@hortiview/shared-components 0.0.6504 → 0.0.6829

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