@genai-fi/base 4.1.4 → 4.2.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/Close-BGAFHd7i.js +8 -0
- package/dist/assets/PercentageBar.css +1 -1
- package/dist/assets/SidePanel.css +1 -0
- package/dist/components/Motd/Motd.js +19 -21
- package/dist/components/PercentageBar/PercentageBar.d.ts +5 -1
- package/dist/components/PercentageBar/PercentageBar.js +38 -32
- package/dist/components/SidePanel/SidePanel.d.ts +9 -0
- package/dist/components/SidePanel/SidePanel.js +122 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +34 -32
- package/dist/services/peer2peer/PeerConnection.js +13 -13
- package/dist/util/crypto.d.ts +2 -2
- package/dist/util/crypto.js +3 -3
- package/package.json +12 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as r } from "./createSvgIcon-DQhMxTx4.js";
|
|
3
|
+
const c = r(/* @__PURE__ */ o("path", {
|
|
4
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
5
|
+
}), "Close");
|
|
6
|
+
export {
|
|
7
|
+
c as C
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._outer_161yr_1{position:relative;overflow:hidden;border-radius:4px;color:#fff}._outer_161yr_1._orange_161yr_8{background-color:#c6840c33}._orange_161yr_8._progress_161yr_11{background-color:#c6840c}._outer_161yr_1._purple_161yr_15{background-color:#a751c933}._purple_161yr_15._progress_161yr_11{background-color:#a751c9}._outer_161yr_1._blue_161yr_22{background-color:#5165c933}._blue_161yr_22._progress_161yr_11{background-color:#5165c9}._outer_161yr_1._green_161yr_29{background-color:#53a52733}._green_161yr_29._progress_161yr_11{background-color:#53a527}._outer_161yr_1._red_161yr_36{background-color:#db491d33}._red_161yr_36._progress_161yr_11{background-color:#db491d}._progress_161yr_11{position:absolute;left:0;top:0;bottom:0;width:100%;background:#1976d2;transition:width .5s,height .5s}._label_161yr_53{position:relative;font-weight:700;text-align:right;padding:.2rem .5rem;box-sizing:border-box;font-size:12pt;transition:width .5s,height .5s}._horizontal_161yr_63{width:100%;min-height:20px}._vertical_161yr_68{width:min-content;height:100%}._vertical_161yr_68 ._label_161yr_53{display:flex;align-items:flex-end}._vertical_161yr_68 ._progress_161yr_11{height:100%;bottom:unset}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._sidePanel_fhsa8_1{background:#fff;display:flex;z-index:2;flex-shrink:0;position:relative;transition:opacity .3s ease-in;opacity:0}._sidePanelHorizontal_fhsa8_14{flex-direction:column;width:100%}._sidePanel_fhsa8_1._closed_fhsa8_19{opacity:0;transition:width .3s cubic-bezier(.4,0,.2,1),height .3s cubic-bezier(.4,0,.2,1),opacity .3s ease-out}._sidePanel_fhsa8_1._opening_fhsa8_24{opacity:1;transition:width .3s cubic-bezier(.4,0,.2,1),height .3s cubic-bezier(.4,0,.2,1),opacity .3s ease-in}._sidePanel_fhsa8_1._open_fhsa8_24{opacity:1}._resizer_fhsa8_33{background-color:transparent;box-sizing:border-box;position:absolute;opacity:1;touch-action:none;-webkit-user-select:none;user-select:none;z-index:2}._resizerHorizontal_fhsa8_44{height:30px;width:100%;cursor:ns-resize;left:0;top:-8px;right:0}._resizerVertical_fhsa8_53{width:30px;cursor:ew-resize;left:-8px;top:0;bottom:0}._noSelect_fhsa8_61{-webkit-user-select:none;user-select:none}._resizerBar_fhsa8_65{position:absolute;top:0;left:7px;width:2px;height:100%;background-color:#ddd;touch-action:none;-webkit-user-select:none;user-select:none}._resizerHorizontal_fhsa8_44 ._resizerBar_fhsa8_65{top:7px;left:0;width:100%;height:2px}._resizer_fhsa8_33:hover ._resizerBar_fhsa8_65{background-color:#75a4e288}._resizer_fhsa8_33._resizing_fhsa8_87 ._resizerBar_fhsa8_65{background-color:#75a4e2}._resizerHandle_fhsa8_91{position:absolute;top:50%;left:2px;width:10px;height:60px;transform:translateY(-50%);background-color:#fff;border-radius:3px;border:2px solid #ddd;box-shadow:0 0 4px #ccc;display:flex;align-items:center;justify-content:center;touch-action:none;-webkit-user-select:none;user-select:none}._resizerHorizontal_fhsa8_44 ._resizerHandle_fhsa8_91{top:2px;left:50%;width:60px;height:10px;transform:translate(-50%)}._resizerHandle_fhsa8_91._minimised_fhsa8_117{left:-15px;width:20px}._resizerHorizontal_fhsa8_44 ._resizerHandle_fhsa8_91._minimised_fhsa8_117{top:-15px;height:20px;left:50%;width:60px;transform:translate(-50%)}._resizerHandle_fhsa8_91:focus{outline:2px solid #75a4e2;outline-offset:2px}._resizerVertical_fhsa8_53 ._resizerHandle_fhsa8_91:before{content:"";display:block;width:4px;height:20px;background:radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 0 2px,radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 0 8px,radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 0 14px;background-repeat:no-repeat;background-size:4px 4px}._resizerHorizontal_fhsa8_44 ._resizerHandle_fhsa8_91:before{content:"";display:block;width:20px;height:4px;background:radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 2px 0,radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 8px 0,radial-gradient(circle,#bbb 1.5px,transparent 1.5px) 14px 0;background-repeat:no-repeat;background-size:4px 4px}._resizer_fhsa8_33:hover ._resizerHandle_fhsa8_91,._resizer_fhsa8_33._resizing_fhsa8_87 ._resizerHandle_fhsa8_91{border-color:#75a4e2}._expand_fhsa8_167{position:absolute;top:2rem;right:0;height:40px;width:30px;background-color:#fff;border-radius:3px;border:2px solid #ddd;cursor:pointer;display:flex;align-items:center;justify-content:center}._content_fhsa8_183{flex-grow:1;overflow:auto;min-width:300px!important;position:relative}._closeButton_fhsa8_190{position:absolute;top:.5rem;right:.5rem}
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as l, useEffect as d, useMemo as m } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { C as _ } from "../../Close-BGAFHd7i.js";
|
|
4
4
|
import { IconButton as a } from "@mui/material";
|
|
5
|
-
import '../../assets/Motd.css';const g = "#e04f66",
|
|
5
|
+
import '../../assets/Motd.css';const g = "#e04f66", b = "#fd9d32", h = "#e8f0fe", j = "_motd_1rn2j_3", v = "_info_1rn2j_15 _motd_1rn2j_3", w = "_warn_1rn2j_21 _motd_1rn2j_3", C = "_error_1rn2j_26 _motd_1rn2j_3", M = {
|
|
6
6
|
bgColourful3: g,
|
|
7
|
-
bgColourful2:
|
|
8
|
-
bgSubdued1:
|
|
7
|
+
bgColourful2: b,
|
|
8
|
+
bgSubdued1: h,
|
|
9
9
|
motd: j,
|
|
10
10
|
info: v,
|
|
11
11
|
warn: w,
|
|
12
12
|
error: C
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function k({ message: t }) {
|
|
17
|
-
const [o, i] = l(t || ""), [f, c] = l(!0);
|
|
13
|
+
};
|
|
14
|
+
function k({ message: o }) {
|
|
15
|
+
const [r, i] = l(o || ""), [f, u] = l(!0);
|
|
18
16
|
d(() => {
|
|
19
|
-
|
|
20
|
-
s.ok && s.json().then((
|
|
21
|
-
|
|
17
|
+
o || fetch("undefined/motd").then((s) => {
|
|
18
|
+
s.ok && s.json().then((t) => {
|
|
19
|
+
t && t.motd && i(t.motd);
|
|
22
20
|
});
|
|
23
21
|
}).catch(() => {
|
|
24
22
|
console.warn("MOTD Failed");
|
|
25
23
|
});
|
|
26
|
-
}, [
|
|
27
|
-
const n = m(() =>
|
|
28
|
-
return
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
24
|
+
}, [o]);
|
|
25
|
+
const n = m(() => r.startsWith("info:") ? { msg: r.substring(5), level: "info" } : r.startsWith("warn:") ? { msg: r.substring(5), level: "warn" } : r.startsWith("error:") ? { msg: r.substring(6), level: "error" } : { msg: r, level: "info" }, [r]);
|
|
26
|
+
return r.length > 0 && f ? /* @__PURE__ */ c("div", { className: M[n.level], children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { style: { flexGrow: 1 }, children: n.msg }),
|
|
28
|
+
/* @__PURE__ */ e(
|
|
31
29
|
a,
|
|
32
30
|
{
|
|
33
31
|
color: "inherit",
|
|
34
|
-
onClick: () =>
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
|
|
32
|
+
onClick: () => u(!1),
|
|
33
|
+
children: /* @__PURE__ */ e(
|
|
34
|
+
_,
|
|
37
35
|
{
|
|
38
36
|
fontSize: "large",
|
|
39
37
|
color: "inherit"
|
|
@@ -2,6 +2,10 @@ export type Colours = 'purple' | 'green' | 'blue' | 'red' | 'orange';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
colour: Colours;
|
|
4
4
|
value: number;
|
|
5
|
+
hideLabel?: boolean;
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
thickness?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
5
9
|
}
|
|
6
|
-
export default function PercentageBar({ colour, value }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default function PercentageBar({ colour, value, hideLabel, orientation, thickness, style: cssStyle }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import '../../assets/PercentageBar.css';const
|
|
3
|
-
outer:
|
|
4
|
-
orange:
|
|
5
|
-
progress:
|
|
6
|
-
purple:
|
|
7
|
-
blue:
|
|
1
|
+
import { jsxs as n, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/PercentageBar.css';const i = "_outer_161yr_1", p = "_orange_161yr_8", g = "_progress_161yr_11", h = "_purple_161yr_15", d = "_blue_161yr_22", u = "_green_161yr_29", y = "_red_161yr_36", $ = "_label_161yr_53", v = "_horizontal_161yr_63", b = "_vertical_161yr_68", r = {
|
|
3
|
+
outer: i,
|
|
4
|
+
orange: p,
|
|
5
|
+
progress: g,
|
|
6
|
+
purple: h,
|
|
7
|
+
blue: d,
|
|
8
8
|
green: u,
|
|
9
|
-
red:
|
|
10
|
-
label:
|
|
9
|
+
red: y,
|
|
10
|
+
label: $,
|
|
11
|
+
horizontal: v,
|
|
12
|
+
vertical: b
|
|
11
13
|
};
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
function x({ colour: o, value: a, hideLabel: c, orientation: t, thickness: l, style: _ }) {
|
|
15
|
+
const e = Math.round(a);
|
|
16
|
+
return /* @__PURE__ */ n(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: `${r.outer} ${r[o]} ${r[t || "horizontal"]}`,
|
|
20
|
+
style: l ? t === "vertical" ? { width: `${l}px`, ..._ } : { height: `${l}px`, ..._ } : _,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ s(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: `${r.progress} ${r[o]}`,
|
|
26
|
+
style: t === "vertical" ? { height: `${e}%` } : { width: `${e}%` }
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
!c && /* @__PURE__ */ s(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: r.label,
|
|
33
|
+
style: t === "vertical" ? { height: `${e}%` } : { width: `${e}%` },
|
|
34
|
+
children: `${e}%`
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
34
40
|
}
|
|
35
41
|
export {
|
|
36
|
-
|
|
42
|
+
x as default
|
|
37
43
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface Props extends PropsWithChildren {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
onOpen?: () => void;
|
|
6
|
+
position?: 'right' | 'bottom';
|
|
7
|
+
}
|
|
8
|
+
export default function SidePanel({ children, open, onClose, onOpen, position }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs as g, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as B, useEffect as w } from "react";
|
|
3
|
+
import { C as A } from "../../Close-BGAFHd7i.js";
|
|
4
|
+
import { IconButton as D } from "@mui/material";
|
|
5
|
+
import '../../assets/SidePanel.css';const L = "_sidePanel_fhsa8_1", T = "_sidePanelHorizontal_fhsa8_14", C = "_closed_fhsa8_19", k = "_opening_fhsa8_24", V = "_open_fhsa8_24", W = "_resizer_fhsa8_33", Z = "_resizerHorizontal_fhsa8_44", U = "_resizerVertical_fhsa8_53", X = "_noSelect_fhsa8_61", j = "_resizerBar_fhsa8_65", K = "_resizing_fhsa8_87", O = "_resizerHandle_fhsa8_91", Y = "_minimised_fhsa8_117", F = "_content_fhsa8_183", G = "_closeButton_fhsa8_190", e = {
|
|
6
|
+
sidePanel: L,
|
|
7
|
+
sidePanelHorizontal: T,
|
|
8
|
+
closed: C,
|
|
9
|
+
opening: k,
|
|
10
|
+
open: V,
|
|
11
|
+
resizer: W,
|
|
12
|
+
resizerHorizontal: Z,
|
|
13
|
+
resizerVertical: U,
|
|
14
|
+
noSelect: X,
|
|
15
|
+
resizerBar: j,
|
|
16
|
+
resizing: K,
|
|
17
|
+
resizerHandle: O,
|
|
18
|
+
minimised: Y,
|
|
19
|
+
content: F,
|
|
20
|
+
closeButton: G
|
|
21
|
+
}, h = 30, N = 300, v = Math.max(N, Math.floor(window.innerWidth * 0.25)), M = "sidePanelWidth";
|
|
22
|
+
function ie({ children: R, open: r, onClose: S, onOpen: I, position: t = "right" }) {
|
|
23
|
+
const [l, s] = m(r ? v : 0), _ = B(null), [c, E] = m(!1), [f, H] = m(!1), [p, P] = m(!r), b = B(
|
|
24
|
+
window.sessionStorage.getItem(M) ? Number(window.sessionStorage.getItem(M)) : v
|
|
25
|
+
), o = Math.max(
|
|
26
|
+
N,
|
|
27
|
+
Math.floor(t === "right" ? window.innerWidth / 2 : window.innerHeight / 2)
|
|
28
|
+
);
|
|
29
|
+
w(() => {
|
|
30
|
+
if (r)
|
|
31
|
+
H(!0), P(!1);
|
|
32
|
+
else {
|
|
33
|
+
s(0);
|
|
34
|
+
const i = setTimeout(() => {
|
|
35
|
+
P(!0);
|
|
36
|
+
}, 300);
|
|
37
|
+
return () => clearTimeout(i);
|
|
38
|
+
}
|
|
39
|
+
}, [r]), w(() => {
|
|
40
|
+
if (f) {
|
|
41
|
+
s(b.current || v);
|
|
42
|
+
const i = setTimeout(() => {
|
|
43
|
+
H(!1);
|
|
44
|
+
}, 300);
|
|
45
|
+
return () => clearTimeout(i);
|
|
46
|
+
}
|
|
47
|
+
}, [f]), w(() => {
|
|
48
|
+
if (c) {
|
|
49
|
+
let i = function(u) {
|
|
50
|
+
if (c && _.current) {
|
|
51
|
+
const x = _.current.getBoundingClientRect(), y = t === "right" ? x.right - u.clientX : x.bottom - u.clientY, d = Math.max(Math.min(y, o), h);
|
|
52
|
+
d - y > 10 ? s(0) : (b.current = d, s(d), window.sessionStorage.setItem(M, d.toString())), u.preventDefault();
|
|
53
|
+
}
|
|
54
|
+
}, n = function() {
|
|
55
|
+
E(!1);
|
|
56
|
+
};
|
|
57
|
+
return window.addEventListener("pointermove", i, { passive: !1 }), window.addEventListener("pointerup", n), document.body.classList.add(e.noSelect), () => {
|
|
58
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", n), document.body.classList.remove(e.noSelect);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}, [c, t, o]);
|
|
62
|
+
const z = l === 0, $ = /* @__PURE__ */ g(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: `${e.resizer} ${c ? e.resizing : ""} ${t === "right" ? e.resizerVertical : e.resizerHorizontal}`,
|
|
66
|
+
onPointerDown: () => {
|
|
67
|
+
E(!0), I && I();
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ a("div", { className: e.resizerBar }),
|
|
71
|
+
r && /* @__PURE__ */ a(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: `${e.resizerHandle} ${z ? e.minimised : ""}`,
|
|
75
|
+
role: "separator",
|
|
76
|
+
"aria-orientation": t === "right" ? "vertical" : "horizontal",
|
|
77
|
+
"aria-label": "Resize sidebar",
|
|
78
|
+
tabIndex: 0,
|
|
79
|
+
"aria-valuenow": l,
|
|
80
|
+
"aria-valuemin": h,
|
|
81
|
+
"aria-valuemax": o,
|
|
82
|
+
onKeyDown: (i) => {
|
|
83
|
+
t === "right" ? i.key === "ArrowRight" ? s((n) => Math.min(o, Math.max(0, n - 50))) : i.key === "ArrowLeft" && s((n) => Math.max(h, Math.min(o, n + 50))) : i.key === "ArrowDown" ? s((n) => Math.min(o, Math.max(0, n - 50))) : i.key === "ArrowUp" && s((n) => Math.max(h, Math.min(o, n + 50)));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ g(
|
|
91
|
+
"section",
|
|
92
|
+
{
|
|
93
|
+
className: `${e.sidePanel} ${r ? e.open : e.closed} ${f ? e.opening : ""} ${t === "right" ? e.sidePanelVertical : e.sidePanelHorizontal}`,
|
|
94
|
+
style: t === "right" ? { width: z ? 0 : l, visibility: p ? "hidden" : void 0 } : { height: z ? 0 : l, visibility: p ? "hidden" : void 0 },
|
|
95
|
+
ref: _,
|
|
96
|
+
"aria-hidden": !r,
|
|
97
|
+
children: [
|
|
98
|
+
(t === "right" || t === "bottom") && $,
|
|
99
|
+
/* @__PURE__ */ g("div", { className: e.content, children: [
|
|
100
|
+
S && /* @__PURE__ */ a("div", { className: e.closeButton, children: /* @__PURE__ */ a(
|
|
101
|
+
D,
|
|
102
|
+
{
|
|
103
|
+
onClick: S,
|
|
104
|
+
"data-testid": "sidepanel-close-button",
|
|
105
|
+
children: /* @__PURE__ */ a(
|
|
106
|
+
A,
|
|
107
|
+
{
|
|
108
|
+
fontSize: "medium",
|
|
109
|
+
htmlColor: "#444"
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
) }),
|
|
114
|
+
R
|
|
115
|
+
] })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
ie as default
|
|
122
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { default as BusyButton } from './components/BusyButton/BusyButton';
|
|
|
18
18
|
export { default as AlertPara } from './components/AlertPara/AlertPara';
|
|
19
19
|
export { default as QRCode } from './components/QRCode/QRCode';
|
|
20
20
|
export { default as Webcam } from './components/Webcam/Webcam';
|
|
21
|
+
export { default as SidePanel } from './components/SidePanel/SidePanel';
|
|
21
22
|
export { default as ContentLoader } from './components/ContentLoader/ContentLoader';
|
|
22
23
|
export { WorkflowLayout, type IConnection, Widget, SvgLayer, type ILine, generateLines, extractNodesFromElements, } from './components/WorkflowLayout';
|
|
23
24
|
export { default as LangSelect } from './components/LangSelect/LangSelect';
|
package/dist/main.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { default as o } from "./components/ConnectionStatus/ConnectionStatus.js";
|
|
2
2
|
import { Button as t, LargeButton as f, VerticalButton as m } from "./components/Button/Button.js";
|
|
3
3
|
import { default as p } from "./hooks/peer.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as u } from "./services/peer2peer/Peer2Peer.js";
|
|
5
5
|
import { useID as x } from "./hooks/id.js";
|
|
6
6
|
import { useOnlyOnce as c } from "./hooks/onlyOnce.js";
|
|
7
7
|
import { default as F } from "./hooks/random.js";
|
|
8
8
|
import { theme as I } from "./style/theme.js";
|
|
9
|
-
import { default as
|
|
10
|
-
import { canvasFromDataTransfer as
|
|
9
|
+
import { default as S } from "./util/randomId.js";
|
|
10
|
+
import { canvasFromDataTransfer as B, canvasFromFile as L, canvasFromImage as y, canvasFromURL as T, canvasesFromFiles as b, cropTo as A, urlFromDataTransfer as C } from "./util/canvas.js";
|
|
11
11
|
import { createZipBlob as M, loadZipFile as R, saveZipFile as W } from "./util/zip.js";
|
|
12
12
|
import { useTabActive as O } from "./hooks/useTabActive.js";
|
|
13
13
|
import { default as k } from "./components/Spinner/Spinner.js";
|
|
@@ -16,18 +16,19 @@ import { default as Q } from "./components/BusyButton/BusyButton.js";
|
|
|
16
16
|
import { default as V } from "./components/AlertPara/AlertPara.js";
|
|
17
17
|
import { default as q } from "./components/QRCode/QRCode.js";
|
|
18
18
|
import { default as G } from "./components/Webcam/Webcam.js";
|
|
19
|
-
import { default as J } from "./components/
|
|
20
|
-
import { default as X } from "./components/
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { default as se } from "./components/
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as ne } from "./components/IconMenu/
|
|
28
|
-
import { default as de } from "./components/IconMenu/
|
|
29
|
-
import { default as ie } from "./components/
|
|
30
|
-
import { default as ve } from "./components/
|
|
19
|
+
import { default as J } from "./components/SidePanel/SidePanel.js";
|
|
20
|
+
import { default as X } from "./components/ContentLoader/ContentLoader.js";
|
|
21
|
+
import { default as _ } from "./components/WorkflowLayout/Layout.js";
|
|
22
|
+
import { extractNodesFromElements as ee, generateLines as re } from "./components/WorkflowLayout/lines.js";
|
|
23
|
+
import { Widget as ae } from "./components/WorkflowLayout/Widget.js";
|
|
24
|
+
import { S as fe } from "./SvgLayer-DHFiKVQ9.js";
|
|
25
|
+
import { default as se } from "./components/LangSelect/LangSelect.js";
|
|
26
|
+
import { default as le } from "./components/IconMenu/Spacer.js";
|
|
27
|
+
import { default as ne } from "./components/IconMenu/IconMenu.js";
|
|
28
|
+
import { default as de } from "./components/IconMenu/IconMenuInline.js";
|
|
29
|
+
import { default as ie } from "./components/IconMenu/Item.js";
|
|
30
|
+
import { default as ve } from "./components/PercentageBar/PercentageBar.js";
|
|
31
|
+
import { default as Pe } from "./components/PieScore/PieScore.js";
|
|
31
32
|
import { default as ge } from "./components/Application/Application.js";
|
|
32
33
|
export {
|
|
33
34
|
V as AlertPara,
|
|
@@ -35,35 +36,36 @@ export {
|
|
|
35
36
|
Q as BusyButton,
|
|
36
37
|
t as Button,
|
|
37
38
|
o as ConnectionStatus,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
X as ContentLoader,
|
|
40
|
+
ne as IconMenu,
|
|
41
|
+
de as IconMenuInline,
|
|
42
|
+
ie as IconMenuItem,
|
|
43
|
+
se as LangSelect,
|
|
43
44
|
f as LargeButton,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
u as Peer2Peer,
|
|
46
|
+
ve as PercentageBar,
|
|
47
|
+
Pe as PieScore,
|
|
47
48
|
E as Privacy,
|
|
48
49
|
q as QRCode,
|
|
49
|
-
|
|
50
|
+
J as SidePanel,
|
|
51
|
+
le as Spacer,
|
|
50
52
|
k as Spinner,
|
|
51
|
-
|
|
53
|
+
fe as SvgLayer,
|
|
52
54
|
m as VerticalButton,
|
|
53
55
|
G as Webcam,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
ae as Widget,
|
|
57
|
+
_ as WorkflowLayout,
|
|
58
|
+
B as canvasFromDataTransfer,
|
|
59
|
+
L as canvasFromFile,
|
|
58
60
|
y as canvasFromImage,
|
|
59
61
|
T as canvasFromURL,
|
|
60
62
|
b as canvasesFromFiles,
|
|
61
63
|
M as createZipBlob,
|
|
62
64
|
A as cropTo,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
ee as extractNodesFromElements,
|
|
66
|
+
re as generateLines,
|
|
65
67
|
R as loadZipFile,
|
|
66
|
-
|
|
68
|
+
S as randomId,
|
|
67
69
|
W as saveZipFile,
|
|
68
70
|
I as theme,
|
|
69
71
|
C as urlFromDataTransfer,
|
|
@@ -2,13 +2,13 @@ var u = Object.defineProperty;
|
|
|
2
2
|
var f = (h, c, e) => c in h ? u(h, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[c] = e;
|
|
3
3
|
var o = (h, c, e) => f(h, typeof c != "symbol" ? c + "" : c, e);
|
|
4
4
|
import { E as m } from "../../index-SOhdqzHq.js";
|
|
5
|
-
import { createAsym as
|
|
5
|
+
import { createAsym as T } from "../../util/crypto.js";
|
|
6
6
|
import { base64ToBytes as d, bytesToBase64 as l } from "../../util/base64.js";
|
|
7
7
|
import y from "./error.js";
|
|
8
|
-
const
|
|
8
|
+
const w = 1e4;
|
|
9
9
|
class K extends m {
|
|
10
10
|
/** Create a connection. If the dataConnection parameter is missing then it uses the websocket as a relay. */
|
|
11
|
-
constructor(e, s, r, t,
|
|
11
|
+
constructor(e, s, r, t, p) {
|
|
12
12
|
super();
|
|
13
13
|
o(this, "dataConnection");
|
|
14
14
|
o(this, "peerInstance");
|
|
@@ -27,8 +27,8 @@ class K extends m {
|
|
|
27
27
|
clearTimeout(this.connectTimeout), this.connectTimeout = -1, t.peerConnection.getStats().then((i) => {
|
|
28
28
|
i.forEach((n) => {
|
|
29
29
|
if (n.type === "candidate-pair" && (n.state === "succeeded" || n.state === "in-progress")) {
|
|
30
|
-
const
|
|
31
|
-
(
|
|
30
|
+
const a = i.get(n.remoteCandidateId);
|
|
31
|
+
(a == null ? void 0 : a.candidateType) === "relay" ? this._connType = "relay" : a && (this._connType = "p2p");
|
|
32
32
|
}
|
|
33
33
|
}), this._connType === "server" && console.warn("Failed to find p2p candidate", Array.from(i)), this.emit("open", this);
|
|
34
34
|
});
|
|
@@ -39,11 +39,11 @@ class K extends m {
|
|
|
39
39
|
}), t.on("error", (i) => {
|
|
40
40
|
this.emit("error", i, this);
|
|
41
41
|
}), t.on("iceStateChanged", (i) => {
|
|
42
|
-
i === "disconnected" && t.open && t.close(),
|
|
42
|
+
i === "disconnected" && t.open && t.close(), p && i === "checking" && (t.close(), this.emit("close", this, !1));
|
|
43
43
|
});
|
|
44
44
|
else {
|
|
45
|
-
this._connType = "server",
|
|
46
|
-
this.createCrypto = n, this.pubKey =
|
|
45
|
+
this._connType = "server", T().then(({ createSymCrypto: n, publicKey: a }) => {
|
|
46
|
+
this.createCrypto = n, this.pubKey = a, this.sendCryptoHandshake(), this.emit("crypto");
|
|
47
47
|
}).catch(() => {
|
|
48
48
|
this.emit("error", { type: "no-crypto" }, this), this.close();
|
|
49
49
|
});
|
|
@@ -56,7 +56,7 @@ class K extends m {
|
|
|
56
56
|
}
|
|
57
57
|
this.initiated && (this.connectTimeout = window.setTimeout(() => {
|
|
58
58
|
this.connectTimeout = -1, this.open ? console.warn("Timeout, but already open") : (console.warn("Connect timeout", this), this.close(), this.emit("timeout", this));
|
|
59
|
-
},
|
|
59
|
+
}, w));
|
|
60
60
|
}
|
|
61
61
|
get connectionType() {
|
|
62
62
|
return this._connType;
|
|
@@ -113,8 +113,8 @@ class K extends m {
|
|
|
113
113
|
if (!s || !s.data || !s.iv) throw new y("Invalid encrypted packet");
|
|
114
114
|
const r = await d(s.data), t = await d(s.iv);
|
|
115
115
|
try {
|
|
116
|
-
const
|
|
117
|
-
this.emit("data", JSON.parse(
|
|
116
|
+
const p = await this.decrypt(r, t);
|
|
117
|
+
this.emit("data", JSON.parse(p), this);
|
|
118
118
|
} catch {
|
|
119
119
|
console.error("Decryption error");
|
|
120
120
|
}
|
|
@@ -125,7 +125,7 @@ class K extends m {
|
|
|
125
125
|
}
|
|
126
126
|
async sendEncrypted(e) {
|
|
127
127
|
if (this.encrypt) {
|
|
128
|
-
const s = await this.encrypt(JSON.stringify(e)), r = await l(s[0]), t = await l(s[1]),
|
|
128
|
+
const s = await this.encrypt(JSON.stringify(e)), r = await l(s[0]), t = await l(s[1]), p = JSON.stringify({
|
|
129
129
|
data: r,
|
|
130
130
|
iv: t
|
|
131
131
|
});
|
|
@@ -133,7 +133,7 @@ class K extends m {
|
|
|
133
133
|
type: "DATA",
|
|
134
134
|
src: this.peerInstance.id,
|
|
135
135
|
dst: this.peer,
|
|
136
|
-
payload:
|
|
136
|
+
payload: p
|
|
137
137
|
});
|
|
138
138
|
} else
|
|
139
139
|
throw new y("Failed to send, no key");
|
package/dist/util/crypto.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function createAsym(): Promise<{
|
|
2
2
|
createSymCrypto: (rkey: string) => Promise<{
|
|
3
|
-
encrypt: (data: string) => Promise<[ArrayBuffer,
|
|
4
|
-
decrypt: (data: ArrayBuffer, iv:
|
|
3
|
+
encrypt: (data: string) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
|
4
|
+
decrypt: (data: ArrayBuffer, iv: ArrayBuffer) => Promise<string>;
|
|
5
5
|
}>;
|
|
6
6
|
publicKey: string;
|
|
7
7
|
}>;
|
package/dist/util/crypto.js
CHANGED
|
@@ -4,7 +4,7 @@ function y(e) {
|
|
|
4
4
|
function o(e) {
|
|
5
5
|
return new TextEncoder().encode(e);
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function u() {
|
|
8
8
|
const e = await crypto.subtle.generateKey(
|
|
9
9
|
{
|
|
10
10
|
name: "ECDH",
|
|
@@ -36,7 +36,7 @@ async function s() {
|
|
|
36
36
|
);
|
|
37
37
|
return {
|
|
38
38
|
encrypt: async (c) => {
|
|
39
|
-
const t = crypto.getRandomValues(new Uint8Array(12));
|
|
39
|
+
const t = crypto.getRandomValues(new Uint8Array(12)).buffer;
|
|
40
40
|
return [await crypto.subtle.encrypt({ name: "AES-GCM", iv: t }, a, o(c)), t];
|
|
41
41
|
},
|
|
42
42
|
decrypt: async (c, t) => y(await crypto.subtle.decrypt({ name: "AES-GCM", iv: t }, a, c))
|
|
@@ -46,5 +46,5 @@ async function s() {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
u as createAsym
|
|
50
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genai-fi/base",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@emotion/react": "^11.14.0",
|
|
52
52
|
"@emotion/styled": "^11.14.0",
|
|
53
|
-
"@
|
|
53
|
+
"@eslint/compat": "^2.0.0",
|
|
54
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
55
|
+
"@eslint/js": "^9.39.1",
|
|
56
|
+
"@ladle/react": "^5.1.1",
|
|
54
57
|
"@mui/icons-material": "^7.3.1",
|
|
55
58
|
"@mui/material": "^7.3.1",
|
|
56
59
|
"@mui/x-charts": "^8.5.2",
|
|
@@ -62,15 +65,16 @@
|
|
|
62
65
|
"@types/qrcode": "^1.5.5",
|
|
63
66
|
"@types/react": "^18.3.3",
|
|
64
67
|
"@types/react-dom": "^18.3.0",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
66
|
-
"@typescript-eslint/parser": "^
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
67
70
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
68
71
|
"@vitest/coverage-v8": "^3.0.4",
|
|
69
|
-
"eslint": "^
|
|
70
|
-
"eslint-plugin-react": "^7.
|
|
71
|
-
"eslint-plugin-react-hooks": "^
|
|
72
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
72
|
+
"eslint": "^9.39.1",
|
|
73
|
+
"eslint-plugin-react": "^7.37.5",
|
|
74
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
75
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
73
76
|
"glob": "^11.0.0",
|
|
77
|
+
"globals": "^16.5.0",
|
|
74
78
|
"jsdom": "^26.1.0",
|
|
75
79
|
"react": "^19.1.1",
|
|
76
80
|
"react-dom": "^19.1.1",
|