@researai/deepscientist 1.5.16 → 1.5.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 (82) hide show
  1. package/README.md +66 -23
  2. package/bin/ds.js +550 -19
  3. package/docs/en/00_QUICK_START.md +65 -5
  4. package/docs/en/01_SETTINGS_REFERENCE.md +1 -1
  5. package/docs/en/09_DOCTOR.md +14 -3
  6. package/docs/en/15_CODEX_PROVIDER_SETUP.md +12 -3
  7. package/docs/en/21_LOCAL_MODEL_BACKENDS_GUIDE.md +283 -0
  8. package/docs/en/91_DEVELOPMENT.md +237 -0
  9. package/docs/en/README.md +7 -3
  10. package/docs/zh/00_QUICK_START.md +54 -5
  11. package/docs/zh/01_SETTINGS_REFERENCE.md +1 -1
  12. package/docs/zh/09_DOCTOR.md +15 -4
  13. package/docs/zh/15_CODEX_PROVIDER_SETUP.md +12 -3
  14. package/docs/zh/21_LOCAL_MODEL_BACKENDS_GUIDE.md +281 -0
  15. package/docs/zh/README.md +7 -3
  16. package/install.sh +46 -4
  17. package/package.json +2 -1
  18. package/pyproject.toml +1 -1
  19. package/src/deepscientist/__init__.py +1 -1
  20. package/src/deepscientist/bridges/connectors.py +8 -2
  21. package/src/deepscientist/codex_cli_compat.py +185 -72
  22. package/src/deepscientist/config/service.py +154 -6
  23. package/src/deepscientist/daemon/api/handlers.py +130 -25
  24. package/src/deepscientist/daemon/api/router.py +5 -0
  25. package/src/deepscientist/daemon/app.py +446 -22
  26. package/src/deepscientist/diagnostics/__init__.py +6 -0
  27. package/src/deepscientist/diagnostics/runner_failures.py +130 -0
  28. package/src/deepscientist/doctor.py +207 -3
  29. package/src/deepscientist/prompts/builder.py +22 -4
  30. package/src/deepscientist/quest/service.py +413 -13
  31. package/src/deepscientist/runners/codex.py +59 -14
  32. package/src/deepscientist/shared.py +19 -0
  33. package/src/prompts/contracts/shared_interaction.md +3 -2
  34. package/src/prompts/system.md +13 -0
  35. package/src/prompts/system_copilot.md +13 -0
  36. package/src/tui/package.json +1 -1
  37. package/src/ui/dist/assets/{AiManusChatView-COFACy7V.js → AiManusChatView-Bv-Z8YpU.js} +44 -44
  38. package/src/ui/dist/assets/{AnalysisPlugin-DnSm0GZn.js → AnalysisPlugin-BCKAfjba.js} +1 -1
  39. package/src/ui/dist/assets/{CliPlugin-CvwCmDQ5.js → CliPlugin-BCKcpc35.js} +4 -4
  40. package/src/ui/dist/assets/{CodeEditorPlugin-cOqSa0xq.js → CodeEditorPlugin-DbOfSJ8K.js} +1 -1
  41. package/src/ui/dist/assets/{CodeViewerPlugin-itb0tltR.js → CodeViewerPlugin-CbaFRrUU.js} +3 -3
  42. package/src/ui/dist/assets/{DocViewerPlugin-DqKkiCI6.js → DocViewerPlugin-DAjLVeQD.js} +3 -3
  43. package/src/ui/dist/assets/{GitCommitViewerPlugin-DVgNHBCS.js → GitCommitViewerPlugin-CIUqbUDO.js} +1 -1
  44. package/src/ui/dist/assets/{GitDiffViewerPlugin-DxL2ezFG.js → GitDiffViewerPlugin-CQACjoAA.js} +1 -1
  45. package/src/ui/dist/assets/{GitSnapshotViewer-B_RQm1YZ.js → GitSnapshotViewer-0r4nLPke.js} +1 -1
  46. package/src/ui/dist/assets/{ImageViewerPlugin-tHqlXY3n.js → ImageViewerPlugin-nBOmI2v_.js} +3 -3
  47. package/src/ui/dist/assets/{LabCopilotPanel-ClMbq5Yu.js → LabCopilotPanel-BHxOxF4z.js} +1 -1
  48. package/src/ui/dist/assets/{LabPlugin-L_SuE8ow.js → LabPlugin-BKoZGs95.js} +1 -1
  49. package/src/ui/dist/assets/{LatexPlugin-B495DTXC.js → LatexPlugin-ZwtV8pIp.js} +1 -1
  50. package/src/ui/dist/assets/{MarkdownViewerPlugin-DG28-61B.js → MarkdownViewerPlugin-DKqVfKyW.js} +3 -3
  51. package/src/ui/dist/assets/{MarketplacePlugin-BiOGT-Kj.js → MarketplacePlugin-BwxStZ9D.js} +1 -1
  52. package/src/ui/dist/assets/{NotebookEditor-C-4Kt1p9.js → NotebookEditor-BEQhaQbt.js} +1 -1
  53. package/src/ui/dist/assets/{NotebookEditor-CVsj8h_T.js → NotebookEditor-DB9N_T9q.js} +23 -23
  54. package/src/ui/dist/assets/{PdfLoader-CASDQmxJ.js → PdfLoader-eWBONbQP.js} +1 -1
  55. package/src/ui/dist/assets/{PdfMarkdownPlugin-BFhwoKsY.js → PdfMarkdownPlugin-D22YOZL3.js} +1 -1
  56. package/src/ui/dist/assets/{PdfViewerPlugin-DcOzU9vd.js → PdfViewerPlugin-c-RK9DLM.js} +3 -3
  57. package/src/ui/dist/assets/{SearchPlugin-CHj7M58O.js → SearchPlugin-CxF9ytAx.js} +1 -1
  58. package/src/ui/dist/assets/{TextViewerPlugin-CB4DYfWO.js → TextViewerPlugin-C5xqeeUH.js} +2 -2
  59. package/src/ui/dist/assets/{VNCViewer-CjlbyCB3.js → VNCViewer-BoLGLnHz.js} +1 -1
  60. package/src/ui/dist/assets/{bot-CFkZY-JP.js → bot-DREQOxzP.js} +1 -1
  61. package/src/ui/dist/assets/{chevron-up-Dq5ofbht.js → chevron-up-C9Qpx4DE.js} +1 -1
  62. package/src/ui/dist/assets/{code-DLC6G24T.js → code-WlFHE7z_.js} +1 -1
  63. package/src/ui/dist/assets/{file-content-Dv4LoZec.js → file-content-BZMz3RYp.js} +1 -1
  64. package/src/ui/dist/assets/{file-diff-panel-Denq-lC3.js → file-diff-panel-CQhw0jS2.js} +1 -1
  65. package/src/ui/dist/assets/{file-socket-Cu4Qln7Y.js → file-socket-CfQPKQKj.js} +1 -1
  66. package/src/ui/dist/assets/{git-commit-horizontal-BUh6G52n.js → git-commit-horizontal-DxZ8DCZh.js} +1 -1
  67. package/src/ui/dist/assets/{image-B9HUUddG.js → image-Bgl4VIyx.js} +1 -1
  68. package/src/ui/dist/assets/{index-Cgla8biy.css → index-BpV6lusQ.css} +1 -1
  69. package/src/ui/dist/assets/{index-Gbl53BNp.js → index-CBNVuWcP.js} +363 -363
  70. package/src/ui/dist/assets/{index-wQ7RIIRd.js → index-CwNu1aH4.js} +1 -1
  71. package/src/ui/dist/assets/{index-B2B1sg-M.js → index-DrUnlf6K.js} +1 -1
  72. package/src/ui/dist/assets/{index-DRyx7vAc.js → index-NW-h8VzN.js} +1 -1
  73. package/src/ui/dist/assets/{pdf-effect-queue-ZtnHFCAi.js → pdf-effect-queue-J8OnM0jE.js} +1 -1
  74. package/src/ui/dist/assets/{popover-DL6h35vr.js → popover-CLc0pPP8.js} +1 -1
  75. package/src/ui/dist/assets/{project-sync-CsX08Qno.js → project-sync-C9IdzdZW.js} +1 -1
  76. package/src/ui/dist/assets/{select-DvmXt1yY.js → select-Cs2PmzwL.js} +1 -1
  77. package/src/ui/dist/assets/{sigma-7jpXazui.js → sigma-ClKcHAXm.js} +1 -1
  78. package/src/ui/dist/assets/{trash-xA7kFt8i.js → trash-DwpbFr3w.js} +1 -1
  79. package/src/ui/dist/assets/{useCliAccess-DsMwDjOp.js → useCliAccess-NQ8m0Let.js} +1 -1
  80. package/src/ui/dist/assets/{wrap-text-CwMn-iqb.js → wrap-text-BC-Hltpd.js} +1 -1
  81. package/src/ui/dist/assets/{zoom-out-R-GWEhzS.js → zoom-out-E_gaeAxL.js} +1 -1
  82. package/src/ui/dist/index.html +2 -2
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js"])))=>i.map(i=>d[i]);
2
- import{i as Q,f as B,j as o,b as C,L as M,S as X,B as Y,R as Z,g as $,_ as ee}from"./index-Gbl53BNp.js";import{R as c}from"./plugin-monaco-C8UgLomw.js";import{u as l,a as te}from"./file-content-Dv4LoZec.js";import{a as ne}from"./file-socket-Cu4Qln7Y.js";import{c as se}from"./monaco-CiHMMNH_.js";import{u as ie}from"./useFileDiffOverlay-FuhcnKiw.js";import{F as re}from"./file-diff-panel-Denq-lC3.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const oe=$(()=>ee(()=>import("./plugin-monaco-C8UgLomw.js").then(r=>r.i),__vite__mapDeps([0,1])),{});se();function ae(r){const i=r.toLowerCase();return i.endsWith(".py")||i.endsWith(".pyw")||i.endsWith(".pyi")?"python":i.endsWith(".json")||i.endsWith(".jsonc")||i.endsWith(".json5")?"json":i.endsWith(".ts")||i.endsWith(".tsx")||i.endsWith(".mts")?"typescript":i.endsWith(".js")||i.endsWith(".jsx")||i.endsWith(".mjs")?"javascript":i.endsWith(".md")||i.endsWith(".markdown")?"markdown":i.endsWith(".yaml")||i.endsWith(".yml")?"yaml":i.endsWith(".html")||i.endsWith(".htm")?"html":i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")?"css":"plaintext"}function de(){const[r,i]=c.useState(()=>typeof document>"u"?!1:document.documentElement.classList.contains("dark"));return c.useEffect(()=>{const m=document.documentElement,h=new MutationObserver(()=>{i(m.classList.contains("dark"))});return h.observe(m,{attributes:!0,attributeFilter:["class"]}),()=>h.disconnect()},[]),r}function ce(r,i,m){c.useEffect(()=>{const h=window.setTimeout(r,m);return()=>window.clearTimeout(h)},[...i,m])}function be({context:r,tabId:i,setDirty:m,setTitle:h}){const n=r.customData?.projectId??void 0,d=r.customData?.fileMeta??void 0,t=r.resourceId,v=Q(t),P=r.resourcePath??void 0,g=r.resourceName||r.resourcePath||"Untitled",T=c.useMemo(()=>ae(g),[g]),I=de(),D=l(e=>e.ensureLoaded),k=l(e=>e.reload),A=l(e=>e.save),_=l(e=>e.setContent),E=l(e=>e.applyServerSnapshot),N=n&&t?l.getState().getKey(n,t):null,s=l(e=>N?e.entries[N]:void 0),W=te(n,t??void 0),x=B(e=>e.updateFileMeta),{diffEvent:b,clearDiff:K}=ie({fileId:t,filePath:P,projectId:n}),F=c.useRef(null),z=c.useRef(null),w=c.useRef(!1),[O,j]=c.useState(!1);c.useEffect(()=>{h(g)},[g,h]),c.useEffect(()=>{!n||!t||D({projectId:n,fileId:t,updatedAt:d?.updatedAt,mimeType:r.mimeType??d?.mimeType,sizeBytes:d?.sizeBytes}).catch(e=>{console.error("[CodeEditorPlugin] Failed to load file:",e)})},[n,t,D,d?.updatedAt,d?.mimeType,d?.sizeBytes,r.mimeType]),c.useEffect(()=>{if(!n||!t||v)return;const{socket:e,release:u}=ne();z.current={socket:e,release:u};const a=async()=>{if(!w.current&&e.connected)try{w.current=!0,await e.emitWithAck("file:join",{projectId:n,fileId:t,clientVersion:"1.0.0"}),j(!0)}catch(f){console.warn("[CodeEditorPlugin] file:join failed:",f)}},p=()=>{j(!0),a()},y=()=>{j(!1),w.current=!1},R=f=>{if(f?.fileId!==t)return;const G=l.getState().getKey(n,t),L=l.getState().entries[G];L?.isDirty||(E({projectId:n,fileId:t,content:String(f?.content??""),updatedAt:String(f?.updatedAt??""),sizeBytes:typeof f?.size=="number"?f.size:void 0,mimeType:L?.mimeType}),x(t,{updatedAt:String(f?.updatedAt??""),size:typeof f?.size=="number"?f.size:void 0}))};return e.on("connect",p),e.on("disconnect",y),e.on("file:content-updated",R),e.connected&&a(),()=>{try{e.off("connect",p),e.off("disconnect",y),e.off("file:content-updated",R),w.current&&e.emit("file:leave",{projectId:n,fileId:t})}finally{w.current=!1,j(!1),z.current=null,u()}}},[n,t,v]),c.useEffect(()=>{m(!!s?.isDirty)},[s?.isDirty,m]);const S=c.useCallback(async()=>{if(!n||!t||!s)return;try{const a=l.getState().getKey(n,t);l.setState(p=>{const y=p.entries[a];return y?{entries:{...p.entries,[a]:{...y,saveState:"saving",saveError:void 0}}}:p})}catch{}const e=z.current?.socket;if(!v&&e&&e.connected&&w.current)try{const a=await e.emitWithAck("file:update-content",{projectId:n,fileId:t,content:s.content});if("error"in a)throw new Error(a.error.message);E({projectId:n,fileId:t,content:s.content,updatedAt:a.data.updatedAt,sizeBytes:typeof a.data.size=="number"?a.data.size:s.sizeBytes,mimeType:s.mimeType}),v||x(t,{updatedAt:a.data.updatedAt,size:typeof a.data.size=="number"?a.data.size:void 0,mimeType:s.mimeType});return}catch(a){console.warn("[CodeEditorPlugin] realtime save failed, fallback to HTTP:",a)}const u=await A({projectId:n,fileId:t});!v&&u.updatedAt&&x(t,{updatedAt:u.updatedAt,size:u.sizeBytes,mimeType:u.mimeType})},[E,s,t,v,n,A,x]);ce(()=>{!n||!t||!s?.isDirty||s.saveState!=="saving"&&S()},[n,t,s?.content,s?.isDirty],650),c.useEffect(()=>{if(!n||!t)return;const e=u=>{(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="s"&&(u.preventDefault(),S())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,t,S]);const U=c.useMemo(()=>s?s.saveState==="saving"?"Saving…":s.saveState==="error"?s.saveError||"Save failed":s.isDirty?"Unsaved":"Saved":"",[s]),H=!!n&&!!t&&!!s&&!W,J=T==="json",V=async()=>{const e=F.current;if(e)try{await e.getAction("editor.action.formatDocument").run()}catch(u){console.warn("[CodeEditorPlugin] Format failed:",u)}},q=c.useCallback(async()=>{if(!n||!t||s?.isDirty&&!window.confirm("Discard unsaved changes and reload from server?"))return;const e=B.getState().findNode(t),u=e?.updatedAt??d?.updatedAt,a=e?.size??d?.sizeBytes,p=e?.mimeType??r.mimeType??d?.mimeType;try{await k({projectId:n,fileId:t,updatedAt:u,sizeBytes:a,mimeType:p,ignoreDirty:!0})}catch(y){console.warn("[CodeEditorPlugin] Reload failed:",y)}},[n,t,s?.isDirty,d?.updatedAt,d?.sizeBytes,d?.mimeType,r.mimeType,k]);return c.useEffect(()=>{b?.diff&&(!n||!t||b.changeType!=="delete"&&(s?.isDirty||k({projectId:n,fileId:t,mimeType:r.mimeType??d?.mimeType,sizeBytes:d?.sizeBytes,updatedAt:d?.updatedAt,ignoreDirty:!0})))},[b,s?.isDirty,n,t,r.mimeType,d?.mimeType,d?.sizeBytes,d?.updatedAt,k]),!n||!t?o.jsx("div",{className:"h-full flex items-center justify-center text-sm text-muted-foreground",children:"No file selected."}):o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/60 bg-white/60 backdrop-blur dark:bg-black/30",children:[o.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:g}),o.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded bg-black/[0.06] dark:bg-white/[0.08] text-muted-foreground uppercase",children:T})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:C("text-xs",s?.saveState==="error"?"text-red-600":"text-muted-foreground"),title:s?.saveError,children:[U,!v&&!O?" (offline)":""]}),o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]",!H&&"opacity-60 pointer-events-none"),onClick:()=>void S(),title:"Save (Ctrl/Cmd+S)",children:[s?.saveState==="saving"?o.jsx(M,{className:"h-3.5 w-3.5 animate-spin"}):o.jsx(X,{className:"h-3.5 w-3.5"}),"Save"]}),J?o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:V,title:"Format JSON",children:[o.jsx(Y,{className:"h-3.5 w-3.5"}),"Format"]}):null,o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:()=>void q(),title:"Reload from cache/server",children:[o.jsx(Z,{className:"h-3.5 w-3.5"}),"Reload"]})]})]}),o.jsxs("div",{className:"relative flex-1 min-h-0",children:[b?.diff?o.jsx(re,{diff:b.diff,changeType:b.changeType,title:"AI change",subtitle:g,onClose:K,className:"absolute right-4 top-4 z-10 w-[min(420px,46vw)]"}):null,W&&!s?o.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:o.jsx(M,{className:"h-6 w-6 animate-spin"})}):o.jsx(oe,{height:"100%",language:T,theme:I?"vs-dark":"vs",value:s?.content??"",beforeMount:e=>{try{e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!0,trailingCommas:"ignore"})}catch{}},onMount:e=>{F.current=e},onChange:e=>{_({projectId:n,fileId:t,content:e??""})},options:{automaticLayout:!0,minimap:{enabled:!1},fontFamily:'"Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,wordWrap:"off",scrollBeyondLastLine:!1,renderWhitespace:"selection",tabSize:2,insertSpaces:!0}})]})]})}export{be as default};
2
+ import{i as Q,f as B,j as o,b as C,L as M,S as X,B as Y,R as Z,g as $,_ as ee}from"./index-CBNVuWcP.js";import{R as c}from"./plugin-monaco-C8UgLomw.js";import{u as l,a as te}from"./file-content-BZMz3RYp.js";import{a as ne}from"./file-socket-CfQPKQKj.js";import{c as se}from"./monaco-CiHMMNH_.js";import{u as ie}from"./useFileDiffOverlay-FuhcnKiw.js";import{F as re}from"./file-diff-panel-CQhw0jS2.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const oe=$(()=>ee(()=>import("./plugin-monaco-C8UgLomw.js").then(r=>r.i),__vite__mapDeps([0,1])),{});se();function ae(r){const i=r.toLowerCase();return i.endsWith(".py")||i.endsWith(".pyw")||i.endsWith(".pyi")?"python":i.endsWith(".json")||i.endsWith(".jsonc")||i.endsWith(".json5")?"json":i.endsWith(".ts")||i.endsWith(".tsx")||i.endsWith(".mts")?"typescript":i.endsWith(".js")||i.endsWith(".jsx")||i.endsWith(".mjs")?"javascript":i.endsWith(".md")||i.endsWith(".markdown")?"markdown":i.endsWith(".yaml")||i.endsWith(".yml")?"yaml":i.endsWith(".html")||i.endsWith(".htm")?"html":i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")?"css":"plaintext"}function de(){const[r,i]=c.useState(()=>typeof document>"u"?!1:document.documentElement.classList.contains("dark"));return c.useEffect(()=>{const m=document.documentElement,h=new MutationObserver(()=>{i(m.classList.contains("dark"))});return h.observe(m,{attributes:!0,attributeFilter:["class"]}),()=>h.disconnect()},[]),r}function ce(r,i,m){c.useEffect(()=>{const h=window.setTimeout(r,m);return()=>window.clearTimeout(h)},[...i,m])}function be({context:r,tabId:i,setDirty:m,setTitle:h}){const n=r.customData?.projectId??void 0,d=r.customData?.fileMeta??void 0,t=r.resourceId,v=Q(t),P=r.resourcePath??void 0,g=r.resourceName||r.resourcePath||"Untitled",T=c.useMemo(()=>ae(g),[g]),I=de(),D=l(e=>e.ensureLoaded),k=l(e=>e.reload),A=l(e=>e.save),_=l(e=>e.setContent),E=l(e=>e.applyServerSnapshot),N=n&&t?l.getState().getKey(n,t):null,s=l(e=>N?e.entries[N]:void 0),W=te(n,t??void 0),x=B(e=>e.updateFileMeta),{diffEvent:b,clearDiff:K}=ie({fileId:t,filePath:P,projectId:n}),F=c.useRef(null),z=c.useRef(null),w=c.useRef(!1),[O,j]=c.useState(!1);c.useEffect(()=>{h(g)},[g,h]),c.useEffect(()=>{!n||!t||D({projectId:n,fileId:t,updatedAt:d?.updatedAt,mimeType:r.mimeType??d?.mimeType,sizeBytes:d?.sizeBytes}).catch(e=>{console.error("[CodeEditorPlugin] Failed to load file:",e)})},[n,t,D,d?.updatedAt,d?.mimeType,d?.sizeBytes,r.mimeType]),c.useEffect(()=>{if(!n||!t||v)return;const{socket:e,release:u}=ne();z.current={socket:e,release:u};const a=async()=>{if(!w.current&&e.connected)try{w.current=!0,await e.emitWithAck("file:join",{projectId:n,fileId:t,clientVersion:"1.0.0"}),j(!0)}catch(f){console.warn("[CodeEditorPlugin] file:join failed:",f)}},p=()=>{j(!0),a()},y=()=>{j(!1),w.current=!1},R=f=>{if(f?.fileId!==t)return;const G=l.getState().getKey(n,t),L=l.getState().entries[G];L?.isDirty||(E({projectId:n,fileId:t,content:String(f?.content??""),updatedAt:String(f?.updatedAt??""),sizeBytes:typeof f?.size=="number"?f.size:void 0,mimeType:L?.mimeType}),x(t,{updatedAt:String(f?.updatedAt??""),size:typeof f?.size=="number"?f.size:void 0}))};return e.on("connect",p),e.on("disconnect",y),e.on("file:content-updated",R),e.connected&&a(),()=>{try{e.off("connect",p),e.off("disconnect",y),e.off("file:content-updated",R),w.current&&e.emit("file:leave",{projectId:n,fileId:t})}finally{w.current=!1,j(!1),z.current=null,u()}}},[n,t,v]),c.useEffect(()=>{m(!!s?.isDirty)},[s?.isDirty,m]);const S=c.useCallback(async()=>{if(!n||!t||!s)return;try{const a=l.getState().getKey(n,t);l.setState(p=>{const y=p.entries[a];return y?{entries:{...p.entries,[a]:{...y,saveState:"saving",saveError:void 0}}}:p})}catch{}const e=z.current?.socket;if(!v&&e&&e.connected&&w.current)try{const a=await e.emitWithAck("file:update-content",{projectId:n,fileId:t,content:s.content});if("error"in a)throw new Error(a.error.message);E({projectId:n,fileId:t,content:s.content,updatedAt:a.data.updatedAt,sizeBytes:typeof a.data.size=="number"?a.data.size:s.sizeBytes,mimeType:s.mimeType}),v||x(t,{updatedAt:a.data.updatedAt,size:typeof a.data.size=="number"?a.data.size:void 0,mimeType:s.mimeType});return}catch(a){console.warn("[CodeEditorPlugin] realtime save failed, fallback to HTTP:",a)}const u=await A({projectId:n,fileId:t});!v&&u.updatedAt&&x(t,{updatedAt:u.updatedAt,size:u.sizeBytes,mimeType:u.mimeType})},[E,s,t,v,n,A,x]);ce(()=>{!n||!t||!s?.isDirty||s.saveState!=="saving"&&S()},[n,t,s?.content,s?.isDirty],650),c.useEffect(()=>{if(!n||!t)return;const e=u=>{(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="s"&&(u.preventDefault(),S())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,t,S]);const U=c.useMemo(()=>s?s.saveState==="saving"?"Saving…":s.saveState==="error"?s.saveError||"Save failed":s.isDirty?"Unsaved":"Saved":"",[s]),H=!!n&&!!t&&!!s&&!W,J=T==="json",V=async()=>{const e=F.current;if(e)try{await e.getAction("editor.action.formatDocument").run()}catch(u){console.warn("[CodeEditorPlugin] Format failed:",u)}},q=c.useCallback(async()=>{if(!n||!t||s?.isDirty&&!window.confirm("Discard unsaved changes and reload from server?"))return;const e=B.getState().findNode(t),u=e?.updatedAt??d?.updatedAt,a=e?.size??d?.sizeBytes,p=e?.mimeType??r.mimeType??d?.mimeType;try{await k({projectId:n,fileId:t,updatedAt:u,sizeBytes:a,mimeType:p,ignoreDirty:!0})}catch(y){console.warn("[CodeEditorPlugin] Reload failed:",y)}},[n,t,s?.isDirty,d?.updatedAt,d?.sizeBytes,d?.mimeType,r.mimeType,k]);return c.useEffect(()=>{b?.diff&&(!n||!t||b.changeType!=="delete"&&(s?.isDirty||k({projectId:n,fileId:t,mimeType:r.mimeType??d?.mimeType,sizeBytes:d?.sizeBytes,updatedAt:d?.updatedAt,ignoreDirty:!0})))},[b,s?.isDirty,n,t,r.mimeType,d?.mimeType,d?.sizeBytes,d?.updatedAt,k]),!n||!t?o.jsx("div",{className:"h-full flex items-center justify-center text-sm text-muted-foreground",children:"No file selected."}):o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/60 bg-white/60 backdrop-blur dark:bg-black/30",children:[o.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:g}),o.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded bg-black/[0.06] dark:bg-white/[0.08] text-muted-foreground uppercase",children:T})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:C("text-xs",s?.saveState==="error"?"text-red-600":"text-muted-foreground"),title:s?.saveError,children:[U,!v&&!O?" (offline)":""]}),o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]",!H&&"opacity-60 pointer-events-none"),onClick:()=>void S(),title:"Save (Ctrl/Cmd+S)",children:[s?.saveState==="saving"?o.jsx(M,{className:"h-3.5 w-3.5 animate-spin"}):o.jsx(X,{className:"h-3.5 w-3.5"}),"Save"]}),J?o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:V,title:"Format JSON",children:[o.jsx(Y,{className:"h-3.5 w-3.5"}),"Format"]}):null,o.jsxs("button",{type:"button",className:C("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:()=>void q(),title:"Reload from cache/server",children:[o.jsx(Z,{className:"h-3.5 w-3.5"}),"Reload"]})]})]}),o.jsxs("div",{className:"relative flex-1 min-h-0",children:[b?.diff?o.jsx(re,{diff:b.diff,changeType:b.changeType,title:"AI change",subtitle:g,onClose:K,className:"absolute right-4 top-4 z-10 w-[min(420px,46vw)]"}):null,W&&!s?o.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:o.jsx(M,{className:"h-6 w-6 animate-spin"})}):o.jsx(oe,{height:"100%",language:T,theme:I?"vs-dark":"vs",value:s?.content??"",beforeMount:e=>{try{e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!0,trailingCommas:"ignore"})}catch{}},onMount:e=>{F.current=e},onChange:e=>{_({projectId:n,fileId:t,content:e??""})},options:{automaticLayout:!0,minimap:{enabled:!1},fontFamily:'"Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,wordWrap:"off",scrollBeyondLastLine:!1,renderWhitespace:"selection",tabSize:2,insertSpaces:!0}})]})]})}export{be as default};
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Gbl53BNp.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-Cgla8biy.css"])))=>i.map(i=>d[i]);
2
- import{u as V,a as q,c as G,j as e,L as $,C as J,F as K,E as Q,b as S,d as Z,e as B,_ as X}from"./index-Gbl53BNp.js";import{r}from"./plugin-monaco-C8UgLomw.js";import{c as Y}from"./file-jump-queue-DA-SdG__.js";import{C as ee}from"./code-DLC6G24T.js";import{H as te,W as se}from"./wrap-text-CwMn-iqb.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const ne={".js":"javascript",".jsx":"javascript",".mjs":"javascript",".ts":"typescript",".tsx":"typescript",".mts":"typescript",".py":"python",".pyw":"python",".pyi":"python",".json":"json",".jsonc":"json",".json5":"json",".html":"html",".htm":"html",".css":"css",".scss":"scss",".sass":"sass",".less":"less",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".sh":"bash",".bash":"bash",".zsh":"zsh",".fish":"fish",".sql":"sql",".xml":"xml",".xsl":"xml",".xslt":"xml",".svg":"xml",".go":"go",".rs":"rust",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hxx":"cpp",".java":"java",".cs":"csharp",".php":"php",".rb":"ruby",".swift":"swift",".kt":"kotlin",".kts":"kotlin",".md":"markdown",".markdown":"markdown"};function re(c){const w=c.substring(c.lastIndexOf(".")).toLowerCase();return ne[w]||"plaintext"}function ae(c){return c==="html"}const U={javascript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","default","class","extends","new","this","super","import","export","from","as","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void"],typescript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","default","class","extends","new","this","super","import","export","from","as","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void","type","interface","enum","namespace","module","declare","abstract","implements","private","protected","public","readonly","static"],python:["def","class","if","elif","else","for","while","try","except","finally","with","as","import","from","return","yield","raise","pass","break","continue","and","or","not","in","is","lambda","True","False","None","global","nonlocal","assert","del"],go:["package","import","func","return","var","const","type","struct","interface","map","chan","go","defer","if","else","for","range","switch","case","default","break","continue","fallthrough","select","true","false","nil"],rust:["fn","let","mut","const","static","if","else","match","for","while","loop","break","continue","return","struct","enum","impl","trait","pub","mod","use","as","self","super","crate","async","await","move","ref","true","false","where"]};function ce(c,w){const z=c.split(`
3
- `),E=U[w]||U.javascript||[],o=new Set(E);return z.map(C=>{const s=[];let t=C;for(;t.length>0;){const _=t.match(/^"(?:[^"\\]|\\.)*"/);if(_){s.push({type:"string",value:_[0]}),t=t.slice(_[0].length);continue}const f=t.match(/^'(?:[^'\\]|\\.)*'/);if(f){s.push({type:"string",value:f[0]}),t=t.slice(f[0].length);continue}const y=t.match(/^`(?:[^`\\]|\\.)*`/);if(y){s.push({type:"string",value:y[0]}),t=t.slice(y[0].length);continue}const D=t.match(/^(\/\/.*|#.*)$/);if(D){s.push({type:"comment",value:D[0]}),t="";continue}const N=t.match(/^\/\*.*?\*\//);if(N){s.push({type:"comment",value:N[0]}),t=t.slice(N[0].length);continue}const v=t.match(/^-?\d+\.?\d*([eE][+-]?\d+)?/);if(v){s.push({type:"number",value:v[0]}),t=t.slice(v[0].length);continue}const b=t.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*/);if(b){const m=b[0],d=t[m.length];o.has(m)?s.push({type:"keyword",value:m}):d==="("?s.push({type:"function",value:m}):s.push({type:"default",value:m}),t=t.slice(m.length);continue}const k=t.match(/^[+\-*/%=<>!&|^~?:]+/);if(k){s.push({type:"operator",value:k[0]}),t=t.slice(k[0].length);continue}const g=t.match(/^[{}[\]();,.]/);if(g){s.push({type:"punctuation",value:g[0]}),t=t.slice(g[0].length);continue}s.push({type:"default",value:t[0]}),t=t.slice(1)}return s})}const oe={keyword:"text-purple-400",string:"text-green-400",comment:"text-gray-500 italic",number:"text-slate-200",function:"text-blue-400",operator:"text-pink-400",punctuation:"text-gray-400",default:"text-gray-100"};function fe({context:c,tabId:w,setDirty:z,setTitle:E}){const{t:o}=V("code_viewer"),C=q(a=>a.updateTabState),[s,t]=r.useState(""),[_,f]=r.useState(!0),[y,D]=r.useState(null),[N,v]=r.useState(!1),[b,k]=r.useState(!0),[g,m]=r.useState(!1),[d,L]=r.useState("source"),[T,A]=r.useState(null),j=r.useRef(null),p=c.resourceId,M=c.resourceName||c.resourcePath||"Untitled",x=r.useMemo(()=>re(c.resourcePath||""),[c.resourcePath]),u=r.useMemo(()=>ae(x)||String(c.mimeType||"").toLowerCase().includes("html"),[c.mimeType,x]);r.useEffect(()=>{L(u?"rendered":"source")},[p,u]),r.useEffect(()=>{E(M)},[M,E]),r.useEffect(()=>{C(w,{contentKind:u?"html":"code",documentMode:u?d:"source",isReadOnly:!0})},[u,w,C,d]),r.useEffect(()=>{(async()=>{f(!0),D(null);try{if(!c.resourceId){t(F[x]||F.javascript),f(!1);return}const{getFileContent:n}=await X(async()=>{const{getFileContent:l}=await import("./index-Gbl53BNp.js").then(i=>i.el);return{getFileContent:l}},__vite__mapDeps([0,1,2,3,4])),h=await n(c.resourceId);t(h)}catch(n){D(n instanceof Error?n.message:o("load_failed"))}finally{f(!1)}})()},[c.resourceId,x,o]);const P=r.useMemo(()=>ce(s,x),[s,x]),H=r.useCallback(async()=>{await G(s)&&(v(!0),setTimeout(()=>v(!1),2e3))},[s]),R=P.length,I=r.useCallback(a=>{if(!p||a.fileId!==p)return;const n=a.lineStart??a.line??a.lineEnd;if(!n)return;const h=a.lineEnd??a.line??a.lineStart??n,l=Math.max(1,R),i=Math.min(Math.max(n,1),l),W=Math.min(Math.max(h,i),l);A({start:i,end:W});const O=document.getElementById(`code-line-${i-1}`);O&&O.scrollIntoView({behavior:"smooth",block:"center"}),j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A(null)},2500)},[p,R]);return r.useEffect(()=>{if(!p)return;const a=()=>{Y(p).forEach(i=>I(i.data))};a();const n=l=>{const i=l.detail;I(i)},h=l=>{const i=l.detail;!i||i.fileId!==p||a()};return window.addEventListener("ds:file:jump",n),window.addEventListener("ds:file:queue",h),()=>{window.removeEventListener("ds:file:jump",n),window.removeEventListener("ds:file:queue",h),j.current&&(window.clearTimeout(j.current),j.current=null)}},[I,p]),_?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx($,{className:"w-8 h-8 animate-spin"}),e.jsx("span",{children:o("loading")})]})}):y?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-destructive",children:[e.jsx(J,{className:"w-8 h-8"}),e.jsx("span",{children:y}),e.jsx("button",{className:"px-4 py-2 text-sm bg-destructive/10 hover:bg-destructive/20 rounded-lg transition-colors",onClick:()=>window.location.reload(),children:o("retry")})]})}):e.jsxs("div",{className:"flex flex-col h-full bg-[#1e1e1e] text-gray-100",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[#333] bg-[#252526]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(K,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-300",children:M}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-[#333] text-gray-400 uppercase",children:u?"HTML":x}),e.jsx("span",{className:"text-xs text-gray-500",children:o("line_count",{count:R})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[u?e.jsxs("div",{className:"mr-2 flex items-center rounded-md border border-[#3a3a3a] bg-[#202021] p-0.5",children:[e.jsx("button",{onClick:()=>L("rendered"),className:S("rounded px-2 py-1 text-xs transition-colors",d==="rendered"?"bg-[#3A4653] text-white":"text-gray-400 hover:text-gray-200"),title:o("rendered_view"),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Q,{className:"h-3.5 w-3.5"}),o("rendered_view_short")]})}),e.jsx("button",{onClick:()=>L("source"),className:S("rounded px-2 py-1 text-xs transition-colors",d==="source"?"bg-[#3A4653] text-white":"text-gray-400 hover:text-gray-200"),title:o("source_view"),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),o("source_view_short")]})})]}):null,!u||d==="source"?e.jsx("button",{onClick:()=>k(!b),className:S("p-2 rounded hover:bg-[#333] transition-colors",b?"text-blue-400":"text-gray-500"),title:o("toggle_line_numbers"),children:e.jsx(te,{className:"w-4 h-4"})}):null,!u||d==="source"?e.jsx("button",{onClick:()=>m(!g),className:S("p-2 rounded hover:bg-[#333] transition-colors",g?"text-blue-400":"text-gray-500"),title:o("toggle_word_wrap"),children:e.jsx(se,{className:"w-4 h-4"})}):null,e.jsx("button",{onClick:H,className:"p-2 rounded hover:bg-[#333] transition-colors text-gray-400 hover:text-gray-200",title:o("copy_source"),children:N?e.jsx(Z,{className:"w-4 h-4 text-green-400"}):e.jsx(B,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:u&&d==="rendered"?e.jsxs("div",{className:"flex h-full flex-col bg-[#1c1c1d]",children:[e.jsx("div",{className:"border-b border-[#2f2f30] px-4 py-2 text-xs text-gray-400",children:o("html_render_hint")}),e.jsx("div",{className:"flex-1 p-3",children:e.jsx("div",{className:"h-full overflow-hidden rounded-xl border border-white/10 bg-white shadow-[0_24px_60px_-36px_rgba(0,0,0,0.55)]",children:e.jsx("iframe",{title:o("html_render_frame_title",{name:M}),srcDoc:s,sandbox:"",className:"h-full w-full bg-white"})})})]}):e.jsxs("div",{className:"flex min-h-full",children:[b&&e.jsx("div",{className:"flex-shrink-0 py-4 pr-4 text-right bg-[#1e1e1e] border-r border-[#333] select-none sticky left-0",children:P.map((a,n)=>e.jsx("div",{className:"px-4 text-xs leading-6 text-gray-500 font-mono",children:n+1},n))}),e.jsx("pre",{className:S("flex-1 py-4 px-4 font-mono text-sm leading-6 overflow-x-auto",g&&"whitespace-pre-wrap break-all"),children:e.jsx("code",{children:P.map((a,n)=>{const h=T&&n+1>=T.start&&n+1<=T.end;return e.jsx("div",{id:`code-line-${n}`,className:S("min-h-[1.5rem]",h&&"ds-citation-line-highlight"),children:a.length===0?e.jsx("span",{children:" "}):a.map((l,i)=>e.jsx("span",{className:oe[l.type],children:l.value},i))},n)})})})]})})]})}const F={javascript:`// DeepScientist - Example JavaScript Code
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBNVuWcP.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-BpV6lusQ.css"])))=>i.map(i=>d[i]);
2
+ import{u as V,a as q,c as G,j as e,L as $,C as J,F as K,E as Q,b as S,d as Z,e as B,_ as X}from"./index-CBNVuWcP.js";import{r}from"./plugin-monaco-C8UgLomw.js";import{c as Y}from"./file-jump-queue-DA-SdG__.js";import{C as ee}from"./code-WlFHE7z_.js";import{H as te,W as se}from"./wrap-text-BC-Hltpd.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const ne={".js":"javascript",".jsx":"javascript",".mjs":"javascript",".ts":"typescript",".tsx":"typescript",".mts":"typescript",".py":"python",".pyw":"python",".pyi":"python",".json":"json",".jsonc":"json",".json5":"json",".html":"html",".htm":"html",".css":"css",".scss":"scss",".sass":"sass",".less":"less",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".sh":"bash",".bash":"bash",".zsh":"zsh",".fish":"fish",".sql":"sql",".xml":"xml",".xsl":"xml",".xslt":"xml",".svg":"xml",".go":"go",".rs":"rust",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hxx":"cpp",".java":"java",".cs":"csharp",".php":"php",".rb":"ruby",".swift":"swift",".kt":"kotlin",".kts":"kotlin",".md":"markdown",".markdown":"markdown"};function re(c){const w=c.substring(c.lastIndexOf(".")).toLowerCase();return ne[w]||"plaintext"}function ae(c){return c==="html"}const U={javascript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","default","class","extends","new","this","super","import","export","from","as","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void"],typescript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","default","class","extends","new","this","super","import","export","from","as","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void","type","interface","enum","namespace","module","declare","abstract","implements","private","protected","public","readonly","static"],python:["def","class","if","elif","else","for","while","try","except","finally","with","as","import","from","return","yield","raise","pass","break","continue","and","or","not","in","is","lambda","True","False","None","global","nonlocal","assert","del"],go:["package","import","func","return","var","const","type","struct","interface","map","chan","go","defer","if","else","for","range","switch","case","default","break","continue","fallthrough","select","true","false","nil"],rust:["fn","let","mut","const","static","if","else","match","for","while","loop","break","continue","return","struct","enum","impl","trait","pub","mod","use","as","self","super","crate","async","await","move","ref","true","false","where"]};function ce(c,w){const z=c.split(`
3
+ `),E=U[w]||U.javascript||[],o=new Set(E);return z.map(C=>{const s=[];let t=C;for(;t.length>0;){const _=t.match(/^"(?:[^"\\]|\\.)*"/);if(_){s.push({type:"string",value:_[0]}),t=t.slice(_[0].length);continue}const f=t.match(/^'(?:[^'\\]|\\.)*'/);if(f){s.push({type:"string",value:f[0]}),t=t.slice(f[0].length);continue}const y=t.match(/^`(?:[^`\\]|\\.)*`/);if(y){s.push({type:"string",value:y[0]}),t=t.slice(y[0].length);continue}const D=t.match(/^(\/\/.*|#.*)$/);if(D){s.push({type:"comment",value:D[0]}),t="";continue}const N=t.match(/^\/\*.*?\*\//);if(N){s.push({type:"comment",value:N[0]}),t=t.slice(N[0].length);continue}const v=t.match(/^-?\d+\.?\d*([eE][+-]?\d+)?/);if(v){s.push({type:"number",value:v[0]}),t=t.slice(v[0].length);continue}const b=t.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*/);if(b){const m=b[0],d=t[m.length];o.has(m)?s.push({type:"keyword",value:m}):d==="("?s.push({type:"function",value:m}):s.push({type:"default",value:m}),t=t.slice(m.length);continue}const k=t.match(/^[+\-*/%=<>!&|^~?:]+/);if(k){s.push({type:"operator",value:k[0]}),t=t.slice(k[0].length);continue}const g=t.match(/^[{}[\]();,.]/);if(g){s.push({type:"punctuation",value:g[0]}),t=t.slice(g[0].length);continue}s.push({type:"default",value:t[0]}),t=t.slice(1)}return s})}const oe={keyword:"text-purple-400",string:"text-green-400",comment:"text-gray-500 italic",number:"text-slate-200",function:"text-blue-400",operator:"text-pink-400",punctuation:"text-gray-400",default:"text-gray-100"};function fe({context:c,tabId:w,setDirty:z,setTitle:E}){const{t:o}=V("code_viewer"),C=q(a=>a.updateTabState),[s,t]=r.useState(""),[_,f]=r.useState(!0),[y,D]=r.useState(null),[N,v]=r.useState(!1),[b,k]=r.useState(!0),[g,m]=r.useState(!1),[d,L]=r.useState("source"),[T,A]=r.useState(null),j=r.useRef(null),p=c.resourceId,M=c.resourceName||c.resourcePath||"Untitled",x=r.useMemo(()=>re(c.resourcePath||""),[c.resourcePath]),u=r.useMemo(()=>ae(x)||String(c.mimeType||"").toLowerCase().includes("html"),[c.mimeType,x]);r.useEffect(()=>{L(u?"rendered":"source")},[p,u]),r.useEffect(()=>{E(M)},[M,E]),r.useEffect(()=>{C(w,{contentKind:u?"html":"code",documentMode:u?d:"source",isReadOnly:!0})},[u,w,C,d]),r.useEffect(()=>{(async()=>{f(!0),D(null);try{if(!c.resourceId){t(F[x]||F.javascript),f(!1);return}const{getFileContent:n}=await X(async()=>{const{getFileContent:l}=await import("./index-CBNVuWcP.js").then(i=>i.em);return{getFileContent:l}},__vite__mapDeps([0,1,2,3,4])),h=await n(c.resourceId);t(h)}catch(n){D(n instanceof Error?n.message:o("load_failed"))}finally{f(!1)}})()},[c.resourceId,x,o]);const P=r.useMemo(()=>ce(s,x),[s,x]),H=r.useCallback(async()=>{await G(s)&&(v(!0),setTimeout(()=>v(!1),2e3))},[s]),R=P.length,I=r.useCallback(a=>{if(!p||a.fileId!==p)return;const n=a.lineStart??a.line??a.lineEnd;if(!n)return;const h=a.lineEnd??a.line??a.lineStart??n,l=Math.max(1,R),i=Math.min(Math.max(n,1),l),W=Math.min(Math.max(h,i),l);A({start:i,end:W});const O=document.getElementById(`code-line-${i-1}`);O&&O.scrollIntoView({behavior:"smooth",block:"center"}),j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A(null)},2500)},[p,R]);return r.useEffect(()=>{if(!p)return;const a=()=>{Y(p).forEach(i=>I(i.data))};a();const n=l=>{const i=l.detail;I(i)},h=l=>{const i=l.detail;!i||i.fileId!==p||a()};return window.addEventListener("ds:file:jump",n),window.addEventListener("ds:file:queue",h),()=>{window.removeEventListener("ds:file:jump",n),window.removeEventListener("ds:file:queue",h),j.current&&(window.clearTimeout(j.current),j.current=null)}},[I,p]),_?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx($,{className:"w-8 h-8 animate-spin"}),e.jsx("span",{children:o("loading")})]})}):y?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-destructive",children:[e.jsx(J,{className:"w-8 h-8"}),e.jsx("span",{children:y}),e.jsx("button",{className:"px-4 py-2 text-sm bg-destructive/10 hover:bg-destructive/20 rounded-lg transition-colors",onClick:()=>window.location.reload(),children:o("retry")})]})}):e.jsxs("div",{className:"flex flex-col h-full bg-[#1e1e1e] text-gray-100",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[#333] bg-[#252526]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(K,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-300",children:M}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-[#333] text-gray-400 uppercase",children:u?"HTML":x}),e.jsx("span",{className:"text-xs text-gray-500",children:o("line_count",{count:R})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[u?e.jsxs("div",{className:"mr-2 flex items-center rounded-md border border-[#3a3a3a] bg-[#202021] p-0.5",children:[e.jsx("button",{onClick:()=>L("rendered"),className:S("rounded px-2 py-1 text-xs transition-colors",d==="rendered"?"bg-[#3A4653] text-white":"text-gray-400 hover:text-gray-200"),title:o("rendered_view"),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Q,{className:"h-3.5 w-3.5"}),o("rendered_view_short")]})}),e.jsx("button",{onClick:()=>L("source"),className:S("rounded px-2 py-1 text-xs transition-colors",d==="source"?"bg-[#3A4653] text-white":"text-gray-400 hover:text-gray-200"),title:o("source_view"),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),o("source_view_short")]})})]}):null,!u||d==="source"?e.jsx("button",{onClick:()=>k(!b),className:S("p-2 rounded hover:bg-[#333] transition-colors",b?"text-blue-400":"text-gray-500"),title:o("toggle_line_numbers"),children:e.jsx(te,{className:"w-4 h-4"})}):null,!u||d==="source"?e.jsx("button",{onClick:()=>m(!g),className:S("p-2 rounded hover:bg-[#333] transition-colors",g?"text-blue-400":"text-gray-500"),title:o("toggle_word_wrap"),children:e.jsx(se,{className:"w-4 h-4"})}):null,e.jsx("button",{onClick:H,className:"p-2 rounded hover:bg-[#333] transition-colors text-gray-400 hover:text-gray-200",title:o("copy_source"),children:N?e.jsx(Z,{className:"w-4 h-4 text-green-400"}):e.jsx(B,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:u&&d==="rendered"?e.jsxs("div",{className:"flex h-full flex-col bg-[#1c1c1d]",children:[e.jsx("div",{className:"border-b border-[#2f2f30] px-4 py-2 text-xs text-gray-400",children:o("html_render_hint")}),e.jsx("div",{className:"flex-1 p-3",children:e.jsx("div",{className:"h-full overflow-hidden rounded-xl border border-white/10 bg-white shadow-[0_24px_60px_-36px_rgba(0,0,0,0.55)]",children:e.jsx("iframe",{title:o("html_render_frame_title",{name:M}),srcDoc:s,sandbox:"",className:"h-full w-full bg-white"})})})]}):e.jsxs("div",{className:"flex min-h-full",children:[b&&e.jsx("div",{className:"flex-shrink-0 py-4 pr-4 text-right bg-[#1e1e1e] border-r border-[#333] select-none sticky left-0",children:P.map((a,n)=>e.jsx("div",{className:"px-4 text-xs leading-6 text-gray-500 font-mono",children:n+1},n))}),e.jsx("pre",{className:S("flex-1 py-4 px-4 font-mono text-sm leading-6 overflow-x-auto",g&&"whitespace-pre-wrap break-all"),children:e.jsx("code",{children:P.map((a,n)=>{const h=T&&n+1>=T.start&&n+1<=T.end;return e.jsx("div",{id:`code-line-${n}`,className:S("min-h-[1.5rem]",h&&"ds-citation-line-highlight"),children:a.length===0?e.jsx("span",{children:" "}):a.map((l,i)=>e.jsx("span",{className:oe[l.type],children:l.value},i))},n)})})})]})})]})}const F={javascript:`// DeepScientist - Example JavaScript Code
4
4
  import { useState, useEffect } from 'react';
5
5
 
6
6
  /**
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Gbl53BNp.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-Cgla8biy.css"])))=>i.map(i=>d[i]);
2
- import{y as k,u as v,j as e,L as P,b as m,T as I,a3 as E,_ as C,ab as j,h as g}from"./index-Gbl53BNp.js";import{r as l}from"./plugin-monaco-C8UgLomw.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBNVuWcP.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-BpV6lusQ.css"])))=>i.map(i=>d[i]);
2
+ import{y as k,u as v,j as e,L as P,b as m,T as I,a3 as E,_ as C,ab as j,h as g}from"./index-CBNVuWcP.js";import{r as n}from"./plugin-monaco-C8UgLomw.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
3
3
  * @license lucide-react v0.511.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const F=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],_=k("presentation",F),O={docx:{icon:"W",color:"bg-blue-600",labelKey:"word_document"},doc:{icon:"W",color:"bg-blue-600",labelKey:"word_document"},xlsx:{icon:"X",color:"bg-green-600",labelKey:"excel_spreadsheet"},xls:{icon:"X",color:"bg-green-600",labelKey:"excel_spreadsheet"},pptx:{icon:"P",color:"bg-primary",labelKey:"powerpoint_presentation"},ppt:{icon:"P",color:"bg-primary",labelKey:"powerpoint_presentation"},odt:{icon:"OD",color:"bg-blue-500",labelKey:"open_document_text"},ods:{icon:"OD",color:"bg-green-500",labelKey:"open_document_spreadsheet"},odp:{icon:"OD",color:"bg-primary",labelKey:"open_document_presentation"}};function T({src:o,fileName:n,fileType:N,onError:c,onDownload:a,className:w}){const{t}=v("doc_viewer"),[r,i]=l.useState(!0),[d,p]=l.useState(!1),u=O[N.toLowerCase()]||{icon:"?",color:"bg-gray-600",labelKey:"document"},f=l.useCallback(()=>{i(!1)},[]),b=l.useCallback(()=>{i(!1),p(!0),c?.(t("preview_load_failed"))},[c,t]),h=o?(x=>null)(o):null,y=l.useCallback(()=>{if(a){a();return}if(!o)return;const x=document.createElement("a");x.href=o,x.download=n,x.click()},[a,o,n]);return h&&!d?e.jsxs("div",{className:m("relative w-full h-full",w),children:[r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(P,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("preview_loading")})]})}),e.jsx("iframe",{src:h,className:"w-full h-full border-0",onLoad:f,onError:b,title:n,sandbox:"allow-scripts allow-same-origin allow-popups"})]}):e.jsxs("div",{className:m("flex flex-col items-center justify-center h-full text-center p-8",w),children:[e.jsx("div",{className:m("w-24 h-24 rounded-lg flex items-center justify-center text-4xl font-bold text-white mb-6",u.color),children:u.icon}),e.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:n}),e.jsx("p",{className:"text-muted-foreground mb-6",children:t(u.labelKey)}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400 mb-6",children:[e.jsx(I,{className:"w-4 h-4"}),e.jsx("span",{children:t("preview_unavailable")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:y,className:"flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(E,{className:"w-4 h-4"}),t("download")]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-8 max-w-md",children:t("help_text")})]})}const K={docx:{type:"word",icon:g,label:"Word Document",color:"text-blue-500"},doc:{type:"word",icon:g,label:"Word Document",color:"text-blue-500"},xlsx:{type:"excel",icon:j,label:"Excel Spreadsheet",color:"text-green-500"},xls:{type:"excel",icon:j,label:"Excel Spreadsheet",color:"text-green-500"},pptx:{type:"powerpoint",icon:_,label:"PowerPoint",color:"text-primary"},ppt:{type:"powerpoint",icon:_,label:"PowerPoint",color:"text-primary"},odt:{type:"opendocument",icon:g,label:"OpenDocument Text",color:"text-blue-400"},ods:{type:"opendocument",icon:j,label:"OpenDocument Spreadsheet",color:"text-green-400"},odp:{type:"opendocument",icon:_,label:"OpenDocument Presentation",color:"text-primary"}},S={type:"unknown",icon:g,label:"Document",color:"text-muted-foreground"};function D(o){return o.split(".").pop()?.toLowerCase()||""}function L(o){const n=D(o);return K[n]||S}function B(o){return o?o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`:""}function W({context:o,tabId:n,setDirty:N,setTitle:c}){const{t:a}=v("doc_viewer"),[w,t]=l.useState(null),r=o.resourceName||o.resourcePath||"Document",i=D(r),d=l.useMemo(()=>L(r),[r]),p=o.customData?.size;l.useEffect(()=>{c(r)},[r,c]),l.useEffect(()=>{t(null)},[o.resourceId]);const u=l.useCallback(s=>{t(s)},[]),f=l.useCallback(()=>{o.resourceId&&(async()=>{try{const{downloadFileById:s}=await C(async()=>{const{downloadFileById:h}=await import("./index-Gbl53BNp.js").then(y=>y.el);return{downloadFileById:h}},__vite__mapDeps([0,1,2,3,4]));await s(o.resourceId,r)}catch(s){console.error("Failed to download document:",s),t("Failed to download document")}})()},[o.resourceId,r]),b=d.icon;return e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(b,{className:m("w-4 h-4",d.color)}),e.jsx("span",{className:"text-sm text-foreground",children:r}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:i}),p&&e.jsx("span",{className:"text-xs text-muted-foreground",children:B(p)})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{onClick:f,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:a("download_document"),children:e.jsx(E,{className:"w-4 h-4"})})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:o.resourceId?e.jsx(T,{src:"",fileName:r,fileType:i,onError:u,onDownload:f}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[e.jsx(b,{className:m("w-16 h-16 mb-4",d.color)}),e.jsx("h2",{className:"text-lg font-medium text-foreground mb-2",children:"No document selected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a document file to view it here"})]})})]})}export{W as default};
7
+ */const F=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],_=k("presentation",F),O={docx:{icon:"W",color:"bg-blue-600",labelKey:"word_document"},doc:{icon:"W",color:"bg-blue-600",labelKey:"word_document"},xlsx:{icon:"X",color:"bg-green-600",labelKey:"excel_spreadsheet"},xls:{icon:"X",color:"bg-green-600",labelKey:"excel_spreadsheet"},pptx:{icon:"P",color:"bg-primary",labelKey:"powerpoint_presentation"},ppt:{icon:"P",color:"bg-primary",labelKey:"powerpoint_presentation"},odt:{icon:"OD",color:"bg-blue-500",labelKey:"open_document_text"},ods:{icon:"OD",color:"bg-green-500",labelKey:"open_document_spreadsheet"},odp:{icon:"OD",color:"bg-primary",labelKey:"open_document_presentation"}};function T({src:o,fileName:l,fileType:N,onError:c,onDownload:a,className:w}){const{t}=v("doc_viewer"),[r,i]=n.useState(!0),[d,p]=n.useState(!1),u=O[N.toLowerCase()]||{icon:"?",color:"bg-gray-600",labelKey:"document"},f=n.useCallback(()=>{i(!1)},[]),b=n.useCallback(()=>{i(!1),p(!0),c?.(t("preview_load_failed"))},[c,t]),h=o?(x=>null)(o):null,y=n.useCallback(()=>{if(a){a();return}if(!o)return;const x=document.createElement("a");x.href=o,x.download=l,x.click()},[a,o,l]);return h&&!d?e.jsxs("div",{className:m("relative w-full h-full",w),children:[r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(P,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t("preview_loading")})]})}),e.jsx("iframe",{src:h,className:"w-full h-full border-0",onLoad:f,onError:b,title:l,sandbox:"allow-scripts allow-same-origin allow-popups"})]}):e.jsxs("div",{className:m("flex flex-col items-center justify-center h-full text-center p-8",w),children:[e.jsx("div",{className:m("w-24 h-24 rounded-lg flex items-center justify-center text-4xl font-bold text-white mb-6",u.color),children:u.icon}),e.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:l}),e.jsx("p",{className:"text-muted-foreground mb-6",children:t(u.labelKey)}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400 mb-6",children:[e.jsx(I,{className:"w-4 h-4"}),e.jsx("span",{children:t("preview_unavailable")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:y,className:"flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(E,{className:"w-4 h-4"}),t("download")]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-8 max-w-md",children:t("help_text")})]})}const K={docx:{type:"word",icon:g,label:"Word Document",color:"text-blue-500"},doc:{type:"word",icon:g,label:"Word Document",color:"text-blue-500"},xlsx:{type:"excel",icon:j,label:"Excel Spreadsheet",color:"text-green-500"},xls:{type:"excel",icon:j,label:"Excel Spreadsheet",color:"text-green-500"},pptx:{type:"powerpoint",icon:_,label:"PowerPoint",color:"text-primary"},ppt:{type:"powerpoint",icon:_,label:"PowerPoint",color:"text-primary"},odt:{type:"opendocument",icon:g,label:"OpenDocument Text",color:"text-blue-400"},ods:{type:"opendocument",icon:j,label:"OpenDocument Spreadsheet",color:"text-green-400"},odp:{type:"opendocument",icon:_,label:"OpenDocument Presentation",color:"text-primary"}},S={type:"unknown",icon:g,label:"Document",color:"text-muted-foreground"};function D(o){return o.split(".").pop()?.toLowerCase()||""}function L(o){const l=D(o);return K[l]||S}function B(o){return o?o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`:""}function W({context:o,tabId:l,setDirty:N,setTitle:c}){const{t:a}=v("doc_viewer"),[w,t]=n.useState(null),r=o.resourceName||o.resourcePath||"Document",i=D(r),d=n.useMemo(()=>L(r),[r]),p=o.customData?.size;n.useEffect(()=>{c(r)},[r,c]),n.useEffect(()=>{t(null)},[o.resourceId]);const u=n.useCallback(s=>{t(s)},[]),f=n.useCallback(()=>{o.resourceId&&(async()=>{try{const{downloadFileById:s}=await C(async()=>{const{downloadFileById:h}=await import("./index-CBNVuWcP.js").then(y=>y.em);return{downloadFileById:h}},__vite__mapDeps([0,1,2,3,4]));await s(o.resourceId,r)}catch(s){console.error("Failed to download document:",s),t("Failed to download document")}})()},[o.resourceId,r]),b=d.icon;return e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(b,{className:m("w-4 h-4",d.color)}),e.jsx("span",{className:"text-sm text-foreground",children:r}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:i}),p&&e.jsx("span",{className:"text-xs text-muted-foreground",children:B(p)})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{onClick:f,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:a("download_document"),children:e.jsx(E,{className:"w-4 h-4"})})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:o.resourceId?e.jsx(T,{src:"",fileName:r,fileType:i,onError:u,onDownload:f}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[e.jsx(b,{className:m("w-16 h-16 mb-4",d.color)}),e.jsx("h2",{className:"text-lg font-medium text-foreground mb-2",children:"No document selected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a document file to view it here"})]})})]})}export{W as default};
@@ -1 +1 @@
1
- import{u as _,a as F,H as b,j as e,b as x,J as C,R as S,h as E,K as g}from"./index-Gbl53BNp.js";import{r as n}from"./plugin-monaco-C8UgLomw.js";import{f as G,G as M,a as q}from"./GitSnapshotViewer-B_RQm1YZ.js";import{G as D}from"./git-commit-horizontal-BUh6G52n.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const w=m=>typeof m!="string"?null:m.trim()||null;function R({context:m,tabId:u,setTitle:j}){const{t:l}=_("workspace"),h=m.customData??{},k=F(a=>a.updateTabState),d=w(h.projectId),r=w(h.sha),[s,p]=n.useState(w(h.initialPath)),[o,v]=n.useState(h.initialMode==="snapshot"?"snapshot":"diff"),t=b({queryKey:["git-commit-viewer","commit",d,r],queryFn:()=>g.gitCommit(d,r),enabled:!!(d&&r),staleTime:3e4});n.useEffect(()=>{const a=t.data?.files||[];if(!a.length){s&&p(null);return}s&&a.some(y=>y.path===s)||p(a[0].path)},[t.data?.files,s]);const c=b({queryKey:["git-commit-viewer","diff",d,r,s],queryFn:()=>g.gitCommitFile(d,r,s),enabled:!!(d&&r&&s&&o==="diff"),staleTime:3e4}),i=b({queryKey:["git-commit-viewer","snapshot",d,r,s],queryFn:()=>g.openDocument(d,`git::${r}::${s}`),enabled:!!(d&&r&&s&&o==="snapshot"),staleTime:3e4}),N=n.useMemo(()=>t.data?.files?.find(a=>a.path===s)||null,[t.data?.files,s]),f=n.useMemo(()=>G(s||i.data?.path||void 0,N?.old_path||null,l("git_viewer_diff",void 0,"Diff")),[N?.old_path,s,i.data?.path,l]);return n.useEffect(()=>{const a=t.data?.subject||t.data?.short_sha||r||l("git_viewer_diff",void 0,"Commit");j(a)},[t.data?.short_sha,t.data?.subject,j,r,l]),n.useEffect(()=>{k(u,{contentKind:o==="snapshot"?"text":"code",documentMode:o,isReadOnly:!0,resourceName:f,resourcePath:s||void 0})},[f,s,u,k,o]),!d||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-sm text-muted-foreground",children:l("git_viewer_missing_context",void 0,"Missing diff context.")}):e.jsxs("div",{"data-testid":"git-commit-viewer-plugin",className:"flex h-full min-h-0 flex-col bg-[rgba(250,248,244,0.86)] dark:bg-[rgba(18,20,24,0.92)]",children:[e.jsx("div",{className:"border-b border-black/[0.06] px-6 py-5 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Commit"]}),t.data?.short_sha?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:t.data.short_sha})]}):null]}),e.jsx("div",{className:"mt-2 break-words text-[24px] font-semibold tracking-[-0.03em] text-foreground",children:t.data?.subject||r}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[t.data?.author_name?e.jsx("span",{children:t.data.author_name}):null,t.data?.authored_at?e.jsx("span",{children:t.data.authored_at}):null,typeof t.data?.file_count=="number"?e.jsxs("span",{children:[t.data.file_count," files"]}):null,typeof t.data?.stats?.added=="number"?e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",t.data.stats.added]}):null,typeof t.data?.stats?.removed=="number"?e.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",t.data.stats.removed]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"flex items-center rounded-full border border-black/[0.08] bg-white/[0.86] p-1 dark:border-white/[0.1] dark:bg-white/[0.03]",children:[e.jsx("button",{type:"button",onClick:()=>v("snapshot"),className:x("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",o==="snapshot"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:"Snapshot"}),e.jsx("button",{type:"button",onClick:()=>v("diff"),className:x("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",o==="diff"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:"Diff"})]}),e.jsxs(C,{type:"button",size:"sm",variant:"outline",onClick:()=>{t.refetch(),c.refetch(),i.refetch()},className:"h-9 rounded-full border-black/[0.08] bg-white/[0.86] px-3 text-[12px] shadow-none hover:bg-black/[0.03] dark:border-white/[0.1] dark:bg-white/[0.03] dark:hover:bg-white/[0.06]",children:[e.jsx(S,{className:x("mr-1.5 h-3.5 w-3.5",(t.isFetching||c.isFetching||i.isFetching)&&"animate-spin")}),l("explorer_refresh")]})]})]})}),e.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[280px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"border-r border-black/[0.06] bg-white/[0.46] p-4 dark:border-white/[0.08] dark:bg-white/[0.02]",children:[e.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Changed Files"}),e.jsx("div",{className:"space-y-2",children:(t.data?.files||[]).map(a=>e.jsxs("button",{type:"button",onClick:()=>p(a.path),className:x("w-full rounded-[18px] border px-3 py-3 text-left transition",s===a.path?"border-black/[0.12] bg-white shadow-sm dark:border-white/[0.12] dark:bg-white/[0.04]":"border-black/[0.06] bg-white/[0.72] hover:border-black/[0.1] dark:border-white/[0.08] dark:bg-white/[0.02]"),children:[e.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:a.path}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:a.status||"modified"}),typeof a.added=="number"?e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",a.added]}):null,typeof a.removed=="number"?e.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",a.removed]}):null]})]},a.path))})]}),e.jsxs("div",{className:"min-h-0 overflow-hidden px-6 py-6",children:[s?o==="snapshot"?i.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:"Loading snapshot…"}):i.isError?e.jsx("div",{className:"rounded-[20px] border border-rose-200/80 bg-rose-50/70 px-4 py-4 text-sm text-rose-700 dark:border-rose-400/20 dark:bg-rose-500/10 dark:text-rose-200",children:"Failed to load snapshot."}):e.jsx(M,{document:i.data,className:"border border-black/[0.06] bg-white/[0.92] shadow-none dark:border-white/[0.08] dark:bg-[rgba(24,26,31,0.92)]"}):c.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:"Loading patch…"}):c.isError?e.jsx("div",{className:"rounded-[20px] border border-rose-200/80 bg-rose-50/70 px-4 py-4 text-sm text-rose-700 dark:border-rose-400/20 dark:bg-rose-500/10 dark:text-rose-200",children:"Failed to load diff."}):e.jsx(q,{diff:c.data,pathLabel:f,className:"border border-black/[0.06] bg-white/[0.92] shadow-none dark:border-white/[0.08] dark:bg-[rgba(24,26,31,0.92)]"}):e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Select one changed file to inspect this commit."}),t.data?.body?e.jsxs("div",{className:"mt-5 rounded-[20px] border border-black/[0.06] bg-white/[0.68] px-4 py-4 text-sm leading-7 text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.03]",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),"Body"]}),e.jsx("div",{className:"whitespace-pre-wrap",children:t.data.body})]}):null]})]})]})}export{R as default};
1
+ import{u as _,a as F,H as b,j as e,b as x,J as C,R as S,h as E,K as g}from"./index-CBNVuWcP.js";import{r as n}from"./plugin-monaco-C8UgLomw.js";import{f as G,G as M,a as q}from"./GitSnapshotViewer-0r4nLPke.js";import{G as D}from"./git-commit-horizontal-DxZ8DCZh.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";const w=m=>typeof m!="string"?null:m.trim()||null;function R({context:m,tabId:u,setTitle:j}){const{t:l}=_("workspace"),h=m.customData??{},k=F(a=>a.updateTabState),d=w(h.projectId),r=w(h.sha),[s,p]=n.useState(w(h.initialPath)),[o,v]=n.useState(h.initialMode==="snapshot"?"snapshot":"diff"),t=b({queryKey:["git-commit-viewer","commit",d,r],queryFn:()=>g.gitCommit(d,r),enabled:!!(d&&r),staleTime:3e4});n.useEffect(()=>{const a=t.data?.files||[];if(!a.length){s&&p(null);return}s&&a.some(y=>y.path===s)||p(a[0].path)},[t.data?.files,s]);const c=b({queryKey:["git-commit-viewer","diff",d,r,s],queryFn:()=>g.gitCommitFile(d,r,s),enabled:!!(d&&r&&s&&o==="diff"),staleTime:3e4}),i=b({queryKey:["git-commit-viewer","snapshot",d,r,s],queryFn:()=>g.openDocument(d,`git::${r}::${s}`),enabled:!!(d&&r&&s&&o==="snapshot"),staleTime:3e4}),N=n.useMemo(()=>t.data?.files?.find(a=>a.path===s)||null,[t.data?.files,s]),f=n.useMemo(()=>G(s||i.data?.path||void 0,N?.old_path||null,l("git_viewer_diff",void 0,"Diff")),[N?.old_path,s,i.data?.path,l]);return n.useEffect(()=>{const a=t.data?.subject||t.data?.short_sha||r||l("git_viewer_diff",void 0,"Commit");j(a)},[t.data?.short_sha,t.data?.subject,j,r,l]),n.useEffect(()=>{k(u,{contentKind:o==="snapshot"?"text":"code",documentMode:o,isReadOnly:!0,resourceName:f,resourcePath:s||void 0})},[f,s,u,k,o]),!d||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-sm text-muted-foreground",children:l("git_viewer_missing_context",void 0,"Missing diff context.")}):e.jsxs("div",{"data-testid":"git-commit-viewer-plugin",className:"flex h-full min-h-0 flex-col bg-[rgba(250,248,244,0.86)] dark:bg-[rgba(18,20,24,0.92)]",children:[e.jsx("div",{className:"border-b border-black/[0.06] px-6 py-5 dark:border-white/[0.08]",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Commit"]}),t.data?.short_sha?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:t.data.short_sha})]}):null]}),e.jsx("div",{className:"mt-2 break-words text-[24px] font-semibold tracking-[-0.03em] text-foreground",children:t.data?.subject||r}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[t.data?.author_name?e.jsx("span",{children:t.data.author_name}):null,t.data?.authored_at?e.jsx("span",{children:t.data.authored_at}):null,typeof t.data?.file_count=="number"?e.jsxs("span",{children:[t.data.file_count," files"]}):null,typeof t.data?.stats?.added=="number"?e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",t.data.stats.added]}):null,typeof t.data?.stats?.removed=="number"?e.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",t.data.stats.removed]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"flex items-center rounded-full border border-black/[0.08] bg-white/[0.86] p-1 dark:border-white/[0.1] dark:bg-white/[0.03]",children:[e.jsx("button",{type:"button",onClick:()=>v("snapshot"),className:x("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",o==="snapshot"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:"Snapshot"}),e.jsx("button",{type:"button",onClick:()=>v("diff"),className:x("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",o==="diff"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:"Diff"})]}),e.jsxs(C,{type:"button",size:"sm",variant:"outline",onClick:()=>{t.refetch(),c.refetch(),i.refetch()},className:"h-9 rounded-full border-black/[0.08] bg-white/[0.86] px-3 text-[12px] shadow-none hover:bg-black/[0.03] dark:border-white/[0.1] dark:bg-white/[0.03] dark:hover:bg-white/[0.06]",children:[e.jsx(S,{className:x("mr-1.5 h-3.5 w-3.5",(t.isFetching||c.isFetching||i.isFetching)&&"animate-spin")}),l("explorer_refresh")]})]})]})}),e.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[280px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"border-r border-black/[0.06] bg-white/[0.46] p-4 dark:border-white/[0.08] dark:bg-white/[0.02]",children:[e.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Changed Files"}),e.jsx("div",{className:"space-y-2",children:(t.data?.files||[]).map(a=>e.jsxs("button",{type:"button",onClick:()=>p(a.path),className:x("w-full rounded-[18px] border px-3 py-3 text-left transition",s===a.path?"border-black/[0.12] bg-white shadow-sm dark:border-white/[0.12] dark:bg-white/[0.04]":"border-black/[0.06] bg-white/[0.72] hover:border-black/[0.1] dark:border-white/[0.08] dark:bg-white/[0.02]"),children:[e.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:a.path}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:a.status||"modified"}),typeof a.added=="number"?e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",a.added]}):null,typeof a.removed=="number"?e.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",a.removed]}):null]})]},a.path))})]}),e.jsxs("div",{className:"min-h-0 overflow-hidden px-6 py-6",children:[s?o==="snapshot"?i.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:"Loading snapshot…"}):i.isError?e.jsx("div",{className:"rounded-[20px] border border-rose-200/80 bg-rose-50/70 px-4 py-4 text-sm text-rose-700 dark:border-rose-400/20 dark:bg-rose-500/10 dark:text-rose-200",children:"Failed to load snapshot."}):e.jsx(M,{document:i.data,className:"border border-black/[0.06] bg-white/[0.92] shadow-none dark:border-white/[0.08] dark:bg-[rgba(24,26,31,0.92)]"}):c.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:"Loading patch…"}):c.isError?e.jsx("div",{className:"rounded-[20px] border border-rose-200/80 bg-rose-50/70 px-4 py-4 text-sm text-rose-700 dark:border-rose-400/20 dark:bg-rose-500/10 dark:text-rose-200",children:"Failed to load diff."}):e.jsx(q,{diff:c.data,pathLabel:f,className:"border border-black/[0.06] bg-white/[0.92] shadow-none dark:border-white/[0.08] dark:bg-[rgba(24,26,31,0.92)]"}):e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Select one changed file to inspect this commit."}),t.data?.body?e.jsxs("div",{className:"mt-5 rounded-[20px] border border-black/[0.06] bg-white/[0.68] px-4 py-4 text-sm leading-7 text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.03]",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),"Body"]}),e.jsx("div",{className:"whitespace-pre-wrap",children:t.data.body})]}):null]})]})]})}export{R as default};
@@ -1,4 +1,4 @@
1
- import{y as ne,u as de,a as A,H as J,j as e,h as le,b as L,J as ce,R as he,a7 as fe,U as pe,K as G}from"./index-Gbl53BNp.js";import{r as p}from"./plugin-monaco-C8UgLomw.js";import me from"./ImageViewerPlugin-tHqlXY3n.js";import ue from"./MarkdownViewerPlugin-DG28-61B.js";import{N as xe}from"./NotebookEditor-C-4Kt1p9.js";import ge from"./PdfViewerPlugin-DcOzU9vd.js";import{i as ve,b as Z,f as be,a as we,G as U}from"./GitSnapshotViewer-B_RQm1YZ.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";import"./image-B9HUUddG.js";import"./zoom-out-R-GWEhzS.js";import"./code-DLC6G24T.js";import"./NotebookEditor-CVsj8h_T.js";import"./project-sync-CsX08Qno.js";import"./index-wQ7RIIRd.js";import"./popover-DL6h35vr.js";import"./trash-xA7kFt8i.js";import"./sigma-7jpXazui.js";import"./useFileDiffOverlay-FuhcnKiw.js";import"./file-diff-panel-Denq-lC3.js";import"./file-socket-Cu4Qln7Y.js";import"./pdf-effect-queue-ZtnHFCAi.js";import"./PdfLoader-CASDQmxJ.js";import"./plugin-pdf-CR8hgQBV.js";import"./chevron-up-Dq5ofbht.js";/**
1
+ import{y as ne,u as de,a as A,H as J,j as e,h as le,b as L,J as ce,R as he,a7 as fe,U as pe,K as G}from"./index-CBNVuWcP.js";import{r as p}from"./plugin-monaco-C8UgLomw.js";import me from"./ImageViewerPlugin-nBOmI2v_.js";import ue from"./MarkdownViewerPlugin-DKqVfKyW.js";import{N as xe}from"./NotebookEditor-BEQhaQbt.js";import ge from"./PdfViewerPlugin-c-RK9DLM.js";import{i as ve,b as Z,f as be,a as we,G as U}from"./GitSnapshotViewer-0r4nLPke.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";import"./image-Bgl4VIyx.js";import"./zoom-out-E_gaeAxL.js";import"./code-WlFHE7z_.js";import"./NotebookEditor-DB9N_T9q.js";import"./project-sync-C9IdzdZW.js";import"./index-CwNu1aH4.js";import"./popover-CLc0pPP8.js";import"./trash-DwpbFr3w.js";import"./sigma-ClKcHAXm.js";import"./useFileDiffOverlay-FuhcnKiw.js";import"./file-diff-panel-CQhw0jS2.js";import"./file-socket-CfQPKQKj.js";import"./pdf-effect-queue-J8OnM0jE.js";import"./PdfLoader-eWBONbQP.js";import"./plugin-pdf-CR8hgQBV.js";import"./chevron-up-C9Qpx4DE.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{aj as Br,s as We,ak as Fr,al as Rr,j as g,u as Xn,b as Ce}from"./index-Gbl53BNp.js";import{r as E}from"./plugin-monaco-C8UgLomw.js";function Jn(e){const r=String(e||"").trim();if(!r)return"";const n=r.split("/").filter(Boolean);return n[n.length-1]||r}function Lr(e){const r=Jn(e?.path),n=String(e?.mime_type||"").trim();return(n?Fr(n):void 0)||(r?Rr(r):void 0)||null}function is(e){const r=Lr(e),n=Jn(e?.path).toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")||n.endsWith(".mdx")?"markdown":r===We.PDF_VIEWER?"pdf":r===We.IMAGE_VIEWER?"image":r===We.NOTEBOOK?"notebook":"plain"}function ss(e){return Br({mimeType:e?.mime_type,resourceName:e?.path,resourcePath:e?.path})||"file"}function Ur(e,r,n="Diff"){return e&&r&&e!==r?`${r} → ${e}`:e||n}function _n(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,t)}return n}function D(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_n(Object(n),!0).forEach(function(t){Ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_n(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e,r,n){return(r=function(t){var a=function(i,s){if(typeof i!="object"||i===null)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}(t,"string");return typeof a=="symbol"?a:String(a)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(e,r){if(e==null)return{};var n,t,a=function(s,o){if(s==null)return{};var u,l,c={},f=Object.keys(s);for(l=0;l<f.length;l++)u=f[l],o.indexOf(u)>=0||(c[u]=s[u]);return c}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function T(e,r){return Qn(e)||function(n,t){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var i,s,o,u,l=[],c=!0,f=!1;try{if(o=(a=a.call(n)).next,t===0){if(Object(a)!==a)return;c=!1}else for(;!(c=(i=o.call(a)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(h){f=!0,s=h}finally{try{if(!c&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(f)throw s}}return l}}(e,r)||De(e,r)||qn()}function Zn(e){return Qn(e)||Yn(e)||De(e)||qn()}function G(e){return function(r){if(Array.isArray(r))return Qe(r)}(e)||Yn(e)||De(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{aj as Br,s as We,ak as Fr,al as Rr,j as g,u as Xn,b as Ce}from"./index-CBNVuWcP.js";import{r as E}from"./plugin-monaco-C8UgLomw.js";function Jn(e){const r=String(e||"").trim();if(!r)return"";const n=r.split("/").filter(Boolean);return n[n.length-1]||r}function Lr(e){const r=Jn(e?.path),n=String(e?.mime_type||"").trim();return(n?Fr(n):void 0)||(r?Rr(r):void 0)||null}function is(e){const r=Lr(e),n=Jn(e?.path).toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")||n.endsWith(".mdx")?"markdown":r===We.PDF_VIEWER?"pdf":r===We.IMAGE_VIEWER?"image":r===We.NOTEBOOK?"notebook":"plain"}function ss(e){return Br({mimeType:e?.mime_type,resourceName:e?.path,resourcePath:e?.path})||"file"}function Ur(e,r,n="Diff"){return e&&r&&e!==r?`${r} → ${e}`:e||n}function _n(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,t)}return n}function D(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_n(Object(n),!0).forEach(function(t){Ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_n(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e,r,n){return(r=function(t){var a=function(i,s){if(typeof i!="object"||i===null)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var u=o.call(i,s);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(i)}(t,"string");return typeof a=="symbol"?a:String(a)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(e,r){if(e==null)return{};var n,t,a=function(s,o){if(s==null)return{};var u,l,c={},f=Object.keys(s);for(l=0;l<f.length;l++)u=f[l],o.indexOf(u)>=0||(c[u]=s[u]);return c}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function T(e,r){return Qn(e)||function(n,t){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var i,s,o,u,l=[],c=!0,f=!1;try{if(o=(a=a.call(n)).next,t===0){if(Object(a)!==a)return;c=!1}else for(;!(c=(i=o.call(a)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(h){f=!0,s=h}finally{try{if(!c&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(f)throw s}}return l}}(e,r)||De(e,r)||qn()}function Zn(e){return Qn(e)||Yn(e)||De(e)||qn()}function G(e){return function(r){if(Array.isArray(r))return Qe(r)}(e)||Yn(e)||De(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Qn(e){if(Array.isArray(e))return e}function Yn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function De(e,r){if(e){if(typeof e=="string")return Qe(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qe(e,r):void 0}}function Qe(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function qn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function an(e,r){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=De(e))||r){n&&(e=n);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,i=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw i}}}}var _e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ve(e,r){return e(r={exports:{}},r.exports),r.exports}var $=ve(function(e){/*!
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Gbl53BNp.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-Cgla8biy.css"])))=>i.map(i=>d[i]);
2
- import{y as O,j as e,b as z,am as Z,an as B,a3 as V,L as q,_ as G}from"./index-Gbl53BNp.js";import{r as t}from"./plugin-monaco-C8UgLomw.js";import{I as F}from"./image-B9HUUddG.js";import{Z as K,a as J}from"./zoom-out-R-GWEhzS.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBNVuWcP.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-BpV6lusQ.css"])))=>i.map(i=>d[i]);
2
+ import{y as O,j as e,b as z,am as Z,an as B,a3 as V,L as q,_ as G}from"./index-CBNVuWcP.js";import{r as t}from"./plugin-monaco-C8UgLomw.js";import{I as F}from"./image-Bgl4VIyx.js";import{Z as K,a as J}from"./zoom-out-E_gaeAxL.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
3
3
  * @license lucide-react v0.511.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -18,7 +18,7 @@ import{y as O,j as e,b as z,am as Z,an as B,a3 as V,L as q,_ as G}from"./index-G
18
18
  translate(${s.translateX}px, ${s.translateY}px)
19
19
  scale(${s.scale})
20
20
  rotate(${f}deg)
21
- `;return e.jsxs("div",{ref:m,className:z("relative w-full h-full overflow-hidden select-none",c?"cursor-grabbing":"cursor-grab",C),onWheel:L,onMouseDown:_,onMouseMove:U,onMouseUp:M,onMouseLeave:M,onTouchStart:S,onTouchMove:n,onTouchEnd:g,onDoubleClick:T,children:[v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("img",{ref:u,src:r,alt:E,className:z("max-w-none transition-transform duration-100",v&&"opacity-0"),style:{transform:y,transformOrigin:"center center"},onLoad:k,onError:i,draggable:!1})}),e.jsxs("div",{className:"absolute bottom-4 left-4 px-2 py-1 bg-background/80 backdrop-blur rounded text-xs text-muted-foreground",children:[Math.round(s.scale*100),"%"]})]})}const oe="https://via.placeholder.com/1920x1080?text=DeepScientist+Image+Viewer";function le(r){return r?r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`:"Unknown"}function W(r){return(r.split(".").pop()?.toLowerCase()||"").toUpperCase()}function he({context:r,tabId:E,setDirty:w,setTitle:N}){const[f,C]=t.useState(""),[v,x]=t.useState(!0),[s,l]=t.useState(null),[c,p]=t.useState(null),[d,j]=t.useState(0),[m,u]=t.useState(!1),k=t.useRef(null),i=r.resourceName||r.resourcePath||"Image";t.useEffect(()=>{N(i)},[i,N]),t.useEffect(()=>{let n=!1,g=null;return x(!0),l(null),r.resourceId?((async()=>{try{const{createFileObjectUrl:y}=await G(async()=>{const{createFileObjectUrl:a}=await import("./index-Gbl53BNp.js").then(o=>o.el);return{createFileObjectUrl:a}},__vite__mapDeps([0,1,2,3,4]));if(g=await y(r.resourceId),n){URL.revokeObjectURL(g);return}C(g)}catch(y){console.error("Failed to get image URL:",y),l("Failed to load image"),x(!1)}})(),()=>{n=!0,g&&URL.revokeObjectURL(g)}):(C(oe),()=>{n=!0})},[r.resourceId]);const I=t.useCallback(n=>{x(!1),p(n)},[]),L=t.useCallback(()=>{x(!1),l("Failed to load image")},[]),_=t.useCallback(()=>{j(n=>(n-90)%360)},[]),U=t.useCallback(()=>{j(n=>(n+90)%360)},[]);t.useCallback(()=>{j(0)},[]);const M=t.useCallback(()=>{if(!f)return;const n=document.createElement("a");n.href=f,n.download=i,n.click()},[f,i]),S=r.customData?.size;return s&&!v?e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsx("div",{className:"flex items-center px-4 py-2 border-b border-border bg-muted/30",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:i})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx(ee,{className:"w-16 h-16 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-foreground",children:"Failed to load image"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s})]}),e.jsx("button",{className:"px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",onClick:()=>window.location.reload(),children:"Retry"})]})})]}):e.jsxs("div",{className:"flex flex-col h-full bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-background",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:i}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:W(i)}),c&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.naturalWidth," x ",c.naturalHeight]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>k.current?.zoomOut?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Zoom out",children:e.jsx(K,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>k.current?.resetTransform?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Reset zoom (double-click image)",children:e.jsx(ae,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>k.current?.zoomIn?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Zoom in",children:e.jsx(J,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx("button",{onClick:_,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Rotate left",children:e.jsx(Z,{className:"w-4 h-4"})}),e.jsx("button",{onClick:U,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Rotate right",children:e.jsx(re,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx("button",{onClick:()=>u(!m),className:z("p-2 rounded transition-colors",m?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground hover:text-foreground"),title:"Image info",children:e.jsx(B,{className:"w-4 h-4"})}),e.jsx("button",{onClick:M,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Download image",children:e.jsx(V,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 relative overflow-hidden bg-[#1a1a1a]",children:[e.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:`
21
+ `;return e.jsxs("div",{ref:m,className:z("relative w-full h-full overflow-hidden select-none",c?"cursor-grabbing":"cursor-grab",C),onWheel:L,onMouseDown:_,onMouseMove:U,onMouseUp:M,onMouseLeave:M,onTouchStart:S,onTouchMove:n,onTouchEnd:g,onDoubleClick:T,children:[v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("img",{ref:u,src:r,alt:E,className:z("max-w-none transition-transform duration-100",v&&"opacity-0"),style:{transform:y,transformOrigin:"center center"},onLoad:k,onError:i,draggable:!1})}),e.jsxs("div",{className:"absolute bottom-4 left-4 px-2 py-1 bg-background/80 backdrop-blur rounded text-xs text-muted-foreground",children:[Math.round(s.scale*100),"%"]})]})}const oe="https://via.placeholder.com/1920x1080?text=DeepScientist+Image+Viewer";function le(r){return r?r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`:"Unknown"}function W(r){return(r.split(".").pop()?.toLowerCase()||"").toUpperCase()}function he({context:r,tabId:E,setDirty:w,setTitle:N}){const[f,C]=t.useState(""),[v,x]=t.useState(!0),[s,l]=t.useState(null),[c,p]=t.useState(null),[d,j]=t.useState(0),[m,u]=t.useState(!1),k=t.useRef(null),i=r.resourceName||r.resourcePath||"Image";t.useEffect(()=>{N(i)},[i,N]),t.useEffect(()=>{let n=!1,g=null;return x(!0),l(null),r.resourceId?((async()=>{try{const{createFileObjectUrl:y}=await G(async()=>{const{createFileObjectUrl:a}=await import("./index-CBNVuWcP.js").then(o=>o.em);return{createFileObjectUrl:a}},__vite__mapDeps([0,1,2,3,4]));if(g=await y(r.resourceId),n){URL.revokeObjectURL(g);return}C(g)}catch(y){console.error("Failed to get image URL:",y),l("Failed to load image"),x(!1)}})(),()=>{n=!0,g&&URL.revokeObjectURL(g)}):(C(oe),()=>{n=!0})},[r.resourceId]);const I=t.useCallback(n=>{x(!1),p(n)},[]),L=t.useCallback(()=>{x(!1),l("Failed to load image")},[]),_=t.useCallback(()=>{j(n=>(n-90)%360)},[]),U=t.useCallback(()=>{j(n=>(n+90)%360)},[]);t.useCallback(()=>{j(0)},[]);const M=t.useCallback(()=>{if(!f)return;const n=document.createElement("a");n.href=f,n.download=i,n.click()},[f,i]),S=r.customData?.size;return s&&!v?e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsx("div",{className:"flex items-center px-4 py-2 border-b border-border bg-muted/30",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:i})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx(ee,{className:"w-16 h-16 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-foreground",children:"Failed to load image"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s})]}),e.jsx("button",{className:"px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",onClick:()=>window.location.reload(),children:"Retry"})]})})]}):e.jsxs("div",{className:"flex flex-col h-full bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-background",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:i}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:W(i)}),c&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.naturalWidth," x ",c.naturalHeight]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>k.current?.zoomOut?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Zoom out",children:e.jsx(K,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>k.current?.resetTransform?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Reset zoom (double-click image)",children:e.jsx(ae,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>k.current?.zoomIn?.(),className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Zoom in",children:e.jsx(J,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx("button",{onClick:_,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Rotate left",children:e.jsx(Z,{className:"w-4 h-4"})}),e.jsx("button",{onClick:U,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Rotate right",children:e.jsx(re,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx("button",{onClick:()=>u(!m),className:z("p-2 rounded transition-colors",m?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground hover:text-foreground"),title:"Image info",children:e.jsx(B,{className:"w-4 h-4"})}),e.jsx("button",{onClick:M,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:"Download image",children:e.jsx(V,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 relative overflow-hidden bg-[#1a1a1a]",children:[e.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:`
22
22
  linear-gradient(45deg, #808080 25%, transparent 25%),
23
23
  linear-gradient(-45deg, #808080 25%, transparent 25%),
24
24
  linear-gradient(45deg, transparent 75%, #808080 75%),
@@ -1,4 +1,4 @@
1
- import{y as qt,aP as Ft,j as s,aQ as St,n as Ct,u as Pt,ao as H,aR as He,aS as We,aT as zt,aU as vt,aV as ns,aW as yt,aX as Ve,at as Ce,au as at,aY as is,aZ as xt,J as _t,a_ as wt,av as Dt,d as $t,b as Me,x as Bt,a$ as Ht,b0 as dt,b1 as Wt,L as Vt,b2 as os,b3 as rs,b4 as as,b5 as ls,b6 as cs,k as us,b7 as ds,b8 as ms,b9 as fs,ba as hs,bb as ps,bc as gs,bd as bs}from"./index-Gbl53BNp.js";import{r}from"./plugin-monaco-C8UgLomw.js";import{r as Ye}from"./plugin-notebook-HbW2K-1c.js";import{P as xs,a as vs,b as ys}from"./popover-DL6h35vr.js";import{S as _s,a as ws,b as Ss,c as Cs,d as Ms}from"./select-DvmXt1yY.js";import{A as js,D as Es,C as ks,a as Mt,u as Ns,b as Qt,r as Ls}from"./AiManusChatView-COFACy7V.js";import"./plugin-terminal-MXFIPun8.js";import"./chevron-up-Dq5ofbht.js";import"./file-content-Dv4LoZec.js";import"./file-jump-queue-DA-SdG__.js";import"./pdf-effect-queue-ZtnHFCAi.js";import"./file-diff-panel-Denq-lC3.js";import"./bot-CFkZY-JP.js";import"./git-commit-horizontal-BUh6G52n.js";import"./NotebookEditor-CVsj8h_T.js";import"./trash-xA7kFt8i.js";/**
1
+ import{y as qt,aP as Ft,j as s,aQ as St,n as Ct,u as Pt,ao as H,aR as He,aS as We,aT as zt,aU as vt,aV as ns,aW as yt,aX as Ve,at as Ce,au as at,aY as is,aZ as xt,J as _t,a_ as wt,av as Dt,d as $t,b as Me,x as Bt,a$ as Ht,b0 as dt,b1 as Wt,L as Vt,b2 as os,b3 as rs,b4 as as,b5 as ls,b6 as cs,k as us,b7 as ds,b8 as ms,b9 as fs,ba as hs,bb as ps,bc as gs,bd as bs}from"./index-CBNVuWcP.js";import{r}from"./plugin-monaco-C8UgLomw.js";import{r as Ye}from"./plugin-notebook-HbW2K-1c.js";import{P as xs,a as vs,b as ys}from"./popover-CLc0pPP8.js";import{S as _s,a as ws,b as Ss,c as Cs,d as Ms}from"./select-Cs2PmzwL.js";import{A as js,D as Es,C as ks,a as Mt,u as Ns,b as Qt,r as Ls}from"./AiManusChatView-Bv-Z8YpU.js";import"./plugin-terminal-MXFIPun8.js";import"./chevron-up-C9Qpx4DE.js";import"./file-content-BZMz3RYp.js";import"./file-jump-queue-DA-SdG__.js";import"./pdf-effect-queue-J8OnM0jE.js";import"./file-diff-panel-CQhw0jS2.js";import"./bot-DREQOxzP.js";import"./git-commit-horizontal-DxZ8DCZh.js";import"./NotebookEditor-DB9N_T9q.js";import"./trash-DwpbFr3w.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{y as kt,H as le,j as e,be as ue,bf as ie,K as xt,bg as Jt,u as ke,at as He,aX as rt,a_ as Ye,aU as pt,bh as gt,bi as Zt,bj as It,bk as ea,bl as ta,b as ne,bm as We,bn as Xe,bo as Mt,bp as Bt,bq as Rt,br as Dt,aw as Ve,l as aa,aQ as ut,ao as Ue,aR as yt,bs as sa,J as Fe,R as Oe,bt as wt,bu as na,b1 as ia,O as at,bv as _t,bw as Nt,bx as ra,by as la,bz as oa,bA as ca,bB as ua,bC as da,bD as ma,bE as st,bF as va,s as ba,bG as ha,ap as fa,aq as xa,bH as pa,bI as ga,bJ as ya}from"./index-Gbl53BNp.js";import{r as i}from"./plugin-monaco-C8UgLomw.js";import{B as nt}from"./bot-CFkZY-JP.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
1
+ import{y as kt,H as le,j as e,be as ue,bf as ie,K as xt,bg as Jt,u as ke,at as He,aX as rt,a_ as Ye,aU as pt,bh as gt,bi as Zt,bj as It,bk as ea,bl as ta,b as ne,bm as We,bn as Xe,bo as Mt,bp as Bt,bq as Rt,br as Dt,aw as Ve,l as aa,aQ as ut,ao as Ue,aR as yt,bs as sa,J as Fe,R as Oe,bt as wt,bu as na,b1 as ia,O as at,bv as _t,bw as Nt,bx as ra,by as la,bz as oa,bA as ca,bB as ua,bC as da,bD as ma,bE as st,bF as va,s as ba,bG as ha,ap as fa,aq as xa,bH as pa,bI as ga,bJ as ya}from"./index-CBNVuWcP.js";import{r as i}from"./plugin-monaco-C8UgLomw.js";import{B as nt}from"./bot-DREQOxzP.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js"])))=>i.map(i=>d[i]);
2
- import{y as ur,x as fr,u as mr,a as nt,f as br,t as hr,U as st,V as xr,K as gr,W as pr,Y as Ee,_ as lt,Z as wr,$ as vr,a0 as kr,j as n,b as F,h as yr,a1 as _r,L as ge,S as Nr,a2 as jr,T as Et,a3 as Sr,a4 as Lr,a5 as Cr,a6 as Ar,g as Ir}from"./index-Gbl53BNp.js";import{r as s}from"./plugin-monaco-C8UgLomw.js";import{P as Rr}from"./project-sync-CsX08Qno.js";import{c as Er}from"./monaco-CiHMMNH_.js";import{P as ot,a as Fr,b as Pr,c as Mr,Z as D,d as Br}from"./PdfLoader-CASDQmxJ.js";import{Z as $r,a as Tr}from"./zoom-out-R-GWEhzS.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";import"./plugin-pdf-CR8hgQBV.js";/**
2
+ import{y as ur,x as fr,u as mr,a as nt,f as br,t as hr,U as st,V as xr,K as gr,W as pr,Y as Ee,_ as lt,Z as wr,$ as vr,a0 as kr,j as n,b as F,h as yr,a1 as _r,L as ge,S as Nr,a2 as jr,T as Et,a3 as Sr,a4 as Lr,a5 as Cr,a6 as Ar,g as Ir}from"./index-CBNVuWcP.js";import{r as s}from"./plugin-monaco-C8UgLomw.js";import{P as Rr}from"./project-sync-C9IdzdZW.js";import{c as Er}from"./monaco-CiHMMNH_.js";import{P as ot,a as Fr,b as Pr,c as Mr,Z as D,d as Br}from"./PdfLoader-eWBONbQP.js";import{Z as $r,a as Tr}from"./zoom-out-E_gaeAxL.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";import"./plugin-pdf-CR8hgQBV.js";/**
3
3
  * @license lucide-react v0.511.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Gbl53BNp.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-Cgla8biy.css"])))=>i.map(i=>d[i]);
2
- import{u as E,a as F,a8 as I,c as $,j as e,L as T,C as L,a9 as R,h as P,E as H,b as k,d as O,e as W,M as A,_ as V}from"./index-Gbl53BNp.js";import{r as n,R as G}from"./plugin-monaco-C8UgLomw.js";import{C as q}from"./code-DLC6G24T.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";function B(t){return t?/\.mdx$/i.test(t.trim()):!1}function K(t){if(!t.startsWith("---"))return t;const i=t.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);return i?t.slice(i[0].length):t}function U(t,i={}){if(!i.isMdx)return t;const l=K(t).split(/\r?\n/),r=[];let a=!1,c=!1;for(const s of l){const o=s.trim();if(/^(```|~~~)/.test(o)){a=!a,c=!0,r.push(s);continue}if(a){r.push(s);continue}if(!c){if(!o||/^(import|export)\s/.test(o)||/^\{\/\*.*\*\/\}$/.test(o))continue;c=!0}/^\{\/\*.*\*\/\}$/.test(o)||r.push(s)}return r.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBNVuWcP.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-BpV6lusQ.css"])))=>i.map(i=>d[i]);
2
+ import{u as E,a as F,a8 as I,c as $,j as e,L as T,C as L,a9 as R,h as P,E as H,b as k,d as O,e as W,M as A,_ as V}from"./index-CBNVuWcP.js";import{r as n,R as G}from"./plugin-monaco-C8UgLomw.js";import{C as q}from"./code-WlFHE7z_.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";function B(t){return t?/\.mdx$/i.test(t.trim()):!1}function K(t){if(!t.startsWith("---"))return t;const i=t.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);return i?t.slice(i[0].length):t}function U(t,i={}){if(!i.isMdx)return t;const l=K(t).split(/\r?\n/),r=[];let a=!1,c=!1;for(const s of l){const o=s.trim();if(/^(```|~~~)/.test(o)){a=!a,c=!0,r.push(s);continue}if(a){r.push(s);continue}if(!c){if(!o||/^(import|export)\s/.test(o)||/^\{\/\*.*\*\/\}$/.test(o))continue;c=!0}/^\{\/\*.*\*\/\}$/.test(o)||r.push(s)}return r.join(`
3
3
  `)}const z=`# DeepScientist Markdown Viewer
4
4
 
5
5
  Welcome to the **Markdown Viewer** plugin. This viewer supports [GitHub Flavored Markdown](https://github.github.com/gfm/) with additional features.
@@ -125,4 +125,4 @@ $$
125
125
  4. 使用复制按钮复制源内容
126
126
 
127
127
  祝你写作顺利!:rocket:
128
- `;function te({context:t,tabId:i,setDirty:y,setTitle:l}){const{t:r,language:a}=E("markdown_viewer"),c=F(f=>f.updateTabState),[s,o]=n.useState(""),[j,x]=n.useState(!0),[h,g]=n.useState(null),[M,w]=n.useState(!1),[d,b]=n.useState("rendered"),u=t.resourceName||t.resourcePath||"Untitled.md",m=B(u),v=U(s,{isMdx:m}),N=G.useMemo(()=>I(t.resourceId),[t.resourceId]);n.useEffect(()=>{l(u)},[u,l]),n.useEffect(()=>{c(i,{contentKind:m?"mdx":"markdown",documentMode:d,isReadOnly:!0})},[m,i,c,d]),n.useEffect(()=>{(async()=>{x(!0),g(null);try{if(!t.resourceId){o(a==="zh-CN"?Q:z),x(!1);return}const{getFileContent:p}=await V(async()=>{const{getFileContent:S}=await import("./index-Gbl53BNp.js").then(_=>_.el);return{getFileContent:S}},__vite__mapDeps([0,1,2,3,4])),D=await p(t.resourceId);o(D)}catch(p){g(p instanceof Error?p.message:r("load_failed"))}finally{x(!1)}})()},[t.resourceId,a,r]);const C=n.useCallback(async()=>{await $(s)&&(w(!0),setTimeout(()=>w(!1),2e3))},[s]);return j?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(T,{className:"w-8 h-8 animate-spin"}),e.jsx("span",{children:r("loading")})]})}):h?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-destructive",children:[e.jsx(L,{className:"w-8 h-8"}),e.jsx("span",{children:h}),e.jsx("button",{className:"px-4 py-2 text-sm bg-destructive/10 hover:bg-destructive/20 rounded-lg transition-colors",onClick:()=>window.location.reload(),children:r("retry")})]})}):e.jsxs("div",{className:"flex flex-col h-full bg-background text-foreground",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:R}}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(P,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:u}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:m?"MDX":"Markdown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"flex items-center border border-border rounded-md mr-2",children:[e.jsx("button",{onClick:()=>b("rendered"),className:k("p-2 rounded-l-md transition-colors",d==="rendered"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("rendered_view"),children:e.jsx(H,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>b("source"),className:k("p-2 rounded-r-md transition-colors",d==="source"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("source_view"),children:e.jsx(q,{className:"w-4 h-4"})})]}),e.jsx("button",{onClick:C,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:r("copy_source"),children:M?e.jsx(O,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:d==="rendered"?e.jsx("div",{className:"max-w-4xl mx-auto p-8",children:e.jsx(A,{content:v,questContext:N})}):e.jsx("pre",{className:"p-4 font-mono text-sm whitespace-pre-wrap",children:s})})]})}export{te as default};
128
+ `;function te({context:t,tabId:i,setDirty:y,setTitle:l}){const{t:r,language:a}=E("markdown_viewer"),c=F(f=>f.updateTabState),[s,o]=n.useState(""),[j,x]=n.useState(!0),[h,g]=n.useState(null),[M,w]=n.useState(!1),[d,b]=n.useState("rendered"),u=t.resourceName||t.resourcePath||"Untitled.md",m=B(u),v=U(s,{isMdx:m}),N=G.useMemo(()=>I(t.resourceId),[t.resourceId]);n.useEffect(()=>{l(u)},[u,l]),n.useEffect(()=>{c(i,{contentKind:m?"mdx":"markdown",documentMode:d,isReadOnly:!0})},[m,i,c,d]),n.useEffect(()=>{(async()=>{x(!0),g(null);try{if(!t.resourceId){o(a==="zh-CN"?Q:z),x(!1);return}const{getFileContent:p}=await V(async()=>{const{getFileContent:S}=await import("./index-CBNVuWcP.js").then(_=>_.em);return{getFileContent:S}},__vite__mapDeps([0,1,2,3,4])),D=await p(t.resourceId);o(D)}catch(p){g(p instanceof Error?p.message:r("load_failed"))}finally{x(!1)}})()},[t.resourceId,a,r]);const C=n.useCallback(async()=>{await $(s)&&(w(!0),setTimeout(()=>w(!1),2e3))},[s]);return j?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(T,{className:"w-8 h-8 animate-spin"}),e.jsx("span",{children:r("loading")})]})}):h?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-destructive",children:[e.jsx(L,{className:"w-8 h-8"}),e.jsx("span",{children:h}),e.jsx("button",{className:"px-4 py-2 text-sm bg-destructive/10 hover:bg-destructive/20 rounded-lg transition-colors",onClick:()=>window.location.reload(),children:r("retry")})]})}):e.jsxs("div",{className:"flex flex-col h-full bg-background text-foreground",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:R}}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(P,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:u}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:m?"MDX":"Markdown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"flex items-center border border-border rounded-md mr-2",children:[e.jsx("button",{onClick:()=>b("rendered"),className:k("p-2 rounded-l-md transition-colors",d==="rendered"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("rendered_view"),children:e.jsx(H,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>b("source"),className:k("p-2 rounded-r-md transition-colors",d==="source"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("source_view"),children:e.jsx(q,{className:"w-4 h-4"})})]}),e.jsx("button",{onClick:C,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:r("copy_source"),children:M?e.jsx(O,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:d==="rendered"?e.jsx("div",{className:"max-w-4xl mx-auto p-8",children:e.jsx(A,{content:v,questContext:N})}):e.jsx("pre",{className:"p-4 font-mono text-sm whitespace-pre-wrap",children:s})})]})}export{te as default};
@@ -1,4 +1,4 @@
1
- import{y as F,ac as O,m as R,ad as D,f as m,s as o,j as t,k as S,O as A,ae as C,af as V,ag as _,ah as E,h as w,ai as X,b as P}from"./index-Gbl53BNp.js";import{r as f}from"./plugin-monaco-C8UgLomw.js";import{S as W}from"./sigma-7jpXazui.js";import{I as q}from"./image-B9HUUddG.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
1
+ import{y as F,ac as O,m as R,ad as D,f as m,s as o,j as t,k as S,O as A,ae as C,af as V,ag as _,ah as E,h as w,ai as X,b as P}from"./index-CBNVuWcP.js";import{r as f}from"./plugin-monaco-C8UgLomw.js";import{S as W}from"./sigma-ClKcHAXm.js";import{I as q}from"./image-Bgl4VIyx.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{y as j,j as e,J as B,l as Be,d as re,b as Y,bu as rt,c3 as at,c4 as U,c5 as it,c6 as lt,u as fe,n as ct,Y as me,L as Fe,e as dt,C as ut,f as mt,a8 as ft,c7 as pt,c8 as ht,c9 as Ce,Z as Ae}from"./index-Gbl53BNp.js";import{r as a}from"./plugin-monaco-C8UgLomw.js";import{m as gt,l as xt,w as se,P as Pe,g as W,s as oe,q as bt,u as ce,r as Ee,d as vt,J as de,U as kt,I as yt,T as wt,B as jt,O as Nt,S as Tt,K as Ct,G as Me,c as At,i as Et}from"./NotebookEditor-CVsj8h_T.js";import{D as Mt,e as It,a as Ie,m as Rt,u as D,f as St,C as zt}from"./plugin-notebook-HbW2K-1c.js";import{P as Dt}from"./project-sync-CsX08Qno.js";import{S as He}from"./index-wQ7RIIRd.js";import{C as pe}from"./code-DLC6G24T.js";import{I as Lt}from"./image-B9HUUddG.js";import{P as he,a as ge,b as xe}from"./popover-DL6h35vr.js";import{T as _t,A as Bt}from"./trash-xA7kFt8i.js";import{S as Ft}from"./sigma-7jpXazui.js";import{u as Pt}from"./useFileDiffOverlay-FuhcnKiw.js";import{F as Ht}from"./file-diff-panel-Denq-lC3.js";/**
1
+ import{y as j,j as e,J as B,l as Be,d as re,b as Y,bu as rt,c3 as at,c4 as U,c5 as it,c6 as lt,u as fe,n as ct,Y as me,L as Fe,e as dt,C as ut,f as mt,a8 as ft,c7 as pt,c8 as ht,c9 as Ce,Z as Ae}from"./index-CBNVuWcP.js";import{r as a}from"./plugin-monaco-C8UgLomw.js";import{m as gt,l as xt,w as se,P as Pe,g as W,s as oe,q as bt,u as ce,r as Ee,d as vt,J as de,U as kt,I as yt,T as wt,B as jt,O as Nt,S as Tt,K as Ct,G as Me,c as At,i as Et}from"./NotebookEditor-DB9N_T9q.js";import{D as Mt,e as It,a as Ie,m as Rt,u as D,f as St,C as zt}from"./plugin-notebook-HbW2K-1c.js";import{P as Dt}from"./project-sync-C9IdzdZW.js";import{S as He}from"./index-CwNu1aH4.js";import{C as pe}from"./code-WlFHE7z_.js";import{I as Lt}from"./image-Bgl4VIyx.js";import{P as he,a as ge,b as xe}from"./popover-CLc0pPP8.js";import{T as _t,A as Bt}from"./trash-DwpbFr3w.js";import{S as Ft}from"./sigma-ClKcHAXm.js";import{u as Pt}from"./useFileDiffOverlay-FuhcnKiw.js";import{F as Ht}from"./file-diff-panel-CQhw0jS2.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.