@nice2dev/ui-core 1.4.20 → 1.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/dist/core/validation.d.ts +14 -2
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +1048 -1045
- package/dist/input-layer-C7WPpx2F.cjs +1 -0
- package/dist/{input-layer-ZtEUgROz.js → input-layer-DD2KbYdM.js} +1086 -1074
- package/dist/input.cjs +1 -1
- package/dist/input.mjs +1 -1
- package/package.json +3 -3
- package/dist/input-layer-C7TEW5HS.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useNiceTranslation as J } from "@nice2dev/i18n";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsx as C, jsxs as V, Fragment as _t } from "react/jsx-runtime";
|
|
3
|
+
import Ne, { useContext as ae, useCallback as D, createContext as He, useRef as O, useEffect as R, useLayoutEffect as Bt, useState as j, useMemo as pe, useSyncExternalStore as Mt, forwardRef as Kt, useImperativeHandle as jt } from "react";
|
|
4
|
+
const gt = /* @__PURE__ */ new Set([
|
|
5
5
|
"",
|
|
6
6
|
"text",
|
|
7
7
|
"search",
|
|
@@ -17,7 +17,7 @@ const Mt = /* @__PURE__ */ new Set([
|
|
|
17
17
|
"datetime-local",
|
|
18
18
|
"month",
|
|
19
19
|
"week"
|
|
20
|
-
]),
|
|
20
|
+
]), Ut = /* @__PURE__ */ new Set([
|
|
21
21
|
"checkbox",
|
|
22
22
|
"radio",
|
|
23
23
|
"button",
|
|
@@ -26,7 +26,7 @@ const Mt = /* @__PURE__ */ new Set([
|
|
|
26
26
|
"file",
|
|
27
27
|
"image",
|
|
28
28
|
"color"
|
|
29
|
-
]),
|
|
29
|
+
]), Gt = /* @__PURE__ */ new Set([
|
|
30
30
|
"button",
|
|
31
31
|
"link",
|
|
32
32
|
"checkbox",
|
|
@@ -38,28 +38,28 @@ const Mt = /* @__PURE__ */ new Set([
|
|
|
38
38
|
"menuitemradio",
|
|
39
39
|
"option",
|
|
40
40
|
"treeitem"
|
|
41
|
-
]),
|
|
42
|
-
function
|
|
43
|
-
const { intent:
|
|
44
|
-
return
|
|
41
|
+
]), bt = (t) => t instanceof HTMLInputElement && gt.has(t.type), Pe = (t) => t instanceof HTMLTextAreaElement, yt = (t) => t instanceof HTMLElement && t.isContentEditable;
|
|
42
|
+
function qt(t, e) {
|
|
43
|
+
const { intent: n, direction: a } = e;
|
|
44
|
+
return bt(t) ? n === "navigate" ? a === "left" || a === "right" : n === "first" || n === "last" || n === "activate" || n === "toggleHints" : Pe(t) || yt(t) ? n !== "back" && n !== "view" && n !== "menu" && n !== "secondary" : t instanceof HTMLSelectElement ? n !== "back" && n !== "view" && n !== "menu" : t instanceof HTMLInputElement ? Te.has(t.type) ? n === "navigate" || n === "first" || n === "last" || n === "pagePrev" || n === "pageNext" : t.type === "radio" && n === "navigate" : !1;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
if (
|
|
46
|
+
function wt(t) {
|
|
47
|
+
if (t instanceof HTMLButtonElement || t.tagName === "SUMMARY")
|
|
48
48
|
return !0;
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
53
|
-
const e =
|
|
54
|
-
return e !== null &&
|
|
55
|
-
}
|
|
56
|
-
function
|
|
57
|
-
if (typeof
|
|
58
|
-
|
|
49
|
+
if (t instanceof HTMLAnchorElement)
|
|
50
|
+
return t.hasAttribute("href");
|
|
51
|
+
if (t instanceof HTMLInputElement)
|
|
52
|
+
return Ut.has(t.type);
|
|
53
|
+
const e = t.getAttribute("role");
|
|
54
|
+
return e !== null && Gt.has(e);
|
|
55
|
+
}
|
|
56
|
+
function $t(t) {
|
|
57
|
+
if (typeof t.click == "function") {
|
|
58
|
+
t.click();
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
const e =
|
|
62
|
-
|
|
61
|
+
const e = t.ownerDocument.defaultView;
|
|
62
|
+
t.dispatchEvent(
|
|
63
63
|
new ((e == null ? void 0 : e.MouseEvent) ?? MouseEvent)("click", {
|
|
64
64
|
bubbles: !0,
|
|
65
65
|
cancelable: !0,
|
|
@@ -67,95 +67,102 @@ function qt(n) {
|
|
|
67
67
|
})
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
if (
|
|
70
|
+
function Et(t) {
|
|
71
|
+
if (t.defaultPrevented || t.repeat || t.target !== t.currentTarget || t.key !== "Enter" && t.key !== " " && t.key !== "Spacebar")
|
|
72
72
|
return;
|
|
73
|
-
const e =
|
|
73
|
+
const e = t.currentTarget;
|
|
74
74
|
if (!e || typeof e.dispatchEvent != "function")
|
|
75
75
|
return;
|
|
76
|
-
|
|
77
|
-
const
|
|
76
|
+
t.preventDefault();
|
|
77
|
+
const n = e.ownerDocument.defaultView;
|
|
78
78
|
e.dispatchEvent(
|
|
79
|
-
new ((
|
|
79
|
+
new ((n == null ? void 0 : n.MouseEvent) ?? MouseEvent)("click", {
|
|
80
80
|
bubbles: !0,
|
|
81
81
|
cancelable: !0,
|
|
82
82
|
composed: !0,
|
|
83
|
-
ctrlKey: !!
|
|
84
|
-
shiftKey: !!
|
|
85
|
-
altKey: !!
|
|
86
|
-
metaKey: !!
|
|
83
|
+
ctrlKey: !!t.ctrlKey,
|
|
84
|
+
shiftKey: !!t.shiftKey,
|
|
85
|
+
altKey: !!t.altKey,
|
|
86
|
+
metaKey: !!t.metaKey
|
|
87
87
|
})
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
|
-
function ve(
|
|
91
|
-
const e =
|
|
90
|
+
function ve(t) {
|
|
91
|
+
const e = t.getAttribute("data-nice-engage");
|
|
92
92
|
if (e === "value" || e === "text" || e === "popup" || e === "canvas")
|
|
93
93
|
return e;
|
|
94
94
|
if (e === "none")
|
|
95
95
|
return null;
|
|
96
|
-
const
|
|
97
|
-
return
|
|
96
|
+
const n = t.getAttribute("role");
|
|
97
|
+
return n === "combobox" ? "popup" : n === "slider" || n === "spinbutton" || t instanceof HTMLSelectElement ? "value" : t instanceof HTMLInputElement ? gt.has(t.type) ? t.readOnly ? null : "text" : Te.has(t.type) && !t.readOnly ? "value" : null : Pe(t) ? t.readOnly ? null : "text" : yt(t) ? "text" : null;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return e === "popup" ?
|
|
99
|
+
function kt(t, e) {
|
|
100
|
+
return e === "popup" ? t.getAttribute("aria-expanded") === "true" : t.hasAttribute("data-nice-engaged");
|
|
101
101
|
}
|
|
102
|
-
function ie(
|
|
103
|
-
return
|
|
102
|
+
function ie(t) {
|
|
103
|
+
return t instanceof HTMLSelectElement || t instanceof HTMLInputElement && Te.has(t.type);
|
|
104
104
|
}
|
|
105
|
-
function me(
|
|
106
|
-
|
|
105
|
+
function me(t) {
|
|
106
|
+
t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Ie(t, e) {
|
|
109
109
|
var r;
|
|
110
|
-
const
|
|
111
|
-
a ? a.call(
|
|
110
|
+
const n = Object.getPrototypeOf(t), a = (r = Object.getOwnPropertyDescriptor(n, "value")) == null ? void 0 : r.set;
|
|
111
|
+
a ? a.call(t, e) : t.value = e;
|
|
112
112
|
}
|
|
113
|
-
const Me = "data-nice-engage-restore", ge = (
|
|
114
|
-
function
|
|
115
|
-
return ge(
|
|
113
|
+
const Me = "data-nice-engage-restore", ge = (t) => t instanceof HTMLInputElement && t.type === "number";
|
|
114
|
+
function Yt(t) {
|
|
115
|
+
return ge(t) || t.hasAttribute(Me);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
if (
|
|
117
|
+
function Na(t, e, n) {
|
|
118
|
+
if (t.value !== e && (Ie(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 }))), n !== void 0)
|
|
119
119
|
try {
|
|
120
|
-
|
|
120
|
+
t.setSelectionRange(n, n);
|
|
121
121
|
} catch {
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function Wt(t, e) {
|
|
125
|
+
t.value !== e && (Ie(t, e), me(t));
|
|
126
126
|
}
|
|
127
|
-
function ce(
|
|
127
|
+
function ce(t, e, n = "step") {
|
|
128
128
|
const a = e === "up" || e === "right";
|
|
129
|
-
if (
|
|
130
|
-
const s =
|
|
131
|
-
if (
|
|
132
|
-
|
|
129
|
+
if (t instanceof HTMLSelectElement) {
|
|
130
|
+
const s = t.selectedIndex, o = t.options.length - 1;
|
|
131
|
+
if (n === "edge")
|
|
132
|
+
t.selectedIndex = a ? o : 0;
|
|
133
133
|
else {
|
|
134
|
-
const i =
|
|
135
|
-
|
|
134
|
+
const i = n === "big" ? 10 : 1;
|
|
135
|
+
t.selectedIndex = Math.max(0, Math.min(o, s + (a ? i : -i)));
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return t.selectedIndex !== s ? (me(t), !0) : !1;
|
|
138
138
|
}
|
|
139
|
-
const r =
|
|
139
|
+
const r = t.value;
|
|
140
140
|
try {
|
|
141
|
-
if (
|
|
142
|
-
|
|
141
|
+
if (n === "edge" && (t.min !== "" || t.max !== ""))
|
|
142
|
+
Ie(t, a ? t.max || t.value : t.min || t.value);
|
|
143
143
|
else {
|
|
144
|
-
const s =
|
|
145
|
-
a ?
|
|
144
|
+
const s = n === "big" ? 10 : 1;
|
|
145
|
+
a ? t.stepUp(s) : t.stepDown(s);
|
|
146
146
|
}
|
|
147
147
|
} catch {
|
|
148
148
|
return !1;
|
|
149
149
|
}
|
|
150
|
-
return
|
|
150
|
+
return t.value !== r ? (me(t), !0) : !1;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
if (!(
|
|
152
|
+
function Xt(t, e) {
|
|
153
|
+
if (!(bt(t) || Pe(t)) || t.selectionStart === null || e !== "left" && e !== "right")
|
|
154
154
|
return !1;
|
|
155
|
-
const
|
|
156
|
-
return
|
|
157
|
-
}
|
|
158
|
-
const
|
|
155
|
+
const n = t.selectionStart + (e === "right" ? 1 : -1), a = Math.max(0, Math.min(t.value.length, n));
|
|
156
|
+
return t.setSelectionRange(a, a), !0;
|
|
157
|
+
}
|
|
158
|
+
const Fe = {
|
|
159
|
+
refresh: "M15.3 10.91L19.05 15.18L22.49 10.66zM8.7 13.09L4.95 8.82L1.51 13.34z",
|
|
160
|
+
// 1.4.22 (NiceDocumentEditor: "uchwyty … nie mają nawet ikon", "wcięcie i odwrotność - są
|
|
161
|
+
// straszne"): a drag grip of six dots, and indent / outdent as text lines with a solid arrow head.
|
|
162
|
+
grip: "M9 4.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 4.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM9 10.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 10.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM9 16.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2zM15 16.4a1.6 1.6 0 1 0 0 3.2a1.6 1.6 0 1 0 0-3.2z",
|
|
163
|
+
indent: "M3 8.5L7.5 12L3 15.5z",
|
|
164
|
+
outdent: "M7.5 8.5L3 12L7.5 15.5z"
|
|
165
|
+
}, zt = {
|
|
159
166
|
// Navigation
|
|
160
167
|
"chevron-down": "M6 9l6 6 6-6",
|
|
161
168
|
"chevron-up": "M18 15l-6-6-6 6",
|
|
@@ -175,7 +182,9 @@ const kt = {
|
|
|
175
182
|
copy: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",
|
|
176
183
|
download: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",
|
|
177
184
|
upload: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",
|
|
178
|
-
|
|
185
|
+
// 1.4.22 ("refresh wygląda jak stara kiepska wersja tej ikony"): NtdRefresh's shape — two arcs round
|
|
186
|
+
// the centre, each running into a filled head (BUILTIN_FILLS) — instead of the old corner-bracket glyph.
|
|
187
|
+
refresh: "M6.8 7.32A7 7 0 0 1 18.95 11.15M17.2 16.68A7 7 0 0 1 5.05 12.85",
|
|
179
188
|
// UI
|
|
180
189
|
search: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",
|
|
181
190
|
filter: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z",
|
|
@@ -213,7 +222,7 @@ const kt = {
|
|
|
213
222
|
star: "M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z",
|
|
214
223
|
heart: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z",
|
|
215
224
|
bell: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9",
|
|
216
|
-
grip: "
|
|
225
|
+
grip: "",
|
|
217
226
|
hash: "M4 9h16M4 15h16M10 3L8 21M16 3l-2 18",
|
|
218
227
|
list: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01",
|
|
219
228
|
circle: "M12 21a9 9 0 100-18 9 9 0 000 18z",
|
|
@@ -333,8 +342,8 @@ const kt = {
|
|
|
333
342
|
unlink: "M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07L11 5.78M3 3l18 18M9 15l3-3M14 11l3 3M14 21l-1.72-1.72a5 5 0 0 1-7.07-7.07L7 10.49",
|
|
334
343
|
code: "M16 18l6-6-6-6M8 6l-6 6 6 6",
|
|
335
344
|
quote: "M3 21c3-3 3-9 0-12M21 21c-3-3-3-9 0-12M9 7h6v6H9zM15 7h6v6h-6z",
|
|
336
|
-
indent: "M3
|
|
337
|
-
outdent: "
|
|
345
|
+
indent: "M3 5h18M11 10h10M11 14h10M3 19h18",
|
|
346
|
+
outdent: "M3 5h18M11 10h10M11 14h10M3 19h18",
|
|
338
347
|
"align-center": "M3 6h18M6 12h12M3 18h18",
|
|
339
348
|
"align-right": "M3 6h18M9 12h12M3 18h18",
|
|
340
349
|
"align-justify": "M3 6h18M3 12h18M3 18h18",
|
|
@@ -421,82 +430,85 @@ const kt = {
|
|
|
421
430
|
"key-backspace": "M21 5H9l-6 7 6 7h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z M17 9l-6 6 M11 9l6 6",
|
|
422
431
|
"key-space": "M4 10v4h16v-4",
|
|
423
432
|
"key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
|
|
424
|
-
},
|
|
433
|
+
}, Jt = {
|
|
425
434
|
xs: 12,
|
|
426
435
|
sm: 16,
|
|
427
436
|
md: 20,
|
|
428
437
|
lg: 24,
|
|
429
438
|
xl: 32
|
|
430
|
-
},
|
|
431
|
-
function
|
|
432
|
-
path:
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
+
}, De = /* @__PURE__ */ He({}), Ha = ({ resolver: t, children: e }) => Ne.createElement(De.Provider, { value: { resolver: t } }, e);
|
|
440
|
+
function Zt({
|
|
441
|
+
path: t,
|
|
442
|
+
fill: e,
|
|
443
|
+
size: n,
|
|
444
|
+
className: a,
|
|
445
|
+
style: r,
|
|
446
|
+
color: s,
|
|
447
|
+
title: o,
|
|
448
|
+
onClick: i
|
|
439
449
|
}) {
|
|
440
450
|
return /* @__PURE__ */ V(
|
|
441
451
|
"svg",
|
|
442
452
|
{
|
|
443
453
|
xmlns: "http://www.w3.org/2000/svg",
|
|
444
|
-
width:
|
|
445
|
-
height:
|
|
454
|
+
width: n,
|
|
455
|
+
height: n,
|
|
446
456
|
viewBox: "0 0 24 24",
|
|
447
457
|
fill: "none",
|
|
448
|
-
stroke:
|
|
458
|
+
stroke: s || "currentColor",
|
|
449
459
|
strokeWidth: 2,
|
|
450
460
|
strokeLinecap: "round",
|
|
451
461
|
strokeLinejoin: "round",
|
|
452
|
-
className: `nice-icon ${
|
|
453
|
-
style:
|
|
454
|
-
role:
|
|
455
|
-
tabIndex:
|
|
456
|
-
onKeyDown:
|
|
457
|
-
"aria-label":
|
|
458
|
-
"aria-hidden":
|
|
459
|
-
onClick:
|
|
462
|
+
className: `nice-icon ${a || ""}`,
|
|
463
|
+
style: r,
|
|
464
|
+
role: i ? "button" : o ? "img" : "presentation",
|
|
465
|
+
tabIndex: i ? 0 : void 0,
|
|
466
|
+
onKeyDown: i ? Et : void 0,
|
|
467
|
+
"aria-label": o,
|
|
468
|
+
"aria-hidden": i ? void 0 : !o,
|
|
469
|
+
onClick: i,
|
|
460
470
|
children: [
|
|
461
|
-
|
|
462
|
-
/* @__PURE__ */
|
|
471
|
+
o && /* @__PURE__ */ C("title", { children: o }),
|
|
472
|
+
t && /* @__PURE__ */ C("path", { d: t }),
|
|
473
|
+
e && /* @__PURE__ */ C("path", { d: e, fill: s || "currentColor", stroke: "none" })
|
|
463
474
|
]
|
|
464
475
|
}
|
|
465
476
|
);
|
|
466
477
|
}
|
|
467
478
|
const ee = ({
|
|
468
|
-
name:
|
|
479
|
+
name: t,
|
|
469
480
|
size: e = "md",
|
|
470
|
-
className:
|
|
481
|
+
className: n,
|
|
471
482
|
style: a,
|
|
472
483
|
color: r,
|
|
473
484
|
title: s,
|
|
474
485
|
onClick: o
|
|
475
486
|
}) => {
|
|
476
|
-
const { resolver: i } = ae(
|
|
487
|
+
const { resolver: i } = ae(De), c = typeof e == "number" ? e : Jt[e];
|
|
477
488
|
if (i) {
|
|
478
|
-
const u = i(
|
|
489
|
+
const u = i(t, c);
|
|
479
490
|
if (u)
|
|
480
|
-
return /* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ C(
|
|
481
492
|
"span",
|
|
482
493
|
{
|
|
483
494
|
role: o ? "button" : void 0,
|
|
484
495
|
tabIndex: o ? 0 : void 0,
|
|
485
|
-
onKeyDown: o ?
|
|
486
|
-
className: `nice-icon-wrap ${
|
|
496
|
+
onKeyDown: o ? Et : void 0,
|
|
497
|
+
className: `nice-icon-wrap ${n || ""}`,
|
|
487
498
|
style: a,
|
|
488
499
|
onClick: o,
|
|
489
500
|
children: u
|
|
490
501
|
}
|
|
491
502
|
);
|
|
492
503
|
}
|
|
493
|
-
const d =
|
|
494
|
-
return d ? /* @__PURE__ */
|
|
495
|
-
|
|
504
|
+
const d = zt[t];
|
|
505
|
+
return d || Fe[t] ? /* @__PURE__ */ C(
|
|
506
|
+
Zt,
|
|
496
507
|
{
|
|
497
508
|
path: d,
|
|
509
|
+
fill: Fe[t],
|
|
498
510
|
size: c,
|
|
499
|
-
className:
|
|
511
|
+
className: n,
|
|
500
512
|
style: a,
|
|
501
513
|
color: r,
|
|
502
514
|
title: s,
|
|
@@ -504,14 +516,14 @@ const ee = ({
|
|
|
504
516
|
}
|
|
505
517
|
) : null;
|
|
506
518
|
};
|
|
507
|
-
function
|
|
508
|
-
const { resolver:
|
|
509
|
-
return { renderIcon:
|
|
510
|
-
(
|
|
511
|
-
[
|
|
519
|
+
function Ta() {
|
|
520
|
+
const { resolver: t } = ae(De);
|
|
521
|
+
return { renderIcon: D(
|
|
522
|
+
(n, a = "md") => n == null ? null : typeof n != "string" ? n : Ne.createElement(ee, { name: n, size: a }),
|
|
523
|
+
[t]
|
|
512
524
|
) };
|
|
513
525
|
}
|
|
514
|
-
const
|
|
526
|
+
const Pa = /* @__PURE__ */ Object.keys(zt), xt = [
|
|
515
527
|
"a[href]",
|
|
516
528
|
"area[href]",
|
|
517
529
|
"button",
|
|
@@ -526,8 +538,8 @@ const Ta = /* @__PURE__ */ Object.keys(kt), xt = [
|
|
|
526
538
|
"[tabindex]",
|
|
527
539
|
"[data-nice-focusable]"
|
|
528
540
|
].join(",");
|
|
529
|
-
function X(
|
|
530
|
-
const e =
|
|
541
|
+
function X(t) {
|
|
542
|
+
const e = t.getBoundingClientRect();
|
|
531
543
|
return {
|
|
532
544
|
left: e.left,
|
|
533
545
|
top: e.top,
|
|
@@ -537,61 +549,61 @@ function X(n) {
|
|
|
537
549
|
height: e.height
|
|
538
550
|
};
|
|
539
551
|
}
|
|
540
|
-
const
|
|
541
|
-
function
|
|
542
|
-
if (
|
|
552
|
+
const _e = (t) => t instanceof HTMLButtonElement || t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement;
|
|
553
|
+
function Qt(t) {
|
|
554
|
+
if (_e(t) && t.disabled || t.getAttribute("aria-disabled") === "true" && !t.hasAttribute("data-nice-focusable"))
|
|
543
555
|
return !0;
|
|
544
|
-
const e =
|
|
545
|
-
if (e &&
|
|
546
|
-
const
|
|
547
|
-
return !(
|
|
556
|
+
const e = t.closest("fieldset[disabled]");
|
|
557
|
+
if (e && _e(t)) {
|
|
558
|
+
const n = e.querySelector(":scope > legend");
|
|
559
|
+
return !(n && n.contains(t));
|
|
548
560
|
}
|
|
549
561
|
return !1;
|
|
550
562
|
}
|
|
551
|
-
function
|
|
563
|
+
function en(t) {
|
|
552
564
|
var a;
|
|
553
|
-
if (
|
|
565
|
+
if (t.closest("[hidden]"))
|
|
554
566
|
return !1;
|
|
555
|
-
const e =
|
|
567
|
+
const e = t.getBoundingClientRect();
|
|
556
568
|
if (e.width === 0 && e.height === 0) {
|
|
557
|
-
const r =
|
|
569
|
+
const r = t.ownerDocument.documentElement.getBoundingClientRect();
|
|
558
570
|
if (r.width !== 0 || r.height !== 0)
|
|
559
571
|
return !1;
|
|
560
572
|
}
|
|
561
|
-
const
|
|
562
|
-
return !
|
|
573
|
+
const n = (a = t.ownerDocument.defaultView) == null ? void 0 : a.getComputedStyle(t);
|
|
574
|
+
return !n || n.display !== "none" && n.visibility !== "hidden" && n.visibility !== "collapse";
|
|
563
575
|
}
|
|
564
|
-
function
|
|
565
|
-
if (!(
|
|
576
|
+
function tn(t) {
|
|
577
|
+
if (!(t instanceof HTMLInputElement) || t.type !== "radio" || !t.name || t.checked)
|
|
566
578
|
return !0;
|
|
567
|
-
const
|
|
568
|
-
(a) => a.name ===
|
|
579
|
+
const n = [...(t.form ?? t.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
|
|
580
|
+
(a) => a.name === t.name
|
|
569
581
|
);
|
|
570
|
-
return !
|
|
582
|
+
return !n.some((a) => a.checked) && n[0] === t;
|
|
571
583
|
}
|
|
572
|
-
function te(
|
|
573
|
-
if (!(
|
|
584
|
+
function te(t) {
|
|
585
|
+
if (!(t instanceof HTMLElement) || !t.matches(xt))
|
|
574
586
|
return !1;
|
|
575
|
-
if (!
|
|
576
|
-
const e =
|
|
577
|
-
if (e !== null && Number(e) < 0 ||
|
|
587
|
+
if (!t.hasAttribute("data-nice-focusable")) {
|
|
588
|
+
const e = t.getAttribute("tabindex");
|
|
589
|
+
if (e !== null && Number(e) < 0 || t instanceof HTMLAnchorElement && !t.hasAttribute("href") && e === null)
|
|
578
590
|
return !1;
|
|
579
591
|
}
|
|
580
|
-
return
|
|
592
|
+
return t.closest('[inert],[aria-hidden="true"]') || Qt(t) ? !1 : en(t) && tn(t);
|
|
581
593
|
}
|
|
582
|
-
function U(
|
|
583
|
-
const
|
|
584
|
-
for (const a of
|
|
585
|
-
e.some((r) => r && r.contains(a)) || te(a) &&
|
|
586
|
-
return
|
|
594
|
+
function U(t, e = []) {
|
|
595
|
+
const n = [];
|
|
596
|
+
for (const a of t.querySelectorAll(xt))
|
|
597
|
+
e.some((r) => r && r.contains(a)) || te(a) && n.push(a);
|
|
598
|
+
return n;
|
|
587
599
|
}
|
|
588
|
-
const
|
|
589
|
-
function B(
|
|
600
|
+
const Be = typeof window > "u" ? R : Bt;
|
|
601
|
+
function B(t, e, n) {
|
|
590
602
|
const a = O({ el: null, deps: [] }), r = O(e);
|
|
591
|
-
r.current = e,
|
|
592
|
-
const s = (
|
|
593
|
-
s === o.el &&
|
|
594
|
-
}),
|
|
603
|
+
r.current = e, Be(() => {
|
|
604
|
+
const s = (t == null ? void 0 : t.current) ?? null, o = a.current;
|
|
605
|
+
s === o.el && n.length === o.deps.length && n.every((c, d) => Object.is(c, o.deps[d])) || (typeof o.cleanup == "function" && o.cleanup(), o.el = s, o.deps = [...n], o.cleanup = s ? r.current(s) : void 0);
|
|
606
|
+
}), Be(
|
|
595
607
|
() => () => {
|
|
596
608
|
const s = a.current;
|
|
597
609
|
typeof s.cleanup == "function" && s.cleanup(), a.current = { el: null, deps: [] };
|
|
@@ -600,53 +612,53 @@ function B(n, e, t) {
|
|
|
600
612
|
);
|
|
601
613
|
}
|
|
602
614
|
const Q = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new Set();
|
|
603
|
-
function
|
|
604
|
-
be.forEach((
|
|
605
|
-
}
|
|
606
|
-
function
|
|
607
|
-
const a = { hints: e, fallback:
|
|
608
|
-
let r = Q.get(
|
|
609
|
-
return r || (r = /* @__PURE__ */ new Set(), Q.set(
|
|
610
|
-
const s = Q.get(
|
|
611
|
-
s != null && s.delete(a) && (s.size === 0 && Q.delete(
|
|
615
|
+
function Ke() {
|
|
616
|
+
be.forEach((t) => t());
|
|
617
|
+
}
|
|
618
|
+
function At(t, e, n = !1) {
|
|
619
|
+
const a = { hints: e, fallback: n };
|
|
620
|
+
let r = Q.get(t);
|
|
621
|
+
return r || (r = /* @__PURE__ */ new Set(), Q.set(t, r)), r.add(a), Ke(), () => {
|
|
622
|
+
const s = Q.get(t);
|
|
623
|
+
s != null && s.delete(a) && (s.size === 0 && Q.delete(t), Ke());
|
|
612
624
|
};
|
|
613
625
|
}
|
|
614
|
-
function
|
|
615
|
-
const
|
|
616
|
-
le.delete(
|
|
626
|
+
function Ia(t, e) {
|
|
627
|
+
const n = le.get(t);
|
|
628
|
+
le.delete(t), e && e.length > 0 && le.set(t, At(t, e)), n == null || n();
|
|
617
629
|
}
|
|
618
|
-
function
|
|
619
|
-
const
|
|
630
|
+
function nn(t, e) {
|
|
631
|
+
const n = [], a = /* @__PURE__ */ new Set(), r = (s) => {
|
|
620
632
|
const o = [...Q.get(s) ?? []], i = [...o.filter((c) => !c.fallback), ...o.filter((c) => c.fallback)];
|
|
621
633
|
for (const c of i.flatMap((d) => d.hints)) {
|
|
622
634
|
const d = `${c.intent}:${c.direction ?? ""}`;
|
|
623
|
-
a.has(d) || (a.add(d),
|
|
635
|
+
a.has(d) || (a.add(d), n.push(c));
|
|
624
636
|
}
|
|
625
637
|
};
|
|
626
|
-
for (let s =
|
|
638
|
+
for (let s = t; s; s = s.parentElement)
|
|
627
639
|
r(s);
|
|
628
|
-
return r(e),
|
|
640
|
+
return r(e), n;
|
|
629
641
|
}
|
|
630
|
-
function
|
|
631
|
-
const { enabled: a = !0, fallback: r = !1 } =
|
|
642
|
+
function Lt(t, e, n = {}) {
|
|
643
|
+
const { enabled: a = !0, fallback: r = !1 } = n, s = JSON.stringify(e), o = (i) => {
|
|
632
644
|
const c = JSON.parse(s);
|
|
633
|
-
return c.length > 0 ?
|
|
645
|
+
return c.length > 0 ? At(i, c, r) : void 0;
|
|
634
646
|
};
|
|
635
|
-
B(
|
|
636
|
-
if (!(
|
|
647
|
+
B(t, (i) => a ? o(i) : void 0, [s, a, r]), R(() => {
|
|
648
|
+
if (!(t || !a))
|
|
637
649
|
return o(document);
|
|
638
|
-
}, [
|
|
650
|
+
}, [t, s, a, r]);
|
|
639
651
|
}
|
|
640
|
-
function
|
|
641
|
-
const [
|
|
652
|
+
function an() {
|
|
653
|
+
const [t, e] = j(null), [, n] = j(0);
|
|
642
654
|
return R(() => {
|
|
643
|
-
const a = document, r = () => e(a.activeElement), s = () =>
|
|
655
|
+
const a = document, r = () => e(a.activeElement), s = () => n((o) => o + 1);
|
|
644
656
|
return r(), a.addEventListener("focusin", r), a.addEventListener("focusout", r), be.add(s), () => {
|
|
645
657
|
a.removeEventListener("focusin", r), a.removeEventListener("focusout", r), be.delete(s);
|
|
646
658
|
};
|
|
647
|
-
}, []),
|
|
659
|
+
}, []), t;
|
|
648
660
|
}
|
|
649
|
-
class
|
|
661
|
+
class rn {
|
|
650
662
|
constructor(e = "ntd-user-preferences") {
|
|
651
663
|
this.key = e;
|
|
652
664
|
}
|
|
@@ -666,13 +678,13 @@ class an {
|
|
|
666
678
|
}
|
|
667
679
|
}
|
|
668
680
|
class Da {
|
|
669
|
-
constructor(e = "ntd-preferences",
|
|
670
|
-
this.db = null, this.dbName = e, this.storeName =
|
|
681
|
+
constructor(e = "ntd-preferences", n = "preferences") {
|
|
682
|
+
this.db = null, this.dbName = e, this.storeName = n;
|
|
671
683
|
}
|
|
672
684
|
async getDB() {
|
|
673
|
-
return this.db ? this.db : new Promise((e,
|
|
685
|
+
return this.db ? this.db : new Promise((e, n) => {
|
|
674
686
|
const a = indexedDB.open(this.dbName, 1);
|
|
675
|
-
a.onerror = () =>
|
|
687
|
+
a.onerror = () => n(a.error), a.onsuccess = () => {
|
|
676
688
|
this.db = a.result, e(this.db);
|
|
677
689
|
}, a.onupgradeneeded = (r) => {
|
|
678
690
|
const s = r.target.result;
|
|
@@ -682,32 +694,32 @@ class Da {
|
|
|
682
694
|
}
|
|
683
695
|
async load() {
|
|
684
696
|
const e = await this.getDB();
|
|
685
|
-
return new Promise((
|
|
697
|
+
return new Promise((n, a) => {
|
|
686
698
|
const o = e.transaction(this.storeName, "readonly").objectStore(this.storeName).get("user-preferences");
|
|
687
699
|
o.onerror = () => a(o.error), o.onsuccess = () => {
|
|
688
700
|
var i;
|
|
689
|
-
return
|
|
701
|
+
return n(((i = o.result) == null ? void 0 : i.data) || null);
|
|
690
702
|
};
|
|
691
703
|
});
|
|
692
704
|
}
|
|
693
705
|
async save(e) {
|
|
694
|
-
const
|
|
706
|
+
const n = await this.getDB();
|
|
695
707
|
return new Promise((a, r) => {
|
|
696
|
-
const i =
|
|
708
|
+
const i = n.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ id: "user-preferences", data: e });
|
|
697
709
|
i.onerror = () => r(i.error), i.onsuccess = () => a();
|
|
698
710
|
});
|
|
699
711
|
}
|
|
700
712
|
async clear() {
|
|
701
713
|
const e = await this.getDB();
|
|
702
|
-
return new Promise((
|
|
714
|
+
return new Promise((n, a) => {
|
|
703
715
|
const o = e.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete("user-preferences");
|
|
704
|
-
o.onerror = () => a(o.error), o.onsuccess = () =>
|
|
716
|
+
o.onerror = () => a(o.error), o.onsuccess = () => n();
|
|
705
717
|
});
|
|
706
718
|
}
|
|
707
719
|
}
|
|
708
|
-
class
|
|
709
|
-
constructor(e,
|
|
710
|
-
this.baseUrl = e, this.getAuthHeaders =
|
|
720
|
+
class Oa {
|
|
721
|
+
constructor(e, n) {
|
|
722
|
+
this.baseUrl = e, this.getAuthHeaders = n;
|
|
711
723
|
}
|
|
712
724
|
getHeaders() {
|
|
713
725
|
var e;
|
|
@@ -729,13 +741,13 @@ class Ia {
|
|
|
729
741
|
return e.json();
|
|
730
742
|
}
|
|
731
743
|
async push(e) {
|
|
732
|
-
const
|
|
744
|
+
const n = await fetch(`${this.baseUrl}/preferences`, {
|
|
733
745
|
method: "PUT",
|
|
734
746
|
headers: this.getHeaders(),
|
|
735
747
|
body: JSON.stringify(e)
|
|
736
748
|
});
|
|
737
|
-
if (!
|
|
738
|
-
throw new Error(`Failed to save preferences: ${
|
|
749
|
+
if (!n.ok)
|
|
750
|
+
throw new Error(`Failed to save preferences: ${n.statusText}`);
|
|
739
751
|
}
|
|
740
752
|
async getServerTimestamp() {
|
|
741
753
|
const e = await fetch(`${this.baseUrl}/preferences/timestamp`, {
|
|
@@ -745,52 +757,52 @@ class Ia {
|
|
|
745
757
|
return e.ok && (await e.json()).timestamp || 0;
|
|
746
758
|
}
|
|
747
759
|
}
|
|
748
|
-
const Oe = /* @__PURE__ */
|
|
760
|
+
const Oe = /* @__PURE__ */ He(
|
|
749
761
|
null
|
|
750
762
|
);
|
|
751
763
|
function St() {
|
|
752
|
-
const
|
|
753
|
-
if (!
|
|
764
|
+
const t = ae(Oe);
|
|
765
|
+
if (!t)
|
|
754
766
|
throw new Error("useUserPreferences must be used within NiceUserPreferencesProvider");
|
|
755
|
-
return
|
|
767
|
+
return t;
|
|
756
768
|
}
|
|
757
|
-
function
|
|
769
|
+
function sn() {
|
|
758
770
|
return ae(Oe);
|
|
759
771
|
}
|
|
760
|
-
function
|
|
761
|
-
const { getControlPreferences:
|
|
762
|
-
(c) => a(
|
|
763
|
-
[
|
|
764
|
-
), i =
|
|
765
|
-
(c) => r(
|
|
766
|
-
[
|
|
772
|
+
function Ct(t, e) {
|
|
773
|
+
const { getControlPreferences: n, setControlPreferences: a, updateControlPreferences: r } = St(), s = n(t, e), o = D(
|
|
774
|
+
(c) => a(t, e, c),
|
|
775
|
+
[t, e, a]
|
|
776
|
+
), i = D(
|
|
777
|
+
(c) => r(t, e, c),
|
|
778
|
+
[t, e, r]
|
|
767
779
|
);
|
|
768
780
|
return [s, o, i];
|
|
769
781
|
}
|
|
770
|
-
function
|
|
771
|
-
return
|
|
782
|
+
function Ra(t) {
|
|
783
|
+
return Ct(t, "grid");
|
|
772
784
|
}
|
|
773
|
-
function
|
|
774
|
-
return
|
|
785
|
+
function Va(t) {
|
|
786
|
+
return Ct(t, "chart");
|
|
775
787
|
}
|
|
776
|
-
const
|
|
788
|
+
const je = {
|
|
777
789
|
version: 1,
|
|
778
790
|
global: {},
|
|
779
791
|
controls: {}
|
|
780
792
|
};
|
|
781
|
-
function
|
|
782
|
-
storage:
|
|
793
|
+
function Fa({
|
|
794
|
+
storage: t = new rn(),
|
|
783
795
|
syncAdapter: e,
|
|
784
|
-
autoSyncInterval:
|
|
796
|
+
autoSyncInterval: n = 0,
|
|
785
797
|
saveDebounce: a = 500,
|
|
786
798
|
children: r
|
|
787
799
|
}) {
|
|
788
|
-
const [s, o] = j(
|
|
800
|
+
const [s, o] = j(je), [i, c] = j(!0), [d, u] = j(!1), [h, l] = j(null), p = O(void 0), w = O(void 0);
|
|
789
801
|
R(() => {
|
|
790
802
|
let f = !0;
|
|
791
803
|
return (async () => {
|
|
792
804
|
try {
|
|
793
|
-
const b = await
|
|
805
|
+
const b = await t.load();
|
|
794
806
|
f && b && o(b);
|
|
795
807
|
} catch (b) {
|
|
796
808
|
f && l(b instanceof Error ? b : new Error("Failed to load preferences"));
|
|
@@ -800,67 +812,67 @@ function Va({
|
|
|
800
812
|
})(), () => {
|
|
801
813
|
f = !1;
|
|
802
814
|
};
|
|
803
|
-
}, [
|
|
804
|
-
const k =
|
|
815
|
+
}, [t]);
|
|
816
|
+
const k = D(
|
|
805
817
|
(f) => {
|
|
806
818
|
p.current && clearTimeout(p.current), p.current = setTimeout(async () => {
|
|
807
819
|
try {
|
|
808
|
-
await
|
|
809
|
-
} catch (
|
|
810
|
-
l(
|
|
820
|
+
await t.save(f);
|
|
821
|
+
} catch (x) {
|
|
822
|
+
l(x instanceof Error ? x : new Error("Failed to save preferences"));
|
|
811
823
|
}
|
|
812
824
|
}, a);
|
|
813
825
|
},
|
|
814
|
-
[
|
|
826
|
+
[t, a]
|
|
815
827
|
);
|
|
816
828
|
R(() => {
|
|
817
829
|
i || k(s);
|
|
818
830
|
}, [s, i, k]);
|
|
819
|
-
const
|
|
831
|
+
const z = O(async () => {
|
|
820
832
|
});
|
|
821
833
|
R(() => {
|
|
822
|
-
if (e &&
|
|
834
|
+
if (e && n > 0)
|
|
823
835
|
return w.current = setInterval(() => {
|
|
824
|
-
|
|
825
|
-
},
|
|
836
|
+
z.current();
|
|
837
|
+
}, n), () => {
|
|
826
838
|
w.current && clearInterval(w.current);
|
|
827
839
|
};
|
|
828
|
-
}, [e,
|
|
840
|
+
}, [e, n]), R(() => () => {
|
|
829
841
|
p.current && clearTimeout(p.current), w.current && clearInterval(w.current);
|
|
830
842
|
}, []);
|
|
831
|
-
const
|
|
832
|
-
(f,
|
|
843
|
+
const N = D(
|
|
844
|
+
(f, x) => {
|
|
833
845
|
var b;
|
|
834
|
-
return (b = s.controls[f]) == null ? void 0 : b[
|
|
846
|
+
return (b = s.controls[f]) == null ? void 0 : b[x];
|
|
835
847
|
},
|
|
836
848
|
[s]
|
|
837
|
-
),
|
|
838
|
-
(f,
|
|
849
|
+
), L = D(
|
|
850
|
+
(f, x, b) => {
|
|
839
851
|
o((P) => ({
|
|
840
852
|
...P,
|
|
841
853
|
controls: {
|
|
842
854
|
...P.controls,
|
|
843
855
|
[f]: {
|
|
844
856
|
...P.controls[f],
|
|
845
|
-
[
|
|
857
|
+
[x]: b,
|
|
846
858
|
lastModified: Date.now()
|
|
847
859
|
}
|
|
848
860
|
}
|
|
849
861
|
}));
|
|
850
862
|
},
|
|
851
863
|
[]
|
|
852
|
-
), m =
|
|
853
|
-
(f,
|
|
864
|
+
), m = D(
|
|
865
|
+
(f, x, b) => {
|
|
854
866
|
o((P) => {
|
|
855
867
|
var _;
|
|
856
|
-
const H = (_ = P.controls[f]) == null ? void 0 : _[
|
|
868
|
+
const H = (_ = P.controls[f]) == null ? void 0 : _[x], I = typeof H == "object" && H !== null ? { ...H, ...b } : b;
|
|
857
869
|
return {
|
|
858
870
|
...P,
|
|
859
871
|
controls: {
|
|
860
872
|
...P.controls,
|
|
861
873
|
[f]: {
|
|
862
874
|
...P.controls[f],
|
|
863
|
-
[
|
|
875
|
+
[x]: I,
|
|
864
876
|
lastModified: Date.now()
|
|
865
877
|
}
|
|
866
878
|
}
|
|
@@ -868,11 +880,11 @@ function Va({
|
|
|
868
880
|
});
|
|
869
881
|
},
|
|
870
882
|
[]
|
|
871
|
-
), A =
|
|
872
|
-
(f,
|
|
883
|
+
), A = D(
|
|
884
|
+
(f, x) => {
|
|
873
885
|
o((b) => {
|
|
874
|
-
if (
|
|
875
|
-
const { [
|
|
886
|
+
if (x) {
|
|
887
|
+
const { [x]: I, ..._ } = b.controls[f] || {};
|
|
876
888
|
return {
|
|
877
889
|
...b,
|
|
878
890
|
controls: {
|
|
@@ -889,31 +901,31 @@ function Va({
|
|
|
889
901
|
});
|
|
890
902
|
},
|
|
891
903
|
[]
|
|
892
|
-
), y =
|
|
904
|
+
), y = D(
|
|
893
905
|
(f) => s.global[f],
|
|
894
906
|
[s]
|
|
895
|
-
),
|
|
896
|
-
(f,
|
|
907
|
+
), S = D(
|
|
908
|
+
(f, x) => {
|
|
897
909
|
o((b) => ({
|
|
898
910
|
...b,
|
|
899
911
|
global: {
|
|
900
912
|
...b.global,
|
|
901
|
-
[f]:
|
|
913
|
+
[f]: x
|
|
902
914
|
}
|
|
903
915
|
}));
|
|
904
916
|
},
|
|
905
917
|
[]
|
|
906
|
-
), T =
|
|
918
|
+
), T = D(async () => {
|
|
907
919
|
if (e) {
|
|
908
920
|
u(!0), l(null);
|
|
909
921
|
try {
|
|
910
|
-
const f = await e.getServerTimestamp(),
|
|
911
|
-
if (f >
|
|
922
|
+
const f = await e.getServerTimestamp(), x = s.lastSync || 0;
|
|
923
|
+
if (f > x) {
|
|
912
924
|
const b = await e.fetch();
|
|
913
925
|
b && (o({
|
|
914
926
|
...b,
|
|
915
927
|
lastSync: Date.now()
|
|
916
|
-
}), await
|
|
928
|
+
}), await t.save(b));
|
|
917
929
|
} else {
|
|
918
930
|
const b = { ...s, lastSync: Date.now() };
|
|
919
931
|
await e.push(b), o(b);
|
|
@@ -924,31 +936,31 @@ function Va({
|
|
|
924
936
|
u(!1);
|
|
925
937
|
}
|
|
926
938
|
}
|
|
927
|
-
}, [e, s,
|
|
928
|
-
|
|
929
|
-
const E =
|
|
939
|
+
}, [e, s, t]);
|
|
940
|
+
z.current = T;
|
|
941
|
+
const E = D(() => JSON.stringify(s, null, 2), [s]), g = D((f) => {
|
|
930
942
|
try {
|
|
931
|
-
const
|
|
932
|
-
if (typeof
|
|
943
|
+
const x = JSON.parse(f);
|
|
944
|
+
if (typeof x.version != "number" || !x.controls)
|
|
933
945
|
throw new Error("Invalid preferences format");
|
|
934
|
-
o(
|
|
935
|
-
} catch (
|
|
936
|
-
l(
|
|
946
|
+
o(x);
|
|
947
|
+
} catch (x) {
|
|
948
|
+
l(x instanceof Error ? x : new Error("Import failed"));
|
|
937
949
|
}
|
|
938
|
-
}, []), v =
|
|
939
|
-
o(
|
|
940
|
-
}, [
|
|
950
|
+
}, []), v = D(() => {
|
|
951
|
+
o(je), t.clear();
|
|
952
|
+
}, [t]), M = pe(
|
|
941
953
|
() => ({
|
|
942
954
|
preferences: s,
|
|
943
955
|
isLoading: i,
|
|
944
956
|
isSyncing: d,
|
|
945
957
|
error: h,
|
|
946
|
-
getControlPreferences:
|
|
947
|
-
setControlPreferences:
|
|
958
|
+
getControlPreferences: N,
|
|
959
|
+
setControlPreferences: L,
|
|
948
960
|
updateControlPreferences: m,
|
|
949
961
|
clearControlPreferences: A,
|
|
950
962
|
getGlobalPreferences: y,
|
|
951
|
-
setGlobalPreferences:
|
|
963
|
+
setGlobalPreferences: S,
|
|
952
964
|
sync: T,
|
|
953
965
|
exportPreferences: E,
|
|
954
966
|
importPreferences: g,
|
|
@@ -959,29 +971,29 @@ function Va({
|
|
|
959
971
|
i,
|
|
960
972
|
d,
|
|
961
973
|
h,
|
|
962
|
-
|
|
963
|
-
|
|
974
|
+
N,
|
|
975
|
+
L,
|
|
964
976
|
m,
|
|
965
977
|
A,
|
|
966
978
|
y,
|
|
967
|
-
|
|
979
|
+
S,
|
|
968
980
|
T,
|
|
969
981
|
E,
|
|
970
982
|
g,
|
|
971
983
|
v
|
|
972
984
|
]
|
|
973
985
|
);
|
|
974
|
-
return /* @__PURE__ */
|
|
986
|
+
return /* @__PURE__ */ C(Oe.Provider, { value: M, children: r });
|
|
975
987
|
}
|
|
976
|
-
function
|
|
977
|
-
showGlobal:
|
|
988
|
+
function _a({
|
|
989
|
+
showGlobal: t = !0,
|
|
978
990
|
showControls: e = !0,
|
|
979
|
-
showExportImport:
|
|
991
|
+
showExportImport: n = !0,
|
|
980
992
|
showSync: a = !0,
|
|
981
993
|
className: r,
|
|
982
994
|
style: s
|
|
983
995
|
}) {
|
|
984
|
-
var y,
|
|
996
|
+
var y, S, T, E;
|
|
985
997
|
const { t: o } = J(), {
|
|
986
998
|
preferences: i,
|
|
987
999
|
isLoading: c,
|
|
@@ -992,8 +1004,8 @@ function Fa({
|
|
|
992
1004
|
importPreferences: p,
|
|
993
1005
|
resetAllPreferences: w,
|
|
994
1006
|
setGlobalPreferences: k,
|
|
995
|
-
clearControlPreferences:
|
|
996
|
-
} = St(),
|
|
1007
|
+
clearControlPreferences: z
|
|
1008
|
+
} = St(), N = O(null), L = () => {
|
|
997
1009
|
const g = l(), v = new Blob([g], { type: "application/json" }), M = URL.createObjectURL(v), f = document.createElement("a");
|
|
998
1010
|
f.href = M, f.download = "nice2dev-preferences.json", f.click(), URL.revokeObjectURL(M);
|
|
999
1011
|
}, m = (g) => {
|
|
@@ -1007,7 +1019,7 @@ function Fa({
|
|
|
1007
1019
|
}, M.readAsText(v);
|
|
1008
1020
|
};
|
|
1009
1021
|
if (c)
|
|
1010
|
-
return /* @__PURE__ */
|
|
1022
|
+
return /* @__PURE__ */ C("div", { className: r, style: s, children: o("userPreferences.loadingPreferences", "Loading preferences...") });
|
|
1011
1023
|
const A = Object.keys(i.controls);
|
|
1012
1024
|
return /* @__PURE__ */ V(
|
|
1013
1025
|
"div",
|
|
@@ -1020,7 +1032,7 @@ function Fa({
|
|
|
1020
1032
|
...s
|
|
1021
1033
|
},
|
|
1022
1034
|
children: [
|
|
1023
|
-
u && /* @__PURE__ */
|
|
1035
|
+
u && /* @__PURE__ */ C(
|
|
1024
1036
|
"div",
|
|
1025
1037
|
{
|
|
1026
1038
|
style: {
|
|
@@ -1035,7 +1047,7 @@ function Fa({
|
|
|
1035
1047
|
}
|
|
1036
1048
|
),
|
|
1037
1049
|
/* @__PURE__ */ V("div", { style: { display: "flex", gap: "8px", marginBottom: "20px", flexWrap: "wrap" }, children: [
|
|
1038
|
-
a && /* @__PURE__ */
|
|
1050
|
+
a && /* @__PURE__ */ C(
|
|
1039
1051
|
"button",
|
|
1040
1052
|
{
|
|
1041
1053
|
onClick: h,
|
|
@@ -1050,11 +1062,11 @@ function Fa({
|
|
|
1050
1062
|
children: d ? o("userPreferences.syncing", "Syncing...") : o("userPreferences.sync", "Sync")
|
|
1051
1063
|
}
|
|
1052
1064
|
),
|
|
1053
|
-
|
|
1054
|
-
/* @__PURE__ */
|
|
1065
|
+
n && /* @__PURE__ */ V(_t, { children: [
|
|
1066
|
+
/* @__PURE__ */ C(
|
|
1055
1067
|
"button",
|
|
1056
1068
|
{
|
|
1057
|
-
onClick:
|
|
1069
|
+
onClick: L,
|
|
1058
1070
|
style: {
|
|
1059
1071
|
padding: "8px 16px",
|
|
1060
1072
|
border: "1px solid var(--nice-border-color, #e5e7eb)",
|
|
@@ -1065,12 +1077,12 @@ function Fa({
|
|
|
1065
1077
|
children: o("userPreferences.export", "Export")
|
|
1066
1078
|
}
|
|
1067
1079
|
),
|
|
1068
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ C(
|
|
1069
1081
|
"button",
|
|
1070
1082
|
{
|
|
1071
1083
|
onClick: () => {
|
|
1072
1084
|
var g;
|
|
1073
|
-
return (g =
|
|
1085
|
+
return (g = N.current) == null ? void 0 : g.click();
|
|
1074
1086
|
},
|
|
1075
1087
|
style: {
|
|
1076
1088
|
padding: "8px 16px",
|
|
@@ -1082,10 +1094,10 @@ function Fa({
|
|
|
1082
1094
|
children: o("userPreferences.import", "Import")
|
|
1083
1095
|
}
|
|
1084
1096
|
),
|
|
1085
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ C(
|
|
1086
1098
|
"input",
|
|
1087
1099
|
{
|
|
1088
|
-
ref:
|
|
1100
|
+
ref: N,
|
|
1089
1101
|
type: "file",
|
|
1090
1102
|
accept: ".json",
|
|
1091
1103
|
onChange: m,
|
|
@@ -1093,7 +1105,7 @@ function Fa({
|
|
|
1093
1105
|
}
|
|
1094
1106
|
)
|
|
1095
1107
|
] }),
|
|
1096
|
-
/* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ C(
|
|
1097
1109
|
"button",
|
|
1098
1110
|
{
|
|
1099
1111
|
onClick: w,
|
|
@@ -1110,11 +1122,11 @@ function Fa({
|
|
|
1110
1122
|
}
|
|
1111
1123
|
)
|
|
1112
1124
|
] }),
|
|
1113
|
-
|
|
1114
|
-
/* @__PURE__ */
|
|
1125
|
+
t && /* @__PURE__ */ V("div", { style: { marginBottom: "24px" }, children: [
|
|
1126
|
+
/* @__PURE__ */ C("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.globalPreferences", "Global Preferences") }),
|
|
1115
1127
|
/* @__PURE__ */ V("div", { style: { display: "grid", gap: "12px" }, children: [
|
|
1116
1128
|
/* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
1117
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ C(
|
|
1118
1130
|
"input",
|
|
1119
1131
|
{
|
|
1120
1132
|
type: "checkbox",
|
|
@@ -1128,11 +1140,11 @@ function Fa({
|
|
|
1128
1140
|
o("userPreferences.reducedMotion", "Reduced motion")
|
|
1129
1141
|
] }),
|
|
1130
1142
|
/* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ C(
|
|
1132
1144
|
"input",
|
|
1133
1145
|
{
|
|
1134
1146
|
type: "checkbox",
|
|
1135
|
-
checked: ((
|
|
1147
|
+
checked: ((S = i.global.display) == null ? void 0 : S.highContrast) || !1,
|
|
1136
1148
|
onChange: (g) => k("display", {
|
|
1137
1149
|
...i.global.display,
|
|
1138
1150
|
highContrast: g.target.checked
|
|
@@ -1143,7 +1155,7 @@ function Fa({
|
|
|
1143
1155
|
] }),
|
|
1144
1156
|
/* @__PURE__ */ V("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
1145
1157
|
o("userPreferences.fontScale", "Font scale:"),
|
|
1146
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ C(
|
|
1147
1159
|
"input",
|
|
1148
1160
|
{
|
|
1149
1161
|
type: "range",
|
|
@@ -1166,11 +1178,11 @@ function Fa({
|
|
|
1166
1178
|
] })
|
|
1167
1179
|
] }),
|
|
1168
1180
|
e && A.length > 0 && /* @__PURE__ */ V("div", { children: [
|
|
1169
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ C("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: o("userPreferences.controlPreferences", "Control Preferences ({controlIds})").replace(
|
|
1170
1182
|
"{controlIds}",
|
|
1171
1183
|
String(A.length)
|
|
1172
1184
|
) }),
|
|
1173
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ C("div", { style: { display: "grid", gap: "8px" }, children: A.map((g) => {
|
|
1174
1186
|
const v = i.controls[g], M = Object.keys(v).filter((f) => f !== "lastModified");
|
|
1175
1187
|
return /* @__PURE__ */ V(
|
|
1176
1188
|
"div",
|
|
@@ -1185,13 +1197,13 @@ function Fa({
|
|
|
1185
1197
|
},
|
|
1186
1198
|
children: [
|
|
1187
1199
|
/* @__PURE__ */ V("div", { children: [
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ C("div", { style: { fontWeight: 500 }, children: g }),
|
|
1201
|
+
/* @__PURE__ */ C("div", { style: { fontSize: "12px", color: "var(--nice-text-muted, #6b7280)" }, children: M.join(", ") })
|
|
1190
1202
|
] }),
|
|
1191
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ C(
|
|
1192
1204
|
"button",
|
|
1193
1205
|
{
|
|
1194
|
-
onClick: () =>
|
|
1206
|
+
onClick: () => z(g),
|
|
1195
1207
|
style: {
|
|
1196
1208
|
padding: "4px 8px",
|
|
1197
1209
|
border: "none",
|
|
@@ -1209,26 +1221,26 @@ function Fa({
|
|
|
1209
1221
|
);
|
|
1210
1222
|
}) })
|
|
1211
1223
|
] }),
|
|
1212
|
-
e && A.length === 0 && /* @__PURE__ */
|
|
1224
|
+
e && A.length === 0 && /* @__PURE__ */ C("div", { style: { color: "var(--nice-text-muted, #6b7280)", fontStyle: "italic" }, children: o("userPreferences.noControlPreferencesSavedYet", "No control preferences saved yet.") })
|
|
1213
1225
|
]
|
|
1214
1226
|
}
|
|
1215
1227
|
);
|
|
1216
1228
|
}
|
|
1217
|
-
const
|
|
1229
|
+
const Ue = {
|
|
1218
1230
|
"045e": "xbox",
|
|
1219
1231
|
"054c": "playstation",
|
|
1220
1232
|
"057e": "nintendo",
|
|
1221
1233
|
"28de": "steam"
|
|
1222
1234
|
};
|
|
1223
|
-
function
|
|
1235
|
+
function on(t) {
|
|
1224
1236
|
var a, r, s;
|
|
1225
|
-
const e =
|
|
1226
|
-
return
|
|
1237
|
+
const e = t.toLowerCase(), n = ((a = /vendor:\s*([0-9a-f]{4})/.exec(e)) == null ? void 0 : a[1]) ?? ((s = (r = /^([0-9a-f]{1,4})-[0-9a-f]{1,4}-/.exec(e)) == null ? void 0 : r[1]) == null ? void 0 : s.padStart(4, "0"));
|
|
1238
|
+
return n && Ue[n] ? Ue[n] : /xbox|xinput|x-box/.test(e) ? "xbox" : /dualsense|dualshock|playstation/.test(e) ? "playstation" : /nintendo|pro controller|joy-con|switch/.test(e) ? "nintendo" : /steam|valve/.test(e) ? "steam" : "generic";
|
|
1227
1239
|
}
|
|
1228
|
-
function
|
|
1229
|
-
return e !== "auto" ? e :
|
|
1240
|
+
function cn(t, e) {
|
|
1241
|
+
return e !== "auto" ? e : t === "nintendo" ? "east" : "south";
|
|
1230
1242
|
}
|
|
1231
|
-
const
|
|
1243
|
+
const ln = {
|
|
1232
1244
|
A: "south",
|
|
1233
1245
|
B: "east",
|
|
1234
1246
|
X: "west",
|
|
@@ -1242,8 +1254,8 @@ const cn = {
|
|
|
1242
1254
|
LS: "leftStick",
|
|
1243
1255
|
RS: "rightStick"
|
|
1244
1256
|
};
|
|
1245
|
-
function
|
|
1246
|
-
return
|
|
1257
|
+
function un(t) {
|
|
1258
|
+
return ln[t] ?? t;
|
|
1247
1259
|
}
|
|
1248
1260
|
const ye = {
|
|
1249
1261
|
xbox: { south: ["A"], east: ["B"], west: ["X"], north: ["Y"] },
|
|
@@ -1261,7 +1273,7 @@ const ye = {
|
|
|
1261
1273
|
west: ["Left button", "input.pad.leftButton"],
|
|
1262
1274
|
north: ["Top button", "input.pad.topButton"]
|
|
1263
1275
|
}
|
|
1264
|
-
},
|
|
1276
|
+
}, Ge = ["Left stick", "input.pad.leftStick"], qe = ["Right stick", "input.pad.rightStick"], dn = {
|
|
1265
1277
|
xbox: [["LB"], ["RB"], ["LT"], ["RT"], ["View"], ["Menu"], ["LS"], ["RS"]],
|
|
1266
1278
|
playstation: [["L1"], ["R1"], ["L2"], ["R2"], ["Create"], ["Options"], ["L3"], ["R3"]],
|
|
1267
1279
|
nintendo: [
|
|
@@ -1271,8 +1283,8 @@ const ye = {
|
|
|
1271
1283
|
["ZR"],
|
|
1272
1284
|
["Minus", "input.pad.minus"],
|
|
1273
1285
|
["Plus", "input.pad.plus"],
|
|
1274
|
-
|
|
1275
|
-
|
|
1286
|
+
Ge,
|
|
1287
|
+
qe
|
|
1276
1288
|
],
|
|
1277
1289
|
steam: [["L1"], ["R1"], ["L2"], ["R2"], ["View"], ["Menu"], ["L3"], ["R3"]],
|
|
1278
1290
|
generic: [
|
|
@@ -1282,10 +1294,10 @@ const ye = {
|
|
|
1282
1294
|
["Right trigger", "input.pad.rightTrigger"],
|
|
1283
1295
|
["Select"],
|
|
1284
1296
|
["Start"],
|
|
1285
|
-
|
|
1286
|
-
|
|
1297
|
+
Ge,
|
|
1298
|
+
qe
|
|
1287
1299
|
]
|
|
1288
|
-
},
|
|
1300
|
+
}, hn = {
|
|
1289
1301
|
leftBumper: 0,
|
|
1290
1302
|
rightBumper: 1,
|
|
1291
1303
|
leftTrigger: 2,
|
|
@@ -1294,33 +1306,33 @@ const ye = {
|
|
|
1294
1306
|
start: 5,
|
|
1295
1307
|
leftStick: 6,
|
|
1296
1308
|
rightStick: 7
|
|
1297
|
-
},
|
|
1309
|
+
}, fn = {
|
|
1298
1310
|
dpadUp: ["D-pad up", "input.pad.dpadUp"],
|
|
1299
1311
|
dpadDown: ["D-pad down", "input.pad.dpadDown"],
|
|
1300
1312
|
dpadLeft: ["D-pad left", "input.pad.dpadLeft"],
|
|
1301
1313
|
dpadRight: ["D-pad right", "input.pad.dpadRight"],
|
|
1302
1314
|
home: ["Home"]
|
|
1303
1315
|
};
|
|
1304
|
-
function
|
|
1305
|
-
if (e in ye[
|
|
1306
|
-
return ye[
|
|
1307
|
-
const
|
|
1308
|
-
return
|
|
1316
|
+
function pn(t, e) {
|
|
1317
|
+
if (e in ye[t])
|
|
1318
|
+
return ye[t][e];
|
|
1319
|
+
const n = hn[e];
|
|
1320
|
+
return n === void 0 ? fn[e] ?? [e] : dn[t][n];
|
|
1309
1321
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const [
|
|
1312
|
-
return a ? { label:
|
|
1322
|
+
function vn(t, e) {
|
|
1323
|
+
const [n, a] = pn(t, e);
|
|
1324
|
+
return a ? { label: n, key: a } : { label: n };
|
|
1313
1325
|
}
|
|
1314
|
-
function
|
|
1326
|
+
function mn(t, e) {
|
|
1315
1327
|
switch (e) {
|
|
1316
1328
|
case "south":
|
|
1317
1329
|
case "east":
|
|
1318
1330
|
case "west":
|
|
1319
1331
|
case "north": {
|
|
1320
|
-
if (
|
|
1332
|
+
if (t === "generic")
|
|
1321
1333
|
return `pad-generic-${e}`;
|
|
1322
|
-
const
|
|
1323
|
-
return `pad-${
|
|
1334
|
+
const n = t === "steam" ? "xbox" : t;
|
|
1335
|
+
return `pad-${n}-${ye[n][e][0].toLowerCase()}`;
|
|
1324
1336
|
}
|
|
1325
1337
|
case "leftBumper":
|
|
1326
1338
|
return "pad-lb";
|
|
@@ -1346,7 +1358,7 @@ function vn(n, e) {
|
|
|
1346
1358
|
return `pad-${e}`;
|
|
1347
1359
|
}
|
|
1348
1360
|
}
|
|
1349
|
-
const
|
|
1361
|
+
const Nt = ["up", "down", "left", "right"], we = {
|
|
1350
1362
|
navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
|
|
1351
1363
|
activate: ["Enter", "Space"],
|
|
1352
1364
|
back: ["Escape"],
|
|
@@ -1362,7 +1374,7 @@ const Ct = ["up", "down", "left", "right"], we = {
|
|
|
1362
1374
|
last: ["End"],
|
|
1363
1375
|
scroll: [],
|
|
1364
1376
|
toggleHints: ["Shift+?"]
|
|
1365
|
-
},
|
|
1377
|
+
}, $e = {
|
|
1366
1378
|
navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
|
|
1367
1379
|
activate: ["south"],
|
|
1368
1380
|
back: ["east"],
|
|
@@ -1378,7 +1390,7 @@ const Ct = ["up", "down", "left", "right"], we = {
|
|
|
1378
1390
|
last: [],
|
|
1379
1391
|
scroll: [],
|
|
1380
1392
|
toggleHints: ["leftStick"]
|
|
1381
|
-
},
|
|
1393
|
+
}, Mn = {
|
|
1382
1394
|
" ": "Space",
|
|
1383
1395
|
Spacebar: "Space",
|
|
1384
1396
|
Esc: "Escape",
|
|
@@ -1388,63 +1400,63 @@ const Ct = ["up", "down", "left", "right"], we = {
|
|
|
1388
1400
|
Left: "ArrowLeft",
|
|
1389
1401
|
Right: "ArrowRight"
|
|
1390
1402
|
};
|
|
1391
|
-
function Re(
|
|
1392
|
-
return
|
|
1403
|
+
function Re(t) {
|
|
1404
|
+
return Mn[t] ?? t;
|
|
1393
1405
|
}
|
|
1394
|
-
function Ht(
|
|
1395
|
-
const e =
|
|
1406
|
+
function Ht(t) {
|
|
1407
|
+
const e = t.endsWith("++") ? [...t.slice(0, -2).split("+"), "+"] : t.split("+"), n = e.pop() ?? "", a = new Set(e.map((r) => r.toLowerCase()));
|
|
1396
1408
|
return {
|
|
1397
|
-
key: Re(
|
|
1409
|
+
key: Re(n),
|
|
1398
1410
|
primary: a.has("ctrl") || a.has("cmd") || a.has("meta") || a.has("mod"),
|
|
1399
1411
|
alt: a.has("alt") || a.has("option"),
|
|
1400
1412
|
shift: a.has("shift")
|
|
1401
1413
|
};
|
|
1402
1414
|
}
|
|
1403
|
-
const
|
|
1404
|
-
function
|
|
1405
|
-
const
|
|
1406
|
-
return !(
|
|
1415
|
+
const gn = (t) => t.length === 1 && t.toLowerCase() === t.toUpperCase();
|
|
1416
|
+
function Tt(t, e) {
|
|
1417
|
+
const n = Re(e.key);
|
|
1418
|
+
return !(n.length === 1 ? n.toLowerCase() === t.key.toLowerCase() : n === t.key) || t.primary !== (e.ctrlKey || e.metaKey) || t.alt !== e.altKey ? !1 : gn(t.key) || t.shift === e.shiftKey;
|
|
1407
1419
|
}
|
|
1408
|
-
function
|
|
1420
|
+
function Ye(t) {
|
|
1409
1421
|
const e = {};
|
|
1410
|
-
for (const
|
|
1411
|
-
const a =
|
|
1412
|
-
e[
|
|
1422
|
+
for (const n of Object.keys(we)) {
|
|
1423
|
+
const a = t.keyboardBindings[n] ?? we[n];
|
|
1424
|
+
e[n] = a.map(Ht);
|
|
1413
1425
|
}
|
|
1414
1426
|
return e;
|
|
1415
1427
|
}
|
|
1416
|
-
function
|
|
1417
|
-
for (const
|
|
1418
|
-
const a = e[
|
|
1428
|
+
function bn(t, e) {
|
|
1429
|
+
for (const n of Object.keys(e)) {
|
|
1430
|
+
const a = e[n];
|
|
1419
1431
|
for (let r = 0; r < a.length; r++)
|
|
1420
|
-
if (
|
|
1421
|
-
return
|
|
1432
|
+
if (Tt(a[r], t))
|
|
1433
|
+
return n === "navigate" ? { intent: n, direction: Nt[r] } : n === "view" ? { intent: n, direction: a[r].shift ? "up" : "down" } : { intent: n };
|
|
1422
1434
|
}
|
|
1423
1435
|
return null;
|
|
1424
1436
|
}
|
|
1425
|
-
const
|
|
1426
|
-
function
|
|
1427
|
-
return
|
|
1437
|
+
const yn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), wn = /* @__PURE__ */ new Set([461, 10009]);
|
|
1438
|
+
function En(t) {
|
|
1439
|
+
return yn.has(t.key) || wn.has(t.keyCode) ? { intent: "back" } : t.key === "ChannelUp" ? { intent: "sectionNext" } : t.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
|
|
1428
1440
|
}
|
|
1429
|
-
function Ee(
|
|
1430
|
-
const
|
|
1431
|
-
for (const s of Object.keys(
|
|
1432
|
-
const o =
|
|
1433
|
-
o ? r[s] = [...o] : s === "activate" ? r[s] = [
|
|
1441
|
+
function Ee(t, e) {
|
|
1442
|
+
const n = cn(e, t.confirmButton), a = n === "south" ? "east" : "south", r = {};
|
|
1443
|
+
for (const s of Object.keys($e)) {
|
|
1444
|
+
const o = t.gamepadBindings[s];
|
|
1445
|
+
o ? r[s] = [...o] : s === "activate" ? r[s] = [n] : s === "back" ? r[s] = [a] : r[s] = [...$e[s]];
|
|
1434
1446
|
}
|
|
1435
1447
|
return r;
|
|
1436
1448
|
}
|
|
1437
|
-
function
|
|
1449
|
+
function kn(t) {
|
|
1438
1450
|
const e = /* @__PURE__ */ new Map();
|
|
1439
|
-
for (const
|
|
1440
|
-
n
|
|
1441
|
-
e.has(a) || e.set(a,
|
|
1451
|
+
for (const n of Object.keys(t))
|
|
1452
|
+
t[n].forEach((a, r) => {
|
|
1453
|
+
e.has(a) || e.set(a, n === "navigate" ? { intent: n, direction: Nt[r] } : { intent: n });
|
|
1442
1454
|
});
|
|
1443
1455
|
return e;
|
|
1444
1456
|
}
|
|
1445
1457
|
const re = "data-nice-focus-scope", ke = `[${re}]`;
|
|
1446
|
-
function
|
|
1447
|
-
const
|
|
1458
|
+
function zn(t, e) {
|
|
1459
|
+
const n = {
|
|
1448
1460
|
[re]: e.nav ?? "spatial",
|
|
1449
1461
|
"data-nice-scope-wrap": e.wrap ? "" : null,
|
|
1450
1462
|
"data-nice-scope-trap": e.trap ? "" : null,
|
|
@@ -1452,55 +1464,55 @@ function kn(n, e) {
|
|
|
1452
1464
|
"data-nice-arrows": e.arrows ?? null,
|
|
1453
1465
|
"data-nice-region": e.region ?? null
|
|
1454
1466
|
}, a = {};
|
|
1455
|
-
for (const [r, s] of Object.entries(
|
|
1456
|
-
a[r] =
|
|
1467
|
+
for (const [r, s] of Object.entries(n))
|
|
1468
|
+
a[r] = t.getAttribute(r), s === null ? t.removeAttribute(r) : t.setAttribute(r, s);
|
|
1457
1469
|
return () => {
|
|
1458
1470
|
for (const [r, s] of Object.entries(a))
|
|
1459
|
-
s === null ?
|
|
1471
|
+
s === null ? t.removeAttribute(r) : t.setAttribute(r, s);
|
|
1460
1472
|
};
|
|
1461
1473
|
}
|
|
1462
|
-
function
|
|
1463
|
-
const e =
|
|
1474
|
+
function Pt(t) {
|
|
1475
|
+
const e = t.getAttribute(re), n = t.getAttribute("data-nice-scope-enter");
|
|
1464
1476
|
return {
|
|
1465
1477
|
nav: e === "vertical" || e === "horizontal" || e === "grid" || e === "none" ? e : "spatial",
|
|
1466
|
-
wrap:
|
|
1467
|
-
trap:
|
|
1468
|
-
enter:
|
|
1478
|
+
wrap: t.hasAttribute("data-nice-scope-wrap"),
|
|
1479
|
+
trap: t.hasAttribute("data-nice-scope-trap"),
|
|
1480
|
+
enter: n === "selected" || n === "first" ? n : "last"
|
|
1469
1481
|
};
|
|
1470
1482
|
}
|
|
1471
|
-
function
|
|
1483
|
+
function We(t, e) {
|
|
1472
1484
|
var a;
|
|
1473
|
-
const
|
|
1474
|
-
return
|
|
1485
|
+
const n = (a = t.parentElement) == null ? void 0 : a.closest(ke);
|
|
1486
|
+
return n && e.contains(n) && n !== e ? n : e;
|
|
1475
1487
|
}
|
|
1476
|
-
function xn(
|
|
1477
|
-
var
|
|
1488
|
+
function xn(t) {
|
|
1489
|
+
var n, a;
|
|
1478
1490
|
const e = [];
|
|
1479
|
-
for (let r = (
|
|
1491
|
+
for (let r = (n = t.parentElement) == null ? void 0 : n.closest(ke); r; r = (a = r.parentElement) == null ? void 0 : a.closest(ke))
|
|
1480
1492
|
e.push(r);
|
|
1481
1493
|
return e;
|
|
1482
1494
|
}
|
|
1483
|
-
function
|
|
1484
|
-
var
|
|
1485
|
-
const e = (
|
|
1495
|
+
function An(t) {
|
|
1496
|
+
var n;
|
|
1497
|
+
const e = (n = t.closest("[data-nice-arrows]")) == null ? void 0 : n.getAttribute("data-nice-arrows");
|
|
1486
1498
|
return e === "spatial" || e === "native" ? e : null;
|
|
1487
1499
|
}
|
|
1488
|
-
const
|
|
1489
|
-
function
|
|
1490
|
-
switch (
|
|
1500
|
+
const Xe = { horizontal: 30, vertical: 2 }, G = 1, Je = (t) => t === "left" || t === "right", Ze = (t, e, n, a) => Math.max(0, Math.max(t, n) - Math.min(e, a));
|
|
1501
|
+
function Ln(t, e, n) {
|
|
1502
|
+
switch (n) {
|
|
1491
1503
|
case "right":
|
|
1492
|
-
return e.left >=
|
|
1504
|
+
return e.left >= t.right - G;
|
|
1493
1505
|
case "left":
|
|
1494
|
-
return e.right <=
|
|
1506
|
+
return e.right <= t.left + G;
|
|
1495
1507
|
case "down":
|
|
1496
|
-
return e.top >=
|
|
1508
|
+
return e.top >= t.bottom - G;
|
|
1497
1509
|
default:
|
|
1498
|
-
return e.bottom <=
|
|
1510
|
+
return e.bottom <= t.top + G;
|
|
1499
1511
|
}
|
|
1500
1512
|
}
|
|
1501
|
-
function Sn(
|
|
1502
|
-
const a =
|
|
1503
|
-
switch (
|
|
1513
|
+
function Sn(t, e, n) {
|
|
1514
|
+
const a = t.left + t.width / 2, r = t.top + t.height / 2, s = e.left + e.width / 2, o = e.top + e.height / 2;
|
|
1515
|
+
switch (n) {
|
|
1504
1516
|
case "right":
|
|
1505
1517
|
return s > a + G;
|
|
1506
1518
|
case "left":
|
|
@@ -1511,20 +1523,20 @@ function Sn(n, e, t) {
|
|
|
1511
1523
|
return o < r - G;
|
|
1512
1524
|
}
|
|
1513
1525
|
}
|
|
1514
|
-
function
|
|
1526
|
+
function Cn(t, e, n) {
|
|
1515
1527
|
let a, r, s;
|
|
1516
|
-
|
|
1517
|
-
const o =
|
|
1528
|
+
Je(n) ? (a = n === "right" ? e.left - t.right : t.left - e.right, r = Ze(t.top, t.bottom, e.top, e.bottom), s = Math.abs(e.top + e.height / 2 - (t.top + t.height / 2))) : (a = n === "down" ? e.top - t.bottom : t.top - e.bottom, r = Ze(t.left, t.right, e.left, e.right), s = Math.abs(e.left + e.width / 2 - (t.left + t.width / 2)));
|
|
1529
|
+
const o = Je(n) ? Xe.horizontal : Xe.vertical;
|
|
1518
1530
|
return Math.max(0, a) + r * o + s * 0.01;
|
|
1519
1531
|
}
|
|
1520
|
-
function
|
|
1521
|
-
const r = e.map(
|
|
1522
|
-
for (const s of [
|
|
1532
|
+
function It(t, e, n, a) {
|
|
1533
|
+
const r = e.map(n);
|
|
1534
|
+
for (const s of [Ln, Sn]) {
|
|
1523
1535
|
let o = -1, i = 1 / 0;
|
|
1524
1536
|
for (let c = 0; c < r.length; c++) {
|
|
1525
|
-
if (!s(
|
|
1537
|
+
if (!s(t, r[c], a))
|
|
1526
1538
|
continue;
|
|
1527
|
-
const d =
|
|
1539
|
+
const d = Cn(t, r[c], a);
|
|
1528
1540
|
d < i && (i = d, o = c);
|
|
1529
1541
|
}
|
|
1530
1542
|
if (o >= 0)
|
|
@@ -1532,61 +1544,61 @@ function Pt(n, e, t, a) {
|
|
|
1532
1544
|
}
|
|
1533
1545
|
return null;
|
|
1534
1546
|
}
|
|
1535
|
-
const ue = (
|
|
1547
|
+
const ue = (t) => t === "left" || t === "right", Nn = (t) => {
|
|
1536
1548
|
var e;
|
|
1537
|
-
return ((e =
|
|
1549
|
+
return ((e = t.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(t).direction) === "rtl";
|
|
1538
1550
|
};
|
|
1539
|
-
function Hn(
|
|
1540
|
-
if (
|
|
1551
|
+
function Hn(t, e, n, a) {
|
|
1552
|
+
if (t.length === 0)
|
|
1541
1553
|
return null;
|
|
1542
1554
|
const r = (s) => !!(e.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
1543
|
-
if (
|
|
1544
|
-
return
|
|
1545
|
-
for (let s =
|
|
1546
|
-
if (!r(
|
|
1547
|
-
return
|
|
1548
|
-
return a ?
|
|
1549
|
-
}
|
|
1550
|
-
const
|
|
1551
|
-
function
|
|
1555
|
+
if (n)
|
|
1556
|
+
return t.find(r) ?? (a ? t[0] : null);
|
|
1557
|
+
for (let s = t.length - 1; s >= 0; s--)
|
|
1558
|
+
if (!r(t[s]))
|
|
1559
|
+
return t[s];
|
|
1560
|
+
return a ? t[t.length - 1] : null;
|
|
1561
|
+
}
|
|
1562
|
+
const Tn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
|
|
1563
|
+
function Pn(t, e, n) {
|
|
1552
1564
|
let a = null;
|
|
1553
|
-
for (let s =
|
|
1565
|
+
for (let s = t.parentElement; s && !s.contains(e); s = s.parentElement)
|
|
1554
1566
|
s.hasAttribute(re) && (a = s);
|
|
1555
1567
|
if (!a)
|
|
1556
|
-
return
|
|
1557
|
-
const r =
|
|
1568
|
+
return t;
|
|
1569
|
+
const r = Pt(a).enter;
|
|
1558
1570
|
if (r === "last") {
|
|
1559
|
-
const s =
|
|
1560
|
-
return s && s.isConnected && a.contains(s) && te(s) ? s :
|
|
1571
|
+
const s = n.get(a);
|
|
1572
|
+
return s && s.isConnected && a.contains(s) && te(s) ? s : t;
|
|
1561
1573
|
}
|
|
1562
|
-
return r === "selected" ? [...a.querySelectorAll(
|
|
1574
|
+
return r === "selected" ? [...a.querySelectorAll(Tn)].find(te) ?? t : U(a)[0] ?? t;
|
|
1563
1575
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const a = X(
|
|
1566
|
-
let r =
|
|
1576
|
+
function In(t, e, n) {
|
|
1577
|
+
const a = X(t);
|
|
1578
|
+
let r = We(t, n.root), s = null;
|
|
1567
1579
|
for (; ; ) {
|
|
1568
|
-
const o =
|
|
1580
|
+
const o = Pt(r);
|
|
1569
1581
|
if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !ue(e) || o.nav === "horizontal" && ue(e)) {
|
|
1570
|
-
const c = U(r, [
|
|
1582
|
+
const c = U(r, [t, s]);
|
|
1571
1583
|
let d;
|
|
1572
1584
|
if (o.nav === "vertical" || o.nav === "horizontal") {
|
|
1573
1585
|
let u = e === "down" || e === "right";
|
|
1574
|
-
ue(e) &&
|
|
1586
|
+
ue(e) && Nn(r) && (u = !u), d = Hn(c, t, u, o.wrap);
|
|
1575
1587
|
} else
|
|
1576
|
-
d =
|
|
1588
|
+
d = It(a, c, X, e);
|
|
1577
1589
|
if (d)
|
|
1578
|
-
return
|
|
1590
|
+
return Pn(d, t, n.memory);
|
|
1579
1591
|
}
|
|
1580
|
-
if (r ===
|
|
1592
|
+
if (r === n.root || o.trap)
|
|
1581
1593
|
return null;
|
|
1582
|
-
s = r, r =
|
|
1594
|
+
s = r, r = We(r, n.root);
|
|
1583
1595
|
}
|
|
1584
1596
|
}
|
|
1585
|
-
function
|
|
1586
|
-
const
|
|
1597
|
+
function Qe(t, e) {
|
|
1598
|
+
const n = e.left + e.width / 2, a = e.top + e.height / 2;
|
|
1587
1599
|
let r = null, s = 1 / 0;
|
|
1588
|
-
for (const o of U(
|
|
1589
|
-
const i = X(o), c = Math.hypot(i.left + i.width / 2 -
|
|
1600
|
+
for (const o of U(t)) {
|
|
1601
|
+
const i = X(o), c = Math.hypot(i.left + i.width / 2 - n, i.top + i.height / 2 - a);
|
|
1590
1602
|
c < s && (s = c, r = o);
|
|
1591
1603
|
}
|
|
1592
1604
|
return r;
|
|
@@ -1607,19 +1619,19 @@ const Dt = [
|
|
|
1607
1619
|
'[role="region"][aria-label]',
|
|
1608
1620
|
'[role="region"][aria-labelledby]'
|
|
1609
1621
|
].join(",");
|
|
1610
|
-
function Dn(
|
|
1611
|
-
const a = [...
|
|
1622
|
+
function Dn(t, e, n) {
|
|
1623
|
+
const a = [...n.root.querySelectorAll(Dt)], r = a.filter(
|
|
1612
1624
|
(u) => !a.some((h) => h !== u && h.contains(u)) && U(u).length > 0
|
|
1613
1625
|
);
|
|
1614
1626
|
if (r.length === 0)
|
|
1615
1627
|
return null;
|
|
1616
|
-
const s = r.findIndex((u) => u.contains(
|
|
1628
|
+
const s = r.findIndex((u) => u.contains(t)), o = e === "up" || e === "left" ? -1 : 1, i = s < 0 ? o > 0 ? -1 : 0 : s, c = r[(i + o + r.length) % r.length];
|
|
1617
1629
|
if (c === r[s])
|
|
1618
1630
|
return null;
|
|
1619
|
-
const d =
|
|
1631
|
+
const d = n.memory.get(c);
|
|
1620
1632
|
return d && d.isConnected && c.contains(d) && te(d) ? d : U(c)[0];
|
|
1621
1633
|
}
|
|
1622
|
-
const
|
|
1634
|
+
const Ba = [
|
|
1623
1635
|
"navigate",
|
|
1624
1636
|
"activate",
|
|
1625
1637
|
"back",
|
|
@@ -1653,7 +1665,7 @@ const _a = [
|
|
|
1653
1665
|
"dpadLeft",
|
|
1654
1666
|
"dpadRight",
|
|
1655
1667
|
"home"
|
|
1656
|
-
],
|
|
1668
|
+
], ze = "nice-intent", ne = "nice-engagechange", Y = {
|
|
1657
1669
|
confirmButton: "auto",
|
|
1658
1670
|
gamepadBindings: {},
|
|
1659
1671
|
keyboardBindings: {},
|
|
@@ -1669,12 +1681,12 @@ const _a = [
|
|
|
1669
1681
|
vibration: !1,
|
|
1670
1682
|
arrowNavigation: "auto",
|
|
1671
1683
|
onScreenKeyboard: "auto"
|
|
1672
|
-
},
|
|
1673
|
-
function
|
|
1674
|
-
return Math.abs(
|
|
1684
|
+
}, On = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), Rn = 0.85;
|
|
1685
|
+
function Vn(t, e) {
|
|
1686
|
+
return Math.abs(t) > Math.abs(e) ? t > 0 ? "right" : "left" : e > 0 ? "down" : "up";
|
|
1675
1687
|
}
|
|
1676
|
-
class
|
|
1677
|
-
constructor(e,
|
|
1688
|
+
class Fn {
|
|
1689
|
+
constructor(e, n) {
|
|
1678
1690
|
this.states = /* @__PURE__ */ new Map(), this.connected = /* @__PURE__ */ new Set(), this.warned = /* @__PURE__ */ new Set(), this.started = !1, this.frameId = 0, this.onConnected = (a) => {
|
|
1679
1691
|
const r = a.gamepad;
|
|
1680
1692
|
r && this.connected.add(r.index), this.schedule();
|
|
@@ -1686,7 +1698,7 @@ class Vn {
|
|
|
1686
1698
|
this.win.document.hidden ? this.cancel() : this.schedule();
|
|
1687
1699
|
}, this.frame = (a) => {
|
|
1688
1700
|
this.frameId = 0, this.poll(a), this.schedule();
|
|
1689
|
-
}, this.win = e, this.opts =
|
|
1701
|
+
}, this.win = e, this.opts = n;
|
|
1690
1702
|
}
|
|
1691
1703
|
/** Whether an animation frame is scheduled (false without a pad or on a hidden page). */
|
|
1692
1704
|
get running() {
|
|
@@ -1709,7 +1721,7 @@ class Vn {
|
|
|
1709
1721
|
/** Read every pad once; public so tests can drive a frame. */
|
|
1710
1722
|
poll(e) {
|
|
1711
1723
|
var o, i, c, d, u, h;
|
|
1712
|
-
const
|
|
1724
|
+
const n = this.opts.timing(), a = /* @__PURE__ */ new Set(), r = this.read();
|
|
1713
1725
|
for (const l of r) {
|
|
1714
1726
|
a.add(l.index);
|
|
1715
1727
|
let p = this.states.get(l.index);
|
|
@@ -1717,23 +1729,23 @@ class Vn {
|
|
|
1717
1729
|
info: {
|
|
1718
1730
|
index: l.index,
|
|
1719
1731
|
id: l.id,
|
|
1720
|
-
family:
|
|
1732
|
+
family: on(l.id),
|
|
1721
1733
|
mapping: l.mapping
|
|
1722
1734
|
},
|
|
1723
1735
|
pressed: [],
|
|
1724
1736
|
stick: null,
|
|
1725
1737
|
holds: /* @__PURE__ */ new Map()
|
|
1726
|
-
}, this.states.set(l.index, p), this.warnMapping(l), (i = (o = this.opts).onPadsChange) == null || i.call(o, this.pads)), this.readButtons(p, l, e,
|
|
1738
|
+
}, this.states.set(l.index, p), this.warnMapping(l), (i = (o = this.opts).onPadsChange) == null || i.call(o, this.pads)), this.readButtons(p, l, e, n), this.readSticks(p, l, e, n);
|
|
1727
1739
|
}
|
|
1728
1740
|
let s = !1;
|
|
1729
1741
|
for (const l of [...this.states.keys()])
|
|
1730
1742
|
a.has(l) || (this.states.delete(l), s = !0);
|
|
1731
1743
|
s && ((d = (c = this.opts).onPadsChange) == null || d.call(c, this.pads)), (h = (u = this.opts).onFrame) == null || h.call(u, r, e);
|
|
1732
1744
|
}
|
|
1733
|
-
readButtons(e,
|
|
1745
|
+
readButtons(e, n, a, r) {
|
|
1734
1746
|
for (let s = 0; s < de.length; s++) {
|
|
1735
|
-
const o =
|
|
1736
|
-
i !== !!e.pressed[s] ? (e.pressed[s] = i, i &&
|
|
1747
|
+
const o = n.buttons[s], i = !!(o && (o.pressed || o.value > 0.5)), c = `b${s}`;
|
|
1748
|
+
i !== !!e.pressed[s] ? (e.pressed[s] = i, i && On.has(s) ? e.holds.set(c, { since: a, last: a, count: 0 }) : e.holds.delete(c), this.opts.onButton({
|
|
1737
1749
|
pad: e.info,
|
|
1738
1750
|
button: de[s],
|
|
1739
1751
|
pressed: i,
|
|
@@ -1746,34 +1758,34 @@ class Vn {
|
|
|
1746
1758
|
});
|
|
1747
1759
|
}
|
|
1748
1760
|
}
|
|
1749
|
-
readSticks(e,
|
|
1750
|
-
const s =
|
|
1761
|
+
readSticks(e, n, a, r) {
|
|
1762
|
+
const s = n.axes[0] ?? 0, o = n.axes[1] ?? 0, i = Math.hypot(s, o);
|
|
1751
1763
|
if (i >= r.stickThreshold) {
|
|
1752
|
-
const h =
|
|
1764
|
+
const h = Vn(s, o);
|
|
1753
1765
|
h !== e.stick ? (e.stick = h, e.holds.set("stick", { since: a, last: a, count: 0 }), this.opts.onStick({ pad: e.info, direction: h, repeat: !1 })) : this.repeats(e, "stick", a, r) && this.opts.onStick({ pad: e.info, direction: h, repeat: !0 });
|
|
1754
1766
|
} else e.stick && i < r.stickThreshold * 0.7 && (e.stick = null, e.holds.delete("stick"));
|
|
1755
|
-
const c =
|
|
1767
|
+
const c = n.axes[2] ?? 0, d = n.axes[3] ?? 0, u = Math.hypot(c, d);
|
|
1756
1768
|
if (u > r.stickDeadzone) {
|
|
1757
1769
|
const h = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
|
|
1758
1770
|
this.opts.onScroll({ pad: e.info, x: c * h, y: d * h });
|
|
1759
1771
|
}
|
|
1760
1772
|
}
|
|
1761
|
-
repeats(e,
|
|
1762
|
-
const s = e.holds.get(
|
|
1773
|
+
repeats(e, n, a, r) {
|
|
1774
|
+
const s = e.holds.get(n);
|
|
1763
1775
|
if (!s || a - s.since < r.repeatDelay)
|
|
1764
1776
|
return !1;
|
|
1765
1777
|
const o = Math.max(
|
|
1766
1778
|
r.repeatIntervalMin,
|
|
1767
|
-
r.repeatInterval *
|
|
1779
|
+
r.repeatInterval * Rn ** s.count
|
|
1768
1780
|
);
|
|
1769
1781
|
return a - s.last < o ? !1 : (s.last = a, s.count++, !0);
|
|
1770
1782
|
}
|
|
1771
1783
|
read() {
|
|
1772
1784
|
var a, r;
|
|
1773
|
-
const e = ((r = (a = this.win.navigator).getGamepads) == null ? void 0 : r.call(a)) ?? [],
|
|
1785
|
+
const e = ((r = (a = this.win.navigator).getGamepads) == null ? void 0 : r.call(a)) ?? [], n = [];
|
|
1774
1786
|
for (const s of e)
|
|
1775
|
-
s && s.connected !== !1 &&
|
|
1776
|
-
return
|
|
1787
|
+
s && s.connected !== !1 && n.push(s);
|
|
1788
|
+
return n;
|
|
1777
1789
|
}
|
|
1778
1790
|
warnMapping(e) {
|
|
1779
1791
|
e.mapping === "standard" || this.warned.has(e.id) || (this.warned.add(e.id), process.env.NODE_ENV !== "production" && console.warn(
|
|
@@ -1787,12 +1799,12 @@ class Vn {
|
|
|
1787
1799
|
this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
|
|
1788
1800
|
}
|
|
1789
1801
|
}
|
|
1790
|
-
const
|
|
1802
|
+
const _n = {
|
|
1791
1803
|
up: "ArrowUp",
|
|
1792
1804
|
down: "ArrowDown",
|
|
1793
1805
|
left: "ArrowLeft",
|
|
1794
1806
|
right: "ArrowRight"
|
|
1795
|
-
},
|
|
1807
|
+
}, et = {
|
|
1796
1808
|
ArrowUp: 38,
|
|
1797
1809
|
ArrowDown: 40,
|
|
1798
1810
|
ArrowLeft: 37,
|
|
@@ -1803,107 +1815,107 @@ const Fn = {
|
|
|
1803
1815
|
End: 35,
|
|
1804
1816
|
PageUp: 33,
|
|
1805
1817
|
PageDown: 34
|
|
1806
|
-
},
|
|
1807
|
-
class
|
|
1818
|
+
}, tt = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph", "OS"]), Bn = /Web0S|webOS|Tizen|SMART-TV|SmartTV|HbbTV|NetCast|Android TV|AFT|BRAVIA|CrKey/i, nt = 18, at = (t) => t === "keyboard" || t === "gamepad" || t === "remote";
|
|
1819
|
+
class Kn {
|
|
1808
1820
|
constructor(e) {
|
|
1809
|
-
this.started = !1, this.listeners = /* @__PURE__ */ new Set(), this.frameListeners = /* @__PURE__ */ new Set(), this.padMaps = /* @__PURE__ */ new Map(), this.memory = /* @__PURE__ */ new WeakMap(), this.engagedValues = /* @__PURE__ */ new WeakMap(), this.overlays = [], this.hintsToggled = !1, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (
|
|
1810
|
-
if (
|
|
1821
|
+
this.started = !1, this.listeners = /* @__PURE__ */ new Set(), this.frameListeners = /* @__PURE__ */ new Set(), this.padMaps = /* @__PURE__ */ new Map(), this.memory = /* @__PURE__ */ new WeakMap(), this.engagedValues = /* @__PURE__ */ new WeakMap(), this.overlays = [], this.hintsToggled = !1, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (n, a) => a, this.onKeyDown = (n) => {
|
|
1822
|
+
if (n.niceSource)
|
|
1811
1823
|
return;
|
|
1812
|
-
const a =
|
|
1813
|
-
if (
|
|
1814
|
-
|
|
1824
|
+
const a = En(n), r = this.tv || a ? "remote" : "keyboard";
|
|
1825
|
+
if (tt.has(n.key) || this.setMethod(r), this.capture && !tt.has(n.key)) {
|
|
1826
|
+
n.preventDefault();
|
|
1815
1827
|
const c = [
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
], d = Re(
|
|
1828
|
+
n.ctrlKey || n.metaKey ? "Ctrl" : "",
|
|
1829
|
+
n.altKey ? "Alt" : "",
|
|
1830
|
+
n.shiftKey ? "Shift" : ""
|
|
1831
|
+
], d = Re(n.key);
|
|
1820
1832
|
this.capture({
|
|
1821
1833
|
keys: [...c, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
|
|
1822
1834
|
});
|
|
1823
1835
|
return;
|
|
1824
1836
|
}
|
|
1825
|
-
if (
|
|
1837
|
+
if (n.defaultPrevented || n.isComposing)
|
|
1826
1838
|
return;
|
|
1827
|
-
const s = a ??
|
|
1839
|
+
const s = a ?? bn(n, this.keyTable);
|
|
1828
1840
|
if (!s)
|
|
1829
1841
|
return;
|
|
1830
|
-
const o = this.targetOf(
|
|
1831
|
-
if (
|
|
1842
|
+
const o = this.targetOf(n);
|
|
1843
|
+
if (qt(o, s))
|
|
1832
1844
|
return;
|
|
1833
1845
|
const i = {
|
|
1834
1846
|
intent: s.intent,
|
|
1835
1847
|
direction: s.direction,
|
|
1836
1848
|
source: r,
|
|
1837
|
-
repeat:
|
|
1838
|
-
keyEvent:
|
|
1849
|
+
repeat: n.repeat,
|
|
1850
|
+
keyEvent: n
|
|
1839
1851
|
};
|
|
1840
|
-
(this.dispatchIntent(i, o) || this.keyDefault(i, o)) &&
|
|
1841
|
-
}, this.onPadButton = (
|
|
1842
|
-
if (this.activePad =
|
|
1852
|
+
(this.dispatchIntent(i, o) || this.keyDefault(i, o)) && n.preventDefault();
|
|
1853
|
+
}, this.onPadButton = (n) => {
|
|
1854
|
+
if (this.activePad = n.pad, this.setMethod("gamepad", n.pad.family), !n.pressed)
|
|
1843
1855
|
return;
|
|
1844
1856
|
if (this.capture) {
|
|
1845
|
-
|
|
1857
|
+
n.repeat || this.capture({ button: n.button });
|
|
1846
1858
|
return;
|
|
1847
1859
|
}
|
|
1848
|
-
const a = this.padMap(
|
|
1849
|
-
a && this.deviceIntent({ ...a, source: "gamepad", repeat:
|
|
1850
|
-
}, this.onPadStick = (
|
|
1851
|
-
this.activePad =
|
|
1860
|
+
const a = this.padMap(n.pad.family).get(n.button);
|
|
1861
|
+
a && this.deviceIntent({ ...a, source: "gamepad", repeat: n.repeat, gamepad: n.pad });
|
|
1862
|
+
}, this.onPadStick = (n) => {
|
|
1863
|
+
this.activePad = n.pad, this.setMethod("gamepad", n.pad.family), !this.capture && this.deviceIntent({
|
|
1852
1864
|
intent: "navigate",
|
|
1853
|
-
direction:
|
|
1865
|
+
direction: n.direction,
|
|
1854
1866
|
source: "gamepad",
|
|
1855
|
-
repeat:
|
|
1856
|
-
gamepad:
|
|
1867
|
+
repeat: n.repeat,
|
|
1868
|
+
gamepad: n.pad
|
|
1857
1869
|
});
|
|
1858
|
-
}, this.onPadScroll = (
|
|
1859
|
-
this.activePad =
|
|
1860
|
-
const a = this.state.preferences.invertScroll ? -1 : 1, r =
|
|
1870
|
+
}, this.onPadScroll = (n) => {
|
|
1871
|
+
this.activePad = n.pad, this.setMethod("gamepad", n.pad.family);
|
|
1872
|
+
const a = this.state.preferences.invertScroll ? -1 : 1, r = n.x * a, s = n.y * a, o = this.focused(), i = {
|
|
1861
1873
|
intent: "scroll",
|
|
1862
1874
|
direction: Math.abs(r) > Math.abs(s) ? r > 0 ? "right" : "left" : s > 0 ? "down" : "up",
|
|
1863
1875
|
amount: Math.min(1, Math.hypot(r, s)),
|
|
1864
1876
|
source: "gamepad",
|
|
1865
1877
|
repeat: !0,
|
|
1866
|
-
gamepad:
|
|
1878
|
+
gamepad: n.pad
|
|
1867
1879
|
};
|
|
1868
|
-
this.dispatchIntent(i, o) ||
|
|
1869
|
-
}, this.onPointerDown = (
|
|
1870
|
-
this.setMethod(
|
|
1871
|
-
}, this.onFocusIn = (
|
|
1872
|
-
const a =
|
|
1880
|
+
this.dispatchIntent(i, o) || rt(st(o, r, s), r * nt, s * nt);
|
|
1881
|
+
}, this.onPointerDown = (n) => {
|
|
1882
|
+
this.setMethod(n.pointerType === "touch" ? "touch" : "pointer");
|
|
1883
|
+
}, this.onFocusIn = (n) => {
|
|
1884
|
+
const a = n.target;
|
|
1873
1885
|
if (a instanceof HTMLElement) {
|
|
1874
1886
|
for (let r = a.parentElement; r; r = r.parentElement)
|
|
1875
1887
|
(r.hasAttribute(re) || r.matches(Dt) || r === this.doc.body) && this.memory.set(r, a);
|
|
1876
1888
|
this.lastFocus = { el: a, rect: X(a), scope: xn(a)[0] ?? null };
|
|
1877
1889
|
}
|
|
1878
|
-
}, this.onFocusOut = (
|
|
1879
|
-
const a =
|
|
1890
|
+
}, this.onFocusOut = (n) => {
|
|
1891
|
+
const a = n.target;
|
|
1880
1892
|
a instanceof HTMLElement && a.hasAttribute("data-nice-engaged") && this.release(a, this.state.method === "gamepad" ? "gamepad" : "keyboard", !1);
|
|
1881
1893
|
}, this.recover = () => {
|
|
1882
|
-
const
|
|
1883
|
-
if (!
|
|
1894
|
+
const n = this.lastFocus;
|
|
1895
|
+
if (!n || n.el.isConnected)
|
|
1884
1896
|
return;
|
|
1885
1897
|
this.lastFocus = null;
|
|
1886
1898
|
const a = this.doc.activeElement;
|
|
1887
1899
|
if (a && a !== this.doc.body)
|
|
1888
1900
|
return;
|
|
1889
|
-
const r = this.navigationRoot(), s =
|
|
1901
|
+
const r = this.navigationRoot(), s = n.scope && n.scope.isConnected && r.contains(n.scope) ? n.scope : r, o = Qe(s, n.rect) ?? (s !== r ? Qe(r, n.rect) : null);
|
|
1890
1902
|
o && this.focusElement(o);
|
|
1891
|
-
}, this.win = e, this.doc = e.document, this.tv =
|
|
1903
|
+
}, this.win = e, this.doc = e.document, this.tv = Bn.test(e.navigator.userAgent), this.keyTable = Ye(Y), this.state = {
|
|
1892
1904
|
method: "pointer",
|
|
1893
1905
|
family: null,
|
|
1894
1906
|
pads: [],
|
|
1895
1907
|
preferences: Y,
|
|
1896
1908
|
hintsVisible: Y.hints === "always"
|
|
1897
|
-
}, this.poller = new
|
|
1909
|
+
}, this.poller = new Fn(e, {
|
|
1898
1910
|
timing: () => this.state.preferences,
|
|
1899
1911
|
onButton: this.onPadButton,
|
|
1900
1912
|
onStick: this.onPadStick,
|
|
1901
1913
|
onScroll: this.onPadScroll,
|
|
1902
|
-
onPadsChange: (
|
|
1903
|
-
|
|
1914
|
+
onPadsChange: (n) => {
|
|
1915
|
+
n.length === 0 && (this.snapshot = []), this.update({ pads: n });
|
|
1904
1916
|
},
|
|
1905
|
-
onFrame: (
|
|
1906
|
-
this.snapshot =
|
|
1917
|
+
onFrame: (n, a) => {
|
|
1918
|
+
this.snapshot = n, this.frameListeners.forEach((r) => r(n, a));
|
|
1907
1919
|
}
|
|
1908
1920
|
});
|
|
1909
1921
|
}
|
|
@@ -1934,8 +1946,8 @@ class Bn {
|
|
|
1934
1946
|
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
1935
1947
|
}
|
|
1936
1948
|
setPreferences(e) {
|
|
1937
|
-
const
|
|
1938
|
-
this.keyTable =
|
|
1949
|
+
const n = { ...this.state.preferences, ...e };
|
|
1950
|
+
this.keyTable = Ye(n), this.padMaps.clear(), this.update({ preferences: n });
|
|
1939
1951
|
}
|
|
1940
1952
|
/** Words of announcements and labels; the React provider passes the app's translator. */
|
|
1941
1953
|
setTranslator(e) {
|
|
@@ -1947,8 +1959,8 @@ class Bn {
|
|
|
1947
1959
|
return e !== "auto" ? e : this.state.family ?? "xbox";
|
|
1948
1960
|
}
|
|
1949
1961
|
/** The buttons bound to an intent on a pad of the family (for prompts). */
|
|
1950
|
-
gamepadBinding(e,
|
|
1951
|
-
return Ee(this.state.preferences,
|
|
1962
|
+
gamepadBinding(e, n = this.glyphFamily) {
|
|
1963
|
+
return Ee(this.state.preferences, n)[e];
|
|
1952
1964
|
}
|
|
1953
1965
|
/** The keys bound to an intent (for prompts), as written in the preferences. */
|
|
1954
1966
|
keyboardBinding(e) {
|
|
@@ -1962,21 +1974,21 @@ class Bn {
|
|
|
1962
1974
|
* screen); returns what cancels the capture.
|
|
1963
1975
|
*/
|
|
1964
1976
|
captureNextInput(e) {
|
|
1965
|
-
const
|
|
1977
|
+
const n = (a) => {
|
|
1966
1978
|
this.capture = null, e(a);
|
|
1967
1979
|
};
|
|
1968
|
-
return this.capture =
|
|
1969
|
-
this.capture ===
|
|
1980
|
+
return this.capture = n, () => {
|
|
1981
|
+
this.capture === n && (this.capture = null);
|
|
1970
1982
|
};
|
|
1971
1983
|
}
|
|
1972
1984
|
update(e) {
|
|
1973
|
-
const
|
|
1974
|
-
let r = a === "always" ? !0 : a === "never" ? !1 :
|
|
1975
|
-
this.hintsToggled && (r = !r),
|
|
1985
|
+
const n = { ...this.state, ...e }, { hints: a } = n.preferences;
|
|
1986
|
+
let r = a === "always" ? !0 : a === "never" ? !1 : at(n.method);
|
|
1987
|
+
this.hintsToggled && (r = !r), n.hintsVisible = r, this.state = n, this.listeners.forEach((s) => s());
|
|
1976
1988
|
}
|
|
1977
|
-
setMethod(e,
|
|
1989
|
+
setMethod(e, n) {
|
|
1978
1990
|
const a = this.doc.documentElement;
|
|
1979
|
-
|
|
1991
|
+
n && a.getAttribute("data-nice-gamepad") !== n && a.setAttribute("data-nice-gamepad", n), !(e === this.state.method && (n === void 0 || n === this.state.family)) && (a.setAttribute("data-nice-input", e), this.watchRecovery(at(e)), this.update(n ? { method: e, family: n } : { method: e }));
|
|
1980
1992
|
}
|
|
1981
1993
|
/* ── Gamepad frames (games, device testers) ──────────────────── */
|
|
1982
1994
|
/** Raw pads every polled frame while a pad is connected. */
|
|
@@ -1991,16 +2003,16 @@ class Bn {
|
|
|
1991
2003
|
return this.snapshot;
|
|
1992
2004
|
}
|
|
1993
2005
|
/** Feedback rumble on the pad used last, when the user allows vibration. */
|
|
1994
|
-
vibrate(e,
|
|
1995
|
-
this.state.preferences.vibration && this.activePad && this.rumble(this.activePad.index, e,
|
|
2006
|
+
vibrate(e, n = 0.5) {
|
|
2007
|
+
this.state.preferences.vibration && this.activePad && this.rumble(this.activePad.index, e, n, n);
|
|
1996
2008
|
}
|
|
1997
2009
|
/** Rumble a given pad regardless of the preference (a game's own effect). */
|
|
1998
|
-
rumble(e,
|
|
2010
|
+
rumble(e, n, a = 0.5, r = 0.5) {
|
|
1999
2011
|
var i, c, d;
|
|
2000
2012
|
const s = (c = (i = this.win.navigator).getGamepads) == null ? void 0 : c.call(i)[e], o = s == null ? void 0 : s.vibrationActuator;
|
|
2001
2013
|
(d = o == null ? void 0 : o.playEffect) == null || d.call(o, "dual-rumble", {
|
|
2002
2014
|
startDelay: 0,
|
|
2003
|
-
duration:
|
|
2015
|
+
duration: n,
|
|
2004
2016
|
weakMagnitude: a,
|
|
2005
2017
|
strongMagnitude: r
|
|
2006
2018
|
});
|
|
@@ -2009,8 +2021,8 @@ class Bn {
|
|
|
2009
2021
|
/** Puts an overlay on the stack; returns what takes it off. */
|
|
2010
2022
|
pushOverlay(e) {
|
|
2011
2023
|
return this.overlays.push(e), () => {
|
|
2012
|
-
const
|
|
2013
|
-
|
|
2024
|
+
const n = this.overlays.lastIndexOf(e);
|
|
2025
|
+
n >= 0 && this.overlays.splice(n, 1);
|
|
2014
2026
|
};
|
|
2015
2027
|
}
|
|
2016
2028
|
topOverlay() {
|
|
@@ -2018,8 +2030,8 @@ class Bn {
|
|
|
2018
2030
|
}
|
|
2019
2031
|
/** Closes the top overlay that can be closed; returns whether one was. */
|
|
2020
2032
|
closeTopOverlay(e) {
|
|
2021
|
-
for (let
|
|
2022
|
-
const a = this.overlays[
|
|
2033
|
+
for (let n = this.overlays.length - 1; n >= 0; n--) {
|
|
2034
|
+
const a = this.overlays[n];
|
|
2023
2035
|
if (a.onClose)
|
|
2024
2036
|
return a.onClose(e), !0;
|
|
2025
2037
|
if (a.modal)
|
|
@@ -2029,26 +2041,26 @@ class Bn {
|
|
|
2029
2041
|
}
|
|
2030
2042
|
/* ── Intents ─────────────────────────────────────────────────── */
|
|
2031
2043
|
/** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
|
|
2032
|
-
dispatchIntent(e,
|
|
2033
|
-
const a = new CustomEvent(
|
|
2044
|
+
dispatchIntent(e, n = this.focused()) {
|
|
2045
|
+
const a = new CustomEvent(ze, {
|
|
2034
2046
|
detail: e,
|
|
2035
2047
|
bubbles: !0,
|
|
2036
2048
|
cancelable: !0,
|
|
2037
2049
|
composed: !0
|
|
2038
2050
|
});
|
|
2039
|
-
return
|
|
2051
|
+
return n.dispatchEvent(a), a.defaultPrevented;
|
|
2040
2052
|
}
|
|
2041
2053
|
/** Moves focus in a direction through the scope tree; returns whether it moved. */
|
|
2042
|
-
moveFocus(e,
|
|
2054
|
+
moveFocus(e, n = this.focused()) {
|
|
2043
2055
|
const a = this.navigationRoot();
|
|
2044
|
-
if (
|
|
2056
|
+
if (n === this.doc.body || !a.contains(n))
|
|
2045
2057
|
return this.focusInitial(a);
|
|
2046
|
-
const r =
|
|
2058
|
+
const r = In(n, e, { root: a, memory: this.memory });
|
|
2047
2059
|
return r ? (this.focusElement(r), !0) : !1;
|
|
2048
2060
|
}
|
|
2049
2061
|
/** The `view` intent: next (`down`) or previous (`up`) region. */
|
|
2050
|
-
focusRegion(e,
|
|
2051
|
-
const a = Dn(
|
|
2062
|
+
focusRegion(e, n = this.focused()) {
|
|
2063
|
+
const a = Dn(n, e, {
|
|
2052
2064
|
root: this.navigationRoot(),
|
|
2053
2065
|
memory: this.memory
|
|
2054
2066
|
});
|
|
@@ -2056,37 +2068,37 @@ class Bn {
|
|
|
2056
2068
|
}
|
|
2057
2069
|
/** Focuses the element and brings it into view (scroll-padding respected). */
|
|
2058
2070
|
focusElement(e) {
|
|
2059
|
-
var
|
|
2060
|
-
e.focus({ preventScroll: !0, focusVisible: !0 }), (
|
|
2071
|
+
var n;
|
|
2072
|
+
e.focus({ preventScroll: !0, focusVisible: !0 }), (n = e.scrollIntoView) == null || n.call(e, { block: "nearest", inline: "nearest" });
|
|
2061
2073
|
}
|
|
2062
2074
|
/** Engages a control (ADR-005 § 6); popup controls open instead. */
|
|
2063
|
-
engage(e,
|
|
2075
|
+
engage(e, n, a = ve(e)) {
|
|
2064
2076
|
if (a) {
|
|
2065
2077
|
if (a === "popup") {
|
|
2066
|
-
this.emulateKey(e, "ArrowDown",
|
|
2078
|
+
this.emulateKey(e, "ArrowDown", n);
|
|
2067
2079
|
return;
|
|
2068
2080
|
}
|
|
2069
|
-
e.setAttribute("data-nice-engaged", ""), ge(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: !0, cancelled: !1, source:
|
|
2081
|
+
e.setAttribute("data-nice-engaged", ""), ge(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: !0, cancelled: !1, source: n }), this.announce(this.translate("input.engaged", "Editing"));
|
|
2070
2082
|
}
|
|
2071
2083
|
}
|
|
2072
2084
|
/**
|
|
2073
2085
|
* Releases an engaged control; `cancelled` when left with `back`. A native number field gets
|
|
2074
2086
|
* its value from before back; custom controls do that in `useEngage`'s `onRelease`.
|
|
2075
2087
|
*/
|
|
2076
|
-
release(e,
|
|
2088
|
+
release(e, n, a) {
|
|
2077
2089
|
if (!e.hasAttribute("data-nice-engaged"))
|
|
2078
2090
|
return;
|
|
2079
2091
|
e.removeAttribute("data-nice-engaged");
|
|
2080
2092
|
const r = this.engagedValues.get(e);
|
|
2081
|
-
this.engagedValues.delete(e), a && r !== void 0 && ge(e) &&
|
|
2093
|
+
this.engagedValues.delete(e), a && r !== void 0 && ge(e) && Wt(e, r), this.fireEngage(e, { engaged: !1, cancelled: a, source: n }), this.announce(this.translate("input.released", "Done editing"));
|
|
2082
2094
|
}
|
|
2083
2095
|
/** Defaults of trusted keys: the browser already clicks, types and scrolls. */
|
|
2084
|
-
keyDefault(e,
|
|
2096
|
+
keyDefault(e, n) {
|
|
2085
2097
|
switch (e.intent) {
|
|
2086
2098
|
case "navigate":
|
|
2087
|
-
return this.arrowPolicy(
|
|
2099
|
+
return this.arrowPolicy(n, e.source) === "spatial" ? this.moveFocus(e.direction ?? "down", n) : !1;
|
|
2088
2100
|
case "view":
|
|
2089
|
-
return this.focusRegion(e.direction ?? "down",
|
|
2101
|
+
return this.focusRegion(e.direction ?? "down", n);
|
|
2090
2102
|
case "back":
|
|
2091
2103
|
return this.closeTopOverlay(e.source);
|
|
2092
2104
|
case "toggleHints":
|
|
@@ -2095,65 +2107,65 @@ class Bn {
|
|
|
2095
2107
|
return !1;
|
|
2096
2108
|
}
|
|
2097
2109
|
}
|
|
2098
|
-
arrowPolicy(e,
|
|
2099
|
-
if (
|
|
2110
|
+
arrowPolicy(e, n) {
|
|
2111
|
+
if (n !== "keyboard")
|
|
2100
2112
|
return "spatial";
|
|
2101
2113
|
const a = this.state.preferences.arrowNavigation;
|
|
2102
|
-
return a !== "auto" ? a :
|
|
2114
|
+
return a !== "auto" ? a : An(e) ?? "native";
|
|
2103
2115
|
}
|
|
2104
2116
|
/* ── Gamepad ─────────────────────────────────────────────────── */
|
|
2105
2117
|
padMap(e) {
|
|
2106
|
-
let
|
|
2107
|
-
return
|
|
2118
|
+
let n = this.padMaps.get(e);
|
|
2119
|
+
return n || (n = kn(Ee(this.state.preferences, e)), this.padMaps.set(e, n)), n;
|
|
2108
2120
|
}
|
|
2109
2121
|
/** A pad intent: the intent event, then engage rules, key emulation and the default action. */
|
|
2110
2122
|
deviceIntent(e) {
|
|
2111
|
-
const
|
|
2112
|
-
if (this.dispatchIntent(e,
|
|
2123
|
+
const n = this.focused();
|
|
2124
|
+
if (this.dispatchIntent(e, n))
|
|
2113
2125
|
return;
|
|
2114
|
-
const a =
|
|
2126
|
+
const a = n === this.doc.body ? null : ve(n), r = a !== null && kt(n, a), s = n, o = e.source;
|
|
2115
2127
|
switch (e.intent) {
|
|
2116
2128
|
case "navigate": {
|
|
2117
2129
|
const i = e.direction ?? "down";
|
|
2118
|
-
a && !r ? this.moveFocus(i,
|
|
2130
|
+
a && !r ? this.moveFocus(i, n) : r && ie(n) ? ce(n, i) : r && a === "text" ? Xt(n, i) : this.emulateKey(n, _n[i], o) || this.moveFocus(i, n);
|
|
2119
2131
|
return;
|
|
2120
2132
|
}
|
|
2121
2133
|
case "activate":
|
|
2122
|
-
a && !r ? this.engage(s, o, a) : r && a === "popup" ? this.emulateKey(
|
|
2134
|
+
a && !r ? this.engage(s, o, a) : r && a === "popup" ? this.emulateKey(n, "Enter", o) : r && (a === "value" || a === "canvas") ? this.release(s, o, !1) : r || (wt(n) ? $t(n) : this.emulateKey(n, "Enter", o));
|
|
2123
2135
|
return;
|
|
2124
2136
|
case "back":
|
|
2125
|
-
r && a === "popup" ? this.emulateKey(
|
|
2137
|
+
r && a === "popup" ? this.emulateKey(n, "Escape", o) : r ? this.release(s, o, !0) : this.emulateKey(n, "Escape", o) || this.closeTopOverlay(o);
|
|
2126
2138
|
return;
|
|
2127
2139
|
case "sectionPrev":
|
|
2128
2140
|
case "sectionNext":
|
|
2129
2141
|
if (r && a === "value") {
|
|
2130
2142
|
const i = e.intent === "sectionNext";
|
|
2131
|
-
ie(
|
|
2143
|
+
ie(n) ? ce(n, i ? "up" : "down", "big") : this.emulateKey(n, i ? "PageUp" : "PageDown", o);
|
|
2132
2144
|
}
|
|
2133
2145
|
return;
|
|
2134
2146
|
case "pagePrev":
|
|
2135
2147
|
case "pageNext": {
|
|
2136
2148
|
const i = e.intent === "pageNext";
|
|
2137
2149
|
if (r && a === "value")
|
|
2138
|
-
ie(
|
|
2139
|
-
else if (!this.emulateKey(
|
|
2140
|
-
const c =
|
|
2141
|
-
|
|
2150
|
+
ie(n) ? ce(n, i ? "up" : "down", "edge") : this.emulateKey(n, i ? "End" : "Home", o);
|
|
2151
|
+
else if (!this.emulateKey(n, i ? "PageDown" : "PageUp", o)) {
|
|
2152
|
+
const c = st(n, 0, i ? 1 : -1);
|
|
2153
|
+
rt(c, 0, (i ? 1 : -1) * ((c == null ? void 0 : c.clientHeight) ?? 0) * 0.9);
|
|
2142
2154
|
}
|
|
2143
2155
|
return;
|
|
2144
2156
|
}
|
|
2145
2157
|
case "first":
|
|
2146
2158
|
case "last":
|
|
2147
|
-
this.emulateKey(
|
|
2159
|
+
this.emulateKey(n, e.intent === "first" ? "Home" : "End", o);
|
|
2148
2160
|
return;
|
|
2149
2161
|
case "secondary":
|
|
2150
|
-
this.contextMenu(
|
|
2162
|
+
this.contextMenu(n);
|
|
2151
2163
|
return;
|
|
2152
2164
|
case "menu":
|
|
2153
|
-
r && a === "text" && (this.release(s, o, !1), this.emulateKey(
|
|
2165
|
+
r && a === "text" && (this.release(s, o, !1), this.emulateKey(n, "Enter", o));
|
|
2154
2166
|
return;
|
|
2155
2167
|
case "view":
|
|
2156
|
-
this.focusRegion(e.direction ?? "down",
|
|
2168
|
+
this.focusRegion(e.direction ?? "down", n);
|
|
2157
2169
|
return;
|
|
2158
2170
|
case "toggleHints":
|
|
2159
2171
|
this.toggleHints();
|
|
@@ -2163,29 +2175,29 @@ class Bn {
|
|
|
2163
2175
|
}
|
|
2164
2176
|
}
|
|
2165
2177
|
/** A synthetic key on the element; returns whether a handler consumed it. */
|
|
2166
|
-
emulateKey(e,
|
|
2178
|
+
emulateKey(e, n, a) {
|
|
2167
2179
|
const r = (o) => {
|
|
2168
2180
|
const i = new KeyboardEvent(o, {
|
|
2169
|
-
key:
|
|
2170
|
-
code:
|
|
2181
|
+
key: n,
|
|
2182
|
+
code: n,
|
|
2171
2183
|
bubbles: !0,
|
|
2172
2184
|
cancelable: !0,
|
|
2173
2185
|
composed: !0
|
|
2174
2186
|
});
|
|
2175
|
-
return Object.defineProperty(i, "niceSource", { value: a }), Object.defineProperty(i, "keyCode", { value:
|
|
2187
|
+
return Object.defineProperty(i, "niceSource", { value: a }), Object.defineProperty(i, "keyCode", { value: et[n] ?? 0 }), Object.defineProperty(i, "which", { value: et[n] ?? 0 }), i;
|
|
2176
2188
|
}, s = r("keydown");
|
|
2177
2189
|
return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
|
|
2178
2190
|
}
|
|
2179
2191
|
/** `secondary` on a pad: the context menu of the element, as a right click would open it. */
|
|
2180
2192
|
contextMenu(e) {
|
|
2181
|
-
const
|
|
2193
|
+
const n = e.getBoundingClientRect();
|
|
2182
2194
|
e.dispatchEvent(
|
|
2183
2195
|
new MouseEvent("contextmenu", {
|
|
2184
2196
|
bubbles: !0,
|
|
2185
2197
|
cancelable: !0,
|
|
2186
2198
|
button: 2,
|
|
2187
|
-
clientX:
|
|
2188
|
-
clientY:
|
|
2199
|
+
clientX: n.left + n.width / 2,
|
|
2200
|
+
clientY: n.top + n.height / 2
|
|
2189
2201
|
})
|
|
2190
2202
|
);
|
|
2191
2203
|
}
|
|
@@ -2199,8 +2211,8 @@ class Bn {
|
|
|
2199
2211
|
}
|
|
2200
2212
|
targetOf(e) {
|
|
2201
2213
|
var a;
|
|
2202
|
-
const
|
|
2203
|
-
return
|
|
2214
|
+
const n = (a = e.composedPath) == null ? void 0 : a.call(e)[0];
|
|
2215
|
+
return n instanceof Element ? n : e.target instanceof Element ? e.target : this.focused();
|
|
2204
2216
|
}
|
|
2205
2217
|
/** Moves stay inside the top modal overlay. */
|
|
2206
2218
|
navigationRoot() {
|
|
@@ -2211,100 +2223,100 @@ class Bn {
|
|
|
2211
2223
|
}
|
|
2212
2224
|
/** Nothing focused yet: the remembered element, else the first one of the main region. */
|
|
2213
2225
|
focusInitial(e) {
|
|
2214
|
-
const
|
|
2226
|
+
const n = this.memory.get(e), a = e.querySelector('main,[role="main"]'), r = (n && n.isConnected && e.contains(n) && te(n) ? n : null) ?? (a ? U(a)[0] : void 0) ?? U(e)[0];
|
|
2215
2227
|
return r ? (this.focusElement(r), !0) : !1;
|
|
2216
2228
|
}
|
|
2217
|
-
fireEngage(e,
|
|
2218
|
-
e.dispatchEvent(new CustomEvent(ne, { detail:
|
|
2229
|
+
fireEngage(e, n) {
|
|
2230
|
+
e.dispatchEvent(new CustomEvent(ne, { detail: n, bubbles: !0 }));
|
|
2219
2231
|
}
|
|
2220
2232
|
/** Polite announcement through the engine's own live region. */
|
|
2221
2233
|
announce(e) {
|
|
2222
2234
|
if (!this.live || !this.live.isConnected) {
|
|
2223
|
-
const
|
|
2224
|
-
|
|
2235
|
+
const n = this.doc.createElement("div");
|
|
2236
|
+
n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("data-nice-input-live", ""), n.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", this.doc.body.appendChild(n), this.live = n;
|
|
2225
2237
|
}
|
|
2226
2238
|
this.live.textContent = e;
|
|
2227
2239
|
}
|
|
2228
2240
|
}
|
|
2229
|
-
function
|
|
2230
|
-
|
|
2241
|
+
function rt(t, e, n) {
|
|
2242
|
+
t && (typeof t.scrollBy == "function" ? t.scrollBy({ left: e, top: n }) : (t.scrollLeft += e, t.scrollTop += n));
|
|
2231
2243
|
}
|
|
2232
|
-
function
|
|
2233
|
-
const a =
|
|
2234
|
-
for (let s =
|
|
2244
|
+
function st(t, e, n) {
|
|
2245
|
+
const a = t.ownerDocument, r = a.defaultView;
|
|
2246
|
+
for (let s = t; s && s !== a.body; s = s.parentElement) {
|
|
2235
2247
|
if (!(s instanceof HTMLElement) || !r)
|
|
2236
2248
|
continue;
|
|
2237
2249
|
const o = r.getComputedStyle(s), i = /(auto|scroll)/.test(o.overflowY) && s.scrollHeight > s.clientHeight, c = /(auto|scroll)/.test(o.overflowX) && s.scrollWidth > s.clientWidth;
|
|
2238
|
-
if (
|
|
2250
|
+
if (n !== 0 && i || e !== 0 && c)
|
|
2239
2251
|
return s;
|
|
2240
2252
|
}
|
|
2241
2253
|
return a.scrollingElement ?? a.documentElement;
|
|
2242
2254
|
}
|
|
2243
|
-
const
|
|
2244
|
-
function
|
|
2245
|
-
let
|
|
2246
|
-
return
|
|
2255
|
+
const ot = /* @__PURE__ */ new WeakMap();
|
|
2256
|
+
function jn(t = window, e = !0) {
|
|
2257
|
+
let n = ot.get(t);
|
|
2258
|
+
return n || (n = new Kn(t), ot.set(t, n)), e && n.start(), n;
|
|
2247
2259
|
}
|
|
2248
|
-
const
|
|
2260
|
+
const it = {
|
|
2249
2261
|
method: "pointer",
|
|
2250
2262
|
family: null,
|
|
2251
2263
|
pads: [],
|
|
2252
2264
|
preferences: Y,
|
|
2253
2265
|
hintsVisible: !1
|
|
2254
|
-
},
|
|
2255
|
-
},
|
|
2266
|
+
}, Un = () => {
|
|
2267
|
+
}, Ot = /* @__PURE__ */ He(null);
|
|
2256
2268
|
function K() {
|
|
2257
|
-
const [
|
|
2258
|
-
() => typeof window > "u" ? null :
|
|
2269
|
+
const [t] = j(
|
|
2270
|
+
() => typeof window > "u" ? null : jn(window, !1)
|
|
2259
2271
|
);
|
|
2260
2272
|
return R(() => {
|
|
2261
|
-
|
|
2262
|
-
}, [
|
|
2273
|
+
t == null || t.start();
|
|
2274
|
+
}, [t]), t;
|
|
2263
2275
|
}
|
|
2264
|
-
function Z(
|
|
2265
|
-
const e = K(),
|
|
2266
|
-
(a) => e ? (e.start(), e.subscribe(a)) :
|
|
2276
|
+
function Z(t) {
|
|
2277
|
+
const e = K(), n = D(
|
|
2278
|
+
(a) => e ? (e.start(), e.subscribe(a)) : Un,
|
|
2267
2279
|
[e]
|
|
2268
2280
|
);
|
|
2269
|
-
return
|
|
2270
|
-
|
|
2271
|
-
() =>
|
|
2272
|
-
() =>
|
|
2281
|
+
return Mt(
|
|
2282
|
+
n,
|
|
2283
|
+
() => t(e ? e.getState() : it),
|
|
2284
|
+
() => t(it)
|
|
2273
2285
|
);
|
|
2274
2286
|
}
|
|
2275
|
-
function
|
|
2276
|
-
return Z((
|
|
2277
|
-
}
|
|
2278
|
-
function Ba() {
|
|
2279
|
-
return Z((n) => n.method);
|
|
2287
|
+
function Rt() {
|
|
2288
|
+
return Z((t) => t);
|
|
2280
2289
|
}
|
|
2281
2290
|
function Ka() {
|
|
2282
|
-
return Z((
|
|
2291
|
+
return Z((t) => t.method);
|
|
2283
2292
|
}
|
|
2284
2293
|
function ja() {
|
|
2285
|
-
return Z((
|
|
2294
|
+
return Z((t) => t.family);
|
|
2286
2295
|
}
|
|
2287
|
-
function
|
|
2288
|
-
return Z((
|
|
2296
|
+
function Ua() {
|
|
2297
|
+
return Z((t) => t.pads);
|
|
2289
2298
|
}
|
|
2290
2299
|
function Gn() {
|
|
2291
|
-
|
|
2300
|
+
return Z((t) => t.hintsVisible);
|
|
2301
|
+
}
|
|
2302
|
+
function qn() {
|
|
2303
|
+
const t = Z((r) => r.preferences), e = ae(Ot), n = K(), a = D(
|
|
2292
2304
|
(r) => {
|
|
2293
|
-
e ? e.setPreferences(r) :
|
|
2305
|
+
e ? e.setPreferences(r) : n == null || n.setPreferences(r);
|
|
2294
2306
|
},
|
|
2295
|
-
[e,
|
|
2307
|
+
[e, n]
|
|
2296
2308
|
);
|
|
2297
|
-
return [
|
|
2309
|
+
return [t, a];
|
|
2298
2310
|
}
|
|
2299
|
-
function
|
|
2300
|
-
preferences:
|
|
2311
|
+
function Ga({
|
|
2312
|
+
preferences: t,
|
|
2301
2313
|
defaultPreferences: e,
|
|
2302
|
-
onPreferencesChange:
|
|
2314
|
+
onPreferencesChange: n,
|
|
2303
2315
|
persist: a = !0,
|
|
2304
2316
|
children: r
|
|
2305
2317
|
}) {
|
|
2306
|
-
const s = K(), { t: o } = J(), i =
|
|
2307
|
-
() => ({ ...Y, ...e, ...c, ...d, ...
|
|
2318
|
+
const s = K(), { t: o } = J(), i = sn(), c = a ? i == null ? void 0 : i.preferences.global.input : void 0, [d, u] = j({}), h = JSON.stringify([e, c, d, t]), l = pe(
|
|
2319
|
+
() => ({ ...Y, ...e, ...c, ...d, ...t }),
|
|
2308
2320
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by content: callers pass inline objects
|
|
2309
2321
|
[h]
|
|
2310
2322
|
);
|
|
@@ -2313,83 +2325,83 @@ function Ua({
|
|
|
2313
2325
|
}, [s, l]), R(() => () => s == null ? void 0 : s.setPreferences(Y), [s]), R(() => {
|
|
2314
2326
|
s == null || s.setTranslator(o);
|
|
2315
2327
|
}, [s, o]);
|
|
2316
|
-
const p =
|
|
2328
|
+
const p = D(
|
|
2317
2329
|
(k) => {
|
|
2318
|
-
const
|
|
2319
|
-
u(
|
|
2330
|
+
const z = { ...d, ...k };
|
|
2331
|
+
u(z), a && i && i.setGlobalPreferences("input", { ...i.preferences.global.input, ...k }), n == null || n({ ...l, ...k });
|
|
2320
2332
|
},
|
|
2321
|
-
[d, a, i,
|
|
2333
|
+
[d, a, i, n, l]
|
|
2322
2334
|
), w = pe(() => ({ setPreferences: p }), [p]);
|
|
2323
|
-
return /* @__PURE__ */
|
|
2335
|
+
return /* @__PURE__ */ C(Ot.Provider, { value: w, children: r });
|
|
2324
2336
|
}
|
|
2325
|
-
function
|
|
2326
|
-
return e === "none" ? null : e && typeof e == "object" ? e.current ??
|
|
2337
|
+
function ct(t, e) {
|
|
2338
|
+
return e === "none" ? null : e && typeof e == "object" ? e.current ?? t : typeof e == "string" && e !== "first" && e !== "container" ? t.querySelector(e) ?? t : e === "container" ? t : t.querySelector("[autofocus],[data-autofocus]") ?? U(t)[0] ?? t;
|
|
2327
2339
|
}
|
|
2328
|
-
const
|
|
2329
|
-
function
|
|
2330
|
-
let e =
|
|
2340
|
+
const $n = '[role="listbox"],[role="menu"],[role="dialog"],[role="alertdialog"],[role="grid"],[role="tree"],[data-nice-popup]', lt = /* @__PURE__ */ new WeakMap();
|
|
2341
|
+
function ut(t) {
|
|
2342
|
+
let e = lt.get(t);
|
|
2331
2343
|
if (!e) {
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2344
|
+
const n = { current: t.activeElement, previous: null };
|
|
2345
|
+
t.addEventListener(
|
|
2334
2346
|
"focusin",
|
|
2335
2347
|
(a) => {
|
|
2336
|
-
a.target !==
|
|
2348
|
+
a.target !== n.current && (n.previous = n.current, n.current = a.target);
|
|
2337
2349
|
},
|
|
2338
2350
|
!0
|
|
2339
|
-
),
|
|
2351
|
+
), lt.set(t, n), e = n;
|
|
2340
2352
|
}
|
|
2341
2353
|
return e;
|
|
2342
2354
|
}
|
|
2343
|
-
function
|
|
2344
|
-
var
|
|
2345
|
-
let e =
|
|
2346
|
-
for (; e.parentNode && e.parentNode !== ((
|
|
2355
|
+
function dt(t) {
|
|
2356
|
+
var n;
|
|
2357
|
+
let e = t;
|
|
2358
|
+
for (; e.parentNode && e.parentNode !== ((n = e.ownerDocument) == null ? void 0 : n.body); )
|
|
2347
2359
|
e = e.parentNode;
|
|
2348
2360
|
return e;
|
|
2349
2361
|
}
|
|
2350
|
-
function
|
|
2351
|
-
return
|
|
2362
|
+
function Yn(t, e) {
|
|
2363
|
+
return t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING ? dt(e) !== dt(t) || e instanceof Element && e.closest($n) !== null : !1;
|
|
2352
2364
|
}
|
|
2353
|
-
function
|
|
2354
|
-
!
|
|
2365
|
+
function ht(t) {
|
|
2366
|
+
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
|
|
2355
2367
|
}
|
|
2356
|
-
function
|
|
2357
|
-
const { open:
|
|
2368
|
+
function Wn(t, e) {
|
|
2369
|
+
const { open: n, modal: a = !0, restoreFocus: r = !0, closeHint: s } = e, o = O(e);
|
|
2358
2370
|
o.current = e;
|
|
2359
2371
|
const i = K(), { t: c } = J();
|
|
2360
2372
|
R(() => {
|
|
2361
|
-
typeof document < "u" &&
|
|
2373
|
+
typeof document < "u" && ut(document);
|
|
2362
2374
|
}, []);
|
|
2363
2375
|
const d = !!e.onClose && e.closeOnEscape !== !1;
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2376
|
+
Lt(
|
|
2377
|
+
t,
|
|
2378
|
+
n && d && s !== !1 ? [{ intent: "back", label: s ?? c("input.hint.close", "Close") }] : [],
|
|
2367
2379
|
{ fallback: !0 }
|
|
2368
2380
|
), B(
|
|
2369
|
-
|
|
2381
|
+
t,
|
|
2370
2382
|
(u) => {
|
|
2371
|
-
if (!
|
|
2383
|
+
if (!n || !i)
|
|
2372
2384
|
return;
|
|
2373
|
-
const h = u.ownerDocument, l = h.activeElement, p =
|
|
2385
|
+
const h = u.ownerDocument, l = h.activeElement, p = ut(h), w = (E) => E instanceof HTMLElement && E !== h.body && !u.contains(E);
|
|
2374
2386
|
let k = null;
|
|
2375
2387
|
w(l) ? k = l : l && u.contains(l) ? k = w(p.previous) ? p.previous : null : w(p.current) && (k = p.current);
|
|
2376
|
-
const
|
|
2388
|
+
const z = (E) => {
|
|
2377
2389
|
const { onClose: g, closeOnEscape: v } = o.current;
|
|
2378
2390
|
g && v !== !1 && g(E);
|
|
2379
|
-
},
|
|
2391
|
+
}, N = {
|
|
2380
2392
|
element: u,
|
|
2381
2393
|
modal: a,
|
|
2382
|
-
onClose: o.current.onClose && o.current.closeOnEscape !== !1 ?
|
|
2383
|
-
},
|
|
2394
|
+
onClose: o.current.onClose && o.current.closeOnEscape !== !1 ? z : void 0
|
|
2395
|
+
}, L = i.pushOverlay(N), m = ["data-nice-focus-scope", "data-nice-scope-trap"], A = m.map((E) => u.getAttribute(E));
|
|
2384
2396
|
if (u.setAttribute("data-nice-focus-scope", "spatial"), a && u.setAttribute("data-nice-scope-trap", ""), !u.contains(h.activeElement)) {
|
|
2385
|
-
const E =
|
|
2386
|
-
E &&
|
|
2397
|
+
const E = ct(u, o.current.initialFocus);
|
|
2398
|
+
E && ht(E);
|
|
2387
2399
|
}
|
|
2388
2400
|
const y = (E) => {
|
|
2389
2401
|
if (E.defaultPrevented)
|
|
2390
2402
|
return;
|
|
2391
2403
|
if (E.key === "Escape" || E.key === "Esc") {
|
|
2392
|
-
i.topOverlay() ===
|
|
2404
|
+
i.topOverlay() === N && N.onClose && (E.preventDefault(), N.onClose(E.niceSource ?? "keyboard"));
|
|
2393
2405
|
return;
|
|
2394
2406
|
}
|
|
2395
2407
|
if (E.key !== "Tab" || !a)
|
|
@@ -2403,24 +2415,24 @@ function Yn(n, e) {
|
|
|
2403
2415
|
E.shiftKey && (f === v || f === u) ? (E.preventDefault(), M.focus()) : !E.shiftKey && f === M && (E.preventDefault(), v.focus());
|
|
2404
2416
|
};
|
|
2405
2417
|
u.addEventListener("keydown", y);
|
|
2406
|
-
let
|
|
2418
|
+
let S = u.contains(h.activeElement);
|
|
2407
2419
|
const T = (E) => {
|
|
2408
2420
|
const g = E.target;
|
|
2409
|
-
|
|
2421
|
+
S = !!g && u.contains(g), !(!a || !g || u.contains(g) || i.topOverlay() !== N) && (Yn(u, g) || ht(ct(u, o.current.initialFocus) ?? u));
|
|
2410
2422
|
};
|
|
2411
2423
|
return h.addEventListener("focusin", T), () => {
|
|
2412
|
-
u.removeEventListener("keydown", y), h.removeEventListener("focusin", T),
|
|
2424
|
+
u.removeEventListener("keydown", y), h.removeEventListener("focusin", T), L(), m.forEach((v, M) => {
|
|
2413
2425
|
const f = A[M];
|
|
2414
2426
|
f === null ? u.removeAttribute(v) : u.setAttribute(v, f);
|
|
2415
2427
|
});
|
|
2416
|
-
const E = h.activeElement, g = u.contains(E) || (!E || E === h.body) &&
|
|
2428
|
+
const E = h.activeElement, g = u.contains(E) || (!E || E === h.body) && S;
|
|
2417
2429
|
r && k && k.isConnected && g && k.focus({ preventScroll: !0 });
|
|
2418
2430
|
};
|
|
2419
2431
|
},
|
|
2420
|
-
[
|
|
2432
|
+
[n, a, r, i]
|
|
2421
2433
|
);
|
|
2422
2434
|
}
|
|
2423
|
-
const
|
|
2435
|
+
const Xn = {
|
|
2424
2436
|
Enter: ["Enter", "input.key.enter"],
|
|
2425
2437
|
Escape: ["Esc", "input.key.escape"],
|
|
2426
2438
|
Space: ["Space", "input.key.space"],
|
|
@@ -2435,16 +2447,16 @@ const Wn = {
|
|
|
2435
2447
|
Ctrl: ["Ctrl", "input.key.ctrl"],
|
|
2436
2448
|
Alt: ["Alt", "input.key.alt"],
|
|
2437
2449
|
Shift: ["Shift", "input.key.shift"]
|
|
2438
|
-
},
|
|
2450
|
+
}, Jn = {
|
|
2439
2451
|
ArrowUp: ["arrow-up", "Up arrow", "input.key.arrowUp"],
|
|
2440
2452
|
ArrowDown: ["arrow-down", "Down arrow", "input.key.arrowDown"],
|
|
2441
2453
|
ArrowLeft: ["arrow-left", "Left arrow", "input.key.arrowLeft"],
|
|
2442
2454
|
ArrowRight: ["arrow-right", "Right arrow", "input.key.arrowRight"]
|
|
2443
|
-
},
|
|
2455
|
+
}, Zn = {
|
|
2444
2456
|
Ctrl: ["key-command", "Command", "input.key.command"],
|
|
2445
2457
|
Alt: ["key-option", "Option", "input.key.option"],
|
|
2446
2458
|
Shift: ["key-shift", "Shift", "input.key.shift"]
|
|
2447
|
-
},
|
|
2459
|
+
}, Vt = {
|
|
2448
2460
|
Cmd: "Ctrl",
|
|
2449
2461
|
Meta: "Ctrl",
|
|
2450
2462
|
Mod: "Ctrl",
|
|
@@ -2453,77 +2465,77 @@ const Wn = {
|
|
|
2453
2465
|
Esc: "Escape",
|
|
2454
2466
|
" ": "Space"
|
|
2455
2467
|
};
|
|
2456
|
-
function
|
|
2457
|
-
var
|
|
2468
|
+
function Qn() {
|
|
2469
|
+
var n;
|
|
2458
2470
|
if (typeof navigator > "u")
|
|
2459
2471
|
return !1;
|
|
2460
|
-
const
|
|
2472
|
+
const t = navigator, e = ((n = t.userAgentData) == null ? void 0 : n.platform) || t.platform || t.userAgent;
|
|
2461
2473
|
return /mac|iphone|ipad|ipod/i.test(e);
|
|
2462
2474
|
}
|
|
2463
|
-
function
|
|
2464
|
-
return (
|
|
2475
|
+
function xe(t) {
|
|
2476
|
+
return (t.endsWith("++") ? [...t.slice(0, -2).split("+"), "+"] : t.split("+")).filter(Boolean).map((n) => Vt[n] ?? n);
|
|
2465
2477
|
}
|
|
2466
|
-
function
|
|
2478
|
+
function qa(t) {
|
|
2467
2479
|
return [
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2480
|
+
t.primary ? "Ctrl" : "",
|
|
2481
|
+
t.alt ? "Alt" : "",
|
|
2482
|
+
t.shift ? "Shift" : "",
|
|
2483
|
+
t.key
|
|
2472
2484
|
].filter(Boolean).join("+");
|
|
2473
2485
|
}
|
|
2474
|
-
function
|
|
2475
|
-
const
|
|
2486
|
+
function ft(t, e) {
|
|
2487
|
+
const n = Vt[t] ?? t, a = (e ? Zn[n] : void 0) ?? Jn[n];
|
|
2476
2488
|
if (a)
|
|
2477
2489
|
return { icon: a[0], spoken: a[1], spokenKey: a[2] };
|
|
2478
|
-
const r =
|
|
2490
|
+
const r = Xn[n];
|
|
2479
2491
|
if (r)
|
|
2480
2492
|
return { text: r[0], textKey: r[1], spoken: r[0], spokenKey: r[1] };
|
|
2481
|
-
const s =
|
|
2493
|
+
const s = n.length === 1 ? n.toUpperCase() : n;
|
|
2482
2494
|
return { text: s, spoken: s };
|
|
2483
2495
|
}
|
|
2484
|
-
const
|
|
2496
|
+
const ea = { sm: 12, md: 14, lg: 18 }, ta = /* @__PURE__ */ Object.assign(
|
|
2485
2497
|
function({
|
|
2486
2498
|
keys: e,
|
|
2487
|
-
size:
|
|
2499
|
+
size: n = "md",
|
|
2488
2500
|
platform: a = "auto",
|
|
2489
2501
|
className: r,
|
|
2490
2502
|
style: s
|
|
2491
2503
|
}) {
|
|
2492
|
-
const { t: o } = J(), i = a === "mac" || a === "auto" &&
|
|
2493
|
-
(u) =>
|
|
2494
|
-
const l =
|
|
2504
|
+
const { t: o } = J(), i = a === "mac" || a === "auto" && Qn(), c = e.split(" ").filter(Boolean), d = c.map(
|
|
2505
|
+
(u) => xe(u).map((h) => {
|
|
2506
|
+
const l = ft(h, i);
|
|
2495
2507
|
return l.spokenKey ? o(l.spokenKey, l.spoken) : l.spoken;
|
|
2496
2508
|
}).join(" + ")
|
|
2497
2509
|
).join(", ");
|
|
2498
|
-
return /* @__PURE__ */
|
|
2510
|
+
return /* @__PURE__ */ C(
|
|
2499
2511
|
"kbd",
|
|
2500
2512
|
{
|
|
2501
|
-
className: `nice-keycap nice-keycap--${
|
|
2513
|
+
className: `nice-keycap nice-keycap--${n}${r ? ` ${r}` : ""}`,
|
|
2502
2514
|
style: s,
|
|
2503
2515
|
role: "img",
|
|
2504
2516
|
"aria-label": d,
|
|
2505
|
-
children: c.map((u, h) => /* @__PURE__ */
|
|
2506
|
-
const w =
|
|
2507
|
-
return /* @__PURE__ */ V(
|
|
2508
|
-
p > 0 && !i && /* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2517
|
+
children: c.map((u, h) => /* @__PURE__ */ C("span", { className: "nice-keycap__chord", "aria-hidden": "true", children: xe(u).map((l, p) => {
|
|
2518
|
+
const w = ft(l, i);
|
|
2519
|
+
return /* @__PURE__ */ V(Ne.Fragment, { children: [
|
|
2520
|
+
p > 0 && !i && /* @__PURE__ */ C("span", { className: "nice-keycap__plus", children: "+" }),
|
|
2521
|
+
/* @__PURE__ */ C("span", { className: "nice-keycap__key", children: w.icon ? /* @__PURE__ */ C(ee, { name: w.icon, size: ea[n] }) : w.textKey ? o(w.textKey, w.text ?? "") : w.text })
|
|
2510
2522
|
] }, p);
|
|
2511
2523
|
}) }, h))
|
|
2512
2524
|
}
|
|
2513
2525
|
);
|
|
2514
2526
|
},
|
|
2515
2527
|
{ displayName: "NiceKeyCap" }
|
|
2516
|
-
), he = { sm: 16, md: 20, lg: 28 },
|
|
2528
|
+
), he = { sm: 16, md: 20, lg: 28 }, na = {
|
|
2517
2529
|
up: "ArrowUp",
|
|
2518
2530
|
down: "ArrowDown",
|
|
2519
2531
|
left: "ArrowLeft",
|
|
2520
2532
|
right: "ArrowRight"
|
|
2521
|
-
},
|
|
2533
|
+
}, aa = {
|
|
2522
2534
|
up: "dpadUp",
|
|
2523
2535
|
down: "dpadDown",
|
|
2524
2536
|
left: "dpadLeft",
|
|
2525
2537
|
right: "dpadRight"
|
|
2526
|
-
},
|
|
2538
|
+
}, ra = /* @__PURE__ */ new Set([
|
|
2527
2539
|
"south",
|
|
2528
2540
|
"east",
|
|
2529
2541
|
"west",
|
|
@@ -2534,14 +2546,14 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
|
|
|
2534
2546
|
"dpadRight",
|
|
2535
2547
|
"leftStick",
|
|
2536
2548
|
"rightStick"
|
|
2537
|
-
]),
|
|
2549
|
+
]), pt = {
|
|
2538
2550
|
activate: ["remote-ok", "OK", "input.remote.ok"],
|
|
2539
2551
|
back: ["remote-back", "Back", "input.intent.back"],
|
|
2540
2552
|
menu: ["remote-menu", "Menu", "input.intent.menu"]
|
|
2541
|
-
},
|
|
2553
|
+
}, Ft = /* @__PURE__ */ Object.assign(
|
|
2542
2554
|
function({
|
|
2543
2555
|
intent: e,
|
|
2544
|
-
direction:
|
|
2556
|
+
direction: n,
|
|
2545
2557
|
button: a,
|
|
2546
2558
|
keys: r,
|
|
2547
2559
|
label: s,
|
|
@@ -2551,42 +2563,42 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
|
|
|
2551
2563
|
className: d,
|
|
2552
2564
|
style: u
|
|
2553
2565
|
}) {
|
|
2554
|
-
const { t: h } = J(), l =
|
|
2555
|
-
let
|
|
2556
|
-
if (p === "remote" && e &&
|
|
2557
|
-
const [m, A, y] =
|
|
2558
|
-
|
|
2566
|
+
const { t: h } = J(), l = Rt(), p = o !== "auto" ? o : l.method === "gamepad" || l.method === "remote" ? l.method : "keyboard", w = l.preferences.glyphFamily, k = i ?? (w !== "auto" ? w : l.family ?? "xbox"), z = `nice-button-prompt nice-button-prompt--${c}${d ? ` ${d}` : ""}`, N = s !== void 0 && /* @__PURE__ */ C("span", { className: "nice-button-prompt__label", children: s });
|
|
2567
|
+
let L = null;
|
|
2568
|
+
if (p === "remote" && e && pt[e]) {
|
|
2569
|
+
const [m, A, y] = pt[e];
|
|
2570
|
+
L = /* @__PURE__ */ C("span", { className: "nice-button-prompt__glyph", role: "img", "aria-label": h(y, A), children: /* @__PURE__ */ C(ee, { name: m, size: he[c] }) });
|
|
2559
2571
|
} else if (p === "gamepad" || p === "remote") {
|
|
2560
|
-
let m = a ?
|
|
2561
|
-
if (!m && e === "navigate" ? m =
|
|
2562
|
-
|
|
2572
|
+
let m = a ? un(a) : null;
|
|
2573
|
+
if (!m && e === "navigate" ? m = n ? aa[n] : null : !m && e && (m = Ee(l.preferences, k)[e][0] ?? null), !m && e === "navigate")
|
|
2574
|
+
L = /* @__PURE__ */ C(
|
|
2563
2575
|
"span",
|
|
2564
2576
|
{
|
|
2565
2577
|
className: "nice-button-prompt__glyph",
|
|
2566
2578
|
role: "img",
|
|
2567
2579
|
"aria-label": h("input.pad.dpad", "D-pad"),
|
|
2568
|
-
children: /* @__PURE__ */
|
|
2580
|
+
children: /* @__PURE__ */ C(ee, { name: "pad-dpad", size: he[c] })
|
|
2569
2581
|
}
|
|
2570
2582
|
);
|
|
2571
2583
|
else if (m) {
|
|
2572
|
-
const { label: A, key: y } =
|
|
2573
|
-
|
|
2584
|
+
const { label: A, key: y } = vn(k, m), S = y ? h(y, A) : h("input.prompt.button", "Button {name}").replace("{name}", A);
|
|
2585
|
+
L = ra.has(m) ? /* @__PURE__ */ C(
|
|
2574
2586
|
"span",
|
|
2575
2587
|
{
|
|
2576
2588
|
className: `nice-button-prompt__glyph nice-button-prompt__glyph--${k}-${m}`,
|
|
2577
2589
|
role: "img",
|
|
2578
|
-
"aria-label":
|
|
2579
|
-
children: /* @__PURE__ */
|
|
2590
|
+
"aria-label": S,
|
|
2591
|
+
children: /* @__PURE__ */ C(ee, { name: mn(k, m), size: he[c] })
|
|
2580
2592
|
}
|
|
2581
|
-
) : /* @__PURE__ */
|
|
2593
|
+
) : /* @__PURE__ */ C("span", { className: "nice-button-prompt__chip", role: "img", "aria-label": S, children: /* @__PURE__ */ C("span", { "aria-hidden": "true", children: y ? h(y, A) : A }) });
|
|
2582
2594
|
}
|
|
2583
2595
|
} else {
|
|
2584
2596
|
let m = r;
|
|
2585
|
-
!m && e === "navigate" ? m =
|
|
2597
|
+
!m && e === "navigate" ? m = n ? na[n] : "ArrowUp ArrowDown ArrowLeft ArrowRight" : !m && e && (m = (l.preferences.keyboardBindings[e] ?? we[e])[0]), m && (L = /* @__PURE__ */ C(ta, { keys: m, size: c }));
|
|
2586
2598
|
}
|
|
2587
|
-
return !
|
|
2588
|
-
|
|
2589
|
-
|
|
2599
|
+
return !L && !N ? null : /* @__PURE__ */ V("span", { className: z, style: u, "data-device": p, children: [
|
|
2600
|
+
L,
|
|
2601
|
+
N
|
|
2590
2602
|
] });
|
|
2591
2603
|
},
|
|
2592
2604
|
{ displayName: "NiceButtonPrompt" }
|
|
@@ -2599,10 +2611,10 @@ const Qn = { sm: 12, md: 14, lg: 18 }, ea = /* @__PURE__ */ Object.assign(
|
|
|
2599
2611
|
'[role="radio"]',
|
|
2600
2612
|
'[role="treeitem"]',
|
|
2601
2613
|
"[data-nice-roving-item]"
|
|
2602
|
-
].join(","),
|
|
2603
|
-
function
|
|
2614
|
+
].join(","), sa = '[aria-selected="true"],[aria-checked="true"],[aria-pressed="true"],[aria-current]:not([aria-current="false"])', oa = 500;
|
|
2615
|
+
function ia(t, e = {}) {
|
|
2604
2616
|
const {
|
|
2605
|
-
orientation:
|
|
2617
|
+
orientation: n = "horizontal",
|
|
2606
2618
|
itemSelector: a = Ae,
|
|
2607
2619
|
wrap: r = !1,
|
|
2608
2620
|
homeEnd: s = !0,
|
|
@@ -2614,89 +2626,89 @@ function oa(n, e = {}) {
|
|
|
2614
2626
|
u.current = e.onMove;
|
|
2615
2627
|
const h = O(e.activateOnMove);
|
|
2616
2628
|
h.current = e.activateOnMove;
|
|
2617
|
-
const l = K(), p =
|
|
2618
|
-
const
|
|
2619
|
-
return
|
|
2620
|
-
(
|
|
2629
|
+
const l = K(), p = D(() => {
|
|
2630
|
+
const z = t.current;
|
|
2631
|
+
return z ? [...z.querySelectorAll(a)].filter(
|
|
2632
|
+
(N) => N.closest("[data-nice-roving]") === z && !(c && (N.getAttribute("aria-disabled") === "true" || N.disabled))
|
|
2621
2633
|
) : [];
|
|
2622
|
-
}, [
|
|
2623
|
-
const
|
|
2624
|
-
if (
|
|
2634
|
+
}, [t, a, c]), w = D(() => {
|
|
2635
|
+
const z = p();
|
|
2636
|
+
if (z.length === 0)
|
|
2625
2637
|
return;
|
|
2626
|
-
const
|
|
2627
|
-
for (const A of
|
|
2638
|
+
const N = z[0].ownerDocument, m = z.find((A) => A === N.activeElement || A.contains(N.activeElement)) ?? z.find((A) => A.matches(sa)) ?? z.find((A) => A.getAttribute("tabindex") === "0") ?? z[0];
|
|
2639
|
+
for (const A of z) {
|
|
2628
2640
|
const y = A === m ? "0" : "-1";
|
|
2629
2641
|
A.getAttribute("tabindex") !== y && A.setAttribute("tabindex", y);
|
|
2630
2642
|
}
|
|
2631
|
-
}, [p]), k =
|
|
2632
|
-
(
|
|
2643
|
+
}, [p]), k = D(
|
|
2644
|
+
(z) => {
|
|
2633
2645
|
var m;
|
|
2634
|
-
const
|
|
2635
|
-
if (
|
|
2636
|
-
for (const A of
|
|
2637
|
-
A.setAttribute("tabindex", A ===
|
|
2638
|
-
l ? l.focusElement(
|
|
2646
|
+
const N = p(), L = N[z];
|
|
2647
|
+
if (L) {
|
|
2648
|
+
for (const A of N)
|
|
2649
|
+
A.setAttribute("tabindex", A === L ? "0" : "-1");
|
|
2650
|
+
l ? l.focusElement(L) : L.focus(), h.current && ((L.matches('button, a[href], [role="button"]') ? L : L.querySelector("button, a[href]")) ?? L).click(), (m = u.current) == null || m.call(u, L, z);
|
|
2639
2651
|
}
|
|
2640
2652
|
},
|
|
2641
2653
|
[p, l]
|
|
2642
2654
|
);
|
|
2643
2655
|
return B(
|
|
2644
|
-
|
|
2645
|
-
(
|
|
2656
|
+
t,
|
|
2657
|
+
(z) => {
|
|
2646
2658
|
if (!d)
|
|
2647
2659
|
return;
|
|
2648
|
-
|
|
2649
|
-
let
|
|
2650
|
-
const m = (
|
|
2660
|
+
z.setAttribute("data-nice-roving", n), w();
|
|
2661
|
+
let N = "", L;
|
|
2662
|
+
const m = (S) => {
|
|
2651
2663
|
var P;
|
|
2652
|
-
if (
|
|
2664
|
+
if (S.defaultPrevented || S.altKey || S.ctrlKey || S.metaKey)
|
|
2653
2665
|
return;
|
|
2654
|
-
const T = p(), E =
|
|
2666
|
+
const T = p(), E = z.ownerDocument, g = T.findIndex(
|
|
2655
2667
|
(H) => H === E.activeElement || H.contains(E.activeElement)
|
|
2656
2668
|
);
|
|
2657
2669
|
if (g < 0)
|
|
2658
2670
|
return;
|
|
2659
|
-
const v = ((P = E.defaultView) == null ? void 0 : P.getComputedStyle(
|
|
2671
|
+
const v = ((P = E.defaultView) == null ? void 0 : P.getComputedStyle(z).direction) === "rtl";
|
|
2660
2672
|
let M = -1;
|
|
2661
2673
|
const f = (H) => {
|
|
2662
|
-
const
|
|
2663
|
-
return
|
|
2674
|
+
const I = g + H;
|
|
2675
|
+
return I >= 0 && I < T.length ? I : r ? (I + T.length) % T.length : -1;
|
|
2664
2676
|
}, b = {
|
|
2665
2677
|
ArrowUp: "up",
|
|
2666
2678
|
ArrowDown: "down",
|
|
2667
2679
|
ArrowLeft: "left",
|
|
2668
2680
|
ArrowRight: "right"
|
|
2669
|
-
}[
|
|
2681
|
+
}[S.key];
|
|
2670
2682
|
if (b) {
|
|
2671
2683
|
const H = b === "left" || b === "right";
|
|
2672
|
-
if (
|
|
2673
|
-
const
|
|
2684
|
+
if (n === "grid") {
|
|
2685
|
+
const I = It(
|
|
2674
2686
|
X(T[g]),
|
|
2675
2687
|
T.filter((_, F) => F !== g),
|
|
2676
2688
|
X,
|
|
2677
2689
|
b
|
|
2678
2690
|
);
|
|
2679
|
-
M =
|
|
2680
|
-
} else if (
|
|
2681
|
-
let
|
|
2682
|
-
H && v && (
|
|
2691
|
+
M = I ? T.indexOf(I) : -1;
|
|
2692
|
+
} else if (n === "both" || n === "horizontal" && H || n === "vertical" && !H) {
|
|
2693
|
+
let I = b === "down" || b === "right";
|
|
2694
|
+
H && v && (I = !I), M = f(I ? 1 : -1);
|
|
2683
2695
|
} else
|
|
2684
2696
|
return;
|
|
2685
2697
|
if (M < 0)
|
|
2686
2698
|
return;
|
|
2687
|
-
} else if (s && (
|
|
2688
|
-
M =
|
|
2689
|
-
else if (o > 0 && (
|
|
2690
|
-
const H =
|
|
2699
|
+
} else if (s && (S.key === "Home" || S.key === "End"))
|
|
2700
|
+
M = S.key === "Home" ? 0 : T.length - 1;
|
|
2701
|
+
else if (o > 0 && (S.key === "PageUp" || S.key === "PageDown")) {
|
|
2702
|
+
const H = S.key === "PageUp" ? -o : o;
|
|
2691
2703
|
M = Math.max(0, Math.min(T.length - 1, g + H));
|
|
2692
|
-
} else if (i &&
|
|
2693
|
-
clearTimeout(
|
|
2694
|
-
|
|
2695
|
-
},
|
|
2704
|
+
} else if (i && S.key.length === 1 && S.key !== " ") {
|
|
2705
|
+
clearTimeout(L), N += S.key.toLowerCase(), L = setTimeout(() => {
|
|
2706
|
+
N = "";
|
|
2707
|
+
}, oa);
|
|
2696
2708
|
for (let H = 1; H <= T.length; H++) {
|
|
2697
|
-
const
|
|
2698
|
-
if ((T[
|
|
2699
|
-
M =
|
|
2709
|
+
const I = (g + H) % T.length;
|
|
2710
|
+
if ((T[I].getAttribute("aria-label") ?? T[I].textContent ?? "").trim().toLowerCase().startsWith(N)) {
|
|
2711
|
+
M = I;
|
|
2700
2712
|
break;
|
|
2701
2713
|
}
|
|
2702
2714
|
}
|
|
@@ -2704,11 +2716,11 @@ function oa(n, e = {}) {
|
|
|
2704
2716
|
return;
|
|
2705
2717
|
} else
|
|
2706
2718
|
return;
|
|
2707
|
-
|
|
2719
|
+
S.preventDefault(), M !== g && k(M);
|
|
2708
2720
|
}, A = () => w();
|
|
2709
|
-
|
|
2721
|
+
z.addEventListener("keydown", m), z.addEventListener("focusin", A);
|
|
2710
2722
|
const y = typeof MutationObserver > "u" ? null : new MutationObserver(() => w());
|
|
2711
|
-
return y == null || y.observe(
|
|
2723
|
+
return y == null || y.observe(z, {
|
|
2712
2724
|
childList: !0,
|
|
2713
2725
|
subtree: !0,
|
|
2714
2726
|
attributes: !0,
|
|
@@ -2720,33 +2732,33 @@ function oa(n, e = {}) {
|
|
|
2720
2732
|
"disabled"
|
|
2721
2733
|
]
|
|
2722
2734
|
}), () => {
|
|
2723
|
-
clearTimeout(
|
|
2735
|
+
clearTimeout(L), z.removeEventListener("keydown", m), z.removeEventListener("focusin", A), y == null || y.disconnect(), z.removeAttribute("data-nice-roving");
|
|
2724
2736
|
};
|
|
2725
2737
|
},
|
|
2726
|
-
[d,
|
|
2738
|
+
[d, n, r, s, o, i, p, w, k]
|
|
2727
2739
|
), { items: p, focusItem: k, refresh: w };
|
|
2728
2740
|
}
|
|
2729
|
-
function
|
|
2730
|
-
const { ref: a, enabled: r = !0 } =
|
|
2741
|
+
function ca(t, e, n = {}) {
|
|
2742
|
+
const { ref: a, enabled: r = !0 } = n, s = O(e);
|
|
2731
2743
|
s.current = e;
|
|
2732
|
-
const o = typeof
|
|
2744
|
+
const o = typeof t == "string" ? t : t.join(",");
|
|
2733
2745
|
K();
|
|
2734
2746
|
const i = (c) => {
|
|
2735
2747
|
const d = new Set(o.split(",")), u = (h) => {
|
|
2736
2748
|
const l = h;
|
|
2737
2749
|
l.defaultPrevented || !d.has(l.detail.intent) || s.current(l.detail, l) !== !1 && l.preventDefault();
|
|
2738
2750
|
};
|
|
2739
|
-
return c.addEventListener(
|
|
2751
|
+
return c.addEventListener(ze, u), () => c.removeEventListener(ze, u);
|
|
2740
2752
|
};
|
|
2741
2753
|
B(a, (c) => r ? i(c) : void 0, [o, r]), R(() => {
|
|
2742
2754
|
if (!(a || !r))
|
|
2743
2755
|
return i(document);
|
|
2744
2756
|
}, [a, o, r]);
|
|
2745
2757
|
}
|
|
2746
|
-
function
|
|
2747
|
-
const { nav:
|
|
2748
|
-
K(), B(
|
|
2749
|
-
|
|
2758
|
+
function la(t, e = {}) {
|
|
2759
|
+
const { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i } = e;
|
|
2760
|
+
K(), B(t, (c) => zn(c, { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i }), [
|
|
2761
|
+
n,
|
|
2750
2762
|
a,
|
|
2751
2763
|
r,
|
|
2752
2764
|
s,
|
|
@@ -2754,28 +2766,28 @@ function ca(n, e = {}) {
|
|
|
2754
2766
|
i
|
|
2755
2767
|
]);
|
|
2756
2768
|
}
|
|
2757
|
-
function
|
|
2758
|
-
const { kind:
|
|
2769
|
+
function $a(t, e = {}) {
|
|
2770
|
+
const { kind: n = "value", disabled: a = !1, restoreOnCancel: r = !1 } = e, [s, o] = j(!1), i = O(e);
|
|
2759
2771
|
return i.current = e, K(), B(
|
|
2760
|
-
|
|
2772
|
+
t,
|
|
2761
2773
|
(c) => {
|
|
2762
2774
|
const d = c.getAttribute("data-nice-engage");
|
|
2763
|
-
c.setAttribute("data-nice-engage", a ? "none" :
|
|
2775
|
+
c.setAttribute("data-nice-engage", a ? "none" : n), c.toggleAttribute(Me, r);
|
|
2764
2776
|
const u = (h) => {
|
|
2765
|
-
var p, w, k,
|
|
2777
|
+
var p, w, k, z;
|
|
2766
2778
|
if (h.target !== c)
|
|
2767
2779
|
return;
|
|
2768
2780
|
const l = h.detail;
|
|
2769
|
-
o(l.engaged), l.engaged ? (w = (p = i.current).onEngage) == null || w.call(p) : (
|
|
2781
|
+
o(l.engaged), l.engaged ? (w = (p = i.current).onEngage) == null || w.call(p) : (z = (k = i.current).onRelease) == null || z.call(k, l.cancelled);
|
|
2770
2782
|
};
|
|
2771
2783
|
return c.addEventListener(ne, u), () => {
|
|
2772
2784
|
c.removeEventListener(ne, u), c.removeAttribute(Me), d === null ? c.removeAttribute("data-nice-engage") : c.setAttribute("data-nice-engage", d);
|
|
2773
2785
|
};
|
|
2774
2786
|
},
|
|
2775
|
-
[
|
|
2787
|
+
[n, a, r]
|
|
2776
2788
|
), { engaged: s };
|
|
2777
2789
|
}
|
|
2778
|
-
function
|
|
2790
|
+
function Ya(t, e, n) {
|
|
2779
2791
|
const {
|
|
2780
2792
|
open: a,
|
|
2781
2793
|
orientation: r = "vertical",
|
|
@@ -2783,18 +2795,18 @@ function $a(n, e, t) {
|
|
|
2783
2795
|
typeahead: o = !0,
|
|
2784
2796
|
closeOnFocusOut: i = !0,
|
|
2785
2797
|
closeOnOutsidePress: c = !0
|
|
2786
|
-
} =
|
|
2787
|
-
d.current =
|
|
2798
|
+
} = n, d = O(n);
|
|
2799
|
+
d.current = n;
|
|
2788
2800
|
const u = O("first");
|
|
2789
|
-
|
|
2801
|
+
ia(e, { orientation: r, wrap: !0, typeahead: o, itemSelector: s }), Wn(e, {
|
|
2790
2802
|
open: a,
|
|
2791
2803
|
modal: !1,
|
|
2792
2804
|
onClose: () => d.current.onOpenChange(!1)
|
|
2793
2805
|
}), B(
|
|
2794
|
-
|
|
2806
|
+
t,
|
|
2795
2807
|
(h) => {
|
|
2796
2808
|
const l = (p) => {
|
|
2797
|
-
var
|
|
2809
|
+
var z, N;
|
|
2798
2810
|
const w = p.niceSource;
|
|
2799
2811
|
if (p.defaultPrevented || w === "gamepad" || w === "remote" || p.key !== "ArrowDown" && p.key !== "ArrowUp")
|
|
2800
2812
|
return;
|
|
@@ -2803,11 +2815,11 @@ function $a(n, e, t) {
|
|
|
2803
2815
|
return;
|
|
2804
2816
|
}
|
|
2805
2817
|
const k = [
|
|
2806
|
-
...((
|
|
2818
|
+
...((z = e.current) == null ? void 0 : z.querySelectorAll(
|
|
2807
2819
|
d.current.itemSelector ?? Ae
|
|
2808
2820
|
)) ?? []
|
|
2809
2821
|
];
|
|
2810
|
-
(
|
|
2822
|
+
(N = u.current === "last" ? k[k.length - 1] : k[0]) == null || N.focus();
|
|
2811
2823
|
};
|
|
2812
2824
|
return h.addEventListener("keydown", l), () => h.removeEventListener("keydown", l);
|
|
2813
2825
|
},
|
|
@@ -2815,36 +2827,36 @@ function $a(n, e, t) {
|
|
|
2815
2827
|
), B(
|
|
2816
2828
|
e,
|
|
2817
2829
|
(h) => {
|
|
2818
|
-
var
|
|
2830
|
+
var N;
|
|
2819
2831
|
if (!a)
|
|
2820
2832
|
return;
|
|
2821
2833
|
if (u.current === "last") {
|
|
2822
|
-
const
|
|
2823
|
-
(
|
|
2834
|
+
const L = h.querySelectorAll(s);
|
|
2835
|
+
(N = L[L.length - 1]) == null || N.focus();
|
|
2824
2836
|
}
|
|
2825
2837
|
u.current = "first";
|
|
2826
|
-
const l = (
|
|
2827
|
-
const m =
|
|
2828
|
-
|
|
2829
|
-
}, p = (
|
|
2838
|
+
const l = (L) => {
|
|
2839
|
+
const m = L.target;
|
|
2840
|
+
L.defaultPrevented || L.key !== "Enter" && L.key !== " " || !m.matches(s) || m.matches("button, a[href], input, select, textarea") || (L.preventDefault(), m.click());
|
|
2841
|
+
}, p = (L) => {
|
|
2830
2842
|
var m;
|
|
2831
|
-
return !!
|
|
2832
|
-
}, w = (
|
|
2833
|
-
p(
|
|
2834
|
-
}, k = (
|
|
2835
|
-
p(
|
|
2836
|
-
},
|
|
2837
|
-
return h.addEventListener("keydown", l), i && h.addEventListener("focusout", w), c && (
|
|
2838
|
-
h.removeEventListener("keydown", l), h.removeEventListener("focusout", w),
|
|
2843
|
+
return !!L && !h.contains(L) && !((m = t.current) != null && m.contains(L));
|
|
2844
|
+
}, w = (L) => {
|
|
2845
|
+
p(L.relatedTarget) && d.current.onOpenChange(!1);
|
|
2846
|
+
}, k = (L) => {
|
|
2847
|
+
p(L.target) && d.current.onOpenChange(!1);
|
|
2848
|
+
}, z = h.ownerDocument;
|
|
2849
|
+
return h.addEventListener("keydown", l), i && h.addEventListener("focusout", w), c && (z.addEventListener("mousedown", k), z.addEventListener("touchstart", k)), () => {
|
|
2850
|
+
h.removeEventListener("keydown", l), h.removeEventListener("focusout", w), z.removeEventListener("mousedown", k), z.removeEventListener("touchstart", k);
|
|
2839
2851
|
};
|
|
2840
2852
|
},
|
|
2841
2853
|
[a, s, i, c]
|
|
2842
2854
|
);
|
|
2843
2855
|
}
|
|
2844
|
-
const
|
|
2845
|
-
function
|
|
2856
|
+
const ua = 500;
|
|
2857
|
+
function Wa(t, e) {
|
|
2846
2858
|
const {
|
|
2847
|
-
itemSelector:
|
|
2859
|
+
itemSelector: n = '[role="treeitem"]',
|
|
2848
2860
|
rowSelector: a,
|
|
2849
2861
|
typeahead: r = !0,
|
|
2850
2862
|
enabled: s = !0
|
|
@@ -2852,56 +2864,56 @@ function Ya(n, e) {
|
|
|
2852
2864
|
o.current = e;
|
|
2853
2865
|
const i = K();
|
|
2854
2866
|
B(
|
|
2855
|
-
|
|
2867
|
+
t,
|
|
2856
2868
|
(c) => {
|
|
2857
2869
|
if (!s)
|
|
2858
2870
|
return;
|
|
2859
|
-
const d = c.ownerDocument, u = (v) => v instanceof HTMLElement && v.matches(
|
|
2871
|
+
const d = c.ownerDocument, u = (v) => v instanceof HTMLElement && v.matches(n) && c.contains(v), h = () => [...c.querySelectorAll(n)], l = (v) => Number(v.getAttribute("aria-level")) || 0, p = (v) => {
|
|
2860
2872
|
var b;
|
|
2861
|
-
const M = ((b = v.parentElement) == null ? void 0 : b.closest(
|
|
2873
|
+
const M = ((b = v.parentElement) == null ? void 0 : b.closest(n)) ?? null;
|
|
2862
2874
|
if (M && c.contains(M))
|
|
2863
2875
|
return M;
|
|
2864
2876
|
const f = l(v);
|
|
2865
2877
|
if (f < 2)
|
|
2866
2878
|
return null;
|
|
2867
|
-
const
|
|
2868
|
-
for (let P =
|
|
2869
|
-
const H = l(
|
|
2879
|
+
const x = h();
|
|
2880
|
+
for (let P = x.indexOf(v) - 1; P >= 0; P--) {
|
|
2881
|
+
const H = l(x[P]);
|
|
2870
2882
|
if (H === f - 1)
|
|
2871
|
-
return
|
|
2883
|
+
return x[P];
|
|
2872
2884
|
if (H < f - 1)
|
|
2873
2885
|
return null;
|
|
2874
2886
|
}
|
|
2875
2887
|
return null;
|
|
2876
2888
|
}, w = () => {
|
|
2877
|
-
var
|
|
2889
|
+
var x;
|
|
2878
2890
|
const v = [], M = /* @__PURE__ */ new Map(), f = [];
|
|
2879
2891
|
for (const b of h()) {
|
|
2880
2892
|
const P = l(b);
|
|
2881
|
-
let H = ((
|
|
2893
|
+
let H = ((x = b.parentElement) == null ? void 0 : x.closest(n)) ?? null;
|
|
2882
2894
|
H && !c.contains(H) && (H = null), !H && P >= 2 && (H = f[P - 1] ?? null), P > 0 && (f.length = P + 1, f[P] = b);
|
|
2883
|
-
const
|
|
2884
|
-
M.set(b,
|
|
2895
|
+
const I = H ? (M.get(H) ?? !0) && H.getAttribute("aria-expanded") !== "false" : !0;
|
|
2896
|
+
M.set(b, I), I && !b.closest("[hidden],[inert]") && v.push(b);
|
|
2885
2897
|
}
|
|
2886
2898
|
return v;
|
|
2887
2899
|
}, k = (v) => a ? [...v.querySelectorAll(a)].find(
|
|
2888
|
-
(M) => M.closest(
|
|
2889
|
-
) ?? null : null,
|
|
2900
|
+
(M) => M.closest(n) === v
|
|
2901
|
+
) ?? null : null, z = (v) => {
|
|
2890
2902
|
const M = v.getAttribute("aria-label");
|
|
2891
2903
|
if (M)
|
|
2892
2904
|
return M;
|
|
2893
2905
|
const f = k(v);
|
|
2894
|
-
return f ? f.textContent ?? "" : [...v.childNodes].filter((
|
|
2895
|
-
},
|
|
2906
|
+
return f ? f.textContent ?? "" : [...v.childNodes].filter((x) => !(x instanceof Element && x.matches('[role="group"]'))).map((x) => x.textContent ?? "").join("");
|
|
2907
|
+
}, N = () => {
|
|
2896
2908
|
const v = w();
|
|
2897
2909
|
if (v.length === 0)
|
|
2898
2910
|
return;
|
|
2899
|
-
const M = d.activeElement, f = v.find((
|
|
2900
|
-
for (const
|
|
2901
|
-
const b =
|
|
2902
|
-
|
|
2911
|
+
const M = d.activeElement, f = v.find((x) => x === M) ?? v.find((x) => x.getAttribute("aria-selected") === "true") ?? v.find((x) => x.getAttribute("tabindex") === "0") ?? v[0];
|
|
2912
|
+
for (const x of h()) {
|
|
2913
|
+
const b = x === f ? "0" : "-1";
|
|
2914
|
+
x.getAttribute("tabindex") !== b && x.setAttribute("tabindex", b);
|
|
2903
2915
|
}
|
|
2904
|
-
},
|
|
2916
|
+
}, L = (v) => {
|
|
2905
2917
|
for (const M of h())
|
|
2906
2918
|
M.setAttribute("tabindex", M === v ? "0" : "-1");
|
|
2907
2919
|
i ? i.focusElement(v) : v.focus();
|
|
@@ -2911,32 +2923,32 @@ function Ya(n, e) {
|
|
|
2911
2923
|
var _;
|
|
2912
2924
|
if (v.defaultPrevented || v.altKey || v.ctrlKey || v.metaKey || !u(v.target))
|
|
2913
2925
|
return;
|
|
2914
|
-
const M = v.target, f = w(),
|
|
2915
|
-
if (
|
|
2926
|
+
const M = v.target, f = w(), x = f.indexOf(M);
|
|
2927
|
+
if (x < 0)
|
|
2916
2928
|
return;
|
|
2917
2929
|
const b = ((_ = d.defaultView) == null ? void 0 : _.getComputedStyle(c).direction) === "rtl", P = b && v.key === "ArrowLeft" ? "ArrowRight" : b && v.key === "ArrowRight" ? "ArrowLeft" : v.key, H = M.getAttribute("aria-expanded");
|
|
2918
|
-
let
|
|
2930
|
+
let I;
|
|
2919
2931
|
if (P === "ArrowDown")
|
|
2920
|
-
|
|
2932
|
+
I = f[x + 1];
|
|
2921
2933
|
else if (P === "ArrowUp")
|
|
2922
|
-
|
|
2934
|
+
I = f[x - 1];
|
|
2923
2935
|
else if (P === "Home")
|
|
2924
|
-
|
|
2936
|
+
I = f[0];
|
|
2925
2937
|
else if (P === "End")
|
|
2926
|
-
|
|
2938
|
+
I = f[f.length - 1];
|
|
2927
2939
|
else if (P === "ArrowRight") {
|
|
2928
2940
|
if (H === "false") {
|
|
2929
2941
|
v.preventDefault(), o.current.onToggle(M, !0);
|
|
2930
2942
|
return;
|
|
2931
2943
|
}
|
|
2932
|
-
const F = f[
|
|
2933
|
-
|
|
2944
|
+
const F = f[x + 1];
|
|
2945
|
+
I = H === "true" && F && p(F) === M ? F : void 0;
|
|
2934
2946
|
} else if (P === "ArrowLeft") {
|
|
2935
2947
|
if (H === "true") {
|
|
2936
2948
|
v.preventDefault(), o.current.onToggle(M, !1);
|
|
2937
2949
|
return;
|
|
2938
2950
|
}
|
|
2939
|
-
|
|
2951
|
+
I = p(M);
|
|
2940
2952
|
} else if (P === "*") {
|
|
2941
2953
|
v.preventDefault();
|
|
2942
2954
|
const F = p(M);
|
|
@@ -2949,95 +2961,95 @@ function Ya(n, e) {
|
|
|
2949
2961
|
} else if (r && P.length === 1) {
|
|
2950
2962
|
clearTimeout(A), m += P.toLowerCase(), A = setTimeout(() => {
|
|
2951
2963
|
m = "";
|
|
2952
|
-
},
|
|
2964
|
+
}, ua);
|
|
2953
2965
|
for (let F = 1; F <= f.length; F++) {
|
|
2954
|
-
const $ = f[(
|
|
2955
|
-
if (
|
|
2956
|
-
|
|
2966
|
+
const $ = f[(x + F) % f.length];
|
|
2967
|
+
if (z($).trim().toLowerCase().startsWith(m)) {
|
|
2968
|
+
I = $;
|
|
2957
2969
|
break;
|
|
2958
2970
|
}
|
|
2959
2971
|
}
|
|
2960
2972
|
}
|
|
2961
|
-
|
|
2962
|
-
},
|
|
2973
|
+
I && I !== M && (v.preventDefault(), L(I));
|
|
2974
|
+
}, S = (v) => {
|
|
2963
2975
|
const M = u(v.target) ? k(v.target) : null;
|
|
2964
2976
|
M && M.click();
|
|
2965
2977
|
}, T = (v) => {
|
|
2966
2978
|
const M = u(v.target) ? k(v.target) : null;
|
|
2967
2979
|
if (!M)
|
|
2968
2980
|
return;
|
|
2969
|
-
const f = M.getBoundingClientRect(),
|
|
2981
|
+
const f = M.getBoundingClientRect(), x = new MouseEvent("contextmenu", {
|
|
2970
2982
|
bubbles: !0,
|
|
2971
2983
|
cancelable: !0,
|
|
2972
2984
|
clientX: v.clientX || f.left + f.width / 2,
|
|
2973
2985
|
clientY: v.clientY || f.top + f.height / 2
|
|
2974
2986
|
});
|
|
2975
|
-
v.stopPropagation(), M.dispatchEvent(
|
|
2976
|
-
}, E = () =>
|
|
2977
|
-
|
|
2978
|
-
const g = typeof MutationObserver > "u" ? null : new MutationObserver(() =>
|
|
2987
|
+
v.stopPropagation(), M.dispatchEvent(x) || v.preventDefault();
|
|
2988
|
+
}, E = () => N();
|
|
2989
|
+
N(), c.addEventListener("keydown", y), c.addEventListener("click", S), c.addEventListener("contextmenu", T), c.addEventListener("focusin", E);
|
|
2990
|
+
const g = typeof MutationObserver > "u" ? null : new MutationObserver(() => N());
|
|
2979
2991
|
return g == null || g.observe(c, {
|
|
2980
2992
|
childList: !0,
|
|
2981
2993
|
subtree: !0,
|
|
2982
2994
|
attributes: !0,
|
|
2983
2995
|
attributeFilter: ["aria-expanded", "aria-selected", "hidden"]
|
|
2984
2996
|
}), () => {
|
|
2985
|
-
clearTimeout(A), c.removeEventListener("keydown", y), c.removeEventListener("click",
|
|
2997
|
+
clearTimeout(A), c.removeEventListener("keydown", y), c.removeEventListener("click", S), c.removeEventListener("contextmenu", T), c.removeEventListener("focusin", E), g == null || g.disconnect();
|
|
2986
2998
|
};
|
|
2987
2999
|
},
|
|
2988
|
-
[s,
|
|
3000
|
+
[s, n, a, r, i]
|
|
2989
3001
|
);
|
|
2990
3002
|
}
|
|
2991
|
-
const
|
|
2992
|
-
function
|
|
2993
|
-
const { rowSelector:
|
|
3003
|
+
const da = '[role="row"],tr', ha = '[role="gridcell"],[role="columnheader"],[role="rowheader"],td,th', fa = 'button:not([disabled]),a[href],input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled])', pa = 'textarea,select,input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])';
|
|
3004
|
+
function Xa(t, e = {}) {
|
|
3005
|
+
const { rowSelector: n = da, cellSelector: a = ha, pageSize: r = 10, enabled: s = !0 } = e, o = O(e);
|
|
2994
3006
|
o.current = e;
|
|
2995
3007
|
const i = K();
|
|
2996
3008
|
B(
|
|
2997
|
-
|
|
3009
|
+
t,
|
|
2998
3010
|
(c) => {
|
|
2999
3011
|
if (!s)
|
|
3000
3012
|
return;
|
|
3001
3013
|
const d = c.ownerDocument, u = (y) => {
|
|
3002
|
-
var
|
|
3003
|
-
return !!y && y.matches(
|
|
3004
|
-
}, h = () => [...c.querySelectorAll(
|
|
3005
|
-
const
|
|
3006
|
-
return
|
|
3014
|
+
var S;
|
|
3015
|
+
return !!y && y.matches(n) && ((S = y.parentElement) == null ? void 0 : S.closest('[role="grid"],[role="treegrid"]')) === c;
|
|
3016
|
+
}, h = () => [...c.querySelectorAll(n)].filter(u), l = (y) => [...y.children].filter((S) => S.matches(a)), p = (y) => {
|
|
3017
|
+
const S = y.querySelectorAll(fa);
|
|
3018
|
+
return S.length === 1 ? S[0] : y;
|
|
3007
3019
|
}, w = () => h().flatMap((y) => l(y).map(p)), k = (y) => {
|
|
3008
|
-
const
|
|
3009
|
-
return
|
|
3010
|
-
},
|
|
3020
|
+
const S = (y == null ? void 0 : y.closest(a)) ?? null;
|
|
3021
|
+
return S && u(S.parentElement) ? S : null;
|
|
3022
|
+
}, z = () => {
|
|
3011
3023
|
const y = w();
|
|
3012
3024
|
if (y.length === 0)
|
|
3013
3025
|
return;
|
|
3014
|
-
const
|
|
3026
|
+
const S = d.activeElement, T = y.find((E) => E === S || E.contains(S)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
|
|
3015
3027
|
for (const E of y) {
|
|
3016
3028
|
const g = E === T ? "0" : "-1";
|
|
3017
3029
|
E.getAttribute("tabindex") !== g && E.setAttribute("tabindex", g);
|
|
3018
3030
|
}
|
|
3019
|
-
},
|
|
3031
|
+
}, N = (y, S, T) => {
|
|
3020
3032
|
var g, v;
|
|
3021
3033
|
const E = p(y);
|
|
3022
3034
|
for (const M of w())
|
|
3023
3035
|
M.setAttribute("tabindex", M === E ? "0" : "-1");
|
|
3024
|
-
i ? i.focusElement(E) : E.focus(), (v = (g = o.current).onMove) == null || v.call(g, y,
|
|
3025
|
-
},
|
|
3036
|
+
i ? i.focusElement(E) : E.focus(), (v = (g = o.current).onMove) == null || v.call(g, y, S, T);
|
|
3037
|
+
}, L = (y) => {
|
|
3026
3038
|
var P;
|
|
3027
3039
|
if (y.defaultPrevented || y.altKey || y.metaKey)
|
|
3028
3040
|
return;
|
|
3029
|
-
const
|
|
3030
|
-
if (!T || p(T) !==
|
|
3041
|
+
const S = y.target, T = k(S);
|
|
3042
|
+
if (!T || p(T) !== S || S !== T && S.matches(pa))
|
|
3031
3043
|
return;
|
|
3032
|
-
const E = h(), g = E.indexOf(T.parentElement), v = l(E[g]).indexOf(T), M = (H,
|
|
3044
|
+
const E = h(), g = E.indexOf(T.parentElement), v = l(E[g]).indexOf(T), M = (H, I) => {
|
|
3033
3045
|
const _ = E[H] ? l(E[H]) : [];
|
|
3034
3046
|
if (_.length === 0)
|
|
3035
3047
|
return null;
|
|
3036
|
-
const F = Math.min(
|
|
3048
|
+
const F = Math.min(I, _.length - 1);
|
|
3037
3049
|
return [_[F], H, F];
|
|
3038
3050
|
};
|
|
3039
3051
|
let f = null;
|
|
3040
|
-
const
|
|
3052
|
+
const x = ((P = d.defaultView) == null ? void 0 : P.getComputedStyle(c).direction) === "rtl", b = x && y.key === "ArrowLeft" ? "ArrowRight" : x && y.key === "ArrowRight" ? "ArrowLeft" : y.key;
|
|
3041
3053
|
if (y.ctrlKey && (b === "Home" || b === "End"))
|
|
3042
3054
|
f = b === "Home" ? M(0, 0) : M(E.length - 1, Number.MAX_SAFE_INTEGER);
|
|
3043
3055
|
else {
|
|
@@ -3058,67 +3070,67 @@ function Wa(n, e = {}) {
|
|
|
3058
3070
|
else if (b === "PageDown" || b === "PageUp") {
|
|
3059
3071
|
const H = b === "PageDown" ? Math.min(E.length - 1, g + r) : Math.max(0, g - r);
|
|
3060
3072
|
f = H !== g ? M(H, v) : null;
|
|
3061
|
-
} else if ((b === "Enter" || b === " ") &&
|
|
3073
|
+
} else if ((b === "Enter" || b === " ") && S === T && !T.matches("button,a[href]")) {
|
|
3062
3074
|
y.preventDefault(), T.click();
|
|
3063
3075
|
return;
|
|
3064
3076
|
} else
|
|
3065
3077
|
return;
|
|
3066
3078
|
}
|
|
3067
|
-
f && f[0] !== T && (y.preventDefault(),
|
|
3068
|
-
}, m = () =>
|
|
3069
|
-
|
|
3070
|
-
const A = typeof MutationObserver > "u" ? null : new MutationObserver(() =>
|
|
3079
|
+
f && f[0] !== T && (y.preventDefault(), N(...f));
|
|
3080
|
+
}, m = () => z();
|
|
3081
|
+
z(), c.addEventListener("keydown", L), c.addEventListener("focusin", m);
|
|
3082
|
+
const A = typeof MutationObserver > "u" ? null : new MutationObserver(() => z());
|
|
3071
3083
|
return A == null || A.observe(c, {
|
|
3072
3084
|
childList: !0,
|
|
3073
3085
|
subtree: !0,
|
|
3074
3086
|
attributes: !0,
|
|
3075
3087
|
attributeFilter: ["disabled"]
|
|
3076
3088
|
}), () => {
|
|
3077
|
-
c.removeEventListener("keydown",
|
|
3089
|
+
c.removeEventListener("keydown", L), c.removeEventListener("focusin", m), A == null || A.disconnect();
|
|
3078
3090
|
};
|
|
3079
3091
|
},
|
|
3080
|
-
[s,
|
|
3092
|
+
[s, n, a, r, i]
|
|
3081
3093
|
);
|
|
3082
3094
|
}
|
|
3083
|
-
const
|
|
3084
|
-
/* @__PURE__ */
|
|
3095
|
+
const Ja = /* @__PURE__ */ Object.assign(
|
|
3096
|
+
/* @__PURE__ */ Kt(function({ as: e = "div", nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i, children: c, ...d }, u) {
|
|
3085
3097
|
const h = O(null);
|
|
3086
|
-
return
|
|
3098
|
+
return jt(u, () => h.current), la(h, { nav: n, wrap: a, trap: r, enter: s, arrows: o, region: i }), /* @__PURE__ */ C(e, { ref: h, ...d, children: c });
|
|
3087
3099
|
}),
|
|
3088
3100
|
{ displayName: "NiceFocusScope" }
|
|
3089
|
-
), W = /* @__PURE__ */ new Map(),
|
|
3090
|
-
let
|
|
3091
|
-
function
|
|
3092
|
-
|
|
3101
|
+
), W = /* @__PURE__ */ new Map(), Le = /* @__PURE__ */ new Set();
|
|
3102
|
+
let Se = [];
|
|
3103
|
+
function vt() {
|
|
3104
|
+
Se = [...W.values()].map((t) => t.current), Le.forEach((t) => t());
|
|
3093
3105
|
}
|
|
3094
|
-
const Ce = (
|
|
3095
|
-
function
|
|
3096
|
-
return
|
|
3106
|
+
const Ce = (t) => t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
|
|
3107
|
+
function va(t) {
|
|
3108
|
+
return xe(t).map((e) => e === "Ctrl" ? "Control" : e === "Esc" ? "Escape" : e).join("+");
|
|
3097
3109
|
}
|
|
3098
|
-
function
|
|
3110
|
+
function ma(t) {
|
|
3099
3111
|
if (process.env.NODE_ENV === "production")
|
|
3100
3112
|
return;
|
|
3101
|
-
const e = Ce(
|
|
3102
|
-
for (const { current:
|
|
3103
|
-
if (
|
|
3113
|
+
const e = Ce(t.keyboard);
|
|
3114
|
+
for (const { current: n } of W.values()) {
|
|
3115
|
+
if (n.id === t.id || (n.scope ?? "global") !== (t.scope ?? "global") || t.scope === "local" && n.ref !== t.ref)
|
|
3104
3116
|
continue;
|
|
3105
|
-
const a = Ce(
|
|
3106
|
-
(a.length > 0 ||
|
|
3107
|
-
`[nice2dev/input] actions "${
|
|
3117
|
+
const a = Ce(n.keyboard).filter((r) => e.includes(r));
|
|
3118
|
+
(a.length > 0 || t.gamepad && t.gamepad === n.gamepad) && console.warn(
|
|
3119
|
+
`[nice2dev/input] actions "${n.id}" and "${t.id}" share ${a.length > 0 ? a.join(", ") : `the ${t.gamepad} intent`} in the same scope; the inner or later one wins.`
|
|
3108
3120
|
);
|
|
3109
3121
|
}
|
|
3110
3122
|
}
|
|
3111
|
-
function
|
|
3112
|
-
const e = O(
|
|
3113
|
-
e.current =
|
|
3114
|
-
const { id:
|
|
3115
|
-
R(() => (
|
|
3116
|
-
W.get(
|
|
3117
|
-
}), [
|
|
3123
|
+
function Za(t) {
|
|
3124
|
+
const e = O(t);
|
|
3125
|
+
e.current = t;
|
|
3126
|
+
const { id: n, scope: a = "global", ref: r, gamepad: s, hint: o = !0, shortcutTarget: i } = t, c = Ce(t.keyboard).join("|");
|
|
3127
|
+
R(() => (ma(e.current), W.set(n, e), vt(), () => {
|
|
3128
|
+
W.get(n) === e && (W.delete(n), vt());
|
|
3129
|
+
}), [n]);
|
|
3118
3130
|
const d = (u) => {
|
|
3119
3131
|
const h = c.split("|").map(Ht), l = (p) => {
|
|
3120
3132
|
const w = p;
|
|
3121
|
-
if (w.defaultPrevented || !h.some((
|
|
3133
|
+
if (w.defaultPrevented || !h.some((z) => Tt(z, w)))
|
|
3122
3134
|
return;
|
|
3123
3135
|
const k = e.current;
|
|
3124
3136
|
k.when && !k.when() || (w.preventDefault(), k.onTrigger("keyboard"));
|
|
@@ -3130,80 +3142,80 @@ function Ja(n) {
|
|
|
3130
3142
|
]), R(() => {
|
|
3131
3143
|
if (!(a === "local" || !c))
|
|
3132
3144
|
return d(document);
|
|
3133
|
-
}, [c, a]),
|
|
3145
|
+
}, [c, a]), ca(
|
|
3134
3146
|
s ?? "menu",
|
|
3135
3147
|
(u) => {
|
|
3136
3148
|
const h = e.current;
|
|
3137
3149
|
return h.when && !h.when() ? !1 : (h.onTrigger(u.source), !0);
|
|
3138
3150
|
},
|
|
3139
3151
|
{ ref: a === "local" ? r : void 0, enabled: !!s }
|
|
3140
|
-
),
|
|
3152
|
+
), Lt(
|
|
3141
3153
|
a === "local" ? r ?? null : null,
|
|
3142
|
-
s && o ? [{ intent: s, label:
|
|
3154
|
+
s && o ? [{ intent: s, label: t.label, keys: c.split("|")[0] }] : []
|
|
3143
3155
|
), B(
|
|
3144
3156
|
i,
|
|
3145
3157
|
(u) => {
|
|
3146
3158
|
if (!c)
|
|
3147
3159
|
return;
|
|
3148
3160
|
const h = u.getAttribute("aria-keyshortcuts");
|
|
3149
|
-
return u.setAttribute("aria-keyshortcuts", c.split("|").map(
|
|
3161
|
+
return u.setAttribute("aria-keyshortcuts", c.split("|").map(va).join(" ")), () => {
|
|
3150
3162
|
h === null ? u.removeAttribute("aria-keyshortcuts") : u.setAttribute("aria-keyshortcuts", h);
|
|
3151
3163
|
};
|
|
3152
3164
|
},
|
|
3153
3165
|
[c]
|
|
3154
3166
|
);
|
|
3155
3167
|
}
|
|
3156
|
-
function
|
|
3157
|
-
return
|
|
3158
|
-
(
|
|
3159
|
-
() =>
|
|
3160
|
-
() =>
|
|
3168
|
+
function Qa() {
|
|
3169
|
+
return Mt(
|
|
3170
|
+
(t) => (Le.add(t), () => Le.delete(t)),
|
|
3171
|
+
() => Se,
|
|
3172
|
+
() => Se
|
|
3161
3173
|
);
|
|
3162
3174
|
}
|
|
3163
|
-
function
|
|
3175
|
+
function er(t, e = "keyboard") {
|
|
3164
3176
|
var a;
|
|
3165
|
-
const
|
|
3166
|
-
return !
|
|
3177
|
+
const n = (a = W.get(t)) == null ? void 0 : a.current;
|
|
3178
|
+
return !n || n.when && !n.when() ? !1 : (n.onTrigger(e), !0);
|
|
3167
3179
|
}
|
|
3168
|
-
const
|
|
3169
|
-
function
|
|
3180
|
+
const Ma = [];
|
|
3181
|
+
function ga(t, e, n) {
|
|
3170
3182
|
switch (e) {
|
|
3171
3183
|
case "popup":
|
|
3172
3184
|
return [
|
|
3173
|
-
{ intent: "activate", label:
|
|
3174
|
-
{ intent: "back", label:
|
|
3185
|
+
{ intent: "activate", label: n("input.intent.activate", "Select") },
|
|
3186
|
+
{ intent: "back", label: n("input.hint.close", "Close") }
|
|
3175
3187
|
];
|
|
3176
3188
|
case "text":
|
|
3177
3189
|
return [
|
|
3178
|
-
{ intent: "menu", label:
|
|
3179
|
-
{ intent: "back", label:
|
|
3190
|
+
{ intent: "menu", label: n("input.hint.confirm", "Confirm") },
|
|
3191
|
+
{ intent: "back", label: n("input.hint.done", "Done") }
|
|
3180
3192
|
];
|
|
3181
3193
|
case "value":
|
|
3182
|
-
return
|
|
3183
|
-
{ intent: "navigate", label:
|
|
3184
|
-
{ intent: "activate", label:
|
|
3185
|
-
{ intent: "back", label:
|
|
3194
|
+
return Yt(t) ? [
|
|
3195
|
+
{ intent: "navigate", label: n("input.hint.adjust", "Adjust") },
|
|
3196
|
+
{ intent: "activate", label: n("input.hint.done", "Done") },
|
|
3197
|
+
{ intent: "back", label: n("input.hint.cancel", "Cancel") }
|
|
3186
3198
|
] : [
|
|
3187
|
-
{ intent: "navigate", label:
|
|
3188
|
-
{ intent: "back", label:
|
|
3199
|
+
{ intent: "navigate", label: n("input.hint.adjust", "Adjust") },
|
|
3200
|
+
{ intent: "back", label: n("input.hint.done", "Done") }
|
|
3189
3201
|
];
|
|
3190
3202
|
default:
|
|
3191
|
-
return [{ intent: "back", label:
|
|
3203
|
+
return [{ intent: "back", label: n("input.hint.done", "Done") }];
|
|
3192
3204
|
}
|
|
3193
3205
|
}
|
|
3194
|
-
const
|
|
3206
|
+
const tr = /* @__PURE__ */ Object.assign(
|
|
3195
3207
|
function({
|
|
3196
3208
|
position: e = "bottom",
|
|
3197
|
-
visibility:
|
|
3209
|
+
visibility: n = "auto",
|
|
3198
3210
|
automatic: a = !0,
|
|
3199
|
-
hints: r =
|
|
3211
|
+
hints: r = Ma,
|
|
3200
3212
|
max: s = 6,
|
|
3201
3213
|
size: o = "sm",
|
|
3202
3214
|
className: i,
|
|
3203
3215
|
style: c
|
|
3204
3216
|
}) {
|
|
3205
|
-
var
|
|
3206
|
-
const { t: d } = J(), u =
|
|
3217
|
+
var L;
|
|
3218
|
+
const { t: d } = J(), u = Rt(), h = K(), l = an(), [, p] = j(0);
|
|
3207
3219
|
R(() => {
|
|
3208
3220
|
if (!l)
|
|
3209
3221
|
return;
|
|
@@ -3215,26 +3227,26 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3215
3227
|
};
|
|
3216
3228
|
}, [l]);
|
|
3217
3229
|
const w = u.method === "gamepad" || u.method === "remote";
|
|
3218
|
-
if (
|
|
3230
|
+
if (n === "auto" && !u.hintsVisible || n === "pad" && !(u.hintsVisible && (w || u.preferences.hints === "always")))
|
|
3219
3231
|
return null;
|
|
3220
3232
|
const k = [...r];
|
|
3221
|
-
if (l && typeof document < "u" && k.push(...
|
|
3233
|
+
if (l && typeof document < "u" && k.push(...nn(l, document)), a && l && l !== document.body) {
|
|
3222
3234
|
const m = ve(l);
|
|
3223
|
-
m &&
|
|
3235
|
+
m && kt(l, m) ? k.push(...ga(l, m, d)) : (k.push({ intent: "navigate", label: d("input.intent.navigate", "Move") }), m ? k.push({ intent: "activate", label: d("input.hint.edit", "Edit") }) : wt(l) && k.push({ intent: "activate", label: d("input.intent.activate", "Select") }), (L = h == null ? void 0 : h.topOverlay()) != null && L.onClose && k.push({ intent: "back", label: d("input.hint.close", "Close") }));
|
|
3224
3236
|
}
|
|
3225
|
-
const
|
|
3237
|
+
const z = [], N = /* @__PURE__ */ new Set();
|
|
3226
3238
|
for (const m of k) {
|
|
3227
3239
|
const A = `${m.intent}:${m.direction ?? ""}`;
|
|
3228
|
-
|
|
3240
|
+
N.has(A) || (N.add(A), z.push(m));
|
|
3229
3241
|
}
|
|
3230
|
-
return
|
|
3242
|
+
return z.length === 0 ? null : /* @__PURE__ */ C(
|
|
3231
3243
|
"div",
|
|
3232
3244
|
{
|
|
3233
3245
|
className: `nice-input-hint-bar nice-input-hint-bar--${e}${i ? ` ${i}` : ""}`,
|
|
3234
3246
|
style: c,
|
|
3235
3247
|
"aria-hidden": "true",
|
|
3236
|
-
children:
|
|
3237
|
-
|
|
3248
|
+
children: z.slice(0, s).map((m) => /* @__PURE__ */ C(
|
|
3249
|
+
Ft,
|
|
3238
3250
|
{
|
|
3239
3251
|
className: "nice-input-hint-bar__item",
|
|
3240
3252
|
intent: m.intent,
|
|
@@ -3250,22 +3262,22 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3250
3262
|
);
|
|
3251
3263
|
},
|
|
3252
3264
|
{ displayName: "NiceInputHintBar" }
|
|
3253
|
-
),
|
|
3265
|
+
), nr = /* @__PURE__ */ Object.assign(
|
|
3254
3266
|
function({
|
|
3255
3267
|
intent: e,
|
|
3256
|
-
direction:
|
|
3268
|
+
direction: n,
|
|
3257
3269
|
button: a,
|
|
3258
3270
|
keys: r,
|
|
3259
3271
|
always: s = !1,
|
|
3260
3272
|
size: o = "sm",
|
|
3261
3273
|
className: i
|
|
3262
3274
|
}) {
|
|
3263
|
-
const c =
|
|
3264
|
-
return !c || !(s || d.hintDensity === "bar-and-controls") ? null : /* @__PURE__ */
|
|
3265
|
-
|
|
3275
|
+
const c = Gn(), [d] = qn();
|
|
3276
|
+
return !c || !(s || d.hintDensity === "bar-and-controls") ? null : /* @__PURE__ */ C("span", { className: `nice-control-hint${i ? ` ${i}` : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ C(
|
|
3277
|
+
Ft,
|
|
3266
3278
|
{
|
|
3267
3279
|
intent: e,
|
|
3268
|
-
direction:
|
|
3280
|
+
direction: n,
|
|
3269
3281
|
button: a,
|
|
3270
3282
|
keys: r,
|
|
3271
3283
|
size: o
|
|
@@ -3273,7 +3285,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3273
3285
|
) });
|
|
3274
3286
|
},
|
|
3275
3287
|
{ displayName: "NiceControlHint" }
|
|
3276
|
-
),
|
|
3288
|
+
), mt = {
|
|
3277
3289
|
en: {
|
|
3278
3290
|
code: "en",
|
|
3279
3291
|
name: "English",
|
|
@@ -3618,12 +3630,12 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3618
3630
|
["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"]
|
|
3619
3631
|
]
|
|
3620
3632
|
}
|
|
3621
|
-
},
|
|
3633
|
+
}, ar = (t) => t === "ar" || t === "he", q = {
|
|
3622
3634
|
value: "Backspace",
|
|
3623
3635
|
label: "⌫",
|
|
3624
3636
|
type: "backspace",
|
|
3625
3637
|
width: 1.5
|
|
3626
|
-
},
|
|
3638
|
+
}, ba = {
|
|
3627
3639
|
value: "Enter",
|
|
3628
3640
|
label: "⏎",
|
|
3629
3641
|
type: "enter",
|
|
@@ -3638,12 +3650,12 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3638
3650
|
label: "⇧",
|
|
3639
3651
|
type: "shift",
|
|
3640
3652
|
width: 1.5
|
|
3641
|
-
},
|
|
3653
|
+
}, ya = {
|
|
3642
3654
|
value: "CapsLock",
|
|
3643
3655
|
label: "⇪",
|
|
3644
3656
|
type: "caps",
|
|
3645
3657
|
width: 1.75
|
|
3646
|
-
},
|
|
3658
|
+
}, wa = { value: "Tab", label: "⇥", type: "tab", width: 1.5 }, fe = [
|
|
3647
3659
|
{ value: "1" },
|
|
3648
3660
|
{ value: "2" },
|
|
3649
3661
|
{ value: "3" },
|
|
@@ -3656,7 +3668,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3656
3668
|
{ value: "0" },
|
|
3657
3669
|
{ value: "-" },
|
|
3658
3670
|
{ value: "=" }
|
|
3659
|
-
],
|
|
3671
|
+
], Ea = [
|
|
3660
3672
|
{ value: "!" },
|
|
3661
3673
|
{ value: "@" },
|
|
3662
3674
|
{ value: "#" },
|
|
@@ -3667,7 +3679,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3667
3679
|
{ value: "*" },
|
|
3668
3680
|
{ value: "(" },
|
|
3669
3681
|
{ value: ")" }
|
|
3670
|
-
],
|
|
3682
|
+
], ka = [
|
|
3671
3683
|
{ value: "-" },
|
|
3672
3684
|
{ value: "_" },
|
|
3673
3685
|
{ value: "=" },
|
|
@@ -3677,7 +3689,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3677
3689
|
{ value: "{" },
|
|
3678
3690
|
{ value: "}" },
|
|
3679
3691
|
q
|
|
3680
|
-
],
|
|
3692
|
+
], za = [
|
|
3681
3693
|
{ value: "Esc", label: "Esc", type: "fn", width: 1 },
|
|
3682
3694
|
{ value: "F1", label: "F1", type: "fn" },
|
|
3683
3695
|
{ value: "F2", label: "F2", type: "fn" },
|
|
@@ -3696,7 +3708,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3696
3708
|
[{ value: "4" }, { value: "5" }, { value: "6" }],
|
|
3697
3709
|
[{ value: "7" }, { value: "8" }, { value: "9" }],
|
|
3698
3710
|
[{ value: ".", width: 1 }, { value: "0" }, q]
|
|
3699
|
-
],
|
|
3711
|
+
], rr = [
|
|
3700
3712
|
[{ value: "7" }, { value: "8" }, { value: "9" }, { value: "/", type: "special" }],
|
|
3701
3713
|
[{ value: "4" }, { value: "5" }, { value: "6" }, { value: "*", type: "special" }],
|
|
3702
3714
|
[{ value: "1" }, { value: "2" }, { value: "3" }, { value: "-", type: "special" }],
|
|
@@ -3706,7 +3718,7 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3706
3718
|
q,
|
|
3707
3719
|
{ value: "=", type: "enter", width: 2 }
|
|
3708
3720
|
]
|
|
3709
|
-
],
|
|
3721
|
+
], sr = [
|
|
3710
3722
|
[
|
|
3711
3723
|
{ value: "1", label: "1" },
|
|
3712
3724
|
{ value: "2", label: "2 ABC" },
|
|
@@ -3728,18 +3740,18 @@ const er = /* @__PURE__ */ Object.assign(
|
|
|
3728
3740
|
{ value: "#", label: "#" }
|
|
3729
3741
|
],
|
|
3730
3742
|
[{ value: "Call", label: "Call", type: "enter", width: 1.5 }, q]
|
|
3731
|
-
],
|
|
3743
|
+
], or = [
|
|
3732
3744
|
[{ value: "1" }, { value: "2" }, { value: "3" }],
|
|
3733
3745
|
[{ value: "4" }, { value: "5" }, { value: "6" }],
|
|
3734
3746
|
[{ value: "7" }, { value: "8" }, { value: "9" }],
|
|
3735
3747
|
[{ value: "Clear", label: "C", type: "fn" }, { value: "0" }, q]
|
|
3736
3748
|
];
|
|
3737
|
-
function
|
|
3738
|
-
const s =
|
|
3749
|
+
function ir(t, e, n, a, r) {
|
|
3750
|
+
const s = mt[t] || mt.en, [o, i, c] = s.rows, d = { ...ba, ...r ? { label: r } : {} };
|
|
3739
3751
|
if (e === "minimal")
|
|
3740
3752
|
return xa;
|
|
3741
|
-
if (
|
|
3742
|
-
const l = [fe.slice(0, 10),
|
|
3753
|
+
if (n) {
|
|
3754
|
+
const l = [fe.slice(0, 10), Ea, ka], p = [{ value: "ABC", label: "ABC", type: "fn", width: 1.5 }];
|
|
3743
3755
|
return a && p.push({ value: "Lang", label: "Lang", type: "lang", width: 1 }), p.push({ value: ",", width: 1 }), p.push({ ...se, width: a ? 3.5 : 4 }), p.push({ value: ".", width: 1 }), p.push(d), l.push(p), l;
|
|
3744
3756
|
}
|
|
3745
3757
|
if (e === "compact") {
|
|
@@ -3760,10 +3772,10 @@ function or(n, e, t, a, r) {
|
|
|
3760
3772
|
return a && p.push({ value: "Lang", label: "Lang", type: "lang", width: 1 }), p.push({ value: ",", width: 1 }), p.push({ ...se, width: a ? 3 : 4 }), p.push({ value: ".", width: 1 }), p.push(d), l.push(p), l;
|
|
3761
3773
|
}
|
|
3762
3774
|
const u = [
|
|
3763
|
-
|
|
3775
|
+
za,
|
|
3764
3776
|
[...fe, q],
|
|
3765
|
-
[
|
|
3766
|
-
[
|
|
3777
|
+
[wa, ...o.map((l) => ({ value: l }))],
|
|
3778
|
+
[ya, ...i.map((l) => ({ value: l })), { ...d, width: 1.75 }],
|
|
3767
3779
|
[
|
|
3768
3780
|
{ ...oe, width: 2.25 },
|
|
3769
3781
|
...c.map((l) => ({ value: l })),
|
|
@@ -3779,137 +3791,137 @@ function or(n, e, t, a, r) {
|
|
|
3779
3791
|
}
|
|
3780
3792
|
return u;
|
|
3781
3793
|
}
|
|
3782
|
-
const Ve = (
|
|
3783
|
-
function
|
|
3784
|
-
const a = Ve(
|
|
3785
|
-
return
|
|
3794
|
+
const Ve = (t, e) => Math.max(0, Math.min(t.length, e));
|
|
3795
|
+
function cr(t, e, n) {
|
|
3796
|
+
const a = Ve(t.text, t.caret), r = t.text.slice(0, a) + e + t.text.slice(a);
|
|
3797
|
+
return n !== void 0 && r.length > n ? t : { text: r, caret: a + e.length };
|
|
3786
3798
|
}
|
|
3787
|
-
function
|
|
3788
|
-
const e = Ve(
|
|
3799
|
+
function lr(t) {
|
|
3800
|
+
const e = Ve(t.text, t.caret);
|
|
3789
3801
|
if (e === 0)
|
|
3790
|
-
return { text:
|
|
3791
|
-
const
|
|
3792
|
-
return { text:
|
|
3802
|
+
return { text: t.text, caret: e };
|
|
3803
|
+
const n = e >= 2 && /[\uDC00-\uDFFF]/.test(t.text[e - 1]) ? 2 : 1;
|
|
3804
|
+
return { text: t.text.slice(0, e - n) + t.text.slice(e), caret: e - n };
|
|
3793
3805
|
}
|
|
3794
|
-
function
|
|
3795
|
-
const
|
|
3796
|
-
return { text:
|
|
3806
|
+
function ur(t, e) {
|
|
3807
|
+
const n = e === "start" ? 0 : e === "end" ? t.text.length : Ve(t.text, t.caret + e);
|
|
3808
|
+
return { text: t.text, caret: n };
|
|
3797
3809
|
}
|
|
3798
|
-
const
|
|
3799
|
-
function
|
|
3800
|
-
let
|
|
3810
|
+
const Aa = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph"]);
|
|
3811
|
+
function dr() {
|
|
3812
|
+
let t = !1;
|
|
3801
3813
|
return (e) => {
|
|
3802
3814
|
if (e.key === "Tab") {
|
|
3803
|
-
const
|
|
3804
|
-
return
|
|
3815
|
+
const n = t;
|
|
3816
|
+
return t = !1, n;
|
|
3805
3817
|
}
|
|
3806
|
-
return
|
|
3818
|
+
return Aa.has(e.key) || (t = e.key === "Escape"), !1;
|
|
3807
3819
|
};
|
|
3808
3820
|
}
|
|
3809
3821
|
export {
|
|
3810
3822
|
U as $,
|
|
3811
|
-
|
|
3823
|
+
wa as A,
|
|
3812
3824
|
Ae as B,
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3825
|
+
nr as C,
|
|
3826
|
+
Ja as D,
|
|
3827
|
+
Fn as E,
|
|
3816
3828
|
Ha as F,
|
|
3817
|
-
|
|
3818
|
-
|
|
3829
|
+
Kn as G,
|
|
3830
|
+
tr as H,
|
|
3819
3831
|
Da as I,
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3832
|
+
Ga as J,
|
|
3833
|
+
_a as K,
|
|
3834
|
+
rn as L,
|
|
3835
|
+
Fa as M,
|
|
3824
3836
|
ee as N,
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3837
|
+
zn as O,
|
|
3838
|
+
ir as P,
|
|
3839
|
+
Tt as Q,
|
|
3840
|
+
Oa as R,
|
|
3841
|
+
qa as S,
|
|
3842
|
+
$t as T,
|
|
3843
|
+
cn as U,
|
|
3844
|
+
dr as V,
|
|
3845
|
+
lr as W,
|
|
3846
|
+
on as X,
|
|
3835
3847
|
ve as Y,
|
|
3836
|
-
|
|
3848
|
+
In as Z,
|
|
3837
3849
|
Dn as _,
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3850
|
+
Ka as a,
|
|
3851
|
+
vn as a0,
|
|
3852
|
+
mn as a1,
|
|
3853
|
+
kn as a2,
|
|
3854
|
+
nn as a3,
|
|
3855
|
+
cr as a4,
|
|
3856
|
+
bn as a5,
|
|
3857
|
+
wt as a6,
|
|
3858
|
+
kt as a7,
|
|
3847
3859
|
te as a8,
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3860
|
+
Qn as a9,
|
|
3861
|
+
ja as aA,
|
|
3862
|
+
Xa as aB,
|
|
3863
|
+
Ra as aC,
|
|
3864
|
+
Gn as aD,
|
|
3853
3865
|
K as aE,
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3866
|
+
Lt as aF,
|
|
3867
|
+
qn as aG,
|
|
3868
|
+
Rt as aH,
|
|
3869
|
+
Ya as aI,
|
|
3870
|
+
Za as aJ,
|
|
3871
|
+
Qa as aK,
|
|
3872
|
+
Ta as aL,
|
|
3873
|
+
Wa as aM,
|
|
3862
3874
|
St as aN,
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3875
|
+
sn as aO,
|
|
3876
|
+
ar as aa,
|
|
3877
|
+
bt as ab,
|
|
3878
|
+
ft as ac,
|
|
3879
|
+
ur as ad,
|
|
3868
3880
|
Re as ae,
|
|
3869
3881
|
Ht as af,
|
|
3870
|
-
|
|
3871
|
-
|
|
3882
|
+
It as ag,
|
|
3883
|
+
Pt as ah,
|
|
3872
3884
|
X as ai,
|
|
3873
|
-
|
|
3885
|
+
En as aj,
|
|
3874
3886
|
Ee as ak,
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3887
|
+
Ye as al,
|
|
3888
|
+
Yt as am,
|
|
3889
|
+
Na as an,
|
|
3890
|
+
Ia as ao,
|
|
3891
|
+
Cn as ap,
|
|
3892
|
+
xe as aq,
|
|
3893
|
+
va as ar,
|
|
3894
|
+
un as as,
|
|
3895
|
+
er as at,
|
|
3896
|
+
Va as au,
|
|
3897
|
+
Ua as av,
|
|
3898
|
+
Ct as aw,
|
|
3899
|
+
$a as ax,
|
|
3900
|
+
la as ay,
|
|
3901
|
+
an as az,
|
|
3902
|
+
Ft as b,
|
|
3903
|
+
Et as c,
|
|
3904
|
+
ta as d,
|
|
3905
|
+
ia as e,
|
|
3906
|
+
ca as f,
|
|
3907
|
+
jn as g,
|
|
3908
|
+
Pa as h,
|
|
3909
|
+
$e as i,
|
|
3898
3910
|
we as j,
|
|
3899
3911
|
ne as k,
|
|
3900
3912
|
de as l,
|
|
3901
3913
|
Y as m,
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3914
|
+
Ba as n,
|
|
3915
|
+
ze as o,
|
|
3916
|
+
mt as p,
|
|
3905
3917
|
xa as q,
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3918
|
+
rr as r,
|
|
3919
|
+
sr as s,
|
|
3920
|
+
or as t,
|
|
3921
|
+
Wn as u,
|
|
3910
3922
|
q as v,
|
|
3911
|
-
|
|
3912
|
-
|
|
3923
|
+
ya as w,
|
|
3924
|
+
ba as x,
|
|
3913
3925
|
oe as y,
|
|
3914
3926
|
se as z
|
|
3915
3927
|
};
|