@luzmo/analytics-components-kit 1.0.1-alpha.2 → 1.0.1-alpha.4

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 (151) hide show
  1. package/LICENSE +18 -0
  2. package/custom-elements.json +1550 -0
  3. package/lib/area-chart-slots.config-BLxiYX05.cjs +20 -0
  4. package/lib/area-chart-slots.config-C0c2ZzBh.js +52 -0
  5. package/lib/async-directive-CPjMHOPu.cjs +24 -0
  6. package/lib/async-directive-SCUUQ3Mh.js +114 -0
  7. package/lib/bar-chart-slots.config-GSSL7XVA.js +47 -0
  8. package/lib/bar-chart-slots.config-Jx1PveTM.cjs +20 -0
  9. package/lib/bar-chart.config-B57geUzJ.cjs +20 -0
  10. package/lib/bar-chart.config-CQ6HAvs2.js +153 -0
  11. package/lib/bar-chart.en-BqYbiHO3.cjs +20 -0
  12. package/lib/bar-chart.en-FwT00qdU.js +69 -0
  13. package/lib/bar-chart.fr-DGx9smEh.cjs +20 -0
  14. package/lib/bar-chart.fr-DbxKiM0j.js +44 -0
  15. package/lib/bar-chart.nl-BYzVExsz.cjs +20 -0
  16. package/lib/bar-chart.nl-ahX1ARpH.js +44 -0
  17. package/lib/button-base-B4PdJFVe.cjs +27 -0
  18. package/lib/button-base-CtfPWS-P.js +142 -0
  19. package/lib/column-chart.config-B57geUzJ.cjs +20 -0
  20. package/lib/column-chart.config-C9hP0kX7.js +153 -0
  21. package/lib/cs-DVZ0Tapy.js +89 -0
  22. package/lib/cs-I9E81keK.cjs +20 -0
  23. package/lib/da-DHy05oSR.js +97 -0
  24. package/lib/da-QkdvupDg.cjs +20 -0
  25. package/lib/de-Dn5mUzha.cjs +20 -0
  26. package/lib/de-iM39JlAt.js +109 -0
  27. package/lib/decompose-numeric-format-B3rVVHpO.cjs +20 -0
  28. package/lib/decompose-numeric-format-BuZcjH2k.js +39 -0
  29. package/lib/directive-helpers-BSB0tfc9.cjs +32 -0
  30. package/lib/directive-helpers-eY1rHtyn.js +154 -0
  31. package/lib/divider.module-BW8qaMVq.js +211 -0
  32. package/lib/divider.module-DEy88Ieh.cjs +20 -0
  33. package/lib/donut-chart-slots.config-BEwhfq27.js +39 -0
  34. package/lib/donut-chart-slots.config-DIp-24lO.cjs +20 -0
  35. package/lib/donut-chart.config-3DhKiSSM.js +177 -0
  36. package/lib/donut-chart.config-DLWJUlHx.cjs +20 -0
  37. package/lib/donut-chart.en-Blb9oSdU.cjs +20 -0
  38. package/lib/donut-chart.en-CzjT4-XN.js +85 -0
  39. package/lib/donut-chart.fr-BeTVa2wh.cjs +20 -0
  40. package/lib/donut-chart.fr-DftPrKbG.js +39 -0
  41. package/lib/donut-chart.nl-D9YGbOce.cjs +20 -0
  42. package/lib/donut-chart.nl-NMatXfhK.js +39 -0
  43. package/lib/draggable-data-item/index.cjs +20 -0
  44. package/lib/draggable-data-item/index.js +30 -0
  45. package/lib/droppable-slot/index.cjs +20 -0
  46. package/lib/droppable-slot/index.js +30 -0
  47. package/lib/en-BDBzmAXX.cjs +202 -0
  48. package/lib/en-CIeY2T5K.js +1980 -0
  49. package/lib/en-GB-BqYHIX1v.cjs +20 -0
  50. package/lib/en-GB-CYx--4nh.js +28 -0
  51. package/lib/es-CwyPlN5d.cjs +20 -0
  52. package/lib/es-KhTq4jX8.js +305 -0
  53. package/lib/fi-Dh_ebgpe.js +97 -0
  54. package/lib/fi-rijeZE5V.cjs +20 -0
  55. package/lib/fr-BcgE-6S_.cjs +20 -0
  56. package/lib/fr-CU727YF1.js +305 -0
  57. package/lib/get-css-variable-BHHQ0SnL.js +1444 -0
  58. package/lib/get-css-variable-D439CdH9.cjs +24 -0
  59. package/lib/he-Au3xg6lR.js +89 -0
  60. package/lib/he-O6Ih8Bqh.cjs +20 -0
  61. package/lib/hu-BnZ8y3xQ.cjs +20 -0
  62. package/lib/hu-DNJ-P_MW.js +97 -0
  63. package/lib/if-defined-BbzmSG-O.js +757 -0
  64. package/lib/if-defined-V7yEJWI3.cjs +54 -0
  65. package/lib/imageobject.config-B7ld9bj3.cjs +20 -0
  66. package/lib/imageobject.config-DZLp9Elq.js +127 -0
  67. package/lib/index-0314DjEl.cjs +20 -0
  68. package/lib/index-B9h2L_hV.js +3048 -0
  69. package/lib/index-BDXFsKUM.cjs +146 -0
  70. package/lib/index-Bd4cKS9O.js +155 -0
  71. package/lib/index-BmAD29P2.js +106 -0
  72. package/lib/index-Bo1DpZ-1.cjs +58 -0
  73. package/lib/index-C4ePDYEC.cjs +41 -0
  74. package/lib/index-C9xEN5Ji.js +82 -0
  75. package/lib/index-CBCm4_7S.js +869 -0
  76. package/lib/index-CM80_HQw.js +442 -0
  77. package/lib/index-CcF-9wyF.cjs +71 -0
  78. package/lib/index-CfEm5P0J.cjs +196 -0
  79. package/lib/index-CrWoFMZ3.cjs +22 -0
  80. package/lib/index-CtEJZdT0.js +1627 -0
  81. package/lib/index-CvX-HLY1.cjs +322 -0
  82. package/lib/index-D37RwuEH.js +1584 -0
  83. package/lib/index-D5puKlcm.cjs +96 -0
  84. package/lib/index-DGz6jCKo.cjs +26 -0
  85. package/lib/index-DJp_9h0l.js +327 -0
  86. package/lib/index-DSbgZduE.js +501 -0
  87. package/lib/index-D_KYpfBM.js +24 -0
  88. package/lib/index-DdtjeKYI.js +928 -0
  89. package/lib/index-Dj7PF4Q9.cjs +63 -0
  90. package/lib/index-Dq3HAOaM.js +127 -0
  91. package/lib/index-DrIA0eFE.js +392 -0
  92. package/lib/index-jt6FL_uE.cjs +20 -0
  93. package/lib/index-kJR406YZ.cjs +112 -0
  94. package/lib/index-v8ZTprPO.cjs +51 -0
  95. package/lib/index.cjs +875 -0
  96. package/lib/index.js +6411 -0
  97. package/lib/it-Bh5U73z6.js +305 -0
  98. package/lib/it-PshtLMkq.cjs +20 -0
  99. package/lib/ja-CCcHUL61.js +89 -0
  100. package/lib/ja-KIS2HdaG.cjs +20 -0
  101. package/lib/ko--l4qmjLV.cjs +20 -0
  102. package/lib/ko-DhapsZMM.js +89 -0
  103. package/lib/line-chart.config-BZcvfO2c.cjs +20 -0
  104. package/lib/line-chart.config-CIVN6uLI.js +115 -0
  105. package/lib/mk-B9HPSuKa.js +97 -0
  106. package/lib/mk-DZlj-edb.cjs +20 -0
  107. package/lib/nl-BKlDqOXb.cjs +20 -0
  108. package/lib/nl-BwSt5Bf4.js +109 -0
  109. package/lib/no-D-DofYnx.js +109 -0
  110. package/lib/no-D_SzxhTu.cjs +20 -0
  111. package/lib/observe-slot-text-DOYmGOZe.js +181 -0
  112. package/lib/observe-slot-text-oJ0a2KY9.cjs +42 -0
  113. package/lib/picker/index.cjs +20 -0
  114. package/lib/picker/index.js +32 -0
  115. package/lib/pl-D_L_0Boq.js +97 -0
  116. package/lib/pl-PIK23rK_.cjs +20 -0
  117. package/lib/popover-Bwnkg-5-.js +67 -0
  118. package/lib/popover-CQGN8nbX.cjs +32 -0
  119. package/lib/progress-circle/index.cjs +35 -0
  120. package/lib/progress-circle/index.js +104 -0
  121. package/lib/pt-B0BBS5VB.js +89 -0
  122. package/lib/pt-Dqlu4MS5.cjs +20 -0
  123. package/lib/ru-Vo-m3O_2.js +108 -0
  124. package/lib/ru-zyNDTB04.cjs +20 -0
  125. package/lib/sv-1DPTltNQ.cjs +20 -0
  126. package/lib/sv-CiozMaev.js +89 -0
  127. package/lib/textobject.config-C8opcGG4.js +52 -0
  128. package/lib/textobject.config-DbAajFz8.cjs +20 -0
  129. package/lib/tr-BkmWvOG2.cjs +20 -0
  130. package/lib/tr-D_D4i5iv.js +109 -0
  131. package/lib/zh-CN-DTZ4OmdP.cjs +20 -0
  132. package/lib/zh-CN-wsl7eFSd.js +89 -0
  133. package/lib/zh-TW-DTZ4OmdP.cjs +20 -0
  134. package/lib/zh-TW-wsl7eFSd.js +89 -0
  135. package/package.json +19 -24
  136. package/37.js +0 -1
  137. package/729.js +0 -1
  138. package/common-31743c5a.js +0 -13
  139. package/common-b02547a0.js +0 -1
  140. package/common-b49d9a9d.js +0 -1
  141. package/common-b5232813.js +0 -56
  142. package/common-cefd4f4c.js +0 -1
  143. package/common-d6cb565f.js +0 -1
  144. package/common-fd868059.js +0 -1
  145. package/common-fedaf338.js +0 -32
  146. package/edit-option-picker/index.js +0 -314
  147. package/edit-option-slider/index.js +0 -102
  148. package/edit-option-toggle/index.js +0 -114
  149. package/index.js +0 -346
  150. package/vendors-93cc3efa.js +0 -1
  151. package/vendors-bb3d84b5.js +0 -1
@@ -0,0 +1,3048 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2024 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ import { e as re, i as Oe, t as Ae, c as Lt, a as _t, E as Te, b as Re, r as ut } from "./directive-helpers-eY1rHtyn.js";
21
+ import { b as De, T as Se, L as le, r as ae, x as k, o as St, n as x, e as pt, E as ce, B as he } from "./if-defined-BbzmSG-O.js";
22
+ import { v as ft } from "./index-DdtjeKYI.js";
23
+ import { i as ke, b as Le, f as $e } from "./async-directive-SCUUQ3Mh.js";
24
+ /**
25
+ * @license
26
+ * Copyright 2021 Google LLC
27
+ * SPDX-License-Identifier: BSD-3-Clause
28
+ */
29
+ function Fe(e) {
30
+ return (t, n) => {
31
+ const { slot: i, selector: o } = e ?? {}, s = "slot" + (i ? `[name=${i}]` : ":not([name])");
32
+ return De(t, n, { get() {
33
+ var a;
34
+ const r = (a = this.renderRoot) == null ? void 0 : a.querySelector(s), l = (r == null ? void 0 : r.assignedElements(e)) ?? [];
35
+ return o === void 0 ? l : l.filter((c) => c.matches(o));
36
+ } });
37
+ };
38
+ }
39
+ class ze extends Event {
40
+ constructor(t, n, i) {
41
+ super("slottable-request", {
42
+ bubbles: !1,
43
+ cancelable: !0,
44
+ composed: !1
45
+ }), this.name = t, this.data = n, this.slotName = i === void 0 ? t : `${t}.${i}`;
46
+ }
47
+ }
48
+ const Nt = Symbol("remove-slottable-request");
49
+ /**
50
+ * @license
51
+ * Copyright 2018 Google LLC
52
+ * SPDX-License-Identifier: BSD-3-Clause
53
+ */
54
+ const de = "important", _e = " !" + de, Jt = re(class extends Oe {
55
+ constructor(e) {
56
+ var t;
57
+ if (super(e), e.type !== Ae.ATTRIBUTE || e.name !== "style" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
58
+ }
59
+ render(e) {
60
+ return Object.keys(e).reduce((t, n) => {
61
+ const i = e[n];
62
+ return i == null ? t : t + `${n = n.includes("-") ? n : n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${i};`;
63
+ }, "");
64
+ }
65
+ update(e, [t]) {
66
+ const { style: n } = e.element;
67
+ if (this.ft === void 0) return this.ft = new Set(Object.keys(t)), this.render(t);
68
+ for (const i of this.ft) t[i] == null && (this.ft.delete(i), i.includes("-") ? n.removeProperty(i) : n[i] = null);
69
+ for (const i in t) {
70
+ const o = t[i];
71
+ if (o != null) {
72
+ this.ft.add(i);
73
+ const s = typeof o == "string" && o.endsWith(_e);
74
+ i.includes("-") || s ? n.setProperty(i, s ? o.slice(0, -11) : o, s ? de : "") : n[i] = o;
75
+ }
76
+ }
77
+ return Se;
78
+ }
79
+ });
80
+ function Ne(e, t, n = []) {
81
+ for (const [i, o] of t.entries()) {
82
+ const s = e[i], r = s.parentElement || s.getRootNode();
83
+ n[i] && n[i](o), r && r !== s && s.replaceWith(o), delete e[i];
84
+ }
85
+ return t;
86
+ }
87
+ const Be = (e, t, {
88
+ position: n,
89
+ prepareCallback: i
90
+ } = { position: "beforeend" }) => {
91
+ let { length: o } = e;
92
+ if (o === 0)
93
+ return () => e;
94
+ let s = 1, r = 0;
95
+ (n === "afterbegin" || n === "afterend") && (s = -1, r = o - 1);
96
+ const l = new Array(o), a = new Array(o), c = document.createComment(
97
+ "placeholder for reparented element"
98
+ );
99
+ do {
100
+ const h = e[r];
101
+ i && (a[r] = i(h)), l[r] = c.cloneNode();
102
+ const d = h.parentElement || h.getRootNode();
103
+ d && d !== h && d.replaceChild(l[r], h), t.insertAdjacentElement(n, h), r += s;
104
+ } while (--o > 0);
105
+ return function() {
106
+ return Ne(
107
+ l,
108
+ e,
109
+ a
110
+ );
111
+ };
112
+ }, Me = 1e3, He = 1e3;
113
+ class qe {
114
+ constructor(t = {}) {
115
+ this.warmUpDelay = Me, this.coolDownDelay = He, this.isWarm = !1, this.timeout = 0, Object.assign(this, t);
116
+ }
117
+ openTimer(t) {
118
+ if (this.cancelCooldownTimer(), !this.component || t !== this.component)
119
+ return this.component && (this.close(this.component), this.cancelCooldownTimer()), this.component = t, this.isWarm ? Promise.resolve(!1) : (this.promise = new Promise((n) => {
120
+ this.resolve = n, this.timeout = window.setTimeout(() => {
121
+ this.resolve && (this.resolve(!1), this.isWarm = !0);
122
+ }, this.warmUpDelay);
123
+ }), this.promise);
124
+ if (this.promise)
125
+ return this.promise;
126
+ throw new Error("Inconsistent state");
127
+ }
128
+ close(t) {
129
+ 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);
130
+ }
131
+ resetCooldownTimer() {
132
+ this.isWarm && (this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), this.cooldownTimeout = window.setTimeout(() => {
133
+ this.isWarm = !1, delete this.cooldownTimeout;
134
+ }, this.coolDownDelay));
135
+ }
136
+ cancelCooldownTimer() {
137
+ this.cooldownTimeout && window.clearTimeout(this.cooldownTimeout), delete this.cooldownTimeout;
138
+ }
139
+ }
140
+ const xt = new qe(), tt = () => {
141
+ }, Bt = (e, t, n) => {
142
+ const i = new AbortController(), o = /* @__PURE__ */ new Map(), s = () => {
143
+ i.abort(), n();
144
+ };
145
+ let r, l;
146
+ const a = requestAnimationFrame(() => {
147
+ r = requestAnimationFrame(() => {
148
+ l = requestAnimationFrame(() => {
149
+ s();
150
+ });
151
+ });
152
+ }), c = (d) => {
153
+ d.target === e && (o.set(
154
+ d.propertyName,
155
+ o.get(d.propertyName) - 1
156
+ ), o.get(d.propertyName) || o.delete(d.propertyName), o.size === 0 && s());
157
+ }, h = (d) => {
158
+ d.target === e && (o.has(d.propertyName) || o.set(d.propertyName, 0), o.set(
159
+ d.propertyName,
160
+ o.get(d.propertyName) + 1
161
+ ), cancelAnimationFrame(a), cancelAnimationFrame(r), cancelAnimationFrame(l));
162
+ };
163
+ e.addEventListener("transitionrun", h, {
164
+ signal: i.signal
165
+ }), e.addEventListener("transitionend", c, {
166
+ signal: i.signal
167
+ }), e.addEventListener("transitioncancel", c, {
168
+ signal: i.signal
169
+ }), t();
170
+ };
171
+ function L() {
172
+ return new Promise((e) => requestAnimationFrame(() => e()));
173
+ }
174
+ class rt extends le {
175
+ constructor() {
176
+ super(...arguments), this.dispose = tt, this.offset = 0, this.willPreventClose = !1;
177
+ }
178
+ applyFocus(t, n) {
179
+ }
180
+ /* c8 ignore next 6 */
181
+ get delayed() {
182
+ return !1;
183
+ }
184
+ set delayed(t) {
185
+ }
186
+ /* c8 ignore next 6 */
187
+ get disabled() {
188
+ return !1;
189
+ }
190
+ set disabled(t) {
191
+ }
192
+ get elementResolver() {
193
+ return this._elementResolver;
194
+ }
195
+ set elementResolver(t) {
196
+ this._elementResolver = t;
197
+ }
198
+ /* c8 ignore next 3 */
199
+ ensureOnDOM(t) {
200
+ }
201
+ /* c8 ignore next 5 */
202
+ makeTransition(t) {
203
+ return null;
204
+ }
205
+ manageDelay(t) {
206
+ }
207
+ /* c8 ignore next 3 */
208
+ manageDialogOpen() {
209
+ }
210
+ /* c8 ignore next 3 */
211
+ managePopoverOpen() {
212
+ }
213
+ /* c8 ignore next 3 */
214
+ managePosition() {
215
+ }
216
+ /* c8 ignore next 6 */
217
+ get open() {
218
+ return !1;
219
+ }
220
+ set open(t) {
221
+ }
222
+ get placementController() {
223
+ return this._placementController;
224
+ }
225
+ set placementController(t) {
226
+ this._placementController = t;
227
+ }
228
+ requestSlottable() {
229
+ }
230
+ returnFocus() {
231
+ }
232
+ /* c8 ignore next 6 */
233
+ get state() {
234
+ return "closed";
235
+ }
236
+ set state(t) {
237
+ }
238
+ /* c8 ignore next 3 */
239
+ manuallyKeepOpen() {
240
+ }
241
+ static update() {
242
+ const t = new CustomEvent("luzmo-update-overlays", {
243
+ bubbles: !0,
244
+ composed: !0,
245
+ cancelable: !0
246
+ });
247
+ document.dispatchEvent(t);
248
+ }
249
+ static async open(t, n, i, o) {
250
+ await Promise.resolve().then(() => st);
251
+ const s = arguments.length === 2, r = i || t, l = new this();
252
+ let a = !1;
253
+ const c = Be([r], l, {
254
+ position: "beforeend",
255
+ prepareCallback: (f) => {
256
+ const u = f.slot;
257
+ return f.removeAttribute("slot"), () => {
258
+ f.slot = u;
259
+ };
260
+ }
261
+ });
262
+ if (l.dispose = () => {
263
+ l.addEventListener("luzmo-closed", () => {
264
+ a || (c(), a = !0), requestAnimationFrame(() => {
265
+ l.remove();
266
+ });
267
+ }), l.open = !1, l.dispose = tt;
268
+ }, !s && r && o) {
269
+ const f = t, u = n, p = o;
270
+ return rt.applyOptions(l, {
271
+ ...p,
272
+ delayed: p.delayed || r.hasAttribute("delayed"),
273
+ trigger: p.virtualTrigger || f,
274
+ type: u === "modal" ? "modal" : u === "hover" ? "hint" : "auto"
275
+ }), f.after(l), await l.updateComplete, l.open = !0, l.dispose;
276
+ }
277
+ const d = n;
278
+ return l.append(r), rt.applyOptions(l, {
279
+ ...d,
280
+ delayed: d.delayed || r.hasAttribute("delayed")
281
+ }), l.updateComplete.then(() => {
282
+ l.open = !0;
283
+ }), l;
284
+ }
285
+ static applyOptions(t, n) {
286
+ t.delayed = !!n.delayed, t.receivesFocus = n.receivesFocus ?? "auto", t.triggerElement = n.trigger || null, t.type = n.type || "modal", t.offset = n.offset ?? 0, t.placement = n.placement, t.willPreventClose = !!n.notImmediatelyClosable;
287
+ }
288
+ }
289
+ const Mt = (e) => e.querySelector(
290
+ ft
291
+ ), Ht = (e) => e.assignedElements().find(
292
+ (n) => n.matches(ft)
293
+ );
294
+ class qt extends Event {
295
+ constructor() {
296
+ super("beforetoggle", {
297
+ bubbles: !1,
298
+ composed: !1
299
+ }), this.currentState = "open", this.newState = "closed";
300
+ }
301
+ }
302
+ class It extends Event {
303
+ constructor() {
304
+ super("beforetoggle", {
305
+ bubbles: !1,
306
+ composed: !1
307
+ }), this.currentState = "closed", this.newState = "open";
308
+ }
309
+ }
310
+ class z extends Event {
311
+ constructor(t, n, {
312
+ publish: i,
313
+ interaction: o,
314
+ reason: s
315
+ }) {
316
+ super(t, {
317
+ bubbles: i,
318
+ composed: i
319
+ }), this.overlay = n, this.detail = {
320
+ interaction: o,
321
+ reason: s
322
+ };
323
+ }
324
+ }
325
+ class mt {
326
+ constructor(t, n) {
327
+ this.x = 0, this.y = 0, this.x = t, this.y = n;
328
+ }
329
+ updateBoundingClientRect(t, n) {
330
+ this.x = t, this.y = n, rt.update();
331
+ }
332
+ getBoundingClientRect() {
333
+ return {
334
+ width: 0,
335
+ height: 0,
336
+ top: this.y,
337
+ right: this.x,
338
+ y: this.y,
339
+ x: this.x,
340
+ bottom: this.y,
341
+ left: this.x,
342
+ /* c8 ignore next 3 */
343
+ toJSON() {
344
+ }
345
+ };
346
+ }
347
+ }
348
+ function Ie(e) {
349
+ class t extends e {
350
+ async manageDialogOpen() {
351
+ const i = this.open;
352
+ if (await L(), await this.managePosition(), this.open !== i)
353
+ return;
354
+ const o = await this.dialogMakeTransition(i);
355
+ this.open === i && await this.dialogApplyFocus(i, o);
356
+ }
357
+ dialogMakeTransition(i) {
358
+ let o = null;
359
+ const s = (l, a) => () => {
360
+ if (l.open = i, !i) {
361
+ const h = () => {
362
+ l.removeEventListener("close", h);
363
+ };
364
+ l.addEventListener("close", h);
365
+ }
366
+ if (a > 0)
367
+ return;
368
+ const c = i ? It : qt;
369
+ this.dispatchEvent(new c()), i && (l.matches(ft) && (o = l), o = o || Mt(l), o || l.querySelectorAll("slot").forEach((d) => {
370
+ o || (o = Ht(d));
371
+ }), !(!this.isConnected || this.dialogEl.open) && this.dialogEl.showModal());
372
+ }, r = (l, a) => () => {
373
+ if (this.open !== i)
374
+ return;
375
+ const c = i ? "luzmo-opened" : "luzmo-closed";
376
+ if (a > 0) {
377
+ l.dispatchEvent(
378
+ new z(c, this, {
379
+ interaction: this.type,
380
+ publish: !1
381
+ })
382
+ );
383
+ return;
384
+ }
385
+ if (!this.isConnected || i !== this.open)
386
+ return;
387
+ const h = async () => {
388
+ const d = this.triggerElement instanceof mt;
389
+ this.dispatchEvent(
390
+ new z(c, this, {
391
+ interaction: this.type,
392
+ publish: d
393
+ })
394
+ ), l.dispatchEvent(
395
+ new z(c, this, {
396
+ interaction: this.type,
397
+ publish: !1
398
+ })
399
+ ), this.triggerElement && !d && this.triggerElement.dispatchEvent(
400
+ new z(c, this, {
401
+ interaction: this.type,
402
+ publish: !0
403
+ })
404
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await L(), await L(), i === this.open && i === !1 && this.requestSlottable();
405
+ };
406
+ !i && this.dialogEl.open ? (this.dialogEl.addEventListener(
407
+ "close",
408
+ () => {
409
+ h();
410
+ },
411
+ { once: !0 }
412
+ ), this.dialogEl.close()) : h();
413
+ };
414
+ return this.elements.forEach((l, a) => {
415
+ Bt(l, s(l, a), r(l, a));
416
+ }), o;
417
+ }
418
+ dialogApplyFocus(i, o) {
419
+ this.applyFocus(i, o);
420
+ }
421
+ }
422
+ return t;
423
+ }
424
+ function We(e) {
425
+ class t extends e {
426
+ async managePopoverOpen() {
427
+ await this.managePosition();
428
+ }
429
+ async manageDelay(i) {
430
+ if (i === !1 || i !== this.open) {
431
+ xt.close(this);
432
+ return;
433
+ }
434
+ this.delayed && await xt.openTimer(this) && (this.open = !i);
435
+ }
436
+ ensureOnDOM(i) {
437
+ document.body.offsetHeight;
438
+ }
439
+ makeTransition(i) {
440
+ if (this.open !== i)
441
+ return null;
442
+ let o = null;
443
+ const s = (l, a) => () => {
444
+ if (i !== this.open)
445
+ return;
446
+ if (l.open = i, a === 0) {
447
+ const h = i ? It : qt;
448
+ this.dispatchEvent(new h());
449
+ }
450
+ if (i !== !0 || (l.matches(ft) && (o = l), o = o || Mt(l), o))
451
+ return;
452
+ l.querySelectorAll("slot").forEach((h) => {
453
+ o || (o = Ht(h));
454
+ });
455
+ }, r = (l, a) => async () => {
456
+ if (this.open !== i)
457
+ return;
458
+ const c = i ? "luzmo-opened" : "luzmo-closed";
459
+ if (l.dispatchEvent(
460
+ new z(c, this, {
461
+ interaction: this.type
462
+ })
463
+ ), a > 0)
464
+ return;
465
+ const h = this.triggerElement instanceof mt;
466
+ this.dispatchEvent(
467
+ new z(c, this, {
468
+ interaction: this.type,
469
+ publish: h
470
+ })
471
+ ), this.triggerElement && !h && this.triggerElement.dispatchEvent(
472
+ new z(c, this, {
473
+ interaction: this.type,
474
+ publish: !0
475
+ })
476
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await L(), await L(), i === this.open && i === !1 && this.requestSlottable();
477
+ };
478
+ return this.elements.forEach((l, a) => {
479
+ Bt(l, s(l, a), r(l, a));
480
+ }), o;
481
+ }
482
+ }
483
+ return t;
484
+ }
485
+ const Ve = CSS.supports("(overlay: auto)");
486
+ function Qt(e) {
487
+ let t = !1;
488
+ try {
489
+ t = e.matches(":popover-open");
490
+ } catch {
491
+ }
492
+ let n = !1;
493
+ try {
494
+ n = e.matches(":open");
495
+ } catch {
496
+ }
497
+ return t || n;
498
+ }
499
+ function Ue(e) {
500
+ class t extends e {
501
+ async manageDelay(i) {
502
+ if (i === !1 || i !== this.open) {
503
+ xt.close(this);
504
+ return;
505
+ }
506
+ this.delayed && await xt.openTimer(this) && (this.open = !i);
507
+ }
508
+ /**
509
+ * A popover should be hidden _after_ it is no longer on top-layer because
510
+ * the position metrics will have changed from when it was originally positioned.
511
+ */
512
+ shouldHidePopover(i) {
513
+ if (i && this.open !== i)
514
+ return;
515
+ const o = async ({
516
+ newState: s
517
+ } = {}) => {
518
+ s !== "open" && await this.placementController.resetOverlayPosition();
519
+ };
520
+ if (!Qt(this.dialogEl)) {
521
+ o();
522
+ return;
523
+ }
524
+ this.dialogEl.addEventListener("toggle", o, {
525
+ once: !0
526
+ });
527
+ }
528
+ shouldShowPopover(i) {
529
+ let o = !1;
530
+ try {
531
+ o = this.dialogEl.matches(":popover-open");
532
+ } catch {
533
+ }
534
+ let s = !1;
535
+ try {
536
+ s = this.dialogEl.matches(":open");
537
+ } catch {
538
+ }
539
+ i && this.open === i && !o && !s && this.isConnected && (this.dialogEl.showPopover(), this.managePosition());
540
+ }
541
+ async ensureOnDOM(i) {
542
+ await L(), Ve || await this.shouldHidePopover(i), this.shouldShowPopover(i), await L();
543
+ }
544
+ makeTransition(i) {
545
+ if (this.open !== i)
546
+ return null;
547
+ let o = null;
548
+ const s = (l, a) => () => {
549
+ if (l.open = i, a === 0) {
550
+ const h = i ? It : qt;
551
+ this.dispatchEvent(new h());
552
+ }
553
+ if (!i || (l.matches(ft) && (o = l), o = o || Mt(l), o))
554
+ return;
555
+ l.querySelectorAll("slot").forEach((h) => {
556
+ o || (o = Ht(h));
557
+ });
558
+ }, r = (l, a) => () => {
559
+ if (this.open !== i)
560
+ return;
561
+ const c = i ? "luzmo-opened" : "luzmo-closed";
562
+ if (a > 0) {
563
+ l.dispatchEvent(
564
+ new z(c, this, {
565
+ interaction: this.type,
566
+ publish: !1
567
+ })
568
+ );
569
+ return;
570
+ }
571
+ const h = async () => {
572
+ if (this.open !== i)
573
+ return;
574
+ await L();
575
+ const f = this.triggerElement instanceof mt;
576
+ this.dispatchEvent(
577
+ new z(c, this, {
578
+ interaction: this.type,
579
+ publish: f
580
+ })
581
+ ), l.dispatchEvent(
582
+ new z(c, this, {
583
+ interaction: this.type,
584
+ publish: !1
585
+ })
586
+ ), this.triggerElement && !f && this.triggerElement.dispatchEvent(
587
+ new z(c, this, {
588
+ interaction: this.type,
589
+ publish: !0
590
+ })
591
+ ), this.state = i ? "opened" : "closed", this.returnFocus(), await L(), await L(), i === this.open && i === !1 && this.requestSlottable();
592
+ };
593
+ if (this.open !== i)
594
+ return;
595
+ const d = Qt(this.dialogEl);
596
+ i !== !0 && d && this.isConnected ? (this.dialogEl.addEventListener(
597
+ "beforetoggle",
598
+ () => {
599
+ h();
600
+ },
601
+ { once: !0 }
602
+ ), this.dialogEl.hidePopover()) : h();
603
+ };
604
+ return this.elements.forEach((l, a) => {
605
+ Bt(l, s(l, a), r(l, a));
606
+ }), o;
607
+ }
608
+ }
609
+ return t;
610
+ }
611
+ const je = "showPopover" in document.createElement("div");
612
+ class Ke {
613
+ constructor() {
614
+ this.root = document.body, this.stack = [], this.handlePointerdown = (t) => {
615
+ this.pointerdownPath = t.composedPath(), this.lastOverlay = this.stack.at(-1);
616
+ }, this.handlePointerup = () => {
617
+ const t = this.pointerdownPath;
618
+ if (this.pointerdownPath = void 0, this.stack.length === 0 || !(t != null && t.length))
619
+ return;
620
+ const n = this.lastOverlay;
621
+ this.lastOverlay = void 0;
622
+ const i = this.stack.length - 1, o = this.stack.filter((s, r) => !t.find(
623
+ (a) => (
624
+ // The Overlay is in the stack
625
+ a === s || a === (s == null ? void 0 : s.triggerElement) && (s == null ? void 0 : s.type) === "hint" || r === i && s !== n && s.triggerInteraction === "longpress"
626
+ )
627
+ ) && !s.shouldPreventClose() && s.type !== "manual" && !(s.type === "modal" && n !== s));
628
+ o.reverse(), o.forEach((s) => {
629
+ this.closeOverlay(s);
630
+ let r = s.parentOverlayToForceClose;
631
+ for (; r; )
632
+ this.closeOverlay(r), r = r.parentOverlayToForceClose;
633
+ });
634
+ }, this.handleBeforetoggle = (t) => {
635
+ const { target: n, newState: i } = t;
636
+ i !== "open" && this.closeOverlay(n);
637
+ }, this.handleKeydown = (t) => {
638
+ if (t.code !== "Escape" || this.stack.length === 0)
639
+ return;
640
+ const n = this.stack.at(-1);
641
+ if ((n == null ? void 0 : n.type) === "page") {
642
+ t.preventDefault();
643
+ return;
644
+ }
645
+ je || (n == null ? void 0 : n.type) !== "manual" && n && this.closeOverlay(n);
646
+ }, this.bindEvents();
647
+ }
648
+ get document() {
649
+ return this.root.ownerDocument || document;
650
+ }
651
+ bindEvents() {
652
+ this.document.addEventListener("pointerdown", this.handlePointerdown), this.document.addEventListener("pointerup", this.handlePointerup), this.document.addEventListener("keydown", this.handleKeydown);
653
+ }
654
+ closeOverlay(t) {
655
+ const n = this.stack.indexOf(t);
656
+ n !== -1 && this.stack.splice(n, 1), t.open = !1;
657
+ }
658
+ /**
659
+ * Get an array of Overlays that all share the same trigger element.
660
+ *
661
+ * @param triggerElement {HTMLELement}
662
+ * @returns
663
+ */
664
+ overlaysByTriggerElement(t) {
665
+ return this.stack.filter(
666
+ (n) => n.triggerElement === t
667
+ );
668
+ }
669
+ /**
670
+ * When overlays are added manage the open state of exisiting overlays appropriately:
671
+ * - 'modal': should close other non-'modal' and non-'manual' overlays
672
+ * - 'page': should close other non-'modal' and non-'manual' overlays
673
+ * - 'auto': should close other 'auto' overlays and other 'hint' overlays, but not 'manual' overlays
674
+ * - 'manual': shouldn't close other overlays
675
+ * - 'hint': shouldn't close other overlays and give way to all other overlays on a trigger
676
+ */
677
+ add(t) {
678
+ if (this.stack.includes(t)) {
679
+ const n = this.stack.indexOf(t);
680
+ n !== -1 && (this.stack.splice(n, 1), this.stack.push(t));
681
+ return;
682
+ }
683
+ if (t.type === "auto" || t.type === "modal" || t.type === "page") {
684
+ const n = "luzmo-overlay-query-path", i = new Event(n, {
685
+ composed: !0,
686
+ bubbles: !0
687
+ });
688
+ t.addEventListener(
689
+ n,
690
+ (o) => {
691
+ const s = o.composedPath();
692
+ this.stack.forEach((r) => {
693
+ !s.find((a) => a === r) && r.type !== "manual" && r.type !== "modal" && this.closeOverlay(r);
694
+ });
695
+ },
696
+ { once: !0 }
697
+ ), t.dispatchEvent(i);
698
+ } else if (t.type === "hint") {
699
+ if (this.stack.some((i) => i.type !== "manual" && i.triggerElement && i.triggerElement === t.triggerElement)) {
700
+ t.open = !1;
701
+ return;
702
+ }
703
+ this.stack.forEach((i) => {
704
+ i.type === "hint" && this.closeOverlay(i);
705
+ });
706
+ }
707
+ requestAnimationFrame(() => {
708
+ this.stack.push(t), t.addEventListener("beforetoggle", this.handleBeforetoggle, {
709
+ once: !0
710
+ });
711
+ });
712
+ }
713
+ remove(t) {
714
+ this.closeOverlay(t);
715
+ }
716
+ }
717
+ const Zt = new Ke(), Ye = ':host{display:contents;pointer-events:none;--luzmo-overlay-animation-distance: .5rem}:host(:has(> luzmo-tooltip)){--luzmo-overlay-animation-distance: var( --luzmo-tooltip-animation-distance, 4px )}.dialog{margin:0;border:0;background:none;padding:0;position:fixed;overflow:visible;opacity:1!important;box-sizing:border-box;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);height:auto;inset:auto;top:0;left:0;display:flex;--luzmo-overlay-open: true}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}:host(:not([open])) .dialog{--luzmo-overlay-open: false}.dialog::backdrop{display:none}.dialog:before{position:absolute;top:-999em;right:-999em;bottom:-999em;left:-999em;content:"";pointer-events:auto!important}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(luzmo-popover){position:static}.dialog:not([actual-placement])[placement*=top]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:var(--luzmo-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=bottom]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog:not([actual-placement])[placement*=left]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:var(--luzmo-overlay-animation-distance)}.dialog[actual-placement*=top]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:var(--luzmo-overlay-animation-distance)}.dialog[actual-placement*=right]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog[actual-placement*=bottom]{padding-block:var(--luzmo-overlay-animation-distance);margin-top:calc(-1 * var(--luzmo-overlay-animation-distance))}.dialog[actual-placement*=left]{padding-inline:var(--luzmo-overlay-animation-distance);margin-left:var(--luzmo-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{opacity:1;--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{opacity:1;--luzmo-popover-filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, .15))}}@supports (overlay: auto){.dialog{display:none;transition:all var(--luzmo-overlay-animation-duration, .13s),translate 0s,display var(--luzmo-overlay-animation-duration, .13s);transition-behavior:allow-discrete}.dialog:popover-open,.dialog:modal{display:flex}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--luzmo-overlay-z-index-base, 1000) + var(--luzmo-overlay-open-count))}}', J = Math.min, D = Math.max, Ct = Math.round, yt = Math.floor, q = (e) => ({
718
+ x: e,
719
+ y: e
720
+ }), Ge = {
721
+ left: "right",
722
+ right: "left",
723
+ bottom: "top",
724
+ top: "bottom"
725
+ }, Xe = {
726
+ start: "end",
727
+ end: "start"
728
+ };
729
+ function $t(e, t, n) {
730
+ return D(e, J(t, n));
731
+ }
732
+ function at(e, t) {
733
+ return typeof e == "function" ? e(t) : e;
734
+ }
735
+ function Q(e) {
736
+ return e.split("-")[0];
737
+ }
738
+ function ct(e) {
739
+ return e.split("-")[1];
740
+ }
741
+ function ue(e) {
742
+ return e === "x" ? "y" : "x";
743
+ }
744
+ function Wt(e) {
745
+ return e === "y" ? "height" : "width";
746
+ }
747
+ function et(e) {
748
+ return ["top", "bottom"].includes(Q(e)) ? "y" : "x";
749
+ }
750
+ function Vt(e) {
751
+ return ue(et(e));
752
+ }
753
+ function Je(e, t, n) {
754
+ n === void 0 && (n = !1);
755
+ const i = ct(e), o = Vt(e), s = Wt(o);
756
+ let r = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
757
+ return t.reference[s] > t.floating[s] && (r = Pt(r)), [r, Pt(r)];
758
+ }
759
+ function Qe(e) {
760
+ const t = Pt(e);
761
+ return [Ft(e), t, Ft(t)];
762
+ }
763
+ function Ft(e) {
764
+ return e.replace(/start|end/g, (t) => Xe[t]);
765
+ }
766
+ function Ze(e, t, n) {
767
+ const i = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
768
+ switch (e) {
769
+ case "top":
770
+ case "bottom":
771
+ return n ? t ? o : i : t ? i : o;
772
+ case "left":
773
+ case "right":
774
+ return t ? s : r;
775
+ default:
776
+ return [];
777
+ }
778
+ }
779
+ function tn(e, t, n, i) {
780
+ const o = ct(e);
781
+ let s = Ze(Q(e), n === "start", i);
782
+ return o && (s = s.map((r) => r + "-" + o), t && (s = s.concat(s.map(Ft)))), s;
783
+ }
784
+ function Pt(e) {
785
+ return e.replace(/left|right|bottom|top/g, (t) => Ge[t]);
786
+ }
787
+ function en(e) {
788
+ return {
789
+ top: 0,
790
+ right: 0,
791
+ bottom: 0,
792
+ left: 0,
793
+ ...e
794
+ };
795
+ }
796
+ function pe(e) {
797
+ return typeof e != "number" ? en(e) : {
798
+ top: e,
799
+ right: e,
800
+ bottom: e,
801
+ left: e
802
+ };
803
+ }
804
+ function Ot(e) {
805
+ const {
806
+ x: t,
807
+ y: n,
808
+ width: i,
809
+ height: o
810
+ } = e;
811
+ return {
812
+ width: i,
813
+ height: o,
814
+ top: n,
815
+ left: t,
816
+ right: t + i,
817
+ bottom: n + o,
818
+ x: t,
819
+ y: n
820
+ };
821
+ }
822
+ function te(e, t, n) {
823
+ let {
824
+ reference: i,
825
+ floating: o
826
+ } = e;
827
+ const s = et(t), r = Vt(t), l = Wt(r), a = Q(t), c = s === "y", h = i.x + i.width / 2 - o.width / 2, d = i.y + i.height / 2 - o.height / 2, f = i[l] / 2 - o[l] / 2;
828
+ let u;
829
+ switch (a) {
830
+ case "top":
831
+ u = {
832
+ x: h,
833
+ y: i.y - o.height
834
+ };
835
+ break;
836
+ case "bottom":
837
+ u = {
838
+ x: h,
839
+ y: i.y + i.height
840
+ };
841
+ break;
842
+ case "right":
843
+ u = {
844
+ x: i.x + i.width,
845
+ y: d
846
+ };
847
+ break;
848
+ case "left":
849
+ u = {
850
+ x: i.x - o.width,
851
+ y: d
852
+ };
853
+ break;
854
+ default:
855
+ u = {
856
+ x: i.x,
857
+ y: i.y
858
+ };
859
+ }
860
+ switch (ct(t)) {
861
+ case "start":
862
+ u[r] -= f * (n && c ? -1 : 1);
863
+ break;
864
+ case "end":
865
+ u[r] += f * (n && c ? -1 : 1);
866
+ break;
867
+ }
868
+ return u;
869
+ }
870
+ const nn = async (e, t, n) => {
871
+ const {
872
+ placement: i = "bottom",
873
+ strategy: o = "absolute",
874
+ middleware: s = [],
875
+ platform: r
876
+ } = n, l = s.filter(Boolean), a = await (r.isRTL == null ? void 0 : r.isRTL(t));
877
+ let c = await r.getElementRects({
878
+ reference: e,
879
+ floating: t,
880
+ strategy: o
881
+ }), {
882
+ x: h,
883
+ y: d
884
+ } = te(c, i, a), f = i, u = {}, p = 0;
885
+ for (let m = 0; m < l.length; m++) {
886
+ const {
887
+ name: v,
888
+ fn: g
889
+ } = l[m], {
890
+ x: y,
891
+ y: b,
892
+ data: E,
893
+ reset: w
894
+ } = await g({
895
+ x: h,
896
+ y: d,
897
+ initialPlacement: i,
898
+ placement: f,
899
+ strategy: o,
900
+ middlewareData: u,
901
+ rects: c,
902
+ platform: r,
903
+ elements: {
904
+ reference: e,
905
+ floating: t
906
+ }
907
+ });
908
+ h = y ?? h, d = b ?? d, u = {
909
+ ...u,
910
+ [v]: {
911
+ ...u[v],
912
+ ...E
913
+ }
914
+ }, w && p <= 50 && (p++, typeof w == "object" && (w.placement && (f = w.placement), w.rects && (c = w.rects === !0 ? await r.getElementRects({
915
+ reference: e,
916
+ floating: t,
917
+ strategy: o
918
+ }) : w.rects), {
919
+ x: h,
920
+ y: d
921
+ } = te(c, f, a)), m = -1);
922
+ }
923
+ return {
924
+ x: h,
925
+ y: d,
926
+ placement: f,
927
+ strategy: o,
928
+ middlewareData: u
929
+ };
930
+ };
931
+ async function Ut(e, t) {
932
+ var n;
933
+ t === void 0 && (t = {});
934
+ const {
935
+ x: i,
936
+ y: o,
937
+ platform: s,
938
+ rects: r,
939
+ elements: l,
940
+ strategy: a
941
+ } = e, {
942
+ boundary: c = "clippingAncestors",
943
+ rootBoundary: h = "viewport",
944
+ elementContext: d = "floating",
945
+ altBoundary: f = !1,
946
+ padding: u = 0
947
+ } = at(t, e), p = pe(u), v = l[f ? d === "floating" ? "reference" : "floating" : d], g = Ot(await s.getClippingRect({
948
+ element: (n = await (s.isElement == null ? void 0 : s.isElement(v))) == null || n ? v : v.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
949
+ boundary: c,
950
+ rootBoundary: h,
951
+ strategy: a
952
+ })), y = d === "floating" ? {
953
+ x: i,
954
+ y: o,
955
+ width: r.floating.width,
956
+ height: r.floating.height
957
+ } : r.reference, b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), E = await (s.isElement == null ? void 0 : s.isElement(b)) ? await (s.getScale == null ? void 0 : s.getScale(b)) || {
958
+ x: 1,
959
+ y: 1
960
+ } : {
961
+ x: 1,
962
+ y: 1
963
+ }, w = Ot(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
964
+ elements: l,
965
+ rect: y,
966
+ offsetParent: b,
967
+ strategy: a
968
+ }) : y);
969
+ return {
970
+ top: (g.top - w.top + p.top) / E.y,
971
+ bottom: (w.bottom - g.bottom + p.bottom) / E.y,
972
+ left: (g.left - w.left + p.left) / E.x,
973
+ right: (w.right - g.right + p.right) / E.x
974
+ };
975
+ }
976
+ const on = (e) => ({
977
+ name: "arrow",
978
+ options: e,
979
+ async fn(t) {
980
+ const {
981
+ x: n,
982
+ y: i,
983
+ placement: o,
984
+ rects: s,
985
+ platform: r,
986
+ elements: l,
987
+ middlewareData: a
988
+ } = t, {
989
+ element: c,
990
+ padding: h = 0
991
+ } = at(e, t) || {};
992
+ if (c == null)
993
+ return {};
994
+ const d = pe(h), f = {
995
+ x: n,
996
+ y: i
997
+ }, u = Vt(o), p = Wt(u), m = await r.getDimensions(c), v = u === "y", g = v ? "top" : "left", y = v ? "bottom" : "right", b = v ? "clientHeight" : "clientWidth", E = s.reference[p] + s.reference[u] - f[u] - s.floating[p], w = f[u] - s.reference[u], $ = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c));
998
+ let C = $ ? $[b] : 0;
999
+ (!C || !await (r.isElement == null ? void 0 : r.isElement($))) && (C = l.floating[b] || s.floating[p]);
1000
+ const V = E / 2 - w / 2, B = C / 2 - m[p] / 2 - 1, F = J(d[g], B), K = J(d[y], B), M = F, Y = C - m[p] - K, A = C / 2 - m[p] / 2 + V, it = $t(M, A, Y), U = !a.arrow && ct(o) != null && A !== it && s.reference[p] / 2 - (A < M ? F : K) - m[p] / 2 < 0, H = U ? A < M ? A - M : A - Y : 0;
1001
+ return {
1002
+ [u]: f[u] + H,
1003
+ data: {
1004
+ [u]: it,
1005
+ centerOffset: A - it - H,
1006
+ ...U && {
1007
+ alignmentOffset: H
1008
+ }
1009
+ },
1010
+ reset: U
1011
+ };
1012
+ }
1013
+ }), sn = function(e) {
1014
+ return e === void 0 && (e = {}), {
1015
+ name: "flip",
1016
+ options: e,
1017
+ async fn(t) {
1018
+ var n, i;
1019
+ const {
1020
+ placement: o,
1021
+ middlewareData: s,
1022
+ rects: r,
1023
+ initialPlacement: l,
1024
+ platform: a,
1025
+ elements: c
1026
+ } = t, {
1027
+ mainAxis: h = !0,
1028
+ crossAxis: d = !0,
1029
+ fallbackPlacements: f,
1030
+ fallbackStrategy: u = "bestFit",
1031
+ fallbackAxisSideDirection: p = "none",
1032
+ flipAlignment: m = !0,
1033
+ ...v
1034
+ } = at(e, t);
1035
+ if ((n = s.arrow) != null && n.alignmentOffset)
1036
+ return {};
1037
+ const g = Q(o), y = et(l), b = Q(l) === l, E = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), w = f || (b || !m ? [Pt(l)] : Qe(l)), $ = p !== "none";
1038
+ !f && $ && w.push(...tn(l, m, p, E));
1039
+ const C = [l, ...w], V = await Ut(t, v), B = [];
1040
+ let F = ((i = s.flip) == null ? void 0 : i.overflows) || [];
1041
+ if (h && B.push(V[g]), d) {
1042
+ const A = Je(o, r, E);
1043
+ B.push(V[A[0]], V[A[1]]);
1044
+ }
1045
+ if (F = [...F, {
1046
+ placement: o,
1047
+ overflows: B
1048
+ }], !B.every((A) => A <= 0)) {
1049
+ var K, M;
1050
+ const A = (((K = s.flip) == null ? void 0 : K.index) || 0) + 1, it = C[A];
1051
+ if (it)
1052
+ return {
1053
+ data: {
1054
+ index: A,
1055
+ overflows: F
1056
+ },
1057
+ reset: {
1058
+ placement: it
1059
+ }
1060
+ };
1061
+ let U = (M = F.filter((H) => H.overflows[0] <= 0).sort((H, G) => H.overflows[1] - G.overflows[1])[0]) == null ? void 0 : M.placement;
1062
+ if (!U)
1063
+ switch (u) {
1064
+ case "bestFit": {
1065
+ var Y;
1066
+ const H = (Y = F.filter((G) => {
1067
+ if ($) {
1068
+ const X = et(G.placement);
1069
+ return X === y || // Create a bias to the `y` side axis due to horizontal
1070
+ // reading directions favoring greater width.
1071
+ X === "y";
1072
+ }
1073
+ return !0;
1074
+ }).map((G) => [G.placement, G.overflows.filter((X) => X > 0).reduce((X, Pe) => X + Pe, 0)]).sort((G, X) => G[1] - X[1])[0]) == null ? void 0 : Y[0];
1075
+ H && (U = H);
1076
+ break;
1077
+ }
1078
+ case "initialPlacement":
1079
+ U = l;
1080
+ break;
1081
+ }
1082
+ if (o !== U)
1083
+ return {
1084
+ reset: {
1085
+ placement: U
1086
+ }
1087
+ };
1088
+ }
1089
+ return {};
1090
+ }
1091
+ };
1092
+ };
1093
+ async function rn(e, t) {
1094
+ const {
1095
+ placement: n,
1096
+ platform: i,
1097
+ elements: o
1098
+ } = e, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = Q(n), l = ct(n), a = et(n) === "y", c = ["left", "top"].includes(r) ? -1 : 1, h = s && a ? -1 : 1, d = at(t, e);
1099
+ let {
1100
+ mainAxis: f,
1101
+ crossAxis: u,
1102
+ alignmentAxis: p
1103
+ } = typeof d == "number" ? {
1104
+ mainAxis: d,
1105
+ crossAxis: 0,
1106
+ alignmentAxis: null
1107
+ } : {
1108
+ mainAxis: d.mainAxis || 0,
1109
+ crossAxis: d.crossAxis || 0,
1110
+ alignmentAxis: d.alignmentAxis
1111
+ };
1112
+ return l && typeof p == "number" && (u = l === "end" ? p * -1 : p), a ? {
1113
+ x: u * h,
1114
+ y: f * c
1115
+ } : {
1116
+ x: f * c,
1117
+ y: u * h
1118
+ };
1119
+ }
1120
+ const ln = function(e) {
1121
+ return e === void 0 && (e = 0), {
1122
+ name: "offset",
1123
+ options: e,
1124
+ async fn(t) {
1125
+ var n, i;
1126
+ const {
1127
+ x: o,
1128
+ y: s,
1129
+ placement: r,
1130
+ middlewareData: l
1131
+ } = t, a = await rn(t, e);
1132
+ return r === ((n = l.offset) == null ? void 0 : n.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
1133
+ x: o + a.x,
1134
+ y: s + a.y,
1135
+ data: {
1136
+ ...a,
1137
+ placement: r
1138
+ }
1139
+ };
1140
+ }
1141
+ };
1142
+ }, an = function(e) {
1143
+ return e === void 0 && (e = {}), {
1144
+ name: "shift",
1145
+ options: e,
1146
+ async fn(t) {
1147
+ const {
1148
+ x: n,
1149
+ y: i,
1150
+ placement: o
1151
+ } = t, {
1152
+ mainAxis: s = !0,
1153
+ crossAxis: r = !1,
1154
+ limiter: l = {
1155
+ fn: (v) => {
1156
+ let {
1157
+ x: g,
1158
+ y
1159
+ } = v;
1160
+ return {
1161
+ x: g,
1162
+ y
1163
+ };
1164
+ }
1165
+ },
1166
+ ...a
1167
+ } = at(e, t), c = {
1168
+ x: n,
1169
+ y: i
1170
+ }, h = await Ut(t, a), d = et(Q(o)), f = ue(d);
1171
+ let u = c[f], p = c[d];
1172
+ if (s) {
1173
+ const v = f === "y" ? "top" : "left", g = f === "y" ? "bottom" : "right", y = u + h[v], b = u - h[g];
1174
+ u = $t(y, u, b);
1175
+ }
1176
+ if (r) {
1177
+ const v = d === "y" ? "top" : "left", g = d === "y" ? "bottom" : "right", y = p + h[v], b = p - h[g];
1178
+ p = $t(y, p, b);
1179
+ }
1180
+ const m = l.fn({
1181
+ ...t,
1182
+ [f]: u,
1183
+ [d]: p
1184
+ });
1185
+ return {
1186
+ ...m,
1187
+ data: {
1188
+ x: m.x - n,
1189
+ y: m.y - i,
1190
+ enabled: {
1191
+ [f]: s,
1192
+ [d]: r
1193
+ }
1194
+ }
1195
+ };
1196
+ }
1197
+ };
1198
+ }, cn = function(e) {
1199
+ return e === void 0 && (e = {}), {
1200
+ name: "size",
1201
+ options: e,
1202
+ async fn(t) {
1203
+ var n, i;
1204
+ const {
1205
+ placement: o,
1206
+ rects: s,
1207
+ platform: r,
1208
+ elements: l
1209
+ } = t, {
1210
+ apply: a = () => {
1211
+ },
1212
+ ...c
1213
+ } = at(e, t), h = await Ut(t, c), d = Q(o), f = ct(o), u = et(o) === "y", {
1214
+ width: p,
1215
+ height: m
1216
+ } = s.floating;
1217
+ let v, g;
1218
+ d === "top" || d === "bottom" ? (v = d, g = f === (await (r.isRTL == null ? void 0 : r.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (g = d, v = f === "end" ? "top" : "bottom");
1219
+ const y = m - h.top - h.bottom, b = p - h.left - h.right, E = J(m - h[v], y), w = J(p - h[g], b), $ = !t.middlewareData.shift;
1220
+ let C = E, V = w;
1221
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (V = b), (i = t.middlewareData.shift) != null && i.enabled.y && (C = y), $ && !f) {
1222
+ const F = D(h.left, 0), K = D(h.right, 0), M = D(h.top, 0), Y = D(h.bottom, 0);
1223
+ u ? V = p - 2 * (F !== 0 || K !== 0 ? F + K : D(h.left, h.right)) : C = m - 2 * (M !== 0 || Y !== 0 ? M + Y : D(h.top, h.bottom));
1224
+ }
1225
+ await a({
1226
+ ...t,
1227
+ availableWidth: V,
1228
+ availableHeight: C
1229
+ });
1230
+ const B = await r.getDimensions(l.floating);
1231
+ return p !== B.width || m !== B.height ? {
1232
+ reset: {
1233
+ rects: !0
1234
+ }
1235
+ } : {};
1236
+ }
1237
+ };
1238
+ };
1239
+ function At() {
1240
+ return typeof window < "u";
1241
+ }
1242
+ function ht(e) {
1243
+ return fe(e) ? (e.nodeName || "").toLowerCase() : "#document";
1244
+ }
1245
+ function S(e) {
1246
+ var t;
1247
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1248
+ }
1249
+ function W(e) {
1250
+ var t;
1251
+ return (t = (fe(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1252
+ }
1253
+ function fe(e) {
1254
+ return At() ? e instanceof Node || e instanceof S(e).Node : !1;
1255
+ }
1256
+ function _(e) {
1257
+ return At() ? e instanceof Element || e instanceof S(e).Element : !1;
1258
+ }
1259
+ function I(e) {
1260
+ return At() ? e instanceof HTMLElement || e instanceof S(e).HTMLElement : !1;
1261
+ }
1262
+ function ee(e) {
1263
+ return !At() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof S(e).ShadowRoot;
1264
+ }
1265
+ function gt(e) {
1266
+ const {
1267
+ overflow: t,
1268
+ overflowX: n,
1269
+ overflowY: i,
1270
+ display: o
1271
+ } = N(e);
1272
+ return /auto|scroll|overlay|hidden|clip/.test(t + i + n) && !["inline", "contents"].includes(o);
1273
+ }
1274
+ function hn(e) {
1275
+ return ["table", "td", "th"].includes(ht(e));
1276
+ }
1277
+ function Tt(e) {
1278
+ return [":popover-open", ":modal"].some((t) => {
1279
+ try {
1280
+ return e.matches(t);
1281
+ } catch {
1282
+ return !1;
1283
+ }
1284
+ });
1285
+ }
1286
+ function jt(e) {
1287
+ const t = Kt(), n = _(e) ? N(e) : e;
1288
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((i) => (n.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (n.contain || "").includes(i));
1289
+ }
1290
+ function dn(e) {
1291
+ let t = Z(e);
1292
+ for (; I(t) && !lt(t); ) {
1293
+ if (jt(t))
1294
+ return t;
1295
+ if (Tt(t))
1296
+ return null;
1297
+ t = Z(t);
1298
+ }
1299
+ return null;
1300
+ }
1301
+ function Kt() {
1302
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1303
+ }
1304
+ function lt(e) {
1305
+ return ["html", "body", "#document"].includes(ht(e));
1306
+ }
1307
+ function N(e) {
1308
+ return S(e).getComputedStyle(e);
1309
+ }
1310
+ function Rt(e) {
1311
+ return _(e) ? {
1312
+ scrollLeft: e.scrollLeft,
1313
+ scrollTop: e.scrollTop
1314
+ } : {
1315
+ scrollLeft: e.scrollX,
1316
+ scrollTop: e.scrollY
1317
+ };
1318
+ }
1319
+ function Z(e) {
1320
+ if (ht(e) === "html")
1321
+ return e;
1322
+ const t = (
1323
+ // Step into the shadow DOM of the parent of a slotted node.
1324
+ e.assignedSlot || // DOM Element detected.
1325
+ e.parentNode || // ShadowRoot detected.
1326
+ ee(e) && e.host || // Fallback.
1327
+ W(e)
1328
+ );
1329
+ return ee(t) ? t.host : t;
1330
+ }
1331
+ function me(e) {
1332
+ const t = Z(e);
1333
+ return lt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : I(t) && gt(t) ? t : me(t);
1334
+ }
1335
+ function dt(e, t, n) {
1336
+ var i;
1337
+ t === void 0 && (t = []), n === void 0 && (n = !0);
1338
+ const o = me(e), s = o === ((i = e.ownerDocument) == null ? void 0 : i.body), r = S(o);
1339
+ if (s) {
1340
+ const l = zt(r);
1341
+ return t.concat(r, r.visualViewport || [], gt(o) ? o : [], l && n ? dt(l) : []);
1342
+ }
1343
+ return t.concat(o, dt(o, [], n));
1344
+ }
1345
+ function zt(e) {
1346
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1347
+ }
1348
+ function ge(e) {
1349
+ const t = N(e);
1350
+ let n = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
1351
+ const o = I(e), s = o ? e.offsetWidth : n, r = o ? e.offsetHeight : i, l = Ct(n) !== s || Ct(i) !== r;
1352
+ return l && (n = s, i = r), {
1353
+ width: n,
1354
+ height: i,
1355
+ $: l
1356
+ };
1357
+ }
1358
+ function Yt(e) {
1359
+ return _(e) ? e : e.contextElement;
1360
+ }
1361
+ function ot(e) {
1362
+ const t = Yt(e);
1363
+ if (!I(t))
1364
+ return q(1);
1365
+ const n = t.getBoundingClientRect(), {
1366
+ width: i,
1367
+ height: o,
1368
+ $: s
1369
+ } = ge(t);
1370
+ let r = (s ? Ct(n.width) : n.width) / i, l = (s ? Ct(n.height) : n.height) / o;
1371
+ return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
1372
+ x: r,
1373
+ y: l
1374
+ };
1375
+ }
1376
+ const un = /* @__PURE__ */ q(0);
1377
+ function ve(e) {
1378
+ const t = S(e);
1379
+ return !Kt() || !t.visualViewport ? un : {
1380
+ x: t.visualViewport.offsetLeft,
1381
+ y: t.visualViewport.offsetTop
1382
+ };
1383
+ }
1384
+ function pn(e, t, n) {
1385
+ return t === void 0 && (t = !1), !n || t && n !== S(e) ? !1 : t;
1386
+ }
1387
+ function nt(e, t, n, i) {
1388
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1389
+ const o = e.getBoundingClientRect(), s = Yt(e);
1390
+ let r = q(1);
1391
+ t && (i ? _(i) && (r = ot(i)) : r = ot(e));
1392
+ const l = pn(s, n, i) ? ve(s) : q(0);
1393
+ let a = (o.left + l.x) / r.x, c = (o.top + l.y) / r.y, h = o.width / r.x, d = o.height / r.y;
1394
+ if (s) {
1395
+ const f = S(s), u = i && _(i) ? S(i) : i;
1396
+ let p = f, m = zt(p);
1397
+ for (; m && i && u !== p; ) {
1398
+ const v = ot(m), g = m.getBoundingClientRect(), y = N(m), b = g.left + (m.clientLeft + parseFloat(y.paddingLeft)) * v.x, E = g.top + (m.clientTop + parseFloat(y.paddingTop)) * v.y;
1399
+ a *= v.x, c *= v.y, h *= v.x, d *= v.y, a += b, c += E, p = S(m), m = zt(p);
1400
+ }
1401
+ }
1402
+ return Ot({
1403
+ width: h,
1404
+ height: d,
1405
+ x: a,
1406
+ y: c
1407
+ });
1408
+ }
1409
+ function Gt(e, t) {
1410
+ const n = Rt(e).scrollLeft;
1411
+ return t ? t.left + n : nt(W(e)).left + n;
1412
+ }
1413
+ function ye(e, t, n) {
1414
+ n === void 0 && (n = !1);
1415
+ const i = e.getBoundingClientRect(), o = i.left + t.scrollLeft - (n ? 0 : (
1416
+ // RTL <body> scrollbar.
1417
+ Gt(e, i)
1418
+ )), s = i.top + t.scrollTop;
1419
+ return {
1420
+ x: o,
1421
+ y: s
1422
+ };
1423
+ }
1424
+ function fn(e) {
1425
+ let {
1426
+ elements: t,
1427
+ rect: n,
1428
+ offsetParent: i,
1429
+ strategy: o
1430
+ } = e;
1431
+ const s = o === "fixed", r = W(i), l = t ? Tt(t.floating) : !1;
1432
+ if (i === r || l && s)
1433
+ return n;
1434
+ let a = {
1435
+ scrollLeft: 0,
1436
+ scrollTop: 0
1437
+ }, c = q(1);
1438
+ const h = q(0), d = I(i);
1439
+ if ((d || !d && !s) && ((ht(i) !== "body" || gt(r)) && (a = Rt(i)), I(i))) {
1440
+ const u = nt(i);
1441
+ c = ot(i), h.x = u.x + i.clientLeft, h.y = u.y + i.clientTop;
1442
+ }
1443
+ const f = r && !d && !s ? ye(r, a, !0) : q(0);
1444
+ return {
1445
+ width: n.width * c.x,
1446
+ height: n.height * c.y,
1447
+ x: n.x * c.x - a.scrollLeft * c.x + h.x + f.x,
1448
+ y: n.y * c.y - a.scrollTop * c.y + h.y + f.y
1449
+ };
1450
+ }
1451
+ function mn(e) {
1452
+ return Array.from(e.getClientRects());
1453
+ }
1454
+ function gn(e) {
1455
+ const t = W(e), n = Rt(e), i = e.ownerDocument.body, o = D(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), s = D(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
1456
+ let r = -n.scrollLeft + Gt(e);
1457
+ const l = -n.scrollTop;
1458
+ return N(i).direction === "rtl" && (r += D(t.clientWidth, i.clientWidth) - o), {
1459
+ width: o,
1460
+ height: s,
1461
+ x: r,
1462
+ y: l
1463
+ };
1464
+ }
1465
+ function vn(e, t) {
1466
+ const n = S(e), i = W(e), o = n.visualViewport;
1467
+ let s = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
1468
+ if (o) {
1469
+ s = o.width, r = o.height;
1470
+ const c = Kt();
1471
+ (!c || c && t === "fixed") && (l = o.offsetLeft, a = o.offsetTop);
1472
+ }
1473
+ return {
1474
+ width: s,
1475
+ height: r,
1476
+ x: l,
1477
+ y: a
1478
+ };
1479
+ }
1480
+ function yn(e, t) {
1481
+ const n = nt(e, !0, t === "fixed"), i = n.top + e.clientTop, o = n.left + e.clientLeft, s = I(e) ? ot(e) : q(1), r = e.clientWidth * s.x, l = e.clientHeight * s.y, a = o * s.x, c = i * s.y;
1482
+ return {
1483
+ width: r,
1484
+ height: l,
1485
+ x: a,
1486
+ y: c
1487
+ };
1488
+ }
1489
+ function ne(e, t, n) {
1490
+ let i;
1491
+ if (t === "viewport")
1492
+ i = vn(e, n);
1493
+ else if (t === "document")
1494
+ i = gn(W(e));
1495
+ else if (_(t))
1496
+ i = yn(t, n);
1497
+ else {
1498
+ const o = ve(e);
1499
+ i = {
1500
+ x: t.x - o.x,
1501
+ y: t.y - o.y,
1502
+ width: t.width,
1503
+ height: t.height
1504
+ };
1505
+ }
1506
+ return Ot(i);
1507
+ }
1508
+ function be(e, t) {
1509
+ const n = Z(e);
1510
+ return n === t || !_(n) || lt(n) ? !1 : N(n).position === "fixed" || be(n, t);
1511
+ }
1512
+ function bn(e, t) {
1513
+ const n = t.get(e);
1514
+ if (n)
1515
+ return n;
1516
+ let i = dt(e, [], !1).filter((l) => _(l) && ht(l) !== "body"), o = null;
1517
+ const s = N(e).position === "fixed";
1518
+ let r = s ? Z(e) : e;
1519
+ for (; _(r) && !lt(r); ) {
1520
+ const l = N(r), a = jt(r);
1521
+ !a && l.position === "fixed" && (o = null), (s ? !a && !o : !a && l.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || gt(r) && !a && be(e, r)) ? i = i.filter((h) => h !== r) : o = l, r = Z(r);
1522
+ }
1523
+ return t.set(e, i), i;
1524
+ }
1525
+ function wn(e) {
1526
+ let {
1527
+ element: t,
1528
+ boundary: n,
1529
+ rootBoundary: i,
1530
+ strategy: o
1531
+ } = e;
1532
+ const r = [...n === "clippingAncestors" ? Tt(t) ? [] : bn(t, this._c) : [].concat(n), i], l = r[0], a = r.reduce((c, h) => {
1533
+ const d = ne(t, h, o);
1534
+ return c.top = D(d.top, c.top), c.right = J(d.right, c.right), c.bottom = J(d.bottom, c.bottom), c.left = D(d.left, c.left), c;
1535
+ }, ne(t, l, o));
1536
+ return {
1537
+ width: a.right - a.left,
1538
+ height: a.bottom - a.top,
1539
+ x: a.left,
1540
+ y: a.top
1541
+ };
1542
+ }
1543
+ function En(e) {
1544
+ const {
1545
+ width: t,
1546
+ height: n
1547
+ } = ge(e);
1548
+ return {
1549
+ width: t,
1550
+ height: n
1551
+ };
1552
+ }
1553
+ function xn(e, t, n) {
1554
+ const i = I(t), o = W(t), s = n === "fixed", r = nt(e, !0, s, t);
1555
+ let l = {
1556
+ scrollLeft: 0,
1557
+ scrollTop: 0
1558
+ };
1559
+ const a = q(0);
1560
+ if (i || !i && !s)
1561
+ if ((ht(t) !== "body" || gt(o)) && (l = Rt(t)), i) {
1562
+ const f = nt(t, !0, s, t);
1563
+ a.x = f.x + t.clientLeft, a.y = f.y + t.clientTop;
1564
+ } else o && (a.x = Gt(o));
1565
+ const c = o && !i && !s ? ye(o, l) : q(0), h = r.left + l.scrollLeft - a.x - c.x, d = r.top + l.scrollTop - a.y - c.y;
1566
+ return {
1567
+ x: h,
1568
+ y: d,
1569
+ width: r.width,
1570
+ height: r.height
1571
+ };
1572
+ }
1573
+ function kt(e) {
1574
+ return N(e).position === "static";
1575
+ }
1576
+ function ie(e, t) {
1577
+ if (!I(e) || N(e).position === "fixed")
1578
+ return null;
1579
+ if (t)
1580
+ return t(e);
1581
+ let n = e.offsetParent;
1582
+ return W(e) === n && (n = n.ownerDocument.body), n;
1583
+ }
1584
+ function we(e, t) {
1585
+ const n = S(e);
1586
+ if (Tt(e))
1587
+ return n;
1588
+ if (!I(e)) {
1589
+ let o = Z(e);
1590
+ for (; o && !lt(o); ) {
1591
+ if (_(o) && !kt(o))
1592
+ return o;
1593
+ o = Z(o);
1594
+ }
1595
+ return n;
1596
+ }
1597
+ let i = ie(e, t);
1598
+ for (; i && hn(i) && kt(i); )
1599
+ i = ie(i, t);
1600
+ return i && lt(i) && kt(i) && !jt(i) ? n : i || dn(e) || n;
1601
+ }
1602
+ const Cn = async function(e) {
1603
+ const t = this.getOffsetParent || we, n = this.getDimensions, i = await n(e.floating);
1604
+ return {
1605
+ reference: xn(e.reference, await t(e.floating), e.strategy),
1606
+ floating: {
1607
+ x: 0,
1608
+ y: 0,
1609
+ width: i.width,
1610
+ height: i.height
1611
+ }
1612
+ };
1613
+ };
1614
+ function Pn(e) {
1615
+ return N(e).direction === "rtl";
1616
+ }
1617
+ const On = {
1618
+ convertOffsetParentRelativeRectToViewportRelativeRect: fn,
1619
+ getDocumentElement: W,
1620
+ getClippingRect: wn,
1621
+ getOffsetParent: we,
1622
+ getElementRects: Cn,
1623
+ getClientRects: mn,
1624
+ getDimensions: En,
1625
+ getScale: ot,
1626
+ isElement: _,
1627
+ isRTL: Pn
1628
+ };
1629
+ function Ee(e, t) {
1630
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1631
+ }
1632
+ function An(e, t) {
1633
+ let n = null, i;
1634
+ const o = W(e);
1635
+ function s() {
1636
+ var l;
1637
+ clearTimeout(i), (l = n) == null || l.disconnect(), n = null;
1638
+ }
1639
+ function r(l, a) {
1640
+ l === void 0 && (l = !1), a === void 0 && (a = 1), s();
1641
+ const c = e.getBoundingClientRect(), {
1642
+ left: h,
1643
+ top: d,
1644
+ width: f,
1645
+ height: u
1646
+ } = c;
1647
+ if (l || t(), !f || !u)
1648
+ return;
1649
+ const p = yt(d), m = yt(o.clientWidth - (h + f)), v = yt(o.clientHeight - (d + u)), g = yt(h), b = {
1650
+ rootMargin: -p + "px " + -m + "px " + -v + "px " + -g + "px",
1651
+ threshold: D(0, J(1, a)) || 1
1652
+ };
1653
+ let E = !0;
1654
+ function w($) {
1655
+ const C = $[0].intersectionRatio;
1656
+ if (C !== a) {
1657
+ if (!E)
1658
+ return r();
1659
+ C ? r(!1, C) : i = setTimeout(() => {
1660
+ r(!1, 1e-7);
1661
+ }, 1e3);
1662
+ }
1663
+ C === 1 && !Ee(c, e.getBoundingClientRect()) && r(), E = !1;
1664
+ }
1665
+ try {
1666
+ n = new IntersectionObserver(w, {
1667
+ ...b,
1668
+ // Handle <iframe>s
1669
+ root: o.ownerDocument
1670
+ });
1671
+ } catch {
1672
+ n = new IntersectionObserver(w, b);
1673
+ }
1674
+ n.observe(e);
1675
+ }
1676
+ return r(!0), s;
1677
+ }
1678
+ function oe(e, t, n, i) {
1679
+ i === void 0 && (i = {});
1680
+ const {
1681
+ ancestorScroll: o = !0,
1682
+ ancestorResize: s = !0,
1683
+ elementResize: r = typeof ResizeObserver == "function",
1684
+ layoutShift: l = typeof IntersectionObserver == "function",
1685
+ animationFrame: a = !1
1686
+ } = i, c = Yt(e), h = o || s ? [...c ? dt(c) : [], ...dt(t)] : [];
1687
+ h.forEach((g) => {
1688
+ o && g.addEventListener("scroll", n, {
1689
+ passive: !0
1690
+ }), s && g.addEventListener("resize", n);
1691
+ });
1692
+ const d = c && l ? An(c, n) : null;
1693
+ let f = -1, u = null;
1694
+ r && (u = new ResizeObserver((g) => {
1695
+ let [y] = g;
1696
+ y && y.target === c && u && (u.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
1697
+ var b;
1698
+ (b = u) == null || b.observe(t);
1699
+ })), n();
1700
+ }), c && !a && u.observe(c), u.observe(t));
1701
+ let p, m = a ? nt(e) : null;
1702
+ a && v();
1703
+ function v() {
1704
+ const g = nt(e);
1705
+ m && !Ee(m, g) && n(), m = g, p = requestAnimationFrame(v);
1706
+ }
1707
+ return n(), () => {
1708
+ var g;
1709
+ h.forEach((y) => {
1710
+ o && y.removeEventListener("scroll", n), s && y.removeEventListener("resize", n);
1711
+ }), d == null || d(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(p);
1712
+ };
1713
+ }
1714
+ const Tn = ln, Rn = an, se = sn, Dn = cn, Sn = on, kn = (e, t, n) => {
1715
+ const i = /* @__PURE__ */ new Map(), o = {
1716
+ platform: On,
1717
+ ...n
1718
+ }, s = {
1719
+ ...o.platform,
1720
+ _c: i
1721
+ };
1722
+ return nn(e, t, {
1723
+ ...o,
1724
+ platform: s
1725
+ });
1726
+ };
1727
+ function bt(e) {
1728
+ if (e === void 0)
1729
+ return 0;
1730
+ const t = window.devicePixelRatio || 1;
1731
+ return Math.round(e * t) / t;
1732
+ }
1733
+ const wt = 8, Ln = 100, $n = (e) => ({
1734
+ left: ["right", "bottom", "top"],
1735
+ "left-start": ["right-start", "bottom", "top"],
1736
+ "left-end": ["right-end", "bottom", "top"],
1737
+ right: ["left", "bottom", "top"],
1738
+ "right-start": ["left-start", "bottom", "top"],
1739
+ "right-end": ["left-end", "bottom", "top"],
1740
+ top: ["bottom", "left", "right"],
1741
+ "top-start": ["bottom-start", "left", "right"],
1742
+ "top-end": ["bottom-end", "left", "right"],
1743
+ bottom: ["top", "left", "right"],
1744
+ "bottom-start": ["top-start", "left", "right"],
1745
+ "bottom-end": ["top-end", "left", "right"]
1746
+ })[e] ?? [e];
1747
+ class Fn {
1748
+ /**
1749
+ * Creates an instance of the PlacementController.
1750
+ *
1751
+ * @param host - The host element that uses this controller.
1752
+ */
1753
+ constructor(t) {
1754
+ this.originalPlacements = /* @__PURE__ */ new WeakMap(), this.allowPlacementUpdate = !1, this.closeForAncestorUpdate = () => {
1755
+ !this.allowPlacementUpdate && this.options.type !== "modal" && this.cleanup && this.target.dispatchEvent(new Event("close", { bubbles: !0 })), this.allowPlacementUpdate = !1;
1756
+ }, this.updatePlacement = () => {
1757
+ this.computePlacement();
1758
+ }, this.resetOverlayPosition = () => {
1759
+ !this.target || !this.options || (this.clearOverlayPosition(), this.host.offsetHeight, this.computePlacement());
1760
+ }, this.host = t, this.host.addController(this);
1761
+ }
1762
+ /**
1763
+ * Places the overlay relative to the target element.
1764
+ *
1765
+ * This method sets up the necessary configurations and event listeners to manage the
1766
+ * positioning and constraints of the overlay element.
1767
+ *
1768
+ * @param [target=this.target] - The target element for the overlay.
1769
+ * @param [options=this.options] - The options for configuring the overlay placement.
1770
+ * @returns A promise that resolves when the overlay has been placed.
1771
+ */
1772
+ placeOverlay(t = this.target, n = this.options) {
1773
+ if (this.target = t, this.options = n, !t || !n)
1774
+ return;
1775
+ const i = oe(
1776
+ n.trigger,
1777
+ t,
1778
+ this.closeForAncestorUpdate,
1779
+ {
1780
+ ancestorResize: !1,
1781
+ elementResize: !1,
1782
+ layoutShift: !1
1783
+ }
1784
+ ), o = oe(
1785
+ n.trigger,
1786
+ t,
1787
+ this.updatePlacement,
1788
+ {
1789
+ ancestorScroll: !1
1790
+ }
1791
+ );
1792
+ this.cleanup = () => {
1793
+ var s;
1794
+ (s = this.host.elements) == null || s.forEach((r) => {
1795
+ r.addEventListener(
1796
+ "luzmo-closed",
1797
+ () => {
1798
+ const l = this.originalPlacements.get(r);
1799
+ l && r.setAttribute("placement", l), this.originalPlacements.delete(r);
1800
+ },
1801
+ { once: !0 }
1802
+ );
1803
+ }), i(), o();
1804
+ };
1805
+ }
1806
+ /**
1807
+ * Computes the placement of the overlay relative to the target element.
1808
+ *
1809
+ * This method calculates the necessary positioning and constraints for the overlay element
1810
+ * using various middleware functions. It updates the overlay's style and attributes based
1811
+ * on the computed position.
1812
+ *
1813
+ * @returns A promise that resolves when the placement has been computed.
1814
+ */
1815
+ async computePlacement() {
1816
+ var f, u;
1817
+ const { options: t, target: n } = this;
1818
+ await (document.fonts ? document.fonts.ready : Promise.resolve());
1819
+ const i = t.trigger instanceof HTMLElement ? se() : se({
1820
+ padding: wt,
1821
+ fallbackPlacements: $n(t.placement)
1822
+ }), [o = 0, s = 0] = Array.isArray(t == null ? void 0 : t.offset) ? t.offset : [t.offset, 0], r = (f = this.host.elements.find(
1823
+ (p) => p.tipElement
1824
+ )) == null ? void 0 : f.tipElement, l = [
1825
+ Tn({
1826
+ mainAxis: o,
1827
+ crossAxis: s
1828
+ }),
1829
+ Rn({ padding: wt }),
1830
+ i,
1831
+ Dn({
1832
+ padding: wt,
1833
+ apply: ({ availableWidth: p, availableHeight: m, rects: { floating: v } }) => {
1834
+ const g = Math.max(
1835
+ Ln,
1836
+ Math.floor(m)
1837
+ ), y = v.height;
1838
+ this.initialHeight = this.isConstrained && this.initialHeight || y, this.isConstrained = y < this.initialHeight || g <= y;
1839
+ const b = this.isConstrained ? `${g}px` : "";
1840
+ Object.assign(n.style, {
1841
+ maxWidth: `${Math.floor(p)}px`,
1842
+ maxHeight: b
1843
+ });
1844
+ }
1845
+ }),
1846
+ ...r ? [
1847
+ Sn({
1848
+ element: r,
1849
+ padding: t.tipPadding || wt
1850
+ })
1851
+ ] : []
1852
+ ], { x: a, y: c, placement: h, middlewareData: d } = await kn(
1853
+ t.trigger,
1854
+ n,
1855
+ {
1856
+ placement: t.placement,
1857
+ middleware: l,
1858
+ strategy: "fixed"
1859
+ }
1860
+ );
1861
+ if (Object.assign(n.style, {
1862
+ top: "0px",
1863
+ left: "0px",
1864
+ translate: `${bt(a)}px ${bt(c)}px`
1865
+ }), n.setAttribute("actual-placement", h), (u = this.host.elements) == null || u.forEach((p) => {
1866
+ this.originalPlacements.has(p) || this.originalPlacements.set(
1867
+ p,
1868
+ p.getAttribute("placement")
1869
+ ), p.setAttribute("placement", h);
1870
+ }), r && d.arrow) {
1871
+ const { x: p, y: m } = d.arrow;
1872
+ Object.assign(r.style, {
1873
+ top: h.startsWith("right") || h.startsWith("left") ? "0px" : "",
1874
+ left: h.startsWith("bottom") || h.startsWith("top") ? "0px" : "",
1875
+ translate: `${bt(p)}px ${bt(m)}px`
1876
+ });
1877
+ }
1878
+ }
1879
+ /**
1880
+ * Clears the overlay's position styles.
1881
+ *
1882
+ * This method removes the max-height and max-width styles from the target element,
1883
+ * and resets the initial height and constrained state of the overlay.
1884
+ */
1885
+ clearOverlayPosition() {
1886
+ this.target && (this.target.style.removeProperty("max-height"), this.target.style.removeProperty("max-width"), this.initialHeight = void 0, this.isConstrained = !1);
1887
+ }
1888
+ /**
1889
+ * Lifecycle method called when the host element is connected to the DOM.
1890
+ *
1891
+ * This method sets up an event listener to reset the overlay's position when the 'luzmo-update-overlays' event is dispatched.
1892
+ */
1893
+ hostConnected() {
1894
+ document.addEventListener(
1895
+ "luzmo-update-overlays",
1896
+ this.resetOverlayPosition
1897
+ );
1898
+ }
1899
+ /**
1900
+ * Lifecycle method called when the host element is updated.
1901
+ *
1902
+ * This method cleans up resources if the overlay is not open.
1903
+ */
1904
+ hostUpdated() {
1905
+ var t;
1906
+ this.host.open || ((t = this.cleanup) == null || t.call(this), this.cleanup = void 0);
1907
+ }
1908
+ /**
1909
+ * Lifecycle method called when the host element is disconnected from the DOM.
1910
+ *
1911
+ * This method removes the event listener and cleans up resources.
1912
+ */
1913
+ hostDisconnected() {
1914
+ var t;
1915
+ (t = this.cleanup) == null || t.call(this), this.cleanup = void 0, document.removeEventListener(
1916
+ "luzmo-update-overlays",
1917
+ this.resetOverlayPosition
1918
+ );
1919
+ }
1920
+ }
1921
+ var vt = /* @__PURE__ */ ((e) => (e[e.click = 0] = "click", e[e.hover = 1] = "hover", e[e.longpress = 2] = "longpress", e))(vt || {});
1922
+ class Xt {
1923
+ constructor(t, { overlay: n, isPersistent: i, handleOverlayReady: o }) {
1924
+ this.target = t, this.isLazilyOpen = !1, this.isPersistent = !1, this.isPersistent = !!i, this.handleOverlayReady = o, this.isPersistent && this.init(), this.overlay = n;
1925
+ }
1926
+ get activelyOpening() {
1927
+ return !1;
1928
+ }
1929
+ get open() {
1930
+ var t;
1931
+ return ((t = this.overlay) == null ? void 0 : t.open) ?? this.isLazilyOpen;
1932
+ }
1933
+ /**
1934
+ * Set `open` against the associated Overlay lazily.
1935
+ */
1936
+ set open(t) {
1937
+ if (t !== this.open) {
1938
+ if (this.isLazilyOpen = t, this.overlay) {
1939
+ this.overlay.open = t;
1940
+ return;
1941
+ }
1942
+ t && (customElements.whenDefined("luzmo-overlay").then(async () => {
1943
+ const { Overlay: n } = await Promise.resolve().then(() => st);
1944
+ this.overlay = new n(), this.overlay.open = !0;
1945
+ }), Promise.resolve().then(() => st));
1946
+ }
1947
+ }
1948
+ get overlay() {
1949
+ return this._overlay;
1950
+ }
1951
+ set overlay(t) {
1952
+ var n;
1953
+ t && this.overlay !== t && (this.overlay && this.overlay.removeController(this), this._overlay = t, this.overlay.addController(this), this.initOverlay(), this.prepareDescription(this.target), (n = this.handleOverlayReady) == null || n.call(this, this.overlay));
1954
+ }
1955
+ prepareDescription(t) {
1956
+ }
1957
+ releaseDescription() {
1958
+ }
1959
+ shouldCompleteOpen() {
1960
+ }
1961
+ /* c8 ignore next 3 */
1962
+ init() {
1963
+ }
1964
+ /* c8 ignore next 3 */
1965
+ initOverlay() {
1966
+ }
1967
+ abort() {
1968
+ var t;
1969
+ this.releaseDescription(), (t = this.abortController) == null || t.abort();
1970
+ }
1971
+ hostConnected() {
1972
+ this.init();
1973
+ }
1974
+ hostDisconnected() {
1975
+ this.isPersistent || this.abort();
1976
+ }
1977
+ }
1978
+ class zn extends Xt {
1979
+ constructor() {
1980
+ super(...arguments), this.type = vt.click, this.preventNextToggle = !1;
1981
+ }
1982
+ handleClick() {
1983
+ this.preventNextToggle || (this.open = !this.open), this.preventNextToggle = !1;
1984
+ }
1985
+ handlePointerdown() {
1986
+ this.preventNextToggle = this.open;
1987
+ }
1988
+ init() {
1989
+ var n;
1990
+ (n = this.abortController) == null || n.abort(), this.abortController = new AbortController();
1991
+ const { signal: t } = this.abortController;
1992
+ this.target.addEventListener("click", () => this.handleClick(), {
1993
+ signal: t
1994
+ }), this.target.addEventListener(
1995
+ "pointerdown",
1996
+ () => this.handlePointerdown(),
1997
+ { signal: t }
1998
+ );
1999
+ }
2000
+ }
2001
+ const _n = 300;
2002
+ class Nn extends Xt {
2003
+ constructor() {
2004
+ super(...arguments), this.type = vt.hover, this.elementIds = [], this.focusedin = !1, this.pointerentered = !1;
2005
+ }
2006
+ handleTargetFocusin() {
2007
+ this.target.matches(":focus-visible") && (this.open = !0, this.focusedin = !0);
2008
+ }
2009
+ handleTargetFocusout() {
2010
+ this.focusedin = !1, !this.pointerentered && (this.open = !1);
2011
+ }
2012
+ handleTargetPointerenter() {
2013
+ var t;
2014
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0), !((t = this.overlay) != null && t.disabled) && (this.open = !0, this.pointerentered = !0);
2015
+ }
2016
+ handleTargetPointerleave() {
2017
+ this.doPointerleave();
2018
+ }
2019
+ // set a timeout once the pointer enters and the overlay is shown
2020
+ // give the user time to enter the overlay
2021
+ handleHostPointerenter() {
2022
+ this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = void 0);
2023
+ }
2024
+ handleHostPointerleave() {
2025
+ this.doPointerleave();
2026
+ }
2027
+ prepareDescription() {
2028
+ if (this.overlay.elements.length === 0)
2029
+ return;
2030
+ const t = this.target.getRootNode(), n = this.overlay.elements[0].getRootNode(), i = this.overlay.getRootNode();
2031
+ t === i ? this.prepareOverlayRelativeDescription() : t === n && this.prepareContentRelativeDescription();
2032
+ }
2033
+ prepareOverlayRelativeDescription() {
2034
+ const t = Lt(
2035
+ this.target,
2036
+ "aria-describedby",
2037
+ [this.overlay.id]
2038
+ );
2039
+ this.releaseDescription = () => {
2040
+ t(), this.releaseDescription = tt;
2041
+ };
2042
+ }
2043
+ prepareContentRelativeDescription() {
2044
+ const t = [], n = this.overlay.elements.map((o) => (t.push(o.id), o.id || (o.id = `${this.overlay.tagName.toLowerCase()}-helper-${_t()}`), o.id));
2045
+ this.elementIds = t;
2046
+ const i = Lt(
2047
+ this.target,
2048
+ "aria-describedby",
2049
+ n
2050
+ );
2051
+ this.releaseDescription = () => {
2052
+ i(), this.overlay.elements.map((o, s) => {
2053
+ o.id = this.elementIds[s];
2054
+ }), this.releaseDescription = tt;
2055
+ };
2056
+ }
2057
+ doPointerleave() {
2058
+ this.pointerentered = !1;
2059
+ const t = this.target;
2060
+ this.focusedin && t.matches(":focus-visible") || (this.hoverTimeout = setTimeout(() => {
2061
+ this.open = !1;
2062
+ }, _n));
2063
+ }
2064
+ init() {
2065
+ var n;
2066
+ (n = this.abortController) == null || n.abort(), this.abortController = new AbortController();
2067
+ const { signal: t } = this.abortController;
2068
+ this.target.addEventListener("focusin", () => this.handleTargetFocusin(), {
2069
+ signal: t
2070
+ }), this.target.addEventListener(
2071
+ "focusout",
2072
+ () => this.handleTargetFocusout(),
2073
+ { signal: t }
2074
+ ), this.target.addEventListener(
2075
+ "pointerenter",
2076
+ () => this.handleTargetPointerenter(),
2077
+ { signal: t }
2078
+ ), this.target.addEventListener(
2079
+ "pointerleave",
2080
+ () => this.handleTargetPointerleave(),
2081
+ { signal: t }
2082
+ ), this.overlay && this.initOverlay();
2083
+ }
2084
+ initOverlay() {
2085
+ if (!this.abortController)
2086
+ return;
2087
+ const { signal: t } = this.abortController;
2088
+ this.overlay.addEventListener(
2089
+ "pointerenter",
2090
+ () => this.handleHostPointerenter(),
2091
+ { signal: t }
2092
+ ), this.overlay.addEventListener(
2093
+ "pointerleave",
2094
+ () => this.handleHostPointerleave(),
2095
+ { signal: t }
2096
+ );
2097
+ }
2098
+ }
2099
+ const Bn = 300, Mn = {
2100
+ touch: "Double tap and long press for additional options",
2101
+ keyboard: "Press Space or Alt+Down Arrow for additional options",
2102
+ mouse: "Click and hold for additional options"
2103
+ };
2104
+ class Hn extends Xt {
2105
+ constructor() {
2106
+ super(...arguments), this.type = vt.longpress, this.longpressState = null, this.releaseDescription = tt, this.handlePointerup = () => {
2107
+ var t;
2108
+ clearTimeout(this.timeout), this.target && (this.longpressState = ((t = this.overlay) == null ? void 0 : t.state) === "opening" ? "pressed" : null, document.removeEventListener("pointerup", this.handlePointerup), document.removeEventListener("pointercancel", this.handlePointerup));
2109
+ };
2110
+ }
2111
+ get activelyOpening() {
2112
+ return this.longpressState === "opening" || this.longpressState === "pressed";
2113
+ }
2114
+ handleLongpress() {
2115
+ this.open = !0, this.longpressState = this.longpressState === "potential" ? "opening" : "pressed";
2116
+ }
2117
+ handlePointerdown(t) {
2118
+ !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(() => {
2119
+ this.target && this.target.dispatchEvent(
2120
+ new CustomEvent("longpress", {
2121
+ bubbles: !0,
2122
+ composed: !0,
2123
+ detail: {
2124
+ source: "pointer"
2125
+ }
2126
+ })
2127
+ );
2128
+ }, Bn));
2129
+ }
2130
+ handleKeydown(t) {
2131
+ const { code: n, altKey: i } = t;
2132
+ i && n === "ArrowDown" && (t.stopPropagation(), t.stopImmediatePropagation());
2133
+ }
2134
+ handleKeyup(t) {
2135
+ const { code: n, altKey: i } = t;
2136
+ if (n === "Space" || i && n === "ArrowDown") {
2137
+ if (!this.target)
2138
+ return;
2139
+ t.stopPropagation(), this.target.dispatchEvent(
2140
+ new CustomEvent("longpress", {
2141
+ bubbles: !0,
2142
+ composed: !0,
2143
+ detail: {
2144
+ source: "keyboard"
2145
+ }
2146
+ })
2147
+ ), setTimeout(() => {
2148
+ this.longpressState = null;
2149
+ });
2150
+ }
2151
+ }
2152
+ prepareDescription(t) {
2153
+ if (
2154
+ // do not reapply until target is recycled
2155
+ this.releaseDescription !== tt || // require "longpress content" to apply relationship
2156
+ this.overlay.elements.length === 0
2157
+ )
2158
+ return;
2159
+ const n = document.createElement("div");
2160
+ n.id = `longpress-describedby-descriptor-${_t()}`;
2161
+ const i = ke() || Le() ? "touch" : "keyboard";
2162
+ n.textContent = Mn[i], n.slot = "longpress-describedby-descriptor";
2163
+ const o = t.getRootNode(), s = this.overlay.getRootNode();
2164
+ o === s ? this.overlay.append(n) : (n.hidden = !("host" in o), t.after(n));
2165
+ const r = Lt(
2166
+ t,
2167
+ "aria-describedby",
2168
+ [n.id]
2169
+ );
2170
+ this.releaseDescription = () => {
2171
+ r(), n.remove(), this.releaseDescription = tt;
2172
+ };
2173
+ }
2174
+ shouldCompleteOpen() {
2175
+ this.longpressState = this.longpressState === "pressed" ? null : this.longpressState;
2176
+ }
2177
+ init() {
2178
+ var n;
2179
+ (n = this.abortController) == null || n.abort(), this.abortController = new AbortController();
2180
+ const { signal: t } = this.abortController;
2181
+ this.target.addEventListener("longpress", () => this.handleLongpress(), {
2182
+ signal: t
2183
+ }), this.target.addEventListener(
2184
+ "pointerdown",
2185
+ (i) => this.handlePointerdown(i),
2186
+ { signal: t }
2187
+ ), this.prepareDescription(this.target), !this.target.holdAffordance && (this.target.addEventListener(
2188
+ "keydown",
2189
+ (i) => this.handleKeydown(i),
2190
+ { signal: t }
2191
+ ), this.target.addEventListener(
2192
+ "keyup",
2193
+ (i) => this.handleKeyup(i),
2194
+ { signal: t }
2195
+ ));
2196
+ }
2197
+ }
2198
+ const xe = {
2199
+ click: zn,
2200
+ longpress: Hn,
2201
+ hover: Nn
2202
+ };
2203
+ var qn = Object.defineProperty, In = Object.getOwnPropertyDescriptor, T = (e, t, n, i) => {
2204
+ for (var o = i > 1 ? void 0 : i ? In(t, n) : t, s = e.length - 1, r; s >= 0; s--)
2205
+ (r = e[s]) && (o = (i ? r(t, n, o) : r(o)) || o);
2206
+ return i && o && qn(t, n, o), o;
2207
+ };
2208
+ const Wn = "showPopover" in document.createElement("div");
2209
+ let Et = Ie(rt);
2210
+ Et = Wn ? Ue(Et) : We(Et);
2211
+ var j;
2212
+ const P = (j = class extends Et {
2213
+ constructor() {
2214
+ super(...arguments), 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) => {
2215
+ if (!t.relatedTarget)
2216
+ return;
2217
+ const n = new Event("overlay-relation-query", {
2218
+ bubbles: !0,
2219
+ composed: !0
2220
+ });
2221
+ t.relatedTarget.addEventListener(n.type, (i) => {
2222
+ i.composedPath().includes(this) || (this.open = !1);
2223
+ }), t.relatedTarget.dispatchEvent(n);
2224
+ };
2225
+ }
2226
+ get delayed() {
2227
+ var t;
2228
+ return ((t = this.elements.at(-1)) == null ? void 0 : t.hasAttribute("delayed")) || this._delayed;
2229
+ }
2230
+ set delayed(t) {
2231
+ this._delayed = t;
2232
+ }
2233
+ get disabled() {
2234
+ return this._disabled;
2235
+ }
2236
+ set disabled(t) {
2237
+ var n;
2238
+ this._disabled = t, t ? ((n = this.strategy) == null || n.abort(), this.wasOpen = this.open, this.open = !1) : (this.bindEvents(), this.open = this.open || this.wasOpen, this.wasOpen = !1);
2239
+ }
2240
+ /**
2241
+ * Determines if the overlay has a non-virtual trigger element.
2242
+ *
2243
+ * @returns `true` if the trigger element is not a virtual trigger, otherwise `false`.
2244
+ */
2245
+ get hasNonVirtualTrigger() {
2246
+ return !!this.triggerElement && !(this.triggerElement instanceof mt);
2247
+ }
2248
+ /**
2249
+ * Provides an instance of the `PlacementController` for managing the positioning
2250
+ * of the overlay relative to its trigger element.
2251
+ *
2252
+ * If the `PlacementController` instance does not already exist, it is created and
2253
+ * assigned to the `_placementController` property.
2254
+ *
2255
+ * @protected
2256
+ * @returns The `PlacementController` instance.
2257
+ */
2258
+ get placementController() {
2259
+ return this._placementController || (this._placementController = new Fn(this)), this._placementController;
2260
+ }
2261
+ get open() {
2262
+ return this._open;
2263
+ }
2264
+ set open(t) {
2265
+ var n;
2266
+ t && this.disabled || t !== this.open && ((n = this.strategy) != null && n.activelyOpening && !t || (this._open = t, this.open && (j.openCount += 1), this.requestUpdate("open", !this.open), this.open && this.requestSlottable()));
2267
+ }
2268
+ get state() {
2269
+ return this._state;
2270
+ }
2271
+ set state(t) {
2272
+ var i;
2273
+ if (t === this.state)
2274
+ return;
2275
+ const n = this.state;
2276
+ this._state = t, (this.state === "opened" || this.state === "closed") && ((i = this.strategy) == null || i.shouldCompleteOpen()), this.requestUpdate("state", n);
2277
+ }
2278
+ /**
2279
+ * Provides an instance of the `ElementResolutionController` for managing the element
2280
+ * that the overlay should be associated with. If the instance does not already exist,
2281
+ * it is created and assigned to the `_elementResolver` property.
2282
+ *
2283
+ * @protected
2284
+ * @returns The `ElementResolutionController` instance.
2285
+ */
2286
+ get elementResolver() {
2287
+ return this._elementResolver || (this._elementResolver = new Te(this)), this._elementResolver;
2288
+ }
2289
+ /**
2290
+ * Determines if the overlay uses a dialog.
2291
+ * Returns `true` if the overlay type is "modal" or "page".
2292
+ *
2293
+ * @private
2294
+ * @returns `true` if the overlay uses a dialog, otherwise `false`.
2295
+ */
2296
+ get usesDialog() {
2297
+ return this.type === "modal" || this.type === "page";
2298
+ }
2299
+ /**
2300
+ * Determines the value for the popover attribute based on the overlay type.
2301
+ *
2302
+ * @private
2303
+ * @returns The popover value or undefined if not applicable.
2304
+ */
2305
+ get popoverValue() {
2306
+ if ("popover" in this)
2307
+ switch (this.type) {
2308
+ case "modal":
2309
+ case "page":
2310
+ return;
2311
+ case "hint":
2312
+ return "manual";
2313
+ default:
2314
+ return this.type;
2315
+ }
2316
+ }
2317
+ /**
2318
+ * Determines if the overlay requires positioning based on its type and state.
2319
+ *
2320
+ * @protected
2321
+ * @returns True if the overlay requires positioning, otherwise false.
2322
+ */
2323
+ get requiresPositioning() {
2324
+ return !(this.type === "page" || !this.open || !this.triggerElement || !this.placement && this.type !== "hint");
2325
+ }
2326
+ /**
2327
+ * Manages the positioning of the overlay relative to its trigger element.
2328
+ *
2329
+ * This method calculates the necessary parameters for positioning the overlay,
2330
+ * such as offset, placement, and tip padding, and then delegates the actual
2331
+ * positioning to the `PlacementController`.
2332
+ *
2333
+ * @protected
2334
+ * @override
2335
+ */
2336
+ managePosition() {
2337
+ if (!this.requiresPositioning || !this.open)
2338
+ return;
2339
+ const t = this.offset || 0, n = this.triggerElement, i = this.placement || "right", o = this.tipPadding;
2340
+ this.placementController.placeOverlay(this.dialogEl, {
2341
+ offset: t,
2342
+ placement: i,
2343
+ tipPadding: o,
2344
+ trigger: n,
2345
+ type: this.type
2346
+ });
2347
+ }
2348
+ /**
2349
+ * Manages the process of opening the popover.
2350
+ *
2351
+ * This method handles the necessary steps to open the popover, including managing delays,
2352
+ * ensuring the popover is in the DOM, making transitions, and applying focus.
2353
+ *
2354
+ * @protected
2355
+ * @override
2356
+ * @returns A promise that resolves when the popover has been fully opened.
2357
+ */
2358
+ async managePopoverOpen() {
2359
+ super.managePopoverOpen();
2360
+ const t = this.open;
2361
+ if (this.open !== t || (await this.manageDelay(t), this.open !== t) || (await this.ensureOnDOM(t), this.open !== t))
2362
+ return;
2363
+ const n = await this.makeTransition(t);
2364
+ this.open === t && await this.applyFocus(t, n);
2365
+ }
2366
+ /**
2367
+ * Applies focus to the appropriate element after the popover has been opened.
2368
+ *
2369
+ * This method handles the focus management for the overlay, ensuring that the correct
2370
+ * element receives focus based on the overlay's type and state.
2371
+ *
2372
+ * @protected
2373
+ * @override
2374
+ * @param targetOpenState - The target open state of the overlay.
2375
+ * @param focusEl - The element to focus after opening the popover.
2376
+ * @returns A promise that resolves when the focus has been applied.
2377
+ */
2378
+ async applyFocus(t, n) {
2379
+ if (!(this.receivesFocus === "false" || this.type === "hint")) {
2380
+ if (await L(), await L(), t === this.open && !this.open) {
2381
+ this.hasNonVirtualTrigger && this.contains(this.getRootNode().activeElement) && this.triggerElement.focus();
2382
+ return;
2383
+ }
2384
+ n == null || n.focus();
2385
+ }
2386
+ }
2387
+ /**
2388
+ * Returns focus to the trigger element if the overlay is closed.
2389
+ *
2390
+ * This method ensures that focus is returned to the trigger element when the overlay is closed,
2391
+ * unless the overlay is of type "hint" or the focus is already outside the overlay.
2392
+ *
2393
+ * @protected
2394
+ * @override
2395
+ */
2396
+ returnFocus() {
2397
+ var n;
2398
+ if (this.open || this.type === "hint")
2399
+ return;
2400
+ const t = () => {
2401
+ var s, r;
2402
+ const i = [];
2403
+ let o = document.activeElement;
2404
+ for (; (s = o == null ? void 0 : o.shadowRoot) != null && s.activeElement; )
2405
+ o = o.shadowRoot.activeElement;
2406
+ for (; o; ) {
2407
+ const l = o.assignedSlot || o.parentElement || ((r = o.getRootNode()) == null ? void 0 : r.host);
2408
+ l && i.push(l), o = l;
2409
+ }
2410
+ return i;
2411
+ };
2412
+ this.receivesFocus !== "false" && ((n = this.triggerElement) != null && n.focus) && (this.contains(this.getRootNode().activeElement) || t().includes(this) || document.activeElement === document.body) && this.triggerElement.focus();
2413
+ }
2414
+ /**
2415
+ * Manages the process of opening or closing the overlay.
2416
+ *
2417
+ * This method handles the necessary steps to open or close the overlay, including updating the state,
2418
+ * managing the overlay stack, and handling focus events.
2419
+ *
2420
+ * @protected
2421
+ * @param oldOpen - The previous open state of the overlay.
2422
+ * @returns A promise that resolves when the overlay has been fully managed.
2423
+ */
2424
+ async manageOpen(t) {
2425
+ if (!(!this.isConnected && this.open) && (this.hasUpdated || await this.updateComplete, this.open ? (Zt.add(this), this.willPreventClose && (document.addEventListener(
2426
+ "pointerup",
2427
+ () => {
2428
+ this.dialogEl.classList.toggle("not-immediately-closable", !1), this.willPreventClose = !1;
2429
+ },
2430
+ { once: !0 }
2431
+ ), this.dialogEl.classList.toggle("not-immediately-closable", !0))) : (t && this.dispose(), Zt.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")) {
2432
+ const n = this.getRootNode();
2433
+ this.open ? n.addEventListener("focusout", this.closeOnFocusOut, {
2434
+ capture: !0
2435
+ }) : n.removeEventListener("focusout", this.closeOnFocusOut, {
2436
+ capture: !0
2437
+ });
2438
+ }
2439
+ }
2440
+ /**
2441
+ * Binds event handling strategies to the overlay based on the specified trigger interaction.
2442
+ *
2443
+ * This method sets up the appropriate event handling strategy for the overlay, ensuring that
2444
+ * it responds correctly to user interactions such as clicks, hovers, or long presses.
2445
+ *
2446
+ * @protected
2447
+ */
2448
+ bindEvents() {
2449
+ var t;
2450
+ (t = this.strategy) == null || t.abort(), this.strategy = void 0, this.hasNonVirtualTrigger && this.triggerInteraction && (this.strategy = new xe[this.triggerInteraction](
2451
+ this.triggerElement,
2452
+ {
2453
+ overlay: this
2454
+ }
2455
+ ));
2456
+ }
2457
+ /**
2458
+ * Handles the `beforetoggle` event to manage the overlay's state.
2459
+ *
2460
+ * This method checks the new state of the event and calls `handleBrowserClose`
2461
+ * if the new state is not 'open'.
2462
+ *
2463
+ * @protected
2464
+ * @param event - The `beforetoggle` event with the new state.
2465
+ */
2466
+ handleBeforetoggle(t) {
2467
+ t.newState !== "open" && this.handleBrowserClose(t);
2468
+ }
2469
+ /**
2470
+ * Handles the browser's close event to manage the overlay's state.
2471
+ *
2472
+ * This method stops the propagation of the event and closes the overlay if it is not
2473
+ * actively opening. If the overlay is actively opening, it calls `manuallyKeepOpen`.
2474
+ *
2475
+ * @protected
2476
+ * @param event - The browser's close event.
2477
+ */
2478
+ handleBrowserClose(t) {
2479
+ var n;
2480
+ if (t.stopPropagation(), !((n = this.strategy) != null && n.activelyOpening)) {
2481
+ this.open = !1;
2482
+ return;
2483
+ }
2484
+ this.manuallyKeepOpen();
2485
+ }
2486
+ /**
2487
+ * Manually keeps the overlay open.
2488
+ *
2489
+ * This method sets the overlay to open, allows placement updates, and manages the open state.
2490
+ *
2491
+ * @public
2492
+ * @override
2493
+ */
2494
+ manuallyKeepOpen() {
2495
+ this.open = !0, this.placementController.allowPlacementUpdate = !0, this.manageOpen(!1);
2496
+ }
2497
+ /**
2498
+ * Handles the `slotchange` event to manage the overlay's state.
2499
+ *
2500
+ * This method checks if there are any elements in the slot. If there are no elements,
2501
+ * it releases the description from the strategy. If there are elements and the trigger
2502
+ * is non-virtual, it prepares the description for the trigger element.
2503
+ *
2504
+ * @protected
2505
+ */
2506
+ handleSlotchange() {
2507
+ var t, n;
2508
+ this.elements.length === 0 ? (t = this.strategy) == null || t.releaseDescription() : this.hasNonVirtualTrigger && ((n = this.strategy) == null || n.prepareDescription(this.triggerElement));
2509
+ }
2510
+ /**
2511
+ * Determines whether the overlay should prevent closing.
2512
+ *
2513
+ * This method checks the `willPreventClose` flag and resets it to `false`.
2514
+ * It returns the value of the `willPreventClose` flag.
2515
+ *
2516
+ * @public
2517
+ * @returns `true` if the overlay should prevent closing, otherwise `false`.
2518
+ */
2519
+ shouldPreventClose() {
2520
+ const t = this.willPreventClose;
2521
+ return this.willPreventClose = !1, t;
2522
+ }
2523
+ /**
2524
+ * Requests slottable content for the overlay.
2525
+ *
2526
+ * This method dispatches a `SlottableRequestEvent` to request or remove slottable content
2527
+ * based on the current open state of the overlay. It ensures that the same state is not
2528
+ * dispatched twice in a row.
2529
+ *
2530
+ * @protected
2531
+ * @override
2532
+ */
2533
+ requestSlottable() {
2534
+ this.lastRequestSlottableState !== this.open && (this.open || document.body.offsetHeight, this.dispatchEvent(
2535
+ new ze(
2536
+ "overlay-content",
2537
+ this.open ? {} : Nt
2538
+ )
2539
+ ), this.lastRequestSlottableState = this.open);
2540
+ }
2541
+ /**
2542
+ * Lifecycle method called before the component updates.
2543
+ *
2544
+ * This method handles various tasks before the component updates, such as setting an ID,
2545
+ * managing the open state, resolving the trigger element, and binding events.
2546
+ *
2547
+ * @override
2548
+ * @param changes - The properties that have changed.
2549
+ */
2550
+ willUpdate(t) {
2551
+ var i;
2552
+ if (this.hasAttribute("id") || this.setAttribute("id", `${this.tagName.toLowerCase()}-${_t()}`), t.has("open") && (this.hasUpdated || this.open) && this.manageOpen(t.get("open")), t.has("trigger")) {
2553
+ const [o, s] = ((i = this.trigger) == null ? void 0 : i.split("@")) || [];
2554
+ this.elementResolver.selector = o ? `#${o}` : "", this.triggerInteraction = s;
2555
+ }
2556
+ let n = !1;
2557
+ t.has(Re) && (n = this.triggerElement, this.triggerElement = this.elementResolver.element), t.has("triggerElement") && (n = t.get("triggerElement")), n !== !1 && this.bindEvents();
2558
+ }
2559
+ /**
2560
+ * Lifecycle method called after the component updates.
2561
+ *
2562
+ * This method handles various tasks after the component updates, such as updating the placement
2563
+ * attribute, resetting the overlay position, and clearing the overlay position based on the state.
2564
+ *
2565
+ * @override
2566
+ * @param changes - The properties that have changed.
2567
+ */
2568
+ updated(t) {
2569
+ super.updated(t), t.has("placement") && (this.placement ? this.dialogEl.setAttribute("actual-placement", this.placement) : this.dialogEl.removeAttribute("actual-placement"), this.open && t.get("placement") !== void 0 && this.placementController.resetOverlayPosition()), t.has("state") && this.state === "closed" && t.get("state") !== void 0 && this.placementController.clearOverlayPosition();
2570
+ }
2571
+ /**
2572
+ * Renders the content of the overlay.
2573
+ *
2574
+ * This method returns a template result containing a slot element. The slot element
2575
+ * listens for the `slotchange` event to manage the overlay's state.
2576
+ *
2577
+ * @protected
2578
+ * @returns The template result containing the slot element.
2579
+ */
2580
+ renderContent() {
2581
+ return k` <slot @slotchange=${this.handleSlotchange}></slot> `;
2582
+ }
2583
+ /**
2584
+ * Generates a style map for the dialog element.
2585
+ *
2586
+ * This method returns an object containing CSS custom properties for the dialog element.
2587
+ * The `--luzmo-overlay-open-count` custom property is set to the current open count of overlays.
2588
+ *
2589
+ * @private
2590
+ * @returns The style map for the dialog element.
2591
+ */
2592
+ get dialogStyleMap() {
2593
+ return {
2594
+ "--luzmo-overlay-open-count": j.openCount.toString()
2595
+ };
2596
+ }
2597
+ /**
2598
+ * Renders the dialog element for the overlay.
2599
+ *
2600
+ * This method returns a template result containing a dialog element. The dialog element
2601
+ * includes various attributes and event listeners to manage the overlay's state and behavior.
2602
+ *
2603
+ * @protected
2604
+ * @returns The template result containing the dialog element.
2605
+ */
2606
+ renderDialog() {
2607
+ return k`
2608
+ <dialog
2609
+ class="dialog"
2610
+ part="dialog"
2611
+ placement=${St(
2612
+ this.requiresPositioning ? this.placement || "right" : void 0
2613
+ )}
2614
+ style=${Jt(this.dialogStyleMap)}
2615
+ @close=${this.handleBrowserClose}
2616
+ @cancel=${this.handleBrowserClose}
2617
+ @beforetoggle=${this.handleBeforetoggle}
2618
+ ?is-visible=${this.state !== "closed"}
2619
+ >
2620
+ ${this.renderContent()}
2621
+ </dialog>
2622
+ `;
2623
+ }
2624
+ /**
2625
+ * Renders the popover element for the overlay.
2626
+ *
2627
+ * This method returns a template result containing a div element styled as a popover.
2628
+ * The popover element includes various attributes and event listeners to manage the overlay's state and behavior.
2629
+ *
2630
+ * @protected
2631
+ * @returns The template result containing the popover element.
2632
+ */
2633
+ renderPopover() {
2634
+ return k`
2635
+ <div
2636
+ class="dialog"
2637
+ part="dialog"
2638
+ placement=${St(
2639
+ this.requiresPositioning ? this.placement || "right" : void 0
2640
+ )}
2641
+ popover=${St(this.popoverValue)}
2642
+ style=${Jt(this.dialogStyleMap)}
2643
+ @beforetoggle=${this.handleBeforetoggle}
2644
+ @close=${this.handleBrowserClose}
2645
+ ?is-visible=${this.state !== "closed"}
2646
+ >
2647
+ ${this.renderContent()}
2648
+ </div>
2649
+ `;
2650
+ }
2651
+ /**
2652
+ * Renders the overlay component.
2653
+ *
2654
+ * This method returns a template result containing either a dialog or popover element
2655
+ * based on the overlay type. It also includes a slot for longpress descriptors.
2656
+ *
2657
+ * @override
2658
+ * @returns The template result containing the overlay content.
2659
+ */
2660
+ render() {
2661
+ const t = this.type === "modal" || this.type === "page";
2662
+ return k`
2663
+ ${t ? this.renderDialog() : this.renderPopover()}
2664
+ <slot name="longpress-describedby-descriptor"></slot>
2665
+ `;
2666
+ }
2667
+ /**
2668
+ * Lifecycle method called when the component is added to the DOM.
2669
+ *
2670
+ * This method sets up event listeners and binds events if the component has already updated.
2671
+ *
2672
+ * @override
2673
+ */
2674
+ connectedCallback() {
2675
+ super.connectedCallback(), this.addEventListener("close", () => {
2676
+ this.open = !1;
2677
+ }), this.hasUpdated && this.bindEvents();
2678
+ }
2679
+ /**
2680
+ * Lifecycle method called when the component is removed from the DOM.
2681
+ *
2682
+ * This method releases the description from the strategy and updates the 'open' property.
2683
+ *
2684
+ * @override
2685
+ */
2686
+ disconnectedCallback() {
2687
+ var t;
2688
+ (t = this.strategy) == null || t.releaseDescription(), this.open = !1, super.disconnectedCallback();
2689
+ }
2690
+ }, j.styles = [ae(Ye)], j.openCount = 1, j);
2691
+ T([
2692
+ x({ type: Boolean })
2693
+ ], P.prototype, "delayed", 1);
2694
+ T([
2695
+ pt(".dialog")
2696
+ ], P.prototype, "dialogEl", 2);
2697
+ T([
2698
+ x({ type: Boolean })
2699
+ ], P.prototype, "disabled", 1);
2700
+ T([
2701
+ Fe({
2702
+ flatten: !0,
2703
+ selector: ':not([slot="longpress-describedby-descriptor"], slot)'
2704
+ })
2705
+ ], P.prototype, "elements", 2);
2706
+ T([
2707
+ x({ type: Number })
2708
+ ], P.prototype, "offset", 2);
2709
+ T([
2710
+ x({ type: Boolean, reflect: !0 })
2711
+ ], P.prototype, "open", 1);
2712
+ T([
2713
+ x()
2714
+ ], P.prototype, "placement", 2);
2715
+ T([
2716
+ x({ attribute: "receives-focus" })
2717
+ ], P.prototype, "receivesFocus", 2);
2718
+ T([
2719
+ pt("slot")
2720
+ ], P.prototype, "slotEl", 2);
2721
+ T([
2722
+ ut()
2723
+ ], P.prototype, "state", 1);
2724
+ T([
2725
+ x({ type: Number, attribute: "tip-padding" })
2726
+ ], P.prototype, "tipPadding", 2);
2727
+ T([
2728
+ x()
2729
+ ], P.prototype, "trigger", 2);
2730
+ T([
2731
+ x({ attribute: !1 })
2732
+ ], P.prototype, "triggerElement", 2);
2733
+ T([
2734
+ x({ attribute: !1 })
2735
+ ], P.prototype, "triggerInteraction", 2);
2736
+ T([
2737
+ x()
2738
+ ], P.prototype, "type", 2);
2739
+ let Dt = P;
2740
+ const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2741
+ __proto__: null,
2742
+ Overlay: Dt
2743
+ }, Symbol.toStringTag, { value: "Module" })), Vn = ":host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}";
2744
+ var Un = Object.defineProperty, R = (e, t, n, i) => {
2745
+ for (var o = void 0, s = e.length - 1, r; s >= 0; s--)
2746
+ (r = e[s]) && (o = r(t, n, o) || o);
2747
+ return o && Un(t, n, o), o;
2748
+ };
2749
+ class O extends le {
2750
+ constructor() {
2751
+ super(...arguments), this.content = "click hover longpress", this.offset = 6, this.disabled = !1, this.receivesFocus = "auto", this.clickContent = [], this.longpressContent = [], this.hoverContent = [], this.targetContent = [];
2752
+ }
2753
+ static get styles() {
2754
+ return [ae(Vn)];
2755
+ }
2756
+ getAssignedElementsFromSlot(t) {
2757
+ return t.assignedElements({ flatten: !0 });
2758
+ }
2759
+ handleTriggerContent(t) {
2760
+ this.targetContent = this.getAssignedElementsFromSlot(t.target);
2761
+ }
2762
+ handleSlotContent(t) {
2763
+ switch (t.target.name) {
2764
+ case "click-content": {
2765
+ this.clickContent = this.getAssignedElementsFromSlot(t.target);
2766
+ break;
2767
+ }
2768
+ case "longpress-content": {
2769
+ this.longpressContent = this.getAssignedElementsFromSlot(t.target);
2770
+ break;
2771
+ }
2772
+ case "hover-content": {
2773
+ this.hoverContent = this.getAssignedElementsFromSlot(t.target);
2774
+ break;
2775
+ }
2776
+ }
2777
+ }
2778
+ handleBeforetoggle(t) {
2779
+ const { target: n } = t;
2780
+ let i;
2781
+ if (n === this.clickOverlayElement)
2782
+ i = "click";
2783
+ else if (n === this.longpressOverlayElement)
2784
+ i = "longpress";
2785
+ else if (n === this.hoverOverlayElement)
2786
+ i = "hover";
2787
+ else
2788
+ return;
2789
+ t.newState === "open" ? this.open = i : this.open === i && (this.open = void 0);
2790
+ }
2791
+ update(t) {
2792
+ var n, i, o, s, r, l;
2793
+ t.has("clickContent") && (this.clickPlacement = ((n = this.clickContent[0]) == null ? void 0 : n.getAttribute("placement")) || ((i = this.clickContent[0]) == null ? void 0 : i.getAttribute("direction")) || void 0), t.has("hoverContent") && (this.hoverPlacement = ((o = this.hoverContent[0]) == null ? void 0 : o.getAttribute("placement")) || ((s = this.hoverContent[0]) == null ? void 0 : s.getAttribute("direction")) || void 0), t.has("longpressContent") && (this.longpressPlacement = ((r = this.longpressContent[0]) == null ? void 0 : r.getAttribute("placement")) || ((l = this.longpressContent[0]) == null ? void 0 : l.getAttribute("direction")) || void 0), super.update(t);
2794
+ }
2795
+ renderSlot(t) {
2796
+ return k`
2797
+ <slot name=${t} @slotchange=${this.handleSlotContent}></slot>
2798
+ `;
2799
+ }
2800
+ renderClickOverlay() {
2801
+ Promise.resolve().then(() => st);
2802
+ const t = this.renderSlot("click-content");
2803
+ return this.clickContent.length === 0 ? t : k`
2804
+ <luzmo-overlay
2805
+ id="click-overlay"
2806
+ ?disabled=${this.disabled || this.clickContent.length === 0}
2807
+ ?open=${this.open === "click" && this.clickContent.length > 0}
2808
+ .offset=${this.offset}
2809
+ .placement=${this.clickPlacement || this.placement}
2810
+ .triggerElement=${this.targetContent[0]}
2811
+ .triggerInteraction=${"click"}
2812
+ .type=${this.type === "modal" ? "modal" : "auto"}
2813
+ @beforetoggle=${this.handleBeforetoggle}
2814
+ .receivesFocus=${this.receivesFocus}
2815
+ >
2816
+ ${t}
2817
+ </luzmo-overlay>
2818
+ `;
2819
+ }
2820
+ renderHoverOverlay() {
2821
+ Promise.resolve().then(() => st);
2822
+ const t = this.renderSlot("hover-content");
2823
+ return this.hoverContent.length === 0 ? t : k`
2824
+ <luzmo-overlay
2825
+ id="hover-overlay"
2826
+ ?open=${this.open === "hover" && this.hoverContent.length > 0}
2827
+ ?disabled=${this.disabled || this.hoverContent.length === 0 || !!this.open && this.open !== "hover"}
2828
+ .offset=${this.offset}
2829
+ .placement=${this.hoverPlacement || this.placement}
2830
+ .triggerElement=${this.targetContent[0]}
2831
+ .triggerInteraction=${"hover"}
2832
+ .type=${"hint"}
2833
+ @beforetoggle=${this.handleBeforetoggle}
2834
+ .receivesFocus=${this.receivesFocus}
2835
+ >
2836
+ ${t}
2837
+ </luzmo-overlay>
2838
+ `;
2839
+ }
2840
+ renderLongpressOverlay() {
2841
+ Promise.resolve().then(() => st);
2842
+ const t = this.renderSlot("longpress-content");
2843
+ return this.longpressContent.length === 0 ? t : k`
2844
+ <luzmo-overlay
2845
+ id="longpress-overlay"
2846
+ ?disabled=${this.disabled || this.longpressContent.length === 0}
2847
+ ?open=${this.open === "longpress" && this.longpressContent.length > 0}
2848
+ .offset=${this.offset}
2849
+ .placement=${this.longpressPlacement || this.placement}
2850
+ .triggerElement=${this.targetContent[0]}
2851
+ .triggerInteraction=${"longpress"}
2852
+ .type=${"auto"}
2853
+ @beforetoggle=${this.handleBeforetoggle}
2854
+ .receivesFocus=${this.receivesFocus}
2855
+ >
2856
+ ${t}
2857
+ </luzmo-overlay>
2858
+ <slot name="longpress-describedby-descriptor"></slot>
2859
+ `;
2860
+ }
2861
+ render() {
2862
+ const t = this.content.split(" ");
2863
+ return k`
2864
+ <slot
2865
+ id="trigger"
2866
+ name="trigger"
2867
+ @slotchange=${this.handleTriggerContent}
2868
+ ></slot>
2869
+ ${[
2870
+ t.includes("click") ? this.renderClickOverlay() : k``,
2871
+ t.includes("hover") ? this.renderHoverOverlay() : k``,
2872
+ t.includes("longpress") ? this.renderLongpressOverlay() : k``
2873
+ ]}
2874
+ `;
2875
+ }
2876
+ updated(t) {
2877
+ if (super.updated(t), this.disabled && t.has("disabled")) {
2878
+ this.open = void 0;
2879
+ return;
2880
+ }
2881
+ }
2882
+ async getUpdateComplete() {
2883
+ return await super.getUpdateComplete();
2884
+ }
2885
+ }
2886
+ R([
2887
+ x()
2888
+ ], O.prototype, "content");
2889
+ R([
2890
+ x({ reflect: !0 })
2891
+ ], O.prototype, "placement");
2892
+ R([
2893
+ x()
2894
+ ], O.prototype, "type");
2895
+ R([
2896
+ x({ type: Number })
2897
+ ], O.prototype, "offset");
2898
+ R([
2899
+ x({ reflect: !0 })
2900
+ ], O.prototype, "open");
2901
+ R([
2902
+ x({ type: Boolean, reflect: !0 })
2903
+ ], O.prototype, "disabled");
2904
+ R([
2905
+ x({ attribute: "receives-focus" })
2906
+ ], O.prototype, "receivesFocus");
2907
+ R([
2908
+ ut()
2909
+ ], O.prototype, "clickContent");
2910
+ R([
2911
+ ut()
2912
+ ], O.prototype, "longpressContent");
2913
+ R([
2914
+ ut()
2915
+ ], O.prototype, "hoverContent");
2916
+ R([
2917
+ ut()
2918
+ ], O.prototype, "targetContent");
2919
+ R([
2920
+ pt("#click-overlay", !0)
2921
+ ], O.prototype, "clickOverlayElement");
2922
+ R([
2923
+ pt("#longpress-overlay", !0)
2924
+ ], O.prototype, "longpressOverlayElement");
2925
+ R([
2926
+ pt("#hover-overlay", !0)
2927
+ ], O.prototype, "hoverOverlayElement");
2928
+ function jn(e, t, n, i) {
2929
+ return Dt.open(
2930
+ e,
2931
+ t,
2932
+ n,
2933
+ i
2934
+ );
2935
+ }
2936
+ class Kn extends $e {
2937
+ /* c8 ignore next 9 */
2938
+ render(t) {
2939
+ return ce;
2940
+ }
2941
+ update(t, [n]) {
2942
+ this.template = n, this.target !== t.element && (this.target = t.element, this.renderBefore = this.target.children[0]), this.listenerHost = this.target, this.init();
2943
+ }
2944
+ handleSlottableRequest(t) {
2945
+ if (t.target !== t.currentTarget)
2946
+ return;
2947
+ const n = t.data === Nt;
2948
+ he(n ? void 0 : this.template(), this.target, {
2949
+ renderBefore: this.renderBefore
2950
+ });
2951
+ }
2952
+ init() {
2953
+ var n;
2954
+ (n = this.listeners) == null || n.abort(), this.listeners = new AbortController();
2955
+ const { signal: t } = this.listeners;
2956
+ this.listenerHost.addEventListener(
2957
+ "slottable-request",
2958
+ (i) => this.handleSlottableRequest(i),
2959
+ { signal: t }
2960
+ );
2961
+ }
2962
+ disconnected() {
2963
+ var t;
2964
+ (t = this.listeners) == null || t.abort();
2965
+ }
2966
+ /* c8 ignore next 3 */
2967
+ reconnected() {
2968
+ this.init();
2969
+ }
2970
+ }
2971
+ class Ce extends Kn {
2972
+ constructor() {
2973
+ super(...arguments), this.defaultOptions = {
2974
+ triggerInteraction: "click",
2975
+ overlayOptions: {
2976
+ type: "auto",
2977
+ offset: 0
2978
+ }
2979
+ }, this.options = {
2980
+ ...this.defaultOptions.overlayOptions
2981
+ };
2982
+ }
2983
+ /* c8 ignore next 9 */
2984
+ render(t, n) {
2985
+ return ce;
2986
+ }
2987
+ update(t, [n, i]) {
2988
+ var l, a, c;
2989
+ this.options = {
2990
+ ...this.defaultOptions.overlayOptions,
2991
+ ...i == null ? void 0 : i.overlayOptions
2992
+ }, this.insertionOptions = i == null ? void 0 : i.insertionOptions, this.template = n, this.host = (l = t.options) == null ? void 0 : l.host;
2993
+ let o = !1;
2994
+ const s = (i == null ? void 0 : i.triggerInteraction) || this.defaultOptions.triggerInteraction, r = vt[(a = this.strategy) == null ? void 0 : a.type] !== s;
2995
+ this.target !== t.element && (this.target = t.element, o = !0), (o || r) && ((c = this.strategy) == null || c.abort(), this.strategy = new xe[s](this.target, {
2996
+ isPersistent: !0,
2997
+ handleOverlayReady: (h) => {
2998
+ this.listenerHost = this.overlay = h, this.init();
2999
+ }
3000
+ })), this.strategy.open = (i == null ? void 0 : i.open) ?? !1;
3001
+ }
3002
+ handleSlottableRequest(t) {
3003
+ var o, s;
3004
+ if (t.target !== t.currentTarget)
3005
+ return;
3006
+ const n = t.data === Nt, i = {};
3007
+ if (this.host && (i.host = this.host), he(
3008
+ n ? void 0 : this.template(),
3009
+ this.overlay,
3010
+ i
3011
+ ), n)
3012
+ this.overlay.remove();
3013
+ else {
3014
+ rt.applyOptions(this.overlay, {
3015
+ ...this.options,
3016
+ trigger: this.target
3017
+ });
3018
+ const r = typeof ((o = this.insertionOptions) == null ? void 0 : o.el) == "function" ? this.insertionOptions.el() : ((s = this.insertionOptions) == null ? void 0 : s.el) || this.target, { where: l = "afterend" } = this.insertionOptions || {};
3019
+ r.insertAdjacentElement(l, this.overlay);
3020
+ }
3021
+ }
3022
+ }
3023
+ const Yn = re(Ce);
3024
+ customElements.get("luzmo-overlay") || customElements.define("luzmo-overlay", Dt);
3025
+ customElements.get("luzmo-overlay-trigger") || customElements.define("luzmo-overlay-trigger", O);
3026
+ const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3027
+ __proto__: null,
3028
+ Overlay: Dt,
3029
+ OverlayTrigger: O,
3030
+ OverlayTriggerDirective: Ce,
3031
+ VirtualTrigger: mt,
3032
+ openOverlay: jn,
3033
+ trigger: Yn
3034
+ }, Symbol.toStringTag, { value: "Module" }));
3035
+ export {
3036
+ Dt as O,
3037
+ ze as S,
3038
+ mt as V,
3039
+ Fe as a,
3040
+ jn as b,
3041
+ O as c,
3042
+ Ce as d,
3043
+ st as e,
3044
+ Zn as i,
3045
+ Jt as o,
3046
+ Nt as r,
3047
+ Yn as t
3048
+ };