@genai-fi/base 4.1.2 → 4.1.4
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
api: string;
|
|
3
|
+
checkURL?: string;
|
|
3
4
|
appName: string;
|
|
4
5
|
visibility?: number;
|
|
5
6
|
noCheck?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export default function ConnectionStatus({ api, appName, visibility, noCheck }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function ConnectionStatus({ api, checkURL, appName, visibility, noCheck }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { iceConfig as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { getRTConfig as
|
|
5
|
-
import { W as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { c as
|
|
8
|
-
import { checkP2P as
|
|
9
|
-
import { usePeerObject as
|
|
10
|
-
import { a as
|
|
11
|
-
import '../../assets/ConnectionStatus.css';const
|
|
12
|
-
containerConnecting:
|
|
13
|
-
containerSuccess:
|
|
14
|
-
containerMedium:
|
|
15
|
-
containerBad:
|
|
16
|
-
message:
|
|
17
|
-
},
|
|
1
|
+
import { jsx as r, Fragment as W, jsxs as q } from "react/jsx-runtime";
|
|
2
|
+
import { iceConfig as F, webrtcActive as L } from "../../state/webrtcState.js";
|
|
3
|
+
import { useRef as P, useState as g, useEffect as o } from "react";
|
|
4
|
+
import { getRTConfig as z } from "./ice.js";
|
|
5
|
+
import { W as E, F as R } from "../../FlashWifi-DkGhdWqj.js";
|
|
6
|
+
import { useTranslation as b } from "react-i18next";
|
|
7
|
+
import { c as j } from "../../createSvgIcon-DQhMxTx4.js";
|
|
8
|
+
import { checkP2P as x } from "./check.js";
|
|
9
|
+
import { usePeerObject as A } from "../../hooks/peer.js";
|
|
10
|
+
import { a as B } from "../../react-D_xU5dL6.js";
|
|
11
|
+
import '../../assets/ConnectionStatus.css';const w = "_containerConnecting_1p4sr_15 _container_1p4sr_3", D = "_containerSuccess_1p4sr_20 _container_1p4sr_3", O = "_containerMedium_1p4sr_25 _container_1p4sr_3", U = "_containerBad_1p4sr_30 _container_1p4sr_3", $ = "_message_1p4sr_35", a = {
|
|
12
|
+
containerConnecting: w,
|
|
13
|
+
containerSuccess: D,
|
|
14
|
+
containerMedium: O,
|
|
15
|
+
containerBad: U,
|
|
16
|
+
message: $
|
|
17
|
+
}, k = j(/* @__PURE__ */ r("path", {
|
|
18
18
|
d: "M24 8.98C20.93 5.9 16.69 4 12 4S3.07 5.9 0 8.98L12 21v-9h8.99zM19.59 14l-2.09 2.09L15.41 14 14 15.41l2.09 2.09L14 19.59 15.41 21l2.09-2.08L19.59 21 21 19.59l-2.08-2.09L21 15.41z"
|
|
19
|
-
}), "SignalWifiBad"),
|
|
20
|
-
function
|
|
21
|
-
const { t: p } =
|
|
19
|
+
}), "SignalWifiBad"), N = 6e4;
|
|
20
|
+
function te({ api: f, checkURL: S, appName: h, visibility: v, noCheck: y }) {
|
|
21
|
+
const { t: p } = b(), e = A(), [u, C] = B(F), [M, l] = B(L), m = P(), [n, d] = g("connecting"), [s, _] = g(0), [, I] = g(!1), [c, T] = g(!1), i = n === "ready";
|
|
22
22
|
return o(() => {
|
|
23
23
|
if (e)
|
|
24
24
|
return e.on("status", d), e.on("quality", _), d(e.status), _(e.quality), () => {
|
|
@@ -26,48 +26,48 @@ function ee({ api: f, appName: h, visibility: S, noCheck: v }) {
|
|
|
26
26
|
};
|
|
27
27
|
_(0), d("connecting");
|
|
28
28
|
}, [e]), o(() => {
|
|
29
|
-
u ||
|
|
30
|
-
|
|
29
|
+
u || z(f, h, (t) => {
|
|
30
|
+
C(t);
|
|
31
31
|
});
|
|
32
|
-
}, [u,
|
|
32
|
+
}, [u, C, f, h]), o(() => {
|
|
33
33
|
if (n !== "ready") {
|
|
34
34
|
const t = setTimeout(() => {
|
|
35
|
-
|
|
36
|
-
},
|
|
35
|
+
T(!0);
|
|
36
|
+
}, N);
|
|
37
37
|
return () => {
|
|
38
38
|
clearTimeout(t);
|
|
39
39
|
};
|
|
40
40
|
} else
|
|
41
|
-
|
|
41
|
+
T(!1);
|
|
42
42
|
}, [n]), o(() => {
|
|
43
|
-
u &&
|
|
43
|
+
u && M === "unset" && (navigator != null && navigator.mediaDevices ? navigator.mediaDevices.getUserMedia({ video: !0 }).then((t) => {
|
|
44
44
|
m.current = t, l("full");
|
|
45
45
|
}).catch(() => {
|
|
46
46
|
l("relay");
|
|
47
47
|
}) : l("relay"));
|
|
48
|
-
}, [u,
|
|
48
|
+
}, [u, M, l]), o(() => {
|
|
49
49
|
i && m.current && (m.current.getTracks().forEach(function(t) {
|
|
50
50
|
t.stop();
|
|
51
51
|
}), m.current = void 0);
|
|
52
52
|
}, [i, n]), o(() => {
|
|
53
|
-
i && e && !
|
|
54
|
-
|
|
53
|
+
i && e && !y && e.code && x(S || f, e.code).then((t) => {
|
|
54
|
+
I(t);
|
|
55
55
|
});
|
|
56
|
-
}, [i, e, f,
|
|
56
|
+
}, [i, e, f, S, y]), /* @__PURE__ */ r(W, { children: (v === void 0 || s <= v) && /* @__PURE__ */ q(
|
|
57
57
|
"div",
|
|
58
58
|
{
|
|
59
59
|
className: n === "connecting" && !c ? a.containerConnecting : s === 3 ? a.containerSuccess : s === 2 ? a.containerMedium : a.containerBad,
|
|
60
60
|
children: [
|
|
61
61
|
!c && s > 0 && /* @__PURE__ */ r(
|
|
62
|
-
|
|
62
|
+
E,
|
|
63
63
|
{
|
|
64
64
|
fontSize: "large",
|
|
65
65
|
color: "inherit"
|
|
66
66
|
}
|
|
67
67
|
),
|
|
68
|
-
!c && s <= 0 && /* @__PURE__ */ r(
|
|
68
|
+
!c && s <= 0 && /* @__PURE__ */ r(R, {}),
|
|
69
69
|
c && /* @__PURE__ */ r(
|
|
70
|
-
|
|
70
|
+
k,
|
|
71
71
|
{
|
|
72
72
|
fontSize: "large",
|
|
73
73
|
color: "inherit"
|
|
@@ -79,5 +79,5 @@ function ee({ api: f, appName: h, visibility: S, noCheck: v }) {
|
|
|
79
79
|
) });
|
|
80
80
|
}
|
|
81
81
|
export {
|
|
82
|
-
|
|
82
|
+
te as default
|
|
83
83
|
};
|
|
@@ -13,5 +13,5 @@ interface Props extends Callbacks {
|
|
|
13
13
|
hidden?: boolean;
|
|
14
14
|
size: number;
|
|
15
15
|
}
|
|
16
|
-
export default function Webcam({ interval, capture, disable, direct, hidden, size,
|
|
16
|
+
export default function Webcam({ interval, capture, disable, direct, hidden, size, onActivated, onFatal, onPostprocess, onCapture, onPreprocess, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { c as
|
|
7
|
-
import { WebcamClass as
|
|
8
|
-
import { g as
|
|
9
|
-
import { g as
|
|
10
|
-
import { css as
|
|
11
|
-
import '../../assets/Webcam.css';function
|
|
12
|
-
return String(
|
|
1
|
+
import { jsx as c, jsxs as F, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import * as G from "react";
|
|
3
|
+
import { useState as N, useRef as T, useEffect as b, useCallback as E } from "react";
|
|
4
|
+
import { useTranslation as J } from "react-i18next";
|
|
5
|
+
import { IconButton as V } from "@mui/material";
|
|
6
|
+
import { c as Q } from "../../createSvgIcon-DQhMxTx4.js";
|
|
7
|
+
import { WebcamClass as Y } from "./webcamClass.js";
|
|
8
|
+
import { g as Z, u as P, s as W, c as ee, a as te, m as ae } from "../../DefaultPropsProvider-BurgXZzw.js";
|
|
9
|
+
import { g as ne, P as a } from "../../createTheme-DV959X3d.js";
|
|
10
|
+
import { css as A, keyframes as H } from "@emotion/react";
|
|
11
|
+
import '../../assets/Webcam.css';function re(e) {
|
|
12
|
+
return String(e).match(/[\d.\-+]*\s*(.*)/)[1] || "";
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return parseFloat(
|
|
14
|
+
function ie(e) {
|
|
15
|
+
return parseFloat(e);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
container:
|
|
19
|
-
wrapContainer:
|
|
20
|
-
flipButton:
|
|
17
|
+
const oe = "_container_u6uf5_1", se = "_wrapContainer_u6uf5_5", ce = "_flipButton_u6uf5_10", $ = {
|
|
18
|
+
container: oe,
|
|
19
|
+
wrapContainer: se,
|
|
20
|
+
flipButton: ce
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
return
|
|
22
|
+
function le(e) {
|
|
23
|
+
return ne("MuiSkeleton", e);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
const
|
|
25
|
+
Z("MuiSkeleton", ["root", "text", "rectangular", "rounded", "circular", "pulse", "wave", "withChildren", "fitContent", "heightAuto"]);
|
|
26
|
+
const ue = (e) => {
|
|
27
27
|
const {
|
|
28
|
-
classes:
|
|
29
|
-
variant:
|
|
30
|
-
animation:
|
|
31
|
-
hasChildren:
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
-
} =
|
|
35
|
-
return
|
|
36
|
-
root: ["root",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
28
|
+
classes: i,
|
|
29
|
+
variant: r,
|
|
30
|
+
animation: o,
|
|
31
|
+
hasChildren: u,
|
|
32
|
+
width: v,
|
|
33
|
+
height: s
|
|
34
|
+
} = e;
|
|
35
|
+
return te({
|
|
36
|
+
root: ["root", r, o, u && "withChildren", u && !v && "fitContent", u && !s && "heightAuto"]
|
|
37
|
+
}, le, i);
|
|
38
|
+
}, j = H`
|
|
39
39
|
0% {
|
|
40
40
|
opacity: 1;
|
|
41
41
|
}
|
|
@@ -47,7 +47,7 @@ const st = (t) => {
|
|
|
47
47
|
100% {
|
|
48
48
|
opacity: 1;
|
|
49
49
|
}
|
|
50
|
-
`,
|
|
50
|
+
`, D = H`
|
|
51
51
|
0% {
|
|
52
52
|
transform: translateX(-100%);
|
|
53
53
|
}
|
|
@@ -60,29 +60,29 @@ const st = (t) => {
|
|
|
60
60
|
100% {
|
|
61
61
|
transform: translateX(100%);
|
|
62
62
|
}
|
|
63
|
-
`,
|
|
64
|
-
animation: ${
|
|
65
|
-
` : null,
|
|
63
|
+
`, fe = typeof j != "string" ? A`
|
|
64
|
+
animation: ${j} 2s ease-in-out 0.5s infinite;
|
|
65
|
+
` : null, pe = typeof D != "string" ? A`
|
|
66
66
|
&::after {
|
|
67
|
-
animation: ${
|
|
67
|
+
animation: ${D} 2s linear 0.5s infinite;
|
|
68
68
|
}
|
|
69
|
-
` : null,
|
|
69
|
+
` : null, de = W("span", {
|
|
70
70
|
name: "MuiSkeleton",
|
|
71
71
|
slot: "Root",
|
|
72
|
-
overridesResolver: (
|
|
72
|
+
overridesResolver: (e, i) => {
|
|
73
73
|
const {
|
|
74
|
-
ownerState:
|
|
75
|
-
} =
|
|
76
|
-
return [
|
|
74
|
+
ownerState: r
|
|
75
|
+
} = e;
|
|
76
|
+
return [i.root, i[r.variant], r.animation !== !1 && i[r.animation], r.hasChildren && i.withChildren, r.hasChildren && !r.width && i.fitContent, r.hasChildren && !r.height && i.heightAuto];
|
|
77
77
|
}
|
|
78
|
-
})(
|
|
79
|
-
theme:
|
|
78
|
+
})(ae(({
|
|
79
|
+
theme: e
|
|
80
80
|
}) => {
|
|
81
|
-
const
|
|
81
|
+
const i = re(e.shape.borderRadius) || "px", r = ie(e.shape.borderRadius);
|
|
82
82
|
return {
|
|
83
83
|
display: "block",
|
|
84
84
|
// Create a "on paper" color with sufficient contrast retaining the color
|
|
85
|
-
backgroundColor:
|
|
85
|
+
backgroundColor: e.vars ? e.vars.palette.Skeleton.bg : e.alpha(e.palette.text.primary, e.palette.mode === "light" ? 0.11 : 0.13),
|
|
86
86
|
height: "1.2em",
|
|
87
87
|
variants: [{
|
|
88
88
|
props: {
|
|
@@ -94,7 +94,7 @@ const st = (t) => {
|
|
|
94
94
|
height: "auto",
|
|
95
95
|
transformOrigin: "0 55%",
|
|
96
96
|
transform: "scale(1, 0.60)",
|
|
97
|
-
borderRadius: `${
|
|
97
|
+
borderRadius: `${r}${i}/${Math.round(r / 0.6 * 10) / 10}${i}`,
|
|
98
98
|
"&:empty:before": {
|
|
99
99
|
content: '"\\00a0"'
|
|
100
100
|
}
|
|
@@ -111,12 +111,12 @@ const st = (t) => {
|
|
|
111
111
|
variant: "rounded"
|
|
112
112
|
},
|
|
113
113
|
style: {
|
|
114
|
-
borderRadius: (
|
|
114
|
+
borderRadius: (e.vars || e).shape.borderRadius
|
|
115
115
|
}
|
|
116
116
|
}, {
|
|
117
117
|
props: ({
|
|
118
|
-
ownerState:
|
|
119
|
-
}) =>
|
|
118
|
+
ownerState: o
|
|
119
|
+
}) => o.hasChildren,
|
|
120
120
|
style: {
|
|
121
121
|
"& > *": {
|
|
122
122
|
visibility: "hidden"
|
|
@@ -124,15 +124,15 @@ const st = (t) => {
|
|
|
124
124
|
}
|
|
125
125
|
}, {
|
|
126
126
|
props: ({
|
|
127
|
-
ownerState:
|
|
128
|
-
}) =>
|
|
127
|
+
ownerState: o
|
|
128
|
+
}) => o.hasChildren && !o.width,
|
|
129
129
|
style: {
|
|
130
130
|
maxWidth: "fit-content"
|
|
131
131
|
}
|
|
132
132
|
}, {
|
|
133
133
|
props: ({
|
|
134
|
-
ownerState:
|
|
135
|
-
}) =>
|
|
134
|
+
ownerState: o
|
|
135
|
+
}) => o.hasChildren && !o.height,
|
|
136
136
|
style: {
|
|
137
137
|
height: "auto"
|
|
138
138
|
}
|
|
@@ -140,8 +140,8 @@ const st = (t) => {
|
|
|
140
140
|
props: {
|
|
141
141
|
animation: "pulse"
|
|
142
142
|
},
|
|
143
|
-
style:
|
|
144
|
-
animation: `${
|
|
143
|
+
style: fe || {
|
|
144
|
+
animation: `${j} 2s ease-in-out 0.5s infinite`
|
|
145
145
|
}
|
|
146
146
|
}, {
|
|
147
147
|
props: {
|
|
@@ -156,7 +156,7 @@ const st = (t) => {
|
|
|
156
156
|
background: `linear-gradient(
|
|
157
157
|
90deg,
|
|
158
158
|
transparent,
|
|
159
|
-
${(
|
|
159
|
+
${(e.vars || e).palette.action.hover},
|
|
160
160
|
transparent
|
|
161
161
|
)`,
|
|
162
162
|
content: '""',
|
|
@@ -172,47 +172,47 @@ const st = (t) => {
|
|
|
172
172
|
props: {
|
|
173
173
|
animation: "wave"
|
|
174
174
|
},
|
|
175
|
-
style:
|
|
175
|
+
style: pe || {
|
|
176
176
|
"&::after": {
|
|
177
|
-
animation: `${
|
|
177
|
+
animation: `${D} 2s linear 0.5s infinite`
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
}]
|
|
181
181
|
};
|
|
182
|
-
})),
|
|
183
|
-
const
|
|
184
|
-
props:
|
|
182
|
+
})), K = /* @__PURE__ */ G.forwardRef(function(i, r) {
|
|
183
|
+
const o = P({
|
|
184
|
+
props: i,
|
|
185
185
|
name: "MuiSkeleton"
|
|
186
186
|
}), {
|
|
187
|
-
animation:
|
|
188
|
-
className:
|
|
189
|
-
component:
|
|
190
|
-
height:
|
|
191
|
-
style:
|
|
192
|
-
variant:
|
|
193
|
-
width:
|
|
194
|
-
...
|
|
195
|
-
} =
|
|
196
|
-
...
|
|
197
|
-
animation:
|
|
198
|
-
component:
|
|
199
|
-
variant:
|
|
200
|
-
hasChildren: !!
|
|
201
|
-
},
|
|
202
|
-
return /* @__PURE__ */ c(
|
|
203
|
-
as:
|
|
204
|
-
ref:
|
|
205
|
-
className:
|
|
206
|
-
ownerState:
|
|
207
|
-
...
|
|
187
|
+
animation: u = "pulse",
|
|
188
|
+
className: v,
|
|
189
|
+
component: s = "span",
|
|
190
|
+
height: d,
|
|
191
|
+
style: w,
|
|
192
|
+
variant: m = "text",
|
|
193
|
+
width: y,
|
|
194
|
+
...h
|
|
195
|
+
} = o, t = {
|
|
196
|
+
...o,
|
|
197
|
+
animation: u,
|
|
198
|
+
component: s,
|
|
199
|
+
variant: m,
|
|
200
|
+
hasChildren: !!h.children
|
|
201
|
+
}, M = ue(t);
|
|
202
|
+
return /* @__PURE__ */ c(de, {
|
|
203
|
+
as: s,
|
|
204
|
+
ref: r,
|
|
205
|
+
className: ee(M.root, v),
|
|
206
|
+
ownerState: t,
|
|
207
|
+
...h,
|
|
208
208
|
style: {
|
|
209
|
-
width:
|
|
210
|
-
height:
|
|
211
|
-
...
|
|
209
|
+
width: y,
|
|
210
|
+
height: d,
|
|
211
|
+
...w
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
|
-
process.env.NODE_ENV !== "production" && (
|
|
215
|
+
process.env.NODE_ENV !== "production" && (K.propTypes = {
|
|
216
216
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
217
217
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
218
218
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
@@ -222,159 +222,169 @@ process.env.NODE_ENV !== "production" && (E.propTypes = {
|
|
|
222
222
|
* If `false` the animation effect is disabled.
|
|
223
223
|
* @default 'pulse'
|
|
224
224
|
*/
|
|
225
|
-
animation:
|
|
225
|
+
animation: a.oneOf(["pulse", "wave", !1]),
|
|
226
226
|
/**
|
|
227
227
|
* Optional children to infer width and height from.
|
|
228
228
|
*/
|
|
229
|
-
children:
|
|
229
|
+
children: a.node,
|
|
230
230
|
/**
|
|
231
231
|
* Override or extend the styles applied to the component.
|
|
232
232
|
*/
|
|
233
|
-
classes:
|
|
233
|
+
classes: a.object,
|
|
234
234
|
/**
|
|
235
235
|
* @ignore
|
|
236
236
|
*/
|
|
237
|
-
className:
|
|
237
|
+
className: a.string,
|
|
238
238
|
/**
|
|
239
239
|
* The component used for the root node.
|
|
240
240
|
* Either a string to use a HTML element or a component.
|
|
241
241
|
*/
|
|
242
|
-
component:
|
|
242
|
+
component: a.elementType,
|
|
243
243
|
/**
|
|
244
244
|
* Height of the skeleton.
|
|
245
245
|
* Useful when you don't want to adapt the skeleton to a text element but for instance a card.
|
|
246
246
|
*/
|
|
247
|
-
height:
|
|
247
|
+
height: a.oneOfType([a.number, a.string]),
|
|
248
248
|
/**
|
|
249
249
|
* @ignore
|
|
250
250
|
*/
|
|
251
|
-
style:
|
|
251
|
+
style: a.object,
|
|
252
252
|
/**
|
|
253
253
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
254
254
|
*/
|
|
255
|
-
sx:
|
|
255
|
+
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
|
|
256
256
|
/**
|
|
257
257
|
* The type of content that will be rendered.
|
|
258
258
|
* @default 'text'
|
|
259
259
|
*/
|
|
260
|
-
variant:
|
|
260
|
+
variant: a.oneOfType([a.oneOf(["circular", "rectangular", "rounded", "text"]), a.string]),
|
|
261
261
|
/**
|
|
262
262
|
* Width of the skeleton.
|
|
263
263
|
* Useful when the skeleton is inside an inline element with no width of its own.
|
|
264
264
|
*/
|
|
265
|
-
width:
|
|
265
|
+
width: a.oneOfType([a.number, a.string])
|
|
266
266
|
});
|
|
267
|
-
const
|
|
267
|
+
const X = Q([/* @__PURE__ */ c("path", {
|
|
268
268
|
d: "M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"
|
|
269
269
|
}, "0"), /* @__PURE__ */ c("path", {
|
|
270
270
|
d: "m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"
|
|
271
271
|
}, "1")], "Cameraswitch");
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
272
|
+
function Re({
|
|
273
|
+
interval: e,
|
|
274
|
+
capture: i,
|
|
275
|
+
disable: r,
|
|
276
|
+
direct: o,
|
|
277
|
+
hidden: u,
|
|
278
|
+
size: v,
|
|
279
|
+
onActivated: s,
|
|
280
|
+
onFatal: d,
|
|
281
|
+
onPostprocess: w,
|
|
282
|
+
onCapture: m,
|
|
283
|
+
onPreprocess: y
|
|
284
|
+
}) {
|
|
285
|
+
const { t: h } = J(), [t, M] = N(null), C = T(null), k = T(-1), _ = T(0), f = T(), [R, L] = N(!1), [S, B] = N(!1), p = Math.floor(v);
|
|
286
|
+
b(() => {
|
|
287
|
+
f.current = async (n) => {
|
|
278
288
|
var l;
|
|
279
|
-
if (
|
|
280
|
-
|
|
289
|
+
if (r) {
|
|
290
|
+
f.current && (k.current = window.requestAnimationFrame(f.current));
|
|
281
291
|
return;
|
|
282
292
|
}
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
287
|
-
if (
|
|
288
|
-
await
|
|
293
|
+
if (t && t.canvas) {
|
|
294
|
+
t.update();
|
|
295
|
+
const x = e !== void 0 ? e : 1e3;
|
|
296
|
+
if (y && await y(t.canvas), i && m && n - _.current >= x) {
|
|
297
|
+
if (o && t.canvas)
|
|
298
|
+
await m(t.canvas);
|
|
289
299
|
else {
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
300
|
+
const g = document.createElement("canvas");
|
|
301
|
+
g.width = t.canvas.width, g.height = t.canvas.height;
|
|
302
|
+
const O = g.getContext("2d");
|
|
303
|
+
O || console.error("Failed to get context"), O == null || O.drawImage(t.canvas, 0, 0), await m(g);
|
|
294
304
|
}
|
|
295
|
-
|
|
305
|
+
_.current = n;
|
|
296
306
|
}
|
|
297
|
-
const
|
|
298
|
-
|
|
307
|
+
const I = (l = C.current) == null ? void 0 : l.getContext("2d");
|
|
308
|
+
I && (I.drawImage(t.canvas, 0, 0), w && C.current && await w(C.current));
|
|
299
309
|
}
|
|
300
|
-
|
|
301
|
-
},
|
|
302
|
-
}, [e,
|
|
303
|
-
const
|
|
304
|
-
async (
|
|
310
|
+
f.current && (k.current = window.requestAnimationFrame(f.current));
|
|
311
|
+
}, k.current === -1 && (k.current = window.requestAnimationFrame(f.current));
|
|
312
|
+
}, [t, e, i, o, r, m, y, w]);
|
|
313
|
+
const U = E(
|
|
314
|
+
async (n) => {
|
|
305
315
|
var l;
|
|
306
|
-
if (await
|
|
316
|
+
if (await n.setup({ facingMode: S ? "user" : "environment" }), n.webcam && (n.webcam.playsInline = !0, n.webcam.muted = !0, n.webcam.onsuspend = () => n.play(), M(n)), (l = navigator.mediaDevices) != null && l.enumerateDevices)
|
|
307
317
|
try {
|
|
308
|
-
(await navigator.mediaDevices.enumerateDevices()).filter((
|
|
309
|
-
} catch (
|
|
310
|
-
console.error(
|
|
318
|
+
(await navigator.mediaDevices.enumerateDevices()).filter((g) => g.kind === "videoinput").length > 1 && (R || L(!0), n.flip = S);
|
|
319
|
+
} catch (x) {
|
|
320
|
+
console.error(x);
|
|
311
321
|
}
|
|
312
|
-
return s
|
|
322
|
+
return s && s(!0), n;
|
|
313
323
|
},
|
|
314
|
-
[R,
|
|
324
|
+
[S, R, s]
|
|
315
325
|
);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}, [
|
|
319
|
-
const
|
|
320
|
-
return
|
|
321
|
-
s
|
|
326
|
+
b(() => {
|
|
327
|
+
i && (_.current = 0);
|
|
328
|
+
}, [i]), b(() => {
|
|
329
|
+
const n = new Y(p, p, !0);
|
|
330
|
+
return U(n).catch((l) => {
|
|
331
|
+
s && s(!1), console.error("No webcam", l), d && d();
|
|
322
332
|
}), () => {
|
|
323
333
|
var l;
|
|
324
|
-
(l =
|
|
334
|
+
(l = n.webcam) != null && l.srcObject && n.stop();
|
|
325
335
|
};
|
|
326
|
-
}, [
|
|
327
|
-
var
|
|
328
|
-
|
|
329
|
-
}, [
|
|
330
|
-
|
|
331
|
-
}, [
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
}, [
|
|
335
|
-
return
|
|
336
|
-
|
|
336
|
+
}, [S, U, p, s, d]), b(() => () => {
|
|
337
|
+
var n;
|
|
338
|
+
f.current = void 0, (n = t == null ? void 0 : t.webcam) != null && n.srcObject && t.stop();
|
|
339
|
+
}, [t]), b(() => {
|
|
340
|
+
t && (r ? t.pause() : t.play());
|
|
341
|
+
}, [t, r]);
|
|
342
|
+
const z = E(() => {
|
|
343
|
+
B((n) => !n);
|
|
344
|
+
}, [B]);
|
|
345
|
+
return u ? /* @__PURE__ */ c(q, { children: R && /* @__PURE__ */ c(
|
|
346
|
+
V,
|
|
337
347
|
{
|
|
338
348
|
size: "large",
|
|
339
349
|
color: "inherit",
|
|
340
|
-
onClick:
|
|
350
|
+
onClick: z,
|
|
341
351
|
"aria-label": h("webcam.aria.flip"),
|
|
342
|
-
children: /* @__PURE__ */ c(
|
|
352
|
+
children: /* @__PURE__ */ c(X, { fontSize: "large" })
|
|
343
353
|
}
|
|
344
|
-
) }) : /* @__PURE__ */
|
|
345
|
-
!
|
|
346
|
-
|
|
354
|
+
) }) : /* @__PURE__ */ F(q, { children: [
|
|
355
|
+
!t && /* @__PURE__ */ c(
|
|
356
|
+
K,
|
|
347
357
|
{
|
|
348
358
|
variant: "rounded",
|
|
349
|
-
width:
|
|
350
|
-
height:
|
|
359
|
+
width: p,
|
|
360
|
+
height: p
|
|
351
361
|
}
|
|
352
362
|
),
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
363
|
+
t && /* @__PURE__ */ F("div", { className: $.wrapContainer, children: [
|
|
364
|
+
R && /* @__PURE__ */ c(
|
|
365
|
+
V,
|
|
356
366
|
{
|
|
357
|
-
className:
|
|
367
|
+
className: $.flipButton,
|
|
358
368
|
size: "large",
|
|
359
369
|
color: "inherit",
|
|
360
|
-
onClick:
|
|
370
|
+
onClick: z,
|
|
361
371
|
"aria-label": h("webcam.aria.flip"),
|
|
362
|
-
children: /* @__PURE__ */ c(
|
|
372
|
+
children: /* @__PURE__ */ c(X, { fontSize: "large" })
|
|
363
373
|
}
|
|
364
374
|
),
|
|
365
375
|
/* @__PURE__ */ c(
|
|
366
376
|
"div",
|
|
367
377
|
{
|
|
368
378
|
"data-testid": "webcam",
|
|
369
|
-
className:
|
|
379
|
+
className: $.container,
|
|
370
380
|
role: "img",
|
|
371
381
|
"aria-label": h("webcam.aria.video"),
|
|
372
382
|
children: /* @__PURE__ */ c(
|
|
373
383
|
"canvas",
|
|
374
384
|
{
|
|
375
|
-
width:
|
|
376
|
-
height:
|
|
377
|
-
ref:
|
|
385
|
+
width: p,
|
|
386
|
+
height: p,
|
|
387
|
+
ref: C
|
|
378
388
|
}
|
|
379
389
|
)
|
|
380
390
|
}
|
|
@@ -383,5 +393,5 @@ function bt({ interval: t, capture: o, disable: a, direct: i, hidden: p, size: y
|
|
|
383
393
|
] });
|
|
384
394
|
}
|
|
385
395
|
export {
|
|
386
|
-
|
|
396
|
+
Re as default
|
|
387
397
|
};
|