@ethora/chat-component 26.8.2 → 26.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{ChatProfileModal-DJcii-VO.js → ChatProfileModal-DfXEnzJf.js} +6 -3
- package/dist/{FilePreviewModal-CZtgkIHl.js → FilePreviewModal-Cs1tij9R.js} +63 -63
- package/dist/{ManageDataModal-aOWxvxSs.js → ManageDataModal-BBOui09n.js} +3 -3
- package/dist/{MarkdownBody-neDkIgJl.js → MarkdownBody-DttRXyAK.js} +3 -3
- package/dist/{SideDrawer-mSCnYOgy.js → SideDrawer-DLqEOqAi.js} +25 -25
- package/dist/{UserProfileModal-a_O8hh1O.js → UserProfileModal-DEtLQxkJ.js} +3 -3
- package/dist/{UserSettingsModal-92nP1add.js → UserSettingsModal-Ddht5fc0.js} +9 -9
- package/dist/{VideoCallOverlay-DYd3pFuD.js → VideoCallOverlay-BJMarThf.js} +2673 -2662
- package/dist/VisibilityModal-CckTnGKB.js +138 -0
- package/dist/components/MainComponents/SealedAttachmentList.d.ts +14 -0
- package/dist/components/RoomComponents/styled/LastMessageSealed.d.ts +14 -0
- package/dist/components/styled/AudioMessage.d.ts +38 -0
- package/dist/e2ee/fileEnvelope.d.ts +48 -0
- package/dist/{handleCopyClick-tizCFAb8.js → handleCopyClick-CWw4UAlT.js} +2 -2
- package/dist/helpers/sealedAttachments.d.ts +25 -0
- package/dist/{main-DkokKp7d.js → main-BHtKhpBZ.js} +9533 -8812
- package/dist/main.js +5 -5
- package/dist/networking/api-requests/auth.api.d.ts +10 -1
- package/dist/networking/xmpp/sendMediaMessage.xmpp.d.ts +12 -1
- package/dist/styles/tokens.d.ts +14 -4
- package/dist/types/models/config.model.d.ts +19 -0
- package/dist/types/models/message.model.d.ts +17 -0
- package/package.json +1 -1
- package/dist/VisibilityModal-BKI5XKir.js +0 -132
package/README.md
CHANGED
|
@@ -360,6 +360,7 @@ Below is a grouped reference for all `config` options.
|
|
|
360
360
|
| `headerChatMenu` | `() => void` | Same for the chat header's room menu (the "more" button carrying Report and Leave). When set, that dropdown is not rendered and the button calls your handler. |
|
|
361
361
|
| `colors` | `{ primary; secondary; icons?; ownMessageBackground?; otherMessageBackground?; inputBackground? }` | Theme colours. `primary` drives icon colours and the sender name. `icons` themes every accent icon/icon-button (attach, mic, active send, new-chat, header, empty-state) — defaults to `primary`, so set a *distinct* value to decouple. `ownMessageBackground`/`otherMessageBackground`/`inputBackground` recolour the message bubbles and input bar. |
|
|
362
362
|
| `backgroundChat` | `{ color?; image? }` | Background colour and/or image for the messages area. (`image` as a string URL; pass an object URL for a `File`.) |
|
|
363
|
+
| `colorScheme` | `'light' \| 'dark' \| 'system'` | Light or dark UI. Default `'light'` (the chat as before). `'system'` follows the viewer's OS / browser setting and updates live. Scoped to the chat's own elements, so it never restyles the host page; a host with its own dark mode should pass its resolved choice. `colors.icons`, `colors.iconsBg`, the bubble/input colours and `backgroundChat` are used as given in both schemes. `colors.primary` is the one exception: in dark it is lightened slightly (about 20% toward white) so primary-coloured text and icons stay legible on the dark surface while buttons keep white text on them, and `--ethora-color-primary-text` carries a further-lifted variant for text-only uses such as links and sender names. Pass an already-dark-suitable `primary` if you need the exact brand value. |
|
|
363
364
|
| `typography` | `TypographyConfig` | Font family + size for the chat UI: `fontFamily` (or just `googleFontsFamily`) is applied across all chat text incl. messages and sender names; `fontSize` (px) scales message text, sender names, timestamps, inputs, room names and badges. Plus loaders (`googleFontsUrl`/`fontFaces`) and weight tokens. |
|
|
364
365
|
| `fallbackScreens` | `{ noUser?; noConnection?; noRoom?; error? }` | Replace the built-in screens (Ethora login form, "Connecting...", empty room state, crash screen) with your own text or React nodes. A plain string is rendered as centered text. `error` also accepts a function `({ error, componentStack, scope, reset }) => ReactNode`, see [Error handling](#error-handling-and-crash-containment). |
|
|
365
366
|
| `hiddenRooms` | `{ titles?: string[]; jids?: string[] }` | Hide specific rooms from the room list and unread counters (e.g. `{ titles: ['Main chat'] }` to suppress the auto-created default room). |
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as E, jsxs as j, Fragment as gt } from "react/jsx-runtime";
|
|
2
2
|
import ke, { useRef as yt, useState as ee, useMemo as se } from "react";
|
|
3
|
-
import { S as bt, f as qt, b as Tt, D as he, a as pe, e as Ft, g as zt, h as Fe, i as Qt, j as Ht, k as Yt, l as ze } from "./SideDrawer-
|
|
4
|
-
import { h as Wt, P as Gt, a as Kt, c as Xt, D as Jt, d as Vt, e as Qe, f as He } from "./handleCopyClick-
|
|
5
|
-
import {
|
|
3
|
+
import { S as bt, f as qt, b as Tt, D as he, a as pe, e as Ft, g as zt, h as Fe, i as Qt, j as Ht, k as Yt, l as ze } from "./SideDrawer-DLqEOqAi.js";
|
|
4
|
+
import { h as Wt, P as Gt, a as Kt, c as Xt, D as Jt, d as Vt, e as Qe, f as He } from "./handleCopyClick-CWw4UAlT.js";
|
|
5
|
+
import { o as Zt, b as Et, p as de, a4 as er, B as te, x as W, a as Ne, u as fe, a5 as $e, F as Ct, y as wt, a6 as Rt, a7 as Pt, a8 as xt, a9 as tr, aa as Be, ab as rr, ac as nr, a2 as or, J as _t, Z as ar, ad as ir, ae as Ie, af as sr, ag as ye, ah as St, P as Mt, W as At, w as lr, ai as ur, aj as cr, ak as fr, al as dr, am as hr, q as Ye, an as pr, ao as vr, ap as mr, aq as gr, ar as yr, as as We, at as br, au as Tr, X as Er, av as Cr, aw as wr, M as Rr, K as Pr, ax as Ge } from "./main-BHtKhpBZ.js";
|
|
6
6
|
var le = {}, ve = { exports: {} }, me = { exports: {} }, k = {};
|
|
7
7
|
var Ke;
|
|
8
8
|
function xr() {
|
|
@@ -1736,6 +1736,9 @@ const Ur = /* @__PURE__ */ Zt(jr), qr = "chatId", Fr = (n, h, a) => {
|
|
|
1736
1736
|
font-size: var(--ethora-font-size-xs, 12px);
|
|
1737
1737
|
font-weight: var(--ethora-font-weight-medium, 500);
|
|
1738
1738
|
text-transform: capitalize;
|
|
1739
|
+
[data-ethora-color-scheme='dark'] & {
|
|
1740
|
+
${({ $banned: n }) => n ? "background-color: rgba(242, 118, 107, 0.15);" : ""}
|
|
1741
|
+
}
|
|
1739
1742
|
`, on = ({
|
|
1740
1743
|
member: n,
|
|
1741
1744
|
disableClick: h,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import te, { useState as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import te, { useState as H, useRef as z, useEffect as O, useMemo as $, useCallback as k } from "react";
|
|
3
|
+
import { p as le, b as pe, aN as we, ae as ve, x as X, B as V, aO as xe, aP as be, ay as ye, aQ as Ee, aR as Le, aS as ue, aT as ne, a as Ce, aJ as Re, u as q, a5 as Me, aU as re, as as Pe, ao as J, aV as ke, aW as Se, aX as Te, aY as Ae, aZ as Ie, a_ as Xe, a$ as Ye, b0 as ze, b1 as Oe, az as De, b2 as Fe, b3 as Ne, ax as Be, b4 as He, w as Ue } from "./main-BHtKhpBZ.js";
|
|
4
4
|
function oe(t, i) {
|
|
5
5
|
let o;
|
|
6
6
|
return (...E) => {
|
|
@@ -11,18 +11,18 @@ function _e({ debounce: t, scroll: i, polyfill: o, offsetSize: E } = { debounce:
|
|
|
11
11
|
const L = o || (typeof window > "u" ? class {
|
|
12
12
|
} : window.ResizeObserver);
|
|
13
13
|
if (!L) throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
|
|
14
|
-
const [u, C] =
|
|
14
|
+
const [u, C] = H({ left: 0, top: 0, width: 0, height: 0, bottom: 0, right: 0, x: 0, y: 0 }), n = z({ element: null, scrollContainers: null, resizeObserver: null, lastBounds: u, orientationHandler: null }), R = t ? typeof t == "number" ? t : t.scroll : null, p = t ? typeof t == "number" ? t : t.resize : null, T = z(!1);
|
|
15
15
|
O(() => (T.current = !0, () => {
|
|
16
16
|
T.current = !1;
|
|
17
17
|
}));
|
|
18
18
|
const [b, x, m] = $(() => {
|
|
19
19
|
const r = () => {
|
|
20
20
|
if (!n.current.element) return;
|
|
21
|
-
const { left: g, top: w, width: v, height:
|
|
21
|
+
const { left: g, top: w, width: v, height: N, bottom: S, right: M, x: f, y: h } = n.current.element.getBoundingClientRect(), A = { left: g, top: w, width: v, height: N, bottom: S, right: M, x: f, y: h };
|
|
22
22
|
n.current.element instanceof HTMLElement && E && (A.height = n.current.element.offsetHeight, A.width = n.current.element.offsetWidth), Object.freeze(A), T.current && !We(n.current.lastBounds, A) && C(n.current.lastBounds = A);
|
|
23
23
|
};
|
|
24
|
-
return [r, p ? oe(r, p) : r,
|
|
25
|
-
}, [C, E,
|
|
24
|
+
return [r, p ? oe(r, p) : r, R ? oe(r, R) : r];
|
|
25
|
+
}, [C, E, R, p]);
|
|
26
26
|
function y() {
|
|
27
27
|
n.current.scrollContainers && (n.current.scrollContainers.forEach((r) => r.removeEventListener("scroll", m, !0)), n.current.scrollContainers = null), n.current.resizeObserver && (n.current.resizeObserver.disconnect(), n.current.resizeObserver = null), n.current.orientationHandler && ("orientation" in screen && "removeEventListener" in screen.orientation ? screen.orientation.removeEventListener("change", n.current.orientationHandler) : "onorientationchange" in window && window.removeEventListener("orientationchange", n.current.orientationHandler));
|
|
28
28
|
}
|
|
@@ -107,10 +107,10 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
107
107
|
text-align: center;
|
|
108
108
|
|
|
109
109
|
a {
|
|
110
|
-
color: var(--ethora-color-primary, #0052cd);
|
|
110
|
+
color: var(--ethora-color-primary-text, var(--ethora-color-primary, #0052cd));
|
|
111
111
|
}
|
|
112
|
-
`,
|
|
113
|
-
const i = le(), { config: o } = pe(), [E, L] = _e(), u = z(null), C = z(null), n = z(null), [
|
|
112
|
+
`, Qe = ({ pdfUrl: t }) => {
|
|
113
|
+
const i = le(), { config: o } = pe(), [E, L] = _e(), u = z(null), C = z(null), n = z(null), [R, p] = H("loading"), [T, b] = H(0), [x, m] = H(1), y = Math.max(320, Math.floor(L.width || 0));
|
|
114
114
|
O(() => {
|
|
115
115
|
let r = !1, g;
|
|
116
116
|
return p("loading"), m(1), b(0), (async () => {
|
|
@@ -140,21 +140,21 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
140
140
|
};
|
|
141
141
|
}, [t, o?.pdfPreview?.workerSrc]), O(() => {
|
|
142
142
|
const r = C.current, g = u.current;
|
|
143
|
-
if (
|
|
143
|
+
if (R !== "ready" || !r || !g || y <= 0) return;
|
|
144
144
|
let w = !1;
|
|
145
145
|
return (async () => {
|
|
146
146
|
try {
|
|
147
147
|
const v = await r.getPage(x);
|
|
148
148
|
if (w) return;
|
|
149
|
-
const
|
|
150
|
-
g.width = Math.max(1, Math.floor(
|
|
149
|
+
const N = v.getViewport({ scale: 1 }), S = N.width ? y / N.width : 1, M = v.getViewport({ scale: S });
|
|
150
|
+
g.width = Math.max(1, Math.floor(M.width)), g.height = Math.max(1, Math.floor(M.height));
|
|
151
151
|
const f = g.getContext("2d");
|
|
152
152
|
if (!f) {
|
|
153
153
|
p("error");
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
n.current?.cancel();
|
|
157
|
-
const h = v.render({ canvasContext: f, viewport:
|
|
157
|
+
const h = v.render({ canvasContext: f, viewport: M });
|
|
158
158
|
n.current = h, await h.promise, v.cleanup();
|
|
159
159
|
} catch (v) {
|
|
160
160
|
w || console.warn("[Ethora] PDF page render failed:", v);
|
|
@@ -162,7 +162,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
162
162
|
})(), () => {
|
|
163
163
|
w = !0, n.current?.cancel(), n.current = null;
|
|
164
164
|
};
|
|
165
|
-
}, [
|
|
165
|
+
}, [R, x, y]);
|
|
166
166
|
const Y = k(
|
|
167
167
|
() => m((r) => Math.max(1, r - 1)),
|
|
168
168
|
[]
|
|
@@ -170,12 +170,12 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
170
170
|
() => m((r) => Math.min(T || 1, r + 1)),
|
|
171
171
|
[T]
|
|
172
172
|
);
|
|
173
|
-
return
|
|
173
|
+
return R === "error" ? /* @__PURE__ */ l(ie, { children: /* @__PURE__ */ B(Ge, { children: [
|
|
174
174
|
/* @__PURE__ */ l("span", { children: i("modal.filePreview.pdfUnavailable") }),
|
|
175
175
|
/* @__PURE__ */ l("a", { href: t, target: "_blank", rel: "noopener noreferrer", children: i("modal.filePreview.openExternally") })
|
|
176
|
-
] }) }) : /* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */ l(Ze, { ref: E, children:
|
|
178
|
-
T > 1 && /* @__PURE__ */
|
|
176
|
+
] }) }) : /* @__PURE__ */ B(ie, { children: [
|
|
177
|
+
/* @__PURE__ */ l(Ze, { ref: E, children: R === "loading" ? /* @__PURE__ */ l(ve, { color: o?.colors?.primary }) : /* @__PURE__ */ l("canvas", { ref: u }) }),
|
|
178
|
+
T > 1 && /* @__PURE__ */ B(Ke, { children: [
|
|
179
179
|
/* @__PURE__ */ l(
|
|
180
180
|
ae,
|
|
181
181
|
{
|
|
@@ -185,7 +185,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
185
185
|
"aria-label": i("modal.filePreview.previousPage")
|
|
186
186
|
}
|
|
187
187
|
),
|
|
188
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ B("span", { children: [
|
|
189
189
|
x,
|
|
190
190
|
" / ",
|
|
191
191
|
T
|
|
@@ -201,7 +201,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
201
201
|
)
|
|
202
202
|
] })
|
|
203
203
|
] });
|
|
204
|
-
}, I = 1, ee = 6,
|
|
204
|
+
}, I = 1, ee = 6, qe = 2.5, Je = 50, et = 300, se = 24, tt = 16e-4, G = (t, i, o) => Math.min(o, Math.max(i, t)), nt = X.div`
|
|
205
205
|
position: relative;
|
|
206
206
|
/* An explicit height, not flex growth alone: the parent lays its children
|
|
207
207
|
out in a row and centres them, so the viewport would otherwise be sized
|
|
@@ -235,12 +235,12 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
235
235
|
${ye}
|
|
236
236
|
`, fe = te.forwardRef(
|
|
237
237
|
({ src: t, alt: i, onSwipeLeft: o, onSwipeRight: E, onError: L, onScaleChange: u }, C) => {
|
|
238
|
-
const n = z(null),
|
|
238
|
+
const n = z(null), R = z(null), [p, T] = H(I), [b, x] = H({ x: 0, y: 0 }), [m, y] = H(!1), [Y, F] = H(!1), r = z({ scale: I, offset: { x: 0, y: 0 } });
|
|
239
239
|
r.current = { scale: p, offset: b };
|
|
240
240
|
const g = z(null), w = z(null), v = z(
|
|
241
241
|
null
|
|
242
|
-
),
|
|
243
|
-
const e = n.current, c =
|
|
242
|
+
), N = k((a) => {
|
|
243
|
+
const e = n.current, c = R.current;
|
|
244
244
|
if (!e) return { x: 0, y: 0 };
|
|
245
245
|
const s = e.clientWidth, d = e.clientHeight, P = c?.naturalWidth || 0, D = c?.naturalHeight || 0;
|
|
246
246
|
let j = s, Z = d;
|
|
@@ -254,14 +254,14 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
254
254
|
};
|
|
255
255
|
}, []), S = k(
|
|
256
256
|
(a, e, c) => {
|
|
257
|
-
const s = G(a, I, ee), d =
|
|
257
|
+
const s = G(a, I, ee), d = N(s);
|
|
258
258
|
y(c), T(s), x({
|
|
259
259
|
x: G(e.x, -d.x, d.x),
|
|
260
260
|
y: G(e.y, -d.y, d.y)
|
|
261
261
|
});
|
|
262
262
|
},
|
|
263
|
-
[
|
|
264
|
-
),
|
|
263
|
+
[N]
|
|
264
|
+
), M = k(
|
|
265
265
|
(a, e, c, s) => {
|
|
266
266
|
const d = r.current, P = G(a, I, ee), D = P / d.scale;
|
|
267
267
|
S(
|
|
@@ -278,9 +278,9 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
278
278
|
S(I, { x: 0, y: 0 }, !0);
|
|
279
279
|
}, [S]), h = k(
|
|
280
280
|
(a) => {
|
|
281
|
-
|
|
281
|
+
M(r.current.scale * a, 0, 0, !0);
|
|
282
282
|
},
|
|
283
|
-
[
|
|
283
|
+
[M]
|
|
284
284
|
);
|
|
285
285
|
te.useImperativeHandle(
|
|
286
286
|
C,
|
|
@@ -300,10 +300,10 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
300
300
|
const e = (c) => {
|
|
301
301
|
c.preventDefault();
|
|
302
302
|
const s = a.getBoundingClientRect(), d = c.clientX - s.left - s.width / 2, P = c.clientY - s.top - s.height / 2, D = Math.exp(-c.deltaY * tt);
|
|
303
|
-
|
|
303
|
+
M(r.current.scale * D, d, P, !1);
|
|
304
304
|
};
|
|
305
305
|
return a.addEventListener("wheel", e, { passive: !1 }), () => a.removeEventListener("wheel", e);
|
|
306
|
-
}, [
|
|
306
|
+
}, [M]);
|
|
307
307
|
const A = k(
|
|
308
308
|
(a, e) => {
|
|
309
309
|
const c = n.current;
|
|
@@ -313,14 +313,14 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
const s = c.getBoundingClientRect();
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
M(
|
|
317
|
+
qe,
|
|
318
318
|
a - s.left - s.width / 2,
|
|
319
319
|
e - s.top - s.height / 2,
|
|
320
320
|
!0
|
|
321
321
|
);
|
|
322
322
|
},
|
|
323
|
-
[f,
|
|
323
|
+
[f, M]
|
|
324
324
|
), _ = k((a) => {
|
|
325
325
|
a.button === 0 && (r.current.scale <= I || (a.preventDefault(), g.current = { x: a.clientX, y: a.clientY }, F(!0)));
|
|
326
326
|
}, []);
|
|
@@ -345,7 +345,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
345
345
|
window.removeEventListener("mousemove", a), window.removeEventListener("mouseup", e);
|
|
346
346
|
};
|
|
347
347
|
}, [Y, S]);
|
|
348
|
-
const
|
|
348
|
+
const Q = k((a) => {
|
|
349
349
|
if (a.touches.length === 2) {
|
|
350
350
|
const [c, s] = [a.touches[0], a.touches[1]];
|
|
351
351
|
w.current = {
|
|
@@ -385,7 +385,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
385
385
|
), D = n.current;
|
|
386
386
|
if (!D || P <= 0) return;
|
|
387
387
|
const j = D.getBoundingClientRect(), Z = (s.clientX + d.clientX) / 2 - j.left - j.width / 2, K = (s.clientY + d.clientY) / 2 - j.top - j.height / 2;
|
|
388
|
-
e.moved = !0,
|
|
388
|
+
e.moved = !0, M(
|
|
389
389
|
e.pinchScale * P / e.pinchDistance,
|
|
390
390
|
Z,
|
|
391
391
|
K,
|
|
@@ -409,7 +409,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
409
409
|
e.lastX = c.clientX, e.lastY = c.clientY;
|
|
410
410
|
}
|
|
411
411
|
},
|
|
412
|
-
[S,
|
|
412
|
+
[S, M]
|
|
413
413
|
), U = k(
|
|
414
414
|
(a) => {
|
|
415
415
|
const e = w.current;
|
|
@@ -448,14 +448,14 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
448
448
|
"data-testid": "image-lightbox-viewport",
|
|
449
449
|
onMouseDown: _,
|
|
450
450
|
onDoubleClick: me,
|
|
451
|
-
onTouchStart:
|
|
451
|
+
onTouchStart: Q,
|
|
452
452
|
onTouchMove: W,
|
|
453
453
|
onTouchEnd: U,
|
|
454
454
|
onTouchCancel: U,
|
|
455
455
|
children: /* @__PURE__ */ l(
|
|
456
456
|
rt,
|
|
457
457
|
{
|
|
458
|
-
ref:
|
|
458
|
+
ref: R,
|
|
459
459
|
"data-testid": "image-lightbox-image",
|
|
460
460
|
src: t,
|
|
461
461
|
alt: i,
|
|
@@ -536,16 +536,16 @@ const ot = (t) => {
|
|
|
536
536
|
`, gt = ({
|
|
537
537
|
handleCloseModal: t
|
|
538
538
|
}) => {
|
|
539
|
-
const i = Ce(), o = le(), E =
|
|
539
|
+
const i = Ce(), o = le(), E = Re(), { activeFile: L } = q(
|
|
540
540
|
(f) => f.chatSettingStore
|
|
541
541
|
), u = $(
|
|
542
542
|
() => L ?? { fileName: "", fileURL: "", mimetype: "" },
|
|
543
543
|
[L]
|
|
544
|
-
), C =
|
|
544
|
+
), C = q(
|
|
545
545
|
(f) => f.chatSettingStore.user?.fileToken || ""
|
|
546
|
-
), n =
|
|
547
|
-
(f) =>
|
|
548
|
-
),
|
|
546
|
+
), n = q(
|
|
547
|
+
(f) => Me(f)?.messages
|
|
548
|
+
), R = z(null), [p, T] = H(I), b = ue(u?.mimetype, u?.fileName), x = $(() => ot(n), [n]), m = $(
|
|
549
549
|
() => b === "image" ? it(x, u) : -1,
|
|
550
550
|
[x, u, b]
|
|
551
551
|
), y = m >= 0 && x.length > 1, Y = y && m > 0, F = y && m < x.length - 1, r = k(
|
|
@@ -575,29 +575,29 @@ const ot = (t) => {
|
|
|
575
575
|
return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
|
|
576
576
|
}, [y, g, w]);
|
|
577
577
|
const v = () => {
|
|
578
|
-
fetch(
|
|
578
|
+
fetch(Be(u.fileURL), {
|
|
579
579
|
method: "GET",
|
|
580
580
|
headers: {}
|
|
581
581
|
}).then((f) => {
|
|
582
|
-
const _ = !!
|
|
583
|
-
f.arrayBuffer().then(function(
|
|
582
|
+
const _ = !!He(u.fileName) ? u.fileName : `MEDIA-ETHORA.${b === "image" ? "png" : b === "video" ? "mp4" : "bin"}`;
|
|
583
|
+
f.arrayBuffer().then(function(Q) {
|
|
584
584
|
if (typeof window > "u")
|
|
585
585
|
return;
|
|
586
|
-
const W = window.URL.createObjectURL(new Blob([
|
|
586
|
+
const W = window.URL.createObjectURL(new Blob([Q])), U = document.createElement("a");
|
|
587
587
|
U.href = W, U.setAttribute("download", _), document.body.appendChild(U), U.click(), U.remove(), window.URL.revokeObjectURL(W);
|
|
588
588
|
});
|
|
589
589
|
}).catch((f) => {
|
|
590
590
|
Ue.log(f);
|
|
591
591
|
});
|
|
592
|
-
},
|
|
592
|
+
}, N = () => {
|
|
593
593
|
i(re(void 0)), t?.();
|
|
594
|
-
}, S = u?.fileName || o("modal.filePreview.imageAlt"),
|
|
594
|
+
}, S = u?.fileName || o("modal.filePreview.imageAlt"), M = $(() => {
|
|
595
595
|
switch (b) {
|
|
596
596
|
case "image":
|
|
597
597
|
return /* @__PURE__ */ l(
|
|
598
598
|
fe,
|
|
599
599
|
{
|
|
600
|
-
ref:
|
|
600
|
+
ref: R,
|
|
601
601
|
src: J(u.fileURL, C) || ce,
|
|
602
602
|
alt: S,
|
|
603
603
|
onScaleChange: T,
|
|
@@ -618,9 +618,9 @@ const ot = (t) => {
|
|
|
618
618
|
}
|
|
619
619
|
);
|
|
620
620
|
case "pdf":
|
|
621
|
-
return /* @__PURE__ */ l(
|
|
621
|
+
return /* @__PURE__ */ l(Qe, { pdfUrl: J(u.fileURL, C) });
|
|
622
622
|
default:
|
|
623
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ B(
|
|
624
624
|
"div",
|
|
625
625
|
{
|
|
626
626
|
style: {
|
|
@@ -649,7 +649,7 @@ const ot = (t) => {
|
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
651
|
}, [u, C, S, b, w, g, o]);
|
|
652
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ B(
|
|
653
653
|
Ae,
|
|
654
654
|
{
|
|
655
655
|
"aria-label": o("modal.filePreview.title"),
|
|
@@ -658,18 +658,18 @@ const ot = (t) => {
|
|
|
658
658
|
/* @__PURE__ */ l(
|
|
659
659
|
Ie,
|
|
660
660
|
{
|
|
661
|
-
handleCloseModal:
|
|
661
|
+
handleCloseModal: N,
|
|
662
662
|
headerTitle: o("modal.filePreview.title"),
|
|
663
|
-
rightMenu: /* @__PURE__ */
|
|
663
|
+
rightMenu: /* @__PURE__ */ B(lt, { children: [
|
|
664
664
|
y && /* @__PURE__ */ l(dt, { "data-testid": "lightbox-position", "aria-live": "polite", children: o("modal.filePreview.position", {
|
|
665
665
|
current: m + 1,
|
|
666
666
|
total: x.length
|
|
667
667
|
}) }),
|
|
668
|
-
b === "image" && /* @__PURE__ */
|
|
668
|
+
b === "image" && /* @__PURE__ */ B(ut, { children: [
|
|
669
669
|
/* @__PURE__ */ l(
|
|
670
670
|
V,
|
|
671
671
|
{
|
|
672
|
-
onClick: () =>
|
|
672
|
+
onClick: () => R.current?.zoomOut(),
|
|
673
673
|
disabled: p <= I,
|
|
674
674
|
"aria-label": o("modal.filePreview.zoomOut"),
|
|
675
675
|
children: /* @__PURE__ */ l(Xe, {})
|
|
@@ -678,7 +678,7 @@ const ot = (t) => {
|
|
|
678
678
|
/* @__PURE__ */ l(
|
|
679
679
|
V,
|
|
680
680
|
{
|
|
681
|
-
onClick: () =>
|
|
681
|
+
onClick: () => R.current?.zoomIn(),
|
|
682
682
|
disabled: p >= ee,
|
|
683
683
|
"aria-label": o("modal.filePreview.zoomIn"),
|
|
684
684
|
children: /* @__PURE__ */ l(Ye, {})
|
|
@@ -687,7 +687,7 @@ const ot = (t) => {
|
|
|
687
687
|
/* @__PURE__ */ l(
|
|
688
688
|
V,
|
|
689
689
|
{
|
|
690
|
-
onClick: () =>
|
|
690
|
+
onClick: () => R.current?.reset(),
|
|
691
691
|
disabled: p <= I,
|
|
692
692
|
"aria-label": o("modal.filePreview.resetZoom"),
|
|
693
693
|
children: /* @__PURE__ */ l(ze, {})
|
|
@@ -711,7 +711,7 @@ const ot = (t) => {
|
|
|
711
711
|
padding: "16px",
|
|
712
712
|
width: "90%"
|
|
713
713
|
},
|
|
714
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ B(at, { children: [
|
|
715
715
|
y && /* @__PURE__ */ l(
|
|
716
716
|
st,
|
|
717
717
|
{
|
|
@@ -721,14 +721,14 @@ const ot = (t) => {
|
|
|
721
721
|
children: /* @__PURE__ */ l(Fe, {})
|
|
722
722
|
}
|
|
723
723
|
),
|
|
724
|
-
|
|
724
|
+
M,
|
|
725
725
|
y && /* @__PURE__ */ l(
|
|
726
726
|
ct,
|
|
727
727
|
{
|
|
728
728
|
onClick: w,
|
|
729
729
|
disabled: !F,
|
|
730
730
|
"aria-label": o("modal.filePreview.nextImage"),
|
|
731
|
-
children: /* @__PURE__ */ l(
|
|
731
|
+
children: /* @__PURE__ */ l(Ne, {})
|
|
732
732
|
}
|
|
733
733
|
)
|
|
734
734
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, Fragment as T, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m, useCallback as M } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { S as J, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-
|
|
3
|
+
import { ay as B, x as t, az as I, aA as w, B as j, u as z, p as E, J as F, aB as R, L as U, w as x, aC as A, aD as $, aE as O, aF as H } from "./main-BHtKhpBZ.js";
|
|
4
|
+
import { S as J, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-DLqEOqAi.js";
|
|
5
5
|
t(I)`
|
|
6
6
|
display: flex;
|
|
7
7
|
box-sizing: border-box;
|
|
@@ -82,7 +82,7 @@ const y = t(j)`
|
|
|
82
82
|
`, Q = ({
|
|
83
83
|
handleCloseModal: r
|
|
84
84
|
}) => {
|
|
85
|
-
const { config: l } = z((s) => s.chatSettingStore), e =
|
|
85
|
+
const { config: l } = z((s) => s.chatSettingStore), e = E(), { showToast: d } = F(), [C, c] = m(!1), [i, g] = m(!1), S = async () => {
|
|
86
86
|
const p = (await H()).data;
|
|
87
87
|
x.log(p);
|
|
88
88
|
const L = new Blob([p], { type: "text/plain" }), h = URL.createObjectURL(L), n = document.createElement("a");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as fs, jsx as ie, Fragment as hs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { o as ei } from "./main-BHtKhpBZ.js";
|
|
4
4
|
function zr(e) {
|
|
5
5
|
const t = [], n = String(e || "");
|
|
6
6
|
let r = n.indexOf(","), u = 0, i = !1;
|
|
@@ -16715,7 +16715,7 @@ const h1 = [
|
|
|
16715
16715
|
target: "_blank",
|
|
16716
16716
|
rel: "noopener noreferrer",
|
|
16717
16717
|
style: {
|
|
16718
|
-
color: "var(--ethora-color-primary, #0a66c2)",
|
|
16718
|
+
color: "var(--ethora-color-primary-text, var(--ethora-color-primary, #0a66c2))",
|
|
16719
16719
|
textDecoration: "none"
|
|
16720
16720
|
},
|
|
16721
16721
|
children: r
|
|
@@ -16855,7 +16855,7 @@ const h1 = [
|
|
|
16855
16855
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), o());
|
|
16856
16856
|
} : void 0,
|
|
16857
16857
|
style: {
|
|
16858
|
-
color: "var(--ethora-color-primary, #0052cd)",
|
|
16858
|
+
color: "var(--ethora-color-primary-text, var(--ethora-color-primary, #0052cd))",
|
|
16859
16859
|
fontWeight: 600,
|
|
16860
16860
|
cursor: t ? "pointer" : "default"
|
|
16861
16861
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useId as f, useRef as v } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { p as u, y as g, aI as m, aJ as w, B as b, aK as y, x as e, aL as D, aM as k } from "./main-BHtKhpBZ.js";
|
|
4
4
|
const c = 767, R = `${c}px`, z = e.div`
|
|
5
5
|
position: relative;
|
|
6
6
|
pointer-events: auto;
|
|
@@ -97,7 +97,7 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
97
97
|
font: inherit;
|
|
98
98
|
font-size: var(--ethora-font-size-xs, 13px);
|
|
99
99
|
font-weight: var(--ethora-font-weight-medium, 500);
|
|
100
|
-
color: var(--ethora-color-primary, #0052cd);
|
|
100
|
+
color: var(--ethora-color-primary-text, var(--ethora-color-primary, #0052cd));
|
|
101
101
|
align-self: center;
|
|
102
102
|
|
|
103
103
|
&:hover {
|
|
@@ -109,11 +109,11 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
109
109
|
outline-offset: 2px;
|
|
110
110
|
border-radius: var(--ethora-radius-sm, 8px);
|
|
111
111
|
}
|
|
112
|
-
`,
|
|
112
|
+
`, J = e.div`
|
|
113
113
|
height: 1px;
|
|
114
114
|
margin: 0 var(--ethora-space-4, 16px);
|
|
115
115
|
background-color: var(--ethora-color-border, #e6e8ec);
|
|
116
|
-
`,
|
|
116
|
+
`, V = e.div`
|
|
117
117
|
display: flex;
|
|
118
118
|
align-items: center;
|
|
119
119
|
gap: var(--ethora-space-2, 8px);
|
|
@@ -135,7 +135,7 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
135
135
|
& > svg {
|
|
136
136
|
flex: 0 0 auto;
|
|
137
137
|
}
|
|
138
|
-
`,
|
|
138
|
+
`, X = e.input`
|
|
139
139
|
flex: 1 1 auto;
|
|
140
140
|
min-width: 0;
|
|
141
141
|
border: none;
|
|
@@ -148,22 +148,22 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
148
148
|
&::placeholder {
|
|
149
149
|
color: var(--ethora-color-text-muted, #8c8c8c);
|
|
150
150
|
}
|
|
151
|
-
`,
|
|
151
|
+
`, q = e.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
flex-direction: column;
|
|
154
154
|
width: 100%;
|
|
155
|
-
`,
|
|
155
|
+
`, L = e.div`
|
|
156
156
|
font-size: var(--ethora-font-size-sm, 14px);
|
|
157
157
|
font-weight: var(--ethora-font-weight-medium, 500);
|
|
158
158
|
color: var(--ethora-color-text, #141414);
|
|
159
159
|
text-align: start;
|
|
160
|
-
`,
|
|
160
|
+
`, T = e.div`
|
|
161
161
|
font-size: var(--ethora-font-size-xs, 12px);
|
|
162
162
|
font-weight: var(--ethora-font-weight-regular, 400);
|
|
163
163
|
color: var(--ethora-color-text-muted, #8c8c8c);
|
|
164
164
|
text-align: start;
|
|
165
165
|
line-height: 1.4;
|
|
166
|
-
`,
|
|
166
|
+
`, C = e.button`
|
|
167
167
|
display: flex;
|
|
168
168
|
align-items: center;
|
|
169
169
|
gap: var(--ethora-space-3, 12px);
|
|
@@ -186,17 +186,17 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
186
186
|
outline: 2px solid var(--ethora-color-primary, #0052cd);
|
|
187
187
|
outline-offset: -2px;
|
|
188
188
|
}
|
|
189
|
-
`,
|
|
189
|
+
`, E = e.span`
|
|
190
190
|
display: flex;
|
|
191
191
|
flex-direction: column;
|
|
192
192
|
gap: var(--ethora-space-1, 4px);
|
|
193
193
|
flex: 1 1 auto;
|
|
194
194
|
min-width: 0;
|
|
195
|
-
`,
|
|
195
|
+
`, M = e.span`
|
|
196
196
|
flex: 0 0 auto;
|
|
197
197
|
display: inline-flex;
|
|
198
198
|
color: var(--ethora-color-text-muted, #8c8c8c);
|
|
199
|
-
`,
|
|
199
|
+
`, j = () => /* @__PURE__ */ o("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ o(
|
|
200
200
|
"path",
|
|
201
201
|
{
|
|
202
202
|
d: "M6 3.5L10.5 8L6 12.5",
|
|
@@ -205,16 +205,16 @@ const c = 767, R = `${c}px`, z = e.div`
|
|
|
205
205
|
strokeLinecap: "round",
|
|
206
206
|
strokeLinejoin: "round"
|
|
207
207
|
}
|
|
208
|
-
) }),
|
|
208
|
+
) }), G = ({
|
|
209
209
|
label: r,
|
|
210
210
|
hint: a,
|
|
211
211
|
onClick: t
|
|
212
|
-
}) => /* @__PURE__ */ i(
|
|
213
|
-
/* @__PURE__ */ i(
|
|
214
|
-
/* @__PURE__ */ o(
|
|
215
|
-
a && /* @__PURE__ */ o(
|
|
212
|
+
}) => /* @__PURE__ */ i(C, { type: "button", onClick: t, children: [
|
|
213
|
+
/* @__PURE__ */ i(E, { children: [
|
|
214
|
+
/* @__PURE__ */ o(L, { children: r }),
|
|
215
|
+
a && /* @__PURE__ */ o(T, { children: a })
|
|
216
216
|
] }),
|
|
217
|
-
/* @__PURE__ */ o(
|
|
217
|
+
/* @__PURE__ */ o(M, { "aria-hidden": "true", children: /* @__PURE__ */ o(j, {}) })
|
|
218
218
|
] }), Q = ({
|
|
219
219
|
title: r,
|
|
220
220
|
onClose: a,
|
|
@@ -257,14 +257,14 @@ export {
|
|
|
257
257
|
Q as S,
|
|
258
258
|
K as a,
|
|
259
259
|
O as b,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
J as c,
|
|
261
|
+
G as d,
|
|
262
262
|
W as e,
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
T as f,
|
|
264
|
+
L as g,
|
|
265
265
|
_ as h,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
V as i,
|
|
267
|
+
X as j,
|
|
268
|
+
q as k,
|
|
269
269
|
F as l
|
|
270
270
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as u, Fragment as $, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as ge, useState as I, useCallback as y, useImperativeHandle as ve, useRef as ae, useMemo as M } from "react";
|
|
3
|
-
import { a as be,
|
|
4
|
-
import { D as E, a as W, b as Ge, e as qe, f as _e, S as Qe } from "./SideDrawer-
|
|
5
|
-
import { P as ne, a as Ye, D as Ze, b as eo, h as oo } from "./handleCopyClick-
|
|
3
|
+
import { a as be, p as J, t as ye, v as xe, w as we, P as re, I as H, x as D, y as Ce, z as Se, C as Ie, D as te, E as De, F as Ne, G as ke, J as Ue, u as Q, K as Fe, L as Pe, N as Ae, O as Re, Q as Y, q as Z, R as ze, S as je, T as Be, s as $e, B as X, U as Ee, W as Oe, X as Te, Y as ee, Z as R, _ as Le, $ as Me, V as He, A as Xe, a0 as We, a1 as Je, a2 as Ke, a3 as Ve } from "./main-BHtKhpBZ.js";
|
|
4
|
+
import { D as E, a as W, b as Ge, e as qe, f as _e, S as Qe } from "./SideDrawer-DLqEOqAi.js";
|
|
5
|
+
import { P as ne, a as Ye, D as Ze, b as eo, h as oo } from "./handleCopyClick-CWw4UAlT.js";
|
|
6
6
|
const ao = (c, i) => {
|
|
7
7
|
const l = atob(c.split(",")[1]), g = new ArrayBuffer(l.length), e = new Uint8Array(g);
|
|
8
8
|
for (let r = 0; r < l.length; r++)
|