zen-gitsync 2.17.45 → 2.17.46
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 +1 -1
- package/src/cli/ai/agent.js +5 -1
- package/src/cli/ai/context.js +81 -7
- package/src/cli/ai/context.test.js +64 -1
- package/src/cli/ai/turn.js +3 -1
- package/src/config.js +20 -1
- package/src/ui/public/assets/{AgentEngineSelector-DklehAya.js → AgentEngineSelector-D6rlSfMD.js} +1 -1
- package/src/ui/public/assets/{AgentView-BB83G3x3.js → AgentView-BFRGoIVb.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-DD9jzd0T.js → AppVersionBadge-BnPsn1X5.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-BNK9Sh9m.js → BranchSelector-D30GJwUl.js} +1 -1
- package/src/ui/public/assets/{CommitForm-DhOR8SLd.js → CommitForm-Dvg-RUZI.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-DiiVswHL.js → CommonDialog-BzLau2RJ.js} +1 -1
- package/src/ui/public/assets/{EditorView-Bujglhs9.js → EditorView-D4ZQutRw.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-Bn4uBFZ9.js → FlowExecutionViewer-VL-rUElj.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-B91-BIvF.js → FlowOrchestrationWorkspace-BPNlHRVu.js} +1 -1
- package/src/ui/public/assets/{LogList-kVdrFbaC.js → LogList-COwGjQl6.js} +1 -1
- package/src/ui/public/assets/{MindmapView-C19009vK.js → MindmapView-BVuqPD_H.js} +1 -1
- package/src/ui/public/assets/{MonitorView-kcZy_KA1.js → MonitorView-hqe-4xd0.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-BA4CrfPz.js → ProjectStartupButton-RBc-DJBR.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-Qx78wLVb.js → RecentDirectoriesChat-DFljcYFH.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-DnRcxJ1E.js → RemoteManagerDialog-D6Rbjchl.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-Tpm3yKuD.js → RemoteRepoCard-l0NpXgvB.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-DyS6VOG0.js → SourceMapView-CeVystt0.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-CRCQbZ1H.js → SvgIcon-B-xDJQA1.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-CibAkKOU.js → UserInputNode-DJglU68l.js} +1 -1
- package/src/ui/public/assets/{WorkbenchView-CzKsiGr3.css → WorkbenchView-BSQ87CDi.css} +1 -1
- package/src/ui/public/assets/WorkbenchView-BpH5kNht.js +20 -0
- package/src/ui/public/assets/{_plugin-vue_export-helper-DO_hkLgw.js → _plugin-vue_export-helper-Dz1ARW9a.js} +4 -4
- package/src/ui/public/assets/{agentConversations-gSbkMpVI.js → agentConversations-B8nY45V4.js} +2 -2
- package/src/ui/public/assets/configStore-CMlW8sMa.js +1 -0
- package/src/ui/public/assets/{index-Czdu1C9o.js → index-BQxIFopZ.js} +10 -10
- package/src/ui/public/assets/{index-DxRA_V28.css → index-u9LyUFkr.css} +1 -1
- package/src/ui/public/index.html +6 -6
- package/src/ui/server/routes/config.js +43 -11
- package/src/ui/server/routes/workbench/agentChat.js +7 -2
- package/src/ui/server/routes/workbench/agentRoutes.js +11 -1
- package/src/ui/public/assets/WorkbenchView-CZoswfeC.js +0 -20
- package/src/ui/public/assets/configStore-7LTPR6P8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,E as t,En as n,Gr as r,Hn as i,Mn as a,Mr as o,Pn as s,Qn as c,Rn as l,Tn as u,Xr as d,Yn as f,dr as p,jn as m,kn as h,nr as g,or as _,qr as v,wn as y,wr as b,z as x}from"./element-plus-DrCk0pcV.js";import{n as S,t as C}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,E as t,En as n,Gr as r,Hn as i,Mn as a,Mr as o,Pn as s,Qn as c,Rn as l,Tn as u,Xr as d,Yn as f,dr as p,jn as m,kn as h,nr as g,or as _,qr as v,wn as y,wr as b,z as x}from"./element-plus-DrCk0pcV.js";import{n as S,t as C}from"./_plugin-vue_export-helper-Dz1ARW9a.js";l(),p(),o();var w=[`id`],T={class:`common-dialog__footer`},E=s({__name:`CommonDialog`,props:{modelValue:{type:Boolean},title:{},size:{default:`medium`},type:{default:`default`},width:{},height:{},top:{default:`50px`},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},customClass:{},modalClass:{},appendToBody:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},zIndex:{},showClose:{type:Boolean,default:!0},heightMode:{default:`max`},heightOffset:{default:`100px`},showFooter:{type:Boolean,default:!1},confirmText:{default:S(`@803A9:确定`)},cancelText:{default:S(`@803A9:取消`)},showCancel:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(o,{emit:s}){let l=o,p=s,S=e(()=>{if(l.width)return l.width;switch(l.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),C=g(),E=null;function D(){p(`opened`),i(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function O(){p(`closed`),E&&typeof E.focus==`function`&&(i(()=>E?.focus()),E=null)}function k(e){e&&!l.modelValue&&(E=document.activeElement),p(`update:modelValue`,e)}let A=e(()=>l.size===`fullscreen`?`0`:l.top),j=e(()=>{let e=[];return l.customClass&&e.push(l.customClass),l.type===`flex`&&e.push(`common-dialog--flex`),l.type===`full-height`&&e.push(`common-dialog--full-height`),l.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),M=e(()=>{if(l.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${l.heightOffset})`;return l.heightMode===`fixed`?{height:e}:{maxHeight:e}});function N(){p(`update:modelValue`,!1),p(`close`)}function P(){p(`confirm`)}function F(){p(`cancel`),N()}return(e,i)=>{let s=x;return f(),u(b(t),{"model-value":o.modelValue,title:o.title,width:S.value,top:A.value,style:v(M.value),"z-index":o.zIndex,fullscreen:o.size===`fullscreen`,"close-on-click-modal":o.closeOnClickModal,"close-on-press-escape":o.closeOnPressEscape,"destroy-on-close":o.destroyOnClose,draggable:o.draggable,class:r(j.value),"show-close":o.showClose,"modal-class":o.modalClass,"data-dialog-shell":`common`,"append-to-body":o.appendToBody,"lock-scroll":o.lockScroll,"aria-modal":!0,"aria-labelledby":b(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},h({header:_(({titleClass:e})=>[y(`span`,{id:b(C),class:r([`el-dialog__title`,e]),role:`heading`,"aria-level":`2`},d(o.title),11,w)]),default:_(()=>[c(e.$slots,`default`,{},void 0,!0)]),_:2},[o.showFooter||e.$slots.footer?{name:`footer`,fn:_(()=>[c(e.$slots,`footer`,{},()=>[y(`div`,T,[o.showCancel?(f(),u(s,{key:0,type:`button`,onClick:F},{default:_(()=>[m(d(o.cancelText),1)]),_:1})):n(``,!0),a(s,{type:`primary`,loading:o.confirmLoading,onClick:P},{default:_(()=>[m(d(o.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`show-close`,`modal-class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}}}),D=C(E,[[`__scopeId`,`data-v-6969f391`]]);export{D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,Hn as o,Mn as s,Mr as c,Pn as l,Rn as u,Tn as d,W as ee,Xr as f,Yn as p,Zn as te,_n as ne,dr as m,gn as re,hn as ie,i as h,ir as g,jn as _,ln as v,or as ae,qn as oe,qr as y,r as se,sr as b,vn as ce,vr as x,wn as S,wr as C,xn as le,yn as w,yr as ue}from"./element-plus-DrCk0pcV.js";import{a as de,r as T,t as fe}from"./vendor-yntih_em.js";import{n as E,t as D}from"./_plugin-vue_export-helper-DO_hkLgw.js";import{t as pe}from"./SvgIcon-CRCQbZ1H.js";import{t as me}from"./configStore-7LTPR6P8.js";import{a as he,c as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./monaco-Dfcwm1aX.js";import{n as Se,r as O}from"./flow-mindmap-Cx5RNYN9.js";import{A as Ce,F as we,I as Te,M as Ee,N as De,O as Oe,P as ke,d as Ae,i as je,j as Me,k}from"./index-Czdu1C9o.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./agentConversations-gSbkMpVI.js";import{n as Be,t as A}from"./AgentEngineSelector-DklehAya.js";function j(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`}u(),m();var M={class:`mindmap-preview`},N={class:`mindmap-preview-canvas`},P=D(l({__name:`MindmapPreview`,props:{content:{}},setup(e){let r=e,i=t(()=>O(r.content||``,`未命名文档`));return(e,t)=>(p(),n(`div`,M,[t[0]||=S(`div`,{class:`mindmap-preview-header`},[S(`span`,{class:`mindmap-preview-title`},`整篇导图`),S(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),S(`div`,N,[s(C(Se),{data:i.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);u(),m(),c(),v();var Ve={class:`agent-panel-header`},He=[`title`,`aria-label`],Ue={class:`agent-panel-title`},We={key:1,class:`agent-panel-title`},Ge=[`title`,`aria-label`],Ke=[`title`],qe={class:`agent-panel-convs`},Je=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],Ye=D(l({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(c,{emit:l}){let u=c,ee=l,{theme:te}=De(),ne=t(()=>te.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:ie,currentSessionId:h,messages:_,isStreaming:v,pendingQuestion:ae,answeringQuestion:y,isSessionGenerating:se,currentEngine:ce,pendingEngine:ue,isEngineLocked:D,pickEngine:pe,loadSessions:me,loadSession:he,deleteSession:ge,renameSession:_e,newSession:ve,sendMessage:ye,answerQuestion:be,stop:xe}=Re(),Se=t(()=>D.value?ce.value:ue.value);function O(e){D.value||pe(e)}let Ce=t(()=>Ne(m.value,se)),we=Le(),Te=Pe(),Ee=x(null),Oe=x(null),ke=x(null),Ae=x(null),je=x(null),{width:Me,narrow:k}=Be(je),j=x(`chat`),M=x(null),N=x(!1),P=null,Ye=t(()=>!!u.activeFileName&&!N.value);function Xe(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Ze(){let e=Oe.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Ye.value){if(!t)return;M.value=null,o(()=>t.remove());return}let n=M.value&&e.contains(M.value)?M.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Xe(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),M.value=n}function Qe(e=!0){Ee.value?.scrollToBottom(e)}async function $e(e){let t=N.value?void 0:u.activeFilePath||void 0;await ye(e.text,e.files,{openFilePath:t}),await o(),Qe()}function et(e){he(e),j.value=`chat`}function tt(){ve(),j.value=`chat`}g(()=>_.value.length,()=>{o(()=>Qe(!1))});function nt(){let e=Ae.value;!e||typeof MutationObserver>`u`||(P?.disconnect(),P=new MutationObserver(()=>Ze()),P.observe(e,{childList:!0,subtree:!0}))}return g(()=>u.active,e=>{e&&(j.value=`chat`,me().catch(()=>{}),o(()=>{Ze(),Qe(!1)}))}),g(k,e=>{e||(j.value=`chat`)}),g(()=>u.activeFilePath,()=>{N.value=!1}),g(Ye,e=>{e&&o(Ze)}),oe(()=>{me().catch(()=>{}),o(()=>{Ze(),nt()})}),i(()=>{P?.disconnect(),P=null,M.value=null}),(t,i)=>(p(),n(`div`,{ref_key:`rootRef`,ref:je,class:`editor-agent-panel`},[S(`div`,Ve,[C(k)&&j.value===`list`?(p(),n(w,{key:0},[S(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:C(E)(`@EDITOR:返回对话`),"aria-label":C(E)(`@EDITOR:返回对话`),onClick:i[0]||=e=>j.value=`chat`},[...i[4]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),S(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,He),S(`span`,Ue,f(C(E)(`@EDITOR:会话列表`)),1)],64)):(p(),n(`span`,We,f(C(E)(`@EDITOR:g ai 对话`)),1)),i[7]||=S(`div`,{class:`agent-panel-spacer`},null,-1),!C(k)||j.value===`chat`?(p(),d(A,{key:2,class:`agent-panel-engine`,engine:Se.value,locked:C(D),onSelect:O},null,8,[`engine`,`locked`])):r(``,!0),C(k)&&j.value===`chat`?(p(),n(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:C(E)(`@EDITOR:会话列表`),"aria-label":C(E)(`@EDITOR:会话列表`),onClick:i[1]||=e=>j.value=`list`},[...i[5]||=[e(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-1b43252d><line x1="8" y1="6" x2="21" y2="6" data-v-1b43252d></line><line x1="8" y1="12" x2="21" y2="12" data-v-1b43252d></line><line x1="8" y1="18" x2="21" y2="18" data-v-1b43252d></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-1b43252d></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-1b43252d></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-1b43252d></line></svg>`,1)]],8,Ge)):r(``,!0),S(`button`,{class:`agent-panel-icon-btn`,title:C(E)(`@EDITOR:关闭对话`),onClick:i[2]||=e=>ee(`close`)},[...i[6]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ke)]),S(`div`,{class:a([`agent-panel-body`,{"is-wide":!C(k)}])},[b(S(`div`,qe,[s(C(fe),{"show-search":!0,items:Ce.value,"active-id":C(h),loading:C(ie),labels:C(we),onSelect:et,onNew:tt,onRename:C(_e),onDelete:C(ge)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[re,!C(k)||j.value===`list`]]),b(S(`div`,{ref_key:`chatHostRef`,ref:ke,class:`agent-panel-chat`},[s(C(de),{ref_key:`chatRef`,ref:Ee,"show-input":!1,messages:C(_),"assistant-name":C(Fe),"assistant-avatar":C(ze),theme:ne.value,question:C(ae),"question-submitting":C(y),"question-labels":C(Te),"plan-config":{labels:{title:C(E)(`@AGENT:计划`),raw:C(E)(`@AGENT:原始参数`)}},onAnswer:C(be)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[re,!C(k)||j.value===`chat`]]),C(Me)>0?(p(),n(`div`,{key:0,ref_key:`composerRef`,ref:Ae,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[s(C(T),{ref_key:`inputRef`,ref:Oe,disabled:C(v),generating:C(v),placeholder:C(v)?C(E)(`@AGENT:正在生成中...`):C(E)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:C(Ie)},onSend:$e,onStop:C(xe)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),M.value?(p(),d(le,{key:0,to:M.value},[Ye.value?(p(),n(`div`,{key:0,class:`agent-context-att`,title:c.activeFilePath||``},[i[9]||=S(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[S(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),S(`polyline`,{points:`14 3 14 8 19 8`})],-1),S(`span`,I,f(c.activeFileName),1),S(`button`,{type:`button`,class:`agent-context-att-remove`,title:C(E)(`@EDITOR:不引用当前文档`),"aria-label":C(E)(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>N.value=!0},[...i[8]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):r(``,!0)],8,[`to`])):r(``,!0)],8,Je)):r(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-1b43252d`]]);u(),m(),c(),v();var Xe={class:`sidebar-header`},Ze={class:`sidebar-title`},Qe={class:`sidebar-actions`},$e={class:`sidebar-search`},et=[`placeholder`,`title`],tt=[`title`,`aria-label`],nt={key:0,class:`sidebar-tree`},rt={key:1,class:`tree-arrow-spacer`},it={class:`tree-icon mit-icon`,"aria-hidden":`true`},at=[`xlink:href`],ot=[`onClick`,`onContextmenu`],st={key:1,class:`tree-arrow-spacer`},ct={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},dt=[`xlink:href`],ft=[`title`],pt={key:0,class:`tree-name-hit`},mt={key:4,class:`tree-loading`},ht={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-dark)`}},gt={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-meta)`}},_t=[`placeholder`],vt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},yt={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-dark)`}},bt={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-meta)`}},xt=[`placeholder`],St={key:1,class:`tree-empty`},Ct={key:1,class:`sidebar-loading`},wt={class:`editor-main`},Tt={key:0,class:`editor-tabs`},Et=[`onClick`,`title`],Dt={class:`tab-name`},Ot={key:0,class:`tab-dirty-dot`},kt=[`onClick`],At=[`title`],jt=[`disabled`,`title`],Mt=[`title`],Nt={class:`editor-body`},Pt={key:0,class:`image-tab-placeholder`},Ft={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`}},It={class:`image-tab-placeholder-title`},Lt={class:`image-tab-placeholder-hint`},Rt={class:`preview-header`},zt={class:`preview-title`},Bt={class:`preview-ext-badge`},Vt=[`title`],Ht={class:`preview-body`},Ut=[`sandbox`,`srcdoc`],Wt=6e4,Gt=3e4,Kt=D(l({__name:`EditorView`,props:{pendingFilePath:{}},setup(c){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new xe:t===`css`||t===`scss`||t===`less`?new ye:t===`html`||t===`handlebars`||t===`razor`?new he:t===`typescript`||t===`javascript`?new _e:new ge}};let l=c,u=me(),m=Ae(),v=x([]),de=x(!1),T=x(``),fe=x(``),D=null;function Se(){T.value=``,fe.value=``,D&&=(clearTimeout(D),null)}g(T,e=>{D&&clearTimeout(D),D=setTimeout(()=>{fe.value=e,D=null},180)}),i(()=>{D&&clearTimeout(D),Pe(),gn()});let O=null;function Ne(){Pe(),u.ui.fileTreeAutoRefresh&&(O=setInterval(()=>{document.hidden||u.currentDirectory&&(T.value.trim()||A())},Wt))}function Pe(){O&&=(clearInterval(O),null)}g(()=>u.currentDirectory,async()=>{if(Zt=!1,Ne(),await Ie(),F.value.some(e=>e.isDirty)){Zt=!0;return}F.value=[],I.value=null,rn(),await en()}),g(()=>u.ui.fileTreeAutoRefresh,()=>{Ne()});async function Fe(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 Ie(){let e=u.currentDirectory;if(e){de.value=!0;try{v.value=await Fe(e,0)}finally{de.value=!1}}}function Le(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Le(n.children,t));return t}function Re(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=Re(e.children,t+1),n.expanded=!0),n})}async function ze(e){let t=u.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:Re(n.items,0)}catch{return null}}function Be(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?Be(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function A(e={}){if(!u.currentDirectory)return;let t=await ze([...Le(v.value)]);if(!t){e.notifyOnError&&h.error(E(`@EDITOR:刷新失败`));return}if(v.value.length===0){v.value=t;return}Be(v.value,t)&&(v.value=t)}async function M(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Fe(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function N(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...N(n.children));return t}let Ve=t(()=>fe.value.trim().toLowerCase());function He(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?He(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 Ue=t(()=>He(v.value,Ve.value)),We=t(()=>Ve.value.length>0&&Ue.value.length===0);function Ge(e){let t=fe.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 Ke=x(null);function qe(){let e=Ke.value;e&&(e.focus(),e.select())}function Je(){T.value?(Se(),Ke.value?.focus()):(Ke.value?.blur(),R.value?.focus())}let F=x([]),I=x(null),L=x(null);async function Kt(e){if(L.value=e,e.type!==`file`){M(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,o(()=>on());return}let n=e.name.split(`.`).pop()||``;if(q.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ke(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.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){h.error(`${E(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=j(n),a=z.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),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),h.error(`${E(`@EDITOR:打开文件失败: `)}${e.message}`)}}g(()=>l.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await o();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Kt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function qt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(E(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Jt=()=>F.value.find(e=>e.path===I.value)??null,Yt=t(()=>({expandedDirs:[...Le(v.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Xt=!1,Zt=!1;function Qt(){Zt&&!Xt&&u.isUiLoaded&&u.saveEditorWorkspace(Yt.value)}g(Yt,()=>Qt());async function $t(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(q.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ke(t)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=z.get(e);i&&!i.isDisposed()&&R.value?.getModel()!==i&&(i.dispose(),z.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:j(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function en(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;V.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Xt=!0;try{if(e.expandedDirs.length>0){let t=await ze(e.expandedDirs);t&&(v.value=t)}for(let t of e.tabs)await $t(t);if(!l.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Jt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(q.has(n)||ke(t.name))&&(J.value=!0)}}finally{Xt=!1}}finally{Zt=!0,Qt()}}let tn=x(null),R=ue(null),z=new Map;function nn(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=be.createModel(e.content,e.language,ve.file(e.path)),z.set(e.path,t)),t}function rn(){R.value?.setModel(null);for(let e of z.values())e.isDisposed()||e.dispose();z.clear()}function an(){if(!tn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=be.create(tn.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=Jt();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Jt()?.isDirty&&yn(!1),requestAnimationFrame(()=>{if(!B.value||B.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`))||on()})})}g(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=nn(t);R.value.setModel(n),o(()=>on()),fn(e)});function on(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let sn=0,cn=new Map;async function ln(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function un(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function dn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=z.get(e.path);if(!r||r.isDisposed())return;let i=R.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function fn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++sn,r=await ln(e);if(n!==sn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(cn.get(e)===r.mtimeMs)return;cn.set(e,r.mtimeMs);try{await se.confirm(E(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),E(`@EDITOR:文件已被外部改动`),{confirmButtonText:E(`@EDITOR:重新加载`),cancelButtonText:E(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await un(e);i&&F.value.find(t=>t.path===e)===t&&dn(t,i.content,i.mtimeMs)}function pn(){document.hidden||fn(I.value)}let mn=null;function hn(){gn(),mn=setInterval(()=>{document.hidden||fn(I.value)},Gt)}function gn(){mn&&=(clearInterval(mn),null)}g(()=>F.value.filter(e=>e.isDirty).length,e=>{m.setDirtyCount(e)},{immediate:!0}),i(()=>m.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;be.setTheme(e?`vs-dark`:`vs`)});let _n=null;function vn(){if(_n||!B.value)return;let e=[B.value],t=B.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}_n=new MutationObserver(()=>{B.value&&B.value.offsetParent!==null&&I.value&&R.value&&(fn(I.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`))||on()}))});let n=_n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}oe(async()=>{an(),await Ie(),await en(),vn(),Ne(),window.addEventListener(`focus`,pn),document.addEventListener(`visibilitychange`,pn),hn(),I.value&&o(()=>on())}),i(()=>{_n?.disconnect(),_n=null,window.removeEventListener(`focus`,pn),document.removeEventListener(`visibilitychange`,pn),R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function yn(e=!1){let t=Jt();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){h.error(`${E(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||h.success(E(`@EDITOR:已保存`))}catch(e){h.error(`${E(`@EDITOR:保存失败: `)}${e.message}`)}}function bn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),qe();return}t&&e.key===`s`&&(e.preventDefault(),yn())}oe(()=>window.addEventListener(`keydown`,bn)),i(()=>window.removeEventListener(`keydown`,bn));let B=x(null),V=x(u.ui.editorSidebarWidth),xn=!1,Sn=0,Cn=0;function wn(e){xn=!0,Sn=e.clientX,Cn=V.value,document.addEventListener(`mousemove`,Tn),document.addEventListener(`mouseup`,En),e.preventDefault()}function Tn(e){if(!xn)return;let t=e.clientX-Sn;V.value=Math.max(140,Math.min(400,Cn+t))}function En(){xn=!1,document.removeEventListener(`mousemove`,Tn),document.removeEventListener(`mouseup`,En),V.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(V.value)}function Dn(e){return e.type===`directory`?Te(e.name):we(e.name)}let H=x(null),U=x(null),W=x(null),On=x(null);function kn(){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(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function An(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`file`,value:``},await o(),W.value?.focus()}async function jn(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`directory`,value:``},await o(),W.value?.focus()}function Mn(){H.value=null}async function Nn(){let e=H.value;if(!e||!e.value.trim()){H.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){h.error(e.error);return}h.success(E(`@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){h.error(e.error);return}h.success(E(`@EDITOR:创建成功`))}H.value=null,await A()}function Pn(e){e.key===`Enter`&&(e.preventDefault(),Nn()),e.key===`Escape`&&(e.preventDefault(),Mn())}let G=x(null),Fn=x(null);function In(e,t){e.preventDefault(),G.value={x:e.clientX,y:e.clientY,node:t}}function K(){G.value=null}async function Ln(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`file`,value:``},await o(),W.value?.focus()}async function Rn(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`directory`,value:``},await o(),W.value?.focus()}async function zn(){let e=G.value?.node;K(),e&&(U.value={node:e,value:e.name},await o(),On.value?.focus(),On.value?.select())}async function Bn(){let e=U.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){U.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){h.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)),U.value=null,await A()}function Vn(e){e.key===`Enter`&&(e.preventDefault(),Bn()),e.key===`Escape`&&(e.preventDefault(),U.value=null)}async function Hn(){let e=G.value?.node;if(K(),!e)return;let t=e.type===`directory`?E(`@EDITOR:文件夹`):E(`@EDITOR:文件`);if(!confirm(`${E(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){h.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)),h.success(E(`@EDITOR:已删除`)),await A()}async function Un(){let e=G.value?.node;if(K(),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||h.error(t.error)}catch(e){h.error(e?.message||String(e))}}function Wn(e){let t=u.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 Gn(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 Kn(){let e=G.value?.node;K(),e&&(await Gn(e.path)?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function qn(){let e=G.value?.node;K(),e&&(await Gn(Wn(e.path))?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function Jn(){let e=G.value?.node;if(K(),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||h.error(t.error||E(`@EDITOR:VSCode 未安装`))}catch(e){h.error(e?.message||String(e))}}let Yn=new Set([`html`,`htm`]),Xn=t(()=>{let e=G.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Yn.has(t)});async function Zn(){let e=G.value?.node;if(K(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||E(`@EDITOR:浏览器打开失败`))}catch(e){h.error(e?.message||String(e))}}oe(()=>document.addEventListener(`click`,K)),i(()=>document.removeEventListener(`click`,K));let Qn=new Set([`md`,`html`,`htm`,`svg`]),q=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=x(!1),Y=x(!1),X=x(!1),$n=x(!1),er=x(0),Z=t(()=>F.value.find(e=>e.path===I.value)??null),tr=t(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),nr=t(()=>Z.value?.language===`office`),Q=t(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),rr=t(()=>Qn.has(Q.value)||q.has(Q.value)||ke(Q.value)),ir=t(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=t(()=>Q.value===`md`&&ir.value>0);g(I,()=>{J.value&&!rr.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function ar(){rr.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function or(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function sr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,$n.value=!0}let cr=t(()=>{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`?k(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>`:``}),lr=!1,ur=0,dr=0;function fr(e){lr=!0,ur=e.clientX,dr=er.value,document.addEventListener(`mousemove`,pr),document.addEventListener(`mouseup`,mr),e.preventDefault()}function pr(e){if(!lr)return;let t=e.clientX-ur;er.value=Math.max(200,Math.min(900,dr+t))}function mr(){lr=!1,document.removeEventListener(`mousemove`,pr),document.removeEventListener(`mouseup`,mr)}return(t,i)=>(p(),n(w,null,[S(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:B},[S(`div`,{class:`editor-sidebar`,style:y({width:V.value+`px`})},[S(`div`,Xe,[S(`span`,Ze,f(C(E)(`@EDITOR:资源管理器`)),1),S(`div`,Qe,[s(C(ee),{content:C(E)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:An},[...i[11]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:jn},[...i[12]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>A({notifyOnError:!0})},[...i[13]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`1 4 1 10 7 10`}),S(`polyline`,{points:`23 20 23 14 17 14`}),S(`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`])])]),S(`div`,$e,[i[15]||=S(`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`},[S(`circle`,{cx:`11`,cy:`11`,r:`7`}),S(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),b(S(`input`,{ref_key:`searchInputRef`,ref:Ke,"onUpdate:modelValue":i[1]||=e=>T.value=e,type:`text`,class:`sidebar-search-input`,placeholder:C(E)(`@EDITOR:搜索文件...`),title:C(E)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ne(Je,[`escape`])},null,40,et),[[ie,T.value]]),T.value?(p(),n(`button`,{key:0,class:`sidebar-search-clear`,title:C(E)(`@EDITOR:清除搜索`),"aria-label":C(E)(`@EDITOR:清除搜索`),onClick:Se},[...i[14]||=[S(`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`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,tt)):r(``,!0)]),de.value?(p(),n(`div`,Ct,[...i[24]||=[S(`span`,{class:`spin-icon`},null,-1)]])):(p(),n(`div`,nt,[(p(!0),n(w,null,te(N(Ue.value),e=>(p(),n(w,{key:e.path},[U.value&&U.value.node.path===e.path?(p(),n(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[16]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,rt)),(p(),n(`svg`,it,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,at)])),b(S(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:On,"onUpdate:modelValue":i[2]||=e=>U.value.value=e,onKeydown:Vn,onBlur:Bn,onClick:i[3]||=ce(()=>{},[`stop`])},null,544),[[ie,U.value.value]])],4)):(p(),n(`div`,{key:1,class:a([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":I.value===e.path,"tree-node--selected":L.value?.path===e.path&&I.value!==e.path}]),style:y({paddingLeft:12+e.depth*14+`px`}),onClick:t=>Kt(e),onContextmenu:t=>In(t,e)},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[17]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,st)),e.type===`directory`?(p(),n(`svg`,ct,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,lt)])):(p(),n(`svg`,ut,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,dt)])),S(`span`,{class:`tree-name`,title:e.path},[(p(!0),n(w,null,te(Ge(e.name),(e,t)=>(p(),n(w,{key:t},[e.hit?(p(),n(`span`,pt,f(e.text),1)):(p(),n(w,{key:1},[_(f(e.text),1)],64))],64))),128))],8,ft),e.loading?(p(),n(`span`,mt)):r(``,!0)],46,ot)),H.value&&H.value.afterNode?.path===e.path?(p(),n(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+H.value.depth*14+`px`})},[i[20]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,ht,[...i[18]||=[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,gt,[...i[19]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[5]||=ce(()=>{},[`stop`])},null,40,_t),[[ie,H.value.value]])],4)):r(``,!0)],64))),128)),H.value&&H.value.afterNode===null?(p(),n(`div`,vt,[i[23]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,yt,[...i[21]||=[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,bt,[...i[22]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[7]||=ce(()=>{},[`stop`])},null,40,xt),[[ie,H.value.value]])])):r(``,!0),!H.value&&(We.value||v.value.length===0)?(p(),n(`div`,St,f(We.value?C(E)(`@EDITOR:未找到匹配文件`):C(E)(`@EDITOR:暂无文件`)),1)):r(``,!0)]))],4),S(`div`,{class:`editor-resizer`,onMousedown:wn},null,32),S(`div`,wt,[F.value.length>0?(p(),n(`div`,Tt,[(p(!0),n(w,null,te(F.value,e=>(p(),n(`div`,{key:e.path,class:a([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[S(`span`,Dt,f(e.name),1),e.isDirty?(p(),n(`span`,Ot)):r(``,!0),S(`button`,{class:`tab-close`,onClick:t=>qt(e.path,t)},[...i[25]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,kt)],10,Et))),128)),i[29]||=S(`div`,{class:`editor-tabs-spacer`},null,-1),rr.value?(p(),n(`button`,{key:0,class:a([`preview-toggle-btn`,{active:J.value}]),title:J.value?C(E)(`@EDITOR:关闭预览`):C(E)(`@EDITOR:打开预览`),onClick:ar},[i[26]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),S(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),S(`span`,null,f(C(E)(`@EDITOR:预览`)),1)],10,At)):r(``,!0),$.value?(p(),n(`button`,{key:1,class:a([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:打开思维导图`):C(E)(`@EDITOR:需要至少一个 # 标题`),onClick:or},[i[27]||=e(`<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-c65c2d3f><circle cx="12" cy="12" r="2" data-v-c65c2d3f></circle><circle cx="5" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="5" cy="18" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="18" r="1.6" data-v-c65c2d3f></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-c65c2d3f></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-c65c2d3f></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-c65c2d3f></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-c65c2d3f></line></svg>`,1),S(`span`,null,f(C(E)(`@EDITOR:思维导图`)),1)],10,jt)):r(``,!0),S(`button`,{class:a([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?C(E)(`@EDITOR:关闭 g ai 对话`):C(E)(`@EDITOR:打开 g ai 对话`),onClick:sr},[i[28]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),S(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),S(`span`,null,f(C(E)(`@EDITOR:g ai 对话`)),1)],10,Mt)])):r(``,!0),F.value.length===0?(p(),d(je,{key:1,class:`editor-empty`,title:C(E)(`@EDITOR:从左侧选择文件打开`),hint:C(E)(`@EDITOR:Ctrl+S 保存`)},{icon:ae(()=>[...i[30]||=[S(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):r(``,!0),S(`div`,Nt,[S(`div`,{class:a([`monaco-container`,{hidden:F.value.length===0||tr.value||nr.value}]),ref_key:`editorContainerRef`,ref:tn},null,2),tr.value&&F.value.length>0&&!J.value&&!Y.value?(p(),n(`div`,Pt,[(p(),n(`svg`,Ft,[...i[31]||=[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),S(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),S(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),S(`p`,It,f(Z.value?.name),1),S(`p`,Lt,f(C(E)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):r(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(p(),n(`div`,{key:1,class:`preview-resizer`,onMousedown:fr},null,32)):r(``,!0),$n.value?b((p(),d(Ye,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:y({flexBasis:er.value+`px`}),onClose:i[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[re,X.value&&F.value.length>0]]):r(``,!0),(J.value||Y.value)&&F.value.length>0?(p(),n(`div`,{key:3,class:`preview-panel`,style:y({flexBasis:er.value+`px`})},[S(`div`,Rt,[S(`span`,zt,f(Y.value?C(E)(`@EDITOR:思维导图`):C(E)(`@EDITOR:预览`)),1),S(`span`,Bt,f(Q.value.toUpperCase()),1),i[33]||=S(`div`,{class:`preview-header-spacer`},null,-1),S(`button`,{class:`preview-close-btn`,title:Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:关闭预览`),onClick:i[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...i[32]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Vt)]),S(`div`,Ht,[Y.value&&Q.value===`md`&&Z.value?(p(),d(P,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(p(),d(Me,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(p(),n(`iframe`,{key:2,class:`preview-iframe`,sandbox:C(Oe),srcdoc:cr.value},null,8,Ut)):J.value&&C(q).has(Q.value)&&Z.value?(p(),d(Ee,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&nr.value&&Z.value?(p(),d(Ce,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):r(``,!0)])],4)):r(``,!0)])])],512),(p(),d(le,{to:`body`},[G.value?(p(),n(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Fn,class:`ctx-menu`,style:y({left:G.value.x+`px`,top:G.value.y+`px`}),onClick:i[10]||=ce(()=>{},[`stop`])},[S(`button`,{class:`ctx-menu-item`,onClick:Ln},[i[34]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Rn},[i[35]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件夹`)),1)]),i[42]||=S(`div`,{class:`ctx-menu-sep`},null,-1),S(`button`,{class:`ctx-menu-item`,onClick:Kn},[i[36]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),S(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),_(` `+f(C(E)(`@EDITOR:复制绝对路径`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:qn},[i[37]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),S(`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),_(` `+f(C(E)(`@EDITOR:复制相对路径`)),1)]),i[43]||=S(`div`,{class:`ctx-menu-sep`},null,-1),Xn.value?(p(),n(`button`,{key:0,class:`ctx-menu-item`,onClick:Zn},[i[38]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`9`}),S(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),S(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),_(` `+f(C(E)(`@EDITOR:在浏览器中打开`)),1)])):r(``,!0),S(`button`,{class:`ctx-menu-item`,onClick:Un},[i[39]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),_(` `+f(C(E)(`@EDITOR:在资源管理器中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Jn},[s(pe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),_(` `+f(C(E)(`@EDITOR:在 VSCode 中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:zn},[i[40]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),S(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),_(` `+f(C(E)(`@EDITOR:重命名`)),1)]),S(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Hn},[i[41]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`3 6 5 6 21 6`}),S(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),S(`path`,{d:`M10 11v6`}),S(`path`,{d:`M14 11v6`}),S(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),_(` `+f(C(E)(`@EDITOR:删除`)),1)])],4)):r(``,!0)]))],64))}}),[[`__scopeId`,`data-v-c65c2d3f`]]);export{Kt as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Cn as t,Dn as n,En as r,Gn as i,Gr as a,Hn as o,Mn as s,Mr as c,Pn as l,Rn as u,Tn as d,W as ee,Xr as f,Yn as p,Zn as te,_n as ne,dr as m,gn as re,hn as ie,i as h,ir as g,jn as _,ln as v,or as ae,qn as oe,qr as y,r as se,sr as b,vn as ce,vr as x,wn as S,wr as C,xn as le,yn as w,yr as ue}from"./element-plus-DrCk0pcV.js";import{a as de,r as T,t as fe}from"./vendor-yntih_em.js";import{n as E,t as D}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{t as pe}from"./SvgIcon-B-xDJQA1.js";import{t as me}from"./configStore-CMlW8sMa.js";import{a as he,c as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./monaco-Dfcwm1aX.js";import{n as Se,r as O}from"./flow-mindmap-Cx5RNYN9.js";import{A as Ce,F as we,I as Te,M as Ee,N as De,O as Oe,P as ke,d as Ae,i as je,j as Me,k}from"./index-BQxIFopZ.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./agentConversations-B8nY45V4.js";import{n as Be,t as A}from"./AgentEngineSelector-D6rlSfMD.js";function j(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`}u(),m();var M={class:`mindmap-preview`},N={class:`mindmap-preview-canvas`},P=D(l({__name:`MindmapPreview`,props:{content:{}},setup(e){let r=e,i=t(()=>O(r.content||``,`未命名文档`));return(e,t)=>(p(),n(`div`,M,[t[0]||=S(`div`,{class:`mindmap-preview-header`},[S(`span`,{class:`mindmap-preview-title`},`整篇导图`),S(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),S(`div`,N,[s(C(Se),{data:i.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);u(),m(),c(),v();var Ve={class:`agent-panel-header`},He=[`title`,`aria-label`],Ue={class:`agent-panel-title`},We={key:1,class:`agent-panel-title`},Ge=[`title`,`aria-label`],Ke=[`title`],qe={class:`agent-panel-convs`},Je=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],Ye=D(l({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(c,{emit:l}){let u=c,ee=l,{theme:te}=De(),ne=t(()=>te.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:ie,currentSessionId:h,messages:_,isStreaming:v,pendingQuestion:ae,answeringQuestion:y,isSessionGenerating:se,currentEngine:ce,pendingEngine:ue,isEngineLocked:D,pickEngine:pe,loadSessions:me,loadSession:he,deleteSession:ge,renameSession:_e,newSession:ve,sendMessage:ye,answerQuestion:be,stop:xe}=Re(),Se=t(()=>D.value?ce.value:ue.value);function O(e){D.value||pe(e)}let Ce=t(()=>Ne(m.value,se)),we=Le(),Te=Pe(),Ee=x(null),Oe=x(null),ke=x(null),Ae=x(null),je=x(null),{width:Me,narrow:k}=Be(je),j=x(`chat`),M=x(null),N=x(!1),P=null,Ye=t(()=>!!u.activeFileName&&!N.value);function Xe(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Ze(){let e=Oe.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Ye.value){if(!t)return;M.value=null,o(()=>t.remove());return}let n=M.value&&e.contains(M.value)?M.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Xe(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),M.value=n}function Qe(e=!0){Ee.value?.scrollToBottom(e)}async function $e(e){let t=N.value?void 0:u.activeFilePath||void 0;await ye(e.text,e.files,{openFilePath:t}),await o(),Qe()}function et(e){he(e),j.value=`chat`}function tt(){ve(),j.value=`chat`}g(()=>_.value.length,()=>{o(()=>Qe(!1))});function nt(){let e=Ae.value;!e||typeof MutationObserver>`u`||(P?.disconnect(),P=new MutationObserver(()=>Ze()),P.observe(e,{childList:!0,subtree:!0}))}return g(()=>u.active,e=>{e&&(j.value=`chat`,me().catch(()=>{}),o(()=>{Ze(),Qe(!1)}))}),g(k,e=>{e||(j.value=`chat`)}),g(()=>u.activeFilePath,()=>{N.value=!1}),g(Ye,e=>{e&&o(Ze)}),oe(()=>{me().catch(()=>{}),o(()=>{Ze(),nt()})}),i(()=>{P?.disconnect(),P=null,M.value=null}),(t,i)=>(p(),n(`div`,{ref_key:`rootRef`,ref:je,class:`editor-agent-panel`},[S(`div`,Ve,[C(k)&&j.value===`list`?(p(),n(w,{key:0},[S(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:C(E)(`@EDITOR:返回对话`),"aria-label":C(E)(`@EDITOR:返回对话`),onClick:i[0]||=e=>j.value=`chat`},[...i[4]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),S(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,He),S(`span`,Ue,f(C(E)(`@EDITOR:会话列表`)),1)],64)):(p(),n(`span`,We,f(C(E)(`@EDITOR:g ai 对话`)),1)),i[7]||=S(`div`,{class:`agent-panel-spacer`},null,-1),!C(k)||j.value===`chat`?(p(),d(A,{key:2,class:`agent-panel-engine`,engine:Se.value,locked:C(D),onSelect:O},null,8,[`engine`,`locked`])):r(``,!0),C(k)&&j.value===`chat`?(p(),n(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:C(E)(`@EDITOR:会话列表`),"aria-label":C(E)(`@EDITOR:会话列表`),onClick:i[1]||=e=>j.value=`list`},[...i[5]||=[e(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-1b43252d><line x1="8" y1="6" x2="21" y2="6" data-v-1b43252d></line><line x1="8" y1="12" x2="21" y2="12" data-v-1b43252d></line><line x1="8" y1="18" x2="21" y2="18" data-v-1b43252d></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-1b43252d></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-1b43252d></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-1b43252d></line></svg>`,1)]],8,Ge)):r(``,!0),S(`button`,{class:`agent-panel-icon-btn`,title:C(E)(`@EDITOR:关闭对话`),onClick:i[2]||=e=>ee(`close`)},[...i[6]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ke)]),S(`div`,{class:a([`agent-panel-body`,{"is-wide":!C(k)}])},[b(S(`div`,qe,[s(C(fe),{"show-search":!0,items:Ce.value,"active-id":C(h),loading:C(ie),labels:C(we),onSelect:et,onNew:tt,onRename:C(_e),onDelete:C(ge)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[re,!C(k)||j.value===`list`]]),b(S(`div`,{ref_key:`chatHostRef`,ref:ke,class:`agent-panel-chat`},[s(C(de),{ref_key:`chatRef`,ref:Ee,"show-input":!1,messages:C(_),"assistant-name":C(Fe),"assistant-avatar":C(ze),theme:ne.value,question:C(ae),"question-submitting":C(y),"question-labels":C(Te),"plan-config":{labels:{title:C(E)(`@AGENT:计划`),raw:C(E)(`@AGENT:原始参数`)}},onAnswer:C(be)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[re,!C(k)||j.value===`chat`]]),C(Me)>0?(p(),n(`div`,{key:0,ref_key:`composerRef`,ref:Ae,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[s(C(T),{ref_key:`inputRef`,ref:Oe,disabled:C(v),generating:C(v),placeholder:C(v)?C(E)(`@AGENT:正在生成中...`):C(E)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:C(Ie)},onSend:$e,onStop:C(xe)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),M.value?(p(),d(le,{key:0,to:M.value},[Ye.value?(p(),n(`div`,{key:0,class:`agent-context-att`,title:c.activeFilePath||``},[i[9]||=S(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[S(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),S(`polyline`,{points:`14 3 14 8 19 8`})],-1),S(`span`,I,f(c.activeFileName),1),S(`button`,{type:`button`,class:`agent-context-att-remove`,title:C(E)(`@EDITOR:不引用当前文档`),"aria-label":C(E)(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>N.value=!0},[...i[8]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):r(``,!0)],8,[`to`])):r(``,!0)],8,Je)):r(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-1b43252d`]]);u(),m(),c(),v();var Xe={class:`sidebar-header`},Ze={class:`sidebar-title`},Qe={class:`sidebar-actions`},$e={class:`sidebar-search`},et=[`placeholder`,`title`],tt=[`title`,`aria-label`],nt={key:0,class:`sidebar-tree`},rt={key:1,class:`tree-arrow-spacer`},it={class:`tree-icon mit-icon`,"aria-hidden":`true`},at=[`xlink:href`],ot=[`onClick`,`onContextmenu`],st={key:1,class:`tree-arrow-spacer`},ct={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},dt=[`xlink:href`],ft=[`title`],pt={key:0,class:`tree-name-hit`},mt={key:4,class:`tree-loading`},ht={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-dark)`}},gt={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-meta)`}},_t=[`placeholder`],vt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},yt={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-dark)`}},bt={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-meta)`}},xt=[`placeholder`],St={key:1,class:`tree-empty`},Ct={key:1,class:`sidebar-loading`},wt={class:`editor-main`},Tt={key:0,class:`editor-tabs`},Et=[`onClick`,`title`],Dt={class:`tab-name`},Ot={key:0,class:`tab-dirty-dot`},kt=[`onClick`],At=[`title`],jt=[`disabled`,`title`],Mt=[`title`],Nt={class:`editor-body`},Pt={key:0,class:`image-tab-placeholder`},Ft={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`}},It={class:`image-tab-placeholder-title`},Lt={class:`image-tab-placeholder-hint`},Rt={class:`preview-header`},zt={class:`preview-title`},Bt={class:`preview-ext-badge`},Vt=[`title`],Ht={class:`preview-body`},Ut=[`sandbox`,`srcdoc`],Wt=6e4,Gt=3e4,Kt=D(l({__name:`EditorView`,props:{pendingFilePath:{}},setup(c){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new xe:t===`css`||t===`scss`||t===`less`?new ye:t===`html`||t===`handlebars`||t===`razor`?new he:t===`typescript`||t===`javascript`?new _e:new ge}};let l=c,u=me(),m=Ae(),v=x([]),de=x(!1),T=x(``),fe=x(``),D=null;function Se(){T.value=``,fe.value=``,D&&=(clearTimeout(D),null)}g(T,e=>{D&&clearTimeout(D),D=setTimeout(()=>{fe.value=e,D=null},180)}),i(()=>{D&&clearTimeout(D),Pe(),gn()});let O=null;function Ne(){Pe(),u.ui.fileTreeAutoRefresh&&(O=setInterval(()=>{document.hidden||u.currentDirectory&&(T.value.trim()||A())},Wt))}function Pe(){O&&=(clearInterval(O),null)}g(()=>u.currentDirectory,async()=>{if(Zt=!1,Ne(),await Ie(),F.value.some(e=>e.isDirty)){Zt=!0;return}F.value=[],I.value=null,rn(),await en()}),g(()=>u.ui.fileTreeAutoRefresh,()=>{Ne()});async function Fe(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 Ie(){let e=u.currentDirectory;if(e){de.value=!0;try{v.value=await Fe(e,0)}finally{de.value=!1}}}function Le(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Le(n.children,t));return t}function Re(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=Re(e.children,t+1),n.expanded=!0),n})}async function ze(e){let t=u.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:Re(n.items,0)}catch{return null}}function Be(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?Be(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function A(e={}){if(!u.currentDirectory)return;let t=await ze([...Le(v.value)]);if(!t){e.notifyOnError&&h.error(E(`@EDITOR:刷新失败`));return}if(v.value.length===0){v.value=t;return}Be(v.value,t)&&(v.value=t)}async function M(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Fe(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function N(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...N(n.children));return t}let Ve=t(()=>fe.value.trim().toLowerCase());function He(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?He(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 Ue=t(()=>He(v.value,Ve.value)),We=t(()=>Ve.value.length>0&&Ue.value.length===0);function Ge(e){let t=fe.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 Ke=x(null);function qe(){let e=Ke.value;e&&(e.focus(),e.select())}function Je(){T.value?(Se(),Ke.value?.focus()):(Ke.value?.blur(),R.value?.focus())}let F=x([]),I=x(null),L=x(null);async function Kt(e){if(L.value=e,e.type!==`file`){M(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,o(()=>on());return}let n=e.name.split(`.`).pop()||``;if(q.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ke(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.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){h.error(`${E(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=j(n),a=z.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),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),h.error(`${E(`@EDITOR:打开文件失败: `)}${e.message}`)}}g(()=>l.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await o();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Kt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function qt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(E(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Jt=()=>F.value.find(e=>e.path===I.value)??null,Yt=t(()=>({expandedDirs:[...Le(v.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Xt=!1,Zt=!1;function Qt(){Zt&&!Xt&&u.isUiLoaded&&u.saveEditorWorkspace(Yt.value)}g(Yt,()=>Qt());async function $t(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(q.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ke(t)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=z.get(e);i&&!i.isDisposed()&&R.value?.getModel()!==i&&(i.dispose(),z.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:j(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function en(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;V.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Xt=!0;try{if(e.expandedDirs.length>0){let t=await ze(e.expandedDirs);t&&(v.value=t)}for(let t of e.tabs)await $t(t);if(!l.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Jt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(q.has(n)||ke(t.name))&&(J.value=!0)}}finally{Xt=!1}}finally{Zt=!0,Qt()}}let tn=x(null),R=ue(null),z=new Map;function nn(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=be.createModel(e.content,e.language,ve.file(e.path)),z.set(e.path,t)),t}function rn(){R.value?.setModel(null);for(let e of z.values())e.isDisposed()||e.dispose();z.clear()}function an(){if(!tn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=be.create(tn.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=Jt();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Jt()?.isDirty&&yn(!1),requestAnimationFrame(()=>{if(!B.value||B.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`))||on()})})}g(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=nn(t);R.value.setModel(n),o(()=>on()),fn(e)});function on(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let sn=0,cn=new Map;async function ln(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function un(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function dn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=z.get(e.path);if(!r||r.isDisposed())return;let i=R.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function fn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++sn,r=await ln(e);if(n!==sn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(cn.get(e)===r.mtimeMs)return;cn.set(e,r.mtimeMs);try{await se.confirm(E(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),E(`@EDITOR:文件已被外部改动`),{confirmButtonText:E(`@EDITOR:重新加载`),cancelButtonText:E(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await un(e);i&&F.value.find(t=>t.path===e)===t&&dn(t,i.content,i.mtimeMs)}function pn(){document.hidden||fn(I.value)}let mn=null;function hn(){gn(),mn=setInterval(()=>{document.hidden||fn(I.value)},Gt)}function gn(){mn&&=(clearInterval(mn),null)}g(()=>F.value.filter(e=>e.isDirty).length,e=>{m.setDirtyCount(e)},{immediate:!0}),i(()=>m.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;be.setTheme(e?`vs-dark`:`vs`)});let _n=null;function vn(){if(_n||!B.value)return;let e=[B.value],t=B.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}_n=new MutationObserver(()=>{B.value&&B.value.offsetParent!==null&&I.value&&R.value&&(fn(I.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`))||on()}))});let n=_n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}oe(async()=>{an(),await Ie(),await en(),vn(),Ne(),window.addEventListener(`focus`,pn),document.addEventListener(`visibilitychange`,pn),hn(),I.value&&o(()=>on())}),i(()=>{_n?.disconnect(),_n=null,window.removeEventListener(`focus`,pn),document.removeEventListener(`visibilitychange`,pn),R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function yn(e=!1){let t=Jt();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){h.error(`${E(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||h.success(E(`@EDITOR:已保存`))}catch(e){h.error(`${E(`@EDITOR:保存失败: `)}${e.message}`)}}function bn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),qe();return}t&&e.key===`s`&&(e.preventDefault(),yn())}oe(()=>window.addEventListener(`keydown`,bn)),i(()=>window.removeEventListener(`keydown`,bn));let B=x(null),V=x(u.ui.editorSidebarWidth),xn=!1,Sn=0,Cn=0;function wn(e){xn=!0,Sn=e.clientX,Cn=V.value,document.addEventListener(`mousemove`,Tn),document.addEventListener(`mouseup`,En),e.preventDefault()}function Tn(e){if(!xn)return;let t=e.clientX-Sn;V.value=Math.max(140,Math.min(400,Cn+t))}function En(){xn=!1,document.removeEventListener(`mousemove`,Tn),document.removeEventListener(`mouseup`,En),V.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(V.value)}function Dn(e){return e.type===`directory`?Te(e.name):we(e.name)}let H=x(null),U=x(null),W=x(null),On=x(null);function kn(){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(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function An(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`file`,value:``},await o(),W.value?.focus()}async function jn(){let e=kn();L.value?.type===`directory`&&!L.value.expanded&&await M(L.value),H.value={...e,kind:`directory`,value:``},await o(),W.value?.focus()}function Mn(){H.value=null}async function Nn(){let e=H.value;if(!e||!e.value.trim()){H.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){h.error(e.error);return}h.success(E(`@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){h.error(e.error);return}h.success(E(`@EDITOR:创建成功`))}H.value=null,await A()}function Pn(e){e.key===`Enter`&&(e.preventDefault(),Nn()),e.key===`Escape`&&(e.preventDefault(),Mn())}let G=x(null),Fn=x(null);function In(e,t){e.preventDefault(),G.value={x:e.clientX,y:e.clientY,node:t}}function K(){G.value=null}async function Ln(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`file`,value:``},await o(),W.value?.focus()}async function Rn(){let e=G.value?.node;K(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await M(e);let t=kn();H.value={...t,kind:`directory`,value:``},await o(),W.value?.focus()}async function zn(){let e=G.value?.node;K(),e&&(U.value={node:e,value:e.name},await o(),On.value?.focus(),On.value?.select())}async function Bn(){let e=U.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){U.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){h.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)),U.value=null,await A()}function Vn(e){e.key===`Enter`&&(e.preventDefault(),Bn()),e.key===`Escape`&&(e.preventDefault(),U.value=null)}async function Hn(){let e=G.value?.node;if(K(),!e)return;let t=e.type===`directory`?E(`@EDITOR:文件夹`):E(`@EDITOR:文件`);if(!confirm(`${E(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){h.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)),h.success(E(`@EDITOR:已删除`)),await A()}async function Un(){let e=G.value?.node;if(K(),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||h.error(t.error)}catch(e){h.error(e?.message||String(e))}}function Wn(e){let t=u.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 Gn(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 Kn(){let e=G.value?.node;K(),e&&(await Gn(e.path)?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function qn(){let e=G.value?.node;K(),e&&(await Gn(Wn(e.path))?h.success(E(`@EDITOR:已复制到剪贴板`)):h.error(E(`@EDITOR:复制失败`)))}async function Jn(){let e=G.value?.node;if(K(),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||h.error(t.error||E(`@EDITOR:VSCode 未安装`))}catch(e){h.error(e?.message||String(e))}}let Yn=new Set([`html`,`htm`]),Xn=t(()=>{let e=G.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Yn.has(t)});async function Zn(){let e=G.value?.node;if(K(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||E(`@EDITOR:浏览器打开失败`))}catch(e){h.error(e?.message||String(e))}}oe(()=>document.addEventListener(`click`,K)),i(()=>document.removeEventListener(`click`,K));let Qn=new Set([`md`,`html`,`htm`,`svg`]),q=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=x(!1),Y=x(!1),X=x(!1),$n=x(!1),er=x(0),Z=t(()=>F.value.find(e=>e.path===I.value)??null),tr=t(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),nr=t(()=>Z.value?.language===`office`),Q=t(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),rr=t(()=>Qn.has(Q.value)||q.has(Q.value)||ke(Q.value)),ir=t(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=t(()=>Q.value===`md`&&ir.value>0);g(I,()=>{J.value&&!rr.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function ar(){rr.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function or(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function sr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,$n.value=!0}let cr=t(()=>{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`?k(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>`:``}),lr=!1,ur=0,dr=0;function fr(e){lr=!0,ur=e.clientX,dr=er.value,document.addEventListener(`mousemove`,pr),document.addEventListener(`mouseup`,mr),e.preventDefault()}function pr(e){if(!lr)return;let t=e.clientX-ur;er.value=Math.max(200,Math.min(900,dr+t))}function mr(){lr=!1,document.removeEventListener(`mousemove`,pr),document.removeEventListener(`mouseup`,mr)}return(t,i)=>(p(),n(w,null,[S(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:B},[S(`div`,{class:`editor-sidebar`,style:y({width:V.value+`px`})},[S(`div`,Xe,[S(`span`,Ze,f(C(E)(`@EDITOR:资源管理器`)),1),S(`div`,Qe,[s(C(ee),{content:C(E)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:An},[...i[11]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:jn},[...i[12]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),s(C(ee),{content:C(E)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ae(()=>[S(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>A({notifyOnError:!0})},[...i[13]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`1 4 1 10 7 10`}),S(`polyline`,{points:`23 20 23 14 17 14`}),S(`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`])])]),S(`div`,$e,[i[15]||=S(`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`},[S(`circle`,{cx:`11`,cy:`11`,r:`7`}),S(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),b(S(`input`,{ref_key:`searchInputRef`,ref:Ke,"onUpdate:modelValue":i[1]||=e=>T.value=e,type:`text`,class:`sidebar-search-input`,placeholder:C(E)(`@EDITOR:搜索文件...`),title:C(E)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ne(Je,[`escape`])},null,40,et),[[ie,T.value]]),T.value?(p(),n(`button`,{key:0,class:`sidebar-search-clear`,title:C(E)(`@EDITOR:清除搜索`),"aria-label":C(E)(`@EDITOR:清除搜索`),onClick:Se},[...i[14]||=[S(`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`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,tt)):r(``,!0)]),de.value?(p(),n(`div`,Ct,[...i[24]||=[S(`span`,{class:`spin-icon`},null,-1)]])):(p(),n(`div`,nt,[(p(!0),n(w,null,te(N(Ue.value),e=>(p(),n(w,{key:e.path},[U.value&&U.value.node.path===e.path?(p(),n(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[16]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,rt)),(p(),n(`svg`,it,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,at)])),b(S(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:On,"onUpdate:modelValue":i[2]||=e=>U.value.value=e,onKeydown:Vn,onBlur:Bn,onClick:i[3]||=ce(()=>{},[`stop`])},null,544),[[ie,U.value.value]])],4)):(p(),n(`div`,{key:1,class:a([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":I.value===e.path,"tree-node--selected":L.value?.path===e.path&&I.value!==e.path}]),style:y({paddingLeft:12+e.depth*14+`px`}),onClick:t=>Kt(e),onContextmenu:t=>In(t,e)},[e.type===`directory`?(p(),n(`span`,{key:0,class:a([`tree-arrow`,{expanded:e.expanded}])},[...i[17]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),n(`span`,st)),e.type===`directory`?(p(),n(`svg`,ct,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,lt)])):(p(),n(`svg`,ut,[S(`use`,{"xlink:href":`#${Dn(e)}`},null,8,dt)])),S(`span`,{class:`tree-name`,title:e.path},[(p(!0),n(w,null,te(Ge(e.name),(e,t)=>(p(),n(w,{key:t},[e.hit?(p(),n(`span`,pt,f(e.text),1)):(p(),n(w,{key:1},[_(f(e.text),1)],64))],64))),128))],8,ft),e.loading?(p(),n(`span`,mt)):r(``,!0)],46,ot)),H.value&&H.value.afterNode?.path===e.path?(p(),n(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:y({paddingLeft:12+H.value.depth*14+`px`})},[i[20]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,ht,[...i[18]||=[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,gt,[...i[19]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[5]||=ce(()=>{},[`stop`])},null,40,_t),[[ie,H.value.value]])],4)):r(``,!0)],64))),128)),H.value&&H.value.afterNode===null?(p(),n(`div`,vt,[i[23]||=S(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),n(`svg`,yt,[...i[21]||=[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(p(),n(`svg`,bt,[...i[22]||=[S(`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),S(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),b(S(`input`,{ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?C(E)(`@EDITOR:输入文件名`):C(E)(`@EDITOR:输入文件夹名`),onKeydown:Pn,onBlur:Mn,onClick:i[7]||=ce(()=>{},[`stop`])},null,40,xt),[[ie,H.value.value]])])):r(``,!0),!H.value&&(We.value||v.value.length===0)?(p(),n(`div`,St,f(We.value?C(E)(`@EDITOR:未找到匹配文件`):C(E)(`@EDITOR:暂无文件`)),1)):r(``,!0)]))],4),S(`div`,{class:`editor-resizer`,onMousedown:wn},null,32),S(`div`,wt,[F.value.length>0?(p(),n(`div`,Tt,[(p(!0),n(w,null,te(F.value,e=>(p(),n(`div`,{key:e.path,class:a([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[S(`span`,Dt,f(e.name),1),e.isDirty?(p(),n(`span`,Ot)):r(``,!0),S(`button`,{class:`tab-close`,onClick:t=>qt(e.path,t)},[...i[25]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,kt)],10,Et))),128)),i[29]||=S(`div`,{class:`editor-tabs-spacer`},null,-1),rr.value?(p(),n(`button`,{key:0,class:a([`preview-toggle-btn`,{active:J.value}]),title:J.value?C(E)(`@EDITOR:关闭预览`):C(E)(`@EDITOR:打开预览`),onClick:ar},[i[26]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),S(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),S(`span`,null,f(C(E)(`@EDITOR:预览`)),1)],10,At)):r(``,!0),$.value?(p(),n(`button`,{key:1,class:a([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:打开思维导图`):C(E)(`@EDITOR:需要至少一个 # 标题`),onClick:or},[i[27]||=e(`<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-c65c2d3f><circle cx="12" cy="12" r="2" data-v-c65c2d3f></circle><circle cx="5" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="6" r="1.6" data-v-c65c2d3f></circle><circle cx="5" cy="18" r="1.6" data-v-c65c2d3f></circle><circle cx="19" cy="18" r="1.6" data-v-c65c2d3f></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-c65c2d3f></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-c65c2d3f></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-c65c2d3f></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-c65c2d3f></line></svg>`,1),S(`span`,null,f(C(E)(`@EDITOR:思维导图`)),1)],10,jt)):r(``,!0),S(`button`,{class:a([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?C(E)(`@EDITOR:关闭 g ai 对话`):C(E)(`@EDITOR:打开 g ai 对话`),onClick:sr},[i[28]||=S(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),S(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),S(`span`,null,f(C(E)(`@EDITOR:g ai 对话`)),1)],10,Mt)])):r(``,!0),F.value.length===0?(p(),d(je,{key:1,class:`editor-empty`,title:C(E)(`@EDITOR:从左侧选择文件打开`),hint:C(E)(`@EDITOR:Ctrl+S 保存`)},{icon:ae(()=>[...i[30]||=[S(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):r(``,!0),S(`div`,Nt,[S(`div`,{class:a([`monaco-container`,{hidden:F.value.length===0||tr.value||nr.value}]),ref_key:`editorContainerRef`,ref:tn},null,2),tr.value&&F.value.length>0&&!J.value&&!Y.value?(p(),n(`div`,Pt,[(p(),n(`svg`,Ft,[...i[31]||=[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),S(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),S(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),S(`p`,It,f(Z.value?.name),1),S(`p`,Lt,f(C(E)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):r(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(p(),n(`div`,{key:1,class:`preview-resizer`,onMousedown:fr},null,32)):r(``,!0),$n.value?b((p(),d(Ye,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:y({flexBasis:er.value+`px`}),onClose:i[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[re,X.value&&F.value.length>0]]):r(``,!0),(J.value||Y.value)&&F.value.length>0?(p(),n(`div`,{key:3,class:`preview-panel`,style:y({flexBasis:er.value+`px`})},[S(`div`,Rt,[S(`span`,zt,f(Y.value?C(E)(`@EDITOR:思维导图`):C(E)(`@EDITOR:预览`)),1),S(`span`,Bt,f(Q.value.toUpperCase()),1),i[33]||=S(`div`,{class:`preview-header-spacer`},null,-1),S(`button`,{class:`preview-close-btn`,title:Y.value?C(E)(`@EDITOR:关闭思维导图`):C(E)(`@EDITOR:关闭预览`),onClick:i[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...i[32]||=[S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[S(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),S(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Vt)]),S(`div`,Ht,[Y.value&&Q.value===`md`&&Z.value?(p(),d(P,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(p(),d(Me,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(p(),n(`iframe`,{key:2,class:`preview-iframe`,sandbox:C(Oe),srcdoc:cr.value},null,8,Ut)):J.value&&C(q).has(Q.value)&&Z.value?(p(),d(Ee,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&nr.value&&Z.value?(p(),d(Ce,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):r(``,!0)])],4)):r(``,!0)])])],512),(p(),d(le,{to:`body`},[G.value?(p(),n(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Fn,class:`ctx-menu`,style:y({left:G.value.x+`px`,top:G.value.y+`px`}),onClick:i[10]||=ce(()=>{},[`stop`])},[S(`button`,{class:`ctx-menu-item`,onClick:Ln},[i[34]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`polyline`,{points:`14 2 14 8 20 8`}),S(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),S(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Rn},[i[35]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),S(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),S(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),_(` `+f(C(E)(`@EDITOR:新建文件夹`)),1)]),i[42]||=S(`div`,{class:`ctx-menu-sep`},null,-1),S(`button`,{class:`ctx-menu-item`,onClick:Kn},[i[36]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),S(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),_(` `+f(C(E)(`@EDITOR:复制绝对路径`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:qn},[i[37]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),S(`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),_(` `+f(C(E)(`@EDITOR:复制相对路径`)),1)]),i[43]||=S(`div`,{class:`ctx-menu-sep`},null,-1),Xn.value?(p(),n(`button`,{key:0,class:`ctx-menu-item`,onClick:Zn},[i[38]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`circle`,{cx:`12`,cy:`12`,r:`9`}),S(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),S(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),_(` `+f(C(E)(`@EDITOR:在浏览器中打开`)),1)])):r(``,!0),S(`button`,{class:`ctx-menu-item`,onClick:Un},[i[39]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`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`}),S(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),_(` `+f(C(E)(`@EDITOR:在资源管理器中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:Jn},[s(pe,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),_(` `+f(C(E)(`@EDITOR:在 VSCode 中打开`)),1)]),S(`button`,{class:`ctx-menu-item`,onClick:zn},[i[40]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),S(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),_(` `+f(C(E)(`@EDITOR:重命名`)),1)]),S(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Hn},[i[41]||=S(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[S(`polyline`,{points:`3 6 5 6 21 6`}),S(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),S(`path`,{d:`M10 11v6`}),S(`path`,{d:`M14 11v6`}),S(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),_(` `+f(C(E)(`@EDITOR:删除`)),1)])],4)):r(``,!0)]))],64))}}),[[`__scopeId`,`data-v-c65c2d3f`]]);export{Kt as default};
|
package/src/ui/public/assets/{FlowExecutionViewer-Bn4uBFZ9.js → FlowExecutionViewer-VL-rUElj.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Dn as t,Hn as n,In as r,Jn as i,Mn as a,Pn as o,Rn as s,Yn as c,dr as l,ir as u,mr as d,or as f,wr as p}from"./element-plus-DrCk0pcV.js";import{n as m,t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{Cn as e,Dn as t,Hn as n,In as r,Jn as i,Mn as a,Pn as o,Rn as s,Yn as c,dr as l,ir as u,mr as d,or as f,wr as p}from"./element-plus-DrCk0pcV.js";import{n as m,t as h}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-De8mr_Fv.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-DJglU68l.js";s(),l();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(o({__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(s){function l(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=o({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>r(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:l(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(t){return o({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(n){let i=e(()=>{let e=n.data?.config,t=[...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 t.includes(`default`)||t.push(`default`),t.length?t:[`default`]});return()=>r(x,{id:n.id,nodeId:n.id,nodeType:n.data?.type,title:n.data?.label,icon:l(n.data?.type),enabled:n.data?.enabled,selected:n.data?.selected,execStatus:n.data?.execStatus,sourceHandleIds:n.data?.type===`condition`?i.value:void 0,deletable:!1},{default:()=>r(t,{data:n.data,id:n.id})})}})}let j={start:d(h),command:d(A(E)),wait:d(A(w)),version:d(A(b)),confirm:d(A(S)),code:d(A(T)),condition:d(A(C)),user_input:d(A(D))},M=s,{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 n(),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;u(()=>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))}),i(()=>{L&&=(window.clearTimeout(L),null)});let R=e(()=>{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=e(()=>{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(),t(`div`,O,[a(p(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:f(()=>[a(p(g)),a(p(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{A as t,At as n,C as r,Cn as i,Dn as a,En as o,Et as s,F as c,G as l,Gr as u,Gt as d,Hn as f,I as ee,In as p,J as m,Jn as te,K as h,M as g,Mn as _,Mr as v,N as y,Pn as b,Pt as x,Qn as S,Rn as C,Rt as w,S as ne,St as re,Tn as T,U as ie,Vt as ae,W as oe,Xn as E,Xr as D,Yn as O,Zn as k,at as se,bt as ce,c as A,ct as le,dr as j,dt as M,i as N,ir as P,jn as F,kt as I,l as L,ln as R,lt as ue,m as z,mr as B,or as V,qn as H,r as de,tn as fe,vn as pe,vr as U,w as me,wn as W,wr as G,x as K,y as he,yn as q,z as ge,zn as _e}from"./element-plus-DrCk0pcV.js";import{b as ve}from"./vendor-yntih_em.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-DO_hkLgw.js";import{t as ye}from"./dagre-DyI0XLXY.js";import{t as be}from"./SvgIcon-CRCQbZ1H.js";import{t as X}from"./configStore-7LTPR6P8.js";import{t as xe}from"./CommonDialog-DiiVswHL.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow-De8mr_Fv.js";import{V as Z,a as Ee}from"./index-Czdu1C9o.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-CibAkKOU.js";var Pe=e(ye(),1);C(),j();var Fe=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,i=t,a=U(!1);function o(e){e===`executeFrom`?i(`execute-from-node`,n.nodeId):e===`executeSingle`&&i(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,i=r,s=me,c=ne;return O(),T(c,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>a.value=e,"popper-class":`flow-node-dropdown`},{dropdown:V(()=>[_(s,null,{default:V(()=>[_(i,{command:`executeFrom`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[1]||=F(` 从此处开始执行 `,-1)]),_:1}),_(i,{command:`executeSingle`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[2]||=F(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:V(()=>[S(e.$slots,`default`,{dropdownVisible:a.value})]),_:3})}}});C(),j(),v();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,s=t,l=U(!1),u=U([]),d=U(``),f=i({get:()=>r.modelValue,set:e=>{d.value=e,s(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);s(`change`,t||null)}}),te=i(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function h(e){l.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){u.value=r.packages||[],f.value&&!u.value.some(e=>e.fullPath===f.value)&&(f.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function g(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?v(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function v(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}y(e)};de.alert(p(`div`,{class:`directory-browser`},[p(`div`,{class:`current-path`},[p(`span`,{class:`path-label`},`当前路径:`),p(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),p(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),p(`div`,{class:`directory-list`},[e.parentPath?p(`div`,{class:`directory-item parent-dir`,onClick:()=>y(e.parentPath)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[p(`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`})])),p(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>p(`div`,{class:`directory-item`,onClick:()=>y(e.path)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[p(`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`})])),p(`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){N.warning(`请输入目录路径`);return}h(n)}}})}async function y(e){try{de.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?v(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return h(),P(()=>r.modelValue,e=>{d.value=e},{immediate:!0}),(t,r)=>{let i=m,s=c,d=ee,p=ge,v=L;return O(),a(`div`,Ie,[W(`div`,Le,[_(d,{modelValue:f.value,"onUpdate:modelValue":r[0]||=e=>f.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:V(()=>[(O(!0),a(q,null,k(te.value,e=>(O(),T(s,{key:e.value,label:e.label,value:e.value},{default:V(()=>[W(`div`,Re,[W(`div`,ze,[_(i,{class:`folder-icon`},{default:V(()=>[_(G(re))]),_:1}),W(`span`,Be,D(e.label),1)]),W(`div`,Ve,D(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),_(p,{icon:l.value?G(n):G(ae),loading:l.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>h(),class:`refresh-btn`,title:`刷新当前项目`},{default:V(()=>[F(D(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),_(p,{icon:G(ce),disabled:e.disabled||l.value,size:`default`,onClick:g,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:V(()=>[...r[2]||=[F(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),a(`div`,$,[_(v,{type:`info`,size:`small`},{default:V(()=>[...r[3]||=[F(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):o(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);C(),v(),j();var Ue={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=Y(b({__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:t}){let n=e,r=t,s=i(()=>Array.isArray(n.modelValue)?n.modelValue:[]);function c(){if(!n.addable||n.disableAdd)return;let e=n.createItem;if(!e)return;let t=[...s.value,e()];r(`update:modelValue`,t),r(`add`)}function l(e){if(!n.removable)return;let t=typeof n.minItems==`number`?n.minItems:0;if(s.value.length<=t)return;let i=s.value[e];if(n.disableRemove&&n.disableRemove(i,e))return;let a=[...s.value];a.splice(e,1),r(`update:modelValue`,a),r(`remove`,e)}function d(e,t){return n.itemKey?n.itemKey(e,t):t}return(t,n)=>{let r=ge;return O(),a(`div`,Ue,[e.title!==void 0||e.addable?(O(),a(`div`,We,[e.title?(O(),a(`span`,Ge,D(e.title),1)):o(``,!0),W(`div`,Ke,[S(t.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),T(r,{key:0,type:`primary`,plain:``,icon:G(w),disabled:e.disableAdd||!e.createItem,onClick:c},null,8,[`icon`,`disabled`])):o(``,!0)])])):o(``,!0),s.value.length===0?(O(),a(`div`,qe,[S(t.$slots,`empty`,{},void 0,!0)])):(O(),a(`div`,Je,[(O(!0),a(q,null,k(s.value,(n,i)=>(O(),a(`div`,{key:d(n,i),class:u([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[W(`div`,Ye,[S(t.$slots,`row`,{item:n,index:i},void 0,!0)]),e.removable?(O(),a(`div`,Xe,[_(r,{type:`danger`,plain:``,icon:G(ue),disabled:typeof e.minItems==`number`&&s.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,i):!1),onClick:e=>l(i)},null,8,[`icon`,`disabled`,`onClick`])])):o(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);C(),j(),v();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=Y(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,s=U([]);P(()=>n.modelValue,e=>{s.value=e?[...e]:[]},{immediate:!0,deep:!0}),P(()=>n.paramNames,e=>{if(!e||e.length===0){s.value=[],r(`update:modelValue`,[]);return}let t=new Map(s.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:``});s.value=n,r(`update:modelValue`,n)},{immediate:!0});function l(e,t,n){if(!s.value[e])return;let i=[...s.value];i[e]={...i[e],[t]:n},t===`inputType`&&(n===`manual`?(i[e].referenceNodeId=void 0,i[e].referenceOutputKey=void 0):i[e].manualValue=void 0),s.value=i,r(`update:modelValue`,i)}function u(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function d(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 f=i(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:u(e),children:d(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,i]=t.split(`::`),a=[...s.value];a[e]={...a[e],referenceNodeId:n,referenceOutputKey:i},s.value=a,r(`update:modelValue`,a)}function te(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,i=c,u=ee,d=m,h=A,g=z;return O(),a(`div`,Qe,[_(Ze,{"model-value":s.value,title:void 0,addable:!1,removable:!1},{empty:V(()=>[F(D(G(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,$e,[W(`div`,et,[W(`label`,tt,D(G(J)(`@NODEINPUT:参数名`)),1),_(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:G(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>l(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,nt,[W(`label`,rt,D(G(J)(`@NODEINPUT:类型`)),1),_(u,{"model-value":t.inputType,placeholder:G(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>l(n,`inputType`,e)},{default:V(()=>[_(i,{value:`manual`,label:G(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),_(i,{value:`reference`,label:G(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,it,[W(`label`,at,D(G(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),T(r,{key:0,"model-value":t.manualValue,placeholder:G(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>l(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),T(h,{key:1,"model-value":te(t),data:f.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:V(({data:e})=>[W(`span`,ot,[e.children?o(``,!0):(O(),T(d,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,st,[W(`label`,ct,D(G(J)(`@NODEINPUT:必填`)),1),_(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>l(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);C(),j(),v();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=Y(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=U([]);P(()=>r.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:l(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=[...s.value,f()];s.value=e,o(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,o(`update:modelValue`,n)}function te(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function h(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,i=c,l=ee,u=A,p=z;return O(),a(`div`,ut,[_(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>o(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@NODECFG:暂无输入参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,dt,[W(`div`,ft,[W(`label`,pt,D(G(J)(`@NODECFG:参数名`)),1),_(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:G(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,mt,[W(`label`,ht,D(G(J)(`@NODECFG:参数值`)),1),_(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:V(()=>[_(i,{label:G(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),_(i,{label:G(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,gt,[W(`label`,_t,D(G(J)(`@NODECFG:值`)),1),t.source===`manual`?(O(),T(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:G(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(u,{key:1,"model-value":h(t),data:d.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>te(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,vt,[W(`label`,yt,D(G(J)(`@NODEINPUT:必填`)),1),_(p,{"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-b16df1ae`]]);C(),j(),v();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=Y(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,s=n,l=U([]);P(()=>r.modelValue,e=>{l.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...l.value,u()];l.value=e,s(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!l.value[e])return;let n=[...l.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`}))),l.value=n,s(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function te(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:te(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 i=ie,p=c,te=ee,y=m,b=A,x=z,S=ge;return O(),a(`div`,xt,[_(Ze,{"model-value":l.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>s(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@UINPUT:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[W(`div`,St,[W(`div`,Ct,[W(`label`,wt,D(G(J)(`@UINPUT:参数名`)),1),_(i,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:G(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,Tt,[W(`label`,Et,D(G(J)(`@UINPUT:类型`)),1),_(te,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:V(()=>[_(p,{label:G(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),_(p,{label:G(J)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,Dt,[W(`label`,Ot,D(e.source===`manual`?G(J)(`@UINPUT:默认值`):G(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),T(i,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:G(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(b,{key:1,"model-value":v(e),data:h.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:V(({data:e})=>[W(`span`,kt,[e.children?o(``,!0):(O(),T(y,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,At,[W(`label`,jt,D(G(J)(`@NODEINPUT:必填`)),1),_(x,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:V(()=>[e.addable===!1?o(``,!0):(O(),T(S,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:V(()=>[F(D(G(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);C(),j(),v();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{A as t,At as n,C as r,Cn as i,Dn as a,En as o,Et as s,F as c,G as l,Gr as u,Gt as d,Hn as f,I as ee,In as p,J as m,Jn as te,K as h,M as g,Mn as _,Mr as v,N as y,Pn as b,Pt as x,Qn as S,Rn as C,Rt as w,S as ne,St as re,Tn as T,U as ie,Vt as ae,W as oe,Xn as E,Xr as D,Yn as O,Zn as k,at as se,bt as ce,c as A,ct as le,dr as j,dt as M,i as N,ir as P,jn as F,kt as I,l as L,ln as R,lt as ue,m as z,mr as B,or as V,qn as H,r as de,tn as fe,vn as pe,vr as U,w as me,wn as W,wr as G,x as K,y as he,yn as q,z as ge,zn as _e}from"./element-plus-DrCk0pcV.js";import{b as ve}from"./vendor-yntih_em.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{t as ye}from"./dagre-DyI0XLXY.js";import{t as be}from"./SvgIcon-B-xDJQA1.js";import{t as X}from"./configStore-CMlW8sMa.js";import{t as xe}from"./CommonDialog-BzLau2RJ.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow-De8mr_Fv.js";import{V as Z,a as Ee}from"./index-BQxIFopZ.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-DJglU68l.js";var Pe=e(ye(),1);C(),j();var Fe=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,i=t,a=U(!1);function o(e){e===`executeFrom`?i(`execute-from-node`,n.nodeId):e===`executeSingle`&&i(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,i=r,s=me,c=ne;return O(),T(c,{trigger:`contextmenu`,onCommand:o,onVisibleChange:t[0]||=e=>a.value=e,"popper-class":`flow-node-dropdown`},{dropdown:V(()=>[_(s,null,{default:V(()=>[_(i,{command:`executeFrom`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[1]||=F(` 从此处开始执行 `,-1)]),_:1}),_(i,{command:`executeSingle`},{default:V(()=>[_(n,null,{default:V(()=>[_(G(fe))]),_:1}),t[2]||=F(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:V(()=>[S(e.$slots,`default`,{dropdownVisible:a.value})]),_:3})}}});C(),j(),v();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,s=t,l=U(!1),u=U([]),d=U(``),f=i({get:()=>r.modelValue,set:e=>{d.value=e,s(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);s(`change`,t||null)}}),te=i(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function h(e){l.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){u.value=r.packages||[],f.value&&!u.value.some(e=>e.fullPath===f.value)&&(f.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function g(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?v(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function v(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}y(e)};de.alert(p(`div`,{class:`directory-browser`},[p(`div`,{class:`current-path`},[p(`span`,{class:`path-label`},`当前路径:`),p(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),p(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),p(`div`,{class:`directory-list`},[e.parentPath?p(`div`,{class:`directory-item parent-dir`,onClick:()=>y(e.parentPath)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[p(`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`})])),p(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>p(`div`,{class:`directory-item`,onClick:()=>y(e.path)},[p(`span`,{class:`dir-icon`},p(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[p(`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`})])),p(`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){N.warning(`请输入目录路径`);return}h(n)}}})}async function y(e){try{de.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?v(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return h(),P(()=>r.modelValue,e=>{d.value=e},{immediate:!0}),(t,r)=>{let i=m,s=c,d=ee,p=ge,v=L;return O(),a(`div`,Ie,[W(`div`,Le,[_(d,{modelValue:f.value,"onUpdate:modelValue":r[0]||=e=>f.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:V(()=>[(O(!0),a(q,null,k(te.value,e=>(O(),T(s,{key:e.value,label:e.label,value:e.value},{default:V(()=>[W(`div`,Re,[W(`div`,ze,[_(i,{class:`folder-icon`},{default:V(()=>[_(G(re))]),_:1}),W(`span`,Be,D(e.label),1)]),W(`div`,Ve,D(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),_(p,{icon:l.value?G(n):G(ae),loading:l.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>h(),class:`refresh-btn`,title:`刷新当前项目`},{default:V(()=>[F(D(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),_(p,{icon:G(ce),disabled:e.disabled||l.value,size:`default`,onClick:g,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:V(()=>[...r[2]||=[F(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),a(`div`,$,[_(v,{type:`info`,size:`small`},{default:V(()=>[...r[3]||=[F(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):o(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);C(),v(),j();var Ue={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=Y(b({__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:t}){let n=e,r=t,s=i(()=>Array.isArray(n.modelValue)?n.modelValue:[]);function c(){if(!n.addable||n.disableAdd)return;let e=n.createItem;if(!e)return;let t=[...s.value,e()];r(`update:modelValue`,t),r(`add`)}function l(e){if(!n.removable)return;let t=typeof n.minItems==`number`?n.minItems:0;if(s.value.length<=t)return;let i=s.value[e];if(n.disableRemove&&n.disableRemove(i,e))return;let a=[...s.value];a.splice(e,1),r(`update:modelValue`,a),r(`remove`,e)}function d(e,t){return n.itemKey?n.itemKey(e,t):t}return(t,n)=>{let r=ge;return O(),a(`div`,Ue,[e.title!==void 0||e.addable?(O(),a(`div`,We,[e.title?(O(),a(`span`,Ge,D(e.title),1)):o(``,!0),W(`div`,Ke,[S(t.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),T(r,{key:0,type:`primary`,plain:``,icon:G(w),disabled:e.disableAdd||!e.createItem,onClick:c},null,8,[`icon`,`disabled`])):o(``,!0)])])):o(``,!0),s.value.length===0?(O(),a(`div`,qe,[S(t.$slots,`empty`,{},void 0,!0)])):(O(),a(`div`,Je,[(O(!0),a(q,null,k(s.value,(n,i)=>(O(),a(`div`,{key:d(n,i),class:u([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[W(`div`,Ye,[S(t.$slots,`row`,{item:n,index:i},void 0,!0)]),e.removable?(O(),a(`div`,Xe,[_(r,{type:`danger`,plain:``,icon:G(ue),disabled:typeof e.minItems==`number`&&s.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,i):!1),onClick:e=>l(i)},null,8,[`icon`,`disabled`,`onClick`])])):o(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);C(),j(),v();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=Y(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,s=U([]);P(()=>n.modelValue,e=>{s.value=e?[...e]:[]},{immediate:!0,deep:!0}),P(()=>n.paramNames,e=>{if(!e||e.length===0){s.value=[],r(`update:modelValue`,[]);return}let t=new Map(s.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:``});s.value=n,r(`update:modelValue`,n)},{immediate:!0});function l(e,t,n){if(!s.value[e])return;let i=[...s.value];i[e]={...i[e],[t]:n},t===`inputType`&&(n===`manual`?(i[e].referenceNodeId=void 0,i[e].referenceOutputKey=void 0):i[e].manualValue=void 0),s.value=i,r(`update:modelValue`,i)}function u(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function d(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 f=i(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:u(e),children:d(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,i]=t.split(`::`),a=[...s.value];a[e]={...a[e],referenceNodeId:n,referenceOutputKey:i},s.value=a,r(`update:modelValue`,a)}function te(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,i=c,u=ee,d=m,h=A,g=z;return O(),a(`div`,Qe,[_(Ze,{"model-value":s.value,title:void 0,addable:!1,removable:!1},{empty:V(()=>[F(D(G(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,$e,[W(`div`,et,[W(`label`,tt,D(G(J)(`@NODEINPUT:参数名`)),1),_(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:G(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>l(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,nt,[W(`label`,rt,D(G(J)(`@NODEINPUT:类型`)),1),_(u,{"model-value":t.inputType,placeholder:G(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>l(n,`inputType`,e)},{default:V(()=>[_(i,{value:`manual`,label:G(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),_(i,{value:`reference`,label:G(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),W(`div`,it,[W(`label`,at,D(G(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),T(r,{key:0,"model-value":t.manualValue,placeholder:G(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>l(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),T(h,{key:1,"model-value":te(t),data:f.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:V(({data:e})=>[W(`span`,ot,[e.children?o(``,!0):(O(),T(d,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,st,[W(`label`,ct,D(G(J)(`@NODEINPUT:必填`)),1),_(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>l(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);C(),j(),v();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=Y(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,o=n,s=U([]);P(()=>r.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:l(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=[...s.value,f()];s.value=e,o(`update:modelValue`,e)}t({addRow:p});function m(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,o(`update:modelValue`,n)}function te(e,t){if(!t)return;let[n,r]=t.split(`::`);m(e,{ref:{nodeId:n,outputKey:r}})}function h(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,i=c,l=ee,u=A,p=z;return O(),a(`div`,ut,[_(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":f,"onUpdate:modelValue":n[0]||=e=>o(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@NODECFG:暂无输入参数`)),1)]),row:V(({item:t,index:n})=>[W(`div`,dt,[W(`div`,ft,[W(`label`,pt,D(G(J)(`@NODECFG:参数名`)),1),_(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>m(n,{name:e})],placeholder:G(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,mt,[W(`label`,ht,D(G(J)(`@NODECFG:参数值`)),1),_(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>m(n,{source:e})],style:{width:`110px`}},{default:V(()=>[_(i,{label:G(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),_(i,{label:G(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,gt,[W(`label`,_t,D(G(J)(`@NODECFG:值`)),1),t.source===`manual`?(O(),T(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>m(n,{manualValue:e})],placeholder:G(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(u,{key:1,"model-value":h(t),data:d.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>te(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,vt,[W(`label`,yt,D(G(J)(`@NODEINPUT:必填`)),1),_(p,{"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-b16df1ae`]]);C(),j(),v();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=Y(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,s=n,l=U([]);P(()=>r.modelValue,e=>{l.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function u(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function d(){let e=[...l.value,u()];l.value=e,s(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!l.value[e])return;let n=[...l.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`}))),l.value=n,s(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function te(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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=i(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:te(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 i=ie,p=c,te=ee,y=m,b=A,x=z,S=ge;return O(),a(`div`,xt,[_(Ze,{"model-value":l.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":u,"onUpdate:modelValue":n[0]||=e=>s(`update:modelValue`,e)},{empty:V(()=>[F(D(G(J)(`@UINPUT:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[W(`div`,St,[W(`div`,Ct,[W(`label`,wt,D(G(J)(`@UINPUT:参数名`)),1),_(i,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>f(t,{name:e})],placeholder:G(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),W(`div`,Tt,[W(`label`,Et,D(G(J)(`@UINPUT:类型`)),1),_(te,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>f(t,{source:e})],style:{width:`130px`}},{default:V(()=>[_(p,{label:G(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),_(p,{label:G(J)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),W(`div`,Dt,[W(`label`,Ot,D(e.source===`manual`?G(J)(`@UINPUT:默认值`):G(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),T(i,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>f(t,{defaultValue:e})],placeholder:G(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),T(b,{key:1,"model-value":v(e),data:h.value,placeholder:G(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:V(({data:e})=>[W(`span`,kt,[e.children?o(``,!0):(O(),T(y,{key:0},{default:V(()=>[_(G(I))]),_:1})),F(` `+D(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),W(`div`,At,[W(`label`,jt,D(G(J)(`@NODEINPUT:必填`)),1),_(x,{"model-value":!!e.required,"onUpdate:modelValue":e=>f(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:V(()=>[e.addable===!1?o(``,!0):(O(),T(S,{key:0,type:`primary`,plain:``,size:`small`,onClick:d},{default:V(()=>[F(D(G(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);C(),j(),v();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,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,D as t,Dn as n,En as r,F as i,Gn as a,Gr as o,Hn as s,I as c,J as l,L as u,Mn as d,Mr as f,Pn as p,Rn as m,Tn as h,U as ee,Ut as te,W as ne,Xr as g,Yn as _,Zn as v,_n as y,a as re,ct as ie,dr as ae,f as oe,gn as se,i as b,ir as x,jn as S,ln as C,or as w,p as ce,pt as le,qn as ue,qr as de,r as fe,sr as pe,vn as T,vr as E,vt as me,wn as D,wr as O,wt as he,yn as k,z as A}from"./element-plus-DrCk0pcV.js";import{n as j,t as M}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,D as t,Dn as n,En as r,F as i,Gn as a,Gr as o,Hn as s,I as c,J as l,L as u,Mn as d,Mr as f,Pn as p,Rn as m,Tn as h,U as ee,Ut as te,W as ne,Xr as g,Yn as _,Zn as v,_n as y,a as re,ct as ie,dr as ae,f as oe,gn as se,i as b,ir as x,jn as S,ln as C,or as w,p as ce,pt as le,qn as ue,qr as de,r as fe,sr as pe,vn as T,vr as E,vt as me,wn as D,wr as O,wt as he,yn as k,z as A}from"./element-plus-DrCk0pcV.js";import{n as j,t as M}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{t as ge}from"./CommonDialog-BzLau2RJ.js";import{B as _e,D as ve,L as ye,V as be,z as xe}from"./index-BQxIFopZ.js";var N=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function P(e){return 10+e*14}function F(e){return N[e%N.length]}function I(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 Se(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 I(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 Ce(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:F(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],ee=F(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:ee,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:ee,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:ee,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:F(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let te=t.slice();i=Math.max(i,t.length);let ne=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<te.length&&te[e]!==null&&te[e].hash===t.hash&&ne.push({lane:e,color:F(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:ee,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:ne,topCurves:p,bottomEdges:h,branches:[]})}let c=Se(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}}m(),ae(),f();var we={class:`graph-wrap`},Te=[`viewBox`],Ee=[`x1`,`x2`,`stroke`],De=[`x1`,`x2`],L=[`d`,`stroke`],Oe=[`d`],ke=[`x1`,`x2`,`stroke`],R=[`d`,`stroke`],z=[`d`],B={class:`graph-layer graph-nodes`,"aria-hidden":`true`},V=[`cx`,`stroke`],H=[`cx`,`fill`],U=[`cx`,`stroke`],W=[`cx`],G=-1,Ae=M(p({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(t){let i=t,a=e(()=>P(i.layout.commitLane)),o=j(`@A1833:暂不属于任何分支`);function s(e){return e.length>0?e.join(`, `):o}let c=e(()=>`${i.layout.hash.slice(0,7)} · ${s(i.layout.branches)}`),l=e(()=>i.layout.passes.map(e=>({x:P(e.lane),color:e.color,title:s(e.branches)}))),u=e(()=>i.layout.topCurves.map(e=>{let t=P(e.fromLane),n=a.value;return{d:`M ${t} ${G} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:s(e.branches)}})),d=e(()=>i.layout.bottomEdges.map(e=>{let t=a.value,n=P(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(e,i)=>(_(),n(`div`,we,[(_(),n(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${t.width} ${O(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(_(!0),n(k,null,v(l.value,(e,t)=>(_(),n(`line`,{key:`p`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[D(`title`,null,g(e.title),1)],8,Ee))),128)),(_(!0),n(k,null,v(l.value,(e,t)=>(_(),n(`line`,{key:`ph`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[D(`title`,null,g(e.title),1)],8,De))),128)),(_(!0),n(k,null,v(u.value,(e,t)=>(_(),n(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,g(e.title),1)],8,L))),128)),(_(!0),n(k,null,v(u.value,(e,t)=>(_(),n(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,g(e.title),1)],8,Oe))),128)),t.layout.hasTopLine?(_(),n(`line`,{key:0,x1:a.value,y1:G,x2:a.value,y2:15,stroke:t.layout.color,"stroke-width":`2`},[D(`title`,null,g(s(t.layout.branches)),1)],8,ke)):r(``,!0),(_(!0),n(k,null,v(d.value,(e,t)=>(_(),n(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,g(e.title),1)],8,R))),128)),(_(!0),n(k,null,v(d.value,(e,t)=>(_(),n(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,g(e.title),1)],8,z))),128))],8,Te)),(_(),n(`svg`,B,[D(`g`,null,[D(`title`,null,g(c.value),1),t.layout.isMerge?(_(),n(`circle`,{key:0,cx:a.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:t.layout.color,"stroke-width":`2`},null,8,V)):(_(),n(`circle`,{key:1,cx:a.value,cy:`50%`,r:`4`,fill:t.layout.color},null,8,H)),t.layout.isHead?(_(),n(`circle`,{key:2,cx:a.value,cy:`50%`,r:`7`,fill:`none`,stroke:t.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,U)):r(``,!0),D(`circle`,{cx:a.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,W)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);m(),ae(),f(),C();var je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,xt=M(p({__name:`LogList`,setup(f,{expose:p}){let m=_e(),ae=xe(),C=E([]),M=E(``),N=E(!1),P=e(()=>m.isLoadingLog||N.value),F=E(!1),I=E(localStorage.getItem(bt)!==`false`);x(I,e=>{localStorage.setItem(bt,String(e))});let we=e(()=>I.value&&C.value.length>0?Ce(C.value):null),Te=e(()=>{let e=new Map;if(we.value)for(let t of we.value.rows)e.set(t.hash,t);return e}),Ee=e(()=>Math.max(we.value?.width??0,28)),De=e(()=>Se(C.value)),L=E(!1),Oe=E(null),ke=E(!1),R=E(null),z=E([]),B=E(``),V=E(!1),H=E(``),U=E(`full-new`),W=E(``),G=E(``),xt=e(()=>R.value?De.value.get(R.value.hash)??[]:[]),K=E(!1),St=e(()=>R.value?.message?R.value.message.split(`
|
|
2
2
|
`)[0].trim():``),Ct=e(()=>R.value?.message?R.value.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim():``),wt=e(()=>Ct.value.length>0),Tt=e(()=>Ct.value.replace(/\n/g,`<br>`)),q=E(!1),Et=E([]),Dt=E(``),J=E(null),Ot=E([]),kt=E([]),At=E([]),jt=E(!1),Mt=E(0),Nt=E(0),Y=E(null),Pt=E(null),Ft=e(()=>C.value),It=e(()=>z.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function X(e=!1,t=1){let n=_e();if(!n.isGitRepo){M.value=`当前目录不是Git仓库`;return}try{t>1?L.value=!0:N.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),Et.value.length>0&&r.append(`author`,Et.value.join(`,`)),kt.value.length>0&&r.append(`branch`,kt.value.join(`,`)),Dt.value&&r.append(`message`,Dt.value),J.value&&Array.isArray(J.value)&&J.value.length===2&&(r.append(`dateFrom`,J.value[0]),r.append(`dateTo`,J.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)){M.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?C.value=C.value.concat(i.data):Array.isArray(i.data)&&(C.value=i.data),n.currentPage=t,n.totalCommits=i.total??C.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&s(()=>{Ut(),setTimeout(Sn,200)}),M.value=``}catch(e){M.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?L.value=!1:N.value=!1}}function Lt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function Rt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function zt(e){return e?e.length>60||e.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,Ct as t,Dn as n,En as r,Gn as i,Gr as a,J as o,L as s,Mn as c,Mr as l,Pn as u,Rn as d,Rt as f,Tn as p,Vt as m,W as h,Xr as g,Y as _,Yn as v,Zn as y,a as b,dr as x,gn as S,ht as C,i as w,ir as T,jn as E,ln as D,lt as ee,or as O,pt as te,qn as k,qr as ne,r as A,sr as j,vn as M,vr as N,wn as P,wr as F,xn as re,xt as ie,yn as I,z as ae}from"./element-plus-DrCk0pcV.js";import{C as oe,S as L,m as se}from"./vendor-yntih_em.js";import{n as R,t as z}from"./_plugin-vue_export-helper-DO_hkLgw.js";import{r as ce,t as B}from"./configStore-7LTPR6P8.js";import{n as le,t as ue}from"./flow-mindmap-Cx5RNYN9.js";import{i as V,x as de}from"./index-Czdu1C9o.js";x(),d();function H(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function U(e){return H(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function W(e,t){let n=U(e),r=U(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function G(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var fe=L(`mindmap`,()=>{let t=B(),n=N([]),r=N([]),i=N(null),a=N(!1),o=N(!1),s=N(null),c=N(``),l=N(``),u=e(()=>i.value!==null),d=e(()=>r.value.reduce((e,t)=>e+t.files.length,0)),f=e(()=>r.value.some(e=>e.loading));function p(){t.ui.mindmapDirs=[...n.value]}function m(e){return r.value.find(t=>U(t.dir)===U(e))}function h(e){let t=m(e);if(t)return t;let n={dir:e,files:[],error:null,loading:!1};return r.value.push(n),n}function g(e){let t=H(e);return!t||n.value.some(e=>U(e)===U(t))?!1:(n.value.push(t),h(t),!0)}let _=new Map;async function v(e){let t=m(e);if(!t)return;let r=U(t.dir),i=(_.get(r)||0)+1;_.set(r,i),t.loading=!0,t.error=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(t.dir)}`)).json();if(_.get(r)!==i)return;if(e.success){let r=typeof e.dir==`string`&&e.dir?e.dir:t.dir;if(r!==t.dir){let e=n.value.findIndex(e=>U(e)===U(t.dir));e>=0&&(n.value[e]=r),t.dir=r,p()}t.files=e.files||[]}else t.error=e.error||`读取目录失败`,t.files=[]}catch(e){if(_.get(r)!==i)return;t.error=e?.message||String(e),t.files=[]}finally{_.get(r)===i&&(t.loading=!1)}}async function y(){await Promise.all(n.value.map(e=>v(e)))}async function b(){let e=Array.isArray(t.ui.mindmapDirs)?t.ui.mindmapDirs:[];for(let t of e)g(t);c.value&&!n.value.some(e=>U(e)===U(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=H(n);e&&g(e)&&t.push(e)}return t.length===0?0:(p(),c.value||=t[0],await Promise.all(t.map(e=>v(e))),t.length)}function S(e){let t=U(e);n.value=n.value.filter(e=>U(e)!==t),r.value=r.value.filter(e=>U(e.dir)!==t),_.delete(t),c.value&&U(c.value)===t&&(c.value=``),p()}function C(){if(n.value.length===0)return{dir:null,ambiguous:!1};let e=n.value.find(e=>U(e)===U(c.value));if(e)return{dir:e,ambiguous:!1};let t=i.value?.path;if(t){let e=n.value.find(e=>W(t,e));if(e)return{dir:e,ambiguous:!1}}return n.value.length===1?{dir:n.value[0],ambiguous:!1}:{dir:null,ambiguous:!0}}async function w(e,t=!1){if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();if(t.success){i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1;let e=n.value.find(e=>W(t.path,e));c.value=e||G(t.path)}else s.value=t.error||`读取文件失败`}catch(e){s.value=e?.message||String(e)}finally{o.value=!1}}async function T(e,t=!1,n){let r=n?H(n):C().dir;if(!r)throw Error(`未选择目录`);if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:r,name:e})})).json();if(t.success)i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1,c.value=r,await v(r);else throw s.value=t.error||`新建失败`,Error(t.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(s.value=e?.message||String(e)),e}finally{o.value=!1}}async function E(e){if(!i.value)throw Error(`没有打开的文件`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i.value.path,content:e})})).json();if(t.success){let n=i.value.path;return i.value&&(i.value.content=e,i.value.mtime=t.mtime),l.value=e,a.value=!1,await D(n),t}throw s.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw s.value=e?.message||String(e),e}finally{o.value=!1}}async function D(e){let t=r.value.find(t=>W(e,t.dir));t&&await v(t.dir)}async function ee(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 i.value&&i.value.path===e&&(i.value=null,a.value=!1,l.value=``),await D(e),t}async function O(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 i.value&&e===i.value.path&&(i.value={...i.value,path:n.path,title:t}),await D(n.path||e),n}function te(){i.value&&(a.value=!0)}function k(){i.value=null,a.value=!1,l.value=``}return{dirs:n,groups:r,current:i,dirty:a,loading:o,refreshing:f,error:s,activeDir:c,hasCurrent:u,filesCount:d,init:b,addDirs:x,removeDir:S,refresh:y,refreshDir:v,resolveTargetDir:C,openFile:w,createFile:T,saveCurrent:E,deleteFile:ee,renameFile:O,markDirty:te,closeCurrent:k}});d(),x(),l(),D();var pe={class:`mindmap-view`},me={class:`mm-toolbar`},he={class:`mm-toolbar-left`},ge={class:`mm-dir-tooltip`},_e={key:1,class:`mm-dir-empty`},ve={class:`mm-toolbar-right`},ye={key:0,class:`mm-status`},be=[`title`],xe={key:0,class:`mm-status-dirty`},Se={class:`mm-body`},Ce={class:`mm-sidebar`},we={class:`mm-sidebar-header`},Te={class:`mm-sidebar-title`},Ee={class:`mm-sidebar-list`},De={key:0,class:`mm-sidebar-error`},Oe=[`title`,`onClick`,`onContextmenu`],ke={class:`mm-group-info`},Ae={class:`mm-group-name`},je={class:`mm-group-title`},Me={class:`mm-group-count`},Ne={class:`mm-group-path`},Pe={class:`mm-group-body`},Fe=[`title`],Ie=[`onClick`],Le={class:`mm-file-info`},Re=[`title`],ze={class:`mm-file-meta`},Be={class:`mm-editor`},Ve=1500,K=z(u({__name:`MindmapView`,setup(l){let u=fe(),d=B(),{currentLocale:x}=oe(ce()),D=e(()=>{let e=d.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),L=N(null),z=N(!1);function H(){z.value=!0}async function U(e){z.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await u.addDirs(t);e>0?w.success(R(`@MINDMAP:已添加目录`,{n:e})):w.info(R(`@MINDMAP:重复目录已忽略`))}catch(e){w.error(e?.message||R(`@MINDMAP:读取目录失败`))}}let G=N({});function K(e){G.value={...G.value,[e]:!G.value[e]},u.activeDir=e}function He(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Ue(e){return!!u.activeDir&&u.activeDir.toLowerCase()===e.toLowerCase()}function q(){let{dir:e,ambiguous:t}=u.resolveTargetDir();return e||(w.warning(R(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function We(e){let t=e||q();if(!t||(e&&(u.activeDir=e),!await Ke()))return;let n=``;try{n=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:新建思维导图`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputPlaceholder:R(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(n,!0,t),w.success(R(`@MINDMAP:已新建并打开`))}catch(e){w.error(e?.message||R(`@MINDMAP:新建失败`))}}async function J(e=!1){if(u.current)try{let t=L.value?.exportData();if(!t){e||w.warning(R(`@MINDMAP:无法获取数据`));return}await u.saveCurrent(t),e||w.success(R(`@MINDMAP:已保存`))}catch(e){w.error(e?.message||R(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){u.current&&u.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,u.current&&u.dirty&&J(!0)},Ve))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!u.dirty||!u.current)return!0;try{await A.confirm(R(`@MINDMAP:未保存提示`,{title:u.current.title}),R(`@MINDMAP:未保存的改动`),{confirmButtonText:R(`@MINDMAP:保存`),cancelButtonText:R(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=L.value?.exportData();return e&&(await u.saveCurrent(e),w.success(R(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(u.current&&u.current.path===e)&&await Ke())try{await u.openFile(e,!0)}catch(e){w.error(e?.message||R(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!u.current&&W(u.current.path,e),n=R(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${R(`@MINDMAP:当前文件将保持打开`)}`);try{await A.confirm(n,R(`@MINDMAP:移除目录`),{confirmButtonText:R(`@MINDMAP:移除目录`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}u.removeDir(e),w.success(R(`@MINDMAP:已移除目录`))}let Z=N(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await de(e);t.success?w.success(t.message||R(`@MINDMAP:已在文件管理器中打开`)):w.error(t.error||R(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&We(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await A.confirm(R(`@MINDMAP:确认删除提示`,{title:e.title}),R(`@MINDMAP:删除`),{confirmButtonText:R(`@MINDMAP:删除`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await u.deleteFile(e.path),w.success(R(`@MINDMAP:已删除`))}catch(e){w.error(e?.message||R(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await A.prompt(R(`@MINDMAP:输入新名称提示`),R(`@MINDMAP:重命名`),{confirmButtonText:R(`@MINDMAP:确定`),cancelButtonText:R(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.renameFile(e.path,t),w.success(R(`@MINDMAP:已重命名`))}catch(e){w.error(e?.message||R(`@MINDMAP:重命名失败`))}}function tt(e){u.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||q();if(!t)return;let n=``,r=``;try{n=(await A.prompt(R(`@MINDMAP:粘贴Markdown提示`),R(`@MINDMAP:从Markdown导入`),{confirmButtonText:R(`@MINDMAP:导入`),cancelButtonText:R(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:R(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:文件名`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(r,!0,t);let e=ue(n,r),i=JSON.stringify(e,null,2);await u.saveCurrent(i),w.success(R(`@MINDMAP:已导入`))}catch(e){w.error(e?.message||R(`@MINDMAP:导入失败`))}}async function it(){if(L.value)try{let e=L.value.getMarkdown();await navigator.clipboard.writeText(e),w.success(R(`@MINDMAP:已复制Markdown`))}catch(e){w.error(e?.message||R(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),u.current&&u.dirty&&(X(),J()))}let ot=N(0);T(()=>u.current?.path,()=>{ot.value++});let $=N(!1);function st(){$.value=!$.value}let ct=e(()=>{let e=u.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});k(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await u.init()}),i(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?R(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${R(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${R(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(e,i)=>{let l=ae,d=s,w=h,T=o,k=b;return v(),n(`div`,pe,[P(`div`,me,[P(`div`,he,[c(l,{size:`small`,icon:F(t),onClick:H},{default:O(()=>[E(g(F(R)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),F(u).dirs.length>0?(v(),p(w,{key:0,placement:`bottom-start`,"show-after":200},{content:O(()=>[P(`div`,ge,[(v(!0),n(I,null,y(F(u).dirs,e=>(v(),n(`div`,{key:e},g(e),1))),128))])]),default:O(()=>[c(d,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:O(()=>[E(g(F(R)(`@MINDMAP:个目录`,{n:F(u).dirs.length})),1)]),_:1})]),_:1})):(v(),n(`span`,_e,g(F(R)(`@MINDMAP:请先添加目录`)),1))]),P(`div`,ve,[c(l,{size:`small`,icon:F(f),disabled:F(u).dirs.length===0,onClick:i[0]||=e=>We()},{default:O(()=>[E(g(F(R)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(te),disabled:F(u).dirs.length===0,onClick:i[1]||=e=>rt()},{default:O(()=>[E(g(F(R)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(C),disabled:!F(u).current,onClick:it},{default:O(()=>[E(g(F(R)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,type:`primary`,icon:F(ie),disabled:!F(u).current||!F(u).dirty,loading:F(u).loading,onClick:i[2]||=()=>{X(),J()}},{default:O(()=>[E(g(F(R)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),F(u).current?(v(),n(`span`,ye,[P(`span`,{class:`mm-status-title`,title:F(u).current.title},g(F(u).current.title),9,be),F(u).dirty?(v(),n(`span`,xe,`●`)):r(``,!0)])):r(``,!0)])]),P(`div`,Se,[P(`div`,Ce,[P(`div`,we,[P(`span`,Te,g(F(R)(`@MINDMAP:文件列表`)),1),c(l,{size:`small`,text:``,icon:F(m),loading:F(u).refreshing,onClick:i[3]||=e=>F(u).refresh(),disabled:F(u).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),j((v(),n(`div`,Ee,[F(u).error?(v(),n(`div`,De,g(F(u).error),1)):r(``,!0),F(u).dirs.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(F(u).groups,e=>(v(),n(`div`,{key:e.dir,class:`mm-group`},[P(`div`,{class:a([`mm-group-header`,{active:Ue(e.dir)}]),title:e.dir,onClick:t=>K(e.dir),onContextmenu:t=>Ye(t,e.dir)},[c(T,{class:a([`mm-group-caret`,{collapsed:G.value[e.dir]}])},{default:O(()=>[c(F(_))]),_:1},8,[`class`]),P(`div`,ke,[P(`div`,Ae,[P(`span`,je,g(He(e.dir)),1),P(`span`,Me,g(e.files.length),1)]),P(`div`,Ne,g(e.dir),1)])],42,Oe),j(P(`div`,Pe,[e.error?(v(),n(`div`,{key:0,class:`mm-group-error`,title:e.error},[P(`span`,null,g(F(R)(`@MINDMAP:目录不存在或已删除`)),1),c(l,{size:`small`,text:``,type:`danger`,onClick:t=>Je(e.dir)},{default:O(()=>[E(g(F(R)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Fe)):e.files.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(e.files,e=>(v(),n(`div`,{key:e.path,class:a([`mm-file-item`,{active:F(u).current?.path===e.path}]),onClick:t=>qe(e.path)},[P(`div`,Le,[P(`div`,{class:`mm-file-title`,title:e.title},g(e.title),9,Re),P(`div`,ze,g(lt(e.mtime))+` · `+g(ut(e.size)),1)]),P(`div`,{class:`mm-file-actions`,onClick:i[4]||=M(()=>{},[`stop`])},[c(l,{size:`small`,text:``,icon:F(C),onClick:t=>et(e),title:F(R)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),c(l,{size:`small`,text:``,type:`danger`,icon:F(ee),onClick:t=>$e(e),title:F(R)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Ie))),128))],512),[[S,!G.value[e.dir]]])]))),128))])),[[k,F(u).refreshing]])]),P(`div`,Be,[F(u).current?(v(),p(F(le),{key:ot.value,ref_key:`mmRef`,ref:L,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(v(),p(V,{key:0,class:`mm-editor-empty`,title:F(R)(`@MINDMAP:思维导图编辑器`),hint:F(u).dirs.length>0?F(R)(`@MINDMAP:从左侧选择或新建`):F(R)(`@MINDMAP:先选择目录提示`)},{icon:O(()=>[...i[7]||=[P(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`circle`,{cx:`12`,cy:`12`,r:`2`}),P(`circle`,{cx:`5`,cy:`5`,r:`2`}),P(`circle`,{cx:`19`,cy:`5`,r:`2`}),P(`circle`,{cx:`5`,cy:`19`,r:`2`}),P(`circle`,{cx:`19`,cy:`19`,r:`2`}),P(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),P(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),P(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),P(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),c(F(se),{visible:z.value,mode:`directory`,multiple:!0,theme:D.value?`dark`:`light`,locale:F(x),"default-path":F(u).activeDir||F(u).dirs[0]||``,onClose:i[5]||=e=>z.value=!1,onConfirm:U},null,8,[`visible`,`theme`,`locale`,`default-path`]),(v(),p(re,{to:`body`},[Z.value?(v(),n(`div`,{key:0,class:`ctx-menu`,style:ne({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:i[6]||=M(()=>{},[`stop`])},[P(`button`,{class:`ctx-menu-item`,onClick:Xe},[i[8]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`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`}),P(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),E(` `+g(F(R)(`@MINDMAP:打开目录`)),1)]),P(`button`,{class:`ctx-menu-item`,onClick:Ze},[i[9]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`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`}),P(`polyline`,{points:`14 2 14 8 20 8`}),P(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),P(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),E(` `+g(F(R)(`@MINDMAP:在此新建`)),1)]),i[11]||=P(`div`,{class:`ctx-menu-sep`},null,-1),P(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[i[10]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`polyline`,{points:`3 6 5 6 21 6`}),P(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),P(`path`,{d:`M10 11v6`}),P(`path`,{d:`M14 11v6`}),P(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),E(` `+g(F(R)(`@MINDMAP:移除目录`)),1)])],4)):r(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{K as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Cn as e,Ct as t,Dn as n,En as r,Gn as i,Gr as a,J as o,L as s,Mn as c,Mr as l,Pn as u,Rn as d,Rt as f,Tn as p,Vt as m,W as h,Xr as g,Y as _,Yn as v,Zn as y,a as b,dr as x,gn as S,ht as C,i as w,ir as T,jn as E,ln as D,lt as ee,or as O,pt as te,qn as k,qr as ne,r as A,sr as j,vn as M,vr as N,wn as P,wr as F,xn as re,xt as ie,yn as I,z as ae}from"./element-plus-DrCk0pcV.js";import{C as oe,S as L,m as se}from"./vendor-yntih_em.js";import{n as R,t as z}from"./_plugin-vue_export-helper-Dz1ARW9a.js";import{r as ce,t as B}from"./configStore-CMlW8sMa.js";import{n as le,t as ue}from"./flow-mindmap-Cx5RNYN9.js";import{i as V,x as de}from"./index-BQxIFopZ.js";x(),d();function H(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function U(e){return H(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function W(e,t){let n=U(e),r=U(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function G(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var fe=L(`mindmap`,()=>{let t=B(),n=N([]),r=N([]),i=N(null),a=N(!1),o=N(!1),s=N(null),c=N(``),l=N(``),u=e(()=>i.value!==null),d=e(()=>r.value.reduce((e,t)=>e+t.files.length,0)),f=e(()=>r.value.some(e=>e.loading));function p(){t.ui.mindmapDirs=[...n.value]}function m(e){return r.value.find(t=>U(t.dir)===U(e))}function h(e){let t=m(e);if(t)return t;let n={dir:e,files:[],error:null,loading:!1};return r.value.push(n),n}function g(e){let t=H(e);return!t||n.value.some(e=>U(e)===U(t))?!1:(n.value.push(t),h(t),!0)}let _=new Map;async function v(e){let t=m(e);if(!t)return;let r=U(t.dir),i=(_.get(r)||0)+1;_.set(r,i),t.loading=!0,t.error=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(t.dir)}`)).json();if(_.get(r)!==i)return;if(e.success){let r=typeof e.dir==`string`&&e.dir?e.dir:t.dir;if(r!==t.dir){let e=n.value.findIndex(e=>U(e)===U(t.dir));e>=0&&(n.value[e]=r),t.dir=r,p()}t.files=e.files||[]}else t.error=e.error||`读取目录失败`,t.files=[]}catch(e){if(_.get(r)!==i)return;t.error=e?.message||String(e),t.files=[]}finally{_.get(r)===i&&(t.loading=!1)}}async function y(){await Promise.all(n.value.map(e=>v(e)))}async function b(){let e=Array.isArray(t.ui.mindmapDirs)?t.ui.mindmapDirs:[];for(let t of e)g(t);c.value&&!n.value.some(e=>U(e)===U(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=H(n);e&&g(e)&&t.push(e)}return t.length===0?0:(p(),c.value||=t[0],await Promise.all(t.map(e=>v(e))),t.length)}function S(e){let t=U(e);n.value=n.value.filter(e=>U(e)!==t),r.value=r.value.filter(e=>U(e.dir)!==t),_.delete(t),c.value&&U(c.value)===t&&(c.value=``),p()}function C(){if(n.value.length===0)return{dir:null,ambiguous:!1};let e=n.value.find(e=>U(e)===U(c.value));if(e)return{dir:e,ambiguous:!1};let t=i.value?.path;if(t){let e=n.value.find(e=>W(t,e));if(e)return{dir:e,ambiguous:!1}}return n.value.length===1?{dir:n.value[0],ambiguous:!1}:{dir:null,ambiguous:!0}}async function w(e,t=!1){if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();if(t.success){i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1;let e=n.value.find(e=>W(t.path,e));c.value=e||G(t.path)}else s.value=t.error||`读取文件失败`}catch(e){s.value=e?.message||String(e)}finally{o.value=!1}}async function T(e,t=!1,n){let r=n?H(n):C().dir;if(!r)throw Error(`未选择目录`);if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:r,name:e})})).json();if(t.success)i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1,c.value=r,await v(r);else throw s.value=t.error||`新建失败`,Error(t.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(s.value=e?.message||String(e)),e}finally{o.value=!1}}async function E(e){if(!i.value)throw Error(`没有打开的文件`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i.value.path,content:e})})).json();if(t.success){let n=i.value.path;return i.value&&(i.value.content=e,i.value.mtime=t.mtime),l.value=e,a.value=!1,await D(n),t}throw s.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw s.value=e?.message||String(e),e}finally{o.value=!1}}async function D(e){let t=r.value.find(t=>W(e,t.dir));t&&await v(t.dir)}async function ee(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 i.value&&i.value.path===e&&(i.value=null,a.value=!1,l.value=``),await D(e),t}async function O(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 i.value&&e===i.value.path&&(i.value={...i.value,path:n.path,title:t}),await D(n.path||e),n}function te(){i.value&&(a.value=!0)}function k(){i.value=null,a.value=!1,l.value=``}return{dirs:n,groups:r,current:i,dirty:a,loading:o,refreshing:f,error:s,activeDir:c,hasCurrent:u,filesCount:d,init:b,addDirs:x,removeDir:S,refresh:y,refreshDir:v,resolveTargetDir:C,openFile:w,createFile:T,saveCurrent:E,deleteFile:ee,renameFile:O,markDirty:te,closeCurrent:k}});d(),x(),l(),D();var pe={class:`mindmap-view`},me={class:`mm-toolbar`},he={class:`mm-toolbar-left`},ge={class:`mm-dir-tooltip`},_e={key:1,class:`mm-dir-empty`},ve={class:`mm-toolbar-right`},ye={key:0,class:`mm-status`},be=[`title`],xe={key:0,class:`mm-status-dirty`},Se={class:`mm-body`},Ce={class:`mm-sidebar`},we={class:`mm-sidebar-header`},Te={class:`mm-sidebar-title`},Ee={class:`mm-sidebar-list`},De={key:0,class:`mm-sidebar-error`},Oe=[`title`,`onClick`,`onContextmenu`],ke={class:`mm-group-info`},Ae={class:`mm-group-name`},je={class:`mm-group-title`},Me={class:`mm-group-count`},Ne={class:`mm-group-path`},Pe={class:`mm-group-body`},Fe=[`title`],Ie=[`onClick`],Le={class:`mm-file-info`},Re=[`title`],ze={class:`mm-file-meta`},Be={class:`mm-editor`},Ve=1500,K=z(u({__name:`MindmapView`,setup(l){let u=fe(),d=B(),{currentLocale:x}=oe(ce()),D=e(()=>{let e=d.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),L=N(null),z=N(!1);function H(){z.value=!0}async function U(e){z.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await u.addDirs(t);e>0?w.success(R(`@MINDMAP:已添加目录`,{n:e})):w.info(R(`@MINDMAP:重复目录已忽略`))}catch(e){w.error(e?.message||R(`@MINDMAP:读取目录失败`))}}let G=N({});function K(e){G.value={...G.value,[e]:!G.value[e]},u.activeDir=e}function He(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Ue(e){return!!u.activeDir&&u.activeDir.toLowerCase()===e.toLowerCase()}function q(){let{dir:e,ambiguous:t}=u.resolveTargetDir();return e||(w.warning(R(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function We(e){let t=e||q();if(!t||(e&&(u.activeDir=e),!await Ke()))return;let n=``;try{n=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:新建思维导图`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputPlaceholder:R(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(n,!0,t),w.success(R(`@MINDMAP:已新建并打开`))}catch(e){w.error(e?.message||R(`@MINDMAP:新建失败`))}}async function J(e=!1){if(u.current)try{let t=L.value?.exportData();if(!t){e||w.warning(R(`@MINDMAP:无法获取数据`));return}await u.saveCurrent(t),e||w.success(R(`@MINDMAP:已保存`))}catch(e){w.error(e?.message||R(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){u.current&&u.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,u.current&&u.dirty&&J(!0)},Ve))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!u.dirty||!u.current)return!0;try{await A.confirm(R(`@MINDMAP:未保存提示`,{title:u.current.title}),R(`@MINDMAP:未保存的改动`),{confirmButtonText:R(`@MINDMAP:保存`),cancelButtonText:R(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=L.value?.exportData();return e&&(await u.saveCurrent(e),w.success(R(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(u.current&&u.current.path===e)&&await Ke())try{await u.openFile(e,!0)}catch(e){w.error(e?.message||R(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!u.current&&W(u.current.path,e),n=R(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${R(`@MINDMAP:当前文件将保持打开`)}`);try{await A.confirm(n,R(`@MINDMAP:移除目录`),{confirmButtonText:R(`@MINDMAP:移除目录`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}u.removeDir(e),w.success(R(`@MINDMAP:已移除目录`))}let Z=N(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await de(e);t.success?w.success(t.message||R(`@MINDMAP:已在文件管理器中打开`)):w.error(t.error||R(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&We(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await A.confirm(R(`@MINDMAP:确认删除提示`,{title:e.title}),R(`@MINDMAP:删除`),{confirmButtonText:R(`@MINDMAP:删除`),cancelButtonText:R(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await u.deleteFile(e.path),w.success(R(`@MINDMAP:已删除`))}catch(e){w.error(e?.message||R(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await A.prompt(R(`@MINDMAP:输入新名称提示`),R(`@MINDMAP:重命名`),{confirmButtonText:R(`@MINDMAP:确定`),cancelButtonText:R(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.renameFile(e.path,t),w.success(R(`@MINDMAP:已重命名`))}catch(e){w.error(e?.message||R(`@MINDMAP:重命名失败`))}}function tt(e){u.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||q();if(!t)return;let n=``,r=``;try{n=(await A.prompt(R(`@MINDMAP:粘贴Markdown提示`),R(`@MINDMAP:从Markdown导入`),{confirmButtonText:R(`@MINDMAP:导入`),cancelButtonText:R(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:R(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await A.prompt(R(`@MINDMAP:输入文件名提示`),R(`@MINDMAP:文件名`),{confirmButtonText:R(`@MINDMAP:新建`),cancelButtonText:R(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?R(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||R(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await u.createFile(r,!0,t);let e=ue(n,r),i=JSON.stringify(e,null,2);await u.saveCurrent(i),w.success(R(`@MINDMAP:已导入`))}catch(e){w.error(e?.message||R(`@MINDMAP:导入失败`))}}async function it(){if(L.value)try{let e=L.value.getMarkdown();await navigator.clipboard.writeText(e),w.success(R(`@MINDMAP:已复制Markdown`))}catch(e){w.error(e?.message||R(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),u.current&&u.dirty&&(X(),J()))}let ot=N(0);T(()=>u.current?.path,()=>{ot.value++});let $=N(!1);function st(){$.value=!$.value}let ct=e(()=>{let e=u.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});k(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await u.init()}),i(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?R(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${R(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${R(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(e,i)=>{let l=ae,d=s,w=h,T=o,k=b;return v(),n(`div`,pe,[P(`div`,me,[P(`div`,he,[c(l,{size:`small`,icon:F(t),onClick:H},{default:O(()=>[E(g(F(R)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),F(u).dirs.length>0?(v(),p(w,{key:0,placement:`bottom-start`,"show-after":200},{content:O(()=>[P(`div`,ge,[(v(!0),n(I,null,y(F(u).dirs,e=>(v(),n(`div`,{key:e},g(e),1))),128))])]),default:O(()=>[c(d,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:O(()=>[E(g(F(R)(`@MINDMAP:个目录`,{n:F(u).dirs.length})),1)]),_:1})]),_:1})):(v(),n(`span`,_e,g(F(R)(`@MINDMAP:请先添加目录`)),1))]),P(`div`,ve,[c(l,{size:`small`,icon:F(f),disabled:F(u).dirs.length===0,onClick:i[0]||=e=>We()},{default:O(()=>[E(g(F(R)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(te),disabled:F(u).dirs.length===0,onClick:i[1]||=e=>rt()},{default:O(()=>[E(g(F(R)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,icon:F(C),disabled:!F(u).current,onClick:it},{default:O(()=>[E(g(F(R)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),c(l,{size:`small`,type:`primary`,icon:F(ie),disabled:!F(u).current||!F(u).dirty,loading:F(u).loading,onClick:i[2]||=()=>{X(),J()}},{default:O(()=>[E(g(F(R)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),F(u).current?(v(),n(`span`,ye,[P(`span`,{class:`mm-status-title`,title:F(u).current.title},g(F(u).current.title),9,be),F(u).dirty?(v(),n(`span`,xe,`●`)):r(``,!0)])):r(``,!0)])]),P(`div`,Se,[P(`div`,Ce,[P(`div`,we,[P(`span`,Te,g(F(R)(`@MINDMAP:文件列表`)),1),c(l,{size:`small`,text:``,icon:F(m),loading:F(u).refreshing,onClick:i[3]||=e=>F(u).refresh(),disabled:F(u).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),j((v(),n(`div`,Ee,[F(u).error?(v(),n(`div`,De,g(F(u).error),1)):r(``,!0),F(u).dirs.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(F(u).groups,e=>(v(),n(`div`,{key:e.dir,class:`mm-group`},[P(`div`,{class:a([`mm-group-header`,{active:Ue(e.dir)}]),title:e.dir,onClick:t=>K(e.dir),onContextmenu:t=>Ye(t,e.dir)},[c(T,{class:a([`mm-group-caret`,{collapsed:G.value[e.dir]}])},{default:O(()=>[c(F(_))]),_:1},8,[`class`]),P(`div`,ke,[P(`div`,Ae,[P(`span`,je,g(He(e.dir)),1),P(`span`,Me,g(e.files.length),1)]),P(`div`,Ne,g(e.dir),1)])],42,Oe),j(P(`div`,Pe,[e.error?(v(),n(`div`,{key:0,class:`mm-group-error`,title:e.error},[P(`span`,null,g(F(R)(`@MINDMAP:目录不存在或已删除`)),1),c(l,{size:`small`,text:``,type:`danger`,onClick:t=>Je(e.dir)},{default:O(()=>[E(g(F(R)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Fe)):e.files.length===0?(v(),p(V,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:F(R)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(v(!0),n(I,{key:2},y(e.files,e=>(v(),n(`div`,{key:e.path,class:a([`mm-file-item`,{active:F(u).current?.path===e.path}]),onClick:t=>qe(e.path)},[P(`div`,Le,[P(`div`,{class:`mm-file-title`,title:e.title},g(e.title),9,Re),P(`div`,ze,g(lt(e.mtime))+` · `+g(ut(e.size)),1)]),P(`div`,{class:`mm-file-actions`,onClick:i[4]||=M(()=>{},[`stop`])},[c(l,{size:`small`,text:``,icon:F(C),onClick:t=>et(e),title:F(R)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),c(l,{size:`small`,text:``,type:`danger`,icon:F(ee),onClick:t=>$e(e),title:F(R)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Ie))),128))],512),[[S,!G.value[e.dir]]])]))),128))])),[[k,F(u).refreshing]])]),P(`div`,Be,[F(u).current?(v(),p(F(le),{key:ot.value,ref_key:`mmRef`,ref:L,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(v(),p(V,{key:0,class:`mm-editor-empty`,title:F(R)(`@MINDMAP:思维导图编辑器`),hint:F(u).dirs.length>0?F(R)(`@MINDMAP:从左侧选择或新建`):F(R)(`@MINDMAP:先选择目录提示`)},{icon:O(()=>[...i[7]||=[P(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`circle`,{cx:`12`,cy:`12`,r:`2`}),P(`circle`,{cx:`5`,cy:`5`,r:`2`}),P(`circle`,{cx:`19`,cy:`5`,r:`2`}),P(`circle`,{cx:`5`,cy:`19`,r:`2`}),P(`circle`,{cx:`19`,cy:`19`,r:`2`}),P(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),P(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),P(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),P(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),c(F(se),{visible:z.value,mode:`directory`,multiple:!0,theme:D.value?`dark`:`light`,locale:F(x),"default-path":F(u).activeDir||F(u).dirs[0]||``,onClose:i[5]||=e=>z.value=!1,onConfirm:U},null,8,[`visible`,`theme`,`locale`,`default-path`]),(v(),p(re,{to:`body`},[Z.value?(v(),n(`div`,{key:0,class:`ctx-menu`,style:ne({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:i[6]||=M(()=>{},[`stop`])},[P(`button`,{class:`ctx-menu-item`,onClick:Xe},[i[8]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`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`}),P(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),E(` `+g(F(R)(`@MINDMAP:打开目录`)),1)]),P(`button`,{class:`ctx-menu-item`,onClick:Ze},[i[9]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`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`}),P(`polyline`,{points:`14 2 14 8 20 8`}),P(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),P(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),E(` `+g(F(R)(`@MINDMAP:在此新建`)),1)]),i[11]||=P(`div`,{class:`ctx-menu-sep`},null,-1),P(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[i[10]||=P(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[P(`polyline`,{points:`3 6 5 6 21 6`}),P(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),P(`path`,{d:`M10 11v6`}),P(`path`,{d:`M14 11v6`}),P(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),E(` `+g(F(R)(`@MINDMAP:移除目录`)),1)])],4)):r(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{K as default};
|