@luzmo/lucero 1.0.1-alpha.21 → 1.0.1-alpha.22

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