@researai/deepscientist 1.5.15 → 1.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +336 -98
- package/bin/ds.js +691 -91
- package/docs/en/00_QUICK_START.md +36 -15
- package/docs/en/01_SETTINGS_REFERENCE.md +33 -0
- package/docs/en/02_START_RESEARCH_GUIDE.md +7 -0
- package/docs/en/05_TUI_GUIDE.md +6 -0
- package/docs/en/06_RUNTIME_AND_CANVAS.md +4 -3
- package/docs/en/09_DOCTOR.md +11 -5
- package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +63 -13
- package/docs/en/15_CODEX_PROVIDER_SETUP.md +25 -8
- package/docs/en/19_EXTERNAL_CONTROLLER_GUIDE.md +226 -0
- package/docs/en/19_LOCAL_BROWSER_AUTH.md +70 -0
- package/docs/en/20_WORKSPACE_MODES_GUIDE.md +250 -0
- package/docs/en/README.md +18 -0
- package/docs/zh/00_QUICK_START.md +36 -15
- package/docs/zh/01_SETTINGS_REFERENCE.md +33 -0
- package/docs/zh/02_START_RESEARCH_GUIDE.md +7 -0
- package/docs/zh/05_TUI_GUIDE.md +6 -0
- package/docs/zh/09_DOCTOR.md +11 -5
- package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +63 -13
- package/docs/zh/15_CODEX_PROVIDER_SETUP.md +25 -8
- package/docs/zh/19_EXTERNAL_CONTROLLER_GUIDE.md +226 -0
- package/docs/zh/19_LOCAL_BROWSER_AUTH.md +68 -0
- package/docs/zh/20_WORKSPACE_MODES_GUIDE.md +251 -0
- package/docs/zh/README.md +18 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/deepscientist/__init__.py +1 -1
- package/src/deepscientist/acp/envelope.py +6 -0
- package/src/deepscientist/artifact/service.py +647 -22
- package/src/deepscientist/bash_exec/service.py +234 -9
- package/src/deepscientist/cli.py +115 -19
- package/src/deepscientist/codex_cli_compat.py +232 -0
- package/src/deepscientist/config/models.py +2 -1
- package/src/deepscientist/config/service.py +31 -9
- package/src/deepscientist/daemon/api/handlers.py +125 -6
- package/src/deepscientist/daemon/api/router.py +4 -0
- package/src/deepscientist/daemon/app.py +715 -98
- package/src/deepscientist/gitops/__init__.py +10 -1
- package/src/deepscientist/gitops/diff.py +129 -0
- package/src/deepscientist/gitops/service.py +4 -1
- package/src/deepscientist/mcp/server.py +39 -0
- package/src/deepscientist/prompts/builder.py +255 -32
- package/src/deepscientist/quest/layout.py +15 -2
- package/src/deepscientist/quest/service.py +295 -43
- package/src/deepscientist/quest/stage_views.py +6 -1
- package/src/deepscientist/runners/codex.py +86 -31
- package/src/deepscientist/skills/__init__.py +2 -2
- package/src/deepscientist/skills/installer.py +196 -5
- package/src/deepscientist/skills/registry.py +66 -0
- package/src/prompts/connectors/qq.md +18 -8
- package/src/prompts/connectors/weixin.md +16 -6
- package/src/prompts/contracts/shared_interaction.md +12 -1
- package/src/prompts/system.md +10 -5
- package/src/prompts/system_copilot.md +43 -0
- package/src/skills/analysis-campaign/SKILL.md +1 -0
- package/src/skills/baseline/SKILL.md +8 -0
- package/src/skills/decision/SKILL.md +8 -0
- package/src/skills/experiment/SKILL.md +8 -0
- package/src/skills/figure-polish/SKILL.md +1 -0
- package/src/skills/finalize/SKILL.md +1 -0
- package/src/skills/idea/SKILL.md +1 -0
- package/src/skills/intake-audit/SKILL.md +8 -0
- package/src/skills/mentor/SKILL.md +217 -0
- package/src/skills/mentor/references/correction-rules.md +210 -0
- package/src/skills/mentor/references/knowledge-profile.md +91 -0
- package/src/skills/mentor/references/persona-profile.md +138 -0
- package/src/skills/mentor/references/taste-profile.md +128 -0
- package/src/skills/mentor/references/thought-style-profile.md +138 -0
- package/src/skills/mentor/references/work-profile.md +289 -0
- package/src/skills/mentor/references/workflow-profile.md +240 -0
- package/src/skills/optimize/SKILL.md +1 -0
- package/src/skills/rebuttal/SKILL.md +1 -0
- package/src/skills/review/SKILL.md +1 -0
- package/src/skills/scout/SKILL.md +8 -0
- package/src/skills/write/SKILL.md +1 -0
- package/src/tui/dist/app/AppContainer.js +19 -11
- package/src/tui/dist/index.js +4 -1
- package/src/tui/dist/lib/api.js +33 -3
- package/src/tui/package.json +1 -1
- package/src/ui/dist/assets/AiManusChatView-COFACy7V.js +204 -0
- package/src/ui/dist/assets/AnalysisPlugin-DnSm0GZn.js +1 -0
- package/src/ui/dist/assets/CliPlugin-CvwCmDQ5.js +109 -0
- package/src/ui/dist/assets/CodeEditorPlugin-cOqSa0xq.js +2 -0
- package/src/ui/dist/assets/CodeViewerPlugin-itb0tltR.js +270 -0
- package/src/ui/dist/assets/DocViewerPlugin-DqKkiCI6.js +7 -0
- package/src/ui/dist/assets/GitCommitViewerPlugin-DVgNHBCS.js +1 -0
- package/src/ui/dist/assets/GitDiffViewerPlugin-DxL2ezFG.js +6 -0
- package/src/ui/dist/assets/GitSnapshotViewer-B_RQm1YZ.js +30 -0
- package/src/ui/dist/assets/ImageViewerPlugin-tHqlXY3n.js +26 -0
- package/src/ui/dist/assets/LabCopilotPanel-ClMbq5Yu.js +14 -0
- package/src/ui/dist/assets/LabPlugin-L_SuE8ow.js +22 -0
- package/src/ui/dist/assets/LatexPlugin-B495DTXC.js +25 -0
- package/src/ui/dist/assets/MarkdownViewerPlugin-DG28-61B.js +128 -0
- package/src/ui/dist/assets/MarketplacePlugin-BiOGT-Kj.js +13 -0
- package/src/ui/dist/assets/{NotebookEditor-CccQYZjX.css → NotebookEditor-BHH8rdGj.css} +1 -1
- package/src/ui/dist/assets/NotebookEditor-BOr3x3Ej.css +1 -0
- package/src/ui/dist/assets/NotebookEditor-C-4Kt1p9.js +81 -0
- package/src/ui/dist/assets/NotebookEditor-CVsj8h_T.js +361 -0
- package/src/ui/dist/assets/PdfLoader-CASDQmxJ.js +16 -0
- package/src/ui/dist/assets/PdfLoader-Cy5jtWrr.css +1 -0
- package/src/ui/dist/assets/PdfMarkdownPlugin-BFhwoKsY.js +1 -0
- package/src/ui/dist/assets/PdfViewerPlugin-DcOzU9vd.js +17 -0
- package/src/ui/dist/assets/PdfViewerPlugin-nwwE-fjJ.css +1 -0
- package/src/ui/dist/assets/SearchPlugin-CHj7M58O.js +16 -0
- package/src/ui/dist/assets/SearchPlugin-DA4en4hK.css +1 -0
- package/src/ui/dist/assets/TextViewerPlugin-CB4DYfWO.js +54 -0
- package/src/ui/dist/assets/VNCViewer-CjlbyCB3.js +11 -0
- package/src/ui/dist/assets/bot-CFkZY-JP.js +6 -0
- package/src/ui/dist/assets/browser-CTB2jwNe.js +8 -0
- package/src/ui/dist/assets/chevron-up-Dq5ofbht.js +6 -0
- package/src/ui/dist/assets/code-DLC6G24T.js +6 -0
- package/src/ui/dist/assets/file-content-Dv4LoZec.js +1 -0
- package/src/ui/dist/assets/file-diff-panel-Denq-lC3.js +1 -0
- package/src/ui/dist/assets/file-jump-queue-DA-SdG__.js +1 -0
- package/src/ui/dist/assets/file-socket-Cu4Qln7Y.js +1 -0
- package/src/ui/dist/assets/git-commit-horizontal-BUh6G52n.js +6 -0
- package/src/ui/dist/assets/image-B9HUUddG.js +6 -0
- package/src/ui/dist/assets/index-B2B1sg-M.js +1 -0
- package/src/ui/dist/assets/index-Cgla8biy.css +33 -0
- package/src/ui/dist/assets/index-DRyx7vAc.js +1 -0
- package/src/ui/dist/assets/index-Gbl53BNp.js +2496 -0
- package/src/ui/dist/assets/index-wQ7RIIRd.js +11 -0
- package/src/ui/dist/assets/monaco-CiHMMNH_.js +1 -0
- package/src/ui/dist/assets/pdf-effect-queue-ZtnHFCAi.js +6 -0
- package/src/ui/dist/assets/plugin-monaco-C8UgLomw.js +19 -0
- package/src/ui/dist/assets/plugin-notebook-HbW2K-1c.js +169 -0
- package/src/ui/dist/assets/plugin-pdf-CR8hgQBV.js +357 -0
- package/src/ui/dist/assets/plugin-terminal-MXFIPun8.js +227 -0
- package/src/ui/dist/assets/popover-DL6h35vr.js +1 -0
- package/src/ui/dist/assets/project-sync-CsX08Qno.js +1 -0
- package/src/ui/dist/assets/select-DvmXt1yY.js +11 -0
- package/src/ui/dist/assets/sigma-7jpXazui.js +6 -0
- package/src/ui/dist/assets/trash-xA7kFt8i.js +11 -0
- package/src/ui/dist/assets/useCliAccess-DsMwDjOp.js +1 -0
- package/src/ui/dist/assets/useFileDiffOverlay-FuhcnKiw.js +1 -0
- package/src/ui/dist/assets/wrap-text-CwMn-iqb.js +11 -0
- package/src/ui/dist/assets/zoom-out-R-GWEhzS.js +11 -0
- package/src/ui/dist/index.html +5 -2
- package/src/ui/dist/assets/AiManusChatView-DDjbFnbt.js +0 -26597
- package/src/ui/dist/assets/AnalysisPlugin-Yb5IdmaU.js +0 -123
- package/src/ui/dist/assets/CliPlugin-e64sreyu.js +0 -31037
- package/src/ui/dist/assets/CodeEditorPlugin-C4D2TIkU.js +0 -427
- package/src/ui/dist/assets/CodeViewerPlugin-BVoNZIvC.js +0 -905
- package/src/ui/dist/assets/DocViewerPlugin-CLChbllo.js +0 -278
- package/src/ui/dist/assets/GitDiffViewerPlugin-C4xeFyFQ.js +0 -2661
- package/src/ui/dist/assets/ImageViewerPlugin-OiMUAcLi.js +0 -500
- package/src/ui/dist/assets/LabCopilotPanel-BjD2ThQF.js +0 -4104
- package/src/ui/dist/assets/LabPlugin-DQPg-NrB.js +0 -2677
- package/src/ui/dist/assets/LatexPlugin-CI05XAV9.js +0 -1792
- package/src/ui/dist/assets/MarkdownViewerPlugin-DpeBLYZf.js +0 -308
- package/src/ui/dist/assets/MarketplacePlugin-DolE58Q2.js +0 -413
- package/src/ui/dist/assets/NotebookEditor-7Qm2rSWD.js +0 -4214
- package/src/ui/dist/assets/NotebookEditor-C1kWaxKi.js +0 -84873
- package/src/ui/dist/assets/NotebookEditor-C3VQ7ylN.css +0 -1405
- package/src/ui/dist/assets/PdfLoader-BfOHw8Zw.js +0 -25468
- package/src/ui/dist/assets/PdfLoader-C-Y707R3.css +0 -49
- package/src/ui/dist/assets/PdfMarkdownPlugin-BulDREv1.js +0 -409
- package/src/ui/dist/assets/PdfViewerPlugin-C-daaOaL.js +0 -3095
- package/src/ui/dist/assets/PdfViewerPlugin-DQ11QcSf.css +0 -3627
- package/src/ui/dist/assets/SearchPlugin-CjpaiJ3A.js +0 -741
- package/src/ui/dist/assets/SearchPlugin-DDMrGDkh.css +0 -379
- package/src/ui/dist/assets/TextViewerPlugin-BxIyqPQC.js +0 -472
- package/src/ui/dist/assets/VNCViewer-HAg9mF7M.js +0 -18821
- package/src/ui/dist/assets/awareness-C0NPR2Dj.js +0 -292
- package/src/ui/dist/assets/bot-0DYntytV.js +0 -21
- package/src/ui/dist/assets/browser-BAcuE0Xj.js +0 -2895
- package/src/ui/dist/assets/code-B20Slj_w.js +0 -17
- package/src/ui/dist/assets/file-content-DT24KFma.js +0 -377
- package/src/ui/dist/assets/file-diff-panel-DK13YPql.js +0 -92
- package/src/ui/dist/assets/file-jump-queue-r5XKgJEV.js +0 -16
- package/src/ui/dist/assets/file-socket-B4T2o4nR.js +0 -58
- package/src/ui/dist/assets/function-B5QZkkHC.js +0 -1895
- package/src/ui/dist/assets/image-DSeR_sDS.js +0 -18
- package/src/ui/dist/assets/index-BrFje2Uk.js +0 -120
- package/src/ui/dist/assets/index-BwRJaoTl.js +0 -25
- package/src/ui/dist/assets/index-D_E4281X.js +0 -221322
- package/src/ui/dist/assets/index-DnYB3xb1.js +0 -159
- package/src/ui/dist/assets/index-G7AcWcMu.css +0 -12594
- package/src/ui/dist/assets/monaco-LExaAN3Y.js +0 -623
- package/src/ui/dist/assets/pdf-effect-queue-BJk5okWJ.js +0 -47
- package/src/ui/dist/assets/pdf_viewer-e0g1is2C.js +0 -8206
- package/src/ui/dist/assets/popover-D3Gg_FoV.js +0 -476
- package/src/ui/dist/assets/project-sync-C_ygLlVU.js +0 -297
- package/src/ui/dist/assets/select-CpAK6uWm.js +0 -1690
- package/src/ui/dist/assets/sigma-DEccaSgk.js +0 -22
- package/src/ui/dist/assets/square-check-big-uUfyVsbD.js +0 -17
- package/src/ui/dist/assets/trash-CXvwwSe8.js +0 -32
- package/src/ui/dist/assets/useCliAccess-Bnop4mgR.js +0 -957
- package/src/ui/dist/assets/useFileDiffOverlay-B8eUAX0I.js +0 -53
- package/src/ui/dist/assets/wrap-text-9vbOBpkW.js +0 -35
- package/src/ui/dist/assets/yjs-DncrqiZ8.js +0 -11243
- package/src/ui/dist/assets/zoom-out-BgVMmOW4.js +0 -34
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
@@ -0,0 +1,270 @@
|
|
|
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
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom hook for fetching data
|
|
8
|
+
* @param {string} url - The URL to fetch from
|
|
9
|
+
* @returns {Object} - The data, loading state, and error
|
|
10
|
+
*/
|
|
11
|
+
export function useFetch(url) {
|
|
12
|
+
const [data, setData] = useState(null);
|
|
13
|
+
const [loading, setLoading] = useState(true);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const fetchData = async () => {
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(url);
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
throw new Error('Network response was not ok');
|
|
22
|
+
}
|
|
23
|
+
const json = await response.json();
|
|
24
|
+
setData(json);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
setError(err.message);
|
|
27
|
+
} finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
fetchData();
|
|
33
|
+
}, [url]);
|
|
34
|
+
|
|
35
|
+
return { data, loading, error };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Example usage
|
|
39
|
+
const API_URL = "https://api.example.com/data";
|
|
40
|
+
const { data, loading } = useFetch(API_URL);
|
|
41
|
+
|
|
42
|
+
console.log("Data loaded:", data);
|
|
43
|
+
`,typescript:`// DeepScientist - Example TypeScript Code
|
|
44
|
+
interface User {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
email: string;
|
|
48
|
+
role: 'admin' | 'user' | 'guest';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type AsyncResult<T> = {
|
|
52
|
+
data: T | null;
|
|
53
|
+
loading: boolean;
|
|
54
|
+
error: string | null;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
async function fetchUser(userId: string): Promise<User> {
|
|
58
|
+
const response = await fetch(\`/api/users/\${userId}\`);
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new Error('Failed to fetch user');
|
|
61
|
+
}
|
|
62
|
+
return response.json();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class UserService {
|
|
66
|
+
private cache: Map<string, User> = new Map();
|
|
67
|
+
|
|
68
|
+
async getUser(id: string): Promise<User | undefined> {
|
|
69
|
+
if (this.cache.has(id)) {
|
|
70
|
+
return this.cache.get(id);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const user = await fetchUser(id);
|
|
74
|
+
this.cache.set(id, user);
|
|
75
|
+
return user;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const userService = new UserService();
|
|
80
|
+
`,python:`# DeepScientist - Example Python Code
|
|
81
|
+
from typing import List, Optional, Dict
|
|
82
|
+
from dataclasses import dataclass
|
|
83
|
+
import asyncio
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class Document:
|
|
87
|
+
"""Represents a research document."""
|
|
88
|
+
id: str
|
|
89
|
+
title: str
|
|
90
|
+
content: str
|
|
91
|
+
tags: List[str]
|
|
92
|
+
metadata: Dict[str, any]
|
|
93
|
+
|
|
94
|
+
class DocumentProcessor:
|
|
95
|
+
"""Processes and analyzes documents."""
|
|
96
|
+
|
|
97
|
+
def __init__(self, model_name: str = "gpt-4"):
|
|
98
|
+
self.model_name = model_name
|
|
99
|
+
self._cache: Dict[str, Document] = {}
|
|
100
|
+
|
|
101
|
+
async def process(self, doc: Document) -> Dict[str, any]:
|
|
102
|
+
"""Process a document and extract insights."""
|
|
103
|
+
# Simulate async processing
|
|
104
|
+
await asyncio.sleep(0.1)
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
"word_count": len(doc.content.split()),
|
|
108
|
+
"tag_count": len(doc.tags),
|
|
109
|
+
"has_metadata": bool(doc.metadata)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
def summarize(self, doc: Document) -> str:
|
|
113
|
+
"""Generate a summary of the document."""
|
|
114
|
+
words = doc.content.split()[:100]
|
|
115
|
+
return " ".join(words) + "..."
|
|
116
|
+
|
|
117
|
+
# Example usage
|
|
118
|
+
if __name__ == "__main__":
|
|
119
|
+
doc = Document(
|
|
120
|
+
id="doc-001",
|
|
121
|
+
title="Research Paper",
|
|
122
|
+
content="This is the content of the research paper...",
|
|
123
|
+
tags=["AI", "Machine Learning"],
|
|
124
|
+
metadata={"author": "Dr. Smith"}
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
processor = DocumentProcessor()
|
|
128
|
+
print(f"Processing: {doc.title}")
|
|
129
|
+
`,go:`// DeepScientist - Example Go Code
|
|
130
|
+
package main
|
|
131
|
+
|
|
132
|
+
import (
|
|
133
|
+
"context"
|
|
134
|
+
"encoding/json"
|
|
135
|
+
"fmt"
|
|
136
|
+
"net/http"
|
|
137
|
+
"time"
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
// Document represents a research document
|
|
141
|
+
type Document struct {
|
|
142
|
+
ID string \`json:"id"\`
|
|
143
|
+
Title string \`json:"title"\`
|
|
144
|
+
Content string \`json:"content"\`
|
|
145
|
+
Tags []string \`json:"tags"\`
|
|
146
|
+
Metadata map[string]string \`json:"metadata"\`
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// DocumentService handles document operations
|
|
150
|
+
type DocumentService struct {
|
|
151
|
+
cache map[string]*Document
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// NewDocumentService creates a new DocumentService
|
|
155
|
+
func NewDocumentService() *DocumentService {
|
|
156
|
+
return &DocumentService{
|
|
157
|
+
cache: make(map[string]*Document),
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// GetDocument retrieves a document by ID
|
|
162
|
+
func (s *DocumentService) GetDocument(ctx context.Context, id string) (*Document, error) {
|
|
163
|
+
if doc, ok := s.cache[id]; ok {
|
|
164
|
+
return doc, nil
|
|
165
|
+
}
|
|
166
|
+
return nil, fmt.Errorf("document not found: %s", id)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
func main() {
|
|
170
|
+
service := NewDocumentService()
|
|
171
|
+
|
|
172
|
+
http.HandleFunc("/documents", func(w http.ResponseWriter, r *http.Request) {
|
|
173
|
+
w.Header().Set("Content-Type", "application/json")
|
|
174
|
+
json.NewEncoder(w).Encode(map[string]string{
|
|
175
|
+
"status": "ok",
|
|
176
|
+
"time": time.Now().Format(time.RFC3339),
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
fmt.Println("Server starting on :8080")
|
|
181
|
+
http.ListenAndServe(":8080", nil)
|
|
182
|
+
}
|
|
183
|
+
`,rust:`// DeepScientist - Example Rust Code
|
|
184
|
+
use std::collections::HashMap;
|
|
185
|
+
use serde::{Deserialize, Serialize};
|
|
186
|
+
|
|
187
|
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
188
|
+
pub struct Document {
|
|
189
|
+
pub id: String,
|
|
190
|
+
pub title: String,
|
|
191
|
+
pub content: String,
|
|
192
|
+
pub tags: Vec<String>,
|
|
193
|
+
pub metadata: HashMap<String, String>,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
impl Document {
|
|
197
|
+
pub fn new(id: &str, title: &str, content: &str) -> Self {
|
|
198
|
+
Document {
|
|
199
|
+
id: id.to_string(),
|
|
200
|
+
title: title.to_string(),
|
|
201
|
+
content: content.to_string(),
|
|
202
|
+
tags: Vec::new(),
|
|
203
|
+
metadata: HashMap::new(),
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
pub fn word_count(&self) -> usize {
|
|
208
|
+
self.content.split_whitespace().count()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
pub fn add_tag(&mut self, tag: &str) {
|
|
212
|
+
self.tags.push(tag.to_string());
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
pub struct DocumentService {
|
|
217
|
+
cache: HashMap<String, Document>,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
impl DocumentService {
|
|
221
|
+
pub fn new() -> Self {
|
|
222
|
+
DocumentService {
|
|
223
|
+
cache: HashMap::new(),
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
pub fn get(&self, id: &str) -> Option<&Document> {
|
|
228
|
+
self.cache.get(id)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
pub fn insert(&mut self, doc: Document) {
|
|
232
|
+
self.cache.insert(doc.id.clone(), doc);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
fn main() {
|
|
237
|
+
let mut service = DocumentService::new();
|
|
238
|
+
let mut doc = Document::new("doc-001", "Research Paper", "Content here...");
|
|
239
|
+
doc.add_tag("AI");
|
|
240
|
+
|
|
241
|
+
service.insert(doc);
|
|
242
|
+
println!("Document service initialized");
|
|
243
|
+
}
|
|
244
|
+
`,json:`{
|
|
245
|
+
"name": "@ds/plugin-code-viewer",
|
|
246
|
+
"version": "1.0.0",
|
|
247
|
+
"description": "Code viewer plugin for DeepScientist",
|
|
248
|
+
"author": "DeepScientist Team",
|
|
249
|
+
"license": "MIT",
|
|
250
|
+
"keywords": ["code", "viewer", "syntax", "highlight"],
|
|
251
|
+
"main": "dist/index.js",
|
|
252
|
+
"types": "dist/index.d.ts",
|
|
253
|
+
"dependencies": {
|
|
254
|
+
"react": "^18.0.0",
|
|
255
|
+
"lucide-react": "^0.263.0"
|
|
256
|
+
},
|
|
257
|
+
"devDependencies": {
|
|
258
|
+
"typescript": "^5.0.0",
|
|
259
|
+
"@types/react": "^18.0.0"
|
|
260
|
+
},
|
|
261
|
+
"scripts": {
|
|
262
|
+
"build": "tsc",
|
|
263
|
+
"dev": "tsc --watch",
|
|
264
|
+
"test": "jest"
|
|
265
|
+
},
|
|
266
|
+
"peerDependencies": {
|
|
267
|
+
"react": ">=18.0.0"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
`};export{fe as default};
|
|
@@ -0,0 +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";/**
|
|
3
|
+
* @license lucide-react v0.511.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,6 @@
|
|
|
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";/**
|
|
2
|
+
* @license lucide-react v0.511.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const _e=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],ke=ne("git-compare",_e),X=s=>typeof s=="boolean"?s:null,Y=s=>typeof s=="number"&&Number.isFinite(s)?s:null,c=s=>typeof s!="string"?null:s.trim()||null,M=s=>!!(s&&"available"in s);function je({document:s,projectId:x,parentTabId:D}){const a=A(f=>f.clearTabState),o=A(f=>f.clearTabReferences),h=p.useMemo(()=>Z(s),[s]),t=p.useMemo(()=>s?fe(x,s):null,[s,x]),r=p.useMemo(()=>`${D}::snapshot-preview::${h}`,[D,h]),b=p.useMemo(()=>{if(!t)return null;const f=t.path?pe(t.path):void 0,g={updatedAt:t.updatedAt,sizeBytes:t.size,mimeType:t.mimeType};return{context:{type:h==="notebook"?"notebook":"file",resourceId:t.id,resourceName:t.name,resourcePath:f,mimeType:t.mimeType,customData:{projectId:x,readonly:!0,readOnlyMode:!0,size:t.size,fileMeta:g}},tabId:r,setDirty:()=>{},setTitle:()=>{}}},[h,r,x,t]);return p.useEffect(()=>()=>{o(r),a(r)},[o,a,r]),!s||h==="plain"||!b?e.jsx(U,{document:s,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)]"}):h==="markdown"?e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsx(ue,{...b})}):h==="notebook"?e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsx(xe,{...b,className:"h-full"})}):h==="pdf"?e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsx(ge,{...b})}):h==="image"?e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsx(me,{...b})}):e.jsx(U,{document:s,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)]"})}function Je({context:s,tabId:x,setTitle:D}){const{t:a}=de("workspace"),o=s.customData??{},h=A(i=>i.updateTabState),t=c(o.projectId),r=o.resolver==="file_change"?"file_change":o.resolver==="git_commit"?"git_commit":"git",b=o.initialMode==="snapshot"?"snapshot":"diff",f=c(o.sha),g=c(o.base),w=c(o.head),l=c(o.path),_=c(o.queryPath),F=c(o.displayPath),k=c(o.runId),S=c(o.eventId),T=c(o.status),C=c(o.oldPath),B=Y(o.added),E=Y(o.removed),I=c(o.snapshotRevision),ee=c(o.snapshotDocumentId),R=r==="file_change"?!!(t&&k&&_):r==="git_commit"?!!(t&&f&&l):!!(t&&g&&w&&l),V=ee||(I&&l?`git::${I}::${l}`:null),q=!!(t&&V),te=X(o.allowSnapshot),ie=X(o.allowDiff),v=te??q,m=ie??R,[n,z]=p.useState(()=>b==="snapshot"&&v?"snapshot":"diff");p.useEffect(()=>{if(n==="snapshot"&&!v&&m){z("diff");return}n==="diff"&&!m&&v&&z("snapshot")},[m,v,n]);const u=J({queryKey:["git-diff-viewer","snapshot",t,V],queryFn:()=>G.openDocument(t,V),enabled:!!(t&&V&&v&&n==="snapshot"),staleTime:3e4}),P=J({queryKey:["git-diff-viewer","diff",r,t,f,g,w,l,_,k,S],queryFn:()=>r==="file_change"?G.fileChangeDiff(t,k,_,S||void 0):r==="git_commit"?G.gitCommitFile(t,f,l):G.gitDiffFile(t,g,w,l),enabled:!!(R&&m&&n==="diff"),staleTime:3e4}),d=p.useMemo(()=>{const i=P.data??null;return i&&(r==="file_change"?{...i,display_path:(M(i)?i.display_path:null)||F||void 0,run_id:M(i)?i.run_id||k||void 0:k||void 0,event_id:M(i)?i.event_id||S||void 0:S||void 0}:r==="git_commit"?l?{...i,path:l,sha:i?.sha||f||void 0,old_path:i.old_path||C||void 0,status:i.status||T||void 0,added:i.added??B??void 0,removed:i.removed??E??void 0}:i:!l||!g||!w?i:{...i,path:l,base:g,head:w,old_path:i.old_path||C||void 0,status:i.status||T||void 0,added:i.added??B??void 0,removed:i.removed??E??void 0})},[B,g,P.data,F,S,w,C,l,E,r,k,f,T]),j=d?.base||g||"",y=d?.head||w||"",K=c(d?.sha)||f||"",se=d?.status||T||"modified",oe=d?.old_path||C||null,H=d?.added??B,Q=d?.removed??E,W=p.useMemo(()=>ve(u.data),[u.data]),re=p.useMemo(()=>Z(u.data),[u.data]),N=r==="file_change"?(M(d)?d.display_path:null)||F||d?.path||_||a("git_viewer_diff",void 0,"Diff"):be(l||d?.path||F,oe,a("git_viewer_diff",void 0,"Diff"));p.useEffect(()=>{D(N)},[N,D]),p.useEffect(()=>{h(x,{contentKind:n==="snapshot"?W:"code",documentMode:n,isReadOnly:!0,resourceName:N,resourcePath:n==="snapshot"?u.data?.path||l||void 0:d?.path||l||_||void 0})},[d?.path,l,_,N,W,u.data?.path,x,h,n]);const $=r==="file_change"&&M(d)&&!d.available?d.message||a("git_viewer_historical_patch_unavailable",void 0,"Historical patch unavailable."):null,O=n==="snapshot"?u:P,ae=n==="snapshot"&&!!u.data&&re!=="plain";return!t||!q&&!R?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-sm text-muted-foreground",children:a("git_viewer_missing_context",void 0,"Missing diff context.")}):e.jsxs("div",{"data-testid":"git-diff-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:[n==="snapshot"?e.jsx(le,{className:"h-3.5 w-3.5"}):e.jsx(ke,{className:"h-3.5 w-3.5"}),n==="snapshot"?a("git_viewer_snapshot",void 0,"Snapshot"):r==="file_change"?a("git_viewer_historical_diff",void 0,"Historical Diff"):a("git_viewer_diff",void 0,"Diff")]}),n==="diff"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:se})]}):null]}),e.jsx("div",{className:"mt-2 break-words text-[24px] font-semibold tracking-[-0.03em] text-foreground",children:N}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[n==="snapshot"?e.jsxs(e.Fragment,{children:[I?e.jsx("span",{children:I}):null,m&&r==="git_commit"&&K?e.jsx("span",{children:K}):null,m&&r!=="git_commit"&&j?e.jsx("span",{children:j}):null,m&&r!=="git_commit"&&j&&y?e.jsx("span",{children:"→"}):null,m&&r!=="git_commit"&&y?e.jsx("span",{children:y}):null]}):e.jsx(e.Fragment,{children:r==="git_commit"?K?e.jsx("span",{children:K}):null:e.jsxs(e.Fragment,{children:[j?e.jsx("span",{children:j}):null,j&&y?e.jsx("span",{children:"→"}):null,y?e.jsx("span",{children:y}):null]})}),H!=null?e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",H]}):null,Q!=null?e.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",Q]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v||m?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:[v?e.jsx("button",{type:"button",onClick:()=>z("snapshot"),"data-testid":"git-diff-viewer-snapshot-toggle",className:L("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",n==="snapshot"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:a("git_viewer_snapshot",void 0,"Snapshot")}):null,m?e.jsx("button",{type:"button",onClick:()=>z("diff"),"data-testid":"git-diff-viewer-diff-toggle",className:L("rounded-full px-3 py-1.5 text-[12px] font-medium transition-colors",n==="diff"?"bg-black/[0.06] text-foreground dark:bg-white/[0.12]":"text-muted-foreground hover:text-foreground"),children:a("git_viewer_diff",void 0,"Diff")}):null]}):null,e.jsxs(ce,{type:"button",size:"sm",variant:"outline",onClick:()=>{O.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(he,{className:L("mr-1.5 h-3.5 w-3.5",O.isFetching&&"animate-spin")}),a("explorer_refresh")]})]})]})}),e.jsx("div",{className:L("min-h-0 flex-1 px-6 py-6",ae?"overflow-hidden":"overflow-y-auto"),children:n==="snapshot"?!v||!q?e.jsx("div",{className:"rounded-[20px] border border-black/[0.08] bg-white/[0.82] px-4 py-4 text-sm leading-7 text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:a("git_viewer_snapshot_unavailable",void 0,"Snapshot preview is unavailable for this file.")}):u.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:a("git_viewer_loading_snapshot",void 0,"Loading snapshot…")}):u.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:a("git_viewer_failed_snapshot",void 0,"Failed to load snapshot.")}):e.jsx(je,{document:u.data,projectId:t,parentTabId:x}):!m||!R?e.jsx("div",{className:"rounded-[20px] border border-black/[0.08] bg-white/[0.82] px-4 py-4 text-sm leading-7 text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:a("git_viewer_diff_unavailable",void 0,"Diff preview is unavailable for this file.")}):P.isLoading?e.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:a("git_viewer_loading_diff",void 0,"Loading patch…")}):P.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:a("git_viewer_failed_diff",void 0,"Failed to load diff.")}):$?e.jsx("div",{className:"rounded-[20px] border border-black/[0.08] bg-white/[0.82] px-4 py-4 text-sm leading-7 text-muted-foreground dark:border-white/[0.08] dark:bg-white/[0.04]",children:$}):e.jsx(we,{diff:d,pathLabel:N,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)]"})})]})}export{Je as default};
|
|
@@ -0,0 +1,30 @@
|
|
|
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.
|
|
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
|
+
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
|
+
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){/*!
|
|
5
|
+
Copyright (c) 2018 Jed Watson.
|
|
6
|
+
Licensed under the MIT License (MIT), see
|
|
7
|
+
http://jedwatson.github.io/classnames
|
|
8
|
+
*/(function(){var r={}.hasOwnProperty;function n(){for(var t=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")t.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&t.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){t.push(i.toString());continue}for(var u in i)r.call(i,u)&&i[u]&&t.push(u)}}}return t.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()}),k={hunkClassName:"",lineClassName:"",gutterClassName:"",codeClassName:"",monotonous:!1,gutterType:"default",viewType:"split",widgets:{},hideGutter:!1,selectedChanges:[],generateAnchorID:function(){},generateLineClassName:function(){},renderGutter:function(e){var r=e.renderDefault;return(0,e.wrapInAnchor)(r())},codeEvents:{},gutterEvents:{}},xn=E.createContext(k),zr=xn.Provider,er=function(){return E.useContext(xn)},Kr=ve(function(e,r){(function(n){function t(i){var s=i.slice(11),o=null,u=null;switch(s.indexOf('"')){case-1:o=(f=s.split(" "))[0].slice(2),u=f[1].slice(2);break;case 0:var l=s.indexOf('"',2);o=s.slice(3,l);var c=s.indexOf('"',l+1);u=c<0?s.slice(l+4):s.slice(c+3,-1);break;default:var f;o=(f=s.split(" "))[0].slice(2),u=f[1].slice(3,-1)}return{oldPath:o,newPath:u}}var a={parse:function(i){for(var s,o,u,l,c,f=[],h=2,d=i.split(`
|
|
9
|
+
`),v=d.length,b=0;b<v;){var m=d[b];if(m.indexOf("diff --git")===0){s={hunks:[],oldEndingNewLine:!0,newEndingNewLine:!0,oldPath:(c=t(m)).oldPath,newPath:c.newPath},f.push(s);var _,w=null;e:for(;_=d[++b];){var y=_.indexOf(" "),N=y>-1?_.slice(0,y):N;switch(N){case"diff":b--;break e;case"deleted":case"new":var p=_.slice(y+1);p.indexOf("file mode")===0&&(s[N==="new"?"newMode":"oldMode"]=p.slice(10));break;case"similarity":s.similarity=parseInt(_.split(" ")[2],10);break;case"index":var C=_.slice(y+1).split(" "),S=C[0].split("..");s.oldRevision=S[0],s.newRevision=S[1],C[1]&&(s.oldMode=s.newMode=C[1]);break;case"copy":case"rename":var O=_.slice(y+1);O.indexOf("from")===0?s.oldPath=O.slice(5):s.newPath=O.slice(3),w=N;break;case"---":var j=_.slice(y+1),A=d[++b].slice(4);j==="/dev/null"?(A=A.slice(2),w="add"):A==="/dev/null"?(j=j.slice(2),w="delete"):(w="modify",j=j.slice(2),A=A.slice(2)),j&&(s.oldPath=j),A&&(s.newPath=A),h=5;break e}}s.type=w||"modify"}else if(m.indexOf("Binary")===0)s.isBinary=!0,s.type=m.indexOf("/dev/null and")>=0?"add":m.indexOf("and /dev/null")>=0?"delete":"modify",h=2,s=null;else if(h===5)if(m.indexOf("@@")===0){var M=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(m);o={content:m,oldStart:M[1]-0,newStart:M[4]-0,oldLines:M[3]-0||1,newLines:M[6]-0||1,changes:[]},s.hunks.push(o),u=o.oldStart,l=o.newStart}else{var U=m.slice(0,1),I={content:m.slice(1)};switch(U){case"+":I.type="insert",I.isInsert=!0,I.lineNumber=l,l++;break;case"-":I.type="delete",I.isDelete=!0,I.lineNumber=u,u++;break;case" ":I.type="normal",I.isNormal=!0,I.oldLineNumber=u,I.newLineNumber=l,u++,l++;break;case"\\":var R=o.changes[o.changes.length-1];R.isDelete||(s.newEndingNewLine=!1),R.isInsert||(s.oldEndingNewLine=!1)}I.type&&o.changes.push(I)}b++}return f}};e.exports=a})()});function J(e){return e.type==="insert"}function B(e){return e.type==="delete"}function z(e){return e.type==="normal"}function Hr(e,r){var n=r.nearbySequences==="zip"?function(t){var a=t.reduce(function(i,s,o){var u=T(i,3),l=u[0],c=u[1],f=u[2];return c?J(s)&&f>=0?(l.splice(f+1,0,s),[l,s,f+2]):(l.push(s),[l,s,B(s)&&B(c)?f:o]):(l.push(s),[l,s,B(s)?o:-1])},[[],null,-1]);return T(a,1)[0]}(e.changes):e.changes;return D(D({},e),{},{isPlain:!1,changes:n})}function Wr(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=function(t){if(t.startsWith("diff --git"))return t;var a=t.indexOf(`
|
|
10
|
+
`),i=t.indexOf(`
|
|
11
|
+
`,a+1),s=t.slice(0,a),o=t.slice(a+1,i),u=s.split(" ").slice(1,-3).join(" "),l=o.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(u," b/").concat(l),"index 1111111..2222222 100644","--- a/".concat(u),"+++ b/".concat(l),t.slice(i+1)].join(`
|
|
12
|
+
`)}(e.trimStart());return Kr.parse(n).map(function(t){return function(a,i){var s=a.hunks.map(function(o){return Hr(o,i)});return D(D({},a),{},{hunks:s})}(t,r)})}function Vr(e){return e[0]}function Xr(e){return e[e.length-1]}function Ye(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function fe(e){return e==="old"?function(r){return J(r)?-1:z(r)?r.oldLineNumber:r.lineNumber}:function(r){return B(r)?-1:z(r)?r.newLineNumber:r.lineNumber}}function nr(e,r){return function(n,t){var a=n[e],i=a+n[r];return t>=a&&t<i}}function Jr(e,r){return function(n,t,a){var i=n[e]+n[r],s=t[e];return a>=i&&a<s}}function rr(e){var r=fe(e),n=function(t){var a=T(Ye(t),2),i=nr(a[0],a[1]);return function(s,o){return s.find(function(u){return i(u,o)})}}(e);return function(t,a){var i=n(t,a);if(i)return i.changes.find(function(s){return r(s)===a})}}function sn(e){var r=e==="old"?"new":"old",n=T(Ye(e),2),t=n[0],a=n[1],i=T(Ye(r),2),s=i[0],o=i[1],u=fe(e),l=fe(r),c=nr(t,a),f=Jr(t,a);return function(h,d){var v=Vr(h);if(d<v[t]){var b=v[t]-d;return v[s]-b}var m=Xr(h);if(m[t]+m[a]<=d){var _=d-m[t]-m[a];return m[s]+m[o]+_}for(var w=0;w<h.length;w++){var y=h[w],N=h[w+1];if(c(y,d)){var p=y.changes.findIndex(function(M){return u(M)===d}),C=y.changes[p];if(z(C))return l(C);var S=B(C)?p+1:p-1,O=y.changes[S];if(!O)return-1;var j=J(C)?"delete":"insert";return O.type===j?l(O):-1}if(f(y,N,d)){var A=d-y[t]-y[a];return y[s]+y[o]+A}}throw new Error("Unexpected line position ".concat(d))}}var Zr=function(e,r,n,t){for(var a=e.length,i=n+-1;++i<a;)if(r(e[i],i,e))return i;return-1},Qr=function(){this.__data__=[],this.size=0},tr=function(e,r){return e===r||e!=e&&r!=r},Me=function(e,r){for(var n=e.length;n--;)if(tr(e[n][0],r))return n;return-1},Yr=Array.prototype.splice,qr=function(e){var r=this.__data__,n=Me(r,e);return!(n<0)&&(n==r.length-1?r.pop():Yr.call(r,n,1),--this.size,!0)},xr=function(e){var r=this.__data__,n=Me(r,e);return n<0?void 0:r[n][1]},et=function(e){return Me(this.__data__,e)>-1},nt=function(e,r){var n=this.__data__,t=Me(n,e);return t<0?(++this.size,n.push([e,r])):n[t][1]=r,this};function ne(e){var r=-1,n=e==null?0:e.length;for(this.clear();++r<n;){var t=e[r];this.set(t[0],t[1])}}ne.prototype.clear=Qr,ne.prototype.delete=qr,ne.prototype.get=xr,ne.prototype.has=et,ne.prototype.set=nt;var Ee=ne,rt=function(){this.__data__=new Ee,this.size=0},tt=function(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n},at=function(e){return this.__data__.get(e)},it=function(e){return this.__data__.has(e)},ar=typeof _e=="object"&&_e&&_e.Object===Object&&_e,st=typeof self=="object"&&self&&self.Object===Object&&self,K=ar||st||Function("return this")(),L=K.Symbol,ir=Object.prototype,ut=ir.hasOwnProperty,ot=ir.toString,ce=L?L.toStringTag:void 0,lt=function(e){var r=ut.call(e,ce),n=e[ce];try{e[ce]=void 0;var t=!0}catch{}var a=ot.call(e);return t&&(r?e[ce]=n:delete e[ce]),a},ct=Object.prototype.toString,ft=function(e){return ct.call(e)},wn=L?L.toStringTag:void 0,ue=function(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":wn&&wn in Object(e)?lt(e):ft(e)},he=function(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")},sr=function(e){if(!he(e))return!1;var r=ue(e);return r=="[object Function]"||r=="[object GeneratorFunction]"||r=="[object AsyncFunction]"||r=="[object Proxy]"},Ve=K["__core-js_shared__"],pn=function(){var e=/[^.]+$/.exec(Ve&&Ve.keys&&Ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ht=function(e){return!!pn&&pn in e},dt=Function.prototype.toString,Y=function(e){if(e!=null){try{return dt.call(e)}catch{}try{return e+""}catch{}}return""},gt=/^\[object .+?Constructor\]$/,vt=Function.prototype,mt=Object.prototype,bt=vt.toString,yt=mt.hasOwnProperty,_t=RegExp("^"+bt.call(yt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=function(e){return!(!he(e)||ht(e))&&(sr(e)?_t:gt).test(Y(e))},pt=function(e,r){return e?.[r]},q=function(e,r){var n=pt(e,r);return wt(n)?n:void 0},de=q(K,"Map"),ge=q(Object,"create"),Nt=function(){this.__data__=ge?ge(null):{},this.size=0},St=function(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r},Ct=Object.prototype.hasOwnProperty,jt=function(e){var r=this.__data__;if(ge){var n=r[e];return n==="__lodash_hash_undefined__"?void 0:n}return Ct.call(r,e)?r[e]:void 0},Tt=Object.prototype.hasOwnProperty,Ot=function(e){var r=this.__data__;return ge?r[e]!==void 0:Tt.call(r,e)},At=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ge&&r===void 0?"__lodash_hash_undefined__":r,this};function re(e){var r=-1,n=e==null?0:e.length;for(this.clear();++r<n;){var t=e[r];this.set(t[0],t[1])}}re.prototype.clear=Nt,re.prototype.delete=St,re.prototype.get=jt,re.prototype.has=Ot,re.prototype.set=At;var Nn=re,Dt=function(){this.size=0,this.__data__={hash:new Nn,map:new(de||Ee),string:new Nn}},Mt=function(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null},Pe=function(e,r){var n=e.__data__;return Mt(r)?n[typeof r=="string"?"string":"hash"]:n.map},Et=function(e){var r=Pe(this,e).delete(e);return this.size-=r?1:0,r},Pt=function(e){return Pe(this,e).get(e)},It=function(e){return Pe(this,e).has(e)},$t=function(e,r){var n=Pe(this,e),t=n.size;return n.set(e,r),this.size+=n.size==t?0:1,this};function te(e){var r=-1,n=e==null?0:e.length;for(this.clear();++r<n;){var t=e[r];this.set(t[0],t[1])}}te.prototype.clear=Dt,te.prototype.delete=Et,te.prototype.get=Pt,te.prototype.has=It,te.prototype.set=$t;var Ie=te,kt=function(e,r){var n=this.__data__;if(n instanceof Ee){var t=n.__data__;if(!de||t.length<199)return t.push([e,r]),this.size=++n.size,this;n=this.__data__=new Ie(t)}return n.set(e,r),this.size=n.size,this};function ae(e){var r=this.__data__=new Ee(e);this.size=r.size}ae.prototype.clear=rt,ae.prototype.delete=tt,ae.prototype.get=at,ae.prototype.has=it,ae.prototype.set=kt;var je=ae,Gt=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Bt=function(e){return this.__data__.has(e)};function Te(e){var r=-1,n=e==null?0:e.length;for(this.__data__=new Ie;++r<n;)this.add(e[r])}Te.prototype.add=Te.prototype.push=Gt,Te.prototype.has=Bt;var Ft=Te,Rt=function(e,r){for(var n=-1,t=e==null?0:e.length;++n<t;)if(r(e[n],n,e))return!0;return!1},Lt=function(e,r){return e.has(r)},ur=function(e,r,n,t,a,i){var s=1&n,o=e.length,u=r.length;if(o!=u&&!(s&&u>o))return!1;var l=i.get(e),c=i.get(r);if(l&&c)return l==r&&c==e;var f=-1,h=!0,d=2&n?new Ft:void 0;for(i.set(e,r),i.set(r,e);++f<o;){var v=e[f],b=r[f];if(t)var m=s?t(b,v,f,r,e,i):t(v,b,f,e,r,i);if(m!==void 0){if(m)continue;h=!1;break}if(d){if(!Rt(r,function(_,w){if(!Lt(d,w)&&(v===_||a(v,_,n,t,i)))return d.push(w)})){h=!1;break}}else if(v!==b&&!a(v,b,n,t,i)){h=!1;break}}return i.delete(e),i.delete(r),h},Sn=K.Uint8Array,Ut=function(e){var r=-1,n=Array(e.size);return e.forEach(function(t,a){n[++r]=[a,t]}),n},zt=function(e){var r=-1,n=Array(e.size);return e.forEach(function(t){n[++r]=t}),n},Cn=L?L.prototype:void 0,Xe=Cn?Cn.valueOf:void 0,Kt=function(e,r,n,t,a,i,s){switch(n){case"[object DataView]":if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=r.byteLength||!i(new Sn(e),new Sn(r)));case"[object Boolean]":case"[object Date]":case"[object Number]":return tr(+e,+r);case"[object Error]":return e.name==r.name&&e.message==r.message;case"[object RegExp]":case"[object String]":return e==r+"";case"[object Map]":var o=Ut;case"[object Set]":var u=1&t;if(o||(o=zt),e.size!=r.size&&!u)return!1;var l=s.get(e);if(l)return l==r;t|=2,s.set(e,r);var c=ur(o(e),o(r),t,a,i,s);return s.delete(e),c;case"[object Symbol]":if(Xe)return Xe.call(e)==Xe.call(r)}return!1},or=function(e,r){for(var n=-1,t=r.length,a=e.length;++n<t;)e[a+n]=r[n];return e},F=Array.isArray,Ht=function(e,r,n){var t=r(e);return F(e)?t:or(t,n(e))},Wt=function(e,r){for(var n=-1,t=e==null?0:e.length,a=0,i=[];++n<t;){var s=e[n];r(s,n,e)&&(i[a++]=s)}return i},Vt=function(){return[]},Xt=Object.prototype.propertyIsEnumerable,jn=Object.getOwnPropertySymbols,Jt=jn?function(e){return e==null?[]:(e=Object(e),Wt(jn(e),function(r){return Xt.call(e,r)}))}:Vt,Zt=function(e,r){for(var n=-1,t=Array(e);++n<e;)t[n]=r(n);return t},se=function(e){return e!=null&&typeof e=="object"},Tn=function(e){return se(e)&&ue(e)=="[object Arguments]"},lr=Object.prototype,Qt=lr.hasOwnProperty,Yt=lr.propertyIsEnumerable,$e=Tn(function(){return arguments}())?Tn:function(e){return se(e)&&Qt.call(e,"callee")&&!Yt.call(e,"callee")},qt=function(){return!1},Oe=ve(function(e,r){var n=r&&!r.nodeType&&r,t=n&&e&&!e.nodeType&&e,a=t&&t.exports===n?K.Buffer:void 0,i=(a?a.isBuffer:void 0)||qt;e.exports=i}),xt=/^(?:0|[1-9]\d*)$/,cr=function(e,r){var n=typeof e;return!!(r=r??9007199254740991)&&(n=="number"||n!="symbol"&&xt.test(e))&&e>-1&&e%1==0&&e<r},un=function(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=9007199254740991},P={};P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P["[object Arguments]"]=P["[object Array]"]=P["[object ArrayBuffer]"]=P["[object Boolean]"]=P["[object DataView]"]=P["[object Date]"]=P["[object Error]"]=P["[object Function]"]=P["[object Map]"]=P["[object Number]"]=P["[object Object]"]=P["[object RegExp]"]=P["[object Set]"]=P["[object String]"]=P["[object WeakMap]"]=!1;var ea=function(e){return se(e)&&un(e.length)&&!!P[ue(e)]},na=function(e){return function(r){return e(r)}},On=ve(function(e,r){var n=r&&!r.nodeType&&r,t=n&&e&&!e.nodeType&&e,a=t&&t.exports===n&&ar.process,i=function(){try{var s=t&&t.require&&t.require("util").types;return s||a&&a.binding&&a.binding("util")}catch{}}();e.exports=i}),An=On&&On.isTypedArray,on=An?na(An):ea,ra=Object.prototype.hasOwnProperty,ta=function(e,r){var n=F(e),t=!n&&$e(e),a=!n&&!t&&Oe(e),i=!n&&!t&&!a&&on(e),s=n||t||a||i,o=s?Zt(e.length,String):[],u=o.length;for(var l in e)!ra.call(e,l)||s&&(l=="length"||a&&(l=="offset"||l=="parent")||i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||cr(l,u))||o.push(l);return o},aa=Object.prototype,fr=function(e){var r=e&&e.constructor;return e===(typeof r=="function"&&r.prototype||aa)},ia=function(e,r){return function(n){return e(r(n))}}(Object.keys,Object),sa=Object.prototype.hasOwnProperty,hr=function(e){if(!fr(e))return ia(e);var r=[];for(var n in Object(e))sa.call(e,n)&&n!="constructor"&&r.push(n);return r},ke=function(e){return e!=null&&un(e.length)&&!sr(e)},ln=function(e){return ke(e)?ta(e):hr(e)},Dn=function(e){return Ht(e,ln,Jt)},ua=Object.prototype.hasOwnProperty,oa=function(e,r,n,t,a,i){var s=1&n,o=Dn(e),u=o.length;if(u!=Dn(r).length&&!s)return!1;for(var l=u;l--;){var c=o[l];if(!(s?c in r:ua.call(r,c)))return!1}var f=i.get(e),h=i.get(r);if(f&&h)return f==r&&h==e;var d=!0;i.set(e,r),i.set(r,e);for(var v=s;++l<u;){var b=e[c=o[l]],m=r[c];if(t)var _=s?t(m,b,c,r,e,i):t(b,m,c,e,r,i);if(!(_===void 0?b===m||a(b,m,n,t,i):_)){d=!1;break}v||(v=c=="constructor")}if(d&&!v){var w=e.constructor,y=r.constructor;w==y||!("constructor"in e)||!("constructor"in r)||typeof w=="function"&&w instanceof w&&typeof y=="function"&&y instanceof y||(d=!1)}return i.delete(e),i.delete(r),d},qe=q(K,"DataView"),xe=q(K,"Promise"),en=q(K,"Set"),nn=q(K,"WeakMap"),la=Y(qe),ca=Y(de),fa=Y(xe),ha=Y(en),da=Y(nn),Q=ue;(qe&&Q(new qe(new ArrayBuffer(1)))!="[object DataView]"||de&&Q(new de)!="[object Map]"||xe&&Q(xe.resolve())!="[object Promise]"||en&&Q(new en)!="[object Set]"||nn&&Q(new nn)!="[object WeakMap]")&&(Q=function(e){var r=ue(e),n=r=="[object Object]"?e.constructor:void 0,t=n?Y(n):"";if(t)switch(t){case la:return"[object DataView]";case ca:return"[object Map]";case fa:return"[object Promise]";case ha:return"[object Set]";case da:return"[object WeakMap]"}return r});var rn=Q,we="[object Object]",Mn=Object.prototype.hasOwnProperty,ga=function(e,r,n,t,a,i){var s=F(e),o=F(r),u=s?"[object Array]":rn(e),l=o?"[object Array]":rn(r),c=(u=u=="[object Arguments]"?we:u)==we,f=(l=l=="[object Arguments]"?we:l)==we,h=u==l;if(h&&Oe(e)){if(!Oe(r))return!1;s=!0,c=!1}if(h&&!c)return i||(i=new je),s||on(e)?ur(e,r,n,t,a,i):Kt(e,r,u,n,t,a,i);if(!(1&n)){var d=c&&Mn.call(e,"__wrapped__"),v=f&&Mn.call(r,"__wrapped__");if(d||v){var b=d?e.value():e,m=v?r.value():r;return i||(i=new je),a(b,m,n,t,i)}}return!!h&&(i||(i=new je),oa(e,r,n,t,a,i))},Ge=function e(r,n,t,a,i){return r===n||(r==null||n==null||!se(r)&&!se(n)?r!=r&&n!=n:ga(r,n,t,a,e,i))},va=function(e,r,n,t){var a=n.length,i=a;if(e==null)return!i;for(e=Object(e);a--;){var s=n[a];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++a<i;){var o=(s=n[a])[0],u=e[o],l=s[1];if(s[2]){if(u===void 0&&!(o in e))return!1}else{var c=new je,f;if(!(f===void 0?Ge(l,u,3,t,c):f))return!1}}return!0},dr=function(e){return e==e&&!he(e)},ma=function(e){for(var r=ln(e),n=r.length;n--;){var t=r[n],a=e[t];r[n]=[t,a,dr(a)]}return r},gr=function(e,r){return function(n){return n!=null&&n[e]===r&&(r!==void 0||e in Object(n))}},ba=function(e){var r=ma(e);return r.length==1&&r[0][2]?gr(r[0][0],r[0][1]):function(n){return n===e||va(n,e,r)}},Be=function(e){return typeof e=="symbol"||se(e)&&ue(e)=="[object Symbol]"},ya=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_a=/^\w*$/,cn=function(e,r){if(F(e))return!1;var n=typeof e;return!(n!="number"&&n!="symbol"&&n!="boolean"&&e!=null&&!Be(e))||_a.test(e)||!ya.test(e)||r!=null&&e in Object(r)};function fn(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new TypeError("Expected a function");var n=function(){var t=arguments,a=r?r.apply(this,t):t[0],i=n.cache;if(i.has(a))return i.get(a);var s=e.apply(this,t);return n.cache=i.set(a,s)||i,s};return n.cache=new(fn.Cache||Ie),n}fn.Cache=Ie;var wa=fn,pa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Na=/\\(\\)?/g,Sa=function(e){var r=wa(e,function(t){return n.size===500&&n.clear(),t}),n=r.cache;return r}(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(pa,function(n,t,a,i){r.push(a?i.replace(Na,"$1"):t||n)}),r}),vr=function(e,r){for(var n=-1,t=e==null?0:e.length,a=Array(t);++n<t;)a[n]=r(e[n],n,e);return a},En=L?L.prototype:void 0,Pn=En?En.toString:void 0,Ca=function e(r){if(typeof r=="string")return r;if(F(r))return vr(r,e)+"";if(Be(r))return Pn?Pn.call(r):"";var n=r+"";return n=="0"&&1/r==-1/0?"-0":n},ja=function(e){return e==null?"":Ca(e)},mr=function(e,r){return F(e)?e:cn(e,r)?[e]:Sa(ja(e))},Fe=function(e){if(typeof e=="string"||Be(e))return e;var r=e+"";return r=="0"&&1/e==-1/0?"-0":r},br=function(e,r){for(var n=0,t=(r=mr(r,e)).length;e!=null&&n<t;)e=e[Fe(r[n++])];return n&&n==t?e:void 0},Ta=function(e,r,n){var t=e==null?void 0:br(e,r);return t===void 0?n:t},Oa=function(e,r){return e!=null&&r in Object(e)},Aa=function(e,r,n){for(var t=-1,a=(r=mr(r,e)).length,i=!1;++t<a;){var s=Fe(r[t]);if(!(i=e!=null&&n(e,s)))break;e=e[s]}return i||++t!=a?i:!!(a=e==null?0:e.length)&&un(a)&&cr(s,a)&&(F(e)||$e(e))},Da=function(e,r){return e!=null&&Aa(e,r,Oa)},Ma=function(e,r){return cn(e)&&dr(r)?gr(Fe(e),r):function(n){var t=Ta(n,e);return t===void 0&&t===r?Da(n,e):Ge(r,t,3)}},Ea=function(e){return e},Pa=function(e){return function(r){return r?.[e]}},Ia=function(e){return function(r){return br(r,e)}},$a=function(e){return cn(e)?Pa(Fe(e)):Ia(e)},Re=function(e){return typeof e=="function"?e:e==null?Ea:typeof e=="object"?F(e)?Ma(e[0],e[1]):ba(e):$a(e)},ka=/\s/,Ga=function(e){for(var r=e.length;r--&&ka.test(e.charAt(r)););return r},Ba=/^\s+/,Fa=function(e){return e&&e.slice(0,Ga(e)+1).replace(Ba,"")},Ra=/^[-+]0x[0-9a-f]+$/i,La=/^0b[01]+$/i,Ua=/^0o[0-7]+$/i,za=parseInt,Ka=function(e){if(typeof e=="number")return e;if(Be(e))return NaN;if(he(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=he(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=Fa(e);var n=La.test(e);return n||Ua.test(e)?za(e.slice(2),n?2:8):Ra.test(e)?NaN:+e},Ha=function(e){return e?(e=Ka(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:e===0?e:0},Wa=function(e){var r=Ha(e),n=r%1;return r==r?n?r-n:r:0};function V(e){if(!e)throw new Error("change is not provided");if(z(e))return"N".concat(e.oldLineNumber);var r=J(e)?"I":"D";return"".concat(r).concat(e.lineNumber)}sn("old");var Le=fe("old"),Ue=fe("new");rr("old");rr("new");sn("new");sn("old");var In=function(){try{var e=q(Object,"defineProperty");return e({},"",{}),e}catch{}}(),hn=function(e,r,n){r=="__proto__"&&In?In(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n},Va=function(e){return function(r,n,t){for(var a=-1,i=Object(r),s=t(r),o=s.length;o--;){var u=s[++a];if(n(i[u],u,i)===!1)break}return r}},Xa=Va(),yr=function(e,r){return e&&Xa(e,r,ln)},_r=function(e,r){var n={};return r=Re(r),yr(e,function(t,a,i){hn(n,a,r(t,a,i))}),n},Ja=["changeKey","text","tokens","renderToken"],$n=function e(r,n){var t=r.type,a=r.value,i=r.markType,s=r.properties,o=r.className,u=r.children,l=function(f){return g.jsx("span",{className:f,children:a||u&&u.map(e)},n)};switch(t){case"text":return a;case"mark":return l("diff-code-mark diff-code-mark-".concat(i));case"edit":return l("diff-code-edit");default:var c=s&&s.className;return l($(o||c))}};function Za(e){if(!Array.isArray(e))return!0;if(e.length>1)return!1;if(e.length===1){var r=T(e,1)[0];return r.type==="text"&&!r.value}return!0}function Qa(e){var r=e.changeKey,n=e.text,t=e.tokens,a=e.renderToken,i=X(e,Ja),s=a?function(o,u){return a(o,$n,u)}:$n;return g.jsx("td",D(D({},i),{},{"data-change-key":r,children:t?Za(t)?" ":t.map(s):n||" "}))}var wr=E.memo(Qa);function pr(e,r){return function(){var n=r==="old"?Le(e):Ue(e);return n===-1?void 0:n}}function Nr(e,r){return function(n){return e&&n?g.jsx("a",{href:r?"#"+r:void 0,children:n}):n}}function Ae(e,r){return r?function(n){e(),r(n)}:e}function kn(e,r,n,t){return E.useMemo(function(){var a=_r(e,function(i){return function(s){return i&&i(r,s)}});return a.onMouseEnter=Ae(n,a.onMouseEnter),a.onMouseLeave=Ae(t,a.onMouseLeave),a},[e,n,t,r])}function Gn(e,r,n,t,a,i,s,o,u){var l={change:r,side:t,inHoverState:o,renderDefault:pr(r,t),wrapInAnchor:Nr(a,i)};return g.jsx("td",D(D({className:e},s),{},{"data-change-key":n,children:u(l)}))}function Ya(e){var r,n,t,a=e.change,i=e.selected,s=e.tokens,o=e.className,u=e.generateLineClassName,l=e.gutterClassName,c=e.codeClassName,f=e.gutterEvents,h=e.codeEvents,d=e.hideGutter,v=e.gutterAnchor,b=e.generateAnchorID,m=e.renderToken,_=e.renderGutter,w=a.type,y=a.content,N=V(a),p=(r=T(E.useState(!1),2),n=r[0],t=r[1],[n,E.useCallback(function(){return t(!0)},[]),E.useCallback(function(){return t(!1)},[])]),C=T(p,3),S=C[0],O=C[1],j=C[2],A=E.useMemo(function(){return{change:a}},[a]),M=kn(f,A,O,j),U=kn(h,A,O,j),I=b(a),R=u({changes:[a],defaultGenerate:function(){return o}}),H=$("diff-gutter","diff-gutter-".concat(w),l,{"diff-gutter-selected":i}),x=$("diff-code","diff-code-".concat(w),c,{"diff-code-selected":i});return g.jsxs("tr",{id:I,className:$("diff-line",R),children:[!d&&Gn(H,a,N,"old",v,I,M,S,_),!d&&Gn(H,a,N,"new",v,I,M,S,_),g.jsx(wr,D({className:x,changeKey:N,text:y,tokens:s,renderToken:m},U))]})}var qa=E.memo(Ya);function xa(e){var r=e.hideGutter,n=e.element;return g.jsx("tr",{className:"diff-widget",children:g.jsx("td",{colSpan:r?1:3,className:"diff-widget-content",children:n})})}var ei=["hideGutter","selectedChanges","tokens","lineClassName"],ni=["hunk","widgets","className"];function ri(e){var r=e.hunk,n=e.widgets,t=e.className,a=X(e,ni),i=function(s,o){return s.reduce(function(u,l){var c=V(l);u.push(["change",c,l]);var f=o[c];return f&&u.push(["widget",c,f]),u},[])}(r.changes,n);return g.jsx("tbody",{className:$("diff-hunk",t),children:i.map(function(s){return function(o,u){var l=T(o,3),c=l[0],f=l[1],h=l[2],d=u.hideGutter,v=u.selectedChanges,b=u.tokens,m=u.lineClassName,_=X(u,ei);if(c==="change"){var w=B(h)?"old":"new",y=B(h)?Le(h):Ue(h),N=b?b[w][y-1]:null;return g.jsx(qa,D({className:m,change:h,hideGutter:d,selected:v.includes(f),tokens:N},_),"change".concat(f))}return c==="widget"?g.jsx(xa,{hideGutter:d,element:h},"widget".concat(f)):null}(s,a)})})}var Sr=0;function pe(e,r,n,t){var a=E.useCallback(function(){return r(e)},[e,r]),i=E.useCallback(function(){return r("")},[r]);return E.useMemo(function(){var s=_r(t,function(o){return function(u){return o&&o({side:e,change:n},u)}});return s.onMouseEnter=Ae(a,s.onMouseEnter),s.onMouseLeave=Ae(i,s.onMouseLeave),s},[n,t,a,e,i])}function Je(e){var r=e.change,n=e.side,t=e.selected,a=e.tokens,i=e.gutterClassName,s=e.codeClassName,o=e.gutterEvents,u=e.codeEvents,l=e.anchorID,c=e.gutterAnchor,f=e.gutterAnchorTarget,h=e.hideGutter,d=e.hover,v=e.renderToken,b=e.renderGutter;if(!r){var m=$("diff-gutter","diff-gutter-omit",i),_=$("diff-code","diff-code-omit",s);return[!h&&g.jsx("td",{className:m},"gutter"),g.jsx("td",{className:_},"code")]}var w=r.type,y=r.content,N=V(r),p=n===Sr?"old":"new",C=D({id:l||void 0,className:$("diff-gutter","diff-gutter-".concat(w),Ze({"diff-gutter-selected":t},"diff-line-hover-"+p,d),i),children:b({change:r,side:p,inHoverState:d,renderDefault:pr(r,p),wrapInAnchor:Nr(c,f)})},o),S=$("diff-code","diff-code-".concat(w),Ze({"diff-code-selected":t},"diff-line-hover-"+p,d),s);return[!h&&g.jsx("td",D(D({},C),{},{"data-change-key":N}),"gutter"),g.jsx(wr,D({className:S,changeKey:N,text:y,tokens:a,renderToken:v},u),"code")]}function ti(e){var r=e.className,n=e.oldChange,t=e.newChange,a=e.oldSelected,i=e.newSelected,s=e.oldTokens,o=e.newTokens,u=e.monotonous,l=e.gutterClassName,c=e.codeClassName,f=e.gutterEvents,h=e.codeEvents,d=e.hideGutter,v=e.generateAnchorID,b=e.generateLineClassName,m=e.gutterAnchor,_=e.renderToken,w=e.renderGutter,y=T(E.useState(""),2),N=y[0],p=y[1],C=pe("old",p,n,f),S=pe("new",p,t,f),O=pe("old",p,n,h),j=pe("new",p,t,h),A=n&&v(n),M=t&&v(t),U=b({changes:[n,t],defaultGenerate:function(){return r}}),I={monotonous:u,hideGutter:d,gutterClassName:l,codeClassName:c,gutterEvents:f,codeEvents:h,renderToken:_,renderGutter:w},R=D(D({},I),{},{change:n,side:Sr,selected:a,tokens:s,gutterEvents:C,codeEvents:O,anchorID:A,gutterAnchor:m,gutterAnchorTarget:A,hover:N==="old"}),H=D(D({},I),{},{change:t,side:1,selected:i,tokens:o,gutterEvents:S,codeEvents:j,anchorID:n===t?null:M,gutterAnchor:m,gutterAnchorTarget:n===t?A:M,hover:N==="new"});if(u)return g.jsx("tr",{className:$("diff-line",U),children:Je(n?R:H)});var x=function(ee,oe){return ee&&!oe?"diff-line-old-only":!ee&&oe?"diff-line-new-only":ee===oe?"diff-line-normal":"diff-line-compare"}(n,t);return g.jsxs("tr",{className:$("diff-line",x,U),children:[Je(R),Je(H)]})}var ai=E.memo(ti);function ii(e){var r=e.hideGutter,n=e.oldElement,t=e.newElement;return e.monotonous?g.jsx("tr",{className:"diff-widget",children:g.jsx("td",{colSpan:r?1:2,className:"diff-widget-content",children:n||t})}):n===t?g.jsx("tr",{className:"diff-widget",children:g.jsx("td",{colSpan:r?2:4,className:"diff-widget-content",children:n})}):g.jsxs("tr",{className:"diff-widget",children:[g.jsx("td",{colSpan:r?1:2,className:"diff-widget-content",children:n}),g.jsx("td",{colSpan:r?1:2,className:"diff-widget-content",children:t})]})}var si=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],ui=["hunk","widgets","className"];function Ne(e,r){return(e?V(e):"00")+(r?V(r):"00")}function oi(e){var r=e.hunk,n=e.widgets,t=e.className,a=X(e,ui),i=function(s,o){for(var u=function(_){if(!_)return null;var w=V(_);return o[w]||null},l=[],c=0;c<s.length;c++){var f=s[c];if(z(f))l.push(["change",Ne(f,f),f,f]);else if(B(f)){var h=s[c+1];h&&J(h)?(c+=1,l.push(["change",Ne(f,h),f,h])):l.push(["change",Ne(f,null),f,null])}else l.push(["change",Ne(null,f),null,f]);var d=l[l.length-1],v=u(d[2]),b=u(d[3]);if(v||b){var m=d[1];l.push(["widget",m,v,b])}}return l}(r.changes,n);return g.jsx("tbody",{className:$("diff-hunk",t),children:i.map(function(s){return function(o,u){var l=T(o,4),c=l[0],f=l[1],h=l[2],d=l[3],v=u.selectedChanges,b=u.monotonous,m=u.hideGutter,_=u.tokens,w=u.lineClassName,y=X(u,si);if(c==="change"){var N=!!h&&v.includes(V(h)),p=!!d&&v.includes(V(d)),C=h&&_?_.old[Le(h)-1]:null,S=d&&_?_.new[Ue(d)-1]:null;return g.jsx(ai,D({className:w,oldChange:h,newChange:d,monotonous:b,hideGutter:m,oldSelected:N,newSelected:p,oldTokens:C,newTokens:S},y),"change".concat(f))}return c==="widget"?g.jsx(ii,{monotonous:b,hideGutter:m,oldElement:h,newElement:d},"widget".concat(f)):null}(s,a)})})}var li=["gutterType","hunkClassName"];function Cr(e){var r=e.hunk,n=er(),t=n.gutterType,a=n.hunkClassName,i=X(n,li),s=t==="none",o=t==="anchor",u=i.viewType==="unified"?ri:oi;return g.jsx(u,D(D({},i),{},{hunk:r,hideGutter:s,gutterAnchor:o,className:a}))}function ci(){}function Bn(e,r){var n=r?"auto":"none";e instanceof HTMLElement&&e.style.userSelect!==n&&(e.style.userSelect=n)}function fi(e){return e.map(function(r){return g.jsx(Cr,{hunk:r},function(n){return"-".concat(n.oldStart,",").concat(n.oldLines," +").concat(n.newStart,",").concat(n.newLines)}(r))})}function hi(e){var r=e.diffType,n=e.hunks,t=e.optimizeSelection,a=e.className,i=e.hunkClassName,s=i===void 0?k.hunkClassName:i,o=e.lineClassName,u=o===void 0?k.lineClassName:o,l=e.generateLineClassName,c=l===void 0?k.generateLineClassName:l,f=e.gutterClassName,h=f===void 0?k.gutterClassName:f,d=e.codeClassName,v=d===void 0?k.codeClassName:d,b=e.gutterType,m=b===void 0?k.gutterType:b,_=e.viewType,w=_===void 0?k.viewType:_,y=e.gutterEvents,N=y===void 0?k.gutterEvents:y,p=e.codeEvents,C=p===void 0?k.codeEvents:p,S=e.generateAnchorID,O=S===void 0?k.generateAnchorID:S,j=e.selectedChanges,A=j===void 0?k.selectedChanges:j,M=e.widgets,U=M===void 0?k.widgets:M,I=e.renderGutter,R=I===void 0?k.renderGutter:I,H=e.tokens,x=e.renderToken,ee=e.children,oe=ee===void 0?fi:ee,Ke=E.useRef(null),Er=E.useCallback(function(vn){var kr=vn.target;if(vn.button===0){var me=function(He,Gr){for(var Z=He;Z&&Z!==document.documentElement&&!Z.classList.contains(Gr);)Z=Z.parentElement;return Z===document.documentElement?null:Z}(kr,"diff-code");if(me&&me.parentElement){var mn=window.getSelection();mn&&mn.removeAllRanges();var be=G(me.parentElement.children).indexOf(me);if(be===1||be===3){var bn,ye=an(Ke.current?Ke.current.querySelectorAll(".diff-line"):[]);try{for(ye.s();!(bn=ye.n()).done;){var yn=bn.value.children;Bn(yn[1],be===1),Bn(yn[3],be===3)}}catch(He){ye.e(He)}finally{ye.f()}}}}},[]),W=m==="none",le=r==="add"||r==="delete",Pr=w==="split"&&!le&&t?Er:ci,Ir=E.useMemo(function(){return g.jsxs("colgroup",w==="unified"?{children:[!W&&g.jsx("col",{className:"diff-gutter-col"}),!W&&g.jsx("col",{className:"diff-gutter-col"}),g.jsx("col",{})]}:le?{children:[!W&&g.jsx("col",{className:"diff-gutter-col"}),g.jsx("col",{})]}:{children:[!W&&g.jsx("col",{className:"diff-gutter-col"}),g.jsx("col",{}),!W&&g.jsx("col",{className:"diff-gutter-col"}),g.jsx("col",{})]})},[w,le,W]),$r=E.useMemo(function(){return{hunkClassName:s,lineClassName:u,generateLineClassName:c,gutterClassName:h,codeClassName:v,monotonous:le,hideGutter:W,viewType:w,gutterType:m,codeEvents:C,gutterEvents:N,generateAnchorID:O,selectedChanges:A,widgets:U,renderGutter:R,tokens:H,renderToken:x}},[v,C,O,h,N,m,W,s,u,c,le,R,x,A,H,w,U]);return g.jsx(zr,{value:$r,children:g.jsxs("table",{ref:Ke,className:$("diff","diff-".concat(w),a),onMouseDown:Pr,children:[Ir,oe(n)]})})}var di=E.memo(hi);function gi(e){var r=e.hideGutter,n=e.monotonous,t=e.className,a=e.gutterClassName,i=e.contentClassName,s=e.children,o=$("diff-decoration",t),u=$("diff-decoration-gutter",a),l=$("diff-decoration-content",i),c=(r?2:4)/(n?2:1),f=c-(r?0:1);if(E.Children.count(s)===1)return g.jsx("tbody",{className:o,children:g.jsx("tr",{children:g.jsx("td",{colSpan:c,className:l,children:s})})});var h=T(s,2),d=h[0],v=h[1];return g.jsx("tbody",{className:o,children:g.jsxs("tr",{children:[!r&&g.jsx("td",{className:u,children:d}),g.jsx("td",{colSpan:f,className:l,children:v})]})})}function vi(e){var r=e.hideGutter,n=e.className,t=e.gutterClassName,a=e.contentClassName,i=e.children,s=$("diff-decoration",n),o=$("diff-decoration-gutter",t),u=$("diff-decoration-content",a);if(E.Children.count(i)===1)return g.jsx("tbody",{className:s,children:g.jsx("tr",{children:g.jsx("td",{colSpan:r?1:3,className:u,children:i})})});var l=T(i,2),c=l[0],f=l[1];return g.jsx("tbody",{className:s,children:g.jsxs("tr",{children:[!r&&g.jsx("td",{colSpan:2,className:o,children:c}),g.jsx("td",{className:u,children:f})]})})}function mi(e){var r=e.className,n=r===void 0?"":r,t=e.gutterClassName,a=t===void 0?"":t,i=e.contentClassName,s=i===void 0?"":i,o=e.children,u=er(),l=u.viewType,c=u.gutterType,f=u.monotonous,h=l==="split"?gi:vi;E.Children.count(o);var d=c==="none";return g.jsx(h,{hideGutter:d,monotonous:f,className:n,gutterClassName:a,contentClassName:s,children:o})}var bi=function(e,r,n,t){for(var a=-1,i=e==null?0:e.length;++a<i;){var s=e[a];r(t,s,n(s),e)}return t},yi=function(e,r){return function(n,t){if(n==null)return n;if(!ke(n))return e(n,t);for(var a=n.length,i=-1,s=Object(n);++i<a&&t(s[i],i,s)!==!1;);return n}},jr=yi(yr),_i=function(e,r,n,t){return jr(e,function(a,i,s){r(t,a,n(a),s)}),t},Tr=function(e,r){return function(n,t){var a=F(n)?bi:_i,i=r?r():{};return a(n,e,Re(t),i)}},wi=Tr(function(e,r,n){hn(e,n,r)}),Fn=L?L.isConcatSpreadable:void 0,pi=function(e){return F(e)||$e(e)||!!(Fn&&e&&e[Fn])},Or=function(r,n,t,a,i){var s=-1,o=r.length;for(t||(t=pi),i||(i=[]);++s<o;){var u=r[s];t(u)?or(i,u):i[i.length]=u}return i},Ni=function(e,r){var n=-1,t=ke(e)?Array(e.length):[];return jr(e,function(a,i,s){t[++n]=r(a,i,s)}),t},Si=function(e,r){return(F(e)?vr:Ni)(e,Re(r))},dn=function(e,r){return Or(Si(e,r))};function Ci(e,r){var n=r.newStart,t=r.changes.reduce(function(a,i){var s=T(a,2),o=s[0],u=s[1];return B(i)?(o.splice(u,1),[o,u]):(J(i)&&o.splice(u,0,i.content),[o,u+1])},[e,n-1]);return T(t,1)[0]}function Rn(e,r,n){if(!e.length)return[];var t=r==="old"?Le:Ue,a=wi(e,t),i=t(e[e.length-1]);return Array.from({length:i}).map(function(s,o){return n(a[o+1])})}function ji(e){var r=function(s){return dn(s,function(o){return o.changes}).reduce(function(o,u){var l=T(o,2),c=l[0],f=l[1];return z(u)?(c.push(u),f.push(u)):B(u)?c.push(u):f.push(u),[c,f]},[[],[]])}(e),n=T(r,2),t=n[0],a=n[1],i=function(s){return s?s.content:""};return[Rn(t,"old",i).join(`
|
|
13
|
+
`),Rn(a,"new",i).join(`
|
|
14
|
+
`)]}function Se(e){return{type:"root",children:e}}function Ti(e,r){if(r.oldSource){var n=function(u,l){return l.reduce(Ci,u.split(`
|
|
15
|
+
`)).join(`
|
|
16
|
+
`)}(r.oldSource,e),t=r.highlight?function(u){return r.refractor.highlight(u,r.language)}:function(u){return[{type:"text",value:u}]};return[Se(t(r.oldSource)),Se(t(n))]}var a=T(ji(e),2),i=a[0],s=a[1],o=r.highlight?function(u){return Se(r.refractor.highlight(u,r.language))}:function(u){return Se([{type:"text",value:u}])};return[o(i),o(s)]}function ie(e){return e.map(function(r){return D({},r)})}function Oi(e,r){return[].concat(G(ie(e.slice(0,-1))),[r])}function gn(e){var r=e[e.length-1];if(r.type==="text")return r;throw new Error("Invalid token path with leaf of type ".concat(r.type))}function Ai(e,r,n,t){var a=e.slice(0,-1),i=gn(e),s=[];if(n<=0||r>=i?.value.length)return[e];var o=function(f,h){var d=i.value.slice(f,h);return[].concat(G(a),[D(D({},i),{},{value:d})])};if(r>0){var u=o(0,r);s.push(ie(u))}var l=o(Math.max(r,0),n);if(s.push(t?function(f,h){return[h].concat(G(ie(f)))}(l,t):ie(l)),n<i.value.length){var c=o(n);s.push(ie(c))}return s}var Di=["children"];function Ar(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var t=e.children,a=X(e,Di);n.push(a);var i,s=an(t);try{for(s.s();!(i=s.n()).done;)Ar(i.value,r,n)}catch(o){s.e(o)}finally{s.f()}n.pop()}else r.push(ie([].concat(G(n.slice(1)),[e])));return r}function Mi(e){return e.reduce(function(r,n){var t=r[r.length-1],a=function(u){var l=gn(u);return l.value.includes(`
|
|
17
|
+
`)?l.value.split(`
|
|
18
|
+
`).map(function(c){return Oi(u,D(D({},l),{},{value:c}))}):[u]}(n),i=Zn(a),s=i[0],o=i.slice(1);return[].concat(G(r.slice(0,-1)),[[].concat(G(t),[s])],G(o.map(function(u){return[u]})))},[[]])}function Ln(e){return Mi(Ar(e))}var Ei=function(e,r,n){var t=(n=typeof n=="function"?n:void 0)?n(e,r):void 0;return t===void 0?Ge(e,r,void 0,n):!!t},Pi=function(e,r){return Ge(e,r)},Ii=function(e){var r=e==null?0:e.length;return r?e[r-1]:void 0};function $i(e,r){if(!e.children)throw new Error("parent node missing children property");var n,t,a=Ii(e.children);return a&&(t=r,(n=a).type===t.type&&(n.type==="text"||n.children&&t.children&&Ei(n,t,function(i,s,o){return o==="chlidren"||Pi(i,s)})))?e.children[e.children.length-1]=function(i,s){return"value"in i&&"value"in s?D(D({},i),{},{value:"".concat(i.value).concat(s.value)}):i}(a,r):e.children.push(r),e.children[e.children.length-1]}function Un(e){var r,n={type:"root",children:[]},t=an(e);try{var a=function(){var i=r.value;i.reduce(function(s,o,u){return $i(s,u===i.length-1?D({},o):D(D({},o),{},{children:[]}))},n)};for(t.s();!(r=t.n()).done;)a()}catch(i){t.e(i)}finally{t.f()}return n}var ki=Object.prototype.hasOwnProperty,Gi=Tr(function(e,r,n){ki.call(e,n)?e[n].push(r):hn(e,n,[r])}),Bi=Object.prototype.hasOwnProperty,Fi=function(e){if(e==null)return!0;if(ke(e)&&(F(e)||typeof e=="string"||typeof e.splice=="function"||Oe(e)||on(e)||$e(e)))return!e.length;var r=rn(e);if(r=="[object Map]"||r=="[object Set]")return!e.size;if(fr(e))return!hr(e).length;for(var n in e)if(Bi.call(e,n))return!1;return!0},Ri=function(e,r){var n=r.start,t=r.length,a=n+t,i=e.reduce(function(s,o){var u=T(s,2),l=u[0],c=u[1],f=c+gn(o).value.length;if(c>a||f<n)l.push(o);else{var h=Ai(o,n-c,a-c,r);l.push.apply(l,G(h))}return[l,f]},[[],0]);return T(i,1)[0]};function zn(e,r){var n=Gi(r,"lineNumber");return e.map(function(t,a){return function(i,s){return Fi(s)?i:s.reduce(Ri,i)}(t,n[a+1])})}function Li(e,r){return function(n){var t=T(n,2),a=t[0],i=t[1];return[zn(a,e),zn(i,r)]}}var Kn=function(e){return e!=null&&e.length?Or(e):[]},Ui=Math.max,Hn=function(e,r,n){var t=e==null?0:e.length;if(!t)return-1;var a=n==null?0:Wa(n);return a<0&&(a=Ui(t+a,0)),Zr(e,Re(r),a)},ze=ve(function(e){var r=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32};r.Diff=function(n,t){return[n,t]},r.prototype.diff_main=function(n,t,a,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+1e3*this.Diff_Timeout);var s=i;if(n==null||t==null)throw new Error("Null input. (diff_main)");if(n==t)return n?[new r.Diff(0,n)]:[];a===void 0&&(a=!0);var o=a,u=this.diff_commonPrefix(n,t),l=n.substring(0,u);n=n.substring(u),t=t.substring(u),u=this.diff_commonSuffix(n,t);var c=n.substring(n.length-u);n=n.substring(0,n.length-u),t=t.substring(0,t.length-u);var f=this.diff_compute_(n,t,o,s);return l&&f.unshift(new r.Diff(0,l)),c&&f.push(new r.Diff(0,c)),this.diff_cleanupMerge(f),f},r.prototype.diff_compute_=function(n,t,a,i){var s;if(!n)return[new r.Diff(1,t)];if(!t)return[new r.Diff(-1,n)];var o=n.length>t.length?n:t,u=n.length>t.length?t:n,l=o.indexOf(u);if(l!=-1)return s=[new r.Diff(1,o.substring(0,l)),new r.Diff(0,u),new r.Diff(1,o.substring(l+u.length))],n.length>t.length&&(s[0][0]=s[2][0]=-1),s;if(u.length==1)return[new r.Diff(-1,n),new r.Diff(1,t)];var c=this.diff_halfMatch_(n,t);if(c){var f=c[0],h=c[1],d=c[2],v=c[3],b=c[4],m=this.diff_main(f,d,a,i),_=this.diff_main(h,v,a,i);return m.concat([new r.Diff(0,b)],_)}return a&&n.length>100&&t.length>100?this.diff_lineMode_(n,t,i):this.diff_bisect_(n,t,i)},r.prototype.diff_lineMode_=function(n,t,a){var i=this.diff_linesToChars_(n,t);n=i.chars1,t=i.chars2;var s=i.lineArray,o=this.diff_main(n,t,!1,a);this.diff_charsToLines_(o,s),this.diff_cleanupSemantic(o),o.push(new r.Diff(0,""));for(var u=0,l=0,c=0,f="",h="";u<o.length;){switch(o[u][0]){case 1:c++,h+=o[u][1];break;case-1:l++,f+=o[u][1];break;case 0:if(l>=1&&c>=1){o.splice(u-l-c,l+c),u=u-l-c;for(var d=this.diff_main(f,h,!1,a),v=d.length-1;v>=0;v--)o.splice(u,0,d[v]);u+=d.length}c=0,l=0,f="",h=""}u++}return o.pop(),o},r.prototype.diff_bisect_=function(n,t,a){for(var i=n.length,s=t.length,o=Math.ceil((i+s)/2),u=o,l=2*o,c=new Array(l),f=new Array(l),h=0;h<l;h++)c[h]=-1,f[h]=-1;c[u+1]=0,f[u+1]=0;for(var d=i-s,v=d%2!=0,b=0,m=0,_=0,w=0,y=0;y<o&&!(new Date().getTime()>a);y++){for(var N=-y+b;N<=y-m;N+=2){for(var p=u+N,C=(M=N==-y||N!=y&&c[p-1]<c[p+1]?c[p+1]:c[p-1]+1)-N;M<i&&C<s&&n.charAt(M)==t.charAt(C);)M++,C++;if(c[p]=M,M>i)m+=2;else if(C>s)b+=2;else if(v&&(j=u+d-N)>=0&&j<l&&f[j]!=-1&&M>=(O=i-f[j]))return this.diff_bisectSplit_(n,t,M,C,a)}for(var S=-y+_;S<=y-w;S+=2){for(var O,j=u+S,A=(O=S==-y||S!=y&&f[j-1]<f[j+1]?f[j+1]:f[j-1]+1)-S;O<i&&A<s&&n.charAt(i-O-1)==t.charAt(s-A-1);)O++,A++;if(f[j]=O,O>i)w+=2;else if(A>s)_+=2;else if(!v&&(p=u+d-S)>=0&&p<l&&c[p]!=-1){var M;if(C=u+(M=c[p])-p,M>=(O=i-O))return this.diff_bisectSplit_(n,t,M,C,a)}}}return[new r.Diff(-1,n),new r.Diff(1,t)]},r.prototype.diff_bisectSplit_=function(n,t,a,i,s){var o=n.substring(0,a),u=t.substring(0,i),l=n.substring(a),c=t.substring(i),f=this.diff_main(o,u,!1,s),h=this.diff_main(l,c,!1,s);return f.concat(h)},r.prototype.diff_linesToChars_=function(n,t){var a=[],i={};function s(l){for(var c="",f=0,h=-1,d=a.length;h<l.length-1;){(h=l.indexOf(`
|
|
19
|
+
`,f))==-1&&(h=l.length-1);var v=l.substring(f,h+1);(i.hasOwnProperty?i.hasOwnProperty(v):i[v]!==void 0)?c+=String.fromCharCode(i[v]):(d==o&&(v=l.substring(f),h=l.length),c+=String.fromCharCode(d),i[v]=d,a[d++]=v),f=h+1}return c}a[0]="";var o=4e4,u=s(n);return o=65535,{chars1:u,chars2:s(t),lineArray:a}},r.prototype.diff_charsToLines_=function(n,t){for(var a=0;a<n.length;a++){for(var i=n[a][1],s=[],o=0;o<i.length;o++)s[o]=t[i.charCodeAt(o)];n[a][1]=s.join("")}},r.prototype.diff_commonPrefix=function(n,t){if(!n||!t||n.charAt(0)!=t.charAt(0))return 0;for(var a=0,i=Math.min(n.length,t.length),s=i,o=0;a<s;)n.substring(o,s)==t.substring(o,s)?o=a=s:i=s,s=Math.floor((i-a)/2+a);return s},r.prototype.diff_commonSuffix=function(n,t){if(!n||!t||n.charAt(n.length-1)!=t.charAt(t.length-1))return 0;for(var a=0,i=Math.min(n.length,t.length),s=i,o=0;a<s;)n.substring(n.length-s,n.length-o)==t.substring(t.length-s,t.length-o)?o=a=s:i=s,s=Math.floor((i-a)/2+a);return s},r.prototype.diff_commonOverlap_=function(n,t){var a=n.length,i=t.length;if(a==0||i==0)return 0;a>i?n=n.substring(a-i):a<i&&(t=t.substring(0,a));var s=Math.min(a,i);if(n==t)return s;for(var o=0,u=1;;){var l=n.substring(s-u),c=t.indexOf(l);if(c==-1)return o;u+=c,c!=0&&n.substring(s-u)!=t.substring(0,u)||(o=u,u++)}},r.prototype.diff_halfMatch_=function(n,t){if(this.Diff_Timeout<=0)return null;var a=n.length>t.length?n:t,i=n.length>t.length?t:n;if(a.length<4||2*i.length<a.length)return null;var s=this;function o(b,m,_){for(var w,y,N,p,C=b.substring(_,_+Math.floor(b.length/4)),S=-1,O="";(S=m.indexOf(C,S+1))!=-1;){var j=s.diff_commonPrefix(b.substring(_),m.substring(S)),A=s.diff_commonSuffix(b.substring(0,_),m.substring(0,S));O.length<A+j&&(O=m.substring(S-A,S)+m.substring(S,S+j),w=b.substring(0,_-A),y=b.substring(_+j),N=m.substring(0,S-A),p=m.substring(S+j))}return 2*O.length>=b.length?[w,y,N,p,O]:null}var u,l,c,f,h,d=o(a,i,Math.ceil(a.length/4)),v=o(a,i,Math.ceil(a.length/2));return d||v?(u=v?d&&d[4].length>v[4].length?d:v:d,n.length>t.length?(l=u[0],c=u[1],f=u[2],h=u[3]):(f=u[0],h=u[1],l=u[2],c=u[3]),[l,c,f,h,u[4]]):null},r.prototype.diff_cleanupSemantic=function(n){for(var t=!1,a=[],i=0,s=null,o=0,u=0,l=0,c=0,f=0;o<n.length;)n[o][0]==0?(a[i++]=o,u=c,l=f,c=0,f=0,s=n[o][1]):(n[o][0]==1?c+=n[o][1].length:f+=n[o][1].length,s&&s.length<=Math.max(u,l)&&s.length<=Math.max(c,f)&&(n.splice(a[i-1],0,new r.Diff(-1,s)),n[a[i-1]+1][0]=1,i--,o=--i>0?a[i-1]:-1,u=0,l=0,c=0,f=0,s=null,t=!0)),o++;for(t&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o<n.length;){if(n[o-1][0]==-1&&n[o][0]==1){var h=n[o-1][1],d=n[o][1],v=this.diff_commonOverlap_(h,d),b=this.diff_commonOverlap_(d,h);v>=b?(v>=h.length/2||v>=d.length/2)&&(n.splice(o,0,new r.Diff(0,d.substring(0,v))),n[o-1][1]=h.substring(0,h.length-v),n[o+1][1]=d.substring(v),o++):(b>=h.length/2||b>=d.length/2)&&(n.splice(o,0,new r.Diff(0,h.substring(0,b))),n[o-1][0]=1,n[o-1][1]=d.substring(0,d.length-b),n[o+1][0]=-1,n[o+1][1]=h.substring(b),o++),o++}o++}},r.prototype.diff_cleanupSemanticLossless=function(n){function t(b,m){if(!b||!m)return 6;var _=b.charAt(b.length-1),w=m.charAt(0),y=_.match(r.nonAlphaNumericRegex_),N=w.match(r.nonAlphaNumericRegex_),p=y&&_.match(r.whitespaceRegex_),C=N&&w.match(r.whitespaceRegex_),S=p&&_.match(r.linebreakRegex_),O=C&&w.match(r.linebreakRegex_),j=S&&b.match(r.blanklineEndRegex_),A=O&&m.match(r.blanklineStartRegex_);return j||A?5:S||O?4:y&&!p&&C?3:p||C?2:y||N?1:0}for(var a=1;a<n.length-1;){if(n[a-1][0]==0&&n[a+1][0]==0){var i=n[a-1][1],s=n[a][1],o=n[a+1][1],u=this.diff_commonSuffix(i,s);if(u){var l=s.substring(s.length-u);i=i.substring(0,i.length-u),s=l+s.substring(0,s.length-u),o=l+o}for(var c=i,f=s,h=o,d=t(i,s)+t(s,o);s.charAt(0)===o.charAt(0);){i+=s.charAt(0),s=s.substring(1)+o.charAt(0),o=o.substring(1);var v=t(i,s)+t(s,o);v>=d&&(d=v,c=i,f=s,h=o)}n[a-1][1]!=c&&(c?n[a-1][1]=c:(n.splice(a-1,1),a--),n[a][1]=f,h?n[a+1][1]=h:(n.splice(a+1,1),a--))}a++}},r.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,r.whitespaceRegex_=/\s/,r.linebreakRegex_=/[\r\n]/,r.blanklineEndRegex_=/\n\r?\n$/,r.blanklineStartRegex_=/^\r?\n\r?\n/,r.prototype.diff_cleanupEfficiency=function(n){for(var t=!1,a=[],i=0,s=null,o=0,u=!1,l=!1,c=!1,f=!1;o<n.length;)n[o][0]==0?(n[o][1].length<this.Diff_EditCost&&(c||f)?(a[i++]=o,u=c,l=f,s=n[o][1]):(i=0,s=null),c=f=!1):(n[o][0]==-1?f=!0:c=!0,s&&(u&&l&&c&&f||s.length<this.Diff_EditCost/2&&u+l+c+f==3)&&(n.splice(a[i-1],0,new r.Diff(-1,s)),n[a[i-1]+1][0]=1,i--,s=null,u&&l?(c=f=!0,i=0):(o=--i>0?a[i-1]:-1,c=f=!1),t=!0)),o++;t&&this.diff_cleanupMerge(n)},r.prototype.diff_cleanupMerge=function(n){n.push(new r.Diff(0,""));for(var t,a=0,i=0,s=0,o="",u="";a<n.length;)switch(n[a][0]){case 1:s++,u+=n[a][1],a++;break;case-1:i++,o+=n[a][1],a++;break;case 0:i+s>1?(i!==0&&s!==0&&((t=this.diff_commonPrefix(u,o))!==0&&(a-i-s>0&&n[a-i-s-1][0]==0?n[a-i-s-1][1]+=u.substring(0,t):(n.splice(0,0,new r.Diff(0,u.substring(0,t))),a++),u=u.substring(t),o=o.substring(t)),(t=this.diff_commonSuffix(u,o))!==0&&(n[a][1]=u.substring(u.length-t)+n[a][1],u=u.substring(0,u.length-t),o=o.substring(0,o.length-t))),a-=i+s,n.splice(a,i+s),o.length&&(n.splice(a,0,new r.Diff(-1,o)),a++),u.length&&(n.splice(a,0,new r.Diff(1,u)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,s=0,i=0,o="",u=""}n[n.length-1][1]===""&&n.pop();var l=!1;for(a=1;a<n.length-1;)n[a-1][0]==0&&n[a+1][0]==0&&(n[a][1].substring(n[a][1].length-n[a-1][1].length)==n[a-1][1]?(n[a][1]=n[a-1][1]+n[a][1].substring(0,n[a][1].length-n[a-1][1].length),n[a+1][1]=n[a-1][1]+n[a+1][1],n.splice(a-1,1),l=!0):n[a][1].substring(0,n[a+1][1].length)==n[a+1][1]&&(n[a-1][1]+=n[a+1][1],n[a][1]=n[a][1].substring(n[a+1][1].length)+n[a+1][1],n.splice(a+1,1),l=!0)),a++;l&&this.diff_cleanupMerge(n)},r.prototype.diff_xIndex=function(n,t){var a,i=0,s=0,o=0,u=0;for(a=0;a<n.length&&(n[a][0]!==1&&(i+=n[a][1].length),n[a][0]!==-1&&(s+=n[a][1].length),!(i>t));a++)o=i,u=s;return n.length!=a&&n[a][0]===-1?u:u+(t-o)},r.prototype.diff_prettyHtml=function(n){for(var t=[],a=/&/g,i=/</g,s=/>/g,o=/\n/g,u=0;u<n.length;u++){var l=n[u][0],c=n[u][1].replace(a,"&").replace(i,"<").replace(s,">").replace(o,"¶<br>");switch(l){case 1:t[u]='<ins style="background:#e6ffe6;">'+c+"</ins>";break;case-1:t[u]='<del style="background:#ffe6e6;">'+c+"</del>";break;case 0:t[u]="<span>"+c+"</span>"}}return t.join("")},r.prototype.diff_text1=function(n){for(var t=[],a=0;a<n.length;a++)n[a][0]!==1&&(t[a]=n[a][1]);return t.join("")},r.prototype.diff_text2=function(n){for(var t=[],a=0;a<n.length;a++)n[a][0]!==-1&&(t[a]=n[a][1]);return t.join("")},r.prototype.diff_levenshtein=function(n){for(var t=0,a=0,i=0,s=0;s<n.length;s++){var o=n[s][0],u=n[s][1];switch(o){case 1:a+=u.length;break;case-1:i+=u.length;break;case 0:t+=Math.max(a,i),a=0,i=0}}return t+=Math.max(a,i)},r.prototype.diff_toDelta=function(n){for(var t=[],a=0;a<n.length;a++)switch(n[a][0]){case 1:t[a]="+"+encodeURI(n[a][1]);break;case-1:t[a]="-"+n[a][1].length;break;case 0:t[a]="="+n[a][1].length}return t.join(" ").replace(/%20/g," ")},r.prototype.diff_fromDelta=function(n,t){for(var a=[],i=0,s=0,o=t.split(/\t/g),u=0;u<o.length;u++){var l=o[u].substring(1);switch(o[u].charAt(0)){case"+":try{a[i++]=new r.Diff(1,decodeURI(l))}catch{throw new Error("Illegal escape in diff_fromDelta: "+l)}break;case"-":case"=":var c=parseInt(l,10);if(isNaN(c)||c<0)throw new Error("Invalid number in diff_fromDelta: "+l);var f=n.substring(s,s+=c);o[u].charAt(0)=="="?a[i++]=new r.Diff(0,f):a[i++]=new r.Diff(-1,f);break;default:if(o[u])throw new Error("Invalid diff operation in diff_fromDelta: "+o[u])}}if(s!=n.length)throw new Error("Delta length ("+s+") does not equal source text length ("+n.length+").");return a},r.prototype.match_main=function(n,t,a){if(n==null||t==null||a==null)throw new Error("Null input. (match_main)");return a=Math.max(0,Math.min(a,n.length)),n==t?0:n.length?n.substring(a,a+t.length)==t?a:this.match_bitap_(n,t,a):-1},r.prototype.match_bitap_=function(n,t,a){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var i=this.match_alphabet_(t),s=this;function o(C,S){var O=C/t.length,j=Math.abs(a-S);return s.Match_Distance?O+j/s.Match_Distance:j?1:O}var u=this.Match_Threshold,l=n.indexOf(t,a);l!=-1&&(u=Math.min(o(0,l),u),(l=n.lastIndexOf(t,a+t.length))!=-1&&(u=Math.min(o(0,l),u)));var c,f,h=1<<t.length-1;l=-1;for(var d,v=t.length+n.length,b=0;b<t.length;b++){for(c=0,f=v;c<f;)o(b,a+f)<=u?c=f:v=f,f=Math.floor((v-c)/2+c);v=f;var m=Math.max(1,a-f+1),_=Math.min(a+f,n.length)+t.length,w=Array(_+2);w[_+1]=(1<<b)-1;for(var y=_;y>=m;y--){var N=i[n.charAt(y-1)];if(w[y]=b===0?(w[y+1]<<1|1)&N:(w[y+1]<<1|1)&N|(d[y+1]|d[y])<<1|1|d[y+1],w[y]&h){var p=o(b,y-1);if(p<=u){if(u=p,!((l=y-1)>a))break;m=Math.max(1,2*a-l)}}}if(o(b+1,a)>u)break;d=w}return l},r.prototype.match_alphabet_=function(n){for(var t={},a=0;a<n.length;a++)t[n.charAt(a)]=0;for(a=0;a<n.length;a++)t[n.charAt(a)]|=1<<n.length-a-1;return t},r.prototype.patch_addContext_=function(n,t){if(t.length!=0){if(n.start2===null)throw Error("patch not initialized");for(var a=t.substring(n.start2,n.start2+n.length1),i=0;t.indexOf(a)!=t.lastIndexOf(a)&&a.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,a=t.substring(n.start2-i,n.start2+n.length1+i);i+=this.Patch_Margin;var s=t.substring(n.start2-i,n.start2);s&&n.diffs.unshift(new r.Diff(0,s));var o=t.substring(n.start2+n.length1,n.start2+n.length1+i);o&&n.diffs.push(new r.Diff(0,o)),n.start1-=s.length,n.start2-=s.length,n.length1+=s.length+o.length,n.length2+=s.length+o.length}},r.prototype.patch_make=function(n,t,a){var i,s;if(typeof n=="string"&&typeof t=="string"&&a===void 0)i=n,(s=this.diff_main(i,t,!0)).length>2&&(this.diff_cleanupSemantic(s),this.diff_cleanupEfficiency(s));else if(n&&typeof n=="object"&&t===void 0&&a===void 0)s=n,i=this.diff_text1(s);else if(typeof n=="string"&&t&&typeof t=="object"&&a===void 0)i=n,s=t;else{if(typeof n!="string"||typeof t!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");i=n,s=a}if(s.length===0)return[];for(var o=[],u=new r.patch_obj,l=0,c=0,f=0,h=i,d=i,v=0;v<s.length;v++){var b=s[v][0],m=s[v][1];switch(l||b===0||(u.start1=c,u.start2=f),b){case 1:u.diffs[l++]=s[v],u.length2+=m.length,d=d.substring(0,f)+m+d.substring(f);break;case-1:u.length1+=m.length,u.diffs[l++]=s[v],d=d.substring(0,f)+d.substring(f+m.length);break;case 0:m.length<=2*this.Patch_Margin&&l&&s.length!=v+1?(u.diffs[l++]=s[v],u.length1+=m.length,u.length2+=m.length):m.length>=2*this.Patch_Margin&&l&&(this.patch_addContext_(u,h),o.push(u),u=new r.patch_obj,l=0,h=d,c=f)}b!==1&&(c+=m.length),b!==-1&&(f+=m.length)}return l&&(this.patch_addContext_(u,h),o.push(u)),o},r.prototype.patch_deepCopy=function(n){for(var t=[],a=0;a<n.length;a++){var i=n[a],s=new r.patch_obj;s.diffs=[];for(var o=0;o<i.diffs.length;o++)s.diffs[o]=new r.Diff(i.diffs[o][0],i.diffs[o][1]);s.start1=i.start1,s.start2=i.start2,s.length1=i.length1,s.length2=i.length2,t[a]=s}return t},r.prototype.patch_apply=function(n,t){if(n.length==0)return[t,[]];n=this.patch_deepCopy(n);var a=this.patch_addPadding(n);t=a+t+a,this.patch_splitMax(n);for(var i=0,s=[],o=0;o<n.length;o++){var u,l,c=n[o].start2+i,f=this.diff_text1(n[o].diffs),h=-1;if(f.length>this.Match_MaxBits?(u=this.match_main(t,f.substring(0,this.Match_MaxBits),c))!=-1&&((h=this.match_main(t,f.substring(f.length-this.Match_MaxBits),c+f.length-this.Match_MaxBits))==-1||u>=h)&&(u=-1):u=this.match_main(t,f,c),u==-1)s[o]=!1,i-=n[o].length2-n[o].length1;else if(s[o]=!0,i=u-c,f==(l=h==-1?t.substring(u,u+f.length):t.substring(u,h+this.Match_MaxBits)))t=t.substring(0,u)+this.diff_text2(n[o].diffs)+t.substring(u+f.length);else{var d=this.diff_main(f,l,!1);if(f.length>this.Match_MaxBits&&this.diff_levenshtein(d)/f.length>this.Patch_DeleteThreshold)s[o]=!1;else{this.diff_cleanupSemanticLossless(d);for(var v,b=0,m=0;m<n[o].diffs.length;m++){var _=n[o].diffs[m];_[0]!==0&&(v=this.diff_xIndex(d,b)),_[0]===1?t=t.substring(0,u+v)+_[1]+t.substring(u+v):_[0]===-1&&(t=t.substring(0,u+v)+t.substring(u+this.diff_xIndex(d,b+_[1].length))),_[0]!==-1&&(b+=_[1].length)}}}}return[t=t.substring(a.length,t.length-a.length),s]},r.prototype.patch_addPadding=function(n){for(var t=this.Patch_Margin,a="",i=1;i<=t;i++)a+=String.fromCharCode(i);for(i=0;i<n.length;i++)n[i].start1+=t,n[i].start2+=t;var s=n[0],o=s.diffs;if(o.length==0||o[0][0]!=0)o.unshift(new r.Diff(0,a)),s.start1-=t,s.start2-=t,s.length1+=t,s.length2+=t;else if(t>o[0][1].length){var u=t-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],s.start1-=u,s.start2-=u,s.length1+=u,s.length2+=u}return(o=(s=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new r.Diff(0,a)),s.length1+=t,s.length2+=t):t>o[o.length-1][1].length&&(u=t-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,u),s.length1+=u,s.length2+=u),a},r.prototype.patch_splitMax=function(n){for(var t=this.Match_MaxBits,a=0;a<n.length;a++)if(!(n[a].length1<=t)){var i=n[a];n.splice(a--,1);for(var s=i.start1,o=i.start2,u="";i.diffs.length!==0;){var l=new r.patch_obj,c=!0;for(l.start1=s-u.length,l.start2=o-u.length,u!==""&&(l.length1=l.length2=u.length,l.diffs.push(new r.Diff(0,u)));i.diffs.length!==0&&l.length1<t-this.Patch_Margin;){var f=i.diffs[0][0],h=i.diffs[0][1];f===1?(l.length2+=h.length,o+=h.length,l.diffs.push(i.diffs.shift()),c=!1):f===-1&&l.diffs.length==1&&l.diffs[0][0]==0&&h.length>2*t?(l.length1+=h.length,s+=h.length,c=!1,l.diffs.push(new r.Diff(f,h)),i.diffs.shift()):(h=h.substring(0,t-l.length1-this.Patch_Margin),l.length1+=h.length,s+=h.length,f===0?(l.length2+=h.length,o+=h.length):c=!1,l.diffs.push(new r.Diff(f,h)),h==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(h.length))}u=(u=this.diff_text2(l.diffs)).substring(u.length-this.Patch_Margin);var d=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);d!==""&&(l.length1+=d.length,l.length2+=d.length,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===0?l.diffs[l.diffs.length-1][1]+=d:l.diffs.push(new r.Diff(0,d))),c||n.splice(++a,0,l)}}},r.prototype.patch_toText=function(n){for(var t=[],a=0;a<n.length;a++)t[a]=n[a];return t.join("")},r.prototype.patch_fromText=function(n){var t=[];if(!n)return t;for(var a=n.split(`
|
|
20
|
+
`),i=0,s=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;i<a.length;){var o=a[i].match(s);if(!o)throw new Error("Invalid patch string: "+a[i]);var u=new r.patch_obj;for(t.push(u),u.start1=parseInt(o[1],10),o[2]===""?(u.start1--,u.length1=1):o[2]=="0"?u.length1=0:(u.start1--,u.length1=parseInt(o[2],10)),u.start2=parseInt(o[3],10),o[4]===""?(u.start2--,u.length2=1):o[4]=="0"?u.length2=0:(u.start2--,u.length2=parseInt(o[4],10)),i++;i<a.length;){var l=a[i].charAt(0);try{var c=decodeURI(a[i].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+c)}if(l=="-")u.diffs.push(new r.Diff(-1,c));else if(l=="+")u.diffs.push(new r.Diff(1,c));else if(l==" ")u.diffs.push(new r.Diff(0,c));else{if(l=="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+c)}i++}}return t},(r.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var n,t=["@@ -"+(this.length1===0?this.start1+",0":this.length1==1?this.start1+1:this.start1+1+","+this.length1)+" +"+(this.length2===0?this.start2+",0":this.length2==1?this.start2+1:this.start2+1+","+this.length2)+` @@
|
|
21
|
+
`],a=0;a<this.diffs.length;a++){switch(this.diffs[a][0]){case 1:n="+";break;case-1:n="-";break;case 0:n=" "}t[a+1]=n+encodeURI(this.diffs[a][1])+`
|
|
22
|
+
`}return t.join("").replace(/%20/g," ")},e.exports=r,e.exports.diff_match_patch=r,e.exports.DIFF_DELETE=-1,e.exports.DIFF_INSERT=1,e.exports.DIFF_EQUAL=0}),zi=ze.DIFF_EQUAL,Ki=ze.DIFF_DELETE,Hi=ze.DIFF_INSERT;function Dr(e){var r=Hn(e,function(t){return!z(t)});if(r===-1)return[];var n=Hn(e,function(t){return!!z(t)},r);return n===-1?[e.slice(r)]:[e.slice(r,n)].concat(G(Dr(e.slice(n))))}function Wn(e){return e.reduce(function(r,n){var t=T(n,2),a=t[0],i=Zn(t[1].split(`
|
|
23
|
+
`).map(function(u){return[a,u]})),s=i[0],o=i.slice(1);return[].concat(G(r.slice(0,-1)),[[].concat(G(r[r.length-1]),[s])],G(o.map(function(u){return[u]})))},[[]])}function tn(e,r){return e.reduce(function(n,t){var a=T(n,2),i=a[0],s=a[1],o=T(t,2),u=o[0],l=o[1];if(u!==zi){var c={type:"edit",lineNumber:r,start:s,length:l.length};i.push(c)}return[i,s+l.length]},[[],0])[0]}function Vn(e,r){return dn(e,function(n,t){return tn(n,r+t)})}function Mr(e,r){var n=new ze,t=n.diff_main(e,r);return n.diff_cleanupSemantic(t),t.length<=1?[[],[]]:function(a){return a.reduce(function(i,s){var o=T(i,2),u=o[0],l=o[1];switch(T(s,1)[0]){case Hi:l.push(s);break;case Ki:u.push(s);break;default:u.push(s),l.push(s)}return[u,l]},[[],[]])}(t)}function Wi(e){var r=e.reduce(function(l,c){var f=T(l,2),h=f[0],d=f[1];return B(c)?[h+(h?`
|
|
24
|
+
`:"")+c.content,d]:[h,d+(d?`
|
|
25
|
+
`:"")+c.content]},["",""]),n=T(r,2),t=T(Mr(n[0],n[1]),2),a=t[0],i=t[1];if(a.length===0&&i.length===0)return[[],[]];var s=function(l){if(l&&!z(l))return l.lineNumber},o=s(e.find(B)),u=s(e.find(J));if(o===void 0||u===void 0)throw new Error("Could not find start line number for edit");return[Vn(Wn(a),o),Vn(Wn(i),u)]}function Vi(e){var r=e.reduce(function(t,a){var i=T(t,3),s=i[0],o=i[1],u=i[2];if(!u||!B(u)||!J(a))return[s,o,a];var l=T(Mr(u.content,a.content),2),c=l[0],f=l[1];return[s.concat(tn(c,u.lineNumber)),o.concat(tn(f,a.lineNumber)),a]},[[],[],null]),n=T(r,2);return[n[0],n[1]]}function Xi(e){var r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(r===void 0?"block":r)==="block"?Wi:Vi,t=dn(e.map(function(o){return o.changes}),Dr).map(n).reduce(function(o,u){var l=T(o,2),c=l[0],f=l[1],h=T(u,2),d=h[0],v=h[1];return[c.concat(d),f.concat(v)]},[[],[]]),a=T(t,2),i=a[0],s=a[1];return Li(Kn(i),Kn(s))}var Ji=["enhancers"],Zi=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=n.enhancers,a=t===void 0?[]:t,i=T(Ti(e,X(n,Ji)),2),s=i[0],o=i[1],u=[Ln(s),Ln(o)],l=(r=[u[0],u[1]],a.reduce(function(b,m){return m(b)},r)),c=T(l,2),f=c[0],h=c[1],d=[f.map(Un),h.map(Un)],v=d[1];return{old:d[0].map(function(b){var m;return(m=b.children)!==null&&m!==void 0?m:[]}),new:v.map(function(b){var m;return(m=b.children)!==null&&m!==void 0?m:[]})}};function Qi(e){switch(String(e||"").trim().toLowerCase()){case"added":case"add":return"add";case"deleted":case"delete":return"delete";case"renamed":case"rename":return"rename";case"copied":case"copy":return"copy";default:return"modify"}}function Yi(e){return String(e||"").trim().toLowerCase()}function qi(e){const r=e.old_path||e.path,n=e.path,t=Yi(e.status),a=t==="added"||t==="add"?"/dev/null":`a/${r}`,i=t==="deleted"||t==="delete"?"/dev/null":`b/${n}`;return[...[`diff --git a/${r} b/${n}`,`--- ${a}`,`+++ ${i}`],...e.lines].join(`
|
|
26
|
+
`)}function xi(e){if(!e.lines.length)return"";const r=String(e.lines[0]||""),n=e.old_path||e.path,t=e.path;return r.startsWith("diff --git ")?e.lines.join(`
|
|
27
|
+
`):r.startsWith("--- ")||r.startsWith("Binary files ")?[`diff --git a/${n} b/${t}`,...e.lines].join(`
|
|
28
|
+
`):qi(e)}function es(e,r){const n="display_path"in e&&typeof e.display_path=="string"&&e.display_path.trim()?e.display_path.trim():e.path;return Ur(n,e.old_path,r)}function ns(e){if(!e.trim())return null;try{return Wr(e,{nearbySequences:"zip"})[0]??null}catch{return null}}function us({diff:e,className:r,pathLabel:n}){const{t}=Xn("workspace"),a=E.useMemo(()=>e?xi(e):"",[e]),i=E.useMemo(()=>ns(a),[a]),s=E.useMemo(()=>{if(!i?.hunks.length)return null;try{return Zi(i.hunks,{enhancers:[Xi(i.hunks,{type:"line"})]})}catch{return null}},[i]),o=e?n||es(e,t("git_viewer_diff",void 0,"Diff")):null;return e?e.binary?g.jsx("div",{"data-testid":"git-unified-diff-viewer",className:Ce("ds-stage-diff-shell",r),children:g.jsx("div",{className:"ds-stage-diff-filehead",children:g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:o}),g.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:t("git_diff_binary_changed",void 0,"Binary file changed.")})]})})}):!i||!i.hunks.length?g.jsxs("div",{"data-testid":"git-unified-diff-viewer",className:Ce("ds-stage-diff-shell",r),children:[g.jsxs("div",{className:"ds-stage-diff-filehead",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:o}),g.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:String(e.status||"modified")})]}),g.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[g.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",e.added||0]}),g.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",e.removed||0]})]})]}),g.jsx("div",{className:"feed-scrollbar overflow-x-auto overflow-y-visible",children:g.jsx("pre",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-6 text-foreground",children:e.lines.join(`
|
|
29
|
+
`)||t("git_diff_no_patch_lines",void 0,"No patch lines available.")})})]}):g.jsxs("div",{"data-testid":"git-unified-diff-viewer",className:Ce("ds-stage-diff-shell",r),children:[g.jsxs("div",{className:"ds-stage-diff-filehead",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:o}),g.jsxs("div",{className:"mt-1 text-[11px] text-muted-foreground",children:[String(e.status||"modified")," · ",e.base," → ",e.head]})]}),g.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[g.jsxs("span",{className:"text-emerald-700 dark:text-emerald-300",children:["+",e.added||0]}),g.jsxs("span",{className:"text-rose-700 dark:text-rose-300",children:["-",e.removed||0]})]})]}),g.jsx("div",{className:"feed-scrollbar overflow-x-auto overflow-y-visible",children:g.jsx("div",{className:"min-w-max",children:g.jsx(di,{viewType:"unified",diffType:i.type||Qi(e.status),hunks:i.hunks,gutterType:"default",tokens:s,className:"ds-github-diff-table",children:u=>u.flatMap(l=>[g.jsx(mi,{children:g.jsx("div",{className:"ds-github-diff-hunk",children:l.content})},`decoration-${l.content}`),g.jsx(Cr,{hunk:l},`hunk-${l.content}`)])})})}),e.truncated?g.jsx("div",{className:"border-t border-black/[0.06] px-4 py-2 text-[11px] text-muted-foreground dark:border-white/[0.08]",children:t("git_diff_patch_truncated",void 0,"Patch output is truncated.")}):null]}):g.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:t("git_diff_none_selected",void 0,"No patch selected.")})}function rs(e){const r=e?.meta?.git_revision;return typeof r=="string"&&r.trim()?r.trim():String(e?.revision||"").trim()||null}function os({document:e,className:r}){const{t:n}=Xn("workspace"),t=E.useMemo(()=>String(e?.content||"").split(`
|
|
30
|
+
`),[e?.content]),a=rs(e),i=!e?.content&&!e?.encoding&&Number(e?.size_bytes||0)>0;return e?g.jsxs("div",{"data-testid":"git-snapshot-viewer",className:Ce("ds-stage-diff-shell",r),children:[g.jsx("div",{className:"ds-stage-diff-filehead",children:g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:e.path||e.title||n("git_viewer_snapshot",void 0,"Snapshot")}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[g.jsx("span",{children:n("git_snapshot_meta_label",void 0,"Snapshot")}),a?g.jsxs("span",{children:["· ",a]}):null,e.mime_type?g.jsxs("span",{children:["· ",e.mime_type]}):null,typeof e.size_bytes=="number"?g.jsxs("span",{children:["· ",e.size_bytes," bytes"]}):null]})]})}),i?g.jsx("div",{className:"px-4 py-8 text-sm text-muted-foreground",children:n("git_snapshot_binary_unavailable",void 0,"Snapshot preview is unavailable for binary files.")}):g.jsx("div",{className:"feed-scrollbar overflow-x-auto overflow-y-visible",children:g.jsx("div",{className:"min-w-max",children:t.length===1&&t[0]===""?g.jsx("div",{className:"px-4 py-6 font-mono text-[12px] leading-6 text-muted-foreground",children:n("git_snapshot_empty_file",void 0,"File is empty.")}):t.map((s,o)=>g.jsxs("div",{className:"grid grid-cols-[64px_minmax(0,1fr)] border-b border-black/[0.05] font-mono text-[12px] leading-6 text-foreground last:border-b-0 dark:border-white/[0.06]",children:[g.jsx("div",{className:"select-none border-r border-black/[0.06] bg-black/[0.02] px-3 py-0.5 text-right text-[11px] text-muted-foreground dark:border-white/[0.06] dark:bg-white/[0.03]",children:o+1}),g.jsx("div",{className:"whitespace-pre px-4 py-0.5",children:s||" "})]},`snapshot-line-${o+1}`))})})]}):g.jsx("div",{className:"text-sm leading-7 text-muted-foreground",children:n("git_snapshot_none_selected",void 0,"No snapshot selected.")})}export{os as G,us as a,is as b,Ur as f,ss as i};
|