zen-gitsync 2.17.4 → 2.17.5
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 +2 -1
- package/scripts/release.js +93 -66
- package/src/ui/public/assets/{AgentView-BkNdHFRW.js → AgentView-DJOdvJEV.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-pJ33fsvn.js → AppVersionBadge-D2Li5_R-.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-Ixv2uRS6.js → BranchSelector-CSd5uaVm.js} +1 -1
- package/src/ui/public/assets/{CommitForm-DqJvDzSw.js → CommitForm-Ckg9-zay.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-DfT04-V7.js → CommonDialog-B8XOXtz_.js} +1 -1
- package/src/ui/public/assets/{EditorView-Br0JBESF.js → EditorView-Crj8S2TI.js} +1 -1
- package/src/ui/public/assets/{FileDiffViewer-C3DxCngU.js → FileDiffViewer-DL07IMz5.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-C_FOK1_9.js → FlowExecutionViewer-DvVT19Qv.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-wu9ieYbz.js → FlowOrchestrationWorkspace-kRhK9IyL.js} +1 -1
- package/src/ui/public/assets/{IconButton-CQB_swX6.js → IconButton-pqSYKRT8.js} +1 -1
- package/src/ui/public/assets/{LogList-CSpeYuAd.js → LogList-BrN6qtFb.js} +1 -1
- package/src/ui/public/assets/{MindmapView-8AHGHv9g.js → MindmapView-CSsT0NDZ.js} +1 -1
- package/src/ui/public/assets/{MonitorView-Do6DcGd9.js → MonitorView-edRyBybQ.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-DwrukeUb.js → ProjectStartupButton-DZ8VgU79.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-Dhdwvb2y.js → RemoteManagerDialog-pu9szuYB.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-DjKHYGRi.js → RemoteRepoCard-BSFehgY5.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-COuEBUTw.js → SourceMapView-DbEydLSU.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-C6aJB-3Q.js → SvgIcon-BVCbrPws.js} +1 -1
- package/src/ui/public/assets/{TemplateManager-Th1ibeIh.js → TemplateManager-DPyYaGCE.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-B8F60XEE.js → UserInputNode-DXHeCjzG.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-CKXtZAJn.css +1 -0
- package/src/ui/public/assets/WorkbenchView-DGcirla3.js +13 -0
- package/src/ui/public/assets/{_plugin-vue_export-helper-nUAWISuX.js → _plugin-vue_export-helper-C-YBnnP5.js} +2 -2
- package/src/ui/public/assets/{configStore-CRYvJSvr.js → configStore-DoobmT7N.js} +1 -1
- package/src/ui/public/assets/{gitStore-QokQdW7C.js → gitStore-BJbNtjxA.js} +1 -1
- package/src/ui/public/assets/{index-BLO9MkBC.js → index-ndDaGoRO.js} +4 -4
- package/src/ui/public/assets/{previewSandbox-CA1fFxdo.js → previewSandbox-BZV6Eqhv.js} +0 -0
- package/src/ui/public/index.html +10 -10
- package/src/ui/public/assets/WorkbenchView-CML-A0y6.css +0 -1
- package/src/ui/public/assets/WorkbenchView-jutdH9WI.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,G as o,In as s,Mn as ee,Nn as c,On as l,Pn as u,Pr as d,Qr as f,Tn as p,Wn as m,Yn as te,Yr as h,Zn as g,_n as _,a as v,bn as ne,br as y,cr as re,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,un as E,xn as D,xr as ie,yn as ae}from"./element-plus-KTmRV-so.js";import{n as O,t as k}from"./_plugin-vue_export-helper-nUAWISuX.js";import{t as oe}from"./SvgIcon-C6aJB-3Q.js";import{t as se}from"./configStore-CRYvJSvr.js";import{n as ce,r as le,t as ue}from"./useThemeObserver-B01D-Vl6.js";import{a as de,i as fe,n as pe,r as me,s as he,t as ge}from"./previewSandbox-CA1fFxdo.js";import{a as _e,c as ve,l as ye,n as be,o as xe,r as Se,s as Ce}from"./monaco-DkJuNcCr.js";import{r as A,t as j}from"./flow-mindmap-CurCIiCp.js";import{r as we}from"./index-BLO9MkBC.js";function Te(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`}t(),C();var M={class:`mindmap-preview`},Ee={class:`mindmap-preview-canvas`},De=k(s({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=p(()=>j(t.content||``,`未命名文档`));return(e,t)=>(g(),b(`div`,M,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,Ee,[u(a(A),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-6929f46f`]]);t(),C(),d(),E();var Oe={class:`sidebar-header`},ke={class:`sidebar-title`},Ae={class:`sidebar-actions`},je={class:`sidebar-search`},Me=[`placeholder`,`title`],Ne=[`title`,`aria-label`],Pe={key:0,class:`sidebar-tree`},Fe={key:1,class:`tree-arrow-spacer`},Ie={class:`tree-icon mit-icon`,"aria-hidden":`true`},Le=[`xlink:href`],Re=[`onClick`,`onContextmenu`],ze={key:1,class:`tree-arrow-spacer`},Be={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ve=[`xlink:href`],He={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ue=[`xlink:href`],We=[`title`],Ge={key:0,class:`tree-name-hit`},Ke={key:4,class:`tree-loading`},qe={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)`}},Je={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)`}},Ye=[`placeholder`],Xe={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Ze={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)`}},Qe={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)`}},$e=[`placeholder`],et={key:1,class:`tree-empty`},tt={key:1,class:`sidebar-loading`},nt={class:`editor-main`},rt={key:0,class:`editor-tabs`},it=[`onClick`,`title`],at={class:`tab-name`},ot={key:0,class:`tab-dirty-dot`},st=[`onClick`],ct=[`title`],lt=[`disabled`,`title`],ut={key:1,class:`editor-empty`},dt={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`}},ft={class:`editor-empty-hint`},pt={class:`editor-body`},mt={key:0,class:`image-tab-placeholder`},ht={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`}},gt={class:`image-tab-placeholder-title`},_t={class:`image-tab-placeholder-hint`},vt={class:`preview-header`},yt={class:`preview-title`},bt={class:`preview-ext-badge`},xt=[`title`],St={class:`preview-body`},Ct=[`sandbox`,`srcdoc`],wt=15e3,N=k(s({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new ve:t===`css`||t===`scss`||t===`less`?new Ce:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new _e:new ye}};let s=t,d=se(),C=we(),E=y([]),k=y(!1),A=y(``),j=y(``),M=null;function Ee(){A.value=``,j.value=``,M&&=(clearTimeout(M),null)}S(A,e=>{M&&clearTimeout(M),M=setTimeout(()=>{j.value=e,M=null},180)}),w(()=>{M&&clearTimeout(M),Et()});let N=null;function Tt(){Et(),N=setInterval(()=>{document.hidden||d.currentDirectory&&(A.value.trim()||jt())},wt)}function Et(){N&&=(clearInterval(N),null)}S(()=>d.currentDirectory,()=>{Tt()});async function Dt(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 Ot(){let e=d.currentDirectory;if(e){k.value=!0;try{E.value=await Dt(e,0)}finally{k.value=!1}}}function kt(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&kt(n.children,t));return t}async function At(e,t){for(let n of e)n.type===`directory`&&t.has(n.path)&&(n.children||=await Dt(n.path,n.depth+1),n.expanded=!0,await At(n.children,t))}async function jt(){let e=d.currentDirectory;if(!e)return;let t=kt(E.value);k.value=!0;try{E.value=await Dt(e,0),t.size>0&&await At(E.value,t)}finally{k.value=!1}}async function P(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Dt(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Mt(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Mt(n.children));return t}let Nt=p(()=>j.value.trim().toLowerCase());function Pt(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Pt(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let Ft=p(()=>Pt(E.value,Nt.value)),It=p(()=>Nt.value.length>0&&Ft.value.length===0);function Lt(e){let t=j.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Rt=y(null);function zt(){let e=Rt.value;e&&(e.focus(),e.select())}function Bt(){A.value?(Ee(),Rt.value?.focus()):(Rt.value?.blur(),R.value?.focus())}let F=y([]),I=y(null),L=y(null);async function Vt(e){if(L.value=e,e.type!==`file`){P(e);return}let t=F.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:F.value.length}),t){I.value=e.path,m(()=>B());return}let n=e.name.split(`.`).pop()||``;if(En.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`};F.value.push(t),I.value=e.path,Y.value=!0;return}if(he(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`};F.value.push(t),I.value=e.path,X.value=!1,Y.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){v.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=Te(n),a={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:a.path,name:a.name,contentLen:a.content.length,lang:a.language}),F.value.push(a),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),v.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>s.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await m();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Vt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Ht(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Ut=()=>F.value.find(e=>e.path===I.value)??null,Wt=y(null),R=ie(null),z=new Map;function Gt(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=Se.createModel(e.content,e.language,be.file(e.path)),z.set(e.path,t)),t}function Kt(){if(!Wt.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=Se.create(Wt.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},editContext:!1}),R.value.onDidChangeModelContent(()=>{let e=Ut();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{d.ui.editorAutoSave&&Ut()?.isDirty&&Jt(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})})}S(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=Gt(t);R.value.setModel(n),m(()=>B())});function B(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}S(()=>F.value.filter(e=>e.isDirty).length,e=>{C.setDirtyCount(e)},{immediate:!0}),w(()=>C.setDirtyCount(0)),ue(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Se.setTheme(e?`vs-dark`:`vs`)});let V=null;function qt(){if(V||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}V=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&I.value&&R.value&&requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})});let n=V;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}te(async()=>{Kt(),await Ot(),qt(),Tt(),I.value&&m(()=>B())}),w(()=>{V?.disconnect(),V=null,R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function Jt(e=!1){let t=Ut();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){v.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,e||v.success(O(`@EDITOR:已保存`))}catch(e){v.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function Yt(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),zt();return}t&&e.key===`s`&&(e.preventDefault(),Jt())}te(()=>window.addEventListener(`keydown`,Yt)),w(()=>window.removeEventListener(`keydown`,Yt));let H=y(null),Xt=y(220),Zt=!1,Qt=0,$t=0;function en(e){Zt=!0,Qt=e.clientX,$t=Xt.value,document.addEventListener(`mousemove`,tn),document.addEventListener(`mouseup`,nn),e.preventDefault()}function tn(e){if(!Zt)return;let t=e.clientX-Qt;Xt.value=Math.max(140,Math.min(400,$t+t))}function nn(){Zt=!1,document.removeEventListener(`mousemove`,tn),document.removeEventListener(`mouseup`,nn)}function rn(e){return e.type===`directory`?le(e.name):ce(e.name)}let U=y(null),W=y(null),G=y(null),an=y(null);function K(){let e=L.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(/[\\/][^\\/]+$/,``):d.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:d.currentDirectory??``,afterNode:null,depth:0}}async function on(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`file`,value:``},await m(),G.value?.focus()}async function sn(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`directory`,value:``},await m(),G.value?.focus()}function cn(){U.value=null}async function ln(){let e=U.value;if(!e||!e.value.trim()){U.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){v.error(e.error);return}v.success(O(`@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){v.error(e.error);return}v.success(O(`@EDITOR:创建成功`))}U.value=null,await jt()}function un(e){e.key===`Enter`&&(e.preventDefault(),ln()),e.key===`Escape`&&(e.preventDefault(),cn())}let q=y(null),dn=y(null);function fn(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function pn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`file`,value:``},await m(),G.value?.focus()}async function mn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`directory`,value:``},await m(),G.value?.focus()}async function hn(){let e=q.value?.node;J(),e&&(W.value={node:e,value:e.name},await m(),an.value?.focus(),an.value?.select())}async function gn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.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){v.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await jt()}function _n(e){e.key===`Enter`&&(e.preventDefault(),gn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function vn(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){v.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),v.success(O(`@EDITOR:已删除`)),await jt()}async function yn(){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||v.error(t.error)}catch(e){v.error(e?.message||String(e))}}function bn(e){let t=d.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function xn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function Sn(){let e=q.value?.node;J(),e&&(await xn(e.path)?v.success(O(`@EDITOR:已复制到剪贴板`)):v.error(O(`@EDITOR:复制失败`)))}async function Cn(){let e=q.value?.node;J(),e&&(await xn(bn(e.path))?v.success(O(`@EDITOR:已复制到剪贴板`)):v.error(O(`@EDITOR:复制失败`)))}async function wn(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){v.error(e?.message||String(e))}}te(()=>document.addEventListener(`click`,J)),w(()=>document.removeEventListener(`click`,J));let Tn=new Set([`md`,`html`,`htm`,`svg`]),En=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),Y=y(!1),X=y(!1),Dn=y(0),Z=p(()=>F.value.find(e=>e.path===I.value)??null),On=p(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),kn=p(()=>Z.value?.language===`office`),Q=p(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),An=p(()=>Tn.has(Q.value)||En.has(Q.value)||he(Q.value)),jn=p(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=p(()=>Q.value===`md`&&jn.value>0);S(I,()=>{Y.value&&!An.value&&(Y.value=!1),X.value&&!$.value&&(X.value=!1)});function Mn(){An.value&&(Y.value||(X.value=!1),Y.value=!Y.value)}function Nn(){$.value&&(X.value||(Y.value=!1),X.value=!X.value)}let Pn=p(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?pe(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),Fn=!1,In=0,Ln=0;function Rn(e){Fn=!0,In=e.clientX,Ln=Dn.value,document.addEventListener(`mousemove`,zn),document.addEventListener(`mouseup`,Bn),e.preventDefault()}function zn(e){if(!Fn)return;let t=e.clientX-In;Dn.value=Math.max(200,Math.min(900,Ln+t))}function Bn(){Fn=!1,document.removeEventListener(`mousemove`,zn),document.removeEventListener(`mouseup`,Bn)}return(t,s)=>(g(),b(D,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[i(`div`,{class:`editor-sidebar`,style:h({width:Xt.value+`px`})},[i(`div`,Oe,[i(`span`,ke,f(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Ae,[u(a(o),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:on},[...s[9]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:sn},[...s[10]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Ot},[...s[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,je,[s[13]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Rt,"onUpdate:modelValue":s[0]||=e=>A.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ae(Bt,[`escape`])},null,40,Me),[[_,A.value]]),A.value?(g(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:Ee},[...s[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ne)):l(``,!0)]),k.value?(g(),b(`div`,tt,[...s[22]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(g(),b(`div`,Pe,[(g(!0),b(D,null,e(Mt(Ft.value),t=>(g(),b(D,{key:t.path},[W.value&&W.value.node.path===t.path?(g(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,Fe)),(g(),b(`svg`,Ie,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Le)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:an,"onUpdate:modelValue":s[1]||=e=>W.value.value=e,onKeydown:_n,onBlur:gn,onClick:s[2]||=ne(()=>{},[`stop`])},null,544),[[_,W.value.value]])],4)):(g(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:h({paddingLeft:12+t.depth*14+`px`}),onClick:e=>Vt(t),onContextmenu:e=>fn(e,t)},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[15]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,ze)),t.type===`directory`?(g(),b(`svg`,Be,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Ve)])):(g(),b(`svg`,He,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Ue)])),i(`span`,{class:`tree-name`,title:t.path},[(g(!0),b(D,null,e(Lt(t.name),(e,t)=>(g(),b(D,{key:t},[e.hit?(g(),b(`span`,Ge,f(e.text),1)):(g(),b(D,{key:1},[c(f(e.text),1)],64))],64))),128))],8,We),t.loading?(g(),b(`span`,Ke)):l(``,!0)],46,Re)),U.value&&U.value.afterNode?.path===t.path?(g(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+U.value.depth*14+`px`})},[s[18]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,qe,[...s[16]||=[i(`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`},null,-1)]])):(g(),b(`svg`,Je,[...s[17]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[3]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[4]||=ne(()=>{},[`stop`])},null,40,Ye),[[_,U.value.value]])],4)):l(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(g(),b(`div`,Xe,[s[21]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,Ze,[...s[19]||=[i(`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`},null,-1)]])):(g(),b(`svg`,Qe,[...s[20]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[5]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[6]||=ne(()=>{},[`stop`])},null,40,$e),[[_,U.value.value]])])):l(``,!0),!U.value&&(It.value||E.value.length===0)?(g(),b(`div`,et,f(It.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):l(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:en},null,32),i(`div`,nt,[F.value.length>0?(g(),b(`div`,rt,[(g(!0),b(D,null,e(F.value,e=>(g(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,at,f(e.name),1),e.isDirty?(g(),b(`span`,ot)):l(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Ht(e.path,t)},[...s[23]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,st)],10,it))),128)),s[26]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),An.value?(g(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:Y.value}]),title:Y.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:Mn},[s[24]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,f(a(O)(`@EDITOR:预览`)),1)],10,ct)):l(``,!0),$.value?(g(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:X.value,disabled:!$.value}]),disabled:!$.value,title:$.value?X.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:Nn},[s[25]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-6bc4e9b4><circle cx="12" cy="12" r="2" data-v-6bc4e9b4></circle><circle cx="5" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="5" cy="18" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="18" r="1.6" data-v-6bc4e9b4></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-6bc4e9b4></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-6bc4e9b4></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-6bc4e9b4></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-6bc4e9b4></line></svg>`,1),i(`span`,null,f(a(O)(`@EDITOR:思维导图`)),1)],10,lt)):l(``,!0)])):l(``,!0),F.value.length===0?(g(),b(`div`,ut,[(g(),b(`svg`,dt,[...s[27]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,f(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,ft,f(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):l(``,!0),i(`div`,pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||On.value||kn.value}]),ref_key:`editorContainerRef`,ref:Wt},null,2),On.value&&F.value.length>0&&!Y.value&&!X.value?(g(),b(`div`,mt,[(g(),b(`svg`,ht,[...s[28]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,gt,f(Z.value?.name),1),i(`p`,_t,f(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:Rn},null,32)):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:2,class:`preview-panel`,style:h({flexBasis:Dn.value+`px`})},[i(`div`,vt,[i(`span`,yt,f(X.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,bt,f(Q.value.toUpperCase()),1),s[30]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:X.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:s[7]||=e=>X.value?X.value=!1:Y.value=!1},[...s[29]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,xt)]),i(`div`,St,[X.value&&Q.value===`md`&&Z.value?(g(),r(De,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):Y.value&&Q.value===`md`&&Z.value?(g(),r(fe,{key:1,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):Y.value&&[`html`,`htm`,`svg`].includes(Q.value)?(g(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(ge),srcdoc:Pn.value},null,8,Ct)):Y.value&&a(En).has(Q.value)&&Z.value?(g(),r(de,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):Y.value&&kn.value&&Z.value?(g(),r(me,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):l(``,!0)])],4)):l(``,!0)])])],512),(g(),r(n,{to:`body`},[q.value?(g(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:dn,class:`ctx-menu`,style:h({left:q.value.x+`px`,top:q.value.y+`px`}),onClick:s[8]||=ne(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:pn},[s[31]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),c(` `+f(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:mn},[s[32]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),c(` `+f(a(O)(`@EDITOR:新建文件夹`)),1)]),s[38]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:Sn},[s[33]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),c(` `+f(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Cn},[s[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),c(` `+f(a(O)(`@EDITOR:复制相对路径`)),1)]),s[39]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:yn},[s[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),c(` `+f(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:wn},[u(oe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),c(` `+f(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:hn},[s[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),c(` `+f(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:vn},[s[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),c(` `+f(a(O)(`@EDITOR:删除`)),1)])],4)):l(``,!0)]))],64))}}),[[`__scopeId`,`data-v-6bc4e9b4`]]);export{N as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,G as o,In as s,Mn as ee,Nn as c,On as l,Pn as u,Pr as d,Qr as f,Tn as p,Wn as m,Yn as te,Yr as h,Zn as g,_n as _,a as v,bn as ne,br as y,cr as re,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,un as E,xn as D,xr as ie,yn as ae}from"./element-plus-KTmRV-so.js";import{n as O,t as k}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{t as oe}from"./SvgIcon-BVCbrPws.js";import{t as se}from"./configStore-DoobmT7N.js";import{n as ce,r as le,t as ue}from"./useThemeObserver-B01D-Vl6.js";import{a as de,i as fe,n as pe,r as me,s as he,t as ge}from"./previewSandbox-BZV6Eqhv.js";import{a as _e,c as ve,l as ye,n as be,o as xe,r as Se,s as Ce}from"./monaco-DkJuNcCr.js";import{r as A,t as j}from"./flow-mindmap-CurCIiCp.js";import{r as we}from"./index-ndDaGoRO.js";function Te(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`}t(),C();var M={class:`mindmap-preview`},Ee={class:`mindmap-preview-canvas`},De=k(s({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=p(()=>j(t.content||``,`未命名文档`));return(e,t)=>(g(),b(`div`,M,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,Ee,[u(a(A),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-6929f46f`]]);t(),C(),d(),E();var Oe={class:`sidebar-header`},ke={class:`sidebar-title`},Ae={class:`sidebar-actions`},je={class:`sidebar-search`},Me=[`placeholder`,`title`],Ne=[`title`,`aria-label`],Pe={key:0,class:`sidebar-tree`},Fe={key:1,class:`tree-arrow-spacer`},Ie={class:`tree-icon mit-icon`,"aria-hidden":`true`},Le=[`xlink:href`],Re=[`onClick`,`onContextmenu`],ze={key:1,class:`tree-arrow-spacer`},Be={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ve=[`xlink:href`],He={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ue=[`xlink:href`],We=[`title`],Ge={key:0,class:`tree-name-hit`},Ke={key:4,class:`tree-loading`},qe={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)`}},Je={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)`}},Ye=[`placeholder`],Xe={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Ze={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)`}},Qe={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)`}},$e=[`placeholder`],et={key:1,class:`tree-empty`},tt={key:1,class:`sidebar-loading`},nt={class:`editor-main`},rt={key:0,class:`editor-tabs`},it=[`onClick`,`title`],at={class:`tab-name`},ot={key:0,class:`tab-dirty-dot`},st=[`onClick`],ct=[`title`],lt=[`disabled`,`title`],ut={key:1,class:`editor-empty`},dt={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`}},ft={class:`editor-empty-hint`},pt={class:`editor-body`},mt={key:0,class:`image-tab-placeholder`},ht={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`}},gt={class:`image-tab-placeholder-title`},_t={class:`image-tab-placeholder-hint`},vt={class:`preview-header`},yt={class:`preview-title`},bt={class:`preview-ext-badge`},xt=[`title`],St={class:`preview-body`},Ct=[`sandbox`,`srcdoc`],wt=15e3,N=k(s({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new ve:t===`css`||t===`scss`||t===`less`?new Ce:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new _e:new ye}};let s=t,d=se(),C=we(),E=y([]),k=y(!1),A=y(``),j=y(``),M=null;function Ee(){A.value=``,j.value=``,M&&=(clearTimeout(M),null)}S(A,e=>{M&&clearTimeout(M),M=setTimeout(()=>{j.value=e,M=null},180)}),w(()=>{M&&clearTimeout(M),Et()});let N=null;function Tt(){Et(),N=setInterval(()=>{document.hidden||d.currentDirectory&&(A.value.trim()||jt())},wt)}function Et(){N&&=(clearInterval(N),null)}S(()=>d.currentDirectory,()=>{Tt()});async function Dt(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 Ot(){let e=d.currentDirectory;if(e){k.value=!0;try{E.value=await Dt(e,0)}finally{k.value=!1}}}function kt(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&kt(n.children,t));return t}async function At(e,t){for(let n of e)n.type===`directory`&&t.has(n.path)&&(n.children||=await Dt(n.path,n.depth+1),n.expanded=!0,await At(n.children,t))}async function jt(){let e=d.currentDirectory;if(!e)return;let t=kt(E.value);k.value=!0;try{E.value=await Dt(e,0),t.size>0&&await At(E.value,t)}finally{k.value=!1}}async function P(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Dt(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Mt(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Mt(n.children));return t}let Nt=p(()=>j.value.trim().toLowerCase());function Pt(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Pt(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let Ft=p(()=>Pt(E.value,Nt.value)),It=p(()=>Nt.value.length>0&&Ft.value.length===0);function Lt(e){let t=j.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Rt=y(null);function zt(){let e=Rt.value;e&&(e.focus(),e.select())}function Bt(){A.value?(Ee(),Rt.value?.focus()):(Rt.value?.blur(),R.value?.focus())}let F=y([]),I=y(null),L=y(null);async function Vt(e){if(L.value=e,e.type!==`file`){P(e);return}let t=F.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:F.value.length}),t){I.value=e.path,m(()=>B());return}let n=e.name.split(`.`).pop()||``;if(En.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`};F.value.push(t),I.value=e.path,Y.value=!0;return}if(he(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`};F.value.push(t),I.value=e.path,X.value=!1,Y.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){v.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=Te(n),a={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:a.path,name:a.name,contentLen:a.content.length,lang:a.language}),F.value.push(a),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),v.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>s.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await m();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Vt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Ht(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Ut=()=>F.value.find(e=>e.path===I.value)??null,Wt=y(null),R=ie(null),z=new Map;function Gt(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=Se.createModel(e.content,e.language,be.file(e.path)),z.set(e.path,t)),t}function Kt(){if(!Wt.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=Se.create(Wt.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},editContext:!1}),R.value.onDidChangeModelContent(()=>{let e=Ut();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{d.ui.editorAutoSave&&Ut()?.isDirty&&Jt(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})})}S(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=Gt(t);R.value.setModel(n),m(()=>B())});function B(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}S(()=>F.value.filter(e=>e.isDirty).length,e=>{C.setDirtyCount(e)},{immediate:!0}),w(()=>C.setDirtyCount(0)),ue(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Se.setTheme(e?`vs-dark`:`vs`)});let V=null;function qt(){if(V||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}V=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&I.value&&R.value&&requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})});let n=V;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}te(async()=>{Kt(),await Ot(),qt(),Tt(),I.value&&m(()=>B())}),w(()=>{V?.disconnect(),V=null,R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function Jt(e=!1){let t=Ut();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){v.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,e||v.success(O(`@EDITOR:已保存`))}catch(e){v.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function Yt(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),zt();return}t&&e.key===`s`&&(e.preventDefault(),Jt())}te(()=>window.addEventListener(`keydown`,Yt)),w(()=>window.removeEventListener(`keydown`,Yt));let H=y(null),Xt=y(220),Zt=!1,Qt=0,$t=0;function en(e){Zt=!0,Qt=e.clientX,$t=Xt.value,document.addEventListener(`mousemove`,tn),document.addEventListener(`mouseup`,nn),e.preventDefault()}function tn(e){if(!Zt)return;let t=e.clientX-Qt;Xt.value=Math.max(140,Math.min(400,$t+t))}function nn(){Zt=!1,document.removeEventListener(`mousemove`,tn),document.removeEventListener(`mouseup`,nn)}function rn(e){return e.type===`directory`?le(e.name):ce(e.name)}let U=y(null),W=y(null),G=y(null),an=y(null);function K(){let e=L.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(/[\\/][^\\/]+$/,``):d.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:d.currentDirectory??``,afterNode:null,depth:0}}async function on(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`file`,value:``},await m(),G.value?.focus()}async function sn(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`directory`,value:``},await m(),G.value?.focus()}function cn(){U.value=null}async function ln(){let e=U.value;if(!e||!e.value.trim()){U.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){v.error(e.error);return}v.success(O(`@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){v.error(e.error);return}v.success(O(`@EDITOR:创建成功`))}U.value=null,await jt()}function un(e){e.key===`Enter`&&(e.preventDefault(),ln()),e.key===`Escape`&&(e.preventDefault(),cn())}let q=y(null),dn=y(null);function fn(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function pn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`file`,value:``},await m(),G.value?.focus()}async function mn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`directory`,value:``},await m(),G.value?.focus()}async function hn(){let e=q.value?.node;J(),e&&(W.value={node:e,value:e.name},await m(),an.value?.focus(),an.value?.select())}async function gn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.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){v.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await jt()}function _n(e){e.key===`Enter`&&(e.preventDefault(),gn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function vn(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){v.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),v.success(O(`@EDITOR:已删除`)),await jt()}async function yn(){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||v.error(t.error)}catch(e){v.error(e?.message||String(e))}}function bn(e){let t=d.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function xn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function Sn(){let e=q.value?.node;J(),e&&(await xn(e.path)?v.success(O(`@EDITOR:已复制到剪贴板`)):v.error(O(`@EDITOR:复制失败`)))}async function Cn(){let e=q.value?.node;J(),e&&(await xn(bn(e.path))?v.success(O(`@EDITOR:已复制到剪贴板`)):v.error(O(`@EDITOR:复制失败`)))}async function wn(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){v.error(e?.message||String(e))}}te(()=>document.addEventListener(`click`,J)),w(()=>document.removeEventListener(`click`,J));let Tn=new Set([`md`,`html`,`htm`,`svg`]),En=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),Y=y(!1),X=y(!1),Dn=y(0),Z=p(()=>F.value.find(e=>e.path===I.value)??null),On=p(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),kn=p(()=>Z.value?.language===`office`),Q=p(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),An=p(()=>Tn.has(Q.value)||En.has(Q.value)||he(Q.value)),jn=p(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=p(()=>Q.value===`md`&&jn.value>0);S(I,()=>{Y.value&&!An.value&&(Y.value=!1),X.value&&!$.value&&(X.value=!1)});function Mn(){An.value&&(Y.value||(X.value=!1),Y.value=!Y.value)}function Nn(){$.value&&(X.value||(Y.value=!1),X.value=!X.value)}let Pn=p(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?pe(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),Fn=!1,In=0,Ln=0;function Rn(e){Fn=!0,In=e.clientX,Ln=Dn.value,document.addEventListener(`mousemove`,zn),document.addEventListener(`mouseup`,Bn),e.preventDefault()}function zn(e){if(!Fn)return;let t=e.clientX-In;Dn.value=Math.max(200,Math.min(900,Ln+t))}function Bn(){Fn=!1,document.removeEventListener(`mousemove`,zn),document.removeEventListener(`mouseup`,Bn)}return(t,s)=>(g(),b(D,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[i(`div`,{class:`editor-sidebar`,style:h({width:Xt.value+`px`})},[i(`div`,Oe,[i(`span`,ke,f(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Ae,[u(a(o),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:on},[...s[9]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:sn},[...s[10]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Ot},[...s[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,je,[s[13]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Rt,"onUpdate:modelValue":s[0]||=e=>A.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ae(Bt,[`escape`])},null,40,Me),[[_,A.value]]),A.value?(g(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:Ee},[...s[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ne)):l(``,!0)]),k.value?(g(),b(`div`,tt,[...s[22]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(g(),b(`div`,Pe,[(g(!0),b(D,null,e(Mt(Ft.value),t=>(g(),b(D,{key:t.path},[W.value&&W.value.node.path===t.path?(g(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,Fe)),(g(),b(`svg`,Ie,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Le)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:an,"onUpdate:modelValue":s[1]||=e=>W.value.value=e,onKeydown:_n,onBlur:gn,onClick:s[2]||=ne(()=>{},[`stop`])},null,544),[[_,W.value.value]])],4)):(g(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:h({paddingLeft:12+t.depth*14+`px`}),onClick:e=>Vt(t),onContextmenu:e=>fn(e,t)},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[15]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,ze)),t.type===`directory`?(g(),b(`svg`,Be,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Ve)])):(g(),b(`svg`,He,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Ue)])),i(`span`,{class:`tree-name`,title:t.path},[(g(!0),b(D,null,e(Lt(t.name),(e,t)=>(g(),b(D,{key:t},[e.hit?(g(),b(`span`,Ge,f(e.text),1)):(g(),b(D,{key:1},[c(f(e.text),1)],64))],64))),128))],8,We),t.loading?(g(),b(`span`,Ke)):l(``,!0)],46,Re)),U.value&&U.value.afterNode?.path===t.path?(g(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+U.value.depth*14+`px`})},[s[18]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,qe,[...s[16]||=[i(`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`},null,-1)]])):(g(),b(`svg`,Je,[...s[17]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[3]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[4]||=ne(()=>{},[`stop`])},null,40,Ye),[[_,U.value.value]])],4)):l(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(g(),b(`div`,Xe,[s[21]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,Ze,[...s[19]||=[i(`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`},null,-1)]])):(g(),b(`svg`,Qe,[...s[20]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[5]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[6]||=ne(()=>{},[`stop`])},null,40,$e),[[_,U.value.value]])])):l(``,!0),!U.value&&(It.value||E.value.length===0)?(g(),b(`div`,et,f(It.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):l(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:en},null,32),i(`div`,nt,[F.value.length>0?(g(),b(`div`,rt,[(g(!0),b(D,null,e(F.value,e=>(g(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,at,f(e.name),1),e.isDirty?(g(),b(`span`,ot)):l(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Ht(e.path,t)},[...s[23]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,st)],10,it))),128)),s[26]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),An.value?(g(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:Y.value}]),title:Y.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:Mn},[s[24]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,f(a(O)(`@EDITOR:预览`)),1)],10,ct)):l(``,!0),$.value?(g(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:X.value,disabled:!$.value}]),disabled:!$.value,title:$.value?X.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:Nn},[s[25]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-6bc4e9b4><circle cx="12" cy="12" r="2" data-v-6bc4e9b4></circle><circle cx="5" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="5" cy="18" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="18" r="1.6" data-v-6bc4e9b4></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-6bc4e9b4></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-6bc4e9b4></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-6bc4e9b4></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-6bc4e9b4></line></svg>`,1),i(`span`,null,f(a(O)(`@EDITOR:思维导图`)),1)],10,lt)):l(``,!0)])):l(``,!0),F.value.length===0?(g(),b(`div`,ut,[(g(),b(`svg`,dt,[...s[27]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,f(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,ft,f(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):l(``,!0),i(`div`,pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||On.value||kn.value}]),ref_key:`editorContainerRef`,ref:Wt},null,2),On.value&&F.value.length>0&&!Y.value&&!X.value?(g(),b(`div`,mt,[(g(),b(`svg`,ht,[...s[28]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,gt,f(Z.value?.name),1),i(`p`,_t,f(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:Rn},null,32)):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:2,class:`preview-panel`,style:h({flexBasis:Dn.value+`px`})},[i(`div`,vt,[i(`span`,yt,f(X.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,bt,f(Q.value.toUpperCase()),1),s[30]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:X.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:s[7]||=e=>X.value?X.value=!1:Y.value=!1},[...s[29]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,xt)]),i(`div`,St,[X.value&&Q.value===`md`&&Z.value?(g(),r(De,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):Y.value&&Q.value===`md`&&Z.value?(g(),r(fe,{key:1,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):Y.value&&[`html`,`htm`,`svg`].includes(Q.value)?(g(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(ge),srcdoc:Pn.value},null,8,Ct)):Y.value&&a(En).has(Q.value)&&Z.value?(g(),r(de,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):Y.value&&kn.value&&Z.value?(g(),r(me,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):l(``,!0)])],4)):l(``,!0)])])],512),(g(),r(n,{to:`body`},[q.value?(g(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:dn,class:`ctx-menu`,style:h({left:q.value.x+`px`,top:q.value.y+`px`}),onClick:s[8]||=ne(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:pn},[s[31]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),c(` `+f(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:mn},[s[32]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),c(` `+f(a(O)(`@EDITOR:新建文件夹`)),1)]),s[38]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:Sn},[s[33]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),c(` `+f(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Cn},[s[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),c(` `+f(a(O)(`@EDITOR:复制相对路径`)),1)]),s[39]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:yn},[s[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),c(` `+f(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:wn},[u(oe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),c(` `+f(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:hn},[s[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),c(` `+f(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:vn},[s[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),c(` `+f(a(O)(`@EDITOR:删除`)),1)])],4)):l(``,!0)]))],64))}}),[[`__scopeId`,`data-v-6bc4e9b4`]]);export{N as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-DkJuNcCr.js","assets/rolldown-runtime-C0FnF6B9.js","assets/monaco-B2lPvkrc.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$ as e,$n as t,At as n,B as r,Bn as i,D as a,Dn as o,En as s,Er as c,G as l,Gt as u,Ht as d,In as f,Mn as p,Mt as m,Nn as h,On as g,Pn as _,Pr as v,Qr as y,S as b,Tn as x,Tt as S,U as ee,W as C,Wt as w,X as T,Y as E,Yn as D,Yr as O,Zn as k,a as A,br as j,c as te,cr as M,en as N,er as ne,in as re,jt as P,kn as F,lr as I,lt as ie,mt as ae,nr as L,o as oe,or as R,pr as z,pt as se,qn as ce,qr as le,rn as ue,rt as de,s as fe,st as pe,tr as me,un as B,vn as he,wt as ge,xn as _e}from"./element-plus-KTmRV-so.js";import{n as V,t as H}from"./_plugin-vue_export-helper-
|
|
2
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$ as e,$n as t,At as n,B as r,Bn as i,D as a,Dn as o,En as s,Er as c,G as l,Gt as u,Ht as d,In as f,Mn as p,Mt as m,Nn as h,On as g,Pn as _,Pr as v,Qr as y,S as b,Tn as x,Tt as S,U as ee,W as C,Wt as w,X as T,Y as E,Yn as D,Yr as O,Zn as k,a as A,br as j,c as te,cr as M,en as N,er as ne,in as re,jt as P,kn as F,lr as I,lt as ie,mt as ae,nr as L,o as oe,or as R,pr as z,pt as se,qn as ce,qr as le,rn as ue,rt as de,s as fe,st as pe,tr as me,un as B,vn as he,wt as ge,xn as _e}from"./element-plus-KTmRV-so.js";import{n as V,t as H}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{t as ve}from"./SvgIcon-BVCbrPws.js";import{t as ye}from"./IconButton-pqSYKRT8.js";import{t as be}from"./configStore-DoobmT7N.js";import{t as xe}from"./gitStore-BJbNtjxA.js";import{i as U,n as Se,t as Ce}from"./useThemeObserver-B01D-Vl6.js";import{a as we,c as Te,i as Ee,n as De,o as Oe,r as ke,s as Ae,t as W}from"./previewSandbox-BZV6Eqhv.js";import{a as je,c as Me,i as G,l as Ne,o as Pe,s as K}from"./monaco-DkJuNcCr.js";i();var Fe=[`width`,`height`],Ie=f({__name:`TreeIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(k(),F(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`},[...n[0]||=[p(`<line x1="3" y1="2" x2="3" y2="14"></line><line x1="3" y1="4" x2="6" y2="4"></line><rect x="2" y="3" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="8" x2="6" y2="8"></line><rect x="4" y="7" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="12" x2="6" y2="12"></line><rect x="6" y="11" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect>`,7)]],8,Fe))}});i();var Le=[`width`,`height`],Re=f({__name:`ListIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(k(),F(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`currentColor`,stroke:`none`},[...n[0]||=[s(`rect`,{x:`2`,y:`3`,width:`12`,height:`2`,rx:`0.5`},null,-1),s(`rect`,{x:`2`,y:`7`,width:`12`,height:`2`,rx:`0.5`},null,-1),s(`rect`,{x:`2`,y:`11`,width:`12`,height:`2`,rx:`0.5`},null,-1)]],8,Le))}});function ze(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Be(e){if(!e)return``;let t=e.split(`
|
|
3
3
|
`),n=!1,r=null;return t.map(e=>{let t=ze(e);return e.startsWith(`diff --git`)||e.startsWith(`diff --cc`)||e.startsWith(`diff --combined`)?`<div class="diff-header">${t}</div>`:e.startsWith(`---`)?`<div class="diff-old-file">${t}</div>`:e.startsWith(`+++`)?`<div class="diff-new-file">${t}</div>`:e.startsWith(`@@`)?`<div class="diff-hunk-header">${t}</div>`:e.match(/^[+\-\s]*<{7,}\s+(HEAD|.*)/)?(n=!0,r=`current`,`<div class="diff-conflict-start">${t}</div>`):e.match(/^[+\-\s]*={7,}\s*$/)?(r=`incoming`,`<div class="diff-conflict-separator">${t}</div>`):e.match(/^[+\-\s]*>{7,}\s+.*/)?(n=!1,r=null,`<div class="diff-conflict-end">${t}</div>`):n&&r?r===`current`?`<div class="diff-conflict-current">${t}</div>`:`<div class="diff-conflict-incoming">${t}</div>`:e.startsWith(`+`)?`<div class="diff-added">${` `+t.substring(1)}</div>`:e.startsWith(`-`)?`<div class="diff-removed">${` `+t.substring(1)}</div>`:`<div class="diff-context">${t}</div>`}).join(``)}function Ve(e){if(!e)return``;let t=e.match(/^(feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert)(\([^)]+\))?\s*:\s*(.+)$/s);return t?t[3].trim():e.trim()}i(),z(),v();var He={class:`file-action-buttons`},Ue={key:1,style:{"font-size":`var(--font-size-md)`,"font-weight":`bold`}},We=H(f({__name:`FileActionButtons`,props:{filePath:{},fileType:{},isLocked:{type:Boolean,default:!1},isLocking:{type:Boolean,default:!1},showLockButton:{type:Boolean,default:!0}},emits:[`toggleLock`,`stage`,`unstage`,`revert`,`manageLockedFiles`],setup(e,{emit:n}){let i=e,a=n,u=x(()=>{switch(i.fileType){case`added`:return[{type:`unstage`,tooltip:V(`@0883F:取消暂存`),buttonType:`warning`,icon:`-`,handler:()=>a(`unstage`,i.filePath)}];case`modified`:case`deleted`:return[{type:`stage`,tooltip:V(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>a(`stage`,i.filePath)},{type:`revert`,tooltip:V(`@0883F:撤回修改`),buttonType:`danger`,icon:w,handler:()=>a(`revert`,i.filePath)}];case`untracked`:return[{type:`stage`,tooltip:V(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>a(`stage`,i.filePath)},{type:`delete`,tooltip:V(`@0883F:删除文件`),buttonType:`danger`,icon:pe,handler:()=>a(`revert`,i.filePath)}];default:return[]}});function d(e){e.stopPropagation(),a(`toggleLock`,i.filePath)}function f(e,t){t.stopPropagation(),e()}function p(e){e.stopPropagation(),a(`manageLockedFiles`)}return(n,i)=>{let a=E,m=r,h=l;return k(),F(`div`,He,[e.showLockButton?(k(),o(h,{key:0,content:e.isLocking?c(V)(`@0883F:处理中...`):e.isLocked?c(V)(`@0883F:解锁文件`):c(V)(`@0883F:锁定文件`),placement:`top`,disabled:e.isLocking,"show-after":200},{default:M(()=>[_(m,{type:e.isLocked?`danger`:`info`,size:`small`,text:``,loading:e.isLocking,disabled:e.isLocking,onClick:d,class:`file-action-btn`},{default:M(()=>[e.isLocking?g(``,!0):(k(),o(a,{key:0,size:`16`},{default:M(()=>[(k(),o(L(e.isLocked?c(P):c(N))))]),_:1}))]),_:1},8,[`type`,`loading`,`disabled`])]),_:1},8,[`content`,`disabled`])):g(``,!0),e.isLocked?(k(),o(h,{key:1,content:c(V)(`@13D1C:管理锁定文件`),placement:`top`,"show-after":200},{default:M(()=>[_(m,{type:`warning`,size:`small`,text:``,onClick:p,class:`file-action-btn`},{default:M(()=>[_(a,{size:`16`},{default:M(()=>[...i[0]||=[s(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[s(`path`,{fill:`currentColor`,d:`M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296L315.2 220.096c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z`})],-1)]]),_:1})]),_:1})]),_:1},8,[`content`])):g(``,!0),(k(!0),F(_e,null,t(u.value,e=>(k(),o(h,{key:e.type,content:e.tooltip,placement:`top`,"show-after":200},{default:M(()=>[_(m,{type:e.buttonType,size:`small`,text:``,onClick:t=>f(e.handler,t),class:`file-action-btn`},{default:M(()=>[typeof e.icon==`string`?(k(),F(`span`,Ue,y(e.icon),1)):(k(),o(a,{key:0,size:`16`},{default:M(()=>[(k(),o(L(e.icon)))]),_:2},1024))]),_:2},1032,[`type`,`onClick`])]),_:2},1032,[`content`]))),128))])}}}),[[`__scopeId`,`data-v-e552faf2`]]);function Ge(e){let t=[],n=new Map;return[...e].sort((e,t)=>e.path.localeCompare(t.path)).forEach(e=>{let r=e.path.split(`/`).filter(e=>e),i=``,a=t;r.forEach((t,o)=>{let s=o===r.length-1;i=i?`${i}/${t}`:t;let c=n.get(i);c||(c={name:t,path:i,isDirectory:!s,expanded:!0},s?(c.file=e,c.type=e.type,c.locked=e.locked):c.children=[],n.set(i,c),a.push(c)),!s&&c.children&&(a=c.children)})}),t}function Ke(e){e.expanded=!e.expanded}function qe(e,t){let n=new Map,r=e=>{e.forEach(e=>{e.isDirectory&&(n.set(e.path,e.expanded||!1),e.children&&r(e.children))})},i=e=>{e.forEach(e=>{if(e.isDirectory){let t=n.get(e.path);t!==void 0&&(e.expanded=t),e.children&&i(e.children)}})};r(t),i(e)}i(),v(),z();var Je={class:`tree-node-wrapper`},q=[`xlink:href`],J={class:`node-name`},Y={key:0,class:`file-type-tag`},Ye={key:2,class:`file-actions`},Xe={key:0,class:`tree-children`},Ze=H(f({__name:`TreeNodeItem`,props:{node:{},level:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`,`node-click`],setup(e,{emit:n}){let r=e,i=n;function a(e){return`${e*20+10}px`}function u(e){return U(e.name,e.isDirectory,!!e.expanded)}function d(e){return!e.isDirectory&&e.path===r.selectedFile}function f(){i(`node-click`,r.node)}return(n,r)=>{let p=me(`TreeNodeItem`,!0);return k(),F(`div`,Je,[s(`div`,{class:le([`tree-node`,{"is-directory":e.node.isDirectory,"is-file":!e.node.isDirectory,"is-selected":d(e.node),"is-locked":e.node.locked,[`file-type-${e.node.type}`]:e.node.type}]),style:O({paddingLeft:a(e.level)}),onClick:f},[(k(),F(`svg`,{class:le([`node-icon mit-icon`,{"folder-icon":u(e.node).key.startsWith(`folder-`)}]),"aria-hidden":`true`},[s(`use`,{"xlink:href":`#${u(e.node).spriteId}`},null,8,q)],2)),_(c(l),{content:e.node.path,placement:`top`,disabled:e.node.name.length<=35,"show-after":200},{default:M(()=>[s(`span`,J,y(e.node.name),1)]),_:1},8,[`content`,`disabled`]),e.node.isDirectory?g(``,!0):(k(),F(`span`,Y,y(e.node.type||`modified`),1)),e.node.locked?(k(),o(c(l),{key:1,content:c(V)(`@E80AC:该文件已被锁定,提交时会被跳过`),placement:`top`,"show-after":200},{default:M(()=>[_(c(E),{class:`lock-icon`,color:`var(--color-warning)`},{default:M(()=>[_(c(P))]),_:1})]),_:1},8,[`content`])):g(``,!0),e.showActionButtons&&!e.node.isDirectory&&e.node.file?(k(),F(`div`,Ye,[_(We,{"file-path":e.node.path,"file-type":e.node.type||`modified`,"is-locked":e.isFileLocked(e.node.path),"is-locking":e.isLocking(e.node.path),onToggleLock:r[0]||=e=>i(`toggle-lock`,e),onStage:r[1]||=e=>i(`stage`,e),onUnstage:r[2]||=e=>i(`unstage`,e),onRevert:r[3]||=e=>i(`revert`,e)},null,8,[`file-path`,`file-type`,`is-locked`,`is-locking`])])):g(``,!0)],6),e.node.isDirectory&&e.node.expanded&&e.node.children&&e.node.children.length>0?(k(),F(`div`,Xe,[(k(!0),F(_e,null,t(e.node.children,t=>(k(),o(p,{key:t.path+`-`+(t.expanded?`open`:`closed`),node:t,level:e.level+1,"selected-file":e.selectedFile,"show-action-buttons":e.showActionButtons,"is-file-locked":e.isFileLocked,"is-locking":e.isLocking,onFileSelect:r[4]||=e=>i(`file-select`,e),onToggleLock:r[5]||=e=>i(`toggle-lock`,e),onStage:r[6]||=e=>i(`stage`,e),onUnstage:r[7]||=e=>i(`unstage`,e),onRevert:r[8]||=e=>i(`revert`,e),onNodeClick:r[9]||=e=>i(`node-click`,e)},null,8,[`node`,`level`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))])):g(``,!0)])}}}),[[`__scopeId`,`data-v-0f783b58`]]);i(),z();var Qe={class:`file-tree-view`},$e=H(f({__name:`FileTreeView`,props:{treeData:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(e,{emit:n}){let r=n,i=j(0);function a(e){e.isDirectory?(Ke(e),i.value++):e.file&&r(`file-select`,e.path)}return(n,i)=>(k(),F(`div`,Qe,[(k(!0),F(_e,null,t(e.treeData,t=>(k(),o(Ze,{key:t.path+`-`+(t.expanded?`open`:`closed`),node:t,level:0,"selected-file":e.selectedFile,"show-action-buttons":e.showActionButtons,"is-file-locked":e.isFileLocked,"is-locking":e.isLocking,onFileSelect:i[0]||=e=>r(`file-select`,e),onToggleLock:i[1]||=e=>r(`toggle-lock`,e),onStage:i[2]||=e=>r(`stage`,e),onUnstage:i[3]||=e=>r(`unstage`,e),onRevert:i[4]||=e=>r(`revert`,e),onNodeClick:a},null,8,[`node`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))]))}}),[[`__scopeId`,`data-v-267015cf`]]);i(),z();var et=H(f({__name:`MonacoDiffViewer`,props:{original:{},modified:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!0}},setup(e){let t=e,n=j(null),r=null,i=null,a=null,o=null,s=null;async function c(){return r||s||(s=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new K:t===`html`||t===`handlebars`||t===`razor`?new Pe:t===`typescript`||t===`javascript`?new je:new Ne}},r=await G(()=>import(`./monaco-DkJuNcCr.js`).then(e=>e.t),__vite__mapDeps([0,1,2])),r})(),s)}function l(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function u(){return t.language===`auto`?l(t.filePath||``):t.language||`plaintext`}function d(){return t.theme&&t.theme!==`auto`?t.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function f(){if(!r)return;let e=d();r.editor.setTheme(e)}Ce(()=>f());function p(){if(!r)return;a?.dispose(),o?.dispose();let e=u();a=r.editor.createModel(t.original||``,e),o=r.editor.createModel(t.modified||``,e)}function m(){i&&a&&o&&i.setModel({original:a,modified:o})}function h(){a&&a.getValue()!==(t.original||``)&&a.setValue(t.original||``),o&&o.getValue()!==(t.modified||``)&&o.setValue(t.modified||``)}return D(async()=>{n.value&&(r=await c(),f(),p(),i=r.editor.createDiffEditor(n.value,{automaticLayout:!0,readOnly:t.readOnly,renderSideBySide:!0,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,originalEditable:!t.readOnly}),m())}),R(()=>t.language,()=>{if(!r)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),R(()=>t.filePath,()=>{if(!r||t.language!==`auto`)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),R(()=>t.theme,()=>{f()}),R(()=>[t.original,t.modified],()=>{h()}),ce(()=>{i?.dispose(),i=null,a?.dispose(),o?.dispose(),a=null,o=null}),(e,t)=>(k(),F(`div`,{ref_key:`containerRef`,ref:n,class:`monaco-diff-container`},null,512))}}),[[`__scopeId`,`data-v-0c23e676`]]);i(),v(),z();var tt=H(f({__name:`MonacoEditor`,props:{modelValue:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!1},minHeight:{default:`360px`},revealLine:{default:null},highlightRange:{default:null},dimHighlightRanges:{default:null},highlightKind:{default:``},gutterPlacement:{default:`glyph`},gutterItems:{default:()=>[]},rightActions:{default:()=>[]},appliedBlocks:{default:()=>[]},syncGroup:{default:null},syncScrollTop:{default:null}},emits:[`update:modelValue`,`gutter-click`,`scroll-change`],setup(e,{emit:t}){let n=e,r=t,i=j(null),a=null,o=null,s=null,c=null,l=!1,u=[],d=[],f=[],p=null,m=null,h=new Map,g=null,_=null;function v(){if(!o)return;let e=n.gutterItems||[],t=n.gutterPlacement===`glyph`&&e.length>0;try{o.updateOptions({glyphMargin:t})}catch{}}function y(){if(!o||m)return;let e=o.getDomNode?.();e&&(m=document.createElement(`div`),m.className=`merge-right-actions`,e.appendChild(m))}function b(){m&&(m.innerHTML=``,h.clear())}function x(){if(!o||!a||!m)return;let e=n.rightActions||[];if(!e.length)return;let t=o.getLayoutInfo?.(),r=t?.contentLeft??0,i=t?.contentWidth??0,c=Math.max(0,r+i-44);for(let t of e){let e=h.get(t.blockId);if(!e)continue;let n=s?.getLineMaxColumn?.(t.line)??1,r=o.getScrolledVisiblePosition?.({lineNumber:t.line,column:n});if(!r){e.style.display=`none`;continue}e.style.display=``,e.style.top=`${r.top}px`,e.style.left=`${c}px`,e.style.height=`${r.height}px`}}function S(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`current`||r.choice===`both`:r.choice===`incoming`||r.choice===`both`:!1}function ee(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`incoming`:r.choice===`current`:!1}function C(e,t,n){e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-label`,t),n&&e.setAttribute(`aria-pressed`,`true`),e.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.click())})}function w(){if(!o||(y(),!m))return;let e=(n.rightActions||[]).filter(e=>e&&e.line&&e.line>0);if(!e.length){b();return}b();for(let t of e){let e=S(t.blockId,t.kind),n=ee(t.blockId,t.kind),i=document.createElement(`div`);if(i.className=`merge-right-action-wrapper`,t.kind===`current`){let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-current${e?` is-applied`:``}`,a.textContent=e?`✓`:`→`,a.title=e?`已采用当前更改`:`采用当前更改`,C(a,a.title,e),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,o.textContent=`✕`,o.title=n?`已丢弃当前更改`:`丢弃当前更改`,C(o,o.title,n),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)}),i.appendChild(a),i.appendChild(o)}else{let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,a.textContent=`✕`,a.title=n?`已丢弃传入更改`:`丢弃传入更改`,C(a,a.title,n),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-incoming${e?` is-applied`:``}`,o.textContent=e?`✓`:`←`,o.title=e?`已采用传入更改`:`采用传入更改`,C(o,o.title,e),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)}),i.appendChild(a),i.appendChild(o)}m.appendChild(i),h.set(t.blockId,i)}x()}async function T(){return a||c||(c=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new K:t===`html`||t===`handlebars`||t===`razor`?new Pe:t===`typescript`||t===`javascript`?new je:new Ne}},a=await G(()=>import(`./monaco-DkJuNcCr.js`).then(e=>e.t),__vite__mapDeps([0,1,2])),a})(),c)}function E(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function A(){return n.language===`auto`?E(n.filePath||``):n.language||`plaintext`}function te(){return n.theme&&n.theme!==`auto`?n.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function M(){a&&a.editor.setTheme(te())}Ce(()=>M());function N(){if(!a)return;let e=A();if(!s){s=a.editor.createModel(n.modelValue||``,e);return}try{a.editor.setModelLanguage(s,e)}catch{}}function ne(){if(!s)return;let e=n.modelValue||``;s.getValue()!==e&&(l=!0,s.setValue(e),l=!1)}function re(){if(!o)return;let e=n.revealLine;if(!(!e||e<=0))try{o.revealLineInCenter(e)}catch{}}function P(){if(!a||!o)return;if(!n.dimHighlightRanges||!n.dimHighlightRanges.length||!n.highlightKind)d=o.deltaDecorations(d,[]);else{let e=n.highlightKind===`current`?`merge-highlight-current-dim`:n.highlightKind===`incoming`?`merge-highlight-incoming-dim`:`merge-highlight-merged-dim`;d=o.deltaDecorations(d,n.dimHighlightRanges.filter(e=>e&&e.startLine>0&&e.endLine>0).map(t=>{let n=Math.max(1,t.startLine),r=Math.max(n,t.endLine);return{range:new a.Range(n,1,r,1),options:{isWholeLine:!0,className:e,linesDecorationsClassName:e}}}))}if(!n.highlightRange||!n.highlightKind){u=o.deltaDecorations(u,[]);return}let e=Math.max(1,n.highlightRange.startLine),t=Math.max(e,n.highlightRange.endLine),r=n.highlightKind===`current`?`merge-highlight-current`:n.highlightKind===`incoming`?`merge-highlight-incoming`:`merge-highlight-merged`;u=o.deltaDecorations(u,[{range:new a.Range(e,1,t,1),options:{isWholeLine:!0,className:r,linesDecorationsClassName:r}}])}function I(){if(!a||!o)return;let e=n.gutterItems||[];if(!e.length){f=o.deltaDecorations(f,[]),v();return}v();let t=n.gutterPlacement===`line`;f=o.deltaDecorations(f,e.filter(e=>e&&e.line&&e.line>0).map(e=>{let n=S(e.blockId,e.kind),r=e.kind===`current`?n?`merge-glyph-current is-applied`:`merge-glyph-current`:n?`merge-glyph-incoming is-applied`:`merge-glyph-incoming`;return{range:new a.Range(e.line,1,e.line,1),options:{isWholeLine:!0,...t?{linesDecorationsClassName:r}:{glyphMarginClassName:r}}}}))}return D(async()=>{i.value&&(a=await T(),M(),N(),o=a.editor.create(i.value,{automaticLayout:!0,readOnly:n.readOnly,glyphMargin:!1,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10}}),o.setModel(s),o.onDidChangeModelContent(()=>{if(l)return;let e=s?.getValue?.()??``;r(`update:modelValue`,e)}),re(),P(),I(),w(),g=o.onDidScrollChange(e=>{x(),n.syncGroup&&e.scrollTopChanged&&r(`scroll-change`,e.scrollTop)}),_=o.onDidLayoutChange(()=>{x()}),p=o.onMouseDown(e=>{try{let t=e?.target,i=t?.position;if(!i?.lineNumber)return;let o=t?.type;if(o!==a.editor.MouseTargetType.GUTTER_GLYPH_MARGIN&&o!==a.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)return;let s=i.lineNumber,c=(n.gutterItems||[]).find(e=>e.line===s);if(!c)return;r(`gutter-click`,c.blockId)}catch{}}))}),R(()=>n.modelValue,()=>{ne()}),R(()=>n.revealLine,()=>{re()}),R(()=>[n.highlightRange,n.highlightKind],()=>{P()},{deep:!0}),R(()=>n.dimHighlightRanges,()=>{P()},{deep:!0}),R(()=>n.gutterItems,()=>{I()},{deep:!0}),R(()=>n.rightActions,()=>{w()},{deep:!0}),R(()=>n.appliedBlocks,()=>{w(),I()},{deep:!0}),R(()=>n.syncScrollTop,e=>{if(e!=null&&o){let t=o.getScrollTop();Math.abs(t-e)>5&&o.setScrollTop(e)}}),R(()=>n.gutterPlacement,()=>{I()}),R(()=>[n.language,n.filePath],()=>{a&&N()}),R(()=>n.theme,()=>{M()}),R(()=>n.readOnly,e=>{o&&o.updateOptions({readOnly:e})}),ce(()=>{try{p?.dispose?.()}catch{}p=null;try{g?.dispose?.()}catch{}g=null;try{_?.dispose?.()}catch{}_=null;try{m?.remove?.()}catch{}m=null,h.clear(),o?.dispose(),o=null,d=[],s?.dispose(),s=null}),(t,n)=>(k(),F(`div`,{ref_key:`containerRef`,ref:i,class:`monaco-editor-container`,style:O(e.minHeight?{minHeight:e.minHeight}:{flex:1,minHeight:`200px`})},null,4))}}),[[`__scopeId`,`data-v-27ef306d`]]);i(),z(),v(),B();var nt={class:`summary-head`},X={class:`summary-heading`},Z={class:`summary-label`},Q=[`title`],rt={class:`summary-actions`},it={class:`summary-body`},$={key:1,class:`summary-placeholder is-loading`},at={key:2,class:`summary-placeholder`},ot={key:3,class:`summary-placeholder`},st={key:4,class:`summary-error`},ct={class:`err-msg`},lt={key:0,class:`dialog-context`},ut={class:`dialog-body`},dt={key:1,class:`summary-placeholder is-loading`},ft={key:2,class:`summary-placeholder`},pt=H(f({__name:`AiDiffSummary`,props:{source:{},scope:{},commitHash:{default:``},file:{default:``},fileName:{default:``},fileRevision:{default:``},revision:{default:``},auto:{type:Boolean,default:!0}},setup(t){let i=t,l=be(),u=x(()=>Array.isArray(l.models)&&l.models.length>0),f=x(()=>(l.locale||``).startsWith(`en`)?`en`:`zh`),p=x(()=>{let e=Array.isArray(l.models)?l.models:[],t=e.find(e=>e.isDefault)||e[0];return t?`${t.id}|${t.baseURL}|${t.model}`:``}),v=j({status:`idle`,text:``,error:``}),b=j(!1),ee=j(!1),C=new Map,w=null,D=null;function O(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function A(){let e=`${i.source}|${i.commitHash||``}|${i.scope}|${f.value}|${p.value}`;if(i.scope===`overall`)return`${e}|${i.source===`worktree`?O(i.revision):``}`;let t=i.source===`worktree`?O(i.fileRevision):``;return`${e}|${i.file||``}|${t}`}function te(){let e=C.get(A());v.value=e?{status:`done`,text:e,error:``}:{status:`idle`,text:``,error:``}}function N(){w?.abort(),w=null}async function ne(e=!1){if(!u.value||i.scope===`file`&&!i.file||i.source===`commit`&&!i.commitHash)return;let t=A();if(!e&&C.has(t)){v.value={status:`done`,text:C.get(t)||``,error:``};return}N();let n=new AbortController;w=n,v.value={status:`loading`,text:``,error:``};let r=``,a=e=>{let t=e.trim();if(!t.startsWith(`data:`))return;let n=t.slice(5).trim();if(!n)return;let i;try{i=JSON.parse(n)}catch{return}if(i.type===`delta`)r+=i.content||``,v.value={status:`loading`,text:r,error:``};else if(i.type===`done`)v.value={status:`done`,text:r,error:``};else if(i.type===`error`){let e=i.code===`NO_MODEL`?`no-model`:i.code===`EMPTY_DIFF`?`empty`:`error`;v.value={status:e,text:``,error:i.error||V(`@DIFFAI:生成失败`)}}};try{let o={scope:i.scope,source:i.source,locale:f.value};i.scope===`file`&&(o.file=i.file),i.source===`commit`&&(o.hash=i.commitHash),e&&(o.bypassCache=!0);let s=await fetch(`/api/ai/diff-summary`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(o),signal:n.signal});if(!s.ok||!s.body)throw Error(`HTTP ${s.status}`);let c=s.body.getReader(),l=new TextDecoder,u=``;for(;;){let{done:e,value:t}=await c.read();if(e)break;u+=l.decode(t,{stream:!0});let n=u.split(`
|
|
4
4
|
`);u=n.pop()||``,n.forEach(a)}u+=l.decode(),u&&a(u),v.value.status===`loading`&&(v.value={status:r?`done`:`empty`,text:r,error:``}),v.value.status===`done`&&r&&C.set(t,r)}catch(e){e?.name!==`AbortError`&&w===n&&(v.value={status:`error`,text:``,error:e?.message||V(`@DIFFAI:生成失败`)})}finally{w===n&&(w=null)}}function P(){C.delete(A()),ne(!0)}function ie(){i.auto&&u.value&&(i.scope!==`file`||i.file)&&ne()}function ae(){D&&clearTimeout(D),D=setTimeout(ie,350)}R(()=>[i.file,i.fileRevision,i.revision,i.commitHash,i.source,i.scope,u.value,f.value,p.value,i.auto],()=>{N(),te(),u.value&&ae()},{immediate:!0}),ce(()=>{N(),D&&clearTimeout(D)});let L=x(()=>i.scope===`file`?V(`@DIFFAI:AI 文件说明`):V(`@DIFFAI:AI 整体说明`)),oe=x(()=>i.scope===`file`?i.fileName||i.file:i.source===`commit`?V(`@DIFFAI:本次提交`):V(`@DIFFAI:未提交变更`));return(i,l)=>{let f=E,p=r;return u.value?(k(),F(`section`,{key:0,class:le([`ai-diff-summary`,`is-${t.scope}`])},[s(`header`,nt,[s(`div`,X,[_(f,{class:`ai-badge`},{default:M(()=>[_(c(m))]),_:1}),s(`span`,Z,y(L.value),1)]),s(`span`,{class:`summary-context`,title:oe.value},y(oe.value),9,Q),s(`div`,rt,[v.value.status===`loading`?(k(),o(f,{key:0,class:`spin`},{default:M(()=>[_(c(n))]),_:1})):g(``,!0),_(p,{text:``,size:`small`,icon:c(S),disabled:!v.value.text,title:c(V)(`@DIFFAI:弹窗查看`),onClick:l[0]||=e=>ee.value=!0},null,8,[`icon`,`disabled`,`title`]),_(p,{text:``,size:`small`,icon:c(d),disabled:v.value.status===`loading`,title:c(V)(`@DIFFAI:重新生成`),onClick:P},null,8,[`icon`,`disabled`,`title`]),_(p,{text:``,size:`small`,icon:b.value?c(T):c(e),title:b.value?c(V)(`@DIFFAI:展开说明`):c(V)(`@DIFFAI:收起说明`),onClick:l[1]||=e=>b.value=!b.value},null,8,[`icon`,`title`])])]),I(s(`div`,it,[v.value.text?(k(),o(Ee,{key:0,content:v.value.text,"allow-html":!1},null,8,[`content`])):v.value.status===`loading`?(k(),F(`div`,$,y(c(V)(`@DIFFAI:正在生成差异说明...`)),1)):v.value.status===`empty`?(k(),F(`div`,at,y(t.scope===`file`?c(V)(`@DIFFAI:该文件没有可总结的变更`):c(V)(`@DIFFAI:没有可总结的变更`)),1)):v.value.status===`no-model`?(k(),F(`div`,ot,y(v.value.error),1)):v.value.status===`error`?(k(),F(`div`,st,[_(f,null,{default:M(()=>[_(c(re))]),_:1}),s(`span`,ct,y(v.value.error),1),_(p,{text:``,size:`small`,icon:c(d),onClick:P},{default:M(()=>[h(y(c(V)(`@DIFFAI:重试`)),1)]),_:1},8,[`icon`])])):g(``,!0)],512),[[he,!b.value]]),_(c(a),{modelValue:ee.value,"onUpdate:modelValue":l[2]||=e=>ee.value=e,title:L.value,width:`680px`,"close-on-click-modal":!0,"destroy-on-close":``,class:`ai-summary-dialog`},{default:M(()=>[oe.value?(k(),F(`div`,lt,y(oe.value),1)):g(``,!0),s(`div`,ut,[v.value.text?(k(),o(Ee,{key:0,content:v.value.text,"allow-html":!1},null,8,[`content`])):v.value.status===`loading`?(k(),F(`div`,dt,y(c(V)(`@DIFFAI:正在生成差异说明...`)),1)):(k(),F(`div`,ft,y(c(V)(`@DIFFAI:暂无说明内容`)),1))])]),_:1},8,[`modelValue`,`title`])],2)):g(``,!0)}}}),[[`__scopeId`,`data-v-f36a5713`]]);i(),v(),z();var mt={key:0,class:`diff-preview-panel`},ht={class:`diff-preview-header`},gt={class:`diff-preview-title`},_t={class:`diff-preview-ext-badge`},vt=[`title`],yt={class:`diff-preview-body`},bt={key:0,class:`diff-preview-loading`},xt={key:1,class:`diff-preview-error`},St=[`sandbox`,`srcdoc`],Ct={key:1,class:`diff-preview-panel diff-preview-unsupported`},wt={class:`diff-preview-body`},Tt={class:`diff-preview-empty`},Et=H(f({__name:`DiffPreviewPanel`,props:{filePath:{},content:{},loading:{type:Boolean,default:!1},error:{default:``},context:{default:`git-status`},commitHash:{default:``},officePreviewUrl:{default:``}},emits:[`refresh`],setup(e,{emit:t}){let n=e,r=t,i=x(()=>(n.filePath||``).split(`.`).pop()?.toLowerCase()??``),a=x(()=>i.value===`md`||i.value===`markdown`),u=x(()=>i.value===`html`||i.value===`htm`||i.value===`svg`),f=x(()=>[`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`].includes(i.value)),p=x(()=>a.value||u.value||f.value&&!!n.officePreviewUrl),m=j(!0);function h(){typeof document<`u`&&(m.value=document.documentElement.getAttribute(`data-theme`)!==`light`)}let v=x(()=>{if(!u.value)return``;let e=m.value?`#0d1117`:`#ffffff`,t=m.value?`#e6edf3`:`#1f2328`;return i.value===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${e};color:${t};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${n.content||``}</body></html>`:De(n.content||``)});return R(()=>n.filePath,()=>{h()},{immediate:!0}),h(),(t,m)=>p.value?(k(),F(`div`,mt,[s(`div`,ht,[s(`span`,gt,y(t.$t(`@E80AC:文件预览`)),1),s(`span`,_t,y(i.value.toUpperCase()),1),m[1]||=s(`div`,{class:`diff-preview-spacer`},null,-1),_(c(l),{content:t.$t(`@E80AC:刷新预览`),placement:`top`},{default:M(()=>[s(`button`,{class:`diff-preview-btn`,title:t.$t(`@E80AC:刷新预览`),onClick:m[0]||=e=>r(`refresh`)},[_(c(E),null,{default:M(()=>[_(c(d))]),_:1})],8,vt)]),_:1},8,[`content`])]),s(`div`,yt,[e.loading?(k(),F(`div`,bt,[s(`span`,null,y(t.$t(`@E80AC:正在加载预览...`)),1)])):e.error?(k(),F(`div`,xt,[s(`span`,null,y(e.error),1)])):u.value?(k(),F(`iframe`,{key:2,class:`diff-preview-iframe`,sandbox:c(W),srcdoc:v.value},null,8,St)):f.value&&e.officePreviewUrl?(k(),o(ke,{key:3,"file-path":e.filePath,source:e.context===`commit-detail`?`git`:`worktree`,rev:e.commitHash},null,8,[`file-path`,`source`,`rev`])):a.value?(k(),o(Ee,{key:4,content:n.content||``,class:`diff-preview-markdown`},null,8,[`content`])):g(``,!0)])])):(k(),F(`div`,Ct,[s(`div`,wt,[s(`span`,Tt,y(t.$t(`@E80AC:当前文件类型不支持预览`)),1)])]))}}),[[`__scopeId`,`data-v-247beeca`]]);i(),z(),v();var Dt={class:`diff-viewer-main`},Ot={class:`files-panel`},kt={class:`panel-header`},At={class:`header-left`},jt={key:0,class:`file-count`},Mt={class:`view-mode-toggle`},Nt={class:`search-box`},Pt={class:`files-list`},Ft=[`onClick`],It={class:`file-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={key:0,class:`conflict-marker`,title:`冲突文件`},zt={class:`file-name`},Bt=[`title`],Vt={class:`file-directory path-badge`},Ht={key:2,class:`file-actions`},Ut={key:0,class:`ai-summary-float`},Wt={class:`diff-panel`},Gt={class:`panel-header`},Kt={class:`header-right`},qt={class:`selected-file`},Jt={class:`path-dir`},Yt={class:`path-name`},Xt={key:1,class:`diff-stats-badge`},Zt={class:`stats-added`},Qt={class:`stats-deleted`},$t={key:2,class:`action-buttons`},en=[`aria-pressed`],tn={key:0,class:`conflict-resolution-container`},nn={key:0,class:`resolution-mode-switch`},rn={key:1,class:`block-conflict-resolution`},an={class:`merge-three-pane`},on={class:`pane`},sn={class:`pane-header`},cn={class:`pane-title`},ln={class:`pane-body`},un={class:`pane pane-merged`},dn={class:`pane-header`},fn={class:`pane-title`},pn={class:`pane-subhint`},mn={class:`pane-body`},hn={class:`pane`},gn={class:`pane-header`},_n={class:`pane-title`},vn={class:`pane-body`},yn={class:`save-resolution-bar`},bn={key:2,class:`global-conflict-wrapper`},xn={class:`global-conflict-resolution`},Sn={class:`conflict-warning`},Cn={class:`conflict-buttons`},wn={class:`diff-content`},Tn=[`textContent`],En=[`innerHTML`],Dn={key:1,class:`conflict-resolved-container`},On={class:`resolved-notice`},kn={class:`notice-text`},An={class:`diff-content`},jn=[`textContent`],Mn=[`innerHTML`],Nn={key:2,class:`diff-and-preview-wrapper`},Pn={key:2,class:`compare-view`},Fn=[`textContent`],In=[`innerHTML`],Ln={key:1,class:`diff-panel full-width`},Rn={class:`panel-header`},zn={class:`header-right`},Bn={class:`selected-file`},Vn={class:`path-dir`},Hn={class:`path-name`},Un={key:1,class:`action-buttons`},Wn={key:0,class:`conflict-resolution-container`},Gn={key:0,class:`resolution-mode-switch`},Kn={key:1,class:`block-conflict-resolution`},qn={class:`merge-three-pane`},Jn={class:`pane`},Yn={class:`pane-header`},Xn={class:`pane-title`},Zn={class:`pane-body`},Qn={class:`pane pane-merged`},$n={class:`pane-header`},er={class:`pane-title`},tr={class:`pane-subhint`},nr={class:`pane-body`},rr={class:`pane`},ir={class:`pane-header`},ar={class:`pane-title`},or={class:`pane-body`},sr={class:`save-resolution-bar`},cr={key:2,class:`global-conflict-wrapper`},lr={class:`global-conflict-resolution`},ur={class:`conflict-warning`},dr={class:`conflict-buttons`},fr={class:`diff-content`},pr=[`textContent`],mr=[`innerHTML`],hr={key:1,class:`diff-and-preview-wrapper`},gr={key:2,class:`compare-view`},_r=[`textContent`],vr=[`innerHTML`],yr=`merge-three-pane`,br=f({__name:`FileDiffViewer`,props:{files:{},emptyText:{default:V(`@E80AC:没有找到变更文件`)},diffContent:{default:``},diffStats:{default:null},selectedFile:{default:``},isLoading:{type:Boolean,default:!1},plainText:{type:Boolean,default:!1},compareMode:{type:Boolean,default:!1},compareOriginal:{default:``},compareModified:{default:``},height:{default:`100%`},showFileList:{type:Boolean,default:!0},context:{default:`git-status`},showOpenButton:{type:Boolean,default:!0},showActionButtons:{type:Boolean,default:!1},showVscodeButton:{type:Boolean,default:!0},showEditorButton:{type:Boolean,default:!0},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1},commitHash:{default:``}},emits:[`file-select`,`open-file`,`open-with-vscode`,`open-in-editor`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(e,{emit:n}){let i=new Set([`md`,`markdown`,`html`,`htm`,`svg`,`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`]),a=e,d=n,f=be(),p=xe(),m=j(``),v=j(``),S=e=>Math.min(85,Math.max(15,e)),w=x({get:()=>f.ui.fileListViewMode,set:e=>{f.ui.fileListViewMode=e}}),T=x({get:()=>S(f.ui.fileDiffSplitPercent),set:e=>{f.ui.fileDiffSplitPercent=S(e)}}),N=j(!1),P=j(``),L=j(!1),z=j(``),pe=j(``),me=0,B=x({get:()=>S(f.ui.diffPreviewSplitPercent??55),set:e=>{f.ui.diffPreviewSplitPercent=S(e)}}),he=x(()=>{let e=U.value||``;return(e.split(`/`).pop()||e).split(`.`).pop()?.toLowerCase()??``}),H=x(()=>i.has(he.value)),U=x(()=>a.selectedFile||m.value),Ce=x(()=>a.context===`commit-detail`?`commit`:a.context===`git-status`?`worktree`:``),Ee=x(()=>!!(Ce.value&&f.aiDiffSummaryEnabled)),De=x(()=>a.files.map(e=>`${e.path}\0${e.type||``}`).sort().join(`\0`)),ke=x(()=>Te(U.value||``)),W=x(()=>U.value?a.files.find(e=>e.path===U.value)?.type===`conflicted`:!1),je=x(()=>q.value.length>0),Me=x(()=>a.files.map(e=>{let t=e.name||e.path.split(`/`).pop()||e.path;return{...e,displayName:t,dirPath:(()=>{let t=(e.path||``).split(`/`);return t.length>1?t.slice(0,-1).join(`/`):``})(),iconClass:Se(t)}})),G=x(()=>{if(!v.value.trim())return Me.value;let e=v.value.toLowerCase().trim();return Me.value.filter(t=>t.displayName.toLowerCase().includes(e)||t.path.toLowerCase().includes(e))}),Ne=j([]);function Pe(){let e=Ge(G.value);Ne.value.length>0&&qe(e,Ne.value),Ne.value=e}R(G,()=>{w.value===`tree`&&Pe()},{deep:!0}),R(w,e=>{e===`tree`&&Pe(),window.dispatchEvent(new CustomEvent(`file-list-view-mode-change`,{detail:{mode:e}}))});let K=x(()=>a.compareMode?!0:a.diffContent&&a.diffContent.trim()!==``),Fe=x(()=>{if(!U.value)return``;let e=U.value.split(`/`);return e.slice(0,-1).join(`/`)+(e.length>1?`/`:``)}),Le=x(()=>{if(!U.value)return``;let e=U.value.split(`/`);return e[e.length-1]||U.value});function ze(e){m.value=e,d(`file-select`,e)}function Ve(){if(!U.value){A.warning(V(`@E80AC:请先选择一个文件`));return}d(`open-file`,U.value,a.context)}function He(){if(!U.value){A.warning(V(`@E80AC:请先选择一个文件`));return}navigator.clipboard.writeText(U.value).then(()=>{A.success(V(`@E80AC:文件路径已复制到剪贴板`))}).catch(()=>{A.error(V(`@E80AC:复制失败`))})}function Ue(){p.copyCurrentDiff()}function Ke(){if(!U.value){A.warning(V(`@E80AC:请先选择一个文件`));return}d(`open-with-vscode`,U.value,a.context)}function Je(){if(console.log(`[debug-open-in-editor] FileDiffViewer handleOpenInEditor start`),!U.value){A.warning(V(`@E80AC:请先选择一个文件`));return}console.log(`[debug-open-in-editor] FileDiffViewer emit, filePath=`,U.value,`context=`,a.context),d(`open-in-editor`,U.value,a.context)}let q=j([]),J=j(!0),Y=j(``),Ye=j(!1),Xe=j(``),Ze=j(``),Qe=j(``),nt=j(``),X=j(new Map),Z=j(null),Q=j(null),rt=j(new Map),it=j(new Map),$=j(new Map);async function at(e){let t=await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json();if(!t.success)throw Error(t.error||V(`@E80AC:无法读取文件内容`));return String(t.content??``)}async function ot(){let e=U.value;if(!e||!H.value)return;let t=++me;L.value=!0,z.value=``,pe.value=``;try{if(Ae(e)){pe.value=Oe(e,{source:a.context===`commit-detail`?`git`:`worktree`,rev:a.context===`commit-detail`?a.commitHash:void 0}),L.value=!1;return}let n=null;if(n=a.context===`commit-detail`&&a.commitHash?await(await fetch(`/api/git-file-content?rev=${encodeURIComponent(a.commitHash)}&file=${encodeURIComponent(e)}`)).json():await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json(),t!==me)return;if(!n||!n.success){z.value=n?.error||V(`@E80AC:无法读取文件内容`),P.value=``;return}P.value=String(n.content??``)}catch(e){if(t!==me)return;z.value=e.message||V(`@E80AC:无法读取文件内容`),P.value=``}finally{t===me&&(L.value=!1)}}function st(){H.value&&(N.value=!N.value,N.value&&!P.value&&!L.value&&ot())}R([U,()=>a.context,()=>a.commitHash],()=>{if(P.value=``,pe.value=``,z.value=``,!H.value&&N.value){N.value=!1;return}N.value&&ot()});let ct=!1,lt=0,ut=0;function dt(e){ct=!0,lt=e.clientY,ut=B.value,document.addEventListener(`mousemove`,ft),document.addEventListener(`mouseup`,mt),e.preventDefault()}function ft(e){if(!ct)return;let t=e.target?.closest(`.diff-panel`);if(!t)return;let n=t.getBoundingClientRect().height-34;if(n<=0)return;let r=e.clientY-lt,i=ut+r/n*100;B.value=S(i)}function mt(){ct=!1,document.removeEventListener(`mousemove`,ft),document.removeEventListener(`mouseup`,mt)}ce(()=>{ct&&mt()});function ht(e,t){let n=e.split(`
|
|
5
5
|
`),r=[],i=new Map,a=0,o=0;for(;a<n.length;){let e=n[a];if(e.includes(`<<<<<<<`)){o++;let e=[],s=[];for(a++;a<n.length&&!n[a].includes(`=======`);)e.push(n[a]),a++;for(a++;a<n.length&&!n[a].includes(`>>>>>>>`);)s.push(n[a]),a++;a<n.length&&n[a].includes(`>>>>>>>`)&&a++;let c=t(o),l=[];l=c===`incoming`?s:c===`both`?[...e,...s]:c===`none`?[]:e;let u=r.length+1;r.push(...l);let d=Math.max(u,r.length);i.set(o,{startLine:u,endLine:d});continue}r.push(e),a++}return{text:r.join(`
|
package/src/ui/public/assets/{FlowExecutionViewer-C_FOK1_9.js → FlowExecutionViewer-DvVT19Qv.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-KTmRV-so.js";import{n as m,t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-KTmRV-so.js";import{n as m,t as h}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-CsvDD38k.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./UserInputNode-DXHeCjzG.js";e(),p();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(n({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(e){function p(e){switch(e){case`command`:return`📋`;case`wait`:return`⏰`;case`version`:return`📦`;case`confirm`:return`✋`;case`code`:return`🧩`;case`start`:return`🚀`;case`condition`:return`🔀`;case`user_input`:return`⌨️`;default:return``}}let h=n({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>i(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:p(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return n({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=a(()=>{let e=t.data?.config,n=[...Array.isArray(e?.conditionBranches)?e.conditionBranches:[]].sort((e,t)=>{let n=e?.handleId==="default"||e?.isDefault,r=t?.handleId==="default"||t?.isDefault;return n&&!r?1:!n&&r?-1:Number(e?.priority??0)-Number(t?.priority??0)}).map(e=>String(e?.handleId||``).trim()).filter(e=>!!e);return n.includes(`default`)||n.push(`default`),n.length?n:[`default`]});return()=>i(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:p(t.data?.type),enabled:t.data?.enabled,selected:t.data?.selected,execStatus:t.data?.execStatus,sourceHandleIds:t.data?.type===`condition`?n.value:void 0,deletable:!1},{default:()=>i(e,{data:t.data,id:t.id})})}})}let j={start:u(h),command:u(A(E)),wait:u(A(w)),version:u(A(b)),confirm:u(A(S)),code:u(A(T)),condition:u(A(C)),user_input:u(A(D))},M=e,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let t=0;t<6;t+=1){if(await o(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof P?.findNode==`function`&&P.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await P.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}N(e=>{P=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,k),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{P.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(M.currentNodeId||F||``).trim();t&&(F=null,I(t))});let L=null;f(()=>M.currentNodeId,async e=>{e&&(L&&=(window.clearTimeout(L),null),L=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,k,`nodeId=`,e),!P){F=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,F);return}I(e)},150))}),s(()=>{L&&=(window.clearTimeout(L),null)});let R=a(()=>{let e=Array.isArray(M.flowData?.nodes)?M.flowData.nodes:[],t=new Set(M.executedNodeIds),n=new Set(M.failedNodeIds),r=M.currentNodeId;return e.map(e=>{let i;r&&e.id===r?i=`running`:n.has(e.id)?i=`failed`:t.has(e.id)&&(i=`success`);let a=[];return t.has(e.id)&&a.push(`exec-node-done`),{...e,data:{...e.data,execStatus:i},class:a.join(` `)}})}),z=a(()=>{let e=Array.isArray(M.flowData?.edges)?M.flowData.edges:[],t=new Set(M.executedEdgeIds);return e.map(e=>{let n=[];return t.has(e.id)&&n.push(`exec-edge-done`),{...e,class:n.join(` `)}})});return(e,n)=>(c(),d(`div`,O,[r(t(y),{id:k,nodes:R.value,edges:z.value,"node-types":j,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:l(()=>[r(t(g)),r(t(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,At as n,B as r,Bn as i,C as a,Ct as o,Dn as s,En as c,Er as l,Et as u,F as d,G as f,Ht as p,In as m,K as h,Kt as g,L as _,M as v,Nn as y,On as b,Ot as x,P as S,Pn as C,Pr as w,Pt as ee,Qn as te,Qr as T,R as ne,Rn as E,S as re,T as ie,Tn as D,Vn as ae,W as oe,Wn as O,Xn as se,Y as ce,Yn as le,Zn as k,a as A,b as ue,bn as de,br as j,cr as M,d as N,er as P,ft as F,g as I,gr as L,i as R,kn as z,lt as fe,nn as pe,or as B,ot as me,pr as V,q as he,qr as ge,u as H,un as _e,ut as ve,w as U,xn as W,xt as ye,zt as G}from"./element-plus-KTmRV-so.js";import{d as be}from"./vendor-CwZs6S_i.js";import{n as K,t as q}from"./_plugin-vue_export-helper-nUAWISuX.js";import{t as xe}from"./SvgIcon-C6aJB-3Q.js";import{t as J}from"./IconButton-CQB_swX6.js";import{t as Y}from"./configStore-CRYvJSvr.js";import{t as Se}from"./CommonDialog-DfT04-V7.js";import{i as Ce,l as we,n as Te,s as Ee}from"./vue-flow-CsvDD38k.js";import{n as De}from"./index-BLO9MkBC.js";import{a as Oe,c as ke,i as Ae,n as X,o as je,r as Me,s as Ne,t as Pe}from"./UserInputNode-B8F60XEE.js";import{t as Fe}from"./dagre-zBHe31_z.js";var Ie=e(Fe(),1);i(),V();var Z=m({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=j(!1);function o(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=ce,r=U,c=ie,u=a;return k(),s(u,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:M(()=>[C(c,null,{default:M(()=>[C(r,{command:`executeFrom`},{default:M(()=>[C(n,null,{default:M(()=>[C(l(pe))]),_:1}),t[1]||=y(` 从此处开始执行 `,-1)]),_:1}),C(r,{command:`executeSingle`},{default:M(()=>[C(n,null,{default:M(()=>[C(l(pe))]),_:1}),t[2]||=y(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:M(()=>[P(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});i(),V(),w();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(m({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:i}){let a=e,u=i,d=j(!1),f=j([]),m=j(``),h=D({get:()=>a.modelValue,set:e=>{m.value=e,u(`update:modelValue`,e);let t=f.value.find(t=>t.fullPath===e);u(`change`,t||null)}}),g=D(()=>f.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function v(e){d.value=!0;try{let t=e?`/api/scan-package-files?directory=${encodeURIComponent(e)}`:`/api/scan-package-files`,n=await fetch(t);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(r.success){f.value=r.packages||[],h.value&&!f.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;A.success(`扫描 ${t} 完成,找到 ${f.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),A.error(`扫描失败: ${e.message}`),f.value=[]}finally{d.value=!1}}async function x(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?S(e):e.error&&A.error(e.error)}catch(e){A.error(`浏览目录失败: ${e.message}`)}}function S(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){A.warning(`请输入目录路径`);return}w(e)};R.alert(E(`div`,{class:`directory-browser`},[E(`div`,{class:`current-path`},[E(`span`,{class:`path-label`},`当前路径:`),E(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),E(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),E(`div`,{class:`directory-list`},[e.parentPath?E(`div`,{class:`directory-item parent-dir`,onClick:()=>w(e.parentPath)},[E(`span`,{class:`dir-icon`},E(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[E(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),E(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>E(`div`,{class:`directory-item`,onClick:()=>w(e.path)},[E(`span`,{class:`dir-icon`},E(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[E(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),E(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){A.warning(`请输入目录路径`);return}v(n)}}})}async function w(e){try{R.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?S(t):t.error&&A.error(t.error)}catch(e){A.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){A.error(`处理目录选择时出错: ${e.message}`)}}return v(),B(()=>a.modelValue,e=>{m.value=e},{immediate:!0}),(i,a)=>{let u=ce,m=_,S=ne,w=r,ee=N;return k(),z(`div`,Le,[c(`div`,Re,[C(S,{modelValue:h.value,"onUpdate:modelValue":a[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||d.value,filterable:``,class:`package-select`},{default:M(()=>[(k(!0),z(W,null,t(g.value,e=>(k(),s(m,{key:e.value,label:e.label,value:e.value},{default:M(()=>[c(`div`,ze,[c(`div`,Be,[C(u,{class:`folder-icon`},{default:M(()=>[C(l(o))]),_:1}),c(`span`,Ve,T(e.label),1)]),c(`div`,He,T(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),C(w,{icon:d.value?l(n):l(p),loading:d.value,disabled:e.disabled,size:`default`,onClick:a[1]||=e=>v(),class:`refresh-btn`,title:`刷新当前项目`},{default:M(()=>[y(T(d.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),C(w,{icon:l(ye),disabled:e.disabled||d.value,size:`default`,onClick:x,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:M(()=>[...a[2]||=[y(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),f.value.length===0&&!d.value?(k(),z(`div`,Q,[C(ee,{type:`info`,size:`small`},{default:M(()=>[...a[3]||=[y(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):b(``,!0)])}}}),[[`__scopeId`,`data-v-2f8c5bc0`]]);i(),w(),V();var $={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=q(m({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:n}){let i=e,a=n,o=D(()=>Array.isArray(i.modelValue)?i.modelValue:[]);function u(){if(!i.addable||i.disableAdd)return;let e=i.createItem;if(!e)return;let t=[...o.value,e()];a(`update:modelValue`,t),a(`add`)}function d(e){if(!i.removable)return;let t=typeof i.minItems==`number`?i.minItems:0;if(o.value.length<=t)return;let n=o.value[e];if(i.disableRemove&&i.disableRemove(n,e))return;let r=[...o.value];r.splice(e,1),a(`update:modelValue`,r),a(`remove`,e)}function f(e,t){return i.itemKey?i.itemKey(e,t):t}return(n,i)=>{let a=r;return k(),z(`div`,$,[e.title!==void 0||e.addable?(k(),z(`div`,We,[e.title?(k(),z(`span`,Ge,T(e.title),1)):b(``,!0),c(`div`,Ke,[P(n.$slots,`title-actions`,{},void 0,!0),e.addable?(k(),s(a,{key:0,type:`primary`,plain:``,icon:l(G),disabled:e.disableAdd||!e.createItem,onClick:u},null,8,[`icon`,`disabled`])):b(``,!0)])])):b(``,!0),o.value.length===0?(k(),z(`div`,qe,[P(n.$slots,`empty`,{},void 0,!0)])):(k(),z(`div`,Je,[(k(!0),z(W,null,t(o.value,(t,r)=>(k(),z(`div`,{key:f(t,r),class:ge([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[c(`div`,Ye,[P(n.$slots,`row`,{item:t,index:r},void 0,!0)]),e.removable?(k(),z(`div`,Xe,[C(a,{type:`danger`,plain:``,icon:l(ve),disabled:typeof e.minItems==`number`&&o.value.length<=e.minItems||(e.disableRemove?e.disableRemove(t,r):!1),onClick:e=>d(r)},null,8,[`icon`,`disabled`,`onClick`])])):b(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-e8a38cd0`]]);i(),V(),w();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=q(m({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=j([]);B(()=>n.modelValue,e=>{i.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>n.paramNames,e=>{if(!e||e.length===0){i.value=[],r(`update:modelValue`,[]);return}let t=new Map(i.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});i.value=n,r(`update:modelValue`,n)},{immediate:!0});function a(e,t,n){if(!i.value[e])return;let a=[...i.value];a[e]={...a[e],[t]:n},t===`inputType`&&(n===`manual`?(a[e].referenceNodeId=void 0,a[e].referenceOutputKey=void 0):a[e].manualValue=void 0),i.value=a,r(`update:modelValue`,a)}function o(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=D(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:o(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,a]=t.split(`::`),o=[...i.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:a},i.value=o,r(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=oe,o=_,u=ne,m=ce,h=H,g=I;return k(),z(`div`,Qe,[C(Ze,{"model-value":i.value,title:void 0,addable:!1,removable:!1},{empty:M(()=>[y(T(l(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:M(({item:t,index:n})=>[c(`div`,$e,[c(`div`,et,[c(`label`,tt,T(l(K)(`@NODEINPUT:参数名`)),1),C(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:l(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>a(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),c(`div`,nt,[c(`label`,rt,T(l(K)(`@NODEINPUT:类型`)),1),C(u,{"model-value":t.inputType,placeholder:l(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>a(n,`inputType`,e)},{default:M(()=>[C(o,{value:`manual`,label:l(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),C(o,{value:`reference`,label:l(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),c(`div`,it,[c(`label`,at,T(l(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(k(),s(r,{key:0,"model-value":t.manualValue,placeholder:l(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>a(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(k(),s(h,{key:1,"model-value":p(t),data:d.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(n,e)},{default:M(({data:e})=>[c(`span`,ot,[e.children?b(``,!0):(k(),s(m,{key:0},{default:M(()=>[C(l(x))]),_:1})),y(` `+T(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,st,[c(`label`,ct,T(l(K)(`@NODEINPUT:必填`)),1),C(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>a(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-1e9fd815`]]);i(),V(),w();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=q(m({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);B(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function o(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=D(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:o(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function p(){let e=[...a.value,f()];a.value=e,i(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function g(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=oe,o=_,u=ne,p=H,v=I;return k(),z(`div`,ut,[C(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(T(l(K)(`@NODECFG:暂无输入参数`)),1)]),row:M(({item:t,index:n})=>[c(`div`,dt,[c(`div`,ft,[c(`label`,pt,T(l(K)(`@NODECFG:参数名`)),1),C(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:l(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),c(`div`,mt,[c(`label`,ht,T(l(K)(`@NODECFG:参数值`)),1),C(u,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:M(()=>[C(o,{label:l(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),C(o,{label:l(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),c(`div`,gt,[c(`label`,_t,T(l(K)(`@NODECFG:值`)),1),t.source===`manual`?(k(),s(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:l(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(k(),s(p,{key:1,"model-value":g(t),data:d.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,vt,[c(`label`,yt,T(l(K)(`@NODEINPUT:必填`)),1),C(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>m(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b90fd34c`]]);i(),V(),w();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=q(m({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let i=e,a=n,o=j([]);B(()=>i.modelValue,e=>{o.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...o.value,u()];o.value=e,a(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!o.value[e])return;let n=[...o.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),o.value=n,a(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function m(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=D(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);f(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let p=oe,m=_,S=ne,w=ce,ee=H,te=I,E=r;return k(),z(`div`,xt,[C(Ze,{"model-value":o.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>a(`update:modelValue`,e)},{empty:M(()=>[y(T(l(K)(`@UINPUT:暂无输入参数`)),1)]),row:M(({item:e,index:t})=>[c(`div`,St,[c(`div`,Ct,[c(`label`,wt,T(l(K)(`@UINPUT:参数名`)),1),C(p,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:l(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),c(`div`,Tt,[c(`label`,Et,T(l(K)(`@UINPUT:类型`)),1),C(S,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:M(()=>[C(m,{label:l(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),C(m,{label:l(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),c(`div`,Dt,[c(`label`,Ot,T(e.source===`manual`?l(K)(`@UINPUT:默认值`):l(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(k(),s(p,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:l(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(k(),s(ee,{key:1,"model-value":v(e),data:h.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:M(({data:e})=>[c(`span`,kt,[e.children?b(``,!0):(k(),s(w,{key:0},{default:M(()=>[C(l(x))]),_:1})),y(` `+T(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,At,[c(`label`,jt,T(l(K)(`@NODEINPUT:必填`)),1),C(te,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:M(()=>[e.addable===!1?b(``,!0):(k(),s(E,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:M(()=>[y(T(l(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-5dc978f3`]]);i(),V(),w();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,At as n,B as r,Bn as i,C as a,Ct as o,Dn as s,En as c,Er as l,Et as u,F as d,G as f,Ht as p,In as m,K as h,Kt as g,L as _,M as v,Nn as y,On as b,Ot as x,P as S,Pn as C,Pr as w,Pt as ee,Qn as te,Qr as T,R as ne,Rn as E,S as re,T as ie,Tn as D,Vn as ae,W as oe,Wn as O,Xn as se,Y as ce,Yn as le,Zn as k,a as A,b as ue,bn as de,br as j,cr as M,d as N,er as P,ft as F,g as I,gr as L,i as R,kn as z,lt as fe,nn as pe,or as B,ot as me,pr as V,q as he,qr as ge,u as H,un as _e,ut as ve,w as U,xn as W,xt as ye,zt as G}from"./element-plus-KTmRV-so.js";import{d as be}from"./vendor-CwZs6S_i.js";import{n as K,t as q}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{t as xe}from"./SvgIcon-BVCbrPws.js";import{t as J}from"./IconButton-pqSYKRT8.js";import{t as Y}from"./configStore-DoobmT7N.js";import{t as Se}from"./CommonDialog-B8XOXtz_.js";import{i as Ce,l as we,n as Te,s as Ee}from"./vue-flow-CsvDD38k.js";import{n as De}from"./index-ndDaGoRO.js";import{a as Oe,c as ke,i as Ae,n as X,o as je,r as Me,s as Ne,t as Pe}from"./UserInputNode-DXHeCjzG.js";import{t as Fe}from"./dagre-zBHe31_z.js";var Ie=e(Fe(),1);i(),V();var Z=m({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=j(!1);function o(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=ce,r=U,c=ie,u=a;return k(),s(u,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:M(()=>[C(c,null,{default:M(()=>[C(r,{command:`executeFrom`},{default:M(()=>[C(n,null,{default:M(()=>[C(l(pe))]),_:1}),t[1]||=y(` 从此处开始执行 `,-1)]),_:1}),C(r,{command:`executeSingle`},{default:M(()=>[C(n,null,{default:M(()=>[C(l(pe))]),_:1}),t[2]||=y(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:M(()=>[P(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});i(),V(),w();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(m({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:i}){let a=e,u=i,d=j(!1),f=j([]),m=j(``),h=D({get:()=>a.modelValue,set:e=>{m.value=e,u(`update:modelValue`,e);let t=f.value.find(t=>t.fullPath===e);u(`change`,t||null)}}),g=D(()=>f.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function v(e){d.value=!0;try{let t=e?`/api/scan-package-files?directory=${encodeURIComponent(e)}`:`/api/scan-package-files`,n=await fetch(t);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(r.success){f.value=r.packages||[],h.value&&!f.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;A.success(`扫描 ${t} 完成,找到 ${f.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),A.error(`扫描失败: ${e.message}`),f.value=[]}finally{d.value=!1}}async function x(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?S(e):e.error&&A.error(e.error)}catch(e){A.error(`浏览目录失败: ${e.message}`)}}function S(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){A.warning(`请输入目录路径`);return}w(e)};R.alert(E(`div`,{class:`directory-browser`},[E(`div`,{class:`current-path`},[E(`span`,{class:`path-label`},`当前路径:`),E(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),E(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),E(`div`,{class:`directory-list`},[e.parentPath?E(`div`,{class:`directory-item parent-dir`,onClick:()=>w(e.parentPath)},[E(`span`,{class:`dir-icon`},E(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[E(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),E(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>E(`div`,{class:`directory-item`,onClick:()=>w(e.path)},[E(`span`,{class:`dir-icon`},E(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[E(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),E(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){A.warning(`请输入目录路径`);return}v(n)}}})}async function w(e){try{R.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?S(t):t.error&&A.error(t.error)}catch(e){A.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){A.error(`处理目录选择时出错: ${e.message}`)}}return v(),B(()=>a.modelValue,e=>{m.value=e},{immediate:!0}),(i,a)=>{let u=ce,m=_,S=ne,w=r,ee=N;return k(),z(`div`,Le,[c(`div`,Re,[C(S,{modelValue:h.value,"onUpdate:modelValue":a[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||d.value,filterable:``,class:`package-select`},{default:M(()=>[(k(!0),z(W,null,t(g.value,e=>(k(),s(m,{key:e.value,label:e.label,value:e.value},{default:M(()=>[c(`div`,ze,[c(`div`,Be,[C(u,{class:`folder-icon`},{default:M(()=>[C(l(o))]),_:1}),c(`span`,Ve,T(e.label),1)]),c(`div`,He,T(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),C(w,{icon:d.value?l(n):l(p),loading:d.value,disabled:e.disabled,size:`default`,onClick:a[1]||=e=>v(),class:`refresh-btn`,title:`刷新当前项目`},{default:M(()=>[y(T(d.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),C(w,{icon:l(ye),disabled:e.disabled||d.value,size:`default`,onClick:x,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:M(()=>[...a[2]||=[y(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),f.value.length===0&&!d.value?(k(),z(`div`,Q,[C(ee,{type:`info`,size:`small`},{default:M(()=>[...a[3]||=[y(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):b(``,!0)])}}}),[[`__scopeId`,`data-v-2f8c5bc0`]]);i(),w(),V();var $={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=q(m({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:n}){let i=e,a=n,o=D(()=>Array.isArray(i.modelValue)?i.modelValue:[]);function u(){if(!i.addable||i.disableAdd)return;let e=i.createItem;if(!e)return;let t=[...o.value,e()];a(`update:modelValue`,t),a(`add`)}function d(e){if(!i.removable)return;let t=typeof i.minItems==`number`?i.minItems:0;if(o.value.length<=t)return;let n=o.value[e];if(i.disableRemove&&i.disableRemove(n,e))return;let r=[...o.value];r.splice(e,1),a(`update:modelValue`,r),a(`remove`,e)}function f(e,t){return i.itemKey?i.itemKey(e,t):t}return(n,i)=>{let a=r;return k(),z(`div`,$,[e.title!==void 0||e.addable?(k(),z(`div`,We,[e.title?(k(),z(`span`,Ge,T(e.title),1)):b(``,!0),c(`div`,Ke,[P(n.$slots,`title-actions`,{},void 0,!0),e.addable?(k(),s(a,{key:0,type:`primary`,plain:``,icon:l(G),disabled:e.disableAdd||!e.createItem,onClick:u},null,8,[`icon`,`disabled`])):b(``,!0)])])):b(``,!0),o.value.length===0?(k(),z(`div`,qe,[P(n.$slots,`empty`,{},void 0,!0)])):(k(),z(`div`,Je,[(k(!0),z(W,null,t(o.value,(t,r)=>(k(),z(`div`,{key:f(t,r),class:ge([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[c(`div`,Ye,[P(n.$slots,`row`,{item:t,index:r},void 0,!0)]),e.removable?(k(),z(`div`,Xe,[C(a,{type:`danger`,plain:``,icon:l(ve),disabled:typeof e.minItems==`number`&&o.value.length<=e.minItems||(e.disableRemove?e.disableRemove(t,r):!1),onClick:e=>d(r)},null,8,[`icon`,`disabled`,`onClick`])])):b(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-e8a38cd0`]]);i(),V(),w();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=q(m({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=j([]);B(()=>n.modelValue,e=>{i.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>n.paramNames,e=>{if(!e||e.length===0){i.value=[],r(`update:modelValue`,[]);return}let t=new Map(i.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});i.value=n,r(`update:modelValue`,n)},{immediate:!0});function a(e,t,n){if(!i.value[e])return;let a=[...i.value];a[e]={...a[e],[t]:n},t===`inputType`&&(n===`manual`?(a[e].referenceNodeId=void 0,a[e].referenceOutputKey=void 0):a[e].manualValue=void 0),i.value=a,r(`update:modelValue`,a)}function o(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=D(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:o(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,a]=t.split(`::`),o=[...i.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:a},i.value=o,r(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=oe,o=_,u=ne,m=ce,h=H,g=I;return k(),z(`div`,Qe,[C(Ze,{"model-value":i.value,title:void 0,addable:!1,removable:!1},{empty:M(()=>[y(T(l(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:M(({item:t,index:n})=>[c(`div`,$e,[c(`div`,et,[c(`label`,tt,T(l(K)(`@NODEINPUT:参数名`)),1),C(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:l(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>a(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),c(`div`,nt,[c(`label`,rt,T(l(K)(`@NODEINPUT:类型`)),1),C(u,{"model-value":t.inputType,placeholder:l(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>a(n,`inputType`,e)},{default:M(()=>[C(o,{value:`manual`,label:l(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),C(o,{value:`reference`,label:l(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),c(`div`,it,[c(`label`,at,T(l(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(k(),s(r,{key:0,"model-value":t.manualValue,placeholder:l(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>a(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(k(),s(h,{key:1,"model-value":p(t),data:d.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(n,e)},{default:M(({data:e})=>[c(`span`,ot,[e.children?b(``,!0):(k(),s(m,{key:0},{default:M(()=>[C(l(x))]),_:1})),y(` `+T(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,st,[c(`label`,ct,T(l(K)(`@NODEINPUT:必填`)),1),C(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>a(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-1e9fd815`]]);i(),V(),w();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=q(m({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);B(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function o(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=D(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:o(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function p(){let e=[...a.value,f()];a.value=e,i(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function g(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=oe,o=_,u=ne,p=H,v=I;return k(),z(`div`,ut,[C(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(T(l(K)(`@NODECFG:暂无输入参数`)),1)]),row:M(({item:t,index:n})=>[c(`div`,dt,[c(`div`,ft,[c(`label`,pt,T(l(K)(`@NODECFG:参数名`)),1),C(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:l(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),c(`div`,mt,[c(`label`,ht,T(l(K)(`@NODECFG:参数值`)),1),C(u,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:M(()=>[C(o,{label:l(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),C(o,{label:l(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),c(`div`,gt,[c(`label`,_t,T(l(K)(`@NODECFG:值`)),1),t.source===`manual`?(k(),s(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:l(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(k(),s(p,{key:1,"model-value":g(t),data:d.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,vt,[c(`label`,yt,T(l(K)(`@NODEINPUT:必填`)),1),C(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>m(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b90fd34c`]]);i(),V(),w();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=q(m({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let i=e,a=n,o=j([]);B(()=>i.modelValue,e=>{o.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...o.value,u()];o.value=e,a(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!o.value[e])return;let n=[...o.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),o.value=n,a(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function m(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=D(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);f(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let p=oe,m=_,S=ne,w=ce,ee=H,te=I,E=r;return k(),z(`div`,xt,[C(Ze,{"model-value":o.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>a(`update:modelValue`,e)},{empty:M(()=>[y(T(l(K)(`@UINPUT:暂无输入参数`)),1)]),row:M(({item:e,index:t})=>[c(`div`,St,[c(`div`,Ct,[c(`label`,wt,T(l(K)(`@UINPUT:参数名`)),1),C(p,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:l(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),c(`div`,Tt,[c(`label`,Et,T(l(K)(`@UINPUT:类型`)),1),C(S,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:M(()=>[C(m,{label:l(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),C(m,{label:l(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),c(`div`,Dt,[c(`label`,Ot,T(e.source===`manual`?l(K)(`@UINPUT:默认值`):l(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(k(),s(p,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:l(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(k(),s(ee,{key:1,"model-value":v(e),data:h.value,placeholder:l(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:M(({data:e})=>[c(`span`,kt,[e.children?b(``,!0):(k(),s(w,{key:0},{default:M(()=>[C(l(x))]),_:1})),y(` `+T(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),c(`div`,At,[c(`label`,jt,T(l(K)(`@NODEINPUT:必填`)),1),C(te,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:M(()=>[e.addable===!1?b(``,!0):(k(),s(E,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:M(()=>[y(T(l(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-5dc978f3`]]);i(),V(),w();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
2
2
|
const out = new Object()
|
|
3
3
|
out.key0 = param.input
|
|
4
4
|
return out
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,En as n,G as r,In as i,Pr as a,Tn as o,Yr as s,Zn as c,cr as l,er as u,fn as d,kn as f,qr as p,un as m}from"./element-plus-KTmRV-so.js";import{t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,En as n,G as r,In as i,Pr as a,Tn as o,Yr as s,Zn as c,cr as l,er as u,fn as d,kn as f,qr as p,un as m}from"./element-plus-KTmRV-so.js";import{t as h}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{t as g}from"./SvgIcon-BVCbrPws.js";m(),e(),a();var _=[`disabled`,`aria-label`,`aria-pressed`],v=[`src`],y=h(i({__name:`IconButton`,props:{iconClass:{},imageUrl:{},size:{default:`medium`},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},tooltip:{default:``},ariaLabel:{default:``},pressed:{type:Boolean,default:!1},customClass:{default:``},color:{default:``},hoverColor:{default:`var(--color-primary)`}},emits:[`click`],setup(e,{emit:i}){d(e=>({a3c905a2:e.hoverColor}));let a=e,m=i,h=o(()=>`icon-button--${a.size}`),y=e=>{a.disabled||m(`click`,e)};return(i,a)=>{let o=r;return c(),t(o,{content:e.tooltip,disabled:!e.tooltip,placement:`bottom`,"show-after":300},{default:l(()=>[n(`button`,{type:`button`,class:p([`icon-button`,[h.value,e.customClass,{"is-disabled":e.disabled,"is-active":e.active}]]),disabled:e.disabled,"aria-label":e.ariaLabel||e.tooltip||void 0,"aria-pressed":e.pressed?`true`:void 0,onClick:y},[e.iconClass?(c(),t(g,{key:0,"icon-class":e.iconClass,decorative:!0,style:s({color:e.color||void 0})},null,8,[`icon-class`,`style`])):e.imageUrl?(c(),f(`img`,{key:1,src:e.imageUrl,alt:``,"aria-hidden":`true`,class:`icon-image`},null,8,v)):u(i.$slots,`default`,{},void 0,!0,2)],10,_)]),_:3},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-c60f6beb`]]);export{y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,B as t,Bn as n,Dn as r,En as i,Er as a,G as o,In as s,L as c,Nn as l,O as u,On as d,Pn as f,Pr as p,Qr as m,R as h,Tn as g,Tt as ee,W as te,Wn as _,Wt as ne,Y as re,Yn as ie,Yr as ae,Zn as v,a as y,bn as b,br as x,cr as S,h as C,i as oe,kn as w,lr as se,lt as ce,m as le,mt as ue,o as de,or as T,pr as fe,qn as pe,qr as me,un as E,vn as he,xn as D,yn as ge,yt as _e,z as ve}from"./element-plus-KTmRV-so.js";import{n as O,t as k}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,B as t,Bn as n,Dn as r,En as i,Er as a,G as o,In as s,L as c,Nn as l,O as u,On as d,Pn as f,Pr as p,Qr as m,R as h,Tn as g,Tt as ee,W as te,Wn as _,Wt as ne,Y as re,Yn as ie,Yr as ae,Zn as v,a as y,bn as b,br as x,cr as S,h as C,i as oe,kn as w,lr as se,lt as ce,m as le,mt as ue,o as de,or as T,pr as fe,qn as pe,qr as me,un as E,vn as he,xn as D,yn as ge,yt as _e,z as ve}from"./element-plus-KTmRV-so.js";import{n as O,t as k}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{o as ye,t as be}from"./FileDiffViewer-DL07IMz5.js";import{t as xe}from"./IconButton-pqSYKRT8.js";import{t as Se}from"./gitStore-BJbNtjxA.js";import{t as Ce}from"./toolsStore-Bu8Ujw_A.js";import{t as we}from"./CommonDialog-B8XOXtz_.js";var Te=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function A(e){return 10+e*14}function j(e){return Te[e%Te.length]}function M(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Ee(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of M(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function De(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let p=[],m=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(p.push({fromLane:e,color:j(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],g=j(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:g,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:g,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:g,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:j(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let ee=t.slice();i=Math.max(i,t.length);let te=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<ee.length&&ee[e]!==null&&ee[e].hash===t.hash&&te.push({lane:e,color:j(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:g,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:te,topCurves:p,bottomEdges:h,branches:[]})}let c=Ee(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}n(),fe(),p();var Oe={class:`graph-wrap`},ke=[`viewBox`],Ae=[`x1`,`x2`,`stroke`],je=[`x1`,`x2`],N=[`d`,`stroke`],Me=[`d`],P=[`x1`,`x2`,`stroke`],F=[`d`,`stroke`],I=[`d`],L={class:`graph-layer graph-nodes`,"aria-hidden":`true`},R=[`cx`,`stroke`],z=[`cx`,`fill`],B=[`cx`,`stroke`],V=[`cx`],H=-1,Ne=k(s({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(t){let n=t,r=g(()=>A(n.layout.commitLane)),o=O(`@A1833:暂不属于任何分支`);function s(e){return e.length>0?e.join(`, `):o}let c=g(()=>`${n.layout.hash.slice(0,7)} · ${s(n.layout.branches)}`),l=g(()=>n.layout.passes.map(e=>({x:A(e.lane),color:e.color,title:s(e.branches)}))),u=g(()=>n.layout.topCurves.map(e=>{let t=A(e.fromLane),n=r.value;return{d:`M ${t} ${H} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:s(e.branches)}})),f=g(()=>n.layout.bottomEdges.map(e=>{let t=r.value,n=A(e.toLane);return{d:e.kind===`straight`||t===n?`M ${t} 15 L ${n} 31`:`M ${t} 15 C ${t} 23, ${n} 23, ${n} 31`,color:e.color,title:s(e.branches)}}));return(n,o)=>(v(),w(`div`,Oe,[(v(),w(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${t.width} ${a(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(v(!0),w(D,null,e(l.value,(e,t)=>(v(),w(`line`,{key:`p`+t,x1:e.x,y1:H,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[i(`title`,null,m(e.title),1)],8,Ae))),128)),(v(!0),w(D,null,e(l.value,(e,t)=>(v(),w(`line`,{key:`ph`+t,x1:e.x,y1:H,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[i(`title`,null,m(e.title),1)],8,je))),128)),(v(!0),w(D,null,e(u.value,(e,t)=>(v(),w(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[i(`title`,null,m(e.title),1)],8,N))),128)),(v(!0),w(D,null,e(u.value,(e,t)=>(v(),w(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[i(`title`,null,m(e.title),1)],8,Me))),128)),t.layout.hasTopLine?(v(),w(`line`,{key:0,x1:r.value,y1:H,x2:r.value,y2:15,stroke:t.layout.color,"stroke-width":`2`},[i(`title`,null,m(s(t.layout.branches)),1)],8,P)):d(``,!0),(v(!0),w(D,null,e(f.value,(e,t)=>(v(),w(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[i(`title`,null,m(e.title),1)],8,F))),128)),(v(!0),w(D,null,e(f.value,(e,t)=>(v(),w(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[i(`title`,null,m(e.title),1)],8,I))),128))],8,ke)),(v(),w(`svg`,L,[i(`g`,null,[i(`title`,null,m(c.value),1),t.layout.isMerge?(v(),w(`circle`,{key:0,cx:r.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:t.layout.color,"stroke-width":`2`},null,8,R)):(v(),w(`circle`,{key:1,cx:r.value,cy:`50%`,r:`4`,fill:t.layout.color},null,8,z)),t.layout.isHead?(v(),w(`circle`,{key:2,cx:r.value,cy:`50%`,r:`7`,fill:`none`,stroke:t.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,B)):d(``,!0),i(`circle`,{cx:r.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,V)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);n(),fe(),p(),E();var Pe={class:`log-header`},Fe={class:`header-left`},Ie={class:`log-actions`},Le={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Re={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},ze={key:0,class:`filter-panel-header`},Be={class:`filter-form`},Ve={class:`filter-item`},He={class:`compact-label`},Ue={class:`filter-item`},We={class:`compact-label`},Ge={class:`filter-item`},Ke={class:`compact-label`},qe={class:`filter-item`},Je={class:`compact-label`},Ye={class:`filter-actions`},Xe={key:0,role:`alert`,class:`log-error`},Ze={key:1,class:`log-empty-state`},Qe={class:`log-empty-text`},$e={key:2,class:`content-area-content`},et={class:`table-view-container`},tt={class:`commit-message-cell`},nt={class:`message-content`},rt={key:0,class:`branch-container`},it={class:`message-text`},at={class:`author-name`},ot=[`title`,`aria-label`,`onClick`],st={class:`commit-detail-container`},ct={key:0,class:`commit-info`},lt={class:`commit-info-row`},ut={class:`info-item date-item`},dt={class:`info-label`},ft={class:`info-value`},pt={class:`info-item branch-item`},mt={class:`info-label`},ht={key:0,class:`branch-container`},gt={key:1,class:`info-value info-value-muted`},_t={class:`info-item message-item`},vt={class:`info-label`},yt={class:`info-message-wrapper`},bt={class:`info-message-title`},xt=[`innerHTML`],St=[`aria-label`,`onKeydown`],Ct=`zen-gitsync:log-show-graph`,wt=k(s({__name:`LogList`,setup(n,{expose:s}){let p=Se(),fe=Ce(),E=x([]),k=x(``),Te=x(!1),A=g(()=>p.isLoadingLog||Te.value),j=x(!1),M=x(localStorage.getItem(Ct)!==`false`);T(M,e=>{localStorage.setItem(Ct,String(e))});let Oe=g(()=>M.value&&E.value.length>0?De(E.value):null),ke=g(()=>{let e=new Map;if(Oe.value)for(let t of Oe.value.rows)e.set(t.hash,t);return e}),Ae=g(()=>Math.max(Oe.value?.width??0,28)),je=g(()=>Ee(E.value)),N=x(!1),Me=x(null),P=x(!1),F=x(null),I=x([]),L=x(``),R=x(!1),z=x(``),B=x(`full-new`),V=x(``),H=x(``),wt=g(()=>F.value?je.value.get(F.value.hash)??[]:[]),U=x(!1),Tt=g(()=>F.value?.message?F.value.message.split(`
|
|
2
2
|
`)[0].trim():``),Et=g(()=>F.value?.message?F.value.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim():``),Dt=g(()=>Et.value.length>0),Ot=g(()=>Et.value.replace(/\n/g,`<br>`)),W=x(!1),G=x([]),K=x(``),q=x(null),kt=x([]),At=x([]),jt=x([]),Mt=x(!1),Nt=x(0),Pt=x(0),J=x(null),Ft=x(null),It=g(()=>E.value),Lt=g(()=>I.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function Y(e=!1,t=1){let n=Se();if(!n.isGitRepo){k.value=`当前目录不是Git仓库`;return}try{t>1?N.value=!0:Te.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),G.value.length>0&&r.append(`author`,G.value.join(`,`)),At.value.length>0&&r.append(`branch`,At.value.join(`,`)),K.value&&r.append(`message`,K.value),q.value&&Array.isArray(q.value)&&q.value.length===2&&(r.append(`dateFrom`,q.value[0]),r.append(`dateTo`,q.value[1])),r.append(`_t`,Date.now().toString());let i=await(await fetch(`/api/log?${r.toString()}`)).json();if(!i||!i.data||!Array.isArray(i.data)){k.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?E.value=E.value.concat(i.data):Array.isArray(i.data)&&(E.value=i.data),n.currentPage=t,n.totalCommits=i.total??E.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&_(()=>{Ut(),setTimeout(xn,200)}),k.value=``}catch(e){k.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?N.value=!1:Te.value=!1}}function Rt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function zt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function Bt(e){return e?e.length>60||e.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,B as t,Bn as n,Dn as r,En as i,Er as a,Ht as o,In as s,Mn as c,Nn as l,On as u,Pn as d,Pr as f,Qr as p,St as m,Tn as h,Yn as g,Zn as _,a as v,bn as y,br as b,cr as x,gt as S,i as C,kn as w,lr as T,mt as ee,o as te,or as ne,pr as E,qn as D,qr as re,un as O,ut as ie,wt as ae,xn as oe,zt as se}from"./element-plus-KTmRV-so.js";import{c as ce,m as le,p as k}from"./vendor-CwZs6S_i.js";import{n as A,t as j}from"./_plugin-vue_export-helper-nUAWISuX.js";import{n as M,t as N}from"./configStore-CRYvJSvr.js";import{n as P,r as F}from"./flow-mindmap-CurCIiCp.js";E(),n();var I=k(`mindmap`,()=>{let e=N(),t=b(e.ui.mindmapDir||``),n=b([]),r=b(null),i=b(!1),a=b(!1),o=b(null),s=b(``),c=h(()=>r.value!==null),l=h(()=>n.value.length);function u(t){e.saveUiSettings({mindmapDir:t})}async function d(e){let r=e??t.value;if(!r){o.value=null,n.value=[];return}a.value=!0,o.value=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(r)}`)).json();e.success?(t.value=e.dir,n.value=e.files||[],u(e.dir)):(o.value=e.error||`读取目录失败`,n.value=[])}catch(e){o.value=e?.message||String(e),n.value=[]}finally{a.value=!1}}async function f(e){await d(e)}async function p(e,t=!1){if(!t&&i.value&&r.value)throw Error(`UNSAVED_CHANGES`);a.value=!0,o.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();t.success?(r.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},s.value=t.content,i.value=!1):o.value=t.error||`读取文件失败`}catch(e){o.value=e?.message||String(e)}finally{a.value=!1}}async function m(e,n=!1){if(!t.value)throw Error(`未选择目录`);if(!n&&i.value&&r.value)throw Error(`UNSAVED_CHANGES`);a.value=!0,o.value=null;try{let n=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:t.value,name:e})})).json();if(n.success)r.value={path:n.path,title:n.title,content:n.content,mtime:n.mtime},s.value=n.content,i.value=!1,await d();else throw o.value=n.error||`新建失败`,Error(n.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(o.value=e?.message||String(e)),e}finally{a.value=!1}}async function g(e){if(!r.value)throw Error(`没有打开的文件`);a.value=!0,o.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:r.value.path,content:e})})).json();if(t.success)return r.value&&(r.value.content=e,r.value.mtime=t.mtime),s.value=e,i.value=!1,await d(),t;throw o.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw o.value=e?.message||String(e),e}finally{a.value=!1}}async function _(e){let t=await(await fetch(`/api/mindmap/delete`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})})).json();if(!t.success)throw Error(t.error||`删除失败`);return r.value&&r.value.path===e&&(r.value=null,i.value=!1,s.value=``),await d(),t}async function v(e,t){let n=await(await fetch(`/api/mindmap/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})})).json();if(!n.success)throw Error(n.error||`重命名失败`);return r.value&&e===r.value.path&&(r.value={...r.value,path:n.path,title:t}),await d(),n}function y(){r.value&&(i.value=!0)}function x(){r.value=null,i.value=!1,s.value=``}return{currentDir:t,files:n,current:r,dirty:i,loading:a,error:o,hasCurrent:c,filesCount:l,listFiles:d,setDir:f,openFile:p,createFile:m,saveCurrent:g,deleteFile:_,renameFile:v,markDirty:y,closeCurrent:x}});n(),E(),f(),O();var L={class:`mindmap-view`},R={class:`mm-toolbar`},z={class:`mm-toolbar-left`},B=[`title`],V={key:1,class:`mm-dir-empty`},H={class:`mm-toolbar-right`},U={key:0,class:`mm-status`},W=[`title`],ue={key:0,class:`mm-status-dirty`},de={class:`mm-body`},fe={class:`mm-sidebar`},pe={class:`mm-sidebar-header`},me={class:`mm-sidebar-title`},he={class:`mm-sidebar-list`},ge={key:0,class:`mm-sidebar-error`},_e={key:1,class:`mm-sidebar-empty`},ve={key:2,class:`mm-sidebar-empty`},ye=[`onClick`],be={class:`mm-file-info`},xe=[`title`],Se={class:`mm-file-meta`},Ce={class:`mm-editor`},we={key:0,class:`mm-editor-empty`},Te={class:`mm-editor-empty-title`},Ee={class:`mm-editor-empty-hint`},De=1500,G=j(s({__name:`MindmapView`,setup(n){let s=I(),f=N(),{currentLocale:E}=le(M()),O=h(()=>{let e=f.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),k=b(null),j=b(!1);function G(){j.value=!0}function Oe(e){j.value=!1,e&&e.length>0&&s.setDir(e[0])}async function ke(){if(!s.currentDir){v.warning(A(`@MINDMAP:请先选择目录`));return}if(!await Y())return;let e=``;try{e=(await C.prompt(A(`@MINDMAP:输入文件名提示`),A(`@MINDMAP:新建思维导图`),{confirmButtonText:A(`@MINDMAP:新建`),cancelButtonText:A(`@MINDMAP:取消`),inputPlaceholder:A(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.createFile(e,!0),v.success(A(`@MINDMAP:已新建并打开`))}catch(e){v.error(e?.message||A(`@MINDMAP:新建失败`))}}async function K(e=!1){if(s.current)try{let t=k.value?.exportData();if(!t){e||v.warning(A(`@MINDMAP:无法获取数据`));return}await s.saveCurrent(t),e||v.success(A(`@MINDMAP:已保存`))}catch(e){v.error(e?.message||A(`@MINDMAP:保存失败`))}}let q=null;function Ae(){s.current&&s.dirty&&(q&&clearTimeout(q),q=setTimeout(()=>{q=null,s.current&&s.dirty&&K(!0)},De))}function J(){q&&=(clearTimeout(q),null)}async function Y(){if(!s.dirty||!s.current)return!0;try{await C.confirm(A(`@MINDMAP:未保存提示`).replace(`{title}`,s.current.title),A(`@MINDMAP:未保存的改动`),{confirmButtonText:A(`@MINDMAP:保存`),cancelButtonText:A(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),J();let e=k.value?.exportData();return e&&(await s.saveCurrent(e),v.success(A(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(J(),!0)}}async function je(e){if(!(s.current&&s.current.path===e)&&await Y())try{await s.openFile(e,!0)}catch(e){v.error(e?.message||A(`@MINDMAP:打开失败`))}}async function Me(e){try{await C.confirm(A(`@MINDMAP:确认删除提示`).replace(`{title}`,e.title),A(`@MINDMAP:删除`),{confirmButtonText:A(`@MINDMAP:删除`),cancelButtonText:A(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await s.deleteFile(e.path),v.success(A(`@MINDMAP:已删除`))}catch(e){v.error(e?.message||A(`@MINDMAP:删除失败`))}}async function Ne(e){let t=``;try{t=(await C.prompt(A(`@MINDMAP:输入新名称提示`),A(`@MINDMAP:重命名`),{confirmButtonText:A(`@MINDMAP:确定`),cancelButtonText:A(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.renameFile(e.path,t),v.success(A(`@MINDMAP:已重命名`))}catch(e){v.error(e?.message||A(`@MINDMAP:重命名失败`))}}function X(e){s.markDirty(),Ae()}function Pe(e){}async function Fe(){if(!s.currentDir){v.warning(A(`@MINDMAP:请先选择目录`));return}let e=``,t=``;try{e=(await C.prompt(A(`@MINDMAP:粘贴Markdown提示`),A(`@MINDMAP:从Markdown导入`),{confirmButtonText:A(`@MINDMAP:导入`),cancelButtonText:A(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:A(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{t=(await C.prompt(A(`@MINDMAP:输入文件名提示`),A(`@MINDMAP:文件名`),{confirmButtonText:A(`@MINDMAP:新建`),cancelButtonText:A(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.createFile(t,!0);let n=P(e,t),r=JSON.stringify(n,null,2);await s.saveCurrent(r),v.success(A(`@MINDMAP:已导入`))}catch(e){v.error(e?.message||A(`@MINDMAP:导入失败`))}}async function Ie(){if(k.value)try{let e=k.value.getMarkdown();await navigator.clipboard.writeText(e),v.success(A(`@MINDMAP:已复制Markdown`))}catch(e){v.error(e?.message||A(`@MINDMAP:复制失败`))}}function Z(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),s.current&&s.dirty&&(J(),K()))}let Q=b(0);ne(()=>s.current?.path,()=>{Q.value++});let $=b(!1);function Le(){$.value=!$.value}let Re=h(()=>{let e=s.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});g(async()=>{window.addEventListener(`keydown`,Z),s.currentDir&&await s.listFiles()}),D(()=>{window.removeEventListener(`keydown`,Z),J()});function ze(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?A(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${A(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${A(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function Be(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(n,f)=>{let h=t,g=te;return _(),w(`div`,L,[i(`div`,R,[i(`div`,z,[d(h,{size:`small`,icon:a(ae),onClick:G},{default:x(()=>[l(p(a(A)(`@MINDMAP:选择目录`)),1)]),_:1},8,[`icon`]),a(s).currentDir?(_(),w(`span`,{key:0,class:`mm-dir-path`,title:a(s).currentDir},p(a(s).currentDir),9,B)):(_(),w(`span`,V,p(a(A)(`@MINDMAP:未选择目录`)),1))]),i(`div`,H,[d(h,{size:`small`,icon:a(se),disabled:!a(s).currentDir,onClick:ke},{default:x(()=>[l(p(a(A)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,icon:a(ee),disabled:!a(s).currentDir,onClick:Fe},{default:x(()=>[l(p(a(A)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,icon:a(S),disabled:!a(s).current,onClick:Ie},{default:x(()=>[l(p(a(A)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,type:`primary`,icon:a(m),disabled:!a(s).current||!a(s).dirty,loading:a(s).loading,onClick:f[0]||=()=>{J(),K()}},{default:x(()=>[l(p(a(A)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),a(s).current?(_(),w(`span`,U,[i(`span`,{class:`mm-status-title`,title:a(s).current.title},p(a(s).current.title),9,W),a(s).dirty?(_(),w(`span`,ue,`●`)):u(``,!0)])):u(``,!0)])]),i(`div`,de,[i(`div`,fe,[i(`div`,pe,[i(`span`,me,p(a(A)(`@MINDMAP:文件列表`)),1),d(h,{size:`small`,text:``,icon:a(o),loading:a(s).loading,onClick:f[1]||=e=>a(s).listFiles(),disabled:!a(s).currentDir},null,8,[`icon`,`loading`,`disabled`])]),T((_(),w(`div`,he,[a(s).error&&!a(s).loading?(_(),w(`div`,ge,p(a(s).error),1)):a(s).currentDir?a(s).files.length===0?(_(),w(`div`,ve,p(a(A)(`@MINDMAP:暂无思维导图`)),1)):(_(!0),w(oe,{key:3},e(a(s).files,e=>(_(),w(`div`,{key:e.path,class:re([`mm-file-item`,{active:a(s).current?.path===e.path}]),onClick:t=>je(e.path)},[i(`div`,be,[i(`div`,{class:`mm-file-title`,title:e.title},p(e.title),9,xe),i(`div`,Se,p(ze(e.mtime))+` · `+p(Be(e.size)),1)]),i(`div`,{class:`mm-file-actions`,onClick:f[2]||=y(()=>{},[`stop`])},[d(h,{size:`small`,text:``,icon:a(S),onClick:t=>Ne(e),title:a(A)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),d(h,{size:`small`,text:``,type:`danger`,icon:a(ie),onClick:t=>Me(e),title:a(A)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,ye))),128)):(_(),w(`div`,_e,p(a(A)(`@MINDMAP:请先选择目录`)),1))])),[[g,a(s).loading]])]),i(`div`,Ce,[a(s).current?(_(),r(a(F),{key:Q.value,ref_key:`mmRef`,ref:k,data:Re.value,"preview-mode":$.value,onChange:X,onSelect:Pe,onCanvasTogglePreview:Le},null,8,[`data`,`preview-mode`])):(_(),w(`div`,we,[f[4]||=c(`<svg viewBox="0 0 24 24" width="56" height="56" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" data-v-67a98cbd><circle cx="12" cy="12" r="2" data-v-67a98cbd></circle><circle cx="5" cy="5" r="2" data-v-67a98cbd></circle><circle cx="19" cy="5" r="2" data-v-67a98cbd></circle><circle cx="5" cy="19" r="2" data-v-67a98cbd></circle><circle cx="19" cy="19" r="2" data-v-67a98cbd></circle><line x1="10.5" y1="10.5" x2="6.5" y2="6.5" data-v-67a98cbd></line><line x1="13.5" y1="10.5" x2="17.5" y2="6.5" data-v-67a98cbd></line><line x1="10.5" y1="13.5" x2="6.5" y2="17.5" data-v-67a98cbd></line><line x1="13.5" y1="13.5" x2="17.5" y2="17.5" data-v-67a98cbd></line></svg>`,1),i(`p`,Te,p(a(A)(`@MINDMAP:思维导图编辑器`)),1),i(`p`,Ee,p(a(s).currentDir?a(A)(`@MINDMAP:从左侧选择或新建`):a(A)(`@MINDMAP:先选择目录提示`)),1)]))])]),d(a(ce),{visible:j.value,mode:`directory`,theme:O.value?`dark`:`light`,locale:a(E),"default-path":a(s).currentDir||``,onClose:f[3]||=e=>j.value=!1,onConfirm:Oe},null,8,[`visible`,`theme`,`locale`,`default-path`])])}}}),[[`__scopeId`,`data-v-67a98cbd`]]);export{G as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,B as t,Bn as n,Dn as r,En as i,Er as a,Ht as o,In as s,Mn as c,Nn as l,On as u,Pn as d,Pr as f,Qr as p,St as m,Tn as h,Yn as g,Zn as _,a as v,bn as y,br as b,cr as x,gt as S,i as C,kn as w,lr as T,mt as ee,o as te,or as ne,pr as E,qn as D,qr as re,un as O,ut as ie,wt as ae,xn as oe,zt as se}from"./element-plus-KTmRV-so.js";import{c as ce,m as le,p as k}from"./vendor-CwZs6S_i.js";import{n as A,t as j}from"./_plugin-vue_export-helper-C-YBnnP5.js";import{n as M,t as N}from"./configStore-DoobmT7N.js";import{n as P,r as F}from"./flow-mindmap-CurCIiCp.js";E(),n();var I=k(`mindmap`,()=>{let e=N(),t=b(e.ui.mindmapDir||``),n=b([]),r=b(null),i=b(!1),a=b(!1),o=b(null),s=b(``),c=h(()=>r.value!==null),l=h(()=>n.value.length);function u(t){e.saveUiSettings({mindmapDir:t})}async function d(e){let r=e??t.value;if(!r){o.value=null,n.value=[];return}a.value=!0,o.value=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(r)}`)).json();e.success?(t.value=e.dir,n.value=e.files||[],u(e.dir)):(o.value=e.error||`读取目录失败`,n.value=[])}catch(e){o.value=e?.message||String(e),n.value=[]}finally{a.value=!1}}async function f(e){await d(e)}async function p(e,t=!1){if(!t&&i.value&&r.value)throw Error(`UNSAVED_CHANGES`);a.value=!0,o.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();t.success?(r.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},s.value=t.content,i.value=!1):o.value=t.error||`读取文件失败`}catch(e){o.value=e?.message||String(e)}finally{a.value=!1}}async function m(e,n=!1){if(!t.value)throw Error(`未选择目录`);if(!n&&i.value&&r.value)throw Error(`UNSAVED_CHANGES`);a.value=!0,o.value=null;try{let n=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:t.value,name:e})})).json();if(n.success)r.value={path:n.path,title:n.title,content:n.content,mtime:n.mtime},s.value=n.content,i.value=!1,await d();else throw o.value=n.error||`新建失败`,Error(n.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(o.value=e?.message||String(e)),e}finally{a.value=!1}}async function g(e){if(!r.value)throw Error(`没有打开的文件`);a.value=!0,o.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:r.value.path,content:e})})).json();if(t.success)return r.value&&(r.value.content=e,r.value.mtime=t.mtime),s.value=e,i.value=!1,await d(),t;throw o.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw o.value=e?.message||String(e),e}finally{a.value=!1}}async function _(e){let t=await(await fetch(`/api/mindmap/delete`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})})).json();if(!t.success)throw Error(t.error||`删除失败`);return r.value&&r.value.path===e&&(r.value=null,i.value=!1,s.value=``),await d(),t}async function v(e,t){let n=await(await fetch(`/api/mindmap/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})})).json();if(!n.success)throw Error(n.error||`重命名失败`);return r.value&&e===r.value.path&&(r.value={...r.value,path:n.path,title:t}),await d(),n}function y(){r.value&&(i.value=!0)}function x(){r.value=null,i.value=!1,s.value=``}return{currentDir:t,files:n,current:r,dirty:i,loading:a,error:o,hasCurrent:c,filesCount:l,listFiles:d,setDir:f,openFile:p,createFile:m,saveCurrent:g,deleteFile:_,renameFile:v,markDirty:y,closeCurrent:x}});n(),E(),f(),O();var L={class:`mindmap-view`},R={class:`mm-toolbar`},z={class:`mm-toolbar-left`},B=[`title`],V={key:1,class:`mm-dir-empty`},H={class:`mm-toolbar-right`},U={key:0,class:`mm-status`},W=[`title`],ue={key:0,class:`mm-status-dirty`},de={class:`mm-body`},fe={class:`mm-sidebar`},pe={class:`mm-sidebar-header`},me={class:`mm-sidebar-title`},he={class:`mm-sidebar-list`},ge={key:0,class:`mm-sidebar-error`},_e={key:1,class:`mm-sidebar-empty`},ve={key:2,class:`mm-sidebar-empty`},ye=[`onClick`],be={class:`mm-file-info`},xe=[`title`],Se={class:`mm-file-meta`},Ce={class:`mm-editor`},we={key:0,class:`mm-editor-empty`},Te={class:`mm-editor-empty-title`},Ee={class:`mm-editor-empty-hint`},De=1500,G=j(s({__name:`MindmapView`,setup(n){let s=I(),f=N(),{currentLocale:E}=le(M()),O=h(()=>{let e=f.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),k=b(null),j=b(!1);function G(){j.value=!0}function Oe(e){j.value=!1,e&&e.length>0&&s.setDir(e[0])}async function ke(){if(!s.currentDir){v.warning(A(`@MINDMAP:请先选择目录`));return}if(!await Y())return;let e=``;try{e=(await C.prompt(A(`@MINDMAP:输入文件名提示`),A(`@MINDMAP:新建思维导图`),{confirmButtonText:A(`@MINDMAP:新建`),cancelButtonText:A(`@MINDMAP:取消`),inputPlaceholder:A(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.createFile(e,!0),v.success(A(`@MINDMAP:已新建并打开`))}catch(e){v.error(e?.message||A(`@MINDMAP:新建失败`))}}async function K(e=!1){if(s.current)try{let t=k.value?.exportData();if(!t){e||v.warning(A(`@MINDMAP:无法获取数据`));return}await s.saveCurrent(t),e||v.success(A(`@MINDMAP:已保存`))}catch(e){v.error(e?.message||A(`@MINDMAP:保存失败`))}}let q=null;function Ae(){s.current&&s.dirty&&(q&&clearTimeout(q),q=setTimeout(()=>{q=null,s.current&&s.dirty&&K(!0)},De))}function J(){q&&=(clearTimeout(q),null)}async function Y(){if(!s.dirty||!s.current)return!0;try{await C.confirm(A(`@MINDMAP:未保存提示`).replace(`{title}`,s.current.title),A(`@MINDMAP:未保存的改动`),{confirmButtonText:A(`@MINDMAP:保存`),cancelButtonText:A(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),J();let e=k.value?.exportData();return e&&(await s.saveCurrent(e),v.success(A(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(J(),!0)}}async function je(e){if(!(s.current&&s.current.path===e)&&await Y())try{await s.openFile(e,!0)}catch(e){v.error(e?.message||A(`@MINDMAP:打开失败`))}}async function Me(e){try{await C.confirm(A(`@MINDMAP:确认删除提示`).replace(`{title}`,e.title),A(`@MINDMAP:删除`),{confirmButtonText:A(`@MINDMAP:删除`),cancelButtonText:A(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await s.deleteFile(e.path),v.success(A(`@MINDMAP:已删除`))}catch(e){v.error(e?.message||A(`@MINDMAP:删除失败`))}}async function Ne(e){let t=``;try{t=(await C.prompt(A(`@MINDMAP:输入新名称提示`),A(`@MINDMAP:重命名`),{confirmButtonText:A(`@MINDMAP:确定`),cancelButtonText:A(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.renameFile(e.path,t),v.success(A(`@MINDMAP:已重命名`))}catch(e){v.error(e?.message||A(`@MINDMAP:重命名失败`))}}function X(e){s.markDirty(),Ae()}function Pe(e){}async function Fe(){if(!s.currentDir){v.warning(A(`@MINDMAP:请先选择目录`));return}let e=``,t=``;try{e=(await C.prompt(A(`@MINDMAP:粘贴Markdown提示`),A(`@MINDMAP:从Markdown导入`),{confirmButtonText:A(`@MINDMAP:导入`),cancelButtonText:A(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:A(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{t=(await C.prompt(A(`@MINDMAP:输入文件名提示`),A(`@MINDMAP:文件名`),{confirmButtonText:A(`@MINDMAP:新建`),cancelButtonText:A(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?A(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||A(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await s.createFile(t,!0);let n=P(e,t),r=JSON.stringify(n,null,2);await s.saveCurrent(r),v.success(A(`@MINDMAP:已导入`))}catch(e){v.error(e?.message||A(`@MINDMAP:导入失败`))}}async function Ie(){if(k.value)try{let e=k.value.getMarkdown();await navigator.clipboard.writeText(e),v.success(A(`@MINDMAP:已复制Markdown`))}catch(e){v.error(e?.message||A(`@MINDMAP:复制失败`))}}function Z(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),s.current&&s.dirty&&(J(),K()))}let Q=b(0);ne(()=>s.current?.path,()=>{Q.value++});let $=b(!1);function Le(){$.value=!$.value}let Re=h(()=>{let e=s.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});g(async()=>{window.addEventListener(`keydown`,Z),s.currentDir&&await s.listFiles()}),D(()=>{window.removeEventListener(`keydown`,Z),J()});function ze(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?A(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${A(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${A(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function Be(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(n,f)=>{let h=t,g=te;return _(),w(`div`,L,[i(`div`,R,[i(`div`,z,[d(h,{size:`small`,icon:a(ae),onClick:G},{default:x(()=>[l(p(a(A)(`@MINDMAP:选择目录`)),1)]),_:1},8,[`icon`]),a(s).currentDir?(_(),w(`span`,{key:0,class:`mm-dir-path`,title:a(s).currentDir},p(a(s).currentDir),9,B)):(_(),w(`span`,V,p(a(A)(`@MINDMAP:未选择目录`)),1))]),i(`div`,H,[d(h,{size:`small`,icon:a(se),disabled:!a(s).currentDir,onClick:ke},{default:x(()=>[l(p(a(A)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,icon:a(ee),disabled:!a(s).currentDir,onClick:Fe},{default:x(()=>[l(p(a(A)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,icon:a(S),disabled:!a(s).current,onClick:Ie},{default:x(()=>[l(p(a(A)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),d(h,{size:`small`,type:`primary`,icon:a(m),disabled:!a(s).current||!a(s).dirty,loading:a(s).loading,onClick:f[0]||=()=>{J(),K()}},{default:x(()=>[l(p(a(A)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),a(s).current?(_(),w(`span`,U,[i(`span`,{class:`mm-status-title`,title:a(s).current.title},p(a(s).current.title),9,W),a(s).dirty?(_(),w(`span`,ue,`●`)):u(``,!0)])):u(``,!0)])]),i(`div`,de,[i(`div`,fe,[i(`div`,pe,[i(`span`,me,p(a(A)(`@MINDMAP:文件列表`)),1),d(h,{size:`small`,text:``,icon:a(o),loading:a(s).loading,onClick:f[1]||=e=>a(s).listFiles(),disabled:!a(s).currentDir},null,8,[`icon`,`loading`,`disabled`])]),T((_(),w(`div`,he,[a(s).error&&!a(s).loading?(_(),w(`div`,ge,p(a(s).error),1)):a(s).currentDir?a(s).files.length===0?(_(),w(`div`,ve,p(a(A)(`@MINDMAP:暂无思维导图`)),1)):(_(!0),w(oe,{key:3},e(a(s).files,e=>(_(),w(`div`,{key:e.path,class:re([`mm-file-item`,{active:a(s).current?.path===e.path}]),onClick:t=>je(e.path)},[i(`div`,be,[i(`div`,{class:`mm-file-title`,title:e.title},p(e.title),9,xe),i(`div`,Se,p(ze(e.mtime))+` · `+p(Be(e.size)),1)]),i(`div`,{class:`mm-file-actions`,onClick:f[2]||=y(()=>{},[`stop`])},[d(h,{size:`small`,text:``,icon:a(S),onClick:t=>Ne(e),title:a(A)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),d(h,{size:`small`,text:``,type:`danger`,icon:a(ie),onClick:t=>Me(e),title:a(A)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,ye))),128)):(_(),w(`div`,_e,p(a(A)(`@MINDMAP:请先选择目录`)),1))])),[[g,a(s).loading]])]),i(`div`,Ce,[a(s).current?(_(),r(a(F),{key:Q.value,ref_key:`mmRef`,ref:k,data:Re.value,"preview-mode":$.value,onChange:X,onSelect:Pe,onCanvasTogglePreview:Le},null,8,[`data`,`preview-mode`])):(_(),w(`div`,we,[f[4]||=c(`<svg viewBox="0 0 24 24" width="56" height="56" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" data-v-67a98cbd><circle cx="12" cy="12" r="2" data-v-67a98cbd></circle><circle cx="5" cy="5" r="2" data-v-67a98cbd></circle><circle cx="19" cy="5" r="2" data-v-67a98cbd></circle><circle cx="5" cy="19" r="2" data-v-67a98cbd></circle><circle cx="19" cy="19" r="2" data-v-67a98cbd></circle><line x1="10.5" y1="10.5" x2="6.5" y2="6.5" data-v-67a98cbd></line><line x1="13.5" y1="10.5" x2="17.5" y2="6.5" data-v-67a98cbd></line><line x1="10.5" y1="13.5" x2="6.5" y2="17.5" data-v-67a98cbd></line><line x1="13.5" y1="13.5" x2="17.5" y2="17.5" data-v-67a98cbd></line></svg>`,1),i(`p`,Te,p(a(A)(`@MINDMAP:思维导图编辑器`)),1),i(`p`,Ee,p(a(s).currentDir?a(A)(`@MINDMAP:从左侧选择或新建`):a(A)(`@MINDMAP:先选择目录提示`)),1)]))])]),d(a(ce),{visible:j.value,mode:`directory`,theme:O.value?`dark`:`light`,locale:a(E),"default-path":a(s).currentDir||``,onClose:f[3]||=e=>j.value=!1,onConfirm:Oe},null,8,[`visible`,`theme`,`locale`,`default-path`])])}}}),[[`__scopeId`,`data-v-67a98cbd`]]);export{G as default};
|