@gientech/modual 2.2.15 → 2.2.17

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.
Files changed (59) hide show
  1. package/README.md +1 -40
  2. package/assets/{GientechStreamReader-Cw7qAuh1.js → GientechStreamReader-C4xVfNQX.js} +2 -2
  3. package/assets/{LeftOutlined-e0IEJaBy.js → LeftOutlined-DbVWaJal.js} +1 -1
  4. package/assets/{circle-plus-D-3IlJj0.js → circle-plus-Bqwlq2UM.js} +1 -1
  5. package/assets/{lib_enter-e1LoilHd-DrO8w6Nj.js → index-7vlgiCIK.js} +186 -187
  6. package/assets/{index-BtIbpTbT.js → index-BB-K4Uv2.js} +1 -1
  7. package/assets/{index-MhFum9cd.js → index-BBQqouVK.js} +4 -4
  8. package/assets/{index-CJSVtVuI.js → index-BbQ5_tfg.js} +20 -20
  9. package/assets/{index-D3P9OTJx.js → index-CQChY5LV.js} +1 -1
  10. package/assets/{index-BL0njpis.js → index-CaKTISxy.js} +8 -8
  11. package/assets/{index-DfjY9fMd.js → index-DCnYE71u.js} +18 -18
  12. package/assets/{index-DhiJUMaM.js → index-DIaywdNt.js} +1 -1
  13. package/assets/{index-BmxlskIi.js → index-DiTGnLML.js} +1 -1
  14. package/assets/{index-BzdLAhNN.js → index-O8MDfMV6.js} +1 -1
  15. package/assets/{index-B1tZE4X5.js → index-zCzB-56N.js} +1 -1
  16. package/assets/{plus-CmPO6ys9.js → plus-B4_cWXV7.js} +1 -1
  17. package/assets/{search-DH1utHsY.js → search-B5sYxJby.js} +1 -1
  18. package/assets/{style-DolEdtxM.js → style-BMV6a6pa.js} +6 -6
  19. package/assets/{triangle-alert-BjbZI8PD.js → triangle-alert-DMLBtHZo.js} +1 -1
  20. package/assets/{x-BUKpZUhr.js → x-BHe7G4Ln.js} +1 -1
  21. package/assistantConfig.js +20 -20
  22. package/chat.js +1 -1
  23. package/chatCompare.js +1 -1
  24. package/database.js +2 -2
  25. package/databaseId.js +1 -1
  26. package/databaseTable.js +2 -2
  27. package/index.js +1 -1
  28. package/modelManage.js +2 -2
  29. package/package.json +1 -11
  30. package/sensitive.js +6 -6
  31. package/sensitiveWords.js +1 -1
  32. package/streamFilesReader.js +1 -1
  33. package/assets/_commonjsHelpers-_d1bhYXs.js +0 -1
  34. package/assets/prism-bash-zSjFhtUz-cl4oq_rS.js +0 -1
  35. package/assets/prism-c-CXS5tkeN-BI05wwL9.js +0 -1
  36. package/assets/prism-cpp-DTm5qrps-DEcnTKnd.js +0 -1
  37. package/assets/prism-css-3Jya3wSQ-B-W7RKWG.js +0 -1
  38. package/assets/prism-diff-Apx1lkH_-b-nTbU2H.js +0 -3
  39. package/assets/prism-go-CHuRSSd--CyY0RbE6.js +0 -1
  40. package/assets/prism-java-l04-K_JR-DTIQeGI0.js +0 -1
  41. package/assets/prism-javascript-CLux6jF8-2LMHe_9g.js +0 -1
  42. package/assets/prism-json-iVb7He6L-xwnKirkR.js +0 -1
  43. package/assets/prism-jsx-yfun9EDN-BfrbuX8i.js +0 -1
  44. package/assets/prism-kotlin-QHMLy1lI-BxfM_G_h.js +0 -1
  45. package/assets/prism-markdown-tjNeCMi3-mpwv5EuF.js +0 -1
  46. package/assets/prism-markup-BNGj0Tvm-LX0ylPSt.js +0 -1
  47. package/assets/prism-php-Cq3Hq1Wv-BQ6y6LDZ.js +0 -1
  48. package/assets/prism-python-CP37PFZv-BvLoHz-u.js +0 -1
  49. package/assets/prism-ruby-DcAmdHPZ-CavK5dyy.js +0 -1
  50. package/assets/prism-rust-CuWIv8B8-D_BYGjS-.js +0 -1
  51. package/assets/prism-sql-8Y2-THrf-AgAyy5H_.js +0 -1
  52. package/assets/prism-swift-CeDyTyXT--kriB360.js +0 -1
  53. package/assets/prism-tsx-D_jjxt3I-DTNho6I-.js +0 -1
  54. package/assets/prism-typescript-DSWPRTnC-CeVC8Yup.js +0 -1
  55. package/assets/prism-yaml-DwdKlmeG-Dm3L3oXv.js +0 -1
  56. package/init.d.ts +0 -10
  57. package/init.js +0 -1
  58. package/prism-setup.d.ts +0 -10
  59. package/prism-setup.js +0 -9
package/README.md CHANGED
@@ -10,24 +10,6 @@ npm install @gientech/modual
10
10
 
11
11
  **⚠️ 安装问题?** 如果使用 Yarn 安装时遇到 hoisting 错误,请查看 [安装故障排除指南](./INSTALL_TROUBLESHOOTING.md)。
12
12
 
13
- ## ⚠️ 必需:Prism 初始化(避免白屏/class-name 报错)
14
-
15
- **使用 chat、chatCompare、databaseId 或 knowledgebaseDetails 时,必须在入口文件第一行添加:**
16
-
17
- ```javascript
18
- // main.tsx - 第一行必须是此导入(静态 import,不可放在 init() 或动态 import 中)
19
- import '@gientech/modual/init';
20
- ```
21
-
22
- 若使用 `manualChunks` 拆分 vendor,需在配置中排除 prismjs:
23
-
24
- ```javascript
25
- manualChunks(id) {
26
- if (id.includes('node_modules/prismjs')) return undefined;
27
- // ... 其他逻辑
28
- }
29
- ```
30
-
31
13
  ## 🏗️ 打包逻辑
32
14
 
33
15
  ### 多入口打包架构
@@ -44,8 +26,6 @@ dist/
44
26
  ├── modelManage.js # 模型管理模块
45
27
  ├── sensitive.js # 敏感词模块
46
28
  ├── streamFilesReader.js # 流式文件读取器模块
47
- ├── prism-setup.js # Prism 语言预加载
48
- ├── init.js # 初始化入口(含 prism-setup,使用前必须第一行导入)
49
29
  ├── assets/
50
30
  │ └── style.css # 统一样式文件
51
31
  └── *.d.ts # TypeScript 类型定义文件
@@ -80,14 +60,13 @@ dist/
80
60
 
81
61
  ```javascript
82
62
  // main.tsx(应用入口文件)
83
- import '@gientech/modual/init'; // 第一行:Prism 初始化,避免 class-name 报错
84
63
  import React from 'react';
85
64
  import ReactDOM from 'react-dom/client';
86
65
 
87
66
  // 方式一:从主入口引入(推荐)
88
67
  import { registerPDFWorker } from '@gientech/modual';
89
68
 
90
- // 方式二:从 chat 模块引入(chat/chatCompare/databaseId 已内置 Prism 预加载,无需额外配置)
69
+ // 方式二:从 chat 模块引入
91
70
  // import { registerPDFWorker } from '@gientech/modual/chat';
92
71
 
93
72
  // 方式三:直接从 @mxmweb/fviewer 引入
@@ -456,24 +435,6 @@ export default App;
456
435
 
457
436
  ## 🐛 常见问题
458
437
 
459
- ### Q: 白屏或报错 `Cannot set properties of undefined (setting 'class-name')`
460
-
461
- **A**: 这是 Prism.js 语言加载顺序问题。**必须在入口文件第一行**添加(静态 import,不可用 dynamic import):
462
-
463
- ```javascript
464
- // main.tsx 第一行
465
- import '@gientech/modual/init';
466
- ```
467
-
468
- 若使用 `manualChunks`,需排除 prismjs:
469
-
470
- ```javascript
471
- manualChunks(id) {
472
- if (id.includes('node_modules/prismjs')) return undefined;
473
- // ...
474
- }
475
- ```
476
-
477
438
  ### Q: PDF 预览报错 "PDF Worker 未注册"
478
439
 
479
440
  **A**: 需要**在应用入口文件(main.tsx)中**注册 Worker,不能在组件内部注册:
@@ -1,4 +1,4 @@
1
- var zn=Object.defineProperty;var Sn=p=>{throw TypeError(p)};var Gn=(p,a,b)=>a in p?zn(p,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[a]=b;var se=(p,a,b)=>Gn(p,typeof a!="symbol"?a+"":a,b),an=(p,a,b)=>a.has(p)||Sn("Cannot "+b);var R=(p,a,b)=>(an(p,a,"read from private field"),b?b.call(p):a.get(p)),Ot=(p,a,b)=>a.has(p)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(p):a.set(p,b),It=(p,a,b,f)=>(an(p,a,"write to private field"),f?f.call(p,b):a.set(p,b),b),Dt=(p,a,b)=>(an(p,a,"access private method"),b);var on=(p,a,b,f)=>({set _(A){It(p,a,A,b)},get _(){return R(p,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{c as createLucideIcon,d as dt$1,F as axios}from"./index-DfjY9fMd.js";import{G as G8,r as ra}from"./lib_enter-e1LoilHd-DrO8w6Nj.js";import{g as getAugmentedNamespace}from"./_commonjsHelpers-_d1bhYXs.js";import{a as ChevronRight}from"./index-CJSVtVuI.js";import{X}from"./x-BUKpZUhr.js";/**
1
+ var zn=Object.defineProperty;var Sn=p=>{throw TypeError(p)};var Gn=(p,a,b)=>a in p?zn(p,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[a]=b;var se=(p,a,b)=>Gn(p,typeof a!="symbol"?a+"":a,b),an=(p,a,b)=>a.has(p)||Sn("Cannot "+b);var R=(p,a,b)=>(an(p,a,"read from private field"),b?b.call(p):a.get(p)),Ot=(p,a,b)=>a.has(p)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(p):a.set(p,b),It=(p,a,b,f)=>(an(p,a,"write to private field"),f?f.call(p,b):a.set(p,b),b),Dt=(p,a,b)=>(an(p,a,"access private method"),b);var on=(p,a,b,f)=>({set _(A){It(p,a,A,b)},get _(){return R(p,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{c as createLucideIcon,a5 as getAugmentedNamespace,d as dt$1,F as axios}from"./index-DCnYE71u.js";import{W as W8,r as ra}from"./index-7vlgiCIK.js";import{a as ChevronRight}from"./index-BbQ5_tfg.js";import{X}from"./x-BHe7G4Ln.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -167,7 +167,7 @@ var zn=Object.defineProperty;var Sn=p=>{throw TypeError(p)};var Gn=(p,a,b)=>a in
167
167
  0% { transform: rotate(0deg); }
168
168
  100% { transform: rotate(360deg); }
169
169
  }
170
- `))},We=(p,a)=>{var b,f,A,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",p),console.log("data.content:",p.content);let Y="";typeof p.content=="string"?Y=p.content:(b=p.content)!=null&&b.text?Y=p.content.text:(f=p.content)!=null&&f.content&&(Y=p.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),_=useRef(null);return useEffect(()=>{if(M.current&&_.current&&Y){const w=setTimeout(()=>{var P;const F=((P=M.current)==null?void 0:P.scrollHeight)||0,S=Math.max(F+80,200);_.current&&(_.current.style.minHeight=`${S}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",S))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:_,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(G8,{dataSource:{type:ra.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(A=a.styles)==null?void 0:A.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible",whiteSpace:"pre-line"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:p,parentProps:a,isTableMode:b=!1})=>{var f,A,V,q,Y,M,_,w,P,F,S,c;const t=useRef(null),s=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),l=(N,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:N,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:N,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},r=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=N=>{var U,G;try{if(!b)return;const bt=typeof p.content=="string"?p.content:((U=p.content)==null?void 0:U.content)||"";if(!bt||I.length===0)return;const wt=JSON.stringify(I.map(H=>({o:H.offsets,c:H.color}))),Mt=`${bt.length}:${bt.substring(0,64)}:${bt.substring(bt.length-64)}|${wt}`;if(((G=N.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Mt)return;setTimeout(()=>{pt(),N.dataset&&(N.dataset.tableAnnoRuntimeSig=Mt)},50)}catch(bt){console.warn("[MarkdownRendered] apply failed",bt)}};const E=React__default.useCallback(N=>{var U;return(U=e.current)==null?void 0:U.call(e,N)},[]),x=useCallback(()=>{var N;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),bt=G.toString().trim();if(!bt)return;const wt=t.current;let Mt=0,H=0;const d=document.createTreeWalker(wt,NodeFilter.SHOW_TEXT,{acceptNode:O=>{var $;return($=O.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let u=d.nextNode();for(;u;){if(u===G.startContainer){H=Mt+G.startOffset;break}Mt+=((N=u.textContent)==null?void 0:N.length)||0,u=d.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:bt,startOffset:H,charCount:Mt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+bt.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),L=b?[]:(a.annotationData||[]).filter(N=>"start"in N&&"end"in N&&!("pageNumber"in N)),I=b?(a.annotationData||[]).filter(N=>"offsets"in N&&Array.isArray(N.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const N=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",N.length),N.length>0&&N.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),St=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(N=>{Array.from(N.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",I),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(St(),!I.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const N=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",N.length),N.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,I.forEach((U,G)=>{const bt=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(bt)||!bt.length||!Array.isArray(bt[0])||bt[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}bt.forEach((wt,Mt)=>{const[H,d]=wt;if(typeof H!="number"||typeof d!="number"){console.warn("[TableAnnotation] offset is not [number, number]",wt);return}N.forEach((u,T)=>{var O;const $=Array.from(u.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const i=(O=W.cells)==null?void 0:O[d];if(!i){console.warn("[TableAnnotation] cell is undefined",{row:H,col:d,tableIndex:T});return}const h=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(i).backgroundColor;i.getAttribute("data-table-annotated")==="1"&&(C===h||i.style.backgroundColor===h)||(i.style.setProperty("background",h,"important"),i.style.setProperty("background-color",h,"important"),i.setAttribute("data-table-annotated","1")),U.content&&(i.title=U.content),Mt===0&&G===0&&setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[I,St]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!L.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}s.current&&clearTimeout(s.current);const N=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const O=T.parentNode;O&&O.replaceChild(document.createTextNode(T.textContent||""),T)});const bt=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var O;return(O=T.parentElement)!=null&&O.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),wt=[];let Mt;for(;Mt=bt.nextNode();)wt.push(Mt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",wt.length),wt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),s.current=setTimeout(()=>{N()},200);return}let H=0;const d=wt.map(T=>{var O;const $=H;return H+=((O=T.textContent)==null?void 0:O.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",d),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const u=[...L].sort((T,O)=>O.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",u),u.forEach(T=>{const{start:O,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:d});const i=d.filter(h=>O<h.end&&$>h.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",i.length),i.forEach(({node:h,start:C})=>{var y,k,j,D,m,B;const _t=Math.max(0,O-C),z=Math.min(((y=h.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=h.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Q=((j=h.textContent)==null?void 0:j.slice(0,_t))||"",At=((D=h.textContent)==null?void 0:D.slice(_t,z))||"",kt=((m=h.textContent)==null?void 0:m.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Q,annotatedText:At,after:kt});const Rt=document.createElement("span");Rt.className="md-annotation",Rt.style.backgroundColor=W||"#FFE599",Rt.textContent=At;const xt=document.createDocumentFragment();Q&&xt.appendChild(document.createTextNode(Q)),xt.appendChild(Rt),kt&&xt.appendChild(document.createTextNode(kt)),(B=h.parentNode)==null||B.replaceChild(xt,h),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};s.current=setTimeout(()=>{N()},100)},[L]);return useEffect(()=>{var N;if(b){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof p.content=="string"?p.content:((N=p.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",b),console.log("mdAnnotations:",L),console.log("tableAnnotations:",I),console.log("data.content:",p.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(b||yt(),!b&&L.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[b,I,L]),useEffect(()=>{if(!b)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,b]),useEffect(()=>{var N;const U=typeof p.content=="string"?p.content:((N=p.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",b),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",L),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",I)},[L,I,b]),useEffect(()=>{if(b&&t.current){const N=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((bt,wt)=>{if(bt instanceof HTMLTableElement){bt.style.width="100%",bt.style.minWidth="100%",bt.style.tableLayout="auto";const Mt=bt.closest(".markdown-table-mode");Mt&&Mt instanceof HTMLElement&&(Mt.style.width="100%",Mt.style.overflowX="auto"),console.log(`\u8868\u683C ${wt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(N)}},[b,p.content]),useEffect(()=>()=>{s.current&&clearTimeout(s.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${b?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(G8,{dataSource:{type:ra.MARKDOWN,content:(()=>{var N,U;return typeof p.content=="string"?p.content:(N=p.content)!=null&&N.text?p.content.text:(U=p.content)!=null&&U.content?p.content.content:""})()},size:"md",onScroll:b?void 0:l,onScrollToTop:b?void 0:n,onScrollToBottom:b?void 0:r,onRendered:E,theme:{primaryColor:((V=(A=(f=a.styles)==null?void 0:f.theme)==null?void 0:A.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(_=a.styles)==null?void 0:_.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((c=(S=(F=a.styles)==null?void 0:F.theme)==null?void 0:S.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:b?"0px":"8px",padding:b?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:b?"visible":"scroll"}})))},Oe=({markdown:p,onRendered:a,tableAnnotations:b=[]})=>{const f=useRef(null),A=q=>{const Y=q.split(/\r?\n/).filter(F=>F.trim().length>0);let M=-1;for(let F=0;F<Y.length-1;F++){const S=Y[F].trim(),c=Y[F+1].trim();if(S.startsWith("|")&&S.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=F;break}}if(M===-1)return null;const _=Y[M].split("|").slice(1,-1).map(F=>F.trim()),w=[];for(let F=M+2;F<Y.length;F++){const S=Y[F].trim();if(!S.startsWith("|")||!S.endsWith("|"))break;w.push(S)}const P=w.map(F=>F.split("|").slice(1,-1).map(S=>S.trim()));return{headers:_,rows:P}},V=React__default.useMemo(()=>A(p),[p]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(_=>{Array.from(_.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!b.length||!M||M.length===0)return;b.forEach((_,w)=>{(_.offsets||[]).forEach((P,F)=>{const[S,c]=P;M.forEach(t=>{var s;const o=Array.from(t.rows)[S];if(!o)return;const v=(s=o.cells)==null?void 0:s[c];if(!v)return;const g=_.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),_.content&&(v.title=_.content)),w===0&&F===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[p,b,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
170
+ `))},We=(p,a)=>{var b,f,A,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",p),console.log("data.content:",p.content);let Y="";typeof p.content=="string"?Y=p.content:(b=p.content)!=null&&b.text?Y=p.content.text:(f=p.content)!=null&&f.content&&(Y=p.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),_=useRef(null);return useEffect(()=>{if(M.current&&_.current&&Y){const w=setTimeout(()=>{var P;const F=((P=M.current)==null?void 0:P.scrollHeight)||0,S=Math.max(F+80,200);_.current&&(_.current.style.minHeight=`${S}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",S))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:_,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(W8,{dataSource:{type:ra.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(A=a.styles)==null?void 0:A.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible",whiteSpace:"pre-line"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:p,parentProps:a,isTableMode:b=!1})=>{var f,A,V,q,Y,M,_,w,P,F,S,c;const t=useRef(null),s=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),l=(N,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:N,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:N,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},r=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=N=>{var U,G;try{if(!b)return;const bt=typeof p.content=="string"?p.content:((U=p.content)==null?void 0:U.content)||"";if(!bt||I.length===0)return;const wt=JSON.stringify(I.map(H=>({o:H.offsets,c:H.color}))),Mt=`${bt.length}:${bt.substring(0,64)}:${bt.substring(bt.length-64)}|${wt}`;if(((G=N.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Mt)return;setTimeout(()=>{pt(),N.dataset&&(N.dataset.tableAnnoRuntimeSig=Mt)},50)}catch(bt){console.warn("[MarkdownRendered] apply failed",bt)}};const E=React__default.useCallback(N=>{var U;return(U=e.current)==null?void 0:U.call(e,N)},[]),x=useCallback(()=>{var N;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),bt=G.toString().trim();if(!bt)return;const wt=t.current;let Mt=0,H=0;const d=document.createTreeWalker(wt,NodeFilter.SHOW_TEXT,{acceptNode:O=>{var $;return($=O.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let u=d.nextNode();for(;u;){if(u===G.startContainer){H=Mt+G.startOffset;break}Mt+=((N=u.textContent)==null?void 0:N.length)||0,u=d.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:bt,startOffset:H,charCount:Mt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+bt.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),L=b?[]:(a.annotationData||[]).filter(N=>"start"in N&&"end"in N&&!("pageNumber"in N)),I=b?(a.annotationData||[]).filter(N=>"offsets"in N&&Array.isArray(N.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const N=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",N.length),N.length>0&&N.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),St=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(N=>{Array.from(N.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",I),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(St(),!I.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const N=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",N.length),N.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,I.forEach((U,G)=>{const bt=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(bt)||!bt.length||!Array.isArray(bt[0])||bt[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}bt.forEach((wt,Mt)=>{const[H,d]=wt;if(typeof H!="number"||typeof d!="number"){console.warn("[TableAnnotation] offset is not [number, number]",wt);return}N.forEach((u,T)=>{var O;const $=Array.from(u.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const i=(O=W.cells)==null?void 0:O[d];if(!i){console.warn("[TableAnnotation] cell is undefined",{row:H,col:d,tableIndex:T});return}const h=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(i).backgroundColor;i.getAttribute("data-table-annotated")==="1"&&(C===h||i.style.backgroundColor===h)||(i.style.setProperty("background",h,"important"),i.style.setProperty("background-color",h,"important"),i.setAttribute("data-table-annotated","1")),U.content&&(i.title=U.content),Mt===0&&G===0&&setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[I,St]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!L.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}s.current&&clearTimeout(s.current);const N=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const O=T.parentNode;O&&O.replaceChild(document.createTextNode(T.textContent||""),T)});const bt=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var O;return(O=T.parentElement)!=null&&O.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),wt=[];let Mt;for(;Mt=bt.nextNode();)wt.push(Mt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",wt.length),wt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),s.current=setTimeout(()=>{N()},200);return}let H=0;const d=wt.map(T=>{var O;const $=H;return H+=((O=T.textContent)==null?void 0:O.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",d),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const u=[...L].sort((T,O)=>O.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",u),u.forEach(T=>{const{start:O,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:d});const i=d.filter(h=>O<h.end&&$>h.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",i.length),i.forEach(({node:h,start:C})=>{var y,k,j,D,m,B;const _t=Math.max(0,O-C),z=Math.min(((y=h.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=h.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Q=((j=h.textContent)==null?void 0:j.slice(0,_t))||"",At=((D=h.textContent)==null?void 0:D.slice(_t,z))||"",kt=((m=h.textContent)==null?void 0:m.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Q,annotatedText:At,after:kt});const Rt=document.createElement("span");Rt.className="md-annotation",Rt.style.backgroundColor=W||"#FFE599",Rt.textContent=At;const xt=document.createDocumentFragment();Q&&xt.appendChild(document.createTextNode(Q)),xt.appendChild(Rt),kt&&xt.appendChild(document.createTextNode(kt)),(B=h.parentNode)==null||B.replaceChild(xt,h),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};s.current=setTimeout(()=>{N()},100)},[L]);return useEffect(()=>{var N;if(b){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof p.content=="string"?p.content:((N=p.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",b),console.log("mdAnnotations:",L),console.log("tableAnnotations:",I),console.log("data.content:",p.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(b||yt(),!b&&L.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[b,I,L]),useEffect(()=>{if(!b)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,b]),useEffect(()=>{var N;const U=typeof p.content=="string"?p.content:((N=p.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",b),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",L),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",I)},[L,I,b]),useEffect(()=>{if(b&&t.current){const N=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((bt,wt)=>{if(bt instanceof HTMLTableElement){bt.style.width="100%",bt.style.minWidth="100%",bt.style.tableLayout="auto";const Mt=bt.closest(".markdown-table-mode");Mt&&Mt instanceof HTMLElement&&(Mt.style.width="100%",Mt.style.overflowX="auto"),console.log(`\u8868\u683C ${wt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(N)}},[b,p.content]),useEffect(()=>()=>{s.current&&clearTimeout(s.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${b?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(W8,{dataSource:{type:ra.MARKDOWN,content:(()=>{var N,U;return typeof p.content=="string"?p.content:(N=p.content)!=null&&N.text?p.content.text:(U=p.content)!=null&&U.content?p.content.content:""})()},size:"md",onScroll:b?void 0:l,onScrollToTop:b?void 0:n,onScrollToBottom:b?void 0:r,onRendered:E,theme:{primaryColor:((V=(A=(f=a.styles)==null?void 0:f.theme)==null?void 0:A.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(_=a.styles)==null?void 0:_.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((c=(S=(F=a.styles)==null?void 0:F.theme)==null?void 0:S.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:b?"0px":"8px",padding:b?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:b?"visible":"scroll"}})))},Oe=({markdown:p,onRendered:a,tableAnnotations:b=[]})=>{const f=useRef(null),A=q=>{const Y=q.split(/\r?\n/).filter(F=>F.trim().length>0);let M=-1;for(let F=0;F<Y.length-1;F++){const S=Y[F].trim(),c=Y[F+1].trim();if(S.startsWith("|")&&S.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=F;break}}if(M===-1)return null;const _=Y[M].split("|").slice(1,-1).map(F=>F.trim()),w=[];for(let F=M+2;F<Y.length;F++){const S=Y[F].trim();if(!S.startsWith("|")||!S.endsWith("|"))break;w.push(S)}const P=w.map(F=>F.split("|").slice(1,-1).map(S=>S.trim()));return{headers:_,rows:P}},V=React__default.useMemo(()=>A(p),[p]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(_=>{Array.from(_.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!b.length||!M||M.length===0)return;b.forEach((_,w)=>{(_.offsets||[]).forEach((P,F)=>{const[S,c]=P;M.forEach(t=>{var s;const o=Array.from(t.rows)[S];if(!o)return;const v=(s=o.cells)==null?void 0:s[c];if(!v)return;const g=_.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),_.content&&(v.title=_.content)),w===0&&F===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[p,b,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
171
171
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
172
172
  .z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
173
173
  .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
@@ -1 +1 @@
1
- import{I as n,_ as r}from"./index-DfjY9fMd.js";import*as t from"react";var c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},o=function(e,a){return t.createElement(n,r({},e,{ref:a,icon:c}))},d=t.forwardRef(o),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},f=function(e,a){return t.createElement(n,r({},e,{ref:a,icon:l}))},u=t.forwardRef(f);export{u as R,d as a};
1
+ import{I as n,_ as r}from"./index-DCnYE71u.js";import*as t from"react";var c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},o=function(e,a){return t.createElement(n,r({},e,{ref:a,icon:c}))},d=t.forwardRef(o),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},f=function(e,a){return t.createElement(n,r({},e,{ref:a,icon:l}))},u=t.forwardRef(f);export{u as R,d as a};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-DfjY9fMd.js";/**
1
+ import{c}from"./index-DCnYE71u.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.