@blocklet/discuss-kit-ux 1.6.243 → 1.6.245

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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.react, global.material, global.isNil, global.config, 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$1, 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.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, react, material, isNil, config, 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$1, Empty$3, Session, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, ReactDOM, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, bridge, Fab, debounce, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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 = react.useRef(null);
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 = react.lazy(() => import("@blocklet/editor"));
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] = react.useState(null);
487
- const [error, setError] = react.useState("");
488
- const [loading, setLoading] = react.useState(false);
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 = react.useRef(false);
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__ */ react.createElement(material.Box, { ref, ...rest, key: draftKey, sx: mergedSx }, /* @__PURE__ */ jsxRuntime.jsx(config.EditorConfigProvider, { value: mergedEditorConfig, children: /* @__PURE__ */ jsxRuntime.jsxs(
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 } = react.useContext(context.LocaleContext);
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 } = react.useContext(context.LocaleContext);
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$1.Icon, { className: "badge-icon", icon: badgeIcon, color: badgeColor, style: { ...iconStyle } });
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 = react.useContext(Session.SessionContext) || {};
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 = react.useMemo(() => {
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] = react.useState(false);
993
- const [changed, setChanged] = react.useState(false);
994
- const initialValues = react.useRef(values2);
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
- react.useEffect(() => {
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] = react.useState(/* @__PURE__ */ new Date());
1021
+ const [time, setTime] = require$$0.useState(/* @__PURE__ */ new Date());
1021
1022
  const updateTime = () => setTime(/* @__PURE__ */ new Date());
1022
- react.useEffect(() => {
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] = react.useState(false);
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 (react.isValidElement(createdAt)) {
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] = react.useState(true);
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 = react.lazy(() => import("@blocklet/editor"));
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(react.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsxs(
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(react.Suspense, { children: /* @__PURE__ */ jsxRuntime.jsx(ViewMore, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(
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] = react.useState(null);
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] = react.useState(false);
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] = react.useState(false);
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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] = react.useState(null);
1705
- const [loading, setLoading] = react.useState(false);
1706
- const countPerValue = react.useMemo(() => {
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 = react.useMemo(() => {
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] = react.useState(false);
1871
- const [raters, setRaters] = react.useState(null);
1872
- const [myReaction, setMyReaction] = react.useState(null);
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 = react.useMemo(() => {
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 = react.useMemo(() => {
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 = react.useMemo(() => {
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 = react.useMemo(() => {
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 (react.isValidElement(description)) {
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 = react.createContext({});
2109
- const useConfirm = () => react.useContext(ConfirmContext);
2109
+ const ConfirmContext = require$$0.createContext({});
2110
+ const useConfirm = () => require$$0.useContext(ConfirmContext);
2110
2111
  function ConfirmProvider({ children }) {
2111
- const [open, setOpen] = react.useState(false);
2112
- const [currentOptions, setCurrentOptions] = react.useState({});
2113
- const resolver = react.useRef();
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 = react.useMemo(
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] = react.useState(false);
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 = react.useRef(window.location.hash.substring(1));
2312
- const lastHeightRef = react.useRef(containerHeight);
2313
- const autoScrolledRef = react.useRef(false);
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
- react.useEffect(() => {
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 = react.createContext({});
2355
- const useCommentsContext = () => react.useContext(CommentsContext);
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 = react.useMemo(() => {
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 = react.useRef(window.location.hash.substring(1));
2385
+ const highlightedRef = require$$0.useRef(window.location.hash.substring(1));
2385
2386
  const limit = 15;
2386
2387
  const initialRepliesLimit = -1;
2387
- react.useEffect(() => {
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 = react.useMemo(
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(react.Fragment, { children: [
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 = react.lazy(() => import("@blocklet/uploader/react").then((res) => ({ default: res.Uploader })));
2723
- const UploaderContext = react.createContext(null);
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 = react.useContext(UploaderContext);
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 = react.useRef(null);
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] = react.useState(false);
2795
- const [errored, setErrored] = react.useState(false);
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 = react.forwardRef(
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 = react.createContext({
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 = () => react.useContext(AuthzContext);
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 = react.useMemo(() => {
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 = react.useMemo(() => new Set(permissions), [permissions]);
3445
- const hasPermission = react.useCallback(
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 = react.useMemo(
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 = react.createContext(
3515
+ const UnreadNotificationContext = require$$0.createContext(
3515
3516
  {}
3516
3517
  );
3517
- const useUnreadNotification = () => react.useContext(UnreadNotificationContext);
3518
+ const useUnreadNotification = () => require$$0.useContext(UnreadNotificationContext);
3518
3519
  function UnreadNotificationProvider({ fetchUnreadState, children }) {
3519
3520
  const { session } = useSessionContext();
3520
- const [unread, setUnread] = react.useState(false);
3521
- const markAsUnread = react.useCallback((value2 = true) => setUnread(value2), []);
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
- react.useEffect(() => {
3527
+ require$$0.useEffect(() => {
3527
3528
  if (session.user && !preferences.disableNotificationBadge) {
3528
3529
  update();
3529
3530
  }
3530
3531
  }, [session.user]);
3531
- const value = react.useMemo(
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 = react.createContext({});
3542
- const useChatContext = () => react.useContext(ChatContext);
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 = react.useMemo(() => {
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 = react.useMemo(
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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
- react.useEffect(() => {
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
- react.useEffect(() => {
3786
+ require$$0.useEffect(() => {
3786
3787
  if (state.initialized) {
3787
3788
  markAsUnread(hasAnyUnreadMessages);
3788
3789
  }
3789
3790
  }, [state.initialized, hasAnyUnreadMessages, markAsUnread]);
3790
- const value = react.useMemo(() => {
3791
+ const value = require$$0.useMemo(() => {
3791
3792
  return {
3792
3793
  ...state,
3793
3794
  client: client2,
@@ -3845,9 +3846,923 @@ 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 isChatInWalletV2 = require$$0.useMemo(() => {
4745
+ try {
4746
+ const targetVersion = mobile.apple.device ? "5.3.2" : "5.3.0";
4747
+ return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
4748
+ } catch (e) {
4749
+ console.error(e);
4750
+ return false;
4751
+ }
4752
+ }, [walletVersion, mobile]);
4753
+ const navigateToChat = ({ id: id2, title }) => {
4754
+ if (isChatInWalletV2) {
4755
+ navigate(`/chat-in-wallet/${id2}`);
4756
+ } else {
4757
+ bridge.call("clickChat", { id: id2, title });
4758
+ }
4759
+ };
4760
+ return { navigateToChat, isChatInWalletV2 };
4761
+ };
3848
4762
  function ChatList({ inWallet, ...rest }) {
3849
4763
  const { t } = context.useLocaleContext();
3850
4764
  const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
4765
+ const { navigateToChat } = useChatInWallet();
3851
4766
  const renderItem = (chat) => {
3852
4767
  if (chat.type === "notification") {
3853
4768
  return /* @__PURE__ */ jsxRuntime.jsx(SystemUser, { name: t("chat.notification") });
@@ -3917,7 +4832,7 @@ var __publicField = (obj, key, value) => {
3917
4832
  const getTitle = webTitleMap[chat.type] || webTitleMap.default;
3918
4833
  return getTitle();
3919
4834
  };
3920
- bridge.call("clickChat", { id: chat.id, title: getWebTitle() });
4835
+ navigateToChat({ id: chat.id, title: getWebTitle() });
3921
4836
  } else {
3922
4837
  setActiveChat(chat);
3923
4838
  }
@@ -4132,7 +5047,7 @@ var __publicField = (obj, key, value) => {
4132
5047
  },
4133
5048
  children: [
4134
5049
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4135
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
5050
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:news", style: { height: 15, width: 15, marginRight: 4 } }),
4136
5051
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4137
5052
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.newPost") })
4138
5053
  ] }),
@@ -4165,7 +5080,7 @@ var __publicField = (obj, key, value) => {
4165
5080
  },
4166
5081
  children: [
4167
5082
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4168
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
5083
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4169
5084
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4170
5085
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.cc) ? t("chat.commentedPost") : t("chat.commentedYourPost") })
4171
5086
  ] }),
@@ -4199,7 +5114,7 @@ var __publicField = (obj, key, value) => {
4199
5114
  },
4200
5115
  children: [
4201
5116
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4202
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
5117
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4203
5118
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4204
5119
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: (message == null ? void 0 : message.cc) ? t("chat.replyComment") : t("chat.replyYourComment") })
4205
5120
  ] }),
@@ -4233,7 +5148,7 @@ var __publicField = (obj, key, value) => {
4233
5148
  },
4234
5149
  children: [
4235
5150
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4236
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
5151
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4237
5152
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4238
5153
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4239
5154
  " ",
@@ -4270,7 +5185,7 @@ var __publicField = (obj, key, value) => {
4270
5185
  },
4271
5186
  children: [
4272
5187
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4273
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
5188
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:message-circle-2", style: { height: 15, width: 15, marginRight: 4 } }),
4274
5189
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4275
5190
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("chat.mentionInPost") })
4276
5191
  ] }),
@@ -4320,7 +5235,7 @@ var __publicField = (obj, key, value) => {
4320
5235
  },
4321
5236
  children: [
4322
5237
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
4323
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
5238
+ /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "tabler:arrow-forward-up", style: { height: 15, width: 15, marginRight: 4 } }),
4324
5239
  /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { mr: 0.5 }, children: message.sourceUser.fullName }),
4325
5240
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: titles[message.subtype] })
4326
5241
  ] }),
@@ -4345,15 +5260,15 @@ var __publicField = (obj, key, value) => {
4345
5260
  const { isActiveChat, loadMessages } = useChatContext();
4346
5261
  const { t } = context.useLocaleContext();
4347
5262
  const isActive = isActiveChat(chat.id);
4348
- const containerRef = react.useRef(null);
4349
- const [isAtBottom, setIsAtBottom] = react.useState(true);
4350
- const [isLoadingMore, setIsLoadingMore] = react.useState(false);
5263
+ const containerRef = require$$0.useRef(null);
5264
+ const [isAtBottom, setIsAtBottom] = require$$0.useState(true);
5265
+ const [isLoadingMore, setIsLoadingMore] = require$$0.useState(false);
4351
5266
  const scrollToBottom = () => {
4352
5267
  var _a3, _b3;
4353
5268
  (_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
4354
5269
  setIsAtBottom(true);
4355
5270
  };
4356
- react.useEffect(() => {
5271
+ require$$0.useEffect(() => {
4357
5272
  const handleScroll = debounce(() => {
4358
5273
  setIsAtBottom(checkIsAtBottom(containerRef.current));
4359
5274
  }, 300);
@@ -4361,14 +5276,14 @@ var __publicField = (obj, key, value) => {
4361
5276
  containerRef.current.addEventListener("scroll", handleScroll);
4362
5277
  }
4363
5278
  }, []);
4364
- react.useEffect(() => {
5279
+ require$$0.useEffect(() => {
4365
5280
  setTimeout(() => {
4366
5281
  if (isAtBottom) {
4367
5282
  scrollToBottom();
4368
5283
  }
4369
5284
  }, 100);
4370
5285
  });
4371
- react.useEffect(() => {
5286
+ require$$0.useEffect(() => {
4372
5287
  if (isActive) {
4373
5288
  setIsAtBottom(checkIsAtBottom(containerRef.current));
4374
5289
  }
@@ -4487,7 +5402,7 @@ var __publicField = (obj, key, value) => {
4487
5402
  }
4488
5403
  }));
4489
5404
  function Participants({ users, sx, ...rest }) {
4490
- const [open, setOpen] = react.useState(false);
5405
+ const [open, setOpen] = require$$0.useState(false);
4491
5406
  const handleTooltipClose = () => {
4492
5407
  setOpen(false);
4493
5408
  };
@@ -4574,6 +5489,7 @@ var __publicField = (obj, key, value) => {
4574
5489
  }
4575
5490
  function ChatRoom({ chat, inWallet, ...rest }) {
4576
5491
  var _a2;
5492
+ const { isChatInWalletV2 } = useChatInWallet();
4577
5493
  const { t } = context.useLocaleContext();
4578
5494
  const theme = styles.useTheme();
4579
5495
  const downSm = material.useMediaQuery((currentTheme) => currentTheme.breakpoints.down("sm"));
@@ -4582,8 +5498,8 @@ var __publicField = (obj, key, value) => {
4582
5498
  const isActive = isActiveChat(chat.id);
4583
5499
  const { session, isAdmin } = useSessionContext();
4584
5500
  const isCreator = chat.creator.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
4585
- const [input, setInput] = react.useState("");
4586
- react.useEffect(() => {
5501
+ const [input, setInput] = require$$0.useState("");
5502
+ require$$0.useEffect(() => {
4587
5503
  if (chat.isActivated) {
4588
5504
  initChatRoom(chat.id);
4589
5505
  }
@@ -4672,6 +5588,23 @@ var __publicField = (obj, key, value) => {
4672
5588
  ]
4673
5589
  }
4674
5590
  ),
5591
+ !!inWallet && isChatInWalletV2 && /* @__PURE__ */ jsxRuntime.jsxs(
5592
+ Box,
5593
+ {
5594
+ sx: {
5595
+ display: "flex",
5596
+ alignItems: "center",
5597
+ flex: "0 0 auto",
5598
+ height: 52,
5599
+ px: 2.5,
5600
+ borderBottom: "1px solid #e5e5e5"
5601
+ },
5602
+ children: [
5603
+ downSm && /* @__PURE__ */ jsxRuntime.jsx(Back, { iconOnly: true, url: "/chat-in-wallet" }),
5604
+ renderRoomHeader()
5605
+ ]
5606
+ }
5607
+ ),
4675
5608
  /* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { flex: 1, overflow: "hidden", background: theme.palette.grey[50] }, children: /* @__PURE__ */ jsxRuntime.jsx(MessageList, { chat }) }),
4676
5609
  /* @__PURE__ */ jsxRuntime.jsx(
4677
5610
  Box,
@@ -4741,7 +5674,7 @@ var __publicField = (obj, key, value) => {
4741
5674
  });
4742
5675
  const { t } = context.useLocaleContext();
4743
5676
  const theme = styles.useTheme();
4744
- const canSubmit = react.useMemo(() => {
5677
+ const canSubmit = require$$0.useMemo(() => {
4745
5678
  return state.name;
4746
5679
  }, [state]);
4747
5680
  const handleSubmit = () => {
@@ -4828,8 +5761,9 @@ var __publicField = (obj, key, value) => {
4828
5761
  const { session } = useSessionContext();
4829
5762
  const navigate = reactRouterDom.useNavigate();
4830
5763
  const { client: client2, isInWallet, chats, setActiveChat, createDM } = useChatContext();
4831
- const [inputValue, setInputValue] = react.useState("");
4832
- const [open, setOpen] = react.useState(false);
5764
+ const [inputValue, setInputValue] = require$$0.useState("");
5765
+ const [open, setOpen] = require$$0.useState(false);
5766
+ const { navigateToChat } = useChatInWallet();
4833
5767
  const { data, loading } = ahooks.useRequest(
4834
5768
  async () => {
4835
5769
  if (!open) {
@@ -4865,7 +5799,7 @@ var __publicField = (obj, key, value) => {
4865
5799
  filterOptions: (x) => x,
4866
5800
  options: data || [],
4867
5801
  getOptionLabel: () => "",
4868
- renderOption: (props, option) => /* @__PURE__ */ react.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: [
5802
+ 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
5803
  /* @__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
5804
  /* @__PURE__ */ jsxRuntime.jsxs(
4871
5805
  material.Box,
@@ -4906,10 +5840,10 @@ var __publicField = (obj, key, value) => {
4906
5840
  const chat = chats.find((x) => x.id === chatId);
4907
5841
  if (isInWallet) {
4908
5842
  if (chat) {
4909
- bridge.call("clickChat", { id: chat.id, title: newValue.fullName });
5843
+ navigateToChat({ id: chat.id, title: newValue.fullName });
4910
5844
  } else {
4911
5845
  const dm = await createDM(newValue.did);
4912
- bridge.call("clickChat", { id: dm.id, title: newValue.fullName });
5846
+ navigateToChat({ id: dm.id, title: newValue.fullName });
4913
5847
  }
4914
5848
  } else if (chat) {
4915
5849
  setActiveChat(chat);
@@ -4974,7 +5908,7 @@ var __publicField = (obj, key, value) => {
4974
5908
  function Chat({ sx, ...rest }) {
4975
5909
  var _a2;
4976
5910
  const { client: client2, initialized, chats, activeChatId, addChat, setActiveChat, getOppositeUser } = useChatContext();
4977
- const [newChannelVisible, setNewChannelVisible] = react.useState(false);
5911
+ const [newChannelVisible, setNewChannelVisible] = require$$0.useState(false);
4978
5912
  const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
4979
5913
  const { t } = context.useLocaleContext();
4980
5914
  const activeChat = (_a2 = chats == null ? void 0 : chats.filter((chat) => (chat == null ? void 0 : chat.id) === activeChatId)) == null ? void 0 : _a2[0];
@@ -4994,7 +5928,7 @@ var __publicField = (obj, key, value) => {
4994
5928
  const getTitle = webTitleMap[activeChat.type] || webTitleMap.default;
4995
5929
  return getTitle();
4996
5930
  };
4997
- const show = react.useMemo(() => {
5931
+ const show = require$$0.useMemo(() => {
4998
5932
  if (downMd) {
4999
5933
  return {
5000
5934
  left: !activeChatId,
@@ -5110,7 +6044,7 @@ var __publicField = (obj, key, value) => {
5110
6044
  const { initialized, chats } = useChatContext();
5111
6045
  const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
5112
6046
  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 = react.useMemo(() => {
6047
+ const show = require$$0.useMemo(() => {
5114
6048
  if (downMd) {
5115
6049
  return {
5116
6050
  left: !activeChatId,
@@ -5152,7 +6086,7 @@ var __publicField = (obj, key, value) => {
5152
6086
  function ChatListInWallet({ sx, ...rest }) {
5153
6087
  const { initialized, chats, activeChatId } = useChatContext();
5154
6088
  const downMd = material.useMediaQuery((theme) => theme.breakpoints.down("sm"));
5155
- const show = react.useMemo(() => {
6089
+ const show = require$$0.useMemo(() => {
5156
6090
  if (downMd) {
5157
6091
  return {
5158
6092
  left: !activeChatId,
@@ -5242,11 +6176,11 @@ var __publicField = (obj, key, value) => {
5242
6176
  return response;
5243
6177
  };
5244
6178
  const useApiErrorHandler = ({ request, errorHandler }) => {
5245
- const errorHandlerRef = react.useRef(errorHandler);
5246
- react.useEffect(() => {
6179
+ const errorHandlerRef = require$$0.useRef(errorHandler);
6180
+ require$$0.useEffect(() => {
5247
6181
  errorHandlerRef.current = errorHandler;
5248
6182
  }, [errorHandler]);
5249
- react.useEffect(() => {
6183
+ require$$0.useEffect(() => {
5250
6184
  const interceptor = request.interceptors.response.use(jsonValidationInterceptor, (error) => {
5251
6185
  let handled = false;
5252
6186
  error.markAsHandled = () => {
@@ -5337,7 +6271,7 @@ var __publicField = (obj, key, value) => {
5337
6271
  const { session } = useSessionContext();
5338
6272
  const isAdmin = ["owner", "admin"].includes((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.role);
5339
6273
  const uploaderRef = useUploader();
5340
- const config$1 = react.useMemo(() => {
6274
+ const config$1 = require$$0.useMemo(() => {
5341
6275
  const userService = {
5342
6276
  search: async (text2) => {
5343
6277
  const { data } = await request.get(`/api/mention?search=${text2}`, { baseURL });
@@ -5478,7 +6412,7 @@ var __publicField = (obj, key, value) => {
5478
6412
  }
5479
6413
  );
5480
6414
  }
5481
- const Editor$1 = react.lazy(() => Promise.resolve().then(() => editor));
6415
+ const Editor$1 = require$$0.lazy(() => Promise.resolve().then(() => editor));
5482
6416
  function LazyEditor(props) {
5483
6417
  const fallback = /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { px: 3 }, children: [
5484
6418
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
@@ -5486,9 +6420,9 @@ var __publicField = (obj, key, value) => {
5486
6420
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
5487
6421
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
5488
6422
  ] });
5489
- return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
6423
+ return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
5490
6424
  }
5491
- const BlockletEditor$1 = react.lazy(() => import("@blocklet/editor"));
6425
+ const BlockletEditor$1 = require$$0.lazy(() => import("@blocklet/editor"));
5492
6426
  function EditorPreview({ content, children, ...rest }) {
5493
6427
  const fallback = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5494
6428
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
@@ -5496,7 +6430,7 @@ var __publicField = (obj, key, value) => {
5496
6430
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
5497
6431
  /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
5498
6432
  ] });
5499
- return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(
6433
+ return /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(
5500
6434
  BlockletEditor$1,
5501
6435
  {
5502
6436
  editorState: inferInitialEditorState(content),
@@ -5512,7 +6446,7 @@ var __publicField = (obj, key, value) => {
5512
6446
  ) });
5513
6447
  }
5514
6448
  const useBeforeUnloadPrompt = (dirty) => {
5515
- react.useEffect(() => {
6449
+ require$$0.useEffect(() => {
5516
6450
  const showPrompt = (e) => {
5517
6451
  if (dirty) {
5518
6452
  e.preventDefault();
@@ -5529,24 +6463,24 @@ var __publicField = (obj, key, value) => {
5529
6463
  const { t } = context.useLocaleContext();
5530
6464
  const [dirty, setDirty, getDirty] = ahooks.useGetState(false);
5531
6465
  const { confirm } = useConfirm();
5532
- const resetCallbackRef = react.useRef(null);
6466
+ const resetCallbackRef = require$$0.useRef(null);
5533
6467
  useBeforeUnloadPrompt(dirty);
5534
- const reset = react.useCallback(
6468
+ const reset = require$$0.useCallback(
5535
6469
  (callback) => {
5536
6470
  resetCallbackRef.current = callback;
5537
6471
  setDirty(false);
5538
6472
  },
5539
6473
  [setDirty]
5540
6474
  );
5541
- react.useEffect(() => {
6475
+ require$$0.useEffect(() => {
5542
6476
  var _a2;
5543
6477
  if (!dirty) {
5544
6478
  (_a2 = resetCallbackRef.current) == null ? void 0 : _a2.call(resetCallbackRef);
5545
6479
  resetCallbackRef.current = null;
5546
6480
  }
5547
6481
  }, [dirty]);
5548
- const markDirty = react.useCallback(() => setDirty(true), [setDirty]);
5549
- const check = react.useCallback(async () => {
6482
+ const markDirty = require$$0.useCallback(() => setDirty(true), [setDirty]);
6483
+ const check = require$$0.useCallback(async () => {
5550
6484
  if (getDirty()) {
5551
6485
  const proceed = await confirm({
5552
6486
  title: t("unsaved.title"),
@@ -5569,7 +6503,7 @@ var __publicField = (obj, key, value) => {
5569
6503
  const { t } = context.useLocaleContext();
5570
6504
  const { dirty, reset } = DirtyPromptContainer.useContainer();
5571
6505
  const blocker = reactRouterDom.useBlocker(dirty);
5572
- react.useEffect(() => {
6506
+ require$$0.useEffect(() => {
5573
6507
  if (blocker.state === "blocked" && !dirty) {
5574
6508
  blocker.reset();
5575
6509
  }
@@ -5760,7 +6694,7 @@ var __publicField = (obj, key, value) => {
5760
6694
  }
5761
6695
  };
5762
6696
  const translations = { zh, en };
5763
- const Lottie = react.lazy(() => import("lottie-react"));
6697
+ const Lottie = require$$0.lazy(() => import("lottie-react"));
5764
6698
  function LottieComponent({ src, ...restProps }) {
5765
6699
  return /* @__PURE__ */ jsxRuntime.jsx(Lottie, { animationData: src, loop: true, ...restProps });
5766
6700
  }
@@ -11275,7 +12209,7 @@ var __publicField = (obj, key, value) => {
11275
12209
  }
11276
12210
  const useSubscription = (event, cb = () => {
11277
12211
  }, deps = [], prefix2 = ((_d) => (_d = window.blocklet) == null ? void 0 : _d.prefix)() || "/") => {
11278
- react.useEffect(() => {
12212
+ require$$0.useEffect(() => {
11279
12213
  if (event) {
11280
12214
  if (!client) {
11281
12215
  client = getWsClient(prefix2);
@@ -11290,11 +12224,11 @@ var __publicField = (obj, key, value) => {
11290
12224
  }, [event, ...deps]);
11291
12225
  };
11292
12226
  const id = "point-up-component";
11293
- const PointUpContext = react.createContext({});
12227
+ const PointUpContext = require$$0.createContext({});
11294
12228
  const WsEvents = Object.freeze({
11295
12229
  POINT_UP: "point.up"
11296
12230
  });
11297
- const usePointUpContext = () => react.useContext(PointUpContext);
12231
+ const usePointUpContext = () => require$$0.useContext(PointUpContext);
11298
12232
  function PointUp({ points }) {
11299
12233
  const { t } = context.useLocaleContext();
11300
12234
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11349,7 +12283,7 @@ var __publicField = (obj, key, value) => {
11349
12283
  });
11350
12284
  const { session } = useSessionContext();
11351
12285
  const wsClient = getWsClient();
11352
- const pointUp = react.useCallback(({ points }) => {
12286
+ const pointUp = require$$0.useCallback(({ points }) => {
11353
12287
  state.pointsList.push(points);
11354
12288
  }, []);
11355
12289
  const pointUpComponent = (_c = (_b2 = (_a2 = window.blocklet) == null ? void 0 : _a2.componentMountPoints) == null ? void 0 : _b2.find) == null ? void 0 : _c.call(
@@ -11361,19 +12295,19 @@ var __publicField = (obj, key, value) => {
11361
12295
  pointUp(payload);
11362
12296
  }
11363
12297
  };
11364
- react.useEffect(() => {
12298
+ require$$0.useEffect(() => {
11365
12299
  wsClient.connect();
11366
12300
  return () => {
11367
12301
  if (wsClient.isConnected())
11368
12302
  ;
11369
12303
  };
11370
12304
  }, []);
11371
- const value = react.useMemo(() => {
12305
+ const value = require$$0.useMemo(() => {
11372
12306
  return {
11373
12307
  pointUp
11374
12308
  };
11375
12309
  }, []);
11376
- react.useEffect(() => {
12310
+ require$$0.useEffect(() => {
11377
12311
  if (state.pointsList.length > 0) {
11378
12312
  state.visible = true;
11379
12313
  state.currentPoints = +state.pointsList[0];
@@ -11446,8 +12380,8 @@ var __publicField = (obj, key, value) => {
11446
12380
  const selectedString = searchParams.get(urlName);
11447
12381
  const dataWithDefault = defaultButton && (data == null ? void 0 : data.length) > 0 ? [defaultButton, ...data] : data;
11448
12382
  const selectedArray = selectedString !== null && selectedString !== "" ? selectedString.split(",") : dataWithDefault == null ? void 0 : dataWithDefault.map((item) => item.id);
11449
- const [selectTab, setSelectTab] = react.useState(urlParams ? selectedArray : [boardId]);
11450
- const [selectAll, setSelectAll] = react.useState(false);
12383
+ const [selectTab, setSelectTab] = require$$0.useState(urlParams ? selectedArray : [boardId]);
12384
+ const [selectAll, setSelectAll] = require$$0.useState(false);
11451
12385
  const updateUrl = (url, newSelectTab) => {
11452
12386
  const formatNewSelectTab = newSelectTab.filter(Boolean);
11453
12387
  if (urlParams) {
@@ -11474,7 +12408,7 @@ var __publicField = (obj, key, value) => {
11474
12408
  return newSelectAll;
11475
12409
  });
11476
12410
  };
11477
- react.useEffect(() => {
12411
+ require$$0.useEffect(() => {
11478
12412
  if (JSON.stringify(selectedArray) !== JSON.stringify(selectTab)) {
11479
12413
  if (urlParams) {
11480
12414
  setSelectTab(selectedArray || []);
@@ -11489,7 +12423,7 @@ var __publicField = (obj, key, value) => {
11489
12423
  }
11490
12424
  }
11491
12425
  }, [data, boardId]);
11492
- react.useEffect(() => {
12426
+ require$$0.useEffect(() => {
11493
12427
  if (urlParams) {
11494
12428
  if (selectedString === null || selectedString === "") {
11495
12429
  setSelectAll(true);
@@ -11657,7 +12591,7 @@ var __publicField = (obj, key, value) => {
11657
12591
  }
11658
12592
  ) });
11659
12593
  }
11660
- const BlockletEditor = react.lazy(() => import("@blocklet/editor"));
12594
+ const BlockletEditor = require$$0.lazy(() => import("@blocklet/editor"));
11661
12595
  const Root = material.styled(material.Box)`
11662
12596
  .be-editable,
11663
12597
  .be-content {
@@ -11747,6 +12681,7 @@ var __publicField = (obj, key, value) => {
11747
12681
  exports2.getWsClient = getWsClient;
11748
12682
  exports2.lexicalUtils = lexical;
11749
12683
  exports2.preferences = preferences;
12684
+ exports2.preloadInput = preloadInput;
11750
12685
  exports2.routes = routes;
11751
12686
  exports2.themeOverrides = themeOverrides;
11752
12687
  exports2.translations = translations;