@blocklet/discuss-kit-ux 1.6.242 → 1.6.244
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/components/chat/hooks.d.ts +6 -0
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/input.d.ts +1 -0
- package/dist/{editor-N32Ffdew.mjs → editor-T5YWV1te.mjs} +1 -1
- package/dist/{index-Cy-AzaWZ.mjs → index-C30pyzPN.mjs} +977 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +62 -61
- package/dist/index.umd.js +1056 -147
- package/package.json +7 -4
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@arcblock/bridge"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@arcblock/bridge", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "semver-compare", "@arcblock/bridge", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.require$$0, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react, global.Empty$3, global.Session, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.ReactDOM, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.cmp, global.bridge, global.Fab, global.debounce, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, require$$0, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react, Empty$3, Session, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, ReactDOM, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, cmp, bridge, Fab, debounce, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -365,7 +365,7 @@ var __publicField = (obj, key, value) => {
|
|
|
365
365
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
366
366
|
function CmdEnterShortcutPlugin({ callback, shortcut = "CMD_ENTER" }) {
|
|
367
367
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
368
|
-
|
|
368
|
+
require$$0.useEffect(() => {
|
|
369
369
|
return editor2.registerCommand(
|
|
370
370
|
lexical$1.KEY_ENTER_COMMAND,
|
|
371
371
|
(e) => {
|
|
@@ -406,7 +406,7 @@ var __publicField = (obj, key, value) => {
|
|
|
406
406
|
}
|
|
407
407
|
function ImagePathFixerPlugin() {
|
|
408
408
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
409
|
-
|
|
409
|
+
require$$0.useEffect(() => {
|
|
410
410
|
return editor2.registerNodeTransform(ImageNode.ImageNode, imageNodeTransform);
|
|
411
411
|
}, [editor2]);
|
|
412
412
|
return null;
|
|
@@ -431,14 +431,14 @@ var __publicField = (obj, key, value) => {
|
|
|
431
431
|
}
|
|
432
432
|
function VideoPathFixerPlugin() {
|
|
433
433
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
434
|
-
|
|
434
|
+
require$$0.useEffect(() => {
|
|
435
435
|
return editor2.registerNodeTransform(VideoNode.VideoNode, VideoNodeTransform);
|
|
436
436
|
}, [editor2]);
|
|
437
437
|
return null;
|
|
438
438
|
}
|
|
439
439
|
function AutoClearPlugin({ value, isChanged }) {
|
|
440
440
|
const [editor2] = LexicalComposerContext.useLexicalComposerContext();
|
|
441
|
-
|
|
441
|
+
require$$0.useEffect(() => {
|
|
442
442
|
try {
|
|
443
443
|
if (!isChanged)
|
|
444
444
|
return;
|
|
@@ -463,11 +463,12 @@ var __publicField = (obj, key, value) => {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
const useMeasure = () => {
|
|
466
|
-
const ref =
|
|
466
|
+
const ref = require$$0.useRef(null);
|
|
467
467
|
const size = ahooks.useSize(ref);
|
|
468
468
|
return [ref, size || { width: 0, height: 0 }];
|
|
469
469
|
};
|
|
470
|
-
const BlockletEditor$3 =
|
|
470
|
+
const BlockletEditor$3 = reactLazyWithPreload.lazyWithPreload(() => import("@blocklet/editor"));
|
|
471
|
+
const preloadInput = () => BlockletEditor$3.preload();
|
|
471
472
|
const Input = ({
|
|
472
473
|
initialContent = "",
|
|
473
474
|
send,
|
|
@@ -483,11 +484,11 @@ var __publicField = (obj, key, value) => {
|
|
|
483
484
|
}) => {
|
|
484
485
|
var _a2;
|
|
485
486
|
const sessionKey = draftKey ? `${getDraftSessionKeyPrefix()}${draftKey}` : "";
|
|
486
|
-
const [content, setContent] =
|
|
487
|
-
const [error, setError] =
|
|
488
|
-
const [loading, setLoading] =
|
|
487
|
+
const [content, setContent] = require$$0.useState(null);
|
|
488
|
+
const [error, setError] = require$$0.useState("");
|
|
489
|
+
const [loading, setLoading] = require$$0.useState(false);
|
|
489
490
|
const [ref, { width }] = useMeasure();
|
|
490
|
-
const isChanged =
|
|
491
|
+
const isChanged = require$$0.useRef(false);
|
|
491
492
|
const editorConfig = config.useEditorConfig();
|
|
492
493
|
const inSmallView = width < 700;
|
|
493
494
|
const draftContent = sessionStorage.getItem(sessionKey);
|
|
@@ -572,7 +573,7 @@ var __publicField = (obj, key, value) => {
|
|
|
572
573
|
},
|
|
573
574
|
rest.sx
|
|
574
575
|
);
|
|
575
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ require$$0.createElement(material.Box, { ref, ...rest, key: draftKey, sx: mergedSx }, /* @__PURE__ */ jsxRuntime.jsx(config.EditorConfigProvider, { value: mergedEditorConfig, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
576
577
|
BlockletEditor$3,
|
|
577
578
|
{
|
|
578
579
|
placeholder,
|
|
@@ -611,7 +612,7 @@ var __publicField = (obj, key, value) => {
|
|
|
611
612
|
draftKey = "",
|
|
612
613
|
...rest
|
|
613
614
|
}) {
|
|
614
|
-
const { t } =
|
|
615
|
+
const { t } = require$$0.useContext(context.LocaleContext);
|
|
615
616
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
616
617
|
StyledInput,
|
|
617
618
|
{
|
|
@@ -689,7 +690,7 @@ var __publicField = (obj, key, value) => {
|
|
|
689
690
|
);
|
|
690
691
|
}
|
|
691
692
|
function PostEdit({ content, send, onCancel, onSuccess, ...rest }) {
|
|
692
|
-
const { t } =
|
|
693
|
+
const { t } = require$$0.useContext(context.LocaleContext);
|
|
693
694
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
694
695
|
Input,
|
|
695
696
|
{
|
|
@@ -884,7 +885,7 @@ var __publicField = (obj, key, value) => {
|
|
|
884
885
|
if (badgeIcon) {
|
|
885
886
|
const isHttpIcon = ["http", "/", "data"].some((prefix2) => badgeIcon.startsWith(prefix2));
|
|
886
887
|
if (!isHttpIcon) {
|
|
887
|
-
icon = /* @__PURE__ */ jsxRuntime.jsx(react
|
|
888
|
+
icon = /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { className: "badge-icon", icon: badgeIcon, color: badgeColor, style: { ...iconStyle } });
|
|
888
889
|
} else {
|
|
889
890
|
icon = /* @__PURE__ */ jsxRuntime.jsx(
|
|
890
891
|
Avatar$1,
|
|
@@ -957,9 +958,9 @@ var __publicField = (obj, key, value) => {
|
|
|
957
958
|
}
|
|
958
959
|
const useSessionContext = () => {
|
|
959
960
|
var _a2, _b2, _c, _d;
|
|
960
|
-
const ctx =
|
|
961
|
+
const ctx = require$$0.useContext(Session.SessionContext) || {};
|
|
961
962
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
962
|
-
const permissionSet =
|
|
963
|
+
const permissionSet = require$$0.useMemo(() => {
|
|
963
964
|
var _a3, _b3;
|
|
964
965
|
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
965
966
|
}, [(_d = (_c = ctx.session) == null ? void 0 : _c.user) == null ? void 0 : _d.permissions]);
|
|
@@ -989,9 +990,9 @@ var __publicField = (obj, key, value) => {
|
|
|
989
990
|
return a === b;
|
|
990
991
|
};
|
|
991
992
|
const useChanged = (values2, options) => {
|
|
992
|
-
const [trackingStarted, setTrackingStarted] =
|
|
993
|
-
const [changed, setChanged] =
|
|
994
|
-
const initialValues =
|
|
993
|
+
const [trackingStarted, setTrackingStarted] = require$$0.useState(false);
|
|
994
|
+
const [changed, setChanged] = require$$0.useState(false);
|
|
995
|
+
const initialValues = require$$0.useRef(values2);
|
|
995
996
|
const detectChanges = () => {
|
|
996
997
|
var _a2;
|
|
997
998
|
const changesDetected = Object.keys(initialValues.current).some(
|
|
@@ -1006,7 +1007,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1006
1007
|
initialValues.current = { ...values2, ...overrides };
|
|
1007
1008
|
detectChanges();
|
|
1008
1009
|
};
|
|
1009
|
-
|
|
1010
|
+
require$$0.useEffect(() => {
|
|
1010
1011
|
if (trackingStarted) {
|
|
1011
1012
|
detectChanges();
|
|
1012
1013
|
} else if (options.tracking(values2) && !trackingStarted) {
|
|
@@ -1017,9 +1018,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1017
1018
|
return { changed, reset, initialValues: initialValues.current };
|
|
1018
1019
|
};
|
|
1019
1020
|
const useNow = (interval = 1e3) => {
|
|
1020
|
-
const [time, setTime] =
|
|
1021
|
+
const [time, setTime] = require$$0.useState(/* @__PURE__ */ new Date());
|
|
1021
1022
|
const updateTime = () => setTime(/* @__PURE__ */ new Date());
|
|
1022
|
-
|
|
1023
|
+
require$$0.useEffect(() => {
|
|
1023
1024
|
const timer = setInterval(updateTime, interval);
|
|
1024
1025
|
return () => clearInterval(timer);
|
|
1025
1026
|
}, [interval]);
|
|
@@ -1163,7 +1164,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1163
1164
|
const theme = styles.useTheme();
|
|
1164
1165
|
const downMd = useMediaQuery(theme.breakpoints.down("md"));
|
|
1165
1166
|
const navigate = reactRouterDom.useNavigate();
|
|
1166
|
-
const [open, setOpen] =
|
|
1167
|
+
const [open, setOpen] = require$$0.useState(false);
|
|
1167
1168
|
const sm = size === "sm";
|
|
1168
1169
|
let fontSize = sm ? 12 : 14;
|
|
1169
1170
|
let avatarSize = profileUse ? 24 : sm ? 40 : 48;
|
|
@@ -1175,7 +1176,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1175
1176
|
if (!createdAt) {
|
|
1176
1177
|
return null;
|
|
1177
1178
|
}
|
|
1178
|
-
if (
|
|
1179
|
+
if (require$$0.isValidElement(createdAt)) {
|
|
1179
1180
|
return createdAt;
|
|
1180
1181
|
}
|
|
1181
1182
|
createdAt = typeof createdAt === "string" ? new Date(createdAt) : createdAt;
|
|
@@ -1331,7 +1332,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1331
1332
|
`;
|
|
1332
1333
|
function ViewMore({ children, ...rest }) {
|
|
1333
1334
|
const { t } = context.useLocaleContext();
|
|
1334
|
-
const [collapsed, setCollapsed] =
|
|
1335
|
+
const [collapsed, setCollapsed] = require$$0.useState(true);
|
|
1335
1336
|
const [ref, { height }] = useMeasure();
|
|
1336
1337
|
const _collapsed = collapsed && height > MAX_HEIGHT;
|
|
1337
1338
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$3, { ...rest, className: `${rest.className || ""} ${_collapsed ? "markdown-viewer-collapsed" : ""}`, children: [
|
|
@@ -1356,7 +1357,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1356
1357
|
)
|
|
1357
1358
|
] });
|
|
1358
1359
|
}
|
|
1359
|
-
const BlockletEditor$2 =
|
|
1360
|
+
const BlockletEditor$2 = require$$0.lazy(() => import("@blocklet/editor"));
|
|
1360
1361
|
const StyledBlockletEditor = styles.styled(BlockletEditor$2)`
|
|
1361
1362
|
.editor-scroller {
|
|
1362
1363
|
min-height: initial;
|
|
@@ -1388,7 +1389,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1388
1389
|
);
|
|
1389
1390
|
}
|
|
1390
1391
|
if (!autoCollapse) {
|
|
1391
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1392
|
+
return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1392
1393
|
StyledBlockletEditor,
|
|
1393
1394
|
{
|
|
1394
1395
|
editable: false,
|
|
@@ -1403,7 +1404,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1403
1404
|
}
|
|
1404
1405
|
) });
|
|
1405
1406
|
}
|
|
1406
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1407
|
+
return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsx(ViewMore, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1407
1408
|
StyledBlockletEditor,
|
|
1408
1409
|
{
|
|
1409
1410
|
editable: false,
|
|
@@ -1425,7 +1426,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1425
1426
|
}
|
|
1426
1427
|
`;
|
|
1427
1428
|
function Menu({ items = [], ...rest }) {
|
|
1428
|
-
const [anchorEl, setAnchorEl] =
|
|
1429
|
+
const [anchorEl, setAnchorEl] = require$$0.useState(null);
|
|
1429
1430
|
const open = Boolean(anchorEl);
|
|
1430
1431
|
const handleClick = (event) => {
|
|
1431
1432
|
setAnchorEl(event.currentTarget);
|
|
@@ -1518,10 +1519,10 @@ var __publicField = (obj, key, value) => {
|
|
|
1518
1519
|
const isAuthor = post.author.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
1519
1520
|
const commentUrl = window.location.hash.substring(1);
|
|
1520
1521
|
const { t } = context.useLocaleContext();
|
|
1521
|
-
const [editing, setEditing] =
|
|
1522
|
+
const [editing, setEditing] = require$$0.useState(false);
|
|
1522
1523
|
const postContext = { isAdmin, isAuthor, interactive, post };
|
|
1523
1524
|
const [inViewport] = ahooks.useInViewport(() => document == null ? void 0 : document.getElementById(post.id));
|
|
1524
|
-
const [hasEnteredViewport, setHasEnteredViewport] =
|
|
1525
|
+
const [hasEnteredViewport, setHasEnteredViewport] = require$$0.useState(false);
|
|
1525
1526
|
let menuItems = [];
|
|
1526
1527
|
if (isAuthor && !post.deletedAt) {
|
|
1527
1528
|
menuItems.push(
|
|
@@ -1557,7 +1558,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1557
1558
|
systemTip = t("emptyContent");
|
|
1558
1559
|
}
|
|
1559
1560
|
const showSystemTip = systemTip && !editing;
|
|
1560
|
-
|
|
1561
|
+
require$$0.useEffect(() => {
|
|
1561
1562
|
if (inViewport) {
|
|
1562
1563
|
setHasEnteredViewport(inViewport);
|
|
1563
1564
|
}
|
|
@@ -1661,7 +1662,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1661
1662
|
countPerValue: { ...prevState.countPerValue, [value]: (prevState.countPerValue[value] || 0) + inc }
|
|
1662
1663
|
}));
|
|
1663
1664
|
};
|
|
1664
|
-
|
|
1665
|
+
require$$0.useEffect(() => {
|
|
1665
1666
|
setState({
|
|
1666
1667
|
countPerValue: countPerValue || {},
|
|
1667
1668
|
selectedValue
|
|
@@ -1701,15 +1702,15 @@ var __publicField = (obj, key, value) => {
|
|
|
1701
1702
|
const values = ["1", "-1"];
|
|
1702
1703
|
function BinaryThumb({ data = [], variant = "default", size = "sm", ...rest }) {
|
|
1703
1704
|
const { session } = useSessionContext();
|
|
1704
|
-
const [raterListVisible, setRaterListVisible] =
|
|
1705
|
-
const [loading, setLoading] =
|
|
1706
|
-
const countPerValue =
|
|
1705
|
+
const [raterListVisible, setRaterListVisible] = require$$0.useState(null);
|
|
1706
|
+
const [loading, setLoading] = require$$0.useState(false);
|
|
1707
|
+
const countPerValue = require$$0.useMemo(() => {
|
|
1707
1708
|
return data.reduce((acc, cur) => {
|
|
1708
1709
|
acc[cur.value] = (acc[cur.value] || 0) + 1;
|
|
1709
1710
|
return acc;
|
|
1710
1711
|
}, {});
|
|
1711
1712
|
}, [data]);
|
|
1712
|
-
const selectedValue =
|
|
1713
|
+
const selectedValue = require$$0.useMemo(() => {
|
|
1713
1714
|
var _a2;
|
|
1714
1715
|
return (_a2 = data.find((x) => {
|
|
1715
1716
|
var _a3, _b2;
|
|
@@ -1867,9 +1868,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1867
1868
|
...rest
|
|
1868
1869
|
}) {
|
|
1869
1870
|
const { session } = useSessionContext();
|
|
1870
|
-
const [open, setOpen] =
|
|
1871
|
-
const [raters, setRaters] =
|
|
1872
|
-
const [myReaction, setMyReaction] =
|
|
1871
|
+
const [open, setOpen] = require$$0.useState(false);
|
|
1872
|
+
const [raters, setRaters] = require$$0.useState(null);
|
|
1873
|
+
const [myReaction, setMyReaction] = require$$0.useState(null);
|
|
1873
1874
|
const options = [
|
|
1874
1875
|
{ value: "thumbs_up", label: "👍" },
|
|
1875
1876
|
{ value: "thumbs_down", label: "👎" },
|
|
@@ -1880,7 +1881,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1880
1881
|
{ value: "rocket", label: "🚀" },
|
|
1881
1882
|
{ value: "eyes", label: "👀" }
|
|
1882
1883
|
];
|
|
1883
|
-
const ratings =
|
|
1884
|
+
const ratings = require$$0.useMemo(() => {
|
|
1884
1885
|
var _a2;
|
|
1885
1886
|
const mapped = data.map((x) => {
|
|
1886
1887
|
var _a3;
|
|
@@ -1897,7 +1898,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1897
1898
|
}
|
|
1898
1899
|
return mapped;
|
|
1899
1900
|
}, [data, myReaction, session.user]);
|
|
1900
|
-
const countPerValue =
|
|
1901
|
+
const countPerValue = require$$0.useMemo(() => {
|
|
1901
1902
|
return ratings.reduce((acc, cur) => {
|
|
1902
1903
|
cur.value.forEach((item) => {
|
|
1903
1904
|
acc[item] = (acc[item] || 0) + 1;
|
|
@@ -1905,14 +1906,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1905
1906
|
return acc;
|
|
1906
1907
|
}, {});
|
|
1907
1908
|
}, [ratings]);
|
|
1908
|
-
const selectedValues =
|
|
1909
|
+
const selectedValues = require$$0.useMemo(() => {
|
|
1909
1910
|
var _a2;
|
|
1910
1911
|
return ((_a2 = ratings.find((x) => {
|
|
1911
1912
|
var _a3, _b2;
|
|
1912
1913
|
return ((_a3 = x.rater) == null ? void 0 : _a3.did) === ((_b2 = session == null ? void 0 : session.user) == null ? void 0 : _b2.did);
|
|
1913
1914
|
})) == null ? void 0 : _a2.value) || [];
|
|
1914
1915
|
}, [ratings, session.user]);
|
|
1915
|
-
const selectedValuesMap =
|
|
1916
|
+
const selectedValuesMap = require$$0.useMemo(() => {
|
|
1916
1917
|
return selectedValues.reduce((acc, cur) => ({ ...acc, [cur]: true }), {});
|
|
1917
1918
|
}, [selectedValues]);
|
|
1918
1919
|
const toggleRate = (value) => {
|
|
@@ -2081,7 +2082,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2081
2082
|
const fullScreen = material.useMediaQuery(theme.breakpoints.down("md"));
|
|
2082
2083
|
const { t } = context.useLocaleContext();
|
|
2083
2084
|
const renderDesc = () => {
|
|
2084
|
-
if (
|
|
2085
|
+
if (require$$0.isValidElement(description)) {
|
|
2085
2086
|
return description;
|
|
2086
2087
|
}
|
|
2087
2088
|
return /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { children: description });
|
|
@@ -2105,12 +2106,12 @@ var __publicField = (obj, key, value) => {
|
|
|
2105
2106
|
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: renderActions() })
|
|
2106
2107
|
] });
|
|
2107
2108
|
}
|
|
2108
|
-
const ConfirmContext =
|
|
2109
|
-
const useConfirm = () =>
|
|
2109
|
+
const ConfirmContext = require$$0.createContext({});
|
|
2110
|
+
const useConfirm = () => require$$0.useContext(ConfirmContext);
|
|
2110
2111
|
function ConfirmProvider({ children }) {
|
|
2111
|
-
const [open, setOpen] =
|
|
2112
|
-
const [currentOptions, setCurrentOptions] =
|
|
2113
|
-
const resolver =
|
|
2112
|
+
const [open, setOpen] = require$$0.useState(false);
|
|
2113
|
+
const [currentOptions, setCurrentOptions] = require$$0.useState({});
|
|
2114
|
+
const resolver = require$$0.useRef();
|
|
2114
2115
|
const handleOk = () => {
|
|
2115
2116
|
var _a2;
|
|
2116
2117
|
(_a2 = resolver.current) == null ? void 0 : _a2.call(resolver, true);
|
|
@@ -2128,7 +2129,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2128
2129
|
resolver.current = resolve;
|
|
2129
2130
|
});
|
|
2130
2131
|
};
|
|
2131
|
-
const value =
|
|
2132
|
+
const value = require$$0.useMemo(
|
|
2132
2133
|
() => ({
|
|
2133
2134
|
open,
|
|
2134
2135
|
confirm
|
|
@@ -2167,7 +2168,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2167
2168
|
}) {
|
|
2168
2169
|
const { session } = useSessionContext();
|
|
2169
2170
|
const { t } = context.useLocaleContext();
|
|
2170
|
-
const [inputVisible, setInputVisible] =
|
|
2171
|
+
const [inputVisible, setInputVisible] = require$$0.useState(false);
|
|
2171
2172
|
const { confirm } = useConfirm();
|
|
2172
2173
|
const handleDelete = async (...args) => {
|
|
2173
2174
|
const proceed = await confirm({
|
|
@@ -2308,9 +2309,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2308
2309
|
return sorted;
|
|
2309
2310
|
};
|
|
2310
2311
|
const useAutoScroll = (data, containerHeight) => {
|
|
2311
|
-
const highlightedRef =
|
|
2312
|
-
const lastHeightRef =
|
|
2313
|
-
const autoScrolledRef =
|
|
2312
|
+
const highlightedRef = require$$0.useRef(window.location.hash.substring(1));
|
|
2313
|
+
const lastHeightRef = require$$0.useRef(containerHeight);
|
|
2314
|
+
const autoScrolledRef = require$$0.useRef(false);
|
|
2314
2315
|
const matchTargetedPost = (posts) => {
|
|
2315
2316
|
return posts.some((item) => {
|
|
2316
2317
|
var _a2;
|
|
@@ -2330,7 +2331,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2330
2331
|
lastHeightRef.current = containerHeight;
|
|
2331
2332
|
return false;
|
|
2332
2333
|
};
|
|
2333
|
-
|
|
2334
|
+
require$$0.useEffect(() => {
|
|
2334
2335
|
let interval;
|
|
2335
2336
|
if (containerHeight && !autoScrolledRef.current) {
|
|
2336
2337
|
interval = window.setInterval(() => {
|
|
@@ -2351,8 +2352,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2351
2352
|
};
|
|
2352
2353
|
}, [containerHeight]);
|
|
2353
2354
|
};
|
|
2354
|
-
const CommentsContext =
|
|
2355
|
-
const useCommentsContext = () =>
|
|
2355
|
+
const CommentsContext = require$$0.createContext({});
|
|
2356
|
+
const useCommentsContext = () => require$$0.useContext(CommentsContext);
|
|
2356
2357
|
function CommentsProvider({
|
|
2357
2358
|
target,
|
|
2358
2359
|
api,
|
|
@@ -2369,7 +2370,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2369
2370
|
var _a2;
|
|
2370
2371
|
const [state, setState] = ahooks.useSetState(getInitialState(order ? { order } : {}));
|
|
2371
2372
|
const containerHeight = (_a2 = ahooks.useSize(containerRef)) == null ? void 0 : _a2.height;
|
|
2372
|
-
const commentsKeyById =
|
|
2373
|
+
const commentsKeyById = require$$0.useMemo(() => {
|
|
2373
2374
|
return state.comments.reduce((acc, cur) => {
|
|
2374
2375
|
var _a3;
|
|
2375
2376
|
acc[cur.id] = cur;
|
|
@@ -2381,10 +2382,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2381
2382
|
return acc;
|
|
2382
2383
|
}, {});
|
|
2383
2384
|
}, [state]);
|
|
2384
|
-
const highlightedRef =
|
|
2385
|
+
const highlightedRef = require$$0.useRef(window.location.hash.substring(1));
|
|
2385
2386
|
const limit = 15;
|
|
2386
2387
|
const initialRepliesLimit = -1;
|
|
2387
|
-
|
|
2388
|
+
require$$0.useEffect(() => {
|
|
2388
2389
|
const init = async () => {
|
|
2389
2390
|
if (!autoLoadComments) {
|
|
2390
2391
|
setState({ initialized: true });
|
|
@@ -2543,7 +2544,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2543
2544
|
setTimeout(() => add(result), 800);
|
|
2544
2545
|
};
|
|
2545
2546
|
const findById = (id2) => commentsKeyById[id2];
|
|
2546
|
-
const value =
|
|
2547
|
+
const value = require$$0.useMemo(
|
|
2547
2548
|
() => ({
|
|
2548
2549
|
target,
|
|
2549
2550
|
state,
|
|
@@ -2597,7 +2598,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2597
2598
|
const hiddenComments = highlighted.position - comments.findIndex((item) => item.id === highlighted.id) + headIndex;
|
|
2598
2599
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...rest, className: "comment-list", children: [
|
|
2599
2600
|
comments.map((comment) => {
|
|
2600
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2601
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(require$$0.Fragment, { children: [
|
|
2601
2602
|
comment.id === (highlighted == null ? void 0 : highlighted.id) && hiddenComments > 0 && nextCursor && /* @__PURE__ */ jsxRuntime.jsx(LoadMoreButtonWrapper, { sx: { my: 4, textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2602
2603
|
Box,
|
|
2603
2604
|
{
|
|
@@ -2719,10 +2720,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2719
2720
|
}
|
|
2720
2721
|
return result;
|
|
2721
2722
|
};
|
|
2722
|
-
const UploaderComponent =
|
|
2723
|
-
const UploaderContext =
|
|
2723
|
+
const UploaderComponent = require$$0.lazy(() => import("@blocklet/uploader/react").then((res) => ({ default: res.Uploader })));
|
|
2724
|
+
const UploaderContext = require$$0.createContext(null);
|
|
2724
2725
|
function useUploader() {
|
|
2725
|
-
const uploaderRef =
|
|
2726
|
+
const uploaderRef = require$$0.useContext(UploaderContext);
|
|
2726
2727
|
if (!uploaderRef) {
|
|
2727
2728
|
throw new Error("useUploader must be used within an UploaderProvider");
|
|
2728
2729
|
}
|
|
@@ -2755,7 +2756,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2755
2756
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { onClick: handleOpen, children });
|
|
2756
2757
|
}
|
|
2757
2758
|
function UploaderProvider({ children }) {
|
|
2758
|
-
const uploaderRef =
|
|
2759
|
+
const uploaderRef = require$$0.useRef(null);
|
|
2759
2760
|
window.uploaderRef = uploaderRef;
|
|
2760
2761
|
return /* @__PURE__ */ jsxRuntime.jsxs(UploaderContext.Provider, { value: uploaderRef, children: [
|
|
2761
2762
|
children,
|
|
@@ -2791,8 +2792,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2791
2792
|
fallback,
|
|
2792
2793
|
...rest
|
|
2793
2794
|
}) {
|
|
2794
|
-
const [loaded, setLoaded] =
|
|
2795
|
-
const [errored, setErrored] =
|
|
2795
|
+
const [loaded, setLoaded] = require$$0.useState(false);
|
|
2796
|
+
const [errored, setErrored] = require$$0.useState(false);
|
|
2796
2797
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2797
2798
|
material.Box,
|
|
2798
2799
|
{
|
|
@@ -3137,7 +3138,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3137
3138
|
}
|
|
3138
3139
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, children: content });
|
|
3139
3140
|
}
|
|
3140
|
-
const BlogCard =
|
|
3141
|
+
const BlogCard = require$$0.forwardRef(
|
|
3141
3142
|
({ post, hideAuthor, linkTarget, compactLayout, loading = false }, ref) => {
|
|
3142
3143
|
if (loading) {
|
|
3143
3144
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { display: "flex", justifyContent: "center", color: "inherit", textDecoration: "none" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3427,22 +3428,22 @@ var __publicField = (obj, key, value) => {
|
|
|
3427
3428
|
}
|
|
3428
3429
|
) });
|
|
3429
3430
|
}
|
|
3430
|
-
const AuthzContext =
|
|
3431
|
+
const AuthzContext = require$$0.createContext({
|
|
3431
3432
|
permissions: [],
|
|
3432
3433
|
hasPermission: () => false,
|
|
3433
3434
|
isAdmin: false,
|
|
3434
3435
|
hasAnyPassport: () => false
|
|
3435
3436
|
});
|
|
3436
|
-
const useAuthzContext = () =>
|
|
3437
|
+
const useAuthzContext = () => require$$0.useContext(AuthzContext);
|
|
3437
3438
|
const AuthzProvider = ({ ...rest }) => {
|
|
3438
3439
|
var _a2;
|
|
3439
3440
|
const { session, isAdmin, hasAnyPassport } = useSessionContext();
|
|
3440
|
-
const permissions =
|
|
3441
|
+
const permissions = require$$0.useMemo(() => {
|
|
3441
3442
|
var _a3;
|
|
3442
3443
|
return ((_a3 = session == null ? void 0 : session.user) == null ? void 0 : _a3.permissions) || [];
|
|
3443
3444
|
}, [(_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.permissions]);
|
|
3444
|
-
const permissionSet =
|
|
3445
|
-
const hasPermission =
|
|
3445
|
+
const permissionSet = require$$0.useMemo(() => new Set(permissions), [permissions]);
|
|
3446
|
+
const hasPermission = require$$0.useCallback(
|
|
3446
3447
|
(perms) => {
|
|
3447
3448
|
if (!perms || perms.length === 0) {
|
|
3448
3449
|
return true;
|
|
@@ -3452,7 +3453,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3452
3453
|
},
|
|
3453
3454
|
[permissionSet]
|
|
3454
3455
|
);
|
|
3455
|
-
const value =
|
|
3456
|
+
const value = require$$0.useMemo(
|
|
3456
3457
|
() => ({ permissions, hasPermission, isAdmin, hasAnyPassport }),
|
|
3457
3458
|
[hasPermission, permissions, isAdmin, hasAnyPassport]
|
|
3458
3459
|
);
|
|
@@ -3511,24 +3512,24 @@ var __publicField = (obj, key, value) => {
|
|
|
3511
3512
|
}
|
|
3512
3513
|
}
|
|
3513
3514
|
const iconoirChatBubbleEmpty = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12c0 1.821.487 3.53 1.338 5L2.5 21.5l4.5-.838A9.955 9.955 0 0 0 12 22Z" }) });
|
|
3514
|
-
const UnreadNotificationContext =
|
|
3515
|
+
const UnreadNotificationContext = require$$0.createContext(
|
|
3515
3516
|
{}
|
|
3516
3517
|
);
|
|
3517
|
-
const useUnreadNotification = () =>
|
|
3518
|
+
const useUnreadNotification = () => require$$0.useContext(UnreadNotificationContext);
|
|
3518
3519
|
function UnreadNotificationProvider({ fetchUnreadState, children }) {
|
|
3519
3520
|
const { session } = useSessionContext();
|
|
3520
|
-
const [unread, setUnread] =
|
|
3521
|
-
const markAsUnread =
|
|
3521
|
+
const [unread, setUnread] = require$$0.useState(false);
|
|
3522
|
+
const markAsUnread = require$$0.useCallback((value2 = true) => setUnread(value2), []);
|
|
3522
3523
|
const update = async () => {
|
|
3523
3524
|
const unreadState = await fetchUnreadState();
|
|
3524
3525
|
setUnread(unreadState);
|
|
3525
3526
|
};
|
|
3526
|
-
|
|
3527
|
+
require$$0.useEffect(() => {
|
|
3527
3528
|
if (session.user && !preferences.disableNotificationBadge) {
|
|
3528
3529
|
update();
|
|
3529
3530
|
}
|
|
3530
3531
|
}, [session.user]);
|
|
3531
|
-
const value =
|
|
3532
|
+
const value = require$$0.useMemo(
|
|
3532
3533
|
() => ({
|
|
3533
3534
|
unread,
|
|
3534
3535
|
markAsUnread
|
|
@@ -3538,8 +3539,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3538
3539
|
);
|
|
3539
3540
|
return /* @__PURE__ */ jsxRuntime.jsx(UnreadNotificationContext.Provider, { value, children });
|
|
3540
3541
|
}
|
|
3541
|
-
const ChatContext =
|
|
3542
|
-
const useChatContext = () =>
|
|
3542
|
+
const ChatContext = require$$0.createContext({});
|
|
3543
|
+
const useChatContext = () => require$$0.useContext(ChatContext);
|
|
3543
3544
|
const uniqAndSort = (list, order = "asc") => {
|
|
3544
3545
|
const unique = uniqBy(list, "id");
|
|
3545
3546
|
const sorted = orderBy(unique, ["createdAt", "id"], [order, order]);
|
|
@@ -3556,7 +3557,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3556
3557
|
const navigate = reactRouterDom.useNavigate();
|
|
3557
3558
|
const { session } = useSessionContext();
|
|
3558
3559
|
const currentUser = session == null ? void 0 : session.user;
|
|
3559
|
-
const orderedChats =
|
|
3560
|
+
const orderedChats = require$$0.useMemo(() => {
|
|
3560
3561
|
return orderBy(state.chats, (x) => x.lastMessageAt || "", "desc");
|
|
3561
3562
|
}, [state.chats]);
|
|
3562
3563
|
const hasUnreadMessages = ({ lastMessageAt, lastAckTime }) => {
|
|
@@ -3565,7 +3566,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3565
3566
|
}
|
|
3566
3567
|
return false;
|
|
3567
3568
|
};
|
|
3568
|
-
const hasAnyUnreadMessages =
|
|
3569
|
+
const hasAnyUnreadMessages = require$$0.useMemo(
|
|
3569
3570
|
() => state.chats.filter((chat) => chat.type !== "channel" || chat.hasJoined).some(hasUnreadMessages),
|
|
3570
3571
|
[state.chats]
|
|
3571
3572
|
);
|
|
@@ -3738,7 +3739,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3738
3739
|
addChat(chat);
|
|
3739
3740
|
return chat;
|
|
3740
3741
|
};
|
|
3741
|
-
|
|
3742
|
+
require$$0.useEffect(() => {
|
|
3742
3743
|
if (currentUser == null ? void 0 : currentUser.did) {
|
|
3743
3744
|
init();
|
|
3744
3745
|
} else {
|
|
@@ -3751,7 +3752,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3751
3752
|
}
|
|
3752
3753
|
return () => client2.destroy();
|
|
3753
3754
|
}, [currentUser == null ? void 0 : currentUser.did]);
|
|
3754
|
-
|
|
3755
|
+
require$$0.useEffect(() => {
|
|
3755
3756
|
if (activeChatId) {
|
|
3756
3757
|
if (activeChatId !== state.activeChatId) {
|
|
3757
3758
|
const matched = state.chats.find((chat) => chat.id === activeChatId);
|
|
@@ -3763,7 +3764,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3763
3764
|
setState((prev) => ({ ...prev, activeChatId: void 0 }));
|
|
3764
3765
|
}
|
|
3765
3766
|
}, [state, activeChatId]);
|
|
3766
|
-
|
|
3767
|
+
require$$0.useEffect(() => {
|
|
3767
3768
|
const cancels = [
|
|
3768
3769
|
client2.onMessage(({ chatId, message }) => {
|
|
3769
3770
|
addMessage(chatId, message);
|
|
@@ -3782,12 +3783,12 @@ var __publicField = (obj, key, value) => {
|
|
|
3782
3783
|
cancels.forEach((cancel) => cancel == null ? void 0 : cancel());
|
|
3783
3784
|
};
|
|
3784
3785
|
}, [state]);
|
|
3785
|
-
|
|
3786
|
+
require$$0.useEffect(() => {
|
|
3786
3787
|
if (state.initialized) {
|
|
3787
3788
|
markAsUnread(hasAnyUnreadMessages);
|
|
3788
3789
|
}
|
|
3789
3790
|
}, [state.initialized, hasAnyUnreadMessages, markAsUnread]);
|
|
3790
|
-
const value =
|
|
3791
|
+
const value = require$$0.useMemo(() => {
|
|
3791
3792
|
return {
|
|
3792
3793
|
...state,
|
|
3793
3794
|
client: client2,
|
|
@@ -3845,9 +3846,915 @@ var __publicField = (obj, key, value) => {
|
|
|
3845
3846
|
] })
|
|
3846
3847
|
] });
|
|
3847
3848
|
}
|
|
3849
|
+
function getAugmentedNamespace(n) {
|
|
3850
|
+
if (n.__esModule)
|
|
3851
|
+
return n;
|
|
3852
|
+
var f = n.default;
|
|
3853
|
+
if (typeof f == "function") {
|
|
3854
|
+
var a = function a2() {
|
|
3855
|
+
if (this instanceof a2) {
|
|
3856
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
3857
|
+
}
|
|
3858
|
+
return f.apply(this, arguments);
|
|
3859
|
+
};
|
|
3860
|
+
a.prototype = f.prototype;
|
|
3861
|
+
} else
|
|
3862
|
+
a = {};
|
|
3863
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
3864
|
+
Object.keys(n).forEach(function(k) {
|
|
3865
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
3866
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
3867
|
+
enumerable: true,
|
|
3868
|
+
get: function() {
|
|
3869
|
+
return n[k];
|
|
3870
|
+
}
|
|
3871
|
+
});
|
|
3872
|
+
});
|
|
3873
|
+
return a;
|
|
3874
|
+
}
|
|
3875
|
+
var lib = {};
|
|
3876
|
+
var useInterval$1 = {};
|
|
3877
|
+
Object.defineProperty(useInterval$1, "__esModule", {
|
|
3878
|
+
value: true
|
|
3879
|
+
});
|
|
3880
|
+
useInterval$1.default = useInterval;
|
|
3881
|
+
var _react$2 = require$$0;
|
|
3882
|
+
function useInterval(callback, delay) {
|
|
3883
|
+
const savedCallback = (0, _react$2.useRef)();
|
|
3884
|
+
(0, _react$2.useEffect)(() => {
|
|
3885
|
+
savedCallback.current = callback;
|
|
3886
|
+
}, [callback]);
|
|
3887
|
+
(0, _react$2.useEffect)(() => {
|
|
3888
|
+
function tick() {
|
|
3889
|
+
savedCallback.current();
|
|
3890
|
+
}
|
|
3891
|
+
if (delay !== null) {
|
|
3892
|
+
const id2 = setInterval(tick, delay);
|
|
3893
|
+
return () => clearInterval(id2);
|
|
3894
|
+
}
|
|
3895
|
+
}, [delay]);
|
|
3896
|
+
}
|
|
3897
|
+
var useStorage$1 = {};
|
|
3898
|
+
const privateData = /* @__PURE__ */ new WeakMap();
|
|
3899
|
+
const wrappers = /* @__PURE__ */ new WeakMap();
|
|
3900
|
+
function pd(event) {
|
|
3901
|
+
const retv = privateData.get(event);
|
|
3902
|
+
console.assert(
|
|
3903
|
+
retv != null,
|
|
3904
|
+
"'this' is expected an Event object, but got",
|
|
3905
|
+
event
|
|
3906
|
+
);
|
|
3907
|
+
return retv;
|
|
3908
|
+
}
|
|
3909
|
+
function setCancelFlag(data) {
|
|
3910
|
+
if (data.passiveListener != null) {
|
|
3911
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
3912
|
+
console.error(
|
|
3913
|
+
"Unable to preventDefault inside passive event listener invocation.",
|
|
3914
|
+
data.passiveListener
|
|
3915
|
+
);
|
|
3916
|
+
}
|
|
3917
|
+
return;
|
|
3918
|
+
}
|
|
3919
|
+
if (!data.event.cancelable) {
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3922
|
+
data.canceled = true;
|
|
3923
|
+
if (typeof data.event.preventDefault === "function") {
|
|
3924
|
+
data.event.preventDefault();
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
function Event(eventTarget, event) {
|
|
3928
|
+
privateData.set(this, {
|
|
3929
|
+
eventTarget,
|
|
3930
|
+
event,
|
|
3931
|
+
eventPhase: 2,
|
|
3932
|
+
currentTarget: eventTarget,
|
|
3933
|
+
canceled: false,
|
|
3934
|
+
stopped: false,
|
|
3935
|
+
immediateStopped: false,
|
|
3936
|
+
passiveListener: null,
|
|
3937
|
+
timeStamp: event.timeStamp || Date.now()
|
|
3938
|
+
});
|
|
3939
|
+
Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
|
|
3940
|
+
const keys = Object.keys(event);
|
|
3941
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
3942
|
+
const key = keys[i];
|
|
3943
|
+
if (!(key in this)) {
|
|
3944
|
+
Object.defineProperty(this, key, defineRedirectDescriptor(key));
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
}
|
|
3948
|
+
Event.prototype = {
|
|
3949
|
+
/**
|
|
3950
|
+
* The type of this event.
|
|
3951
|
+
* @type {string}
|
|
3952
|
+
*/
|
|
3953
|
+
get type() {
|
|
3954
|
+
return pd(this).event.type;
|
|
3955
|
+
},
|
|
3956
|
+
/**
|
|
3957
|
+
* The target of this event.
|
|
3958
|
+
* @type {EventTarget}
|
|
3959
|
+
*/
|
|
3960
|
+
get target() {
|
|
3961
|
+
return pd(this).eventTarget;
|
|
3962
|
+
},
|
|
3963
|
+
/**
|
|
3964
|
+
* The target of this event.
|
|
3965
|
+
* @type {EventTarget}
|
|
3966
|
+
*/
|
|
3967
|
+
get currentTarget() {
|
|
3968
|
+
return pd(this).currentTarget;
|
|
3969
|
+
},
|
|
3970
|
+
/**
|
|
3971
|
+
* @returns {EventTarget[]} The composed path of this event.
|
|
3972
|
+
*/
|
|
3973
|
+
composedPath() {
|
|
3974
|
+
const currentTarget = pd(this).currentTarget;
|
|
3975
|
+
if (currentTarget == null) {
|
|
3976
|
+
return [];
|
|
3977
|
+
}
|
|
3978
|
+
return [currentTarget];
|
|
3979
|
+
},
|
|
3980
|
+
/**
|
|
3981
|
+
* Constant of NONE.
|
|
3982
|
+
* @type {number}
|
|
3983
|
+
*/
|
|
3984
|
+
get NONE() {
|
|
3985
|
+
return 0;
|
|
3986
|
+
},
|
|
3987
|
+
/**
|
|
3988
|
+
* Constant of CAPTURING_PHASE.
|
|
3989
|
+
* @type {number}
|
|
3990
|
+
*/
|
|
3991
|
+
get CAPTURING_PHASE() {
|
|
3992
|
+
return 1;
|
|
3993
|
+
},
|
|
3994
|
+
/**
|
|
3995
|
+
* Constant of AT_TARGET.
|
|
3996
|
+
* @type {number}
|
|
3997
|
+
*/
|
|
3998
|
+
get AT_TARGET() {
|
|
3999
|
+
return 2;
|
|
4000
|
+
},
|
|
4001
|
+
/**
|
|
4002
|
+
* Constant of BUBBLING_PHASE.
|
|
4003
|
+
* @type {number}
|
|
4004
|
+
*/
|
|
4005
|
+
get BUBBLING_PHASE() {
|
|
4006
|
+
return 3;
|
|
4007
|
+
},
|
|
4008
|
+
/**
|
|
4009
|
+
* The target of this event.
|
|
4010
|
+
* @type {number}
|
|
4011
|
+
*/
|
|
4012
|
+
get eventPhase() {
|
|
4013
|
+
return pd(this).eventPhase;
|
|
4014
|
+
},
|
|
4015
|
+
/**
|
|
4016
|
+
* Stop event bubbling.
|
|
4017
|
+
* @returns {void}
|
|
4018
|
+
*/
|
|
4019
|
+
stopPropagation() {
|
|
4020
|
+
const data = pd(this);
|
|
4021
|
+
data.stopped = true;
|
|
4022
|
+
if (typeof data.event.stopPropagation === "function") {
|
|
4023
|
+
data.event.stopPropagation();
|
|
4024
|
+
}
|
|
4025
|
+
},
|
|
4026
|
+
/**
|
|
4027
|
+
* Stop event bubbling.
|
|
4028
|
+
* @returns {void}
|
|
4029
|
+
*/
|
|
4030
|
+
stopImmediatePropagation() {
|
|
4031
|
+
const data = pd(this);
|
|
4032
|
+
data.stopped = true;
|
|
4033
|
+
data.immediateStopped = true;
|
|
4034
|
+
if (typeof data.event.stopImmediatePropagation === "function") {
|
|
4035
|
+
data.event.stopImmediatePropagation();
|
|
4036
|
+
}
|
|
4037
|
+
},
|
|
4038
|
+
/**
|
|
4039
|
+
* The flag to be bubbling.
|
|
4040
|
+
* @type {boolean}
|
|
4041
|
+
*/
|
|
4042
|
+
get bubbles() {
|
|
4043
|
+
return Boolean(pd(this).event.bubbles);
|
|
4044
|
+
},
|
|
4045
|
+
/**
|
|
4046
|
+
* The flag to be cancelable.
|
|
4047
|
+
* @type {boolean}
|
|
4048
|
+
*/
|
|
4049
|
+
get cancelable() {
|
|
4050
|
+
return Boolean(pd(this).event.cancelable);
|
|
4051
|
+
},
|
|
4052
|
+
/**
|
|
4053
|
+
* Cancel this event.
|
|
4054
|
+
* @returns {void}
|
|
4055
|
+
*/
|
|
4056
|
+
preventDefault() {
|
|
4057
|
+
setCancelFlag(pd(this));
|
|
4058
|
+
},
|
|
4059
|
+
/**
|
|
4060
|
+
* The flag to indicate cancellation state.
|
|
4061
|
+
* @type {boolean}
|
|
4062
|
+
*/
|
|
4063
|
+
get defaultPrevented() {
|
|
4064
|
+
return pd(this).canceled;
|
|
4065
|
+
},
|
|
4066
|
+
/**
|
|
4067
|
+
* The flag to be composed.
|
|
4068
|
+
* @type {boolean}
|
|
4069
|
+
*/
|
|
4070
|
+
get composed() {
|
|
4071
|
+
return Boolean(pd(this).event.composed);
|
|
4072
|
+
},
|
|
4073
|
+
/**
|
|
4074
|
+
* The unix time of this event.
|
|
4075
|
+
* @type {number}
|
|
4076
|
+
*/
|
|
4077
|
+
get timeStamp() {
|
|
4078
|
+
return pd(this).timeStamp;
|
|
4079
|
+
},
|
|
4080
|
+
/**
|
|
4081
|
+
* The target of this event.
|
|
4082
|
+
* @type {EventTarget}
|
|
4083
|
+
* @deprecated
|
|
4084
|
+
*/
|
|
4085
|
+
get srcElement() {
|
|
4086
|
+
return pd(this).eventTarget;
|
|
4087
|
+
},
|
|
4088
|
+
/**
|
|
4089
|
+
* The flag to stop event bubbling.
|
|
4090
|
+
* @type {boolean}
|
|
4091
|
+
* @deprecated
|
|
4092
|
+
*/
|
|
4093
|
+
get cancelBubble() {
|
|
4094
|
+
return pd(this).stopped;
|
|
4095
|
+
},
|
|
4096
|
+
set cancelBubble(value) {
|
|
4097
|
+
if (!value) {
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
const data = pd(this);
|
|
4101
|
+
data.stopped = true;
|
|
4102
|
+
if (typeof data.event.cancelBubble === "boolean") {
|
|
4103
|
+
data.event.cancelBubble = true;
|
|
4104
|
+
}
|
|
4105
|
+
},
|
|
4106
|
+
/**
|
|
4107
|
+
* The flag to indicate cancellation state.
|
|
4108
|
+
* @type {boolean}
|
|
4109
|
+
* @deprecated
|
|
4110
|
+
*/
|
|
4111
|
+
get returnValue() {
|
|
4112
|
+
return !pd(this).canceled;
|
|
4113
|
+
},
|
|
4114
|
+
set returnValue(value) {
|
|
4115
|
+
if (!value) {
|
|
4116
|
+
setCancelFlag(pd(this));
|
|
4117
|
+
}
|
|
4118
|
+
},
|
|
4119
|
+
/**
|
|
4120
|
+
* Initialize this event object. But do nothing under event dispatching.
|
|
4121
|
+
* @param {string} type The event type.
|
|
4122
|
+
* @param {boolean} [bubbles=false] The flag to be possible to bubble up.
|
|
4123
|
+
* @param {boolean} [cancelable=false] The flag to be possible to cancel.
|
|
4124
|
+
* @deprecated
|
|
4125
|
+
*/
|
|
4126
|
+
initEvent() {
|
|
4127
|
+
}
|
|
4128
|
+
};
|
|
4129
|
+
Object.defineProperty(Event.prototype, "constructor", {
|
|
4130
|
+
value: Event,
|
|
4131
|
+
configurable: true,
|
|
4132
|
+
writable: true
|
|
4133
|
+
});
|
|
4134
|
+
if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
|
|
4135
|
+
Object.setPrototypeOf(Event.prototype, window.Event.prototype);
|
|
4136
|
+
wrappers.set(window.Event.prototype, Event);
|
|
4137
|
+
}
|
|
4138
|
+
function defineRedirectDescriptor(key) {
|
|
4139
|
+
return {
|
|
4140
|
+
get() {
|
|
4141
|
+
return pd(this).event[key];
|
|
4142
|
+
},
|
|
4143
|
+
set(value) {
|
|
4144
|
+
pd(this).event[key] = value;
|
|
4145
|
+
},
|
|
4146
|
+
configurable: true,
|
|
4147
|
+
enumerable: true
|
|
4148
|
+
};
|
|
4149
|
+
}
|
|
4150
|
+
function defineCallDescriptor(key) {
|
|
4151
|
+
return {
|
|
4152
|
+
value() {
|
|
4153
|
+
const event = pd(this).event;
|
|
4154
|
+
return event[key].apply(event, arguments);
|
|
4155
|
+
},
|
|
4156
|
+
configurable: true,
|
|
4157
|
+
enumerable: true
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
4160
|
+
function defineWrapper(BaseEvent, proto) {
|
|
4161
|
+
const keys = Object.keys(proto);
|
|
4162
|
+
if (keys.length === 0) {
|
|
4163
|
+
return BaseEvent;
|
|
4164
|
+
}
|
|
4165
|
+
function CustomEvent2(eventTarget, event) {
|
|
4166
|
+
BaseEvent.call(this, eventTarget, event);
|
|
4167
|
+
}
|
|
4168
|
+
CustomEvent2.prototype = Object.create(BaseEvent.prototype, {
|
|
4169
|
+
constructor: { value: CustomEvent2, configurable: true, writable: true }
|
|
4170
|
+
});
|
|
4171
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
4172
|
+
const key = keys[i];
|
|
4173
|
+
if (!(key in BaseEvent.prototype)) {
|
|
4174
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
4175
|
+
const isFunc = typeof descriptor.value === "function";
|
|
4176
|
+
Object.defineProperty(
|
|
4177
|
+
CustomEvent2.prototype,
|
|
4178
|
+
key,
|
|
4179
|
+
isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)
|
|
4180
|
+
);
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
return CustomEvent2;
|
|
4184
|
+
}
|
|
4185
|
+
function getWrapper(proto) {
|
|
4186
|
+
if (proto == null || proto === Object.prototype) {
|
|
4187
|
+
return Event;
|
|
4188
|
+
}
|
|
4189
|
+
let wrapper = wrappers.get(proto);
|
|
4190
|
+
if (wrapper == null) {
|
|
4191
|
+
wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
|
|
4192
|
+
wrappers.set(proto, wrapper);
|
|
4193
|
+
}
|
|
4194
|
+
return wrapper;
|
|
4195
|
+
}
|
|
4196
|
+
function wrapEvent(eventTarget, event) {
|
|
4197
|
+
const Wrapper = getWrapper(Object.getPrototypeOf(event));
|
|
4198
|
+
return new Wrapper(eventTarget, event);
|
|
4199
|
+
}
|
|
4200
|
+
function isStopped(event) {
|
|
4201
|
+
return pd(event).immediateStopped;
|
|
4202
|
+
}
|
|
4203
|
+
function setEventPhase(event, eventPhase) {
|
|
4204
|
+
pd(event).eventPhase = eventPhase;
|
|
4205
|
+
}
|
|
4206
|
+
function setCurrentTarget(event, currentTarget) {
|
|
4207
|
+
pd(event).currentTarget = currentTarget;
|
|
4208
|
+
}
|
|
4209
|
+
function setPassiveListener(event, passiveListener) {
|
|
4210
|
+
pd(event).passiveListener = passiveListener;
|
|
4211
|
+
}
|
|
4212
|
+
const listenersMap = /* @__PURE__ */ new WeakMap();
|
|
4213
|
+
const CAPTURE = 1;
|
|
4214
|
+
const BUBBLE = 2;
|
|
4215
|
+
const ATTRIBUTE = 3;
|
|
4216
|
+
function isObject(x) {
|
|
4217
|
+
return x !== null && typeof x === "object";
|
|
4218
|
+
}
|
|
4219
|
+
function getListeners(eventTarget) {
|
|
4220
|
+
const listeners = listenersMap.get(eventTarget);
|
|
4221
|
+
if (listeners == null) {
|
|
4222
|
+
throw new TypeError(
|
|
4223
|
+
"'this' is expected an EventTarget object, but got another value."
|
|
4224
|
+
);
|
|
4225
|
+
}
|
|
4226
|
+
return listeners;
|
|
4227
|
+
}
|
|
4228
|
+
function defineEventAttributeDescriptor(eventName) {
|
|
4229
|
+
return {
|
|
4230
|
+
get() {
|
|
4231
|
+
const listeners = getListeners(this);
|
|
4232
|
+
let node = listeners.get(eventName);
|
|
4233
|
+
while (node != null) {
|
|
4234
|
+
if (node.listenerType === ATTRIBUTE) {
|
|
4235
|
+
return node.listener;
|
|
4236
|
+
}
|
|
4237
|
+
node = node.next;
|
|
4238
|
+
}
|
|
4239
|
+
return null;
|
|
4240
|
+
},
|
|
4241
|
+
set(listener) {
|
|
4242
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
4243
|
+
listener = null;
|
|
4244
|
+
}
|
|
4245
|
+
const listeners = getListeners(this);
|
|
4246
|
+
let prev = null;
|
|
4247
|
+
let node = listeners.get(eventName);
|
|
4248
|
+
while (node != null) {
|
|
4249
|
+
if (node.listenerType === ATTRIBUTE) {
|
|
4250
|
+
if (prev !== null) {
|
|
4251
|
+
prev.next = node.next;
|
|
4252
|
+
} else if (node.next !== null) {
|
|
4253
|
+
listeners.set(eventName, node.next);
|
|
4254
|
+
} else {
|
|
4255
|
+
listeners.delete(eventName);
|
|
4256
|
+
}
|
|
4257
|
+
} else {
|
|
4258
|
+
prev = node;
|
|
4259
|
+
}
|
|
4260
|
+
node = node.next;
|
|
4261
|
+
}
|
|
4262
|
+
if (listener !== null) {
|
|
4263
|
+
const newNode = {
|
|
4264
|
+
listener,
|
|
4265
|
+
listenerType: ATTRIBUTE,
|
|
4266
|
+
passive: false,
|
|
4267
|
+
once: false,
|
|
4268
|
+
next: null
|
|
4269
|
+
};
|
|
4270
|
+
if (prev === null) {
|
|
4271
|
+
listeners.set(eventName, newNode);
|
|
4272
|
+
} else {
|
|
4273
|
+
prev.next = newNode;
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
},
|
|
4277
|
+
configurable: true,
|
|
4278
|
+
enumerable: true
|
|
4279
|
+
};
|
|
4280
|
+
}
|
|
4281
|
+
function defineEventAttribute(eventTargetPrototype, eventName) {
|
|
4282
|
+
Object.defineProperty(
|
|
4283
|
+
eventTargetPrototype,
|
|
4284
|
+
`on${eventName}`,
|
|
4285
|
+
defineEventAttributeDescriptor(eventName)
|
|
4286
|
+
);
|
|
4287
|
+
}
|
|
4288
|
+
function defineCustomEventTarget(eventNames) {
|
|
4289
|
+
function CustomEventTarget() {
|
|
4290
|
+
EventTarget.call(this);
|
|
4291
|
+
}
|
|
4292
|
+
CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
|
|
4293
|
+
constructor: {
|
|
4294
|
+
value: CustomEventTarget,
|
|
4295
|
+
configurable: true,
|
|
4296
|
+
writable: true
|
|
4297
|
+
}
|
|
4298
|
+
});
|
|
4299
|
+
for (let i = 0; i < eventNames.length; ++i) {
|
|
4300
|
+
defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
|
|
4301
|
+
}
|
|
4302
|
+
return CustomEventTarget;
|
|
4303
|
+
}
|
|
4304
|
+
function EventTarget() {
|
|
4305
|
+
if (this instanceof EventTarget) {
|
|
4306
|
+
listenersMap.set(this, /* @__PURE__ */ new Map());
|
|
4307
|
+
return;
|
|
4308
|
+
}
|
|
4309
|
+
if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
|
4310
|
+
return defineCustomEventTarget(arguments[0]);
|
|
4311
|
+
}
|
|
4312
|
+
if (arguments.length > 0) {
|
|
4313
|
+
const types = new Array(arguments.length);
|
|
4314
|
+
for (let i = 0; i < arguments.length; ++i) {
|
|
4315
|
+
types[i] = arguments[i];
|
|
4316
|
+
}
|
|
4317
|
+
return defineCustomEventTarget(types);
|
|
4318
|
+
}
|
|
4319
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4320
|
+
}
|
|
4321
|
+
EventTarget.prototype = {
|
|
4322
|
+
/**
|
|
4323
|
+
* Add a given listener to this event target.
|
|
4324
|
+
* @param {string} eventName The event name to add.
|
|
4325
|
+
* @param {Function} listener The listener to add.
|
|
4326
|
+
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
|
|
4327
|
+
* @returns {void}
|
|
4328
|
+
*/
|
|
4329
|
+
addEventListener(eventName, listener, options) {
|
|
4330
|
+
if (listener == null) {
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4333
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
4334
|
+
throw new TypeError("'listener' should be a function or an object.");
|
|
4335
|
+
}
|
|
4336
|
+
const listeners = getListeners(this);
|
|
4337
|
+
const optionsIsObj = isObject(options);
|
|
4338
|
+
const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
|
|
4339
|
+
const listenerType = capture ? CAPTURE : BUBBLE;
|
|
4340
|
+
const newNode = {
|
|
4341
|
+
listener,
|
|
4342
|
+
listenerType,
|
|
4343
|
+
passive: optionsIsObj && Boolean(options.passive),
|
|
4344
|
+
once: optionsIsObj && Boolean(options.once),
|
|
4345
|
+
next: null
|
|
4346
|
+
};
|
|
4347
|
+
let node = listeners.get(eventName);
|
|
4348
|
+
if (node === void 0) {
|
|
4349
|
+
listeners.set(eventName, newNode);
|
|
4350
|
+
return;
|
|
4351
|
+
}
|
|
4352
|
+
let prev = null;
|
|
4353
|
+
while (node != null) {
|
|
4354
|
+
if (node.listener === listener && node.listenerType === listenerType) {
|
|
4355
|
+
return;
|
|
4356
|
+
}
|
|
4357
|
+
prev = node;
|
|
4358
|
+
node = node.next;
|
|
4359
|
+
}
|
|
4360
|
+
prev.next = newNode;
|
|
4361
|
+
},
|
|
4362
|
+
/**
|
|
4363
|
+
* Remove a given listener from this event target.
|
|
4364
|
+
* @param {string} eventName The event name to remove.
|
|
4365
|
+
* @param {Function} listener The listener to remove.
|
|
4366
|
+
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
|
|
4367
|
+
* @returns {void}
|
|
4368
|
+
*/
|
|
4369
|
+
removeEventListener(eventName, listener, options) {
|
|
4370
|
+
if (listener == null) {
|
|
4371
|
+
return;
|
|
4372
|
+
}
|
|
4373
|
+
const listeners = getListeners(this);
|
|
4374
|
+
const capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
|
|
4375
|
+
const listenerType = capture ? CAPTURE : BUBBLE;
|
|
4376
|
+
let prev = null;
|
|
4377
|
+
let node = listeners.get(eventName);
|
|
4378
|
+
while (node != null) {
|
|
4379
|
+
if (node.listener === listener && node.listenerType === listenerType) {
|
|
4380
|
+
if (prev !== null) {
|
|
4381
|
+
prev.next = node.next;
|
|
4382
|
+
} else if (node.next !== null) {
|
|
4383
|
+
listeners.set(eventName, node.next);
|
|
4384
|
+
} else {
|
|
4385
|
+
listeners.delete(eventName);
|
|
4386
|
+
}
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
prev = node;
|
|
4390
|
+
node = node.next;
|
|
4391
|
+
}
|
|
4392
|
+
},
|
|
4393
|
+
/**
|
|
4394
|
+
* Dispatch a given event.
|
|
4395
|
+
* @param {Event|{type:string}} event The event to dispatch.
|
|
4396
|
+
* @returns {boolean} `false` if canceled.
|
|
4397
|
+
*/
|
|
4398
|
+
dispatchEvent(event) {
|
|
4399
|
+
if (event == null || typeof event.type !== "string") {
|
|
4400
|
+
throw new TypeError('"event.type" should be a string.');
|
|
4401
|
+
}
|
|
4402
|
+
const listeners = getListeners(this);
|
|
4403
|
+
const eventName = event.type;
|
|
4404
|
+
let node = listeners.get(eventName);
|
|
4405
|
+
if (node == null) {
|
|
4406
|
+
return true;
|
|
4407
|
+
}
|
|
4408
|
+
const wrappedEvent = wrapEvent(this, event);
|
|
4409
|
+
let prev = null;
|
|
4410
|
+
while (node != null) {
|
|
4411
|
+
if (node.once) {
|
|
4412
|
+
if (prev !== null) {
|
|
4413
|
+
prev.next = node.next;
|
|
4414
|
+
} else if (node.next !== null) {
|
|
4415
|
+
listeners.set(eventName, node.next);
|
|
4416
|
+
} else {
|
|
4417
|
+
listeners.delete(eventName);
|
|
4418
|
+
}
|
|
4419
|
+
} else {
|
|
4420
|
+
prev = node;
|
|
4421
|
+
}
|
|
4422
|
+
setPassiveListener(
|
|
4423
|
+
wrappedEvent,
|
|
4424
|
+
node.passive ? node.listener : null
|
|
4425
|
+
);
|
|
4426
|
+
if (typeof node.listener === "function") {
|
|
4427
|
+
try {
|
|
4428
|
+
node.listener.call(this, wrappedEvent);
|
|
4429
|
+
} catch (err) {
|
|
4430
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
4431
|
+
console.error(err);
|
|
4432
|
+
}
|
|
4433
|
+
}
|
|
4434
|
+
} else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
|
|
4435
|
+
node.listener.handleEvent(wrappedEvent);
|
|
4436
|
+
}
|
|
4437
|
+
if (isStopped(wrappedEvent)) {
|
|
4438
|
+
break;
|
|
4439
|
+
}
|
|
4440
|
+
node = node.next;
|
|
4441
|
+
}
|
|
4442
|
+
setPassiveListener(wrappedEvent, null);
|
|
4443
|
+
setEventPhase(wrappedEvent, 0);
|
|
4444
|
+
setCurrentTarget(wrappedEvent, null);
|
|
4445
|
+
return !wrappedEvent.defaultPrevented;
|
|
4446
|
+
}
|
|
4447
|
+
};
|
|
4448
|
+
Object.defineProperty(EventTarget.prototype, "constructor", {
|
|
4449
|
+
value: EventTarget,
|
|
4450
|
+
configurable: true,
|
|
4451
|
+
writable: true
|
|
4452
|
+
});
|
|
4453
|
+
if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
|
|
4454
|
+
Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
|
|
4455
|
+
}
|
|
4456
|
+
const eventTargetShim = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4457
|
+
__proto__: null,
|
|
4458
|
+
EventTarget,
|
|
4459
|
+
default: EventTarget,
|
|
4460
|
+
defineEventAttribute
|
|
4461
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4462
|
+
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(eventTargetShim);
|
|
4463
|
+
Object.defineProperty(useStorage$1, "__esModule", {
|
|
4464
|
+
value: true
|
|
4465
|
+
});
|
|
4466
|
+
useStorage$1.default = useStorage;
|
|
4467
|
+
var _react$1 = require$$0;
|
|
4468
|
+
var _eventTargetShim = require$$1$1;
|
|
4469
|
+
const evtTarget = new _eventTargetShim.EventTarget();
|
|
4470
|
+
function useStorage(storage, keyPrefix) {
|
|
4471
|
+
return (key, defaultValue) => {
|
|
4472
|
+
const storeKey = "".concat(keyPrefix, ".").concat(key);
|
|
4473
|
+
const raw = storage.getItem(storeKey);
|
|
4474
|
+
const [value, setValue] = (0, _react$1.useState)(raw ? JSON.parse(raw) : defaultValue);
|
|
4475
|
+
const updater = (updatedValue) => {
|
|
4476
|
+
setValue(updatedValue);
|
|
4477
|
+
storage.setItem(storeKey, JSON.stringify(updatedValue));
|
|
4478
|
+
evtTarget.dispatchEvent(new CustomEvent("storage_change", {
|
|
4479
|
+
detail: {
|
|
4480
|
+
key
|
|
4481
|
+
}
|
|
4482
|
+
}));
|
|
4483
|
+
};
|
|
4484
|
+
if (defaultValue != null && !raw) {
|
|
4485
|
+
updater(defaultValue);
|
|
4486
|
+
}
|
|
4487
|
+
(0, _react$1.useEffect)(() => {
|
|
4488
|
+
const listener = (_ref) => {
|
|
4489
|
+
let {
|
|
4490
|
+
detail
|
|
4491
|
+
} = _ref;
|
|
4492
|
+
if (detail.key === key) {
|
|
4493
|
+
const _raw = storage.getItem(storeKey);
|
|
4494
|
+
if (_raw !== raw) {
|
|
4495
|
+
setValue(JSON.parse(_raw));
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
};
|
|
4499
|
+
evtTarget.addEventListener("storage_change", listener);
|
|
4500
|
+
return () => evtTarget.removeEventListener("storage_change", listener);
|
|
4501
|
+
});
|
|
4502
|
+
return [value, updater];
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
var useBrowser$1 = {};
|
|
4506
|
+
var appleIphone = /iPhone/i;
|
|
4507
|
+
var appleIpod = /iPod/i;
|
|
4508
|
+
var appleTablet = /iPad/i;
|
|
4509
|
+
var appleUniversal = /\biOS-universal(?:.+)Mac\b/i;
|
|
4510
|
+
var androidPhone = /\bAndroid(?:.+)Mobile\b/i;
|
|
4511
|
+
var androidTablet = /Android/i;
|
|
4512
|
+
var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i;
|
|
4513
|
+
var amazonTablet = /Silk/i;
|
|
4514
|
+
var windowsPhone = /Windows Phone/i;
|
|
4515
|
+
var windowsTablet = /\bWindows(?:.+)ARM\b/i;
|
|
4516
|
+
var otherBlackBerry = /BlackBerry/i;
|
|
4517
|
+
var otherBlackBerry10 = /BB10/i;
|
|
4518
|
+
var otherOpera = /Opera Mini/i;
|
|
4519
|
+
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
|
|
4520
|
+
var otherFirefox = /Mobile(?:.+)Firefox\b/i;
|
|
4521
|
+
var isAppleTabletOnIos13 = function(navigator2) {
|
|
4522
|
+
return typeof navigator2 !== "undefined" && navigator2.platform === "MacIntel" && typeof navigator2.maxTouchPoints === "number" && navigator2.maxTouchPoints > 1 && typeof MSStream === "undefined";
|
|
4523
|
+
};
|
|
4524
|
+
function createMatch(userAgent) {
|
|
4525
|
+
return function(regex) {
|
|
4526
|
+
return regex.test(userAgent);
|
|
4527
|
+
};
|
|
4528
|
+
}
|
|
4529
|
+
function isMobile(param) {
|
|
4530
|
+
var nav = {
|
|
4531
|
+
userAgent: "",
|
|
4532
|
+
platform: "",
|
|
4533
|
+
maxTouchPoints: 0
|
|
4534
|
+
};
|
|
4535
|
+
if (!param && typeof navigator !== "undefined") {
|
|
4536
|
+
nav = {
|
|
4537
|
+
userAgent: navigator.userAgent,
|
|
4538
|
+
platform: navigator.platform,
|
|
4539
|
+
maxTouchPoints: navigator.maxTouchPoints || 0
|
|
4540
|
+
};
|
|
4541
|
+
} else if (typeof param === "string") {
|
|
4542
|
+
nav.userAgent = param;
|
|
4543
|
+
} else if (param && param.userAgent) {
|
|
4544
|
+
nav = {
|
|
4545
|
+
userAgent: param.userAgent,
|
|
4546
|
+
platform: param.platform,
|
|
4547
|
+
maxTouchPoints: param.maxTouchPoints || 0
|
|
4548
|
+
};
|
|
4549
|
+
}
|
|
4550
|
+
var userAgent = nav.userAgent;
|
|
4551
|
+
var tmp = userAgent.split("[FBAN");
|
|
4552
|
+
if (typeof tmp[1] !== "undefined") {
|
|
4553
|
+
userAgent = tmp[0];
|
|
4554
|
+
}
|
|
4555
|
+
tmp = userAgent.split("Twitter");
|
|
4556
|
+
if (typeof tmp[1] !== "undefined") {
|
|
4557
|
+
userAgent = tmp[0];
|
|
4558
|
+
}
|
|
4559
|
+
var match = createMatch(userAgent);
|
|
4560
|
+
var result = {
|
|
4561
|
+
apple: {
|
|
4562
|
+
phone: match(appleIphone) && !match(windowsPhone),
|
|
4563
|
+
ipod: match(appleIpod),
|
|
4564
|
+
tablet: !match(appleIphone) && (match(appleTablet) || isAppleTabletOnIos13(nav)) && !match(windowsPhone),
|
|
4565
|
+
universal: match(appleUniversal),
|
|
4566
|
+
device: (match(appleIphone) || match(appleIpod) || match(appleTablet) || match(appleUniversal) || isAppleTabletOnIos13(nav)) && !match(windowsPhone)
|
|
4567
|
+
},
|
|
4568
|
+
amazon: {
|
|
4569
|
+
phone: match(amazonPhone),
|
|
4570
|
+
tablet: !match(amazonPhone) && match(amazonTablet),
|
|
4571
|
+
device: match(amazonPhone) || match(amazonTablet)
|
|
4572
|
+
},
|
|
4573
|
+
android: {
|
|
4574
|
+
phone: !match(windowsPhone) && match(amazonPhone) || !match(windowsPhone) && match(androidPhone),
|
|
4575
|
+
tablet: !match(windowsPhone) && !match(amazonPhone) && !match(androidPhone) && (match(amazonTablet) || match(androidTablet)),
|
|
4576
|
+
device: !match(windowsPhone) && (match(amazonPhone) || match(amazonTablet) || match(androidPhone) || match(androidTablet)) || match(/\bokhttp\b/i)
|
|
4577
|
+
},
|
|
4578
|
+
windows: {
|
|
4579
|
+
phone: match(windowsPhone),
|
|
4580
|
+
tablet: match(windowsTablet),
|
|
4581
|
+
device: match(windowsPhone) || match(windowsTablet)
|
|
4582
|
+
},
|
|
4583
|
+
other: {
|
|
4584
|
+
blackberry: match(otherBlackBerry),
|
|
4585
|
+
blackberry10: match(otherBlackBerry10),
|
|
4586
|
+
opera: match(otherOpera),
|
|
4587
|
+
firefox: match(otherFirefox),
|
|
4588
|
+
chrome: match(otherChrome),
|
|
4589
|
+
device: match(otherBlackBerry) || match(otherBlackBerry10) || match(otherOpera) || match(otherFirefox) || match(otherChrome)
|
|
4590
|
+
},
|
|
4591
|
+
any: false,
|
|
4592
|
+
phone: false,
|
|
4593
|
+
tablet: false
|
|
4594
|
+
};
|
|
4595
|
+
result.any = result.apple.device || result.android.device || result.windows.device || result.other.device;
|
|
4596
|
+
result.phone = result.apple.phone || result.android.phone || result.windows.phone;
|
|
4597
|
+
result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;
|
|
4598
|
+
return result;
|
|
4599
|
+
}
|
|
4600
|
+
const esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4601
|
+
__proto__: null,
|
|
4602
|
+
default: isMobile
|
|
4603
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4604
|
+
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(esm);
|
|
4605
|
+
Object.defineProperty(useBrowser$1, "__esModule", {
|
|
4606
|
+
value: true
|
|
4607
|
+
});
|
|
4608
|
+
useBrowser$1.default = useBrowser;
|
|
4609
|
+
var _react = require$$0;
|
|
4610
|
+
var _ismobilejs = _interopRequireDefault(require$$1);
|
|
4611
|
+
function _interopRequireDefault(obj) {
|
|
4612
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
4613
|
+
}
|
|
4614
|
+
function ownKeys(e, r) {
|
|
4615
|
+
var t = Object.keys(e);
|
|
4616
|
+
if (Object.getOwnPropertySymbols) {
|
|
4617
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4618
|
+
r && (o = o.filter(function(r2) {
|
|
4619
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4620
|
+
})), t.push.apply(t, o);
|
|
4621
|
+
}
|
|
4622
|
+
return t;
|
|
4623
|
+
}
|
|
4624
|
+
function _objectSpread(e) {
|
|
4625
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4626
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4627
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
4628
|
+
_defineProperty(e, r2, t[r2]);
|
|
4629
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
4630
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
return e;
|
|
4634
|
+
}
|
|
4635
|
+
function _defineProperty(obj, key, value) {
|
|
4636
|
+
key = _toPropertyKey(key);
|
|
4637
|
+
if (key in obj) {
|
|
4638
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
4639
|
+
} else {
|
|
4640
|
+
obj[key] = value;
|
|
4641
|
+
}
|
|
4642
|
+
return obj;
|
|
4643
|
+
}
|
|
4644
|
+
function _toPropertyKey(t) {
|
|
4645
|
+
var i = _toPrimitive(t, "string");
|
|
4646
|
+
return "symbol" == typeof i ? i : String(i);
|
|
4647
|
+
}
|
|
4648
|
+
function _toPrimitive(t, r) {
|
|
4649
|
+
if ("object" != typeof t || !t)
|
|
4650
|
+
return t;
|
|
4651
|
+
var e = t[Symbol.toPrimitive];
|
|
4652
|
+
if (void 0 !== e) {
|
|
4653
|
+
var i = e.call(t, r || "default");
|
|
4654
|
+
if ("object" != typeof i)
|
|
4655
|
+
return i;
|
|
4656
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4657
|
+
}
|
|
4658
|
+
return ("string" === r ? String : Number)(t);
|
|
4659
|
+
}
|
|
4660
|
+
const DID_WALLET_TAG = "ABTWallet";
|
|
4661
|
+
function getDIDWalletVersion(userAgent) {
|
|
4662
|
+
var _result$groups;
|
|
4663
|
+
const reg = new RegExp("".concat(DID_WALLET_TAG, "/(?<version>[0-9.]+)"), "g");
|
|
4664
|
+
const result = reg.exec(userAgent);
|
|
4665
|
+
const version = result === null || result === void 0 ? void 0 : (_result$groups = result.groups) === null || _result$groups === void 0 ? void 0 : _result$groups.version;
|
|
4666
|
+
return version;
|
|
4667
|
+
}
|
|
4668
|
+
function useBrowser() {
|
|
4669
|
+
var _window, _window$navigator;
|
|
4670
|
+
const userAgent = (_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent;
|
|
4671
|
+
const [browser] = (0, _react.useState)({
|
|
4672
|
+
wallet: userAgent.indexOf(DID_WALLET_TAG) > -1,
|
|
4673
|
+
walletVersion: getDIDWalletVersion(userAgent),
|
|
4674
|
+
wechat: /MicroMessenger/i.test(userAgent),
|
|
4675
|
+
mobile: _objectSpread({
|
|
4676
|
+
apple: {
|
|
4677
|
+
phone: false,
|
|
4678
|
+
ipod: false,
|
|
4679
|
+
tablet: false,
|
|
4680
|
+
device: false
|
|
4681
|
+
},
|
|
4682
|
+
amazon: {
|
|
4683
|
+
phone: false,
|
|
4684
|
+
tablet: false,
|
|
4685
|
+
device: false
|
|
4686
|
+
},
|
|
4687
|
+
android: {
|
|
4688
|
+
phone: false,
|
|
4689
|
+
tablet: false,
|
|
4690
|
+
device: false
|
|
4691
|
+
},
|
|
4692
|
+
windows: {
|
|
4693
|
+
phone: false,
|
|
4694
|
+
tablet: false,
|
|
4695
|
+
device: false
|
|
4696
|
+
},
|
|
4697
|
+
other: {
|
|
4698
|
+
blackberry: false,
|
|
4699
|
+
blackberry10: false,
|
|
4700
|
+
opera: false,
|
|
4701
|
+
firefox: false,
|
|
4702
|
+
chrome: false,
|
|
4703
|
+
device: false
|
|
4704
|
+
},
|
|
4705
|
+
phone: false,
|
|
4706
|
+
tablet: false,
|
|
4707
|
+
any: false
|
|
4708
|
+
}, (0, _ismobilejs.default)(userAgent))
|
|
4709
|
+
});
|
|
4710
|
+
return browser;
|
|
4711
|
+
}
|
|
4712
|
+
(function(exports3) {
|
|
4713
|
+
Object.defineProperty(exports3, "__esModule", {
|
|
4714
|
+
value: true
|
|
4715
|
+
});
|
|
4716
|
+
Object.defineProperty(exports3, "useBrowser", {
|
|
4717
|
+
enumerable: true,
|
|
4718
|
+
get: function get() {
|
|
4719
|
+
return _useBrowser.default;
|
|
4720
|
+
}
|
|
4721
|
+
});
|
|
4722
|
+
Object.defineProperty(exports3, "useInterval", {
|
|
4723
|
+
enumerable: true,
|
|
4724
|
+
get: function get() {
|
|
4725
|
+
return _useInterval.default;
|
|
4726
|
+
}
|
|
4727
|
+
});
|
|
4728
|
+
Object.defineProperty(exports3, "useStorage", {
|
|
4729
|
+
enumerable: true,
|
|
4730
|
+
get: function get() {
|
|
4731
|
+
return _useStorage.default;
|
|
4732
|
+
}
|
|
4733
|
+
});
|
|
4734
|
+
var _useInterval = _interopRequireDefault2(useInterval$1);
|
|
4735
|
+
var _useStorage = _interopRequireDefault2(useStorage$1);
|
|
4736
|
+
var _useBrowser = _interopRequireDefault2(useBrowser$1);
|
|
4737
|
+
function _interopRequireDefault2(obj) {
|
|
4738
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
4739
|
+
}
|
|
4740
|
+
})(lib);
|
|
4741
|
+
const useChatInWallet = () => {
|
|
4742
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4743
|
+
const { walletVersion, mobile } = lib.useBrowser();
|
|
4744
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
4745
|
+
const targetVersion = mobile.apple.device ? "5.3.2" : "5.3.0";
|
|
4746
|
+
if (walletVersion && cmp(walletVersion, targetVersion) === 1) {
|
|
4747
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
4748
|
+
} else {
|
|
4749
|
+
bridge.call("clickChat", { id: id2, title });
|
|
4750
|
+
}
|
|
4751
|
+
};
|
|
4752
|
+
return { navigateToChat };
|
|
4753
|
+
};
|
|
3848
4754
|
function ChatList({ inWallet, ...rest }) {
|
|
3849
4755
|
const { t } = context.useLocaleContext();
|
|
3850
4756
|
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
4757
|
+
const { navigateToChat } = useChatInWallet();
|
|
3851
4758
|
const renderItem = (chat) => {
|
|
3852
4759
|
if (chat.type === "notification") {
|
|
3853
4760
|
return /* @__PURE__ */ jsxRuntime.jsx(SystemUser, { name: t("chat.notification") });
|
|
@@ -3917,7 +4824,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3917
4824
|
const getTitle = webTitleMap[chat.type] || webTitleMap.default;
|
|
3918
4825
|
return getTitle();
|
|
3919
4826
|
};
|
|
3920
|
-
|
|
4827
|
+
navigateToChat({ id: chat.id, title: getWebTitle() });
|
|
3921
4828
|
} else {
|
|
3922
4829
|
setActiveChat(chat);
|
|
3923
4830
|
}
|
|
@@ -4132,7 +5039,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4132
5039
|
},
|
|
4133
5040
|
children: [
|
|
4134
5041
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4135
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5042
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4136
5043
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4137
5044
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.newPost") })
|
|
4138
5045
|
] }),
|
|
@@ -4165,7 +5072,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4165
5072
|
},
|
|
4166
5073
|
children: [
|
|
4167
5074
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4168
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5075
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4169
5076
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4170
5077
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.cc) ? t("chat.commentedPost") : t("chat.commentedYourPost") })
|
|
4171
5078
|
] }),
|
|
@@ -4199,7 +5106,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4199
5106
|
},
|
|
4200
5107
|
children: [
|
|
4201
5108
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4202
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5109
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4203
5110
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4204
5111
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.cc) ? t("chat.replyComment") : t("chat.replyYourComment") })
|
|
4205
5112
|
] }),
|
|
@@ -4233,7 +5140,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4233
5140
|
},
|
|
4234
5141
|
children: [
|
|
4235
5142
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4236
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5143
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4237
5144
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4238
5145
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4239
5146
|
" ",
|
|
@@ -4270,7 +5177,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4270
5177
|
},
|
|
4271
5178
|
children: [
|
|
4272
5179
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4273
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5180
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4274
5181
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4275
5182
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.mentionInPost") })
|
|
4276
5183
|
] }),
|
|
@@ -4320,7 +5227,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4320
5227
|
},
|
|
4321
5228
|
children: [
|
|
4322
5229
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
4323
|
-
/* @__PURE__ */ jsxRuntime.jsx(react
|
|
5230
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
|
|
4324
5231
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
|
|
4325
5232
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: titles[message.subtype] })
|
|
4326
5233
|
] }),
|
|
@@ -4345,15 +5252,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4345
5252
|
const { isActiveChat, loadMessages } = useChatContext();
|
|
4346
5253
|
const { t } = context.useLocaleContext();
|
|
4347
5254
|
const isActive = isActiveChat(chat.id);
|
|
4348
|
-
const containerRef =
|
|
4349
|
-
const [isAtBottom, setIsAtBottom] =
|
|
4350
|
-
const [isLoadingMore, setIsLoadingMore] =
|
|
5255
|
+
const containerRef = require$$0.useRef(null);
|
|
5256
|
+
const [isAtBottom, setIsAtBottom] = require$$0.useState(true);
|
|
5257
|
+
const [isLoadingMore, setIsLoadingMore] = require$$0.useState(false);
|
|
4351
5258
|
const scrollToBottom = () => {
|
|
4352
5259
|
var _a3, _b3;
|
|
4353
5260
|
(_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
|
|
4354
5261
|
setIsAtBottom(true);
|
|
4355
5262
|
};
|
|
4356
|
-
|
|
5263
|
+
require$$0.useEffect(() => {
|
|
4357
5264
|
const handleScroll = debounce(() => {
|
|
4358
5265
|
setIsAtBottom(checkIsAtBottom(containerRef.current));
|
|
4359
5266
|
}, 300);
|
|
@@ -4361,14 +5268,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4361
5268
|
containerRef.current.addEventListener("scroll", handleScroll);
|
|
4362
5269
|
}
|
|
4363
5270
|
}, []);
|
|
4364
|
-
|
|
5271
|
+
require$$0.useEffect(() => {
|
|
4365
5272
|
setTimeout(() => {
|
|
4366
5273
|
if (isAtBottom) {
|
|
4367
5274
|
scrollToBottom();
|
|
4368
5275
|
}
|
|
4369
5276
|
}, 100);
|
|
4370
5277
|
});
|
|
4371
|
-
|
|
5278
|
+
require$$0.useEffect(() => {
|
|
4372
5279
|
if (isActive) {
|
|
4373
5280
|
setIsAtBottom(checkIsAtBottom(containerRef.current));
|
|
4374
5281
|
}
|
|
@@ -4487,7 +5394,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4487
5394
|
}
|
|
4488
5395
|
}));
|
|
4489
5396
|
function Participants({ users, sx, ...rest }) {
|
|
4490
|
-
const [open, setOpen] =
|
|
5397
|
+
const [open, setOpen] = require$$0.useState(false);
|
|
4491
5398
|
const handleTooltipClose = () => {
|
|
4492
5399
|
setOpen(false);
|
|
4493
5400
|
};
|
|
@@ -4582,8 +5489,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4582
5489
|
const isActive = isActiveChat(chat.id);
|
|
4583
5490
|
const { session, isAdmin } = useSessionContext();
|
|
4584
5491
|
const isCreator = chat.creator.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
4585
|
-
const [input, setInput] =
|
|
4586
|
-
|
|
5492
|
+
const [input, setInput] = require$$0.useState("");
|
|
5493
|
+
require$$0.useEffect(() => {
|
|
4587
5494
|
if (chat.isActivated) {
|
|
4588
5495
|
initChatRoom(chat.id);
|
|
4589
5496
|
}
|
|
@@ -4741,7 +5648,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4741
5648
|
});
|
|
4742
5649
|
const { t } = context.useLocaleContext();
|
|
4743
5650
|
const theme = styles.useTheme();
|
|
4744
|
-
const canSubmit =
|
|
5651
|
+
const canSubmit = require$$0.useMemo(() => {
|
|
4745
5652
|
return state.name;
|
|
4746
5653
|
}, [state]);
|
|
4747
5654
|
const handleSubmit = () => {
|
|
@@ -4828,8 +5735,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4828
5735
|
const { session } = useSessionContext();
|
|
4829
5736
|
const navigate = reactRouterDom.useNavigate();
|
|
4830
5737
|
const { client: client2, isInWallet, chats, setActiveChat, createDM } = useChatContext();
|
|
4831
|
-
const [inputValue, setInputValue] =
|
|
4832
|
-
const [open, setOpen] =
|
|
5738
|
+
const [inputValue, setInputValue] = require$$0.useState("");
|
|
5739
|
+
const [open, setOpen] = require$$0.useState(false);
|
|
5740
|
+
const { navigateToChat } = useChatInWallet();
|
|
4833
5741
|
const { data, loading } = ahooks.useRequest(
|
|
4834
5742
|
async () => {
|
|
4835
5743
|
if (!open) {
|
|
@@ -4865,7 +5773,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4865
5773
|
filterOptions: (x) => x,
|
|
4866
5774
|
options: data || [],
|
|
4867
5775
|
getOptionLabel: () => "",
|
|
4868
|
-
renderOption: (props, option) => /* @__PURE__ */
|
|
5776
|
+
renderOption: (props, option) => /* @__PURE__ */ require$$0.createElement(material.Box, { component: "li", ...props, key: option.did, sx: { px: "8px!important" } }, /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", width: 1 }, children: [
|
|
4869
5777
|
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mt: 0.25, lineHeight: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { did: option.did, src: option.avatar, size: 28, shape: "circle", variant: "circle" }) }),
|
|
4870
5778
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4871
5779
|
material.Box,
|
|
@@ -4906,10 +5814,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4906
5814
|
const chat = chats.find((x) => x.id === chatId);
|
|
4907
5815
|
if (isInWallet) {
|
|
4908
5816
|
if (chat) {
|
|
4909
|
-
|
|
5817
|
+
navigateToChat({ id: chat.id, title: newValue.fullName });
|
|
4910
5818
|
} else {
|
|
4911
5819
|
const dm = await createDM(newValue.did);
|
|
4912
|
-
|
|
5820
|
+
navigateToChat({ id: dm.id, title: newValue.fullName });
|
|
4913
5821
|
}
|
|
4914
5822
|
} else if (chat) {
|
|
4915
5823
|
setActiveChat(chat);
|
|
@@ -4974,7 +5882,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4974
5882
|
function Chat({ sx, ...rest }) {
|
|
4975
5883
|
var _a2;
|
|
4976
5884
|
const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, getOppositeUser } = useChatContext();
|
|
4977
|
-
const [newChannelVisible, setNewChannelVisible] =
|
|
5885
|
+
const [newChannelVisible, setNewChannelVisible] = require$$0.useState(false);
|
|
4978
5886
|
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
4979
5887
|
const { t } = context.useLocaleContext();
|
|
4980
5888
|
const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
|
|
@@ -4994,7 +5902,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4994
5902
|
const getTitle = webTitleMap[activeChat.type] || webTitleMap.default;
|
|
4995
5903
|
return getTitle();
|
|
4996
5904
|
};
|
|
4997
|
-
const show =
|
|
5905
|
+
const show = require$$0.useMemo(() => {
|
|
4998
5906
|
if (downMd) {
|
|
4999
5907
|
return {
|
|
5000
5908
|
left: !activeChatId,
|
|
@@ -5110,7 +6018,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5110
6018
|
const { initialized, chats } = useChatContext();
|
|
5111
6019
|
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
5112
6020
|
const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
|
|
5113
|
-
const show =
|
|
6021
|
+
const show = require$$0.useMemo(() => {
|
|
5114
6022
|
if (downMd) {
|
|
5115
6023
|
return {
|
|
5116
6024
|
left: !activeChatId,
|
|
@@ -5152,7 +6060,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5152
6060
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5153
6061
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5154
6062
|
const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
|
5155
|
-
const show =
|
|
6063
|
+
const show = require$$0.useMemo(() => {
|
|
5156
6064
|
if (downMd) {
|
|
5157
6065
|
return {
|
|
5158
6066
|
left: !activeChatId,
|
|
@@ -5242,11 +6150,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5242
6150
|
return response;
|
|
5243
6151
|
};
|
|
5244
6152
|
const useApiErrorHandler = ({ request, errorHandler }) => {
|
|
5245
|
-
const errorHandlerRef =
|
|
5246
|
-
|
|
6153
|
+
const errorHandlerRef = require$$0.useRef(errorHandler);
|
|
6154
|
+
require$$0.useEffect(() => {
|
|
5247
6155
|
errorHandlerRef.current = errorHandler;
|
|
5248
6156
|
}, [errorHandler]);
|
|
5249
|
-
|
|
6157
|
+
require$$0.useEffect(() => {
|
|
5250
6158
|
const interceptor = request.interceptors.response.use(jsonValidationInterceptor, (error) => {
|
|
5251
6159
|
let handled = false;
|
|
5252
6160
|
error.markAsHandled = () => {
|
|
@@ -5337,7 +6245,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5337
6245
|
const { session } = useSessionContext();
|
|
5338
6246
|
const isAdmin = ["owner", "admin"].includes((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.role);
|
|
5339
6247
|
const uploaderRef = useUploader();
|
|
5340
|
-
const config$1 =
|
|
6248
|
+
const config$1 = require$$0.useMemo(() => {
|
|
5341
6249
|
const userService = {
|
|
5342
6250
|
search: async (text2) => {
|
|
5343
6251
|
const { data } = await request.get(`/api/mention?search=${text2}`, { baseURL });
|
|
@@ -5478,7 +6386,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5478
6386
|
}
|
|
5479
6387
|
);
|
|
5480
6388
|
}
|
|
5481
|
-
const Editor$1 =
|
|
6389
|
+
const Editor$1 = require$$0.lazy(() => Promise.resolve().then(() => editor));
|
|
5482
6390
|
function LazyEditor(props) {
|
|
5483
6391
|
const fallback = /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { px: 3 }, children: [
|
|
5484
6392
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
|
|
@@ -5486,9 +6394,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5486
6394
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
|
|
5487
6395
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
|
|
5488
6396
|
] });
|
|
5489
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6397
|
+
return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
|
|
5490
6398
|
}
|
|
5491
|
-
const BlockletEditor$1 =
|
|
6399
|
+
const BlockletEditor$1 = require$$0.lazy(() => import("@blocklet/editor"));
|
|
5492
6400
|
function EditorPreview({ content, children, ...rest }) {
|
|
5493
6401
|
const fallback = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5494
6402
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
|
|
@@ -5496,7 +6404,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5496
6404
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
|
|
5497
6405
|
/* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
|
|
5498
6406
|
] });
|
|
5499
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6407
|
+
return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5500
6408
|
BlockletEditor$1,
|
|
5501
6409
|
{
|
|
5502
6410
|
editorState: inferInitialEditorState(content),
|
|
@@ -5512,7 +6420,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5512
6420
|
) });
|
|
5513
6421
|
}
|
|
5514
6422
|
const useBeforeUnloadPrompt = (dirty) => {
|
|
5515
|
-
|
|
6423
|
+
require$$0.useEffect(() => {
|
|
5516
6424
|
const showPrompt = (e) => {
|
|
5517
6425
|
if (dirty) {
|
|
5518
6426
|
e.preventDefault();
|
|
@@ -5529,24 +6437,24 @@ var __publicField = (obj, key, value) => {
|
|
|
5529
6437
|
const { t } = context.useLocaleContext();
|
|
5530
6438
|
const [dirty, setDirty, getDirty] = ahooks.useGetState(false);
|
|
5531
6439
|
const { confirm } = useConfirm();
|
|
5532
|
-
const resetCallbackRef =
|
|
6440
|
+
const resetCallbackRef = require$$0.useRef(null);
|
|
5533
6441
|
useBeforeUnloadPrompt(dirty);
|
|
5534
|
-
const reset =
|
|
6442
|
+
const reset = require$$0.useCallback(
|
|
5535
6443
|
(callback) => {
|
|
5536
6444
|
resetCallbackRef.current = callback;
|
|
5537
6445
|
setDirty(false);
|
|
5538
6446
|
},
|
|
5539
6447
|
[setDirty]
|
|
5540
6448
|
);
|
|
5541
|
-
|
|
6449
|
+
require$$0.useEffect(() => {
|
|
5542
6450
|
var _a2;
|
|
5543
6451
|
if (!dirty) {
|
|
5544
6452
|
(_a2 = resetCallbackRef.current) == null ? void 0 : _a2.call(resetCallbackRef);
|
|
5545
6453
|
resetCallbackRef.current = null;
|
|
5546
6454
|
}
|
|
5547
6455
|
}, [dirty]);
|
|
5548
|
-
const markDirty =
|
|
5549
|
-
const check =
|
|
6456
|
+
const markDirty = require$$0.useCallback(() => setDirty(true), [setDirty]);
|
|
6457
|
+
const check = require$$0.useCallback(async () => {
|
|
5550
6458
|
if (getDirty()) {
|
|
5551
6459
|
const proceed = await confirm({
|
|
5552
6460
|
title: t("unsaved.title"),
|
|
@@ -5569,7 +6477,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5569
6477
|
const { t } = context.useLocaleContext();
|
|
5570
6478
|
const { dirty, reset } = DirtyPromptContainer.useContainer();
|
|
5571
6479
|
const blocker = reactRouterDom.useBlocker(dirty);
|
|
5572
|
-
|
|
6480
|
+
require$$0.useEffect(() => {
|
|
5573
6481
|
if (blocker.state === "blocked" && !dirty) {
|
|
5574
6482
|
blocker.reset();
|
|
5575
6483
|
}
|
|
@@ -5760,7 +6668,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5760
6668
|
}
|
|
5761
6669
|
};
|
|
5762
6670
|
const translations = { zh, en };
|
|
5763
|
-
const Lottie =
|
|
6671
|
+
const Lottie = require$$0.lazy(() => import("lottie-react"));
|
|
5764
6672
|
function LottieComponent({ src, ...restProps }) {
|
|
5765
6673
|
return /* @__PURE__ */ jsxRuntime.jsx(Lottie, { animationData: src, loop: true, ...restProps });
|
|
5766
6674
|
}
|
|
@@ -11275,7 +12183,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11275
12183
|
}
|
|
11276
12184
|
const useSubscription = (event, cb = () => {
|
|
11277
12185
|
}, deps = [], prefix2 = ((_d) => (_d = window.blocklet) == null ? void 0 : _d.prefix)() || "/") => {
|
|
11278
|
-
|
|
12186
|
+
require$$0.useEffect(() => {
|
|
11279
12187
|
if (event) {
|
|
11280
12188
|
if (!client) {
|
|
11281
12189
|
client = getWsClient(prefix2);
|
|
@@ -11290,11 +12198,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11290
12198
|
}, [event, ...deps]);
|
|
11291
12199
|
};
|
|
11292
12200
|
const id = "point-up-component";
|
|
11293
|
-
const PointUpContext =
|
|
12201
|
+
const PointUpContext = require$$0.createContext({});
|
|
11294
12202
|
const WsEvents = Object.freeze({
|
|
11295
12203
|
POINT_UP: "point.up"
|
|
11296
12204
|
});
|
|
11297
|
-
const usePointUpContext = () =>
|
|
12205
|
+
const usePointUpContext = () => require$$0.useContext(PointUpContext);
|
|
11298
12206
|
function PointUp({ points }) {
|
|
11299
12207
|
const { t } = context.useLocaleContext();
|
|
11300
12208
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11349,7 +12257,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11349
12257
|
});
|
|
11350
12258
|
const { session } = useSessionContext();
|
|
11351
12259
|
const wsClient = getWsClient();
|
|
11352
|
-
const pointUp =
|
|
12260
|
+
const pointUp = require$$0.useCallback(({ points }) => {
|
|
11353
12261
|
state.pointsList.push(points);
|
|
11354
12262
|
}, []);
|
|
11355
12263
|
const pointUpComponent = (_c = (_b2 = (_a2 = window.blocklet) == null ? void 0 : _a2.componentMountPoints) == null ? void 0 : _b2.find) == null ? void 0 : _c.call(
|
|
@@ -11361,19 +12269,19 @@ var __publicField = (obj, key, value) => {
|
|
|
11361
12269
|
pointUp(payload);
|
|
11362
12270
|
}
|
|
11363
12271
|
};
|
|
11364
|
-
|
|
12272
|
+
require$$0.useEffect(() => {
|
|
11365
12273
|
wsClient.connect();
|
|
11366
12274
|
return () => {
|
|
11367
12275
|
if (wsClient.isConnected())
|
|
11368
12276
|
;
|
|
11369
12277
|
};
|
|
11370
12278
|
}, []);
|
|
11371
|
-
const value =
|
|
12279
|
+
const value = require$$0.useMemo(() => {
|
|
11372
12280
|
return {
|
|
11373
12281
|
pointUp
|
|
11374
12282
|
};
|
|
11375
12283
|
}, []);
|
|
11376
|
-
|
|
12284
|
+
require$$0.useEffect(() => {
|
|
11377
12285
|
if (state.pointsList.length > 0) {
|
|
11378
12286
|
state.visible = true;
|
|
11379
12287
|
state.currentPoints = +state.pointsList[0];
|
|
@@ -11446,8 +12354,8 @@ var __publicField = (obj, key, value) => {
|
|
|
11446
12354
|
const selectedString = searchParams.get(urlName);
|
|
11447
12355
|
const dataWithDefault = defaultButton && (data == null ? void 0 : data.length) > 0 ? [defaultButton, ...data] : data;
|
|
11448
12356
|
const selectedArray = selectedString !== null && selectedString !== "" ? selectedString.split(",") : dataWithDefault == null ? void 0 : dataWithDefault.map((item) => item.id);
|
|
11449
|
-
const [selectTab, setSelectTab] =
|
|
11450
|
-
const [selectAll, setSelectAll] =
|
|
12357
|
+
const [selectTab, setSelectTab] = require$$0.useState(urlParams ? selectedArray : [boardId]);
|
|
12358
|
+
const [selectAll, setSelectAll] = require$$0.useState(false);
|
|
11451
12359
|
const updateUrl = (url, newSelectTab) => {
|
|
11452
12360
|
const formatNewSelectTab = newSelectTab.filter(Boolean);
|
|
11453
12361
|
if (urlParams) {
|
|
@@ -11474,7 +12382,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11474
12382
|
return newSelectAll;
|
|
11475
12383
|
});
|
|
11476
12384
|
};
|
|
11477
|
-
|
|
12385
|
+
require$$0.useEffect(() => {
|
|
11478
12386
|
if (JSON.stringify(selectedArray) !== JSON.stringify(selectTab)) {
|
|
11479
12387
|
if (urlParams) {
|
|
11480
12388
|
setSelectTab(selectedArray || []);
|
|
@@ -11489,7 +12397,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11489
12397
|
}
|
|
11490
12398
|
}
|
|
11491
12399
|
}, [data, boardId]);
|
|
11492
|
-
|
|
12400
|
+
require$$0.useEffect(() => {
|
|
11493
12401
|
if (urlParams) {
|
|
11494
12402
|
if (selectedString === null || selectedString === "") {
|
|
11495
12403
|
setSelectAll(true);
|
|
@@ -11657,7 +12565,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11657
12565
|
}
|
|
11658
12566
|
) });
|
|
11659
12567
|
}
|
|
11660
|
-
const BlockletEditor =
|
|
12568
|
+
const BlockletEditor = require$$0.lazy(() => import("@blocklet/editor"));
|
|
11661
12569
|
const Root = material.styled(material.Box)`
|
|
11662
12570
|
.be-editable,
|
|
11663
12571
|
.be-content {
|
|
@@ -11747,6 +12655,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11747
12655
|
exports2.getWsClient = getWsClient;
|
|
11748
12656
|
exports2.lexicalUtils = lexical;
|
|
11749
12657
|
exports2.preferences = preferences;
|
|
12658
|
+
exports2.preloadInput = preloadInput;
|
|
11750
12659
|
exports2.routes = routes;
|
|
11751
12660
|
exports2.themeOverrides = themeOverrides;
|
|
11752
12661
|
exports2.translations = translations;
|