@alixpartners/ui-components 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/ToastProvider-D5LImZ-Q.js +1136 -0
  2. package/dist/assets/Dialog.css +1 -1
  3. package/dist/assets/NavBar.css +1 -1
  4. package/dist/assets/SplitButton.css +1 -1
  5. package/dist/assets/Tooltip.css +1 -1
  6. package/dist/components/Banner/Banner.test.js +1 -1
  7. package/dist/components/Button/Button.test.js +124 -3217
  8. package/dist/components/Checkbox/Checkbox.js +7 -6
  9. package/dist/components/Checkbox/Checkbox.test.js +47 -47
  10. package/dist/components/Creatable/Creatable.js +107 -108
  11. package/dist/components/Dialog/Dialog.d.ts +21 -7
  12. package/dist/components/Dialog/Dialog.js +296 -61
  13. package/dist/components/Dialog/Dialog.test.d.ts +1 -0
  14. package/dist/components/Dialog/Dialog.test.js +368 -0
  15. package/dist/components/Dropdown/Dropdown.js +80 -81
  16. package/dist/components/FilePicker/FilePicker.test.js +1 -1
  17. package/dist/components/Ghost/Ghost.test.js +6 -6
  18. package/dist/components/Input/Input.test.js +2 -2
  19. package/dist/components/NavBar/NavBar.js +16 -16
  20. package/dist/components/Radio/Radio.js +1 -1
  21. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  22. package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
  23. package/dist/components/Search/Search.test.js +1 -1
  24. package/dist/components/SplitButton/SplitButton.js +8 -9
  25. package/dist/components/SplitButton/SplitButton.test.js +1 -1
  26. package/dist/components/Tag/Tag.test.js +1 -1
  27. package/dist/components/TagsFields/TagsFields.js +3 -4
  28. package/dist/components/Textarea/Textarea.js +68 -70
  29. package/dist/components/Textarea/Textarea.test.js +2 -2
  30. package/dist/components/Toast/Toast.d.ts +5 -19
  31. package/dist/components/Toast/Toast.js +65 -62
  32. package/dist/components/Toast/Toast.test.js +47 -30
  33. package/dist/components/ToastProvider/ToastContext.d.ts +11 -0
  34. package/dist/components/ToastProvider/ToastProvider.d.ts +19 -0
  35. package/dist/components/ToastProvider/ToastProvider.js +7 -0
  36. package/dist/components/ToastProvider/ToastProvider.test.d.ts +1 -0
  37. package/dist/components/ToastProvider/ToastProvider.test.js +264 -0
  38. package/dist/components/ToastProvider/types.d.ts +54 -0
  39. package/dist/components/ToastProvider/useToast.d.ts +28 -0
  40. package/dist/components/Toggle/Toggle.js +31 -30
  41. package/dist/components/Toggle/Toggle.test.js +9 -9
  42. package/dist/components/Tooltip/Tooltip.js +20 -19
  43. package/dist/{index-2H7slGYV.js → index-7CBv-Jx6.js} +1 -1
  44. package/dist/{index-DpfPnSMn.js → index-BymOxiM6.js} +2 -2
  45. package/dist/index-C-3_YVJ1.js +1539 -0
  46. package/dist/{index-BKtdMA_j.js → index-C4ffg1vf.js} +24 -23
  47. package/dist/{index-BGZDIjm9.js → index-Chv2KjIL.js} +171 -168
  48. package/dist/{index-BJXIvJs4.js → index-CpsmI33B.js} +24 -23
  49. package/dist/index-CxAtPSMM.js +27 -0
  50. package/dist/{index-CjQV7MmW.js → index-DEphED6n.js} +11 -11
  51. package/dist/index-DM51yNMI.js +237 -0
  52. package/dist/{index-CVWHq7Pr.js → index-D_3jWVyV.js} +37 -36
  53. package/dist/index-DkTDHhag.js +3098 -0
  54. package/dist/index-DrR82jOT.js +142 -0
  55. package/dist/magic-string.es-uPKorP4O.js +663 -0
  56. package/dist/main.d.ts +3 -0
  57. package/dist/main.js +38 -34
  58. package/dist/useToast-Cz5MGKnw.js +11 -0
  59. package/dist/{vi.ClIskdbk-CFW_9sOK.js → vi.bdSIJ99Y-017e_Pkz.js} +9494 -10227
  60. package/package.json +6 -3
  61. package/dist/index-DWydnyjJ.js +0 -245
  62. package/dist/index-DieLVN0p.js +0 -1664
  63. package/dist/magic-string.es-D4UQQyt0.js +0 -859
@@ -1,3235 +1,142 @@
1
- import { jsx as b, jsxs as on, Fragment as sn } from "react/jsx-runtime";
2
- import { a as Q, d as H, i as y, r as v, s as h, g as l, v as fe, f as G } from "../../vi.ClIskdbk-CFW_9sOK.js";
3
- import m from "./Button.js";
4
- function f(e, t, n) {
5
- return e.namespaceURI && e.namespaceURI !== "http://www.w3.org/1999/xhtml" || (t = Array.isArray(t) ? t : [
6
- t
7
- ], !t.includes(e.tagName.toLowerCase())) ? !1 : n ? Object.entries(n).every(([i, r]) => e[i] === r) : !0;
8
- }
9
- function S(e) {
10
- var t;
11
- if (un(e) && e.defaultView)
12
- return e.defaultView;
13
- if (!((t = e.ownerDocument) === null || t === void 0) && t.defaultView)
14
- return e.ownerDocument.defaultView;
15
- throw new Error(`Could not determine window of node. Node was ${dn(e)}`);
16
- }
17
- function un(e) {
18
- return e.nodeType === 9;
19
- }
20
- function dn(e) {
21
- return typeof e == "function" ? `function ${e.name}` : e === null ? "null" : String(e);
22
- }
23
- function gt(e, t) {
24
- return new Promise((n, i) => {
25
- const r = new t();
26
- r.onerror = i, r.onabort = i, r.onload = () => {
27
- n(String(r.result));
28
- }, r.readAsText(e);
29
- });
30
- }
31
- function Re(e, t) {
32
- const n = {
33
- ...t,
34
- length: t.length,
35
- item: (i) => n[i],
36
- [Symbol.iterator]: function* () {
37
- for (let r = 0; r < n.length; r++)
38
- yield n[r];
39
- }
40
- };
41
- return n.constructor = e.FileList, e.FileList && Object.setPrototypeOf(n, e.FileList.prototype), Object.freeze(n), n;
42
- }
43
- function B(e, t, n) {
44
- return t in e ? Object.defineProperty(e, t, {
45
- value: n,
46
- enumerable: !0,
47
- configurable: !0,
48
- writable: !0
49
- }) : e[t] = n, e;
50
- }
51
- class Et {
52
- getAsFile() {
53
- return this.file;
54
- }
55
- getAsString(t) {
56
- typeof this.data == "string" && t(this.data);
57
- }
58
- /* istanbul ignore next */
59
- webkitGetAsEntry() {
60
- throw new Error("not implemented");
61
- }
62
- constructor(t, n) {
63
- B(this, "kind", void 0), B(this, "type", void 0), B(this, "file", null), B(this, "data", void 0), typeof t == "string" ? (this.kind = "string", this.type = String(n), this.data = t) : (this.kind = "file", this.type = t.type, this.file = t);
64
- }
65
- }
66
- class an extends Array {
67
- add(...t) {
68
- const n = new Et(t[0], t[1]);
69
- return this.push(n), n;
70
- }
71
- clear() {
72
- this.splice(0, this.length);
73
- }
74
- remove(t) {
75
- this.splice(t, 1);
76
- }
77
- }
78
- function ke(e, t) {
79
- const [n, i] = e.split("/"), r = !i || i === "*";
80
- return (o) => t ? o.type === (r ? n : e) : r ? o.type.startsWith(`${n}/`) : o.type === n;
81
- }
82
- function cn(e) {
83
- return new class {
84
- getData(n) {
85
- var i;
86
- const r = (i = this.items.find(ke(n, !0))) !== null && i !== void 0 ? i : this.items.find(ke(n, !1));
87
- let o = "";
88
- return r == null || r.getAsString((s) => {
89
- o = s;
90
- }), o;
91
- }
92
- setData(n, i) {
93
- const r = this.items.findIndex(ke(n, !0)), o = new Et(i, n);
94
- r >= 0 ? this.items.splice(r, 1, o) : this.items.push(o);
95
- }
96
- clearData(n) {
97
- if (n) {
98
- const i = this.items.findIndex(ke(n, !0));
99
- i >= 0 && this.items.remove(i);
100
- } else
101
- this.items.clear();
102
- }
103
- get types() {
104
- const n = [];
105
- return this.files.length && n.push("Files"), this.items.forEach((i) => n.push(i.type)), Object.freeze(n), n;
106
- }
107
- /* istanbul ignore next */
108
- setDragImage() {
109
- }
110
- constructor() {
111
- B(this, "dropEffect", "none"), B(this, "effectAllowed", "uninitialized"), B(this, "items", new an()), B(this, "files", Re(e, []));
112
- }
113
- }();
114
- }
115
- function je(e, t = []) {
116
- const n = typeof e.DataTransfer > "u" ? cn(e) : (
117
- /* istanbul ignore next */
118
- new e.DataTransfer()
119
- );
120
- return Object.defineProperty(n, "files", {
121
- get: () => Re(e, t)
122
- }), n;
123
- }
124
- async function ln(e, t) {
125
- return t.kind === "file" ? t.getAsFile() : new e.Blob([
126
- await new Promise((n) => t.getAsString(n))
127
- ], {
128
- type: t.type
129
- });
130
- }
131
- function wt(e, t, n) {
132
- return t in e ? Object.defineProperty(e, t, {
133
- value: n,
134
- enumerable: !0,
135
- configurable: !0,
136
- writable: !0
137
- }) : e[t] = n, e;
138
- }
139
- function kt(e, ...t) {
140
- const n = Object.fromEntries(t.map((i) => [
141
- typeof i == "string" ? "text/plain" : i.type,
142
- Promise.resolve(i)
143
- ]));
144
- return typeof e.ClipboardItem < "u" ? new e.ClipboardItem(n) : new class {
145
- get types() {
146
- return Array.from(Object.keys(this.data));
147
- }
148
- async getType(r) {
149
- const o = await this.data[r];
150
- if (!o)
151
- throw new Error(`${r} is not one of the available MIME types on this item.`);
152
- return o instanceof e.Blob ? o : new e.Blob([
153
- o
154
- ], {
155
- type: r
156
- });
157
- }
158
- constructor(r) {
159
- wt(this, "data", void 0), this.data = r;
160
- }
161
- }(n);
162
- }
163
- const te = Symbol("Manage ClipboardSub");
164
- function Je(e, t) {
165
- return Object.assign(new class extends e.EventTarget {
166
- async read() {
167
- return Array.from(this.items);
168
- }
169
- async readText() {
170
- let i = "";
171
- for (const r of this.items) {
172
- const o = r.types.includes("text/plain") ? "text/plain" : r.types.find((s) => s.startsWith("text/"));
173
- o && (i += await r.getType(o).then((s) => gt(s, e.FileReader)));
174
- }
175
- return i;
176
- }
177
- async write(i) {
178
- this.items = i;
179
- }
180
- async writeText(i) {
181
- this.items = [
182
- kt(e, i)
183
- ];
184
- }
185
- constructor(...i) {
186
- super(...i), wt(this, "items", []);
187
- }
188
- }(), {
189
- [te]: t
190
- });
191
- }
192
- function He(e) {
193
- return !!(e != null && e[te]);
194
- }
195
- function fn(e) {
196
- if (He(e.navigator.clipboard))
197
- return e.navigator.clipboard[te];
198
- const t = Object.getOwnPropertyDescriptor(e.navigator, "clipboard");
199
- let n;
200
- const i = {
201
- resetClipboardStub: () => {
202
- n = Je(e, i);
203
- },
204
- detachClipboardStub: () => {
205
- t ? Object.defineProperty(e.navigator, "clipboard", t) : Object.defineProperty(e.navigator, "clipboard", {
206
- value: void 0,
207
- configurable: !0
208
- });
209
- }
210
- };
211
- return n = Je(e, i), Object.defineProperty(e.navigator, "clipboard", {
212
- get: () => n,
213
- configurable: !0
214
- }), n[te];
215
- }
216
- function pn(e) {
217
- He(e.navigator.clipboard) && e.navigator.clipboard[te].resetClipboardStub();
218
- }
219
- function hn(e) {
220
- He(e.navigator.clipboard) && e.navigator.clipboard[te].detachClipboardStub();
221
- }
222
- async function bn(e) {
223
- const t = e.defaultView, n = t == null ? void 0 : t.navigator.clipboard, i = n && await n.read();
224
- if (!i)
225
- throw new Error("The Clipboard API is unavailable.");
226
- const r = je(t);
227
- for (const o of i)
228
- for (const s of o.types)
229
- r.setData(s, await o.getType(s).then((u) => gt(u, t.FileReader)));
230
- return r;
231
- }
232
- async function Ct(e, t) {
233
- const n = S(e), i = n.navigator.clipboard, r = [];
234
- for (let s = 0; s < t.items.length; s++) {
235
- const u = t.items[s], d = await ln(n, u);
236
- r.push(kt(n, d));
237
- }
238
- if (!(i && await i.write(r).then(
239
- () => !0,
240
- // Can happen with other implementations that e.g. require permissions
241
- /* istanbul ignore next */
242
- () => !1
243
- )))
244
- throw new Error("The Clipboard API is unavailable.");
245
- }
246
- const Oe = globalThis;
247
- typeof Oe.afterEach == "function" && Oe.afterEach(() => pn(globalThis.window));
248
- typeof Oe.afterAll == "function" && Oe.afterAll(() => hn(globalThis.window));
249
- const Tt = [
250
- "input:not([type=hidden]):not([disabled])",
251
- "button:not([disabled])",
252
- "select:not([disabled])",
253
- "textarea:not([disabled])",
254
- '[contenteditable=""]',
255
- '[contenteditable="true"]',
256
- "a[href]",
257
- "[tabindex]:not([disabled])"
258
- ].join(", ");
259
- function Ge(e) {
260
- return e.matches(Tt);
261
- }
262
- function mn(e) {
263
- return new e.constructor(e.type, e);
264
- }
265
- function N(e) {
266
- for (let n = e; n; n = n.parentElement)
267
- if (f(n, [
268
- "button",
269
- "input",
270
- "select",
271
- "textarea",
272
- "optgroup",
273
- "option"
274
- ])) {
275
- if (n.hasAttribute("disabled"))
276
- return !0;
277
- } else if (f(n, "fieldset")) {
278
- var t;
279
- if (n.hasAttribute("disabled") && !(!((t = n.querySelector(":scope > legend")) === null || t === void 0) && t.contains(e)))
280
- return !0;
281
- } else if (n.tagName.includes("-") && n.constructor.formAssociated && n.hasAttribute("disabled"))
282
- return !0;
283
- return !1;
284
- }
285
- function we(e) {
286
- const t = e.activeElement;
287
- return t != null && t.shadowRoot ? we(t.shadowRoot) : N(t) ? e.ownerDocument ? (
288
- /* istanbul ignore next */
289
- e.ownerDocument.body
290
- ) : e.body : t;
291
- }
292
- function Me(e) {
293
- var t;
294
- return (t = we(e)) !== null && t !== void 0 ? t : (
295
- /* istanbul ignore next */
296
- e.body
297
- );
298
- }
299
- function yn(e, t) {
300
- let n = e;
301
- do {
302
- if (t(n))
303
- return n;
304
- n = n.parentElement;
305
- } while (n && n !== e.ownerDocument.body);
306
- }
307
- function Y(e) {
308
- return e.hasAttribute("contenteditable") && (e.getAttribute("contenteditable") == "true" || e.getAttribute("contenteditable") == "");
309
- }
310
- function ve(e) {
311
- const t = vn(e);
312
- return t && (t.closest('[contenteditable=""]') || t.closest('[contenteditable="true"]'));
313
- }
314
- function vn(e) {
315
- return e.nodeType === 1 ? e : e.parentElement;
316
- }
317
- var It = /* @__PURE__ */ function(e) {
318
- return e.button = "button", e.color = "color", e.file = "file", e.image = "image", e.reset = "reset", e.submit = "submit", e.checkbox = "checkbox", e.radio = "radio", e;
319
- }(It || {});
320
- function St(e) {
321
- return f(e, "button") || f(e, "input") && e.type in It;
322
- }
323
- function ne(e) {
324
- return Pt(e) && !e.readOnly || Y(e);
325
- }
326
- var _t = /* @__PURE__ */ function(e) {
327
- return e.text = "text", e.date = "date", e["datetime-local"] = "datetime-local", e.email = "email", e.month = "month", e.number = "number", e.password = "password", e.search = "search", e.tel = "tel", e.time = "time", e.url = "url", e.week = "week", e;
328
- }(_t || {});
329
- function Pt(e) {
330
- return f(e, "textarea") || f(e, "input") && e.type in _t;
331
- }
332
- function P(e) {
333
- return At(e) && Pt(e);
334
- }
335
- function gn(e) {
336
- return At(e) && St(e);
337
- }
338
- function At(e) {
339
- return e.nodeType === 1;
340
- }
341
- function En(e) {
342
- const t = e.ownerDocument.getSelection();
343
- if (t != null && t.focusNode && P(e)) {
344
- const i = ve(t.focusNode);
345
- if (i) {
346
- if (!t.isCollapsed) {
347
- var n;
348
- const r = ((n = i.firstChild) === null || n === void 0 ? void 0 : n.nodeType) === 3 ? i.firstChild : i;
349
- t.setBaseAndExtent(r, 0, r, 0);
350
- }
351
- } else
352
- t.setBaseAndExtent(e, 0, e, 0);
353
- }
354
- }
355
- function ie(e, t) {
356
- return Q().eventWrapper(e);
357
- }
358
- function M(e) {
359
- const t = yn(e, Ge), n = we(e.ownerDocument);
360
- (t ?? e.ownerDocument.body) !== n && (ie(t ? () => t.focus() : () => n == null ? void 0 : n.blur()), En(t ?? e.ownerDocument.body));
361
- }
362
- function wn(e) {
363
- !Ge(e) || !(we(e.ownerDocument) === e) || ie(() => e.blur());
364
- }
365
- const $ = {};
366
- $.click = (e, t, n) => {
367
- const i = t.closest("button,input,label,select,textarea"), r = i && f(i, "label") && i.control;
368
- if (r && r !== t)
369
- return () => {
370
- Ge(r) && (M(r), n.dispatchEvent(r, mn(e)));
371
- };
372
- if (f(t, "input", {
373
- type: "file"
374
- }))
375
- return () => {
376
- wn(t), t.dispatchEvent(new (S(t)).Event("fileDialog")), M(t);
377
- };
378
- };
379
- const re = Symbol("Displayed value in UI"), D = Symbol("Displayed selection in UI"), De = Symbol("Initial value to compare on blur");
380
- function kn(e) {
381
- return typeof e == "object" && re in e;
382
- }
383
- function Cn(e) {
384
- return !!e && typeof e == "object" && D in e;
385
- }
386
- function Tn(e, t) {
387
- e[De] === void 0 && (e[De] = e.value), e[re] = t, e.value = Object.assign(new String(t), {
388
- [re]: !0
389
- });
390
- }
391
- function A(e) {
392
- return e[re] === void 0 ? e.value : String(e[re]);
393
- }
394
- function Xe(e) {
395
- e[re] = void 0;
396
- }
397
- function Ot(e) {
398
- e[De] = void 0;
399
- }
400
- function In(e) {
401
- return e[De];
402
- }
403
- function Sn(e, t) {
404
- e[D] = t;
405
- }
406
- function ue(e, { focusOffset: t, anchorOffset: n = t }, i = "replace") {
407
- const r = A(e).length, o = (p) => Math.max(0, Math.min(r, p)), s = i === "replace" || e[D] === void 0 ? o(n) : e[D].anchorOffset, u = o(t), d = Math.min(s, u), a = Math.max(s, u);
408
- if (e[D] = {
409
- anchorOffset: s,
410
- focusOffset: u
411
- }, e.selectionStart === d && e.selectionEnd === a)
412
- return;
413
- const c = Object.assign(new Number(d), {
414
- [D]: !0
415
- });
416
- try {
417
- e.setSelectionRange(c, a);
418
- } catch {
419
- }
420
- }
421
- function ge(e) {
422
- var t, n, i;
423
- const r = (i = e[D]) !== null && i !== void 0 ? i : {
424
- anchorOffset: (t = e.selectionStart) !== null && t !== void 0 ? t : 0,
425
- focusOffset: (n = e.selectionEnd) !== null && n !== void 0 ? n : 0
426
- };
427
- return {
428
- ...r,
429
- startOffset: Math.min(r.anchorOffset, r.focusOffset),
430
- endOffset: Math.max(r.anchorOffset, r.focusOffset)
431
- };
432
- }
433
- function _n(e) {
434
- return !!e[D];
435
- }
436
- function _e(e) {
437
- e[D] = void 0;
438
- }
439
- const Ne = globalThis.parseInt;
440
- function Pn(e) {
441
- const t = e.replace(/\D/g, "");
442
- if (t.length < 2)
443
- return e;
444
- const n = Ne(t[0], 10), i = Ne(t[1], 10);
445
- if (n >= 3 || n === 2 && i >= 4) {
446
- let r;
447
- return n >= 3 ? r = 1 : r = 2, Qe(t, r);
448
- }
449
- return e.length === 2 ? e : Qe(t, 2);
450
- }
451
- function Qe(e, t) {
452
- const n = e.slice(0, t), i = Math.min(Ne(n, 10), 23), r = e.slice(t), o = Ne(r, 10), s = Math.min(o, 59);
453
- return `${i.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
454
- }
455
- function Dt(e, t) {
456
- const n = e.cloneNode();
457
- return n.value = t, n.value === t;
458
- }
459
- var Nt = /* @__PURE__ */ function(e) {
460
- return e.email = "email", e.password = "password", e.search = "search", e.telephone = "telephone", e.text = "text", e.url = "url", e;
461
- }(Nt || {});
462
- function An(e) {
463
- var t;
464
- const n = (t = e.getAttribute("maxlength")) !== null && t !== void 0 ? t : "";
465
- return /^\d+$/.test(n) && Number(n) >= 0 ? Number(n) : void 0;
466
- }
467
- function On(e) {
468
- return f(e, "textarea") || f(e, "input") && e.type in Nt;
469
- }
470
- function Ut(e, t, n, i) {
471
- if (Pe(e) && t + n >= 0 && t + n <= e.nodeValue.length)
472
- return {
473
- node: e,
474
- offset: t + n
475
- };
476
- const r = Ze(e, t, n);
477
- if (r) {
478
- if (Pe(r))
479
- return {
480
- node: r,
481
- offset: n > 0 ? Math.min(1, r.nodeValue.length) : Math.max(r.nodeValue.length - 1, 0)
482
- };
483
- if (f(r, "br")) {
484
- const o = Ze(r, void 0, n);
485
- return o ? Pe(o) ? {
486
- node: o,
487
- offset: n > 0 ? 0 : o.nodeValue.length
488
- } : n < 0 && f(o, "br") ? {
489
- node: r.parentNode,
490
- offset: Ce(r)
491
- } : {
492
- node: o.parentNode,
493
- offset: Ce(o) + (n > 0 ? 0 : 1)
494
- } : n < 0 && i === "deleteContentBackward" ? {
495
- node: r.parentNode,
496
- offset: Ce(r)
497
- } : void 0;
498
- } else
499
- return {
500
- node: r.parentNode,
501
- offset: Ce(r) + (n > 0 ? 1 : 0)
502
- };
503
- }
504
- }
505
- function Ze(e, t, n) {
506
- const i = Number(t) + (n < 0 ? -1 : 0);
507
- return t !== void 0 && We(e) && i >= 0 && i < e.children.length && (e = e.children[i]), Nn(e, n === 1 ? "next" : "previous", Dn);
508
- }
509
- function Dn(e) {
510
- if (Pe(e))
511
- return !0;
512
- if (We(e)) {
513
- if (f(e, [
514
- "input",
515
- "textarea"
516
- ]))
517
- return e.type !== "hidden";
518
- if (f(e, "br"))
519
- return !0;
520
- }
521
- return !1;
522
- }
523
- function Ce(e) {
524
- let t = 0;
525
- for (; e.previousSibling; )
526
- t++, e = e.previousSibling;
527
- return t;
528
- }
529
- function We(e) {
530
- return e.nodeType === 1;
531
- }
532
- function Pe(e) {
533
- return e.nodeType === 3;
534
- }
535
- function Nn(e, t, n) {
536
- for (; ; ) {
537
- var i;
538
- const r = e[`${t}Sibling`];
539
- if (r) {
540
- if (e = Un(r, t === "next" ? "first" : "last"), n(e))
541
- return e;
542
- } else if (e.parentNode && (!We(e.parentNode) || !Y(e.parentNode) && e.parentNode !== ((i = e.ownerDocument) === null || i === void 0 ? void 0 : i.body)))
543
- e = e.parentNode;
544
- else
545
- break;
546
- }
547
- }
548
- function Un(e, t) {
549
- for (; e.hasChildNodes(); )
550
- e = e[`${t}Child`];
551
- return e;
552
- }
553
- const Ee = Symbol("Track programmatic changes for React workaround");
554
- function xn(e) {
555
- return Object.getOwnPropertyNames(e).some((t) => t.startsWith("__react")) && S(e).REACT_VERSION === 17;
556
- }
557
- function Bn(e) {
558
- xn(e) && (e[Ee] = {
559
- previousValue: String(e.value),
560
- tracked: []
561
- });
562
- }
563
- function Mn(e, t) {
564
- var n, i;
565
- (i = e[Ee]) === null || i === void 0 || (n = i.tracked) === null || n === void 0 || n.push(t), e[Ee] || (Xe(e), ue(e, {
566
- focusOffset: t.length
567
- }));
568
- }
569
- function $n(e, t) {
570
- var n;
571
- const i = e[Ee];
572
- if (e[Ee] = void 0, !(!(i == null || (n = i.tracked) === null || n === void 0) && n.length))
573
- return;
574
- const r = i.tracked.length === 2 && i.tracked[0] === i.previousValue && i.tracked[1] === e.value;
575
- r || Xe(e), _n(e) && ue(e, {
576
- focusOffset: r ? t : e.value.length
577
- });
578
- }
579
- function xt(e) {
580
- const t = Ln(e);
581
- if (t && P(t))
582
- return {
583
- type: "input",
584
- selection: ge(t)
585
- };
586
- const n = t == null ? void 0 : t.ownerDocument.getSelection();
587
- return {
588
- type: ve(e) && (n == null ? void 0 : n.anchorNode) && ve(n.anchorNode) ? "contenteditable" : "default",
589
- selection: n
590
- };
591
- }
592
- function Ln(e) {
593
- return e.nodeType === 1 ? e : e.parentElement;
594
- }
595
- function Fn(e) {
596
- const t = xt(e);
597
- if (t.type === "input")
598
- return t.selection;
599
- if (t.type === "contenteditable") {
600
- var n;
601
- return (n = t.selection) === null || n === void 0 ? void 0 : n.getRangeAt(0);
602
- }
603
- }
604
- function J({ focusNode: e, focusOffset: t, anchorNode: n = e, anchorOffset: i = t }) {
605
- var r, o;
606
- if (xt(e).type === "input")
607
- return ue(e, {
608
- anchorOffset: i,
609
- focusOffset: t
610
- });
611
- (o = n.ownerDocument) === null || o === void 0 || (r = o.getSelection()) === null || r === void 0 || r.setBaseAndExtent(n, i, e, t);
612
- }
613
- function Bt(e) {
614
- return f(e, "input") && [
615
- "date",
616
- "time"
617
- ].includes(e.type);
618
- }
619
- function oe(e, t, n, i = "insertText") {
620
- const r = Fn(t);
621
- r && (!Bt(t) && !e.dispatchUIEvent(t, "beforeinput", {
622
- inputType: i,
623
- data: n
624
- }) || ("startContainer" in r ? Vn(e, t, r, n, i) : zn(e, t, r, n, i)));
625
- }
626
- function Vn(e, t, n, i, r) {
627
- let o = !1;
628
- if (!n.collapsed)
629
- o = !0, n.deleteContents();
630
- else if ([
631
- "deleteContentBackward",
632
- "deleteContentForward"
633
- ].includes(r)) {
634
- const s = Ut(n.startContainer, n.startOffset, r === "deleteContentBackward" ? -1 : 1, r);
635
- if (s) {
636
- o = !0;
637
- const u = n.cloneRange();
638
- u.comparePoint(s.node, s.offset) < 0 ? u.setStart(s.node, s.offset) : u.setEnd(s.node, s.offset), u.deleteContents();
639
- }
640
- }
641
- if (i)
642
- if (n.endContainer.nodeType === 3) {
643
- const s = n.endOffset;
644
- n.endContainer.insertData(s, i), n.setStart(n.endContainer, s + i.length), n.setEnd(n.endContainer, s + i.length);
645
- } else {
646
- const s = t.ownerDocument.createTextNode(i);
647
- n.insertNode(s), n.setStart(s, i.length), n.setEnd(s, i.length);
648
- }
649
- (o || i) && e.dispatchUIEvent(t, "input", {
650
- inputType: r
651
- });
652
- }
653
- function zn(e, t, n, i, r) {
654
- let o = i;
655
- if (On(t)) {
656
- const a = An(t);
657
- if (a !== void 0 && i.length > 0) {
658
- const c = a - t.value.length;
659
- if (c > 0)
660
- o = i.substring(0, c);
661
- else
662
- return;
663
- }
664
- }
665
- const { newValue: s, newOffset: u, oldValue: d } = Kn(o, t, n, r);
666
- s === d && u === n.startOffset && u === n.endOffset || f(t, "input", {
667
- type: "number"
668
- }) && !Rn(s) || (Tn(t, s), J({
669
- focusNode: t,
670
- anchorOffset: u,
671
- focusOffset: u
672
- }), Bt(t) ? Dt(t, s) && (et(e, t, u, {}), e.dispatchUIEvent(t, "change"), Ot(t)) : et(e, t, u, {
673
- data: i,
674
- inputType: r
675
- }));
676
- }
677
- function Kn(e, t, { startOffset: n, endOffset: i }, r) {
678
- const o = A(t), s = Math.max(0, n === i && r === "deleteContentBackward" ? n - 1 : n), u = o.substring(0, s), d = Math.min(o.length, n === i && r === "deleteContentForward" ? n + 1 : i), a = o.substring(d, o.length);
679
- let c = `${u}${e}${a}`, p = s + e.length;
680
- if (f(t, "input", {
681
- type: "time"
682
- })) {
683
- const g = Pn(c);
684
- g !== "" && Dt(t, g) && (c = g, p = g.length);
685
- }
686
- return {
687
- oldValue: o,
688
- newValue: c,
689
- newOffset: p
690
- };
691
- }
692
- function et(e, t, n, i) {
693
- e.dispatchUIEvent(t, "input", i), $n(t, n);
694
- }
695
- function Rn(e) {
696
- var t, n;
697
- const i = e.split("e", 2);
698
- return !(/[^\d.\-e]/.test(e) || Number((t = e.match(/-/g)) === null || t === void 0 ? void 0 : t.length) > 2 || Number((n = e.match(/\./g)) === null || n === void 0 ? void 0 : n.length) > 1 || i[1] && !/^-?\d*$/.test(i[1]));
699
- }
700
- $.cut = (e, t, n) => () => {
701
- ne(t) && oe(n, t, "", "deleteByCut");
702
- };
703
- function jn(e) {
704
- return e ? Y(e) ? e.textContent : A(e) : null;
705
- }
706
- function Hn(e) {
707
- const t = S(e);
708
- for (let n = e; n != null && n.ownerDocument; n = n.parentElement) {
709
- const { display: i, visibility: r } = t.getComputedStyle(n);
710
- if (i === "none" || r === "hidden")
711
- return !1;
712
- }
713
- return !0;
714
- }
715
- function Gn(e, t) {
716
- const n = e.ownerDocument, i = n.querySelectorAll(Tt), r = Array.from(i).filter((d) => d === e || !(Number(d.getAttribute("tabindex")) < 0 || N(d)));
717
- Number(e.getAttribute("tabindex")) >= 0 && r.sort((d, a) => {
718
- const c = Number(d.getAttribute("tabindex")), p = Number(a.getAttribute("tabindex"));
719
- return c === p ? 0 : c === 0 ? 1 : p === 0 ? -1 : c - p;
720
- });
721
- const o = {};
722
- let s = [
723
- n.body
724
- ];
725
- const u = f(e, "input", {
726
- type: "radio"
727
- }) ? e.name : void 0;
728
- r.forEach((d) => {
729
- const a = d;
730
- if (f(a, "input", {
731
- type: "radio"
732
- }) && a.name) {
733
- if (a === e) {
734
- s.push(a);
735
- return;
736
- } else if (a.name === u)
737
- return;
738
- if (a.checked) {
739
- s = s.filter((c) => !f(c, "input", {
740
- type: "radio",
741
- name: a.name
742
- })), s.push(a), o[a.name] = a;
743
- return;
744
- }
745
- if (typeof o[a.name] < "u")
746
- return;
747
- }
748
- s.push(a);
749
- });
750
- for (let d = s.findIndex((a) => a === e); ; )
751
- if (d += t ? -1 : 1, d === s.length ? d = 0 : d === -1 && (d = s.length - 1), s[d] === e || s[d] === n.body || Hn(s[d]))
752
- return s[d];
753
- }
754
- function tt(e, t) {
755
- if (P(e)) {
756
- const n = ge(e);
757
- J({
758
- focusNode: e,
759
- focusOffset: n.startOffset === n.endOffset ? n.focusOffset + t : t < 0 ? n.startOffset : n.endOffset
760
- });
761
- } else {
762
- const n = e.ownerDocument.getSelection();
763
- if (!(n != null && n.focusNode))
764
- return;
765
- if (n.isCollapsed) {
766
- const i = Ut(n.focusNode, n.focusOffset, t);
767
- i && J({
768
- focusNode: i.node,
769
- focusOffset: i.offset
770
- });
771
- } else
772
- n[t < 0 ? "collapseToStart" : "collapseToEnd"]();
773
- }
774
- }
775
- function Mt(e) {
776
- if (P(e))
777
- return J({
778
- focusNode: e,
779
- anchorOffset: 0,
780
- focusOffset: A(e).length
781
- });
782
- var t;
783
- const n = (t = ve(e)) !== null && t !== void 0 ? t : e.ownerDocument.body;
784
- J({
785
- focusNode: n,
786
- anchorOffset: 0,
787
- focusOffset: n.childNodes.length
788
- });
789
- }
790
- function Xn(e) {
791
- if (P(e))
792
- return ge(e).startOffset === 0 && ge(e).endOffset === A(e).length;
793
- var t;
794
- const n = (t = ve(e)) !== null && t !== void 0 ? t : e.ownerDocument.body, i = e.ownerDocument.getSelection();
795
- return (i == null ? void 0 : i.anchorNode) === n && i.focusNode === n && i.anchorOffset === 0 && i.focusOffset === n.childNodes.length;
796
- }
797
- function he(e, t, n) {
798
- var i;
799
- if (P(e))
800
- return J({
801
- focusNode: e,
802
- anchorOffset: t,
803
- focusOffset: n
804
- });
805
- if (Y(e) && ((i = e.firstChild) === null || i === void 0 ? void 0 : i.nodeType) === 3)
806
- return J({
807
- focusNode: e.firstChild,
808
- anchorOffset: t,
809
- focusOffset: n
810
- });
811
- throw new Error("Not implemented. The result of this interaction is unreliable.");
812
- }
813
- function Te(e, t, n) {
814
- const i = S(t), r = Array.from(t.ownerDocument.querySelectorAll(t.name ? `input[type="radio"][name="${i.CSS.escape(t.name)}"]` : 'input[type="radio"][name=""], input[type="radio"]:not([name])'));
815
- for (let o = r.findIndex((s) => s === t) + n; ; o += n) {
816
- if (r[o] || (o = n > 0 ? 0 : r.length - 1), r[o] === t)
817
- return;
818
- if (!N(r[o])) {
819
- M(r[o]), e.dispatchUIEvent(r[o], "click");
820
- return;
821
- }
822
- }
823
- }
824
- $.keydown = (e, t, n) => {
825
- var i, r;
826
- return (r = (i = nt[e.key]) === null || i === void 0 ? void 0 : i.call(nt, e, t, n)) !== null && r !== void 0 ? r : Wn(e, t, n);
827
- };
828
- const nt = {
829
- ArrowDown: (e, t, n) => {
830
- if (f(t, "input", {
831
- type: "radio"
832
- }))
833
- return () => Te(n, t, 1);
834
- },
835
- ArrowLeft: (e, t, n) => f(t, "input", {
836
- type: "radio"
837
- }) ? () => Te(n, t, -1) : () => tt(t, -1),
838
- ArrowRight: (e, t, n) => f(t, "input", {
839
- type: "radio"
840
- }) ? () => Te(n, t, 1) : () => tt(t, 1),
841
- ArrowUp: (e, t, n) => {
842
- if (f(t, "input", {
843
- type: "radio"
844
- }))
845
- return () => Te(n, t, -1);
846
- },
847
- Backspace: (e, t, n) => {
848
- if (ne(t))
849
- return () => {
850
- oe(n, t, "", "deleteContentBackward");
851
- };
852
- },
853
- Delete: (e, t, n) => {
854
- if (ne(t))
855
- return () => {
856
- oe(n, t, "", "deleteContentForward");
857
- };
858
- },
859
- End: (e, t) => {
860
- if (f(t, [
861
- "input",
862
- "textarea"
863
- ]) || Y(t))
864
- return () => {
865
- var n, i;
866
- const r = (i = (n = jn(t)) === null || n === void 0 ? void 0 : n.length) !== null && i !== void 0 ? i : (
867
- /* istanbul ignore next */
868
- 0
869
- );
870
- he(t, r, r);
871
- };
872
- },
873
- Home: (e, t) => {
874
- if (f(t, [
875
- "input",
876
- "textarea"
877
- ]) || Y(t))
878
- return () => {
879
- he(t, 0, 0);
880
- };
881
- },
882
- PageDown: (e, t) => {
883
- if (f(t, [
884
- "input"
885
- ]))
886
- return () => {
887
- const n = A(t).length;
888
- he(t, n, n);
889
- };
890
- },
891
- PageUp: (e, t) => {
892
- if (f(t, [
893
- "input"
894
- ]))
895
- return () => {
896
- he(t, 0, 0);
897
- };
898
- },
899
- Tab: (e, t, n) => () => {
900
- const i = Gn(t, n.system.keyboard.modifiers.Shift);
901
- M(i), P(i) && ue(i, {
902
- anchorOffset: 0,
903
- focusOffset: i.value.length
904
- });
905
- }
906
- }, Wn = (e, t, n) => {
907
- if (e.code === "KeyA" && n.system.keyboard.modifiers.Control)
908
- return () => Mt(t);
909
- };
910
- $.keypress = (e, t, n) => {
911
- if (e.key === "Enter") {
912
- if (f(t, "button") || f(t, "input") && qn.includes(t.type) || f(t, "a") && t.href)
913
- return () => {
914
- n.dispatchUIEvent(t, "click");
915
- };
916
- if (f(t, "input")) {
917
- const i = t.form, r = i == null ? void 0 : i.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
918
- return r ? () => n.dispatchUIEvent(r, "click") : i && Yn.includes(t.type) && i.querySelectorAll("input").length === 1 ? () => n.dispatchUIEvent(i, "submit") : void 0;
919
- }
920
- }
921
- if (ne(t)) {
922
- const i = e.key === "Enter" ? Y(t) && !n.system.keyboard.modifiers.Shift ? "insertParagraph" : "insertLineBreak" : "insertText", r = e.key === "Enter" ? `
923
- ` : e.key;
924
- return () => oe(n, t, r, i);
925
- }
926
- };
927
- const qn = [
928
- "button",
929
- "color",
930
- "file",
931
- "image",
932
- "reset",
933
- "submit"
934
- ], Yn = [
935
- "email",
936
- "month",
937
- "password",
938
- "search",
939
- "tel",
940
- "text",
941
- "url",
942
- "week"
943
- ];
944
- $.keyup = (e, t, n) => {
945
- var i;
946
- return (i = it[e.key]) === null || i === void 0 ? void 0 : i.call(it, e, t, n);
947
- };
948
- const it = {
949
- " ": (e, t, n) => {
950
- if (St(t))
951
- return () => n.dispatchUIEvent(t, "click");
952
- }
953
- };
954
- $.paste = (e, t, n) => {
955
- if (ne(t))
956
- return () => {
957
- var i;
958
- const r = (i = e.clipboardData) === null || i === void 0 ? void 0 : i.getData("text");
959
- r && oe(n, t, r, "insertFromPaste");
960
- };
961
- };
962
- const $t = {
963
- auxclick: {
964
- EventType: "PointerEvent",
965
- defaultInit: {
966
- bubbles: !0,
967
- cancelable: !0,
968
- composed: !0
969
- }
970
- },
971
- beforeinput: {
972
- EventType: "InputEvent",
973
- defaultInit: {
974
- bubbles: !0,
975
- cancelable: !0,
976
- composed: !0
977
- }
978
- },
979
- blur: {
980
- EventType: "FocusEvent",
981
- defaultInit: {
982
- bubbles: !1,
983
- cancelable: !1,
984
- composed: !0
985
- }
986
- },
987
- click: {
988
- EventType: "PointerEvent",
989
- defaultInit: {
990
- bubbles: !0,
991
- cancelable: !0,
992
- composed: !0
993
- }
994
- },
995
- contextmenu: {
996
- EventType: "PointerEvent",
997
- defaultInit: {
998
- bubbles: !0,
999
- cancelable: !0,
1000
- composed: !0
1001
- }
1002
- },
1003
- copy: {
1004
- EventType: "ClipboardEvent",
1005
- defaultInit: {
1006
- bubbles: !0,
1007
- cancelable: !0,
1008
- composed: !0
1009
- }
1010
- },
1011
- change: {
1012
- EventType: "Event",
1013
- defaultInit: {
1014
- bubbles: !0,
1015
- cancelable: !1
1016
- }
1017
- },
1018
- cut: {
1019
- EventType: "ClipboardEvent",
1020
- defaultInit: {
1021
- bubbles: !0,
1022
- cancelable: !0,
1023
- composed: !0
1024
- }
1025
- },
1026
- dblclick: {
1027
- EventType: "MouseEvent",
1028
- defaultInit: {
1029
- bubbles: !0,
1030
- cancelable: !0,
1031
- composed: !0
1032
- }
1033
- },
1034
- focus: {
1035
- EventType: "FocusEvent",
1036
- defaultInit: {
1037
- bubbles: !1,
1038
- cancelable: !1,
1039
- composed: !0
1040
- }
1041
- },
1042
- focusin: {
1043
- EventType: "FocusEvent",
1044
- defaultInit: {
1045
- bubbles: !0,
1046
- cancelable: !1,
1047
- composed: !0
1048
- }
1049
- },
1050
- focusout: {
1051
- EventType: "FocusEvent",
1052
- defaultInit: {
1053
- bubbles: !0,
1054
- cancelable: !1,
1055
- composed: !0
1056
- }
1057
- },
1058
- keydown: {
1059
- EventType: "KeyboardEvent",
1060
- defaultInit: {
1061
- bubbles: !0,
1062
- cancelable: !0,
1063
- composed: !0
1064
- }
1065
- },
1066
- keypress: {
1067
- EventType: "KeyboardEvent",
1068
- defaultInit: {
1069
- bubbles: !0,
1070
- cancelable: !0,
1071
- composed: !0
1072
- }
1073
- },
1074
- keyup: {
1075
- EventType: "KeyboardEvent",
1076
- defaultInit: {
1077
- bubbles: !0,
1078
- cancelable: !0,
1079
- composed: !0
1080
- }
1081
- },
1082
- paste: {
1083
- EventType: "ClipboardEvent",
1084
- defaultInit: {
1085
- bubbles: !0,
1086
- cancelable: !0,
1087
- composed: !0
1088
- }
1089
- },
1090
- input: {
1091
- EventType: "InputEvent",
1092
- defaultInit: {
1093
- bubbles: !0,
1094
- cancelable: !1,
1095
- composed: !0
1096
- }
1097
- },
1098
- mousedown: {
1099
- EventType: "MouseEvent",
1100
- defaultInit: {
1101
- bubbles: !0,
1102
- cancelable: !0,
1103
- composed: !0
1104
- }
1105
- },
1106
- mouseenter: {
1107
- EventType: "MouseEvent",
1108
- defaultInit: {
1109
- bubbles: !1,
1110
- cancelable: !1,
1111
- composed: !0
1112
- }
1113
- },
1114
- mouseleave: {
1115
- EventType: "MouseEvent",
1116
- defaultInit: {
1117
- bubbles: !1,
1118
- cancelable: !1,
1119
- composed: !0
1120
- }
1121
- },
1122
- mousemove: {
1123
- EventType: "MouseEvent",
1124
- defaultInit: {
1125
- bubbles: !0,
1126
- cancelable: !0,
1127
- composed: !0
1128
- }
1129
- },
1130
- mouseout: {
1131
- EventType: "MouseEvent",
1132
- defaultInit: {
1133
- bubbles: !0,
1134
- cancelable: !0,
1135
- composed: !0
1136
- }
1137
- },
1138
- mouseover: {
1139
- EventType: "MouseEvent",
1140
- defaultInit: {
1141
- bubbles: !0,
1142
- cancelable: !0,
1143
- composed: !0
1144
- }
1145
- },
1146
- mouseup: {
1147
- EventType: "MouseEvent",
1148
- defaultInit: {
1149
- bubbles: !0,
1150
- cancelable: !0,
1151
- composed: !0
1152
- }
1153
- },
1154
- pointerover: {
1155
- EventType: "PointerEvent",
1156
- defaultInit: {
1157
- bubbles: !0,
1158
- cancelable: !0,
1159
- composed: !0
1160
- }
1161
- },
1162
- pointerenter: {
1163
- EventType: "PointerEvent",
1164
- defaultInit: {
1165
- bubbles: !1,
1166
- cancelable: !1
1167
- }
1168
- },
1169
- pointerdown: {
1170
- EventType: "PointerEvent",
1171
- defaultInit: {
1172
- bubbles: !0,
1173
- cancelable: !0,
1174
- composed: !0
1175
- }
1176
- },
1177
- pointermove: {
1178
- EventType: "PointerEvent",
1179
- defaultInit: {
1180
- bubbles: !0,
1181
- cancelable: !0,
1182
- composed: !0
1183
- }
1184
- },
1185
- pointerup: {
1186
- EventType: "PointerEvent",
1187
- defaultInit: {
1188
- bubbles: !0,
1189
- cancelable: !0,
1190
- composed: !0
1191
- }
1192
- },
1193
- pointercancel: {
1194
- EventType: "PointerEvent",
1195
- defaultInit: {
1196
- bubbles: !0,
1197
- cancelable: !1,
1198
- composed: !0
1199
- }
1200
- },
1201
- pointerout: {
1202
- EventType: "PointerEvent",
1203
- defaultInit: {
1204
- bubbles: !0,
1205
- cancelable: !0,
1206
- composed: !0
1207
- }
1208
- },
1209
- pointerleave: {
1210
- EventType: "PointerEvent",
1211
- defaultInit: {
1212
- bubbles: !1,
1213
- cancelable: !1
1214
- }
1215
- },
1216
- submit: {
1217
- EventType: "Event",
1218
- defaultInit: {
1219
- bubbles: !0,
1220
- cancelable: !0
1221
- }
1222
- }
1223
- };
1224
- function Lt(e) {
1225
- return $t[e].EventType;
1226
- }
1227
- const Jn = [
1228
- "MouseEvent",
1229
- "PointerEvent"
1230
- ];
1231
- function Qn(e) {
1232
- return Jn.includes(Lt(e));
1233
- }
1234
- function Zn(e) {
1235
- return Lt(e) === "KeyboardEvent";
1236
- }
1237
- const ei = {
1238
- ClipboardEvent: [
1239
- ni
1240
- ],
1241
- Event: [],
1242
- FocusEvent: [
1243
- pe,
1244
- ii
1245
- ],
1246
- InputEvent: [
1247
- pe,
1248
- ri
1249
- ],
1250
- MouseEvent: [
1251
- pe,
1252
- $e,
1253
- rt
1254
- ],
1255
- PointerEvent: [
1256
- pe,
1257
- $e,
1258
- rt,
1259
- si
1260
- ],
1261
- KeyboardEvent: [
1262
- pe,
1263
- $e,
1264
- oi
1265
- ]
1266
- };
1267
- function Ft(e, t, n) {
1268
- const i = S(t), { EventType: r, defaultInit: o } = $t[e], s = new (ti(i))[r](e, o);
1269
- return ei[r].forEach((u) => u(s, n ?? {})), s;
1270
- }
1271
- function ti(e) {
1272
- var t;
1273
- const n = (t = e.Event) !== null && t !== void 0 ? t : class {
1274
- };
1275
- var i;
1276
- const r = (i = e.AnimationEvent) !== null && i !== void 0 ? i : class extends n {
1277
- };
1278
- var o;
1279
- const s = (o = e.ClipboardEvent) !== null && o !== void 0 ? o : class extends n {
1280
- };
1281
- var u;
1282
- const d = (u = e.PopStateEvent) !== null && u !== void 0 ? u : class extends n {
1283
- };
1284
- var a;
1285
- const c = (a = e.ProgressEvent) !== null && a !== void 0 ? a : class extends n {
1286
- };
1287
- var p;
1288
- const g = (p = e.TransitionEvent) !== null && p !== void 0 ? p : class extends n {
1289
- };
1290
- var E;
1291
- const k = (E = e.UIEvent) !== null && E !== void 0 ? E : class extends n {
1292
- };
1293
- var U;
1294
- const de = (U = e.CompositionEvent) !== null && U !== void 0 ? U : class extends k {
1295
- };
1296
- var F;
1297
- const ae = (F = e.FocusEvent) !== null && F !== void 0 ? F : class extends k {
1298
- };
1299
- var V;
1300
- const ce = (V = e.InputEvent) !== null && V !== void 0 ? V : class extends k {
1301
- };
1302
- var z;
1303
- const le = (z = e.KeyboardEvent) !== null && z !== void 0 ? z : class extends k {
1304
- };
1305
- var K;
1306
- const R = (K = e.MouseEvent) !== null && K !== void 0 ? K : class extends k {
1307
- };
1308
- var j;
1309
- const tn = (j = e.DragEvent) !== null && j !== void 0 ? j : class extends R {
1310
- };
1311
- var xe;
1312
- const nn = (xe = e.PointerEvent) !== null && xe !== void 0 ? xe : class extends R {
1313
- };
1314
- var Be;
1315
- const rn = (Be = e.TouchEvent) !== null && Be !== void 0 ? Be : class extends k {
1316
- };
1317
- return {
1318
- Event: n,
1319
- AnimationEvent: r,
1320
- ClipboardEvent: s,
1321
- PopStateEvent: d,
1322
- ProgressEvent: c,
1323
- TransitionEvent: g,
1324
- UIEvent: k,
1325
- CompositionEvent: de,
1326
- FocusEvent: ae,
1327
- InputEvent: ce,
1328
- KeyboardEvent: le,
1329
- MouseEvent: R,
1330
- DragEvent: tn,
1331
- PointerEvent: nn,
1332
- TouchEvent: rn
1333
- };
1334
- }
1335
- function L(e, t) {
1336
- for (const [n, i] of Object.entries(t))
1337
- Object.defineProperty(e, n, {
1338
- get: () => i ?? null
1339
- });
1340
- }
1341
- function w(e) {
1342
- return Number(e ?? 0);
1343
- }
1344
- function ni(e, { clipboardData: t }) {
1345
- L(e, {
1346
- clipboardData: t
1347
- });
1348
- }
1349
- function ii(e, { relatedTarget: t }) {
1350
- L(e, {
1351
- relatedTarget: t
1352
- });
1353
- }
1354
- function ri(e, { data: t, inputType: n, isComposing: i }) {
1355
- L(e, {
1356
- data: t,
1357
- isComposing: !!i,
1358
- inputType: String(n)
1359
- });
1360
- }
1361
- function pe(e, { view: t, detail: n }) {
1362
- L(e, {
1363
- view: t,
1364
- detail: w(n ?? 0)
1365
- });
1366
- }
1367
- function $e(e, { altKey: t, ctrlKey: n, metaKey: i, shiftKey: r, modifierAltGraph: o, modifierCapsLock: s, modifierFn: u, modifierFnLock: d, modifierNumLock: a, modifierScrollLock: c, modifierSymbol: p, modifierSymbolLock: g }) {
1368
- L(e, {
1369
- altKey: !!t,
1370
- ctrlKey: !!n,
1371
- metaKey: !!i,
1372
- shiftKey: !!r,
1373
- getModifierState(E) {
1374
- return !!{
1375
- Alt: t,
1376
- AltGraph: o,
1377
- CapsLock: s,
1378
- Control: n,
1379
- Fn: u,
1380
- FnLock: d,
1381
- Meta: i,
1382
- NumLock: a,
1383
- ScrollLock: c,
1384
- Shift: r,
1385
- Symbol: p,
1386
- SymbolLock: g
1387
- }[E];
1388
- }
1389
- });
1390
- }
1391
- function oi(e, { key: t, code: n, location: i, repeat: r, isComposing: o, charCode: s }) {
1392
- L(e, {
1393
- key: String(t),
1394
- code: String(n),
1395
- location: w(i),
1396
- repeat: !!r,
1397
- isComposing: !!o,
1398
- charCode: s
1399
- });
1400
- }
1401
- function rt(e, { x: t, y: n, screenX: i, screenY: r, clientX: o = t, clientY: s = n, button: u, buttons: d, relatedTarget: a, offsetX: c, offsetY: p, pageX: g, pageY: E }) {
1402
- L(e, {
1403
- screenX: w(i),
1404
- screenY: w(r),
1405
- clientX: w(o),
1406
- x: w(o),
1407
- clientY: w(s),
1408
- y: w(s),
1409
- button: w(u),
1410
- buttons: w(d),
1411
- relatedTarget: a,
1412
- offsetX: w(c),
1413
- offsetY: w(p),
1414
- pageX: w(g),
1415
- pageY: w(E)
1416
- });
1417
- }
1418
- function si(e, { pointerId: t, width: n, height: i, pressure: r, tangentialPressure: o, tiltX: s, tiltY: u, twist: d, pointerType: a, isPrimary: c }) {
1419
- L(e, {
1420
- pointerId: w(t),
1421
- width: w(n ?? 1),
1422
- height: w(i ?? 1),
1423
- pressure: w(r),
1424
- tangentialPressure: w(o),
1425
- tiltX: w(s),
1426
- tiltY: w(u),
1427
- twist: w(d),
1428
- pointerType: String(a),
1429
- isPrimary: !!c
1430
- });
1431
- }
1432
- function ui(e, t, n, i = !1) {
1433
- (Qn(t) || Zn(t)) && (n = {
1434
- ...n,
1435
- ...this.system.getUIEventModifiers()
1436
- });
1437
- const r = Ft(t, e, n);
1438
- return Vt.call(this, e, r, i);
1439
- }
1440
- function Vt(e, t, n = !1) {
1441
- var i;
1442
- const r = t.type, o = n ? () => {
1443
- } : (i = $[r]) === null || i === void 0 ? void 0 : i.call($, t, e, this);
1444
- if (o) {
1445
- t.preventDefault();
1446
- let s = !1;
1447
- return Object.defineProperty(t, "defaultPrevented", {
1448
- get: () => s
1449
- }), Object.defineProperty(t, "preventDefault", {
1450
- value: () => {
1451
- s = t.cancelable;
1452
- }
1453
- }), ie(() => e.dispatchEvent(t)), s || o(), !s;
1454
- }
1455
- return ie(() => e.dispatchEvent(t));
1456
- }
1457
- function q(e, t, n) {
1458
- const i = Ft(t, e, n);
1459
- ie(() => e.dispatchEvent(i));
1460
- }
1461
- const ot = Symbol("patched focus/blur methods");
1462
- function zt(e) {
1463
- if (e.prototype[ot])
1464
- return;
1465
- const { focus: t, blur: n } = e.prototype;
1466
- Object.defineProperties(e.prototype, {
1467
- focus: {
1468
- configurable: !0,
1469
- get: () => r
1470
- },
1471
- blur: {
1472
- configurable: !0,
1473
- get: () => o
1474
- },
1475
- [ot]: {
1476
- configurable: !0,
1477
- get: () => ({
1478
- focus: t,
1479
- blur: n
1480
- })
1481
- }
1482
- });
1483
- let i;
1484
- function r(s) {
1485
- if (this.ownerDocument.visibilityState !== "hidden")
1486
- return t.call(this, s);
1487
- const u = st(this.ownerDocument);
1488
- if (u === this)
1489
- return;
1490
- const d = Symbol("focus call");
1491
- i = d, u && (n.call(u), q(u, "blur", {
1492
- relatedTarget: this
1493
- }), q(u, "focusout", {
1494
- relatedTarget: i === d ? this : null
1495
- })), i === d && (t.call(this, s), q(this, "focus", {
1496
- relatedTarget: u
1497
- })), i === d && q(this, "focusin", {
1498
- relatedTarget: u
1499
- });
1500
- }
1501
- function o() {
1502
- if (this.ownerDocument.visibilityState !== "hidden")
1503
- return n.call(this);
1504
- const s = st(this.ownerDocument);
1505
- if (s !== this)
1506
- return;
1507
- i = Symbol("blur call"), n.call(this), q(s, "blur", {
1508
- relatedTarget: null
1509
- }), q(s, "focusout", {
1510
- relatedTarget: null
1511
- });
1512
- }
1513
- }
1514
- function st(e) {
1515
- const t = we(e);
1516
- return (t == null ? void 0 : t.tagName) === "BODY" ? null : t;
1517
- }
1518
- const Le = Symbol("Interceptor for programmatical calls");
1519
- function Z(e, t, n) {
1520
- const i = Object.getOwnPropertyDescriptor(e.constructor.prototype, t), r = Object.getOwnPropertyDescriptor(e, t), o = i != null && i.set ? "set" : "value";
1521
- if (typeof (i == null ? void 0 : i[o]) != "function" || i[o][Le])
1522
- throw new Error(`Element ${e.tagName} does not implement "${String(t)}".`);
1523
- function s(...u) {
1524
- const { applyNative: d = !1, realArgs: a, then: c } = n.call(this, ...u), p = (!d && r || i)[o];
1525
- o === "set" ? p.call(this, a) : p.call(this, ...a), c == null || c();
1526
- }
1527
- s[Le] = Le, Object.defineProperty(e, t, {
1528
- ...r ?? i,
1529
- [o]: s
1530
- });
1531
- }
1532
- function di(e) {
1533
- Z(e, "value", function(n) {
1534
- const i = kn(n);
1535
- return i && Bn(this), {
1536
- applyNative: !!i,
1537
- realArgs: ai(this, n),
1538
- then: i ? void 0 : () => Mn(this, String(n))
1539
- };
1540
- });
1541
- }
1542
- function ai(e, t) {
1543
- return f(e, "input", {
1544
- type: "number"
1545
- }) && String(t) !== "" && !Number.isNaN(Number(t)) ? String(Number(t)) : String(t);
1546
- }
1547
- function ci(e) {
1548
- Z(e, "setSelectionRange", function(n, ...i) {
1549
- const r = Cn(n);
1550
- return {
1551
- applyNative: !!r,
1552
- realArgs: [
1553
- Number(n),
1554
- ...i
1555
- ],
1556
- then: () => r ? void 0 : _e(e)
1557
- };
1558
- }), Z(e, "selectionStart", function(n) {
1559
- return {
1560
- realArgs: n,
1561
- then: () => _e(e)
1562
- };
1563
- }), Z(e, "selectionEnd", function(n) {
1564
- return {
1565
- realArgs: n,
1566
- then: () => _e(e)
1567
- };
1568
- }), Z(e, "select", function() {
1569
- return {
1570
- realArgs: [],
1571
- then: () => Sn(e, {
1572
- anchorOffset: 0,
1573
- focusOffset: A(e).length
1574
- })
1575
- };
1576
- });
1577
- }
1578
- function li(e) {
1579
- Z(e, "setRangeText", function(...n) {
1580
- return {
1581
- realArgs: n,
1582
- then: () => {
1583
- Xe(e), _e(e);
1584
- }
1585
- };
1586
- });
1587
- }
1588
- const ee = Symbol("Node prepared with document state workarounds");
1589
- function Kt(e) {
1590
- e[ee] || (e.addEventListener("focus", (t) => {
1591
- const n = t.target;
1592
- ut(n);
1593
- }, {
1594
- capture: !0,
1595
- passive: !0
1596
- }), e.activeElement && ut(e.activeElement), e.addEventListener("blur", (t) => {
1597
- const n = t.target, i = In(n);
1598
- i !== void 0 && (n.value !== i && q(n, "change"), Ot(n));
1599
- }, {
1600
- capture: !0,
1601
- passive: !0
1602
- }), e[ee] = ee);
1603
- }
1604
- function ut(e) {
1605
- e[ee] || (f(e, [
1606
- "input",
1607
- "textarea"
1608
- ]) && (di(e), ci(e), li(e)), e[ee] = ee);
1609
- }
1610
- function fi(e) {
1611
- return pi(e) ? e : e.ownerDocument;
1612
- }
1613
- function pi(e) {
1614
- return e.nodeType === 9;
1615
- }
1616
- var I = /* @__PURE__ */ function(e) {
1617
- return e[e.Trigger = 2] = "Trigger", e[e.Call = 1] = "Call", e;
1618
- }({});
1619
- function be(e, t) {
1620
- e.levelRefs[t] = {};
1621
- }
1622
- function Ie(e, t) {
1623
- return e.levelRefs[t];
1624
- }
1625
- function se(e) {
1626
- const t = e.delay;
1627
- if (typeof t == "number")
1628
- return Promise.all([
1629
- new Promise((n) => globalThis.setTimeout(() => n(), t)),
1630
- e.advanceTimers(t)
1631
- ]);
1632
- }
1633
- var Ae = /* @__PURE__ */ function(e) {
1634
- return e[e.EachTrigger = 4] = "EachTrigger", e[e.EachApiCall = 2] = "EachApiCall", e[e.EachTarget = 1] = "EachTarget", e[e.Never = 0] = "Never", e;
1635
- }({});
1636
- function X(e, t, n) {
1637
- return t in e ? Object.defineProperty(e, t, {
1638
- value: n,
1639
- enumerable: !0,
1640
- configurable: !0,
1641
- writable: !0
1642
- }) : e[t] = n, e;
1643
- }
1644
- var _ = /* @__PURE__ */ function(e) {
1645
- return e[e.STANDARD = 0] = "STANDARD", e[e.LEFT = 1] = "LEFT", e[e.RIGHT = 2] = "RIGHT", e[e.NUMPAD = 3] = "NUMPAD", e;
1646
- }({});
1647
- const hi = [
1648
- "Alt",
1649
- "AltGraph",
1650
- "Control",
1651
- "Fn",
1652
- "Meta",
1653
- "Shift",
1654
- "Symbol"
1655
- ];
1656
- function dt(e) {
1657
- return hi.includes(e);
1658
- }
1659
- const bi = [
1660
- "CapsLock",
1661
- "FnLock",
1662
- "NumLock",
1663
- "ScrollLock",
1664
- "SymbolLock"
1665
- ];
1666
- function at(e) {
1667
- return bi.includes(e);
1668
- }
1669
- class mi {
1670
- isKeyPressed(t) {
1671
- return this.pressed.has(String(t.code));
1672
- }
1673
- getPressedKeys() {
1674
- return this.pressed.values().map((t) => t.keyDef);
1675
- }
1676
- /** Press a key */
1677
- async keydown(t, n) {
1678
- const i = String(n.key), r = String(n.code), o = Me(t.config.document);
1679
- this.setKeydownTarget(o), this.pressed.add(r, n), dt(i) && (this.modifiers[i] = !0);
1680
- const s = t.dispatchUIEvent(o, "keydown", {
1681
- key: i,
1682
- code: r
1683
- });
1684
- at(i) && !this.modifiers[i] && (this.modifiers[i] = !0, this.modifierLockStart[i] = !0), s && this.pressed.setUnprevented(r), s && this.hasKeyPress(i) && t.dispatchUIEvent(Me(t.config.document), "keypress", {
1685
- key: i,
1686
- code: r,
1687
- charCode: n.key === "Enter" ? 13 : String(n.key).charCodeAt(0)
1688
- });
1689
- }
1690
- /** Release a key */
1691
- async keyup(t, n) {
1692
- const i = String(n.key), r = String(n.code), o = this.pressed.isUnprevented(r);
1693
- this.pressed.delete(r), dt(i) && !this.pressed.values().find((s) => s.keyDef.key === i) && (this.modifiers[i] = !1), t.dispatchUIEvent(Me(t.config.document), "keyup", {
1694
- key: i,
1695
- code: r
1696
- }, !o), at(i) && this.modifiers[i] && (this.modifierLockStart[i] ? this.modifierLockStart[i] = !1 : this.modifiers[i] = !1);
1697
- }
1698
- setKeydownTarget(t) {
1699
- t !== this.lastKeydownTarget && (this.carryChar = ""), this.lastKeydownTarget = t;
1700
- }
1701
- hasKeyPress(t) {
1702
- return (t.length === 1 || t === "Enter") && !this.modifiers.Control && !this.modifiers.Alt;
1703
- }
1704
- constructor(t) {
1705
- X(this, "system", void 0), X(this, "modifiers", {
1706
- Alt: !1,
1707
- AltGraph: !1,
1708
- CapsLock: !1,
1709
- Control: !1,
1710
- Fn: !1,
1711
- FnLock: !1,
1712
- Meta: !1,
1713
- NumLock: !1,
1714
- ScrollLock: !1,
1715
- Shift: !1,
1716
- Symbol: !1,
1717
- SymbolLock: !1
1718
- }), X(this, "pressed", new class {
1719
- add(n, i) {
1720
- var r, o, s;
1721
- (s = (r = this.registry)[o = n]) !== null && s !== void 0 || (r[o] = {
1722
- keyDef: i,
1723
- unpreventedDefault: !1
1724
- });
1725
- }
1726
- has(n) {
1727
- return !!this.registry[n];
1728
- }
1729
- setUnprevented(n) {
1730
- const i = this.registry[n];
1731
- i && (i.unpreventedDefault = !0);
1732
- }
1733
- isUnprevented(n) {
1734
- var i;
1735
- return !!(!((i = this.registry[n]) === null || i === void 0) && i.unpreventedDefault);
1736
- }
1737
- delete(n) {
1738
- delete this.registry[n];
1739
- }
1740
- values() {
1741
- return Object.values(this.registry);
1742
- }
1743
- constructor() {
1744
- X(this, "registry", {});
1745
- }
1746
- }()), X(this, "carryChar", ""), X(this, "lastKeydownTarget", void 0), X(this, "modifierLockStart", {}), this.system = t;
1747
- }
1748
- }
1749
- const yi = [
1750
- // alphanumeric block - writing system
1751
- ..."0123456789".split("").map((e) => ({
1752
- code: `Digit${e}`,
1753
- key: e
1754
- })),
1755
- ...")!@#$%^&*(".split("").map((e, t) => ({
1756
- code: `Digit${t}`,
1757
- key: e,
1758
- shiftKey: !0
1759
- })),
1760
- ..."abcdefghijklmnopqrstuvwxyz".split("").map((e) => ({
1761
- code: `Key${e.toUpperCase()}`,
1762
- key: e
1763
- })),
1764
- ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((e) => ({
1765
- code: `Key${e}`,
1766
- key: e,
1767
- shiftKey: !0
1768
- })),
1769
- {
1770
- code: "BracketLeft",
1771
- key: "["
1772
- },
1773
- {
1774
- code: "BracketLeft",
1775
- key: "{",
1776
- shiftKey: !0
1777
- },
1778
- {
1779
- code: "BracketRight",
1780
- key: "]"
1781
- },
1782
- {
1783
- code: "BracketRight",
1784
- key: "}",
1785
- shiftKey: !0
1786
- },
1787
- // alphanumeric block - functional
1788
- {
1789
- code: "Space",
1790
- key: " "
1791
- },
1792
- {
1793
- code: "AltLeft",
1794
- key: "Alt",
1795
- location: _.LEFT
1796
- },
1797
- {
1798
- code: "AltRight",
1799
- key: "Alt",
1800
- location: _.RIGHT
1801
- },
1802
- {
1803
- code: "ShiftLeft",
1804
- key: "Shift",
1805
- location: _.LEFT
1806
- },
1807
- {
1808
- code: "ShiftRight",
1809
- key: "Shift",
1810
- location: _.RIGHT
1811
- },
1812
- {
1813
- code: "ControlLeft",
1814
- key: "Control",
1815
- location: _.LEFT
1816
- },
1817
- {
1818
- code: "ControlRight",
1819
- key: "Control",
1820
- location: _.RIGHT
1821
- },
1822
- {
1823
- code: "MetaLeft",
1824
- key: "Meta",
1825
- location: _.LEFT
1826
- },
1827
- {
1828
- code: "MetaRight",
1829
- key: "Meta",
1830
- location: _.RIGHT
1831
- },
1832
- {
1833
- code: "OSLeft",
1834
- key: "OS",
1835
- location: _.LEFT
1836
- },
1837
- {
1838
- code: "OSRight",
1839
- key: "OS",
1840
- location: _.RIGHT
1841
- },
1842
- {
1843
- code: "ContextMenu",
1844
- key: "ContextMenu"
1845
- },
1846
- {
1847
- code: "Tab",
1848
- key: "Tab"
1849
- },
1850
- {
1851
- code: "CapsLock",
1852
- key: "CapsLock"
1853
- },
1854
- {
1855
- code: "Backspace",
1856
- key: "Backspace"
1857
- },
1858
- {
1859
- code: "Enter",
1860
- key: "Enter"
1861
- },
1862
- // function
1863
- {
1864
- code: "Escape",
1865
- key: "Escape"
1866
- },
1867
- // arrows
1868
- {
1869
- code: "ArrowUp",
1870
- key: "ArrowUp"
1871
- },
1872
- {
1873
- code: "ArrowDown",
1874
- key: "ArrowDown"
1875
- },
1876
- {
1877
- code: "ArrowLeft",
1878
- key: "ArrowLeft"
1879
- },
1880
- {
1881
- code: "ArrowRight",
1882
- key: "ArrowRight"
1883
- },
1884
- // control pad
1885
- {
1886
- code: "Home",
1887
- key: "Home"
1888
- },
1889
- {
1890
- code: "End",
1891
- key: "End"
1892
- },
1893
- {
1894
- code: "Delete",
1895
- key: "Delete"
1896
- },
1897
- {
1898
- code: "PageUp",
1899
- key: "PageUp"
1900
- },
1901
- {
1902
- code: "PageDown",
1903
- key: "PageDown"
1904
- },
1905
- // Special keys that are not part of a default US-layout but included for specific behavior
1906
- {
1907
- code: "Fn",
1908
- key: "Fn"
1909
- },
1910
- {
1911
- code: "Symbol",
1912
- key: "Symbol"
1913
- },
1914
- {
1915
- code: "AltRight",
1916
- key: "AltGraph"
1917
- }
1918
- ], vi = [
1919
- {
1920
- name: "MouseLeft",
1921
- pointerType: "mouse",
1922
- button: "primary"
1923
- },
1924
- {
1925
- name: "MouseRight",
1926
- pointerType: "mouse",
1927
- button: "secondary"
1928
- },
1929
- {
1930
- name: "MouseMiddle",
1931
- pointerType: "mouse",
1932
- button: "auxiliary"
1933
- },
1934
- {
1935
- name: "TouchA",
1936
- pointerType: "touch"
1937
- },
1938
- {
1939
- name: "TouchB",
1940
- pointerType: "touch"
1941
- },
1942
- {
1943
- name: "TouchC",
1944
- pointerType: "touch"
1945
- }
1946
- ];
1947
- function gi(e, t, n) {
1948
- return t in e ? Object.defineProperty(e, t, {
1949
- value: n,
1950
- enumerable: !0,
1951
- configurable: !0,
1952
- writable: !0
1953
- }) : e[t] = n, e;
1954
- }
1955
- class Rt {
1956
- getButtons() {
1957
- let t = 0;
1958
- for (const n of Object.keys(this.pressed))
1959
- t |= 2 ** Number(n);
1960
- return t;
1961
- }
1962
- down(t) {
1963
- const n = Ve(t.button);
1964
- if (n in this.pressed) {
1965
- this.pressed[n].push(t);
1966
- return;
1967
- }
1968
- return this.pressed[n] = [
1969
- t
1970
- ], n;
1971
- }
1972
- up(t) {
1973
- const n = Ve(t.button);
1974
- if (n in this.pressed && (this.pressed[n] = this.pressed[n].filter((i) => i.name !== t.name), this.pressed[n].length === 0))
1975
- return delete this.pressed[n], n;
1976
- }
1977
- constructor() {
1978
- gi(this, "pressed", {});
1979
- }
1980
- }
1981
- const ct = {
1982
- primary: 0,
1983
- secondary: 1,
1984
- auxiliary: 2,
1985
- back: 3,
1986
- X1: 3,
1987
- forward: 4,
1988
- X2: 4
1989
- };
1990
- function Ve(e = 0) {
1991
- return e in ct ? ct[e] : Number(e);
1992
- }
1993
- const lt = {
1994
- 1: 2,
1995
- 2: 1
1996
- };
1997
- function ze(e) {
1998
- return e = Ve(e), e in lt ? lt[e] : e;
1999
- }
2000
- function Ei(e, t, n) {
2001
- return t in e ? Object.defineProperty(e, t, {
2002
- value: n,
2003
- enumerable: !0,
2004
- configurable: !0,
2005
- writable: !0
2006
- }) : e[t] = n, e;
2007
- }
2008
- class wi {
2009
- get countPressed() {
2010
- return this.pressedKeys.size;
2011
- }
2012
- isPressed(t) {
2013
- return this.pressedKeys.has(t.name);
2014
- }
2015
- addPressed(t) {
2016
- return this.pressedKeys.add(t.name);
2017
- }
2018
- removePressed(t) {
2019
- return this.pressedKeys.delete(t.name);
2020
- }
2021
- constructor() {
2022
- Ei(this, "pressedKeys", /* @__PURE__ */ new Set());
2023
- }
2024
- }
2025
- function ye(e, t) {
2026
- const n = [];
2027
- for (let o = e; o; o = o.parentElement)
2028
- n.push(o);
2029
- const i = [];
2030
- for (let o = t; o; o = o.parentElement)
2031
- i.push(o);
2032
- let r = 0;
2033
- for (; !(r >= n.length || r >= i.length || n[n.length - 1 - r] !== i[i.length - 1 - r]); r++)
2034
- ;
2035
- return [
2036
- n.slice(0, n.length - r),
2037
- i.slice(0, i.length - r),
2038
- i.slice(i.length - r)
2039
- ];
2040
- }
2041
- function Ke({ target: e, node: t, offset: n }) {
2042
- return P(e) ? {
2043
- node: e,
2044
- offset: n ?? A(e).length
2045
- } : t ? {
2046
- node: t,
2047
- offset: n ?? (t.nodeType === 3 ? t.nodeValue.length : t.childNodes.length)
2048
- } : jt(e, n);
2049
- }
2050
- function jt(e, t, n = !0) {
2051
- let i = t === void 0 ? e.childNodes.length - 1 : 0;
2052
- const r = t === void 0 ? -1 : 1;
2053
- for (; t === void 0 ? i >= (n ? Math.max(e.childNodes.length - 1, 0) : 0) : i <= e.childNodes.length; ) {
2054
- if (t && i === e.childNodes.length)
2055
- throw new Error("The given offset is out of bounds.");
2056
- const o = e.childNodes.item(i), s = String(o.textContent);
2057
- if (s.length)
2058
- if (t !== void 0 && s.length < t)
2059
- t -= s.length;
2060
- else {
2061
- if (o.nodeType === 1)
2062
- return jt(o, t, !1);
2063
- if (o.nodeType === 3)
2064
- return {
2065
- node: o,
2066
- offset: t ?? o.nodeValue.length
2067
- };
2068
- }
2069
- i += r;
2070
- }
2071
- return {
2072
- node: e,
2073
- offset: e.childNodes.length
2074
- };
2075
- }
2076
- function ki({ document: e, target: t, clickCount: n, node: i, offset: r }) {
2077
- if (gn(t))
2078
- return;
2079
- const o = P(t), s = String(o ? A(t) : t.textContent), [u, d] = i ? (
2080
- // which elements might be considered in the same line of text.
2081
- // TODO: support expanding initial range on multiple clicks if node is given
2082
- [
2083
- r,
2084
- r
2085
- ]
2086
- ) : Ci(s, r, n);
2087
- if (o)
2088
- return ue(t, {
2089
- anchorOffset: u ?? s.length,
2090
- focusOffset: d ?? s.length
2091
- }), {
2092
- node: t,
2093
- start: u ?? 0,
2094
- end: d ?? s.length
2095
- };
2096
- {
2097
- const { node: a, offset: c } = Ke({
2098
- target: t,
2099
- node: i,
2100
- offset: u
2101
- }), { node: p, offset: g } = Ke({
2102
- target: t,
2103
- node: i,
2104
- offset: d
2105
- }), E = t.ownerDocument.createRange();
2106
- try {
2107
- E.setStart(a, c), E.setEnd(p, g);
2108
- } catch {
2109
- throw new Error("The given offset is out of bounds.");
2110
- }
2111
- const k = e.getSelection();
2112
- return k == null || k.removeAllRanges(), k == null || k.addRange(E.cloneRange()), E;
2113
- }
2114
- }
2115
- function Ci(e, t, n) {
2116
- if (n % 3 === 1 || e.length === 0)
2117
- return [
2118
- t,
2119
- t
2120
- ];
2121
- const i = t ?? e.length;
2122
- return n % 3 === 2 ? [
2123
- i - e.substr(0, t).match(/(\w+|\s+|\W)?$/)[0].length,
2124
- t === void 0 ? t : t + e.substr(t).match(/^(\w+|\s+|\W)?/)[0].length
2125
- ] : [
2126
- i - e.substr(0, t).match(/[^\r\n]*$/)[0].length,
2127
- t === void 0 ? t : t + e.substr(t).match(/^[^\r\n]*/)[0].length
2128
- ];
2129
- }
2130
- function Ti(e, { document: t, target: n, node: i, offset: r }) {
2131
- const o = Ke({
2132
- target: n,
2133
- node: i,
2134
- offset: r
2135
- });
2136
- if ("node" in e) {
2137
- if (o.node === e.node) {
2138
- const s = o.offset < e.start ? e.end : e.start, u = o.offset > e.end || o.offset < e.start ? o.offset : e.end;
2139
- ue(e.node, {
2140
- anchorOffset: s,
2141
- focusOffset: u
2142
- });
2143
- }
2144
- } else {
2145
- const s = e.cloneRange(), u = s.comparePoint(o.node, o.offset);
2146
- u < 0 ? s.setStart(o.node, o.offset) : u > 0 && s.setEnd(o.node, o.offset);
2147
- const d = t.getSelection();
2148
- d == null || d.removeAllRanges(), d == null || d.addRange(s.cloneRange());
2149
- }
2150
- }
2151
- function Ht(e, t) {
2152
- var n, i, r, o, s, u, d, a, c, p, g, E, k, U, de, F, ae, V, ce, z, le, K, R, j;
2153
- return e.target !== t.target || ((n = e.coords) === null || n === void 0 ? void 0 : n.x) !== ((i = t.coords) === null || i === void 0 ? void 0 : i.x) || ((r = e.coords) === null || r === void 0 ? void 0 : r.y) !== ((o = t.coords) === null || o === void 0 ? void 0 : o.y) || ((s = e.coords) === null || s === void 0 ? void 0 : s.clientX) !== ((u = t.coords) === null || u === void 0 ? void 0 : u.clientX) || ((d = e.coords) === null || d === void 0 ? void 0 : d.clientY) !== ((a = t.coords) === null || a === void 0 ? void 0 : a.clientY) || ((c = e.coords) === null || c === void 0 ? void 0 : c.offsetX) !== ((p = t.coords) === null || p === void 0 ? void 0 : p.offsetX) || ((g = e.coords) === null || g === void 0 ? void 0 : g.offsetY) !== ((E = t.coords) === null || E === void 0 ? void 0 : E.offsetY) || ((k = e.coords) === null || k === void 0 ? void 0 : k.pageX) !== ((U = t.coords) === null || U === void 0 ? void 0 : U.pageX) || ((de = e.coords) === null || de === void 0 ? void 0 : de.pageY) !== ((F = t.coords) === null || F === void 0 ? void 0 : F.pageY) || ((ae = e.coords) === null || ae === void 0 ? void 0 : ae.screenX) !== ((V = t.coords) === null || V === void 0 ? void 0 : V.screenX) || ((ce = e.coords) === null || ce === void 0 ? void 0 : ce.screenY) !== ((z = t.coords) === null || z === void 0 ? void 0 : z.screenY) || ((le = e.caret) === null || le === void 0 ? void 0 : le.node) !== ((K = t.caret) === null || K === void 0 ? void 0 : K.node) || ((R = e.caret) === null || R === void 0 ? void 0 : R.offset) !== ((j = t.caret) === null || j === void 0 ? void 0 : j.offset);
2154
- }
2155
- function W(e, t, n) {
2156
- return t in e ? Object.defineProperty(e, t, {
2157
- value: n,
2158
- enumerable: !0,
2159
- configurable: !0,
2160
- writable: !0
2161
- }) : e[t] = n, e;
2162
- }
2163
- class Ii {
2164
- move(t, n, i) {
2165
- const r = this.position, o = this.getTarget(t);
2166
- if (this.position = n, !Ht(r, n))
2167
- return;
2168
- const s = this.getTarget(t), u = this.getEventInit("mousemove"), [d, a] = ye(o, s);
2169
- return {
2170
- leave: () => {
2171
- o !== s && (t.dispatchUIEvent(o, "mouseout", u), d.forEach((c) => t.dispatchUIEvent(c, "mouseleave", u)));
2172
- },
2173
- enter: () => {
2174
- o !== s && (t.dispatchUIEvent(s, "mouseover", u), a.forEach((c) => t.dispatchUIEvent(c, "mouseenter", u)));
2175
- },
2176
- move: () => {
2177
- i || (t.dispatchUIEvent(s, "mousemove", u), this.modifySelecting(t));
2178
- }
2179
- };
2180
- }
2181
- down(t, n, i) {
2182
- const r = this.buttons.down(n);
2183
- if (r === void 0)
2184
- return;
2185
- const o = this.getTarget(t);
2186
- this.buttonDownTarget[r] = o;
2187
- const s = this.getEventInit("mousedown", n.button), u = N(o);
2188
- !i && (u || t.dispatchUIEvent(o, "mousedown", s)) && (this.startSelecting(t, s.detail), M(o)), !u && ze(n.button) === 2 && t.dispatchUIEvent(o, "contextmenu", this.getEventInit("contextmenu", n.button));
2189
- }
2190
- up(t, n, i) {
2191
- const r = this.buttons.up(n);
2192
- if (r === void 0)
2193
- return;
2194
- const o = this.getTarget(t);
2195
- if (!N(o)) {
2196
- if (!i) {
2197
- const u = this.getEventInit("mouseup", n.button);
2198
- t.dispatchUIEvent(o, "mouseup", u), this.endSelecting();
2199
- }
2200
- const s = ye(this.buttonDownTarget[r], o)[2][0];
2201
- if (s) {
2202
- const u = this.getEventInit("click", n.button);
2203
- u.detail && (t.dispatchUIEvent(s, u.button === 0 ? "click" : "auxclick", u), u.button === 0 && u.detail === 2 && t.dispatchUIEvent(s, "dblclick", {
2204
- ...this.getEventInit("dblclick", n.button),
2205
- detail: u.detail
2206
- }));
2207
- }
2208
- }
2209
- }
2210
- resetClickCount() {
2211
- this.clickCount.reset();
2212
- }
2213
- getEventInit(t, n) {
2214
- const i = {
2215
- ...this.position.coords
2216
- };
2217
- return i.button = ze(n), i.buttons = this.buttons.getButtons(), t === "mousedown" ? i.detail = this.clickCount.getOnDown(i.button) : t === "mouseup" ? i.detail = this.clickCount.getOnUp(i.button) : (t === "click" || t === "auxclick") && (i.detail = this.clickCount.incOnClick(i.button)), i;
2218
- }
2219
- getTarget(t) {
2220
- var n;
2221
- return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2222
- }
2223
- startSelecting(t, n) {
2224
- var i, r;
2225
- this.selecting = ki({
2226
- document: t.config.document,
2227
- target: this.getTarget(t),
2228
- node: (i = this.position.caret) === null || i === void 0 ? void 0 : i.node,
2229
- offset: (r = this.position.caret) === null || r === void 0 ? void 0 : r.offset,
2230
- clickCount: n
2231
- });
2232
- }
2233
- modifySelecting(t) {
2234
- var n, i;
2235
- this.selecting && Ti(this.selecting, {
2236
- document: t.config.document,
2237
- target: this.getTarget(t),
2238
- node: (n = this.position.caret) === null || n === void 0 ? void 0 : n.node,
2239
- offset: (i = this.position.caret) === null || i === void 0 ? void 0 : i.offset
2240
- });
2241
- }
2242
- endSelecting() {
2243
- this.selecting = void 0;
2244
- }
2245
- constructor() {
2246
- W(this, "position", {}), W(this, "buttons", new Rt()), W(this, "selecting", void 0), W(this, "buttonDownTarget", {}), W(this, "clickCount", new class {
2247
- incOnClick(t) {
2248
- const n = this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2249
- return this.count = this.count[t] === void 0 ? {} : {
2250
- [t]: Number(this.count[t]) + 1
2251
- }, n;
2252
- }
2253
- getOnDown(t) {
2254
- var n;
2255
- this.down = {
2256
- [t]: (n = this.count[t]) !== null && n !== void 0 ? n : 0
2257
- };
2258
- var i;
2259
- return this.count = {
2260
- [t]: (i = this.count[t]) !== null && i !== void 0 ? i : 0
2261
- }, Number(this.count[t]) + 1;
2262
- }
2263
- getOnUp(t) {
2264
- return this.down[t] === void 0 ? void 0 : Number(this.down[t]) + 1;
2265
- }
2266
- reset() {
2267
- this.count = {};
2268
- }
2269
- constructor() {
2270
- W(this, "down", {}), W(this, "count", {});
2271
- }
2272
- }());
2273
- }
2274
- }
2275
- function Ue(e, t) {
2276
- var n;
2277
- return ((n = Gt(e, t)) === null || n === void 0 ? void 0 : n.pointerEvents) !== "none";
2278
- }
2279
- function Si(e) {
2280
- const t = S(e);
2281
- for (let n = e, i = []; n != null && n.ownerDocument; n = n.parentElement) {
2282
- i.push(n);
2283
- const r = t.getComputedStyle(n).pointerEvents;
2284
- if (r && ![
2285
- "inherit",
2286
- "unset"
2287
- ].includes(r))
2288
- return {
2289
- pointerEvents: r,
2290
- tree: i
2291
- };
2292
- }
2293
- }
2294
- const ft = Symbol("Last check for pointer-events");
2295
- function Gt(e, t) {
2296
- const n = t[ft];
2297
- if (!(e.config.pointerEventsCheck !== Ae.Never && (!n || pt(e.config.pointerEventsCheck, Ae.EachApiCall) && n[I.Call] !== Ie(e, I.Call) || pt(e.config.pointerEventsCheck, Ae.EachTrigger) && n[I.Trigger] !== Ie(e, I.Trigger))))
2298
- return n == null ? void 0 : n.result;
2299
- const r = Si(t);
2300
- return t[ft] = {
2301
- [I.Call]: Ie(e, I.Call),
2302
- [I.Trigger]: Ie(e, I.Trigger),
2303
- result: r
2304
- }, r;
2305
- }
2306
- function me(e, t) {
2307
- const n = Gt(e, t);
2308
- if ((n == null ? void 0 : n.pointerEvents) === "none")
2309
- throw new Error([
2310
- `Unable to perform pointer interaction as the element ${n.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
2311
- "",
2312
- _i(n.tree)
2313
- ].join(`
2314
- `));
2315
- }
2316
- function _i(e) {
2317
- return e.reverse().map((t, n) => [
2318
- "".padEnd(n),
2319
- t.tagName,
2320
- t.id && `#${t.id}`,
2321
- t.hasAttribute("data-testid") && `(testId=${t.getAttribute("data-testid")})`,
2322
- Pi(t),
2323
- e.length > 1 && n === 0 && " <-- This element declared `pointer-events: none`",
2324
- e.length > 1 && n === e.length - 1 && " <-- Asserted pointer events here"
2325
- ].filter(Boolean).join("")).join(`
2326
- `);
2327
- }
2328
- function Pi(e) {
2329
- var t;
2330
- let n;
2331
- if (e.hasAttribute("aria-label"))
2332
- n = e.getAttribute("aria-label");
2333
- else if (e.hasAttribute("aria-labelledby")) {
2334
- var i, r;
2335
- n = (r = e.ownerDocument.getElementById(e.getAttribute("aria-labelledby"))) === null || r === void 0 || (i = r.textContent) === null || i === void 0 ? void 0 : i.trim();
2336
- } else if (f(e, [
2337
- "button",
2338
- "input",
2339
- "meter",
2340
- "output",
2341
- "progress",
2342
- "select",
2343
- "textarea"
2344
- ]) && (!((t = e.labels) === null || t === void 0) && t.length))
2345
- n = Array.from(e.labels).map((s) => {
2346
- var u;
2347
- return (u = s.textContent) === null || u === void 0 ? void 0 : u.trim();
2348
- }).join("|");
2349
- else if (f(e, "button")) {
2350
- var o;
2351
- n = (o = e.textContent) === null || o === void 0 ? void 0 : o.trim();
2352
- }
2353
- return n = n == null ? void 0 : n.replace(/\n/g, " "), Number(n == null ? void 0 : n.length) > 30 && (n = `${n == null ? void 0 : n.substring(0, 29)}…`), n ? `(label=${n})` : "";
2354
- }
2355
- function pt(e, t) {
2356
- return (e & t) > 0;
2357
- }
2358
- function O(e, t, n) {
2359
- return t in e ? Object.defineProperty(e, t, {
2360
- value: n,
2361
- enumerable: !0,
2362
- configurable: !0,
2363
- writable: !0
2364
- }) : e[t] = n, e;
2365
- }
2366
- class Ai {
2367
- init(t) {
2368
- const n = this.getTarget(t), [, i] = ye(null, n), r = this.getEventInit();
2369
- return me(t, n), t.dispatchUIEvent(n, "pointerover", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerenter", r)), this;
2370
- }
2371
- move(t, n) {
2372
- const i = this.position, r = this.getTarget(t);
2373
- if (this.position = n, !Ht(i, n))
2374
- return;
2375
- const o = this.getTarget(t), s = this.getEventInit(-1), [u, d] = ye(r, o);
2376
- return {
2377
- leave: () => {
2378
- Ue(t, r) && r !== o && (t.dispatchUIEvent(r, "pointerout", s), u.forEach((a) => t.dispatchUIEvent(a, "pointerleave", s)));
2379
- },
2380
- enter: () => {
2381
- me(t, o), r !== o && (t.dispatchUIEvent(o, "pointerover", s), d.forEach((a) => t.dispatchUIEvent(a, "pointerenter", s)));
2382
- },
2383
- move: () => {
2384
- t.dispatchUIEvent(o, "pointermove", s);
2385
- }
2386
- };
2387
- }
2388
- down(t, n = 0) {
2389
- if (this.isDown)
2390
- return;
2391
- const i = this.getTarget(t);
2392
- me(t, i), this.isDown = !0, this.isPrevented = !t.dispatchUIEvent(i, "pointerdown", this.getEventInit(n));
2393
- }
2394
- up(t, n = 0) {
2395
- if (!this.isDown)
2396
- return;
2397
- const i = this.getTarget(t);
2398
- me(t, i), this.isPrevented = !1, this.isDown = !1, t.dispatchUIEvent(i, "pointerup", this.getEventInit(n));
2399
- }
2400
- release(t) {
2401
- const n = this.getTarget(t), [i] = ye(n, null), r = this.getEventInit();
2402
- Ue(t, n) && (t.dispatchUIEvent(n, "pointerout", r), i.forEach((o) => t.dispatchUIEvent(o, "pointerleave", r))), this.isCancelled = !0;
2403
- }
2404
- getTarget(t) {
2405
- var n;
2406
- return (n = this.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2407
- }
2408
- getEventInit(t) {
2409
- return {
2410
- ...this.position.coords,
2411
- pointerId: this.pointerId,
2412
- pointerType: this.pointerType,
2413
- isPrimary: this.isPrimary,
2414
- button: ze(t),
2415
- buttons: this.buttons.getButtons()
2416
- };
2417
- }
2418
- constructor({ pointerId: t, pointerType: n, isPrimary: i }, r) {
2419
- O(this, "pointerId", void 0), O(this, "pointerType", void 0), O(this, "isPrimary", void 0), O(this, "buttons", void 0), O(this, "isMultitouch", !1), O(this, "isCancelled", !1), O(this, "isDown", !1), O(this, "isPrevented", !1), O(this, "position", {}), this.pointerId = t, this.pointerType = n, this.isPrimary = i, this.isMultitouch = !i, this.buttons = r;
2420
- }
2421
- }
2422
- function x(e, t, n) {
2423
- return t in e ? Object.defineProperty(e, t, {
2424
- value: n,
2425
- enumerable: !0,
2426
- configurable: !0,
2427
- writable: !0
2428
- }) : e[t] = n, e;
2429
- }
2430
- class Oi {
2431
- isKeyPressed(t) {
2432
- return this.devices.get(t.pointerType).isPressed(t);
2433
- }
2434
- async press(t, n, i) {
2435
- this.devices.get(n.pointerType).addPressed(n), this.buttons.down(n);
2436
- const r = this.getPointerName(n), o = n.pointerType === "touch" ? this.pointers.new(r, n.pointerType, this.buttons) : this.pointers.get(r);
2437
- o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), o.pointerType === "touch" && o.init(t), o.down(t, n.button), o.pointerType !== "touch" && this.mouse.down(t, n, o.isPrevented);
2438
- }
2439
- async move(t, n, i) {
2440
- const r = this.pointers.get(n), o = r.move(t, i), s = r.pointerType === "touch" ? void 0 : this.mouse.move(t, i, r.isPrevented);
2441
- o == null || o.leave(), s == null || s.leave(), o == null || o.enter(), s == null || s.enter(), o == null || o.move(), s == null || s.move();
2442
- }
2443
- async release(t, n, i) {
2444
- const r = this.devices.get(n.pointerType);
2445
- r.removePressed(n), this.buttons.up(n);
2446
- const o = this.pointers.get(this.getPointerName(n)), s = o.isPrevented;
2447
- if (o.position = i, o.pointerType !== "touch" && (this.mouse.position = i), r.countPressed === 0 && o.up(t, n.button), o.pointerType === "touch" && o.release(t), o.pointerType === "touch" && !o.isMultitouch) {
2448
- const u = this.mouse.move(t, i, s);
2449
- u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.down(t, n, s);
2450
- }
2451
- if (!o.isMultitouch) {
2452
- const u = this.mouse.move(t, i, s);
2453
- u == null || u.leave(), u == null || u.enter(), u == null || u.move(), this.mouse.up(t, n, s);
2454
- }
2455
- }
2456
- getPointerName(t) {
2457
- return t.pointerType === "touch" ? t.name : t.pointerType;
2458
- }
2459
- getPreviousPosition(t) {
2460
- return this.pointers.has(t) ? this.pointers.get(t).position : void 0;
2461
- }
2462
- resetClickCount() {
2463
- this.mouse.resetClickCount();
2464
- }
2465
- getMouseTarget(t) {
2466
- var n;
2467
- return (n = this.mouse.position.target) !== null && n !== void 0 ? n : t.config.document.body;
2468
- }
2469
- setMousePosition(t) {
2470
- this.mouse.position = t, this.pointers.get("mouse").position = t;
2471
- }
2472
- constructor(t) {
2473
- x(this, "system", void 0), x(this, "mouse", void 0), x(this, "buttons", void 0), x(this, "devices", new class {
2474
- get(n) {
2475
- var i, r, o;
2476
- return (o = (i = this.registry)[r = n]) !== null && o !== void 0 ? o : i[r] = new wi();
2477
- }
2478
- constructor() {
2479
- x(this, "registry", {});
2480
- }
2481
- }()), x(this, "pointers", new class {
2482
- new(n, i, r) {
2483
- const o = i !== "touch" || !Object.values(this.registry).some((s) => s.pointerType === "touch" && !s.isCancelled);
2484
- return o || Object.values(this.registry).forEach((s) => {
2485
- s.pointerType === i && !s.isCancelled && (s.isMultitouch = !0);
2486
- }), this.registry[n] = new Ai({
2487
- pointerId: this.nextId++,
2488
- pointerType: i,
2489
- isPrimary: o
2490
- }, r), this.registry[n];
2491
- }
2492
- get(n) {
2493
- if (!this.has(n))
2494
- throw new Error(`Trying to access pointer "${n}" which does not exist.`);
2495
- return this.registry[n];
2496
- }
2497
- has(n) {
2498
- return n in this.registry;
2499
- }
2500
- constructor() {
2501
- x(this, "registry", {}), x(this, "nextId", 1);
2502
- }
2503
- }()), this.system = t, this.buttons = new Rt(), this.mouse = new Ii(), this.pointers.new("mouse", "mouse", this.buttons);
2504
- }
2505
- }
2506
- function ht(e, t, n) {
2507
- return t in e ? Object.defineProperty(e, t, {
2508
- value: n,
2509
- enumerable: !0,
2510
- configurable: !0,
2511
- writable: !0
2512
- }) : e[t] = n, e;
2513
- }
2514
- class Xt {
2515
- getUIEventModifiers() {
2516
- return {
2517
- altKey: this.keyboard.modifiers.Alt,
2518
- ctrlKey: this.keyboard.modifiers.Control,
2519
- metaKey: this.keyboard.modifiers.Meta,
2520
- shiftKey: this.keyboard.modifiers.Shift,
2521
- modifierAltGraph: this.keyboard.modifiers.AltGraph,
2522
- modifierCapsLock: this.keyboard.modifiers.CapsLock,
2523
- modifierFn: this.keyboard.modifiers.Fn,
2524
- modifierFnLock: this.keyboard.modifiers.FnLock,
2525
- modifierNumLock: this.keyboard.modifiers.NumLock,
2526
- modifierScrollLock: this.keyboard.modifiers.ScrollLock,
2527
- modifierSymbol: this.keyboard.modifiers.Symbol,
2528
- modifierSymbolLock: this.keyboard.modifiers.SymbolLock
2529
- };
2530
- }
2531
- constructor() {
2532
- ht(this, "keyboard", new mi(this)), ht(this, "pointer", new Oi(this));
2533
- }
2534
- }
2535
- async function Di(e) {
2536
- const t = [];
2537
- return this.config.skipHover || t.push({
2538
- target: e
2539
- }), t.push({
2540
- keys: "[MouseLeft]",
2541
- target: e
2542
- }), this.pointer(t);
2543
- }
2544
- async function Ni(e) {
2545
- return this.pointer([
2546
- {
2547
- target: e
2548
- },
2549
- "[MouseLeft][MouseLeft]"
2550
- ]);
2551
- }
2552
- async function Ui(e) {
2553
- return this.pointer([
2554
- {
2555
- target: e
2556
- },
2557
- "[MouseLeft][MouseLeft][MouseLeft]"
2558
- ]);
2559
- }
2560
- async function xi(e) {
2561
- return this.pointer({
2562
- target: e
2563
- });
2564
- }
2565
- async function Bi(e) {
2566
- return me(this, this.system.pointer.getMouseTarget(this)), this.pointer({
2567
- target: e.ownerDocument.body
2568
- });
2569
- }
2570
- async function Mi({ shift: e } = {}) {
2571
- return this.keyboard(e === !0 ? "{Shift>}{Tab}{/Shift}" : e === !1 ? "[/ShiftLeft][/ShiftRight]{Tab}" : "{Tab}");
2572
- }
2573
- var qe = /* @__PURE__ */ function(e) {
2574
- return e["{"] = "}", e["["] = "]", e;
2575
- }(qe || {});
2576
- function Wt(e, t) {
2577
- let n = 0;
2578
- const i = e[n] in qe ? e[n] : "";
2579
- n += i.length;
2580
- const o = new RegExp(`^\\${i}{2}`).test(e) ? "" : i;
2581
- return {
2582
- type: o,
2583
- ...o === "" ? $i(e, n, t) : Li(e, n, o, t)
2584
- };
2585
- }
2586
- function $i(e, t, n) {
2587
- const i = e[t];
2588
- return qt(i, e, t, n), t += i.length, {
2589
- consumedLength: t,
2590
- descriptor: i,
2591
- releasePrevious: !1,
2592
- releaseSelf: !0,
2593
- repeat: 1
2594
- };
2595
- }
2596
- function Li(e, t, n, i) {
2597
- var r, o;
2598
- const s = e[t] === "/" ? "/" : "";
2599
- t += s.length;
2600
- const u = n === "{" && e[t] === "\\";
2601
- t += Number(u);
2602
- const d = u ? e[t] : (r = e.slice(t).match(n === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) === null || r === void 0 ? void 0 : r[0];
2603
- qt(d, e, t, i), t += d.length;
2604
- var a;
2605
- const c = (a = (o = e.slice(t).match(/^>\d+/)) === null || o === void 0 ? void 0 : o[0]) !== null && a !== void 0 ? a : "";
2606
- t += c.length;
2607
- const p = e[t] === "/" || !c && e[t] === ">" ? e[t] : "";
2608
- t += p.length;
2609
- const g = qe[n], E = e[t] === g ? g : "";
2610
- if (!E)
2611
- throw new Error(Yt([
2612
- !c && "repeat modifier",
2613
- !p && "release modifier",
2614
- `"${g}"`
2615
- ].filter(Boolean).join(" or "), e[t], e, i));
2616
- return t += E.length, {
2617
- consumedLength: t,
2618
- descriptor: d,
2619
- releasePrevious: !!s,
2620
- repeat: c ? Math.max(Number(c.substr(1)), 1) : 1,
2621
- releaseSelf: Fi(p, c)
2622
- };
2623
- }
2624
- function qt(e, t, n, i) {
2625
- if (!e)
2626
- throw new Error(Yt("key descriptor", t[n], t, i));
2627
- }
2628
- function Fi(e, t) {
2629
- if (e)
2630
- return e === "/";
2631
- if (t)
2632
- return !1;
2633
- }
2634
- function Yt(e, t, n, i) {
2635
- return `Expected ${e} but found "${t ?? ""}" in "${n}"
2636
- See ${i === "pointer" ? "https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen" : "https://testing-library.com/docs/user-event/keyboard"}
2637
- for more information about how userEvent parses your input.`;
2638
- }
2639
- function Vi(e, t) {
2640
- const n = [];
2641
- do {
2642
- const { type: r, descriptor: o, consumedLength: s, releasePrevious: u, releaseSelf: d = !0, repeat: a } = Wt(t, "keyboard");
2643
- var i;
2644
- const c = (i = e.find((p) => {
2645
- if (r === "[") {
2646
- var g;
2647
- return ((g = p.code) === null || g === void 0 ? void 0 : g.toLowerCase()) === o.toLowerCase();
2648
- } else if (r === "{") {
2649
- var E;
2650
- return ((E = p.key) === null || E === void 0 ? void 0 : E.toLowerCase()) === o.toLowerCase();
2651
- }
2652
- return p.key === o;
2653
- })) !== null && i !== void 0 ? i : {
2654
- key: "Unknown",
2655
- code: "Unknown",
2656
- [r === "[" ? "code" : "key"]: o
2657
- };
2658
- n.push({
2659
- keyDef: c,
2660
- releasePrevious: u,
2661
- releaseSelf: d,
2662
- repeat: a
2663
- }), t = t.slice(s);
2664
- } while (t);
2665
- return n;
2666
- }
2667
- async function zi(e) {
2668
- const t = Vi(this.config.keyboardMap, e);
2669
- for (let n = 0; n < t.length; n++)
2670
- await se(this.config), await Ki(this, t[n]);
2671
- }
2672
- async function Ki(e, { keyDef: t, releasePrevious: n, releaseSelf: i, repeat: r }) {
2673
- const { system: o } = e;
2674
- if (o.keyboard.isKeyPressed(t) && await o.keyboard.keyup(e, t), !n) {
2675
- for (let s = 1; s <= r; s++)
2676
- await o.keyboard.keydown(e, t), s < r && await se(e.config);
2677
- i && await o.keyboard.keyup(e, t);
2678
- }
2679
- }
2680
- async function Ri(e) {
2681
- for (const t of e.system.keyboard.getPressedKeys())
2682
- await e.system.keyboard.keyup(e, t);
2683
- }
2684
- function Jt(e) {
2685
- const t = P(e) ? {
2686
- "text/plain": ji(e)
2687
- } : {
2688
- "text/plain": String(e.ownerDocument.getSelection())
2689
- }, n = je(S(e));
2690
- for (const i in t)
2691
- t[i] && n.setData(i, t[i]);
2692
- return n;
2693
- }
2694
- function ji(e) {
2695
- const t = ge(e);
2696
- return A(e).substring(t.startOffset, t.endOffset);
2697
- }
2698
- async function Hi() {
2699
- const e = this.config.document;
2700
- var t;
2701
- const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2702
- /* istanbul ignore next */
2703
- e.body
2704
- ), i = Jt(n);
2705
- if (i.items.length !== 0)
2706
- return this.dispatchUIEvent(n, "copy", {
2707
- clipboardData: i
2708
- }) && this.config.writeToClipboard && await Ct(e, i), i;
2709
- }
2710
- async function Gi() {
2711
- const e = this.config.document;
2712
- var t;
2713
- const n = (t = e.activeElement) !== null && t !== void 0 ? t : (
2714
- /* istanbul ignore next */
2715
- e.body
2716
- ), i = Jt(n);
2717
- if (i.items.length !== 0)
2718
- return this.dispatchUIEvent(n, "cut", {
2719
- clipboardData: i
2720
- }) && this.config.writeToClipboard && await Ct(n.ownerDocument, i), i;
2721
- }
2722
- async function Xi(e) {
2723
- const t = this.config.document;
2724
- var n;
2725
- const i = (n = t.activeElement) !== null && n !== void 0 ? n : (
2726
- /* istanbul ignore next */
2727
- t.body
2728
- );
2729
- var r;
2730
- const o = (r = typeof e == "string" ? Wi(t, e) : e) !== null && r !== void 0 ? r : await bn(t).catch(() => {
2731
- throw new Error("`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.");
2732
- });
2733
- this.dispatchUIEvent(i, "paste", {
2734
- clipboardData: o
2735
- });
2736
- }
2737
- function Wi(e, t) {
2738
- const n = je(S(e));
2739
- return n.setData("text", t), n;
2740
- }
2741
- function bt(e, t) {
2742
- const n = [];
2743
- do {
2744
- const { descriptor: i, consumedLength: r, releasePrevious: o, releaseSelf: s = !0 } = Wt(t, "pointer"), u = e.find((d) => d.name === i);
2745
- u && n.push({
2746
- keyDef: u,
2747
- releasePrevious: o,
2748
- releaseSelf: s
2749
- }), t = t.slice(r);
2750
- } while (t);
2751
- return n;
2752
- }
2753
- async function qi(e) {
2754
- const { pointerMap: t } = this.config, n = [];
2755
- (Array.isArray(e) ? e : [
2756
- e
2757
- ]).forEach((i) => {
2758
- typeof i == "string" ? n.push(...bt(t, i)) : "keys" in i ? n.push(...bt(t, i.keys).map((r) => ({
2759
- ...i,
2760
- ...r
2761
- }))) : n.push(i);
2762
- });
2763
- for (let i = 0; i < n.length; i++)
2764
- await se(this.config), await Yi(this, n[i]);
2765
- this.system.pointer.resetClickCount();
2766
- }
2767
- async function Yi(e, t) {
2768
- var n, i;
2769
- const r = "pointerName" in t && t.pointerName ? t.pointerName : "keyDef" in t ? e.system.pointer.getPointerName(t.keyDef) : "mouse", o = e.system.pointer.getPreviousPosition(r);
2770
- var s, u, d, a;
2771
- const c = {
2772
- target: (s = t.target) !== null && s !== void 0 ? s : Ji(e, o),
2773
- coords: (u = t.coords) !== null && u !== void 0 ? u : o == null ? void 0 : o.coords,
2774
- caret: {
2775
- node: (d = t.node) !== null && d !== void 0 ? d : mt(t) || o == null || (n = o.caret) === null || n === void 0 ? void 0 : n.node,
2776
- offset: (a = t.offset) !== null && a !== void 0 ? a : mt(t) || o == null || (i = o.caret) === null || i === void 0 ? void 0 : i.offset
2777
- }
2778
- };
2779
- "keyDef" in t ? (e.system.pointer.isKeyPressed(t.keyDef) && (be(e, I.Trigger), await e.system.pointer.release(e, t.keyDef, c)), t.releasePrevious || (be(e, I.Trigger), await e.system.pointer.press(e, t.keyDef, c), t.releaseSelf && (be(e, I.Trigger), await e.system.pointer.release(e, t.keyDef, c)))) : (be(e, I.Trigger), await e.system.pointer.move(e, r, c));
2780
- }
2781
- function mt(e) {
2782
- var t, n;
2783
- return !!((n = (t = e.target) !== null && t !== void 0 ? t : e.node) !== null && n !== void 0 ? n : e.offset !== void 0);
2784
- }
2785
- function Ji(e, t) {
2786
- if (!t)
2787
- throw new Error("This pointer has no previous position. Provide a target property!");
2788
- var n;
2789
- return (n = t.target) !== null && n !== void 0 ? n : e.config.document.body;
2790
- }
2791
- async function Qi(e) {
2792
- if (!ne(e) || N(e))
2793
- throw new Error("clear()` is only supported on editable elements.");
2794
- if (M(e), e.ownerDocument.activeElement !== e)
2795
- throw new Error("The element to be cleared could not be focused.");
2796
- if (Mt(e), !Xn(e))
2797
- throw new Error("The element content to be cleared could not be selected.");
2798
- oe(this, e, "", "deleteContentBackward");
2799
- }
2800
- async function Zi(e, t) {
2801
- return Qt.call(this, !0, e, t);
2802
- }
2803
- async function er(e, t) {
2804
- return Qt.call(this, !1, e, t);
2805
- }
2806
- async function Qt(e, t, n) {
2807
- if (!e && !t.multiple)
2808
- throw Q().getElementError("Unable to deselect an option in a non-multiple select. Use selectOptions to change the selection instead.", t);
2809
- const i = Array.isArray(n) ? n : [
2810
- n
2811
- ], r = Array.from(t.querySelectorAll('option, [role="option"]')), o = i.map((u) => {
2812
- if (typeof u != "string" && r.includes(u))
2813
- return u;
2814
- {
2815
- const d = r.find((a) => a.value === u || a.innerHTML === u);
2816
- if (d)
2817
- return d;
2818
- throw Q().getElementError(`Value "${String(u)}" not found in options`, t);
2819
- }
2820
- }).filter((u) => !N(u));
2821
- if (N(t) || !o.length) return;
2822
- const s = (u) => {
2823
- u.selected = e, this.dispatchUIEvent(t, "input", {
2824
- bubbles: !0,
2825
- cancelable: !1,
2826
- composed: !0
2827
- }), this.dispatchUIEvent(t, "change");
2828
- };
2829
- if (f(t, "select"))
2830
- if (t.multiple)
2831
- for (const u of o) {
2832
- const d = this.config.pointerEventsCheck === 0 ? !0 : Ue(this, u);
2833
- d && (this.dispatchUIEvent(u, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(u, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(u, "pointermove"), this.dispatchUIEvent(u, "mousemove"), this.dispatchUIEvent(u, "pointerdown"), this.dispatchUIEvent(u, "mousedown")), M(t), d && (this.dispatchUIEvent(u, "pointerup"), this.dispatchUIEvent(u, "mouseup")), s(u), d && this.dispatchUIEvent(u, "click"), await se(this.config);
2834
- }
2835
- else if (o.length === 1) {
2836
- const u = this.config.pointerEventsCheck === 0 ? !0 : Ue(this, t);
2837
- u ? await this.click(t) : M(t), s(o[0]), u && (this.dispatchUIEvent(t, "pointerover"), this.dispatchUIEvent(t, "pointerenter"), this.dispatchUIEvent(t, "mouseover"), this.dispatchUIEvent(t, "mouseenter"), this.dispatchUIEvent(t, "pointerup"), this.dispatchUIEvent(t, "mouseup"), this.dispatchUIEvent(t, "click")), await se(this.config);
2838
- } else
2839
- throw Q().getElementError("Cannot select multiple options on a non-multiple select", t);
2840
- else if (t.getAttribute("role") === "listbox")
2841
- for (const u of o)
2842
- await this.click(u), await this.unhover(u);
2843
- else
2844
- throw Q().getElementError("Cannot select options on elements that are neither select nor listbox elements", t);
2845
- }
2846
- async function tr(e, t, { skipClick: n = this.config.skipClick, skipAutoClose: i = this.config.skipAutoClose, initialSelectionStart: r, initialSelectionEnd: o } = {}) {
2847
- e.disabled || (n || await this.click(e), r !== void 0 && he(e, r, o ?? r), await this.keyboard(t), i || await Ri(this));
2848
- }
2849
- const yt = Symbol("files and value properties are mocked");
2850
- function Fe(e, t, n) {
2851
- n ? Object.defineProperty(e, t, n) : delete e[t];
2852
- }
2853
- function nr(e, t) {
2854
- var n;
2855
- (n = e[yt]) === null || n === void 0 || n.restore();
2856
- const i = Object.getOwnPropertyDescriptor(e, "type"), r = Object.getOwnPropertyDescriptor(e, "value"), o = Object.getOwnPropertyDescriptor(e, "files");
2857
- function s() {
2858
- Fe(e, "type", i), Fe(e, "value", r), Fe(e, "files", o);
2859
- }
2860
- e[yt] = {
2861
- restore: s
2862
- }, Object.defineProperties(e, {
2863
- files: {
2864
- configurable: !0,
2865
- get: () => t
2866
- },
2867
- value: {
2868
- configurable: !0,
2869
- get: () => t.length ? `C:\\fakepath\\${t[0].name}` : "",
2870
- set(u) {
2871
- if (u === "")
2872
- s();
2873
- else {
2874
- var d;
2875
- r == null || (d = r.set) === null || d === void 0 || d.call(e, u);
2876
- }
2877
- }
2878
- },
2879
- type: {
2880
- configurable: !0,
2881
- get: () => "file",
2882
- set(u) {
2883
- u !== "file" && (s(), e.type = u);
2884
- }
2885
- }
2886
- });
2887
- }
2888
- async function ir(e, t) {
2889
- const n = f(e, "label") ? e.control : e;
2890
- if (!n || !f(n, "input", {
2891
- type: "file"
2892
- }))
2893
- throw new TypeError(`The ${n === e ? "given" : "associated"} ${n == null ? void 0 : n.tagName} element does not accept file uploads`);
2894
- if (N(e)) return;
2895
- const i = (Array.isArray(t) ? t : [
2896
- t
2897
- ]).filter((o) => !this.config.applyAccept || rr(o, n.accept)).slice(0, n.multiple ? void 0 : 1), r = () => {
2898
- var o;
2899
- i.length === ((o = n.files) === null || o === void 0 ? void 0 : o.length) && i.every((s, u) => {
2900
- var d;
2901
- return s === ((d = n.files) === null || d === void 0 ? void 0 : d.item(u));
2902
- }) || (nr(n, Re(S(e), i)), this.dispatchUIEvent(n, "input"), this.dispatchUIEvent(n, "change"));
2903
- };
2904
- n.addEventListener("fileDialog", r), await this.click(e), n.removeEventListener("fileDialog", r);
2905
- }
2906
- function Se(e) {
2907
- return e.toLowerCase().replace(/(\.|\/)jpg\b/g, "$1jpeg");
2908
- }
2909
- function rr(e, t) {
2910
- if (!t)
2911
- return !0;
2912
- const n = [
2913
- "audio/*",
2914
- "image/*",
2915
- "video/*"
2916
- ];
2917
- return Se(t).trim().split(/\s*,\s*/).some((i) => i.startsWith(".") ? Se(e.name).endsWith(i) : n.includes(i) ? Se(e.type).startsWith(i.replace("*", "")) : Se(e.type) === i);
2918
- }
2919
- const vt = {
2920
- click: Di,
2921
- dblClick: Ni,
2922
- tripleClick: Ui,
2923
- hover: xi,
2924
- unhover: Bi,
2925
- tab: Mi,
2926
- keyboard: zi,
2927
- copy: Hi,
2928
- cut: Gi,
2929
- paste: Xi,
2930
- pointer: qi,
2931
- clear: Qi,
2932
- deselectOptions: er,
2933
- selectOptions: Zi,
2934
- type: tr,
2935
- upload: ir
2936
- };
2937
- function or(e) {
2938
- return Q().asyncWrapper(e);
2939
- }
2940
- const Zt = {
2941
- applyAccept: !0,
2942
- autoModify: !0,
2943
- delay: 0,
2944
- document: globalThis.document,
2945
- keyboardMap: yi,
2946
- pointerMap: vi,
2947
- pointerEventsCheck: Ae.EachApiCall,
2948
- skipAutoClose: !1,
2949
- skipClick: !1,
2950
- skipHover: !1,
2951
- writeToClipboard: !1,
2952
- advanceTimers: () => Promise.resolve()
2953
- }, sr = {
2954
- ...Zt,
2955
- writeToClipboard: !0
2956
- };
2957
- function en(e = {}, t = sr, n) {
2958
- const i = cr(e, n, t);
2959
- return {
2960
- ...t,
2961
- ...e,
2962
- document: i
2963
- };
2964
- }
2965
- function ur(e = {}) {
2966
- const t = en(e);
2967
- Kt(t.document), zt(S(t.document).HTMLElement);
2968
- var n;
2969
- const i = (n = t.document.defaultView) !== null && n !== void 0 ? n : (
2970
- /* istanbul ignore next */
2971
- globalThis.window
2972
- );
2973
- return fn(i), Ye(t).api;
2974
- }
2975
- function C({ keyboardState: e, pointerState: t, ...n } = {}, i) {
2976
- const r = en(n, Zt, i);
2977
- Kt(r.document), zt(S(r.document).HTMLElement);
2978
- var o;
2979
- const s = (o = t ?? e) !== null && o !== void 0 ? o : new Xt();
2980
- return {
2981
- api: Ye(r, s).api,
2982
- system: s
2983
- };
2984
- }
2985
- function dr(e) {
2986
- return Ye({
2987
- ...this.config,
2988
- ...e
2989
- }, this.system).api;
2990
- }
2991
- function ar(e, t) {
2992
- function n(...i) {
2993
- return be(e, I.Call), or(() => t.apply(e, i).then(async (r) => (await se(e.config), r)));
2994
- }
2995
- return Object.defineProperty(n, "name", {
2996
- get: () => t.name
2997
- }), n;
2998
- }
2999
- function Ye(e, t = new Xt()) {
3000
- const n = {};
3001
- return Object.assign(n, {
3002
- config: e,
3003
- dispatchEvent: Vt.bind(n),
3004
- dispatchUIEvent: ui.bind(n),
3005
- system: t,
3006
- levelRefs: {},
3007
- ...vt
3008
- }), {
3009
- instance: n,
3010
- api: {
3011
- ...Object.fromEntries(Object.entries(vt).map(([i, r]) => [
3012
- i,
3013
- ar(n, r)
3014
- ])),
3015
- setup: dr.bind(n)
3016
- }
3017
- };
3018
- }
3019
- function cr(e, t, n) {
3020
- var i, r;
3021
- return (r = (i = e.document) !== null && i !== void 0 ? i : t && fi(t)) !== null && r !== void 0 ? r : n.document;
3022
- }
3023
- function lr(e) {
3024
- return C().api.clear(e);
3025
- }
3026
- function fr(e, t = {}) {
3027
- return C(t, e).api.click(e);
3028
- }
3029
- function pr(e = {}) {
3030
- return C(e).api.copy();
3031
- }
3032
- function hr(e = {}) {
3033
- return C(e).api.cut();
3034
- }
3035
- function br(e, t = {}) {
3036
- return C(t).api.dblClick(e);
3037
- }
3038
- function mr(e, t, n = {}) {
3039
- return C(n).api.deselectOptions(e, t);
3040
- }
3041
- function yr(e, t = {}) {
3042
- return C(t).api.hover(e);
3043
- }
3044
- async function vr(e, t = {}) {
3045
- const { api: n, system: i } = C(t);
3046
- return n.keyboard(e).then(() => i);
3047
- }
3048
- async function gr(e, t = {}) {
3049
- const { api: n, system: i } = C(t);
3050
- return n.pointer(e).then(() => i);
3051
- }
3052
- function Er(e, t) {
3053
- return C(t).api.paste(e);
3054
- }
3055
- function wr(e, t, n = {}) {
3056
- return C(n).api.selectOptions(e, t);
3057
- }
3058
- function kr(e, t = {}) {
3059
- return C(t).api.tripleClick(e);
3060
- }
3061
- function Cr(e, t, n = {}) {
3062
- return C(n, e).api.type(e, t, n);
3063
- }
3064
- function Tr(e, t = {}) {
3065
- const { api: n, system: i } = C(t);
3066
- return i.pointer.setMousePosition({
3067
- target: e
3068
- }), n.unhover(e);
3069
- }
3070
- function Ir(e, t, n = {}) {
3071
- return C(n).api.upload(e, t);
3072
- }
3073
- function Sr(e = {}) {
3074
- return C().api.tab(e);
3075
- }
3076
- const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3077
- __proto__: null,
3078
- clear: lr,
3079
- click: fr,
3080
- copy: pr,
3081
- cut: hr,
3082
- dblClick: br,
3083
- deselectOptions: mr,
3084
- hover: yr,
3085
- keyboard: vr,
3086
- paste: Er,
3087
- pointer: gr,
3088
- selectOptions: wr,
3089
- tab: Sr,
3090
- tripleClick: kr,
3091
- type: Cr,
3092
- unhover: Tr,
3093
- upload: Ir
3094
- }, Symbol.toStringTag, { value: "Module" })), Pr = {
3095
- ..._r,
3096
- setup: ur
3097
- };
3098
- H("Button", () => {
3099
- H("Rendering", () => {
3100
- H("Basic rendering", () => {
3101
- y("should render button with children", () => {
3102
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3103
- const e = h.getByTestId("button");
3104
- l(e).toBeInTheDocument(), l(e).toHaveTextContent("Click me");
3105
- }), y("should render button without children", () => {
3106
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md" }));
3107
- const e = h.getByTestId("button");
3108
- l(e).toBeInTheDocument(), l(e).toHaveTextContent("");
3109
- }), y("should render button with icon", () => {
3110
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" }));
3111
- const e = h.getByTestId("button"), t = h.getByTestId("button-icon");
3112
- l(e).toBeInTheDocument(), l(t).toBeInTheDocument(), l(t.className).toContain("ap-icon-check");
3113
- }), y("should not render icon when icon prop is not provided", () => {
3114
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3115
- const e = h.queryByTestId("button-icon");
3116
- l(e).not.toBeInTheDocument();
3117
- }), y("should render loading spinner when loading is true", () => {
3118
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", loading: !0, children: "Click me" }));
3119
- const e = h.getByTestId("loading-spinner");
3120
- l(e).toBeInTheDocument(), l(e.className).toContain("loading-spinner");
3121
- }), y("should not render loading spinner when loading is false", () => {
3122
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", loading: !1, children: "Click me" }));
3123
- const e = h.queryByTestId("loading-spinner");
3124
- l(e).not.toBeInTheDocument();
1
+ import { jsx as i, jsxs as u, Fragment as m } from "react/jsx-runtime";
2
+ import { d as l, i as s, r as d, s as n, g as t, v as c, f as r } from "../../vi.bdSIJ99Y-017e_Pkz.js";
3
+ import a from "./Button.js";
4
+ import { u as y } from "../../index-DkTDHhag.js";
5
+ l("Button", () => {
6
+ l("Rendering", () => {
7
+ l("Basic rendering", () => {
8
+ s("should render button with children", () => {
9
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
10
+ const e = n.getByTestId("button");
11
+ t(e).toBeInTheDocument(), t(e).toHaveTextContent("Click me");
12
+ }), s("should render button without children", () => {
13
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md" }));
14
+ const e = n.getByTestId("button");
15
+ t(e).toBeInTheDocument(), t(e).toHaveTextContent("");
16
+ }), s("should render button with icon", () => {
17
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" }));
18
+ const e = n.getByTestId("button"), o = n.getByTestId("button-icon");
19
+ t(e).toBeInTheDocument(), t(o).toBeInTheDocument(), t(o.className).toContain("ap-icon-check");
20
+ }), s("should not render icon when icon prop is not provided", () => {
21
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
22
+ const e = n.queryByTestId("button-icon");
23
+ t(e).not.toBeInTheDocument();
24
+ }), s("should render loading spinner when loading is true", () => {
25
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", loading: !0, children: "Click me" }));
26
+ const e = n.getByTestId("loading-spinner");
27
+ t(e).toBeInTheDocument(), t(e.className).toContain("loading-spinner");
28
+ }), s("should not render loading spinner when loading is false", () => {
29
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", loading: !1, children: "Click me" }));
30
+ const e = n.queryByTestId("loading-spinner");
31
+ t(e).not.toBeInTheDocument();
3125
32
  });
3126
- }), H("Disabled state", () => {
3127
- y("should render enabled when disabled prop is not provided", () => {
3128
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3129
- const e = h.getByTestId("button");
3130
- l(e).toBeEnabled();
3131
- }), y("should render enabled when disabled prop is false", () => {
3132
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !1, children: "Click me" }));
3133
- const e = h.getByTestId("button");
3134
- l(e).toBeEnabled();
3135
- }), y("should render disabled when disabled prop is true", () => {
3136
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }));
3137
- const e = h.getByTestId("button");
3138
- l(e).toBeDisabled();
33
+ }), l("Disabled state", () => {
34
+ s("should render enabled when disabled prop is not provided", () => {
35
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
36
+ const e = n.getByTestId("button");
37
+ t(e).toBeEnabled();
38
+ }), s("should render enabled when disabled prop is false", () => {
39
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !1, children: "Click me" }));
40
+ const e = n.getByTestId("button");
41
+ t(e).toBeEnabled();
42
+ }), s("should render disabled when disabled prop is true", () => {
43
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }));
44
+ const e = n.getByTestId("button");
45
+ t(e).toBeDisabled();
3139
46
  });
3140
- }), H("CSS Classes", () => {
3141
- y("should apply base button class", () => {
3142
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3143
- const e = h.getByTestId("button");
3144
- l(e.className).toContain("btn");
3145
- }), y("should apply variant classes", () => {
47
+ }), l("CSS Classes", () => {
48
+ s("should apply base button class", () => {
49
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
50
+ const e = n.getByTestId("button");
51
+ t(e.className).toContain("btn");
52
+ }), s("should apply variant classes", () => {
3146
53
  const {
3147
54
  rerender: e
3148
- } = v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3149
- let t = h.getByTestId("button");
3150
- l(t.className).toContain("btn-default"), e(/* @__PURE__ */ b(m, { type: "primary", variant: "danger", size: "md", children: "Click me" })), t = h.getByTestId("button"), l(t.className).toContain("btn-danger"), e(/* @__PURE__ */ b(m, { type: "primary", variant: "cancel", size: "md", children: "Click me" })), t = h.getByTestId("button"), l(t.className).toContain("btn-cancel");
3151
- }), y("should apply size classes", () => {
55
+ } = d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
56
+ let o = n.getByTestId("button");
57
+ t(o.className).toContain("btn-default"), e(/* @__PURE__ */ i(a, { type: "primary", variant: "danger", size: "md", children: "Click me" })), o = n.getByTestId("button"), t(o.className).toContain("btn-danger"), e(/* @__PURE__ */ i(a, { type: "primary", variant: "cancel", size: "md", children: "Click me" })), o = n.getByTestId("button"), t(o.className).toContain("btn-cancel");
58
+ }), s("should apply size classes", () => {
3152
59
  const {
3153
60
  rerender: e
3154
- } = v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "sm", children: "Click me" }));
3155
- let t = h.getByTestId("button");
3156
- l(t.className).toContain("btn-sm"), e(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" })), t = h.getByTestId("button"), l(t.className).toContain("btn-md");
3157
- }), y("should apply disabled class when disabled", () => {
3158
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }));
3159
- const e = h.getByTestId("button");
3160
- l(e.className).toContain("btn-disabled");
3161
- }), y("should not apply disabled class when enabled", () => {
3162
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !1, children: "Click me" }));
3163
- const e = h.getByTestId("button");
3164
- l(e.className).not.toContain("btn-disabled");
3165
- }), y("should apply icon classes when icon is provided", () => {
3166
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" }));
3167
- const e = h.getByTestId("button-icon");
3168
- l(e.className).toContain("btn-icon"), l(e.className).toContain("btn-icon-md");
3169
- }), y("should apply icon size classes", () => {
61
+ } = d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "sm", children: "Click me" }));
62
+ let o = n.getByTestId("button");
63
+ t(o.className).toContain("btn-sm"), e(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" })), o = n.getByTestId("button"), t(o.className).toContain("btn-md");
64
+ }), s("should apply disabled class when disabled", () => {
65
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }));
66
+ const e = n.getByTestId("button");
67
+ t(e.className).toContain("btn-disabled");
68
+ }), s("should not apply disabled class when enabled", () => {
69
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !1, children: "Click me" }));
70
+ const e = n.getByTestId("button");
71
+ t(e.className).not.toContain("btn-disabled");
72
+ }), s("should apply icon classes when icon is provided", () => {
73
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" }));
74
+ const e = n.getByTestId("button-icon");
75
+ t(e.className).toContain("btn-icon"), t(e.className).toContain("btn-icon-md");
76
+ }), s("should apply icon size classes", () => {
3170
77
  const {
3171
78
  rerender: e
3172
- } = v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "sm", icon: "ap-icon-check", children: "Click me" }));
3173
- let t = h.getByTestId("button-icon");
3174
- l(t.className).toContain("btn-icon-sm"), e(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" })), t = h.getByTestId("button-icon"), l(t.className).toContain("btn-icon-md");
3175
- }), y("should apply text class when children are provided", () => {
3176
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3177
- const e = h.getByTestId("button-text");
3178
- l(e.className).toContain("btn-text");
79
+ } = d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "sm", icon: "ap-icon-check", children: "Click me" }));
80
+ let o = n.getByTestId("button-icon");
81
+ t(o.className).toContain("btn-icon-sm"), e(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", icon: "ap-icon-check", children: "Click me" })), o = n.getByTestId("button-icon"), t(o.className).toContain("btn-icon-md");
82
+ }), s("should apply text class when children are provided", () => {
83
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
84
+ const e = n.getByTestId("button-text");
85
+ t(e.className).toContain("btn-text");
3179
86
  });
3180
87
  });
3181
- }), H("User Interactions", () => {
3182
- y("should call onClick when clicked", () => {
3183
- const e = fe.fn();
3184
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", onClick: e, children: "Click me" }));
3185
- const t = h.getByTestId("button");
3186
- G.click(t), l(e).toHaveBeenCalledTimes(1);
3187
- }), y("should not call onClick when disabled", () => {
3188
- const e = fe.fn();
3189
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !0, onClick: e, children: "Click me" }));
3190
- const t = h.getByTestId("button");
3191
- G.click(t), l(e).not.toHaveBeenCalled();
3192
- }), y("should not call onClick when loading", () => {
3193
- const e = fe.fn();
3194
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", loading: !0, onClick: e, children: "Click me" }));
3195
- const t = h.getByTestId("button");
3196
- G.click(t), l(e).not.toHaveBeenCalled();
3197
- }), y("should handle keyboard interactions", () => {
3198
- const e = fe.fn();
3199
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", onClick: e, children: "Click me" }));
3200
- const t = h.getByTestId("button");
3201
- G.keyDown(t, {
88
+ }), l("User Interactions", () => {
89
+ s("should call onClick when clicked", () => {
90
+ const e = c.fn();
91
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", onClick: e, children: "Click me" }));
92
+ const o = n.getByTestId("button");
93
+ r.click(o), t(e).toHaveBeenCalledTimes(1);
94
+ }), s("should not call onClick when disabled", () => {
95
+ const e = c.fn();
96
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !0, onClick: e, children: "Click me" }));
97
+ const o = n.getByTestId("button");
98
+ r.click(o), t(e).not.toHaveBeenCalled();
99
+ }), s("should not call onClick when loading", () => {
100
+ const e = c.fn();
101
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", loading: !0, onClick: e, children: "Click me" }));
102
+ const o = n.getByTestId("button");
103
+ r.click(o), t(e).not.toHaveBeenCalled();
104
+ }), s("should handle keyboard interactions", () => {
105
+ const e = c.fn();
106
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", onClick: e, children: "Click me" }));
107
+ const o = n.getByTestId("button");
108
+ r.keyDown(o, {
3202
109
  key: "Enter"
3203
- }), l(e).toHaveBeenCalledTimes(1), G.keyDown(t, {
110
+ }), t(e).toHaveBeenCalledTimes(1), r.keyDown(o, {
3204
111
  key: " "
3205
- }), l(e).toHaveBeenCalledTimes(2);
3206
- }), y("should not handle keyboard interactions when disabled", () => {
3207
- const e = fe.fn();
3208
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !0, onClick: e, children: "Click me" }));
3209
- const t = h.getByTestId("button");
3210
- G.keyDown(t, {
112
+ }), t(e).toHaveBeenCalledTimes(2);
113
+ }), s("should not handle keyboard interactions when disabled", () => {
114
+ const e = c.fn();
115
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !0, onClick: e, children: "Click me" }));
116
+ const o = n.getByTestId("button");
117
+ r.keyDown(o, {
3211
118
  key: "Enter"
3212
- }), l(e).not.toHaveBeenCalled(), G.keyDown(t, {
119
+ }), t(e).not.toHaveBeenCalled(), r.keyDown(o, {
3213
120
  key: " "
3214
- }), l(e).not.toHaveBeenCalled();
3215
- });
3216
- }), H("Accessibility", () => {
3217
- y("should have proper button type attribute", () => {
3218
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3219
- const e = h.getByTestId("button");
3220
- l(e).toHaveAttribute("type", "button");
3221
- }), y("should be focusable when enabled", () => {
3222
- v(/* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", children: "Click me" }));
3223
- const e = h.getByTestId("button");
3224
- e.focus(), l(e).toHaveFocus();
3225
- }), y("skips disabled button when tabbing", async () => {
3226
- v(/* @__PURE__ */ on(sn, { children: [
3227
- /* @__PURE__ */ b("input", {}),
3228
- /* @__PURE__ */ b(m, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }),
3229
- /* @__PURE__ */ b("a", { href: "/", children: "after" })
121
+ }), t(e).not.toHaveBeenCalled();
122
+ });
123
+ }), l("Accessibility", () => {
124
+ s("should have proper button type attribute", () => {
125
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
126
+ const e = n.getByTestId("button");
127
+ t(e).toHaveAttribute("type", "button");
128
+ }), s("should be focusable when enabled", () => {
129
+ d(/* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", children: "Click me" }));
130
+ const e = n.getByTestId("button");
131
+ e.focus(), t(e).toHaveFocus();
132
+ }), s("skips disabled button when tabbing", async () => {
133
+ d(/* @__PURE__ */ u(m, { children: [
134
+ /* @__PURE__ */ i("input", {}),
135
+ /* @__PURE__ */ i(a, { type: "primary", variant: "default", size: "md", disabled: !0, children: "Click me" }),
136
+ /* @__PURE__ */ i("a", { href: "/", children: "after" })
3230
137
  ] }));
3231
- const e = Pr.setup();
3232
- await e.tab(), l(h.getByTestId("before")).toHaveFocus(), await e.tab(), l(h.getByTestId("after")).toHaveFocus(), l(h.getByTestId("button")).not.toHaveFocus();
138
+ const e = y.setup();
139
+ await e.tab(), t(n.getByTestId("before")).toHaveFocus(), await e.tab(), t(n.getByTestId("after")).toHaveFocus(), t(n.getByTestId("button")).not.toHaveFocus();
3233
140
  });
3234
141
  });
3235
142
  });