@zero-library/common 3.0.1 → 3.0.3

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.cjs.js CHANGED
@@ -5,10 +5,11 @@ var icons = require('@ant-design/icons');
5
5
  var antd = require('antd');
6
6
  var classNames2 = require('classnames');
7
7
  var docxPreview = require('docx-preview');
8
- var React = require('react');
8
+ var React3 = require('react');
9
9
  var AES = require('crypto-js/aes');
10
10
  var encUtf8 = require('crypto-js/enc-utf8');
11
11
  var htmlToText$1 = require('html-to-text');
12
+ var jsonrepair = require('jsonrepair');
12
13
  var MarkdownIt = require('markdown-it');
13
14
  var markdownItDefList = require('markdown-it-deflist');
14
15
  var markdownItEmoji = require('markdown-it-emoji');
@@ -21,7 +22,6 @@ var relativeTime = require('dayjs/plugin/relativeTime');
21
22
  var axios = require('axios');
22
23
  var markdownItKatex = require('@traptitech/markdown-it-katex');
23
24
  var parse = require('html-react-parser');
24
- var jsonrepair = require('jsonrepair');
25
25
  require('katex/dist/katex.min.css');
26
26
  var reactVirtual = require('@tanstack/react-virtual');
27
27
  var core$1 = require('@react-pdf-viewer/core');
@@ -33,6 +33,9 @@ var zh_CN = require('@react-pdf-viewer/locales/lib/zh_CN.json');
33
33
  require('@react-pdf-viewer/page-navigation/lib/styles/index.css');
34
34
  require('@react-pdf-viewer/thumbnail/lib/styles/index.css');
35
35
  require('@react-pdf-viewer/zoom/lib/styles/index.css');
36
+ var Editor = require('@monaco-editor/react');
37
+ var monaco = require('monaco-editor');
38
+ var pdfjsLib = require('pdfjs-dist-v5/legacy/build/pdf.mjs');
36
39
  var microApp = require('@micro-zoe/micro-app');
37
40
  var jsxCustomEvent = require('@micro-zoe/micro-app/polyfill/jsx-custom-event');
38
41
  var react = require('@tiptap/react');
@@ -60,6 +63,7 @@ var reactHotkeysHook = require('react-hotkeys-hook');
60
63
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
61
64
  var throttle = require('lodash.throttle');
62
65
 
66
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
63
67
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
64
68
 
65
69
  function _interopNamespace(e) {
@@ -81,7 +85,7 @@ function _interopNamespace(e) {
81
85
  }
82
86
 
83
87
  var classNames2__default = /*#__PURE__*/_interopDefault(classNames2);
84
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
88
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
85
89
  var AES__default = /*#__PURE__*/_interopDefault(AES);
86
90
  var encUtf8__default = /*#__PURE__*/_interopDefault(encUtf8);
87
91
  var MarkdownIt__default = /*#__PURE__*/_interopDefault(MarkdownIt);
@@ -96,6 +100,9 @@ var axios__default = /*#__PURE__*/_interopDefault(axios);
96
100
  var markdownItKatex__default = /*#__PURE__*/_interopDefault(markdownItKatex);
97
101
  var parse__default = /*#__PURE__*/_interopDefault(parse);
98
102
  var zh_CN__default = /*#__PURE__*/_interopDefault(zh_CN);
103
+ var Editor__default = /*#__PURE__*/_interopDefault(Editor);
104
+ var monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
105
+ var pdfjsLib__namespace = /*#__PURE__*/_interopNamespace(pdfjsLib);
99
106
  var microApp__default = /*#__PURE__*/_interopDefault(microApp);
100
107
  var jsxCustomEvent__default = /*#__PURE__*/_interopDefault(jsxCustomEvent);
101
108
  var TiptapHorizontalRule__default = /*#__PURE__*/_interopDefault(TiptapHorizontalRule);
@@ -126,7 +133,14 @@ var styles_module_default = {
126
133
  nsPreviewAudio: "styles_module_nsPreviewAudio",
127
134
  nsPreviewDocx: "styles_module_nsPreviewDocx",
128
135
  docxToolbar: "styles_module_docxToolbar",
129
- docxContent: "styles_module_docxContent"
136
+ docxContent: "styles_module_docxContent",
137
+ stateBody: "styles_module_stateBody",
138
+ pdfContainer: "styles_module_pdfContainer",
139
+ floatingToolbar: "styles_module_floatingToolbar",
140
+ divider: "styles_module_divider",
141
+ pdfBody: "styles_module_pdfBody",
142
+ pdfDocument: "styles_module_pdfDocument",
143
+ pdfPage: "styles_module_pdfPage"
130
144
  };
131
145
  var AudioPlayer_default = ({ fileUrl }) => {
132
146
  return /* @__PURE__ */ jsxRuntime.jsxs("audio", { controls: true, className: styles_module_default.nsPreviewAudio, children: [
@@ -914,6 +928,21 @@ var findTreeNodesByIds = (tree, ids, formatFn, options = {}) => {
914
928
  dfs(tree);
915
929
  return result;
916
930
  };
931
+ function safeParseJson(raw, options = {}) {
932
+ const shouldRepair = options.repair ?? false;
933
+ const fallbackMode = options.fallback ?? "raw";
934
+ const getFallbackValue = () => fallbackMode === "raw" ? raw : null;
935
+ try {
936
+ return JSON.parse(raw);
937
+ } catch {
938
+ if (!shouldRepair) return getFallbackValue();
939
+ }
940
+ try {
941
+ return JSON.parse(jsonrepair.jsonrepair(raw));
942
+ } catch {
943
+ return getFallbackValue();
944
+ }
945
+ }
917
946
  dayjs__default.default.extend(relativeTime__default.default);
918
947
  var DEFAULT_DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
919
948
  var DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
@@ -1280,9 +1309,9 @@ function createTokenManager({ key, storage = localStorage }) {
1280
1309
  };
1281
1310
  }
1282
1311
  var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
1283
- const containerRef = React.useRef(null);
1284
- const [zoomRatio, setZoomRatio] = React.useState(scale);
1285
- React.useEffect(() => {
1312
+ const containerRef = React3.useRef(null);
1313
+ const [zoomRatio, setZoomRatio] = React3.useState(scale);
1314
+ React3.useEffect(() => {
1286
1315
  if (!fileUrl || !containerRef.current) return;
1287
1316
  containerRef.current.innerHTML = "";
1288
1317
  fetch(fileUrl).then((res) => res.arrayBuffer()).then(async (arrayBuffer) => {
@@ -1330,9 +1359,16 @@ var DocxPreview_default = ({ fileUrl, scale = 1 }) => {
1330
1359
  };
1331
1360
  var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1332
1361
  const styles = { fontSize, color: "var(--ant-color-primary)" };
1333
- const Icon = React.useMemo(() => {
1362
+ const Icon = React3.useMemo(() => {
1334
1363
  switch (suffix?.toUpperCase()) {
1335
1364
  case "TXT":
1365
+ case "LOG":
1366
+ case "JSON":
1367
+ case "XML":
1368
+ case "YML":
1369
+ case "YAML":
1370
+ case "INI":
1371
+ case "CONF":
1336
1372
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileTextOutlined, {});
1337
1373
  case "PDF":
1338
1374
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FilePdfOutlined, {});
@@ -1341,8 +1377,10 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1341
1377
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileWordOutlined, {});
1342
1378
  case "XLS":
1343
1379
  case "XLSX":
1380
+ case "CSV":
1344
1381
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileExcelOutlined, {});
1345
1382
  case "PPT":
1383
+ case "PPTX":
1346
1384
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FilePptOutlined, {});
1347
1385
  case "MP4":
1348
1386
  case "MOV":
@@ -1360,6 +1398,7 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1360
1398
  case "JPEG":
1361
1399
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileJpgOutlined, {});
1362
1400
  case "PNG":
1401
+ case "WEBP":
1363
1402
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileImageOutlined, {});
1364
1403
  case "GIF":
1365
1404
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileGifOutlined, {});
@@ -1369,6 +1408,8 @@ var FileIcon_default = ({ suffix, fontSize = 22 }) => {
1369
1408
  case "ZIP":
1370
1409
  case "RAR":
1371
1410
  case "7Z":
1411
+ case "TAR":
1412
+ case "GZ":
1372
1413
  return /* @__PURE__ */ jsxRuntime.jsx(icons.FileZipOutlined, {});
1373
1414
  case "CATALOG":
1374
1415
  return /* @__PURE__ */ jsxRuntime.jsx("i", { style: styles, className: "iconfont icon-wenjianjia" });
@@ -1395,18 +1436,18 @@ var baseComponentMap = {
1395
1436
  };
1396
1437
  var lazyCache = /* @__PURE__ */ new Map();
1397
1438
  var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }) => {
1398
- const loader = customComponents?.[type] || baseComponentMap[type];
1399
- const LazyComponent = React.useMemo(() => {
1400
- if (!loader) return null;
1439
+ const loader2 = customComponents?.[type] || baseComponentMap[type];
1440
+ const LazyComponent = React3.useMemo(() => {
1441
+ if (!loader2) return null;
1401
1442
  const cached = lazyCache.get(type);
1402
1443
  if (cached) return cached;
1403
- const component = React.lazy(loader);
1444
+ const component = React3.lazy(loader2);
1404
1445
  lazyCache.set(type, component);
1405
1446
  return component;
1406
- }, [loader]);
1447
+ }, [loader2]);
1407
1448
  if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { title: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
1408
1449
  return /* @__PURE__ */ jsxRuntime.jsx(
1409
- React.Suspense,
1450
+ React3.Suspense,
1410
1451
  {
1411
1452
  fallback: /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton.Node, { active: true, className: styles_module_default2.skeleton, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", children: "\u7EC4\u4EF6\u52A0\u8F7D\u4E2D..." }) }),
1412
1453
  children: /* @__PURE__ */ jsxRuntime.jsx(LazyComponent, { ...rest })
@@ -1419,19 +1460,6 @@ md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
1419
1460
  token.attrPush(["target", "_blank"]);
1420
1461
  return self.renderToken(tokens, idx, options);
1421
1462
  };
1422
- function parseData(raw) {
1423
- let obj = {};
1424
- try {
1425
- obj = JSON.parse(raw);
1426
- } catch {
1427
- try {
1428
- obj = JSON.parse(jsonrepair.jsonrepair(raw));
1429
- } catch {
1430
- obj = { _raw: raw };
1431
- }
1432
- }
1433
- return obj;
1434
- }
1435
1463
  function highlightKeywords(html, keywords) {
1436
1464
  const escaped = keywords.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
1437
1465
  const regex = new RegExp(`(${escaped.join("|")})`, "gi");
@@ -1506,7 +1534,7 @@ var filterMarkdown = (content = "") => {
1506
1534
  return content.replace(/<!--[\s\S]*?(?:-->|$)/g, "");
1507
1535
  };
1508
1536
  var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...rest }) => {
1509
- const reactContent = React.useMemo(() => {
1537
+ const reactContent = React3.useMemo(() => {
1510
1538
  if (!content) return null;
1511
1539
  const { text: preprocessed, placeholders } = alertMarkClean(filterMarkdown(content));
1512
1540
  let rawHtml = md.render(preprocessed);
@@ -1523,7 +1551,7 @@ var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...
1523
1551
  let data = {};
1524
1552
  if (/^__ALERT_DATA_\d+__$/.test(dataAttr)) {
1525
1553
  const raw = placeholders.get(dataAttr) ?? "";
1526
- data = parseData(raw);
1554
+ data = safeParseJson(raw, { repair: true, fallback: "null" }) ?? { _raw: raw };
1527
1555
  }
1528
1556
  return /* @__PURE__ */ jsxRuntime.jsx(LazyComponent_default, { customComponents, type, data, loading, ...rest }, `${type}${lazyIndex}`);
1529
1557
  }
@@ -1533,8 +1561,8 @@ var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...
1533
1561
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ns-markdown", children: reactContent });
1534
1562
  };
1535
1563
  var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1536
- const [content, setContent] = React.useState("");
1537
- const [error, setError] = React.useState("");
1564
+ const [content, setContent] = React3.useState("");
1565
+ const [error, setError] = React3.useState("");
1538
1566
  const fetchMarkdown = async () => {
1539
1567
  const res = await fetch(fileUrl);
1540
1568
  if (res.status !== 200) {
@@ -1560,7 +1588,7 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1560
1588
  setError("\u6587\u4EF6\u5730\u5740\u9519\u8BEF");
1561
1589
  }
1562
1590
  };
1563
- React.useEffect(() => {
1591
+ React3.useEffect(() => {
1564
1592
  init();
1565
1593
  }, [fileUrl]);
1566
1594
  const wrapInCodeFence = (text) => {
@@ -1571,7 +1599,7 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1571
1599
  ${text}
1572
1600
  ${fence}`;
1573
1601
  };
1574
- const newContent = React.useMemo(() => {
1602
+ const newContent = React3.useMemo(() => {
1575
1603
  return content ? asPlainText ? wrapInCodeFence(content) : content : "";
1576
1604
  }, [content, asPlainText]);
1577
1605
  return error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "height-full width-full", children: /* @__PURE__ */ jsxRuntime.jsx(RenderMarkdown_default, { content: newContent, searchValue }) });
@@ -1659,34 +1687,34 @@ if (window) {
1659
1687
  window.addEventListener("message", handleGlobalMessage);
1660
1688
  }
1661
1689
  var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
1662
- const ctxRef = React.useRef({
1690
+ const ctxRef = React3.useRef({
1663
1691
  handlers: {},
1664
1692
  allowedOrigins
1665
1693
  });
1666
1694
  ctxRef.current.allowedOrigins = allowedOrigins;
1667
- React.useEffect(() => {
1695
+ React3.useEffect(() => {
1668
1696
  const ctx = ctxRef.current;
1669
1697
  hookInstances.add(ctx);
1670
1698
  return () => {
1671
1699
  hookInstances.delete(ctx);
1672
1700
  };
1673
1701
  }, []);
1674
- const on = React.useCallback((type, handler) => {
1702
+ const on = React3.useCallback((type, handler) => {
1675
1703
  const handlers = ctxRef.current.handlers;
1676
1704
  handlers[type] = handlers[type] || [];
1677
1705
  handlers[type].push(handler);
1678
1706
  }, []);
1679
- const off = React.useCallback((type, handler) => {
1707
+ const off = React3.useCallback((type, handler) => {
1680
1708
  const handlers = ctxRef.current.handlers;
1681
1709
  if (handlers[type]) {
1682
1710
  handlers[type] = handlers[type].filter((fn) => fn !== handler);
1683
1711
  }
1684
1712
  }, []);
1685
- return React.useMemo(() => ({ on, off }), [on, off]);
1713
+ return React3.useMemo(() => ({ on, off }), [on, off]);
1686
1714
  };
1687
1715
  var useRefState_default = (init) => {
1688
- const [state, setState] = React.useState(init);
1689
- const stateRef = React.useRef(init);
1716
+ const [state, setState] = React3.useState(init);
1717
+ const stateRef = React3.useRef(init);
1690
1718
  const setProxy = (newVal) => {
1691
1719
  stateRef.current = newVal;
1692
1720
  setState(newVal);
@@ -1697,19 +1725,19 @@ var useRefState_default = (init) => {
1697
1725
 
1698
1726
  // src/hooks/useAsyncQueue.ts
1699
1727
  var useAsyncQueue_default = () => {
1700
- const [queue, setQueue] = React.useState([]);
1701
- const [enabled, setEnabled] = React.useState(true);
1728
+ const [queue, setQueue] = React3.useState([]);
1729
+ const [enabled, setEnabled] = React3.useState(true);
1702
1730
  const [running, setRunning, getRunning] = useRefState_default(false);
1703
- const addToQueue = React.useCallback((func, ...args) => {
1731
+ const addToQueue = React3.useCallback((func, ...args) => {
1704
1732
  setQueue((prevQueue) => [...prevQueue, { func, args }]);
1705
1733
  }, []);
1706
- const executeQueue = React.useCallback((nextEnabled) => {
1734
+ const executeQueue = React3.useCallback((nextEnabled) => {
1707
1735
  setEnabled(nextEnabled);
1708
1736
  }, []);
1709
- const clearQueue = React.useCallback(() => {
1737
+ const clearQueue = React3.useCallback(() => {
1710
1738
  setQueue([]);
1711
1739
  }, []);
1712
- React.useEffect(() => {
1740
+ React3.useEffect(() => {
1713
1741
  if (!enabled) return;
1714
1742
  if (getRunning()) return;
1715
1743
  if (queue.length === 0) return;
@@ -1734,15 +1762,15 @@ var useAsyncQueue_default = () => {
1734
1762
  };
1735
1763
  };
1736
1764
  var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4) => {
1737
- const timerRef = React.useRef(null);
1738
- const shouldRefreshRef = React.useRef(shouldRefresh);
1739
- const callbackRef = React.useRef(callback);
1740
- const [num, setNum] = React.useState(0);
1741
- React.useEffect(() => {
1765
+ const timerRef = React3.useRef(null);
1766
+ const shouldRefreshRef = React3.useRef(shouldRefresh);
1767
+ const callbackRef = React3.useRef(callback);
1768
+ const [num, setNum] = React3.useState(0);
1769
+ React3.useEffect(() => {
1742
1770
  shouldRefreshRef.current = shouldRefresh;
1743
1771
  callbackRef.current = callback;
1744
1772
  }, [shouldRefresh, callback]);
1745
- React.useEffect(() => {
1773
+ React3.useEffect(() => {
1746
1774
  if (timerRef.current) {
1747
1775
  clearTimeout(timerRef.current);
1748
1776
  timerRef.current = null;
@@ -1761,9 +1789,9 @@ var useAutoRefresh_default = (listenValue, shouldRefresh, callback, delay = 1e4)
1761
1789
  }, [listenValue, delay, num]);
1762
1790
  };
1763
1791
  var useCountDown_default = (callback) => {
1764
- const [count, setCount] = React.useState(0);
1765
- const [startCount, setStartCount] = React.useState(0);
1766
- const timer = React.useRef(null);
1792
+ const [count, setCount] = React3.useState(0);
1793
+ const [startCount, setStartCount] = React3.useState(0);
1794
+ const timer = React3.useRef(null);
1767
1795
  const pause = () => {
1768
1796
  clearInterval(timer.current);
1769
1797
  timer.current = null;
@@ -1776,12 +1804,12 @@ var useCountDown_default = (callback) => {
1776
1804
  setCount((count2) => count2 - 1);
1777
1805
  }, 1e3);
1778
1806
  };
1779
- React.useEffect(() => {
1807
+ React3.useEffect(() => {
1780
1808
  return () => {
1781
1809
  pause();
1782
1810
  };
1783
1811
  }, []);
1784
- React.useEffect(() => {
1812
+ React3.useEffect(() => {
1785
1813
  if (count === 0 && startCount !== 0) {
1786
1814
  pause();
1787
1815
  callback?.();
@@ -1790,10 +1818,10 @@ var useCountDown_default = (callback) => {
1790
1818
  return { count, start, pause, startCount };
1791
1819
  };
1792
1820
  var useCreateValtioContext_default = () => {
1793
- const Context = React.createContext(null);
1821
+ const Context = React3.createContext(null);
1794
1822
  const ValtioProvider = ({ store, children }) => /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value: store, children });
1795
1823
  const useValtioStore = () => {
1796
- const store = React.useContext(Context);
1824
+ const store = React3.useContext(Context);
1797
1825
  if (!store) throw new Error("useStore must be used within Provider");
1798
1826
  return store;
1799
1827
  };
@@ -1805,8 +1833,8 @@ var useCreateValtioContext_default = () => {
1805
1833
  };
1806
1834
  };
1807
1835
  var useDebounce_default = (func, wait = 400) => {
1808
- const { current } = React.useRef({ func, timeOut: null });
1809
- React.useEffect(() => {
1836
+ const { current } = React3.useRef({ func, timeOut: null });
1837
+ React3.useEffect(() => {
1810
1838
  current.func = func;
1811
1839
  }, [func]);
1812
1840
  let args;
@@ -1838,12 +1866,12 @@ var useDebounce_default = (func, wait = 400) => {
1838
1866
  }
1839
1867
  debounce.flush = flush;
1840
1868
  debounce.cancel = cancel;
1841
- return React.useCallback(debounce, []);
1869
+ return React3.useCallback(debounce, []);
1842
1870
  };
1843
1871
  var useDeepEffect_default = (effect, deps) => {
1844
- const prevDepsRef = React.useRef();
1872
+ const prevDepsRef = React3.useRef();
1845
1873
  const depsChanged = !prevDepsRef.current || deps.length !== prevDepsRef.current.length || deps.some((dep, i) => !deepEqual(dep, prevDepsRef.current[i]));
1846
- React.useEffect(() => {
1874
+ React3.useEffect(() => {
1847
1875
  if (depsChanged) {
1848
1876
  prevDepsRef.current = deps;
1849
1877
  return effect();
@@ -1851,8 +1879,8 @@ var useDeepEffect_default = (effect, deps) => {
1851
1879
  }, [depsChanged, effect, ...deps]);
1852
1880
  };
1853
1881
  var useSyncInput_default = (storeValue, setStoreValue) => {
1854
- const [inputValue, setInputValue] = React.useState(storeValue);
1855
- React.useEffect(() => {
1882
+ const [inputValue, setInputValue] = React3.useState(storeValue);
1883
+ React3.useEffect(() => {
1856
1884
  if (storeValue !== inputValue) {
1857
1885
  setInputValue(storeValue);
1858
1886
  }
@@ -1867,8 +1895,8 @@ var useSyncInput_default = (storeValue, setStoreValue) => {
1867
1895
  };
1868
1896
  };
1869
1897
  var useThrottle_default = (func, wait) => {
1870
- const { current } = React.useRef({ func, timeOut: null });
1871
- React.useEffect(() => {
1898
+ const { current } = React3.useRef({ func, timeOut: null });
1899
+ React3.useEffect(() => {
1872
1900
  current.func = func;
1873
1901
  }, [func]);
1874
1902
  let args;
@@ -1899,7 +1927,7 @@ var useThrottle_default = (func, wait) => {
1899
1927
  }
1900
1928
  throttle2.flush = flush;
1901
1929
  throttle2.cancel = cancel;
1902
- return React.useCallback(throttle2, []);
1930
+ return React3.useCallback(throttle2, []);
1903
1931
  };
1904
1932
 
1905
1933
  // src/hooks/webSocket/WebSocketManager.ts
@@ -2182,17 +2210,17 @@ var useWebSocket_default = ({
2182
2210
  maxReconnectAttempts,
2183
2211
  isReconnect = true
2184
2212
  }) => {
2185
- const [socketReadyState, setSocketReadyState] = React.useState(null);
2186
- const onMessageRef = React.useRef(onMessage);
2187
- React.useEffect(() => {
2213
+ const [socketReadyState, setSocketReadyState] = React3.useState(null);
2214
+ const onMessageRef = React3.useRef(onMessage);
2215
+ React3.useEffect(() => {
2188
2216
  onMessageRef.current = onMessage;
2189
2217
  }, [onMessage]);
2190
- const onCloseRef = React.useRef(onClose);
2191
- React.useEffect(() => {
2218
+ const onCloseRef = React3.useRef(onClose);
2219
+ React3.useEffect(() => {
2192
2220
  onCloseRef.current = onClose;
2193
2221
  }, [onClose]);
2194
- const managerRef = React.useRef(null);
2195
- React.useEffect(() => {
2222
+ const managerRef = React3.useRef(null);
2223
+ React3.useEffect(() => {
2196
2224
  if (!url) return;
2197
2225
  const manager = WebSocketManager.getInstance({
2198
2226
  url,
@@ -2215,7 +2243,7 @@ var useWebSocket_default = ({
2215
2243
  managerRef.current = null;
2216
2244
  };
2217
2245
  }, [url]);
2218
- const sendMessage = React.useCallback((message3) => {
2246
+ const sendMessage = React3.useCallback((message3) => {
2219
2247
  managerRef.current?.sendMessage(message3);
2220
2248
  }, []);
2221
2249
  return {
@@ -2227,9 +2255,9 @@ var THUMB_IMG_HEIGHT = 514;
2227
2255
  var MAIN_IMG_HEIGHT = 800;
2228
2256
  var MAIN_IMG_WIDTH = 600;
2229
2257
  var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = true, onSetPageNo }) => {
2230
- const [images, setImages] = React.useState([]);
2258
+ const [images, setImages] = React3.useState([]);
2231
2259
  const [currentIndex, setCurrentIndex, getCurrentIndex] = useRefState_default(0);
2232
- const [error, setError] = React.useState("");
2260
+ const [error, setError] = React3.useState("");
2233
2261
  const fetchPdfImages = async () => {
2234
2262
  const res = await fetch(fileUrl);
2235
2263
  if (res.status !== 200) {
@@ -2255,14 +2283,14 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2255
2283
  setError("pdf\u5730\u5740\u9519\u8BEF");
2256
2284
  }
2257
2285
  };
2258
- React.useEffect(() => {
2286
+ React3.useEffect(() => {
2259
2287
  init();
2260
2288
  }, [fileUrl]);
2261
2289
  const handlePageNoChange = (index) => {
2262
2290
  setCurrentIndex(index);
2263
2291
  onSetPageNo?.(images[index]?.pageNum);
2264
2292
  };
2265
- const thumbsParentRef = React.useRef(null);
2293
+ const thumbsParentRef = React3.useRef(null);
2266
2294
  const thumbsVirtualizer = reactVirtual.useVirtualizer({
2267
2295
  count: images.length,
2268
2296
  getScrollElement: () => thumbsParentRef.current,
@@ -2270,14 +2298,14 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2270
2298
  // 缩略图高度(含 margin)
2271
2299
  overscan: 3
2272
2300
  });
2273
- const containerRef = React.useRef(null);
2301
+ const containerRef = React3.useRef(null);
2274
2302
  const virtualizer = reactVirtual.useVirtualizer({
2275
2303
  count: images.length,
2276
2304
  getScrollElement: () => containerRef.current,
2277
2305
  estimateSize: () => MAIN_IMG_HEIGHT * zoom,
2278
2306
  overscan: 2
2279
2307
  });
2280
- const rAFRef = React.useRef(null);
2308
+ const rAFRef = React3.useRef(null);
2281
2309
  const onScroll = useDebounce_default(() => {
2282
2310
  if (rAFRef.current) cancelAnimationFrame(rAFRef.current);
2283
2311
  rAFRef.current = requestAnimationFrame(() => {
@@ -2302,7 +2330,7 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2302
2330
  }
2303
2331
  });
2304
2332
  }, 300);
2305
- React.useEffect(() => {
2333
+ React3.useEffect(() => {
2306
2334
  const el = containerRef.current;
2307
2335
  if (!el) return;
2308
2336
  el.addEventListener("scroll", onScroll, { passive: true });
@@ -2321,13 +2349,13 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2321
2349
  }
2322
2350
  return getCurrentIndex() ?? 0;
2323
2351
  };
2324
- React.useEffect(() => {
2352
+ React3.useEffect(() => {
2325
2353
  const index = getIndex(pageNo);
2326
2354
  if (index !== getCurrentIndex()) {
2327
2355
  virtualizer.scrollToIndex(index);
2328
2356
  }
2329
2357
  }, [images, pageNo, virtualizer, thumbsVirtualizer]);
2330
- const [zoom, setZoom] = React.useState(1);
2358
+ const [zoom, setZoom] = React3.useState(1);
2331
2359
  const zoomIn = () => setZoom((z) => Math.min(z + 0.2, 3));
2332
2360
  const zoomOut = () => setZoom((z) => Math.max(z - 0.2, 0.4));
2333
2361
  const zoomFitWidth = () => {
@@ -2338,12 +2366,12 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
2338
2366
  const nextZoom = (containerWidth - 24) / MAIN_IMG_WIDTH;
2339
2367
  setZoom(Math.max(0.4, Math.min(nextZoom, 3)));
2340
2368
  };
2341
- React.useEffect(() => {
2369
+ React3.useEffect(() => {
2342
2370
  if (scale) {
2343
2371
  setZoom(scale);
2344
2372
  }
2345
2373
  }, [scale]);
2346
- React.useEffect(() => {
2374
+ React3.useEffect(() => {
2347
2375
  if (zoom) {
2348
2376
  virtualizer.measure();
2349
2377
  setTimeout(() => {
@@ -2474,12 +2502,12 @@ var openLinksNewTabPlugin = () => {
2474
2502
  };
2475
2503
  };
2476
2504
  var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumbnails = true, onSetPassword, onSetPageNo }) => {
2477
- const embedRef = React.useRef(null);
2478
- const [sizes, setSizes] = React.useState([0]);
2505
+ const embedRef = React3.useRef(null);
2506
+ const [sizes, setSizes] = React3.useState([0]);
2479
2507
  const [docLoaded, setDocLoaded, getDocLoaded] = useRefState_default(false);
2480
2508
  const [, setCurrentPage, getCurrentPage] = useRefState_default(void 0);
2481
- const [temporaryPassword, setTemporaryPassword] = React.useState("");
2482
- const jumpToPageNo = React.useRef();
2509
+ const [temporaryPassword, setTemporaryPassword] = React3.useState("");
2510
+ const jumpToPageNo = React3.useRef();
2483
2511
  const onVerifyPasswordEnd = (password2) => {
2484
2512
  setTemporaryPassword(password2);
2485
2513
  };
@@ -2533,12 +2561,12 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2533
2561
  setTemporaryPassword("");
2534
2562
  }
2535
2563
  };
2536
- React.useEffect(() => {
2564
+ React3.useEffect(() => {
2537
2565
  setCurrentPage(void 0);
2538
2566
  setDocLoaded(false);
2539
2567
  setSizes([0]);
2540
2568
  }, [fileUrl]);
2541
- React.useEffect(() => {
2569
+ React3.useEffect(() => {
2542
2570
  setTimeout(() => {
2543
2571
  onJumpToPage(pageNo);
2544
2572
  }, 0);
@@ -2630,7 +2658,7 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
2630
2658
  ] }) }) });
2631
2659
  };
2632
2660
  var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps, onSetPassword }) => {
2633
- const Preview = React.useMemo(() => {
2661
+ const Preview = React3.useMemo(() => {
2634
2662
  if (!fileUrl) {
2635
2663
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { ...emptyProps });
2636
2664
  }
@@ -2664,6 +2692,533 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
2664
2692
  }, [suffix, fileUrl, pdfParams]);
2665
2693
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
2666
2694
  };
2695
+ Editor.loader.config({ monaco: monaco__namespace });
2696
+ var getLanguage = (suffix) => {
2697
+ switch (suffix.toLowerCase()) {
2698
+ case "ts":
2699
+ case "tsx":
2700
+ return "typescript";
2701
+ case "js":
2702
+ case "jsx":
2703
+ return "javascript";
2704
+ case "json":
2705
+ return "json";
2706
+ case "css":
2707
+ return "css";
2708
+ case "less":
2709
+ return "less";
2710
+ case "scss":
2711
+ return "scss";
2712
+ case "html":
2713
+ case "htm":
2714
+ return "html";
2715
+ case "xml":
2716
+ return "xml";
2717
+ case "py":
2718
+ return "python";
2719
+ case "java":
2720
+ return "java";
2721
+ case "go":
2722
+ return "go";
2723
+ case "yaml":
2724
+ case "yml":
2725
+ return "yaml";
2726
+ case "md":
2727
+ case "markdown":
2728
+ return "markdown";
2729
+ default:
2730
+ return "plaintext";
2731
+ }
2732
+ };
2733
+ var CodePreview = ({ fileUrl, suffix }) => {
2734
+ const [content, setContent] = React3.useState("");
2735
+ const [error, setError] = React3.useState("");
2736
+ const [loading, setLoading] = React3.useState(false);
2737
+ const fetchContent = async (signal) => {
2738
+ const headers = {
2739
+ "Content-Type": "application/json"
2740
+ };
2741
+ const res = await fetch(fileUrl, { headers, signal });
2742
+ if (res.status !== 200) {
2743
+ throw new Error(`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${res.status}`);
2744
+ }
2745
+ const buffer = await res.arrayBuffer();
2746
+ let text = "";
2747
+ try {
2748
+ const decoder = new TextDecoder("utf-8", { fatal: true });
2749
+ text = decoder.decode(buffer);
2750
+ } catch (e) {
2751
+ const gbkDecoder = new TextDecoder("gbk");
2752
+ text = gbkDecoder.decode(buffer);
2753
+ }
2754
+ setContent(text);
2755
+ };
2756
+ React3.useEffect(() => {
2757
+ const controller = new AbortController();
2758
+ const init = async () => {
2759
+ setContent("");
2760
+ setError("");
2761
+ if (fileUrl) {
2762
+ try {
2763
+ setLoading(true);
2764
+ await fetchContent(controller.signal);
2765
+ } catch (error2) {
2766
+ if (!controller.signal.aborted) {
2767
+ setError("\u52A0\u8F7D\u6587\u4EF6\u5931\u8D25");
2768
+ }
2769
+ } finally {
2770
+ if (!controller.signal.aborted) {
2771
+ setLoading(false);
2772
+ }
2773
+ }
2774
+ }
2775
+ };
2776
+ init();
2777
+ return () => {
2778
+ controller.abort();
2779
+ };
2780
+ }, [fileUrl]);
2781
+ if (error) {
2782
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error });
2783
+ }
2784
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", width: "100%", position: "relative" }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(
2785
+ Editor__default.default,
2786
+ {
2787
+ height: "100%",
2788
+ defaultLanguage: getLanguage(suffix || ""),
2789
+ value: content,
2790
+ options: {
2791
+ readOnly: true,
2792
+ minimap: { enabled: false },
2793
+ lineNumbers: "on",
2794
+ wordWrap: "on",
2795
+ fontSize: 14,
2796
+ unicodeHighlight: {
2797
+ invisibleCharacters: false,
2798
+ ambiguousCharacters: false
2799
+ }
2800
+ }
2801
+ }
2802
+ ) });
2803
+ };
2804
+ var CodePreview_default = CodePreview;
2805
+ var { Text } = antd.Typography;
2806
+ pdfjsLib__namespace.GlobalWorkerOptions.workerSrc = new URL("./pdf.worker.min.mjs", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs.js', document.baseURI).href))).toString();
2807
+ var MIN_SCALE = 0.6;
2808
+ var MAX_SCALE = 1.5;
2809
+ var SCALE_STEP = 0.1;
2810
+ var PdfPage = React3__namespace.default.memo(({ pdf, pageNumber, scale, scrollContainerRef, defaultSize }) => {
2811
+ const canvasRef = React3.useRef(null);
2812
+ const containerRef = React3.useRef(null);
2813
+ const [loading, setLoading] = React3.useState(false);
2814
+ const renderTaskRef = React3.useRef(null);
2815
+ const [dimensions, setDimensions] = React3.useState(null);
2816
+ const [shouldRender2, setShouldRender] = React3.useState(false);
2817
+ React3.useEffect(() => {
2818
+ const el = containerRef.current;
2819
+ if (!el) return;
2820
+ const renderObserver = new IntersectionObserver(
2821
+ ([entry]) => {
2822
+ setShouldRender(entry.isIntersecting);
2823
+ },
2824
+ {
2825
+ root: scrollContainerRef.current,
2826
+ rootMargin: "100% 0px"
2827
+ }
2828
+ );
2829
+ renderObserver.observe(el);
2830
+ return () => {
2831
+ renderObserver.disconnect();
2832
+ };
2833
+ }, [scrollContainerRef]);
2834
+ React3.useEffect(() => {
2835
+ setDimensions(null);
2836
+ }, [scale]);
2837
+ React3.useEffect(() => {
2838
+ if (!shouldRender2 || !pdf || !canvasRef.current) return;
2839
+ const render = async () => {
2840
+ if (renderTaskRef.current) {
2841
+ renderTaskRef.current.cancel();
2842
+ }
2843
+ try {
2844
+ setLoading(true);
2845
+ const page = await pdf.getPage(pageNumber);
2846
+ const dpr = window.devicePixelRatio || 1;
2847
+ const viewport = page.getViewport({ scale });
2848
+ const nextDimensions = { width: viewport.width, height: viewport.height };
2849
+ setDimensions(nextDimensions);
2850
+ const canvas = canvasRef.current;
2851
+ if (!canvas) return;
2852
+ const ctx = canvas.getContext("2d");
2853
+ if (!ctx) return;
2854
+ canvas.width = Math.floor(viewport.width * dpr);
2855
+ canvas.height = Math.floor(viewport.height * dpr);
2856
+ canvas.style.width = `${viewport.width}px`;
2857
+ canvas.style.height = `${viewport.height}px`;
2858
+ const renderTask = page.render({
2859
+ canvasContext: ctx,
2860
+ viewport,
2861
+ transform: [dpr, 0, 0, dpr, 0, 0]
2862
+ });
2863
+ renderTaskRef.current = renderTask;
2864
+ await renderTask.promise;
2865
+ setLoading(false);
2866
+ } catch (error) {
2867
+ if (error.name !== "RenderingCancelledException") {
2868
+ console.error(`Error rendering page ${pageNumber}:`, error);
2869
+ }
2870
+ setLoading(false);
2871
+ }
2872
+ };
2873
+ render();
2874
+ return () => {
2875
+ if (renderTaskRef.current) {
2876
+ renderTaskRef.current.cancel();
2877
+ }
2878
+ };
2879
+ }, [shouldRender2, pdf, pageNumber, scale]);
2880
+ const width = dimensions?.width || defaultSize?.width || "100%";
2881
+ const height = dimensions?.height || defaultSize?.height || 800;
2882
+ return /* @__PURE__ */ jsxRuntime.jsx(
2883
+ "div",
2884
+ {
2885
+ ref: containerRef,
2886
+ className: styles_module_default.pdfPage,
2887
+ id: `pdf-page-${pageNumber}`,
2888
+ style: {
2889
+ width,
2890
+ height,
2891
+ position: "relative"
2892
+ },
2893
+ children: shouldRender2 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2894
+ /* @__PURE__ */ jsxRuntime.jsx("canvas", { ref: canvasRef, style: { display: "block" } }),
2895
+ loading && /* @__PURE__ */ jsxRuntime.jsx(
2896
+ "div",
2897
+ {
2898
+ style: {
2899
+ position: "absolute",
2900
+ top: 0,
2901
+ left: 0,
2902
+ right: 0,
2903
+ bottom: 0,
2904
+ display: "flex",
2905
+ alignItems: "center",
2906
+ justifyContent: "center",
2907
+ background: "rgba(255,255,255,0.8)"
2908
+ },
2909
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {})
2910
+ }
2911
+ )
2912
+ ] })
2913
+ }
2914
+ );
2915
+ });
2916
+ var DocumentPreview = ({ fileUrl, previewEnabled = true }) => {
2917
+ const [loading, setLoading] = React3.useState(false);
2918
+ const [pdf, setPdf] = React3.useState(null);
2919
+ const [numPages, setNumPages] = React3.useState(0);
2920
+ const [pageNumber, setPageNumber] = React3.useState(1);
2921
+ const [scale, setScale] = React3.useState(1);
2922
+ const [error, setError] = React3.useState(null);
2923
+ const containerRef = React3.useRef(null);
2924
+ const pdfLoadingTaskRef = React3.useRef(null);
2925
+ const [defaultSize, setDefaultSize] = React3.useState(void 0);
2926
+ React3.useEffect(() => {
2927
+ let aborted = false;
2928
+ const load = async () => {
2929
+ if (pdfLoadingTaskRef.current) {
2930
+ try {
2931
+ pdfLoadingTaskRef.current.destroy();
2932
+ } catch (e) {
2933
+ }
2934
+ pdfLoadingTaskRef.current = null;
2935
+ }
2936
+ setError(null);
2937
+ setPdf(null);
2938
+ setNumPages(0);
2939
+ setPageNumber(1);
2940
+ setDefaultSize(void 0);
2941
+ if (!previewEnabled || !fileUrl) {
2942
+ return;
2943
+ }
2944
+ setLoading(true);
2945
+ try {
2946
+ const loadingTask = pdfjsLib__namespace.getDocument({
2947
+ url: fileUrl,
2948
+ disableFontFace: true,
2949
+ // 强制将所有字体转换为路径绘制,解决浏览器字体加载拦截/失败导致的文字空白问题
2950
+ disableAutoFetch: true,
2951
+ disableStream: true,
2952
+ rangeChunkSize: 1024 * 512
2953
+ });
2954
+ pdfLoadingTaskRef.current = loadingTask;
2955
+ const doc = await loadingTask.promise;
2956
+ if (aborted) return;
2957
+ setPdf(doc);
2958
+ setNumPages(doc.numPages);
2959
+ setPageNumber(1);
2960
+ if (containerRef.current) {
2961
+ containerRef.current.scrollTop = 0;
2962
+ }
2963
+ try {
2964
+ const page1 = await doc.getPage(1);
2965
+ const viewport = page1.getViewport({ scale: 1 });
2966
+ if (!aborted) {
2967
+ setDefaultSize({ width: viewport.width, height: viewport.height });
2968
+ }
2969
+ } catch (e) {
2970
+ console.warn("Failed to get page 1 size", e);
2971
+ }
2972
+ } catch (e) {
2973
+ if (aborted) return;
2974
+ const message3 = e?.message;
2975
+ if (typeof message3 === "string" && message3.includes("cancelled")) ; else if (typeof message3 === "string" && message3.includes("(903)")) {
2976
+ setError("\u9884\u89C8\u6587\u4EF6\u6B63\u5728\u751F\u6210\u4E2D...");
2977
+ } else {
2978
+ setError(message3 || "PDF \u52A0\u8F7D\u5931\u8D25");
2979
+ }
2980
+ } finally {
2981
+ if (!aborted) {
2982
+ setLoading(false);
2983
+ }
2984
+ }
2985
+ };
2986
+ load();
2987
+ return () => {
2988
+ aborted = true;
2989
+ if (pdfLoadingTaskRef.current) {
2990
+ try {
2991
+ pdfLoadingTaskRef.current.destroy();
2992
+ } catch (e) {
2993
+ }
2994
+ pdfLoadingTaskRef.current = null;
2995
+ }
2996
+ };
2997
+ }, [fileUrl, previewEnabled]);
2998
+ React3.useEffect(() => {
2999
+ const container = containerRef.current;
3000
+ if (!container || numPages === 0) return;
3001
+ let rafId = 0;
3002
+ const onScroll = () => {
3003
+ if (rafId) return;
3004
+ rafId = window.requestAnimationFrame(() => {
3005
+ rafId = 0;
3006
+ const { scrollTop, clientHeight, scrollHeight } = container;
3007
+ if (scrollTop <= 10) {
3008
+ setPageNumber(1);
3009
+ return;
3010
+ }
3011
+ if (scrollTop + clientHeight >= scrollHeight - 10) {
3012
+ setPageNumber(numPages);
3013
+ return;
3014
+ }
3015
+ const containerRect = container.getBoundingClientRect();
3016
+ const centerY = containerRect.top + clientHeight / 2;
3017
+ let closestPage = 1;
3018
+ let closestDistance = Number.POSITIVE_INFINITY;
3019
+ for (let i = 1; i <= numPages; i++) {
3020
+ const el = window.document.getElementById(`pdf-page-${i}`);
3021
+ if (!el) continue;
3022
+ const rect = el.getBoundingClientRect();
3023
+ const pageCenter = rect.top + rect.height / 2;
3024
+ const distance = Math.abs(pageCenter - centerY);
3025
+ if (distance < closestDistance) {
3026
+ closestDistance = distance;
3027
+ closestPage = i;
3028
+ }
3029
+ }
3030
+ setPageNumber(closestPage);
3031
+ });
3032
+ };
3033
+ container.addEventListener("scroll", onScroll, { passive: true });
3034
+ return () => {
3035
+ if (rafId) window.cancelAnimationFrame(rafId);
3036
+ container.removeEventListener("scroll", onScroll);
3037
+ };
3038
+ }, [numPages]);
3039
+ const scrollToPage = (pageNum) => {
3040
+ const container = containerRef.current;
3041
+ const el = window.document.getElementById(`pdf-page-${pageNum}`);
3042
+ if (container && el) {
3043
+ el.scrollIntoView({ behavior: "smooth" });
3044
+ setPageNumber(pageNum);
3045
+ }
3046
+ };
3047
+ const onPrev = () => {
3048
+ scrollToPage(Math.max(1, pageNumber - 1));
3049
+ };
3050
+ const onNext = () => {
3051
+ scrollToPage(Math.min(numPages, pageNumber + 1));
3052
+ };
3053
+ const onZoomOut = () => {
3054
+ setScale((s) => Math.max(MIN_SCALE, parseFloat((s - SCALE_STEP).toFixed(2))));
3055
+ };
3056
+ const onZoomIn = () => {
3057
+ setScale((s) => Math.min(MAX_SCALE, parseFloat((s + SCALE_STEP).toFixed(2))));
3058
+ };
3059
+ const currentDefaultSize = React3.useMemo(() => {
3060
+ if (!defaultSize) return void 0;
3061
+ return {
3062
+ width: defaultSize.width * scale,
3063
+ height: defaultSize.height * scale
3064
+ };
3065
+ }, [defaultSize, scale]);
3066
+ const toolbar = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.floatingToolbar, children: [
3067
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.LeftOutlined, {}), size: "small", onClick: onPrev, disabled: pageNumber <= 1 }),
3068
+ /* @__PURE__ */ jsxRuntime.jsxs(Text, { children: [
3069
+ Math.min(pageNumber, numPages),
3070
+ " / ",
3071
+ numPages || 0
3072
+ ] }),
3073
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.RightOutlined, {}), size: "small", onClick: onNext, disabled: pageNumber >= numPages || numPages === 0 }),
3074
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.divider }),
3075
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusOutlined, {}), size: "small", onClick: onZoomOut, disabled: scale <= MIN_SCALE }),
3076
+ /* @__PURE__ */ jsxRuntime.jsxs(Text, { children: [
3077
+ Math.round(scale * 100),
3078
+ "%"
3079
+ ] }),
3080
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), size: "small", onClick: onZoomIn, disabled: scale >= MAX_SCALE })
3081
+ ] });
3082
+ if (!previewEnabled) {
3083
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default.stateBody, children: "\u5173\u95ED\u9884\u89C8" });
3084
+ }
3085
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.pdfContainer, children: [
3086
+ toolbar,
3087
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.pdfBody, ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default(styles_module_default.pdfDocument, "width-full"), children: loading && !pdf ? /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: true }) : error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { className: styles_module_default.stateBody, children: error }) : Array.from({ length: numPages }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(PdfPage, { pdf, pageNumber: i + 1, scale, scrollContainerRef: containerRef, defaultSize: currentDefaultSize }, i + 1)) }) })
3088
+ ] });
3089
+ };
3090
+ var DocumentPreview_default = DocumentPreview;
3091
+ var HtmlPreview = ({ fileUrl }) => {
3092
+ const [content, setContent] = React3.useState("");
3093
+ const [error, setError] = React3.useState("");
3094
+ const [loading, setLoading] = React3.useState(false);
3095
+ const fetchHtml = async (signal) => {
3096
+ const headers = {
3097
+ "Content-Type": "application/json"
3098
+ };
3099
+ const res = await fetch(fileUrl, {
3100
+ headers,
3101
+ signal
3102
+ });
3103
+ if (res.status !== 200) {
3104
+ throw new Error(`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${res.status}`);
3105
+ }
3106
+ const buffer = await res.arrayBuffer();
3107
+ let htmlText = "";
3108
+ try {
3109
+ const decoder = new TextDecoder("utf-8", { fatal: true });
3110
+ htmlText = decoder.decode(buffer);
3111
+ } catch (e) {
3112
+ const gbkDecoder = new TextDecoder("gbk");
3113
+ htmlText = gbkDecoder.decode(buffer);
3114
+ }
3115
+ if (!htmlText) {
3116
+ throw new Error("\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A");
3117
+ }
3118
+ setContent(htmlText);
3119
+ };
3120
+ React3.useEffect(() => {
3121
+ const controller = new AbortController();
3122
+ const init = async () => {
3123
+ setContent("");
3124
+ setError("");
3125
+ if (fileUrl) {
3126
+ try {
3127
+ setLoading(true);
3128
+ await fetchHtml(controller.signal);
3129
+ } catch (error2) {
3130
+ if (!controller.signal.aborted) {
3131
+ setError("\u52A0\u8F7D\u6216\u89E3\u6790 HTML \u5931\u8D25");
3132
+ }
3133
+ } finally {
3134
+ if (!controller.signal.aborted) {
3135
+ setLoading(false);
3136
+ }
3137
+ }
3138
+ }
3139
+ };
3140
+ init();
3141
+ return () => {
3142
+ controller.abort();
3143
+ };
3144
+ }, [fileUrl]);
3145
+ return error ? /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "error", title: error }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", width: "100%", position: "relative" }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, {}) }) : content ? /* @__PURE__ */ jsxRuntime.jsx(
3146
+ "iframe",
3147
+ {
3148
+ srcDoc: content,
3149
+ style: { width: "100%", height: "100%", border: "none" },
3150
+ sandbox: "allow-scripts allow-same-origin allow-popups allow-forms",
3151
+ title: "HTML Preview"
3152
+ }
3153
+ ) : null });
3154
+ };
3155
+ var HtmlPreview_default = HtmlPreview;
3156
+ var luyaFilePreview_default = ({ suffix, fileUrl, emptyProps, fileName }) => {
3157
+ const extension = suffix ? suffix : getFileSuffixName(fileName || "");
3158
+ const Preview = React3.useMemo(() => {
3159
+ if (!fileUrl) {
3160
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { ...emptyProps });
3161
+ }
3162
+ switch (extension?.toUpperCase()) {
3163
+ case "PNG":
3164
+ case "JPG":
3165
+ case "JPEG":
3166
+ case "GIF":
3167
+ case "BMP":
3168
+ case "WEBP":
3169
+ case "SVG":
3170
+ case "ICO":
3171
+ case "TIFF":
3172
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Image, { classNames: { root: styles_module_default.nsPreviewImage }, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
3173
+ case "DOC":
3174
+ case "DOCX":
3175
+ case "PDF":
3176
+ case "XLS":
3177
+ case "XLSX":
3178
+ case "PPT":
3179
+ case "PPTX":
3180
+ case "CSV":
3181
+ return /* @__PURE__ */ jsxRuntime.jsx(DocumentPreview_default, { fileUrl });
3182
+ case "MP4":
3183
+ return /* @__PURE__ */ jsxRuntime.jsx(VideoPlayer_default, { fileUrl });
3184
+ case "MP3":
3185
+ case "WAV":
3186
+ case "M4A":
3187
+ case "AAC":
3188
+ case "ACC":
3189
+ return /* @__PURE__ */ jsxRuntime.jsx(AudioPlayer_default, { fileUrl });
3190
+ case "HTML":
3191
+ case "HTM":
3192
+ return /* @__PURE__ */ jsxRuntime.jsx(HtmlPreview_default, { fileUrl });
3193
+ case "MD":
3194
+ case "MARKDOWN":
3195
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl });
3196
+ case "TS":
3197
+ case "TSX":
3198
+ case "JS":
3199
+ case "JSX":
3200
+ case "JSON":
3201
+ case "CSS":
3202
+ case "LESS":
3203
+ case "SCSS":
3204
+ case "XML":
3205
+ case "PY":
3206
+ case "JAVA":
3207
+ case "GO":
3208
+ case "YAML":
3209
+ case "YML":
3210
+ case "ENV":
3211
+ case "CONF":
3212
+ case "CONFIG":
3213
+ return /* @__PURE__ */ jsxRuntime.jsx(CodePreview_default, { fileUrl, suffix: extension });
3214
+ case "TXT":
3215
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreview_default, { fileUrl, asPlainText: true });
3216
+ default:
3217
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { subTitle: `\u6682\u4E0D\u652F\u6301 ${suffix || ""} \u6587\u4EF6\u7684\u9884\u89C8` });
3218
+ }
3219
+ }, [suffix, fileUrl, fileName]);
3220
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "center", align: "center", className: "height-full", children: Preview });
3221
+ };
2667
3222
  var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onClose, ...props }) => {
2668
3223
  return /* @__PURE__ */ jsxRuntime.jsx(
2669
3224
  antd.Drawer,
@@ -2683,8 +3238,8 @@ var styles_module_default3 = {
2683
3238
  microApp: "styles_module_microApp"
2684
3239
  };
2685
3240
  var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
2686
- const [loading, setLoading] = React.useState(false);
2687
- React.useEffect(() => {
3241
+ const [loading, setLoading] = React3.useState(false);
3242
+ React3.useEffect(() => {
2688
3243
  setLoading(true);
2689
3244
  }, [url]);
2690
3245
  const handleLoad = () => {
@@ -2695,7 +3250,7 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
2695
3250
  setLoading(false);
2696
3251
  onError?.(e);
2697
3252
  };
2698
- const microAppData = React.useMemo(() => {
3253
+ const microAppData = React3.useMemo(() => {
2699
3254
  const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
2700
3255
  return { mainSource: [...parentMainSource, name], ...data };
2701
3256
  }, [data, name]);
@@ -2714,19 +3269,19 @@ var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...res
2714
3269
  ));
2715
3270
  };
2716
3271
  var Drawer_default = ({ name: podName }) => {
2717
- const [currentPod, setCurrentPod] = React.useState({ title: "", url: "" });
2718
- const [fullPodOpen, setFullPodOpen] = React.useState(false);
3272
+ const [currentPod, setCurrentPod] = React3.useState({ title: "", url: "" });
3273
+ const [fullPodOpen, setFullPodOpen] = React3.useState(false);
2719
3274
  const { on, off } = useIframeRelayBridge_default();
2720
- const openPod = React.useCallback(({ title, url, name }) => {
3275
+ const openPod = React3.useCallback(({ title, url, name }) => {
2721
3276
  if (name === podName) {
2722
3277
  setCurrentPod({ title, url });
2723
3278
  setFullPodOpen(true);
2724
3279
  }
2725
3280
  }, []);
2726
- const onClosePod = React.useCallback(() => {
3281
+ const onClosePod = React3.useCallback(() => {
2727
3282
  setFullPodOpen(false);
2728
3283
  }, []);
2729
- React.useEffect(() => {
3284
+ React3.useEffect(() => {
2730
3285
  on("openPod", openPod);
2731
3286
  on("onClosePod", onClosePod);
2732
3287
  return () => {
@@ -2751,14 +3306,14 @@ var Drawer_default = ({ name: podName }) => {
2751
3306
  );
2752
3307
  };
2753
3308
  var Window_default = ({ defaultUrl, name: appName }) => {
2754
- const [windowUrl, setWindowUrl] = React.useState("");
3309
+ const [windowUrl, setWindowUrl] = React3.useState("");
2755
3310
  const [windowUrlKey, setWindowUrlKey, getWindowUrlKey] = useRefState_default(0);
2756
3311
  const { on, off } = useIframeRelayBridge_default();
2757
3312
  const onWindowUrlChange = (url) => {
2758
3313
  setWindowUrl(url);
2759
3314
  setWindowUrlKey(getWindowUrlKey() + 1);
2760
3315
  };
2761
- React.useEffect(() => {
3316
+ React3.useEffect(() => {
2762
3317
  const urlParams = getAllUrlParams(location.href);
2763
3318
  if (urlParams[appName]) {
2764
3319
  const url = microApp__default.default.router.decode(urlParams[appName]);
@@ -2767,7 +3322,7 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2767
3322
  onWindowUrlChange(defaultUrl);
2768
3323
  }
2769
3324
  }, [defaultUrl, appName]);
2770
- const openWindow = React.useCallback(
3325
+ const openWindow = React3.useCallback(
2771
3326
  ({ url, name }) => {
2772
3327
  if (appName === name) {
2773
3328
  onWindowUrlChange(url);
@@ -2775,7 +3330,7 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2775
3330
  },
2776
3331
  [appName]
2777
3332
  );
2778
- React.useEffect(() => {
3333
+ React3.useEffect(() => {
2779
3334
  on("openWindow", openWindow);
2780
3335
  return () => {
2781
3336
  off("openWindow", openWindow);
@@ -2788,16 +3343,16 @@ var Window_default = ({ defaultUrl, name: appName }) => {
2788
3343
  var styles_module_default4 = {
2789
3344
  iframe: "styles_module_iframe"
2790
3345
  };
2791
- var Iframe_default = React.forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
2792
- const [loading, setLoading] = React.useState(false);
2793
- const finalSrc = React.useMemo(() => {
3346
+ var Iframe_default = React3.forwardRef(({ defaultMainSource, id, src, className, onLoad }, ref) => {
3347
+ const [loading, setLoading] = React3.useState(false);
3348
+ const finalSrc = React3.useMemo(() => {
2794
3349
  return buildUrlParams({ v: Date.now() }, addUrlLastSlash(setUrlMainSource(src, location.href, defaultMainSource)));
2795
3350
  }, [src]);
2796
3351
  const onHandleLoad = () => {
2797
3352
  setLoading(false);
2798
3353
  onLoad?.();
2799
3354
  };
2800
- React.useEffect(() => {
3355
+ React3.useEffect(() => {
2801
3356
  setLoading(true);
2802
3357
  }, [src]);
2803
3358
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, classNames: { root: "full-spin" }, description: "\u52A0\u8F7D\u4E2D...", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3000,7 +3555,7 @@ var PageNoExtension = core.Extension.create({
3000
3555
  });
3001
3556
  function useTiptapEditor(providedEditor) {
3002
3557
  const { editor: coreEditor } = react.useCurrentEditor();
3003
- const mainEditor = React.useMemo(() => providedEditor || coreEditor, [providedEditor, coreEditor]);
3558
+ const mainEditor = React3.useMemo(() => providedEditor || coreEditor, [providedEditor, coreEditor]);
3004
3559
  const editorState = react.useEditorState({
3005
3560
  editor: mainEditor,
3006
3561
  selector(context) {
@@ -3033,7 +3588,7 @@ function useFloatingElement(show, reference, zIndex, options, autoUpdateOptions)
3033
3588
  const { isMounted, styles } = react$1.useTransitionStyles(context);
3034
3589
  const dismiss = react$1.useDismiss(context, dismissOptions);
3035
3590
  const { getReferenceProps, getFloatingProps } = react$1.useInteractions([dismiss]);
3036
- React.useEffect(() => {
3591
+ React3.useEffect(() => {
3037
3592
  if (reference === null) {
3038
3593
  refs.setReference(null);
3039
3594
  return;
@@ -3050,7 +3605,7 @@ function useFloatingElement(show, reference, zIndex, options, autoUpdateOptions)
3050
3605
  getBoundingClientRect
3051
3606
  });
3052
3607
  }, [reference, refs]);
3053
- return React.useMemo(
3608
+ return React3.useMemo(
3054
3609
  () => ({
3055
3610
  isMounted,
3056
3611
  ref: refs.setFloating,
@@ -3268,7 +3823,7 @@ function sanitizeUrl(inputUrl, baseUrl, protocols) {
3268
3823
  }
3269
3824
  return "#";
3270
3825
  }
3271
- var FloatingElement = React.forwardRef(
3826
+ var FloatingElement = React3.forwardRef(
3272
3827
  ({
3273
3828
  editor: providedEditor,
3274
3829
  shouldShow = void 0,
@@ -3283,20 +3838,20 @@ var FloatingElement = React.forwardRef(
3283
3838
  style: propStyle,
3284
3839
  ...props
3285
3840
  }, forwardedRef) => {
3286
- const [open, setOpen] = React.useState(
3841
+ const [open, setOpen] = React3.useState(
3287
3842
  shouldShow !== void 0 ? shouldShow : false
3288
3843
  );
3289
- const floatingElementRef = React.useRef(null);
3290
- const preventHideRef = React.useRef(false);
3291
- const preventShowRef = React.useRef(false);
3292
- const editorRef = React.useRef(null);
3293
- const getBoundingClientRectRef = React.useRef(getBoundingClientRect);
3844
+ const floatingElementRef = React3.useRef(null);
3845
+ const preventHideRef = React3.useRef(false);
3846
+ const preventShowRef = React3.useRef(false);
3847
+ const editorRef = React3.useRef(null);
3848
+ const getBoundingClientRectRef = React3.useRef(getBoundingClientRect);
3294
3849
  const { editor } = useTiptapEditor(providedEditor);
3295
- React.useEffect(() => {
3850
+ React3.useEffect(() => {
3296
3851
  editorRef.current = editor;
3297
3852
  getBoundingClientRectRef.current = getBoundingClientRect;
3298
3853
  }, [editor, getBoundingClientRect]);
3299
- const handleOpenChange = React.useCallback(
3854
+ const handleOpenChange = React3.useCallback(
3300
3855
  (newOpen) => {
3301
3856
  onOpenChange?.(newOpen);
3302
3857
  setOpen(newOpen);
@@ -3312,7 +3867,7 @@ var FloatingElement = React.forwardRef(
3312
3867
  }
3313
3868
  handleOpenChange(open2);
3314
3869
  };
3315
- const reference = React.useMemo(() => {
3870
+ const reference = React3.useMemo(() => {
3316
3871
  if (referenceElement) {
3317
3872
  return referenceElement;
3318
3873
  }
@@ -3341,7 +3896,7 @@ var FloatingElement = React.forwardRef(
3341
3896
  ...floatingOptions
3342
3897
  }
3343
3898
  );
3344
- const updateSelectionState = React.useCallback(() => {
3899
+ const updateSelectionState = React3.useCallback(() => {
3345
3900
  if (!editor) return;
3346
3901
  const newRect = getBoundingClientRect(editor);
3347
3902
  if (newRect && shouldShow !== void 0 && !preventShowRef.current) {
@@ -3355,7 +3910,7 @@ var FloatingElement = React.forwardRef(
3355
3910
  handleOpenChange(false);
3356
3911
  }
3357
3912
  }, [editor, getBoundingClientRect, handleOpenChange, shouldShow]);
3358
- React.useEffect(() => {
3913
+ React3.useEffect(() => {
3359
3914
  if (!editor || !closeOnEscape) return;
3360
3915
  const handleKeyDown = (event) => {
3361
3916
  if (event.key === "Escape" && open) {
@@ -3369,7 +3924,7 @@ var FloatingElement = React.forwardRef(
3369
3924
  editor.view.dom.removeEventListener("keydown", handleKeyDown);
3370
3925
  };
3371
3926
  }, [editor, open, closeOnEscape, handleOpenChange]);
3372
- React.useEffect(() => {
3927
+ React3.useEffect(() => {
3373
3928
  if (!editor) return;
3374
3929
  const handleBlur = (event) => {
3375
3930
  if (preventHideRef.current) {
@@ -3390,7 +3945,7 @@ var FloatingElement = React.forwardRef(
3390
3945
  editor.view.dom.removeEventListener("blur", handleBlur);
3391
3946
  };
3392
3947
  }, [editor, handleOpenChange, open]);
3393
- React.useEffect(() => {
3948
+ React3.useEffect(() => {
3394
3949
  if (!editor) return;
3395
3950
  const handleDrag = () => {
3396
3951
  if (open) {
@@ -3404,7 +3959,7 @@ var FloatingElement = React.forwardRef(
3404
3959
  editor.view.dom.removeEventListener("dragover", handleDrag);
3405
3960
  };
3406
3961
  }, [editor, open, handleOpenChange]);
3407
- React.useEffect(() => {
3962
+ React3.useEffect(() => {
3408
3963
  if (!editor) return;
3409
3964
  const handleMouseDown = (event) => {
3410
3965
  if (event.button !== 0) return;
@@ -3436,18 +3991,18 @@ var FloatingElement = React.forwardRef(
3436
3991
  editor.view.root.removeEventListener("mouseup", handleMouseUp);
3437
3992
  };
3438
3993
  }, [editor, updateSelectionState]);
3439
- React.useEffect(() => {
3994
+ React3.useEffect(() => {
3440
3995
  if (!editor) return;
3441
3996
  editor.on("selectionUpdate", updateSelectionState);
3442
3997
  return () => {
3443
3998
  editor.off("selectionUpdate", updateSelectionState);
3444
3999
  };
3445
4000
  }, [editor, updateSelectionState]);
3446
- React.useEffect(() => {
4001
+ React3.useEffect(() => {
3447
4002
  if (!editor) return;
3448
4003
  updateSelectionState();
3449
4004
  }, [editor, updateSelectionState]);
3450
- const finalStyle = React.useMemo(
4005
+ const finalStyle = React3.useMemo(
3451
4006
  () => propStyle && Object.keys(propStyle).length > 0 ? propStyle : style,
3452
4007
  [propStyle, style]
3453
4008
  );
@@ -3467,8 +4022,8 @@ var FloatingElement = React.forwardRef(
3467
4022
  );
3468
4023
  FloatingElement.displayName = "FloatingElement";
3469
4024
  function useIsBreakpoint(mode = "max", breakpoint = 768) {
3470
- const [matches, setMatches] = React.useState(void 0);
3471
- React.useEffect(() => {
4025
+ const [matches, setMatches] = React3.useState(void 0);
4026
+ React3.useEffect(() => {
3472
4027
  const query = mode === "min" ? `(min-width: ${breakpoint}px)` : `(max-width: ${breakpoint - 1}px)`;
3473
4028
  const mql = window.matchMedia(query);
3474
4029
  const onChange = (e) => setMatches(e.matches);
@@ -3511,7 +4066,7 @@ var styles_module_default6 = {
3511
4066
  annotationItemSelected: "styles_module_annotationItemSelected"
3512
4067
  };
3513
4068
  var { TextArea: TextArea2 } = antd.Input;
3514
- var { Text } = antd.Typography;
4069
+ var { Text: Text2 } = antd.Typography;
3515
4070
  var AnnotationSidebar_default = ({
3516
4071
  disabled,
3517
4072
  annotations,
@@ -3523,8 +4078,8 @@ var AnnotationSidebar_default = ({
3523
4078
  onClose
3524
4079
  }) => {
3525
4080
  const [form] = antd.Form.useForm();
3526
- const [editingId, setEditingId] = React.useState();
3527
- const itemRefs = React.useRef({});
4081
+ const [editingId, setEditingId] = React3.useState();
4082
+ const itemRefs = React3.useRef({});
3528
4083
  const handleEdit = (annotation) => {
3529
4084
  setEditingId(annotation[ANNOTATION_ATTRS[0]]);
3530
4085
  form.setFieldsValue({ content: annotation.content });
@@ -3537,7 +4092,7 @@ var AnnotationSidebar_default = ({
3537
4092
  onEditAnnotation(editingId, values.content);
3538
4093
  handleCancelEdit();
3539
4094
  };
3540
- React.useEffect(() => {
4095
+ React3.useEffect(() => {
3541
4096
  handleCancelEdit();
3542
4097
  if (selectedAnnotationId) {
3543
4098
  const element = itemRefs.current[selectedAnnotationId];
@@ -3584,8 +4139,8 @@ var AnnotationSidebar_default = ({
3584
4139
  },
3585
4140
  children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, flex: 1, children: [
3586
4141
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default6.annotationMeta, children: [
3587
- /* @__PURE__ */ jsxRuntime.jsx(Text, { strong: true, type: "secondary", children: annotation["user-name"] }),
3588
- /* @__PURE__ */ jsxRuntime.jsx(Text, { type: "secondary", children: formatDate(annotation["update-time"]) })
4142
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, type: "secondary", children: annotation["user-name"] }),
4143
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", children: formatDate(annotation["update-time"]) })
3589
4144
  ] }),
3590
4145
  !disabled && (editingId === annotation[ANNOTATION_ATTRS[0]] ? /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, children: [
3591
4146
  /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3604,7 +4159,7 @@ var AnnotationSidebar_default = ({
3604
4159
  /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", onClick: handleCancelEdit, children: "\u53D6\u6D88" })
3605
4160
  ] })
3606
4161
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, vertical: true, children: [
3607
- /* @__PURE__ */ jsxRuntime.jsx(Text, { children: annotation.content }),
4162
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { children: annotation.content }),
3608
4163
  selectedAnnotationId === annotation[ANNOTATION_ATTRS[0]] && /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
3609
4164
  /* @__PURE__ */ jsxRuntime.jsx(
3610
4165
  antd.Button,
@@ -3644,7 +4199,7 @@ var AnnotationSidebar_default = ({
3644
4199
  }
3645
4200
  return reactDom.createPortal(sidebarContent, container);
3646
4201
  };
3647
- var createHtmlMark = (markName, ATTRS, classNames8) => {
4202
+ var createHtmlMark = (markName, ATTRS, classNames9) => {
3648
4203
  return core.Mark.create({
3649
4204
  name: markName,
3650
4205
  priority: 1e3,
@@ -3673,7 +4228,7 @@ var createHtmlMark = (markName, ATTRS, classNames8) => {
3673
4228
  return [
3674
4229
  "div",
3675
4230
  core.mergeAttributes(attrs, {
3676
- class: classNames8
4231
+ class: classNames9
3677
4232
  }),
3678
4233
  0
3679
4234
  ];
@@ -3890,10 +4445,10 @@ var AnnotationPlugin = core.Extension.create({
3890
4445
  }
3891
4446
  });
3892
4447
  var useAnnotations = (annotationConfig) => {
3893
- const [annotations, setAnnotations] = React.useState([]);
3894
- const [selectedAnnotationId, setSelectedAnnotationId] = React.useState(null);
3895
- const [showAnnotationModal, setShowAnnotationModal] = React.useState(false);
3896
- const [internalShowAnnotation, setInternalShowAnnotation] = React.useState(false);
4448
+ const [annotations, setAnnotations] = React3.useState([]);
4449
+ const [selectedAnnotationId, setSelectedAnnotationId] = React3.useState(null);
4450
+ const [showAnnotationModal, setShowAnnotationModal] = React3.useState(false);
4451
+ const [internalShowAnnotation, setInternalShowAnnotation] = React3.useState(false);
3897
4452
  const isControlled = isBoolean(annotationConfig?.visible);
3898
4453
  const showAnnotation = isControlled ? annotationConfig?.visible : internalShowAnnotation;
3899
4454
  const setShowAnnotation = (visible) => {
@@ -3902,7 +4457,7 @@ var useAnnotations = (annotationConfig) => {
3902
4457
  }
3903
4458
  annotationConfig?.onVisibleChange?.(visible);
3904
4459
  };
3905
- const editor = React.useRef();
4460
+ const editor = React3.useRef();
3906
4461
  const setAnnotationEditor = (newEditor) => {
3907
4462
  editor.current = newEditor;
3908
4463
  };
@@ -4192,7 +4747,7 @@ var styles_module_default7 = {
4192
4747
  collectionItem: "styles_module_collectionItem",
4193
4748
  collectionItemSelected: "styles_module_collectionItemSelected"
4194
4749
  };
4195
- var { Text: Text2 } = antd.Typography;
4750
+ var { Text: Text3 } = antd.Typography;
4196
4751
  var collectionSidebar_default = ({
4197
4752
  disabled,
4198
4753
  collections,
@@ -4202,8 +4757,8 @@ var collectionSidebar_default = ({
4202
4757
  collectionConfig,
4203
4758
  onClose
4204
4759
  }) => {
4205
- const itemRefs = React.useRef({});
4206
- React.useEffect(() => {
4760
+ const itemRefs = React3.useRef({});
4761
+ React3.useEffect(() => {
4207
4762
  if (selectedCollectionId) {
4208
4763
  const element = itemRefs.current[selectedCollectionId];
4209
4764
  element?.scrollIntoView({ behavior: "smooth", block: "center" });
@@ -4258,11 +4813,11 @@ var collectionSidebar_default = ({
4258
4813
  },
4259
4814
  children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, flex: 1, children: [
4260
4815
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "space-between", className: styles_module_default7.collectionMeta, children: [
4261
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { strong: true, type: "secondary", children: collection["user-name"] }),
4262
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { type: "secondary", children: formatDate(collection["update-time"]) })
4816
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { strong: true, type: "secondary", children: collection["user-name"] }),
4817
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { type: "secondary", children: formatDate(collection["update-time"]) })
4263
4818
  ] }),
4264
4819
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, vertical: true, children: [
4265
- /* @__PURE__ */ jsxRuntime.jsx(Text2, { children: collection.text }),
4820
+ /* @__PURE__ */ jsxRuntime.jsx(Text3, { children: collection.text }),
4266
4821
  !disabled && selectedCollectionId === collection[COLLECTION_ATTRS[0]] && /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { children: /* @__PURE__ */ jsxRuntime.jsx(
4267
4822
  antd.Popconfirm,
4268
4823
  {
@@ -4290,9 +4845,9 @@ var collectionSidebar_default = ({
4290
4845
  return reactDom.createPortal(sidebarContent, container);
4291
4846
  };
4292
4847
  var useCollections = (collectionConfig) => {
4293
- const [collections, setCollections] = React.useState([]);
4294
- const [selectedCollectionId, setSelectedCollectionId] = React.useState(null);
4295
- const [internalShowCollection, setInternalShowCollection] = React.useState(false);
4848
+ const [collections, setCollections] = React3.useState([]);
4849
+ const [selectedCollectionId, setSelectedCollectionId] = React3.useState(null);
4850
+ const [internalShowCollection, setInternalShowCollection] = React3.useState(false);
4296
4851
  const isControlled = isBoolean(collectionConfig?.visible);
4297
4852
  const showCollection = isControlled ? collectionConfig?.visible : internalShowCollection;
4298
4853
  const setShowCollection = (visible) => {
@@ -4301,7 +4856,7 @@ var useCollections = (collectionConfig) => {
4301
4856
  }
4302
4857
  collectionConfig?.onVisibleChange?.(visible);
4303
4858
  };
4304
- const editor = React.useRef();
4859
+ const editor = React3.useRef();
4305
4860
  const setCollectionEditor = (newEditor) => {
4306
4861
  editor.current = newEditor;
4307
4862
  };
@@ -4364,7 +4919,7 @@ function useTooltip({
4364
4919
  delay = 600,
4365
4920
  closeDelay = 0
4366
4921
  } = {}) {
4367
- const [uncontrolledOpen, setUncontrolledOpen] = React.useState(initialOpen);
4922
+ const [uncontrolledOpen, setUncontrolledOpen] = React3.useState(initialOpen);
4368
4923
  const open = controlledOpen ?? uncontrolledOpen;
4369
4924
  const setOpen = setControlledOpen ?? setUncontrolledOpen;
4370
4925
  const data = react$1.useFloating({
@@ -4398,7 +4953,7 @@ function useTooltip({
4398
4953
  const dismiss = react$1.useDismiss(context);
4399
4954
  const role = react$1.useRole(context, { role: "tooltip" });
4400
4955
  const interactions = react$1.useInteractions([hover, focus, dismiss, role]);
4401
- return React.useMemo(
4956
+ return React3.useMemo(
4402
4957
  () => ({
4403
4958
  open,
4404
4959
  setOpen,
@@ -4408,9 +4963,9 @@ function useTooltip({
4408
4963
  [open, setOpen, interactions, data]
4409
4964
  );
4410
4965
  }
4411
- var TooltipContext = React.createContext(null);
4966
+ var TooltipContext = React3.createContext(null);
4412
4967
  function useTooltipContext() {
4413
- const context = React.useContext(TooltipContext);
4968
+ const context = React3.useContext(TooltipContext);
4414
4969
  if (context == null) {
4415
4970
  throw new Error("Tooltip components must be wrapped in <TooltipProvider />");
4416
4971
  }
@@ -4430,10 +4985,10 @@ function Tooltip({ children, ...props }) {
4430
4985
  }
4431
4986
  );
4432
4987
  }
4433
- var TooltipTrigger = React.forwardRef(
4988
+ var TooltipTrigger = React3.forwardRef(
4434
4989
  function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
4435
4990
  const context = useTooltipContext();
4436
- const childrenRef = React.isValidElement(children) ? parseInt(React.version, 10) >= 19 ? (
4991
+ const childrenRef = React3.isValidElement(children) ? parseInt(React3.version, 10) >= 19 ? (
4437
4992
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4438
4993
  children.props.ref
4439
4994
  ) : (
@@ -4441,11 +4996,11 @@ var TooltipTrigger = React.forwardRef(
4441
4996
  children.ref
4442
4997
  ) : void 0;
4443
4998
  const ref = react$1.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
4444
- if (asChild && React.isValidElement(children)) {
4999
+ if (asChild && React3.isValidElement(children)) {
4445
5000
  const dataAttributes = {
4446
5001
  "data-tooltip-state": context.open ? "open" : "closed"
4447
5002
  };
4448
- return React.cloneElement(
5003
+ return React3.cloneElement(
4449
5004
  children,
4450
5005
  context.getReferenceProps({
4451
5006
  ref,
@@ -4466,7 +5021,7 @@ var TooltipTrigger = React.forwardRef(
4466
5021
  );
4467
5022
  }
4468
5023
  );
4469
- var TooltipContent = React.forwardRef(
5024
+ var TooltipContent = React3.forwardRef(
4470
5025
  function TooltipContent2({ style, children, portal = true, portalProps = {}, ...props }, propRef) {
4471
5026
  const context = useTooltipContext();
4472
5027
  const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
@@ -4497,12 +5052,12 @@ var ShortcutDisplay = ({
4497
5052
  shortcuts
4498
5053
  }) => {
4499
5054
  if (shortcuts.length === 0) return null;
4500
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: shortcuts.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
5055
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: shortcuts.map((key, index) => /* @__PURE__ */ jsxRuntime.jsxs(React3.Fragment, { children: [
4501
5056
  index > 0 && /* @__PURE__ */ jsxRuntime.jsx("kbd", { children: "+" }),
4502
5057
  /* @__PURE__ */ jsxRuntime.jsx("kbd", { children: key })
4503
5058
  ] }, index)) });
4504
5059
  };
4505
- var Button6 = React.forwardRef(
5060
+ var Button7 = React3.forwardRef(
4506
5061
  ({
4507
5062
  className,
4508
5063
  children,
@@ -4512,7 +5067,7 @@ var Button6 = React.forwardRef(
4512
5067
  "aria-label": ariaLabel,
4513
5068
  ...props
4514
5069
  }, ref) => {
4515
- const shortcuts = React.useMemo(
5070
+ const shortcuts = React3.useMemo(
4516
5071
  () => parseShortcutKeys({ shortcutKeys }),
4517
5072
  [shortcutKeys]
4518
5073
  );
@@ -4546,8 +5101,8 @@ var Button6 = React.forwardRef(
4546
5101
  ] });
4547
5102
  }
4548
5103
  );
4549
- Button6.displayName = "Button";
4550
- var ButtonGroup = React.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
5104
+ Button7.displayName = "Button";
5105
+ var ButtonGroup = React3.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => {
4551
5106
  return /* @__PURE__ */ jsxRuntime.jsx(
4552
5107
  "div",
4553
5108
  {
@@ -4577,7 +5132,7 @@ function Spacer({
4577
5132
  };
4578
5133
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, style: computedStyle });
4579
5134
  }
4580
- var Separator = React.forwardRef(
5135
+ var Separator = React3.forwardRef(
4581
5136
  ({ decorative, orientation = "vertical", className, ...divProps }, ref) => {
4582
5137
  const ariaOrientation = orientation === "vertical" ? orientation : void 0;
4583
5138
  const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
@@ -4604,8 +5159,8 @@ function useMenuNavigation({
4604
5159
  orientation = "vertical",
4605
5160
  autoSelectFirstItem = true
4606
5161
  }) {
4607
- const [selectedIndex, setSelectedIndex] = React.useState(autoSelectFirstItem ? 0 : -1);
4608
- React.useEffect(() => {
5162
+ const [selectedIndex, setSelectedIndex] = React3.useState(autoSelectFirstItem ? 0 : -1);
5163
+ React3.useEffect(() => {
4609
5164
  const handleKeyboardNavigation = (event) => {
4610
5165
  if (!items.length) return false;
4611
5166
  const moveNext = () => setSelectedIndex((currentIndex) => {
@@ -4691,7 +5246,7 @@ function useMenuNavigation({
4691
5246
  }
4692
5247
  return void 0;
4693
5248
  }, [editor, containerRef, items, selectedIndex, onSelect, onClose, orientation]);
4694
- React.useEffect(() => {
5249
+ React3.useEffect(() => {
4695
5250
  if (query) {
4696
5251
  setSelectedIndex(autoSelectFirstItem ? 0 : -1);
4697
5252
  }
@@ -4709,8 +5264,8 @@ var updateRef = (ref, value) => {
4709
5264
  }
4710
5265
  };
4711
5266
  var useComposedRef = (libRef, userRef) => {
4712
- const prevUserRef = React.useRef(null);
4713
- return React.useCallback(
5267
+ const prevUserRef = React3.useRef(null);
5268
+ return React3.useCallback(
4714
5269
  (instance) => {
4715
5270
  if (libRef && "current" in libRef) {
4716
5271
  libRef.current = instance;
@@ -4727,8 +5282,8 @@ var useComposedRef = (libRef, userRef) => {
4727
5282
  );
4728
5283
  };
4729
5284
  var useToolbarNavigation = (toolbarRef) => {
4730
- const [items, setItems] = React.useState([]);
4731
- const collectItems = React.useCallback(() => {
5285
+ const [items, setItems] = React3.useState([]);
5286
+ const collectItems = React3.useCallback(() => {
4732
5287
  if (!toolbarRef.current) return [];
4733
5288
  return Array.from(
4734
5289
  toolbarRef.current.querySelectorAll(
@@ -4736,7 +5291,7 @@ var useToolbarNavigation = (toolbarRef) => {
4736
5291
  )
4737
5292
  );
4738
5293
  }, [toolbarRef]);
4739
- React.useEffect(() => {
5294
+ React3.useEffect(() => {
4740
5295
  const toolbar = toolbarRef.current;
4741
5296
  if (!toolbar) return;
4742
5297
  const updateItems = () => setItems(collectItems());
@@ -4752,7 +5307,7 @@ var useToolbarNavigation = (toolbarRef) => {
4752
5307
  onSelect: (el) => el.click(),
4753
5308
  autoSelectFirstItem: false
4754
5309
  });
4755
- React.useEffect(() => {
5310
+ React3.useEffect(() => {
4756
5311
  const toolbar = toolbarRef.current;
4757
5312
  if (!toolbar) return;
4758
5313
  const handleFocus = (e) => {
@@ -4771,15 +5326,15 @@ var useToolbarNavigation = (toolbarRef) => {
4771
5326
  toolbar.removeEventListener("blur", handleBlur, true);
4772
5327
  };
4773
5328
  }, [toolbarRef]);
4774
- React.useEffect(() => {
5329
+ React3.useEffect(() => {
4775
5330
  if (selectedIndex !== void 0 && items[selectedIndex]) {
4776
5331
  items[selectedIndex].focus();
4777
5332
  }
4778
5333
  }, [selectedIndex, items]);
4779
5334
  };
4780
- var Toolbar = React.forwardRef(
5335
+ var Toolbar = React3.forwardRef(
4781
5336
  ({ children, className, variant = "fixed", ...props }, ref) => {
4782
- const toolbarRef = React.useRef(null);
5337
+ const toolbarRef = React3.useRef(null);
4783
5338
  const composedRef = useComposedRef(toolbarRef, ref);
4784
5339
  useToolbarNavigation(toolbarRef);
4785
5340
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4797,7 +5352,7 @@ var Toolbar = React.forwardRef(
4797
5352
  }
4798
5353
  );
4799
5354
  Toolbar.displayName = "Toolbar";
4800
- var ToolbarGroup = React.forwardRef(
5355
+ var ToolbarGroup = React3.forwardRef(
4801
5356
  ({ children, className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4802
5357
  "div",
4803
5358
  {
@@ -4810,11 +5365,11 @@ var ToolbarGroup = React.forwardRef(
4810
5365
  )
4811
5366
  );
4812
5367
  ToolbarGroup.displayName = "ToolbarGroup";
4813
- var ToolbarSeparator = React.forwardRef(
5368
+ var ToolbarSeparator = React3.forwardRef(
4814
5369
  ({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(Separator, { ref, orientation: "vertical", decorative: true, ...props })
4815
5370
  );
4816
5371
  ToolbarSeparator.displayName = "ToolbarSeparator";
4817
- var Badge = React.forwardRef(
5372
+ var Badge = React3.forwardRef(
4818
5373
  ({
4819
5374
  variant,
4820
5375
  size = "default",
@@ -4845,7 +5400,7 @@ function BlockquoteShortcutBadge({
4845
5400
  }) {
4846
5401
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
4847
5402
  }
4848
- var BlockquoteButton = React.forwardRef(
5403
+ var BlockquoteButton = React3.forwardRef(
4849
5404
  ({
4850
5405
  editor: providedEditor,
4851
5406
  text,
@@ -4870,7 +5425,7 @@ var BlockquoteButton = React.forwardRef(
4870
5425
  hideWhenUnavailable,
4871
5426
  onToggled
4872
5427
  });
4873
- const handleClick = React.useCallback(
5428
+ const handleClick = React3.useCallback(
4874
5429
  (event) => {
4875
5430
  onClick?.(event);
4876
5431
  if (event.defaultPrevented) return;
@@ -4882,7 +5437,7 @@ var BlockquoteButton = React.forwardRef(
4882
5437
  return null;
4883
5438
  }
4884
5439
  return /* @__PURE__ */ jsxRuntime.jsx(
4885
- Button6,
5440
+ Button7,
4886
5441
  {
4887
5442
  type: "button",
4888
5443
  "data-style": "ghost",
@@ -4907,7 +5462,7 @@ var BlockquoteButton = React.forwardRef(
4907
5462
  }
4908
5463
  );
4909
5464
  BlockquoteButton.displayName = "BlockquoteButton";
4910
- var BlockquoteIcon = React.memo(({ className, ...props }) => {
5465
+ var BlockquoteIcon = React3.memo(({ className, ...props }) => {
4911
5466
  return /* @__PURE__ */ jsxRuntime.jsxs(
4912
5467
  "svg",
4913
5468
  {
@@ -5034,10 +5589,10 @@ function useBlockquote(config) {
5034
5589
  onToggled
5035
5590
  } = config || {};
5036
5591
  const { editor } = useTiptapEditor(providedEditor);
5037
- const [isVisible, setIsVisible] = React.useState(true);
5592
+ const [isVisible, setIsVisible] = React3.useState(true);
5038
5593
  const canToggle3 = canToggleBlockquote(editor);
5039
5594
  const isActive = editor?.isActive("blockquote") || false;
5040
- React.useEffect(() => {
5595
+ React3.useEffect(() => {
5041
5596
  if (!editor) return;
5042
5597
  const handleSelectionUpdate = () => {
5043
5598
  setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
@@ -5048,7 +5603,7 @@ function useBlockquote(config) {
5048
5603
  editor.off("selectionUpdate", handleSelectionUpdate);
5049
5604
  };
5050
5605
  }, [editor, hideWhenUnavailable]);
5051
- const handleToggle = React.useCallback(() => {
5606
+ const handleToggle = React3.useCallback(() => {
5052
5607
  if (!editor) return false;
5053
5608
  const success = toggleBlockquote(editor);
5054
5609
  if (success) {
@@ -5071,7 +5626,7 @@ function CodeBlockShortcutBadge({
5071
5626
  }) {
5072
5627
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5073
5628
  }
5074
- var CodeBlockButton = React.forwardRef(
5629
+ var CodeBlockButton = React3.forwardRef(
5075
5630
  ({
5076
5631
  editor: providedEditor,
5077
5632
  text,
@@ -5096,7 +5651,7 @@ var CodeBlockButton = React.forwardRef(
5096
5651
  hideWhenUnavailable,
5097
5652
  onToggled
5098
5653
  });
5099
- const handleClick = React.useCallback(
5654
+ const handleClick = React3.useCallback(
5100
5655
  (event) => {
5101
5656
  onClick?.(event);
5102
5657
  if (event.defaultPrevented) return;
@@ -5108,7 +5663,7 @@ var CodeBlockButton = React.forwardRef(
5108
5663
  return null;
5109
5664
  }
5110
5665
  return /* @__PURE__ */ jsxRuntime.jsx(
5111
- Button6,
5666
+ Button7,
5112
5667
  {
5113
5668
  type: "button",
5114
5669
  "data-style": "ghost",
@@ -5133,7 +5688,7 @@ var CodeBlockButton = React.forwardRef(
5133
5688
  }
5134
5689
  );
5135
5690
  CodeBlockButton.displayName = "CodeBlockButton";
5136
- var CodeBlockIcon = React.memo(({ className, ...props }) => {
5691
+ var CodeBlockIcon = React3.memo(({ className, ...props }) => {
5137
5692
  return /* @__PURE__ */ jsxRuntime.jsxs(
5138
5693
  "svg",
5139
5694
  {
@@ -5251,10 +5806,10 @@ function useCodeBlock(config) {
5251
5806
  onToggled
5252
5807
  } = config || {};
5253
5808
  const { editor } = useTiptapEditor(providedEditor);
5254
- const [isVisible, setIsVisible] = React.useState(true);
5809
+ const [isVisible, setIsVisible] = React3.useState(true);
5255
5810
  const canToggleState = canToggle(editor);
5256
5811
  const isActive = editor?.isActive("codeBlock") || false;
5257
- React.useEffect(() => {
5812
+ React3.useEffect(() => {
5258
5813
  if (!editor) return;
5259
5814
  const handleSelectionUpdate = () => {
5260
5815
  setIsVisible(shouldShowButton2({ editor, hideWhenUnavailable }));
@@ -5265,7 +5820,7 @@ function useCodeBlock(config) {
5265
5820
  editor.off("selectionUpdate", handleSelectionUpdate);
5266
5821
  };
5267
5822
  }, [editor, hideWhenUnavailable]);
5268
- const handleToggle = React.useCallback(() => {
5823
+ const handleToggle = React3.useCallback(() => {
5269
5824
  if (!editor) return false;
5270
5825
  const success = toggleCodeBlock(editor);
5271
5826
  if (success) {
@@ -5283,7 +5838,7 @@ function useCodeBlock(config) {
5283
5838
  Icon: CodeBlockIcon
5284
5839
  };
5285
5840
  }
5286
- var BanIcon = React.memo(({ className, ...props }) => {
5841
+ var BanIcon = React3.memo(({ className, ...props }) => {
5287
5842
  return /* @__PURE__ */ jsxRuntime.jsx(
5288
5843
  "svg",
5289
5844
  {
@@ -5307,7 +5862,7 @@ var BanIcon = React.memo(({ className, ...props }) => {
5307
5862
  );
5308
5863
  });
5309
5864
  BanIcon.displayName = "BanIcon";
5310
- var HighlighterIcon = React.memo(({ className, ...props }) => {
5865
+ var HighlighterIcon = React3.memo(({ className, ...props }) => {
5311
5866
  return /* @__PURE__ */ jsxRuntime.jsx(
5312
5867
  "svg",
5313
5868
  {
@@ -5357,13 +5912,13 @@ function PopoverContent({
5357
5912
  }
5358
5913
  ) });
5359
5914
  }
5360
- var Card3 = React.forwardRef(
5915
+ var Card3 = React3.forwardRef(
5361
5916
  ({ className, ...props }, ref) => {
5362
5917
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("tiptap-card", className), ...props });
5363
5918
  }
5364
5919
  );
5365
5920
  Card3.displayName = "Card";
5366
- var CardHeader = React.forwardRef(
5921
+ var CardHeader = React3.forwardRef(
5367
5922
  ({ className, ...props }, ref) => {
5368
5923
  return /* @__PURE__ */ jsxRuntime.jsx(
5369
5924
  "div",
@@ -5376,13 +5931,13 @@ var CardHeader = React.forwardRef(
5376
5931
  }
5377
5932
  );
5378
5933
  CardHeader.displayName = "CardHeader";
5379
- var CardBody = React.forwardRef(
5934
+ var CardBody = React3.forwardRef(
5380
5935
  ({ className, ...props }, ref) => {
5381
5936
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("tiptap-card-body", className), ...props });
5382
5937
  }
5383
5938
  );
5384
5939
  CardBody.displayName = "CardBody";
5385
- var CardItemGroup = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
5940
+ var CardItemGroup = React3.forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
5386
5941
  return /* @__PURE__ */ jsxRuntime.jsx(
5387
5942
  "div",
5388
5943
  {
@@ -5394,7 +5949,7 @@ var CardItemGroup = React.forwardRef(({ className, orientation = "vertical", ...
5394
5949
  );
5395
5950
  });
5396
5951
  CardItemGroup.displayName = "CardItemGroup";
5397
- var CardGroupLabel = React.forwardRef(
5952
+ var CardGroupLabel = React3.forwardRef(
5398
5953
  ({ className, ...props }, ref) => {
5399
5954
  return /* @__PURE__ */ jsxRuntime.jsx(
5400
5955
  "div",
@@ -5407,7 +5962,7 @@ var CardGroupLabel = React.forwardRef(
5407
5962
  }
5408
5963
  );
5409
5964
  CardGroupLabel.displayName = "CardGroupLabel";
5410
- var CardFooter = React.forwardRef(
5965
+ var CardFooter = React3.forwardRef(
5411
5966
  ({ className, ...props }, ref) => {
5412
5967
  return /* @__PURE__ */ jsxRuntime.jsx(
5413
5968
  "div",
@@ -5425,7 +5980,7 @@ function ColorHighlightShortcutBadge({
5425
5980
  }) {
5426
5981
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5427
5982
  }
5428
- var ColorHighlightButton = React.forwardRef(
5983
+ var ColorHighlightButton = React3.forwardRef(
5429
5984
  ({
5430
5985
  editor: providedEditor,
5431
5986
  highlightColor,
@@ -5455,7 +6010,7 @@ var ColorHighlightButton = React.forwardRef(
5455
6010
  mode,
5456
6011
  onApplied
5457
6012
  });
5458
- const handleClick = React.useCallback(
6013
+ const handleClick = React3.useCallback(
5459
6014
  (event) => {
5460
6015
  onClick?.(event);
5461
6016
  if (event.defaultPrevented) return;
@@ -5463,7 +6018,7 @@ var ColorHighlightButton = React.forwardRef(
5463
6018
  },
5464
6019
  [handleColorHighlight, onClick]
5465
6020
  );
5466
- const buttonStyle = React.useMemo(
6021
+ const buttonStyle = React3.useMemo(
5467
6022
  () => ({
5468
6023
  ...style,
5469
6024
  "--highlight-color": highlightColor
@@ -5474,7 +6029,7 @@ var ColorHighlightButton = React.forwardRef(
5474
6029
  return null;
5475
6030
  }
5476
6031
  return /* @__PURE__ */ jsxRuntime.jsx(
5477
- Button6,
6032
+ Button7,
5478
6033
  {
5479
6034
  type: "button",
5480
6035
  "data-style": "ghost",
@@ -5635,10 +6190,10 @@ function useColorHighlight(config) {
5635
6190
  } = config;
5636
6191
  const { editor } = useTiptapEditor(providedEditor);
5637
6192
  const isMobile = useIsBreakpoint();
5638
- const [isVisible, setIsVisible] = React.useState(true);
6193
+ const [isVisible, setIsVisible] = React3.useState(true);
5639
6194
  const canColorHighlightState = canColorHighlight(editor, mode);
5640
6195
  const isActive = isColorHighlightActive(editor, highlightColor, mode);
5641
- React.useEffect(() => {
6196
+ React3.useEffect(() => {
5642
6197
  if (!editor) return;
5643
6198
  const handleSelectionUpdate = () => {
5644
6199
  setIsVisible(shouldShowButton3({ editor, hideWhenUnavailable, mode }));
@@ -5649,7 +6204,7 @@ function useColorHighlight(config) {
5649
6204
  editor.off("selectionUpdate", handleSelectionUpdate);
5650
6205
  };
5651
6206
  }, [editor, hideWhenUnavailable, mode]);
5652
- const handleColorHighlight = React.useCallback(() => {
6207
+ const handleColorHighlight = React3.useCallback(() => {
5653
6208
  if (!editor || !canColorHighlightState || !highlightColor || !label)
5654
6209
  return false;
5655
6210
  if (mode === "mark") {
@@ -5677,7 +6232,7 @@ function useColorHighlight(config) {
5677
6232
  return success;
5678
6233
  }
5679
6234
  }, [canColorHighlightState, highlightColor, editor, label, onApplied, mode]);
5680
- const handleRemoveHighlight = React.useCallback(() => {
6235
+ const handleRemoveHighlight = React3.useCallback(() => {
5681
6236
  const success = removeHighlight(editor, mode);
5682
6237
  if (success) {
5683
6238
  onApplied?.({ color: "", label: "\u79FB\u9664\u80CC\u666F", mode });
@@ -5708,8 +6263,8 @@ function useColorHighlight(config) {
5708
6263
  mode
5709
6264
  };
5710
6265
  }
5711
- var ColorHighlightPopoverButton = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5712
- Button6,
6266
+ var ColorHighlightPopoverButton = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
6267
+ Button7,
5713
6268
  {
5714
6269
  type: "button",
5715
6270
  className,
@@ -5737,8 +6292,8 @@ function ColorHighlightPopoverContent({
5737
6292
  }) {
5738
6293
  const { handleRemoveHighlight } = useColorHighlight({ editor });
5739
6294
  const isMobile = useIsBreakpoint();
5740
- const containerRef = React.useRef(null);
5741
- const menuItems = React.useMemo(
6295
+ const containerRef = React3.useRef(null);
6296
+ const menuItems = React3.useMemo(
5742
6297
  () => [...colors, { label: "\u79FB\u9664\u9AD8\u4EAE", value: "none" }],
5743
6298
  [colors]
5744
6299
  );
@@ -5778,7 +6333,7 @@ function ColorHighlightPopoverContent({
5778
6333
  )) }),
5779
6334
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
5780
6335
  /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { orientation: "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(
5781
- Button6,
6336
+ Button7,
5782
6337
  {
5783
6338
  onClick: handleRemoveHighlight,
5784
6339
  "aria-label": "\u79FB\u9664\u80CC\u666F",
@@ -5809,7 +6364,7 @@ function ColorHighlightPopover({
5809
6364
  ...props
5810
6365
  }) {
5811
6366
  const { editor } = useTiptapEditor(providedEditor);
5812
- const [isOpen, setIsOpen] = React.useState(false);
6367
+ const [isOpen, setIsOpen] = React3.useState(false);
5813
6368
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label, Icon } = useColorHighlight({
5814
6369
  editor,
5815
6370
  hideWhenUnavailable,
@@ -5833,7 +6388,7 @@ function ColorHighlightPopover({
5833
6388
  /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "aria-label": "\u80CC\u666F\u8272", children: /* @__PURE__ */ jsxRuntime.jsx(ColorHighlightPopoverContent, { editor, colors }) })
5834
6389
  ] });
5835
6390
  }
5836
- var ChevronDownIcon = React.memo(({ className, ...props }) => {
6391
+ var ChevronDownIcon = React3.memo(({ className, ...props }) => {
5837
6392
  return /* @__PURE__ */ jsxRuntime.jsx(
5838
6393
  "svg",
5839
6394
  {
@@ -5863,7 +6418,7 @@ function HeadingShortcutBadge({
5863
6418
  }) {
5864
6419
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
5865
6420
  }
5866
- var HeadingButton = React.forwardRef(
6421
+ var HeadingButton = React3.forwardRef(
5867
6422
  ({
5868
6423
  editor: providedEditor,
5869
6424
  level,
@@ -5890,7 +6445,7 @@ var HeadingButton = React.forwardRef(
5890
6445
  hideWhenUnavailable,
5891
6446
  onToggled
5892
6447
  });
5893
- const handleClick = React.useCallback(
6448
+ const handleClick = React3.useCallback(
5894
6449
  (event) => {
5895
6450
  onClick?.(event);
5896
6451
  if (event.defaultPrevented) return;
@@ -5902,7 +6457,7 @@ var HeadingButton = React.forwardRef(
5902
6457
  return null;
5903
6458
  }
5904
6459
  return /* @__PURE__ */ jsxRuntime.jsx(
5905
- Button6,
6460
+ Button7,
5906
6461
  {
5907
6462
  type: "button",
5908
6463
  "data-style": "ghost",
@@ -5927,7 +6482,7 @@ var HeadingButton = React.forwardRef(
5927
6482
  }
5928
6483
  );
5929
6484
  HeadingButton.displayName = "HeadingButton";
5930
- var HeadingOneIcon = React.memo(({ className, ...props }) => {
6485
+ var HeadingOneIcon = React3.memo(({ className, ...props }) => {
5931
6486
  return /* @__PURE__ */ jsxRuntime.jsxs(
5932
6487
  "svg",
5933
6488
  {
@@ -5958,7 +6513,7 @@ var HeadingOneIcon = React.memo(({ className, ...props }) => {
5958
6513
  );
5959
6514
  });
5960
6515
  HeadingOneIcon.displayName = "HeadingOneIcon";
5961
- var HeadingTwoIcon = React.memo(({ className, ...props }) => {
6516
+ var HeadingTwoIcon = React3.memo(({ className, ...props }) => {
5962
6517
  return /* @__PURE__ */ jsxRuntime.jsxs(
5963
6518
  "svg",
5964
6519
  {
@@ -5989,7 +6544,7 @@ var HeadingTwoIcon = React.memo(({ className, ...props }) => {
5989
6544
  );
5990
6545
  });
5991
6546
  HeadingTwoIcon.displayName = "HeadingTwoIcon";
5992
- var HeadingThreeIcon = React.memo(({ className, ...props }) => {
6547
+ var HeadingThreeIcon = React3.memo(({ className, ...props }) => {
5993
6548
  return /* @__PURE__ */ jsxRuntime.jsxs(
5994
6549
  "svg",
5995
6550
  {
@@ -6031,7 +6586,7 @@ var HeadingThreeIcon = React.memo(({ className, ...props }) => {
6031
6586
  );
6032
6587
  });
6033
6588
  HeadingThreeIcon.displayName = "HeadingThreeIcon";
6034
- var HeadingFourIcon = React.memo(({ className, ...props }) => {
6589
+ var HeadingFourIcon = React3.memo(({ className, ...props }) => {
6035
6590
  return /* @__PURE__ */ jsxRuntime.jsxs(
6036
6591
  "svg",
6037
6592
  {
@@ -6062,7 +6617,7 @@ var HeadingFourIcon = React.memo(({ className, ...props }) => {
6062
6617
  );
6063
6618
  });
6064
6619
  HeadingFourIcon.displayName = "HeadingFourIcon";
6065
- var HeadingFiveIcon = React.memo(({ className, ...props }) => {
6620
+ var HeadingFiveIcon = React3.memo(({ className, ...props }) => {
6066
6621
  return /* @__PURE__ */ jsxRuntime.jsxs(
6067
6622
  "svg",
6068
6623
  {
@@ -6093,7 +6648,7 @@ var HeadingFiveIcon = React.memo(({ className, ...props }) => {
6093
6648
  );
6094
6649
  });
6095
6650
  HeadingFiveIcon.displayName = "HeadingFiveIcon";
6096
- var HeadingSixIcon = React.memo(({ className, ...props }) => {
6651
+ var HeadingSixIcon = React3.memo(({ className, ...props }) => {
6097
6652
  return /* @__PURE__ */ jsxRuntime.jsxs(
6098
6653
  "svg",
6099
6654
  {
@@ -6231,10 +6786,10 @@ function useHeading(config) {
6231
6786
  onToggled
6232
6787
  } = config;
6233
6788
  const { editor } = useTiptapEditor(providedEditor);
6234
- const [isVisible, setIsVisible] = React.useState(true);
6789
+ const [isVisible, setIsVisible] = React3.useState(true);
6235
6790
  const canToggleState = canToggle2(editor, level);
6236
6791
  const isActive = isHeadingActive(editor, level);
6237
- React.useEffect(() => {
6792
+ React3.useEffect(() => {
6238
6793
  if (!editor) return;
6239
6794
  const handleSelectionUpdate = () => {
6240
6795
  setIsVisible(shouldShowButton4({ editor, level, hideWhenUnavailable }));
@@ -6245,7 +6800,7 @@ function useHeading(config) {
6245
6800
  editor.off("selectionUpdate", handleSelectionUpdate);
6246
6801
  };
6247
6802
  }, [editor, level, hideWhenUnavailable]);
6248
- const handleToggle = React.useCallback(() => {
6803
+ const handleToggle = React3.useCallback(() => {
6249
6804
  if (!editor) return false;
6250
6805
  const success = toggleHeading(editor, level);
6251
6806
  if (success) {
@@ -6273,10 +6828,10 @@ function DropdownMenuPortal({
6273
6828
  }) {
6274
6829
  return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { ...props });
6275
6830
  }
6276
- var DropdownMenuTrigger = React.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { ref, ...props }));
6831
+ var DropdownMenuTrigger = React3.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { ref, ...props }));
6277
6832
  DropdownMenuTrigger.displayName = DropdownMenuPrimitive__namespace.Trigger.displayName;
6278
6833
  var DropdownMenuItem = DropdownMenuPrimitive__namespace.Item;
6279
- var DropdownMenuSubContent = React.forwardRef(({ className, portal = true, ...props }, ref) => {
6834
+ var DropdownMenuSubContent = React3.forwardRef(({ className, portal = true, ...props }, ref) => {
6280
6835
  const content = /* @__PURE__ */ jsxRuntime.jsx(
6281
6836
  DropdownMenuPrimitive__namespace.SubContent,
6282
6837
  {
@@ -6288,7 +6843,7 @@ var DropdownMenuSubContent = React.forwardRef(({ className, portal = true, ...pr
6288
6843
  return portal ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPortal, { ...typeof portal === "object" ? portal : {}, children: content }) : content;
6289
6844
  });
6290
6845
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
6291
- var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
6846
+ var DropdownMenuContent = React3.forwardRef(({ className, sideOffset = 4, portal = false, ...props }, ref) => {
6292
6847
  const content = /* @__PURE__ */ jsxRuntime.jsx(
6293
6848
  DropdownMenuPrimitive__namespace.Content,
6294
6849
  {
@@ -6302,7 +6857,7 @@ var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, portal
6302
6857
  return portal ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPortal, { ...typeof portal === "object" ? portal : {}, children: content }) : content;
6303
6858
  });
6304
6859
  DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
6305
- var HeadingDropdownMenu = React.forwardRef(
6860
+ var HeadingDropdownMenu = React3.forwardRef(
6306
6861
  ({
6307
6862
  editor: providedEditor,
6308
6863
  levels = [1, 2, 3, 4, 5, 6],
@@ -6312,13 +6867,13 @@ var HeadingDropdownMenu = React.forwardRef(
6312
6867
  ...buttonProps
6313
6868
  }, ref) => {
6314
6869
  const { editor } = useTiptapEditor(providedEditor);
6315
- const [isOpen, setIsOpen] = React.useState(false);
6870
+ const [isOpen, setIsOpen] = React3.useState(false);
6316
6871
  const { isVisible, isActive, canToggle: canToggle3, Icon } = useHeadingDropdownMenu({
6317
6872
  editor,
6318
6873
  levels,
6319
6874
  hideWhenUnavailable
6320
6875
  });
6321
- const handleOpenChange = React.useCallback(
6876
+ const handleOpenChange = React3.useCallback(
6322
6877
  (open) => {
6323
6878
  if (!editor || !canToggle3) return;
6324
6879
  setIsOpen(open);
@@ -6331,7 +6886,7 @@ var HeadingDropdownMenu = React.forwardRef(
6331
6886
  }
6332
6887
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { modal: true, open: isOpen, onOpenChange: handleOpenChange, children: [
6333
6888
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6334
- Button6,
6889
+ Button7,
6335
6890
  {
6336
6891
  type: "button",
6337
6892
  "data-style": "ghost",
@@ -6364,7 +6919,7 @@ var HeadingDropdownMenu = React.forwardRef(
6364
6919
  }
6365
6920
  );
6366
6921
  HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
6367
- var HeadingIcon = React.memo(({ className, ...props }) => {
6922
+ var HeadingIcon = React3.memo(({ className, ...props }) => {
6368
6923
  return /* @__PURE__ */ jsxRuntime.jsx(
6369
6924
  "svg",
6370
6925
  {
@@ -6399,11 +6954,11 @@ function useHeadingDropdownMenu(config) {
6399
6954
  hideWhenUnavailable = false
6400
6955
  } = config || {};
6401
6956
  const { editor } = useTiptapEditor(providedEditor);
6402
- const [isVisible, setIsVisible] = React.useState(true);
6957
+ const [isVisible, setIsVisible] = React3.useState(true);
6403
6958
  const activeLevel = getActiveHeadingLevel(editor, levels);
6404
6959
  const isActive = isHeadingActive(editor);
6405
6960
  const canToggleState = canToggle2(editor);
6406
- React.useEffect(() => {
6961
+ React3.useEffect(() => {
6407
6962
  if (!editor) return;
6408
6963
  const handleSelectionUpdate = () => {
6409
6964
  setIsVisible(
@@ -6426,7 +6981,7 @@ function useHeadingDropdownMenu(config) {
6426
6981
  Icon: activeLevel ? headingIcons[activeLevel] : HeadingIcon
6427
6982
  };
6428
6983
  }
6429
- var CornerDownLeftIcon = React.memo(({ className, ...props }) => {
6984
+ var CornerDownLeftIcon = React3.memo(({ className, ...props }) => {
6430
6985
  return /* @__PURE__ */ jsxRuntime.jsx(
6431
6986
  "svg",
6432
6987
  {
@@ -6450,7 +7005,7 @@ var CornerDownLeftIcon = React.memo(({ className, ...props }) => {
6450
7005
  );
6451
7006
  });
6452
7007
  CornerDownLeftIcon.displayName = "CornerDownLeftIcon";
6453
- var ExternalLinkIcon = React.memo(({ className, ...props }) => {
7008
+ var ExternalLinkIcon = React3.memo(({ className, ...props }) => {
6454
7009
  return /* @__PURE__ */ jsxRuntime.jsxs(
6455
7010
  "svg",
6456
7011
  {
@@ -6481,7 +7036,7 @@ var ExternalLinkIcon = React.memo(({ className, ...props }) => {
6481
7036
  );
6482
7037
  });
6483
7038
  ExternalLinkIcon.displayName = "ExternalLinkIcon";
6484
- var LinkIcon = React.memo(({ className, ...props }) => {
7039
+ var LinkIcon = React3.memo(({ className, ...props }) => {
6485
7040
  return /* @__PURE__ */ jsxRuntime.jsxs(
6486
7041
  "svg",
6487
7042
  {
@@ -6512,7 +7067,7 @@ var LinkIcon = React.memo(({ className, ...props }) => {
6512
7067
  );
6513
7068
  });
6514
7069
  LinkIcon.displayName = "LinkIcon";
6515
- var TrashIcon = React.memo(({ className, ...props }) => {
7070
+ var TrashIcon = React3.memo(({ className, ...props }) => {
6516
7071
  return /* @__PURE__ */ jsxRuntime.jsx(
6517
7072
  "svg",
6518
7073
  {
@@ -6546,10 +7101,10 @@ function InputGroup({
6546
7101
  }) {
6547
7102
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("tiptap-input-group", className), ...props, children });
6548
7103
  }
6549
- var LinkButton = React.forwardRef(
7104
+ var LinkButton = React3.forwardRef(
6550
7105
  ({ className, children, ...props }, ref) => {
6551
7106
  return /* @__PURE__ */ jsxRuntime.jsx(
6552
- Button6,
7107
+ Button7,
6553
7108
  {
6554
7109
  type: "button",
6555
7110
  className,
@@ -6609,7 +7164,7 @@ var LinkMain = ({
6609
7164
  }
6610
7165
  ) }),
6611
7166
  /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { orientation: "horizontal", children: /* @__PURE__ */ jsxRuntime.jsx(
6612
- Button6,
7167
+ Button7,
6613
7168
  {
6614
7169
  type: "button",
6615
7170
  onClick: setLink,
@@ -6622,7 +7177,7 @@ var LinkMain = ({
6622
7177
  /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
6623
7178
  /* @__PURE__ */ jsxRuntime.jsxs(ButtonGroup, { orientation: "horizontal", children: [
6624
7179
  /* @__PURE__ */ jsxRuntime.jsx(
6625
- Button6,
7180
+ Button7,
6626
7181
  {
6627
7182
  type: "button",
6628
7183
  onClick: openLink,
@@ -6633,7 +7188,7 @@ var LinkMain = ({
6633
7188
  }
6634
7189
  ),
6635
7190
  /* @__PURE__ */ jsxRuntime.jsx(
6636
- Button6,
7191
+ Button7,
6637
7192
  {
6638
7193
  type: "button",
6639
7194
  onClick: removeLink,
@@ -6656,7 +7211,7 @@ var LinkContent = ({ editor }) => {
6656
7211
  });
6657
7212
  return /* @__PURE__ */ jsxRuntime.jsx(LinkMain, { ...linkPopover });
6658
7213
  };
6659
- var LinkPopover = React.forwardRef(
7214
+ var LinkPopover = React3.forwardRef(
6660
7215
  ({
6661
7216
  editor: providedEditor,
6662
7217
  hideWhenUnavailable = false,
@@ -6668,7 +7223,7 @@ var LinkPopover = React.forwardRef(
6668
7223
  ...buttonProps
6669
7224
  }, ref) => {
6670
7225
  const { editor } = useTiptapEditor(providedEditor);
6671
- const [isOpen, setIsOpen] = React.useState(false);
7226
+ const [isOpen, setIsOpen] = React3.useState(false);
6672
7227
  const {
6673
7228
  isVisible,
6674
7229
  canSet,
@@ -6685,18 +7240,18 @@ var LinkPopover = React.forwardRef(
6685
7240
  hideWhenUnavailable,
6686
7241
  onSetLink
6687
7242
  });
6688
- const handleOnOpenChange = React.useCallback(
7243
+ const handleOnOpenChange = React3.useCallback(
6689
7244
  (nextIsOpen) => {
6690
7245
  setIsOpen(nextIsOpen);
6691
7246
  onOpenChange?.(nextIsOpen);
6692
7247
  },
6693
7248
  [onOpenChange]
6694
7249
  );
6695
- const handleSetLink = React.useCallback(() => {
7250
+ const handleSetLink = React3.useCallback(() => {
6696
7251
  setLink();
6697
7252
  setIsOpen(false);
6698
7253
  }, [setLink]);
6699
- const handleClick = React.useCallback(
7254
+ const handleClick = React3.useCallback(
6700
7255
  (event) => {
6701
7256
  onClick?.(event);
6702
7257
  if (event.defaultPrevented) return;
@@ -6704,7 +7259,7 @@ var LinkPopover = React.forwardRef(
6704
7259
  },
6705
7260
  [onClick, isOpen]
6706
7261
  );
6707
- React.useEffect(() => {
7262
+ React3.useEffect(() => {
6708
7263
  if (autoOpenOnLinkActive && isActive) {
6709
7264
  setIsOpen(true);
6710
7265
  }
@@ -6764,15 +7319,15 @@ function shouldShowLinkButton(props) {
6764
7319
  }
6765
7320
  function useLinkHandler(props) {
6766
7321
  const { editor, onSetLink } = props;
6767
- const [url, setUrl] = React.useState(null);
6768
- React.useEffect(() => {
7322
+ const [url, setUrl] = React3.useState(null);
7323
+ React3.useEffect(() => {
6769
7324
  if (!editor) return;
6770
7325
  const { href } = editor.getAttributes("link");
6771
7326
  if (isLinkActive(editor) && url === null) {
6772
7327
  setUrl(href || "");
6773
7328
  }
6774
7329
  }, [editor, url]);
6775
- React.useEffect(() => {
7330
+ React3.useEffect(() => {
6776
7331
  if (!editor) return;
6777
7332
  const updateLinkState = () => {
6778
7333
  const { href } = editor.getAttributes("link");
@@ -6783,7 +7338,7 @@ function useLinkHandler(props) {
6783
7338
  editor.off("selectionUpdate", updateLinkState);
6784
7339
  };
6785
7340
  }, [editor]);
6786
- const setLink = React.useCallback(() => {
7341
+ const setLink = React3.useCallback(() => {
6787
7342
  if (!url || !editor) return;
6788
7343
  const { selection } = editor.state;
6789
7344
  const isEmpty2 = selection.empty;
@@ -6796,12 +7351,12 @@ function useLinkHandler(props) {
6796
7351
  setUrl(null);
6797
7352
  onSetLink?.();
6798
7353
  }, [editor, onSetLink, url]);
6799
- const removeLink = React.useCallback(() => {
7354
+ const removeLink = React3.useCallback(() => {
6800
7355
  if (!editor) return;
6801
7356
  editor.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink", true).run();
6802
7357
  setUrl("");
6803
7358
  }, [editor]);
6804
- const openLink = React.useCallback(
7359
+ const openLink = React3.useCallback(
6805
7360
  (target = "_blank", features = "noopener,noreferrer") => {
6806
7361
  if (!url) return;
6807
7362
  const safeUrl = sanitizeUrl(url, window.location.href);
@@ -6823,8 +7378,8 @@ function useLinkState(props) {
6823
7378
  const { editor, hideWhenUnavailable = false } = props;
6824
7379
  const canSet = canSetLink(editor);
6825
7380
  const isActive = isLinkActive(editor);
6826
- const [isVisible, setIsVisible] = React.useState(true);
6827
- React.useEffect(() => {
7381
+ const [isVisible, setIsVisible] = React3.useState(true);
7382
+ React3.useEffect(() => {
6828
7383
  if (!editor) return;
6829
7384
  const handleSelectionUpdate = () => {
6830
7385
  setIsVisible(
@@ -6876,7 +7431,7 @@ function ListShortcutBadge({
6876
7431
  }) {
6877
7432
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
6878
7433
  }
6879
- var ListButton = React.forwardRef(
7434
+ var ListButton = React3.forwardRef(
6880
7435
  ({
6881
7436
  editor: providedEditor,
6882
7437
  type,
@@ -6903,7 +7458,7 @@ var ListButton = React.forwardRef(
6903
7458
  hideWhenUnavailable,
6904
7459
  onToggled
6905
7460
  });
6906
- const handleClick = React.useCallback(
7461
+ const handleClick = React3.useCallback(
6907
7462
  (event) => {
6908
7463
  onClick?.(event);
6909
7464
  if (event.defaultPrevented) return;
@@ -6915,7 +7470,7 @@ var ListButton = React.forwardRef(
6915
7470
  return null;
6916
7471
  }
6917
7472
  return /* @__PURE__ */ jsxRuntime.jsx(
6918
- Button6,
7473
+ Button7,
6919
7474
  {
6920
7475
  type: "button",
6921
7476
  "data-style": "ghost",
@@ -6940,7 +7495,7 @@ var ListButton = React.forwardRef(
6940
7495
  }
6941
7496
  );
6942
7497
  ListButton.displayName = "ListButton";
6943
- var ListIcon = React.memo(({ className, ...props }) => {
7498
+ var ListIcon = React3.memo(({ className, ...props }) => {
6944
7499
  return /* @__PURE__ */ jsxRuntime.jsxs(
6945
7500
  "svg",
6946
7501
  {
@@ -7011,7 +7566,7 @@ var ListIcon = React.memo(({ className, ...props }) => {
7011
7566
  );
7012
7567
  });
7013
7568
  ListIcon.displayName = "ListIcon";
7014
- var ListOrderedIcon = React.memo(({ className, ...props }) => {
7569
+ var ListOrderedIcon = React3.memo(({ className, ...props }) => {
7015
7570
  return /* @__PURE__ */ jsxRuntime.jsxs(
7016
7571
  "svg",
7017
7572
  {
@@ -7082,7 +7637,7 @@ var ListOrderedIcon = React.memo(({ className, ...props }) => {
7082
7637
  );
7083
7638
  });
7084
7639
  ListOrderedIcon.displayName = "ListOrderedIcon";
7085
- var ListTodoIcon = React.memo(({ className, ...props }) => {
7640
+ var ListTodoIcon = React3.memo(({ className, ...props }) => {
7086
7641
  return /* @__PURE__ */ jsxRuntime.jsxs(
7087
7642
  "svg",
7088
7643
  {
@@ -7274,10 +7829,10 @@ function useList(config) {
7274
7829
  onToggled
7275
7830
  } = config;
7276
7831
  const { editor } = useTiptapEditor(providedEditor);
7277
- const [isVisible, setIsVisible] = React.useState(true);
7832
+ const [isVisible, setIsVisible] = React3.useState(true);
7278
7833
  const canToggle3 = canToggleList(editor, type);
7279
7834
  const isActive = isListActive(editor, type);
7280
- React.useEffect(() => {
7835
+ React3.useEffect(() => {
7281
7836
  if (!editor) return;
7282
7837
  const handleSelectionUpdate = () => {
7283
7838
  setIsVisible(shouldShowButton5({ editor, type, hideWhenUnavailable }));
@@ -7288,7 +7843,7 @@ function useList(config) {
7288
7843
  editor.off("selectionUpdate", handleSelectionUpdate);
7289
7844
  };
7290
7845
  }, [editor, type, hideWhenUnavailable]);
7291
- const handleToggle = React.useCallback(() => {
7846
+ const handleToggle = React3.useCallback(() => {
7292
7847
  if (!editor) return false;
7293
7848
  const success = toggleList(editor, type);
7294
7849
  if (success) {
@@ -7357,14 +7912,14 @@ function useListDropdownMenu(config) {
7357
7912
  hideWhenUnavailable = false
7358
7913
  } = config || {};
7359
7914
  const { editor } = useTiptapEditor(providedEditor);
7360
- const [isVisible, setIsVisible] = React.useState(true);
7915
+ const [isVisible, setIsVisible] = React3.useState(true);
7361
7916
  const listInSchema = types.some((type) => isNodeInSchema(type, editor));
7362
- const filteredLists = React.useMemo(() => getFilteredListOptions(types), [types]);
7917
+ const filteredLists = React3.useMemo(() => getFilteredListOptions(types), [types]);
7363
7918
  const canToggleAny = canToggleAnyList(editor, types);
7364
7919
  const isAnyActive = isAnyListActive(editor, types);
7365
7920
  const activeType = getActiveListType(editor, types);
7366
7921
  const activeList = filteredLists.find((option) => option.type === activeType);
7367
- React.useEffect(() => {
7922
+ React3.useEffect(() => {
7368
7923
  if (!editor) return;
7369
7924
  const handleSelectionUpdate = () => {
7370
7925
  setIsVisible(
@@ -7402,13 +7957,13 @@ function ListDropdownMenu({
7402
7957
  ...props
7403
7958
  }) {
7404
7959
  const { editor } = useTiptapEditor(providedEditor);
7405
- const [isOpen, setIsOpen] = React.useState(false);
7960
+ const [isOpen, setIsOpen] = React3.useState(false);
7406
7961
  const { filteredLists, canToggle: canToggle3, isActive, isVisible, Icon } = useListDropdownMenu({
7407
7962
  editor,
7408
7963
  types,
7409
7964
  hideWhenUnavailable
7410
7965
  });
7411
- const handleOnOpenChange = React.useCallback(
7966
+ const handleOnOpenChange = React3.useCallback(
7412
7967
  (open) => {
7413
7968
  setIsOpen(open);
7414
7969
  onOpenChange?.(open);
@@ -7420,7 +7975,7 @@ function ListDropdownMenu({
7420
7975
  }
7421
7976
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
7422
7977
  /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7423
- Button6,
7978
+ Button7,
7424
7979
  {
7425
7980
  type: "button",
7426
7981
  "data-style": "ghost",
@@ -7455,7 +8010,7 @@ function MarkShortcutBadge({
7455
8010
  }) {
7456
8011
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
7457
8012
  }
7458
- var MarkButton = React.forwardRef(
8013
+ var MarkButton = React3.forwardRef(
7459
8014
  ({
7460
8015
  editor: providedEditor,
7461
8016
  type,
@@ -7482,7 +8037,7 @@ var MarkButton = React.forwardRef(
7482
8037
  hideWhenUnavailable,
7483
8038
  onToggled
7484
8039
  });
7485
- const handleClick = React.useCallback(
8040
+ const handleClick = React3.useCallback(
7486
8041
  (event) => {
7487
8042
  onClick?.(event);
7488
8043
  if (event.defaultPrevented) return;
@@ -7494,7 +8049,7 @@ var MarkButton = React.forwardRef(
7494
8049
  return null;
7495
8050
  }
7496
8051
  return /* @__PURE__ */ jsxRuntime.jsx(
7497
- Button6,
8052
+ Button7,
7498
8053
  {
7499
8054
  type: "button",
7500
8055
  disabled: !canToggle3,
@@ -7519,7 +8074,7 @@ var MarkButton = React.forwardRef(
7519
8074
  }
7520
8075
  );
7521
8076
  MarkButton.displayName = "MarkButton";
7522
- var BoldIcon = React.memo(({ className, ...props }) => {
8077
+ var BoldIcon = React3.memo(({ className, ...props }) => {
7523
8078
  return /* @__PURE__ */ jsxRuntime.jsx(
7524
8079
  "svg",
7525
8080
  {
@@ -7543,7 +8098,7 @@ var BoldIcon = React.memo(({ className, ...props }) => {
7543
8098
  );
7544
8099
  });
7545
8100
  BoldIcon.displayName = "BoldIcon";
7546
- var Code2Icon = React.memo(({ className, ...props }) => {
8101
+ var Code2Icon = React3.memo(({ className, ...props }) => {
7547
8102
  return /* @__PURE__ */ jsxRuntime.jsxs(
7548
8103
  "svg",
7549
8104
  {
@@ -7581,7 +8136,7 @@ var Code2Icon = React.memo(({ className, ...props }) => {
7581
8136
  );
7582
8137
  });
7583
8138
  Code2Icon.displayName = "Code2Icon";
7584
- var ItalicIcon = React.memo(({ className, ...props }) => {
8139
+ var ItalicIcon = React3.memo(({ className, ...props }) => {
7585
8140
  return /* @__PURE__ */ jsxRuntime.jsx(
7586
8141
  "svg",
7587
8142
  {
@@ -7603,7 +8158,7 @@ var ItalicIcon = React.memo(({ className, ...props }) => {
7603
8158
  );
7604
8159
  });
7605
8160
  ItalicIcon.displayName = "ItalicIcon";
7606
- var StrikeIcon = React.memo(({ className, ...props }) => {
8161
+ var StrikeIcon = React3.memo(({ className, ...props }) => {
7607
8162
  return /* @__PURE__ */ jsxRuntime.jsxs(
7608
8163
  "svg",
7609
8164
  {
@@ -7634,7 +8189,7 @@ var StrikeIcon = React.memo(({ className, ...props }) => {
7634
8189
  );
7635
8190
  });
7636
8191
  StrikeIcon.displayName = "StrikeIcon";
7637
- var SubscriptIcon = React.memo(({ className, ...props }) => {
8192
+ var SubscriptIcon = React3.memo(({ className, ...props }) => {
7638
8193
  return /* @__PURE__ */ jsxRuntime.jsxs(
7639
8194
  "svg",
7640
8195
  {
@@ -7678,7 +8233,7 @@ var SubscriptIcon = React.memo(({ className, ...props }) => {
7678
8233
  );
7679
8234
  });
7680
8235
  SubscriptIcon.displayName = "SubscriptIcon";
7681
- var SuperscriptIcon = React.memo(({ className, ...props }) => {
8236
+ var SuperscriptIcon = React3.memo(({ className, ...props }) => {
7682
8237
  return /* @__PURE__ */ jsxRuntime.jsxs(
7683
8238
  "svg",
7684
8239
  {
@@ -7722,7 +8277,7 @@ var SuperscriptIcon = React.memo(({ className, ...props }) => {
7722
8277
  );
7723
8278
  });
7724
8279
  SuperscriptIcon.displayName = "SuperscriptIcon";
7725
- var UnderlineIcon = React.memo(({ className, ...props }) => {
8280
+ var UnderlineIcon = React3.memo(({ className, ...props }) => {
7726
8281
  return /* @__PURE__ */ jsxRuntime.jsx(
7727
8282
  "svg",
7728
8283
  {
@@ -7810,10 +8365,10 @@ function useMark(config) {
7810
8365
  onToggled
7811
8366
  } = config;
7812
8367
  const { editor } = useTiptapEditor(providedEditor);
7813
- const [isVisible, setIsVisible] = React.useState(true);
8368
+ const [isVisible, setIsVisible] = React3.useState(true);
7814
8369
  const canToggle3 = canToggleMark(editor, type);
7815
8370
  const isActive = isMarkActive(editor, type);
7816
- React.useEffect(() => {
8371
+ React3.useEffect(() => {
7817
8372
  if (!editor) return;
7818
8373
  const handleSelectionUpdate = () => {
7819
8374
  setIsVisible(shouldShowButton6({ editor, type, hideWhenUnavailable }));
@@ -7824,7 +8379,7 @@ function useMark(config) {
7824
8379
  editor.off("selectionUpdate", handleSelectionUpdate);
7825
8380
  };
7826
8381
  }, [editor, type, hideWhenUnavailable]);
7827
- const handleMark = React.useCallback(() => {
8382
+ const handleMark = React3.useCallback(() => {
7828
8383
  if (!editor) return false;
7829
8384
  const success = toggleMark(editor, type);
7830
8385
  if (success) {
@@ -7848,7 +8403,7 @@ function TextAlignShortcutBadge({
7848
8403
  }) {
7849
8404
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
7850
8405
  }
7851
- var TextAlignButton = React.forwardRef(
8406
+ var TextAlignButton = React3.forwardRef(
7852
8407
  ({
7853
8408
  editor: providedEditor,
7854
8409
  align,
@@ -7876,7 +8431,7 @@ var TextAlignButton = React.forwardRef(
7876
8431
  hideWhenUnavailable,
7877
8432
  onAligned
7878
8433
  });
7879
- const handleClick = React.useCallback(
8434
+ const handleClick = React3.useCallback(
7880
8435
  (event) => {
7881
8436
  onClick?.(event);
7882
8437
  if (event.defaultPrevented) return;
@@ -7889,7 +8444,7 @@ var TextAlignButton = React.forwardRef(
7889
8444
  }
7890
8445
  const RenderIcon = CustomIcon ?? Icon;
7891
8446
  return /* @__PURE__ */ jsxRuntime.jsx(
7892
- Button6,
8447
+ Button7,
7893
8448
  {
7894
8449
  type: "button",
7895
8450
  disabled: !canAlign,
@@ -7920,7 +8475,7 @@ var TextAlignButton = React.forwardRef(
7920
8475
  }
7921
8476
  );
7922
8477
  TextAlignButton.displayName = "TextAlignButton";
7923
- var AlignCenterIcon = React.memo(({ className, ...props }) => {
8478
+ var AlignCenterIcon = React3.memo(({ className, ...props }) => {
7924
8479
  return /* @__PURE__ */ jsxRuntime.jsxs(
7925
8480
  "svg",
7926
8481
  {
@@ -7964,7 +8519,7 @@ var AlignCenterIcon = React.memo(({ className, ...props }) => {
7964
8519
  );
7965
8520
  });
7966
8521
  AlignCenterIcon.displayName = "AlignCenterIcon";
7967
- var AlignJustifyIcon = React.memo(({ className, ...props }) => {
8522
+ var AlignJustifyIcon = React3.memo(({ className, ...props }) => {
7968
8523
  return /* @__PURE__ */ jsxRuntime.jsxs(
7969
8524
  "svg",
7970
8525
  {
@@ -8008,7 +8563,7 @@ var AlignJustifyIcon = React.memo(({ className, ...props }) => {
8008
8563
  );
8009
8564
  });
8010
8565
  AlignJustifyIcon.displayName = "AlignJustifyIcon";
8011
- var AlignLeftIcon = React.memo(({ className, ...props }) => {
8566
+ var AlignLeftIcon = React3.memo(({ className, ...props }) => {
8012
8567
  return /* @__PURE__ */ jsxRuntime.jsxs(
8013
8568
  "svg",
8014
8569
  {
@@ -8052,7 +8607,7 @@ var AlignLeftIcon = React.memo(({ className, ...props }) => {
8052
8607
  );
8053
8608
  });
8054
8609
  AlignLeftIcon.displayName = "AlignLeftIcon";
8055
- var AlignRightIcon = React.memo(({ className, ...props }) => {
8610
+ var AlignRightIcon = React3.memo(({ className, ...props }) => {
8056
8611
  return /* @__PURE__ */ jsxRuntime.jsxs(
8057
8612
  "svg",
8058
8613
  {
@@ -8155,10 +8710,10 @@ function useTextAlign(config) {
8155
8710
  onAligned
8156
8711
  } = config;
8157
8712
  const { editor } = useTiptapEditor(providedEditor);
8158
- const [isVisible, setIsVisible] = React.useState(true);
8713
+ const [isVisible, setIsVisible] = React3.useState(true);
8159
8714
  const canAlign = canSetTextAlign(editor, align);
8160
8715
  const isActive = isTextAlignActive(editor, align);
8161
- React.useEffect(() => {
8716
+ React3.useEffect(() => {
8162
8717
  if (!editor) return;
8163
8718
  const handleSelectionUpdate = () => {
8164
8719
  setIsVisible(shouldShowButton7({ editor, align, hideWhenUnavailable }));
@@ -8169,7 +8724,7 @@ function useTextAlign(config) {
8169
8724
  editor.off("selectionUpdate", handleSelectionUpdate);
8170
8725
  };
8171
8726
  }, [editor, hideWhenUnavailable, align]);
8172
- const handleTextAlign = React.useCallback(() => {
8727
+ const handleTextAlign = React3.useCallback(() => {
8173
8728
  if (!editor) return false;
8174
8729
  const success = setTextAlign(editor, align);
8175
8730
  if (success) {
@@ -8193,7 +8748,7 @@ function HistoryShortcutBadge({
8193
8748
  }) {
8194
8749
  return /* @__PURE__ */ jsxRuntime.jsx(Badge, { children: parseShortcutKeys({ shortcutKeys }) });
8195
8750
  }
8196
- var UndoRedoButton = React.forwardRef(
8751
+ var UndoRedoButton = React3.forwardRef(
8197
8752
  ({
8198
8753
  editor: providedEditor,
8199
8754
  action,
@@ -8212,7 +8767,7 @@ var UndoRedoButton = React.forwardRef(
8212
8767
  hideWhenUnavailable,
8213
8768
  onExecuted
8214
8769
  });
8215
- const handleClick = React.useCallback(
8770
+ const handleClick = React3.useCallback(
8216
8771
  (event) => {
8217
8772
  onClick?.(event);
8218
8773
  if (event.defaultPrevented) return;
@@ -8224,7 +8779,7 @@ var UndoRedoButton = React.forwardRef(
8224
8779
  return null;
8225
8780
  }
8226
8781
  return /* @__PURE__ */ jsxRuntime.jsx(
8227
- Button6,
8782
+ Button7,
8228
8783
  {
8229
8784
  type: "button",
8230
8785
  disabled: !canExecute,
@@ -8253,7 +8808,7 @@ var UndoRedoButton = React.forwardRef(
8253
8808
  }
8254
8809
  );
8255
8810
  UndoRedoButton.displayName = "UndoRedoButton";
8256
- var Redo2Icon = React.memo(({ className, ...props }) => {
8811
+ var Redo2Icon = React3.memo(({ className, ...props }) => {
8257
8812
  return /* @__PURE__ */ jsxRuntime.jsx(
8258
8813
  "svg",
8259
8814
  {
@@ -8277,7 +8832,7 @@ var Redo2Icon = React.memo(({ className, ...props }) => {
8277
8832
  );
8278
8833
  });
8279
8834
  Redo2Icon.displayName = "Redo2Icon";
8280
- var Undo2Icon = React.memo(({ className, ...props }) => {
8835
+ var Undo2Icon = React3.memo(({ className, ...props }) => {
8281
8836
  return /* @__PURE__ */ jsxRuntime.jsx(
8282
8837
  "svg",
8283
8838
  {
@@ -8342,9 +8897,9 @@ function useUndoRedo(config) {
8342
8897
  onExecuted
8343
8898
  } = config;
8344
8899
  const { editor } = useTiptapEditor(providedEditor);
8345
- const [isVisible, setIsVisible] = React.useState(true);
8900
+ const [isVisible, setIsVisible] = React3.useState(true);
8346
8901
  const canExecute = canExecuteUndoRedoAction(editor, action);
8347
- React.useEffect(() => {
8902
+ React3.useEffect(() => {
8348
8903
  if (!editor) return;
8349
8904
  const handleUpdate = () => {
8350
8905
  setIsVisible(shouldShowButton8({ editor, hideWhenUnavailable, action }));
@@ -8355,7 +8910,7 @@ function useUndoRedo(config) {
8355
8910
  editor.off("transaction", handleUpdate);
8356
8911
  };
8357
8912
  }, [editor, hideWhenUnavailable, action]);
8358
- const handleAction = React.useCallback(() => {
8913
+ const handleAction = React3.useCallback(() => {
8359
8914
  if (!editor) return false;
8360
8915
  const success = executeUndoRedoAction(editor, action);
8361
8916
  if (success) {
@@ -8372,7 +8927,7 @@ function useUndoRedo(config) {
8372
8927
  Icon: historyIcons[action]
8373
8928
  };
8374
8929
  }
8375
- var ArrowLeftIcon = React.memo(({ className, ...props }) => {
8930
+ var ArrowLeftIcon = React3.memo(({ className, ...props }) => {
8376
8931
  return /* @__PURE__ */ jsxRuntime.jsx(
8377
8932
  "svg",
8378
8933
  {
@@ -8395,17 +8950,17 @@ var ArrowLeftIcon = React.memo(({ className, ...props }) => {
8395
8950
  });
8396
8951
  ArrowLeftIcon.displayName = "ArrowLeftIcon";
8397
8952
  function useSelect(editor, disabled = false, hideWhenUnavailable = false) {
8398
- const selectionAvailable = React__namespace.default.useMemo(() => hasSelection(editor), [editor?.state.selection]);
8399
- const blockMathSelected = React__namespace.default.useMemo(() => selectionHasBlockMath(editor), [editor?.state.selection]);
8400
- const isDisabled = React__namespace.default.useMemo(() => !selectionAvailable || disabled, [selectionAvailable, disabled]);
8401
- const shouldShow = React__namespace.default.useMemo(() => {
8953
+ const selectionAvailable = React3__namespace.default.useMemo(() => hasSelection(editor), [editor?.state.selection]);
8954
+ const blockMathSelected = React3__namespace.default.useMemo(() => selectionHasBlockMath(editor), [editor?.state.selection]);
8955
+ const isDisabled = React3__namespace.default.useMemo(() => !selectionAvailable || disabled, [selectionAvailable, disabled]);
8956
+ const shouldShow = React3__namespace.default.useMemo(() => {
8402
8957
  if (!editor?.isEditable) return false;
8403
8958
  if (hideWhenUnavailable && !selectionAvailable) return false;
8404
8959
  if (blockMathSelected) return false;
8405
8960
  return true;
8406
8961
  }, [editor, hideWhenUnavailable, selectionAvailable, blockMathSelected]);
8407
- const getText = React__namespace.default.useCallback(() => getSelectedText(editor), [editor]);
8408
- const getMarkdown = React__namespace.default.useCallback(() => getSelectedMarkdown(editor), [editor]);
8962
+ const getText = React3__namespace.default.useCallback(() => getSelectedText(editor), [editor]);
8963
+ const getMarkdown = React3__namespace.default.useCallback(() => getSelectedMarkdown(editor), [editor]);
8409
8964
  return {
8410
8965
  isDisabled,
8411
8966
  shouldShow,
@@ -8413,11 +8968,11 @@ function useSelect(editor, disabled = false, hideWhenUnavailable = false) {
8413
8968
  getMarkdown
8414
8969
  };
8415
8970
  }
8416
- var SelectButton = React__namespace.default.forwardRef(
8971
+ var SelectButton = React3__namespace.default.forwardRef(
8417
8972
  ({ editor: providedEditor, disabled = false, hideWhenUnavailable = false, onClick, children, icon, tooltip, ...buttonProps }, ref) => {
8418
8973
  const { editor } = useTiptapEditor(providedEditor);
8419
8974
  const { isDisabled, shouldShow, getText, getMarkdown } = useSelect(editor, disabled, hideWhenUnavailable);
8420
- const handleClick = React__namespace.default.useCallback(
8975
+ const handleClick = React3__namespace.default.useCallback(
8421
8976
  (e) => {
8422
8977
  if (e.defaultPrevented || isDisabled || !editor) return;
8423
8978
  const selectedText = getText();
@@ -8432,9 +8987,9 @@ var SelectButton = React__namespace.default.forwardRef(
8432
8987
  );
8433
8988
  SelectButton.displayName = "SelectButton";
8434
8989
  var useUnmount = (callback) => {
8435
- const ref = React.useRef(callback);
8990
+ const ref = React3.useRef(callback);
8436
8991
  ref.current = callback;
8437
- React.useEffect(
8992
+ React3.useEffect(
8438
8993
  () => () => {
8439
8994
  ref.current();
8440
8995
  },
@@ -8448,7 +9003,7 @@ var defaultOptions = {
8448
9003
  trailing: true
8449
9004
  };
8450
9005
  function useThrottledCallback(fn, wait = 250, dependencies = [], options = defaultOptions) {
8451
- const handler = React.useMemo(() => throttle__default.default(fn, wait, options), dependencies);
9006
+ const handler = React3.useMemo(() => throttle__default.default(fn, wait, options), dependencies);
8452
9007
  useUnmount(() => {
8453
9008
  handler.cancel();
8454
9009
  });
@@ -8470,8 +9025,8 @@ var isSSR = typeof window === "undefined";
8470
9025
  var hasResizeObserver = !isSSR && typeof ResizeObserver !== "undefined";
8471
9026
  var isClientSide = () => !isSSR;
8472
9027
  function useElementRect({ element, enabled = true, throttleMs = 100, useResizeObserver = true } = {}) {
8473
- const [rect, setRect] = React.useState(initialRect);
8474
- const getTargetElement = React.useCallback(() => {
9028
+ const [rect, setRect] = React3.useState(initialRect);
9029
+ const getTargetElement = React3.useCallback(() => {
8475
9030
  if (!enabled || !isClientSide()) return null;
8476
9031
  if (!element) {
8477
9032
  return document.body;
@@ -8508,7 +9063,7 @@ function useElementRect({ element, enabled = true, throttleMs = 100, useResizeOb
8508
9063
  [enabled, getTargetElement],
8509
9064
  { leading: true, trailing: true }
8510
9065
  );
8511
- React.useEffect(() => {
9066
+ React3.useEffect(() => {
8512
9067
  if (!enabled || !isClientSide()) {
8513
9068
  setRect(initialRect);
8514
9069
  return;
@@ -8545,7 +9100,7 @@ function useBodyRect(options = {}) {
8545
9100
  });
8546
9101
  }
8547
9102
  function useWindowSize() {
8548
- const [windowSize, setWindowSize] = React.useState({
9103
+ const [windowSize, setWindowSize] = React3.useState({
8549
9104
  width: 0,
8550
9105
  height: 0,
8551
9106
  offsetTop: 0,
@@ -8564,7 +9119,7 @@ function useWindowSize() {
8564
9119
  return { width, height, offsetTop, offsetLeft, scale };
8565
9120
  });
8566
9121
  }, 200);
8567
- React.useEffect(() => {
9122
+ React3.useEffect(() => {
8568
9123
  const visualViewport = window.visualViewport;
8569
9124
  if (!visualViewport) return;
8570
9125
  visualViewport.addEventListener("resize", handleViewportChange);
@@ -8584,7 +9139,7 @@ function useCursorVisibility({ editor, overlayHeight = 0 }) {
8584
9139
  throttleMs: 100,
8585
9140
  useResizeObserver: true
8586
9141
  });
8587
- React.useEffect(() => {
9142
+ React3.useEffect(() => {
8588
9143
  const ensureCursorVisibility = () => {
8589
9144
  if (!editor) return;
8590
9145
  const { state, view } = editor;
@@ -8609,7 +9164,7 @@ function useCursorVisibility({ editor, overlayHeight = 0 }) {
8609
9164
  }, [editor, overlayHeight, windowHeight, rect.height]);
8610
9165
  return rect;
8611
9166
  }
8612
- var QuoteIcon = React__namespace.memo(({ ...props }) => {
9167
+ var QuoteIcon = React3__namespace.memo(({ ...props }) => {
8613
9168
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "anticon", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 1024 1024", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
8614
9169
  "path",
8615
9170
  {
@@ -8682,7 +9237,7 @@ var MainToolbarContent = ({
8682
9237
  ] });
8683
9238
  };
8684
9239
  var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8685
- /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button6, { "data-style": "ghost", onClick: onBack, children: [
9240
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Button7, { "data-style": "ghost", onClick: onBack, children: [
8686
9241
  /* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, { className: "tiptap-button-icon" }),
8687
9242
  type === "highlighter" ? /* @__PURE__ */ jsxRuntime.jsx(HighlighterIcon, { className: "tiptap-button-icon" }) : /* @__PURE__ */ jsxRuntime.jsx(LinkIcon, { className: "tiptap-button-icon" })
8688
9243
  ] }) }),
@@ -8693,13 +9248,13 @@ var EditorToolbar = ({ tools, isBubble = false, onQuote, onCreateAnnotation, onC
8693
9248
  const isMobile = useIsBreakpoint();
8694
9249
  const { height } = useWindowSize();
8695
9250
  const { editor } = react.useCurrentEditor();
8696
- const toolbarRef = React.useRef(null);
9251
+ const toolbarRef = React3.useRef(null);
8697
9252
  const rect = useCursorVisibility({
8698
9253
  editor,
8699
9254
  overlayHeight: toolbarRef.current?.getBoundingClientRect().height ?? 0
8700
9255
  });
8701
- const [mobileView, setMobileView] = React.useState("main");
8702
- React.useEffect(() => {
9256
+ const [mobileView, setMobileView] = React3.useState("main");
9257
+ React3.useEffect(() => {
8703
9258
  if (!isMobile && mobileView !== "main") {
8704
9259
  setMobileView("main");
8705
9260
  }
@@ -8922,8 +9477,8 @@ var SearchAndReplace = core.Extension.create({
8922
9477
  });
8923
9478
  var searchAndReplace_default = SearchAndReplace;
8924
9479
  var usePageNo = (pageNoConfig) => {
8925
- const [editor, setEditor] = React.useState(null);
8926
- const lastScrollToPageNoRef = React.useRef(void 0);
9480
+ const [editor, setEditor] = React3.useState(null);
9481
+ const lastScrollToPageNoRef = React3.useRef(void 0);
8927
9482
  const setPageNoEditor = (newEditor) => {
8928
9483
  setEditor(newEditor);
8929
9484
  };
@@ -8931,7 +9486,7 @@ var usePageNo = (pageNoConfig) => {
8931
9486
  lastScrollToPageNoRef.current = pageNo;
8932
9487
  pageNoConfig?.onScrollPage?.(pageNo);
8933
9488
  }, 300);
8934
- React.useEffect(() => {
9489
+ React3.useEffect(() => {
8935
9490
  if (!editor) return;
8936
9491
  if (!pageNoConfig?.enabled) return;
8937
9492
  const targetPageNo = pageNoConfig?.pageNo;
@@ -8970,7 +9525,7 @@ var usePageNo = (pageNoConfig) => {
8970
9525
  onPageChange
8971
9526
  };
8972
9527
  };
8973
- var MarkdownEditor_default = React.forwardRef(
9528
+ var MarkdownEditor_default = React3.forwardRef(
8974
9529
  ({
8975
9530
  value = ``,
8976
9531
  onChange,
@@ -8986,7 +9541,7 @@ var MarkdownEditor_default = React.forwardRef(
8986
9541
  pageNoConfig
8987
9542
  }, ref) => {
8988
9543
  const isMobile = useIsBreakpoint();
8989
- const lastContentRef = React.useRef("");
9544
+ const lastContentRef = React3.useRef("");
8990
9545
  const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
8991
9546
  const {
8992
9547
  setAnnotationEditor,
@@ -9119,7 +9674,7 @@ var MarkdownEditor_default = React.forwardRef(
9119
9674
  if (editor.isEmpty) return "";
9120
9675
  return editor.getMarkdown();
9121
9676
  };
9122
- React.useImperativeHandle(
9677
+ React3.useImperativeHandle(
9123
9678
  ref,
9124
9679
  () => ({
9125
9680
  getEditor: () => editor,
@@ -9139,30 +9694,30 @@ var MarkdownEditor_default = React.forwardRef(
9139
9694
  }),
9140
9695
  [editor]
9141
9696
  );
9142
- React.useEffect(() => {
9697
+ React3.useEffect(() => {
9143
9698
  if (!editor) return;
9144
9699
  setAnnotationEditor(editor);
9145
9700
  setCollectionEditor(editor);
9146
9701
  setPageNoEditor(editor);
9147
9702
  }, [editor]);
9148
- React.useEffect(() => {
9703
+ React3.useEffect(() => {
9149
9704
  if (!editor) return;
9150
9705
  if (lastContentRef.current === value) return;
9151
9706
  editor?.commands.setContent(value, { contentType: "markdown" });
9152
9707
  editor?.commands.focus("start");
9153
9708
  lastContentRef.current = value;
9154
9709
  }, [value, editor]);
9155
- React.useEffect(() => {
9710
+ React3.useEffect(() => {
9156
9711
  editor?.commands.setSearchTerm(searchValue || "");
9157
9712
  }, [searchValue, value, editor]);
9158
- React.useEffect(() => {
9713
+ React3.useEffect(() => {
9159
9714
  editor?.setEditable(!disabled);
9160
9715
  }, [disabled, editor]);
9161
9716
  const downloadFile2 = () => {
9162
9717
  onDownloadFile?.(getMarkdown(), "docx");
9163
9718
  };
9164
- const fixedTools = React.useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
9165
- const floatTools = React.useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
9719
+ const fixedTools = React3.useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
9720
+ const floatTools = React3.useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
9166
9721
  return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "height-full width-full", children: [
9167
9722
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default("height-full", "flex-1", styles_module_default5.editorParent), children: /* @__PURE__ */ jsxRuntime.jsxs(react.EditorContext.Provider, { value: { editor }, children: [
9168
9723
  /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -9265,12 +9820,12 @@ var styles_module_default8 = {
9265
9820
  score: "styles_module_score"
9266
9821
  };
9267
9822
  var MarkDrawing_default = ({ children, detections, originalSize, scopeRender }) => {
9268
- const containerRef = React.useRef(null);
9269
- const [containerSize, setContainerSize] = React.useState({
9823
+ const containerRef = React3.useRef(null);
9824
+ const [containerSize, setContainerSize] = React3.useState({
9270
9825
  width: originalSize.width,
9271
9826
  height: originalSize.height
9272
9827
  });
9273
- React.useEffect(() => {
9828
+ React3.useEffect(() => {
9274
9829
  const obs = new ResizeObserver((entries) => {
9275
9830
  const entry = entries[0];
9276
9831
  if (entry) {
@@ -9291,7 +9846,7 @@ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender })
9291
9846
  const top = y1 * scaleY;
9292
9847
  const width = (x2 - x1) * scaleX;
9293
9848
  const height = (y2 - y1) * scaleY;
9294
- return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [
9849
+ return /* @__PURE__ */ jsxRuntime.jsxs(React3__namespace.default.Fragment, { children: [
9295
9850
  /* @__PURE__ */ jsxRuntime.jsx(
9296
9851
  "div",
9297
9852
  {
@@ -9326,7 +9881,7 @@ function renderDefault(DefaultComponent, ref, props) {
9326
9881
  if (!DefaultComponent) return null;
9327
9882
  return isRenderFn(DefaultComponent) ? /* @__PURE__ */ jsxRuntime.jsx(DefaultComponent, { ref, ...props }) : DefaultComponent;
9328
9883
  }
9329
- var RenderWrapper_default = React.forwardRef(function RenderWrapper({ control = true, ctx, DefaultComponent }, ref) {
9884
+ var RenderWrapper_default = React3.forwardRef(function RenderWrapper({ control = true, ctx, DefaultComponent }, ref) {
9330
9885
  if (control === false || isNull(control)) return null;
9331
9886
  if (control === true || control === void 0) {
9332
9887
  return renderDefault(DefaultComponent, ref);
@@ -9372,6 +9927,7 @@ exports.FilePreviewDrawer = FilePreviewDrawer_default;
9372
9927
  exports.HttpStatus = HttpStatus;
9373
9928
  exports.Iframe = Iframe_default;
9374
9929
  exports.LazyComponent = LazyComponent_default;
9930
+ exports.LuyaFilePreview = luyaFilePreview_default;
9375
9931
  exports.MarkDrawing = MarkDrawing_default;
9376
9932
  exports.MarkdownEditor = MarkdownEditor_default;
9377
9933
  exports.MarkdownPreview = MarkdownPreview_default;
@@ -9478,6 +10034,7 @@ exports.plus = plus;
9478
10034
  exports.precision = precision;
9479
10035
  exports.processItemList = processItemList;
9480
10036
  exports.propsMerge = propsMerge;
10037
+ exports.safeParseJson = safeParseJson;
9481
10038
  exports.setInterval = setInterval2;
9482
10039
  exports.setUrlMainSource = setUrlMainSource;
9483
10040
  exports.shouldRender = shouldRender;