@orangelogic/design-system 2.19.0-pr77248.4 → 2.21.0-pr77302.13

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 (49) hide show
  1. package/library/chunks/{asset-link-format.CNLtOgSn.js → asset-link-format.C0CS4yT2.js} +1 -1
  2. package/library/chunks/{color-swatch-group.fL5ADbZF.js → color-swatch-group.CLgR1RVY.js} +3 -3
  3. package/library/chunks/{color-swatch.JL7CbNRm.js → color-swatch.k8v423rv.js} +1 -1
  4. package/library/chunks/{confirm-popover.DwSAxWFi.js → confirm-popover.B5zE9qkC.js} +1 -1
  5. package/library/chunks/{dialog.upIZWR3x.js → dialog.BTGwgvZG.js} +1 -1
  6. package/library/chunks/{file-on-demand.Cb4mtesb.js → file-on-demand.Dbju7eFg.js} +5 -5
  7. package/library/chunks/{folder-select.BsbsjikP.js → folder-select.hyld2fgc.js} +2 -2
  8. package/library/chunks/{image.CRcv0x3Z.js → image.9eUBQRQ0.js} +11 -12
  9. package/library/chunks/{list-editor.BPUsGMW-.js → list-editor.CrErjQdh.js} +1 -1
  10. package/library/chunks/{menu-item.HK2A6RqD.js → menu-item.Dep30IBS.js} +1 -1
  11. package/library/chunks/popup.CiIgTjOV.js +3320 -0
  12. package/library/chunks/{select.DMdl1Kdd.js → select.CWOW4pAr.js} +1 -1
  13. package/library/chunks/{tab-group.3F6gRchD.js → tab-group.C0I_UeKY.js} +1 -1
  14. package/library/chunks/{table.BarE1-gL.js → table.Oco9h8cd.js} +1 -1
  15. package/library/components/asset-link-format.js +1 -1
  16. package/library/components/atoms.js +7 -7
  17. package/library/components/color-picker.js +1 -1
  18. package/library/components/color-swatch-group.js +4 -4
  19. package/library/components/color-swatch.js +2 -2
  20. package/library/components/confirm-popover.js +2 -2
  21. package/library/components/corner-position-input-group.js +1 -1
  22. package/library/components/dialog.js +2 -2
  23. package/library/components/dropdown.js +1 -1
  24. package/library/components/dynamic-select.js +2 -2
  25. package/library/components/file-on-demand.js +6 -6
  26. package/library/components/folder-select.js +2 -2
  27. package/library/components/image.js +3 -4
  28. package/library/components/line-clamp.js +1 -1
  29. package/library/components/list-editor.js +2 -2
  30. package/library/components/masonry.js +1 -1
  31. package/library/components/menu-item.js +2 -2
  32. package/library/components/menu.js +1 -1
  33. package/library/components/molecules.js +4 -4
  34. package/library/components/organisms.js +3 -3
  35. package/library/components/pagination.js +1 -1
  36. package/library/components/popup.js +10 -3297
  37. package/library/components/range.js +1 -1
  38. package/library/components/select.js +2 -2
  39. package/library/components/size-input-group.js +1 -1
  40. package/library/components/tab-group.js +2 -2
  41. package/library/components/table.js +1 -1
  42. package/library/components/tooltip.js +1 -1
  43. package/library/components/types.js +2262 -2333
  44. package/library/components/video.js +1 -1
  45. package/library/package.json +1 -1
  46. package/library/packages/atoms/src/components/popup/popup.d.ts +7 -1
  47. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +0 -8
  48. package/package.json +1 -1
  49. package/library/chunks/debounce.DZNkg8Q5.js +0 -11
@@ -1,3299 +1,12 @@
1
- import { a as _e, i as Vt, r as ze, x as j, n as v, C as Be, c as Ie } from "../chunks/custom-element.fmLrnDZr.js";
2
- import { r as Me } from "../chunks/state.Dt9F_SuS.js";
3
- import { e as ut } from "../chunks/query.BBf1UFkC.js";
4
- import { e as He } from "../chunks/base.D76d76ww.js";
5
- import { o as Tt } from "../chunks/if-defined.CKupVaWs.js";
6
- import { o as se } from "../chunks/style-map.lEJHEwk3.js";
7
- import { i as Lt, p as ne, f as We, a as qe } from "../chunks/browser.Va59Ix3P.js";
8
- import { c as ye } from "../chunks/component.styles.DtouHn2g.js";
9
- import { L as Ve } from "../chunks/i18n.C6c6_pqI.js";
10
- import { e as Dt } from "../chunks/class-map.DqNfBvJI.js";
11
- import { n as Ue } from "../chunks/when.Dr1es41R.js";
12
- /**
13
- * @license
14
- * Copyright 2021 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- function je(e) {
18
- return (t, o) => {
19
- const { slot: i, selector: s } = e ?? {}, r = "slot" + (i ? `[name=${i}]` : ":not([name])");
20
- return He(t, o, { get() {
21
- const n = this.renderRoot?.querySelector(r), a = n?.assignedElements(e) ?? [];
22
- return s === void 0 ? a : a.filter((l) => l.matches(s));
23
- } });
24
- };
25
- }
26
- const re = /* @__PURE__ */ new Set(), Ye = (e) => typeof e.startManagingContentDirection < "u" || e.tagName === "SP-THEME";
27
- function Ke(e) {
28
- class t extends e {
29
- /**
30
- * @private
31
- */
32
- get isLTR() {
33
- return this.dir === "ltr";
34
- }
35
- hasVisibleFocusInTree() {
36
- const s = ((r = document) => {
37
- let n = r.activeElement;
38
- for (; n?.shadowRoot && n.shadowRoot.activeElement; )
39
- n = n.shadowRoot.activeElement;
40
- const a = n ? [n] : [];
41
- for (; n; ) {
42
- const l = n.assignedSlot || n.parentElement || n.getRootNode()?.host;
43
- l && a.push(l), n = l;
44
- }
45
- return a;
46
- })(this.getRootNode())[0];
47
- if (!s)
48
- return !1;
49
- try {
50
- return s.matches(":focus-visible") || s.matches(".focus-visible");
51
- } catch {
52
- return s.matches(".focus-visible");
53
- }
54
- }
55
- connectedCallback() {
56
- if (!this.hasAttribute("dir")) {
57
- let i = this.assignedSlot || this.parentNode;
58
- for (; i !== document.documentElement && !Ye(i); )
59
- i = i.assignedSlot || // step into the shadow DOM of the parent of a slotted node
60
- i.parentNode || // DOM Element detected
61
- i.host;
62
- if (this.dir = i.dir === "rtl" ? i.dir : this.dir || "ltr", i === document.documentElement)
63
- re.add(this);
64
- else {
65
- const { localName: s } = i;
66
- s.search("-") > -1 && !customElements.get(s) ? customElements.whenDefined(s).then(() => {
67
- i.startManagingContentDirection(this);
68
- }) : i.startManagingContentDirection(this);
69
- }
70
- this._dirParent = i;
71
- }
72
- super.connectedCallback();
73
- }
74
- disconnectedCallback() {
75
- super.disconnectedCallback(), this._dirParent && (this._dirParent === document.documentElement ? re.delete(this) : this._dirParent.stopManagingContentDirection(this), this.removeAttribute("dir"));
76
- }
77
- }
78
- return t;
79
- }
80
- class Xe extends Ke(_e) {
81
- }
82
- function Ge(e, t, o) {
83
- const i = e.getAttribute(t);
84
- let s = i ? i.split(/\s+/) : [];
85
- s = s.filter(
86
- (r) => !o.find((n) => r === n)
87
- ), s.length ? e.setAttribute(t, s.join(" ")) : e.removeAttribute(t);
88
- }
89
- function $t(e, t, o) {
90
- const i = Array.isArray(o) ? o : [o], s = e.getAttribute(t), r = s ? s.split(/\s+/) : [];
91
- return i.every((a) => r.indexOf(a) > -1) ? () => {
92
- } : (r.push(...i), e.setAttribute(t, r.join(" ")), () => Ge(e, t, i));
93
- }
94
- function Qe(e, t) {
95
- customElements.get(e) || customElements.define(e, t);
96
- }
97
- function Je(e, t, o = []) {
98
- for (let i = 0; i < t.length; ++i) {
99
- const s = t[i], r = e[i], n = r.parentElement || r.getRootNode();
100
- o[i] && o[i](s), n && n !== r && n.replaceChild(s, r), delete e[i];
101
- }
102
- return t;
103
- }
104
- const Ze = (e, t, {
105
- position: o,
106
- prepareCallback: i
107
- } = { position: "beforeend" }) => {
108
- let { length: s } = e;
109
- if (s === 0)
110
- return () => e;
111
- let r = 1, n = 0;
112
- (o === "afterbegin" || o === "afterend") && (r = -1, n = s - 1);
113
- const a = new Array(s), l = new Array(s), c = document.createComment(
114
- "placeholder for reparented element"
115
- );
116
- do {
117
- const h = e[n];
118
- i && (l[n] = i(h)), a[n] = c.cloneNode();
119
- const d = h.parentElement || h.getRootNode();
120
- d && d !== h && d.replaceChild(a[n], h), t.insertAdjacentElement(o, h), n += r;
121
- } while (--s > 0);
122
- return function() {
123
- return Je(a, e, l);
124
- };
125
- };
126
- function Ut() {
127
- return Array.from(
128
- crypto.getRandomValues(new Uint8Array(4)),
129
- (e) => `0${(e & 255).toString(16)}`.slice(-2)
130
- ).join("");
131
- }
132
- const ti = [
133
- "button",
134
- "[focusable]",
135
- "[href]",
136
- "input",
137
- "label",
138
- "select",
139
- "textarea",
140
- "[tabindex]"
141
- ], ae = ':not([tabindex="-1"])', ft = ti.join(`${ae}, `) + ae, jt = (e) => e.querySelector(
142
- ft
143
- ), Yt = (e) => e.assignedElements().find(
144
- (o) => o.matches(ft)
145
- );
146
- function ei(e) {
147
- return typeof window < "u" && window.navigator != null ? e.test(window.navigator.userAgent) : !1;
148
- }
149
- function Kt(e) {
150
- return typeof window < "u" && window.navigator != null ? e.test(window.navigator.platform) : !1;
151
- }
152
- function ii() {
153
- return Kt(/^Mac/);
154
- }
155
- function oi() {
156
- return Kt(/^iPhone/);
157
- }
158
- function si() {
159
- return Kt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
160
- ii() && navigator.maxTouchPoints > 1;
161
- }
162
- function ni() {
163
- return oi() || si();
164
- }
165
- function ri() {
166
- return ei(/Android/);
167
- }
168
- const ai = 1e3, li = 1e3;
169
- class ci {
170
- constructor(t = {}) {
171
- this.warmUpDelay = ai, this.coolDownDelay = li, this.isWarm = !1, this.timeout = 0, Object.assign(this, t);
172
- }
173
- async openTimer(t) {
174
- if (this.cancelCooldownTimer(), !this.component || t !== this.component)
175
- return this.component && (this.close(this.component), this.cancelCooldownTimer()), this.component = t, this.isWarm ? !1 : (this.promise = new Promise((o) => {
176
- this.resolve = o, this.timeout = window.setTimeout(() => {
177
- this.resolve && (this.resolve(!1), this.isWarm = !0);
178
- }, this.warmUpDelay);
179
- }), this.promise);
180
- if (this.promise)
181
- return this.promise;
182
- throw new Error("Inconsistent state");
183
- }
184
- close(t) {
185
- this.component && this.component === t && (this.resetCooldownTimer(), this.timeout > 0 && (clearTimeout(this.timeout), this.timeout = 0), this.resolve && (this.resolve(!0), delete this.resolve), delete this.promise, delete this.component);
186
- }
187
- resetCooldownTimer() {
188
- this.isWarm && (this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), this.cooldownTimeout = window.setTimeout(() => {
189
- this.isWarm = !1, delete this.cooldownTimeout;
190
- }, this.coolDownDelay));
191
- }
192
- cancelCooldownTimer() {
193
- this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), delete this.cooldownTimeout;
194
- }
195
- }
196
- const bt = new ci(), it = () => {
197
- }, Xt = (e, t, o) => {
198
- const i = new AbortController(), s = /* @__PURE__ */ new Map(), r = () => {
199
- i.abort(), o();
200
- };
201
- let n, a;
202
- const l = requestAnimationFrame(() => {
203
- n = requestAnimationFrame(() => {
204
- a = requestAnimationFrame(() => {
205
- r();
206
- });
207
- });
208
- }), c = (d) => {
209
- d.target === e && (s.set(
210
- d.propertyName,
211
- s.get(d.propertyName) - 1
212
- ), s.get(d.propertyName) || s.delete(d.propertyName), s.size === 0 && r());
213
- }, h = (d) => {
214
- d.target === e && (s.has(d.propertyName) || s.set(d.propertyName, 0), s.set(
215
- d.propertyName,
216
- s.get(d.propertyName) + 1
217
- ), cancelAnimationFrame(l), cancelAnimationFrame(n), cancelAnimationFrame(a));
218
- };
219
- e.addEventListener("transitionrun", h, {
220
- signal: i.signal
221
- }), e.addEventListener("transitionend", c, {
222
- signal: i.signal
223
- }), e.addEventListener("transitioncancel", c, {
224
- signal: i.signal
225
- }), t();
226
- };
227
- function k() {
228
- return new Promise((e) => requestAnimationFrame(() => e()));
229
- }
230
- class ht extends Xe {
231
- constructor() {
232
- super(...arguments), this.dispose = it, this.offset = 0, this.willPreventClose = !1;
233
- }
234
- async applyFocus(t, o) {
235
- }
236
- /* c8 ignore next 6 */
237
- get delayed() {
238
- return !1;
239
- }
240
- set delayed(t) {
241
- }
242
- /* c8 ignore next 6 */
243
- get disabled() {
244
- return !1;
245
- }
246
- set disabled(t) {
247
- }
248
- get elementResolver() {
249
- return this._elementResolver;
250
- }
251
- set elementResolver(t) {
252
- this._elementResolver = t;
253
- }
254
- /* c8 ignore next 3 */
255
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
256
- async ensureOnDOM(t) {
257
- }
258
- /* c8 ignore next 5 */
259
- async makeTransition(t) {
260
- return null;
261
- }
262
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
263
- async manageDelay(t) {
264
- }
265
- /* c8 ignore next 3 */
266
- async manageDialogOpen() {
267
- }
268
- /* c8 ignore next 3 */
269
- async managePopoverOpen() {
270
- }
271
- /* c8 ignore next 3 */
272
- managePosition() {
273
- }
274
- /* c8 ignore next 6 */
275
- get open() {
276
- return !1;
277
- }
278
- set open(t) {
279
- }
280
- get placementController() {
281
- return this._placementController;
282
- }
283
- set placementController(t) {
284
- this._placementController = t;
285
- }
286
- requestSlottable() {
287
- }
288
- returnFocus() {
289
- }
290
- /* c8 ignore next 6 */
291
- get state() {
292
- return "closed";
293
- }
294
- set state(t) {
295
- }
296
- /* c8 ignore next 3 */
297
- manuallyKeepOpen() {
298
- }
299
- static update() {
300
- const t = new CustomEvent("cx-update-overlays", {
301
- bubbles: !0,
302
- cancelable: !0,
303
- composed: !0
304
- });
305
- document.dispatchEvent(t);
306
- }
307
- static async open(t, o, i, s) {
308
- await Promise.resolve().then(() => Ne);
309
- const r = arguments.length === 2, n = i || t, a = new this();
310
- let l = !1;
311
- a.dispose = () => {
312
- a.addEventListener("cx-closed", () => {
313
- l || (c(), l = !0), requestAnimationFrame(() => {
314
- a.remove();
315
- });
316
- }), a.open = !1, a.dispose = it;
317
- };
318
- const c = Ze([n], a, {
319
- position: "beforeend",
320
- prepareCallback: (u) => {
321
- const p = u.slot;
322
- return u.removeAttribute("slot"), () => {
323
- u.slot = p;
324
- };
325
- }
326
- });
327
- if (!r && n && s) {
328
- const u = t, p = o, f = s;
329
- return ht.applyOptions(a, {
330
- ...f,
331
- delayed: f.delayed || n.hasAttribute("delayed"),
332
- trigger: f.virtualTrigger || u,
333
- type: p === "modal" ? "modal" : p === "hover" ? "hint" : "auto"
334
- }), u.insertAdjacentElement("afterend", a), await a.updateComplete, a.open = !0, a.dispose;
335
- }
336
- const d = o;
337
- return a.append(n), ht.applyOptions(a, {
338
- ...d,
339
- delayed: d.delayed || n.hasAttribute("delayed")
340
- }), a.updateComplete.then(() => {
341
- a.open = !0;
342
- }), a;
343
- }
344
- static applyOptions(t, o) {
345
- t.delayed = !!o.delayed, t.receivesFocus = o.receivesFocus ?? "auto", t.triggerElement = o.trigger || null, t.type = o.type || "modal", t.offset = o.offset ?? 0, t.placement = o.placement, t.willPreventClose = !!o.notImmediatelyClosable;
346
- }
347
- }
348
- const ve = Symbol("element resolver updated");
349
- class hi {
350
- constructor(t, { selector: o } = { selector: "" }) {
351
- this._element = null, this._selector = "", this.mutationCallback = (i) => {
352
- let s = !1;
353
- i.forEach((r) => {
354
- if (!s) {
355
- if (r.type === "childList") {
356
- const n = this.element && [...r.removedNodes].includes(this.element), a = !!this.selector && [...r.addedNodes].some(
357
- this.elementIsSelected
358
- );
359
- s = s || n || a;
360
- }
361
- if (r.type === "attributes") {
362
- const n = r.target === this.element, a = !!this.selector && this.elementIsSelected(r.target);
363
- s = s || n || a;
364
- }
365
- }
366
- }), s && this.resolveElement();
367
- }, this.elementIsSelected = (i) => this.selectorIsId ? i?.id === this.selectorAsId : i?.matches?.(this.selector), this.host = t, this.selector = o, this.observer = new MutationObserver(this.mutationCallback), this.host.addController(this);
368
- }
369
- get element() {
370
- return this._element;
371
- }
372
- set element(t) {
373
- if (t === this.element)
374
- return;
375
- const o = this.element;
376
- this._element = t, this.host.requestUpdate(ve, o);
377
- }
378
- get selector() {
379
- return this._selector;
380
- }
381
- set selector(t) {
382
- t !== this.selector && (this.releaseElement(), this._selector = t, this.resolveElement());
383
- }
384
- get selectorAsId() {
385
- return this.selector.slice(1);
386
- }
387
- get selectorIsId() {
388
- return !!this.selector && this.selector.startsWith("#");
389
- }
390
- hostConnected() {
391
- this.resolveElement(), this.observer.observe(this.host.getRootNode(), {
392
- attributes: !0,
393
- childList: !0,
394
- subtree: !0
395
- });
396
- }
397
- hostDisconnected() {
398
- this.releaseElement(), this.observer.disconnect();
399
- }
400
- resolveElement() {
401
- if (!this.selector) {
402
- this.releaseElement();
403
- return;
404
- }
405
- const t = this.host.getRootNode();
406
- this.element = this.selectorIsId ? t.getElementById(this.selectorAsId) : t.querySelector(this.selector);
407
- }
408
- releaseElement() {
409
- this.element = null;
410
- }
411
- }
412
- class Gt extends Event {
413
- constructor() {
414
- super("beforetoggle", {
415
- bubbles: !1,
416
- composed: !1
417
- }), this.currentState = "open", this.newState = "closed";
418
- }
419
- }
420
- class Qt extends Event {
421
- constructor() {
422
- super("beforetoggle", {
423
- bubbles: !1,
424
- composed: !1
425
- }), this.currentState = "closed", this.newState = "open";
426
- }
427
- }
428
- class _ extends Event {
429
- constructor(t, o, {
430
- interaction: i,
431
- publish: s,
432
- reason: r
433
- }) {
434
- super(t, {
435
- bubbles: s,
436
- composed: s
437
- }), this.overlay = o, this.detail = {
438
- interaction: i,
439
- reason: r
440
- };
441
- }
442
- }
443
- class Pt {
444
- constructor(t, o) {
445
- this.x = 0, this.y = 0, this.x = t, this.y = o;
446
- }
447
- updateBoundingClientRect(t, o) {
448
- this.x = t, this.y = o, ht.update();
449
- }
450
- getBoundingClientRect() {
451
- return {
452
- bottom: this.y,
453
- height: 0,
454
- left: this.x,
455
- right: this.x,
456
- /* c8 ignore next 3 */
457
- toJSON() {
458
- },
459
- top: this.y,
460
- width: 0,
461
- x: this.x,
462
- y: this.y
463
- };
464
- }
465
- }
466
- function di(e) {
467
- class t extends e {
468
- async manageDialogOpen() {
469
- const i = this.open;
470
- if (await this.managePosition(), this.open !== i)
471
- return;
472
- const s = await this.dialogMakeTransition(i);
473
- this.open === i && await this.dialogApplyFocus(i, s);
474
- }
475
- async dialogMakeTransition(i) {
476
- let s = null;
477
- const r = (a, l) => async () => {
478
- if (a.open = i, !i) {
479
- const h = () => {
480
- a.removeEventListener("close", h);
481
- };
482
- a.addEventListener("close", h);
483
- }
484
- if (l > 0)
485
- return;
486
- const c = i ? Qt : Gt;
487
- this.dispatchEvent(new c()), i && (a.matches(ft) && (s = a), s = s || jt(a), s || a.querySelectorAll("slot").forEach((d) => {
488
- s || (s = Yt(d));
489
- }), !(!this.isConnected || this.dialogEl.open) && this.dialogEl.showModal());
490
- }, n = (a, l) => () => {
491
- if (this.open !== i)
492
- return;
493
- const c = i ? "cx-opened" : "cx-closed";
494
- if (l > 0) {
495
- a.dispatchEvent(
496
- new _(c, this, {
497
- interaction: this.type,
498
- publish: !1
499
- })
500
- );
501
- return;
502
- }
503
- if (!this.isConnected || i !== this.open)
504
- return;
505
- const h = async () => {
506
- const d = this.triggerElement instanceof Pt;
507
- this.dispatchEvent(
508
- new _(c, this, {
509
- interaction: this.type,
510
- publish: d
511
- })
512
- ), a.dispatchEvent(
513
- new _(c, this, {
514
- interaction: this.type,
515
- publish: !1
516
- })
517
- ), this.triggerElement && !d && this.triggerElement.dispatchEvent(
518
- new _(c, this, {
519
- interaction: this.type,
520
- publish: !0
521
- })
522
- ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
523
- };
524
- !i && this.dialogEl.open ? (this.dialogEl.addEventListener(
525
- "close",
526
- () => {
527
- h();
528
- },
529
- { once: !0 }
530
- ), this.dialogEl.close()) : h();
531
- };
532
- return this.elements.forEach((a, l) => {
533
- Xt(a, r(a, l), n(a, l));
534
- }), s;
535
- }
536
- async dialogApplyFocus(i, s) {
537
- this.applyFocus(i, s);
538
- }
539
- }
540
- return t;
541
- }
542
- function pi(e) {
543
- class t extends e {
544
- async managePopoverOpen() {
545
- await this.managePosition();
546
- }
547
- async manageDelay(i) {
548
- if (i === !1 || i !== this.open) {
549
- bt.close(this);
550
- return;
551
- }
552
- this.delayed && await bt.openTimer(this) && (this.open = !i);
553
- }
554
- async ensureOnDOM(i) {
555
- document.body.offsetHeight;
556
- }
557
- async makeTransition(i) {
558
- if (this.open !== i)
559
- return null;
560
- let s = null;
561
- const r = (a, l) => () => {
562
- if (i !== this.open)
563
- return;
564
- if (a.open = i, l === 0) {
565
- const h = i ? Qt : Gt;
566
- this.dispatchEvent(new h());
567
- }
568
- if (i !== !0 || (a.matches(ft) && (s = a), s = s || jt(a), s))
569
- return;
570
- a.querySelectorAll("slot").forEach((h) => {
571
- s || (s = Yt(h));
572
- });
573
- }, n = (a, l) => async () => {
574
- if (this.open !== i)
575
- return;
576
- const c = i ? "cx-opened" : "cx-closed";
577
- if (a.dispatchEvent(
578
- new _(c, this, {
579
- interaction: this.type
580
- })
581
- ), l > 0)
582
- return;
583
- const h = this.triggerElement instanceof Pt;
584
- this.dispatchEvent(
585
- new _(c, this, {
586
- interaction: this.type,
587
- publish: h
588
- })
589
- ), this.triggerElement && !h && this.triggerElement.dispatchEvent(
590
- new _(c, this, {
591
- interaction: this.type,
592
- publish: !0
593
- })
594
- ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
595
- };
596
- return this.elements.forEach((a, l) => {
597
- Xt(a, r(a, l), n(a, l));
598
- }), s;
599
- }
600
- }
601
- return t;
602
- }
603
- const ui = CSS.supports("(overlay: auto)");
604
- function kt(e) {
605
- let t = !1;
606
- try {
607
- t = e.matches(":popover-open");
608
- } catch {
609
- }
610
- let o = !1;
611
- try {
612
- o = e.matches(":open");
613
- } catch {
614
- }
615
- return t || o;
616
- }
617
- function fi(e) {
618
- class t extends e {
619
- constructor(...i) {
620
- super(...i), this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
621
- }
622
- async manageDelay(i) {
623
- if (i === !1 || i !== this.open) {
624
- bt.close(this);
625
- return;
626
- }
627
- this.delayed && await bt.openTimer(this) && (this.open = !i);
628
- }
629
- /**
630
- * A popover should be hidden _after_ it is no longer on top-layer because
631
- * the position metrics will have changed from when it was originally positioned.
632
- */
633
- async shouldHidePopover(i) {
634
- if (i && this.open !== i)
635
- return;
636
- const s = async ({
637
- newState: r
638
- } = {}) => {
639
- r !== "open" && await this.placementController.resetOverlayPosition();
640
- };
641
- if (!kt(this.dialogEl)) {
642
- s();
643
- return;
644
- }
645
- this.dialogEl.addEventListener("toggle", s, {
646
- once: !0
647
- });
648
- }
649
- async shouldShowPopover(i) {
650
- let s = !1;
651
- try {
652
- s = this.dialogEl.matches(":popover-open");
653
- } catch {
654
- }
655
- let r = !1;
656
- try {
657
- r = this.dialogEl.matches(":open");
658
- } catch {
659
- }
660
- i && this.open === i && !s && !r && this.isConnected && (this.dialogEl.showPopover(), await this.managePosition());
661
- }
662
- handleFullscreenChange() {
663
- kt(this.dialogEl) && (this.dialogEl.hidePopover(), this.dialogEl.showPopover());
664
- }
665
- firstUpdated(i) {
666
- super.firstUpdated(i), Lt() && (k().then(() => {
667
- this.dialogEl.showPopover();
668
- }), document.addEventListener(
669
- "fullscreenchange",
670
- this.handleFullscreenChange
671
- ));
672
- }
673
- disconnectedCallback() {
674
- super.disconnectedCallback(), Lt() && document.removeEventListener(
675
- "fullscreenchange",
676
- this.handleFullscreenChange
677
- );
678
- }
679
- async ensureOnDOM(i) {
680
- await k(), ui || await this.shouldHidePopover(i), await this.shouldShowPopover(i), await k();
681
- }
682
- async makeTransition(i) {
683
- if (this.open !== i)
684
- return null;
685
- let s = null;
686
- const r = (a, l) => () => {
687
- if (a.open = i, l === 0) {
688
- const h = i ? Qt : Gt;
689
- this.dispatchEvent(new h());
690
- }
691
- if (!i || (a.matches(ft) && (s = a), s = s || jt(a), s))
692
- return;
693
- a.querySelectorAll("slot").forEach((h) => {
694
- s || (s = Yt(h));
695
- });
696
- }, n = (a, l) => async () => {
697
- if (this.open !== i)
698
- return;
699
- const c = i ? "cx-opened" : "cx-closed";
700
- if (l > 0) {
701
- a.dispatchEvent(
702
- new _(c, this, {
703
- interaction: this.type,
704
- publish: !1
705
- })
706
- );
707
- return;
708
- }
709
- const h = async () => {
710
- if (this.open !== i)
711
- return;
712
- await k();
713
- const u = this.triggerElement instanceof Pt;
714
- this.dispatchEvent(
715
- new _(c, this, {
716
- interaction: this.type,
717
- publish: u
718
- })
719
- ), a.dispatchEvent(
720
- new _(c, this, {
721
- interaction: this.type,
722
- publish: !1
723
- })
724
- ), this.triggerElement && !u && this.triggerElement.dispatchEvent(
725
- new _(c, this, {
726
- interaction: this.type,
727
- publish: !0
728
- })
729
- ), this.state = i ? "opened" : "closed", this.returnFocus(), await k(), await k(), i === this.open && i === !1 && this.requestSlottable();
730
- };
731
- if (this.open !== i)
732
- return;
733
- const d = kt(this.dialogEl);
734
- i !== !0 && d && this.isConnected ? (this.dialogEl.addEventListener(
735
- "beforetoggle",
736
- () => {
737
- h();
738
- },
739
- { once: !0 }
740
- ), Lt() || this.dialogEl.hidePopover()) : h();
741
- };
742
- return this.elements.forEach((a, l) => {
743
- Xt(a, r(a, l), n(a, l));
744
- }), s;
745
- }
746
- }
747
- return t;
748
- }
749
- const gi = "showPopover" in document.createElement("div");
750
- class mi {
751
- constructor() {
752
- this.root = document.body, this.stack = [], this.handlePointerdown = (t) => {
753
- this.pointerdownPath = t.composedPath(), this.lastOverlay = this.stack[this.stack.length - 1];
754
- }, this.handlePointerup = () => {
755
- const t = this.pointerdownPath;
756
- if (this.pointerdownPath = void 0, !this.stack.length || !t?.length)
757
- return;
758
- const o = this.stack.length - 1, i = this.stack.filter((s, r) => !t.find(
759
- (a) => (
760
- // The Overlay is in the stack
761
- a === s || // The Overlay trigger is in the stack and the Overlay is a "hint"
762
- a === s?.triggerElement && s?.type === "hint" || // The last Overlay in the stack is not the last Overlay at `pointerdown` time and has a
763
- // `triggerInteraction` of "longpress", meaning it was opened by this poitner interaction
764
- r === o && s !== this.lastOverlay && s.triggerInteraction === "longpress"
765
- )
766
- ) && !s.shouldPreventClose() && s.type !== "manual");
767
- i.reverse(), i.forEach((s) => {
768
- this.closeOverlay(s);
769
- let r = s.parentOverlayToForceClose;
770
- for (; r; )
771
- this.closeOverlay(r), r = r.parentOverlayToForceClose;
772
- });
773
- }, this.handleBeforetoggle = (t) => {
774
- const { newState: o, target: i } = t;
775
- o !== "open" && this.closeOverlay(i);
776
- }, this.handleKeydown = (t) => {
777
- if (t.code !== "Escape" || !this.stack.length)
778
- return;
779
- const o = this.stack[this.stack.length - 1];
780
- if (o?.type === "page") {
781
- t.preventDefault();
782
- return;
783
- }
784
- gi || o?.type !== "manual" && o && this.closeOverlay(o);
785
- }, this.bindEvents();
786
- }
787
- get document() {
788
- return this.root?.ownerDocument || document;
789
- }
790
- bindEvents() {
791
- this.document.addEventListener("pointerdown", this.handlePointerdown), this.document.addEventListener("pointerup", this.handlePointerup), this.document.addEventListener("keydown", this.handleKeydown);
792
- }
793
- closeOverlay(t) {
794
- const o = this.stack.indexOf(t);
795
- o > -1 && this.stack.splice(o, 1), t.open = !1;
796
- }
797
- /**
798
- * Get an array of Overlays that all share the same trigger element.
799
- *
800
- * @param triggerElement {HTMLELement}
801
- * @returns {Overlay[]}
802
- */
803
- overlaysByTriggerElement(t) {
804
- return this.stack.filter(
805
- (o) => o.triggerElement === t
806
- );
807
- }
808
- /**
809
- * When overlays are added manage the open state of exisiting overlays appropriately:
810
- * - 'modal': should close other overlays
811
- * - 'page': should close other overlays
812
- * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
813
- * - 'manual': shouldn't close other overlays
814
- * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
815
- */
816
- add(t) {
817
- if (this.stack.includes(t)) {
818
- const o = this.stack.indexOf(t);
819
- o > -1 && (this.stack.splice(o, 1), this.stack.push(t));
820
- return;
821
- }
822
- if (t.type === "auto" || t.type === "modal" || t.type === "page") {
823
- const o = "cx-overlay-query-path", i = new Event(o, {
824
- bubbles: !0,
825
- composed: !0
826
- });
827
- t.addEventListener(
828
- o,
829
- (s) => {
830
- const r = s.composedPath();
831
- this.stack.forEach((n) => {
832
- !r.find((l) => l === n) && n.type !== "manual" && this.closeOverlay(n);
833
- });
834
- },
835
- { once: !0 }
836
- ), t.dispatchEvent(i);
837
- } else if (t.type === "hint") {
838
- if (this.stack.some((i) => i.type !== "manual" && i.triggerElement && i.triggerElement === t.triggerElement)) {
839
- t.open = !1;
840
- return;
841
- }
842
- this.stack.forEach((i) => {
843
- i.type === "hint" && this.closeOverlay(i);
844
- });
845
- }
846
- requestAnimationFrame(() => {
847
- this.stack.push(t), t.addEventListener("beforetoggle", this.handleBeforetoggle, {
848
- once: !0
849
- });
850
- });
851
- }
852
- remove(t) {
853
- this.closeOverlay(t);
854
- }
855
- }
856
- const le = new mi(), yi = ["top", "right", "bottom", "left"], J = Math.min, T = Math.max, wt = Math.round, mt = Math.floor, H = (e) => ({
857
- x: e,
858
- y: e
859
- }), vi = {
860
- left: "right",
861
- right: "left",
862
- bottom: "top",
863
- top: "bottom"
864
- }, bi = {
865
- start: "end",
866
- end: "start"
867
- };
868
- function _t(e, t, o) {
869
- return T(e, J(t, o));
870
- }
871
- function st(e, t) {
872
- return typeof e == "function" ? e(t) : e;
873
- }
874
- function Z(e) {
875
- return e.split("-")[0];
876
- }
877
- function at(e) {
878
- return e.split("-")[1];
879
- }
880
- function be(e) {
881
- return e === "x" ? "y" : "x";
882
- }
883
- function Jt(e) {
884
- return e === "y" ? "height" : "width";
885
- }
886
- const wi = /* @__PURE__ */ new Set(["top", "bottom"]);
887
- function Y(e) {
888
- return wi.has(Z(e)) ? "y" : "x";
889
- }
890
- function Zt(e) {
891
- return be(Y(e));
892
- }
893
- function xi(e, t, o) {
894
- o === void 0 && (o = !1);
895
- const i = at(e), s = Zt(e), r = Jt(s);
896
- let n = s === "x" ? i === (o ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
897
- return t.reference[r] > t.floating[r] && (n = xt(n)), [n, xt(n)];
898
- }
899
- function Ei(e) {
900
- const t = xt(e);
901
- return [zt(e), t, zt(t)];
902
- }
903
- function zt(e) {
904
- return e.replace(/start|end/g, (t) => bi[t]);
905
- }
906
- const ce = ["left", "right"], he = ["right", "left"], Pi = ["top", "bottom"], Ci = ["bottom", "top"];
907
- function Oi(e, t, o) {
908
- switch (e) {
909
- case "top":
910
- case "bottom":
911
- return o ? t ? he : ce : t ? ce : he;
912
- case "left":
913
- case "right":
914
- return t ? Pi : Ci;
915
- default:
916
- return [];
917
- }
918
- }
919
- function Ai(e, t, o, i) {
920
- const s = at(e);
921
- let r = Oi(Z(e), o === "start", i);
922
- return s && (r = r.map((n) => n + "-" + s), t && (r = r.concat(r.map(zt)))), r;
923
- }
924
- function xt(e) {
925
- return e.replace(/left|right|bottom|top/g, (t) => vi[t]);
926
- }
927
- function Si(e) {
928
- return {
929
- top: 0,
930
- right: 0,
931
- bottom: 0,
932
- left: 0,
933
- ...e
934
- };
935
- }
936
- function we(e) {
937
- return typeof e != "number" ? Si(e) : {
938
- top: e,
939
- right: e,
940
- bottom: e,
941
- left: e
942
- };
943
- }
944
- function Et(e) {
945
- const {
946
- x: t,
947
- y: o,
948
- width: i,
949
- height: s
950
- } = e;
951
- return {
952
- width: i,
953
- height: s,
954
- top: o,
955
- left: t,
956
- right: t + i,
957
- bottom: o + s,
958
- x: t,
959
- y: o
960
- };
961
- }
962
- function de(e, t, o) {
963
- let {
964
- reference: i,
965
- floating: s
966
- } = e;
967
- const r = Y(t), n = Zt(t), a = Jt(n), l = Z(t), c = r === "y", h = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
968
- let p;
969
- switch (l) {
970
- case "top":
971
- p = {
972
- x: h,
973
- y: i.y - s.height
974
- };
975
- break;
976
- case "bottom":
977
- p = {
978
- x: h,
979
- y: i.y + i.height
980
- };
981
- break;
982
- case "right":
983
- p = {
984
- x: i.x + i.width,
985
- y: d
986
- };
987
- break;
988
- case "left":
989
- p = {
990
- x: i.x - s.width,
991
- y: d
992
- };
993
- break;
994
- default:
995
- p = {
996
- x: i.x,
997
- y: i.y
998
- };
999
- }
1000
- switch (at(t)) {
1001
- case "start":
1002
- p[n] -= u * (o && c ? -1 : 1);
1003
- break;
1004
- case "end":
1005
- p[n] += u * (o && c ? -1 : 1);
1006
- break;
1007
- }
1008
- return p;
1009
- }
1010
- const Ri = async (e, t, o) => {
1011
- const {
1012
- placement: i = "bottom",
1013
- strategy: s = "absolute",
1014
- middleware: r = [],
1015
- platform: n
1016
- } = o, a = r.filter(Boolean), l = await (n.isRTL == null ? void 0 : n.isRTL(t));
1017
- let c = await n.getElementRects({
1018
- reference: e,
1019
- floating: t,
1020
- strategy: s
1021
- }), {
1022
- x: h,
1023
- y: d
1024
- } = de(c, i, l), u = i, p = {}, f = 0;
1025
- for (let g = 0; g < a.length; g++) {
1026
- const {
1027
- name: m,
1028
- fn: y
1029
- } = a[g], {
1030
- x,
1031
- y: E,
1032
- data: C,
1033
- reset: P
1034
- } = await y({
1035
- x: h,
1036
- y: d,
1037
- initialPlacement: i,
1038
- placement: u,
1039
- strategy: s,
1040
- middlewareData: p,
1041
- rects: c,
1042
- platform: n,
1043
- elements: {
1044
- reference: e,
1045
- floating: t
1046
- }
1047
- });
1048
- h = x ?? h, d = E ?? d, p = {
1049
- ...p,
1050
- [m]: {
1051
- ...p[m],
1052
- ...C
1053
- }
1054
- }, P && f <= 50 && (f++, typeof P == "object" && (P.placement && (u = P.placement), P.rects && (c = P.rects === !0 ? await n.getElementRects({
1055
- reference: e,
1056
- floating: t,
1057
- strategy: s
1058
- }) : P.rects), {
1059
- x: h,
1060
- y: d
1061
- } = de(c, u, l)), g = -1);
1062
- }
1063
- return {
1064
- x: h,
1065
- y: d,
1066
- placement: u,
1067
- strategy: s,
1068
- middlewareData: p
1069
- };
1070
- };
1071
- async function dt(e, t) {
1072
- var o;
1073
- t === void 0 && (t = {});
1074
- const {
1075
- x: i,
1076
- y: s,
1077
- platform: r,
1078
- rects: n,
1079
- elements: a,
1080
- strategy: l
1081
- } = e, {
1082
- boundary: c = "clippingAncestors",
1083
- rootBoundary: h = "viewport",
1084
- elementContext: d = "floating",
1085
- altBoundary: u = !1,
1086
- padding: p = 0
1087
- } = st(t, e), f = we(p), m = a[u ? d === "floating" ? "reference" : "floating" : d], y = Et(await r.getClippingRect({
1088
- element: (o = await (r.isElement == null ? void 0 : r.isElement(m))) == null || o ? m : m.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
1089
- boundary: c,
1090
- rootBoundary: h,
1091
- strategy: l
1092
- })), x = d === "floating" ? {
1093
- x: i,
1094
- y: s,
1095
- width: n.floating.width,
1096
- height: n.floating.height
1097
- } : n.reference, E = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a.floating)), C = await (r.isElement == null ? void 0 : r.isElement(E)) ? await (r.getScale == null ? void 0 : r.getScale(E)) || {
1098
- x: 1,
1099
- y: 1
1100
- } : {
1101
- x: 1,
1102
- y: 1
1103
- }, P = Et(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
1104
- elements: a,
1105
- rect: x,
1106
- offsetParent: E,
1107
- strategy: l
1108
- }) : x);
1109
- return {
1110
- top: (y.top - P.top + f.top) / C.y,
1111
- bottom: (P.bottom - y.bottom + f.bottom) / C.y,
1112
- left: (y.left - P.left + f.left) / C.x,
1113
- right: (P.right - y.right + f.right) / C.x
1114
- };
1115
- }
1116
- const Ti = (e) => ({
1117
- name: "arrow",
1118
- options: e,
1119
- async fn(t) {
1120
- const {
1121
- x: o,
1122
- y: i,
1123
- placement: s,
1124
- rects: r,
1125
- platform: n,
1126
- elements: a,
1127
- middlewareData: l
1128
- } = t, {
1129
- element: c,
1130
- padding: h = 0
1131
- } = st(e, t) || {};
1132
- if (c == null)
1133
- return {};
1134
- const d = we(h), u = {
1135
- x: o,
1136
- y: i
1137
- }, p = Zt(s), f = Jt(p), g = await n.getDimensions(c), m = p === "y", y = m ? "top" : "left", x = m ? "bottom" : "right", E = m ? "clientHeight" : "clientWidth", C = r.reference[f] + r.reference[p] - u[p] - r.floating[f], P = u[p] - r.reference[p], F = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(c));
1138
- let O = F ? F[E] : 0;
1139
- (!O || !await (n.isElement == null ? void 0 : n.isElement(F))) && (O = a.floating[E] || r.floating[f]);
1140
- const V = C / 2 - P / 2, I = O / 2 - g[f] / 2 - 1, D = J(d[y], I), X = J(d[x], I), M = D, G = O - g[f] - X, S = O / 2 - g[f] / 2 + V, et = _t(M, S, G), U = !l.arrow && at(s) != null && S !== et && r.reference[f] / 2 - (S < M ? D : X) - g[f] / 2 < 0, N = U ? S < M ? S - M : S - G : 0;
1141
- return {
1142
- [p]: u[p] + N,
1143
- data: {
1144
- [p]: et,
1145
- centerOffset: S - et - N,
1146
- ...U && {
1147
- alignmentOffset: N
1148
- }
1149
- },
1150
- reset: U
1151
- };
1152
- }
1153
- }), Li = function(e) {
1154
- return e === void 0 && (e = {}), {
1155
- name: "flip",
1156
- options: e,
1157
- async fn(t) {
1158
- var o, i;
1159
- const {
1160
- placement: s,
1161
- middlewareData: r,
1162
- rects: n,
1163
- initialPlacement: a,
1164
- platform: l,
1165
- elements: c
1166
- } = t, {
1167
- mainAxis: h = !0,
1168
- crossAxis: d = !0,
1169
- fallbackPlacements: u,
1170
- fallbackStrategy: p = "bestFit",
1171
- fallbackAxisSideDirection: f = "none",
1172
- flipAlignment: g = !0,
1173
- ...m
1174
- } = st(e, t);
1175
- if ((o = r.arrow) != null && o.alignmentOffset)
1176
- return {};
1177
- const y = Z(s), x = Y(a), E = Z(a) === a, C = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), P = u || (E || !g ? [xt(a)] : Ei(a)), F = f !== "none";
1178
- !u && F && P.push(...Ai(a, g, f, C));
1179
- const O = [a, ...P], V = await dt(t, m), I = [];
1180
- let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
1181
- if (h && I.push(V[y]), d) {
1182
- const S = xi(s, n, C);
1183
- I.push(V[S[0]], V[S[1]]);
1184
- }
1185
- if (D = [...D, {
1186
- placement: s,
1187
- overflows: I
1188
- }], !I.every((S) => S <= 0)) {
1189
- var X, M;
1190
- const S = (((X = r.flip) == null ? void 0 : X.index) || 0) + 1, et = O[S];
1191
- if (et && (!(d === "alignment" ? x !== Y(et) : !1) || // We leave the current main axis only if every placement on that axis
1192
- // overflows the main axis.
1193
- D.every(($) => Y($.placement) === x ? $.overflows[0] > 0 : !0)))
1194
- return {
1195
- data: {
1196
- index: S,
1197
- overflows: D
1198
- },
1199
- reset: {
1200
- placement: et
1201
- }
1202
- };
1203
- let U = (M = D.filter((N) => N.overflows[0] <= 0).sort((N, $) => N.overflows[1] - $.overflows[1])[0]) == null ? void 0 : M.placement;
1204
- if (!U)
1205
- switch (p) {
1206
- case "bestFit": {
1207
- var G;
1208
- const N = (G = D.filter(($) => {
1209
- if (F) {
1210
- const Q = Y($.placement);
1211
- return Q === x || // Create a bias to the `y` side axis due to horizontal
1212
- // reading directions favoring greater width.
1213
- Q === "y";
1214
- }
1215
- return !0;
1216
- }).map(($) => [$.placement, $.overflows.filter((Q) => Q > 0).reduce((Q, $e) => Q + $e, 0)]).sort(($, Q) => $[1] - Q[1])[0]) == null ? void 0 : G[0];
1217
- N && (U = N);
1218
- break;
1219
- }
1220
- case "initialPlacement":
1221
- U = a;
1222
- break;
1223
- }
1224
- if (s !== U)
1225
- return {
1226
- reset: {
1227
- placement: U
1228
- }
1229
- };
1230
- }
1231
- return {};
1232
- }
1233
- };
1234
- };
1235
- function pe(e, t) {
1236
- return {
1237
- top: e.top - t.height,
1238
- right: e.right - t.width,
1239
- bottom: e.bottom - t.height,
1240
- left: e.left - t.width
1241
- };
1242
- }
1243
- function ue(e) {
1244
- return yi.some((t) => e[t] >= 0);
1245
- }
1246
- const Di = function(e) {
1247
- return e === void 0 && (e = {}), {
1248
- name: "hide",
1249
- options: e,
1250
- async fn(t) {
1251
- const {
1252
- rects: o
1253
- } = t, {
1254
- strategy: i = "referenceHidden",
1255
- ...s
1256
- } = st(e, t);
1257
- switch (i) {
1258
- case "referenceHidden": {
1259
- const r = await dt(t, {
1260
- ...s,
1261
- elementContext: "reference"
1262
- }), n = pe(r, o.reference);
1263
- return {
1264
- data: {
1265
- referenceHiddenOffsets: n,
1266
- referenceHidden: ue(n)
1267
- }
1268
- };
1269
- }
1270
- case "escaped": {
1271
- const r = await dt(t, {
1272
- ...s,
1273
- altBoundary: !0
1274
- }), n = pe(r, o.floating);
1275
- return {
1276
- data: {
1277
- escapedOffsets: n,
1278
- escaped: ue(n)
1279
- }
1280
- };
1281
- }
1282
- default:
1283
- return {};
1284
- }
1285
- }
1286
- };
1287
- }, ki = /* @__PURE__ */ new Set(["left", "top"]);
1288
- async function Fi(e, t) {
1289
- const {
1290
- placement: o,
1291
- platform: i,
1292
- elements: s
1293
- } = e, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), n = Z(o), a = at(o), l = Y(o) === "y", c = ki.has(n) ? -1 : 1, h = r && l ? -1 : 1, d = st(t, e);
1294
- let {
1295
- mainAxis: u,
1296
- crossAxis: p,
1297
- alignmentAxis: f
1298
- } = typeof d == "number" ? {
1299
- mainAxis: d,
1300
- crossAxis: 0,
1301
- alignmentAxis: null
1302
- } : {
1303
- mainAxis: d.mainAxis || 0,
1304
- crossAxis: d.crossAxis || 0,
1305
- alignmentAxis: d.alignmentAxis
1306
- };
1307
- return a && typeof f == "number" && (p = a === "end" ? f * -1 : f), l ? {
1308
- x: p * h,
1309
- y: u * c
1310
- } : {
1311
- x: u * c,
1312
- y: p * h
1313
- };
1314
- }
1315
- const Ni = function(e) {
1316
- return e === void 0 && (e = 0), {
1317
- name: "offset",
1318
- options: e,
1319
- async fn(t) {
1320
- var o, i;
1321
- const {
1322
- x: s,
1323
- y: r,
1324
- placement: n,
1325
- middlewareData: a
1326
- } = t, l = await Fi(t, e);
1327
- return n === ((o = a.offset) == null ? void 0 : o.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
1328
- x: s + l.x,
1329
- y: r + l.y,
1330
- data: {
1331
- ...l,
1332
- placement: n
1333
- }
1334
- };
1335
- }
1336
- };
1337
- }, $i = function(e) {
1338
- return e === void 0 && (e = {}), {
1339
- name: "shift",
1340
- options: e,
1341
- async fn(t) {
1342
- const {
1343
- x: o,
1344
- y: i,
1345
- placement: s
1346
- } = t, {
1347
- mainAxis: r = !0,
1348
- crossAxis: n = !1,
1349
- limiter: a = {
1350
- fn: (m) => {
1351
- let {
1352
- x: y,
1353
- y: x
1354
- } = m;
1355
- return {
1356
- x: y,
1357
- y: x
1358
- };
1359
- }
1360
- },
1361
- ...l
1362
- } = st(e, t), c = {
1363
- x: o,
1364
- y: i
1365
- }, h = await dt(t, l), d = Y(Z(s)), u = be(d);
1366
- let p = c[u], f = c[d];
1367
- if (r) {
1368
- const m = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", x = p + h[m], E = p - h[y];
1369
- p = _t(x, p, E);
1370
- }
1371
- if (n) {
1372
- const m = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", x = f + h[m], E = f - h[y];
1373
- f = _t(x, f, E);
1374
- }
1375
- const g = a.fn({
1376
- ...t,
1377
- [u]: p,
1378
- [d]: f
1379
- });
1380
- return {
1381
- ...g,
1382
- data: {
1383
- x: g.x - o,
1384
- y: g.y - i,
1385
- enabled: {
1386
- [u]: r,
1387
- [d]: n
1388
- }
1389
- }
1390
- };
1391
- }
1392
- };
1393
- }, _i = function(e) {
1394
- return e === void 0 && (e = {}), {
1395
- name: "size",
1396
- options: e,
1397
- async fn(t) {
1398
- var o, i;
1399
- const {
1400
- placement: s,
1401
- rects: r,
1402
- platform: n,
1403
- elements: a
1404
- } = t, {
1405
- apply: l = () => {
1406
- },
1407
- ...c
1408
- } = st(e, t), h = await dt(t, c), d = Z(s), u = at(s), p = Y(s) === "y", {
1409
- width: f,
1410
- height: g
1411
- } = r.floating;
1412
- let m, y;
1413
- d === "top" || d === "bottom" ? (m = d, y = u === (await (n.isRTL == null ? void 0 : n.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (y = d, m = u === "end" ? "top" : "bottom");
1414
- const x = g - h.top - h.bottom, E = f - h.left - h.right, C = J(g - h[m], x), P = J(f - h[y], E), F = !t.middlewareData.shift;
1415
- let O = C, V = P;
1416
- if ((o = t.middlewareData.shift) != null && o.enabled.x && (V = E), (i = t.middlewareData.shift) != null && i.enabled.y && (O = x), F && !u) {
1417
- const D = T(h.left, 0), X = T(h.right, 0), M = T(h.top, 0), G = T(h.bottom, 0);
1418
- p ? V = f - 2 * (D !== 0 || X !== 0 ? D + X : T(h.left, h.right)) : O = g - 2 * (M !== 0 || G !== 0 ? M + G : T(h.top, h.bottom));
1419
- }
1420
- await l({
1421
- ...t,
1422
- availableWidth: V,
1423
- availableHeight: O
1424
- });
1425
- const I = await n.getDimensions(a.floating);
1426
- return f !== I.width || g !== I.height ? {
1427
- reset: {
1428
- rects: !0
1429
- }
1430
- } : {};
1431
- }
1432
- };
1433
- };
1434
- function Ct() {
1435
- return typeof window < "u";
1436
- }
1437
- function lt(e) {
1438
- return xe(e) ? (e.nodeName || "").toLowerCase() : "#document";
1439
- }
1440
- function L(e) {
1441
- var t;
1442
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1443
- }
1444
- function q(e) {
1445
- var t;
1446
- return (t = (xe(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1447
- }
1448
- function xe(e) {
1449
- return Ct() ? e instanceof Node || e instanceof L(e).Node : !1;
1450
- }
1451
- function z(e) {
1452
- return Ct() ? e instanceof Element || e instanceof L(e).Element : !1;
1453
- }
1454
- function W(e) {
1455
- return Ct() ? e instanceof HTMLElement || e instanceof L(e).HTMLElement : !1;
1456
- }
1457
- function fe(e) {
1458
- return !Ct() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof L(e).ShadowRoot;
1459
- }
1460
- const zi = /* @__PURE__ */ new Set(["inline", "contents"]);
1461
- function gt(e) {
1462
- const {
1463
- overflow: t,
1464
- overflowX: o,
1465
- overflowY: i,
1466
- display: s
1467
- } = B(e);
1468
- return /auto|scroll|overlay|hidden|clip/.test(t + i + o) && !zi.has(s);
1469
- }
1470
- const Bi = /* @__PURE__ */ new Set(["table", "td", "th"]);
1471
- function Ii(e) {
1472
- return Bi.has(lt(e));
1473
- }
1474
- const Mi = [":popover-open", ":modal"];
1475
- function Ot(e) {
1476
- return Mi.some((t) => {
1477
- try {
1478
- return e.matches(t);
1479
- } catch {
1480
- return !1;
1481
- }
1482
- });
1483
- }
1484
- const Hi = ["transform", "translate", "scale", "rotate", "perspective"], Wi = ["transform", "translate", "scale", "rotate", "perspective", "filter"], qi = ["paint", "layout", "strict", "content"];
1485
- function At(e) {
1486
- const t = te(), o = z(e) ? B(e) : e;
1487
- return Hi.some((i) => o[i] ? o[i] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !t && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !t && (o.filter ? o.filter !== "none" : !1) || Wi.some((i) => (o.willChange || "").includes(i)) || qi.some((i) => (o.contain || "").includes(i));
1488
- }
1489
- function Vi(e) {
1490
- let t = tt(e);
1491
- for (; W(t) && !rt(t); ) {
1492
- if (At(t))
1493
- return t;
1494
- if (Ot(t))
1495
- return null;
1496
- t = tt(t);
1497
- }
1498
- return null;
1499
- }
1500
- function te() {
1501
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1502
- }
1503
- const Ui = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1504
- function rt(e) {
1505
- return Ui.has(lt(e));
1506
- }
1507
- function B(e) {
1508
- return L(e).getComputedStyle(e);
1509
- }
1510
- function St(e) {
1511
- return z(e) ? {
1512
- scrollLeft: e.scrollLeft,
1513
- scrollTop: e.scrollTop
1514
- } : {
1515
- scrollLeft: e.scrollX,
1516
- scrollTop: e.scrollY
1517
- };
1518
- }
1519
- function tt(e) {
1520
- if (lt(e) === "html")
1521
- return e;
1522
- const t = (
1523
- // Step into the shadow DOM of the parent of a slotted node.
1524
- e.assignedSlot || // DOM Element detected.
1525
- e.parentNode || // ShadowRoot detected.
1526
- fe(e) && e.host || // Fallback.
1527
- q(e)
1528
- );
1529
- return fe(t) ? t.host : t;
1530
- }
1531
- function Ee(e) {
1532
- const t = tt(e);
1533
- return rt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : W(t) && gt(t) ? t : Ee(t);
1534
- }
1535
- function pt(e, t, o) {
1536
- var i;
1537
- t === void 0 && (t = []), o === void 0 && (o = !0);
1538
- const s = Ee(e), r = s === ((i = e.ownerDocument) == null ? void 0 : i.body), n = L(s);
1539
- if (r) {
1540
- const a = Bt(n);
1541
- return t.concat(n, n.visualViewport || [], gt(s) ? s : [], a && o ? pt(a) : []);
1542
- }
1543
- return t.concat(s, pt(s, [], o));
1544
- }
1545
- function Bt(e) {
1546
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1547
- }
1548
- function Pe(e) {
1549
- const t = B(e);
1550
- let o = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
1551
- const s = W(e), r = s ? e.offsetWidth : o, n = s ? e.offsetHeight : i, a = wt(o) !== r || wt(i) !== n;
1552
- return a && (o = r, i = n), {
1553
- width: o,
1554
- height: i,
1555
- $: a
1556
- };
1557
- }
1558
- function ee(e) {
1559
- return z(e) ? e : e.contextElement;
1560
- }
1561
- function nt(e) {
1562
- const t = ee(e);
1563
- if (!W(t))
1564
- return H(1);
1565
- const o = t.getBoundingClientRect(), {
1566
- width: i,
1567
- height: s,
1568
- $: r
1569
- } = Pe(t);
1570
- let n = (r ? wt(o.width) : o.width) / i, a = (r ? wt(o.height) : o.height) / s;
1571
- return (!n || !Number.isFinite(n)) && (n = 1), (!a || !Number.isFinite(a)) && (a = 1), {
1572
- x: n,
1573
- y: a
1574
- };
1575
- }
1576
- const ji = /* @__PURE__ */ H(0);
1577
- function Ce(e) {
1578
- const t = L(e);
1579
- return !te() || !t.visualViewport ? ji : {
1580
- x: t.visualViewport.offsetLeft,
1581
- y: t.visualViewport.offsetTop
1582
- };
1583
- }
1584
- function Yi(e, t, o) {
1585
- return t === void 0 && (t = !1), !o || t && o !== L(e) ? !1 : t;
1586
- }
1587
- function ot(e, t, o, i) {
1588
- t === void 0 && (t = !1), o === void 0 && (o = !1);
1589
- const s = e.getBoundingClientRect(), r = ee(e);
1590
- let n = H(1);
1591
- t && (i ? z(i) && (n = nt(i)) : n = nt(e));
1592
- const a = Yi(r, o, i) ? Ce(r) : H(0);
1593
- let l = (s.left + a.x) / n.x, c = (s.top + a.y) / n.y, h = s.width / n.x, d = s.height / n.y;
1594
- if (r) {
1595
- const u = L(r), p = i && z(i) ? L(i) : i;
1596
- let f = u, g = Bt(f);
1597
- for (; g && i && p !== f; ) {
1598
- const m = nt(g), y = g.getBoundingClientRect(), x = B(g), E = y.left + (g.clientLeft + parseFloat(x.paddingLeft)) * m.x, C = y.top + (g.clientTop + parseFloat(x.paddingTop)) * m.y;
1599
- l *= m.x, c *= m.y, h *= m.x, d *= m.y, l += E, c += C, f = L(g), g = Bt(f);
1600
- }
1601
- }
1602
- return Et({
1603
- width: h,
1604
- height: d,
1605
- x: l,
1606
- y: c
1607
- });
1608
- }
1609
- function ie(e, t) {
1610
- const o = St(e).scrollLeft;
1611
- return t ? t.left + o : ot(q(e)).left + o;
1612
- }
1613
- function Oe(e, t, o) {
1614
- o === void 0 && (o = !1);
1615
- const i = e.getBoundingClientRect(), s = i.left + t.scrollLeft - (o ? 0 : (
1616
- // RTL <body> scrollbar.
1617
- ie(e, i)
1618
- )), r = i.top + t.scrollTop;
1619
- return {
1620
- x: s,
1621
- y: r
1622
- };
1623
- }
1624
- function Ki(e) {
1625
- let {
1626
- elements: t,
1627
- rect: o,
1628
- offsetParent: i,
1629
- strategy: s
1630
- } = e;
1631
- const r = s === "fixed", n = q(i), a = t ? Ot(t.floating) : !1;
1632
- if (i === n || a && r)
1633
- return o;
1634
- let l = {
1635
- scrollLeft: 0,
1636
- scrollTop: 0
1637
- }, c = H(1);
1638
- const h = H(0), d = W(i);
1639
- if ((d || !d && !r) && ((lt(i) !== "body" || gt(n)) && (l = St(i)), W(i))) {
1640
- const p = ot(i);
1641
- c = nt(i), h.x = p.x + i.clientLeft, h.y = p.y + i.clientTop;
1642
- }
1643
- const u = n && !d && !r ? Oe(n, l, !0) : H(0);
1644
- return {
1645
- width: o.width * c.x,
1646
- height: o.height * c.y,
1647
- x: o.x * c.x - l.scrollLeft * c.x + h.x + u.x,
1648
- y: o.y * c.y - l.scrollTop * c.y + h.y + u.y
1649
- };
1650
- }
1651
- function Xi(e) {
1652
- return Array.from(e.getClientRects());
1653
- }
1654
- function Gi(e) {
1655
- const t = q(e), o = St(e), i = e.ownerDocument.body, s = T(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = T(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
1656
- let n = -o.scrollLeft + ie(e);
1657
- const a = -o.scrollTop;
1658
- return B(i).direction === "rtl" && (n += T(t.clientWidth, i.clientWidth) - s), {
1659
- width: s,
1660
- height: r,
1661
- x: n,
1662
- y: a
1663
- };
1664
- }
1665
- function Qi(e, t) {
1666
- const o = L(e), i = q(e), s = o.visualViewport;
1667
- let r = i.clientWidth, n = i.clientHeight, a = 0, l = 0;
1668
- if (s) {
1669
- r = s.width, n = s.height;
1670
- const c = te();
1671
- (!c || c && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
1672
- }
1673
- return {
1674
- width: r,
1675
- height: n,
1676
- x: a,
1677
- y: l
1678
- };
1679
- }
1680
- const Ji = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1681
- function Zi(e, t) {
1682
- const o = ot(e, !0, t === "fixed"), i = o.top + e.clientTop, s = o.left + e.clientLeft, r = W(e) ? nt(e) : H(1), n = e.clientWidth * r.x, a = e.clientHeight * r.y, l = s * r.x, c = i * r.y;
1683
- return {
1684
- width: n,
1685
- height: a,
1686
- x: l,
1687
- y: c
1688
- };
1689
- }
1690
- function ge(e, t, o) {
1691
- let i;
1692
- if (t === "viewport")
1693
- i = Qi(e, o);
1694
- else if (t === "document")
1695
- i = Gi(q(e));
1696
- else if (z(t))
1697
- i = Zi(t, o);
1698
- else {
1699
- const s = Ce(e);
1700
- i = {
1701
- x: t.x - s.x,
1702
- y: t.y - s.y,
1703
- width: t.width,
1704
- height: t.height
1705
- };
1706
- }
1707
- return Et(i);
1708
- }
1709
- function Ae(e, t) {
1710
- const o = tt(e);
1711
- return o === t || !z(o) || rt(o) ? !1 : B(o).position === "fixed" || Ae(o, t);
1712
- }
1713
- function to(e, t) {
1714
- const o = t.get(e);
1715
- if (o)
1716
- return o;
1717
- let i = pt(e, [], !1).filter((a) => z(a) && lt(a) !== "body"), s = null;
1718
- const r = B(e).position === "fixed";
1719
- let n = r ? tt(e) : e;
1720
- for (; z(n) && !rt(n); ) {
1721
- const a = B(n), l = At(n);
1722
- !l && a.position === "fixed" && (s = null), (r ? !l && !s : !l && a.position === "static" && !!s && Ji.has(s.position) || gt(n) && !l && Ae(e, n)) ? i = i.filter((h) => h !== n) : s = a, n = tt(n);
1723
- }
1724
- return t.set(e, i), i;
1725
- }
1726
- function eo(e) {
1727
- let {
1728
- element: t,
1729
- boundary: o,
1730
- rootBoundary: i,
1731
- strategy: s
1732
- } = e;
1733
- const n = [...o === "clippingAncestors" ? Ot(t) ? [] : to(t, this._c) : [].concat(o), i], a = n[0], l = n.reduce((c, h) => {
1734
- const d = ge(t, h, s);
1735
- return c.top = T(d.top, c.top), c.right = J(d.right, c.right), c.bottom = J(d.bottom, c.bottom), c.left = T(d.left, c.left), c;
1736
- }, ge(t, a, s));
1737
- return {
1738
- width: l.right - l.left,
1739
- height: l.bottom - l.top,
1740
- x: l.left,
1741
- y: l.top
1742
- };
1743
- }
1744
- function io(e) {
1745
- const {
1746
- width: t,
1747
- height: o
1748
- } = Pe(e);
1749
- return {
1750
- width: t,
1751
- height: o
1752
- };
1753
- }
1754
- function oo(e, t, o) {
1755
- const i = W(t), s = q(t), r = o === "fixed", n = ot(e, !0, r, t);
1756
- let a = {
1757
- scrollLeft: 0,
1758
- scrollTop: 0
1759
- };
1760
- const l = H(0);
1761
- function c() {
1762
- l.x = ie(s);
1763
- }
1764
- if (i || !i && !r)
1765
- if ((lt(t) !== "body" || gt(s)) && (a = St(t)), i) {
1766
- const p = ot(t, !0, r, t);
1767
- l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
1768
- } else s && c();
1769
- r && !i && s && c();
1770
- const h = s && !i && !r ? Oe(s, a) : H(0), d = n.left + a.scrollLeft - l.x - h.x, u = n.top + a.scrollTop - l.y - h.y;
1771
- return {
1772
- x: d,
1773
- y: u,
1774
- width: n.width,
1775
- height: n.height
1776
- };
1777
- }
1778
- function Ft(e) {
1779
- return B(e).position === "static";
1780
- }
1781
- function me(e, t) {
1782
- if (!W(e) || B(e).position === "fixed")
1783
- return null;
1784
- if (t)
1785
- return t(e);
1786
- let o = e.offsetParent;
1787
- return q(e) === o && (o = o.ownerDocument.body), o;
1788
- }
1789
- function Se(e, t) {
1790
- const o = L(e);
1791
- if (Ot(e))
1792
- return o;
1793
- if (!W(e)) {
1794
- let s = tt(e);
1795
- for (; s && !rt(s); ) {
1796
- if (z(s) && !Ft(s))
1797
- return s;
1798
- s = tt(s);
1799
- }
1800
- return o;
1801
- }
1802
- let i = me(e, t);
1803
- for (; i && Ii(i) && Ft(i); )
1804
- i = me(i, t);
1805
- return i && rt(i) && Ft(i) && !At(i) ? o : i || Vi(e) || o;
1806
- }
1807
- const so = async function(e) {
1808
- const t = this.getOffsetParent || Se, o = this.getDimensions, i = await o(e.floating);
1809
- return {
1810
- reference: oo(e.reference, await t(e.floating), e.strategy),
1811
- floating: {
1812
- x: 0,
1813
- y: 0,
1814
- width: i.width,
1815
- height: i.height
1816
- }
1817
- };
1818
- };
1819
- function no(e) {
1820
- return B(e).direction === "rtl";
1821
- }
1822
- const It = {
1823
- convertOffsetParentRelativeRectToViewportRelativeRect: Ki,
1824
- getDocumentElement: q,
1825
- getClippingRect: eo,
1826
- getOffsetParent: Se,
1827
- getElementRects: so,
1828
- getClientRects: Xi,
1829
- getDimensions: io,
1830
- getScale: nt,
1831
- isElement: z,
1832
- isRTL: no
1833
- };
1834
- function Re(e, t) {
1835
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1836
- }
1837
- function ro(e, t) {
1838
- let o = null, i;
1839
- const s = q(e);
1840
- function r() {
1841
- var a;
1842
- clearTimeout(i), (a = o) == null || a.disconnect(), o = null;
1843
- }
1844
- function n(a, l) {
1845
- a === void 0 && (a = !1), l === void 0 && (l = 1), r();
1846
- const c = e.getBoundingClientRect(), {
1847
- left: h,
1848
- top: d,
1849
- width: u,
1850
- height: p
1851
- } = c;
1852
- if (a || t(), !u || !p)
1853
- return;
1854
- const f = mt(d), g = mt(s.clientWidth - (h + u)), m = mt(s.clientHeight - (d + p)), y = mt(h), E = {
1855
- rootMargin: -f + "px " + -g + "px " + -m + "px " + -y + "px",
1856
- threshold: T(0, J(1, l)) || 1
1857
- };
1858
- let C = !0;
1859
- function P(F) {
1860
- const O = F[0].intersectionRatio;
1861
- if (O !== l) {
1862
- if (!C)
1863
- return n();
1864
- O ? n(!1, O) : i = setTimeout(() => {
1865
- n(!1, 1e-7);
1866
- }, 1e3);
1867
- }
1868
- O === 1 && !Re(c, e.getBoundingClientRect()) && n(), C = !1;
1869
- }
1870
- try {
1871
- o = new IntersectionObserver(P, {
1872
- ...E,
1873
- // Handle <iframe>s
1874
- root: s.ownerDocument
1875
- });
1876
- } catch {
1877
- o = new IntersectionObserver(P, E);
1878
- }
1879
- o.observe(e);
1880
- }
1881
- return n(!0), r;
1882
- }
1883
- function Mt(e, t, o, i) {
1884
- i === void 0 && (i = {});
1885
- const {
1886
- ancestorScroll: s = !0,
1887
- ancestorResize: r = !0,
1888
- elementResize: n = typeof ResizeObserver == "function",
1889
- layoutShift: a = typeof IntersectionObserver == "function",
1890
- animationFrame: l = !1
1891
- } = i, c = ee(e), h = s || r ? [...c ? pt(c) : [], ...pt(t)] : [];
1892
- h.forEach((y) => {
1893
- s && y.addEventListener("scroll", o, {
1894
- passive: !0
1895
- }), r && y.addEventListener("resize", o);
1896
- });
1897
- const d = c && a ? ro(c, o) : null;
1898
- let u = -1, p = null;
1899
- n && (p = new ResizeObserver((y) => {
1900
- let [x] = y;
1901
- x && x.target === c && p && (p.unobserve(t), cancelAnimationFrame(u), u = requestAnimationFrame(() => {
1902
- var E;
1903
- (E = p) == null || E.observe(t);
1904
- })), o();
1905
- }), c && !l && p.observe(c), p.observe(t));
1906
- let f, g = l ? ot(e) : null;
1907
- l && m();
1908
- function m() {
1909
- const y = ot(e);
1910
- g && !Re(g, y) && o(), g = y, f = requestAnimationFrame(m);
1911
- }
1912
- return o(), () => {
1913
- var y;
1914
- h.forEach((x) => {
1915
- s && x.removeEventListener("scroll", o), r && x.removeEventListener("resize", o);
1916
- }), d?.(), (y = p) == null || y.disconnect(), p = null, l && cancelAnimationFrame(f);
1917
- };
1918
- }
1919
- const Ht = Ni, Te = $i, Wt = Li, qt = _i, ao = Di, Le = Ti, De = (e, t, o) => {
1920
- const i = /* @__PURE__ */ new Map(), s = {
1921
- platform: It,
1922
- ...o
1923
- }, r = {
1924
- ...s.platform,
1925
- _c: i
1926
- };
1927
- return Ri(e, t, {
1928
- ...s,
1929
- platform: r
1930
- });
1931
- };
1932
- function yt(e) {
1933
- if (typeof e > "u")
1934
- return 0;
1935
- const t = window.devicePixelRatio || 1;
1936
- return Math.round(e * t) / t || -1e4;
1937
- }
1938
- const vt = 8, lo = 100, co = (e) => ({
1939
- bottom: ["top", "left", "right"],
1940
- "bottom-end": ["top-end", "left", "right"],
1941
- "bottom-start": ["top-start", "left", "right"],
1942
- left: ["right", "bottom", "top"],
1943
- "left-end": ["right-end", "bottom", "top"],
1944
- "left-start": ["right-start", "bottom", "top"],
1945
- right: ["left", "bottom", "top"],
1946
- "right-end": ["left-end", "bottom", "top"],
1947
- "right-start": ["left-start", "bottom", "top"],
1948
- top: ["bottom", "left", "right"],
1949
- "top-end": ["bottom-end", "left", "right"],
1950
- "top-start": ["bottom-start", "left", "right"]
1951
- })[e] ?? [e];
1952
- class ho {
1953
- constructor(t) {
1954
- this.originalPlacements = /* @__PURE__ */ new WeakMap(), this.allowPlacementUpdate = !1, this.closeForAncestorUpdate = () => {
1955
- !this.allowPlacementUpdate && this.options.type !== "modal" && this.cleanup && this.target.dispatchEvent(new Event("close", { bubbles: !0 })), this.allowPlacementUpdate = !1;
1956
- }, this.updatePlacement = () => {
1957
- this.computePlacement();
1958
- }, this.resetOverlayPosition = () => {
1959
- !this.target || !this.options || (this.clearOverlayPosition(), this.host.offsetHeight, this.computePlacement());
1960
- }, this.host = t, this.host.addController(this);
1961
- }
1962
- async placeOverlay(t = this.target, o = this.options) {
1963
- if (this.target = t, this.options = o, !t || !o)
1964
- return;
1965
- const i = Mt(
1966
- o.trigger,
1967
- t,
1968
- this.closeForAncestorUpdate,
1969
- {
1970
- ancestorResize: !1,
1971
- elementResize: !1,
1972
- layoutShift: !1
1973
- }
1974
- ), s = Mt(
1975
- o.trigger,
1976
- t,
1977
- this.updatePlacement,
1978
- {
1979
- ancestorScroll: !1
1980
- }
1981
- );
1982
- this.cleanup = () => {
1983
- this.host.elements?.forEach((r) => {
1984
- r.addEventListener(
1985
- "cx-closed",
1986
- () => {
1987
- const n = this.originalPlacements.get(r);
1988
- n && r.setAttribute("placement", n), this.originalPlacements.delete(r);
1989
- },
1990
- { once: !0 }
1991
- );
1992
- }), i(), s();
1993
- };
1994
- }
1995
- async computePlacement() {
1996
- const { options: t, target: o } = this;
1997
- await (document.fonts ? document.fonts.ready : Promise.resolve());
1998
- const i = t.trigger instanceof HTMLElement ? Wt() : Wt({
1999
- fallbackPlacements: co(t.placement),
2000
- padding: vt
2001
- }), [s = 0, r = 0] = Array.isArray(t?.offset) ? t.offset : [t.offset, 0], n = this.host.elements.find(
2002
- (u) => u.tipElement
2003
- )?.tipElement, a = [
2004
- Ht({
2005
- crossAxis: r,
2006
- mainAxis: s
2007
- }),
2008
- Te({ padding: vt }),
2009
- i,
2010
- qt({
2011
- apply: ({ availableHeight: u, availableWidth: p, rects: { floating: f } }) => {
2012
- const g = Math.max(
2013
- lo,
2014
- Math.floor(u)
2015
- ), m = f.height;
2016
- this.initialHeight = this.isConstrained && this.initialHeight || m, this.isConstrained = m < this.initialHeight || g <= m;
2017
- const y = this.isConstrained ? `${g}px` : "";
2018
- Object.assign(o.style, {
2019
- maxHeight: y,
2020
- maxWidth: `${Math.floor(p)}px`
2021
- });
2022
- },
2023
- padding: vt
2024
- }),
2025
- ...n ? [
2026
- Le({
2027
- element: n,
2028
- padding: t.tipPadding || vt
2029
- })
2030
- ] : []
2031
- ], { middlewareData: l, placement: c, x: h, y: d } = await De(
2032
- t.trigger,
2033
- o,
2034
- {
2035
- middleware: a,
2036
- placement: t.placement,
2037
- strategy: "fixed"
2038
- }
2039
- );
2040
- if (Object.assign(o.style, {
2041
- left: "0px",
2042
- top: "0px",
2043
- translate: `${yt(h)}px ${yt(d)}px`
2044
- }), o.setAttribute("actual-placement", c), this.host.elements?.forEach((u) => {
2045
- this.originalPlacements.has(u) || this.originalPlacements.set(
2046
- u,
2047
- u.getAttribute("placement")
2048
- ), u.setAttribute("placement", c);
2049
- }), n && l.arrow) {
2050
- const { x: u, y: p } = l.arrow;
2051
- Object.assign(n.style, {
2052
- left: c.startsWith("bottom") || c.startsWith("top") ? "0px" : "",
2053
- top: c.startsWith("right") || c.startsWith("left") ? "0px" : "",
2054
- translate: `${yt(u)}px ${yt(p)}px`
2055
- });
2056
- }
2057
- }
2058
- clearOverlayPosition() {
2059
- this.target && (this.target.style.removeProperty("max-height"), this.target.style.removeProperty("max-width"), this.initialHeight = void 0, this.isConstrained = !1);
2060
- }
2061
- hostConnected() {
2062
- document.addEventListener("cx-update-overlays", this.resetOverlayPosition);
2063
- }
2064
- hostUpdated() {
2065
- this.host.open || (this.cleanup?.(), this.cleanup = void 0);
2066
- }
2067
- hostDisconnected() {
2068
- this.cleanup?.(), this.cleanup = void 0, document.removeEventListener(
2069
- "cx-update-overlays",
2070
- this.resetOverlayPosition
2071
- );
2072
- }
2073
- }
2074
- var Rt = /* @__PURE__ */ ((e) => (e.Click = "click", e.Hover = "hover", e.LongPress = "longpress", e))(Rt || {});
2075
- class oe {
2076
- constructor(t, { handleOverlayReady: o, isPersistent: i, overlay: s }) {
2077
- this.target = t, this.isLazilyOpen = !1, this.isPersistent = !1, this.isPersistent = !!i, this.handleOverlayReady = o, this.isPersistent && this.init(), this.overlay = s;
2078
- }
2079
- get activelyOpening() {
2080
- return !1;
2081
- }
2082
- get open() {
2083
- return this.overlay?.open ?? this.isLazilyOpen;
2084
- }
2085
- /**
2086
- * Set `open` against the associated Overlay lazily.
2087
- */
2088
- set open(t) {
2089
- if (t !== this.open) {
2090
- if (this.isLazilyOpen = t, this.overlay) {
2091
- this.overlay.open = t;
2092
- return;
2093
- }
2094
- t && (customElements.whenDefined("cx-overlay").then(async () => {
2095
- const { Overlay: o } = await Promise.resolve().then(() => Co);
2096
- this.overlay = new o(), this.overlay.open = !0;
2097
- }), Promise.resolve().then(() => Ne));
2098
- }
2099
- }
2100
- get overlay() {
2101
- return this._overlay;
2102
- }
2103
- set overlay(t) {
2104
- t && this.overlay !== t && (this.overlay && this.overlay.removeController(this), this._overlay = t, this.overlay.addController(this), this.initOverlay(), this.prepareDescription(this.target), this.handleOverlayReady?.(this.overlay));
2105
- }
2106
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2107
- prepareDescription(t) {
2108
- }
2109
- releaseDescription() {
2110
- }
2111
- shouldCompleteOpen() {
2112
- }
2113
- /* c8 ignore next 3 */
2114
- init() {
2115
- }
2116
- /* c8 ignore next 3 */
2117
- initOverlay() {
2118
- }
2119
- abort() {
2120
- this.releaseDescription(), this.abortController?.abort();
2121
- }
2122
- hostConnected() {
2123
- this.init();
2124
- }
2125
- hostDisconnected() {
2126
- this.isPersistent || this.abort();
2127
- }
2128
- }
2129
- const po = 300, ke = {
2130
- keyboard: "Press Space or Alt+Down Arrow for additional options",
2131
- mouse: "Click and hold for additional options",
2132
- touch: "Double tap and long press for additional options"
2133
- };
2134
- class uo extends oe {
2135
- constructor() {
2136
- super(...arguments), this.type = Rt.LongPress, this.longpressState = null, this.releaseDescription = it, this.handlePointerup = () => {
2137
- clearTimeout(this.timeout), this.target && (this.longpressState = this.overlay?.state === "opening" ? "pressed" : null, document.removeEventListener("pointerup", this.handlePointerup), document.removeEventListener("pointercancel", this.handlePointerup));
2138
- };
2139
- }
2140
- get activelyOpening() {
2141
- return this.longpressState === "opening" || this.longpressState === "pressed";
2142
- }
2143
- handleLongpress() {
2144
- this.open = !0, this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
2145
- }
2146
- handlePointerdown(t) {
2147
- !this.target || t.button !== 0 || (this.longpressState = "potential", document.addEventListener("pointerup", this.handlePointerup), document.addEventListener("pointercancel", this.handlePointerup), "holdAffordance" in this.target) || (this.timeout = setTimeout(() => {
2148
- this.target && this.target.dispatchEvent(
2149
- new CustomEvent("longpress", {
2150
- bubbles: !0,
2151
- composed: !0,
2152
- detail: {
2153
- source: "pointer"
2154
- }
2155
- })
2156
- );
2157
- }, po));
2158
- }
2159
- handleKeydown(t) {
2160
- const { altKey: o, code: i } = t;
2161
- o && i === "ArrowDown" && (t.stopPropagation(), t.stopImmediatePropagation());
2162
- }
2163
- handleKeyup(t) {
2164
- const { altKey: o, code: i } = t;
2165
- if (i === "Space" || o && i === "ArrowDown") {
2166
- if (!this.target)
2167
- return;
2168
- t.stopPropagation(), this.target.dispatchEvent(
2169
- new CustomEvent("longpress", {
2170
- bubbles: !0,
2171
- composed: !0,
2172
- detail: {
2173
- source: "keyboard"
2174
- }
2175
- })
2176
- ), setTimeout(() => {
2177
- this.longpressState = null;
2178
- });
2179
- }
2180
- }
2181
- prepareDescription(t) {
2182
- if (
2183
- // do not reapply until target is recycled
2184
- this.releaseDescription !== it || // require "longpress content" to apply relationship
2185
- !this.overlay.elements.length
2186
- )
2187
- return;
2188
- const o = document.createElement("div");
2189
- o.id = `longpress-describedby-descriptor-${Ut()}`;
2190
- const i = ni() || ri() ? "touch" : "keyboard";
2191
- o.textContent = ke[i], o.slot = "longpress-describedby-descriptor";
2192
- const s = t.getRootNode(), r = this.overlay.getRootNode();
2193
- s === r ? this.overlay.append(o) : (o.hidden = !("host" in s), t.insertAdjacentElement("afterend", o));
2194
- const n = $t(
2195
- t,
2196
- "aria-describedby",
2197
- [o.id]
2198
- );
2199
- this.releaseDescription = () => {
2200
- n(), o.remove(), this.releaseDescription = it;
2201
- };
2202
- }
2203
- shouldCompleteOpen() {
2204
- this.longpressState = this.longpressState === "pressed" ? null : this.longpressState;
2205
- }
2206
- init() {
2207
- this.abortController?.abort(), this.abortController = new AbortController();
2208
- const { signal: t } = this.abortController;
2209
- this.target.addEventListener("longpress", () => this.handleLongpress(), {
2210
- signal: t
2211
- }), this.target.addEventListener(
2212
- "pointerdown",
2213
- (o) => this.handlePointerdown(o),
2214
- { signal: t }
2215
- ), this.prepareDescription(this.target), !this.target.holdAffordance && (this.target.addEventListener(
2216
- "keydown",
2217
- (o) => this.handleKeydown(o),
2218
- { signal: t }
2219
- ), this.target.addEventListener(
2220
- "keyup",
2221
- (o) => this.handleKeyup(o),
2222
- { signal: t }
2223
- ));
2224
- }
2225
- }
2226
- const fo = Vt`
2227
- /*
2228
- Copyright 2022 Adobe. All rights reserved.
2229
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
2230
- you may not use this file except in compliance with the License. You may obtain a copy
2231
- of the License at http://www.apache.org/licenses/LICENSE-2.0
2232
-
2233
- Unless required by applicable law or agreed to in writing, software distributed under
2234
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
2235
- OF ANY KIND, either express or implied. See the License for the specific language
2236
- governing permissions and limitations under the License.
2237
- */
2238
-
2239
- :host {
2240
- display: contents;
2241
- pointer-events: none;
2242
-
2243
- /**
2244
- * Duplicate --spectrum-overlay-animation-distance, which is out of scope.
2245
- * Currently is is statically '--cx-spacing-medium' across a number of places
2246
- * so that is leveraged here as the default.
2247
- **/
2248
-
2249
- --swc-overlay-animation-distance: var(--cx-spacing-medium);
2250
- }
2251
-
2252
- .dialog {
2253
- margin: 0;
2254
- border: 0;
2255
- background: none;
2256
- padding: 0;
2257
- display: flex;
2258
- position: fixed;
2259
- overflow: visible;
2260
- opacity: 1 !important;
2261
- box-sizing: border-box;
2262
- max-height: calc(100vh - 16px);
2263
- max-height: calc(100dvh - 16px);
2264
- max-width: calc(100vw - 16px);
2265
- height: auto;
2266
- inset: auto;
2267
- top: 0;
2268
- left: 0;
2269
-
2270
- --cx-overlay-open: true;
2271
- }
2272
-
2273
- .dialog:not([is-visible]) {
2274
- display: none;
2275
- }
2276
-
2277
- .dialog:focus {
2278
- outline: none;
2279
- }
2280
-
2281
- :host(:not([open])) .dialog {
2282
- --cx-overlay-open: false;
2283
- }
2284
-
2285
- .dialog::backdrop {
2286
- display: none;
2287
- }
2288
-
2289
- .dialog::before {
2290
- position: absolute;
2291
- inset: -999em;
2292
- content: '';
2293
- pointer-events: auto !important;
2294
- }
2295
-
2296
- .dialog:not(.not-immediately-closable)::before {
2297
- display: none;
2298
- }
2299
-
2300
- .dialog > div {
2301
- width: 100%;
2302
- }
2303
-
2304
- ::slotted(*) {
2305
- pointer-events: auto;
2306
- visibility: visible !important;
2307
- }
2308
-
2309
- /**
2310
- * Offset the transition displacement from the trigger edge by
2311
- * padding the equivelent distance off of the opposite edge.
2312
- *
2313
- * <HACK>
2314
- * Prepare for Context Menus with [popover] by adding margin/border
2315
- * that _should_ still be under the pointer when 'pointerup' is dispatched.
2316
- * </HACK>
2317
- **/
2318
- .dialog:not([actual-placement])[placement*='top'] {
2319
- padding-block: var(--swc-overlay-animation-distance);
2320
- margin-top: var(--swc-overlay-animation-distance);
2321
- }
2322
-
2323
- .dialog:not([actual-placement])[placement*='right'] {
2324
- padding-inline: var(--swc-overlay-animation-distance);
2325
- margin-left: calc(-1 * var(--swc-overlay-animation-distance));
2326
- }
2327
-
2328
- .dialog:not([actual-placement])[placement*='bottom'] {
2329
- padding-block: var(--swc-overlay-animation-distance);
2330
- margin-top: calc(-1 * var(--swc-overlay-animation-distance));
2331
- }
2332
-
2333
- .dialog:not([actual-placement])[placement*='left'] {
2334
- padding-inline: var(--swc-overlay-animation-distance);
2335
- margin-left: var(--swc-overlay-animation-distance);
2336
- }
2337
-
2338
- .dialog[actual-placement*='top'] {
2339
- padding-block: var(--swc-overlay-animation-distance);
2340
- margin-top: var(--swc-overlay-animation-distance);
2341
- }
2342
-
2343
- .dialog[actual-placement*='right'] {
2344
- padding-inline: var(--swc-overlay-animation-distance);
2345
- margin-left: calc(-1 * var(--swc-overlay-animation-distance));
2346
- }
2347
-
2348
- .dialog[actual-placement*='bottom'] {
2349
- padding-block: var(--swc-overlay-animation-distance);
2350
- margin-top: calc(-1 * var(--swc-overlay-animation-distance));
2351
- }
2352
-
2353
- .dialog[actual-placement*='left'] {
2354
- padding-inline: var(--swc-overlay-animation-distance);
2355
- margin-left: var(--swc-overlay-animation-distance);
2356
- }
2357
-
2358
- slot[name='longpress-describedby-descriptor'] {
2359
- display: none;
2360
- }
2361
-
2362
- /* stylelint-disable */
2363
- @supports selector(:open) {
2364
- .dialog {
2365
- opacity: 0;
2366
- }
2367
-
2368
- .dialog:open {
2369
- opacity: 1;
2370
- }
2371
- }
2372
-
2373
- @supports selector(:popover-open) {
2374
- .dialog {
2375
- opacity: 0;
2376
- }
2377
-
2378
- .dialog:popover-open {
2379
- opacity: 1;
2380
- }
2381
- }
2382
-
2383
- @supports (overlay: auto) {
2384
- .dialog {
2385
- display: none;
2386
- transition:
2387
- all var(--cx-transition-fast, 0.13s),
2388
- translate 0s,
2389
- display var(--cx-transition-fast, 0.13s);
2390
- transition-behavior: allow-discrete;
2391
- }
2392
-
2393
- .dialog:popover-open,
2394
- .dialog:modal {
2395
- display: flex;
2396
- }
2397
- }
2398
- .dialog[actual-placement] {
2399
- z-index: calc(
2400
- var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count)
2401
- );
2402
- }
2403
- @supports (not selector(:open)) and (not selector(:popover-open)) {
2404
- :host:not([open]) .dialog {
2405
- pointer-events: none;
2406
- }
2407
- }
2408
- `;
2409
- class go extends Event {
2410
- constructor(t, o, i) {
2411
- super("slottable-request", {
2412
- bubbles: !1,
2413
- cancelable: !0,
2414
- composed: !1
2415
- }), this.name = t, this.data = o, this.slotName = i !== void 0 ? `${t}.${i}` : t;
2416
- }
2417
- }
2418
- const mo = Symbol("remove-slottable-request");
2419
- class yo extends oe {
2420
- constructor() {
2421
- super(...arguments), this.type = Rt.Click, this.preventNextToggle = !1;
2422
- }
2423
- handleClick() {
2424
- this.preventNextToggle || (this.open = !this.open), this.preventNextToggle = !1;
2425
- }
2426
- handlePointerdown() {
2427
- this.preventNextToggle = this.open;
2428
- }
2429
- init() {
2430
- this.abortController?.abort(), this.abortController = new AbortController();
2431
- const { signal: t } = this.abortController;
2432
- this.target.addEventListener("click", () => this.handleClick(), {
2433
- signal: t
2434
- }), this.target.addEventListener(
2435
- "pointerdown",
2436
- () => this.handlePointerdown(),
2437
- { signal: t }
2438
- );
2439
- }
2440
- }
2441
- const vo = 300;
2442
- class bo extends oe {
2443
- constructor() {
2444
- super(...arguments), this.type = Rt.Hover, this.elementIds = [], this.focusedin = !1, this.pointerentered = !1;
2445
- }
2446
- handleTargetFocusin() {
2447
- this.target.matches(":focus-visible") && (this.open = !0, this.focusedin = !0);
2448
- }
2449
- handleTargetFocusout() {
2450
- this.focusedin = !1, !this.pointerentered && (this.open = !1);
2451
- }
2452
- handleTargetPointerenter() {
2453
- this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0), !this.overlay?.disabled && (this.open = !0, this.pointerentered = !0);
2454
- }
2455
- handleTargetPointerleave() {
2456
- this.doPointerleave();
2457
- }
2458
- // set a timeout once the pointer enters and the overlay is shown
2459
- // give the user time to enter the overlay
2460
- handleHostPointerenter() {
2461
- this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0);
2462
- }
2463
- handleHostPointerleave() {
2464
- this.doPointerleave();
2465
- }
2466
- prepareDescription() {
2467
- if (!this.overlay.elements.length)
2468
- return;
2469
- const t = this.target.getRootNode(), o = this.overlay.elements[0].getRootNode(), i = this.overlay.getRootNode();
2470
- t === i ? this.prepareOverlayRelativeDescription() : t === o && this.prepareContentRelativeDescription();
2471
- }
2472
- prepareOverlayRelativeDescription() {
2473
- const t = $t(
2474
- this.target,
2475
- "aria-describedby",
2476
- [this.overlay.id]
2477
- );
2478
- this.releaseDescription = () => {
2479
- t(), this.releaseDescription = it;
2480
- };
2481
- }
2482
- prepareContentRelativeDescription() {
2483
- const t = [], o = this.overlay.elements.map((s) => (t.push(s.id), s.id || (s.id = `${this.overlay.tagName.toLowerCase()}-helper-${Ut()}`), s.id));
2484
- this.elementIds = t;
2485
- const i = $t(
2486
- this.target,
2487
- "aria-describedby",
2488
- o
2489
- );
2490
- this.releaseDescription = () => {
2491
- i(), this.overlay.elements.map((s, r) => {
2492
- s.id = this.elementIds[r];
2493
- }), this.releaseDescription = it;
2494
- };
2495
- }
2496
- doPointerleave() {
2497
- this.pointerentered = !1;
2498
- const t = this.target;
2499
- this.focusedin && t.matches(":focus-visible") || (this.hoverTimeout = setTimeout(() => {
2500
- this.open = !1;
2501
- }, vo));
2502
- }
2503
- init() {
2504
- this.abortController?.abort(), this.abortController = new AbortController();
2505
- const { signal: t } = this.abortController;
2506
- this.target.addEventListener("focusin", () => this.handleTargetFocusin(), {
2507
- signal: t
2508
- }), this.target.addEventListener(
2509
- "focusout",
2510
- () => this.handleTargetFocusout(),
2511
- { signal: t }
2512
- ), this.target.addEventListener(
2513
- "pointerenter",
2514
- () => this.handleTargetPointerenter(),
2515
- { signal: t }
2516
- ), this.target.addEventListener(
2517
- "pointerleave",
2518
- () => this.handleTargetPointerleave(),
2519
- { signal: t }
2520
- ), this.overlay && this.initOverlay();
2521
- }
2522
- initOverlay() {
2523
- if (!this.abortController)
2524
- return;
2525
- const { signal: t } = this.abortController;
2526
- this.overlay.addEventListener(
2527
- "pointerenter",
2528
- () => this.handleHostPointerenter(),
2529
- { signal: t }
2530
- ), this.overlay.addEventListener(
2531
- "pointerleave",
2532
- () => this.handleHostPointerleave(),
2533
- { signal: t }
2534
- );
2535
- }
2536
- }
2537
- const wo = {
2538
- click: yo,
2539
- hover: bo,
2540
- longpress: uo
2541
- };
2542
- var xo = Object.defineProperty, Eo = Object.getOwnPropertyDescriptor, R = (e, t, o, i) => {
2543
- for (var s = i > 1 ? void 0 : i ? Eo(t, o) : t, r = e.length - 1, n; r >= 0; r--)
2544
- (n = e[r]) && (s = (i ? n(t, o, s) : n(s)) || s);
2545
- return i && s && xo(t, o, s), s;
2546
- };
2547
- const Po = "showPopover" in document.createElement("div");
2548
- let ct = di(ht);
2549
- Po ? ct = fi(ct) : ct = pi(ct);
2550
- var K;
2551
- const A = (K = class extends ct {
2552
- constructor() {
2553
- super(), this._delayed = !1, this._disabled = !1, this.offset = 0, this._open = !1, this.lastRequestSlottableState = !1, this.receivesFocus = "auto", this._state = "closed", this.triggerElement = null, this.type = "auto", this.wasOpen = !1, this.closeOnFocusOut = (t) => {
2554
- if (!t.relatedTarget)
2555
- return;
2556
- const o = new Event("overlay-relation-query", {
2557
- bubbles: !0,
2558
- composed: !0
2559
- });
2560
- t.relatedTarget.addEventListener(o.type, (i) => {
2561
- i.composedPath().includes(this) || (this.open = !1);
2562
- }), t.relatedTarget.dispatchEvent(o);
2563
- }, this.handleClose = this.handleClose.bind(this);
2564
- }
2565
- get delayed() {
2566
- return this.elements.length ? this.elements[this.elements.length - 1].hasAttribute("delayed") || this._delayed : this._delayed;
2567
- }
2568
- set delayed(t) {
2569
- this._delayed = t;
2570
- }
2571
- get disabled() {
2572
- return this._disabled;
2573
- }
2574
- set disabled(t) {
2575
- this._disabled = t, t ? (this.strategy?.abort(), this.wasOpen = this.open, this.open = !1) : (this.bindEvents(), this.open = this.open || this.wasOpen, this.wasOpen = !1);
2576
- }
2577
- get hasNonVirtualTrigger() {
2578
- return !!this.triggerElement && !(this.triggerElement instanceof Pt);
2579
- }
2580
- get placementController() {
2581
- return this._placementController || (this._placementController = new ho(this)), this._placementController;
2582
- }
2583
- get open() {
2584
- return this._open;
2585
- }
2586
- set open(t) {
2587
- t && this.disabled || t !== this.open && (this.strategy?.activelyOpening && !t || (this._open = t, this.open && (K.openCount += 1), this.requestUpdate("open", !this.open), this.open && this.requestSlottable()));
2588
- }
2589
- get state() {
2590
- return this._state;
2591
- }
2592
- set state(t) {
2593
- if (t === this.state)
2594
- return;
2595
- const o = this.state;
2596
- this._state = t, (this.state === "opened" || this.state === "closed") && this.strategy?.shouldCompleteOpen(), this.requestUpdate("state", o);
2597
- }
2598
- get elementResolver() {
2599
- return this._elementResolver || (this._elementResolver = new hi(this)), this._elementResolver;
2600
- }
2601
- get usesDialog() {
2602
- return this.type === "modal" || this.type === "page";
2603
- }
2604
- get popoverValue() {
2605
- if ("popover" in this)
2606
- switch (this.type) {
2607
- case "modal":
2608
- case "page":
2609
- return;
2610
- case "hint":
2611
- return "manual";
2612
- default:
2613
- return this.type;
2614
- }
2615
- }
2616
- get requiresPosition() {
2617
- return !(this.type === "page" || !this.open || !this.triggerElement || !this.placement && this.type !== "hint");
2618
- }
2619
- managePosition() {
2620
- if (!this.requiresPosition || !this.open)
2621
- return;
2622
- const t = this.offset || 0, o = this.triggerElement, i = this.placement || "right", s = this.tipPadding;
2623
- this.placementController.placeOverlay(this.dialogEl, {
2624
- offset: t,
2625
- placement: i,
2626
- tipPadding: s,
2627
- trigger: o,
2628
- type: this.type
2629
- });
2630
- }
2631
- async managePopoverOpen() {
2632
- super.managePopoverOpen();
2633
- const t = this.open;
2634
- if (this.open !== t || (await this.manageDelay(t), this.open !== t) || (await this.ensureOnDOM(t), this.open !== t))
2635
- return;
2636
- const o = await this.makeTransition(t);
2637
- this.open === t && await this.applyFocus(t, o);
2638
- }
2639
- async applyFocus(t, o) {
2640
- if (!(this.receivesFocus === "false" || this.type === "hint")) {
2641
- if (await k(), await k(), t === this.open && !this.open) {
2642
- this.hasNonVirtualTrigger && this.contains(this.getRootNode().activeElement) && this.triggerElement.focus();
2643
- return;
2644
- }
2645
- o?.focus();
2646
- }
2647
- }
2648
- returnFocus() {
2649
- if (this.open || this.type === "hint")
2650
- return;
2651
- const t = () => {
2652
- const o = [];
2653
- let i = document.activeElement;
2654
- for (; i?.shadowRoot?.activeElement; )
2655
- i = i.shadowRoot.activeElement;
2656
- for (; i; ) {
2657
- const s = i.assignedSlot || i.parentElement || i.getRootNode()?.host;
2658
- s && o.push(s), i = s;
2659
- }
2660
- return o;
2661
- };
2662
- this.receivesFocus !== "false" && this.triggerElement?.focus && (this.contains(this.getRootNode().activeElement) || t().includes(this) || document.activeElement === document.body) && this.triggerElement.focus();
2663
- }
2664
- async manageOpen(t) {
2665
- if (!(!this.isConnected && this.open) && (this.hasUpdated || await this.updateComplete, this.open ? (le.add(this), this.willPreventClose && (document.addEventListener(
2666
- "pointerup",
2667
- () => {
2668
- this.dialogEl.classList.toggle("not-immediately-closable", !1), this.willPreventClose = !1;
2669
- },
2670
- { once: !0 }
2671
- ), this.dialogEl.classList.toggle("not-immediately-closable", !0))) : (t && this.dispose(), le.remove(this)), this.open && this.state !== "opened" ? this.state = "opening" : !this.open && this.state !== "closed" && (this.state = "closing"), this.usesDialog ? this.manageDialogOpen() : this.managePopoverOpen(), this.type === "auto")) {
2672
- const o = this.getRootNode();
2673
- this.open ? o.addEventListener("focusout", this.closeOnFocusOut, {
2674
- capture: !0
2675
- }) : o.removeEventListener("focusout", this.closeOnFocusOut, {
2676
- capture: !0
2677
- });
2678
- }
2679
- }
2680
- bindEvents() {
2681
- this.strategy?.abort(), this.strategy = void 0, this.hasNonVirtualTrigger && this.triggerInteraction && (this.strategy = new wo[this.triggerInteraction](
2682
- this.triggerElement,
2683
- {
2684
- overlay: this
2685
- }
2686
- ));
2687
- }
2688
- handleBeforetoggle(t) {
2689
- t.newState !== "open" && this.handleBrowserClose();
2690
- }
2691
- handleBrowserClose() {
2692
- if (!this.strategy?.activelyOpening) {
2693
- this.open = !1;
2694
- return;
2695
- }
2696
- this.manuallyKeepOpen();
2697
- }
2698
- manuallyKeepOpen() {
2699
- this.open = !0, this.placementController.allowPlacementUpdate = !0, this.manageOpen(!1);
2700
- }
2701
- handleSlotchange() {
2702
- this.elements.length ? this.hasNonVirtualTrigger && this.strategy?.prepareDescription(this.triggerElement) : this.strategy?.releaseDescription();
2703
- }
2704
- shouldPreventClose() {
2705
- const t = this.willPreventClose;
2706
- return this.willPreventClose = !1, t;
2707
- }
2708
- requestSlottable() {
2709
- this.lastRequestSlottableState !== this.open && (this.open || document.body.offsetHeight, this.dispatchEvent(
2710
- new go(
2711
- "overlay-content",
2712
- this.open ? {} : mo
2713
- )
2714
- ), this.lastRequestSlottableState = this.open);
2715
- }
2716
- willUpdate(t) {
2717
- if (this.hasAttribute("id") || this.setAttribute("id", `${this.tagName.toLowerCase()}-${Ut()}`), t.has("open") && (this.hasUpdated || this.open) && this.manageOpen(t.get("open")), t.has("trigger")) {
2718
- const [i, s] = this.trigger?.split("@") || [];
2719
- this.elementResolver.selector = i ? `#${i}` : "", this.triggerInteraction = s;
2720
- }
2721
- let o = !1;
2722
- t.has(ve) && (o = this.triggerElement, this.triggerElement = this.elementResolver.element), t.has("triggerElement") && (o = t.get("triggerElement")), o !== !1 && this.bindEvents();
2723
- }
2724
- updated(t) {
2725
- super.updated(t), t.has("placement") && (this.placement ? this.dialogEl.setAttribute("actual-placement", this.placement) : this.dialogEl.removeAttribute("actual-placement"), this.open && typeof t.get("placement") < "u" && this.placementController.resetOverlayPosition()), t.has("state") && this.state === "closed" && typeof t.get("state") < "u" && this.placementController.clearOverlayPosition();
2726
- }
2727
- renderContent() {
2728
- return j` <slot @slotchange=${this.handleSlotchange}></slot> `;
2729
- }
2730
- get dialogStyleMap() {
2731
- return {
2732
- "--swc-overlay-open-count": K.openCount.toString()
2733
- };
2734
- }
2735
- handleClose() {
2736
- this.open = !1;
2737
- }
2738
- renderDialog() {
2739
- return j`
2740
- <dialog
2741
- class="dialog"
2742
- part="dialog"
2743
- placement=${Tt(
2744
- this.requiresPosition ? this.placement || "right" : void 0
2745
- )}
2746
- style=${se(this.dialogStyleMap)}
2747
- @close=${this.handleBrowserClose}
2748
- @cancel=${this.handleBrowserClose}
2749
- @beforetoggle=${this.handleBeforetoggle}
2750
- ?is-visible=${this.state !== "closed"}
2751
- >
2752
- ${this.renderContent()}
2753
- </dialog>
2754
- `;
2755
- }
2756
- renderPopover() {
2757
- return j`
2758
- <div
2759
- class="dialog"
2760
- part="dialog"
2761
- placement=${Tt(
2762
- this.requiresPosition ? this.placement || "right" : void 0
2763
- )}
2764
- popover=${Tt(this.popoverValue)}
2765
- style=${se(this.dialogStyleMap)}
2766
- @beforetoggle=${this.handleBeforetoggle}
2767
- @close=${this.handleBrowserClose}
2768
- ?is-visible=${this.state !== "closed"}
2769
- >
2770
- ${this.renderContent()}
2771
- </div>
2772
- `;
2773
- }
2774
- render() {
2775
- const t = this.type === "modal" || this.type === "page";
2776
- return j`
2777
- ${t ? this.renderDialog() : this.renderPopover()}
2778
- <slot name="longpress-describedby-descriptor"></slot>
2779
- `;
2780
- }
2781
- connectedCallback() {
2782
- super.connectedCallback(), this.addEventListener("close", this.handleClose), this.hasUpdated && this.bindEvents();
2783
- }
2784
- disconnectedCallback() {
2785
- super.disconnectedCallback(), this.removeEventListener("close", this.handleClose), this.strategy?.releaseDescription(), this.open = !1;
2786
- }
2787
- }, K.styles = [
2788
- ye,
2789
- Vt`
2790
- ${ze(fo)}
2791
- `
2792
- ], K.openCount = 1, K);
2793
- R([
2794
- v({ type: Boolean })
2795
- ], A.prototype, "delayed", 1);
2796
- R([
2797
- ut(".dialog")
2798
- ], A.prototype, "dialogEl", 2);
2799
- R([
2800
- v({ type: Boolean })
2801
- ], A.prototype, "disabled", 1);
2802
- R([
2803
- je({
2804
- flatten: !0,
2805
- selector: ':not([slot="longpress-describedby-descriptor"], slot)'
2806
- // gather only elements slotted into the default slot
2807
- })
2808
- ], A.prototype, "elements", 2);
2809
- R([
2810
- v({ type: Number })
2811
- ], A.prototype, "offset", 2);
2812
- R([
2813
- v({ reflect: !0, type: Boolean })
2814
- ], A.prototype, "open", 1);
2815
- R([
2816
- v()
2817
- ], A.prototype, "placement", 2);
2818
- R([
2819
- v({ attribute: "receives-focus" })
2820
- ], A.prototype, "receivesFocus", 2);
2821
- R([
2822
- ut("slot")
2823
- ], A.prototype, "slotEl", 2);
2824
- R([
2825
- Me()
2826
- ], A.prototype, "state", 1);
2827
- R([
2828
- v({ attribute: "tip-padding", type: Number })
2829
- ], A.prototype, "tipPadding", 2);
2830
- R([
2831
- v()
2832
- ], A.prototype, "trigger", 2);
2833
- R([
2834
- v({ attribute: "trigger-element" })
2835
- ], A.prototype, "triggerElement", 2);
2836
- R([
2837
- v({ attribute: "trigger-interaction" })
2838
- ], A.prototype, "triggerInteraction", 2);
2839
- R([
2840
- v()
2841
- ], A.prototype, "type", 2);
2842
- let Fe = A;
2843
- const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2844
- __proto__: null,
2845
- LONGPRESS_INSTRUCTIONS: ke,
2846
- Overlay: Fe
2847
- }, Symbol.toStringTag, { value: "Module" }));
2848
- Qe("cx-overlay", Fe);
2849
- const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2850
- __proto__: null
2851
- }, Symbol.toStringTag, { value: "Module" }));
2852
- function Oo(e) {
2853
- return Ao(e);
2854
- }
2855
- function Nt(e) {
2856
- return e.assignedSlot ? e.assignedSlot : e.parentNode instanceof ShadowRoot ? e.parentNode.host : e.parentNode;
2857
- }
2858
- function Ao(e) {
2859
- for (let t = e; t; t = Nt(t)) if (t instanceof Element && getComputedStyle(t).display === "none") return null;
2860
- for (let t = Nt(e); t; t = Nt(t)) {
2861
- if (!(t instanceof Element)) continue;
2862
- const o = getComputedStyle(t);
2863
- if (o.display !== "contents" && (o.position !== "static" || At(o) || t.tagName === "BODY"))
2864
- return t;
2865
- }
2866
- return null;
2867
- }
2868
- const So = Vt`
2869
- :host {
2870
- --arrow-color: var(--cx-color-neutral-1000);
2871
- --arrow-size: 6px;
2872
-
2873
- /*
2874
- * These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant
2875
- * 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.
2876
- */
2877
- --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
2878
- --arrow-padding-offset: calc(
2879
- var(--arrow-size-diagonal) - var(--arrow-size)
2880
- );
2881
-
2882
- display: contents;
2883
- /**
2884
- * Reset -webkit-overflow-scrolling style to fix issue with popup being hidden on mobile devices.
2885
- * See https://link.orangelogic.com/Tasks/293FXQ
2886
- */
2887
- -webkit-overflow-scrolling: auto;
2888
- }
2889
-
2890
- .popup {
2891
- position: absolute;
2892
- isolation: isolate;
2893
- max-width: var(--auto-size-available-width, none);
2894
- max-height: var(--auto-size-available-height, none);
2895
- }
2896
-
2897
- .popup--use-size-middleware {
2898
- /*
2899
- * Prevent update loops when using the size middleware.
2900
- * https://github.com/floating-ui/floating-ui/issues/1740#issuecomment-1563544849
2901
- */
2902
- width: max-content;
2903
- }
2904
-
2905
- .popup--fixed {
2906
- position: fixed;
2907
- z-index: var(--cx-z-index-dialog);
2908
- }
2909
-
2910
- .popup:not(.popup--active) {
2911
- display: none;
2912
- }
2913
-
2914
- .popup__arrow {
2915
- position: absolute;
2916
- width: calc(var(--arrow-size-diagonal) * 2);
2917
- height: calc(var(--arrow-size-diagonal) * 2);
2918
- rotate: 45deg;
2919
- background: var(--arrow-color);
2920
- z-index: -1;
2921
- }
2922
-
2923
- /* Hover bridge */
2924
- .popup-hover-bridge:not(.popup-hover-bridge--visible) {
2925
- display: none;
2926
- }
2927
-
2928
- .popup-hover-bridge {
2929
- position: fixed;
2930
- z-index: calc(var(--cx-z-index-dropdown) - 1);
2931
- top: 0;
2932
- right: 0;
2933
- bottom: 0;
2934
- left: 0;
2935
- clip-path: polygon(
2936
- var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),
2937
- var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),
2938
- var(--hover-bridge-bottom-right-x, 0)
2939
- var(--hover-bridge-bottom-right-y, 0),
2940
- var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
2941
- );
2942
- }
2943
- `;
2944
- var Ro = Object.defineProperty, To = Object.getOwnPropertyDescriptor, w = (e, t, o, i) => {
2945
- for (var s = i > 1 ? void 0 : i ? To(t, o) : t, r = e.length - 1, n; r >= 0; r--)
2946
- (n = e[r]) && (s = (i ? n(t, o, s) : n(s)) || s);
2947
- return i && s && Ro(t, o, s), s;
2948
- };
2949
- function Lo(e) {
2950
- if (e == null || typeof e != "object")
2951
- return !1;
2952
- const t = "contextElement" in e ? e.contextElement.ownerDocument.defaultView : null;
2953
- return "getBoundingClientRect" in e && ("contextElement" in e ? e.contextElement instanceof (t?.Element ?? Element) : !0);
2954
- }
2955
- let b = class extends Be {
2956
- constructor() {
2957
- super(...arguments), this.localize = new Ve(this), this.active = !1, this.placement = "top", this.strategy = "absolute", this.distance = 0, this.skidding = 0, this.arrow = !1, this.arrowPlacement = "anchor", this.arrowPadding = 10, this.flip = !1, this.hide = !1, this.hideBoundaryStrategy = "escaped", this.flipFallbackPlacements = "", this.flipFallbackStrategy = "best-fit", this.flipPadding = 0, this.shift = !1, this.shiftPadding = 0, this.autoSizePadding = 0, this.hoverBridge = !1, this.autoWidthFactor = 1, this.updateHoverBridge = () => {
2958
- if (this.hoverBridge && this.anchorEl) {
2959
- const e = this.anchorEl.getBoundingClientRect(), t = this.popup.getBoundingClientRect(), o = this.placement.includes("top") || this.placement.includes("bottom") || this.placement === "center";
2960
- let i = 0, s = 0, r = 0, n = 0, a = 0, l = 0, c = 0, h = 0;
2961
- o ? e.top < t.top ? (i = e.left, s = e.bottom, r = e.right, n = e.bottom, a = t.left, l = t.top, c = t.right, h = t.top) : (i = t.left, s = t.bottom, r = t.right, n = t.bottom, a = e.left, l = e.top, c = e.right, h = e.top) : e.left < t.left ? (i = e.right, s = e.top, r = t.left, n = t.top, a = e.right, l = e.bottom, c = t.left, h = t.bottom) : (i = t.right, s = t.top, r = e.left, n = e.top, a = t.right, l = t.bottom, c = e.left, h = e.bottom), this.style.setProperty("--hover-bridge-top-left-x", `${i}px`), this.style.setProperty("--hover-bridge-top-left-y", `${s}px`), this.style.setProperty("--hover-bridge-top-right-x", `${r}px`), this.style.setProperty("--hover-bridge-top-right-y", `${n}px`), this.style.setProperty(
2962
- "--hover-bridge-bottom-left-x",
2963
- `${a}px`
2964
- ), this.style.setProperty(
2965
- "--hover-bridge-bottom-left-y",
2966
- `${l}px`
2967
- ), this.style.setProperty(
2968
- "--hover-bridge-bottom-right-x",
2969
- `${c}px`
2970
- ), this.style.setProperty(
2971
- "--hover-bridge-bottom-right-y",
2972
- `${h}px`
2973
- );
2974
- }
2975
- };
2976
- }
2977
- /*
2978
- * Use to prevent update loops when using the size middleware.
2979
- * https://github.com/floating-ui/floating-ui/issues/1740#issuecomment-1563544849
2980
- */
2981
- get isSizeMiddleWareUsed() {
2982
- return this.sync || this.autoSize;
2983
- }
2984
- disconnectedCallback() {
2985
- super.disconnectedCallback(), this.stop();
2986
- }
2987
- async runFirstUpdated() {
2988
- if (this.start(), this.strategy === "overlay" && !ne) {
2989
- const e = We(this);
2990
- e && (this.autoSizeBoundary = e, this.flipBoundary = e, this.shiftBoundary = e);
2991
- }
2992
- }
2993
- async updated(e) {
2994
- super.updated(e), e.has("active") && (this.active ? (this.start(), this.emit("cx-opened")) : this.stop()), e.has("anchor") && this.handleAnchorChange(), this.active && (await this.updateComplete, this.reposition());
2995
- }
2996
- async handleAnchorChange() {
2997
- if (await this.stop(), this.anchor && typeof this.anchor == "string") {
2998
- const e = this.getRootNode();
2999
- this.anchorEl = e.getElementById(this.anchor);
3000
- } else this.anchor instanceof Element || Lo(this.anchor) ? this.anchorEl = this.anchor : this.anchorEl = this.querySelector('[slot="anchor"]');
3001
- this.anchorEl instanceof HTMLSlotElement && (this.anchorEl = this.anchorEl.assignedElements({
3002
- flatten: !0
3003
- })[0]), this.anchorEl instanceof Element && this.anchorEl.tagName.toLowerCase() === "cx-dialog" && (this.anchorEl = this.anchorEl?.shadowRoot?.querySelector(
3004
- '[part="panel"]'
3005
- )), this.anchorEl && this.start();
3006
- }
3007
- async handleOverlayOpened(e) {
3008
- e.target === this.overlay && (this.style.removeProperty("--auto-size-available-width"), this.style.removeProperty("--auto-size-available-height"), this.reposition(), await this.updateComplete, this.emit("cx-opened"));
3009
- }
3010
- start() {
3011
- this.anchorEl && (this.cleanup = Mt(this.anchorEl, this.popup, () => {
3012
- this.reposition();
3013
- }));
3014
- }
3015
- async stop() {
3016
- return new Promise((e) => {
3017
- this.cleanup ? (this.cleanup(), this.cleanup = void 0, this.removeAttribute("data-current-placement"), this.style.removeProperty("--auto-size-available-width"), this.style.removeProperty("--auto-size-available-height"), requestAnimationFrame(() => e())) : e();
3018
- });
3019
- }
3020
- /** Forces the popup to recalculate and reposition itself. */
3021
- reposition() {
3022
- if (!this.active || !this.anchorEl)
3023
- return;
3024
- const e = [
3025
- // The offset middleware goes first
3026
- this.placement === "center" ? Ht(
3027
- ({ rects: t }) => -t.reference.height / 2 - t.floating.height / 2
3028
- ) : Ht({ crossAxis: this.skidding, mainAxis: this.distance })
3029
- ];
3030
- if (this.sync ? e.push(
3031
- qt({
3032
- apply: ({ rects: t }) => {
3033
- const o = this.sync === "width" || this.sync === "both", i = this.sync === "height" || this.sync === "both", s = this.syncElement ? this.syncElement.getBoundingClientRect() : t.reference;
3034
- this.popup.style.width = o ? `${s.width}px` : "", this.popup.style.height = i ? `${s.height}px` : "";
3035
- }
3036
- })
3037
- ) : (this.popup.style.width = "", this.popup.style.height = ""), this.flip) {
3038
- let t = this.flipBoundary;
3039
- !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3040
- Wt({
3041
- boundary: t,
3042
- // @ts-expect-error - We're converting a string attribute to an array here
3043
- fallbackPlacements: this.flipFallbackPlacements,
3044
- fallbackStrategy: this.flipFallbackStrategy === "best-fit" ? "bestFit" : "initialPlacement",
3045
- padding: this.flipPadding
3046
- })
3047
- );
3048
- }
3049
- if (this.shift) {
3050
- let t = this.shiftBoundary;
3051
- !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3052
- Te({
3053
- boundary: t,
3054
- padding: this.shiftPadding
3055
- })
3056
- );
3057
- }
3058
- if (this.autoSize) {
3059
- let t = this.autoSizeBoundary;
3060
- !t && ["fixed", "overlay"].includes(this.strategy) && (t = document.body), e.push(
3061
- qt({
3062
- apply: ({ availableHeight: o, availableWidth: i }) => {
3063
- this.autoSize === "vertical" || this.autoSize === "both" ? this.style.setProperty(
3064
- "--auto-size-available-height",
3065
- `${o}px`
3066
- ) : this.style.removeProperty("--auto-size-available-height"), this.autoSize === "horizontal" || this.autoSize === "both" ? this.style.setProperty(
3067
- "--auto-size-available-width",
3068
- `${i * this.autoWidthFactor}px`
3069
- ) : this.style.removeProperty("--auto-size-available-width");
3070
- },
3071
- boundary: t,
3072
- padding: this.autoSizePadding
3073
- })
3074
- );
3075
- } else
3076
- this.style.removeProperty("--auto-size-available-width"), this.style.removeProperty("--auto-size-available-height");
3077
- this.arrow && e.push(
3078
- Le({
3079
- element: this.arrowEl,
3080
- padding: this.arrowPadding
3081
- })
3082
- ), this.hide && e.push(
3083
- ao({
3084
- boundary: this.hideBoundary,
3085
- strategy: this.hideBoundaryStrategy
3086
- })
3087
- ), De(this.anchorEl, this.popup, {
3088
- middleware: e,
3089
- placement: this.placement === "center" ? "bottom" : this.placement,
3090
- platform: {
3091
- ...It,
3092
- getOffsetParent: (t) => this.strategy === "absolute" ? It.getOffsetParent(t, Oo) : this.strategy === "overlay" && ne ? window : qe(t) || window
3093
- },
3094
- strategy: ["overlay", "fixed"].includes(this.strategy) ? "fixed" : "absolute"
3095
- }).then(({ middlewareData: t, placement: o, x: i, y: s }) => {
3096
- const r = this.localize.dir() === "rtl", n = {
3097
- bottom: "top",
3098
- left: "right",
3099
- right: "left",
3100
- top: "bottom"
3101
- }[o.split("-")[0]];
3102
- if (this.setAttribute("data-current-placement", o), this.anchorEl === document.body && this.placement === "center") {
3103
- const a = window.innerWidth, l = window.innerHeight, c = this.popup.offsetWidth, h = this.popup.offsetHeight, d = (a - c) / 2, u = (l - h) / 2;
3104
- Object.assign(this.popup.style, { left: `${d}px`, top: `${u}px` });
3105
- } else
3106
- Object.assign(this.popup.style, {
3107
- left: `${i}px`,
3108
- top: `${s}px`
3109
- });
3110
- if (this.arrow) {
3111
- const a = t.arrow.x, l = t.arrow.y;
3112
- let c = "", h = "", d = "", u = "";
3113
- if (this.arrowPlacement === "start") {
3114
- const p = typeof a == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3115
- c = typeof l == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "", h = r ? p : "", u = r ? "" : p;
3116
- } else if (this.arrowPlacement === "end") {
3117
- const p = typeof a == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3118
- h = r ? "" : p, u = r ? p : "", d = typeof l == "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3119
- } else this.arrowPlacement === "center" ? (u = typeof a == "number" ? "calc(50% - var(--arrow-size-diagonal))" : "", c = typeof l == "number" ? "calc(50% - var(--arrow-size-diagonal))" : "") : (u = typeof a == "number" ? `${a}px` : "", c = typeof l == "number" ? `${l}px` : "");
3120
- Object.assign(this.arrowEl.style, {
3121
- bottom: d,
3122
- left: u,
3123
- right: h,
3124
- top: c
3125
- }), this.arrowEl.style.setProperty(
3126
- n,
3127
- "calc(var(--arrow-size-diagonal) * -1)"
3128
- );
3129
- }
3130
- t.hide && Object.assign(this.popup.style, {
3131
- visibility: t.hide.escaped ? "hidden" : "visible"
3132
- });
3133
- }), requestAnimationFrame(() => {
3134
- this.updateHoverBridge(), this.emit("cx-reposition");
3135
- });
3136
- }
3137
- render() {
3138
- const e = j`<cx-overlay
3139
- open
3140
- placement="bottom"
3141
- type="manual"
3142
- @cx-opened=${this.handleOverlayOpened}
3143
- >
3144
- <div
3145
- part="popup"
3146
- class=${Dt({
3147
- popup: !0,
3148
- "popup--active": this.active,
3149
- "popup--fixed": !0,
3150
- "popup--has-arrow": this.arrow,
3151
- "popup--use-size-middleware": this.isSizeMiddleWareUsed
3152
- })}
3153
- >
3154
- <slot></slot>
3155
- ${this.arrow ? j`<div
3156
- part="arrow"
3157
- class="popup__arrow"
3158
- role="presentation"
3159
- ></div>` : ""}
3160
- </div>
3161
- </cx-overlay>`;
3162
- return j`
3163
- <slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
3164
-
3165
- <span
3166
- part="hover-bridge"
3167
- class=${Dt({
3168
- "popup-hover-bridge": !0,
3169
- "popup-hover-bridge--visible": this.hoverBridge && this.active
3170
- })}
3171
- ></span>
3172
-
3173
- ${Ue(
3174
- this.strategy === "overlay",
3175
- () => e,
3176
- () => j`<div
3177
- part="popup"
3178
- class=${Dt({
3179
- popup: !0,
3180
- "popup--active": this.active,
3181
- "popup--fixed": this.strategy === "fixed",
3182
- "popup--has-arrow": this.arrow,
3183
- "popup--use-size-middleware": this.isSizeMiddleWareUsed
3184
- })}
3185
- >
3186
- <slot></slot>
3187
- ${this.arrow ? j`<div
3188
- part="arrow"
3189
- class="popup__arrow"
3190
- role="presentation"
3191
- ></div>` : ""}
3192
- </div>`
3193
- )}
3194
- `;
3195
- }
3196
- };
3197
- b.styles = [ye, So];
3198
- w([
3199
- ut(".popup")
3200
- ], b.prototype, "popup", 2);
3201
- w([
3202
- ut(".popup__arrow")
3203
- ], b.prototype, "arrowEl", 2);
3204
- w([
3205
- ut("cx-overlay")
3206
- ], b.prototype, "overlay", 2);
3207
- w([
3208
- v()
3209
- ], b.prototype, "anchor", 2);
3210
- w([
3211
- v({ reflect: !0, type: Boolean })
3212
- ], b.prototype, "active", 2);
3213
- w([
3214
- v({ reflect: !0 })
3215
- ], b.prototype, "placement", 2);
3216
- w([
3217
- v({ reflect: !0 })
3218
- ], b.prototype, "strategy", 2);
3219
- w([
3220
- v({ type: Number })
3221
- ], b.prototype, "distance", 2);
3222
- w([
3223
- v({ type: Number })
3224
- ], b.prototype, "skidding", 2);
3225
- w([
3226
- v({ type: Boolean })
3227
- ], b.prototype, "arrow", 2);
3228
- w([
3229
- v({ attribute: "arrow-placement" })
3230
- ], b.prototype, "arrowPlacement", 2);
3231
- w([
3232
- v({ attribute: "arrow-padding", type: Number })
3233
- ], b.prototype, "arrowPadding", 2);
3234
- w([
3235
- v({ type: Boolean })
3236
- ], b.prototype, "flip", 2);
3237
- w([
3238
- v({ type: Boolean })
3239
- ], b.prototype, "hide", 2);
3240
- w([
3241
- v({ attribute: "hide-boundary", type: Object })
3242
- ], b.prototype, "hideBoundary", 2);
3243
- w([
3244
- v({ attribute: "hide-boundary-strategy" })
3245
- ], b.prototype, "hideBoundaryStrategy", 2);
3246
- w([
3247
- v({
3248
- attribute: "flip-fallback-placements",
3249
- converter: {
3250
- fromAttribute: (e) => e.split(" ").map((t) => t.trim()).filter((t) => t !== ""),
3251
- toAttribute: (e) => e.join(" ")
3252
- }
3253
- })
3254
- ], b.prototype, "flipFallbackPlacements", 2);
3255
- w([
3256
- v({ attribute: "flip-fallback-strategy" })
3257
- ], b.prototype, "flipFallbackStrategy", 2);
3258
- w([
3259
- v({ attribute: "flip-boundary", type: Object })
3260
- ], b.prototype, "flipBoundary", 2);
3261
- w([
3262
- v({ attribute: "flip-padding", type: Number })
3263
- ], b.prototype, "flipPadding", 2);
3264
- w([
3265
- v({ type: Boolean })
3266
- ], b.prototype, "shift", 2);
3267
- w([
3268
- v({ attribute: "shift-boundary", type: Object })
3269
- ], b.prototype, "shiftBoundary", 2);
3270
- w([
3271
- v({ attribute: "shift-padding", type: Number })
3272
- ], b.prototype, "shiftPadding", 2);
3273
- w([
3274
- v({ attribute: "auto-size" })
3275
- ], b.prototype, "autoSize", 2);
3276
- w([
3277
- v()
3278
- ], b.prototype, "sync", 2);
3279
- w([
3280
- v({ attribute: "sync-element" })
3281
- ], b.prototype, "syncElement", 2);
3282
- w([
3283
- v({ attribute: "auto-size-boundary", type: Object })
3284
- ], b.prototype, "autoSizeBoundary", 2);
3285
- w([
3286
- v({ attribute: "auto-size-padding", type: Number })
3287
- ], b.prototype, "autoSizePadding", 2);
3288
- w([
3289
- v({ attribute: "hover-bridge", type: Boolean })
3290
- ], b.prototype, "hoverBridge", 2);
3291
- w([
3292
- v({ attribute: "auto-width-factor" })
3293
- ], b.prototype, "autoWidthFactor", 2);
3294
- b = w([
3295
- Ie("cx-popup")
3296
- ], b);
1
+ import { C as l } from "../chunks/popup.CiIgTjOV.js";
2
+ import "../chunks/custom-element.fmLrnDZr.js";
3
+ import "../chunks/component.styles.DtouHn2g.js";
4
+ import "../chunks/browser.Va59Ix3P.js";
5
+ import "../chunks/i18n.C6c6_pqI.js";
6
+ import "../chunks/state.Dt9F_SuS.js";
7
+ import "../chunks/query.BBf1UFkC.js";
8
+ import "../chunks/class-map.DqNfBvJI.js";
9
+ import "../chunks/when.Dr1es41R.js";
3297
10
  export {
3298
- b as default
11
+ l as default
3299
12
  };