@nice2dev/ui-erp 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +1650 -335
  2. package/dist/index.mjs +1595 -280
  3. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,11 +1,155 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import ve, { useContext, createContext, useState, useMemo, useCallback, forwardRef, useRef, useEffect } from "react";
2
+ import $e$1, { useContext, createContext, useRef, useState, useEffect, useLayoutEffect, useMemo, useCallback, forwardRef } from "react";
3
3
  const a = (e, t) => t, c = /* @__PURE__ */ createContext(a), i = /* @__PURE__ */ createContext("en");
4
4
  function v() {
5
5
  const e = useContext(c), t = useContext(i);
6
6
  return { t: e, lang: t };
7
7
  }
8
- const tr = {
8
+ const gt = /* @__PURE__ */ new Set([
9
+ "",
10
+ "text",
11
+ "search",
12
+ "email",
13
+ "url",
14
+ "tel",
15
+ "password"
16
+ ]), Pe = /* @__PURE__ */ new Set([
17
+ "number",
18
+ "range",
19
+ "date",
20
+ "time",
21
+ "datetime-local",
22
+ "month",
23
+ "week"
24
+ ]), Ut = /* @__PURE__ */ new Set([
25
+ "checkbox",
26
+ "radio",
27
+ "button",
28
+ "submit",
29
+ "reset",
30
+ "file",
31
+ "image",
32
+ "color"
33
+ ]), Gt = /* @__PURE__ */ new Set([
34
+ "button",
35
+ "link",
36
+ "checkbox",
37
+ "radio",
38
+ "switch",
39
+ "tab",
40
+ "menuitem",
41
+ "menuitemcheckbox",
42
+ "menuitemradio",
43
+ "option",
44
+ "treeitem"
45
+ ]), bt = (n) => n instanceof HTMLInputElement && gt.has(n.type), De = (n) => n instanceof HTMLTextAreaElement, yt = (n) => n instanceof HTMLElement && n.isContentEditable;
46
+ function qt(n, e) {
47
+ const { intent: t, direction: a2 } = e;
48
+ return bt(n) ? t === "navigate" ? a2 === "left" || a2 === "right" : t === "first" || t === "last" || t === "activate" || t === "toggleHints" : De(n) || yt(n) ? t !== "back" && t !== "view" && t !== "menu" && t !== "secondary" : n instanceof HTMLSelectElement ? t !== "back" && t !== "view" && t !== "menu" : n instanceof HTMLInputElement ? Pe.has(n.type) ? t === "navigate" || t === "first" || t === "last" || t === "pagePrev" || t === "pageNext" : n.type === "radio" && t === "navigate" : false;
49
+ }
50
+ function wt(n) {
51
+ if (n instanceof HTMLButtonElement || n.tagName === "SUMMARY")
52
+ return true;
53
+ if (n instanceof HTMLAnchorElement)
54
+ return n.hasAttribute("href");
55
+ if (n instanceof HTMLInputElement)
56
+ return Ut.has(n.type);
57
+ const e = n.getAttribute("role");
58
+ return e !== null && Gt.has(e);
59
+ }
60
+ function $t(n) {
61
+ if (typeof n.click == "function") {
62
+ n.click();
63
+ return;
64
+ }
65
+ const e = n.ownerDocument.defaultView;
66
+ n.dispatchEvent(
67
+ new ((e == null ? void 0 : e.MouseEvent) ?? MouseEvent)("click", {
68
+ bubbles: true,
69
+ cancelable: true,
70
+ composed: true
71
+ })
72
+ );
73
+ }
74
+ function Et(n) {
75
+ if (n.defaultPrevented || n.repeat || n.target !== n.currentTarget || n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar")
76
+ return;
77
+ const e = n.currentTarget;
78
+ if (!e || typeof e.dispatchEvent != "function")
79
+ return;
80
+ n.preventDefault();
81
+ const t = e.ownerDocument.defaultView;
82
+ e.dispatchEvent(
83
+ new ((t == null ? void 0 : t.MouseEvent) ?? MouseEvent)("click", {
84
+ bubbles: true,
85
+ cancelable: true,
86
+ composed: true,
87
+ ctrlKey: !!n.ctrlKey,
88
+ shiftKey: !!n.shiftKey,
89
+ altKey: !!n.altKey,
90
+ metaKey: !!n.metaKey
91
+ })
92
+ );
93
+ }
94
+ function me(n) {
95
+ const e = n.getAttribute("data-nice-engage");
96
+ if (e === "value" || e === "text" || e === "popup" || e === "canvas")
97
+ return e;
98
+ if (e === "none")
99
+ return null;
100
+ const t = n.getAttribute("role");
101
+ return t === "combobox" ? "popup" : t === "slider" || t === "spinbutton" || n instanceof HTMLSelectElement ? "value" : n instanceof HTMLInputElement ? gt.has(n.type) ? n.readOnly ? null : "text" : Pe.has(n.type) && !n.readOnly ? "value" : null : De(n) ? n.readOnly ? null : "text" : yt(n) ? "text" : null;
102
+ }
103
+ function kt(n, e) {
104
+ return e === "popup" ? n.getAttribute("aria-expanded") === "true" : n.hasAttribute("data-nice-engaged");
105
+ }
106
+ function ce(n) {
107
+ return n instanceof HTMLSelectElement || n instanceof HTMLInputElement && Pe.has(n.type);
108
+ }
109
+ function Me(n) {
110
+ n.dispatchEvent(new Event("input", { bubbles: true })), n.dispatchEvent(new Event("change", { bubbles: true }));
111
+ }
112
+ function Ie(n, e) {
113
+ var r;
114
+ const t = Object.getPrototypeOf(n), a2 = (r = Object.getOwnPropertyDescriptor(t, "value")) == null ? void 0 : r.set;
115
+ a2 ? a2.call(n, e) : n.value = e;
116
+ }
117
+ const be = (n) => n instanceof HTMLInputElement && n.type === "number";
118
+ function Wt(n, e) {
119
+ n.value !== e && (Ie(n, e), Me(n));
120
+ }
121
+ function le(n, e, t = "step") {
122
+ const a2 = e === "up" || e === "right";
123
+ if (n instanceof HTMLSelectElement) {
124
+ const s = n.selectedIndex, o = n.options.length - 1;
125
+ if (t === "edge")
126
+ n.selectedIndex = a2 ? o : 0;
127
+ else {
128
+ const i2 = t === "big" ? 10 : 1;
129
+ n.selectedIndex = Math.max(0, Math.min(o, s + (a2 ? i2 : -i2)));
130
+ }
131
+ return n.selectedIndex !== s ? (Me(n), true) : false;
132
+ }
133
+ const r = n.value;
134
+ try {
135
+ if (t === "edge" && (n.min !== "" || n.max !== ""))
136
+ Ie(n, a2 ? n.max || n.value : n.min || n.value);
137
+ else {
138
+ const s = t === "big" ? 10 : 1;
139
+ a2 ? n.stepUp(s) : n.stepDown(s);
140
+ }
141
+ } catch {
142
+ return false;
143
+ }
144
+ return n.value !== r ? (Me(n), true) : false;
145
+ }
146
+ function Xt(n, e) {
147
+ if (!(bt(n) || De(n)) || n.selectionStart === null || e !== "left" && e !== "right")
148
+ return false;
149
+ const t = n.selectionStart + (e === "right" ? 1 : -1), a2 = Math.max(0, Math.min(n.value.length, t));
150
+ return n.setSelectionRange(a2, a2), true;
151
+ }
152
+ const xt = {
9
153
  // Navigation
10
154
  "chevron-down": "M6 9l6 6 6-6",
11
155
  "chevron-up": "M18 15l-6-6-6 6",
@@ -214,77 +358,1215 @@ const tr = {
214
358
  "zoom-out": "M11 4a7 7 0 100 14 7 7 0 000-14z M21 21l-4.35-4.35 M8 11h6",
215
359
  navigation: "M12 2l7 19-7-4-7 4z",
216
360
  "refresh-ccw": "M1 4v6h6 M23 20v-6h-6 M20.49 9A9 9 0 005.64 5.64L1 10 M3.51 15a9 9 0 0014.85 3.36L23 14",
217
- minimize: "M4 14h6v6 M20 10h-6V4 M14 10l7-7 M3 21l7-7"
218
- }, la = {
361
+ minimize: "M4 14h6v6 M20 10h-6V4 M14 10l7-7 M3 21l7-7",
362
+ // 1.2.2: geometry tools and object grouping, drawn as glyphs before (Ntd* of the same names in icons)
363
+ point: "M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z M12 12h.01",
364
+ segment: "M6.5 17.5L17.5 6.5 M3 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0 M17 5a2 2 0 1 0 4 0a2 2 0 1 0-4 0",
365
+ perpendicular: "M3 20h18 M12 20V4 M12 15h5v5",
366
+ parallel: "M4 16L14 6 M10 20L20 10",
367
+ midpoint: "M3 12h6 M15 12h6 M3 9v6 M21 9v6 M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6z",
368
+ "angle-bisector": "M4 20h17 M4 20L16 5 M4 20l14.4-6.9 M10 20a6 6 0 0 0-2.25-4.68",
369
+ group: "M3 7V3h4 M17 3h4v4 M21 17v4h-4 M7 21H3v-4 M7 7h5v5H7z M12 12h5v5h-5z",
370
+ ungroup: "M3 3h8v8H3z M13 13h8v8h-8z",
371
+ // 1.3.0: button and key glyphs of the input prompts (ADR-005 § 8, decision 0.8). Outline here;
372
+ // the filled, coloured Ntd* of @nice2dev/icons carry the same names in its resolver.
373
+ "pad-xbox-a": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.25 16l2.75-8 2.75 8 M10.2 13.25h3.6",
374
+ "pad-xbox-b": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.75 8v8 M9.75 8h2.5a2 2 0 0 1 0 4h-2.5 M9.75 12h3a2 2 0 0 1 0 4h-3",
375
+ "pad-xbox-x": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l5 8 M14.5 8l-5 8",
376
+ "pad-xbox-y": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l2.5 4 2.5-4 M12 12v4",
377
+ "pad-nintendo-a": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.25 16l2.75-8 2.75 8 M10.2 13.25h3.6",
378
+ "pad-nintendo-b": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.75 8v8 M9.75 8h2.5a2 2 0 0 1 0 4h-2.5 M9.75 12h3a2 2 0 0 1 0 4h-3",
379
+ "pad-nintendo-x": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l5 8 M14.5 8l-5 8",
380
+ "pad-nintendo-y": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9.5 8l2.5 4 2.5-4 M12 12v4",
381
+ "pad-playstation-cross": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M9 9l6 6 M15 9l-6 6",
382
+ "pad-playstation-circle": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8.25a3.75 3.75 0 1 0 0 7.5a3.75 3.75 0 1 0 0 -7.5z",
383
+ "pad-playstation-square": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M8.5 8.5h7v7h-7z",
384
+ "pad-playstation-triangle": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8l4.5 7.5h-9z",
385
+ "pad-generic-north": "M12 3a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M12 6h.01 M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
386
+ "pad-generic-east": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 9a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M18 12h.01 M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
387
+ "pad-generic-west": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 9a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M6 12h.01 M12 16.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z",
388
+ "pad-generic-south": "M12 4.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M18 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M6 10.25a1.75 1.75 0 1 0 0 3.5a1.75 1.75 0 1 0 0 -3.5z M12 15a3 3 0 1 0 0 6a3 3 0 1 0 0 -6z M12 18h.01",
389
+ "pad-lb": "M6 9h12a3 3 0 0 1 0 6H6a3 3 0 0 1 0-6z M7.5 12h.01",
390
+ "pad-rb": "M6 9h12a3 3 0 0 1 0 6H6a3 3 0 0 1 0-6z M16.5 12h.01",
391
+ "pad-lt": "M9 3h6a3 3 0 0 1 3 3v7a6 6 0 0 1-12 0V6a3 3 0 0 1 3-3z M9.5 7h.01",
392
+ "pad-rt": "M9 3h6a3 3 0 0 1 3 3v7a6 6 0 0 1-12 0V6a3 3 0 0 1 3-3z M14.5 7h.01",
393
+ "pad-start": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M8.5 8.75h7 M8.5 12h7 M8.5 15.25h7",
394
+ "pad-select": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M7.75 7.75h5.5v5.5h-5.5z M10.75 16.25h5.5v-5.5",
395
+ "pad-home": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M7.95 12L12 8.6l4.05 3.4v4H7.95z",
396
+ "pad-dpad": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z",
397
+ "pad-dpad-up": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M12 5.6l1.15 1.5h-2.3z",
398
+ "pad-dpad-down": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M12 18.4l1.15-1.5h-2.3z",
399
+ "pad-dpad-left": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M5.6 12l1.5-1.15v2.3z",
400
+ "pad-dpad-right": "M9 3h6v6h6v6h-6v6H9v-6H3V9h6z M18.4 12l-1.5-1.15v2.3z",
401
+ "pad-stick-left": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M4.5 12h1",
402
+ "pad-stick-right": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M18.5 12h1",
403
+ "pad-stick-left-press": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M12 12h.01 M4.5 12h1",
404
+ "pad-stick-right-press": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 7.5a4.5 4.5 0 1 0 0 9a4.5 4.5 0 1 0 0 -9z M12 12h.01 M18.5 12h1",
405
+ "remote-ok": "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0 -18z M12 8.5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 1 0 0 -7z",
406
+ "remote-back": "M9 14l-4-4 4-4 M5 10h9a5 5 0 0 1 0 10h-2",
407
+ "remote-menu": "M4 6h16v12H4z M8 10h8 M8 14h8",
408
+ "key-command": "M9 9V6.5A2.5 2.5 0 1 0 6.5 9H9z M9 9h6 M9 9v6 M15 9V6.5A2.5 2.5 0 1 1 17.5 9H15z M15 9v6 M15 15H9 M15 15v2.5a2.5 2.5 0 1 0 2.5-2.5H15z M9 15H6.5A2.5 2.5 0 1 0 9 17.5V15z",
409
+ "key-option": "M4 6h5l6 12h5 M14 6h6",
410
+ "key-shift": "M12 4l-8 8h4v8h8v-8h4z",
411
+ "key-control": "M7 14l5-5 5 5",
412
+ "key-enter": "M20 5v7a3 3 0 0 1-3 3H5 M9 11l-4 4 4 4",
413
+ "key-tab": "M4 12h14 M14 8l4 4-4 4 M20 6v12",
414
+ // on-screen keyboard (1.3.0 H1)
415
+ "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",
416
+ "key-space": "M4 10v4h16v-4",
417
+ "key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
418
+ }, Jt = {
219
419
  xs: 12,
220
420
  sm: 16,
221
421
  md: 20,
222
422
  lg: 24,
223
423
  xl: 32
224
- }, gt = /* @__PURE__ */ createContext({});
225
- function da({
226
- path: e,
227
- size: t,
228
- className: r,
424
+ }, Oe = /* @__PURE__ */ createContext({});
425
+ function Zt({
426
+ path: n,
427
+ size: e,
428
+ className: t,
229
429
  style: a2,
230
- color: n,
231
- title: o,
232
- onClick: s
430
+ color: r,
431
+ title: s,
432
+ onClick: o
233
433
  }) {
234
434
  return /* @__PURE__ */ jsxs(
235
435
  "svg",
236
436
  {
237
437
  xmlns: "http://www.w3.org/2000/svg",
238
- width: t,
239
- height: t,
438
+ width: e,
439
+ height: e,
240
440
  viewBox: "0 0 24 24",
241
441
  fill: "none",
242
- stroke: n || "currentColor",
442
+ stroke: r || "currentColor",
243
443
  strokeWidth: 2,
244
444
  strokeLinecap: "round",
245
445
  strokeLinejoin: "round",
246
- className: `nice-icon ${r || ""}`,
446
+ className: `nice-icon ${t || ""}`,
247
447
  style: a2,
248
- role: o ? "img" : "presentation",
249
- "aria-label": o,
250
- "aria-hidden": !o,
251
- onClick: s,
448
+ role: o ? "button" : s ? "img" : "presentation",
449
+ tabIndex: o ? 0 : void 0,
450
+ onKeyDown: o ? Et : void 0,
451
+ "aria-label": s,
452
+ "aria-hidden": o ? void 0 : !s,
453
+ onClick: o,
252
454
  children: [
253
- o && /* @__PURE__ */ jsx("title", { children: o }),
254
- /* @__PURE__ */ jsx("path", { d: e })
455
+ s && /* @__PURE__ */ jsx("title", { children: s }),
456
+ /* @__PURE__ */ jsx("path", { d: n })
255
457
  ]
256
458
  }
257
459
  );
258
460
  }
259
- const re = ({
260
- name: e,
261
- size: t = "md",
262
- className: r,
461
+ const te = ({
462
+ name: n,
463
+ size: e = "md",
464
+ className: t,
263
465
  style: a2,
264
- color: n,
265
- title: o,
266
- onClick: s
466
+ color: r,
467
+ title: s,
468
+ onClick: o
267
469
  }) => {
268
- const { resolver: i2 } = useContext(gt), c2 = typeof t == "number" ? t : la[t];
470
+ const { resolver: i2 } = useContext(Oe), c2 = typeof e == "number" ? e : Jt[e];
269
471
  if (i2) {
270
- const d = i2(e, c2);
271
- if (d)
272
- return /* @__PURE__ */ jsx("span", { className: `nice-icon-wrap ${r || ""}`, style: a2, onClick: s, children: d });
472
+ const u = i2(n, c2);
473
+ if (u)
474
+ return /* @__PURE__ */ jsx(
475
+ "span",
476
+ {
477
+ role: o ? "button" : void 0,
478
+ tabIndex: o ? 0 : void 0,
479
+ onKeyDown: o ? Et : void 0,
480
+ className: `nice-icon-wrap ${t || ""}`,
481
+ style: a2,
482
+ onClick: o,
483
+ children: u
484
+ }
485
+ );
273
486
  }
274
- const l = tr[e];
275
- return l ? /* @__PURE__ */ jsx(
276
- da,
487
+ const d = xt[n];
488
+ return d ? /* @__PURE__ */ jsx(
489
+ Zt,
277
490
  {
278
- path: l,
491
+ path: d,
279
492
  size: c2,
280
- className: r,
493
+ className: t,
281
494
  style: a2,
282
- color: n,
283
- title: o,
284
- onClick: s
495
+ color: r,
496
+ title: s,
497
+ onClick: o
285
498
  }
286
499
  ) : null;
287
500
  };
501
+ const zt = [
502
+ "a[href]",
503
+ "area[href]",
504
+ "button",
505
+ 'input:not([type="hidden"])',
506
+ "select",
507
+ "textarea",
508
+ "summary",
509
+ "iframe",
510
+ "audio[controls]",
511
+ "video[controls]",
512
+ '[contenteditable]:not([contenteditable="false"])',
513
+ "[tabindex]",
514
+ "[data-nice-focusable]"
515
+ ].join(",");
516
+ function J(n) {
517
+ const e = n.getBoundingClientRect();
518
+ return {
519
+ left: e.left,
520
+ top: e.top,
521
+ right: e.right,
522
+ bottom: e.bottom,
523
+ width: e.width,
524
+ height: e.height
525
+ };
526
+ }
527
+ const _e = (n) => n instanceof HTMLButtonElement || n instanceof HTMLInputElement || n instanceof HTMLSelectElement || n instanceof HTMLTextAreaElement;
528
+ function Qt(n) {
529
+ if (_e(n) && n.disabled || n.getAttribute("aria-disabled") === "true" && !n.hasAttribute("data-nice-focusable"))
530
+ return true;
531
+ const e = n.closest("fieldset[disabled]");
532
+ if (e && _e(n)) {
533
+ const t = e.querySelector(":scope > legend");
534
+ return !(t && t.contains(n));
535
+ }
536
+ return false;
537
+ }
538
+ function en(n) {
539
+ var a2;
540
+ if (n.closest("[hidden]"))
541
+ return false;
542
+ const e = n.getBoundingClientRect();
543
+ if (e.width === 0 && e.height === 0) {
544
+ const r = n.ownerDocument.documentElement.getBoundingClientRect();
545
+ if (r.width !== 0 || r.height !== 0)
546
+ return false;
547
+ }
548
+ const t = (a2 = n.ownerDocument.defaultView) == null ? void 0 : a2.getComputedStyle(n);
549
+ return !t || t.display !== "none" && t.visibility !== "hidden" && t.visibility !== "collapse";
550
+ }
551
+ function tn(n) {
552
+ if (!(n instanceof HTMLInputElement) || n.type !== "radio" || !n.name || n.checked)
553
+ return true;
554
+ const t = [...(n.form ?? n.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
555
+ (a2) => a2.name === n.name
556
+ );
557
+ return !t.some((a2) => a2.checked) && t[0] === n;
558
+ }
559
+ function ne(n) {
560
+ if (!(n instanceof HTMLElement) || !n.matches(zt))
561
+ return false;
562
+ if (!n.hasAttribute("data-nice-focusable")) {
563
+ const e = n.getAttribute("tabindex");
564
+ if (e !== null && Number(e) < 0 || n instanceof HTMLAnchorElement && !n.hasAttribute("href") && e === null)
565
+ return false;
566
+ }
567
+ return n.closest('[inert],[aria-hidden="true"]') || Qt(n) ? false : en(n) && tn(n);
568
+ }
569
+ function U(n, e = []) {
570
+ const t = [];
571
+ for (const a2 of n.querySelectorAll(zt))
572
+ e.some((r) => r && r.contains(a2)) || ne(a2) && t.push(a2);
573
+ return t;
574
+ }
575
+ const Be = typeof window > "u" ? useEffect : useLayoutEffect;
576
+ function _(n, e, t) {
577
+ const a2 = useRef({ el: null, deps: [] }), r = useRef(e);
578
+ r.current = e, Be(() => {
579
+ const s = (n == null ? void 0 : n.current) ?? null, o = a2.current;
580
+ s === o.el && t.length === o.deps.length && t.every((c2, d) => Object.is(c2, o.deps[d])) || (typeof o.cleanup == "function" && o.cleanup(), o.el = s, o.deps = [...t], o.cleanup = s ? r.current(s) : void 0);
581
+ }), Be(
582
+ () => () => {
583
+ const s = a2.current;
584
+ typeof s.cleanup == "function" && s.cleanup(), a2.current = { el: null, deps: [] };
585
+ },
586
+ []
587
+ );
588
+ }
589
+ const Ue = {
590
+ "045e": "xbox",
591
+ "054c": "playstation",
592
+ "057e": "nintendo",
593
+ "28de": "steam"
594
+ };
595
+ function on(n) {
596
+ var a2, r, s;
597
+ const e = n.toLowerCase(), t = ((a2 = /vendor:\s*([0-9a-f]{4})/.exec(e)) == null ? void 0 : a2[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"));
598
+ return t && Ue[t] ? Ue[t] : /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";
599
+ }
600
+ function cn(n, e) {
601
+ return e !== "auto" ? e : n === "nintendo" ? "east" : "south";
602
+ }
603
+ const Ht = ["up", "down", "left", "right"], Ee = {
604
+ navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
605
+ activate: ["Enter", "Space"],
606
+ back: ["Escape"],
607
+ secondary: ["ContextMenu", "Shift+F10"],
608
+ tertiary: [],
609
+ menu: ["Ctrl+K"],
610
+ view: ["F6", "Shift+F6"],
611
+ sectionPrev: ["Ctrl+PageUp"],
612
+ sectionNext: ["Ctrl+PageDown"],
613
+ pagePrev: ["PageUp"],
614
+ pageNext: ["PageDown"],
615
+ first: ["Home"],
616
+ last: ["End"],
617
+ scroll: [],
618
+ toggleHints: ["Shift+?"]
619
+ }, $e = {
620
+ navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
621
+ activate: ["south"],
622
+ back: ["east"],
623
+ secondary: ["west"],
624
+ tertiary: ["north"],
625
+ menu: ["start"],
626
+ view: ["select"],
627
+ sectionPrev: ["leftBumper"],
628
+ sectionNext: ["rightBumper"],
629
+ pagePrev: ["leftTrigger"],
630
+ pageNext: ["rightTrigger"],
631
+ first: [],
632
+ last: [],
633
+ scroll: [],
634
+ toggleHints: ["leftStick"]
635
+ }, Mn = {
636
+ " ": "Space",
637
+ Spacebar: "Space",
638
+ Esc: "Escape",
639
+ Apps: "ContextMenu",
640
+ Up: "ArrowUp",
641
+ Down: "ArrowDown",
642
+ Left: "ArrowLeft",
643
+ Right: "ArrowRight"
644
+ };
645
+ function Ve(n) {
646
+ return Mn[n] ?? n;
647
+ }
648
+ function Nt(n) {
649
+ const e = n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+"), t = e.pop() ?? "", a2 = new Set(e.map((r) => r.toLowerCase()));
650
+ return {
651
+ key: Ve(t),
652
+ primary: a2.has("ctrl") || a2.has("cmd") || a2.has("meta") || a2.has("mod"),
653
+ alt: a2.has("alt") || a2.has("option"),
654
+ shift: a2.has("shift")
655
+ };
656
+ }
657
+ const gn = (n) => n.length === 1 && n.toLowerCase() === n.toUpperCase();
658
+ function Tt(n, e) {
659
+ const t = Ve(e.key);
660
+ return !(t.length === 1 ? t.toLowerCase() === n.key.toLowerCase() : t === n.key) || n.primary !== (e.ctrlKey || e.metaKey) || n.alt !== e.altKey ? false : gn(n.key) || n.shift === e.shiftKey;
661
+ }
662
+ function Ye(n) {
663
+ const e = {};
664
+ for (const t of Object.keys(Ee)) {
665
+ const a2 = n.keyboardBindings[t] ?? Ee[t];
666
+ e[t] = a2.map(Nt);
667
+ }
668
+ return e;
669
+ }
670
+ function bn(n, e) {
671
+ for (const t of Object.keys(e)) {
672
+ const a2 = e[t];
673
+ for (let r = 0; r < a2.length; r++)
674
+ if (Tt(a2[r], n))
675
+ return t === "navigate" ? { intent: t, direction: Ht[r] } : t === "view" ? { intent: t, direction: a2[r].shift ? "up" : "down" } : { intent: t };
676
+ }
677
+ return null;
678
+ }
679
+ const yn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), wn = /* @__PURE__ */ new Set([461, 10009]);
680
+ function En(n) {
681
+ return yn.has(n.key) || wn.has(n.keyCode) ? { intent: "back" } : n.key === "ChannelUp" ? { intent: "sectionNext" } : n.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
682
+ }
683
+ function ke(n, e) {
684
+ const t = cn(e, n.confirmButton), a2 = t === "south" ? "east" : "south", r = {};
685
+ for (const s of Object.keys($e)) {
686
+ const o = n.gamepadBindings[s];
687
+ o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a2] : r[s] = [...$e[s]];
688
+ }
689
+ return r;
690
+ }
691
+ function kn(n) {
692
+ const e = /* @__PURE__ */ new Map();
693
+ for (const t of Object.keys(n))
694
+ n[t].forEach((a2, r) => {
695
+ e.has(a2) || e.set(a2, t === "navigate" ? { intent: t, direction: Ht[r] } : { intent: t });
696
+ });
697
+ return e;
698
+ }
699
+ const se = "data-nice-focus-scope", xe = `[${se}]`;
700
+ function Pt(n) {
701
+ const e = n.getAttribute(se), t = n.getAttribute("data-nice-scope-enter");
702
+ return {
703
+ nav: e === "vertical" || e === "horizontal" || e === "grid" || e === "none" ? e : "spatial",
704
+ wrap: n.hasAttribute("data-nice-scope-wrap"),
705
+ trap: n.hasAttribute("data-nice-scope-trap"),
706
+ enter: t === "selected" || t === "first" ? t : "last"
707
+ };
708
+ }
709
+ function We(n, e) {
710
+ var a2;
711
+ const t = (a2 = n.parentElement) == null ? void 0 : a2.closest(xe);
712
+ return t && e.contains(t) && t !== e ? t : e;
713
+ }
714
+ function zn(n) {
715
+ var t, a2;
716
+ const e = [];
717
+ for (let r = (t = n.parentElement) == null ? void 0 : t.closest(xe); r; r = (a2 = r.parentElement) == null ? void 0 : a2.closest(xe))
718
+ e.push(r);
719
+ return e;
720
+ }
721
+ function An(n) {
722
+ var t;
723
+ const e = (t = n.closest("[data-nice-arrows]")) == null ? void 0 : t.getAttribute("data-nice-arrows");
724
+ return e === "spatial" || e === "native" ? e : null;
725
+ }
726
+ const Xe = { horizontal: 30, vertical: 2 }, G = 1, Je = (n) => n === "left" || n === "right", Ze = (n, e, t, a2) => Math.max(0, Math.max(n, t) - Math.min(e, a2));
727
+ function Sn(n, e, t) {
728
+ switch (t) {
729
+ case "right":
730
+ return e.left >= n.right - G;
731
+ case "left":
732
+ return e.right <= n.left + G;
733
+ case "down":
734
+ return e.top >= n.bottom - G;
735
+ default:
736
+ return e.bottom <= n.top + G;
737
+ }
738
+ }
739
+ function Ln(n, e, t) {
740
+ const a2 = n.left + n.width / 2, r = n.top + n.height / 2, s = e.left + e.width / 2, o = e.top + e.height / 2;
741
+ switch (t) {
742
+ case "right":
743
+ return s > a2 + G;
744
+ case "left":
745
+ return s < a2 - G;
746
+ case "down":
747
+ return o > r + G;
748
+ default:
749
+ return o < r - G;
750
+ }
751
+ }
752
+ function Cn(n, e, t) {
753
+ let a2, r, s;
754
+ Je(t) ? (a2 = t === "right" ? e.left - n.right : n.left - e.right, r = Ze(n.top, n.bottom, e.top, e.bottom), s = Math.abs(e.top + e.height / 2 - (n.top + n.height / 2))) : (a2 = t === "down" ? e.top - n.bottom : n.top - e.bottom, r = Ze(n.left, n.right, e.left, e.right), s = Math.abs(e.left + e.width / 2 - (n.left + n.width / 2)));
755
+ const o = Je(t) ? Xe.horizontal : Xe.vertical;
756
+ return Math.max(0, a2) + r * o + s * 0.01;
757
+ }
758
+ function Dt(n, e, t, a2) {
759
+ const r = e.map(t);
760
+ for (const s of [Sn, Ln]) {
761
+ let o = -1, i2 = 1 / 0;
762
+ for (let c2 = 0; c2 < r.length; c2++) {
763
+ if (!s(n, r[c2], a2))
764
+ continue;
765
+ const d = Cn(n, r[c2], a2);
766
+ d < i2 && (i2 = d, o = c2);
767
+ }
768
+ if (o >= 0)
769
+ return e[o];
770
+ }
771
+ return null;
772
+ }
773
+ const de = (n) => n === "left" || n === "right", Hn = (n) => {
774
+ var e;
775
+ return ((e = n.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(n).direction) === "rtl";
776
+ };
777
+ function Nn(n, e, t, a2) {
778
+ if (n.length === 0)
779
+ return null;
780
+ const r = (s) => !!(e.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
781
+ if (t)
782
+ return n.find(r) ?? (a2 ? n[0] : null);
783
+ for (let s = n.length - 1; s >= 0; s--)
784
+ if (!r(n[s]))
785
+ return n[s];
786
+ return a2 ? n[n.length - 1] : null;
787
+ }
788
+ const Tn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
789
+ function Pn(n, e, t) {
790
+ let a2 = null;
791
+ for (let s = n.parentElement; s && !s.contains(e); s = s.parentElement)
792
+ s.hasAttribute(se) && (a2 = s);
793
+ if (!a2)
794
+ return n;
795
+ const r = Pt(a2).enter;
796
+ if (r === "last") {
797
+ const s = t.get(a2);
798
+ return s && s.isConnected && a2.contains(s) && ne(s) ? s : n;
799
+ }
800
+ return r === "selected" ? [...a2.querySelectorAll(Tn)].find(ne) ?? n : U(a2)[0] ?? n;
801
+ }
802
+ function Dn(n, e, t) {
803
+ const a2 = J(n);
804
+ let r = We(n, t.root), s = null;
805
+ for (; ; ) {
806
+ const o = Pt(r);
807
+ if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !de(e) || o.nav === "horizontal" && de(e)) {
808
+ const c2 = U(r, [n, s]);
809
+ let d;
810
+ if (o.nav === "vertical" || o.nav === "horizontal") {
811
+ let u = e === "down" || e === "right";
812
+ de(e) && Hn(r) && (u = !u), d = Nn(c2, n, u, o.wrap);
813
+ } else
814
+ d = Dt(a2, c2, J, e);
815
+ if (d)
816
+ return Pn(d, n, t.memory);
817
+ }
818
+ if (r === t.root || o.trap)
819
+ return null;
820
+ s = r, r = We(r, t.root);
821
+ }
822
+ }
823
+ function Qe(n, e) {
824
+ const t = e.left + e.width / 2, a2 = e.top + e.height / 2;
825
+ let r = null, s = 1 / 0;
826
+ for (const o of U(n)) {
827
+ const i2 = J(o), c2 = Math.hypot(i2.left + i2.width / 2 - t, i2.top + i2.height / 2 - a2);
828
+ c2 < s && (s = c2, r = o);
829
+ }
830
+ return r;
831
+ }
832
+ const It = [
833
+ "[data-nice-region]",
834
+ "header",
835
+ "nav",
836
+ "main",
837
+ "aside",
838
+ "footer",
839
+ '[role="banner"]',
840
+ '[role="navigation"]',
841
+ '[role="main"]',
842
+ '[role="complementary"]',
843
+ '[role="contentinfo"]',
844
+ '[role="search"]',
845
+ '[role="region"][aria-label]',
846
+ '[role="region"][aria-labelledby]'
847
+ ].join(",");
848
+ function In(n, e, t) {
849
+ const a2 = [...t.root.querySelectorAll(It)], r = a2.filter(
850
+ (u) => !a2.some((p) => p !== u && p.contains(u)) && U(u).length > 0
851
+ );
852
+ if (r.length === 0)
853
+ return null;
854
+ const s = r.findIndex((u) => u.contains(n)), o = e === "up" || e === "left" ? -1 : 1, i2 = s < 0 ? o > 0 ? -1 : 0 : s, c2 = r[(i2 + o + r.length) % r.length];
855
+ if (c2 === r[s])
856
+ return null;
857
+ const d = t.memory.get(c2);
858
+ return d && d.isConnected && c2.contains(d) && ne(d) ? d : U(c2)[0];
859
+ }
860
+ const he = [
861
+ "south",
862
+ "east",
863
+ "west",
864
+ "north",
865
+ "leftBumper",
866
+ "rightBumper",
867
+ "leftTrigger",
868
+ "rightTrigger",
869
+ "select",
870
+ "start",
871
+ "leftStick",
872
+ "rightStick",
873
+ "dpadUp",
874
+ "dpadDown",
875
+ "dpadLeft",
876
+ "dpadRight",
877
+ "home"
878
+ ], ze = "nice-intent", ae = "nice-engagechange", W = {
879
+ confirmButton: "auto",
880
+ gamepadBindings: {},
881
+ keyboardBindings: {},
882
+ stickThreshold: 0.5,
883
+ stickDeadzone: 0.2,
884
+ invertScroll: false,
885
+ repeatDelay: 400,
886
+ repeatInterval: 110,
887
+ repeatIntervalMin: 50,
888
+ hints: "auto",
889
+ hintDensity: "bar",
890
+ glyphFamily: "auto",
891
+ vibration: false,
892
+ arrowNavigation: "auto",
893
+ onScreenKeyboard: "auto"
894
+ }, On = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), Rn = 0.85;
895
+ function Vn(n, e) {
896
+ return Math.abs(n) > Math.abs(e) ? n > 0 ? "right" : "left" : e > 0 ? "down" : "up";
897
+ }
898
+ class Fn {
899
+ constructor(e, t) {
900
+ this.states = /* @__PURE__ */ new Map(), this.connected = /* @__PURE__ */ new Set(), this.warned = /* @__PURE__ */ new Set(), this.started = false, this.frameId = 0, this.onConnected = (a2) => {
901
+ const r = a2.gamepad;
902
+ r && this.connected.add(r.index), this.schedule();
903
+ }, this.onDisconnected = (a2) => {
904
+ var s, o;
905
+ const r = a2.gamepad;
906
+ r && (this.connected.delete(r.index), this.states.delete(r.index) && ((o = (s = this.opts).onPadsChange) == null || o.call(s, this.pads))), this.connected.size === 0 && this.cancel();
907
+ }, this.onVisibility = () => {
908
+ this.win.document.hidden ? this.cancel() : this.schedule();
909
+ }, this.frame = (a2) => {
910
+ this.frameId = 0, this.poll(a2), this.schedule();
911
+ }, this.win = e, this.opts = t;
912
+ }
913
+ /** Whether an animation frame is scheduled (false without a pad or on a hidden page). */
914
+ get running() {
915
+ return this.frameId !== 0;
916
+ }
917
+ get pads() {
918
+ return [...this.states.values()].map((e) => e.info);
919
+ }
920
+ start() {
921
+ if (!this.started) {
922
+ this.started = true, this.win.addEventListener("gamepadconnected", this.onConnected), this.win.addEventListener("gamepaddisconnected", this.onDisconnected), this.win.document.addEventListener("visibilitychange", this.onVisibility);
923
+ for (const e of this.read())
924
+ this.connected.add(e.index);
925
+ this.schedule();
926
+ }
927
+ }
928
+ stop() {
929
+ this.started && (this.started = false, this.win.removeEventListener("gamepadconnected", this.onConnected), this.win.removeEventListener("gamepaddisconnected", this.onDisconnected), this.win.document.removeEventListener("visibilitychange", this.onVisibility), this.cancel(), this.connected.clear(), this.states.clear());
930
+ }
931
+ /** Read every pad once; public so tests can drive a frame. */
932
+ poll(e) {
933
+ var o, i2, c2, d, u, p;
934
+ const t = this.opts.timing(), a2 = /* @__PURE__ */ new Set(), r = this.read();
935
+ for (const l of r) {
936
+ a2.add(l.index);
937
+ let v2 = this.states.get(l.index);
938
+ (!v2 || v2.info.id !== l.id) && (v2 = {
939
+ info: {
940
+ index: l.index,
941
+ id: l.id,
942
+ family: on(l.id),
943
+ mapping: l.mapping
944
+ },
945
+ pressed: [],
946
+ stick: null,
947
+ holds: /* @__PURE__ */ new Map()
948
+ }, this.states.set(l.index, v2), this.warnMapping(l), (i2 = (o = this.opts).onPadsChange) == null || i2.call(o, this.pads)), this.readButtons(v2, l, e, t), this.readSticks(v2, l, e, t);
949
+ }
950
+ let s = false;
951
+ for (const l of [...this.states.keys()])
952
+ a2.has(l) || (this.states.delete(l), s = true);
953
+ s && ((d = (c2 = this.opts).onPadsChange) == null || d.call(c2, this.pads)), (p = (u = this.opts).onFrame) == null || p.call(u, r, e);
954
+ }
955
+ readButtons(e, t, a2, r) {
956
+ for (let s = 0; s < he.length; s++) {
957
+ const o = t.buttons[s], i2 = !!(o && (o.pressed || o.value > 0.5)), c2 = `b${s}`;
958
+ i2 !== !!e.pressed[s] ? (e.pressed[s] = i2, i2 && On.has(s) ? e.holds.set(c2, { since: a2, last: a2, count: 0 }) : e.holds.delete(c2), this.opts.onButton({
959
+ pad: e.info,
960
+ button: he[s],
961
+ pressed: i2,
962
+ repeat: false
963
+ })) : i2 && this.repeats(e, c2, a2, r) && this.opts.onButton({
964
+ pad: e.info,
965
+ button: he[s],
966
+ pressed: i2,
967
+ repeat: true
968
+ });
969
+ }
970
+ }
971
+ readSticks(e, t, a2, r) {
972
+ const s = t.axes[0] ?? 0, o = t.axes[1] ?? 0, i2 = Math.hypot(s, o);
973
+ if (i2 >= r.stickThreshold) {
974
+ const p = Vn(s, o);
975
+ p !== e.stick ? (e.stick = p, e.holds.set("stick", { since: a2, last: a2, count: 0 }), this.opts.onStick({ pad: e.info, direction: p, repeat: false })) : this.repeats(e, "stick", a2, r) && this.opts.onStick({ pad: e.info, direction: p, repeat: true });
976
+ } else e.stick && i2 < r.stickThreshold * 0.7 && (e.stick = null, e.holds.delete("stick"));
977
+ const c2 = t.axes[2] ?? 0, d = t.axes[3] ?? 0, u = Math.hypot(c2, d);
978
+ if (u > r.stickDeadzone) {
979
+ const p = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
980
+ this.opts.onScroll({ pad: e.info, x: c2 * p, y: d * p });
981
+ }
982
+ }
983
+ repeats(e, t, a2, r) {
984
+ const s = e.holds.get(t);
985
+ if (!s || a2 - s.since < r.repeatDelay)
986
+ return false;
987
+ const o = Math.max(
988
+ r.repeatIntervalMin,
989
+ r.repeatInterval * Rn ** s.count
990
+ );
991
+ return a2 - s.last < o ? false : (s.last = a2, s.count++, true);
992
+ }
993
+ read() {
994
+ var a2, r;
995
+ const e = ((r = (a2 = this.win.navigator).getGamepads) == null ? void 0 : r.call(a2)) ?? [], t = [];
996
+ for (const s of e)
997
+ s && s.connected !== false && t.push(s);
998
+ return t;
999
+ }
1000
+ warnMapping(e) {
1001
+ e.mapping === "standard" || this.warned.has(e.id) || (this.warned.add(e.id), process.env.NODE_ENV !== "production" && console.warn(
1002
+ `[nice2dev/input] "${e.id}" has no standard mapping; its buttons are read by standard positions and may be off.`
1003
+ ));
1004
+ }
1005
+ schedule() {
1006
+ this.frameId === 0 && this.started && this.connected.size > 0 && !this.win.document.hidden && typeof this.win.requestAnimationFrame == "function" && (this.frameId = this.win.requestAnimationFrame(this.frame));
1007
+ }
1008
+ cancel() {
1009
+ this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
1010
+ }
1011
+ }
1012
+ const _n = {
1013
+ up: "ArrowUp",
1014
+ down: "ArrowDown",
1015
+ left: "ArrowLeft",
1016
+ right: "ArrowRight"
1017
+ }, et = {
1018
+ ArrowUp: 38,
1019
+ ArrowDown: 40,
1020
+ ArrowLeft: 37,
1021
+ ArrowRight: 39,
1022
+ Enter: 13,
1023
+ Escape: 27,
1024
+ Home: 36,
1025
+ End: 35,
1026
+ PageUp: 33,
1027
+ PageDown: 34
1028
+ }, 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 = (n) => n === "keyboard" || n === "gamepad" || n === "remote";
1029
+ class Kn {
1030
+ constructor(e) {
1031
+ this.started = false, 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 = false, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (t, a2) => a2, this.onKeyDown = (t) => {
1032
+ if (t.niceSource)
1033
+ return;
1034
+ const a2 = En(t), r = this.tv || a2 ? "remote" : "keyboard";
1035
+ if (tt.has(t.key) || this.setMethod(r), this.capture && !tt.has(t.key)) {
1036
+ t.preventDefault();
1037
+ const c2 = [
1038
+ t.ctrlKey || t.metaKey ? "Ctrl" : "",
1039
+ t.altKey ? "Alt" : "",
1040
+ t.shiftKey ? "Shift" : ""
1041
+ ], d = Ve(t.key);
1042
+ this.capture({
1043
+ keys: [...c2, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
1044
+ });
1045
+ return;
1046
+ }
1047
+ if (t.defaultPrevented || t.isComposing)
1048
+ return;
1049
+ const s = a2 ?? bn(t, this.keyTable);
1050
+ if (!s)
1051
+ return;
1052
+ const o = this.targetOf(t);
1053
+ if (qt(o, s))
1054
+ return;
1055
+ const i2 = {
1056
+ intent: s.intent,
1057
+ direction: s.direction,
1058
+ source: r,
1059
+ repeat: t.repeat,
1060
+ keyEvent: t
1061
+ };
1062
+ (this.dispatchIntent(i2, o) || this.keyDefault(i2, o)) && t.preventDefault();
1063
+ }, this.onPadButton = (t) => {
1064
+ if (this.activePad = t.pad, this.setMethod("gamepad", t.pad.family), !t.pressed)
1065
+ return;
1066
+ if (this.capture) {
1067
+ t.repeat || this.capture({ button: t.button });
1068
+ return;
1069
+ }
1070
+ const a2 = this.padMap(t.pad.family).get(t.button);
1071
+ a2 && this.deviceIntent({ ...a2, source: "gamepad", repeat: t.repeat, gamepad: t.pad });
1072
+ }, this.onPadStick = (t) => {
1073
+ this.activePad = t.pad, this.setMethod("gamepad", t.pad.family), !this.capture && this.deviceIntent({
1074
+ intent: "navigate",
1075
+ direction: t.direction,
1076
+ source: "gamepad",
1077
+ repeat: t.repeat,
1078
+ gamepad: t.pad
1079
+ });
1080
+ }, this.onPadScroll = (t) => {
1081
+ this.activePad = t.pad, this.setMethod("gamepad", t.pad.family);
1082
+ const a2 = this.state.preferences.invertScroll ? -1 : 1, r = t.x * a2, s = t.y * a2, o = this.focused(), i2 = {
1083
+ intent: "scroll",
1084
+ direction: Math.abs(r) > Math.abs(s) ? r > 0 ? "right" : "left" : s > 0 ? "down" : "up",
1085
+ amount: Math.min(1, Math.hypot(r, s)),
1086
+ source: "gamepad",
1087
+ repeat: true,
1088
+ gamepad: t.pad
1089
+ };
1090
+ this.dispatchIntent(i2, o) || rt(st(o, r, s), r * nt, s * nt);
1091
+ }, this.onPointerDown = (t) => {
1092
+ this.setMethod(t.pointerType === "touch" ? "touch" : "pointer");
1093
+ }, this.onFocusIn = (t) => {
1094
+ const a2 = t.target;
1095
+ if (a2 instanceof HTMLElement) {
1096
+ for (let r = a2.parentElement; r; r = r.parentElement)
1097
+ (r.hasAttribute(se) || r.matches(It) || r === this.doc.body) && this.memory.set(r, a2);
1098
+ this.lastFocus = { el: a2, rect: J(a2), scope: zn(a2)[0] ?? null };
1099
+ }
1100
+ }, this.onFocusOut = (t) => {
1101
+ const a2 = t.target;
1102
+ a2 instanceof HTMLElement && a2.hasAttribute("data-nice-engaged") && this.release(a2, this.state.method === "gamepad" ? "gamepad" : "keyboard", false);
1103
+ }, this.recover = () => {
1104
+ const t = this.lastFocus;
1105
+ if (!t || t.el.isConnected)
1106
+ return;
1107
+ this.lastFocus = null;
1108
+ const a2 = this.doc.activeElement;
1109
+ if (a2 && a2 !== this.doc.body)
1110
+ return;
1111
+ const r = this.navigationRoot(), s = t.scope && t.scope.isConnected && r.contains(t.scope) ? t.scope : r, o = Qe(s, t.rect) ?? (s !== r ? Qe(r, t.rect) : null);
1112
+ o && this.focusElement(o);
1113
+ }, this.win = e, this.doc = e.document, this.tv = Bn.test(e.navigator.userAgent), this.keyTable = Ye(W), this.state = {
1114
+ method: "pointer",
1115
+ family: null,
1116
+ pads: [],
1117
+ preferences: W,
1118
+ hintsVisible: W.hints === "always"
1119
+ }, this.poller = new Fn(e, {
1120
+ timing: () => this.state.preferences,
1121
+ onButton: this.onPadButton,
1122
+ onStick: this.onPadStick,
1123
+ onScroll: this.onPadScroll,
1124
+ onPadsChange: (t) => {
1125
+ t.length === 0 && (this.snapshot = []), this.update({ pads: t });
1126
+ },
1127
+ onFrame: (t, a2) => {
1128
+ this.snapshot = t, this.frameListeners.forEach((r) => r(t, a2));
1129
+ }
1130
+ });
1131
+ }
1132
+ /* ── Lifecycle ───────────────────────────────────────────────── */
1133
+ get isStarted() {
1134
+ return this.started;
1135
+ }
1136
+ /** Whether the page runs in a TV browser (webOS, Tizen, Android TV, …): remote and 10-foot. */
1137
+ get isTv() {
1138
+ return this.tv;
1139
+ }
1140
+ start() {
1141
+ this.started || (this.started = true, this.tv && !this.doc.documentElement.hasAttribute("data-nice-tv") && this.doc.documentElement.setAttribute("data-nice-tv", "auto"), this.win.addEventListener("keydown", this.onKeyDown), this.win.addEventListener("pointerdown", this.onPointerDown, { capture: true, passive: true }), this.doc.addEventListener("focusin", this.onFocusIn), this.doc.addEventListener("focusout", this.onFocusOut), this.poller.start());
1142
+ }
1143
+ stop() {
1144
+ this.started && (this.started = false, this.win.removeEventListener("keydown", this.onKeyDown), this.win.removeEventListener("pointerdown", this.onPointerDown, { capture: true }), this.doc.removeEventListener("focusin", this.onFocusIn), this.doc.removeEventListener("focusout", this.onFocusOut), this.poller.stop(), this.watchRecovery(false));
1145
+ }
1146
+ /** Whether the gamepad loop is scheduled (false without a pad). */
1147
+ get polling() {
1148
+ return this.poller.running;
1149
+ }
1150
+ /* ── State ───────────────────────────────────────────────────── */
1151
+ /** Same object until something changes (fit for `useSyncExternalStore`). */
1152
+ getState() {
1153
+ return this.state;
1154
+ }
1155
+ subscribe(e) {
1156
+ return this.listeners.add(e), () => this.listeners.delete(e);
1157
+ }
1158
+ setPreferences(e) {
1159
+ const t = { ...this.state.preferences, ...e };
1160
+ this.keyTable = Ye(t), this.padMaps.clear(), this.update({ preferences: t });
1161
+ }
1162
+ /** Words of announcements and labels; the React provider passes the app's translator. */
1163
+ setTranslator(e) {
1164
+ this.translate = e;
1165
+ }
1166
+ /** Pad family of the prompts: the preference, else the pad used last. */
1167
+ get glyphFamily() {
1168
+ const e = this.state.preferences.glyphFamily;
1169
+ return e !== "auto" ? e : this.state.family ?? "xbox";
1170
+ }
1171
+ /** The buttons bound to an intent on a pad of the family (for prompts). */
1172
+ gamepadBinding(e, t = this.glyphFamily) {
1173
+ return ke(this.state.preferences, t)[e];
1174
+ }
1175
+ /** The keys bound to an intent (for prompts), as written in the preferences. */
1176
+ keyboardBinding(e) {
1177
+ return this.keyTable[e];
1178
+ }
1179
+ toggleHints() {
1180
+ this.hintsToggled = !this.hintsToggled, this.update({});
1181
+ }
1182
+ /**
1183
+ * Hands the next pad button or key press to `onInput` instead of acting on it (a bindings
1184
+ * screen); returns what cancels the capture.
1185
+ */
1186
+ captureNextInput(e) {
1187
+ const t = (a2) => {
1188
+ this.capture = null, e(a2);
1189
+ };
1190
+ return this.capture = t, () => {
1191
+ this.capture === t && (this.capture = null);
1192
+ };
1193
+ }
1194
+ update(e) {
1195
+ const t = { ...this.state, ...e }, { hints: a2 } = t.preferences;
1196
+ let r = a2 === "always" ? true : a2 === "never" ? false : at(t.method);
1197
+ this.hintsToggled && (r = !r), t.hintsVisible = r, this.state = t, this.listeners.forEach((s) => s());
1198
+ }
1199
+ setMethod(e, t) {
1200
+ const a2 = this.doc.documentElement;
1201
+ t && a2.getAttribute("data-nice-gamepad") !== t && a2.setAttribute("data-nice-gamepad", t), !(e === this.state.method && (t === void 0 || t === this.state.family)) && (a2.setAttribute("data-nice-input", e), this.watchRecovery(at(e)), this.update(t ? { method: e, family: t } : { method: e }));
1202
+ }
1203
+ /* ── Gamepad frames (games, device testers) ──────────────────── */
1204
+ /** Raw pads every polled frame while a pad is connected. */
1205
+ subscribeGamepadFrames(e) {
1206
+ return this.frameListeners.add(e), () => this.frameListeners.delete(e);
1207
+ }
1208
+ /**
1209
+ * The pads as read in the last polled frame — empty without a pad. For code that runs its own
1210
+ * animation loop (games, particle effects) instead of a second `getGamepads()` reader.
1211
+ */
1212
+ get gamepadSnapshot() {
1213
+ return this.snapshot;
1214
+ }
1215
+ /** Feedback rumble on the pad used last, when the user allows vibration. */
1216
+ vibrate(e, t = 0.5) {
1217
+ this.state.preferences.vibration && this.activePad && this.rumble(this.activePad.index, e, t, t);
1218
+ }
1219
+ /** Rumble a given pad regardless of the preference (a game's own effect). */
1220
+ rumble(e, t, a2 = 0.5, r = 0.5) {
1221
+ var i2, c2, d;
1222
+ const s = (c2 = (i2 = this.win.navigator).getGamepads) == null ? void 0 : c2.call(i2)[e], o = s == null ? void 0 : s.vibrationActuator;
1223
+ (d = o == null ? void 0 : o.playEffect) == null || d.call(o, "dual-rumble", {
1224
+ startDelay: 0,
1225
+ duration: t,
1226
+ weakMagnitude: a2,
1227
+ strongMagnitude: r
1228
+ });
1229
+ }
1230
+ /* ── Overlays ────────────────────────────────────────────────── */
1231
+ /** Puts an overlay on the stack; returns what takes it off. */
1232
+ pushOverlay(e) {
1233
+ return this.overlays.push(e), () => {
1234
+ const t = this.overlays.lastIndexOf(e);
1235
+ t >= 0 && this.overlays.splice(t, 1);
1236
+ };
1237
+ }
1238
+ topOverlay() {
1239
+ return this.overlays[this.overlays.length - 1];
1240
+ }
1241
+ /** Closes the top overlay that can be closed; returns whether one was. */
1242
+ closeTopOverlay(e) {
1243
+ for (let t = this.overlays.length - 1; t >= 0; t--) {
1244
+ const a2 = this.overlays[t];
1245
+ if (a2.onClose)
1246
+ return a2.onClose(e), true;
1247
+ if (a2.modal)
1248
+ return false;
1249
+ }
1250
+ return false;
1251
+ }
1252
+ /* ── Intents ─────────────────────────────────────────────────── */
1253
+ /** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
1254
+ dispatchIntent(e, t = this.focused()) {
1255
+ const a2 = new CustomEvent(ze, {
1256
+ detail: e,
1257
+ bubbles: true,
1258
+ cancelable: true,
1259
+ composed: true
1260
+ });
1261
+ return t.dispatchEvent(a2), a2.defaultPrevented;
1262
+ }
1263
+ /** Moves focus in a direction through the scope tree; returns whether it moved. */
1264
+ moveFocus(e, t = this.focused()) {
1265
+ const a2 = this.navigationRoot();
1266
+ if (t === this.doc.body || !a2.contains(t))
1267
+ return this.focusInitial(a2);
1268
+ const r = Dn(t, e, { root: a2, memory: this.memory });
1269
+ return r ? (this.focusElement(r), true) : false;
1270
+ }
1271
+ /** The `view` intent: next (`down`) or previous (`up`) region. */
1272
+ focusRegion(e, t = this.focused()) {
1273
+ const a2 = In(t, e, {
1274
+ root: this.navigationRoot(),
1275
+ memory: this.memory
1276
+ });
1277
+ return a2 ? (this.focusElement(a2), true) : false;
1278
+ }
1279
+ /** Focuses the element and brings it into view (scroll-padding respected). */
1280
+ focusElement(e) {
1281
+ var t;
1282
+ e.focus({ preventScroll: true, focusVisible: true }), (t = e.scrollIntoView) == null || t.call(e, { block: "nearest", inline: "nearest" });
1283
+ }
1284
+ /** Engages a control (ADR-005 § 6); popup controls open instead. */
1285
+ engage(e, t, a2 = me(e)) {
1286
+ if (a2) {
1287
+ if (a2 === "popup") {
1288
+ this.emulateKey(e, "ArrowDown", t);
1289
+ return;
1290
+ }
1291
+ e.setAttribute("data-nice-engaged", ""), be(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: true, cancelled: false, source: t }), this.announce(this.translate("input.engaged", "Editing"));
1292
+ }
1293
+ }
1294
+ /**
1295
+ * Releases an engaged control; `cancelled` when left with `back`. A native number field gets
1296
+ * its value from before back; custom controls do that in `useEngage`'s `onRelease`.
1297
+ */
1298
+ release(e, t, a2) {
1299
+ if (!e.hasAttribute("data-nice-engaged"))
1300
+ return;
1301
+ e.removeAttribute("data-nice-engaged");
1302
+ const r = this.engagedValues.get(e);
1303
+ this.engagedValues.delete(e), a2 && r !== void 0 && be(e) && Wt(e, r), this.fireEngage(e, { engaged: false, cancelled: a2, source: t }), this.announce(this.translate("input.released", "Done editing"));
1304
+ }
1305
+ /** Defaults of trusted keys: the browser already clicks, types and scrolls. */
1306
+ keyDefault(e, t) {
1307
+ switch (e.intent) {
1308
+ case "navigate":
1309
+ return this.arrowPolicy(t, e.source) === "spatial" ? this.moveFocus(e.direction ?? "down", t) : false;
1310
+ case "view":
1311
+ return this.focusRegion(e.direction ?? "down", t);
1312
+ case "back":
1313
+ return this.closeTopOverlay(e.source);
1314
+ case "toggleHints":
1315
+ return this.toggleHints(), true;
1316
+ default:
1317
+ return false;
1318
+ }
1319
+ }
1320
+ arrowPolicy(e, t) {
1321
+ if (t !== "keyboard")
1322
+ return "spatial";
1323
+ const a2 = this.state.preferences.arrowNavigation;
1324
+ return a2 !== "auto" ? a2 : An(e) ?? "native";
1325
+ }
1326
+ /* ── Gamepad ─────────────────────────────────────────────────── */
1327
+ padMap(e) {
1328
+ let t = this.padMaps.get(e);
1329
+ return t || (t = kn(ke(this.state.preferences, e)), this.padMaps.set(e, t)), t;
1330
+ }
1331
+ /** A pad intent: the intent event, then engage rules, key emulation and the default action. */
1332
+ deviceIntent(e) {
1333
+ const t = this.focused();
1334
+ if (this.dispatchIntent(e, t))
1335
+ return;
1336
+ const a2 = t === this.doc.body ? null : me(t), r = a2 !== null && kt(t, a2), s = t, o = e.source;
1337
+ switch (e.intent) {
1338
+ case "navigate": {
1339
+ const i2 = e.direction ?? "down";
1340
+ a2 && !r ? this.moveFocus(i2, t) : r && ce(t) ? le(t, i2) : r && a2 === "text" ? Xt(t, i2) : this.emulateKey(t, _n[i2], o) || this.moveFocus(i2, t);
1341
+ return;
1342
+ }
1343
+ case "activate":
1344
+ a2 && !r ? this.engage(s, o, a2) : r && a2 === "popup" ? this.emulateKey(t, "Enter", o) : r && (a2 === "value" || a2 === "canvas") ? this.release(s, o, false) : r || (wt(t) ? $t(t) : this.emulateKey(t, "Enter", o));
1345
+ return;
1346
+ case "back":
1347
+ r && a2 === "popup" ? this.emulateKey(t, "Escape", o) : r ? this.release(s, o, true) : this.emulateKey(t, "Escape", o) || this.closeTopOverlay(o);
1348
+ return;
1349
+ case "sectionPrev":
1350
+ case "sectionNext":
1351
+ if (r && a2 === "value") {
1352
+ const i2 = e.intent === "sectionNext";
1353
+ ce(t) ? le(t, i2 ? "up" : "down", "big") : this.emulateKey(t, i2 ? "PageUp" : "PageDown", o);
1354
+ }
1355
+ return;
1356
+ case "pagePrev":
1357
+ case "pageNext": {
1358
+ const i2 = e.intent === "pageNext";
1359
+ if (r && a2 === "value")
1360
+ ce(t) ? le(t, i2 ? "up" : "down", "edge") : this.emulateKey(t, i2 ? "End" : "Home", o);
1361
+ else if (!this.emulateKey(t, i2 ? "PageDown" : "PageUp", o)) {
1362
+ const c2 = st(t, 0, i2 ? 1 : -1);
1363
+ rt(c2, 0, (i2 ? 1 : -1) * ((c2 == null ? void 0 : c2.clientHeight) ?? 0) * 0.9);
1364
+ }
1365
+ return;
1366
+ }
1367
+ case "first":
1368
+ case "last":
1369
+ this.emulateKey(t, e.intent === "first" ? "Home" : "End", o);
1370
+ return;
1371
+ case "secondary":
1372
+ this.contextMenu(t);
1373
+ return;
1374
+ case "menu":
1375
+ r && a2 === "text" && (this.release(s, o, false), this.emulateKey(t, "Enter", o));
1376
+ return;
1377
+ case "view":
1378
+ this.focusRegion(e.direction ?? "down", t);
1379
+ return;
1380
+ case "toggleHints":
1381
+ this.toggleHints();
1382
+ return;
1383
+ default:
1384
+ return;
1385
+ }
1386
+ }
1387
+ /** A synthetic key on the element; returns whether a handler consumed it. */
1388
+ emulateKey(e, t, a2) {
1389
+ const r = (o) => {
1390
+ const i2 = new KeyboardEvent(o, {
1391
+ key: t,
1392
+ code: t,
1393
+ bubbles: true,
1394
+ cancelable: true,
1395
+ composed: true
1396
+ });
1397
+ return Object.defineProperty(i2, "niceSource", { value: a2 }), Object.defineProperty(i2, "keyCode", { value: et[t] ?? 0 }), Object.defineProperty(i2, "which", { value: et[t] ?? 0 }), i2;
1398
+ }, s = r("keydown");
1399
+ return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
1400
+ }
1401
+ /** `secondary` on a pad: the context menu of the element, as a right click would open it. */
1402
+ contextMenu(e) {
1403
+ const t = e.getBoundingClientRect();
1404
+ e.dispatchEvent(
1405
+ new MouseEvent("contextmenu", {
1406
+ bubbles: true,
1407
+ cancelable: true,
1408
+ button: 2,
1409
+ clientX: t.left + t.width / 2,
1410
+ clientY: t.top + t.height / 2
1411
+ })
1412
+ );
1413
+ }
1414
+ watchRecovery(e) {
1415
+ e && !this.observer && typeof MutationObserver < "u" && this.doc.body ? (this.observer = new MutationObserver(this.recover), this.observer.observe(this.doc.body, { childList: true, subtree: true })) : !e && this.observer && (this.observer.disconnect(), this.observer = null);
1416
+ }
1417
+ /* ── Helpers ─────────────────────────────────────────────────── */
1418
+ focused() {
1419
+ const e = this.doc.activeElement;
1420
+ return e && e !== this.doc.documentElement ? e : this.doc.body;
1421
+ }
1422
+ targetOf(e) {
1423
+ var a2;
1424
+ const t = (a2 = e.composedPath) == null ? void 0 : a2.call(e)[0];
1425
+ return t instanceof Element ? t : e.target instanceof Element ? e.target : this.focused();
1426
+ }
1427
+ /** Moves stay inside the top modal overlay. */
1428
+ navigationRoot() {
1429
+ for (let e = this.overlays.length - 1; e >= 0; e--)
1430
+ if (this.overlays[e].modal && this.overlays[e].element.isConnected)
1431
+ return this.overlays[e].element;
1432
+ return this.doc.body;
1433
+ }
1434
+ /** Nothing focused yet: the remembered element, else the first one of the main region. */
1435
+ focusInitial(e) {
1436
+ const t = this.memory.get(e), a2 = e.querySelector('main,[role="main"]'), r = (t && t.isConnected && e.contains(t) && ne(t) ? t : null) ?? (a2 ? U(a2)[0] : void 0) ?? U(e)[0];
1437
+ return r ? (this.focusElement(r), true) : false;
1438
+ }
1439
+ fireEngage(e, t) {
1440
+ e.dispatchEvent(new CustomEvent(ae, { detail: t, bubbles: true }));
1441
+ }
1442
+ /** Polite announcement through the engine's own live region. */
1443
+ announce(e) {
1444
+ if (!this.live || !this.live.isConnected) {
1445
+ const t = this.doc.createElement("div");
1446
+ t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("data-nice-input-live", ""), t.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(t), this.live = t;
1447
+ }
1448
+ this.live.textContent = e;
1449
+ }
1450
+ }
1451
+ function rt(n, e, t) {
1452
+ n && (typeof n.scrollBy == "function" ? n.scrollBy({ left: e, top: t }) : (n.scrollLeft += e, n.scrollTop += t));
1453
+ }
1454
+ function st(n, e, t) {
1455
+ const a2 = n.ownerDocument, r = a2.defaultView;
1456
+ for (let s = n; s && s !== a2.body; s = s.parentElement) {
1457
+ if (!(s instanceof HTMLElement) || !r)
1458
+ continue;
1459
+ const o = r.getComputedStyle(s), i2 = /(auto|scroll)/.test(o.overflowY) && s.scrollHeight > s.clientHeight, c2 = /(auto|scroll)/.test(o.overflowX) && s.scrollWidth > s.clientWidth;
1460
+ if (t !== 0 && i2 || e !== 0 && c2)
1461
+ return s;
1462
+ }
1463
+ return a2.scrollingElement ?? a2.documentElement;
1464
+ }
1465
+ const ot = /* @__PURE__ */ new WeakMap();
1466
+ function jn(n = window, e = true) {
1467
+ let t = ot.get(n);
1468
+ return t || (t = new Kn(n), ot.set(n, t)), e && t.start(), t;
1469
+ }
1470
+ function B() {
1471
+ const [n] = useState(
1472
+ () => typeof window > "u" ? null : jn(window, false)
1473
+ );
1474
+ return useEffect(() => {
1475
+ n == null || n.start();
1476
+ }, [n]), n;
1477
+ }
1478
+ 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"])';
1479
+ function Xa(n, e = {}) {
1480
+ const { rowSelector: t = da, cellSelector: a2 = ha, pageSize: r = 10, enabled: s = true } = e, o = useRef(e);
1481
+ o.current = e;
1482
+ const i2 = B();
1483
+ _(
1484
+ n,
1485
+ (c2) => {
1486
+ if (!s)
1487
+ return;
1488
+ const d = c2.ownerDocument, u = (g) => {
1489
+ var S;
1490
+ return !!g && g.matches(t) && ((S = g.parentElement) == null ? void 0 : S.closest('[role="grid"],[role="treegrid"]')) === c2;
1491
+ }, p = () => [...c2.querySelectorAll(t)].filter(u), l = (g) => [...g.children].filter((S) => S.matches(a2)), v2 = (g) => {
1492
+ const S = g.querySelectorAll(fa);
1493
+ return S.length === 1 ? S[0] : g;
1494
+ }, y = () => p().flatMap((g) => l(g).map(v2)), k = (g) => {
1495
+ const S = (g == null ? void 0 : g.closest(a2)) ?? null;
1496
+ return S && u(S.parentElement) ? S : null;
1497
+ }, E = () => {
1498
+ const g = y();
1499
+ if (g.length === 0)
1500
+ return;
1501
+ const S = d.activeElement, N = g.find((w) => w === S || w.contains(S)) ?? g.find((w) => w.getAttribute("tabindex") === "0") ?? g[0];
1502
+ for (const w of g) {
1503
+ const b = w === N ? "0" : "-1";
1504
+ w.getAttribute("tabindex") !== b && w.setAttribute("tabindex", b);
1505
+ }
1506
+ }, H = (g, S, N) => {
1507
+ var b, T;
1508
+ const w = v2(g);
1509
+ for (const f of y())
1510
+ f.setAttribute("tabindex", f === w ? "0" : "-1");
1511
+ i2 ? i2.focusElement(w) : w.focus(), (T = (b = o.current).onMove) == null || T.call(b, g, S, N);
1512
+ }, x = (g) => {
1513
+ var D;
1514
+ if (g.defaultPrevented || g.altKey || g.metaKey)
1515
+ return;
1516
+ const S = g.target, N = k(S);
1517
+ if (!N || v2(N) !== S || S !== N && S.matches(pa))
1518
+ return;
1519
+ const w = p(), b = w.indexOf(N.parentElement), T = l(w[b]).indexOf(N), f = (L, P) => {
1520
+ const I = w[L] ? l(w[L]) : [];
1521
+ if (I.length === 0)
1522
+ return null;
1523
+ const $ = Math.min(P, I.length - 1);
1524
+ return [I[$], L, $];
1525
+ };
1526
+ let h = null;
1527
+ const A = ((D = d.defaultView) == null ? void 0 : D.getComputedStyle(c2).direction) === "rtl", m = A && g.key === "ArrowLeft" ? "ArrowRight" : A && g.key === "ArrowRight" ? "ArrowLeft" : g.key;
1528
+ if (g.ctrlKey && (m === "Home" || m === "End"))
1529
+ h = m === "Home" ? f(0, 0) : f(w.length - 1, Number.MAX_SAFE_INTEGER);
1530
+ else {
1531
+ if (g.ctrlKey)
1532
+ return;
1533
+ if (m === "ArrowRight")
1534
+ h = T + 1 < l(w[b]).length ? f(b, T + 1) : null;
1535
+ else if (m === "ArrowLeft")
1536
+ h = T > 0 ? f(b, T - 1) : null;
1537
+ else if (m === "ArrowDown")
1538
+ h = b + 1 < w.length ? f(b + 1, T) : null;
1539
+ else if (m === "ArrowUp")
1540
+ h = b > 0 ? f(b - 1, T) : null;
1541
+ else if (m === "Home")
1542
+ h = f(b, 0);
1543
+ else if (m === "End")
1544
+ h = f(b, Number.MAX_SAFE_INTEGER);
1545
+ else if (m === "PageDown" || m === "PageUp") {
1546
+ const L = m === "PageDown" ? Math.min(w.length - 1, b + r) : Math.max(0, b - r);
1547
+ h = L !== b ? f(L, T) : null;
1548
+ } else if ((m === "Enter" || m === " ") && S === N && !N.matches("button,a[href]")) {
1549
+ g.preventDefault(), N.click();
1550
+ return;
1551
+ } else
1552
+ return;
1553
+ }
1554
+ h && h[0] !== N && (g.preventDefault(), H(...h));
1555
+ }, M = () => E();
1556
+ E(), c2.addEventListener("keydown", x), c2.addEventListener("focusin", M);
1557
+ const z = typeof MutationObserver > "u" ? null : new MutationObserver(() => E());
1558
+ return z == null || z.observe(c2, {
1559
+ childList: true,
1560
+ subtree: true,
1561
+ attributes: true,
1562
+ attributeFilter: ["disabled"]
1563
+ }), () => {
1564
+ c2.removeEventListener("keydown", x), c2.removeEventListener("focusin", M), z == null || z.disconnect();
1565
+ };
1566
+ },
1567
+ [s, t, a2, r, i2]
1568
+ );
1569
+ }
288
1570
  process.env.NODE_ENV !== "production" && "NiceRTLProvider";
289
1571
  process.env.NODE_ENV !== "production" && "NiceAccessControl";
290
1572
  process.env.NODE_ENV !== "production" && "NiceA11yProvider";
@@ -529,7 +1811,7 @@ const NiceCapacityPlanner = ({
529
1811
  unit
530
1812
  )) }) }),
531
1813
  /* @__PURE__ */ jsx("div", { className: "nice-resource-allocation__toolbar-right", children: config.showConflicts && conflicts.length > 0 && /* @__PURE__ */ jsxs("div", { className: "nice-resource-allocation__conflicts-badge", children: [
532
- /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsx(re, { name: "warning", size: 14 }) }),
1814
+ /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsx(te, { name: "warning", size: 14 }) }),
533
1815
  (conflicts.length === 1 ? t("capacityPlanner.oneConflict", "1 Conflict") : t("capacityPlanner.conflicts", "{count} Conflicts")).replace("{count}", String(conflicts.length))
534
1816
  ] }) })
535
1817
  ] }),
@@ -552,13 +1834,10 @@ const NiceCapacityPlanner = ({
552
1834
  style: { backgroundColor: "var(--nice-warning-tint-30, rgba(245, 158, 11, 0.3))" }
553
1835
  }
554
1836
  ),
555
- /* @__PURE__ */ jsxs("span", { children: [
556
- "High Utilization (",
557
- ">",
558
- "=",
559
- config.utilizationThreshold,
560
- "%)"
561
- ] })
1837
+ /* @__PURE__ */ jsx("span", { children: t(
1838
+ "capacityPlanner.highUtilization",
1839
+ "High Utilization (>={utilizationThreshold}%)"
1840
+ ).replace("{utilizationThreshold}", String(config.utilizationThreshold)) })
562
1841
  ] }),
563
1842
  /* @__PURE__ */ jsxs("div", { className: "nice-resource-allocation__legend-item", children: [
564
1843
  /* @__PURE__ */ jsx(
@@ -580,6 +1859,9 @@ const NiceCapacityPlanner = ({
580
1859
  /* @__PURE__ */ jsxs(
581
1860
  "div",
582
1861
  {
1862
+ role: onResourceClick ? "button" : void 0,
1863
+ tabIndex: onResourceClick ? 0 : void 0,
1864
+ onKeyDown: onResourceClick ? Et : void 0,
583
1865
  className: "nice-resource-allocation__resource-cell",
584
1866
  onClick: () => onResourceClick == null ? void 0 : onResourceClick(resource),
585
1867
  children: [
@@ -592,7 +1874,7 @@ const NiceCapacityPlanner = ({
592
1874
  toggleResource(resource.id);
593
1875
  },
594
1876
  children: /* @__PURE__ */ jsx(
595
- re,
1877
+ te,
596
1878
  {
597
1879
  name: expandedResources.has(resource.id) ? "chevron-down" : "chevron-right",
598
1880
  size: 14
@@ -600,15 +1882,15 @@ const NiceCapacityPlanner = ({
600
1882
  )
601
1883
  }
602
1884
  ),
603
- /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsx(re, { name: getResourceTypeIcon(resource.type), size: 16 }) }),
1885
+ /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsx(te, { name: getResourceTypeIcon(resource.type), size: 16 }) }),
604
1886
  /* @__PURE__ */ jsxs("div", { className: "nice-resource-allocation__resource-info", children: [
605
1887
  /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-name", children: resource.name }),
606
1888
  resource.department && /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-dept", children: resource.department })
607
1889
  ] }),
608
- /* @__PURE__ */ jsxs("span", { className: "nice-resource-allocation__resource-capacity", children: [
609
- resource.maxCapacity,
610
- "h/day"
611
- ] })
1890
+ /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-capacity", children: t("capacityPlanner.hDay", "{maxCapacity}h/day").replace(
1891
+ "{maxCapacity}",
1892
+ String(resource.maxCapacity)
1893
+ ) })
612
1894
  ]
613
1895
  }
614
1896
  ),
@@ -620,6 +1902,10 @@ const NiceCapacityPlanner = ({
620
1902
  return /* @__PURE__ */ jsxs(
621
1903
  "div",
622
1904
  {
1905
+ role: readOnly ? void 0 : "button",
1906
+ tabIndex: readOnly ? void 0 : 0,
1907
+ "aria-label": readOnly ? void 0 : `${resource.name} ${formatDate(period)}`,
1908
+ onKeyDown: readOnly ? void 0 : Et,
623
1909
  className: `nice-resource-allocation__time-cell ${isHovered ? "nice-resource-allocation__time-cell--hovered" : ""}`,
624
1910
  style: { backgroundColor: getCellColor(resource.id, period) },
625
1911
  onClick: () => handleCellClick(resource.id, period),
@@ -630,6 +1916,7 @@ const NiceCapacityPlanner = ({
630
1916
  cellAllocations.slice(0, 2).map((alloc) => /* @__PURE__ */ jsx(
631
1917
  "div",
632
1918
  {
1919
+ role: "presentation",
633
1920
  className: `nice-resource-allocation__allocation-dot nice-resource-allocation__allocation-dot--${alloc.status}`,
634
1921
  onClick: (e) => {
635
1922
  e.stopPropagation();
@@ -668,6 +1955,9 @@ const NiceCapacityPlanner = ({
668
1955
  return /* @__PURE__ */ jsxs(
669
1956
  "div",
670
1957
  {
1958
+ role: "button",
1959
+ tabIndex: 0,
1960
+ onKeyDown: Et,
671
1961
  className: `nice-resource-allocation__allocation-bar nice-resource-allocation__allocation-bar--${allocation.status} ${selectedAllocation === allocation.id ? "nice-resource-allocation__allocation-bar--selected" : ""}`,
672
1962
  style: {
673
1963
  left: `${leftPercent}%`,
@@ -675,10 +1965,10 @@ const NiceCapacityPlanner = ({
675
1965
  },
676
1966
  onClick: () => setSelectedAllocation(allocation.id),
677
1967
  children: [
678
- /* @__PURE__ */ jsxs("span", { className: "nice-resource-allocation__allocation-label", children: [
679
- allocation.hoursPerDay,
680
- "h/day"
681
- ] }),
1968
+ /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__allocation-label", children: t("capacityPlanner.hDay2", "{hoursPerDay}h/day").replace(
1969
+ "{hoursPerDay}",
1970
+ String(allocation.hoursPerDay)
1971
+ ) }),
682
1972
  !readOnly && /* @__PURE__ */ jsx(
683
1973
  "button",
684
1974
  {
@@ -688,7 +1978,7 @@ const NiceCapacityPlanner = ({
688
1978
  e.stopPropagation();
689
1979
  onAllocationDelete == null ? void 0 : onAllocationDelete(allocation.id);
690
1980
  },
691
- children: /* @__PURE__ */ jsx(re, { name: "close", size: 14 })
1981
+ children: /* @__PURE__ */ jsx(te, { name: "close", size: 14 })
692
1982
  }
693
1983
  )
694
1984
  ]
@@ -701,11 +1991,13 @@ const NiceCapacityPlanner = ({
701
1991
  showAllocationModal && /* @__PURE__ */ jsx(
702
1992
  "div",
703
1993
  {
1994
+ role: "presentation",
704
1995
  className: "nice-resource-allocation__modal-overlay",
705
1996
  onClick: () => setShowAllocationModal(false),
706
1997
  children: /* @__PURE__ */ jsxs(
707
1998
  "div",
708
1999
  {
2000
+ role: "presentation",
709
2001
  className: "nice-resource-allocation__allocation-modal",
710
2002
  onClick: (e) => e.stopPropagation(),
711
2003
  children: [
@@ -1021,7 +2313,7 @@ const NiceInventoryManager = ({
1021
2313
  onChange: (e) => setFilters((prev) => ({ ...prev, searchQuery: e.target.value }))
1022
2314
  }
1023
2315
  ),
1024
- /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsx(re, { name: "search", size: 14 }) })
2316
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsx(te, { name: "search", size: 14 }) })
1025
2317
  ] }),
1026
2318
  /* @__PURE__ */ jsxs(
1027
2319
  "select",
@@ -1056,7 +2348,7 @@ const NiceInventoryManager = ({
1056
2348
  className: `nice-inventory-manager__view-button ${view === v2 ? "nice-inventory-manager__view-button--active" : ""}`,
1057
2349
  onClick: () => setView(v2),
1058
2350
  children: /* @__PURE__ */ jsx(
1059
- re,
2351
+ te,
1060
2352
  {
1061
2353
  name: v2 === "grid" ? "grid" : v2 === "list" ? "list" : "table",
1062
2354
  size: 14
@@ -1081,34 +2373,32 @@ const NiceInventoryManager = ({
1081
2373
  });
1082
2374
  setShowItemModal(true);
1083
2375
  },
1084
- children: "+ Add Item"
2376
+ children: t("inventoryManager.addItem", "+ Add Item")
1085
2377
  }
1086
2378
  )
1087
2379
  ] })
1088
2380
  ] }),
1089
2381
  /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__tabs", children: [
1090
- /* @__PURE__ */ jsxs(
2382
+ /* @__PURE__ */ jsx(
1091
2383
  "button",
1092
2384
  {
1093
2385
  className: `nice-inventory-manager__tab ${activeTab === "inventory" ? "nice-inventory-manager__tab--active" : ""}`,
1094
2386
  onClick: () => setActiveTab("inventory"),
1095
- children: [
1096
- "Inventory (",
1097
- items.length,
1098
- ")"
1099
- ]
2387
+ children: t("inventoryManager.inventory", "Inventory ({items})").replace(
2388
+ "{items}",
2389
+ String(items.length)
2390
+ )
1100
2391
  }
1101
2392
  ),
1102
- /* @__PURE__ */ jsxs(
2393
+ /* @__PURE__ */ jsx(
1103
2394
  "button",
1104
2395
  {
1105
2396
  className: `nice-inventory-manager__tab ${activeTab === "transactions" ? "nice-inventory-manager__tab--active" : ""}`,
1106
2397
  onClick: () => setActiveTab("transactions"),
1107
- children: [
1108
- "Transactions (",
1109
- transactions.length,
1110
- ")"
1111
- ]
2398
+ children: t("inventoryManager.transactions", "Transactions ({transactions})").replace(
2399
+ "{transactions}",
2400
+ String(transactions.length)
2401
+ )
1112
2402
  }
1113
2403
  ),
1114
2404
  /* @__PURE__ */ jsxs(
@@ -1130,6 +2420,9 @@ const NiceInventoryManager = ({
1130
2420
  return /* @__PURE__ */ jsxs(
1131
2421
  "div",
1132
2422
  {
2423
+ role: onItemClick ? "button" : void 0,
2424
+ tabIndex: onItemClick ? 0 : void 0,
2425
+ onKeyDown: onItemClick ? Et : void 0,
1133
2426
  className: `nice-inventory-manager__item-card ${selectedItems.has(item.id) ? "nice-inventory-manager__item-card--selected" : ""}`,
1134
2427
  onClick: () => onItemClick == null ? void 0 : onItemClick(item),
1135
2428
  children: [
@@ -1143,7 +2436,7 @@ const NiceInventoryManager = ({
1143
2436
  onClick: (e) => e.stopPropagation()
1144
2437
  }
1145
2438
  ),
1146
- config.showImages && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsx(re, { name: "box", size: 32 }) }) }),
2439
+ config.showImages && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsx(te, { name: "box", size: 32 }) }) }),
1147
2440
  /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__item-info", children: [
1148
2441
  /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__item-sku", children: item.sku }),
1149
2442
  /* @__PURE__ */ jsx("h4", { className: "nice-inventory-manager__item-name", children: item.name }),
@@ -1164,7 +2457,7 @@ const NiceInventoryManager = ({
1164
2457
  item.unit
1165
2458
  ] }),
1166
2459
  item.quantity <= item.reorderLevel && /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__reorder-alert", children: [
1167
- /* @__PURE__ */ jsx(re, { name: "warning", size: 12 }),
2460
+ /* @__PURE__ */ jsx(te, { name: "warning", size: 12 }),
1168
2461
  " ",
1169
2462
  t("inventoryManager.lowStock", "Low Stock")
1170
2463
  ] })
@@ -1189,7 +2482,7 @@ const NiceInventoryManager = ({
1189
2482
  t("inventoryManager.sku", "SKU"),
1190
2483
  " ",
1191
2484
  sortBy === "sku" && /* @__PURE__ */ jsx(
1192
- re,
2485
+ te,
1193
2486
  {
1194
2487
  name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
1195
2488
  size: 12
@@ -1209,7 +2502,7 @@ const NiceInventoryManager = ({
1209
2502
  t("inventoryManager.name", "Name"),
1210
2503
  " ",
1211
2504
  sortBy === "name" && /* @__PURE__ */ jsx(
1212
- re,
2505
+ te,
1213
2506
  {
1214
2507
  name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
1215
2508
  size: 12
@@ -1230,7 +2523,7 @@ const NiceInventoryManager = ({
1230
2523
  t("inventoryManager.qty", "Qty"),
1231
2524
  " ",
1232
2525
  sortBy === "quantity" && /* @__PURE__ */ jsx(
1233
- re,
2526
+ te,
1234
2527
  {
1235
2528
  name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
1236
2529
  size: 12
@@ -1252,7 +2545,7 @@ const NiceInventoryManager = ({
1252
2545
  t("inventoryManager.value", "Value"),
1253
2546
  " ",
1254
2547
  sortBy === "value" && /* @__PURE__ */ jsx(
1255
- re,
2548
+ te,
1256
2549
  {
1257
2550
  name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
1258
2551
  size: 12
@@ -1315,7 +2608,7 @@ const NiceInventoryManager = ({
1315
2608
  setEditingItem(item);
1316
2609
  setShowItemModal(true);
1317
2610
  },
1318
- children: /* @__PURE__ */ jsx(re, { name: "edit", size: 14 })
2611
+ children: /* @__PURE__ */ jsx(te, { name: "edit", size: 14 })
1319
2612
  }
1320
2613
  ),
1321
2614
  /* @__PURE__ */ jsx(
@@ -1327,7 +2620,7 @@ const NiceInventoryManager = ({
1327
2620
  setNewTransaction({ itemId: item.id });
1328
2621
  setShowTransactionModal(true);
1329
2622
  },
1330
- children: /* @__PURE__ */ jsx(re, { name: "clipboard", size: 14 })
2623
+ children: /* @__PURE__ */ jsx(te, { name: "clipboard", size: 14 })
1331
2624
  }
1332
2625
  ),
1333
2626
  /* @__PURE__ */ jsx(
@@ -1338,7 +2631,7 @@ const NiceInventoryManager = ({
1338
2631
  e.stopPropagation();
1339
2632
  onItemDelete == null ? void 0 : onItemDelete(item.id);
1340
2633
  },
1341
- children: /* @__PURE__ */ jsx(re, { name: "trash", size: 14 })
2634
+ children: /* @__PURE__ */ jsx(te, { name: "trash", size: 14 })
1342
2635
  }
1343
2636
  )
1344
2637
  ] })
@@ -1369,6 +2662,9 @@ const NiceInventoryManager = ({
1369
2662
  /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__column-items", children: statusItems.map((item) => /* @__PURE__ */ jsxs(
1370
2663
  "div",
1371
2664
  {
2665
+ role: onItemClick ? "button" : void 0,
2666
+ tabIndex: onItemClick ? 0 : void 0,
2667
+ onKeyDown: onItemClick ? Et : void 0,
1372
2668
  className: "nice-inventory-manager__kanban-card",
1373
2669
  onClick: () => onItemClick == null ? void 0 : onItemClick(item),
1374
2670
  children: [
@@ -1396,13 +2692,13 @@ const NiceInventoryManager = ({
1396
2692
  {
1397
2693
  className: "nice-inventory-manager__add-transaction-button",
1398
2694
  onClick: () => setShowTransactionModal(true),
1399
- children: "+ New Transaction"
2695
+ children: t("inventoryManager.newTransaction", "+ New Transaction")
1400
2696
  }
1401
2697
  ),
1402
2698
  /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__transactions-list", children: recentTransactions.map((tx) => {
1403
2699
  const item = items.find((i2) => i2.id === tx.itemId);
1404
2700
  return /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__transaction-item", children: [
1405
- /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsx(re, { name: getTransactionIcon(tx.type), size: 16 }) }),
2701
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsx(te, { name: getTransactionIcon(tx.type), size: 16 }) }),
1406
2702
  /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__tx-info", children: [
1407
2703
  /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-type", children: tx.type }),
1408
2704
  /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-item", children: (item == null ? void 0 : item.name) || tx.itemId })
@@ -1418,15 +2714,15 @@ const NiceInventoryManager = ({
1418
2714
  }
1419
2715
  ),
1420
2716
  /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-date", children: tx.date.toLocaleString() }),
1421
- tx.reference && /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__tx-ref", children: [
1422
- "Ref: ",
1423
- tx.reference
1424
- ] })
2717
+ tx.reference && /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-ref", children: t("inventoryManager.ref", "Ref: {reference}").replace(
2718
+ "{reference}",
2719
+ String(tx.reference)
2720
+ ) })
1425
2721
  ] }, tx.id);
1426
2722
  }) })
1427
2723
  ] }),
1428
2724
  activeTab === "reorder" && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__reorder-tab", children: reorderItems.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__empty-state", children: [
1429
- /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsx(re, { name: "success", size: 32 }) }),
2725
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsx(te, { name: "success", size: 32 }) }),
1430
2726
  /* @__PURE__ */ jsx("p", { children: t(
1431
2727
  "inventoryManager.allItemsAreSufficientlyStocked",
1432
2728
  "All items are sufficiently stocked"
@@ -1437,20 +2733,15 @@ const NiceInventoryManager = ({
1437
2733
  /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__reorder-name", children: item.name })
1438
2734
  ] }),
1439
2735
  /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__reorder-stock", children: [
1440
- /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__current-qty", children: [
1441
- "Current: ",
1442
- item.quantity,
1443
- " ",
1444
- item.unit
1445
- ] }),
1446
- /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__reorder-level", children: [
1447
- "Reorder at: ",
1448
- item.reorderLevel
1449
- ] }),
1450
- /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__reorder-qty", children: [
1451
- "Order qty: ",
1452
- item.reorderQuantity
1453
- ] })
2736
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__current-qty", children: t("inventoryManager.current", "Current: {quantity} {unit}").replace("{quantity}", String(item.quantity)).replace("{unit}", String(item.unit)) }),
2737
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__reorder-level", children: t("inventoryManager.reorderAt", "Reorder at: {reorderLevel}").replace(
2738
+ "{reorderLevel}",
2739
+ String(item.reorderLevel)
2740
+ ) }),
2741
+ /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__reorder-qty", children: t("inventoryManager.orderQty", "Order qty: {reorderQuantity}").replace(
2742
+ "{reorderQuantity}",
2743
+ String(item.reorderQuantity)
2744
+ ) })
1454
2745
  ] }),
1455
2746
  item.supplier && /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__supplier-name", children: item.supplier.name }),
1456
2747
  !readOnly && onCreatePurchaseOrder && /* @__PURE__ */ jsx(
@@ -1467,153 +2758,164 @@ const NiceInventoryManager = ({
1467
2758
  showItemModal && editingItem && /* @__PURE__ */ jsx(
1468
2759
  "div",
1469
2760
  {
2761
+ role: "presentation",
1470
2762
  className: "nice-inventory-manager__modal-overlay",
1471
2763
  onClick: () => setShowItemModal(false),
1472
- children: /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__item-modal", onClick: (e) => e.stopPropagation(), children: [
1473
- /* @__PURE__ */ jsx("h3", { children: editingItem.id ? "Edit Item" : "Add New Item" }),
1474
- /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__modal-form", children: [
1475
- /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
1476
- /* @__PURE__ */ jsxs("label", { children: [
1477
- "SKU",
1478
- /* @__PURE__ */ jsx(
1479
- "input",
1480
- {
1481
- type: "text",
1482
- value: editingItem.sku || "",
1483
- onChange: (e) => setEditingItem((prev) => ({ ...prev, sku: e.target.value }))
1484
- }
1485
- )
2764
+ children: /* @__PURE__ */ jsxs(
2765
+ "div",
2766
+ {
2767
+ role: "presentation",
2768
+ className: "nice-inventory-manager__item-modal",
2769
+ onClick: (e) => e.stopPropagation(),
2770
+ children: [
2771
+ /* @__PURE__ */ jsx("h3", { children: editingItem.id ? t("inventoryManager.editItem", "Edit Item") : t("inventoryManager.addNewItem", "Add New Item") }),
2772
+ /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__modal-form", children: [
2773
+ /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
2774
+ /* @__PURE__ */ jsxs("label", { children: [
2775
+ "SKU",
2776
+ /* @__PURE__ */ jsx(
2777
+ "input",
2778
+ {
2779
+ type: "text",
2780
+ value: editingItem.sku || "",
2781
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, sku: e.target.value }))
2782
+ }
2783
+ )
2784
+ ] }),
2785
+ /* @__PURE__ */ jsxs("label", { children: [
2786
+ t("inventoryManager.name", "Name"),
2787
+ /* @__PURE__ */ jsx(
2788
+ "input",
2789
+ {
2790
+ type: "text",
2791
+ value: editingItem.name || "",
2792
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, name: e.target.value }))
2793
+ }
2794
+ )
2795
+ ] })
2796
+ ] }),
2797
+ /* @__PURE__ */ jsxs("label", { children: [
2798
+ t("inventoryManager.description", "Description"),
2799
+ /* @__PURE__ */ jsx(
2800
+ "textarea",
2801
+ {
2802
+ value: editingItem.description || "",
2803
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, description: e.target.value }))
2804
+ }
2805
+ )
2806
+ ] }),
2807
+ /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
2808
+ /* @__PURE__ */ jsxs("label", { children: [
2809
+ t("inventoryManager.category", "Category"),
2810
+ /* @__PURE__ */ jsx(
2811
+ "input",
2812
+ {
2813
+ type: "text",
2814
+ value: editingItem.category || "",
2815
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, category: e.target.value })),
2816
+ list: "categories"
2817
+ }
2818
+ ),
2819
+ /* @__PURE__ */ jsx("datalist", { id: "categories", children: categories.map((c2) => /* @__PURE__ */ jsx("option", { value: c2 }, c2)) })
2820
+ ] }),
2821
+ /* @__PURE__ */ jsxs("label", { children: [
2822
+ t("inventoryManager.unit", "Unit"),
2823
+ /* @__PURE__ */ jsx(
2824
+ "input",
2825
+ {
2826
+ type: "text",
2827
+ value: editingItem.unit || "",
2828
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, unit: e.target.value }))
2829
+ }
2830
+ )
2831
+ ] })
2832
+ ] }),
2833
+ /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
2834
+ /* @__PURE__ */ jsxs("label", { children: [
2835
+ t("inventoryManager.quantity", "Quantity"),
2836
+ /* @__PURE__ */ jsx(
2837
+ "input",
2838
+ {
2839
+ type: "number",
2840
+ value: editingItem.quantity || 0,
2841
+ onChange: (e) => setEditingItem((prev) => ({ ...prev, quantity: parseInt(e.target.value) }))
2842
+ }
2843
+ )
2844
+ ] }),
2845
+ /* @__PURE__ */ jsxs("label", { children: [
2846
+ t("inventoryManager.reorderLevel", "Reorder Level"),
2847
+ /* @__PURE__ */ jsx(
2848
+ "input",
2849
+ {
2850
+ type: "number",
2851
+ value: editingItem.reorderLevel || 0,
2852
+ onChange: (e) => setEditingItem((prev) => ({
2853
+ ...prev,
2854
+ reorderLevel: parseInt(e.target.value)
2855
+ }))
2856
+ }
2857
+ )
2858
+ ] }),
2859
+ /* @__PURE__ */ jsxs("label", { children: [
2860
+ t("inventoryManager.reorderQty", "Reorder Qty"),
2861
+ /* @__PURE__ */ jsx(
2862
+ "input",
2863
+ {
2864
+ type: "number",
2865
+ value: editingItem.reorderQuantity || 0,
2866
+ onChange: (e) => setEditingItem((prev) => ({
2867
+ ...prev,
2868
+ reorderQuantity: parseInt(e.target.value)
2869
+ }))
2870
+ }
2871
+ )
2872
+ ] })
2873
+ ] }),
2874
+ /* @__PURE__ */ jsxs("label", { children: [
2875
+ t("inventoryManager.unitCost", "Unit Cost"),
2876
+ /* @__PURE__ */ jsx(
2877
+ "input",
2878
+ {
2879
+ type: "number",
2880
+ step: "0.01",
2881
+ value: ((_b = editingItem.cost) == null ? void 0 : _b.amount) || 0,
2882
+ onChange: (e) => setEditingItem((prev) => ({
2883
+ ...prev,
2884
+ cost: {
2885
+ ...prev.cost,
2886
+ amount: parseFloat(e.target.value)
2887
+ }
2888
+ }))
2889
+ }
2890
+ )
2891
+ ] })
1486
2892
  ] }),
1487
- /* @__PURE__ */ jsxs("label", { children: [
1488
- t("inventoryManager.name", "Name"),
1489
- /* @__PURE__ */ jsx(
1490
- "input",
1491
- {
1492
- type: "text",
1493
- value: editingItem.name || "",
1494
- onChange: (e) => setEditingItem((prev) => ({ ...prev, name: e.target.value }))
1495
- }
1496
- )
1497
- ] })
1498
- ] }),
1499
- /* @__PURE__ */ jsxs("label", { children: [
1500
- t("inventoryManager.description", "Description"),
1501
- /* @__PURE__ */ jsx(
1502
- "textarea",
1503
- {
1504
- value: editingItem.description || "",
1505
- onChange: (e) => setEditingItem((prev) => ({ ...prev, description: e.target.value }))
1506
- }
1507
- )
1508
- ] }),
1509
- /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
1510
- /* @__PURE__ */ jsxs("label", { children: [
1511
- t("inventoryManager.category", "Category"),
2893
+ /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__modal-actions", children: [
1512
2894
  /* @__PURE__ */ jsx(
1513
- "input",
2895
+ "button",
1514
2896
  {
1515
- type: "text",
1516
- value: editingItem.category || "",
1517
- onChange: (e) => setEditingItem((prev) => ({ ...prev, category: e.target.value })),
1518
- list: "categories"
2897
+ className: "nice-inventory-manager__cancel-button",
2898
+ onClick: () => setShowItemModal(false),
2899
+ children: t("inventoryManager.cancel", "Cancel")
1519
2900
  }
1520
2901
  ),
1521
- /* @__PURE__ */ jsx("datalist", { id: "categories", children: categories.map((c2) => /* @__PURE__ */ jsx("option", { value: c2 }, c2)) })
1522
- ] }),
1523
- /* @__PURE__ */ jsxs("label", { children: [
1524
- t("inventoryManager.unit", "Unit"),
1525
- /* @__PURE__ */ jsx(
1526
- "input",
1527
- {
1528
- type: "text",
1529
- value: editingItem.unit || "",
1530
- onChange: (e) => setEditingItem((prev) => ({ ...prev, unit: e.target.value }))
1531
- }
1532
- )
1533
- ] })
1534
- ] }),
1535
- /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__form-row", children: [
1536
- /* @__PURE__ */ jsxs("label", { children: [
1537
- t("inventoryManager.quantity", "Quantity"),
1538
- /* @__PURE__ */ jsx(
1539
- "input",
1540
- {
1541
- type: "number",
1542
- value: editingItem.quantity || 0,
1543
- onChange: (e) => setEditingItem((prev) => ({ ...prev, quantity: parseInt(e.target.value) }))
1544
- }
1545
- )
1546
- ] }),
1547
- /* @__PURE__ */ jsxs("label", { children: [
1548
- t("inventoryManager.reorderLevel", "Reorder Level"),
1549
- /* @__PURE__ */ jsx(
1550
- "input",
1551
- {
1552
- type: "number",
1553
- value: editingItem.reorderLevel || 0,
1554
- onChange: (e) => setEditingItem((prev) => ({
1555
- ...prev,
1556
- reorderLevel: parseInt(e.target.value)
1557
- }))
1558
- }
1559
- )
1560
- ] }),
1561
- /* @__PURE__ */ jsxs("label", { children: [
1562
- t("inventoryManager.reorderQty", "Reorder Qty"),
1563
- /* @__PURE__ */ jsx(
1564
- "input",
1565
- {
1566
- type: "number",
1567
- value: editingItem.reorderQuantity || 0,
1568
- onChange: (e) => setEditingItem((prev) => ({
1569
- ...prev,
1570
- reorderQuantity: parseInt(e.target.value)
1571
- }))
1572
- }
1573
- )
2902
+ /* @__PURE__ */ jsx("button", { className: "nice-inventory-manager__save-button", onClick: handleItemSubmit, children: editingItem.id ? t("inventoryManager.saveChanges", "Save Changes") : t("inventoryManager.createItem", "Create Item") })
1574
2903
  ] })
1575
- ] }),
1576
- /* @__PURE__ */ jsxs("label", { children: [
1577
- t("inventoryManager.unitCost", "Unit Cost"),
1578
- /* @__PURE__ */ jsx(
1579
- "input",
1580
- {
1581
- type: "number",
1582
- step: "0.01",
1583
- value: ((_b = editingItem.cost) == null ? void 0 : _b.amount) || 0,
1584
- onChange: (e) => setEditingItem((prev) => ({
1585
- ...prev,
1586
- cost: {
1587
- ...prev.cost,
1588
- amount: parseFloat(e.target.value)
1589
- }
1590
- }))
1591
- }
1592
- )
1593
- ] })
1594
- ] }),
1595
- /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__modal-actions", children: [
1596
- /* @__PURE__ */ jsx(
1597
- "button",
1598
- {
1599
- className: "nice-inventory-manager__cancel-button",
1600
- onClick: () => setShowItemModal(false),
1601
- children: t("inventoryManager.cancel", "Cancel")
1602
- }
1603
- ),
1604
- /* @__PURE__ */ jsx("button", { className: "nice-inventory-manager__save-button", onClick: handleItemSubmit, children: editingItem.id ? "Save Changes" : "Create Item" })
1605
- ] })
1606
- ] })
2904
+ ]
2905
+ }
2906
+ )
1607
2907
  }
1608
2908
  ),
1609
2909
  showTransactionModal && /* @__PURE__ */ jsx(
1610
2910
  "div",
1611
2911
  {
2912
+ role: "presentation",
1612
2913
  className: "nice-inventory-manager__modal-overlay",
1613
2914
  onClick: () => setShowTransactionModal(false),
1614
2915
  children: /* @__PURE__ */ jsxs(
1615
2916
  "div",
1616
2917
  {
2918
+ role: "presentation",
1617
2919
  className: "nice-inventory-manager__transaction-modal",
1618
2920
  onClick: (e) => e.stopPropagation(),
1619
2921
  children: [
@@ -1770,7 +3072,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
1770
3072
  dueDate: "Due date",
1771
3073
  seller: "Seller",
1772
3074
  buyer: "Buyer",
1773
- description: "Description",
3075
+ description: t("invoiceView.description", "Description"),
1774
3076
  qty: "Qty",
1775
3077
  unitPrice: "Unit price",
1776
3078
  vat: "VAT",
@@ -1850,7 +3152,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
1850
3152
  onClick: () => onAction == null ? void 0 : onAction("download"),
1851
3153
  "aria-label": t("invoiceView.download", "Download"),
1852
3154
  title: t("invoiceView.download", "Download"),
1853
- children: /* @__PURE__ */ jsx(re, { name: "arrow-down", size: 12 })
3155
+ children: /* @__PURE__ */ jsx(te, { name: "arrow-down", size: 12 })
1854
3156
  }
1855
3157
  ),
1856
3158
  /* @__PURE__ */ jsx(
@@ -1860,7 +3162,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
1860
3162
  onClick: () => onAction == null ? void 0 : onAction("print"),
1861
3163
  "aria-label": t("invoiceView.print", "Print"),
1862
3164
  title: t("invoiceView.print", "Print"),
1863
- children: /* @__PURE__ */ jsx(re, { name: "printer", size: 14 })
3165
+ children: /* @__PURE__ */ jsx(te, { name: "printer", size: 14 })
1864
3166
  }
1865
3167
  ),
1866
3168
  /* @__PURE__ */ jsx(
@@ -1870,7 +3172,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
1870
3172
  onClick: () => onAction == null ? void 0 : onAction("send"),
1871
3173
  "aria-label": t("invoiceView.send", "Send"),
1872
3174
  title: t("invoiceView.send", "Send"),
1873
- children: /* @__PURE__ */ jsx(re, { name: "mail", size: 14 })
3175
+ children: /* @__PURE__ */ jsx(te, { name: "mail", size: 14 })
1874
3176
  }
1875
3177
  )
1876
3178
  ] })
@@ -2029,6 +3331,8 @@ const NiceWarehouseView = /* @__PURE__ */ forwardRef(
2029
3331
  }
2030
3332
  return [...rows.entries()].map(([rowKey, arr]) => ({ rowKey, cells: arr }));
2031
3333
  }, [cells]);
3334
+ const gridRef = useRef(null);
3335
+ Xa(gridRef);
2032
3336
  return /* @__PURE__ */ jsxs("div", { ref, id, className: `nice-warehouse-view ${className ?? ""}`, style, children: [
2033
3337
  /* @__PURE__ */ jsxs("header", { className: "nice-warehouse-view__header", children: [
2034
3338
  /* @__PURE__ */ jsx("h3", { children: warehouseName }),
@@ -2039,40 +3343,54 @@ const NiceWarehouseView = /* @__PURE__ */ forwardRef(
2039
3343
  "aria-label": t("warehouseView.occupancyLegend", "Occupancy legend"),
2040
3344
  children: [
2041
3345
  /* @__PURE__ */ jsx("span", { style: { background: colors.low } }),
2042
- " low",
3346
+ " ",
3347
+ t("warehouseView.low", "low"),
2043
3348
  /* @__PURE__ */ jsx("span", { style: { background: colors.mid } }),
2044
- " mid",
3349
+ " ",
3350
+ t("warehouseView.mid", "mid"),
2045
3351
  /* @__PURE__ */ jsx("span", { style: { background: colors.high } }),
2046
- " high"
3352
+ " ",
3353
+ t("warehouseView.high", "high")
2047
3354
  ]
2048
3355
  }
2049
3356
  )
2050
3357
  ] }),
2051
- /* @__PURE__ */ jsx("div", { className: "nice-warehouse-view__grid", role: "grid", "aria-label": warehouseName, children: grid.map(({ rowKey, cells: row }) => /* @__PURE__ */ jsx("div", { className: "nice-warehouse-view__row", role: "row", children: row.map((c2, idx) => {
2052
- const key = [c2.location.rack, c2.location.aisle, c2.location.shelf, c2.location.bin].filter(Boolean).join("-") || String(idx);
2053
- const aisleBreak = aisleEvery > 0 && idx > 0 && idx % aisleEvery === 0;
2054
- return /* @__PURE__ */ jsxs(ve.Fragment, { children: [
2055
- aisleBreak && /* @__PURE__ */ jsx("div", { className: "nice-warehouse-view__aisle", "aria-hidden": true }),
2056
- /* @__PURE__ */ jsx(
2057
- "button",
2058
- {
2059
- type: "button",
2060
- role: "gridcell",
2061
- className: "nice-warehouse-view__cell",
2062
- style: {
2063
- width: cellSize,
2064
- height: cellSize,
2065
- background: colorFor(c2.occupancy, colors)
2066
- },
2067
- title: `${key} — ${(c2.occupancy * 100).toFixed(0)}% (${c2.items.length} items)`,
2068
- onClick: () => onCellClick == null ? void 0 : onCellClick(c2),
2069
- onMouseEnter: () => setHovered(c2),
2070
- onMouseLeave: () => setHovered(null),
2071
- children: /* @__PURE__ */ jsx("span", { className: "nice-warehouse-view__bin", children: c2.location.bin ?? c2.location.shelf ?? "" })
2072
- }
2073
- )
2074
- ] }, key);
2075
- }) }, rowKey)) }),
3358
+ /* @__PURE__ */ jsx(
3359
+ "div",
3360
+ {
3361
+ ref: gridRef,
3362
+ className: "nice-warehouse-view__grid",
3363
+ role: "grid",
3364
+ "aria-label": warehouseName,
3365
+ children: grid.map(({ rowKey, cells: row }) => /* @__PURE__ */ jsx("div", { className: "nice-warehouse-view__row", role: "row", children: row.map((c2, idx) => {
3366
+ const key = [c2.location.rack, c2.location.aisle, c2.location.shelf, c2.location.bin].filter(Boolean).join("-") || String(idx);
3367
+ const aisleBreak = aisleEvery > 0 && idx > 0 && idx % aisleEvery === 0;
3368
+ return /* @__PURE__ */ jsxs($e$1.Fragment, { children: [
3369
+ aisleBreak && /* @__PURE__ */ jsx("div", { className: "nice-warehouse-view__aisle", "aria-hidden": true }),
3370
+ /* @__PURE__ */ jsx(
3371
+ "button",
3372
+ {
3373
+ type: "button",
3374
+ role: "gridcell",
3375
+ className: "nice-warehouse-view__cell",
3376
+ style: {
3377
+ width: cellSize,
3378
+ height: cellSize,
3379
+ background: colorFor(c2.occupancy, colors)
3380
+ },
3381
+ title: t("warehouseView.items", "{key} — {occupancy}% ({items} items)").replace("{key}", String(key)).replace("{occupancy}", String((c2.occupancy * 100).toFixed(0))).replace("{items}", String(c2.items.length)),
3382
+ onClick: () => onCellClick == null ? void 0 : onCellClick(c2),
3383
+ onMouseEnter: () => setHovered(c2),
3384
+ onMouseLeave: () => setHovered(null),
3385
+ onFocus: () => setHovered(c2),
3386
+ onBlur: () => setHovered(null),
3387
+ children: /* @__PURE__ */ jsx("span", { className: "nice-warehouse-view__bin", children: c2.location.bin ?? c2.location.shelf ?? "" })
3388
+ }
3389
+ )
3390
+ ] }, key);
3391
+ }) }, rowKey))
3392
+ }
3393
+ ),
2076
3394
  hovered && /* @__PURE__ */ jsxs("aside", { className: "nice-warehouse-view__details", "aria-live": "polite", children: [
2077
3395
  /* @__PURE__ */ jsxs("strong", { children: [
2078
3396
  hovered.location.rack,
@@ -2081,12 +3399,7 @@ const NiceWarehouseView = /* @__PURE__ */ forwardRef(
2081
3399
  "/",
2082
3400
  hovered.location.bin
2083
3401
  ] }),
2084
- /* @__PURE__ */ jsxs("div", { children: [
2085
- hovered.items.length,
2086
- " items · ",
2087
- (hovered.occupancy * 100).toFixed(0),
2088
- "% full"
2089
- ] }),
3402
+ /* @__PURE__ */ jsx("div", { children: t("warehouseView.itemsFull", "{items} items · {occupancy}% full").replace("{items}", String(hovered.items.length)).replace("{occupancy}", String((hovered.occupancy * 100).toFixed(0))) }),
2090
3403
  /* @__PURE__ */ jsxs("ul", { children: [
2091
3404
  hovered.items.slice(0, 5).map((it) => /* @__PURE__ */ jsxs("li", { children: [
2092
3405
  it.sku,
@@ -2482,12 +3795,13 @@ const NiceVatTable = /* @__PURE__ */ forwardRef(
2482
3795
  style,
2483
3796
  id
2484
3797
  }, ref) {
3798
+ const { t } = v();
2485
3799
  const [internal, setInternal] = useState(rates ?? NICE_VAT_PRESETS[country]);
2486
3800
  const L = {
2487
3801
  code: "Code",
2488
3802
  rate: "Rate",
2489
- label: "Label",
2490
- description: "Description",
3803
+ label: t("vatTable.label", "Label"),
3804
+ description: t("vatTable.description", "Description"),
2491
3805
  add: "+ Add",
2492
3806
  remove: "Remove",
2493
3807
  ...labels
@@ -2519,7 +3833,7 @@ const NiceVatTable = /* @__PURE__ */ forwardRef(
2519
3833
  };
2520
3834
  const removeRow = (idx) => {
2521
3835
  const code = internal[idx].code;
2522
- const next = internal.filter((_, i2) => i2 !== idx);
3836
+ const next = internal.filter((_2, i2) => i2 !== idx);
2523
3837
  update(next);
2524
3838
  onRemove == null ? void 0 : onRemove(code);
2525
3839
  };
@@ -2572,7 +3886,7 @@ const NiceVatTable = /* @__PURE__ */ forwardRef(
2572
3886
  onChange: (e) => onCellEdit(idx, "description", e.target.value)
2573
3887
  }
2574
3888
  ) : r.description ?? "" }),
2575
- editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsx(re, { name: "close", size: 14 }) }) })
3889
+ editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsx(te, { name: "close", size: 14 }) }) })
2576
3890
  ] }, r.code)) })
2577
3891
  ] }),
2578
3892
  editable && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-vat-table__add", onClick: addRow, children: L.add })
@@ -2648,6 +3962,7 @@ const NiceJpkExporter = /* @__PURE__ */ forwardRef(
2648
3962
  style,
2649
3963
  id
2650
3964
  }, ref) {
3965
+ const { t } = v();
2651
3966
  const today = /* @__PURE__ */ new Date();
2652
3967
  const [format, setFormat] = useState(defaultFormat);
2653
3968
  const [from, setFrom] = useState(
@@ -2710,10 +4025,10 @@ const NiceJpkExporter = /* @__PURE__ */ forwardRef(
2710
4025
  /* @__PURE__ */ jsx("input", { type: "date", value: to, onChange: (e) => setTo(e.target.value) })
2711
4026
  ] }),
2712
4027
  /* @__PURE__ */ jsx("button", { type: "button", onClick: exportNow, children: L.export }),
2713
- /* @__PURE__ */ jsxs("small", { children: [
2714
- invoices.length,
2715
- " invoices ready"
2716
- ] })
4028
+ /* @__PURE__ */ jsx("small", { children: t("jpkExporter.invoicesReady", "{invoices} invoices ready").replace(
4029
+ "{invoices}",
4030
+ String(invoices.length)
4031
+ ) })
2717
4032
  ] });
2718
4033
  }
2719
4034
  );