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