@nice2dev/ui-platform 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +605 -588
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var nt = Object.defineProperty;
|
|
2
|
-
var rt = (t, g,
|
|
3
|
-
var we = (t, g,
|
|
2
|
+
var rt = (t, g, o) => g in t ? nt(t, g, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[g] = o;
|
|
3
|
+
var we = (t, g, o) => rt(t, typeof g != "symbol" ? g + "" : g, o);
|
|
4
4
|
import { jsx as d, jsxs as J, Fragment as Ae } from "react/jsx-runtime";
|
|
5
5
|
import { useNiceTranslation as ue } from "@nice2dev/ui-core";
|
|
6
|
-
import ke, { forwardRef as ce, useRef as re, useState as ee, useCallback as
|
|
6
|
+
import ke, { forwardRef as ce, useRef as re, useState as ee, useCallback as i, useEffect as ne, useImperativeHandle as le, useContext as fe, createContext as me, useMemo as he } from "react";
|
|
7
7
|
const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
8
8
|
const t = fe(Se);
|
|
9
9
|
if (!t)
|
|
@@ -23,7 +23,7 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
23
23
|
sendAnalytics: !1
|
|
24
24
|
}, at = /* @__PURE__ */ Object.assign(
|
|
25
25
|
/* @__PURE__ */ ce((t, g) => {
|
|
26
|
-
const { t:
|
|
26
|
+
const { t: o } = ue(), {
|
|
27
27
|
tasks: b = [],
|
|
28
28
|
config: x,
|
|
29
29
|
splash: S,
|
|
@@ -44,7 +44,7 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
44
44
|
results: [],
|
|
45
45
|
recoveryAttempt: 0,
|
|
46
46
|
totalDuration: 0
|
|
47
|
-
}), z =
|
|
47
|
+
}), z = i(
|
|
48
48
|
async (n) => {
|
|
49
49
|
const u = Date.now();
|
|
50
50
|
let e = 0;
|
|
@@ -73,7 +73,7 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
73
73
|
return c();
|
|
74
74
|
},
|
|
75
75
|
[E.globalTimeout]
|
|
76
|
-
), X =
|
|
76
|
+
), X = i((n) => {
|
|
77
77
|
const u = [], e = [...n], c = /* @__PURE__ */ new Set();
|
|
78
78
|
for (; e.length > 0; ) {
|
|
79
79
|
const s = e.filter((w) => w.dependencies ? w.dependencies.every((v) => c.has(v)) : !0);
|
|
@@ -86,7 +86,7 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
86
86
|
u.push(h), c.add(h.id), e.splice(e.indexOf(h), 1);
|
|
87
87
|
}
|
|
88
88
|
return u;
|
|
89
|
-
}, []), R =
|
|
89
|
+
}, []), R = i(async () => {
|
|
90
90
|
f.current = Date.now();
|
|
91
91
|
const n = new AbortController();
|
|
92
92
|
I.current = n;
|
|
@@ -154,12 +154,12 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
154
154
|
_,
|
|
155
155
|
D,
|
|
156
156
|
Y
|
|
157
|
-
]), G =
|
|
157
|
+
]), G = i(async () => {
|
|
158
158
|
I.current && I.current.abort(), H((n) => ({
|
|
159
159
|
...n,
|
|
160
160
|
recoveryAttempt: 0
|
|
161
161
|
})), $(E.showSplash), await R();
|
|
162
|
-
}, [E.showSplash, R]), M =
|
|
162
|
+
}, [E.showSplash, R]), M = i(() => {
|
|
163
163
|
I.current && I.current.abort(), H((n) => ({
|
|
164
164
|
...n,
|
|
165
165
|
phase: "ready",
|
|
@@ -167,9 +167,9 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
167
167
|
isReady: !0,
|
|
168
168
|
progress: 100
|
|
169
169
|
})), $(!1);
|
|
170
|
-
}, []), F =
|
|
170
|
+
}, []), F = i(() => {
|
|
171
171
|
$(!1);
|
|
172
|
-
}, []), A =
|
|
172
|
+
}, []), A = i(async () => {
|
|
173
173
|
const n = q.recoveryAttempt + 1;
|
|
174
174
|
n > E.recoveryAttempts || (H((u) => ({
|
|
175
175
|
...u,
|
|
@@ -182,11 +182,11 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
182
182
|
E.recoveryDelay,
|
|
183
183
|
r,
|
|
184
184
|
R
|
|
185
|
-
]), C =
|
|
185
|
+
]), C = i((n) => {
|
|
186
186
|
m.current = [...m.current, n];
|
|
187
|
-
}, []), O =
|
|
187
|
+
}, []), O = i((n) => {
|
|
188
188
|
m.current = m.current.filter((u) => u.id !== n);
|
|
189
|
-
}, []), W =
|
|
189
|
+
}, []), W = i(
|
|
190
190
|
(n) => q.results.find((u) => u.taskId === n),
|
|
191
191
|
[q.results]
|
|
192
192
|
);
|
|
@@ -222,12 +222,12 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
222
222
|
};
|
|
223
223
|
return q.hasError && q.recoveryAttempt >= E.recoveryAttempts ? /* @__PURE__ */ d(Se.Provider, { value: a, children: L || /* @__PURE__ */ J("div", { className: "nice-auto-start__error", children: [
|
|
224
224
|
/* @__PURE__ */ d("div", { className: "nice-auto-start__error-icon", "aria-hidden": "true", children: /* @__PURE__ */ d("span", { className: "nice-platform-mark nice-platform-mark--alert" }) }),
|
|
225
|
-
/* @__PURE__ */ d("h2", { className: "nice-auto-start__error-title", children:
|
|
225
|
+
/* @__PURE__ */ d("h2", { className: "nice-auto-start__error-title", children: o("autoStart.startupFailed", "Startup Failed") }),
|
|
226
226
|
/* @__PURE__ */ d("p", { className: "nice-auto-start__error-message", children: q.errorMessage }),
|
|
227
|
-
/* @__PURE__ */ d("button", { className: "nice-auto-start__error-retry", onClick: G, children:
|
|
227
|
+
/* @__PURE__ */ d("button", { className: "nice-auto-start__error-retry", onClick: G, children: o("autoStart.retry", "Retry") })
|
|
228
228
|
] }) }) : B && !q.isReady ? /* @__PURE__ */ d(Se.Provider, { value: a, children: S || /* @__PURE__ */ d("div", { className: "nice-auto-start__splash", children: /* @__PURE__ */ J("div", { className: "nice-auto-start__splash-content", children: [
|
|
229
229
|
/* @__PURE__ */ d("div", { className: "nice-auto-start__splash-logo", "aria-hidden": "true" }),
|
|
230
|
-
/* @__PURE__ */ d("h1", { className: "nice-auto-start__splash-title", children:
|
|
230
|
+
/* @__PURE__ */ d("h1", { className: "nice-auto-start__splash-title", children: o("autoStart.loading", "Loading...") }),
|
|
231
231
|
E.showProgress && /* @__PURE__ */ d("div", { className: "nice-auto-start__splash-progress", children: /* @__PURE__ */ d(
|
|
232
232
|
"div",
|
|
233
233
|
{
|
|
@@ -236,18 +236,18 @@ const Se = /* @__PURE__ */ me(null), Xn = () => {
|
|
|
236
236
|
}
|
|
237
237
|
) }),
|
|
238
238
|
E.showTaskNames && q.currentTask && /* @__PURE__ */ d("div", { className: "nice-auto-start__splash-task", children: q.currentTask }),
|
|
239
|
-
q.phase === "recovery" && /* @__PURE__ */ d("div", { className: "nice-auto-start__splash-recovery", children:
|
|
239
|
+
q.phase === "recovery" && /* @__PURE__ */ d("div", { className: "nice-auto-start__splash-recovery", children: o(
|
|
240
240
|
"autoStart.recoveryAttemptOf",
|
|
241
241
|
"Recovery attempt {recoveryAttempt} of {recoveryAttempts}"
|
|
242
242
|
).replace("{recoveryAttempt}", String(q.recoveryAttempt)).replace("{recoveryAttempts}", String(E.recoveryAttempts)) })
|
|
243
243
|
] }) }) }) : /* @__PURE__ */ d(Se.Provider, { value: a, children: y });
|
|
244
244
|
}),
|
|
245
245
|
{ displayName: "NiceAutoStart" }
|
|
246
|
-
),
|
|
247
|
-
process.env.NODE_ENV !== "production" && (
|
|
246
|
+
), ot = at;
|
|
247
|
+
process.env.NODE_ENV !== "production" && (ot.displayName = "NiceAutoStartProvider");
|
|
248
248
|
const qe = /* @__PURE__ */ me(
|
|
249
249
|
null
|
|
250
|
-
),
|
|
250
|
+
), it = () => {
|
|
251
251
|
const t = fe(qe);
|
|
252
252
|
if (!t)
|
|
253
253
|
throw new Error("useExternalDisplay must be used within NiceExternalDisplayProvider");
|
|
@@ -268,8 +268,8 @@ const qe = /* @__PURE__ */ me(
|
|
|
268
268
|
function Ee(t, g) {
|
|
269
269
|
if (t.id === "primary" && t.label === Ne)
|
|
270
270
|
return g("externalDisplay.primaryDisplay", Ne);
|
|
271
|
-
const
|
|
272
|
-
return
|
|
271
|
+
const o = /^Display (\d+)$/.exec(t.label);
|
|
272
|
+
return o ? g("externalDisplay.displayN", "Display {n}").replace("{n}", o[1]) : t.label;
|
|
273
273
|
}
|
|
274
274
|
const Pe = () => {
|
|
275
275
|
var g;
|
|
@@ -311,12 +311,12 @@ const Pe = () => {
|
|
|
311
311
|
} catch {
|
|
312
312
|
return "unknown";
|
|
313
313
|
}
|
|
314
|
-
}, Oe = async () => (await window.getScreenDetails()).screens.map((g,
|
|
314
|
+
}, Oe = async () => (await window.getScreenDetails()).screens.map((g, o) => {
|
|
315
315
|
var b;
|
|
316
316
|
return {
|
|
317
|
-
id: `screen-${
|
|
317
|
+
id: `screen-${o}`,
|
|
318
318
|
// audit-allow: i18n — the detector's fallback name; screenName() shows it translated
|
|
319
|
-
label: g.label || `Display ${
|
|
319
|
+
label: g.label || `Display ${o + 1}`,
|
|
320
320
|
width: g.width,
|
|
321
321
|
height: g.height,
|
|
322
322
|
availWidth: g.availWidth,
|
|
@@ -332,23 +332,23 @@ const Pe = () => {
|
|
|
332
332
|
}), Te = (t, g) => JSON.stringify(t) === JSON.stringify(g), mt = /* @__PURE__ */ Object.assign(
|
|
333
333
|
/* @__PURE__ */ ce((t, g) => {
|
|
334
334
|
const {
|
|
335
|
-
config:
|
|
335
|
+
config: o,
|
|
336
336
|
onScreensChange: b,
|
|
337
337
|
onWindowOpen: x,
|
|
338
338
|
onWindowClose: S,
|
|
339
339
|
onPermissionChange: L,
|
|
340
340
|
children: Y
|
|
341
|
-
} = t, _ = { ...ct, ...
|
|
341
|
+
} = t, _ = { ...ct, ...o }, D = re(/* @__PURE__ */ new Map()), r = re(null), [y, E] = ee([Pe()]), [f, m] = ee([]), [I, B] = ee("unknown"), [$] = ee(lt), q = re(b), H = re(L);
|
|
342
342
|
ne(() => {
|
|
343
343
|
q.current = b, H.current = L;
|
|
344
344
|
});
|
|
345
|
-
const z = re([]), X =
|
|
345
|
+
const z = re([]), X = i((s) => {
|
|
346
346
|
var h;
|
|
347
347
|
E((w) => Te(w, s) ? w : s), Te(z.current, s) || (z.current = s, (h = q.current) == null || h.call(q, s));
|
|
348
|
-
}, []), R = re("unknown"), G =
|
|
348
|
+
}, []), R = re("unknown"), G = i((s) => {
|
|
349
349
|
var h;
|
|
350
350
|
R.current !== s && (R.current = s, B(s), (h = H.current) == null || h.call(H, s));
|
|
351
|
-
}, []), M =
|
|
351
|
+
}, []), M = i(async () => {
|
|
352
352
|
if ($) {
|
|
353
353
|
const h = await ft();
|
|
354
354
|
if (G(h), h === "granted")
|
|
@@ -360,7 +360,7 @@ const Pe = () => {
|
|
|
360
360
|
}
|
|
361
361
|
const s = [Pe()];
|
|
362
362
|
return X(s), s;
|
|
363
|
-
}, [$, G, X]), F =
|
|
363
|
+
}, [$, G, X]), F = i(async () => {
|
|
364
364
|
if (!$)
|
|
365
365
|
return G("denied"), !1;
|
|
366
366
|
try {
|
|
@@ -370,7 +370,7 @@ const Pe = () => {
|
|
|
370
370
|
s instanceof DOMException && s.name === "NotAllowedError" ? "denied" : "unknown"
|
|
371
371
|
), !1;
|
|
372
372
|
}
|
|
373
|
-
}, [$, G, X]), A =
|
|
373
|
+
}, [$, G, X]), A = i(
|
|
374
374
|
async (s, h = "about:blank", w = {}) => {
|
|
375
375
|
if (!_.allowMultiWindow && f.length > 0)
|
|
376
376
|
return console.warn("Multi-window mode is disabled"), null;
|
|
@@ -421,17 +421,17 @@ const Pe = () => {
|
|
|
421
421
|
x,
|
|
422
422
|
S
|
|
423
423
|
]
|
|
424
|
-
), C =
|
|
424
|
+
), C = i((s) => {
|
|
425
425
|
const h = D.current.get(s);
|
|
426
426
|
h && !h.closed && h.close(), D.current.delete(s), m((w) => w.filter((v) => v.id !== s));
|
|
427
|
-
}, []), O =
|
|
427
|
+
}, []), O = i(() => {
|
|
428
428
|
for (const [s, h] of D.current)
|
|
429
429
|
h.closed || h.close(), D.current.delete(s);
|
|
430
430
|
m([]);
|
|
431
|
-
}, []), W =
|
|
431
|
+
}, []), W = i((s, h) => {
|
|
432
432
|
const w = D.current.get(s);
|
|
433
433
|
w && !w.closed && (w.moveTo(h.left, h.top), w.resizeTo(h.availWidth, h.availHeight), m((v) => v.map((N) => N.id === s ? { ...N, screen: h } : N)));
|
|
434
|
-
}, []), a =
|
|
434
|
+
}, []), a = i(async (s) => {
|
|
435
435
|
const h = D.current.get(s);
|
|
436
436
|
if (!h || h.closed)
|
|
437
437
|
return !1;
|
|
@@ -443,10 +443,10 @@ const Pe = () => {
|
|
|
443
443
|
} catch {
|
|
444
444
|
return !1;
|
|
445
445
|
}
|
|
446
|
-
}, []), n =
|
|
446
|
+
}, []), n = i((s, h) => {
|
|
447
447
|
const w = D.current.get(s);
|
|
448
448
|
w && !w.closed && w.postMessage(h, "*");
|
|
449
|
-
}, []), u =
|
|
449
|
+
}, []), u = i((s) => {
|
|
450
450
|
for (const h of D.current.values())
|
|
451
451
|
h.closed || h.postMessage(s, "*");
|
|
452
452
|
}, []);
|
|
@@ -519,10 +519,10 @@ process.env.NODE_ENV !== "production" && (ht.displayName = "NiceExternalDisplayP
|
|
|
519
519
|
const gt = ({
|
|
520
520
|
onSelect: t,
|
|
521
521
|
selectedId: g,
|
|
522
|
-
showPreview:
|
|
522
|
+
showPreview: o = !0,
|
|
523
523
|
className: b
|
|
524
524
|
}) => {
|
|
525
|
-
const { t: x } = ue(), { screens: S, primaryScreen: L } =
|
|
525
|
+
const { t: x } = ue(), { screens: S, primaryScreen: L } = it(), Y = (y) => {
|
|
526
526
|
t == null || t(y);
|
|
527
527
|
}, D = (() => {
|
|
528
528
|
let y = 0, E = 0, f = 0, m = 0;
|
|
@@ -531,7 +531,7 @@ const gt = ({
|
|
|
531
531
|
return { minX: y, minY: E, maxX: f, maxY: m, width: f - y, height: m - E };
|
|
532
532
|
})(), r = Math.min(280 / D.width, 160 / D.height, 1);
|
|
533
533
|
return /* @__PURE__ */ J("div", { className: `nice-screen-selector ${b || ""}`, children: [
|
|
534
|
-
|
|
534
|
+
o && /* @__PURE__ */ d(
|
|
535
535
|
"div",
|
|
536
536
|
{
|
|
537
537
|
className: "nice-screen-selector__preview",
|
|
@@ -600,7 +600,7 @@ const je = /* @__PURE__ */ me(null), Kn = () => {
|
|
|
600
600
|
className: ""
|
|
601
601
|
}, yt = /* @__PURE__ */ Object.assign(
|
|
602
602
|
/* @__PURE__ */ ce((t, g) => {
|
|
603
|
-
const { t:
|
|
603
|
+
const { t: o } = ue(), {
|
|
604
604
|
config: b,
|
|
605
605
|
children: x,
|
|
606
606
|
screensaver: S,
|
|
@@ -622,7 +622,7 @@ const je = /* @__PURE__ */ me(null), Kn = () => {
|
|
|
622
622
|
isScreensaverActive: !1,
|
|
623
623
|
idleTime: 0,
|
|
624
624
|
isPinDialogOpen: !1
|
|
625
|
-
}), [H, z] = ee(""), [X, R] = ee(!1), G =
|
|
625
|
+
}), [H, z] = ee(""), [X, R] = ee(!1), G = i(async () => {
|
|
626
626
|
const l = m.current;
|
|
627
627
|
if (l)
|
|
628
628
|
try {
|
|
@@ -630,22 +630,22 @@ const je = /* @__PURE__ */ me(null), Kn = () => {
|
|
|
630
630
|
} catch (p) {
|
|
631
631
|
console.warn("Failed to enter fullscreen:", p);
|
|
632
632
|
}
|
|
633
|
-
}, []), M =
|
|
633
|
+
}, []), M = i(async () => {
|
|
634
634
|
try {
|
|
635
635
|
document.exitFullscreen ? await document.exitFullscreen() : document.webkitExitFullscreen ? await document.webkitExitFullscreen() : document.msExitFullscreen && await document.msExitFullscreen();
|
|
636
636
|
} catch (l) {
|
|
637
637
|
console.warn("Failed to exit fullscreen:", l);
|
|
638
638
|
}
|
|
639
|
-
}, []), F =
|
|
639
|
+
}, []), F = i(async () => {
|
|
640
640
|
$.isFullscreen ? await M() : await G();
|
|
641
|
-
}, [$.isFullscreen, G, M]), A =
|
|
641
|
+
}, [$.isFullscreen, G, M]), A = i(() => {
|
|
642
642
|
q((l) => ({
|
|
643
643
|
...l,
|
|
644
644
|
mode: "locked",
|
|
645
645
|
isLocked: !0,
|
|
646
646
|
isAdminMode: !1
|
|
647
647
|
})), Y == null || Y("locked");
|
|
648
|
-
}, [Y]), C =
|
|
648
|
+
}, [Y]), C = i(
|
|
649
649
|
(l) => f.exitPin && l !== f.exitPin ? (R(!0), setTimeout(() => R(!1), 1e3), !1) : (q((p) => ({
|
|
650
650
|
...p,
|
|
651
651
|
mode: p.isFullscreen ? "fullscreen" : "windowed",
|
|
@@ -653,29 +653,29 @@ const je = /* @__PURE__ */ me(null), Kn = () => {
|
|
|
653
653
|
isPinDialogOpen: !1
|
|
654
654
|
})), z(""), !0),
|
|
655
655
|
[f.exitPin]
|
|
656
|
-
), O =
|
|
656
|
+
), O = i(() => {
|
|
657
657
|
q((l) => ({ ...l, isAdminMode: !0 })), D == null || D();
|
|
658
|
-
}, [D]), W =
|
|
658
|
+
}, [D]), W = i(() => {
|
|
659
659
|
q((l) => ({ ...l, isAdminMode: !1 }));
|
|
660
|
-
}, []), a =
|
|
660
|
+
}, []), a = i(() => {
|
|
661
661
|
B.current.timer && clearTimeout(B.current.timer), B.current.count++, B.current.count >= f.adminTapCount ? (B.current.count = 0, O()) : B.current.timer = setTimeout(() => {
|
|
662
662
|
B.current.count = 0;
|
|
663
663
|
}, f.adminTapTimeout);
|
|
664
|
-
}, [f.adminTapCount, f.adminTapTimeout, O]), n =
|
|
664
|
+
}, [f.adminTapCount, f.adminTapTimeout, O]), n = i(() => {
|
|
665
665
|
I.current && clearTimeout(I.current), $.isScreensaverActive && (q((l) => ({ ...l, isScreensaverActive: !1 })), y == null || y()), f.inactivityTimeout > 0 && (I.current = setTimeout(() => {
|
|
666
666
|
q((l) => ({ ...l, isScreensaverActive: !0 })), r == null || r();
|
|
667
667
|
}, f.inactivityTimeout));
|
|
668
|
-
}, [f.inactivityTimeout, $.isScreensaverActive, y, r]), u =
|
|
668
|
+
}, [f.inactivityTimeout, $.isScreensaverActive, y, r]), u = i(() => {
|
|
669
669
|
q((l) => ({ ...l, isScreensaverActive: !0 }));
|
|
670
|
-
}, []), e =
|
|
670
|
+
}, []), e = i(() => {
|
|
671
671
|
q((l) => ({ ...l, isScreensaverActive: !1 })), n();
|
|
672
|
-
}, [n]), c =
|
|
672
|
+
}, [n]), c = i(() => {
|
|
673
673
|
q((l) => ({ ...l, isPinDialogOpen: !0 })), z(""), R(!1);
|
|
674
|
-
}, []), s =
|
|
674
|
+
}, []), s = i(() => {
|
|
675
675
|
q((l) => ({ ...l, isPinDialogOpen: !1 })), z(""), R(!1);
|
|
676
|
-
}, []), h =
|
|
676
|
+
}, []), h = i(() => {
|
|
677
677
|
C(H);
|
|
678
|
-
}, [H, C]), w =
|
|
678
|
+
}, [H, C]), w = i(
|
|
679
679
|
(l) => {
|
|
680
680
|
l.key === "Enter" && h();
|
|
681
681
|
},
|
|
@@ -818,75 +818,85 @@ const je = /* @__PURE__ */ me(null), Kn = () => {
|
|
|
818
818
|
!f.allowScrolling && "nice-kiosk-mode--no-scroll",
|
|
819
819
|
f.className
|
|
820
820
|
].filter(Boolean).join(" ");
|
|
821
|
-
return /* @__PURE__ */ d(je.Provider, { value: v, children: /* @__PURE__ */ J(
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
821
|
+
return /* @__PURE__ */ d(je.Provider, { value: v, children: /* @__PURE__ */ J(
|
|
822
|
+
"div",
|
|
823
|
+
{
|
|
824
|
+
role: "presentation",
|
|
825
|
+
ref: m,
|
|
826
|
+
className: N,
|
|
827
|
+
onClick: a,
|
|
828
|
+
children: [
|
|
829
|
+
/* @__PURE__ */ d("div", { className: "nice-kiosk-mode__content", children: x }),
|
|
830
|
+
$.isAdminMode && L && /* @__PURE__ */ J("div", { className: "nice-kiosk-mode__admin", children: [
|
|
831
|
+
/* @__PURE__ */ J("div", { className: "nice-kiosk-mode__admin-header", children: [
|
|
832
|
+
/* @__PURE__ */ d("h2", { className: "nice-kiosk-mode__admin-title", children: o("kioskMode.adminMode", "Admin Mode") }),
|
|
833
|
+
/* @__PURE__ */ d(
|
|
834
|
+
"button",
|
|
834
835
|
{
|
|
835
|
-
className: "nice-
|
|
836
|
-
|
|
836
|
+
className: "nice-kiosk-mode__admin-close",
|
|
837
|
+
onClick: W,
|
|
838
|
+
"aria-label": o("kioskMode.closeAdminPanel", "Close admin panel"),
|
|
839
|
+
children: /* @__PURE__ */ d(
|
|
840
|
+
"span",
|
|
841
|
+
{
|
|
842
|
+
className: "nice-platform-mark nice-platform-mark--close",
|
|
843
|
+
"aria-hidden": "true"
|
|
844
|
+
}
|
|
845
|
+
)
|
|
837
846
|
}
|
|
838
847
|
)
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
$.isScreensaverActive && /* @__PURE__ */ d(
|
|
845
|
-
"div",
|
|
846
|
-
{
|
|
847
|
-
className: "nice-kiosk-mode__screensaver",
|
|
848
|
-
onClick: e,
|
|
849
|
-
onTouchStart: e,
|
|
850
|
-
children: S || /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__screensaver-default", children: /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__screensaver-text", children: i("kioskMode.touchToContinue", "Touch to continue") }) })
|
|
851
|
-
}
|
|
852
|
-
),
|
|
853
|
-
$.isPinDialogOpen && /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__pin-overlay", children: /* @__PURE__ */ J("div", { className: "nice-kiosk-mode__pin-dialog", children: [
|
|
854
|
-
/* @__PURE__ */ d("h3", { className: "nice-kiosk-mode__pin-title", children: i("kioskMode.enterPin", "Enter PIN") }),
|
|
855
|
-
/* @__PURE__ */ d(
|
|
856
|
-
"input",
|
|
857
|
-
{
|
|
858
|
-
type: "password",
|
|
859
|
-
className: `nice-kiosk-mode__pin-input ${X ? "nice-kiosk-mode__pin-input--error" : ""}`,
|
|
860
|
-
value: H,
|
|
861
|
-
onChange: (l) => z(l.target.value),
|
|
862
|
-
onKeyPress: w,
|
|
863
|
-
maxLength: 8,
|
|
864
|
-
autoFocus: !0,
|
|
865
|
-
placeholder: "••••"
|
|
866
|
-
}
|
|
867
|
-
),
|
|
868
|
-
/* @__PURE__ */ J("div", { className: "nice-kiosk-mode__pin-buttons", children: [
|
|
869
|
-
/* @__PURE__ */ d(
|
|
870
|
-
"button",
|
|
848
|
+
] }),
|
|
849
|
+
/* @__PURE__ */ d("div", { className: "nice-kiosk-mode__admin-content", children: L })
|
|
850
|
+
] }),
|
|
851
|
+
$.isScreensaverActive && /* @__PURE__ */ d(
|
|
852
|
+
"div",
|
|
871
853
|
{
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
854
|
+
role: "presentation",
|
|
855
|
+
className: "nice-kiosk-mode__screensaver",
|
|
856
|
+
onClick: e,
|
|
857
|
+
onTouchStart: e,
|
|
858
|
+
children: S || /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__screensaver-default", children: /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__screensaver-text", children: o("kioskMode.touchToContinue", "Touch to continue") }) })
|
|
875
859
|
}
|
|
876
860
|
),
|
|
877
|
-
/* @__PURE__ */ d(
|
|
878
|
-
"
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
861
|
+
$.isPinDialogOpen && /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__pin-overlay", children: /* @__PURE__ */ J("div", { className: "nice-kiosk-mode__pin-dialog", children: [
|
|
862
|
+
/* @__PURE__ */ d("h3", { className: "nice-kiosk-mode__pin-title", children: o("kioskMode.enterPin", "Enter PIN") }),
|
|
863
|
+
/* @__PURE__ */ d(
|
|
864
|
+
"input",
|
|
865
|
+
{
|
|
866
|
+
type: "password",
|
|
867
|
+
className: `nice-kiosk-mode__pin-input ${X ? "nice-kiosk-mode__pin-input--error" : ""}`,
|
|
868
|
+
value: H,
|
|
869
|
+
onChange: (l) => z(l.target.value),
|
|
870
|
+
onKeyPress: w,
|
|
871
|
+
maxLength: 8,
|
|
872
|
+
autoFocus: !0,
|
|
873
|
+
placeholder: "••••"
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ J("div", { className: "nice-kiosk-mode__pin-buttons", children: [
|
|
877
|
+
/* @__PURE__ */ d(
|
|
878
|
+
"button",
|
|
879
|
+
{
|
|
880
|
+
className: "nice-kiosk-mode__pin-btn nice-kiosk-mode__pin-btn--cancel",
|
|
881
|
+
onClick: s,
|
|
882
|
+
children: o("kioskMode.cancel", "Cancel")
|
|
883
|
+
}
|
|
884
|
+
),
|
|
885
|
+
/* @__PURE__ */ d(
|
|
886
|
+
"button",
|
|
887
|
+
{
|
|
888
|
+
className: "nice-kiosk-mode__pin-btn nice-kiosk-mode__pin-btn--submit",
|
|
889
|
+
onClick: h,
|
|
890
|
+
children: o("kioskMode.unlock", "Unlock")
|
|
891
|
+
}
|
|
892
|
+
)
|
|
893
|
+
] }),
|
|
894
|
+
X && /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__pin-error", children: o("kioskMode.incorrectPin", "Incorrect PIN") })
|
|
895
|
+
] }) }),
|
|
896
|
+
$.isLocked && !$.isPinDialogOpen && /* @__PURE__ */ d("div", { className: "nice-kiosk-mode__lock-indicator", children: /* @__PURE__ */ d("span", { className: "nice-kiosk-mode__lock-text", children: o("kioskMode.kioskLocked", "Kiosk Locked") }) })
|
|
897
|
+
]
|
|
898
|
+
}
|
|
899
|
+
) });
|
|
890
900
|
}),
|
|
891
901
|
{ displayName: "NiceKioskMode" }
|
|
892
902
|
), vt = yt;
|
|
@@ -939,7 +949,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
939
949
|
transitionDuration: 500
|
|
940
950
|
}, St = /* @__PURE__ */ Object.assign(
|
|
941
951
|
/* @__PURE__ */ ce((t, g) => {
|
|
942
|
-
const { t:
|
|
952
|
+
const { t: o } = ue(), {
|
|
943
953
|
config: b,
|
|
944
954
|
onModeChange: x,
|
|
945
955
|
onBrightnessChange: S,
|
|
@@ -961,7 +971,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
961
971
|
H.current = $;
|
|
962
972
|
const z = re({ onModeChange: x, onBrightnessChange: S, onSleep: L, onWake: Y });
|
|
963
973
|
z.current = { onModeChange: x, onBrightnessChange: S, onSleep: L, onWake: Y };
|
|
964
|
-
const X =
|
|
974
|
+
const X = i(
|
|
965
975
|
(e) => {
|
|
966
976
|
const c = E[e];
|
|
967
977
|
document.documentElement.style.setProperty(
|
|
@@ -973,7 +983,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
973
983
|
), c.disableAnimations ? document.documentElement.classList.add("nice-lpm-no-animations") : document.documentElement.classList.remove("nice-lpm-no-animations"), c.reduceImageQuality ? document.documentElement.classList.add("nice-lpm-reduced-quality") : document.documentElement.classList.remove("nice-lpm-reduced-quality");
|
|
974
984
|
},
|
|
975
985
|
[E, r.transitionDuration]
|
|
976
|
-
), R =
|
|
986
|
+
), R = i(
|
|
977
987
|
(e) => {
|
|
978
988
|
q((c) => {
|
|
979
989
|
var v, N, l, p;
|
|
@@ -993,7 +1003,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
993
1003
|
});
|
|
994
1004
|
},
|
|
995
1005
|
[E, X]
|
|
996
|
-
), G =
|
|
1006
|
+
), G = i(
|
|
997
1007
|
(e) => {
|
|
998
1008
|
const c = Math.max(0, Math.min(1, e));
|
|
999
1009
|
document.documentElement.style.setProperty("--lpm-brightness", String(c)), q((s) => ({
|
|
@@ -1002,21 +1012,21 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
1002
1012
|
})), S == null || S(c);
|
|
1003
1013
|
},
|
|
1004
1014
|
[S]
|
|
1005
|
-
), M =
|
|
1015
|
+
), M = i(() => {
|
|
1006
1016
|
R("sleep");
|
|
1007
|
-
}, [R]), F =
|
|
1017
|
+
}, [R]), F = i(() => {
|
|
1008
1018
|
I.current = Date.now(), f.current && clearTimeout(f.current), m.current && clearTimeout(m.current), r.autoDimTimeout > 0 && (f.current = setTimeout(() => {
|
|
1009
1019
|
H.current.currentMode === "normal" && R("dim");
|
|
1010
1020
|
}, r.autoDimTimeout)), r.autoSleepTimeout > 0 && (m.current = setTimeout(() => {
|
|
1011
1021
|
R("sleep");
|
|
1012
1022
|
}, r.autoSleepTimeout)), q((e) => e.idleTime === 0 ? e : { ...e, idleTime: 0 });
|
|
1013
|
-
}, [r.autoDimTimeout, r.autoSleepTimeout, R]), A =
|
|
1023
|
+
}, [r.autoDimTimeout, r.autoSleepTimeout, R]), A = i(() => {
|
|
1014
1024
|
H.current.currentMode !== "normal" && R("normal"), F();
|
|
1015
|
-
}, [R, F]), C =
|
|
1025
|
+
}, [R, F]), C = i(() => {
|
|
1016
1026
|
R("normal"), A();
|
|
1017
|
-
}, [R, A]), O =
|
|
1027
|
+
}, [R, A]), O = i(() => {
|
|
1018
1028
|
$.currentMode === "normal" ? R("low") : R("normal");
|
|
1019
|
-
}, [$.currentMode, R]), W =
|
|
1029
|
+
}, [$.currentMode, R]), W = i(async () => {
|
|
1020
1030
|
if (typeof navigator < "u" && "getBattery" in navigator)
|
|
1021
1031
|
try {
|
|
1022
1032
|
const e = await navigator.getBattery();
|
|
@@ -1028,7 +1038,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
1028
1038
|
return {};
|
|
1029
1039
|
}
|
|
1030
1040
|
return {};
|
|
1031
|
-
}, []), a =
|
|
1041
|
+
}, []), a = i(async () => {
|
|
1032
1042
|
const e = await W();
|
|
1033
1043
|
e.level !== void 0 && (q((c) => ({
|
|
1034
1044
|
...c,
|
|
@@ -1042,7 +1052,7 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
1042
1052
|
$.currentMode,
|
|
1043
1053
|
R,
|
|
1044
1054
|
_
|
|
1045
|
-
]), n =
|
|
1055
|
+
]), n = i(() => {
|
|
1046
1056
|
if (!(b != null && b.schedule) || b.schedule.length === 0)
|
|
1047
1057
|
return;
|
|
1048
1058
|
const c = (/* @__PURE__ */ new Date()).getHours();
|
|
@@ -1127,10 +1137,11 @@ const Ue = /* @__PURE__ */ me(null), Qn = () => {
|
|
|
1127
1137
|
$.isSleeping && /* @__PURE__ */ d(
|
|
1128
1138
|
"div",
|
|
1129
1139
|
{
|
|
1140
|
+
role: "presentation",
|
|
1130
1141
|
className: "nice-lpm__sleep-screen",
|
|
1131
1142
|
onClick: r.wakeOnTouch ? C : void 0,
|
|
1132
1143
|
onTouchStart: r.wakeOnTouch ? C : void 0,
|
|
1133
|
-
children: /* @__PURE__ */ d("div", { className: "nice-lpm__sleep-message", children:
|
|
1144
|
+
children: /* @__PURE__ */ d("div", { className: "nice-lpm__sleep-message", children: o("lowPowerMode.touchToWake", "Touch to wake") })
|
|
1134
1145
|
}
|
|
1135
1146
|
)
|
|
1136
1147
|
] }) });
|
|
@@ -1180,15 +1191,15 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1180
1191
|
height: 0,
|
|
1181
1192
|
aspectRatio: 0
|
|
1182
1193
|
};
|
|
1183
|
-
const t = We(), g = Ct(),
|
|
1194
|
+
const t = We(), g = Ct(), o = window.screen.width, b = window.screen.height, x = t.includes("portrait") || window.innerHeight > window.innerWidth, S = t.includes("landscape") || window.innerWidth > window.innerHeight;
|
|
1184
1195
|
return {
|
|
1185
1196
|
type: t,
|
|
1186
1197
|
angle: g,
|
|
1187
1198
|
isPortrait: x,
|
|
1188
1199
|
isLandscape: S,
|
|
1189
|
-
width:
|
|
1200
|
+
width: o,
|
|
1190
1201
|
height: b,
|
|
1191
|
-
aspectRatio:
|
|
1202
|
+
aspectRatio: o / b
|
|
1192
1203
|
};
|
|
1193
1204
|
}, xt = () => {
|
|
1194
1205
|
if (typeof window > "u")
|
|
@@ -1197,7 +1208,7 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1197
1208
|
return !!(t.orientation && typeof t.orientation.lock == "function");
|
|
1198
1209
|
}, kt = /* @__PURE__ */ Object.assign(
|
|
1199
1210
|
/* @__PURE__ */ ce((t, g) => {
|
|
1200
|
-
const { t:
|
|
1211
|
+
const { t: o } = ue(), {
|
|
1201
1212
|
config: b,
|
|
1202
1213
|
onOrientationChange: x,
|
|
1203
1214
|
onLockChange: S,
|
|
@@ -1205,10 +1216,10 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1205
1216
|
rotationPrompt: Y,
|
|
1206
1217
|
children: _,
|
|
1207
1218
|
className: D
|
|
1208
|
-
} = t, r = { ...Nt, ...b }, y = re(!1), [E, f] = ee(We), [m, I] = ee(null), [B, $] = ee(Ie), [q] = ee(xt), H =
|
|
1219
|
+
} = t, r = { ...Nt, ...b }, y = re(!1), [E, f] = ee(We), [m, I] = ee(null), [B, $] = ee(Ie), [q] = ee(xt), H = i(
|
|
1209
1220
|
(a) => !!(r.supportedOrientations.includes("any") || r.supportedOrientations.includes(a) || a.includes("portrait") && r.supportedOrientations.includes("portrait") || a.includes("landscape") && r.supportedOrientations.includes("landscape")),
|
|
1210
1221
|
[r.supportedOrientations]
|
|
1211
|
-
), z =
|
|
1222
|
+
), z = i(
|
|
1212
1223
|
async (a) => {
|
|
1213
1224
|
if (!q)
|
|
1214
1225
|
return console.warn("Screen Orientation API is not available"), I(a), S == null || S(!0, a), !1;
|
|
@@ -1219,7 +1230,7 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1219
1230
|
}
|
|
1220
1231
|
},
|
|
1221
1232
|
[q, S]
|
|
1222
|
-
), X =
|
|
1233
|
+
), X = i(async () => {
|
|
1223
1234
|
if (I(null), S == null || S(!1, null), !q)
|
|
1224
1235
|
return !1;
|
|
1225
1236
|
try {
|
|
@@ -1227,7 +1238,7 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1227
1238
|
} catch (a) {
|
|
1228
1239
|
return console.warn("Failed to unlock orientation:", a), !1;
|
|
1229
1240
|
}
|
|
1230
|
-
}, [q, S]), R =
|
|
1241
|
+
}, [q, S]), R = i(async () => m ? X() : z(E), [m, E, z, X]), G = i(() => Ie(), []), M = i(() => {
|
|
1231
1242
|
const a = Ie(), n = a.type;
|
|
1232
1243
|
f(n), $(a), x == null || x(a), H(n) || L == null || L(n, r.supportedOrientations);
|
|
1233
1244
|
}, [
|
|
@@ -1272,7 +1283,7 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1272
1283
|
lock: z,
|
|
1273
1284
|
unlock: X,
|
|
1274
1285
|
getOrientationInfo: G
|
|
1275
|
-
}, C =
|
|
1286
|
+
}, C = i(() => {
|
|
1276
1287
|
if (!r.autoRotateContent || !m || m === "any")
|
|
1277
1288
|
return;
|
|
1278
1289
|
const a = m.includes("portrait"), n = B.isPortrait;
|
|
@@ -1306,10 +1317,10 @@ const Ve = /* @__PURE__ */ me(null), Jn = () => {
|
|
|
1306
1317
|
"aria-hidden": "true"
|
|
1307
1318
|
}
|
|
1308
1319
|
) }),
|
|
1309
|
-
/* @__PURE__ */ d("p", { className: "nice-orientation__prompt-text", children: m != null && m.includes("portrait") ?
|
|
1320
|
+
/* @__PURE__ */ d("p", { className: "nice-orientation__prompt-text", children: m != null && m.includes("portrait") ? o(
|
|
1310
1321
|
"orientationLock.rotateToPortrait",
|
|
1311
1322
|
"Please rotate your device to portrait mode"
|
|
1312
|
-
) :
|
|
1323
|
+
) : o(
|
|
1313
1324
|
"orientationLock.rotateToLandscape",
|
|
1314
1325
|
"Please rotate your device to landscape mode"
|
|
1315
1326
|
) })
|
|
@@ -1340,19 +1351,19 @@ const ze = /* @__PURE__ */ me(
|
|
|
1340
1351
|
}, Dt = /* @__PURE__ */ Object.assign(
|
|
1341
1352
|
/* @__PURE__ */ ce((t, g) => {
|
|
1342
1353
|
const {
|
|
1343
|
-
config:
|
|
1354
|
+
config: o,
|
|
1344
1355
|
onConnectionChange: b,
|
|
1345
1356
|
onCommandReceived: x,
|
|
1346
1357
|
onCustomCommand: S,
|
|
1347
1358
|
onCaptureScreenshot: L,
|
|
1348
1359
|
children: Y
|
|
1349
|
-
} = t, _ = { ...At, ...
|
|
1360
|
+
} = t, _ = { ...At, ...o }, D = re(null), r = re(null), y = re(null), E = re([]), f = re(Date.now()), m = re(0), [I, B] = ee({
|
|
1350
1361
|
status: "disconnected",
|
|
1351
1362
|
isConnected: !1,
|
|
1352
1363
|
reconnectAttempts: 0,
|
|
1353
1364
|
pendingCommands: [],
|
|
1354
1365
|
commandHistory: []
|
|
1355
|
-
}), $ =
|
|
1366
|
+
}), $ = i(() => {
|
|
1356
1367
|
const a = typeof navigator < "u" ? navigator : null, n = typeof window < "u" ? window : null;
|
|
1357
1368
|
return {
|
|
1358
1369
|
deviceId: _.deviceId,
|
|
@@ -1364,7 +1375,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1364
1375
|
uptime: Math.floor((Date.now() - f.current) / 1e3),
|
|
1365
1376
|
metadata: {}
|
|
1366
1377
|
};
|
|
1367
|
-
}, [_.deviceId, _.deviceName]), q =
|
|
1378
|
+
}, [_.deviceId, _.deviceName]), q = i(async () => {
|
|
1368
1379
|
const a = {
|
|
1369
1380
|
isOnline: typeof navigator < "u" ? navigator.onLine : !0,
|
|
1370
1381
|
lastUpdated: /* @__PURE__ */ new Date()
|
|
@@ -1393,7 +1404,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1393
1404
|
ne(() => {
|
|
1394
1405
|
H.current = { enabled: _.enableScreenshot, capture: L };
|
|
1395
1406
|
});
|
|
1396
|
-
const z =
|
|
1407
|
+
const z = i(async () => {
|
|
1397
1408
|
const { enabled: a, capture: n } = H.current;
|
|
1398
1409
|
if (!a)
|
|
1399
1410
|
throw new Error("Screenshots are disabled on this device (enableScreenshot: false)");
|
|
@@ -1403,7 +1414,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1403
1414
|
if (!u)
|
|
1404
1415
|
throw new Error("The screenshot handler returned no image");
|
|
1405
1416
|
return u;
|
|
1406
|
-
}, []), X =
|
|
1417
|
+
}, []), X = i(
|
|
1407
1418
|
() => z().catch(() => {
|
|
1408
1419
|
}),
|
|
1409
1420
|
[z]
|
|
@@ -1411,7 +1422,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1411
1422
|
ne(() => {
|
|
1412
1423
|
R.current = { onConnectionChange: b, onCommandReceived: x, onCustomCommand: S };
|
|
1413
1424
|
});
|
|
1414
|
-
const G =
|
|
1425
|
+
const G = i(async () => {
|
|
1415
1426
|
var a, n, u, e, c;
|
|
1416
1427
|
if (((a = D.current) == null ? void 0 : a.readyState) !== WebSocket.OPEN) {
|
|
1417
1428
|
B((s) => ({ ...s, status: "connecting" })), (u = (n = R.current).onConnectionChange) == null || u.call(n, "connecting");
|
|
@@ -1517,7 +1528,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1517
1528
|
_.reconnectDelay,
|
|
1518
1529
|
$,
|
|
1519
1530
|
z
|
|
1520
|
-
]), M =
|
|
1531
|
+
]), M = i(() => {
|
|
1521
1532
|
m.current = _.maxReconnectAttempts, D.current && (D.current.close(), D.current = null), B((a) => ({
|
|
1522
1533
|
...a,
|
|
1523
1534
|
status: "disconnected",
|
|
@@ -1525,7 +1536,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1525
1536
|
reconnectAttempts: _.maxReconnectAttempts
|
|
1526
1537
|
// Prevent auto-reconnect
|
|
1527
1538
|
}));
|
|
1528
|
-
}, [_.maxReconnectAttempts]), F =
|
|
1539
|
+
}, [_.maxReconnectAttempts]), F = i(async () => {
|
|
1529
1540
|
var a;
|
|
1530
1541
|
((a = D.current) == null ? void 0 : a.readyState) === WebSocket.OPEN && (D.current.send(
|
|
1531
1542
|
JSON.stringify({
|
|
@@ -1534,7 +1545,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1534
1545
|
deviceId: _.deviceId
|
|
1535
1546
|
})
|
|
1536
1547
|
), B((n) => ({ ...n, lastHeartbeat: /* @__PURE__ */ new Date() })));
|
|
1537
|
-
}, [_.deviceId]), A =
|
|
1548
|
+
}, [_.deviceId]), A = i(
|
|
1538
1549
|
async (a) => {
|
|
1539
1550
|
var u;
|
|
1540
1551
|
if (((u = D.current) == null ? void 0 : u.readyState) !== WebSocket.OPEN)
|
|
@@ -1549,7 +1560,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1549
1560
|
), B((e) => ({ ...e, healthMetrics: n }));
|
|
1550
1561
|
},
|
|
1551
1562
|
[_.deviceId, q]
|
|
1552
|
-
), C =
|
|
1563
|
+
), C = i(
|
|
1553
1564
|
async (a, n, u) => {
|
|
1554
1565
|
var e;
|
|
1555
1566
|
((e = D.current) == null ? void 0 : e.readyState) === WebSocket.OPEN && D.current.send(
|
|
@@ -1562,7 +1573,7 @@ const ze = /* @__PURE__ */ me(
|
|
|
1562
1573
|
);
|
|
1563
1574
|
},
|
|
1564
1575
|
[]
|
|
1565
|
-
), O =
|
|
1576
|
+
), O = i(
|
|
1566
1577
|
(a, n, u) => {
|
|
1567
1578
|
var c;
|
|
1568
1579
|
const e = { level: a, message: n, data: u, timestamp: /* @__PURE__ */ new Date() };
|
|
@@ -1668,13 +1679,13 @@ const Et = {
|
|
|
1668
1679
|
(t, g) => {
|
|
1669
1680
|
var s, h, w, v, N, l;
|
|
1670
1681
|
const {
|
|
1671
|
-
config:
|
|
1682
|
+
config: o,
|
|
1672
1683
|
enabled: b = !0,
|
|
1673
1684
|
onActivate: x,
|
|
1674
1685
|
onDeactivate: S,
|
|
1675
1686
|
onModeChange: L,
|
|
1676
1687
|
children: Y
|
|
1677
|
-
} = t, _ = { ...Et, ...
|
|
1688
|
+
} = t, _ = { ...Et, ...o }, D = re(null), r = re(null), y = re(null), E = re(null), [f, m] = ee({
|
|
1678
1689
|
isActive: !1,
|
|
1679
1690
|
activeModes: [],
|
|
1680
1691
|
shiftX: 0,
|
|
@@ -1682,7 +1693,7 @@ const Et = {
|
|
|
1682
1693
|
isDimmed: !1,
|
|
1683
1694
|
isScreensaverActive: !1,
|
|
1684
1695
|
idleTime: 0
|
|
1685
|
-
}), [I, B] = ee(0), [$, q] = ee({ x: 50, y: 50, dx: 1, dy: 1 }), H =
|
|
1696
|
+
}), [I, B] = ee(0), [$, q] = ee({ x: 50, y: 50, dx: 1, dy: 1 }), H = i(() => {
|
|
1686
1697
|
if (!_.pixelShift)
|
|
1687
1698
|
return;
|
|
1688
1699
|
const { maxShift: p } = _.pixelShift, T = Math.floor(Math.random() * (p * 2 + 1)) - p, K = Math.floor(Math.random() * (p * 2 + 1)) - p;
|
|
@@ -1691,20 +1702,20 @@ const Et = {
|
|
|
1691
1702
|
shiftX: T,
|
|
1692
1703
|
shiftY: K
|
|
1693
1704
|
}));
|
|
1694
|
-
}, [_.pixelShift]), z =
|
|
1705
|
+
}, [_.pixelShift]), z = i(() => {
|
|
1695
1706
|
!_.pixelShift || y.current || (H(), y.current = setInterval(H, _.pixelShift.interval));
|
|
1696
|
-
}, [_.pixelShift, H]), X =
|
|
1707
|
+
}, [_.pixelShift, H]), X = i(() => {
|
|
1697
1708
|
y.current && (clearInterval(y.current), y.current = null), m((p) => ({ ...p, shiftX: 0, shiftY: 0 }));
|
|
1698
|
-
}, []), R =
|
|
1709
|
+
}, []), R = i(() => {
|
|
1699
1710
|
!_.colorCycle || E.current || (E.current = setInterval(() => {
|
|
1700
1711
|
B((p) => {
|
|
1701
1712
|
var T;
|
|
1702
1713
|
return (p + 1) % (((T = _.colorCycle) == null ? void 0 : T.colors.length) || 1);
|
|
1703
1714
|
});
|
|
1704
1715
|
}, _.colorCycle.interval));
|
|
1705
|
-
}, [_.colorCycle]), G =
|
|
1716
|
+
}, [_.colorCycle]), G = i(() => {
|
|
1706
1717
|
E.current && (clearInterval(E.current), E.current = null), B(0);
|
|
1707
|
-
}, []), M =
|
|
1718
|
+
}, []), M = i(() => {
|
|
1708
1719
|
if (!b || f.isActive)
|
|
1709
1720
|
return;
|
|
1710
1721
|
const p = _.modes;
|
|
@@ -1721,7 +1732,7 @@ const Et = {
|
|
|
1721
1732
|
R,
|
|
1722
1733
|
x,
|
|
1723
1734
|
L
|
|
1724
|
-
]), F =
|
|
1735
|
+
]), F = i(() => {
|
|
1725
1736
|
f.isActive && (X(), G(), m((p) => ({
|
|
1726
1737
|
...p,
|
|
1727
1738
|
isActive: !1,
|
|
@@ -1729,17 +1740,17 @@ const Et = {
|
|
|
1729
1740
|
isDimmed: !1,
|
|
1730
1741
|
isScreensaverActive: !1
|
|
1731
1742
|
})), S == null || S(), L == null || L([]));
|
|
1732
|
-
}, [f.isActive, X, G, S, L]), A =
|
|
1743
|
+
}, [f.isActive, X, G, S, L]), A = i(() => {
|
|
1733
1744
|
f.isActive ? F() : M();
|
|
1734
|
-
}, [f.isActive, M, F]), C =
|
|
1745
|
+
}, [f.isActive, M, F]), C = i(() => {
|
|
1735
1746
|
r.current && clearTimeout(r.current), f.isActive && F(), b && _.inactivityTimeout > 0 && (r.current = setTimeout(() => {
|
|
1736
1747
|
M();
|
|
1737
1748
|
}, _.inactivityTimeout));
|
|
1738
|
-
}, [b, f.isActive, _.inactivityTimeout, M, F]), O =
|
|
1749
|
+
}, [b, f.isActive, _.inactivityTimeout, M, F]), O = i(() => {
|
|
1739
1750
|
m((p) => ({ ...p, isScreensaverActive: !0 }));
|
|
1740
|
-
}, []), W =
|
|
1751
|
+
}, []), W = i(() => {
|
|
1741
1752
|
m((p) => ({ ...p, isScreensaverActive: !1 })), C();
|
|
1742
|
-
}, [C]), a =
|
|
1753
|
+
}, [C]), a = i((p) => {
|
|
1743
1754
|
m((T) => ({
|
|
1744
1755
|
...T,
|
|
1745
1756
|
isDimmed: p > 0
|
|
@@ -1803,6 +1814,7 @@ const Et = {
|
|
|
1803
1814
|
return /* @__PURE__ */ d(
|
|
1804
1815
|
"div",
|
|
1805
1816
|
{
|
|
1817
|
+
role: "presentation",
|
|
1806
1818
|
className: "nice-sbp__screensaver nice-sbp__screensaver--blank",
|
|
1807
1819
|
onClick: W,
|
|
1808
1820
|
onTouchStart: W
|
|
@@ -1812,6 +1824,7 @@ const Et = {
|
|
|
1812
1824
|
return /* @__PURE__ */ d(
|
|
1813
1825
|
"div",
|
|
1814
1826
|
{
|
|
1827
|
+
role: "presentation",
|
|
1815
1828
|
className: "nice-sbp__screensaver nice-sbp__screensaver--bounce",
|
|
1816
1829
|
onClick: W,
|
|
1817
1830
|
onTouchStart: W,
|
|
@@ -1844,6 +1857,7 @@ const Et = {
|
|
|
1844
1857
|
return /* @__PURE__ */ d(
|
|
1845
1858
|
"div",
|
|
1846
1859
|
{
|
|
1860
|
+
role: "presentation",
|
|
1847
1861
|
className: "nice-sbp__screensaver nice-sbp__screensaver--matrix",
|
|
1848
1862
|
onClick: W,
|
|
1849
1863
|
onTouchStart: W,
|
|
@@ -1866,6 +1880,7 @@ const Et = {
|
|
|
1866
1880
|
return /* @__PURE__ */ d(
|
|
1867
1881
|
"div",
|
|
1868
1882
|
{
|
|
1883
|
+
role: "presentation",
|
|
1869
1884
|
className: "nice-sbp__screensaver nice-sbp__screensaver--noise",
|
|
1870
1885
|
onClick: W,
|
|
1871
1886
|
onTouchStart: W
|
|
@@ -1875,6 +1890,7 @@ const Et = {
|
|
|
1875
1890
|
return /* @__PURE__ */ d(
|
|
1876
1891
|
"div",
|
|
1877
1892
|
{
|
|
1893
|
+
role: "presentation",
|
|
1878
1894
|
className: "nice-sbp__screensaver nice-sbp__screensaver--custom",
|
|
1879
1895
|
onClick: W,
|
|
1880
1896
|
onTouchStart: W,
|
|
@@ -1905,6 +1921,7 @@ const Et = {
|
|
|
1905
1921
|
f.isDimmed && /* @__PURE__ */ d(
|
|
1906
1922
|
"div",
|
|
1907
1923
|
{
|
|
1924
|
+
role: "presentation",
|
|
1908
1925
|
className: "nice-sbp__dim-overlay",
|
|
1909
1926
|
style: e,
|
|
1910
1927
|
onClick: C,
|
|
@@ -1955,7 +1972,7 @@ const Et = {
|
|
|
1955
1972
|
]
|
|
1956
1973
|
})[t], tr = /* @__PURE__ */ Object.assign(
|
|
1957
1974
|
/* @__PURE__ */ ce((t, g) => {
|
|
1958
|
-
const { t:
|
|
1975
|
+
const { t: o } = ue(), {
|
|
1959
1976
|
config: b,
|
|
1960
1977
|
autoStart: x = !1,
|
|
1961
1978
|
onStart: S,
|
|
@@ -1972,7 +1989,7 @@ const Et = {
|
|
|
1972
1989
|
isSuccessful: !1,
|
|
1973
1990
|
matrix: null,
|
|
1974
1991
|
averageError: 0
|
|
1975
|
-
}), I =
|
|
1992
|
+
}), I = i((C) => {
|
|
1976
1993
|
const O = C.filter(
|
|
1977
1994
|
(j) => j.calibrated && j.actualX !== void 0 && j.actualY !== void 0
|
|
1978
1995
|
);
|
|
@@ -1997,7 +2014,7 @@ const Et = {
|
|
|
1997
2014
|
rotation: 0
|
|
1998
2015
|
// Simplified - no rotation calculation
|
|
1999
2016
|
};
|
|
2000
|
-
}, []), B =
|
|
2017
|
+
}, []), B = i(
|
|
2001
2018
|
(C, O) => {
|
|
2002
2019
|
const W = C.filter((n) => n.calibrated);
|
|
2003
2020
|
if (W.length === 0)
|
|
@@ -2012,7 +2029,7 @@ const Et = {
|
|
|
2012
2029
|
return a / W.length;
|
|
2013
2030
|
},
|
|
2014
2031
|
[]
|
|
2015
|
-
), $ =
|
|
2032
|
+
), $ = i(() => {
|
|
2016
2033
|
const O = Ot(r.pointCount).map((W) => ({
|
|
2017
2034
|
...W,
|
|
2018
2035
|
calibrated: !1
|
|
@@ -2027,15 +2044,15 @@ const Et = {
|
|
|
2027
2044
|
matrix: null,
|
|
2028
2045
|
averageError: 0
|
|
2029
2046
|
}), S == null || S();
|
|
2030
|
-
}, [r.pointCount, S]), q =
|
|
2047
|
+
}, [r.pointCount, S]), q = i(() => {
|
|
2031
2048
|
E.current && clearTimeout(E.current), m((C) => ({
|
|
2032
2049
|
...C,
|
|
2033
2050
|
isActive: !1,
|
|
2034
2051
|
isCompleted: !1
|
|
2035
2052
|
})), _ == null || _();
|
|
2036
|
-
}, [_]), H =
|
|
2053
|
+
}, [_]), H = i(() => {
|
|
2037
2054
|
m((C) => ({ ...C, isCompleted: !1 }));
|
|
2038
|
-
}, []), z =
|
|
2055
|
+
}, []), z = i(() => {
|
|
2039
2056
|
if (r.persistCalibration)
|
|
2040
2057
|
try {
|
|
2041
2058
|
localStorage.removeItem(r.storageKey);
|
|
@@ -2051,7 +2068,7 @@ const Et = {
|
|
|
2051
2068
|
matrix: null,
|
|
2052
2069
|
averageError: 0
|
|
2053
2070
|
});
|
|
2054
|
-
}, [r.persistCalibration, r.storageKey, r.pointCount]), X =
|
|
2071
|
+
}, [r.persistCalibration, r.storageKey, r.pointCount]), X = i(
|
|
2055
2072
|
(C) => {
|
|
2056
2073
|
const O = I(C), W = B(C, O), a = W <= r.accuracyThreshold;
|
|
2057
2074
|
if (r.persistCalibration && a)
|
|
@@ -2077,7 +2094,7 @@ const Et = {
|
|
|
2077
2094
|
B,
|
|
2078
2095
|
Y
|
|
2079
2096
|
]
|
|
2080
|
-
), R =
|
|
2097
|
+
), R = i(
|
|
2081
2098
|
(C) => {
|
|
2082
2099
|
if (!f.isActive || !y.current)
|
|
2083
2100
|
return;
|
|
@@ -2107,7 +2124,7 @@ const Et = {
|
|
|
2107
2124
|
X,
|
|
2108
2125
|
L
|
|
2109
2126
|
]
|
|
2110
|
-
), G =
|
|
2127
|
+
), G = i(
|
|
2111
2128
|
(C, O) => {
|
|
2112
2129
|
const W = f.matrix;
|
|
2113
2130
|
return W ? {
|
|
@@ -2116,7 +2133,7 @@ const Et = {
|
|
|
2116
2133
|
} : { x: C, y: O };
|
|
2117
2134
|
},
|
|
2118
2135
|
[f.matrix]
|
|
2119
|
-
), M =
|
|
2136
|
+
), M = i(() => {
|
|
2120
2137
|
if (f.matrix)
|
|
2121
2138
|
return !0;
|
|
2122
2139
|
if (r.persistCalibration)
|
|
@@ -2126,7 +2143,7 @@ const Et = {
|
|
|
2126
2143
|
return !1;
|
|
2127
2144
|
}
|
|
2128
2145
|
return !1;
|
|
2129
|
-
}, [f.matrix, r.persistCalibration, r.storageKey]), F =
|
|
2146
|
+
}, [f.matrix, r.persistCalibration, r.storageKey]), F = i(() => {
|
|
2130
2147
|
if (r.persistCalibration)
|
|
2131
2148
|
try {
|
|
2132
2149
|
localStorage.removeItem(r.storageKey);
|
|
@@ -2196,12 +2213,12 @@ const Et = {
|
|
|
2196
2213
|
return /* @__PURE__ */ J("div", { ref: y, className: "nice-touch-calibration", children: [
|
|
2197
2214
|
/* @__PURE__ */ J("div", { className: "nice-touch-calibration__overlay", children: [
|
|
2198
2215
|
/* @__PURE__ */ J("div", { className: "nice-touch-calibration__instructions", children: [
|
|
2199
|
-
/* @__PURE__ */ d("h2", { className: "nice-touch-calibration__title", children:
|
|
2200
|
-
/* @__PURE__ */ d("p", { className: "nice-touch-calibration__text", children:
|
|
2216
|
+
/* @__PURE__ */ d("h2", { className: "nice-touch-calibration__title", children: o("touchCalibration.touchScreenCalibration", "Touch Screen Calibration") }),
|
|
2217
|
+
/* @__PURE__ */ d("p", { className: "nice-touch-calibration__text", children: o(
|
|
2201
2218
|
"touchCalibration.touchTheCenterOfEach",
|
|
2202
2219
|
"Touch the center of each target to calibrate your screen."
|
|
2203
2220
|
) }),
|
|
2204
|
-
/* @__PURE__ */ d("div", { className: "nice-touch-calibration__progress", children:
|
|
2221
|
+
/* @__PURE__ */ d("div", { className: "nice-touch-calibration__progress", children: o("touchCalibration.pointOf", "Point {currentPointIndex} of {totalPoints}").replace("{currentPointIndex}", String(f.currentPointIndex + 1)).replace("{totalPoints}", String(f.totalPoints)) })
|
|
2205
2222
|
] }),
|
|
2206
2223
|
A && /* @__PURE__ */ d(
|
|
2207
2224
|
"div",
|
|
@@ -2233,7 +2250,7 @@ const Et = {
|
|
|
2233
2250
|
O
|
|
2234
2251
|
)
|
|
2235
2252
|
),
|
|
2236
|
-
f.isActive && /* @__PURE__ */ d("button", { className: "nice-touch-calibration__cancel", onClick: q, children:
|
|
2253
|
+
f.isActive && /* @__PURE__ */ d("button", { className: "nice-touch-calibration__cancel", onClick: q, children: o("touchCalibration.cancel", "Cancel") })
|
|
2237
2254
|
] }),
|
|
2238
2255
|
f.isCompleted && /* @__PURE__ */ J("div", { className: "nice-touch-calibration__result", children: [
|
|
2239
2256
|
/* @__PURE__ */ d(
|
|
@@ -2249,18 +2266,18 @@ const Et = {
|
|
|
2249
2266
|
)
|
|
2250
2267
|
}
|
|
2251
2268
|
),
|
|
2252
|
-
/* @__PURE__ */ d("h3", { className: "nice-touch-calibration__result-title", children: f.isSuccessful ?
|
|
2253
|
-
r.showAccuracy && /* @__PURE__ */ d("p", { className: "nice-touch-calibration__result-accuracy", children:
|
|
2269
|
+
/* @__PURE__ */ d("h3", { className: "nice-touch-calibration__result-title", children: f.isSuccessful ? o("touchCalibration.calibrationComplete", "Calibration Complete") : o("touchCalibration.calibrationFailed", "Calibration Failed") }),
|
|
2270
|
+
r.showAccuracy && /* @__PURE__ */ d("p", { className: "nice-touch-calibration__result-accuracy", children: o("touchCalibration.averageErrorPx", "Average error: {averageError}px").replace(
|
|
2254
2271
|
"{averageError}",
|
|
2255
2272
|
String(f.averageError.toFixed(1))
|
|
2256
2273
|
) }),
|
|
2257
|
-
!f.isSuccessful && r.allowRetry && /* @__PURE__ */ d("button", { className: "nice-touch-calibration__retry", onClick: $, children:
|
|
2274
|
+
!f.isSuccessful && r.allowRetry && /* @__PURE__ */ d("button", { className: "nice-touch-calibration__retry", onClick: $, children: o("touchCalibration.retryCalibration", "Retry Calibration") }),
|
|
2258
2275
|
/* @__PURE__ */ d(
|
|
2259
2276
|
"button",
|
|
2260
2277
|
{
|
|
2261
2278
|
className: "nice-touch-calibration__retry nice-touch-calibration__done",
|
|
2262
2279
|
onClick: H,
|
|
2263
|
-
children:
|
|
2280
|
+
children: o("touchCalibration.done", "Done")
|
|
2264
2281
|
}
|
|
2265
2282
|
)
|
|
2266
2283
|
] })
|
|
@@ -2392,12 +2409,12 @@ const Et = {
|
|
|
2392
2409
|
"11010011100",
|
|
2393
2410
|
"1100011101011"
|
|
2394
2411
|
], Me = (t) => {
|
|
2395
|
-
let g = be[Re],
|
|
2412
|
+
let g = be[Re], o = Re;
|
|
2396
2413
|
for (let b = 0; b < t.length; b++) {
|
|
2397
2414
|
const x = t[b], S = Mt.indexOf(x);
|
|
2398
|
-
S !== -1 && (g += be[S],
|
|
2415
|
+
S !== -1 && (g += be[S], o += S * (b + 1));
|
|
2399
2416
|
}
|
|
2400
|
-
return
|
|
2417
|
+
return o = o % 103, g += be[o], g += be[Rt], g;
|
|
2401
2418
|
}, Ge = [
|
|
2402
2419
|
"0001101",
|
|
2403
2420
|
"0011001",
|
|
@@ -2444,13 +2461,13 @@ const Et = {
|
|
|
2444
2461
|
"LGGLGL"
|
|
2445
2462
|
], $t = (t) => {
|
|
2446
2463
|
let g = 0;
|
|
2447
|
-
for (let
|
|
2448
|
-
g += parseInt(t[
|
|
2464
|
+
for (let o = 0; o < 12; o++)
|
|
2465
|
+
g += parseInt(t[o]) * (o % 2 === 0 ? 1 : 3);
|
|
2449
2466
|
return (10 - g % 10) % 10;
|
|
2450
2467
|
}, qt = (t) => {
|
|
2451
2468
|
let g = t.replace(/\D/g, "").slice(0, 12).padStart(12, "0");
|
|
2452
|
-
const
|
|
2453
|
-
g +=
|
|
2469
|
+
const o = $t(g);
|
|
2470
|
+
g += o;
|
|
2454
2471
|
const b = parseInt(g[0]), x = Bt[b];
|
|
2455
2472
|
let S = "101";
|
|
2456
2473
|
for (let L = 1; L <= 6; L++) {
|
|
@@ -2464,10 +2481,10 @@ const Et = {
|
|
|
2464
2481
|
}
|
|
2465
2482
|
return S += "101", S;
|
|
2466
2483
|
}, jt = (t) => {
|
|
2467
|
-
let g = t.replace(/\D/g, "").slice(0, 7).padStart(7, "0"),
|
|
2484
|
+
let g = t.replace(/\D/g, "").slice(0, 7).padStart(7, "0"), o = 0;
|
|
2468
2485
|
for (let S = 0; S < 7; S++)
|
|
2469
|
-
|
|
2470
|
-
const b = (10 -
|
|
2486
|
+
o += parseInt(g[S]) * (S % 2 === 0 ? 3 : 1);
|
|
2487
|
+
const b = (10 - o % 10) % 10;
|
|
2471
2488
|
g += b;
|
|
2472
2489
|
let x = "101";
|
|
2473
2490
|
for (let S = 0; S < 4; S++)
|
|
@@ -2523,12 +2540,12 @@ const Et = {
|
|
|
2523
2540
|
"*": "100101101101"
|
|
2524
2541
|
}, Vt = (t) => {
|
|
2525
2542
|
const g = ("*" + t.toUpperCase() + "*").split("");
|
|
2526
|
-
let
|
|
2543
|
+
let o = "";
|
|
2527
2544
|
for (const b of g) {
|
|
2528
2545
|
const x = Ut[b];
|
|
2529
|
-
x && (
|
|
2546
|
+
x && (o += x + "0");
|
|
2530
2547
|
}
|
|
2531
|
-
return
|
|
2548
|
+
return o.slice(0, -1);
|
|
2532
2549
|
}, Fe = (t) => {
|
|
2533
2550
|
switch (t) {
|
|
2534
2551
|
case "code128":
|
|
@@ -2545,7 +2562,7 @@ const Et = {
|
|
|
2545
2562
|
}
|
|
2546
2563
|
}, nr = /* @__PURE__ */ Object.assign(
|
|
2547
2564
|
/* @__PURE__ */ ce((t, g) => {
|
|
2548
|
-
const { t:
|
|
2565
|
+
const { t: o } = ue(), {
|
|
2549
2566
|
value: b,
|
|
2550
2567
|
options: x,
|
|
2551
2568
|
onGenerate: S,
|
|
@@ -2555,7 +2572,7 @@ const Et = {
|
|
|
2555
2572
|
} = t, D = JSON.stringify(x ?? null), r = he(
|
|
2556
2573
|
() => ({ ...Tt, ...JSON.parse(D) }),
|
|
2557
2574
|
[D]
|
|
2558
|
-
), y = re(null), E = re(null), [f, m] = ee(null), [I, B] = ee(null), $ =
|
|
2575
|
+
), y = re(null), E = re(null), [f, m] = ee(null), [I, B] = ee(null), $ = i(() => {
|
|
2559
2576
|
if (!y.current || !b)
|
|
2560
2577
|
return;
|
|
2561
2578
|
const M = y.current, F = M.getContext("2d");
|
|
@@ -2577,20 +2594,20 @@ const Et = {
|
|
|
2577
2594
|
const N = M.toDataURL("image/png");
|
|
2578
2595
|
B(N), m(null), S == null || S(N);
|
|
2579
2596
|
} catch (A) {
|
|
2580
|
-
const C = A instanceof Error ? A.message :
|
|
2597
|
+
const C = A instanceof Error ? A.message : o("barcodeGenerator.failedToGenerateBarcode", "Failed to generate barcode");
|
|
2581
2598
|
m(C), L == null || L(new Error(C));
|
|
2582
2599
|
}
|
|
2583
|
-
}, [b, r, S, L,
|
|
2600
|
+
}, [b, r, S, L, o]);
|
|
2584
2601
|
ne(() => {
|
|
2585
2602
|
$();
|
|
2586
2603
|
}, [$]);
|
|
2587
|
-
const q =
|
|
2604
|
+
const q = i(
|
|
2588
2605
|
(M = "image/png", F = 1) => {
|
|
2589
2606
|
var A;
|
|
2590
2607
|
return ((A = y.current) == null ? void 0 : A.toDataURL(M, F)) || null;
|
|
2591
2608
|
},
|
|
2592
2609
|
[]
|
|
2593
|
-
), H =
|
|
2610
|
+
), H = i(() => {
|
|
2594
2611
|
if (!y.current || !b)
|
|
2595
2612
|
return null;
|
|
2596
2613
|
try {
|
|
@@ -2618,7 +2635,7 @@ const Et = {
|
|
|
2618
2635
|
} catch {
|
|
2619
2636
|
return null;
|
|
2620
2637
|
}
|
|
2621
|
-
}, [b, r]), z =
|
|
2638
|
+
}, [b, r]), z = i(() => y.current, []), X = i(
|
|
2622
2639
|
(M = "barcode", F = "png") => {
|
|
2623
2640
|
const A = document.createElement("a");
|
|
2624
2641
|
if (F === "svg") {
|
|
@@ -2636,7 +2653,7 @@ const Et = {
|
|
|
2636
2653
|
A.click();
|
|
2637
2654
|
},
|
|
2638
2655
|
[q, H]
|
|
2639
|
-
), R =
|
|
2656
|
+
), R = i(() => {
|
|
2640
2657
|
$();
|
|
2641
2658
|
}, [$]);
|
|
2642
2659
|
le(
|
|
@@ -2693,8 +2710,8 @@ const Et = {
|
|
|
2693
2710
|
fhd: { width: 1920, height: 1080 }
|
|
2694
2711
|
})[t], Ht = () => {
|
|
2695
2712
|
try {
|
|
2696
|
-
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(),
|
|
2697
|
-
g.connect(
|
|
2713
|
+
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(), o = t.createGain();
|
|
2714
|
+
g.connect(o), o.connect(t.destination), g.type = "sine", g.frequency.value = 1e3, o.gain.value = 0.1, g.start(), setTimeout(() => {
|
|
2698
2715
|
g.stop(), t.close();
|
|
2699
2716
|
}, 100);
|
|
2700
2717
|
} catch {
|
|
@@ -2703,7 +2720,7 @@ const Et = {
|
|
|
2703
2720
|
typeof navigator < "u" && navigator.vibrate && navigator.vibrate(50);
|
|
2704
2721
|
}, rr = /* @__PURE__ */ Object.assign(
|
|
2705
2722
|
/* @__PURE__ */ ce((t, g) => {
|
|
2706
|
-
const { t:
|
|
2723
|
+
const { t: o } = ue(), {
|
|
2707
2724
|
config: b,
|
|
2708
2725
|
onScan: x,
|
|
2709
2726
|
onBatchScan: S,
|
|
@@ -2714,13 +2731,13 @@ const Et = {
|
|
|
2714
2731
|
autoStart: r = !1,
|
|
2715
2732
|
children: y,
|
|
2716
2733
|
className: E
|
|
2717
|
-
} = t, f = { ...Wt, ...b }, m = re(null), I = re(null), B = re(null), $ = re(null), q = re(null), H = re(null), [z, X] = ee(!1), [R, G] = ee(!1), [M, F] = ee(null), [A, C] = ee(null), [O, W] = ee(null), [a, n] = ee(f.facingMode), [u, e] = ee(null), c = Gt(), s =
|
|
2734
|
+
} = t, f = { ...Wt, ...b }, m = re(null), I = re(null), B = re(null), $ = re(null), q = re(null), H = re(null), [z, X] = ee(!1), [R, G] = ee(!1), [M, F] = ee(null), [A, C] = ee(null), [O, W] = ee(null), [a, n] = ee(f.facingMode), [u, e] = ee(null), c = Gt(), s = i(async () => {
|
|
2718
2735
|
try {
|
|
2719
2736
|
return (await navigator.mediaDevices.getUserMedia({ video: !0 })).getTracks().forEach((V) => V.stop()), W(!0), !0;
|
|
2720
2737
|
} catch {
|
|
2721
2738
|
return W(!1), !1;
|
|
2722
2739
|
}
|
|
2723
|
-
}, []), h =
|
|
2740
|
+
}, []), h = i(async () => {
|
|
2724
2741
|
if (!m.current)
|
|
2725
2742
|
return;
|
|
2726
2743
|
const j = Yt(f.resolution), V = {
|
|
@@ -2735,26 +2752,26 @@ const Et = {
|
|
|
2735
2752
|
const Q = await navigator.mediaDevices.getUserMedia(V);
|
|
2736
2753
|
B.current = Q, m.current.srcObject = Q, await m.current.play(), G(!0), W(!0), C(null), Y == null || Y();
|
|
2737
2754
|
} catch (Q) {
|
|
2738
|
-
const ae = Q instanceof Error ? Q.message :
|
|
2755
|
+
const ae = Q instanceof Error ? Q.message : o("barcodeScanner.failedToAccessCamera", "Failed to access camera");
|
|
2739
2756
|
C(ae), W(!1), L == null || L(new Error(ae));
|
|
2740
2757
|
}
|
|
2741
|
-
}, [f.resolution, a, Y, L,
|
|
2758
|
+
}, [f.resolution, a, Y, L, o]), w = i(() => {
|
|
2742
2759
|
B.current && (B.current.getTracks().forEach((j) => j.stop()), B.current = null), m.current && (m.current.srcObject = null), G(!1);
|
|
2743
|
-
}, []), v =
|
|
2760
|
+
}, []), v = i(async () => {
|
|
2744
2761
|
n(a === "user" ? "environment" : "user"), z && w();
|
|
2745
|
-
}, [a, z, w]), N =
|
|
2762
|
+
}, [a, z, w]), N = i(async () => {
|
|
2746
2763
|
if (c)
|
|
2747
2764
|
try {
|
|
2748
2765
|
const j = window.BarcodeDetector, V = f.formats.map((Q) => Q.replace("_", "-"));
|
|
2749
2766
|
$.current = new j({ formats: V });
|
|
2750
2767
|
} catch (j) {
|
|
2751
|
-
const V = j instanceof Error ? j.message :
|
|
2768
|
+
const V = j instanceof Error ? j.message : o(
|
|
2752
2769
|
"barcodeScanner.failedToInitializeBarcodeDetector",
|
|
2753
2770
|
"Failed to initialize barcode detector"
|
|
2754
2771
|
);
|
|
2755
2772
|
C(V), L == null || L(new Error(V));
|
|
2756
2773
|
}
|
|
2757
|
-
}, [c, f.formats, L,
|
|
2774
|
+
}, [c, f.formats, L, o]), l = i(async () => {
|
|
2758
2775
|
if (!(!m.current || !$.current || !R))
|
|
2759
2776
|
try {
|
|
2760
2777
|
const V = await $.current.detect(m.current);
|
|
@@ -2787,13 +2804,13 @@ const Et = {
|
|
|
2787
2804
|
f.vibrateOnScan,
|
|
2788
2805
|
x,
|
|
2789
2806
|
S
|
|
2790
|
-
]), p =
|
|
2807
|
+
]), p = i(async () => {
|
|
2791
2808
|
X(!0), C(null), await N(), await h();
|
|
2792
|
-
}, [N, h]), T =
|
|
2809
|
+
}, [N, h]), T = i(() => {
|
|
2793
2810
|
X(!1), q.current && (clearInterval(q.current), q.current = null), w();
|
|
2794
|
-
}, [w]), K =
|
|
2811
|
+
}, [w]), K = i(async () => {
|
|
2795
2812
|
z ? T() : await p();
|
|
2796
|
-
}, [z, p, T]), k =
|
|
2813
|
+
}, [z, p, T]), k = i(() => {
|
|
2797
2814
|
if (!m.current || !I.current)
|
|
2798
2815
|
return null;
|
|
2799
2816
|
const j = I.current, V = m.current;
|
|
@@ -2872,9 +2889,9 @@ const Et = {
|
|
|
2872
2889
|
A && /* @__PURE__ */ J("div", { className: "nice-barcode-scanner__error", children: [
|
|
2873
2890
|
/* @__PURE__ */ d("div", { className: "nice-barcode-scanner__error-icon", children: /* @__PURE__ */ d("span", { className: "nice-platform-mark nice-platform-mark--alert", "aria-hidden": "true" }) }),
|
|
2874
2891
|
/* @__PURE__ */ d("p", { className: "nice-barcode-scanner__error-text", children: A }),
|
|
2875
|
-
/* @__PURE__ */ d("button", { className: "nice-barcode-scanner__error-btn", onClick: () => p(), children:
|
|
2892
|
+
/* @__PURE__ */ d("button", { className: "nice-barcode-scanner__error-btn", onClick: () => p(), children: o("barcodeScanner.tryAgain", "Try Again") })
|
|
2876
2893
|
] }),
|
|
2877
|
-
!c && /* @__PURE__ */ d("div", { className: "nice-barcode-scanner__unsupported", children: /* @__PURE__ */ d("p", { children:
|
|
2894
|
+
!c && /* @__PURE__ */ d("div", { className: "nice-barcode-scanner__unsupported", children: /* @__PURE__ */ d("p", { children: o(
|
|
2878
2895
|
"barcodeScanner.barcodeScanningIsNotSupported",
|
|
2879
2896
|
"Barcode scanning is not supported in this browser."
|
|
2880
2897
|
) }) }),
|
|
@@ -2911,15 +2928,15 @@ const Et = {
|
|
|
2911
2928
|
minConfidence: 0
|
|
2912
2929
|
}, Jt = () => {
|
|
2913
2930
|
try {
|
|
2914
|
-
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(),
|
|
2915
|
-
g.connect(
|
|
2931
|
+
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(), o = t.createGain();
|
|
2932
|
+
g.connect(o), o.connect(t.destination), g.frequency.value = 1200, g.type = "sine", o.gain.setValueAtTime(0.3, t.currentTime), o.gain.exponentialRampToValueAtTime(0.01, t.currentTime + 0.1), g.start(), g.stop(t.currentTime + 0.1);
|
|
2916
2933
|
} catch {
|
|
2917
2934
|
}
|
|
2918
2935
|
}, Zt = (t = 50) => {
|
|
2919
2936
|
"vibrate" in navigator && navigator.vibrate(t);
|
|
2920
2937
|
}, en = () => `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, ar = /* @__PURE__ */ Object.assign(
|
|
2921
2938
|
/* @__PURE__ */ ce((t, g) => {
|
|
2922
|
-
const { t:
|
|
2939
|
+
const { t: o } = ue(), {
|
|
2923
2940
|
options: b,
|
|
2924
2941
|
initialItems: x = [],
|
|
2925
2942
|
onScan: S,
|
|
@@ -2945,23 +2962,23 @@ const Et = {
|
|
|
2945
2962
|
}
|
|
2946
2963
|
})();
|
|
2947
2964
|
}, [b == null ? void 0 : b.formats]);
|
|
2948
|
-
const c =
|
|
2965
|
+
const c = i(
|
|
2949
2966
|
async (U, Z = "unknown", se) => {
|
|
2950
|
-
const
|
|
2951
|
-
if (r && !await r(
|
|
2967
|
+
const oe = y ? y(U, Z) : U;
|
|
2968
|
+
if (r && !await r(oe, Z))
|
|
2952
2969
|
return;
|
|
2953
|
-
const
|
|
2954
|
-
if (
|
|
2970
|
+
const ie = R.findIndex((de) => de.value === oe);
|
|
2971
|
+
if (ie !== -1 && m.autoIncrementDuplicates) {
|
|
2955
2972
|
const de = [...R];
|
|
2956
|
-
de[
|
|
2957
|
-
...de[
|
|
2958
|
-
quantity: de[
|
|
2973
|
+
de[ie] = {
|
|
2974
|
+
...de[ie],
|
|
2975
|
+
quantity: de[ie].quantity + 1,
|
|
2959
2976
|
timestamp: Date.now()
|
|
2960
|
-
}, G(de), _ == null || _(de[
|
|
2977
|
+
}, G(de), _ == null || _(de[ie], de[ie].quantity);
|
|
2961
2978
|
} else if (R.length < m.maxItems) {
|
|
2962
2979
|
const de = {
|
|
2963
2980
|
id: en(),
|
|
2964
|
-
value:
|
|
2981
|
+
value: oe,
|
|
2965
2982
|
format: Z,
|
|
2966
2983
|
timestamp: Date.now(),
|
|
2967
2984
|
rawValue: U,
|
|
@@ -2973,26 +2990,26 @@ const Et = {
|
|
|
2973
2990
|
m.beepOnScan && Jt(), m.vibrateOnScan && Zt();
|
|
2974
2991
|
},
|
|
2975
2992
|
[R, m, r, y, S, _]
|
|
2976
|
-
), s =
|
|
2993
|
+
), s = i(
|
|
2977
2994
|
(U) => {
|
|
2978
2995
|
const Z = R.find((se) => se.id === U);
|
|
2979
|
-
Z && (G((se) => se.filter((
|
|
2996
|
+
Z && (G((se) => se.filter((oe) => oe.id !== U)), L == null || L(Z));
|
|
2980
2997
|
},
|
|
2981
2998
|
[R, L]
|
|
2982
|
-
), h =
|
|
2999
|
+
), h = i(
|
|
2983
3000
|
(U, Z) => {
|
|
2984
3001
|
if (Z < 1) {
|
|
2985
3002
|
s(U);
|
|
2986
3003
|
return;
|
|
2987
3004
|
}
|
|
2988
|
-
G((
|
|
2989
|
-
const se = R.find((
|
|
3005
|
+
G((oe) => oe.map((ie) => ie.id === U ? { ...ie, quantity: Z } : ie));
|
|
3006
|
+
const se = R.find((oe) => oe.id === U);
|
|
2990
3007
|
se && (_ == null || _(se, Z));
|
|
2991
3008
|
},
|
|
2992
3009
|
[R, s, _]
|
|
2993
|
-
), w =
|
|
3010
|
+
), w = i(() => {
|
|
2994
3011
|
G([]);
|
|
2995
|
-
}, []), v =
|
|
3012
|
+
}, []), v = i(async () => {
|
|
2996
3013
|
if (!I.current || !q.current || !B.current)
|
|
2997
3014
|
return;
|
|
2998
3015
|
const U = I.current, Z = B.current, se = Z.getContext("2d");
|
|
@@ -3002,21 +3019,21 @@ const Et = {
|
|
|
3002
3019
|
}
|
|
3003
3020
|
Z.width = U.videoWidth, Z.height = U.videoHeight, se.drawImage(U, 0, 0);
|
|
3004
3021
|
try {
|
|
3005
|
-
const
|
|
3006
|
-
if (
|
|
3007
|
-
const
|
|
3008
|
-
for (const ge of
|
|
3009
|
-
de.push(ge.boundingBox), (ge.rawValue !== z.current ||
|
|
3022
|
+
const oe = await q.current.detect(Z);
|
|
3023
|
+
if (oe.length > 0) {
|
|
3024
|
+
const ie = Date.now(), de = [];
|
|
3025
|
+
for (const ge of oe)
|
|
3026
|
+
de.push(ge.boundingBox), (ge.rawValue !== z.current || ie - X.current > 2e3) && (z.current = ge.rawValue, X.current = ie, c(ge.rawValue, ge.format, ge.boundingBox));
|
|
3010
3027
|
m.showBoundingBox && (n(de), setTimeout(() => n([]), 500));
|
|
3011
3028
|
}
|
|
3012
|
-
} catch (
|
|
3013
|
-
console.warn("Scan error:",
|
|
3029
|
+
} catch (oe) {
|
|
3030
|
+
console.warn("Scan error:", oe);
|
|
3014
3031
|
}
|
|
3015
3032
|
H.current = requestAnimationFrame(v);
|
|
3016
|
-
}, [c, m.showBoundingBox]), N =
|
|
3033
|
+
}, [c, m.showBoundingBox]), N = i(async () => {
|
|
3017
3034
|
if (!A || !q.current) {
|
|
3018
3035
|
e(
|
|
3019
|
-
|
|
3036
|
+
o(
|
|
3020
3037
|
"batchScanner.cameraOrBarcodedetectorNotAvailable",
|
|
3021
3038
|
"Camera or BarcodeDetector not available"
|
|
3022
3039
|
)
|
|
@@ -3033,18 +3050,18 @@ const Et = {
|
|
|
3033
3050
|
});
|
|
3034
3051
|
$.current = U, I.current && (I.current.srcObject = U, await I.current.play()), F(!0), e(null), H.current = requestAnimationFrame(v);
|
|
3035
3052
|
} catch (U) {
|
|
3036
|
-
const Z = U instanceof Error ? U.message :
|
|
3053
|
+
const Z = U instanceof Error ? U.message : o("batchScanner.failedToStartCamera", "Failed to start camera");
|
|
3037
3054
|
e(Z), D == null || D(new Error(Z));
|
|
3038
3055
|
}
|
|
3039
|
-
}, [A, v, D,
|
|
3056
|
+
}, [A, v, D, o]), l = i(() => {
|
|
3040
3057
|
H.current && cancelAnimationFrame(H.current), $.current && ($.current.getTracks().forEach((U) => U.stop()), $.current = null), I.current && (I.current.srcObject = null), F(!1), n([]);
|
|
3041
3058
|
}, []);
|
|
3042
3059
|
ne(() => () => {
|
|
3043
3060
|
l();
|
|
3044
3061
|
}, [l]);
|
|
3045
|
-
const p =
|
|
3062
|
+
const p = i(() => {
|
|
3046
3063
|
O.trim() && (c(O.trim()), W(""));
|
|
3047
|
-
}, [O, c]), T =
|
|
3064
|
+
}, [O, c]), T = i(() => {
|
|
3048
3065
|
const U = ["Value", "Format", "Quantity", "Timestamp"], Z = R.map((se) => [
|
|
3049
3066
|
`"${se.value.replace(/"/g, '""')}"`,
|
|
3050
3067
|
se.format,
|
|
@@ -3053,7 +3070,7 @@ const Et = {
|
|
|
3053
3070
|
]);
|
|
3054
3071
|
return [U.join(","), ...Z.map((se) => se.join(","))].join(`
|
|
3055
3072
|
`);
|
|
3056
|
-
}, [R]), K =
|
|
3073
|
+
}, [R]), K = i(() => JSON.stringify(R, null, 2), [R]), k = i(() => {
|
|
3057
3074
|
l(), Y == null || Y(R);
|
|
3058
3075
|
}, [R, l, Y]);
|
|
3059
3076
|
le(
|
|
@@ -3130,16 +3147,16 @@ const Et = {
|
|
|
3130
3147
|
),
|
|
3131
3148
|
/* @__PURE__ */ d("canvas", { ref: B, className: "nice-batch-scanner__canvas" }),
|
|
3132
3149
|
I.current && a.map((U, Z) => {
|
|
3133
|
-
const se = I.current,
|
|
3150
|
+
const se = I.current, oe = se.clientWidth / se.videoWidth, ie = se.clientHeight / se.videoHeight;
|
|
3134
3151
|
return /* @__PURE__ */ d(
|
|
3135
3152
|
"div",
|
|
3136
3153
|
{
|
|
3137
3154
|
className: "nice-batch-scanner__bounding-box",
|
|
3138
3155
|
style: {
|
|
3139
|
-
left: U.x *
|
|
3140
|
-
top: U.y *
|
|
3141
|
-
width: U.width *
|
|
3142
|
-
height: U.height *
|
|
3156
|
+
left: U.x * oe,
|
|
3157
|
+
top: U.y * ie,
|
|
3158
|
+
width: U.width * oe,
|
|
3159
|
+
height: U.height * ie
|
|
3143
3160
|
}
|
|
3144
3161
|
},
|
|
3145
3162
|
Z
|
|
@@ -3161,7 +3178,7 @@ const Et = {
|
|
|
3161
3178
|
"aria-hidden": "true"
|
|
3162
3179
|
}
|
|
3163
3180
|
),
|
|
3164
|
-
/* @__PURE__ */ d("p", { children:
|
|
3181
|
+
/* @__PURE__ */ d("p", { children: o("batchScanner.tapToStartScanning", "Tap to start scanning") })
|
|
3165
3182
|
] })
|
|
3166
3183
|
] }),
|
|
3167
3184
|
/* @__PURE__ */ J("div", { className: "nice-batch-scanner__controls", children: [
|
|
@@ -3170,7 +3187,7 @@ const Et = {
|
|
|
3170
3187
|
{
|
|
3171
3188
|
className: `nice-batch-scanner__btn nice-batch-scanner__btn--${M ? "stop" : "start"}`,
|
|
3172
3189
|
onClick: M ? l : N,
|
|
3173
|
-
children: M ?
|
|
3190
|
+
children: M ? o("batchScanner.stopScanning", "Stop Scanning") : o("batchScanner.startScanning", "Start Scanning")
|
|
3174
3191
|
}
|
|
3175
3192
|
),
|
|
3176
3193
|
m.allowManualEntry && /* @__PURE__ */ J("div", { className: "nice-batch-scanner__manual", children: [
|
|
@@ -3181,7 +3198,7 @@ const Et = {
|
|
|
3181
3198
|
value: O,
|
|
3182
3199
|
onChange: (U) => W(U.target.value),
|
|
3183
3200
|
onKeyDown: (U) => U.key === "Enter" && p(),
|
|
3184
|
-
placeholder:
|
|
3201
|
+
placeholder: o("batchScanner.enterCodeManually", "Enter code manually..."),
|
|
3185
3202
|
className: "nice-batch-scanner__manual-input"
|
|
3186
3203
|
}
|
|
3187
3204
|
),
|
|
@@ -3191,7 +3208,7 @@ const Et = {
|
|
|
3191
3208
|
className: "nice-batch-scanner__btn nice-batch-scanner__btn--add",
|
|
3192
3209
|
onClick: p,
|
|
3193
3210
|
disabled: !O.trim(),
|
|
3194
|
-
children:
|
|
3211
|
+
children: o("batchScanner.add", "Add")
|
|
3195
3212
|
}
|
|
3196
3213
|
)
|
|
3197
3214
|
] })
|
|
@@ -3200,12 +3217,12 @@ const Et = {
|
|
|
3200
3217
|
/* @__PURE__ */ J("span", { className: "nice-batch-scanner__count", children: [
|
|
3201
3218
|
/* @__PURE__ */ d("strong", { children: R.length }),
|
|
3202
3219
|
" ",
|
|
3203
|
-
|
|
3220
|
+
o("batchScanner.uniqueItems", "unique items")
|
|
3204
3221
|
] }),
|
|
3205
3222
|
/* @__PURE__ */ J("span", { className: "nice-batch-scanner__total", children: [
|
|
3206
3223
|
/* @__PURE__ */ d("strong", { children: ae }),
|
|
3207
3224
|
" ",
|
|
3208
|
-
|
|
3225
|
+
o("batchScanner.totalQuantity", "total quantity")
|
|
3209
3226
|
] })
|
|
3210
3227
|
] }),
|
|
3211
3228
|
/* @__PURE__ */ J("div", { className: "nice-batch-scanner__items", children: [
|
|
@@ -3220,7 +3237,7 @@ const Et = {
|
|
|
3220
3237
|
{
|
|
3221
3238
|
className: "nice-batch-scanner__qty-btn",
|
|
3222
3239
|
onClick: () => h(U.id, U.quantity - 1),
|
|
3223
|
-
"aria-label":
|
|
3240
|
+
"aria-label": o("batchScanner.decreaseQuantity", "Decrease quantity"),
|
|
3224
3241
|
children: /* @__PURE__ */ d(
|
|
3225
3242
|
"span",
|
|
3226
3243
|
{
|
|
@@ -3236,7 +3253,7 @@ const Et = {
|
|
|
3236
3253
|
{
|
|
3237
3254
|
className: "nice-batch-scanner__qty-btn",
|
|
3238
3255
|
onClick: () => h(U.id, U.quantity + 1),
|
|
3239
|
-
"aria-label":
|
|
3256
|
+
"aria-label": o("batchScanner.increaseQuantity", "Increase quantity"),
|
|
3240
3257
|
children: /* @__PURE__ */ d(
|
|
3241
3258
|
"span",
|
|
3242
3259
|
{
|
|
@@ -3252,7 +3269,7 @@ const Et = {
|
|
|
3252
3269
|
{
|
|
3253
3270
|
className: "nice-batch-scanner__item-remove",
|
|
3254
3271
|
onClick: () => s(U.id),
|
|
3255
|
-
"aria-label":
|
|
3272
|
+
"aria-label": o("batchScanner.removeItem", "Remove item"),
|
|
3256
3273
|
children: /* @__PURE__ */ d(
|
|
3257
3274
|
"span",
|
|
3258
3275
|
{
|
|
@@ -3263,7 +3280,7 @@ const Et = {
|
|
|
3263
3280
|
}
|
|
3264
3281
|
)
|
|
3265
3282
|
] }, U.id)),
|
|
3266
|
-
R.length === 0 && /* @__PURE__ */ d("div", { className: "nice-batch-scanner__empty", children:
|
|
3283
|
+
R.length === 0 && /* @__PURE__ */ d("div", { className: "nice-batch-scanner__empty", children: o("batchScanner.noItemsScannedYet", "No items scanned yet") })
|
|
3267
3284
|
] }),
|
|
3268
3285
|
R.length > 0 && /* @__PURE__ */ J("div", { className: "nice-batch-scanner__actions", children: [
|
|
3269
3286
|
/* @__PURE__ */ d(
|
|
@@ -3271,7 +3288,7 @@ const Et = {
|
|
|
3271
3288
|
{
|
|
3272
3289
|
className: "nice-batch-scanner__btn nice-batch-scanner__btn--secondary",
|
|
3273
3290
|
onClick: w,
|
|
3274
|
-
children:
|
|
3291
|
+
children: o("batchScanner.clearAll", "Clear All")
|
|
3275
3292
|
}
|
|
3276
3293
|
),
|
|
3277
3294
|
/* @__PURE__ */ d(
|
|
@@ -3279,7 +3296,7 @@ const Et = {
|
|
|
3279
3296
|
{
|
|
3280
3297
|
className: "nice-batch-scanner__btn nice-batch-scanner__btn--primary",
|
|
3281
3298
|
onClick: k,
|
|
3282
|
-
children:
|
|
3299
|
+
children: o("batchScanner.completeBatch", "Complete Batch ({totalQuantity})").replace(
|
|
3283
3300
|
"{totalQuantity}",
|
|
3284
3301
|
String(ae)
|
|
3285
3302
|
)
|
|
@@ -3290,9 +3307,9 @@ const Et = {
|
|
|
3290
3307
|
] }) });
|
|
3291
3308
|
}),
|
|
3292
3309
|
{ displayName: "NiceBatchScanner" }
|
|
3293
|
-
),
|
|
3294
|
-
const [g,
|
|
3295
|
-
return /* @__PURE__ */ d(He.Provider, { value:
|
|
3310
|
+
), or = ({ children: t }) => {
|
|
3311
|
+
const [g, o] = ee(null);
|
|
3312
|
+
return /* @__PURE__ */ d(He.Provider, { value: o, children: /* @__PURE__ */ d(De.Provider, { value: g ?? Kt, children: t }) });
|
|
3296
3313
|
}, tn = {
|
|
3297
3314
|
errorCorrection: "M",
|
|
3298
3315
|
size: 200,
|
|
@@ -3311,13 +3328,13 @@ const Et = {
|
|
|
3311
3328
|
Q: [27, 48, 77, 111, 144, 178, 207, 259, 312, 364],
|
|
3312
3329
|
H: [17, 34, 58, 82, 106, 139, 154, 202, 235, 288]
|
|
3313
3330
|
}, rn = (t, g) => {
|
|
3314
|
-
const
|
|
3331
|
+
const o = t.length, b = nn[g];
|
|
3315
3332
|
for (let x = 0; x < b.length; x++)
|
|
3316
|
-
if (b[x] >=
|
|
3333
|
+
if (b[x] >= o)
|
|
3317
3334
|
return x + 1;
|
|
3318
3335
|
return 10;
|
|
3319
3336
|
}, Be = (t, g) => {
|
|
3320
|
-
const
|
|
3337
|
+
const o = rn(t, g), b = o * 4 + 17, x = Array(b).fill(null).map(() => Array(b).fill(!1)), S = Array(b).fill(null).map(() => Array(b).fill(!1)), L = (D, r) => {
|
|
3321
3338
|
for (let y = -1; y <= 7; y++)
|
|
3322
3339
|
for (let E = -1; E <= 7; E++) {
|
|
3323
3340
|
const f = D + y, m = r + E;
|
|
@@ -3327,9 +3344,9 @@ const Et = {
|
|
|
3327
3344
|
L(0, 0), L(0, b - 7), L(b - 7, 0);
|
|
3328
3345
|
for (let D = 8; D < b - 8; D++)
|
|
3329
3346
|
x[6][D] = D % 2 === 0, x[D][6] = D % 2 === 0, S[6][D] = !0, S[D][6] = !0;
|
|
3330
|
-
if (
|
|
3347
|
+
if (o >= 2) {
|
|
3331
3348
|
const D = [6, b - 7];
|
|
3332
|
-
|
|
3349
|
+
o >= 7 && D.splice(1, 0, Math.floor(b / 2));
|
|
3333
3350
|
for (const r of D)
|
|
3334
3351
|
for (const y of D)
|
|
3335
3352
|
if (!(r < 9 && y < 9 || r < 9 && y > b - 10 || r > b - 10 && y < 9))
|
|
@@ -3353,9 +3370,9 @@ const Et = {
|
|
|
3353
3370
|
}
|
|
3354
3371
|
}
|
|
3355
3372
|
return x;
|
|
3356
|
-
},
|
|
3373
|
+
}, ir = /* @__PURE__ */ Object.assign(
|
|
3357
3374
|
/* @__PURE__ */ ce((t, g) => {
|
|
3358
|
-
const { t:
|
|
3375
|
+
const { t: o } = ue(), {
|
|
3359
3376
|
value: b,
|
|
3360
3377
|
options: x,
|
|
3361
3378
|
onGenerate: S,
|
|
@@ -3377,7 +3394,7 @@ const Et = {
|
|
|
3377
3394
|
} else
|
|
3378
3395
|
E.current = null, B(!0);
|
|
3379
3396
|
}, [x == null ? void 0 : x.logo]);
|
|
3380
|
-
const $ =
|
|
3397
|
+
const $ = i(() => {
|
|
3381
3398
|
if (!y.current || !b || !I)
|
|
3382
3399
|
return;
|
|
3383
3400
|
const G = y.current, M = G.getContext("2d");
|
|
@@ -3408,20 +3425,20 @@ const Et = {
|
|
|
3408
3425
|
const a = G.toDataURL("image/png");
|
|
3409
3426
|
m(null), S == null || S(a);
|
|
3410
3427
|
} catch (F) {
|
|
3411
|
-
const A = F instanceof Error ? F.message :
|
|
3428
|
+
const A = F instanceof Error ? F.message : o("qrGenerator.failedToGenerateQrCode", "Failed to generate QR code");
|
|
3412
3429
|
m(A), L == null || L(new Error(A));
|
|
3413
3430
|
}
|
|
3414
|
-
}, [b, r, I, S, L,
|
|
3431
|
+
}, [b, r, I, S, L, o]);
|
|
3415
3432
|
ne(() => {
|
|
3416
3433
|
$();
|
|
3417
3434
|
}, [$]);
|
|
3418
|
-
const q =
|
|
3435
|
+
const q = i(
|
|
3419
3436
|
(G = "image/png", M = 1) => {
|
|
3420
3437
|
var F;
|
|
3421
3438
|
return ((F = y.current) == null ? void 0 : F.toDataURL(G, M)) || null;
|
|
3422
3439
|
},
|
|
3423
3440
|
[]
|
|
3424
|
-
), H =
|
|
3441
|
+
), H = i(() => {
|
|
3425
3442
|
if (!y.current || !b)
|
|
3426
3443
|
return null;
|
|
3427
3444
|
try {
|
|
@@ -3448,7 +3465,7 @@ const Et = {
|
|
|
3448
3465
|
} catch {
|
|
3449
3466
|
return null;
|
|
3450
3467
|
}
|
|
3451
|
-
}, [b, r]), z =
|
|
3468
|
+
}, [b, r]), z = i(
|
|
3452
3469
|
(G = "qrcode", M = "png") => {
|
|
3453
3470
|
const F = document.createElement("a");
|
|
3454
3471
|
if (M === "svg") {
|
|
@@ -3466,7 +3483,7 @@ const Et = {
|
|
|
3466
3483
|
F.click();
|
|
3467
3484
|
},
|
|
3468
3485
|
[q, H]
|
|
3469
|
-
), X =
|
|
3486
|
+
), X = i(() => {
|
|
3470
3487
|
$();
|
|
3471
3488
|
}, [$]);
|
|
3472
3489
|
le(
|
|
@@ -3512,7 +3529,7 @@ const Et = {
|
|
|
3512
3529
|
parseDataType: !0,
|
|
3513
3530
|
highlightDetected: !0
|
|
3514
3531
|
}, an = (t) => {
|
|
3515
|
-
var g,
|
|
3532
|
+
var g, o, b;
|
|
3516
3533
|
if (/^https?:\/\//i.test(t))
|
|
3517
3534
|
return { type: "url", data: { url: t } };
|
|
3518
3535
|
if (/^mailto:/i.test(t)) {
|
|
@@ -3553,7 +3570,7 @@ const Et = {
|
|
|
3553
3570
|
if (/^BEGIN:VEVENT/i.test(t))
|
|
3554
3571
|
return { type: "vevent", data: { raw: t } };
|
|
3555
3572
|
if (/^WIFI:/i.test(t)) {
|
|
3556
|
-
const x = (g = t.match(/S:([^;]+)/)) == null ? void 0 : g[1], S = (
|
|
3573
|
+
const x = (g = t.match(/S:([^;]+)/)) == null ? void 0 : g[1], S = (o = t.match(/P:([^;]+)/)) == null ? void 0 : o[1], L = (b = t.match(/T:([^;]+)/)) == null ? void 0 : b[1], Y = t.includes("H:true");
|
|
3557
3574
|
return {
|
|
3558
3575
|
type: "wifi",
|
|
3559
3576
|
data: { ssid: x, password: S, type: L, hidden: Y }
|
|
@@ -3562,8 +3579,8 @@ const Et = {
|
|
|
3562
3579
|
return { type: "text" };
|
|
3563
3580
|
}, on = () => {
|
|
3564
3581
|
try {
|
|
3565
|
-
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(),
|
|
3566
|
-
g.connect(
|
|
3582
|
+
const t = new (window.AudioContext || window.webkitAudioContext)(), g = t.createOscillator(), o = t.createGain();
|
|
3583
|
+
g.connect(o), o.connect(t.destination), g.type = "square", g.frequency.value = 1200, o.gain.value = 0.1, g.start(), setTimeout(() => {
|
|
3567
3584
|
g.stop(), t.close();
|
|
3568
3585
|
}, 80);
|
|
3569
3586
|
} catch {
|
|
@@ -3576,7 +3593,7 @@ const Et = {
|
|
|
3576
3593
|
fhd: { width: 1920, height: 1080 }
|
|
3577
3594
|
})[t], cr = /* @__PURE__ */ Object.assign(
|
|
3578
3595
|
/* @__PURE__ */ ce((t, g) => {
|
|
3579
|
-
const { t:
|
|
3596
|
+
const { t: o } = ue(), {
|
|
3580
3597
|
config: b,
|
|
3581
3598
|
onScan: x,
|
|
3582
3599
|
onError: S,
|
|
@@ -3585,7 +3602,7 @@ const Et = {
|
|
|
3585
3602
|
showScanFrame: _ = !0,
|
|
3586
3603
|
children: D,
|
|
3587
3604
|
className: r
|
|
3588
|
-
} = t, y = { ...sn, ...b }, E = re(null), f = re(null), m = re(null), I = re(null), B = re(null), $ = re(null), [q, H] = ee(!1), [z, X] = ee(!1), [R, G] = ee(null), [M, F] = ee(null), [A, C] = ee(null), [O, W] = ee(y.facingMode), [a, n] = ee(!1), [u, e] = ee(!1), [c, s] = ee(null), h = ln(), w =
|
|
3605
|
+
} = t, y = { ...sn, ...b }, E = re(null), f = re(null), m = re(null), I = re(null), B = re(null), $ = re(null), [q, H] = ee(!1), [z, X] = ee(!1), [R, G] = ee(null), [M, F] = ee(null), [A, C] = ee(null), [O, W] = ee(y.facingMode), [a, n] = ee(!1), [u, e] = ee(!1), [c, s] = ee(null), h = ln(), w = i(async () => {
|
|
3589
3606
|
var Z;
|
|
3590
3607
|
if (!E.current)
|
|
3591
3608
|
return;
|
|
@@ -3600,17 +3617,17 @@ const Et = {
|
|
|
3600
3617
|
try {
|
|
3601
3618
|
const se = await navigator.mediaDevices.getUserMedia(U);
|
|
3602
3619
|
m.current = se, E.current.srcObject = se, await E.current.play();
|
|
3603
|
-
const
|
|
3604
|
-
n(!!(
|
|
3620
|
+
const oe = se.getVideoTracks()[0], ie = (Z = oe.getCapabilities) == null ? void 0 : Z.call(oe);
|
|
3621
|
+
n(!!(ie != null && ie.torch)), X(!0), C(!0), F(null), L == null || L();
|
|
3605
3622
|
} catch (se) {
|
|
3606
|
-
const
|
|
3607
|
-
F(
|
|
3623
|
+
const oe = se instanceof Error ? se.message : o("qrScanner.failedToAccessCamera", "Failed to access camera");
|
|
3624
|
+
F(oe), C(!1), S == null || S(new Error(oe));
|
|
3608
3625
|
}
|
|
3609
|
-
}, [y.resolution, O, L, S,
|
|
3626
|
+
}, [y.resolution, O, L, S, o]), v = i(() => {
|
|
3610
3627
|
m.current && (m.current.getTracks().forEach((te) => te.stop()), m.current = null), E.current && (E.current.srcObject = null), X(!1), e(!1);
|
|
3611
|
-
}, []), N =
|
|
3628
|
+
}, []), N = i(async () => {
|
|
3612
3629
|
W(O === "user" ? "environment" : "user"), q && v();
|
|
3613
|
-
}, [O, q, v]), l =
|
|
3630
|
+
}, [O, q, v]), l = i(async () => {
|
|
3614
3631
|
if (!m.current || !a)
|
|
3615
3632
|
return;
|
|
3616
3633
|
const te = m.current.getVideoTracks()[0], U = !u;
|
|
@@ -3620,16 +3637,16 @@ const Et = {
|
|
|
3620
3637
|
}), e(U);
|
|
3621
3638
|
} catch {
|
|
3622
3639
|
}
|
|
3623
|
-
}, [a, u]), p =
|
|
3640
|
+
}, [a, u]), p = i(async () => {
|
|
3624
3641
|
if (h)
|
|
3625
3642
|
try {
|
|
3626
3643
|
const te = window.BarcodeDetector;
|
|
3627
3644
|
I.current = new te({ formats: ["qr_code"] });
|
|
3628
3645
|
} catch (te) {
|
|
3629
|
-
const U = te instanceof Error ? te.message :
|
|
3646
|
+
const U = te instanceof Error ? te.message : o("qrScanner.failedToInitializeQrDetector", "Failed to initialize QR detector");
|
|
3630
3647
|
F(U), S == null || S(new Error(U));
|
|
3631
3648
|
}
|
|
3632
|
-
}, [h, S,
|
|
3649
|
+
}, [h, S, o]), T = i(
|
|
3633
3650
|
(te, U) => {
|
|
3634
3651
|
const Z = {
|
|
3635
3652
|
text: te,
|
|
@@ -3649,7 +3666,7 @@ const Et = {
|
|
|
3649
3666
|
return Z;
|
|
3650
3667
|
},
|
|
3651
3668
|
[y.parseDataType]
|
|
3652
|
-
), K =
|
|
3669
|
+
), K = i(async () => {
|
|
3653
3670
|
if (!(!E.current || !I.current || !z))
|
|
3654
3671
|
try {
|
|
3655
3672
|
const U = await I.current.detect(E.current);
|
|
@@ -3673,28 +3690,28 @@ const Et = {
|
|
|
3673
3690
|
y.vibrateOnScan,
|
|
3674
3691
|
T,
|
|
3675
3692
|
x
|
|
3676
|
-
]), k =
|
|
3693
|
+
]), k = i(async () => {
|
|
3677
3694
|
H(!0), F(null), await p(), await w();
|
|
3678
|
-
}, [p, w]), P =
|
|
3695
|
+
}, [p, w]), P = i(() => {
|
|
3679
3696
|
H(!1), B.current && (clearInterval(B.current), B.current = null), v();
|
|
3680
|
-
}, [v]), j =
|
|
3697
|
+
}, [v]), j = i(async () => {
|
|
3681
3698
|
q ? P() : await k();
|
|
3682
|
-
}, [q, k, P]), V =
|
|
3699
|
+
}, [q, k, P]), V = i(() => {
|
|
3683
3700
|
if (!E.current || !f.current)
|
|
3684
3701
|
return null;
|
|
3685
3702
|
const te = f.current, U = E.current;
|
|
3686
3703
|
te.width = U.videoWidth, te.height = U.videoHeight;
|
|
3687
3704
|
const Z = te.getContext("2d");
|
|
3688
3705
|
return Z ? (Z.drawImage(U, 0, 0), te.toDataURL("image/png")) : null;
|
|
3689
|
-
}, []), Q =
|
|
3706
|
+
}, []), Q = i(
|
|
3690
3707
|
async (te) => !h || !I.current ? null : new Promise((U) => {
|
|
3691
3708
|
const Z = new Image();
|
|
3692
3709
|
Z.onload = async () => {
|
|
3693
3710
|
try {
|
|
3694
|
-
const
|
|
3695
|
-
if (
|
|
3696
|
-
const
|
|
3697
|
-
U(
|
|
3711
|
+
const oe = await I.current.detect(Z);
|
|
3712
|
+
if (oe.length > 0) {
|
|
3713
|
+
const ie = T(oe[0].rawValue, oe[0]);
|
|
3714
|
+
U(ie);
|
|
3698
3715
|
} else
|
|
3699
3716
|
U(null);
|
|
3700
3717
|
} catch {
|
|
@@ -3780,9 +3797,9 @@ const Et = {
|
|
|
3780
3797
|
M && /* @__PURE__ */ J("div", { className: "nice-qr-scanner__error", children: [
|
|
3781
3798
|
/* @__PURE__ */ d("div", { className: "nice-qr-scanner__error-icon", children: /* @__PURE__ */ d("span", { className: "nice-platform-mark nice-platform-mark--alert", "aria-hidden": "true" }) }),
|
|
3782
3799
|
/* @__PURE__ */ d("p", { className: "nice-qr-scanner__error-text", children: M }),
|
|
3783
|
-
/* @__PURE__ */ d("button", { className: "nice-qr-scanner__error-btn", onClick: () => k(), children:
|
|
3800
|
+
/* @__PURE__ */ d("button", { className: "nice-qr-scanner__error-btn", onClick: () => k(), children: o("qrScanner.tryAgain", "Try Again") })
|
|
3784
3801
|
] }),
|
|
3785
|
-
!h && /* @__PURE__ */ d("div", { className: "nice-qr-scanner__unsupported", children: /* @__PURE__ */ d("p", { children:
|
|
3802
|
+
!h && /* @__PURE__ */ d("div", { className: "nice-qr-scanner__unsupported", children: /* @__PURE__ */ d("p", { children: o(
|
|
3786
3803
|
"qrScanner.qrScanningIsNotSupported",
|
|
3787
3804
|
"QR scanning is not supported in this browser."
|
|
3788
3805
|
) }) }),
|
|
@@ -4151,13 +4168,13 @@ const Et = {
|
|
|
4151
4168
|
standard: "ISO/IEC 24724"
|
|
4152
4169
|
}
|
|
4153
4170
|
], _e = (t, g) => {
|
|
4154
|
-
const
|
|
4155
|
-
if (!
|
|
4171
|
+
const o = ye.find((_) => _.id === g);
|
|
4172
|
+
if (!o)
|
|
4156
4173
|
return { valid: !1, errors: ["Unknown symbology"], warnings: [] };
|
|
4157
|
-
const b = [], x = [], S =
|
|
4158
|
-
switch (
|
|
4159
|
-
|
|
4160
|
-
) : (t.length <
|
|
4174
|
+
const b = [], x = [], S = o.fixedLength && o.hasCheckDigit ? o.fixedLength - 1 : o.fixedLength, L = !!o.fixedLength && o.hasCheckDigit && t.length === o.fixedLength;
|
|
4175
|
+
switch (o.fixedLength ? t.length !== S && !L && b.push(
|
|
4176
|
+
o.hasCheckDigit ? `Expected ${S} digits, or ${o.fixedLength} with the check digit; got ${t.length}` : `Expected ${o.fixedLength} characters, got ${t.length}`
|
|
4177
|
+
) : (t.length < o.minLength && b.push(`Minimum ${o.minLength} characters required`), t.length > o.maxLength && b.push(`Maximum ${o.maxLength} characters allowed`)), g) {
|
|
4161
4178
|
case "ean13":
|
|
4162
4179
|
case "ean8":
|
|
4163
4180
|
case "ean5":
|
|
@@ -4185,7 +4202,7 @@ const Et = {
|
|
|
4185
4202
|
break;
|
|
4186
4203
|
}
|
|
4187
4204
|
let Y;
|
|
4188
|
-
if (
|
|
4205
|
+
if (o.hasCheckDigit && b.length === 0)
|
|
4189
4206
|
switch (g) {
|
|
4190
4207
|
case "ean13":
|
|
4191
4208
|
case "ean8":
|
|
@@ -4213,7 +4230,7 @@ const Et = {
|
|
|
4213
4230
|
gs1: "GS1 Standards"
|
|
4214
4231
|
}, dr = /* @__PURE__ */ Object.assign(
|
|
4215
4232
|
/* @__PURE__ */ ce((t, g) => {
|
|
4216
|
-
const { t:
|
|
4233
|
+
const { t: o } = ue(), {
|
|
4217
4234
|
selected: b,
|
|
4218
4235
|
onChange: x,
|
|
4219
4236
|
category: S = "all",
|
|
@@ -4228,31 +4245,31 @@ const Et = {
|
|
|
4228
4245
|
for (const n of $)
|
|
4229
4246
|
a[n.category] || (a[n.category] = []), a[n.category].push(n);
|
|
4230
4247
|
return a;
|
|
4231
|
-
}, [$]), H =
|
|
4248
|
+
}, [$]), H = i(
|
|
4232
4249
|
(a) => {
|
|
4233
4250
|
b || f(a), x == null || x(a);
|
|
4234
4251
|
},
|
|
4235
4252
|
[b, x]
|
|
4236
|
-
), z =
|
|
4253
|
+
), z = i(
|
|
4237
4254
|
(a) => {
|
|
4238
4255
|
L ? B.includes(a) || H([...B, a]) : H([a]);
|
|
4239
4256
|
},
|
|
4240
4257
|
[B, L, H]
|
|
4241
|
-
), X =
|
|
4258
|
+
), X = i(
|
|
4242
4259
|
(a) => {
|
|
4243
4260
|
H(B.filter((n) => n !== a));
|
|
4244
4261
|
},
|
|
4245
4262
|
[B, H]
|
|
4246
|
-
), R =
|
|
4263
|
+
), R = i(
|
|
4247
4264
|
(a) => {
|
|
4248
4265
|
r || (B.includes(a) ? X(a) : z(a));
|
|
4249
4266
|
},
|
|
4250
4267
|
[B, r, z, X]
|
|
4251
|
-
), G =
|
|
4268
|
+
), G = i(() => {
|
|
4252
4269
|
H($.map((a) => a.id));
|
|
4253
|
-
}, [$, H]), M =
|
|
4270
|
+
}, [$, H]), M = i(() => {
|
|
4254
4271
|
H([]);
|
|
4255
|
-
}, [H]), F =
|
|
4272
|
+
}, [H]), F = i((a) => ye.find((n) => n.id === a), []), A = he(() => !_ || !D || !m ? null : _e(D, m), [_, D, m]);
|
|
4256
4273
|
le(
|
|
4257
4274
|
g,
|
|
4258
4275
|
() => ({
|
|
@@ -4287,7 +4304,7 @@ const Et = {
|
|
|
4287
4304
|
{
|
|
4288
4305
|
className: "nice-symbology-config__btn nice-symbology-config__btn--secondary",
|
|
4289
4306
|
onClick: G,
|
|
4290
|
-
children:
|
|
4307
|
+
children: o("symbologyConfig.selectAll", "Select All")
|
|
4291
4308
|
}
|
|
4292
4309
|
),
|
|
4293
4310
|
/* @__PURE__ */ d(
|
|
@@ -4295,14 +4312,14 @@ const Et = {
|
|
|
4295
4312
|
{
|
|
4296
4313
|
className: "nice-symbology-config__btn nice-symbology-config__btn--secondary",
|
|
4297
4314
|
onClick: M,
|
|
4298
|
-
children:
|
|
4315
|
+
children: o("symbologyConfig.clear", "Clear")
|
|
4299
4316
|
}
|
|
4300
4317
|
),
|
|
4301
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__count", children:
|
|
4318
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__count", children: o("symbologyConfig.selected", "{selected} / {filteredSymbologies} selected").replace("{selected}", String(B.length)).replace("{filteredSymbologies}", String($.length)) })
|
|
4302
4319
|
] }),
|
|
4303
4320
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__content", children: [
|
|
4304
4321
|
/* @__PURE__ */ d("div", { className: "nice-symbology-config__list", children: Object.entries(q).map(([a, n]) => /* @__PURE__ */ J("div", { className: "nice-symbology-config__group", children: [
|
|
4305
|
-
/* @__PURE__ */ d("h3", { className: "nice-symbology-config__group-title", children:
|
|
4322
|
+
/* @__PURE__ */ d("h3", { className: "nice-symbology-config__group-title", children: o(
|
|
4306
4323
|
`symbologyConfig.categoryName.${a}`,
|
|
4307
4324
|
$e[a] || a
|
|
4308
4325
|
) }),
|
|
@@ -4349,10 +4366,10 @@ const Et = {
|
|
|
4349
4366
|
),
|
|
4350
4367
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__item-info", children: [
|
|
4351
4368
|
/* @__PURE__ */ d("span", { className: "nice-symbology-config__item-name", children: u.name }),
|
|
4352
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__item-desc", children: u.fixedLength ?
|
|
4369
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__item-desc", children: u.fixedLength ? o("symbologyConfig.digits", "{fixedLength} digits").replace(
|
|
4353
4370
|
"{fixedLength}",
|
|
4354
4371
|
String(u.fixedLength)
|
|
4355
|
-
) :
|
|
4372
|
+
) : o("symbologyConfig.chars", "{minLength}-{maxLength} chars").replace("{minLength}", String(u.minLength)).replace("{maxLength}", String(u.maxLength)) })
|
|
4356
4373
|
] })
|
|
4357
4374
|
]
|
|
4358
4375
|
},
|
|
@@ -4362,51 +4379,51 @@ const Et = {
|
|
|
4362
4379
|
] }, a)) }),
|
|
4363
4380
|
Y && O && /* @__PURE__ */ J("div", { className: "nice-symbology-config__details", children: [
|
|
4364
4381
|
/* @__PURE__ */ d("h3", { className: "nice-symbology-config__details-title", children: O.name }),
|
|
4365
|
-
/* @__PURE__ */ d("p", { className: "nice-symbology-config__details-desc", children:
|
|
4382
|
+
/* @__PURE__ */ d("p", { className: "nice-symbology-config__details-desc", children: o(
|
|
4366
4383
|
`symbologyConfig.symbology.${O.id}.description`,
|
|
4367
4384
|
O.description
|
|
4368
4385
|
) }),
|
|
4369
4386
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__details-props", children: [
|
|
4370
4387
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__prop", children: [
|
|
4371
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4372
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children:
|
|
4388
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.category", "Category") }),
|
|
4389
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: o(
|
|
4373
4390
|
`symbologyConfig.categoryName.${O.category}`,
|
|
4374
4391
|
$e[O.category]
|
|
4375
4392
|
) })
|
|
4376
4393
|
] }),
|
|
4377
4394
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__prop", children: [
|
|
4378
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4395
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.characterSet", "Character Set") }),
|
|
4379
4396
|
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.charset })
|
|
4380
4397
|
] }),
|
|
4381
4398
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__prop", children: [
|
|
4382
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4383
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.fixedLength ?
|
|
4399
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.length", "Length") }),
|
|
4400
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.fixedLength ? o("symbologyConfig.fixed", "Fixed: {fixedLength}").replace(
|
|
4384
4401
|
"{fixedLength}",
|
|
4385
4402
|
String(O.fixedLength)
|
|
4386
4403
|
) : `${O.minLength} – ${O.maxLength}` })
|
|
4387
4404
|
] }),
|
|
4388
4405
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__prop", children: [
|
|
4389
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4390
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.hasCheckDigit ?
|
|
4406
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.checkDigit2", "Check Digit") }),
|
|
4407
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.hasCheckDigit ? o("symbologyConfig.yes", "Yes") : o("symbologyConfig.no", "No") })
|
|
4391
4408
|
] }),
|
|
4392
4409
|
O.standard && /* @__PURE__ */ J("div", { className: "nice-symbology-config__prop", children: [
|
|
4393
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4410
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.standard", "Standard") }),
|
|
4394
4411
|
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-value", children: O.standard })
|
|
4395
4412
|
] })
|
|
4396
4413
|
] }),
|
|
4397
4414
|
/* @__PURE__ */ J("div", { className: "nice-symbology-config__use-cases", children: [
|
|
4398
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4399
|
-
/* @__PURE__ */ d("div", { className: "nice-symbology-config__tags", children: O.useCases.map((a, n) => /* @__PURE__ */ d("span", { className: "nice-symbology-config__tag", children:
|
|
4415
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.useCases", "Use Cases") }),
|
|
4416
|
+
/* @__PURE__ */ d("div", { className: "nice-symbology-config__tags", children: O.useCases.map((a, n) => /* @__PURE__ */ d("span", { className: "nice-symbology-config__tag", children: o(`symbologyConfig.symbology.${O.id}.useCase${n}`, a) }, a)) })
|
|
4400
4417
|
] }),
|
|
4401
4418
|
_ && A && /* @__PURE__ */ J("div", { className: "nice-symbology-config__validation", children: [
|
|
4402
|
-
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children:
|
|
4419
|
+
/* @__PURE__ */ d("span", { className: "nice-symbology-config__prop-label", children: o("symbologyConfig.validation", "Validation") }),
|
|
4403
4420
|
/* @__PURE__ */ J(
|
|
4404
4421
|
"div",
|
|
4405
4422
|
{
|
|
4406
4423
|
className: `nice-symbology-config__validation-result ${A.valid ? "nice-symbology-config__validation-result--valid" : "nice-symbology-config__validation-result--invalid"}`,
|
|
4407
4424
|
children: [
|
|
4408
|
-
/* @__PURE__ */ d("span", { children: A.valid ?
|
|
4409
|
-
A.checkDigit && /* @__PURE__ */ d("span", { children:
|
|
4425
|
+
/* @__PURE__ */ d("span", { children: A.valid ? o("symbologyConfig.valid", "Valid") : o("symbologyConfig.invalid", "Invalid") }),
|
|
4426
|
+
A.checkDigit && /* @__PURE__ */ d("span", { children: o("symbologyConfig.checkDigit", "Check digit: {checkDigit}").replace(
|
|
4410
4427
|
"{checkDigit}",
|
|
4411
4428
|
String(A.checkDigit)
|
|
4412
4429
|
) })
|
|
@@ -4422,13 +4439,13 @@ const Et = {
|
|
|
4422
4439
|
}),
|
|
4423
4440
|
{ displayName: "NiceSymbologyConfig" }
|
|
4424
4441
|
), ur = ({ children: t }) => {
|
|
4425
|
-
const g =
|
|
4442
|
+
const g = i((b) => ye.find((x) => x.id === b), []), o = {
|
|
4426
4443
|
symbologies: ye,
|
|
4427
4444
|
selected: [],
|
|
4428
4445
|
validate: _e,
|
|
4429
4446
|
getInfo: g
|
|
4430
4447
|
};
|
|
4431
|
-
return /* @__PURE__ */ d(Le.Provider, { value:
|
|
4448
|
+
return /* @__PURE__ */ d(Le.Provider, { value: o, children: t });
|
|
4432
4449
|
}, Xe = /* @__PURE__ */ me(
|
|
4433
4450
|
null
|
|
4434
4451
|
), fr = () => {
|
|
@@ -4447,7 +4464,7 @@ const Et = {
|
|
|
4447
4464
|
periodicSyncInterval: 0
|
|
4448
4465
|
}, fn = () => `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, mn = (t) => new Promise((g) => setTimeout(g, t)), hn = /* @__PURE__ */ Object.assign(
|
|
4449
4466
|
/* @__PURE__ */ ce((t, g) => {
|
|
4450
|
-
const { t:
|
|
4467
|
+
const { t: o } = ue(), {
|
|
4451
4468
|
config: b,
|
|
4452
4469
|
handlers: x,
|
|
4453
4470
|
onSyncStart: S,
|
|
@@ -4462,7 +4479,7 @@ const Et = {
|
|
|
4462
4479
|
pendingCount: 0,
|
|
4463
4480
|
failedCount: 0,
|
|
4464
4481
|
syncProgress: 0
|
|
4465
|
-
}), B =
|
|
4482
|
+
}), B = i(async () => E.current ? E.current : new Promise((e, c) => {
|
|
4466
4483
|
const s = indexedDB.open(y.dbName, 1);
|
|
4467
4484
|
s.onerror = () => c(s.error), s.onupgradeneeded = () => {
|
|
4468
4485
|
const h = s.result;
|
|
@@ -4473,7 +4490,7 @@ const Et = {
|
|
|
4473
4490
|
}, s.onsuccess = () => {
|
|
4474
4491
|
E.current = s.result, e(s.result);
|
|
4475
4492
|
};
|
|
4476
|
-
}), [y.dbName, y.storeName]), $ =
|
|
4493
|
+
}), [y.dbName, y.storeName]), $ = i(
|
|
4477
4494
|
async (e, c, s) => {
|
|
4478
4495
|
const h = await B(), w = {
|
|
4479
4496
|
id: fn(),
|
|
@@ -4493,7 +4510,7 @@ const Et = {
|
|
|
4493
4510
|
});
|
|
4494
4511
|
},
|
|
4495
4512
|
[B, y.storeName, y.defaultMaxAttempts]
|
|
4496
|
-
), q =
|
|
4513
|
+
), q = i(
|
|
4497
4514
|
async (e) => {
|
|
4498
4515
|
const c = await B();
|
|
4499
4516
|
return new Promise((s, h) => {
|
|
@@ -4502,7 +4519,7 @@ const Et = {
|
|
|
4502
4519
|
});
|
|
4503
4520
|
},
|
|
4504
4521
|
[B, y.storeName]
|
|
4505
|
-
), H =
|
|
4522
|
+
), H = i(
|
|
4506
4523
|
async (e) => {
|
|
4507
4524
|
const c = await B();
|
|
4508
4525
|
return new Promise((s, h) => {
|
|
@@ -4511,13 +4528,13 @@ const Et = {
|
|
|
4511
4528
|
});
|
|
4512
4529
|
},
|
|
4513
4530
|
[B, y.storeName]
|
|
4514
|
-
), z =
|
|
4531
|
+
), z = i(
|
|
4515
4532
|
async (e) => (await H(e)).filter((s) => s.status === "pending"),
|
|
4516
4533
|
[H]
|
|
4517
|
-
), X =
|
|
4534
|
+
), X = i(
|
|
4518
4535
|
async (e) => (await H(e)).filter((s) => s.status === "failed"),
|
|
4519
4536
|
[H]
|
|
4520
|
-
), R =
|
|
4537
|
+
), R = i(
|
|
4521
4538
|
async (e) => {
|
|
4522
4539
|
const c = await B();
|
|
4523
4540
|
return new Promise((s, h) => {
|
|
@@ -4526,10 +4543,10 @@ const Et = {
|
|
|
4526
4543
|
});
|
|
4527
4544
|
},
|
|
4528
4545
|
[B, y.storeName]
|
|
4529
|
-
), G =
|
|
4546
|
+
), G = i(async () => {
|
|
4530
4547
|
const e = await H(), c = e.filter((h) => h.status === "pending").length, s = e.filter((h) => h.status === "failed").length;
|
|
4531
4548
|
I((h) => ({ ...h, pendingCount: c, failedCount: s }));
|
|
4532
|
-
}, [H]), M =
|
|
4549
|
+
}, [H]), M = i(
|
|
4533
4550
|
async (e) => {
|
|
4534
4551
|
const c = x[e.tag];
|
|
4535
4552
|
if (!c)
|
|
@@ -4538,12 +4555,12 @@ const Et = {
|
|
|
4538
4555
|
try {
|
|
4539
4556
|
return await c.handler(e), e.status = "success", await R(e), Y == null || Y(e), await q(e.id), !0;
|
|
4540
4557
|
} catch (s) {
|
|
4541
|
-
const h = s instanceof Error ? s.message :
|
|
4558
|
+
const h = s instanceof Error ? s.message : o("backgroundSync.unknownError", "Unknown error");
|
|
4542
4559
|
return e.error = h, e.attempts >= e.maxAttempts ? (e.status = "failed", _ == null || _(e, s instanceof Error ? s : new Error(h))) : e.status = "pending", await R(e), !1;
|
|
4543
4560
|
}
|
|
4544
4561
|
},
|
|
4545
|
-
[x, R, q, Y, _,
|
|
4546
|
-
), F =
|
|
4562
|
+
[x, R, q, Y, _, o]
|
|
4563
|
+
), F = i(
|
|
4547
4564
|
async (e) => {
|
|
4548
4565
|
if (m.isSyncing)
|
|
4549
4566
|
return { success: 0, failed: 0 };
|
|
@@ -4568,7 +4585,7 @@ const Et = {
|
|
|
4568
4585
|
}));
|
|
4569
4586
|
}
|
|
4570
4587
|
} catch (s) {
|
|
4571
|
-
const h = s instanceof Error ? s.message :
|
|
4588
|
+
const h = s instanceof Error ? s.message : o("backgroundSync.syncFailed", "Sync failed");
|
|
4572
4589
|
I((w) => ({ ...w, error: h }));
|
|
4573
4590
|
}
|
|
4574
4591
|
return await G(), I((s) => ({
|
|
@@ -4588,17 +4605,17 @@ const Et = {
|
|
|
4588
4605
|
G,
|
|
4589
4606
|
S,
|
|
4590
4607
|
L,
|
|
4591
|
-
|
|
4608
|
+
o
|
|
4592
4609
|
]
|
|
4593
|
-
), A =
|
|
4610
|
+
), A = i(() => {
|
|
4594
4611
|
f.current = !0;
|
|
4595
|
-
}, []), C =
|
|
4612
|
+
}, []), C = i(
|
|
4596
4613
|
async (e) => {
|
|
4597
4614
|
const s = (await H()).find((h) => h.id === e);
|
|
4598
4615
|
s && s.status === "failed" && (s.status = "pending", s.attempts = 0, s.error = void 0, await R(s), await G());
|
|
4599
4616
|
},
|
|
4600
4617
|
[H, R, G]
|
|
4601
|
-
), O =
|
|
4618
|
+
), O = i(
|
|
4602
4619
|
async (e) => {
|
|
4603
4620
|
const c = await X(e);
|
|
4604
4621
|
for (const s of c)
|
|
@@ -4606,7 +4623,7 @@ const Et = {
|
|
|
4606
4623
|
await G();
|
|
4607
4624
|
},
|
|
4608
4625
|
[X, R, G]
|
|
4609
|
-
), W =
|
|
4626
|
+
), W = i(
|
|
4610
4627
|
async (e) => {
|
|
4611
4628
|
const c = await B(), s = await H(e);
|
|
4612
4629
|
return new Promise((h, w) => {
|
|
@@ -4619,7 +4636,7 @@ const Et = {
|
|
|
4619
4636
|
});
|
|
4620
4637
|
},
|
|
4621
4638
|
[B, H, y.storeName, G]
|
|
4622
|
-
), a =
|
|
4639
|
+
), a = i(
|
|
4623
4640
|
async (e) => {
|
|
4624
4641
|
const c = await B(), s = await X(e);
|
|
4625
4642
|
return new Promise((h, w) => {
|
|
@@ -4632,7 +4649,7 @@ const Et = {
|
|
|
4632
4649
|
});
|
|
4633
4650
|
},
|
|
4634
4651
|
[B, X, y.storeName, G]
|
|
4635
|
-
), n =
|
|
4652
|
+
), n = i(async (e) => {
|
|
4636
4653
|
if (!("serviceWorker" in navigator))
|
|
4637
4654
|
return !1;
|
|
4638
4655
|
try {
|
|
@@ -4740,9 +4757,9 @@ class vn {
|
|
|
4740
4757
|
}
|
|
4741
4758
|
async init() {
|
|
4742
4759
|
if (!this.db)
|
|
4743
|
-
return new Promise((g,
|
|
4760
|
+
return new Promise((g, o) => {
|
|
4744
4761
|
const b = indexedDB.open(this.dbName, 1);
|
|
4745
|
-
b.onerror = () =>
|
|
4762
|
+
b.onerror = () => o(b.error), b.onupgradeneeded = () => {
|
|
4746
4763
|
const x = b.result;
|
|
4747
4764
|
x.objectStoreNames.contains(this.storeName) || x.createObjectStore(this.storeName, { keyPath: "key" });
|
|
4748
4765
|
}, b.onsuccess = () => {
|
|
@@ -4752,51 +4769,51 @@ class vn {
|
|
|
4752
4769
|
}
|
|
4753
4770
|
async get(g) {
|
|
4754
4771
|
if (await this.init(), !!this.db)
|
|
4755
|
-
return new Promise((
|
|
4772
|
+
return new Promise((o, b) => {
|
|
4756
4773
|
const L = this.db.transaction(this.storeName, "readonly").objectStore(this.storeName).get(g);
|
|
4757
4774
|
L.onerror = () => b(L.error), L.onsuccess = () => {
|
|
4758
4775
|
const Y = L.result;
|
|
4759
|
-
|
|
4776
|
+
o(Y ? Y.value : void 0);
|
|
4760
4777
|
};
|
|
4761
4778
|
});
|
|
4762
4779
|
}
|
|
4763
|
-
async set(g,
|
|
4780
|
+
async set(g, o) {
|
|
4764
4781
|
if (await this.init(), !!this.db)
|
|
4765
4782
|
return new Promise((b, x) => {
|
|
4766
|
-
const Y = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ key: g, value:
|
|
4783
|
+
const Y = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).put({ key: g, value: o });
|
|
4767
4784
|
Y.onerror = () => x(Y.error), Y.onsuccess = () => b();
|
|
4768
4785
|
});
|
|
4769
4786
|
}
|
|
4770
4787
|
async delete(g) {
|
|
4771
|
-
return await this.init(), this.db ? new Promise((
|
|
4788
|
+
return await this.init(), this.db ? new Promise((o, b) => {
|
|
4772
4789
|
const L = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete(g);
|
|
4773
|
-
L.onerror = () => b(L.error), L.onsuccess = () =>
|
|
4790
|
+
L.onerror = () => b(L.error), L.onsuccess = () => o(!0);
|
|
4774
4791
|
}) : !1;
|
|
4775
4792
|
}
|
|
4776
4793
|
async keys() {
|
|
4777
|
-
return await this.init(), this.db ? new Promise((g,
|
|
4794
|
+
return await this.init(), this.db ? new Promise((g, o) => {
|
|
4778
4795
|
const S = this.db.transaction(this.storeName, "readonly").objectStore(this.storeName).getAllKeys();
|
|
4779
|
-
S.onerror = () =>
|
|
4796
|
+
S.onerror = () => o(S.error), S.onsuccess = () => g(S.result);
|
|
4780
4797
|
}) : [];
|
|
4781
4798
|
}
|
|
4782
4799
|
async clear() {
|
|
4783
4800
|
if (await this.init(), !!this.db)
|
|
4784
|
-
return new Promise((g,
|
|
4801
|
+
return new Promise((g, o) => {
|
|
4785
4802
|
const S = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).clear();
|
|
4786
|
-
S.onerror = () =>
|
|
4803
|
+
S.onerror = () => o(S.error), S.onsuccess = () => g();
|
|
4787
4804
|
});
|
|
4788
4805
|
}
|
|
4789
4806
|
async getAll() {
|
|
4790
|
-
return await this.init(), this.db ? new Promise((g,
|
|
4807
|
+
return await this.init(), this.db ? new Promise((g, o) => {
|
|
4791
4808
|
const S = this.db.transaction(this.storeName, "readonly").objectStore(this.storeName).getAll();
|
|
4792
|
-
S.onerror = () =>
|
|
4809
|
+
S.onerror = () => o(S.error), S.onsuccess = () => g(S.result);
|
|
4793
4810
|
}) : [];
|
|
4794
4811
|
}
|
|
4795
4812
|
}
|
|
4796
4813
|
const wn = /* @__PURE__ */ Object.assign(
|
|
4797
4814
|
/* @__PURE__ */ ce((t, g) => {
|
|
4798
4815
|
const {
|
|
4799
|
-
config:
|
|
4816
|
+
config: o,
|
|
4800
4817
|
routeStrategies: b = {},
|
|
4801
4818
|
precacheUrls: x = [],
|
|
4802
4819
|
onFetch: S,
|
|
@@ -4804,14 +4821,14 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4804
4821
|
onCacheMiss: Y,
|
|
4805
4822
|
onNetworkError: _,
|
|
4806
4823
|
children: D
|
|
4807
|
-
} = t, r = { ...yn, ...
|
|
4824
|
+
} = t, r = { ...yn, ...o }, y = re(new vn()), [E, f] = ee({
|
|
4808
4825
|
isFetching: !1,
|
|
4809
4826
|
totalSize: 0,
|
|
4810
4827
|
entryCount: 0,
|
|
4811
4828
|
hits: 0,
|
|
4812
4829
|
misses: 0,
|
|
4813
4830
|
strategy: r.defaultStrategy
|
|
4814
|
-
}), m =
|
|
4831
|
+
}), m = i(
|
|
4815
4832
|
(a) => {
|
|
4816
4833
|
for (const [n, u] of Object.entries(b))
|
|
4817
4834
|
if (new RegExp(n).test(a))
|
|
@@ -4819,9 +4836,9 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4819
4836
|
return E.strategy;
|
|
4820
4837
|
},
|
|
4821
4838
|
[b, E.strategy]
|
|
4822
|
-
), I =
|
|
4839
|
+
), I = i((a) => {
|
|
4823
4840
|
f((n) => ({ ...n, strategy: a }));
|
|
4824
|
-
}, []), B =
|
|
4841
|
+
}, []), B = i(
|
|
4825
4842
|
async (a) => {
|
|
4826
4843
|
const n = await y.current.get(a);
|
|
4827
4844
|
if (!n)
|
|
@@ -4843,7 +4860,7 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4843
4860
|
};
|
|
4844
4861
|
},
|
|
4845
4862
|
[r.staleThreshold, r.serveStale]
|
|
4846
|
-
), $ =
|
|
4863
|
+
), $ = i(async () => {
|
|
4847
4864
|
const a = await y.current.getAll();
|
|
4848
4865
|
let n = 0, u, e;
|
|
4849
4866
|
for (const c of a) {
|
|
@@ -4856,10 +4873,10 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4856
4873
|
oldestEntry: u ? new Date(u) : void 0,
|
|
4857
4874
|
newestEntry: e ? new Date(e) : void 0
|
|
4858
4875
|
};
|
|
4859
|
-
}, []), q =
|
|
4876
|
+
}, []), q = i(async () => {
|
|
4860
4877
|
const a = await $();
|
|
4861
4878
|
f((n) => ({ ...n, entryCount: a.entryCount, totalSize: a.size }));
|
|
4862
|
-
}, [$]), H =
|
|
4879
|
+
}, [$]), H = i(
|
|
4863
4880
|
async (a, n, u) => {
|
|
4864
4881
|
const e = Date.now(), c = {
|
|
4865
4882
|
data: n,
|
|
@@ -4876,18 +4893,18 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4876
4893
|
await q();
|
|
4877
4894
|
},
|
|
4878
4895
|
[r.defaultTTL, r.maxEntries, q]
|
|
4879
|
-
), z =
|
|
4896
|
+
), z = i(
|
|
4880
4897
|
async (a) => {
|
|
4881
4898
|
const n = await y.current.delete(a);
|
|
4882
4899
|
return await q(), n;
|
|
4883
4900
|
},
|
|
4884
4901
|
[q]
|
|
4885
|
-
), X =
|
|
4902
|
+
), X = i(async () => {
|
|
4886
4903
|
await y.current.clear(), f((a) => ({ ...a, entryCount: 0, totalSize: 0 }));
|
|
4887
|
-
}, []), R =
|
|
4904
|
+
}, []), R = i(async () => y.current.keys(), []), G = i(
|
|
4888
4905
|
async (a) => await B(a) !== void 0,
|
|
4889
4906
|
[B]
|
|
4890
|
-
), M =
|
|
4907
|
+
), M = i(
|
|
4891
4908
|
async (a) => {
|
|
4892
4909
|
const n = await y.current.keys();
|
|
4893
4910
|
let u = 0;
|
|
@@ -4896,7 +4913,7 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4896
4913
|
return await q(), u;
|
|
4897
4914
|
},
|
|
4898
4915
|
[q]
|
|
4899
|
-
), F =
|
|
4916
|
+
), F = i(
|
|
4900
4917
|
async (a, n, u) => {
|
|
4901
4918
|
const e = new AbortController(), c = setTimeout(() => e.abort(), u);
|
|
4902
4919
|
try {
|
|
@@ -4910,7 +4927,7 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4910
4927
|
}
|
|
4911
4928
|
},
|
|
4912
4929
|
[]
|
|
4913
|
-
), A =
|
|
4930
|
+
), A = i(
|
|
4914
4931
|
async (a, n = {}) => {
|
|
4915
4932
|
const {
|
|
4916
4933
|
strategy: u = m(a),
|
|
@@ -4991,10 +5008,10 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
4991
5008
|
Y,
|
|
4992
5009
|
_
|
|
4993
5010
|
]
|
|
4994
|
-
), C =
|
|
5011
|
+
), C = i(
|
|
4995
5012
|
async (a, n) => (await A(a, n)).data,
|
|
4996
5013
|
[A]
|
|
4997
|
-
), O =
|
|
5014
|
+
), O = i(
|
|
4998
5015
|
async (a, n) => {
|
|
4999
5016
|
await Promise.all(
|
|
5000
5017
|
a.map(
|
|
@@ -5072,11 +5089,11 @@ const wn = /* @__PURE__ */ Object.assign(
|
|
|
5072
5089
|
), bn = wn;
|
|
5073
5090
|
process.env.NODE_ENV !== "production" && (bn.displayName = "NiceCacheStrategiesProvider");
|
|
5074
5091
|
function mr(t, g) {
|
|
5075
|
-
const
|
|
5092
|
+
const o = pn(), [b, x] = ee(void 0), [S, L] = ee(!1), [Y, _] = ee(void 0), D = i(async () => {
|
|
5076
5093
|
if (t) {
|
|
5077
5094
|
L(!0), _(void 0);
|
|
5078
5095
|
try {
|
|
5079
|
-
const r = await
|
|
5096
|
+
const r = await o.fetchJSON(t, g);
|
|
5080
5097
|
x(r);
|
|
5081
5098
|
} catch (r) {
|
|
5082
5099
|
_(r instanceof Error ? r : new Error(String(r)));
|
|
@@ -5084,7 +5101,7 @@ function mr(t, g) {
|
|
|
5084
5101
|
L(!1);
|
|
5085
5102
|
}
|
|
5086
5103
|
}
|
|
5087
|
-
}, [t, g,
|
|
5104
|
+
}, [t, g, o]);
|
|
5088
5105
|
return ne(() => {
|
|
5089
5106
|
D();
|
|
5090
5107
|
}, [D]), {
|
|
@@ -5105,10 +5122,10 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5105
5122
|
maxPendingConflicts: 100,
|
|
5106
5123
|
persistConflicts: !0,
|
|
5107
5124
|
storageKey: "nice-conflict-resolution"
|
|
5108
|
-
}, _n = () => `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Nn = (t) => JSON.stringify(t), Cn = (t, g) => JSON.stringify(t) === JSON.stringify(g), xn = (t, g,
|
|
5125
|
+
}, _n = () => `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Nn = (t) => JSON.stringify(t), Cn = (t, g) => JSON.stringify(t) === JSON.stringify(g), xn = (t, g, o) => ({ ...t, ...g }), kn = /* @__PURE__ */ Object.assign(
|
|
5109
5126
|
/* @__PURE__ */ ce(
|
|
5110
5127
|
(t, g) => {
|
|
5111
|
-
const { t:
|
|
5128
|
+
const { t: o } = ue(), {
|
|
5112
5129
|
config: b,
|
|
5113
5130
|
handlers: x = {},
|
|
5114
5131
|
showConflictUI: S = !0,
|
|
@@ -5120,10 +5137,10 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5120
5137
|
renderConflictList: y,
|
|
5121
5138
|
renderConflictItem: E,
|
|
5122
5139
|
children: f
|
|
5123
|
-
} = t, m = { ...Sn, ...b }, [I, B] = ee([]), [$, q] = ee(!1), [H, z] = ee(!1), X =
|
|
5140
|
+
} = t, m = { ...Sn, ...b }, [I, B] = ee([]), [$, q] = ee(!1), [H, z] = ee(!1), X = i(
|
|
5124
5141
|
(k) => x[k] || {},
|
|
5125
5142
|
[x]
|
|
5126
|
-
), R =
|
|
5143
|
+
), R = i((k) => ({
|
|
5127
5144
|
pending: k.filter((P) => P.status === "pending").length,
|
|
5128
5145
|
resolving: k.filter((P) => P.status === "resolving").length,
|
|
5129
5146
|
resolved: k.filter((P) => P.status === "resolved").length,
|
|
@@ -5131,7 +5148,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5131
5148
|
}), []), G = he(
|
|
5132
5149
|
() => ({ conflicts: I, isResolving: $, counts: R(I) }),
|
|
5133
5150
|
[I, $, R]
|
|
5134
|
-
), M =
|
|
5151
|
+
), M = i(() => {
|
|
5135
5152
|
if (m.persistConflicts)
|
|
5136
5153
|
try {
|
|
5137
5154
|
const k = localStorage.getItem(m.storageKey);
|
|
@@ -5158,7 +5175,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5158
5175
|
} catch (k) {
|
|
5159
5176
|
console.warn("Failed to load persisted conflicts:", k);
|
|
5160
5177
|
}
|
|
5161
|
-
}, [m.persistConflicts, m.storageKey]), F =
|
|
5178
|
+
}, [m.persistConflicts, m.storageKey]), F = i(
|
|
5162
5179
|
(k) => {
|
|
5163
5180
|
if (m.persistConflicts)
|
|
5164
5181
|
try {
|
|
@@ -5177,7 +5194,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5177
5194
|
}, [M]), ke.useEffect(() => {
|
|
5178
5195
|
F(I);
|
|
5179
5196
|
}, [I, F]);
|
|
5180
|
-
const A =
|
|
5197
|
+
const A = i(
|
|
5181
5198
|
(k) => {
|
|
5182
5199
|
B((P) => {
|
|
5183
5200
|
const j = P.findIndex(
|
|
@@ -5188,7 +5205,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5188
5205
|
}), _ == null || _(k), Y && S && z(!0);
|
|
5189
5206
|
},
|
|
5190
5207
|
[m.maxPendingConflicts, Y, S, _]
|
|
5191
|
-
), C =
|
|
5208
|
+
), C = i(
|
|
5192
5209
|
(k, P, j, V, Q) => {
|
|
5193
5210
|
const ae = X(k), te = ae.compare || Cn, U = ae.hash || Nn, Z = ae.getConflictingFields;
|
|
5194
5211
|
if (te(j.data, V.data) || j.timestamp < V.timestamp && Q && te(j.data, Q.data))
|
|
@@ -5219,7 +5236,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5219
5236
|
return A(se), se;
|
|
5220
5237
|
},
|
|
5221
5238
|
[X, A]
|
|
5222
|
-
), O =
|
|
5239
|
+
), O = i(
|
|
5223
5240
|
async (k, P, j) => {
|
|
5224
5241
|
var te;
|
|
5225
5242
|
const V = I.findIndex((U) => U.id === k);
|
|
@@ -5268,18 +5285,18 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5268
5285
|
resolvedAt: /* @__PURE__ */ new Date()
|
|
5269
5286
|
};
|
|
5270
5287
|
B((se) => {
|
|
5271
|
-
const
|
|
5272
|
-
return
|
|
5288
|
+
const oe = [...se];
|
|
5289
|
+
return oe[V] = Z, oe;
|
|
5273
5290
|
}), D == null || D(Z);
|
|
5274
5291
|
} catch (U) {
|
|
5275
|
-
const Z = U instanceof Error ? U.message :
|
|
5292
|
+
const Z = U instanceof Error ? U.message : o("conflictResolution.resolutionFailed", "Resolution failed");
|
|
5276
5293
|
B((se) => {
|
|
5277
|
-
const
|
|
5278
|
-
return
|
|
5294
|
+
const oe = [...se];
|
|
5295
|
+
return oe[V] = {
|
|
5279
5296
|
...Q,
|
|
5280
5297
|
status: "failed",
|
|
5281
5298
|
error: Z
|
|
5282
|
-
},
|
|
5299
|
+
}, oe;
|
|
5283
5300
|
}), r == null || r(
|
|
5284
5301
|
Q,
|
|
5285
5302
|
U instanceof Error ? U : new Error(Z)
|
|
@@ -5288,35 +5305,35 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5288
5305
|
q(!1);
|
|
5289
5306
|
}
|
|
5290
5307
|
},
|
|
5291
|
-
[I, X, D, r,
|
|
5308
|
+
[I, X, D, r, o]
|
|
5292
5309
|
);
|
|
5293
5310
|
ke.useEffect(() => {
|
|
5294
5311
|
if (!(!m.autoResolve || m.defaultStrategy === "manual"))
|
|
5295
5312
|
for (const k of I)
|
|
5296
5313
|
k.status === "pending" && O(k.id, m.defaultStrategy);
|
|
5297
5314
|
}, [I, m.autoResolve, m.defaultStrategy, O]);
|
|
5298
|
-
const W =
|
|
5315
|
+
const W = i(
|
|
5299
5316
|
async (k) => {
|
|
5300
5317
|
const P = I.filter((j) => j.status === "pending");
|
|
5301
5318
|
for (const j of P)
|
|
5302
5319
|
await O(j.id, k);
|
|
5303
5320
|
},
|
|
5304
5321
|
[I, O]
|
|
5305
|
-
), a =
|
|
5322
|
+
), a = i(
|
|
5306
5323
|
(k) => I.find((P) => P.id === k),
|
|
5307
5324
|
[I]
|
|
5308
|
-
), n =
|
|
5325
|
+
), n = i(
|
|
5309
5326
|
(k, P) => I.filter(
|
|
5310
5327
|
(j) => j.entityType === k && (P === void 0 || j.entityId === P)
|
|
5311
5328
|
),
|
|
5312
5329
|
[I]
|
|
5313
|
-
), u =
|
|
5330
|
+
), u = i(() => I.filter((k) => k.status === "pending"), [I]), e = i((k) => {
|
|
5314
5331
|
B((P) => P.filter((j) => j.id !== k));
|
|
5315
|
-
}, []), c =
|
|
5332
|
+
}, []), c = i(() => {
|
|
5316
5333
|
B((k) => k.filter((P) => P.status !== "resolved"));
|
|
5317
|
-
}, []), s =
|
|
5334
|
+
}, []), s = i(() => {
|
|
5318
5335
|
B([]);
|
|
5319
|
-
}, []), h =
|
|
5336
|
+
}, []), h = i(() => z(!0), []), w = i(() => z(!1), []);
|
|
5320
5337
|
le(
|
|
5321
5338
|
g,
|
|
5322
5339
|
() => ({
|
|
@@ -5373,23 +5390,23 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5373
5390
|
}) : /* @__PURE__ */ J("div", { className: "nice-conflict-item", children: [
|
|
5374
5391
|
/* @__PURE__ */ J("div", { className: "nice-conflict-item__header", children: [
|
|
5375
5392
|
/* @__PURE__ */ d("span", { className: "nice-conflict-item__type", children: k.entityType }),
|
|
5376
|
-
/* @__PURE__ */ d("span", { className: "nice-conflict-item__id", children:
|
|
5393
|
+
/* @__PURE__ */ d("span", { className: "nice-conflict-item__id", children: o("conflictResolution.id", "ID: {entityId}").replace(
|
|
5377
5394
|
"{entityId}",
|
|
5378
5395
|
String(k.entityId)
|
|
5379
5396
|
) })
|
|
5380
5397
|
] }),
|
|
5381
5398
|
/* @__PURE__ */ J("div", { className: "nice-conflict-item__versions", children: [
|
|
5382
5399
|
/* @__PURE__ */ J("div", { className: "nice-conflict-item__version nice-conflict-item__version--client", children: [
|
|
5383
|
-
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-label", children:
|
|
5400
|
+
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-label", children: o("conflictResolution.yourChanges", "Your changes") }),
|
|
5384
5401
|
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-time", children: k.clientVersion.timestamp.toLocaleString() })
|
|
5385
5402
|
] }),
|
|
5386
5403
|
/* @__PURE__ */ J("div", { className: "nice-conflict-item__version nice-conflict-item__version--server", children: [
|
|
5387
|
-
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-label", children:
|
|
5404
|
+
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-label", children: o("conflictResolution.serverVersion", "Server version") }),
|
|
5388
5405
|
/* @__PURE__ */ d("span", { className: "nice-conflict-item__version-time", children: k.serverVersion.timestamp.toLocaleString() })
|
|
5389
5406
|
] })
|
|
5390
5407
|
] }),
|
|
5391
5408
|
k.conflictingFields && k.conflictingFields.length > 0 && /* @__PURE__ */ J("div", { className: "nice-conflict-item__fields", children: [
|
|
5392
|
-
/* @__PURE__ */ d("span", { children:
|
|
5409
|
+
/* @__PURE__ */ d("span", { children: o("conflictResolution.conflictingFields", "Conflicting fields:") }),
|
|
5393
5410
|
k.conflictingFields.map((P) => /* @__PURE__ */ d("code", { children: P }, P))
|
|
5394
5411
|
] }),
|
|
5395
5412
|
/* @__PURE__ */ J("div", { className: "nice-conflict-item__actions", children: [
|
|
@@ -5399,7 +5416,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5399
5416
|
className: "nice-conflict-btn nice-conflict-btn--client",
|
|
5400
5417
|
onClick: () => l(k.id, "client-wins"),
|
|
5401
5418
|
disabled: $,
|
|
5402
|
-
children:
|
|
5419
|
+
children: o("conflictResolution.keepMine", "Keep Mine")
|
|
5403
5420
|
}
|
|
5404
5421
|
),
|
|
5405
5422
|
/* @__PURE__ */ d(
|
|
@@ -5408,7 +5425,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5408
5425
|
className: "nice-conflict-btn nice-conflict-btn--server",
|
|
5409
5426
|
onClick: () => l(k.id, "server-wins"),
|
|
5410
5427
|
disabled: $,
|
|
5411
|
-
children:
|
|
5428
|
+
children: o("conflictResolution.useServer", "Use Server")
|
|
5412
5429
|
}
|
|
5413
5430
|
),
|
|
5414
5431
|
/* @__PURE__ */ d(
|
|
@@ -5417,7 +5434,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5417
5434
|
className: "nice-conflict-btn nice-conflict-btn--merge",
|
|
5418
5435
|
onClick: () => l(k.id, "merge"),
|
|
5419
5436
|
disabled: $,
|
|
5420
|
-
children:
|
|
5437
|
+
children: o("conflictResolution.merge", "Merge")
|
|
5421
5438
|
}
|
|
5422
5439
|
),
|
|
5423
5440
|
/* @__PURE__ */ d(
|
|
@@ -5426,7 +5443,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5426
5443
|
className: "nice-conflict-btn nice-conflict-btn--dismiss",
|
|
5427
5444
|
onClick: () => p(k.id),
|
|
5428
5445
|
disabled: $,
|
|
5429
|
-
children:
|
|
5446
|
+
children: o("conflictResolution.dismiss", "Dismiss")
|
|
5430
5447
|
}
|
|
5431
5448
|
)
|
|
5432
5449
|
] })
|
|
@@ -5441,7 +5458,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5441
5458
|
});
|
|
5442
5459
|
const k = /* @__PURE__ */ J("div", { className: "nice-conflict-list", children: [
|
|
5443
5460
|
/* @__PURE__ */ J("div", { className: "nice-conflict-list__header", children: [
|
|
5444
|
-
/* @__PURE__ */ d("h3", { children:
|
|
5461
|
+
/* @__PURE__ */ d("h3", { children: o(
|
|
5445
5462
|
"conflictResolution.syncConflicts",
|
|
5446
5463
|
"Sync Conflicts ({pendingConflicts})"
|
|
5447
5464
|
).replace("{pendingConflicts}", String(N.length)) }),
|
|
@@ -5450,7 +5467,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5450
5467
|
{
|
|
5451
5468
|
className: "nice-conflict-list__close",
|
|
5452
5469
|
onClick: w,
|
|
5453
|
-
"aria-label":
|
|
5470
|
+
"aria-label": o("conflictResolution.close", "Close"),
|
|
5454
5471
|
children: /* @__PURE__ */ d("span", { className: "nice-platform-mark nice-platform-mark--close", "aria-hidden": "true" })
|
|
5455
5472
|
}
|
|
5456
5473
|
)
|
|
@@ -5463,7 +5480,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5463
5480
|
className: "nice-conflict-btn nice-conflict-btn--client",
|
|
5464
5481
|
onClick: () => W("client-wins"),
|
|
5465
5482
|
disabled: $,
|
|
5466
|
-
children:
|
|
5483
|
+
children: o("conflictResolution.keepAllMine", "Keep All Mine")
|
|
5467
5484
|
}
|
|
5468
5485
|
),
|
|
5469
5486
|
/* @__PURE__ */ d(
|
|
@@ -5472,7 +5489,7 @@ const Qe = /* @__PURE__ */ me(null), hr = () => {
|
|
|
5472
5489
|
className: "nice-conflict-btn nice-conflict-btn--server",
|
|
5473
5490
|
onClick: () => W("server-wins"),
|
|
5474
5491
|
disabled: $,
|
|
5475
|
-
children:
|
|
5492
|
+
children: o("conflictResolution.useAllServer", "Use All Server")
|
|
5476
5493
|
}
|
|
5477
5494
|
)
|
|
5478
5495
|
] })
|
|
@@ -5505,22 +5522,22 @@ const Je = /* @__PURE__ */ me(null), An = () => {
|
|
|
5505
5522
|
return t;
|
|
5506
5523
|
};
|
|
5507
5524
|
function gr(t) {
|
|
5508
|
-
const g = An(),
|
|
5525
|
+
const g = An(), o = i((f) => g.get(t, f), [g, t]), b = i(
|
|
5509
5526
|
(f) => g.getAll(t, f),
|
|
5510
5527
|
[g, t]
|
|
5511
|
-
), x =
|
|
5528
|
+
), x = i(
|
|
5512
5529
|
(f, m) => g.add(t, f, m),
|
|
5513
5530
|
[g, t]
|
|
5514
|
-
), S =
|
|
5531
|
+
), S = i(
|
|
5515
5532
|
(f, m) => g.put(t, f, m),
|
|
5516
5533
|
[g, t]
|
|
5517
|
-
), L =
|
|
5534
|
+
), L = i((f) => g.delete(t, f), [g, t]), Y = i(() => g.clear(t), [g, t]), _ = i(
|
|
5518
5535
|
(f) => g.count(t, f),
|
|
5519
5536
|
[g, t]
|
|
5520
|
-
), D =
|
|
5537
|
+
), D = i(
|
|
5521
5538
|
(f) => g.query(t, f),
|
|
5522
5539
|
[g, t]
|
|
5523
|
-
), r =
|
|
5540
|
+
), r = i((f) => g.bulkAdd(t, f), [g, t]), y = i((f) => g.bulkPut(t, f), [g, t]), E = i(
|
|
5524
5541
|
(f) => g.bulkDelete(t, f),
|
|
5525
5542
|
[g, t]
|
|
5526
5543
|
);
|
|
@@ -5528,7 +5545,7 @@ function gr(t) {
|
|
|
5528
5545
|
isOpen: g.isOpen,
|
|
5529
5546
|
isLoading: g.isLoading,
|
|
5530
5547
|
error: g.error,
|
|
5531
|
-
get:
|
|
5548
|
+
get: o,
|
|
5532
5549
|
getAll: b,
|
|
5533
5550
|
add: x,
|
|
5534
5551
|
put: S,
|
|
@@ -5543,28 +5560,28 @@ function gr(t) {
|
|
|
5543
5560
|
}
|
|
5544
5561
|
const Dn = /* @__PURE__ */ Object.assign(
|
|
5545
5562
|
/* @__PURE__ */ ce((t, g) => {
|
|
5546
|
-
const { config:
|
|
5563
|
+
const { config: o, autoOpen: b = !0, onOpen: x, onError: S, onClose: L, children: Y } = t, _ = re(null), [D, r] = ee({
|
|
5547
5564
|
isOpen: !1,
|
|
5548
5565
|
isLoading: !1,
|
|
5549
5566
|
storeNames: []
|
|
5550
|
-
}), y =
|
|
5567
|
+
}), y = i(async () => {
|
|
5551
5568
|
if (_.current)
|
|
5552
5569
|
return _.current;
|
|
5553
5570
|
if (!("indexedDB" in window))
|
|
5554
5571
|
throw new Error("IndexedDB is not supported in this browser");
|
|
5555
5572
|
return r((a) => ({ ...a, isLoading: !0, error: void 0 })), new Promise((a, n) => {
|
|
5556
|
-
const u = indexedDB.open(
|
|
5573
|
+
const u = indexedDB.open(o.dbName, o.version);
|
|
5557
5574
|
u.onerror = () => {
|
|
5558
5575
|
var c;
|
|
5559
5576
|
const e = new Error(((c = u.error) == null ? void 0 : c.message) || "Failed to open database");
|
|
5560
5577
|
r((s) => ({ ...s, isLoading: !1, error: e.message })), S == null || S(e), n(e);
|
|
5561
5578
|
}, u.onblocked = () => {
|
|
5562
5579
|
var e;
|
|
5563
|
-
(e =
|
|
5580
|
+
(e = o.onBlocked) == null || e.call(o);
|
|
5564
5581
|
}, u.onupgradeneeded = (e) => {
|
|
5565
5582
|
var w;
|
|
5566
5583
|
const c = u.result, s = e.oldVersion, h = e.newVersion;
|
|
5567
|
-
for (const v of
|
|
5584
|
+
for (const v of o.stores)
|
|
5568
5585
|
if (!c.objectStoreNames.contains(v.name)) {
|
|
5569
5586
|
const N = c.createObjectStore(v.name, {
|
|
5570
5587
|
keyPath: v.keyPath,
|
|
@@ -5574,7 +5591,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5574
5591
|
for (const l of v.indexes)
|
|
5575
5592
|
N.createIndex(l.name, l.keyPath, l.options);
|
|
5576
5593
|
}
|
|
5577
|
-
(w =
|
|
5594
|
+
(w = o.onUpgrade) == null || w.call(o, c, s, h);
|
|
5578
5595
|
}, u.onsuccess = () => {
|
|
5579
5596
|
const e = u.result;
|
|
5580
5597
|
_.current = e, e.onclose = () => {
|
|
@@ -5592,10 +5609,10 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5592
5609
|
}), x == null || x(e), a(e);
|
|
5593
5610
|
};
|
|
5594
5611
|
});
|
|
5595
|
-
}, [
|
|
5612
|
+
}, [o, x, S, L]), E = i(() => {
|
|
5596
5613
|
_.current && (_.current.close(), _.current = null, r((a) => ({ ...a, isOpen: !1, db: void 0 })), L == null || L());
|
|
5597
|
-
}, [L]), f =
|
|
5598
|
-
const u = indexedDB.deleteDatabase(
|
|
5614
|
+
}, [L]), f = i(async () => (E(), new Promise((a, n) => {
|
|
5615
|
+
const u = indexedDB.deleteDatabase(o.dbName);
|
|
5599
5616
|
u.onerror = () => {
|
|
5600
5617
|
var e;
|
|
5601
5618
|
n(new Error(((e = u.error) == null ? void 0 : e.message) || "Failed to delete database"));
|
|
@@ -5606,7 +5623,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5606
5623
|
storeNames: []
|
|
5607
5624
|
}), a();
|
|
5608
5625
|
};
|
|
5609
|
-
})), [
|
|
5626
|
+
})), [o.dbName, E]), m = i(async () => _.current ? _.current : y(), [y]), I = i(
|
|
5610
5627
|
async (a, n) => {
|
|
5611
5628
|
const u = await m();
|
|
5612
5629
|
return new Promise((e, c) => {
|
|
@@ -5618,7 +5635,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5618
5635
|
});
|
|
5619
5636
|
},
|
|
5620
5637
|
[m]
|
|
5621
|
-
), B =
|
|
5638
|
+
), B = i(
|
|
5622
5639
|
async (a, n) => {
|
|
5623
5640
|
const u = await m();
|
|
5624
5641
|
return new Promise((e, c) => {
|
|
@@ -5633,7 +5650,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5633
5650
|
});
|
|
5634
5651
|
},
|
|
5635
5652
|
[m]
|
|
5636
|
-
), $ =
|
|
5653
|
+
), $ = i(
|
|
5637
5654
|
async (a, n) => {
|
|
5638
5655
|
const u = await m();
|
|
5639
5656
|
return new Promise((e, c) => {
|
|
@@ -5645,7 +5662,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5645
5662
|
});
|
|
5646
5663
|
},
|
|
5647
5664
|
[m]
|
|
5648
|
-
), q =
|
|
5665
|
+
), q = i(
|
|
5649
5666
|
async (a, n, u) => {
|
|
5650
5667
|
const e = await m();
|
|
5651
5668
|
return new Promise((c, s) => {
|
|
@@ -5657,7 +5674,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5657
5674
|
});
|
|
5658
5675
|
},
|
|
5659
5676
|
[m]
|
|
5660
|
-
), H =
|
|
5677
|
+
), H = i(
|
|
5661
5678
|
async (a, n, u) => {
|
|
5662
5679
|
const e = await m();
|
|
5663
5680
|
return new Promise((c, s) => {
|
|
@@ -5669,7 +5686,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5669
5686
|
});
|
|
5670
5687
|
},
|
|
5671
5688
|
[m]
|
|
5672
|
-
), z =
|
|
5689
|
+
), z = i(
|
|
5673
5690
|
async (a, n) => {
|
|
5674
5691
|
const u = await m();
|
|
5675
5692
|
return new Promise((e, c) => {
|
|
@@ -5681,7 +5698,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5681
5698
|
});
|
|
5682
5699
|
},
|
|
5683
5700
|
[m]
|
|
5684
|
-
), X =
|
|
5701
|
+
), X = i(
|
|
5685
5702
|
async (a) => {
|
|
5686
5703
|
const n = await m();
|
|
5687
5704
|
return new Promise((u, e) => {
|
|
@@ -5693,7 +5710,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5693
5710
|
});
|
|
5694
5711
|
},
|
|
5695
5712
|
[m]
|
|
5696
|
-
), R =
|
|
5713
|
+
), R = i(
|
|
5697
5714
|
async (a, n) => {
|
|
5698
5715
|
const u = await m();
|
|
5699
5716
|
return new Promise((e, c) => {
|
|
@@ -5705,7 +5722,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5705
5722
|
});
|
|
5706
5723
|
},
|
|
5707
5724
|
[m]
|
|
5708
|
-
), G =
|
|
5725
|
+
), G = i(
|
|
5709
5726
|
async (a, n) => {
|
|
5710
5727
|
const u = await m(), e = [];
|
|
5711
5728
|
return new Promise((c, s) => {
|
|
@@ -5732,7 +5749,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5732
5749
|
});
|
|
5733
5750
|
},
|
|
5734
5751
|
[m]
|
|
5735
|
-
), M =
|
|
5752
|
+
), M = i(
|
|
5736
5753
|
async (a, n) => {
|
|
5737
5754
|
const e = (await m()).transaction(a.stores, a.mode || "readwrite");
|
|
5738
5755
|
return new Promise((c, s) => {
|
|
@@ -5745,7 +5762,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5745
5762
|
});
|
|
5746
5763
|
},
|
|
5747
5764
|
[m]
|
|
5748
|
-
), F =
|
|
5765
|
+
), F = i(
|
|
5749
5766
|
async (a, n) => {
|
|
5750
5767
|
const u = await m(), e = [];
|
|
5751
5768
|
return new Promise((c, s) => {
|
|
@@ -5761,7 +5778,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5761
5778
|
});
|
|
5762
5779
|
},
|
|
5763
5780
|
[m]
|
|
5764
|
-
), A =
|
|
5781
|
+
), A = i(
|
|
5765
5782
|
async (a, n) => {
|
|
5766
5783
|
const u = await m(), e = [];
|
|
5767
5784
|
return new Promise((c, s) => {
|
|
@@ -5777,7 +5794,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5777
5794
|
});
|
|
5778
5795
|
},
|
|
5779
5796
|
[m]
|
|
5780
|
-
), C =
|
|
5797
|
+
), C = i(
|
|
5781
5798
|
async (a, n) => {
|
|
5782
5799
|
const u = await m();
|
|
5783
5800
|
return new Promise((e, c) => {
|
|
@@ -5791,7 +5808,7 @@ const Dn = /* @__PURE__ */ Object.assign(
|
|
|
5791
5808
|
});
|
|
5792
5809
|
},
|
|
5793
5810
|
[m]
|
|
5794
|
-
), O =
|
|
5811
|
+
), O = i(async () => {
|
|
5795
5812
|
const a = await m(), n = [];
|
|
5796
5813
|
for (const u of a.objectStoreNames) {
|
|
5797
5814
|
const c = a.transaction(u, "readonly").objectStore(u);
|
|
@@ -5893,7 +5910,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5893
5910
|
retryDelay: 5e3
|
|
5894
5911
|
}, On = () => `draft-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Tn = /* @__PURE__ */ Object.assign(
|
|
5895
5912
|
/* @__PURE__ */ ce((t, g) => {
|
|
5896
|
-
const { t:
|
|
5913
|
+
const { t: o } = ue(), {
|
|
5897
5914
|
config: b,
|
|
5898
5915
|
submitHandlers: x = {},
|
|
5899
5916
|
onDraftSaved: S,
|
|
@@ -5907,7 +5924,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5907
5924
|
draftCounts: {},
|
|
5908
5925
|
pendingCount: 0,
|
|
5909
5926
|
failedCount: 0
|
|
5910
|
-
}), I =
|
|
5927
|
+
}), I = i(async () => y.current ? y.current : new Promise((n, u) => {
|
|
5911
5928
|
const e = indexedDB.open(r.dbName, 1);
|
|
5912
5929
|
e.onerror = () => u(e.error), e.onupgradeneeded = () => {
|
|
5913
5930
|
const c = e.result;
|
|
@@ -5918,7 +5935,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5918
5935
|
}, e.onsuccess = () => {
|
|
5919
5936
|
y.current = e.result, n(e.result);
|
|
5920
5937
|
};
|
|
5921
|
-
}), [r.dbName]), B =
|
|
5938
|
+
}), [r.dbName]), B = i(async () => {
|
|
5922
5939
|
try {
|
|
5923
5940
|
const c = (await I()).transaction("drafts", "readonly").objectStore("drafts").getAll();
|
|
5924
5941
|
c.onsuccess = () => {
|
|
@@ -5935,7 +5952,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5935
5952
|
};
|
|
5936
5953
|
} catch {
|
|
5937
5954
|
}
|
|
5938
|
-
}, [I]), $ =
|
|
5955
|
+
}, [I]), $ = i(
|
|
5939
5956
|
async (n, u, e) => {
|
|
5940
5957
|
const c = await I(), s = {
|
|
5941
5958
|
id: On(),
|
|
@@ -5957,7 +5974,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5957
5974
|
});
|
|
5958
5975
|
},
|
|
5959
5976
|
[I, S, B]
|
|
5960
|
-
), q =
|
|
5977
|
+
), q = i(
|
|
5961
5978
|
async (n) => {
|
|
5962
5979
|
const u = await I();
|
|
5963
5980
|
return new Promise((e, c) => {
|
|
@@ -5969,7 +5986,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5969
5986
|
});
|
|
5970
5987
|
},
|
|
5971
5988
|
[I]
|
|
5972
|
-
), H =
|
|
5989
|
+
), H = i(
|
|
5973
5990
|
async (n) => {
|
|
5974
5991
|
const u = await I();
|
|
5975
5992
|
return new Promise((e, c) => {
|
|
@@ -5986,7 +6003,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
5986
6003
|
});
|
|
5987
6004
|
},
|
|
5988
6005
|
[I]
|
|
5989
|
-
), z =
|
|
6006
|
+
), z = i(async () => {
|
|
5990
6007
|
const n = await I();
|
|
5991
6008
|
return new Promise((u, e) => {
|
|
5992
6009
|
const h = n.transaction("drafts", "readonly").objectStore("drafts").getAll();
|
|
@@ -6000,7 +6017,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6000
6017
|
u(w);
|
|
6001
6018
|
};
|
|
6002
6019
|
});
|
|
6003
|
-
}, [I]), X =
|
|
6020
|
+
}, [I]), X = i(
|
|
6004
6021
|
async (n, u) => {
|
|
6005
6022
|
const e = await q(n);
|
|
6006
6023
|
if (!e)
|
|
@@ -6019,7 +6036,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6019
6036
|
});
|
|
6020
6037
|
},
|
|
6021
6038
|
[I, q, S]
|
|
6022
|
-
), R =
|
|
6039
|
+
), R = i(
|
|
6023
6040
|
async (n, u, e) => {
|
|
6024
6041
|
const c = await q(n);
|
|
6025
6042
|
if (!c)
|
|
@@ -6039,7 +6056,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6039
6056
|
});
|
|
6040
6057
|
},
|
|
6041
6058
|
[I, q, B]
|
|
6042
|
-
), G =
|
|
6059
|
+
), G = i(
|
|
6043
6060
|
async (n) => {
|
|
6044
6061
|
const u = await I();
|
|
6045
6062
|
return new Promise((e, c) => {
|
|
@@ -6050,7 +6067,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6050
6067
|
});
|
|
6051
6068
|
},
|
|
6052
6069
|
[I, B]
|
|
6053
|
-
), M =
|
|
6070
|
+
), M = i(
|
|
6054
6071
|
async (n) => {
|
|
6055
6072
|
const u = await H(n), e = await I();
|
|
6056
6073
|
return new Promise((c, s) => {
|
|
@@ -6063,7 +6080,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6063
6080
|
});
|
|
6064
6081
|
},
|
|
6065
6082
|
[I, H, B]
|
|
6066
|
-
), F =
|
|
6083
|
+
), F = i(
|
|
6067
6084
|
async (n) => {
|
|
6068
6085
|
const u = await q(n);
|
|
6069
6086
|
if (!u)
|
|
@@ -6079,7 +6096,7 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6079
6096
|
try {
|
|
6080
6097
|
await e(u.data, u), await R(n, "synced"), L == null || L(u), await G(n);
|
|
6081
6098
|
} catch (c) {
|
|
6082
|
-
const s = c instanceof Error ? c.message :
|
|
6099
|
+
const s = c instanceof Error ? c.message : o("offlineForms.submissionFailed", "Submission failed");
|
|
6083
6100
|
await R(n, "failed", s), Y == null || Y(u, c instanceof Error ? c : new Error(s));
|
|
6084
6101
|
} finally {
|
|
6085
6102
|
m((c) => ({ ...c, isSyncing: !1 }));
|
|
@@ -6092,15 +6109,15 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6092
6109
|
G,
|
|
6093
6110
|
L,
|
|
6094
6111
|
Y,
|
|
6095
|
-
|
|
6112
|
+
o
|
|
6096
6113
|
]
|
|
6097
|
-
), A =
|
|
6114
|
+
), A = i(
|
|
6098
6115
|
async (n, u) => {
|
|
6099
6116
|
const e = await $(n, u);
|
|
6100
6117
|
await R(e, "pending"), await F(e);
|
|
6101
6118
|
},
|
|
6102
6119
|
[$, R, F]
|
|
6103
|
-
), C =
|
|
6120
|
+
), C = i(async () => {
|
|
6104
6121
|
const n = await z(), u = { synced: 0, failed: 0 };
|
|
6105
6122
|
m((e) => ({ ...e, isSyncing: !0 }));
|
|
6106
6123
|
for (const e of n)
|
|
@@ -6111,12 +6128,12 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6111
6128
|
u.failed++;
|
|
6112
6129
|
}
|
|
6113
6130
|
return m((e) => ({ ...e, isSyncing: !1, lastSyncAt: /* @__PURE__ */ new Date() })), _ == null || _(u), u;
|
|
6114
|
-
}, [z, F, r.maxRetryAttempts, _]), O =
|
|
6131
|
+
}, [z, F, r.maxRetryAttempts, _]), O = i(async () => {
|
|
6115
6132
|
const u = (await z()).filter((e) => e.status === "failed");
|
|
6116
6133
|
for (const e of u)
|
|
6117
6134
|
e.attempts < r.maxRetryAttempts && await R(e.id, "pending");
|
|
6118
6135
|
await C();
|
|
6119
|
-
}, [z, r.maxRetryAttempts, R, C]), W =
|
|
6136
|
+
}, [z, r.maxRetryAttempts, R, C]), W = i(
|
|
6120
6137
|
(n, u) => {
|
|
6121
6138
|
E.current[n] = u;
|
|
6122
6139
|
},
|
|
@@ -6188,15 +6205,15 @@ const Ze = /* @__PURE__ */ me(null), En = () => {
|
|
|
6188
6205
|
process.env.NODE_ENV !== "production" && (Rn.displayName = "NiceOfflineFormsProvider");
|
|
6189
6206
|
function pr(t) {
|
|
6190
6207
|
const { t: g } = ue(), {
|
|
6191
|
-
formId:
|
|
6208
|
+
formId: o,
|
|
6192
6209
|
initialData: b = {},
|
|
6193
6210
|
autoSave: x = !0,
|
|
6194
6211
|
autoSaveInterval: S = 5e3,
|
|
6195
6212
|
onSubmit: L
|
|
6196
6213
|
} = t, Y = En(), [_, D] = ee(b), [r, y] = ee(), [E, f] = ee(!1), [m, I] = ee();
|
|
6197
6214
|
ne(() => {
|
|
6198
|
-
Y.registerHandler(
|
|
6199
|
-
}, [Y,
|
|
6215
|
+
Y.registerHandler(o, L);
|
|
6216
|
+
}, [Y, o, L]), ne(() => {
|
|
6200
6217
|
if (!x)
|
|
6201
6218
|
return;
|
|
6202
6219
|
const z = setInterval(async () => {
|
|
@@ -6204,13 +6221,13 @@ function pr(t) {
|
|
|
6204
6221
|
if (r)
|
|
6205
6222
|
await Y.updateDraft(r, _);
|
|
6206
6223
|
else {
|
|
6207
|
-
const X = await Y.saveDraft(
|
|
6224
|
+
const X = await Y.saveDraft(o, _);
|
|
6208
6225
|
y(X);
|
|
6209
6226
|
}
|
|
6210
6227
|
}, S);
|
|
6211
6228
|
return () => clearInterval(z);
|
|
6212
|
-
}, [x, S, _, r,
|
|
6213
|
-
const B =
|
|
6229
|
+
}, [x, S, _, r, o, Y]);
|
|
6230
|
+
const B = i(
|
|
6214
6231
|
(z) => {
|
|
6215
6232
|
const { name: X, value: R, type: G } = z.target;
|
|
6216
6233
|
D((M) => ({
|
|
@@ -6219,11 +6236,11 @@ function pr(t) {
|
|
|
6219
6236
|
}));
|
|
6220
6237
|
},
|
|
6221
6238
|
[]
|
|
6222
|
-
), $ =
|
|
6239
|
+
), $ = i(
|
|
6223
6240
|
async (z) => {
|
|
6224
6241
|
z == null || z.preventDefault(), f(!0), I(void 0);
|
|
6225
6242
|
try {
|
|
6226
|
-
await Y.submitForm(
|
|
6243
|
+
await Y.submitForm(o, _), D(b), y(void 0);
|
|
6227
6244
|
} catch (X) {
|
|
6228
6245
|
I(
|
|
6229
6246
|
X instanceof Error ? X.message : g("offlineForms.submissionFailed", "Submission failed")
|
|
@@ -6232,10 +6249,10 @@ function pr(t) {
|
|
|
6232
6249
|
f(!1);
|
|
6233
6250
|
}
|
|
6234
6251
|
},
|
|
6235
|
-
[Y,
|
|
6236
|
-
), q =
|
|
6252
|
+
[Y, o, _, b, g]
|
|
6253
|
+
), q = i(() => {
|
|
6237
6254
|
D(b), I(void 0), r && (Y.deleteDraft(r), y(void 0));
|
|
6238
|
-
}, [b, r, Y]), H =
|
|
6255
|
+
}, [b, r, Y]), H = i(
|
|
6239
6256
|
async (z) => {
|
|
6240
6257
|
const X = await Y.getDraft(z);
|
|
6241
6258
|
X && (D(X.data), y(z));
|
|
@@ -6283,7 +6300,7 @@ const Ce = () => {
|
|
|
6283
6300
|
}
|
|
6284
6301
|
}, yr = /* @__PURE__ */ Object.assign(
|
|
6285
6302
|
/* @__PURE__ */ ce((t, g) => {
|
|
6286
|
-
const { t:
|
|
6303
|
+
const { t: o } = ue(), {
|
|
6287
6304
|
mode: b = "banner",
|
|
6288
6305
|
position: x = "top",
|
|
6289
6306
|
showWhenOnline: S = !1,
|
|
@@ -6292,10 +6309,10 @@ const Ce = () => {
|
|
|
6292
6309
|
slowConnectionThreshold: _ = 1,
|
|
6293
6310
|
showReconnecting: D = !0,
|
|
6294
6311
|
reconnectCheckInterval: r = 5e3,
|
|
6295
|
-
offlineMessage: y =
|
|
6296
|
-
onlineMessage: E =
|
|
6297
|
-
slowConnectionMessage: f =
|
|
6298
|
-
reconnectingMessage: m =
|
|
6312
|
+
offlineMessage: y = o("offlineIndicator.youreOffline", "You're offline"),
|
|
6313
|
+
onlineMessage: E = o("offlineIndicator.backOnline", "Back online"),
|
|
6314
|
+
slowConnectionMessage: f = o("offlineIndicator.slowConnection", "Slow connection"),
|
|
6315
|
+
reconnectingMessage: m = o("offlineIndicator.reconnecting", "Reconnecting..."),
|
|
6299
6316
|
showDetails: I = !1,
|
|
6300
6317
|
animated: B = !0,
|
|
6301
6318
|
pulseWhenOffline: $ = !0,
|
|
@@ -6314,7 +6331,7 @@ const Ce = () => {
|
|
|
6314
6331
|
...Q,
|
|
6315
6332
|
quality: xe(Q)
|
|
6316
6333
|
};
|
|
6317
|
-
}), [O, W] = ee(!A.isOnline || S), [a, n] = ee(!1), [u, e] = ee(null), c =
|
|
6334
|
+
}), [O, W] = ee(!A.isOnline || S), [a, n] = ee(!1), [u, e] = ee(null), c = i(() => {
|
|
6318
6335
|
const Q = Ce(), ae = navigator.onLine;
|
|
6319
6336
|
C((te) => {
|
|
6320
6337
|
const U = {
|
|
@@ -6326,7 +6343,7 @@ const Ce = () => {
|
|
|
6326
6343
|
};
|
|
6327
6344
|
return (te.isOnline !== U.isOnline || te.quality !== U.quality) && (R == null || R(U)), U;
|
|
6328
6345
|
});
|
|
6329
|
-
}, [u, R]), s =
|
|
6346
|
+
}, [u, R]), s = i(async () => {
|
|
6330
6347
|
try {
|
|
6331
6348
|
return (await fetch("/favicon.ico", {
|
|
6332
6349
|
method: "HEAD",
|
|
@@ -6425,12 +6442,12 @@ const Ce = () => {
|
|
|
6425
6442
|
if (X)
|
|
6426
6443
|
return /* @__PURE__ */ d("div", { className: K, style: F, children: X(A) });
|
|
6427
6444
|
const k = () => /* @__PURE__ */ d("span", { className: "nice-offline-indicator__icon", children: p() }), P = () => /* @__PURE__ */ d("span", { className: "nice-offline-indicator__message", children: N() }), j = () => I ? /* @__PURE__ */ J("div", { className: "nice-offline-indicator__details", children: [
|
|
6428
|
-
A.offlineDuration !== void 0 && /* @__PURE__ */ d("span", { className: "nice-offline-indicator__duration", children:
|
|
6445
|
+
A.offlineDuration !== void 0 && /* @__PURE__ */ d("span", { className: "nice-offline-indicator__duration", children: o("offlineIndicator.offlineFor", "Offline for {offlineDuration}").replace(
|
|
6429
6446
|
"{offlineDuration}",
|
|
6430
6447
|
String(T(A.offlineDuration))
|
|
6431
6448
|
) }),
|
|
6432
6449
|
A.effectiveType && /* @__PURE__ */ d("span", { className: "nice-offline-indicator__type", children: A.effectiveType.toUpperCase() }),
|
|
6433
|
-
A.downlink !== void 0 && /* @__PURE__ */ d("span", { className: "nice-offline-indicator__speed", children:
|
|
6450
|
+
A.downlink !== void 0 && /* @__PURE__ */ d("span", { className: "nice-offline-indicator__speed", children: o("offlineIndicator.mbps", "{downlink} Mbps").replace(
|
|
6434
6451
|
"{downlink}",
|
|
6435
6452
|
String(A.downlink.toFixed(1))
|
|
6436
6453
|
) }),
|
|
@@ -6494,15 +6511,15 @@ const Ce = () => {
|
|
|
6494
6511
|
);
|
|
6495
6512
|
function vr() {
|
|
6496
6513
|
const [t, g] = ee(() => {
|
|
6497
|
-
const
|
|
6514
|
+
const o = Ce();
|
|
6498
6515
|
return {
|
|
6499
6516
|
isOnline: typeof navigator < "u" ? navigator.onLine : !0,
|
|
6500
|
-
...
|
|
6501
|
-
quality: xe(
|
|
6517
|
+
...o,
|
|
6518
|
+
quality: xe(o)
|
|
6502
6519
|
};
|
|
6503
6520
|
});
|
|
6504
6521
|
return ne(() => {
|
|
6505
|
-
const
|
|
6522
|
+
const o = () => {
|
|
6506
6523
|
const x = Ce();
|
|
6507
6524
|
g((S) => ({
|
|
6508
6525
|
...S,
|
|
@@ -6512,10 +6529,10 @@ function vr() {
|
|
|
6512
6529
|
lastOnlineAt: navigator.onLine ? /* @__PURE__ */ new Date() : S.lastOnlineAt
|
|
6513
6530
|
}));
|
|
6514
6531
|
};
|
|
6515
|
-
window.addEventListener("online",
|
|
6532
|
+
window.addEventListener("online", o), window.addEventListener("offline", o);
|
|
6516
6533
|
const b = navigator;
|
|
6517
|
-
return b.connection && b.connection.addEventListener("change",
|
|
6518
|
-
window.removeEventListener("online",
|
|
6534
|
+
return b.connection && b.connection.addEventListener("change", o), () => {
|
|
6535
|
+
window.removeEventListener("online", o), window.removeEventListener("offline", o), b.connection && b.connection.removeEventListener("change", o);
|
|
6519
6536
|
};
|
|
6520
6537
|
}, []), t;
|
|
6521
6538
|
}
|
|
@@ -6537,8 +6554,8 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6537
6554
|
// 1 hour
|
|
6538
6555
|
}, Bn = () => `media-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, $n = (t, g) => {
|
|
6539
6556
|
var x;
|
|
6540
|
-
const
|
|
6541
|
-
return b.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(
|
|
6557
|
+
const o = ((x = t.split(".").pop()) == null ? void 0 : x.toLowerCase()) || "", b = (g == null ? void 0 : g.toLowerCase()) || "";
|
|
6558
|
+
return b.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(o) ? "image" : b.startsWith("video/") || ["mp4", "webm", "ogg", "mov", "avi"].includes(o) ? "video" : b.startsWith("audio/") || ["mp3", "wav", "ogg", "flac", "m4a"].includes(o) ? "audio" : ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(o) ? "document" : "other";
|
|
6542
6559
|
}, qn = (t) => {
|
|
6543
6560
|
try {
|
|
6544
6561
|
return new URL(t).pathname.split("/").pop() || "unknown";
|
|
@@ -6548,21 +6565,21 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6548
6565
|
}, jn = /* @__PURE__ */ Object.assign(
|
|
6549
6566
|
/* @__PURE__ */ ce((t, g) => {
|
|
6550
6567
|
const {
|
|
6551
|
-
config:
|
|
6568
|
+
config: o,
|
|
6552
6569
|
onDownloadStart: b,
|
|
6553
6570
|
onDownloadProgress: x,
|
|
6554
6571
|
onDownloadComplete: S,
|
|
6555
6572
|
onDownloadFailed: L,
|
|
6556
6573
|
onMediaRemoved: Y,
|
|
6557
6574
|
children: _
|
|
6558
|
-
} = t, D = { ...Fn, ...
|
|
6575
|
+
} = t, D = { ...Fn, ...o }, r = re(null), y = re(/* @__PURE__ */ new Map()), E = re(/* @__PURE__ */ new Map()), [f, m] = ee({
|
|
6559
6576
|
isOnline: typeof navigator < "u" ? navigator.onLine : !0,
|
|
6560
6577
|
activeDownloads: 0,
|
|
6561
6578
|
queuedDownloads: 0,
|
|
6562
6579
|
cachedCount: 0,
|
|
6563
6580
|
totalCacheSize: 0,
|
|
6564
6581
|
isDownloading: !1
|
|
6565
|
-
}), I =
|
|
6582
|
+
}), I = i(async () => r.current ? r.current : new Promise((l, p) => {
|
|
6566
6583
|
const T = indexedDB.open(D.dbName, 1);
|
|
6567
6584
|
T.onerror = () => p(T.error), T.onupgradeneeded = () => {
|
|
6568
6585
|
const K = T.result;
|
|
@@ -6574,7 +6591,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6574
6591
|
}, T.onsuccess = () => {
|
|
6575
6592
|
r.current = T.result, l(T.result);
|
|
6576
6593
|
};
|
|
6577
|
-
}), [D.dbName]), B =
|
|
6594
|
+
}), [D.dbName]), B = i(
|
|
6578
6595
|
async (l) => {
|
|
6579
6596
|
const p = await I();
|
|
6580
6597
|
return new Promise((T, K) => {
|
|
@@ -6583,7 +6600,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6583
6600
|
});
|
|
6584
6601
|
},
|
|
6585
6602
|
[I]
|
|
6586
|
-
), $ =
|
|
6603
|
+
), $ = i(
|
|
6587
6604
|
async (l, p) => {
|
|
6588
6605
|
const T = await I();
|
|
6589
6606
|
return new Promise((K, k) => {
|
|
@@ -6592,7 +6609,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6592
6609
|
});
|
|
6593
6610
|
},
|
|
6594
6611
|
[I]
|
|
6595
|
-
), q =
|
|
6612
|
+
), q = i(
|
|
6596
6613
|
async (l) => {
|
|
6597
6614
|
const p = await I();
|
|
6598
6615
|
return new Promise((T, K) => {
|
|
@@ -6604,7 +6621,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6604
6621
|
});
|
|
6605
6622
|
},
|
|
6606
6623
|
[I]
|
|
6607
|
-
), H =
|
|
6624
|
+
), H = i(
|
|
6608
6625
|
async (l) => {
|
|
6609
6626
|
const p = await I();
|
|
6610
6627
|
return new Promise((T, K) => {
|
|
@@ -6616,7 +6633,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6616
6633
|
});
|
|
6617
6634
|
},
|
|
6618
6635
|
[I]
|
|
6619
|
-
), z =
|
|
6636
|
+
), z = i(async () => {
|
|
6620
6637
|
const l = await I();
|
|
6621
6638
|
return new Promise((p, T) => {
|
|
6622
6639
|
const P = l.transaction("media", "readonly").objectStore("media").getAll();
|
|
@@ -6630,7 +6647,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6630
6647
|
);
|
|
6631
6648
|
};
|
|
6632
6649
|
});
|
|
6633
|
-
}, [I]), X =
|
|
6650
|
+
}, [I]), X = i(
|
|
6634
6651
|
async (l) => {
|
|
6635
6652
|
const p = await I();
|
|
6636
6653
|
return new Promise((T, K) => {
|
|
@@ -6639,13 +6656,13 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6639
6656
|
});
|
|
6640
6657
|
},
|
|
6641
6658
|
[I]
|
|
6642
|
-
), R =
|
|
6659
|
+
), R = i(
|
|
6643
6660
|
async (l) => (await z()).filter((T) => {
|
|
6644
6661
|
var K;
|
|
6645
6662
|
return (K = T.tags) == null ? void 0 : K.includes(l);
|
|
6646
6663
|
}),
|
|
6647
6664
|
[z]
|
|
6648
|
-
), G =
|
|
6665
|
+
), G = i(
|
|
6649
6666
|
async (l) => {
|
|
6650
6667
|
const p = await I();
|
|
6651
6668
|
return new Promise((T, K) => {
|
|
@@ -6654,13 +6671,13 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6654
6671
|
});
|
|
6655
6672
|
},
|
|
6656
6673
|
[I]
|
|
6657
|
-
), M =
|
|
6674
|
+
), M = i(
|
|
6658
6675
|
async (l) => {
|
|
6659
6676
|
const p = await G(l);
|
|
6660
6677
|
return (p == null ? void 0 : p.status) === "completed";
|
|
6661
6678
|
},
|
|
6662
6679
|
[G]
|
|
6663
|
-
), F =
|
|
6680
|
+
), F = i(
|
|
6664
6681
|
async (l) => {
|
|
6665
6682
|
const p = E.current.get(l);
|
|
6666
6683
|
if (p)
|
|
@@ -6672,7 +6689,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6672
6689
|
return E.current.set(l, K), K;
|
|
6673
6690
|
},
|
|
6674
6691
|
[q]
|
|
6675
|
-
), A =
|
|
6692
|
+
), A = i(async () => {
|
|
6676
6693
|
const p = (await z()).filter((k) => k.status === "completed"), T = {
|
|
6677
6694
|
image: { count: 0, size: 0 },
|
|
6678
6695
|
video: { count: 0, size: 0 },
|
|
@@ -6688,14 +6705,14 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6688
6705
|
itemCount: p.length,
|
|
6689
6706
|
byType: T
|
|
6690
6707
|
};
|
|
6691
|
-
}, [z]), C =
|
|
6708
|
+
}, [z]), C = i(async () => {
|
|
6692
6709
|
const l = await A();
|
|
6693
6710
|
m((p) => ({
|
|
6694
6711
|
...p,
|
|
6695
6712
|
cachedCount: l.itemCount,
|
|
6696
6713
|
totalCacheSize: l.totalSize
|
|
6697
6714
|
}));
|
|
6698
|
-
}, [A]), O =
|
|
6715
|
+
}, [A]), O = i(
|
|
6699
6716
|
async (l, p) => {
|
|
6700
6717
|
var j;
|
|
6701
6718
|
const T = await G(l);
|
|
@@ -6721,10 +6738,10 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6721
6738
|
isDownloading: !0
|
|
6722
6739
|
}));
|
|
6723
6740
|
try {
|
|
6724
|
-
P.status = "downloading", await B(P), m((
|
|
6725
|
-
...
|
|
6726
|
-
activeDownloads:
|
|
6727
|
-
queuedDownloads:
|
|
6741
|
+
P.status = "downloading", await B(P), m((ie) => ({
|
|
6742
|
+
...ie,
|
|
6743
|
+
activeDownloads: ie.activeDownloads + 1,
|
|
6744
|
+
queuedDownloads: ie.queuedDownloads - 1
|
|
6728
6745
|
}));
|
|
6729
6746
|
const V = await fetch(l, {
|
|
6730
6747
|
signal: K.signal,
|
|
@@ -6740,13 +6757,13 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6740
6757
|
const Z = [];
|
|
6741
6758
|
let se = 0;
|
|
6742
6759
|
for (; ; ) {
|
|
6743
|
-
const { done:
|
|
6744
|
-
if (
|
|
6760
|
+
const { done: ie, value: de } = await U.read();
|
|
6761
|
+
if (ie)
|
|
6745
6762
|
break;
|
|
6746
6763
|
Z.push(de), se += de.length, P.downloadedBytes = se, P.progress = te > 0 ? Math.round(se / te * 100) : 0, await B(P), x == null || x(P);
|
|
6747
6764
|
}
|
|
6748
|
-
const
|
|
6749
|
-
return await $(k,
|
|
6765
|
+
const oe = new Blob(Z, { type: ae });
|
|
6766
|
+
return await $(k, oe), P.status = "completed", P.progress = 100, P.size = oe.size, P.cachedAt = /* @__PURE__ */ new Date(), P.expiresAt = p != null && p.cacheDuration ? new Date(Date.now() + p.cacheDuration) : new Date(Date.now() + D.defaultCacheDuration), await B(P), S == null || S(P), k;
|
|
6750
6767
|
} catch (V) {
|
|
6751
6768
|
throw V.name === "AbortError" ? P.status = "cancelled" : (P.status = "failed", P.error = V instanceof Error ? V.message : "Download failed", L == null || L(P, V instanceof Error ? V : new Error(String(V)))), await B(P), V;
|
|
6752
6769
|
} finally {
|
|
@@ -6768,7 +6785,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6768
6785
|
L,
|
|
6769
6786
|
C
|
|
6770
6787
|
]
|
|
6771
|
-
), W =
|
|
6788
|
+
), W = i(
|
|
6772
6789
|
async (l) => {
|
|
6773
6790
|
const p = [];
|
|
6774
6791
|
for (let T = 0; T < l.length; T += D.maxConcurrentDownloads) {
|
|
@@ -6781,10 +6798,10 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6781
6798
|
return p;
|
|
6782
6799
|
},
|
|
6783
6800
|
[O, D.maxConcurrentDownloads]
|
|
6784
|
-
), a =
|
|
6801
|
+
), a = i((l) => {
|
|
6785
6802
|
const p = y.current.get(l);
|
|
6786
6803
|
p && p.abort();
|
|
6787
|
-
}, []), n =
|
|
6804
|
+
}, []), n = i(
|
|
6788
6805
|
async (l) => {
|
|
6789
6806
|
const p = await H(l);
|
|
6790
6807
|
p && (p.status === "paused" || p.status === "failed") && await O(p.url, {
|
|
@@ -6795,18 +6812,18 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6795
6812
|
});
|
|
6796
6813
|
},
|
|
6797
6814
|
[H, O]
|
|
6798
|
-
), u =
|
|
6815
|
+
), u = i(
|
|
6799
6816
|
(l) => {
|
|
6800
6817
|
a(l);
|
|
6801
6818
|
},
|
|
6802
6819
|
[a]
|
|
6803
|
-
), e =
|
|
6820
|
+
), e = i(() => {
|
|
6804
6821
|
for (const [l] of y.current)
|
|
6805
6822
|
a(l);
|
|
6806
|
-
}, [a]), c =
|
|
6823
|
+
}, [a]), c = i(async () => {
|
|
6807
6824
|
const p = (await z()).filter((T) => T.status === "paused" || T.status === "failed");
|
|
6808
6825
|
await W(p.map((T) => ({ url: T.url })));
|
|
6809
|
-
}, [z, W]), s =
|
|
6826
|
+
}, [z, W]), s = i(
|
|
6810
6827
|
async (l) => {
|
|
6811
6828
|
const p = await I(), T = E.current.get(l);
|
|
6812
6829
|
T && (URL.revokeObjectURL(T), E.current.delete(l)), await new Promise((K, k) => {
|
|
@@ -6815,7 +6832,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6815
6832
|
}), Y == null || Y(l), await C();
|
|
6816
6833
|
},
|
|
6817
6834
|
[I, Y, C]
|
|
6818
|
-
), h =
|
|
6835
|
+
), h = i(async () => {
|
|
6819
6836
|
const l = await I();
|
|
6820
6837
|
for (const [, p] of E.current)
|
|
6821
6838
|
URL.revokeObjectURL(p);
|
|
@@ -6823,13 +6840,13 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6823
6840
|
const K = l.transaction(["media", "blobs"], "readwrite");
|
|
6824
6841
|
K.objectStore("media").clear(), K.objectStore("blobs").clear(), K.onerror = () => T(K.error), K.oncomplete = () => p();
|
|
6825
6842
|
}), await C();
|
|
6826
|
-
}, [I, C]), w =
|
|
6843
|
+
}, [I, C]), w = i(async () => {
|
|
6827
6844
|
const l = await z(), p = Date.now();
|
|
6828
6845
|
let T = 0;
|
|
6829
6846
|
for (const K of l)
|
|
6830
6847
|
K.expiresAt && K.expiresAt.getTime() < p && (await s(K.id), T++);
|
|
6831
6848
|
return T;
|
|
6832
|
-
}, [z, s]), v =
|
|
6849
|
+
}, [z, s]), v = i(
|
|
6833
6850
|
async (l) => {
|
|
6834
6851
|
await W(l.map((p) => ({ url: p, options: { priority: -1 } })));
|
|
6835
6852
|
},
|
|
@@ -6926,7 +6943,7 @@ const et = /* @__PURE__ */ me(null), Mn = () => {
|
|
|
6926
6943
|
), Un = jn;
|
|
6927
6944
|
process.env.NODE_ENV !== "production" && (Un.displayName = "NiceOfflineMediaProvider");
|
|
6928
6945
|
function wr(t) {
|
|
6929
|
-
const g = Mn(), [
|
|
6946
|
+
const g = Mn(), [o, b] = ee(), [x, S] = ee(), [L, Y] = ee(!1);
|
|
6930
6947
|
return ne(() => {
|
|
6931
6948
|
t && (Y(!0), Promise.all([g.getCachedMedia(t), g.getBlobUrl(t)]).then(([_, D]) => {
|
|
6932
6949
|
b(_), S(D);
|
|
@@ -6934,7 +6951,7 @@ function wr(t) {
|
|
|
6934
6951
|
Y(!1);
|
|
6935
6952
|
}));
|
|
6936
6953
|
}, [t, g]), {
|
|
6937
|
-
item:
|
|
6954
|
+
item: o,
|
|
6938
6955
|
blobUrl: x,
|
|
6939
6956
|
isLoading: L,
|
|
6940
6957
|
isOnline: g.isOnline
|
|
@@ -6955,7 +6972,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
6955
6972
|
reloadOnActivation: !0
|
|
6956
6973
|
}, Wn = /* @__PURE__ */ Object.assign(
|
|
6957
6974
|
/* @__PURE__ */ ce((t, g) => {
|
|
6958
|
-
const { t:
|
|
6975
|
+
const { t: o } = ue(), {
|
|
6959
6976
|
config: b,
|
|
6960
6977
|
showUpdateNotification: x = !0,
|
|
6961
6978
|
showOfflineIndicator: S = !0,
|
|
@@ -7002,7 +7019,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7002
7019
|
window.removeEventListener("online", k), window.removeEventListener("offline", P);
|
|
7003
7020
|
};
|
|
7004
7021
|
}, [m]);
|
|
7005
|
-
const a =
|
|
7022
|
+
const a = i(async () => {
|
|
7006
7023
|
if (!("caches" in window))
|
|
7007
7024
|
return [];
|
|
7008
7025
|
const k = await caches.keys(), P = [];
|
|
@@ -7023,7 +7040,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7023
7040
|
});
|
|
7024
7041
|
}
|
|
7025
7042
|
return C((j) => ({ ...j, caches: P })), P;
|
|
7026
|
-
}, []), n =
|
|
7043
|
+
}, []), n = i(
|
|
7027
7044
|
async (k) => {
|
|
7028
7045
|
if (!("caches" in window))
|
|
7029
7046
|
return !1;
|
|
@@ -7031,19 +7048,19 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7031
7048
|
return await a(), P;
|
|
7032
7049
|
},
|
|
7033
7050
|
[a]
|
|
7034
|
-
), u =
|
|
7051
|
+
), u = i(async () => {
|
|
7035
7052
|
if (!("caches" in window))
|
|
7036
7053
|
return;
|
|
7037
7054
|
const k = await caches.keys();
|
|
7038
7055
|
await Promise.all(k.map((P) => caches.delete(P))), C((P) => ({ ...P, caches: [], cachedUrls: [] }));
|
|
7039
|
-
}, []), e =
|
|
7056
|
+
}, []), e = i(
|
|
7040
7057
|
async (k, P) => {
|
|
7041
7058
|
if (!("caches" in window))
|
|
7042
7059
|
return;
|
|
7043
7060
|
await (await caches.open(k)).addAll(P), await a();
|
|
7044
7061
|
},
|
|
7045
7062
|
[a]
|
|
7046
|
-
), c =
|
|
7063
|
+
), c = i(
|
|
7047
7064
|
async (k, P) => {
|
|
7048
7065
|
if (!("caches" in window))
|
|
7049
7066
|
return !1;
|
|
@@ -7051,7 +7068,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7051
7068
|
return await a(), V;
|
|
7052
7069
|
},
|
|
7053
7070
|
[a]
|
|
7054
|
-
), s =
|
|
7071
|
+
), s = i(async (k) => "caches" in window ? (await (await caches.open(k)).keys()).map((V) => V.url) : [], []), h = i(async () => {
|
|
7055
7072
|
var P, j, V, Q, ae, te;
|
|
7056
7073
|
if (!("serviceWorker" in navigator)) {
|
|
7057
7074
|
C((U) => ({ ...U, status: "error", error: "Service Worker not supported" }));
|
|
@@ -7070,7 +7087,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7070
7087
|
})), (j = (P = F.current).onRegistered) == null || j.call(P, U), U.addEventListener("updatefound", () => {
|
|
7071
7088
|
const se = U.installing;
|
|
7072
7089
|
se && se.addEventListener("statechange", () => {
|
|
7073
|
-
var
|
|
7090
|
+
var oe, ie, de, ge;
|
|
7074
7091
|
switch (se.state) {
|
|
7075
7092
|
case "installing":
|
|
7076
7093
|
C((pe) => ({ ...pe, status: "installing" }));
|
|
@@ -7081,7 +7098,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7081
7098
|
status: "installed",
|
|
7082
7099
|
updateAvailable: !0,
|
|
7083
7100
|
waitingWorker: !0
|
|
7084
|
-
})), W(!0), (
|
|
7101
|
+
})), W(!0), (ie = (oe = F.current).onUpdateAvailable) == null || ie.call(oe)) : C((pe) => ({ ...pe, status: "installed" }));
|
|
7085
7102
|
break;
|
|
7086
7103
|
case "activating":
|
|
7087
7104
|
C((pe) => ({ ...pe, status: "activating" }));
|
|
@@ -7109,11 +7126,11 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7109
7126
|
!Z && M.reloadOnActivation && (Z = !0, window.location.reload());
|
|
7110
7127
|
}), await a(), U;
|
|
7111
7128
|
} catch (U) {
|
|
7112
|
-
const Z = U instanceof Error ? U.message :
|
|
7129
|
+
const Z = U instanceof Error ? U.message : o("serviceWorker.registrationFailed", "Registration failed");
|
|
7113
7130
|
C((se) => ({ ...se, status: "error", error: Z })), (te = (ae = F.current).onError) == null || te.call(ae, U instanceof Error ? U : new Error(Z));
|
|
7114
7131
|
return;
|
|
7115
7132
|
}
|
|
7116
|
-
}, [M, a,
|
|
7133
|
+
}, [M, a, o]), w = i(async () => {
|
|
7117
7134
|
if (!A.registration)
|
|
7118
7135
|
return !1;
|
|
7119
7136
|
const k = await A.registration.unregister();
|
|
@@ -7124,14 +7141,14 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7124
7141
|
updateAvailable: !1,
|
|
7125
7142
|
waitingWorker: !1
|
|
7126
7143
|
})), k;
|
|
7127
|
-
}, [A.registration]), v =
|
|
7144
|
+
}, [A.registration]), v = i(async () => {
|
|
7128
7145
|
A.registration && await A.registration.update();
|
|
7129
|
-
}, [A.registration]), N =
|
|
7146
|
+
}, [A.registration]), N = i(() => {
|
|
7130
7147
|
var k;
|
|
7131
7148
|
(k = A.registration) != null && k.waiting && A.registration.waiting.postMessage({ type: "SKIP_WAITING" });
|
|
7132
|
-
}, [A.registration]), l =
|
|
7149
|
+
}, [A.registration]), l = i(() => {
|
|
7133
7150
|
M.skipWaiting && N(), W(!1);
|
|
7134
|
-
}, [M.skipWaiting, N]), p =
|
|
7151
|
+
}, [M.skipWaiting, N]), p = i(() => {
|
|
7135
7152
|
window.location.reload();
|
|
7136
7153
|
}, []);
|
|
7137
7154
|
ne(() => {
|
|
@@ -7204,8 +7221,8 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7204
7221
|
onDismiss: () => W(!1)
|
|
7205
7222
|
}) : /* @__PURE__ */ J("div", { className: "nice-sw-notification__content", children: [
|
|
7206
7223
|
/* @__PURE__ */ J("div", { className: "nice-sw-notification__text", children: [
|
|
7207
|
-
/* @__PURE__ */ d("strong", { children:
|
|
7208
|
-
/* @__PURE__ */ d("span", { children:
|
|
7224
|
+
/* @__PURE__ */ d("strong", { children: o("serviceWorker.updateAvailable", "Update Available") }),
|
|
7225
|
+
/* @__PURE__ */ d("span", { children: o("serviceWorker.aNewVersionIsReady", "A new version is ready to install") })
|
|
7209
7226
|
] }),
|
|
7210
7227
|
/* @__PURE__ */ J("div", { className: "nice-sw-notification__actions", children: [
|
|
7211
7228
|
/* @__PURE__ */ d(
|
|
@@ -7213,7 +7230,7 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7213
7230
|
{
|
|
7214
7231
|
className: "nice-sw-notification__btn nice-sw-notification__btn--primary",
|
|
7215
7232
|
onClick: l,
|
|
7216
|
-
children:
|
|
7233
|
+
children: o("serviceWorker.updateNow", "Update Now")
|
|
7217
7234
|
}
|
|
7218
7235
|
),
|
|
7219
7236
|
/* @__PURE__ */ d(
|
|
@@ -7221,12 +7238,12 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7221
7238
|
{
|
|
7222
7239
|
className: "nice-sw-notification__btn nice-sw-notification__btn--secondary",
|
|
7223
7240
|
onClick: () => W(!1),
|
|
7224
|
-
children:
|
|
7241
|
+
children: o("serviceWorker.later", "Later")
|
|
7225
7242
|
}
|
|
7226
7243
|
)
|
|
7227
7244
|
] })
|
|
7228
7245
|
] }) }),
|
|
7229
|
-
S && !A.isOnline && /* @__PURE__ */ d("div", { className: `nice-sw-offline ${K}`, children: Y ? Y({ isOnline: A.isOnline }) : /* @__PURE__ */ d("div", { className: "nice-sw-offline__content", children: /* @__PURE__ */ d("span", { children:
|
|
7246
|
+
S && !A.isOnline && /* @__PURE__ */ d("div", { className: `nice-sw-offline ${K}`, children: Y ? Y({ isOnline: A.isOnline }) : /* @__PURE__ */ d("div", { className: "nice-sw-offline__content", children: /* @__PURE__ */ d("span", { children: o("serviceWorker.youAreOffline", "You are offline") }) }) })
|
|
7230
7247
|
] }) });
|
|
7231
7248
|
}),
|
|
7232
7249
|
{ displayName: "NiceServiceWorker" }
|
|
@@ -7236,12 +7253,12 @@ const tt = /* @__PURE__ */ me(null), br = () => {
|
|
|
7236
7253
|
);
|
|
7237
7254
|
export {
|
|
7238
7255
|
at as NiceAutoStart,
|
|
7239
|
-
|
|
7256
|
+
ot as NiceAutoStartProvider,
|
|
7240
7257
|
hn as NiceBackgroundSync,
|
|
7241
7258
|
gn as NiceBackgroundSyncProvider,
|
|
7242
7259
|
rr as NiceBarcodeScanner,
|
|
7243
7260
|
ar as NiceBatchScanner,
|
|
7244
|
-
|
|
7261
|
+
or as NiceBatchScannerProvider,
|
|
7245
7262
|
wn as NiceCacheStrategies,
|
|
7246
7263
|
bn as NiceCacheStrategiesProvider,
|
|
7247
7264
|
kn as NiceConflictResolution,
|
|
@@ -7249,7 +7266,7 @@ export {
|
|
|
7249
7266
|
mt as NiceExternalDisplay,
|
|
7250
7267
|
ht as NiceExternalDisplayProvider,
|
|
7251
7268
|
nr as NiceHardwareBarcodeGenerator,
|
|
7252
|
-
|
|
7269
|
+
ir as NiceHardwareQRGenerator,
|
|
7253
7270
|
Dn as NiceIndexedDB,
|
|
7254
7271
|
Ln as NiceIndexedDBProvider,
|
|
7255
7272
|
yt as NiceKioskMode,
|
|
@@ -7280,7 +7297,7 @@ export {
|
|
|
7280
7297
|
mr as useCachedFetch,
|
|
7281
7298
|
hr as useConflictResolution,
|
|
7282
7299
|
vr as useConnectionStatus,
|
|
7283
|
-
|
|
7300
|
+
it as useExternalDisplay,
|
|
7284
7301
|
An as useIndexedDB,
|
|
7285
7302
|
gr as useIndexedDBStore,
|
|
7286
7303
|
Kn as useKioskMode,
|