zen-gitsync 2.12.3 → 2.12.4
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/package.json +17 -4
- package/src/ui/public/assets/{EditorView-GS5cmh99.js → EditorView-BZaOzahT.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-_YRtzmZZ.js → SourceMapView-D_8mnVt2.js} +1 -1
- package/src/ui/public/assets/{index-yky0Sd13.js → index-BgFwmXzV.js} +6 -6
- package/src/ui/public/assets/{index-ML5Y-5lO.css → index-Dsi6tg7k.css} +1 -1
- package/src/ui/public/index.html +2 -2
- package/src/ui/server/routes/config.js +22 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zen-gitsync",
|
|
3
|
-
"version": "2.12.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.12.4",
|
|
4
|
+
"description": "Auto commit, scheduled sync, and visual GUI for Git. Run `g` in any repo for one-key commit & push, AI commit messages, scheduled background sync, and a drag-and-drop workflow builder.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -61,8 +61,21 @@
|
|
|
61
61
|
"url": "git+https://github.com/xz333221/zen-gitsync.git"
|
|
62
62
|
},
|
|
63
63
|
"keywords": [
|
|
64
|
-
"
|
|
65
|
-
"git"
|
|
64
|
+
"git",
|
|
65
|
+
"git-auto-commit",
|
|
66
|
+
"git-sync",
|
|
67
|
+
"git-gui",
|
|
68
|
+
"git-cli",
|
|
69
|
+
"git-automation",
|
|
70
|
+
"git-workflow",
|
|
71
|
+
"commit-message",
|
|
72
|
+
"conventional-commits",
|
|
73
|
+
"ai-commit",
|
|
74
|
+
"cron",
|
|
75
|
+
"automation",
|
|
76
|
+
"developer-tools",
|
|
77
|
+
"productivity",
|
|
78
|
+
"gitsync"
|
|
66
79
|
],
|
|
67
80
|
"author": "",
|
|
68
81
|
"license": "Apache-2.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-BM3Ffeng.js";import{$r as e,$t as t,Ai as n,Ci as r,Jr as i,Mi as a,Ni as o,Oi as s,Qr as c,Qt as ee,Ti as te,Un as l,Xt as ne,Zr as u,Zt as re,_i as d,_t as ie,ci as f,ei as p,en as ae,hi as m,ii as h,ji as g,ki as oe,mi as _,n as se,ni as ce,pi as v,ri as y,si as b,sn as x,ti as S,ui as le,vt as C,wi as ue,yi as de}from"./vendor-DITsiaGj.js";import{a as w,i as fe,n as pe,o as T,r as me,t as he}from"./index-yky0Sd13.js";function ge(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}var _e={class:`sidebar-header`},ve={class:`sidebar-title`},ye={class:`sidebar-actions`},be={key:0,class:`sidebar-tree`},xe={key:1,class:`tree-arrow-spacer`},Se={class:`tree-icon mit-icon`,"aria-hidden":`true`},Ce=[`xlink:href`],we=[`onClick`,`onContextmenu`],Te={key:1,class:`tree-arrow-spacer`},Ee={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},De=[`xlink:href`],Oe={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},ke=[`xlink:href`],Ae=[`title`],je={key:4,class:`tree-loading`},Me={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},Ne={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},Pe=[`placeholder`],Fe={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Ie={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},Le={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},Re=[`placeholder`],ze={key:1,class:`tree-empty`},Be={key:1,class:`sidebar-loading`},Ve={class:`editor-main`},He={key:0,class:`editor-tabs`},Ue=[`onClick`,`title`],We={class:`tab-name`},Ge={key:0,class:`tab-dirty-dot`},Ke=[`onClick`],qe=[`title`],Je={key:1,class:`editor-empty`},Ye={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Xe={class:`editor-empty-hint`},Ze={class:`editor-body`},Qe={key:0,class:`image-tab-placeholder`},$e={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},et={class:`image-tab-placeholder-title`},tt={class:`image-tab-placeholder-hint`},nt={class:`preview-header`},rt={class:`preview-title`},it={class:`preview-ext-badge`},at=[`title`],ot={class:`preview-body`},st=[`srcdoc`],E=w(le({__name:`EditorView`,setup(le){self.MonacoEnvironment={getWorker(e,n){return n===`json`?new t:n===`css`||n===`scss`||n===`less`?new ee:n===`html`||n===`handlebars`||n===`razor`?new re:n===`typescript`||n===`javascript`?new ne:new ae}};let w=fe(),E=s([]),D=s(!1);async function O(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function ct(){let e=w.currentDirectory;if(e){D.value=!0;try{E.value=await O(e,0)}finally{D.value=!1}}}function lt(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&<(n.children,t));return t}async function ut(e,t){for(let n of e)n.type===`directory`&&t.has(n.path)&&(n.children||=await O(n.path,n.depth+1),n.expanded=!0,await ut(n.children,t))}async function k(){let e=w.currentDirectory;if(!e)return;let t=lt(E.value);D.value=!0;try{E.value=await O(e,0),t.size>0&&await ut(E.value,t)}finally{D.value=!1}}async function A(e){if(e.type===`directory`)if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await O(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}function dt(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...dt(n.children));return t}let j=s([]),M=s(null),N=s(null);async function ft(e){if(N.value=e,e.type!==`file`){A(e);return}if(j.value.find(t=>t.path===e.path)){M.value=e.path;return}let t=e.name.split(`.`).pop()||``;if(Y.has(t.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`};j.value.push(t),M.value=e.path,X.value=!0;return}try{let n=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`)).json();if(!n.success){x.error(`${T(`@EDITOR:打开文件失败: `)}${n.error}`);return}let r=ge(t),i={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:r};j.value.push(i),M.value=e.path}catch(e){x.error(`${T(`@EDITOR:打开文件失败: `)}${e.message}`)}}function pt(e,t){t.stopPropagation();let n=j.value.findIndex(t=>t.path===e);n!==-1&&(j.value[n].isDirty&&!confirm(T(`@EDITOR:文件未保存,确认关闭?`))||(j.value.splice(n,1),M.value===e&&(M.value=j.value[Math.min(n,j.value.length-1)]?.path??null)))}let P=()=>j.value.find(e=>e.path===M.value)??null,F=s(null),I=oe(null),L=new Map;function mt(e){let t=L.get(e.path);return(!t||t.isDisposed())&&(t=C.createModel(e.content,e.language,ie.file(e.path)),L.set(e.path,t)),t}function ht(){if(!F.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;I.value=C.create(F.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8}}),I.value.onDidChangeModelContent(()=>{let e=P();if(!e)return;let t=I.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),I.value.onDidBlurEditorText(()=>{w.ui.editorAutoSave&&P()?.isDirty&&_t(!1)})}r(M,e=>{if(!I.value||!e)return;let t=j.value.find(t=>t.path===e);if(!t)return;let n=mt(t);I.value.setModel(n)});let gt=new MutationObserver(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;C.setTheme(e?`vs-dark`:`vs`)});m(async()=>{ht(),await ct(),gt.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}),_(()=>{gt.disconnect(),I.value?.dispose(),L.forEach(e=>e.dispose()),L.clear()});async function _t(e=!1){let t=P();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){x.error(`${T(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,e||x.success(T(`@EDITOR:已保存`))}catch(e){x.error(`${T(`@EDITOR:保存失败: `)}${e.message}`)}}function vt(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_t())}m(()=>window.addEventListener(`keydown`,vt)),_(()=>window.removeEventListener(`keydown`,vt));let yt=s(null),R=s(220),z=!1,bt=0,xt=0;function St(e){z=!0,bt=e.clientX,xt=R.value,document.addEventListener(`mousemove`,Ct),document.addEventListener(`mouseup`,wt),e.preventDefault()}function Ct(e){if(!z)return;let t=e.clientX-bt;R.value=Math.max(140,Math.min(400,xt+t))}function wt(){z=!1,document.removeEventListener(`mousemove`,Ct),document.removeEventListener(`mouseup`,wt)}function B(e){return e.type===`directory`?me(e.name):pe(e.name)}let V=s(null),H=s(null),U=s(null),W=s(null);function G(){let e=N.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):w.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:w.currentDirectory??``,afterNode:null,depth:0}}async function Tt(){let e=G();N.value?.type===`directory`&&!N.value.expanded&&await A(N.value),V.value={...e,kind:`file`,value:``},await v(),U.value?.focus()}async function Et(){let e=G();N.value?.type===`directory`&&!N.value.expanded&&await A(N.value),V.value={...e,kind:`directory`,value:``},await v(),U.value?.focus()}function K(){V.value=null}async function Dt(){let e=V.value;if(!e||!e.value.trim()){V.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){x.error(e.error);return}x.success(T(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){x.error(e.error);return}x.success(T(`@EDITOR:创建成功`))}V.value=null,await k()}function Ot(e){e.key===`Enter`&&(e.preventDefault(),Dt()),e.key===`Escape`&&(e.preventDefault(),K())}let q=s(null),kt=s(null);function At(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function jt(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await A(e),V.value={...G(),kind:`file`,value:``},await v(),U.value?.focus()}async function Mt(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await A(e),V.value={...G(),kind:`directory`,value:``},await v(),U.value?.focus()}async function Nt(){let e=q.value?.node;J(),e&&(H.value={node:e,value:e.name},await v(),W.value?.focus(),W.value?.select())}async function Pt(){let e=H.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){H.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){x.error(r.error);return}let i=j.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,M.value===e.node.path&&(M.value=n)),H.value=null,await k()}function Ft(e){e.key===`Enter`&&(e.preventDefault(),Pt()),e.key===`Escape`&&(e.preventDefault(),H.value=null)}async function It(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?T(`@EDITOR:文件夹`):T(`@EDITOR:文件`);if(!confirm(`${T(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){x.error(n.error);return}let r=j.value.findIndex(t=>t.path===e.path);r!==-1&&(j.value.splice(r,1),M.value===e.path&&(M.value=j.value[Math.max(0,r-1)]?.path??null)),x.success(T(`@EDITOR:已删除`)),await k()}async function Lt(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||x.error(t.error)}catch(e){x.error(e?.message||String(e))}}m(()=>document.addEventListener(`click`,J)),_(()=>document.removeEventListener(`click`,J));let Rt=new Set([`md`,`html`,`htm`,`svg`]),Y=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),X=s(!1),Z=s(0),Q=p(()=>j.value.find(e=>e.path===M.value)??null),zt=p(()=>Q.value?.language===`plaintext`&&Q.value?.content===``),$=p(()=>(Q.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Bt=p(()=>Rt.has($.value)||Y.has($.value));r(M,()=>{X.value&&!Bt.value&&(X.value=!1)});function Vt(){Bt.value&&(X.value=!X.value)}let Ht=p(()=>{let e=Q.value;if(!e)return``;let t=$.value,n=document.documentElement.getAttribute(`data-theme`)!==`light`,r=n?`#0d1117`:`#ffffff`,i=n?`#c9d1d9`:`#1f2328`,a=n?`#30363d`:`#d0d7de`,o=n?`#161b22`:`#f6f8fa`,s=`
|
|
1
|
+
import"./rolldown-runtime-BM3Ffeng.js";import{$r as e,$t as t,Ai as n,Ci as r,Jr as i,Mi as a,Ni as o,Oi as s,Qr as c,Qt as ee,Ti as te,Un as l,Xt as ne,Zr as u,Zt as re,_i as d,_t as ie,ci as f,ei as p,en as ae,hi as m,ii as h,ji as g,ki as oe,mi as _,n as se,ni as ce,pi as v,ri as y,si as b,sn as x,ti as S,ui as le,vt as C,wi as ue,yi as de}from"./vendor-DITsiaGj.js";import{a as w,i as fe,n as pe,o as T,r as me,t as he}from"./index-BgFwmXzV.js";function ge(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}var _e={class:`sidebar-header`},ve={class:`sidebar-title`},ye={class:`sidebar-actions`},be={key:0,class:`sidebar-tree`},xe={key:1,class:`tree-arrow-spacer`},Se={class:`tree-icon mit-icon`,"aria-hidden":`true`},Ce=[`xlink:href`],we=[`onClick`,`onContextmenu`],Te={key:1,class:`tree-arrow-spacer`},Ee={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},De=[`xlink:href`],Oe={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},ke=[`xlink:href`],Ae=[`title`],je={key:4,class:`tree-loading`},Me={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},Ne={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},Pe=[`placeholder`],Fe={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Ie={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},Le={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},Re=[`placeholder`],ze={key:1,class:`tree-empty`},Be={key:1,class:`sidebar-loading`},Ve={class:`editor-main`},He={key:0,class:`editor-tabs`},Ue=[`onClick`,`title`],We={class:`tab-name`},Ge={key:0,class:`tab-dirty-dot`},Ke=[`onClick`],qe=[`title`],Je={key:1,class:`editor-empty`},Ye={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Xe={class:`editor-empty-hint`},Ze={class:`editor-body`},Qe={key:0,class:`image-tab-placeholder`},$e={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},et={class:`image-tab-placeholder-title`},tt={class:`image-tab-placeholder-hint`},nt={class:`preview-header`},rt={class:`preview-title`},it={class:`preview-ext-badge`},at=[`title`],ot={class:`preview-body`},st=[`srcdoc`],E=w(le({__name:`EditorView`,setup(le){self.MonacoEnvironment={getWorker(e,n){return n===`json`?new t:n===`css`||n===`scss`||n===`less`?new ee:n===`html`||n===`handlebars`||n===`razor`?new re:n===`typescript`||n===`javascript`?new ne:new ae}};let w=fe(),E=s([]),D=s(!1);async function O(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function ct(){let e=w.currentDirectory;if(e){D.value=!0;try{E.value=await O(e,0)}finally{D.value=!1}}}function lt(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&<(n.children,t));return t}async function ut(e,t){for(let n of e)n.type===`directory`&&t.has(n.path)&&(n.children||=await O(n.path,n.depth+1),n.expanded=!0,await ut(n.children,t))}async function k(){let e=w.currentDirectory;if(!e)return;let t=lt(E.value);D.value=!0;try{E.value=await O(e,0),t.size>0&&await ut(E.value,t)}finally{D.value=!1}}async function A(e){if(e.type===`directory`)if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await O(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}function dt(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...dt(n.children));return t}let j=s([]),M=s(null),N=s(null);async function ft(e){if(N.value=e,e.type!==`file`){A(e);return}if(j.value.find(t=>t.path===e.path)){M.value=e.path;return}let t=e.name.split(`.`).pop()||``;if(Y.has(t.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`};j.value.push(t),M.value=e.path,X.value=!0;return}try{let n=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`)).json();if(!n.success){x.error(`${T(`@EDITOR:打开文件失败: `)}${n.error}`);return}let r=ge(t),i={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:r};j.value.push(i),M.value=e.path}catch(e){x.error(`${T(`@EDITOR:打开文件失败: `)}${e.message}`)}}function pt(e,t){t.stopPropagation();let n=j.value.findIndex(t=>t.path===e);n!==-1&&(j.value[n].isDirty&&!confirm(T(`@EDITOR:文件未保存,确认关闭?`))||(j.value.splice(n,1),M.value===e&&(M.value=j.value[Math.min(n,j.value.length-1)]?.path??null)))}let P=()=>j.value.find(e=>e.path===M.value)??null,F=s(null),I=oe(null),L=new Map;function mt(e){let t=L.get(e.path);return(!t||t.isDisposed())&&(t=C.createModel(e.content,e.language,ie.file(e.path)),L.set(e.path,t)),t}function ht(){if(!F.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;I.value=C.create(F.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8}}),I.value.onDidChangeModelContent(()=>{let e=P();if(!e)return;let t=I.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),I.value.onDidBlurEditorText(()=>{w.ui.editorAutoSave&&P()?.isDirty&&_t(!1)})}r(M,e=>{if(!I.value||!e)return;let t=j.value.find(t=>t.path===e);if(!t)return;let n=mt(t);I.value.setModel(n)});let gt=new MutationObserver(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;C.setTheme(e?`vs-dark`:`vs`)});m(async()=>{ht(),await ct(),gt.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}),_(()=>{gt.disconnect(),I.value?.dispose(),L.forEach(e=>e.dispose()),L.clear()});async function _t(e=!1){let t=P();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){x.error(`${T(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,e||x.success(T(`@EDITOR:已保存`))}catch(e){x.error(`${T(`@EDITOR:保存失败: `)}${e.message}`)}}function vt(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_t())}m(()=>window.addEventListener(`keydown`,vt)),_(()=>window.removeEventListener(`keydown`,vt));let yt=s(null),R=s(220),z=!1,bt=0,xt=0;function St(e){z=!0,bt=e.clientX,xt=R.value,document.addEventListener(`mousemove`,Ct),document.addEventListener(`mouseup`,wt),e.preventDefault()}function Ct(e){if(!z)return;let t=e.clientX-bt;R.value=Math.max(140,Math.min(400,xt+t))}function wt(){z=!1,document.removeEventListener(`mousemove`,Ct),document.removeEventListener(`mouseup`,wt)}function B(e){return e.type===`directory`?me(e.name):pe(e.name)}let V=s(null),H=s(null),U=s(null),W=s(null);function G(){let e=N.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):w.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:w.currentDirectory??``,afterNode:null,depth:0}}async function Tt(){let e=G();N.value?.type===`directory`&&!N.value.expanded&&await A(N.value),V.value={...e,kind:`file`,value:``},await v(),U.value?.focus()}async function Et(){let e=G();N.value?.type===`directory`&&!N.value.expanded&&await A(N.value),V.value={...e,kind:`directory`,value:``},await v(),U.value?.focus()}function K(){V.value=null}async function Dt(){let e=V.value;if(!e||!e.value.trim()){V.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){x.error(e.error);return}x.success(T(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){x.error(e.error);return}x.success(T(`@EDITOR:创建成功`))}V.value=null,await k()}function Ot(e){e.key===`Enter`&&(e.preventDefault(),Dt()),e.key===`Escape`&&(e.preventDefault(),K())}let q=s(null),kt=s(null);function At(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function jt(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await A(e),V.value={...G(),kind:`file`,value:``},await v(),U.value?.focus()}async function Mt(){let e=q.value?.node;J(),e&&(N.value=e),e?.type===`directory`&&!e.expanded&&await A(e),V.value={...G(),kind:`directory`,value:``},await v(),U.value?.focus()}async function Nt(){let e=q.value?.node;J(),e&&(H.value={node:e,value:e.name},await v(),W.value?.focus(),W.value?.select())}async function Pt(){let e=H.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){H.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){x.error(r.error);return}let i=j.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,M.value===e.node.path&&(M.value=n)),H.value=null,await k()}function Ft(e){e.key===`Enter`&&(e.preventDefault(),Pt()),e.key===`Escape`&&(e.preventDefault(),H.value=null)}async function It(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?T(`@EDITOR:文件夹`):T(`@EDITOR:文件`);if(!confirm(`${T(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){x.error(n.error);return}let r=j.value.findIndex(t=>t.path===e.path);r!==-1&&(j.value.splice(r,1),M.value===e.path&&(M.value=j.value[Math.max(0,r-1)]?.path??null)),x.success(T(`@EDITOR:已删除`)),await k()}async function Lt(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||x.error(t.error)}catch(e){x.error(e?.message||String(e))}}m(()=>document.addEventListener(`click`,J)),_(()=>document.removeEventListener(`click`,J));let Rt=new Set([`md`,`html`,`htm`,`svg`]),Y=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),X=s(!1),Z=s(0),Q=p(()=>j.value.find(e=>e.path===M.value)??null),zt=p(()=>Q.value?.language===`plaintext`&&Q.value?.content===``),$=p(()=>(Q.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Bt=p(()=>Rt.has($.value)||Y.has($.value));r(M,()=>{X.value&&!Bt.value&&(X.value=!1)});function Vt(){Bt.value&&(X.value=!X.value)}let Ht=p(()=>{let e=Q.value;if(!e)return``;let t=$.value,n=document.documentElement.getAttribute(`data-theme`)!==`light`,r=n?`#0d1117`:`#ffffff`,i=n?`#c9d1d9`:`#1f2328`,a=n?`#30363d`:`#d0d7de`,o=n?`#161b22`:`#f6f8fa`,s=`
|
|
2
2
|
html, body { margin: 0; padding: 0; background: ${r}; color: ${i}; }
|
|
3
3
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.6; padding: 20px 24px; }
|
|
4
4
|
* { box-sizing: border-box; }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ai as t,Bt as n,Ci as r,Gt as i,Ht as a,Jr as o,Kt as s,Mi as c,Ni as l,Oi as u,Qr as d,Ti as f,Un as ee,Ut as te,Vt as ne,Wt as re,Xr as ie,Yr as p,_i as m,ci as h,ei as g,hi as ae,ii as _,ji as v,ki as oe,mi as se,oi as ce,pi as y,qt as le,ri as b,si as x,sn as ue,t as de,ti as S,ui as C,vt as fe,wi as w,yi as T,zt as E}from"./vendor-DITsiaGj.js";import{a as D,i as pe,n as me,o as O}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ai as t,Bt as n,Ci as r,Gt as i,Ht as a,Jr as o,Kt as s,Mi as c,Ni as l,Oi as u,Qr as d,Ti as f,Un as ee,Ut as te,Vt as ne,Wt as re,Xr as ie,Yr as p,_i as m,ci as h,ei as g,hi as ae,ii as _,ji as v,ki as oe,mi as se,oi as ce,pi as y,qt as le,ri as b,si as x,sn as ue,t as de,ti as S,ui as C,vt as fe,wi as w,yi as T,zt as E}from"./vendor-DITsiaGj.js";import{a as D,i as pe,n as me,o as O}from"./index-BgFwmXzV.js";var he=e(E(),1),ge={class:`source-map-view`},_e={class:`sm-toolbar`},ve={class:`sm-toolbar-left`},ye={class:`sm-title`},be={class:`sm-toolbar-center`},xe=[`placeholder`,`disabled`],Se=[`disabled`],Ce={class:`sm-toolbar-right`},we={class:`sm-body`},Te={class:`sm-panel-header sm-panel-header--tabs`},Ee={key:0,class:`sm-badge`},De={class:`sm-panel-body sm-file-tree`},Oe=[`onClick`],ke={key:1,class:`sm-tree-arrow-spacer`},Ae={key:2,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},je=[`xlink:href`],Me={key:3,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},Ne=[`xlink:href`],Pe=[`title`],Fe={key:1,class:`sm-tree-empty`},Ie={class:`sm-panel-body sm-outline-body`},Le={class:`sm-badge`,style:{"margin-left":`auto`}},Re=[`onClick`],ze=[`title`],Be={key:0,class:`sm-outline-desc`},Ve={key:1,class:`sm-tree-empty`},He={class:`sm-panel sm-panel-graph`},Ue={key:0,class:`sm-project-info`},We={class:`sm-lang-badge`},Ge={class:`sm-summary-text`},Ke={class:`sm-graph-container`},qe={class:`sm-layout-btn-wrap`},Je=[`disabled`],Ye=[`title`],Xe={class:`sm-fn-label`},Ze={key:0,class:`sm-fn-desc`},Qe={key:0,class:`sm-graph-empty`},$e={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,style:{opacity:`0.3`}},et={key:1,class:`sm-graph-loading`},tt={class:`sm-log-header`},nt={key:0,class:`sm-log-indicator`},rt={class:`sm-log-body`,ref:`logBodyRef`},it={key:0,class:`sm-empty`},at={class:`sm-panel-header`},ot={key:0,class:`sm-badge sm-badge-amber`},st={key:0,class:`sm-node-detail`},ct={class:`sm-node-name`},lt={class:`sm-node-file`},ut={key:0},dt={key:0,class:`sm-node-desc`},ft={class:`sm-panel-body sm-source-body`},pt={key:0,class:`sm-source-overlay`},mt={key:1,class:`sm-source-overlay sm-source-placeholder`},k=D(C({__name:`SourceMapView`,setup(e){let C=pe(),E=u(C.currentDirectory||``),D=u(`idle`),k=u([]),ht=0,A=u(null),j=u(null),M=u(`files`),N=u(``),P=u(``),F=u(!1),I=u([]),L=u(new Set),R=u({files:!0,graph:!0,source:!0}),z=u(!1),gt=u(220),B=u(360),V=u(140),H=null,U=0,_t=0,W=0;function G(e,t){H=e,U=t.clientX,_t=t.clientY,W=e===`files`?gt.value:e===`source`?B.value:V.value,document.addEventListener(`mousemove`,vt),document.addEventListener(`mouseup`,K),t.preventDefault()}function vt(e){H&&(H===`files`?gt.value=Math.max(120,Math.min(480,W+e.clientX-U)):H===`source`?B.value=Math.max(200,Math.min(700,W+U-e.clientX)):V.value=Math.max(60,Math.min(500,W+_t-e.clientY)))}function K(){H=null,document.removeEventListener(`mousemove`,vt),document.removeEventListener(`mouseup`,K)}let q=u(null),J=oe(null),{fitView:yt,setNodes:Y,setEdges:bt,getNodes:xt,getEdges:St,updateNodeInternals:Ct}=le(),X=g(()=>D.value===`scanning`||D.value===`analyzing`),Z=g(()=>A.value?.nodes.find(e=>e.id===j.value)??null),wt=g(()=>{if(!A.value)return[];let e=new Map;for(let t of A.value.nodes){let n=t.subsystem??`__default__`;if(!e.has(n)){let r=A.value.subsystems?.find(e=>e.name===n);e.set(n,{displayName:r?.displayName||t.subsystem||O(`@SRCMAP:默认`),color:t.subsystemColor||$[0],nodes:[]})}e.get(n).nodes.push(t)}return[...e.entries()].map(([,e])=>e)});function Q(e,t=`info`){k.value.push({id:++ht,message:e,type:t,timestamp:Date.now()}),k.value.length>200&&k.value.splice(0,k.value.length-200)}function Tt(e){let t={name:``,path:``,kind:`dir`,children:[],childMap:new Map};for(let n of e){let e=n.trim().split(`/`).filter(Boolean),r=t,i=``;for(let t=0;t<e.length;t++){let n=e[t];i=i?`${i}/${n}`:n;let a=t===e.length-1,o=r.childMap.get(n);o||(o={name:n,path:i,kind:a?`file`:`dir`,children:[],childMap:new Map},r.childMap.set(n,o),r.children.push(o)),r=o}}let n=e=>{e.sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1),e.forEach(e=>{e.kind===`dir`&&n(e.children)})};return n(t.children),t.children}let $=[`#f59e0b`,`#3b82f6`,`#10b981`,`#8b5cf6`];function Et(e){return e.subsystemColor?e.subsystemColor:e.subsystemIndex===void 0?e.importance===`high`?`#f59e0b`:e.importance===`low`?`#94a3b8`:`#3b82f6`:$[e.subsystemIndex%$.length]}function Dt(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,svelte:`html`,html:`html`,py:`python`,java:`java`,go:`go`,rs:`rust`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,c:`c`,h:`c`,hpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`,swift:`swift`,kt:`kotlin`,sh:`shell`,bash:`shell`,json:`json`,yaml:`yaml`,yml:`yaml`,md:`markdown`,css:`css`,scss:`scss`,less:`less`,sql:`sql`}[e.split(`.`).pop()?.toLowerCase()||``]||`plaintext`}function Ot(){if(!q.value||J.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;J.value=fe.create(q.value,{value:``,language:`plaintext`,theme:e?`vs-dark`:`vs`,readOnly:!0,fontSize:12,lineHeight:19,fontFamily:`'JetBrains Mono', 'Fira Code', Consolas, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:`off`,padding:{top:8,bottom:8},scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6}})}function kt(e,t){let n={};t.forEach(e=>{n[e.source]||(n[e.source]=[]),n[e.source].push(e.target)});let r=new Map;e.forEach(e=>{let t=e.subsystem??`__default`;r.has(t)||r.set(t,[]),r.get(t).push(e)});let i=[],a=0;for(let[,e]of r){let t=new Set(e.map(e=>e.id)),r={},o=e.length?[e[0].id]:[];for(o[0]&&(r[o[0]]=0);o.length;){let e=o.shift();(n[e]||[]).filter(e=>t.has(e)).forEach(t=>{r[t]===void 0&&(r[t]=(r[e]??0)+1,o.push(t))})}let s={};e.forEach(e=>{let t=r[e.id]??0;s[t]=(s[t]||0)+1});let c={};e.forEach(e=>{let t=r[e.id]??0;c[t]=(c[t]??-1)+1;let n=c[t],o=s[t]??1,l=a*600+n*220-(o-1)*220/2,u=t*110,d=Et(e);i.push({id:e.id,type:`default`,position:{x:l,y:u},label:e.label,data:{...e},style:{background:`#1e293b`,border:`2px solid ${d}`,borderRadius:`8px`,color:`#e2e8f0`,fontSize:`12px`,padding:`8px 12px`,minWidth:`140px`,maxWidth:`200px`,cursor:`pointer`}})}),a++}return{flowNodes:i,flowEdges:t.map((e,t)=>({id:`e_${t}_${e.source}_${e.target}`,source:e.source,target:e.target,type:`smoothstep`,animated:!1,style:{stroke:`#475569`,strokeWidth:1.5},markerEnd:{type:te.ArrowClosed,color:`#475569`}}))}}async function At(){let e=xt.value,t=St.value;if(e.length!==0){z.value=!0;try{await y(),await new Promise(e=>requestAnimationFrame(()=>e())),Ct(e.map(e=>e.id)),await new Promise(e=>requestAnimationFrame(()=>e()));let n=new Map;e.forEach(e=>{let t=e.data?.subsystem??`__default__`;n.has(t)||n.set(t,[]),n.get(t).push(e)});let r=new Map,i=0;for(let[,e]of n){let n=new he.default.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,nodesep:55,ranksep:75,marginx:40,marginy:40});let a=new Set(e.map(e=>e.id));e.forEach(e=>{let t=190,r=e.data?.description?68:48,i=document.querySelector(`.vue-flow__node[data-id="${e.id}"]`);i&&i.offsetWidth>0&&(t=i.offsetWidth,r=i.offsetHeight),n.setNode(e.id,{width:t,height:r})}),t.forEach(e=>{a.has(e.source)&&a.has(e.target)&&n.setEdge(e.source,e.target)}),he.default.layout(n);let o=0;e.forEach(e=>{let t=n.node(e.id);t&&(r.set(e.id,{x:i+t.x-t.width/2,y:t.y-t.height/2}),o=Math.max(o,t.x+t.width/2))}),i+=o+120}Y(e.map(e=>({...e,position:r.get(e.id)??e.position}))),await y(),yt({padding:.18})}finally{z.value=!1}}}async function jt(){if(!E.value.trim()){ue.warning(O(`@SRCMAP:请先输入项目路径`));return}if(!X.value){k.value=[],A.value=null,j.value=null,N.value=``,P.value=``,Y([]),bt([]),D.value=`scanning`,Q(O(`@SRCMAP:开始分析项目...`),`info`);try{let e=await fetch(`/api/code-analysis/analyze`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:E.value})});if(!e.ok){let t=await e.json().catch(()=>({error:`请求失败`}));throw Error(t.error||`HTTP ${e.status}`)}let t=e.body.getReader(),n=new TextDecoder,r=``;D.value=`analyzing`;let i=``,a=[];for(;;){let{done:e,value:o}=await t.read();if(e)break;r+=n.decode(o,{stream:!0});let s=r.split(`
|
|
2
2
|
`);r=s.pop()??``;for(let e of s)if(e.startsWith(`event:`))i=e.slice(6).trim(),a=[];else if(e.startsWith(`data:`))a.push(e.slice(5).trim());else if(e===``){if(i&&a.length){let e=a.join(``);try{let t=JSON.parse(e);Mt(i,t)}catch{}}i=``,a=[]}}}catch(e){Q(`${O(`@SRCMAP:分析失败`)}: ${e.message}`,`error`),D.value=`error`}}}function Mt(e,t){if(e===`log`)Q(t.message,t.type||`info`);else if(e===`files`)I.value=Tt(t.files||[]),I.value.forEach(e=>{e.kind===`dir`&&L.value.add(e.path)});else if(e===`result`){A.value={language:t.language||``,entryFile:t.entryFile||``,entryFunction:t.entryFunction||``,nodes:Array.isArray(t.nodes)?t.nodes:[],edges:Array.isArray(t.edges)?t.edges:[],techStack:Array.isArray(t.techStack)?t.techStack:[],summary:t.summary||``,allFiles:Array.isArray(t.allFiles)?t.allFiles:[],codeFiles:Array.isArray(t.codeFiles)?t.codeFiles:[],subsystems:Array.isArray(t.subsystems)?t.subsystems:void 0};let{flowNodes:e,flowEdges:n}=kt(A.value.nodes,A.value.edges);Y(e),bt(n),y(()=>At())}else e===`done`&&(t.error?(Q(`${O(`@SRCMAP:分析失败`)}: ${t.error}`,`error`),D.value=`error`):D.value=`done`)}async function Nt(e){if(!(!e||F.value)&&P.value!==e){F.value=!0,P.value=e,N.value=``;try{let t=await(await fetch(`/api/code-analysis/file-content?path=${encodeURIComponent(E.value)}&file=${encodeURIComponent(e)}`)).json();if(t.error)throw Error(t.error);N.value=t.content||``}catch(e){N.value=`// ${O(`@SRCMAP:加载失败`)}: ${e.message}`}finally{F.value=!1}}}function Pt(e){let t=e.node.data;j.value=t.id,t.file&&Nt(t.file)}function Ft(e){L.value.has(e)?L.value.delete(e):L.value.add(e)}let It=g(()=>{let e=[];function t(n,r){for(let i of n){let n=L.value.has(i.path);e.push({name:i.name,path:i.path,kind:i.kind,depth:r,expanded:n}),i.kind===`dir`&&n&&t(i.children,r+1)}}return t(I.value,0),e});return r(()=>C.currentDirectory,e=>{e&&!E.value&&(E.value=e)}),r([N,P],([e,t])=>{let n=J.value;if(!n)return;let r=Dt(t||``),i=n.getModel(),a=fe.createModel(e||``,r);n.setModel(a),i?.dispose(),n.setScrollPosition({scrollTop:0,scrollLeft:0})}),ae(()=>{Ot(),!E.value&&C.currentDirectory&&(E.value=C.currentDirectory)}),se(()=>{J.value?.getModel()?.dispose(),J.value?.dispose(),K()}),(e,r)=>{let u=ee;return m(),_(`div`,ge,[S(`div`,_e,[S(`div`,ve,[r[9]||=S(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,class:`sm-icon-map`},[S(`polygon`,{points:`3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21`}),S(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`18`}),S(`line`,{x1:`15`,y1:`6`,x2:`15`,y2:`21`})],-1),S(`span`,ye,l(t(O)(`@SRCMAP:源码地图`)),1)]),S(`div`,be,[f(S(`input`,{"onUpdate:modelValue":r[0]||=e=>E.value=e,class:`sm-path-input`,placeholder:t(O)(`@SRCMAP:输入项目目录路径`),disabled:X.value,onKeydown:ie(jt,[`enter`])},null,40,xe),[[o,E.value]]),S(`button`,{class:`sm-btn sm-btn-primary`,disabled:X.value,onClick:jt},[X.value?(m(),_(d,{key:0},[r[10]||=S(`span`,{class:`sm-spinner`},null,-1),x(` `+l(t(O)(`@SRCMAP:分析中...`)),1)],64)):(m(),_(d,{key:1},[x(l(D.value===`done`?t(O)(`@SRCMAP:重新分析`):t(O)(`@SRCMAP:开始分析`)),1)],64))],8,Se)]),S(`div`,Ce,[h(u,{content:t(O)(`@SRCMAP:文件列表`),placement:`bottom`},{default:w(()=>[S(`button`,{class:v([`sm-panel-btn`,{active:R.value.files}]),onClick:r[1]||=e=>R.value.files=!R.value.files},r[11]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`})],-1)],2)]),_:1},8,[`content`]),h(u,{content:t(O)(`@SRCMAP:调用图`),placement:`bottom`},{default:w(()=>[S(`button`,{class:v([`sm-panel-btn`,{active:R.value.graph}]),onClick:r[2]||=e=>R.value.graph=!R.value.graph},r[12]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`circle`,{cx:`12`,cy:`12`,r:`3`}),S(`circle`,{cx:`3`,cy:`6`,r:`2`}),S(`circle`,{cx:`21`,cy:`6`,r:`2`}),S(`circle`,{cx:`3`,cy:`18`,r:`2`}),S(`circle`,{cx:`21`,cy:`18`,r:`2`}),S(`line`,{x1:`5`,y1:`6`,x2:`9`,y2:`11`}),S(`line`,{x1:`19`,y1:`6`,x2:`15`,y2:`11`}),S(`line`,{x1:`5`,y1:`18`,x2:`9`,y2:`13`}),S(`line`,{x1:`19`,y1:`18`,x2:`15`,y2:`13`})],-1)],2)]),_:1},8,[`content`]),h(u,{content:t(O)(`@SRCMAP:源码面板`),placement:`bottom`},{default:w(()=>[S(`button`,{class:v([`sm-panel-btn`,{active:R.value.source}]),onClick:r[3]||=e=>R.value.source=!R.value.source},r[13]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`polyline`,{points:`16 18 22 12 16 6`}),S(`polyline`,{points:`8 6 2 12 8 18`})],-1)],2)]),_:1},8,[`content`])])]),S(`div`,we,[f(S(`div`,{class:`sm-panel sm-panel-files`,style:c({width:gt.value+`px`})},[S(`div`,Te,[S(`button`,{class:v([`sm-tab-btn`,{active:M.value===`files`}]),onClick:r[4]||=e=>M.value=`files`},[r[14]||=S(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`})],-1),x(` `+l(t(O)(`@SRCMAP:文件列表`))+` `,1),A.value?(m(),_(`span`,Ee,l(A.value.allFiles.length),1)):b(``,!0)],2),S(`button`,{class:v([`sm-tab-btn`,{active:M.value===`outline`}]),onClick:r[5]||=e=>M.value=`outline`},[r[15]||=ce(`<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.8" data-v-39b8daed><line x1="8" y1="6" x2="21" y2="6" data-v-39b8daed></line><line x1="8" y1="12" x2="21" y2="12" data-v-39b8daed></line><line x1="8" y1="18" x2="21" y2="18" data-v-39b8daed></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-39b8daed></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-39b8daed></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-39b8daed></line></svg>`,1),x(` `+l(t(O)(`@SRCMAP:大纲`)),1)],2)]),f(S(`div`,De,[It.value.length>0?(m(!0),_(d,{key:0},T(It.value,e=>(m(),_(`div`,{key:e.path,class:v([`sm-tree-node`,{"sm-tree-node--dir":e.kind===`dir`,"sm-tree-node--active":e.kind===`file`&&P.value===e.path}]),style:c({paddingLeft:10+e.depth*14+`px`}),onClick:t=>e.kind===`dir`?Ft(e.path):Nt(e.path)},[e.kind===`dir`?(m(),_(`span`,{key:0,class:v([`sm-tree-arrow`,{expanded:e.expanded}])},r[16]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)],2)):(m(),_(`span`,ke)),e.kind===`dir`?(m(),_(`svg`,Ae,[S(`use`,{"xlink:href":`#${t(me)(e.name)||`icon-folder`}`},null,8,je)])):(m(),_(`svg`,Me,[S(`use`,{"xlink:href":`#${t(me)(e.name)}`},null,8,Ne)])),S(`span`,{class:`sm-tree-name`,title:e.path},l(e.name),9,Pe)],14,Oe))),128)):(m(),_(`div`,Fe,l(t(O)(`@SRCMAP:暂无文件,请先开始分析`)),1))],512),[[p,M.value===`files`]]),f(S(`div`,Ie,[wt.value.length>0?(m(!0),_(d,{key:0},T(wt.value,e=>(m(),_(`div`,{key:e.displayName,class:`sm-outline-group`},[S(`div`,{class:`sm-outline-group-header`,style:c({color:e.color})},[r[17]||=S(`svg`,{viewBox:`0 0 24 24`,width:`8`,height:`8`,fill:`currentColor`},[S(`circle`,{cx:`12`,cy:`12`,r:`6`})],-1),x(` `+l(e.displayName)+` `,1),S(`span`,Le,l(e.nodes.length),1)],4),(m(!0),_(d,null,T(e.nodes,t=>(m(),_(`div`,{key:t.id,class:v([`sm-outline-node`,{"sm-outline-node--active":j.value===t.id}]),onClick:e=>{j.value=t.id,t.file&&Nt(t.file)}},[S(`span`,{class:`sm-outline-dot`,style:c({background:e.color})},null,4),S(`span`,{class:`sm-outline-label`,title:t.file||t.label},l(t.label),9,ze),t.description?(m(),_(`span`,Be,l(t.description.length>18?t.description.slice(0,18)+`…`:t.description),1)):b(``,!0)],10,Re))),128))]))),128)):(m(),_(`div`,Ve,l(t(O)(`@SRCMAP:暂无分析结果`)),1))],512),[[p,M.value===`outline`]])],4),[[p,R.value.files]]),f(S(`div`,{class:`sm-resizer sm-resizer-v`,onMousedown:r[6]||=e=>G(`files`,e)},null,544),[[p,R.value.files&&R.value.graph]]),f(S(`div`,He,[A.value?(m(),_(`div`,Ue,[S(`span`,We,l(A.value.language),1),A.value.subsystems&&A.value.subsystems.length>1?(m(!0),_(d,{key:0},T(A.value.subsystems,e=>(m(),_(`span`,{key:e.name,class:`sm-subsystem-tag`,style:c({borderColor:e.color,color:e.color})},`● `+l(e.displayName||e.name),5))),128)):(m(!0),_(d,{key:1},T(A.value.techStack.slice(0,4),e=>(m(),_(`span`,{key:e,class:`sm-tech-tag`},l(e),1))),128)),S(`span`,Ge,l(A.value.summary),1)])):b(``,!0),S(`div`,Ke,[S(`div`,qe,[S(`button`,{class:`sm-layout-btn`,disabled:z.value||!A.value,onClick:At},[r[18]||=ce(`<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.8" data-v-39b8daed><rect x="3" y="3" width="7" height="7" rx="1" data-v-39b8daed></rect><rect x="14" y="3" width="7" height="7" rx="1" data-v-39b8daed></rect><rect x="3" y="14" width="7" height="7" rx="1" data-v-39b8daed></rect><rect x="14" y="14" width="7" height="7" rx="1" data-v-39b8daed></rect></svg>`,1),x(` `+l(z.value?t(O)(`@SRCMAP:布局中...`):t(O)(`@SRCMAP:优化布局`)),1)],8,Je)]),h(t(i),{class:`sm-vue-flow`,"default-viewport":{zoom:1},"min-zoom":.2,"max-zoom":4,"fit-view-on-init":``,onNodeClick:Pt},{"node-default":w(({data:e,label:n})=>[h(t(s),{type:`target`,position:t(re).Top},null,8,[`position`]),S(`div`,{class:`sm-fn-inner`,title:`${n}${e?.description?`
|
|
3
3
|
`+e.description:``}`},[S(`div`,Xe,l(n),1),e?.description?(m(),_(`div`,Ze,l(e.description.length>22?e.description.slice(0,22)+`…`:e.description),1)):b(``,!0)],8,Ye),h(t(s),{type:`source`,position:t(re).Bottom},null,8,[`position`])]),default:w(()=>[h(t(a),{variant:t(ne).Dots,gap:20,size:1,"pattern-color":`#334155`},null,8,[`variant`]),h(t(n)),h(t(de),{"node-color":`#3b82f6`})]),_:1}),!A.value&&!X.value?(m(),_(`div`,Qe,[(m(),_(`svg`,$e,r[19]||=[S(`polygon`,{points:`3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21`},null,-1),S(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`18`},null,-1),S(`line`,{x1:`15`,y1:`6`,x2:`15`,y2:`21`},null,-1)])),S(`p`,null,l(t(O)(`@SRCMAP:输入项目路径后点击开始分析`)),1)])):b(``,!0),X.value&&!A.value?(m(),_(`div`,et,[r[20]||=S(`span`,{class:`sm-spinner sm-spinner-lg`},null,-1),S(`p`,null,l(t(O)(`@SRCMAP:AI 正在分析项目结构...`)),1)])):b(``,!0)]),S(`div`,{class:`sm-resizer sm-resizer-h`,onMousedown:r[7]||=e=>G(`log`,e)},null,32),S(`div`,{class:`sm-log-panel`,style:c({height:V.value+`px`})},[S(`div`,tt,[r[21]||=S(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`polyline`,{points:`4 17 10 11 4 5`}),S(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`})],-1),x(` `+l(t(O)(`@SRCMAP:Agent 日志`))+` `,1),X.value?(m(),_(`span`,nt)):b(``,!0)]),S(`div`,rt,[(m(!0),_(d,null,T(k.value.slice(-50),e=>(m(),_(`div`,{key:e.id,class:v([`sm-log-entry`,`sm-log-entry--${e.type}`])},l(e.message),3))),128)),k.value.length===0?(m(),_(`div`,it,l(t(O)(`@SRCMAP:等待开始分析`)),1)):b(``,!0)],512)],4)],512),[[p,R.value.graph]]),f(S(`div`,{class:`sm-resizer sm-resizer-v`,onMousedown:r[8]||=e=>G(`source`,e)},null,544),[[p,R.value.graph&&R.value.source]]),f(S(`div`,{class:`sm-panel sm-panel-source`,style:c({width:B.value+`px`})},[S(`div`,at,[r[22]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[S(`polyline`,{points:`16 18 22 12 16 6`}),S(`polyline`,{points:`8 6 2 12 8 18`})],-1),x(` `+l(P.value||t(O)(`@SRCMAP:源码面板`))+` `,1),Z.value?(m(),_(`span`,ot,l(Z.value.label),1)):b(``,!0)]),Z.value?(m(),_(`div`,st,[S(`div`,ct,l(Z.value.label),1),S(`div`,lt,[x(l(Z.value.file),1),Z.value.line?(m(),_(`span`,ut,` :`+l(Z.value.line),1)):b(``,!0)]),Z.value.description?(m(),_(`div`,dt,l(Z.value.description),1)):b(``,!0)])):b(``,!0),S(`div`,ft,[F.value?(m(),_(`div`,pt,r[23]||=[S(`span`,{class:`sm-spinner`},null,-1)])):b(``,!0),!F.value&&!N.value?(m(),_(`div`,mt,l(t(O)(`@SRCMAP:点击调用图中的节点查看源码`)),1)):b(``,!0),S(`div`,{ref_key:`monacoContainerRef`,ref:q,class:`sm-monaco-container`},null,512)])],4),[[p,R.value.source]])])])}}}),[[`__scopeId`,`data-v-39b8daed`]]);export{k as default};
|