zen-gitsync 2.17.31 → 2.17.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/package.json +10 -1
- package/scripts/release.js +66 -29
- package/src/ui/public/assets/{AgentEngineSelector-bQmJlH1b.js → AgentEngineSelector-CGrUh2kD.js} +1 -1
- package/src/ui/public/assets/{AgentView-DpNj6VFj.js → AgentView-BRC3kn-3.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-2etZBF2E.js → AppVersionBadge-BR_ZX6Oq.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-BvbMlZW6.js → BranchSelector-C77-aizC.js} +1 -1
- package/src/ui/public/assets/{CommitForm-C-cL8_vz.css → CommitForm-BbgIoF4h.css} +1 -1
- package/src/ui/public/assets/CommitForm-C6qTIW0T.js +6 -0
- package/src/ui/public/assets/{CommonDialog-UrQUmb6G.js → CommonDialog-kDck8ITZ.js} +1 -1
- package/src/ui/public/assets/{EditorView-DIu2cIai.js → EditorView-DNZXnJnc.js} +1 -1
- package/src/ui/public/assets/{FileDiffViewer-BlDGBxKd.js → FileDiffViewer-BxFkqvIA.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-MPq4Fh6G.js → FlowExecutionViewer-DDkb05TW.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-ByBJ4B3G.js → FlowOrchestrationWorkspace-BiHGQE0o.js} +1 -1
- package/src/ui/public/assets/{IconButton-BvbRjQ_D.js → IconButton-BflzboUD.js} +1 -1
- package/src/ui/public/assets/{LogList-Xs52JPC1.js → LogList-DHfr-rPz.js} +1 -1
- package/src/ui/public/assets/{MindmapView-Br7Fj7Ga.js → MindmapView-7u02tj5n.js} +1 -1
- package/src/ui/public/assets/{MonitorView-DSV5_Q-6.js → MonitorView-cdUkh4VE.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-BCS2YQdX.js → ProjectStartupButton-B9KAavAO.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-Dv47YPKL.js → RecentDirectoriesChat-DQ9phSSJ.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-CIHTYzr7.js → RemoteManagerDialog-CgnM1ndZ.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-DCYTEmuq.js → RemoteRepoCard-BDAvJcFk.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-BANSmwrh.js → SourceMapView-BEAC-dHC.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-b50XyCO5.js → SvgIcon-B-2iTLW-.js} +1 -1
- package/src/ui/public/assets/{TemplateManager-D5-gC33Z.js → TemplateManager-CYy3G7rH.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-BFmTQYZP.js → UserInputNode-DIX4shBD.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-BAko4SjJ.js +20 -0
- package/src/ui/public/assets/WorkbenchView-DWQChnqF.css +1 -0
- package/src/ui/public/assets/{_plugin-vue_export-helper-MIPci_U9.js → _plugin-vue_export-helper-D8rwCQpe.js} +6 -6
- package/src/ui/public/assets/{agentConversations-D8mdZaNY.js → agentConversations-C0WoSH0y.js} +1 -1
- package/src/ui/public/assets/{configStore-BMixvVAA.js → configStore-BFGSfIBp.js} +1 -1
- package/src/ui/public/assets/{gitStore-DriJnutC.js → gitStore-BcrFZogC.js} +1 -1
- package/src/ui/public/assets/index-BCTkDpQv.css +1 -0
- package/src/ui/public/assets/{index-CEEQaAF4.js → index-aNSr4k87.js} +10 -10
- package/src/ui/public/assets/{previewSandbox-D86LH88s.js → previewSandbox-C_ZzCEpS.js} +1 -1
- package/src/ui/public/assets/{toolsStore-B1Lx5gWu.js → toolsStore-B3LQrSEp.js} +1 -1
- package/src/ui/public/index.html +12 -12
- package/src/ui/server/routes/workbench/index.js +182 -18
- package/src/ui/server/routes/workbench/jobActivity.js +18 -6
- package/src/ui/server/routes/workbench/liveJobs.js +7 -1
- package/src/ui/server/routes/workbench/llmClient.js +37 -6
- package/src/ui/server/routes/workbench/progressReport.js +141 -50
- package/src/ui/server/routes/workbench/progressReport.test.js +101 -4
- package/src/ui/server/routes/workbench/projectRegistry.js +58 -2
- package/src/ui/server/routes/workbench/projectRegistry.test.js +51 -0
- package/src/ui/server/routes/workbench/stallWatchdog.js +330 -0
- package/src/ui/server/routes/workbench/stallWatchdog.test.js +356 -0
- package/src/ui/server/utils/directoryGitState.js +41 -1
- package/src/ui/server/utils/directoryGitState.test.js +91 -0
- package/src/utils/desktopNotify.js +199 -41
- package/src/utils/desktopNotify.test.js +84 -29
- package/src/ui/public/assets/CommitForm-Bp41Q0Oo.js +0 -6
- package/src/ui/public/assets/WorkbenchView-Dc7bMMfe.css +0 -1
- package/src/ui/public/assets/WorkbenchView-DsPII7uQ.js +0 -20
- package/src/ui/public/assets/index-BrIl1iaG.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as de}from"./SvgIcon-b50XyCO5.js";import{t as fe}from"./configStore-BMixvVAA.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-D86LH88s.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-CEEQaAF4.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-D8mdZaNY.js";import{n as Re,t as j}from"./AgentEngineSelector-bQmJlH1b.js";function M(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<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-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`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`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={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)`}},mt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={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)`}},vt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={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`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(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 Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(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=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(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:Ie(n.items,0)}catch{return null}}function Re(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)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(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 He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.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 Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(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,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.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(ye(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){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.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),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(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=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.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}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.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`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(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 dn(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 fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.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 pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(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`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();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){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){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 jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.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)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){let e=K.value?.node;if(q(),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||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(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 Kn(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 qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){let e=K.value?.node;if(q(),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||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){let e=K.value?.node;if(q(),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||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{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`?_e(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>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`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),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`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),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as de}from"./SvgIcon-B-2iTLW-.js";import{t as fe}from"./configStore-BFGSfIBp.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-C_ZzCEpS.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-aNSr4k87.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-C0WoSH0y.js";import{n as Re,t as j}from"./AgentEngineSelector-CGrUh2kD.js";function M(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<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-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`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`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={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)`}},mt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={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)`}},vt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={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`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(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 Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(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=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(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:Ie(n.items,0)}catch{return null}}function Re(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)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(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 He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.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 Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(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,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.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(ye(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){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.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),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(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=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.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}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.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`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(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 dn(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 fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.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 pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(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`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();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){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){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 jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.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)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){let e=K.value?.node;if(q(),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||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(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 Kn(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 qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){let e=K.value?.node;if(q(),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||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){let e=K.value?.node;if(q(),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||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{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`?_e(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>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`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),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`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),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-DF5LNTW7.js","assets/rolldown-runtime-C0FnF6B9.js","assets/dagre-Dfa6RS7s.js","assets/monaco-B2lPvkrc.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,H as c,Ht as l,In as u,J as d,Mn as f,Mt as p,Nn as m,On as h,Pn as g,Pr as _,Q as v,Qr as y,Tn as b,U as ee,W as x,Wt as S,Y as C,Yn as w,Yr as T,Zn as E,a as D,an as te,br as O,c as ne,cr as k,ct as re,dn as A,er as ie,ft as ae,in as oe,jt as j,kn as M,lr as N,nr as P,nt as se,o as ce,or as F,ot as I,pr as L,pt as le,qn as ue,qr as de,s as fe,tn as R,tr as pe,vn as me,wt as z,x as B,xn as he,z as V}from"./element-plus-CgEuJBlB.js";import{n as H,t as U}from"./_plugin-vue_export-helper-
|
|
2
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,H as c,Ht as l,In as u,J as d,Mn as f,Mt as p,Nn as m,On as h,Pn as g,Pr as _,Q as v,Qr as y,Tn as b,U as ee,W as x,Wt as S,Y as C,Yn as w,Yr as T,Zn as E,a as D,an as te,br as O,c as ne,cr as k,ct as re,dn as A,er as ie,ft as ae,in as oe,jt as j,kn as M,lr as N,nr as P,nt as se,o as ce,or as F,ot as I,pr as L,pt as le,qn as ue,qr as de,s as fe,tn as R,tr as pe,vn as me,wt as z,x as B,xn as he,z as V}from"./element-plus-CgEuJBlB.js";import{n as H,t as U}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{ir as W}from"./dagre-Dfa6RS7s.js";import{t as ge}from"./SvgIcon-B-2iTLW-.js";import{t as _e}from"./IconButton-BflzboUD.js";import{t as ve}from"./configStore-BFGSfIBp.js";import{r as ye}from"./gitStore-BcrFZogC.js";import{r as G,t as be}from"./fileIcon-B5p5pGN9.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De,t as Oe}from"./previewSandbox-C_ZzCEpS.js";import{a as K,c as ke,i as Ae,o as je,s as Me}from"./monaco-DF5LNTW7.js";import{t as Ne}from"./useThemeObserver-DAyxqy9l.js";import{t as q}from"./CommonDialog-kDck8ITZ.js";n();var Pe=[`width`,`height`],Fe=u({__name:`TreeIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(E(),M(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`},[...n[0]||=[f(`<line x1="3" y1="2" x2="3" y2="14"></line><line x1="3" y1="4" x2="6" y2="4"></line><rect x="2" y="3" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="8" x2="6" y2="8"></line><rect x="4" y="7" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="12" x2="6" y2="12"></line><rect x="6" y="11" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect>`,7)]],8,Pe))}});n();var Ie=[`width`,`height`],Le=u({__name:`ListIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(E(),M(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`currentColor`,stroke:`none`},[...n[0]||=[a(`rect`,{x:`2`,y:`3`,width:`12`,height:`2`,rx:`0.5`},null,-1),a(`rect`,{x:`2`,y:`7`,width:`12`,height:`2`,rx:`0.5`},null,-1),a(`rect`,{x:`2`,y:`11`,width:`12`,height:`2`,rx:`0.5`},null,-1)]],8,Ie))}});function Re(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ze(e){if(!e)return``;let t=e.split(`
|
|
3
3
|
`),n=!1,r=null;return t.map(e=>{let t=Re(e);return e.startsWith(`diff --git`)||e.startsWith(`diff --cc`)||e.startsWith(`diff --combined`)?`<div class="diff-header">${t}</div>`:e.startsWith(`---`)?`<div class="diff-old-file">${t}</div>`:e.startsWith(`+++`)?`<div class="diff-new-file">${t}</div>`:e.startsWith(`@@`)?`<div class="diff-hunk-header">${t}</div>`:e.match(/^[+\-\s]*<{7,}\s+(HEAD|.*)/)?(n=!0,r=`current`,`<div class="diff-conflict-start">${t}</div>`):e.match(/^[+\-\s]*={7,}\s*$/)?(r=`incoming`,`<div class="diff-conflict-separator">${t}</div>`):e.match(/^[+\-\s]*>{7,}\s+.*/)?(n=!1,r=null,`<div class="diff-conflict-end">${t}</div>`):n&&r?r===`current`?`<div class="diff-conflict-current">${t}</div>`:`<div class="diff-conflict-incoming">${t}</div>`:e.startsWith(`+`)?`<div class="diff-added">${` `+t.substring(1)}</div>`:e.startsWith(`-`)?`<div class="diff-removed">${` `+t.substring(1)}</div>`:`<div class="diff-context">${t}</div>`}).join(``)}function Be(e){if(!e)return``;let t=e.match(/^(feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert)(\([^)]+\))?\s*:\s*(.+)$/s);return t?t[3].trim():e.trim()}n(),L(),_();var Ve={class:`file-action-buttons`},He={key:1,style:{"font-size":`var(--font-size-md)`,"font-weight":`bold`}},Ue=U(u({__name:`FileActionButtons`,props:{filePath:{},fileType:{},isLocked:{type:Boolean,default:!1},isLocking:{type:Boolean,default:!1},showLockButton:{type:Boolean,default:!0}},emits:[`toggleLock`,`stage`,`unstage`,`revert`,`manageLockedFiles`],setup(t,{emit:n}){let r=t,s=n,c=b(()=>{switch(r.fileType){case`added`:return[{type:`unstage`,tooltip:H(`@0883F:取消暂存`),buttonType:`warning`,icon:`-`,handler:()=>s(`unstage`,r.filePath)}];case`modified`:case`deleted`:return[{type:`stage`,tooltip:H(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>s(`stage`,r.filePath)},{type:`revert`,tooltip:H(`@0883F:撤回修改`),buttonType:`danger`,icon:S,handler:()=>s(`revert`,r.filePath)}];case`untracked`:return[{type:`stage`,tooltip:H(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>s(`stage`,r.filePath)},{type:`delete`,tooltip:H(`@0883F:删除文件`),buttonType:`danger`,icon:I,handler:()=>s(`revert`,r.filePath)}];default:return[]}});function l(e){e.stopPropagation(),s(`toggleLock`,r.filePath)}function u(e,t){t.stopPropagation(),e()}function f(e){e.stopPropagation(),s(`manageLockedFiles`)}return(n,r)=>{let s=d,p=V,m=x;return E(),M(`div`,Ve,[t.showLockButton?(E(),i(m,{key:0,content:t.isLocking?o(H)(`@0883F:处理中...`):t.isLocked?o(H)(`@0883F:解锁文件`):o(H)(`@0883F:锁定文件`),placement:`top`,disabled:t.isLocking,"show-after":200},{default:k(()=>[g(p,{type:t.isLocked?`danger`:`info`,size:`small`,text:``,loading:t.isLocking,disabled:t.isLocking,onClick:l,class:`file-action-btn`},{default:k(()=>[t.isLocking?h(``,!0):(E(),i(s,{key:0,size:`16`},{default:k(()=>[(E(),i(P(t.isLocked?o(j):o(R))))]),_:1}))]),_:1},8,[`type`,`loading`,`disabled`])]),_:1},8,[`content`,`disabled`])):h(``,!0),t.isLocked?(E(),i(m,{key:1,content:o(H)(`@13D1C:管理锁定文件`),placement:`top`,"show-after":200},{default:k(()=>[g(p,{type:`warning`,size:`small`,text:``,onClick:f,class:`file-action-btn`},{default:k(()=>[g(s,{size:`16`},{default:k(()=>[...r[0]||=[a(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[a(`path`,{fill:`currentColor`,d:`M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296L315.2 220.096c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z`})],-1)]]),_:1})]),_:1})]),_:1},8,[`content`])):h(``,!0),(E(!0),M(he,null,e(c.value,e=>(E(),i(m,{key:e.type,content:e.tooltip,placement:`top`,"show-after":200},{default:k(()=>[g(p,{type:e.buttonType,size:`small`,text:``,onClick:t=>u(e.handler,t),class:`file-action-btn`},{default:k(()=>[typeof e.icon==`string`?(E(),M(`span`,He,y(e.icon),1)):(E(),i(s,{key:0,size:`16`},{default:k(()=>[(E(),i(P(e.icon)))]),_:2},1024))]),_:2},1032,[`type`,`onClick`])]),_:2},1032,[`content`]))),128))])}}}),[[`__scopeId`,`data-v-e552faf2`]]);function We(e){let t=[],n=new Map;return[...e].sort((e,t)=>e.path.localeCompare(t.path)).forEach(e=>{let r=e.path.split(`/`).filter(e=>e),i=``,a=t;r.forEach((t,o)=>{let s=o===r.length-1;i=i?`${i}/${t}`:t;let c=n.get(i);c||(c={name:t,path:i,isDirectory:!s,expanded:!0},s?(c.file=e,c.type=e.type,c.locked=e.locked):c.children=[],n.set(i,c),a.push(c)),!s&&c.children&&(a=c.children)})}),t}function Ge(e){e.expanded=!e.expanded}function Ke(e,t){let n=new Map,r=e=>{e.forEach(e=>{e.isDirectory&&(n.set(e.path,e.expanded||!1),e.children&&r(e.children))})},i=e=>{e.forEach(e=>{if(e.isDirectory){let t=n.get(e.path);t!==void 0&&(e.expanded=t),e.children&&i(e.children)}})};r(t),i(e)}n(),_(),L();var qe={class:`tree-node-wrapper`},J=[`xlink:href`],Y={class:`node-name`},X={key:0,class:`file-type-tag`},Je={key:2,class:`file-actions`},Ye={key:0,class:`tree-children`},Z=U(u({__name:`TreeNodeItem`,props:{node:{},level:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`,`node-click`],setup(t,{emit:n}){let r=t,s=n;function c(e){return`${e*20+10}px`}function l(e){return G(e.name,e.isDirectory,!!e.expanded)}function u(e){return!e.isDirectory&&e.path===r.selectedFile}function f(){s(`node-click`,r.node)}return(n,r)=>{let p=pe(`TreeNodeItem`,!0);return E(),M(`div`,qe,[a(`div`,{class:de([`tree-node`,{"is-directory":t.node.isDirectory,"is-file":!t.node.isDirectory,"is-selected":u(t.node),"is-locked":t.node.locked,[`file-type-${t.node.type}`]:t.node.type}]),style:T({paddingLeft:c(t.level)}),onClick:f},[(E(),M(`svg`,{class:de([`node-icon mit-icon`,{"folder-icon":l(t.node).key.startsWith(`folder-`)}]),"aria-hidden":`true`},[a(`use`,{"xlink:href":`#${l(t.node).spriteId}`},null,8,J)],2)),g(o(x),{content:t.node.path,placement:`top`,disabled:t.node.name.length<=35,"show-after":200},{default:k(()=>[a(`span`,Y,y(t.node.name),1)]),_:1},8,[`content`,`disabled`]),t.node.isDirectory?h(``,!0):(E(),M(`span`,X,y(t.node.type||`modified`),1)),t.node.locked?(E(),i(o(x),{key:1,content:o(H)(`@E80AC:该文件已被锁定,提交时会被跳过`),placement:`top`,"show-after":200},{default:k(()=>[g(o(d),{class:`lock-icon`,color:`var(--color-warning)`},{default:k(()=>[g(o(j))]),_:1})]),_:1},8,[`content`])):h(``,!0),t.showActionButtons&&!t.node.isDirectory&&t.node.file?(E(),M(`div`,Je,[g(Ue,{"file-path":t.node.path,"file-type":t.node.type||`modified`,"is-locked":t.isFileLocked(t.node.path),"is-locking":t.isLocking(t.node.path),onToggleLock:r[0]||=e=>s(`toggle-lock`,e),onStage:r[1]||=e=>s(`stage`,e),onUnstage:r[2]||=e=>s(`unstage`,e),onRevert:r[3]||=e=>s(`revert`,e)},null,8,[`file-path`,`file-type`,`is-locked`,`is-locking`])])):h(``,!0)],6),t.node.isDirectory&&t.node.expanded&&t.node.children&&t.node.children.length>0?(E(),M(`div`,Ye,[(E(!0),M(he,null,e(t.node.children,e=>(E(),i(p,{key:e.path+`-`+(e.expanded?`open`:`closed`),node:e,level:t.level+1,"selected-file":t.selectedFile,"show-action-buttons":t.showActionButtons,"is-file-locked":t.isFileLocked,"is-locking":t.isLocking,onFileSelect:r[4]||=e=>s(`file-select`,e),onToggleLock:r[5]||=e=>s(`toggle-lock`,e),onStage:r[6]||=e=>s(`stage`,e),onUnstage:r[7]||=e=>s(`unstage`,e),onRevert:r[8]||=e=>s(`revert`,e),onNodeClick:r[9]||=e=>s(`node-click`,e)},null,8,[`node`,`level`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))])):h(``,!0)])}}}),[[`__scopeId`,`data-v-ec49f691`]]);n(),L();var Xe={class:`file-tree-view`},Ze=U(u({__name:`FileTreeView`,props:{treeData:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(t,{emit:n}){let r=n,a=O(0);function o(e){e.isDirectory?(Ge(e),a.value++):e.file&&r(`file-select`,e.path)}return(n,a)=>(E(),M(`div`,Xe,[(E(!0),M(he,null,e(t.treeData,e=>(E(),i(Z,{key:e.path+`-`+(e.expanded?`open`:`closed`),node:e,level:0,"selected-file":t.selectedFile,"show-action-buttons":t.showActionButtons,"is-file-locked":t.isFileLocked,"is-locking":t.isLocking,onFileSelect:a[0]||=e=>r(`file-select`,e),onToggleLock:a[1]||=e=>r(`toggle-lock`,e),onStage:a[2]||=e=>r(`stage`,e),onUnstage:a[3]||=e=>r(`unstage`,e),onRevert:a[4]||=e=>r(`revert`,e),onNodeClick:o},null,8,[`node`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))]))}}),[[`__scopeId`,`data-v-267015cf`]]);n(),L();var Qe=U(u({__name:`MonacoDiffViewer`,props:{original:{},modified:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!0}},setup(e){let t=e,n=O(null),r=null,i=null,a=null,o=null,s=null;async function c(){return r||s||(s=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new je:t===`html`||t===`handlebars`||t===`razor`?new K:t===`typescript`||t===`javascript`?new Ae:new ke}},r=await W(()=>import(`./monaco-DF5LNTW7.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3])),r})(),s)}function l(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function u(){return t.language===`auto`?l(t.filePath||``):t.language||`plaintext`}function d(){return t.theme&&t.theme!==`auto`?t.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function f(){if(!r)return;let e=d();r.editor.setTheme(e)}Ne(()=>f());function p(){if(!r)return;a?.dispose(),o?.dispose();let e=u();a=r.editor.createModel(t.original||``,e),o=r.editor.createModel(t.modified||``,e)}function m(){i&&a&&o&&i.setModel({original:a,modified:o})}function h(){a&&a.getValue()!==(t.original||``)&&a.setValue(t.original||``),o&&o.getValue()!==(t.modified||``)&&o.setValue(t.modified||``)}return w(async()=>{n.value&&(r=await c(),f(),p(),i=r.editor.createDiffEditor(n.value,{automaticLayout:!0,readOnly:t.readOnly,renderSideBySide:!0,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,originalEditable:!t.readOnly}),m())}),F(()=>t.language,()=>{if(!r)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),F(()=>t.filePath,()=>{if(!r||t.language!==`auto`)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),F(()=>t.theme,()=>{f()}),F(()=>[t.original,t.modified],()=>{h()}),ue(()=>{i?.dispose(),i=null,a?.dispose(),o?.dispose(),a=null,o=null}),(e,t)=>(E(),M(`div`,{ref_key:`containerRef`,ref:n,class:`monaco-diff-container`},null,512))}}),[[`__scopeId`,`data-v-0c23e676`]]);n(),_(),L();var $e=U(u({__name:`MonacoEditor`,props:{modelValue:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!1},minHeight:{default:`360px`},revealLine:{default:null},highlightRange:{default:null},dimHighlightRanges:{default:null},highlightKind:{default:``},gutterPlacement:{default:`glyph`},gutterItems:{default:()=>[]},rightActions:{default:()=>[]},appliedBlocks:{default:()=>[]},syncGroup:{default:null},syncScrollTop:{default:null}},emits:[`update:modelValue`,`gutter-click`,`scroll-change`],setup(e,{emit:t}){let n=e,r=t,i=O(null),a=null,o=null,s=null,c=null,l=!1,u=[],d=[],f=[],p=null,m=null,h=new Map,g=null,_=null;function v(){if(!o)return;let e=n.gutterItems||[],t=n.gutterPlacement===`glyph`&&e.length>0;try{o.updateOptions({glyphMargin:t})}catch{}}function y(){if(!o||m)return;let e=o.getDomNode?.();e&&(m=document.createElement(`div`),m.className=`merge-right-actions`,e.appendChild(m))}function b(){m&&(m.innerHTML=``,h.clear())}function ee(){if(!o||!a||!m)return;let e=n.rightActions||[];if(!e.length)return;let t=o.getLayoutInfo?.(),r=t?.contentLeft??0,i=t?.contentWidth??0,c=Math.max(0,r+i-44);for(let t of e){let e=h.get(t.blockId);if(!e)continue;let n=s?.getLineMaxColumn?.(t.line)??1,r=o.getScrolledVisiblePosition?.({lineNumber:t.line,column:n});if(!r){e.style.display=`none`;continue}e.style.display=``,e.style.top=`${r.top}px`,e.style.left=`${c}px`,e.style.height=`${r.height}px`}}function x(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`current`||r.choice===`both`:r.choice===`incoming`||r.choice===`both`:!1}function S(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`incoming`:r.choice===`current`:!1}function C(e,t,n){e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-label`,t),n&&e.setAttribute(`aria-pressed`,`true`),e.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.click())})}function D(){if(!o||(y(),!m))return;let e=(n.rightActions||[]).filter(e=>e&&e.line&&e.line>0);if(!e.length){b();return}b();for(let t of e){let e=x(t.blockId,t.kind),n=S(t.blockId,t.kind),i=document.createElement(`div`);if(i.className=`merge-right-action-wrapper`,t.kind===`current`){let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-current${e?` is-applied`:``}`,a.textContent=e?`✓`:`→`,a.title=e?`已采用当前更改`:`采用当前更改`,C(a,a.title,e),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,o.textContent=`✕`,o.title=n?`已丢弃当前更改`:`丢弃当前更改`,C(o,o.title,n),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)}),i.appendChild(a),i.appendChild(o)}else{let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,a.textContent=`✕`,a.title=n?`已丢弃传入更改`:`丢弃传入更改`,C(a,a.title,n),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-incoming${e?` is-applied`:``}`,o.textContent=e?`✓`:`←`,o.title=e?`已采用传入更改`:`采用传入更改`,C(o,o.title,e),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)}),i.appendChild(a),i.appendChild(o)}m.appendChild(i),h.set(t.blockId,i)}ee()}async function te(){return a||c||(c=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new je:t===`html`||t===`handlebars`||t===`razor`?new K:t===`typescript`||t===`javascript`?new Ae:new ke}},a=await W(()=>import(`./monaco-DF5LNTW7.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3])),a})(),c)}function ne(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function k(){return n.language===`auto`?ne(n.filePath||``):n.language||`plaintext`}function re(){return n.theme&&n.theme!==`auto`?n.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function A(){a&&a.editor.setTheme(re())}Ne(()=>A());function ie(){if(!a)return;let e=k();if(!s){s=a.editor.createModel(n.modelValue||``,e);return}try{a.editor.setModelLanguage(s,e)}catch{}}function ae(){if(!s)return;let e=n.modelValue||``;s.getValue()!==e&&(l=!0,s.setValue(e),l=!1)}function oe(){if(!o)return;let e=n.revealLine;if(!(!e||e<=0))try{o.revealLineInCenter(e)}catch{}}function j(){if(!a||!o)return;if(!n.dimHighlightRanges||!n.dimHighlightRanges.length||!n.highlightKind)d=o.deltaDecorations(d,[]);else{let e=n.highlightKind===`current`?`merge-highlight-current-dim`:n.highlightKind===`incoming`?`merge-highlight-incoming-dim`:`merge-highlight-merged-dim`;d=o.deltaDecorations(d,n.dimHighlightRanges.filter(e=>e&&e.startLine>0&&e.endLine>0).map(t=>{let n=Math.max(1,t.startLine),r=Math.max(n,t.endLine);return{range:new a.Range(n,1,r,1),options:{isWholeLine:!0,className:e,linesDecorationsClassName:e}}}))}if(!n.highlightRange||!n.highlightKind){u=o.deltaDecorations(u,[]);return}let e=Math.max(1,n.highlightRange.startLine),t=Math.max(e,n.highlightRange.endLine),r=n.highlightKind===`current`?`merge-highlight-current`:n.highlightKind===`incoming`?`merge-highlight-incoming`:`merge-highlight-merged`;u=o.deltaDecorations(u,[{range:new a.Range(e,1,t,1),options:{isWholeLine:!0,className:r,linesDecorationsClassName:r}}])}function N(){if(!a||!o)return;let e=n.gutterItems||[];if(!e.length){f=o.deltaDecorations(f,[]),v();return}v();let t=n.gutterPlacement===`line`;f=o.deltaDecorations(f,e.filter(e=>e&&e.line&&e.line>0).map(e=>{let n=x(e.blockId,e.kind),r=e.kind===`current`?n?`merge-glyph-current is-applied`:`merge-glyph-current`:n?`merge-glyph-incoming is-applied`:`merge-glyph-incoming`;return{range:new a.Range(e.line,1,e.line,1),options:{isWholeLine:!0,...t?{linesDecorationsClassName:r}:{glyphMarginClassName:r}}}}))}return w(async()=>{i.value&&(a=await te(),A(),ie(),o=a.editor.create(i.value,{automaticLayout:!0,readOnly:n.readOnly,glyphMargin:!1,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10}}),o.setModel(s),o.onDidChangeModelContent(()=>{if(l)return;let e=s?.getValue?.()??``;r(`update:modelValue`,e)}),oe(),j(),N(),D(),g=o.onDidScrollChange(e=>{ee(),n.syncGroup&&e.scrollTopChanged&&r(`scroll-change`,e.scrollTop)}),_=o.onDidLayoutChange(()=>{ee()}),p=o.onMouseDown(e=>{try{let t=e?.target,i=t?.position;if(!i?.lineNumber)return;let o=t?.type;if(o!==a.editor.MouseTargetType.GUTTER_GLYPH_MARGIN&&o!==a.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)return;let s=i.lineNumber,c=(n.gutterItems||[]).find(e=>e.line===s);if(!c)return;r(`gutter-click`,c.blockId)}catch{}}))}),F(()=>n.modelValue,()=>{ae()}),F(()=>n.revealLine,()=>{oe()}),F(()=>[n.highlightRange,n.highlightKind],()=>{j()},{deep:!0}),F(()=>n.dimHighlightRanges,()=>{j()},{deep:!0}),F(()=>n.gutterItems,()=>{N()},{deep:!0}),F(()=>n.rightActions,()=>{D()},{deep:!0}),F(()=>n.appliedBlocks,()=>{D(),N()},{deep:!0}),F(()=>n.syncScrollTop,e=>{if(e!=null&&o){let t=o.getScrollTop();Math.abs(t-e)>5&&o.setScrollTop(e)}}),F(()=>n.gutterPlacement,()=>{N()}),F(()=>[n.language,n.filePath],()=>{a&&ie()}),F(()=>n.theme,()=>{A()}),F(()=>n.readOnly,e=>{o&&o.updateOptions({readOnly:e})}),ue(()=>{try{p?.dispose?.()}catch{}p=null;try{g?.dispose?.()}catch{}g=null;try{_?.dispose?.()}catch{}_=null;try{m?.remove?.()}catch{}m=null,h.clear(),o?.dispose(),o=null,d=[],s?.dispose(),s=null}),(t,n)=>(E(),M(`div`,{ref_key:`containerRef`,ref:i,class:`monaco-editor-container`,style:T(e.minHeight?{minHeight:e.minHeight}:{flex:1,minHeight:`200px`})},null,4))}}),[[`__scopeId`,`data-v-1432c6d1`]]);n(),L(),_(),A();var et={class:`summary-head`},Q={class:`summary-heading`},$={class:`summary-label`},tt=[`title`],nt={class:`summary-actions`},rt={class:`summary-body`},it={key:1,class:`summary-placeholder is-loading`},at={key:2,class:`summary-placeholder`},ot={key:3,class:`summary-placeholder`},st={key:4,class:`summary-error`},ct={class:`err-msg`},lt={key:0,class:`dialog-context`},ut={class:`dialog-body`},dt={key:1,class:`summary-placeholder is-loading`},ft={key:2,class:`summary-placeholder`},pt=U(u({__name:`AiDiffSummary`,props:{source:{},scope:{},commitHash:{default:``},file:{default:``},fileName:{default:``},fileRevision:{default:``},revision:{default:``},auto:{type:Boolean,default:!0}},setup(e){let n=e,r=ve(),s=b(()=>Array.isArray(r.models)&&r.models.length>0),c=b(()=>(r.locale||``).startsWith(`en`)?`en`:`zh`),u=b(()=>{let e=Array.isArray(r.models)?r.models:[],t=e.find(e=>e.isDefault)||e[0];return t?`${t.id}|${t.baseURL}|${t.model}`:``}),f=O({status:`idle`,text:``,error:``}),_=O(!1),ee=O(!1),x=new Map,S=null,w=null;function T(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function D(){let e=`${n.source}|${n.commitHash||``}|${n.scope}|${c.value}|${u.value}`;if(n.scope===`overall`)return`${e}|${n.source===`worktree`?T(n.revision):``}`;let t=n.source===`worktree`?T(n.fileRevision):``;return`${e}|${n.file||``}|${t}`}function ne(){let e=x.get(D());f.value=e?{status:`done`,text:e,error:``}:{status:`idle`,text:``,error:``}}function re(){S?.abort(),S=null}async function A(e=!1){if(!s.value||n.scope===`file`&&!n.file||n.source===`commit`&&!n.commitHash)return;let t=D();if(!e&&x.has(t)){f.value={status:`done`,text:x.get(t)||``,error:``};return}re();let r=new AbortController;S=r,f.value={status:`loading`,text:``,error:``};let i=``,a=e=>{let t=e.trim();if(!t.startsWith(`data:`))return;let n=t.slice(5).trim();if(!n)return;let r;try{r=JSON.parse(n)}catch{return}if(r.type===`delta`)i+=r.content||``,f.value={status:`loading`,text:i,error:``};else if(r.type===`done`)f.value={status:`done`,text:i,error:``};else if(r.type===`error`){let e=r.code===`NO_MODEL`?`no-model`:r.code===`EMPTY_DIFF`?`empty`:`error`;f.value={status:e,text:``,error:r.error||H(`@DIFFAI:生成失败`)}}};try{let o={scope:n.scope,source:n.source,locale:c.value};n.scope===`file`&&(o.file=n.file),n.source===`commit`&&(o.hash=n.commitHash),e&&(o.bypassCache=!0);let s=await fetch(`/api/ai/diff-summary`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(o),signal:r.signal});if(!s.ok||!s.body)throw Error(`HTTP ${s.status}`);let l=s.body.getReader(),u=new TextDecoder,d=``;for(;;){let{done:e,value:t}=await l.read();if(e)break;d+=u.decode(t,{stream:!0});let n=d.split(`
|
|
4
4
|
`);d=n.pop()||``,n.forEach(a)}d+=u.decode(),d&&a(d),f.value.status===`loading`&&(f.value={status:i?`done`:`empty`,text:i,error:``}),f.value.status===`done`&&i&&x.set(t,i)}catch(e){e?.name!==`AbortError`&&S===r&&(f.value={status:`error`,text:``,error:e?.message||H(`@DIFFAI:生成失败`)})}finally{S===r&&(S=null)}}function ie(){x.delete(D()),A(!0)}function ae(){n.auto&&s.value&&(n.scope!==`file`||n.file)&&A()}function oe(){w&&clearTimeout(w),w=setTimeout(ae,350)}F(()=>[n.file,n.fileRevision,n.revision,n.commitHash,n.source,n.scope,s.value,c.value,u.value,n.auto],()=>{re(),ne(),s.value&&oe()},{immediate:!0}),ue(()=>{re(),w&&clearTimeout(w)});let j=b(()=>n.scope===`file`?H(`@DIFFAI:AI 文件说明`):H(`@DIFFAI:AI 整体说明`)),P=b(()=>n.scope===`file`?n.fileName||n.file:n.source===`commit`?H(`@DIFFAI:本次提交`):H(`@DIFFAI:未提交变更`));return(n,r)=>{let c=d,u=V;return s.value?(E(),M(`section`,{key:0,class:de([`ai-diff-summary`,`is-${e.scope}`])},[a(`header`,et,[a(`div`,Q,[g(c,{class:`ai-badge`},{default:k(()=>[g(o(p))]),_:1}),a(`span`,$,y(j.value),1)]),a(`span`,{class:`summary-context`,title:P.value},y(P.value),9,tt),a(`div`,nt,[f.value.status===`loading`?(E(),i(c,{key:0,class:`spin`},{default:k(()=>[g(o(t))]),_:1})):h(``,!0),g(u,{text:``,size:`small`,icon:o(z),disabled:!f.value.text,title:o(H)(`@DIFFAI:弹窗查看`),onClick:r[0]||=e=>ee.value=!0},null,8,[`icon`,`disabled`,`title`]),g(u,{text:``,size:`small`,icon:o(l),disabled:f.value.status===`loading`,title:o(H)(`@DIFFAI:重新生成`),onClick:ie},null,8,[`icon`,`disabled`,`title`]),g(u,{text:``,size:`small`,icon:_.value?o(C):o(v),title:_.value?o(H)(`@DIFFAI:展开说明`):o(H)(`@DIFFAI:收起说明`),onClick:r[1]||=e=>_.value=!_.value},null,8,[`icon`,`title`])])]),N(a(`div`,rt,[f.value.text?(E(),i(Ce,{key:0,content:f.value.text,"allow-html":!1},null,8,[`content`])):f.value.status===`loading`?(E(),M(`div`,it,y(o(H)(`@DIFFAI:正在生成差异说明...`)),1)):f.value.status===`empty`?(E(),M(`div`,at,y(e.scope===`file`?o(H)(`@DIFFAI:该文件没有可总结的变更`):o(H)(`@DIFFAI:没有可总结的变更`)),1)):f.value.status===`no-model`?(E(),M(`div`,ot,y(f.value.error),1)):f.value.status===`error`?(E(),M(`div`,st,[g(c,null,{default:k(()=>[g(o(te))]),_:1}),a(`span`,ct,y(f.value.error),1),g(u,{text:``,size:`small`,icon:o(l),onClick:ie},{default:k(()=>[m(y(o(H)(`@DIFFAI:重试`)),1)]),_:1},8,[`icon`])])):h(``,!0)],512),[[me,!_.value]]),g(q,{modelValue:ee.value,"onUpdate:modelValue":r[2]||=e=>ee.value=e,title:j.value,width:`680px`,type:`flex`,"close-on-click-modal":!0,"destroy-on-close":``,"custom-class":`ai-summary-dialog`},{default:k(()=>[P.value?(E(),M(`div`,lt,y(P.value),1)):h(``,!0),a(`div`,ut,[f.value.text?(E(),i(Ce,{key:0,content:f.value.text,"allow-html":!1},null,8,[`content`])):f.value.status===`loading`?(E(),M(`div`,dt,y(o(H)(`@DIFFAI:正在生成差异说明...`)),1)):(E(),M(`div`,ft,y(o(H)(`@DIFFAI:暂无说明内容`)),1))])]),_:1},8,[`modelValue`,`title`])],2)):h(``,!0)}}}),[[`__scopeId`,`data-v-36297805`]]);n(),_(),L();var mt={key:0,class:`diff-preview-panel`},ht={class:`diff-preview-header`},gt={class:`diff-preview-title`},_t={class:`diff-preview-ext-badge`},vt=[`title`],yt={class:`diff-preview-body`},bt={key:0,class:`diff-preview-loading`},xt={key:1,class:`diff-preview-error`},St=[`sandbox`,`srcdoc`],Ct={key:1,class:`diff-preview-panel diff-preview-unsupported`},wt={class:`diff-preview-body`},Tt={class:`diff-preview-empty`},Et=U(u({__name:`DiffPreviewPanel`,props:{filePath:{},content:{},loading:{type:Boolean,default:!1},error:{default:``},context:{default:`git-status`},commitHash:{default:``},officePreviewUrl:{default:``}},emits:[`refresh`],setup(e,{emit:t}){let n=e,r=t,s=b(()=>(n.filePath||``).split(`.`).pop()?.toLowerCase()??``),c=b(()=>s.value===`md`||s.value===`markdown`),u=b(()=>s.value===`html`||s.value===`htm`||s.value===`svg`),f=b(()=>[`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`].includes(s.value)),p=b(()=>c.value||u.value||f.value&&!!n.officePreviewUrl),m=O(!0);function _(){typeof document<`u`&&(m.value=document.documentElement.getAttribute(`data-theme`)!==`light`)}let v=b(()=>{if(!u.value)return``;let e=m.value?`#0d1117`:`#ffffff`,t=m.value?`#e6edf3`:`var(--md-text-strong)`;return s.value===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${e};color:${t};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${n.content||``}</body></html>`:we(n.content||``)});return F(()=>n.filePath,()=>{_()},{immediate:!0}),_(),(t,m)=>p.value?(E(),M(`div`,mt,[a(`div`,ht,[a(`span`,gt,y(t.$t(`@E80AC:文件预览`)),1),a(`span`,_t,y(s.value.toUpperCase()),1),m[1]||=a(`div`,{class:`diff-preview-spacer`},null,-1),g(o(x),{content:t.$t(`@E80AC:刷新预览`),placement:`top`},{default:k(()=>[a(`button`,{class:`diff-preview-btn`,title:t.$t(`@E80AC:刷新预览`),onClick:m[0]||=e=>r(`refresh`)},[g(o(d),null,{default:k(()=>[g(o(l))]),_:1})],8,vt)]),_:1},8,[`content`])]),a(`div`,yt,[e.loading?(E(),M(`div`,bt,[a(`span`,null,y(t.$t(`@E80AC:正在加载预览...`)),1)])):e.error?(E(),M(`div`,xt,[a(`span`,null,y(e.error),1)])):u.value?(E(),M(`iframe`,{key:2,class:`diff-preview-iframe`,sandbox:o(Oe),srcdoc:v.value},null,8,St)):f.value&&e.officePreviewUrl?(E(),i(Ee,{key:3,"file-path":e.filePath,source:e.context===`commit-detail`?`git`:`worktree`,rev:e.commitHash},null,8,[`file-path`,`source`,`rev`])):c.value?(E(),i(Ce,{key:4,content:n.content||``,class:`diff-preview-markdown`},null,8,[`content`])):h(``,!0)])])):(E(),M(`div`,Ct,[a(`div`,wt,[a(`span`,Tt,y(t.$t(`@E80AC:当前文件类型不支持预览`)),1)])]))}}),[[`__scopeId`,`data-v-1c750348`]]);n(),L(),_();var Dt={class:`diff-viewer-main`},Ot={class:`files-panel`},kt={class:`panel-header`},At={class:`header-left`},jt={key:0,class:`file-count`},Mt={class:`view-mode-toggle`},Nt={class:`search-box`},Pt={class:`files-list`},Ft=[`onClick`],It={class:`file-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={key:0,class:`conflict-marker`,title:`冲突文件`},zt={class:`file-name`},Bt=[`title`],Vt={class:`file-directory path-badge`},Ht={key:2,class:`file-actions`},Ut={key:0,class:`ai-summary-float`},Wt={class:`diff-panel`},Gt={class:`panel-header`},Kt={class:`header-right`},qt={class:`selected-file`},Jt={class:`path-dir`},Yt={class:`path-name`},Xt={key:1,class:`diff-stats-badge`},Zt={class:`stats-added`},Qt={class:`stats-deleted`},$t={key:2,class:`action-buttons`},en=[`aria-pressed`],tn={key:0,class:`conflict-resolution-container`},nn={key:0,class:`resolution-mode-switch`},rn={key:1,class:`block-conflict-resolution`},an={class:`merge-three-pane`},on={class:`pane`},sn={class:`pane-header`},cn={class:`pane-title`},ln={class:`pane-body`},un={class:`pane pane-merged`},dn={class:`pane-header`},fn={class:`pane-title`},pn={class:`pane-subhint`},mn={class:`pane-body`},hn={class:`pane`},gn={class:`pane-header`},_n={class:`pane-title`},vn={class:`pane-body`},yn={class:`save-resolution-bar`},bn={key:2,class:`global-conflict-wrapper`},xn={class:`global-conflict-resolution`},Sn={class:`conflict-warning`},Cn={class:`conflict-buttons`},wn={class:`diff-content`},Tn=[`textContent`],En=[`innerHTML`],Dn={key:1,class:`conflict-resolved-container`},On={class:`resolved-notice`},kn={class:`notice-text`},An={class:`diff-content`},jn=[`textContent`],Mn=[`innerHTML`],Nn={key:2,class:`diff-and-preview-wrapper`},Pn={key:2,class:`compare-view`},Fn=[`textContent`],In=[`innerHTML`],Ln={key:1,class:`diff-panel full-width`},Rn={class:`panel-header`},zn={class:`header-right`},Bn={class:`selected-file`},Vn={class:`path-dir`},Hn={class:`path-name`},Un={key:1,class:`action-buttons`},Wn={key:0,class:`conflict-resolution-container`},Gn={key:0,class:`resolution-mode-switch`},Kn={key:1,class:`block-conflict-resolution`},qn={class:`merge-three-pane`},Jn={class:`pane`},Yn={class:`pane-header`},Xn={class:`pane-title`},Zn={class:`pane-body`},Qn={class:`pane pane-merged`},$n={class:`pane-header`},er={class:`pane-title`},tr={class:`pane-subhint`},nr={class:`pane-body`},rr={class:`pane`},ir={class:`pane-header`},ar={class:`pane-title`},or={class:`pane-body`},sr={class:`save-resolution-bar`},cr={key:2,class:`global-conflict-wrapper`},lr={class:`global-conflict-resolution`},ur={class:`conflict-warning`},dr={class:`conflict-buttons`},fr={class:`diff-content`},pr=[`textContent`],mr=[`innerHTML`],hr={key:1,class:`diff-and-preview-wrapper`},gr={key:2,class:`compare-view`},_r=[`textContent`],vr=[`innerHTML`],yr=`merge-three-pane`,br=u({__name:`FileDiffViewer`,props:{files:{},emptyText:{default:H(`@E80AC:没有找到变更文件`)},diffContent:{default:``},diffStats:{default:null},selectedFile:{default:``},isLoading:{type:Boolean,default:!1},plainText:{type:Boolean,default:!1},compareMode:{type:Boolean,default:!1},compareOriginal:{default:``},compareModified:{default:``},height:{default:`100%`},showFileList:{type:Boolean,default:!0},context:{default:`git-status`},showOpenButton:{type:Boolean,default:!0},showActionButtons:{type:Boolean,default:!1},showVscodeButton:{type:Boolean,default:!0},showEditorButton:{type:Boolean,default:!0},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1},commitHash:{default:``}},emits:[`file-select`,`open-file`,`open-with-vscode`,`open-in-editor`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(t,{emit:n}){let l=new Set([`md`,`markdown`,`html`,`htm`,`svg`,`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`]),u=t,f=n,p=ve(),_=ye(),v=O(``),S=O(``),C=e=>Math.min(85,Math.max(15,e)),A=b({get:()=>p.ui.fileListViewMode,set:e=>{p.ui.fileListViewMode=e}}),j=b({get:()=>C(p.ui.fileDiffSplitPercent),set:e=>{p.ui.fileDiffSplitPercent=C(e)}}),P=O(!1),I=O(``),L=O(!1),R=O(``),pe=O(``),me=0,z=b({get:()=>C(p.ui.diffPreviewSplitPercent??55),set:e=>{p.ui.diffPreviewSplitPercent=C(e)}}),U=b(()=>{let e=G.value||``;return(e.split(`/`).pop()||e).split(`.`).pop()?.toLowerCase()??``}),W=b(()=>l.has(U.value)),G=b(()=>u.selectedFile||v.value),Ce=b(()=>u.context===`commit-detail`?`commit`:u.context===`git-status`?`worktree`:``),we=b(()=>!!(Ce.value&&p.aiDiffSummaryEnabled)),Ee=b(()=>u.files.map(e=>`${e.path}\0${e.type||``}`).sort().join(`\0`)),Oe=b(()=>Se(G.value||``)),K=b(()=>G.value?u.files.find(e=>e.path===G.value)?.type===`conflicted`:!1),ke=b(()=>J.value.length>0),Ae=b(()=>u.files.map(e=>{let t=e.name||e.path.split(`/`).pop()||e.path;return{...e,displayName:t,dirPath:(()=>{let t=(e.path||``).split(`/`);return t.length>1?t.slice(0,-1).join(`/`):``})(),iconClass:be(t)}})),je=b(()=>{if(!S.value.trim())return Ae.value;let e=S.value.toLowerCase().trim();return Ae.value.filter(t=>t.displayName.toLowerCase().includes(e)||t.path.toLowerCase().includes(e))}),Me=O([]);function Ne(){let e=We(je.value);Me.value.length>0&&Ke(e,Me.value),Me.value=e}F(je,()=>{A.value===`tree`&&Ne()},{deep:!0}),F(A,e=>{e===`tree`&&Ne(),window.dispatchEvent(new CustomEvent(`file-list-view-mode-change`,{detail:{mode:e}}))});let q=b(()=>u.compareMode?!0:u.diffContent&&u.diffContent.trim()!==``),Pe=b(()=>{if(!G.value)return``;let e=G.value.split(`/`);return e.slice(0,-1).join(`/`)+(e.length>1?`/`:``)}),Ie=b(()=>{if(!G.value)return``;let e=G.value.split(`/`);return e[e.length-1]||G.value});function Re(e){v.value=e,f(`file-select`,e)}function Be(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}f(`open-file`,G.value,u.context)}function Ve(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}navigator.clipboard.writeText(G.value).then(()=>{D.success(H(`@E80AC:文件路径已复制到剪贴板`))}).catch(()=>{D.error(H(`@E80AC:复制失败`))})}function He(){_.copyCurrentDiff()}function Ge(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}f(`open-with-vscode`,G.value,u.context)}function qe(){if(console.log(`[debug-open-in-editor] FileDiffViewer handleOpenInEditor start`),!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}console.log(`[debug-open-in-editor] FileDiffViewer emit, filePath=`,G.value,`context=`,u.context),f(`open-in-editor`,G.value,u.context)}let J=O([]),Y=O(!0),X=O(``),Je=O(!1),Ye=O(``),Z=O(``),Xe=O(``),et=O(``),Q=O(new Map),$=O(null),tt=O(null),nt=O(new Map),rt=O(new Map),it=O(new Map);async function at(e){let t=await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json();if(!t.success)throw Error(t.error||H(`@E80AC:无法读取文件内容`));return String(t.content??``)}async function ot(){let e=G.value;if(!e||!W.value)return;let t=++me;L.value=!0,R.value=``,pe.value=``;try{if(De(e)){pe.value=Te(e,{source:u.context===`commit-detail`?`git`:`worktree`,rev:u.context===`commit-detail`?u.commitHash:void 0}),L.value=!1;return}let n=null;if(n=u.context===`commit-detail`&&u.commitHash?await(await fetch(`/api/git-file-content?rev=${encodeURIComponent(u.commitHash)}&file=${encodeURIComponent(e)}`)).json():await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json(),t!==me)return;if(!n||!n.success){R.value=n?.error||H(`@E80AC:无法读取文件内容`),I.value=``;return}I.value=String(n.content??``)}catch(e){if(t!==me)return;R.value=e.message||H(`@E80AC:无法读取文件内容`),I.value=``}finally{t===me&&(L.value=!1)}}function st(){W.value&&(P.value=!P.value,P.value&&!I.value&&!L.value&&ot())}F([G,()=>u.context,()=>u.commitHash],()=>{if(I.value=``,pe.value=``,R.value=``,!W.value&&P.value){P.value=!1;return}P.value&&ot()});let ct=!1,lt=0,ut=0;function dt(e){ct=!0,lt=e.clientY,ut=z.value,document.addEventListener(`mousemove`,ft),document.addEventListener(`mouseup`,mt),e.preventDefault()}function ft(e){if(!ct)return;let t=e.target?.closest(`.diff-panel`);if(!t)return;let n=t.getBoundingClientRect().height-34;if(n<=0)return;let r=e.clientY-lt,i=ut+r/n*100;z.value=C(i)}function mt(){ct=!1,document.removeEventListener(`mousemove`,ft),document.removeEventListener(`mouseup`,mt)}ue(()=>{ct&&mt()});function ht(e,t){let n=e.split(`
|
|
5
5
|
`),r=[],i=new Map,a=0,o=0;for(;a<n.length;){let e=n[a];if(e.includes(`<<<<<<<`)){o++;let e=[],s=[];for(a++;a<n.length&&!n[a].includes(`=======`);)e.push(n[a]),a++;for(a++;a<n.length&&!n[a].includes(`>>>>>>>`);)s.push(n[a]),a++;a<n.length&&n[a].includes(`>>>>>>>`)&&a++;let c=t(o),l=[];l=c===`incoming`?s:c===`both`?[...e,...s]:c===`none`?[]:e;let u=r.length+1;r.push(...l);let d=Math.max(u,r.length);i.set(o,{startLine:u,endLine:d});continue}r.push(e),a++}return{text:r.join(`
|
package/src/ui/public/assets/{FlowExecutionViewer-MPq4Fh6G.js → FlowExecutionViewer-DDkb05TW.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-CgEuJBlB.js";import{n as m,t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-CgEuJBlB.js";import{n as m,t as h}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-tRJAB9jP.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-DIX4shBD.js";e(),p();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(n({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(e){function p(e){switch(e){case`command`:return`📋`;case`wait`:return`⏰`;case`version`:return`📦`;case`confirm`:return`✋`;case`code`:return`🧩`;case`start`:return`🚀`;case`condition`:return`🔀`;case`user_input`:return`⌨️`;default:return``}}let h=n({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>i(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:p(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return n({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=a(()=>{let e=t.data?.config,n=[...Array.isArray(e?.conditionBranches)?e.conditionBranches:[]].sort((e,t)=>{let n=e?.handleId==="default"||e?.isDefault,r=t?.handleId==="default"||t?.isDefault;return n&&!r?1:!n&&r?-1:Number(e?.priority??0)-Number(t?.priority??0)}).map(e=>String(e?.handleId||``).trim()).filter(e=>!!e);return n.includes(`default`)||n.push(`default`),n.length?n:[`default`]});return()=>i(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:p(t.data?.type),enabled:t.data?.enabled,selected:t.data?.selected,execStatus:t.data?.execStatus,sourceHandleIds:t.data?.type===`condition`?n.value:void 0,deletable:!1},{default:()=>i(e,{data:t.data,id:t.id})})}})}let j={start:u(h),command:u(A(E)),wait:u(A(w)),version:u(A(b)),confirm:u(A(S)),code:u(A(T)),condition:u(A(C)),user_input:u(A(D))},M=e,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let t=0;t<6;t+=1){if(await o(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof P?.findNode==`function`&&P.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await P.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}N(e=>{P=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,k),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{P.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(M.currentNodeId||F||``).trim();t&&(F=null,I(t))});let L=null;f(()=>M.currentNodeId,async e=>{e&&(L&&=(window.clearTimeout(L),null),L=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,k,`nodeId=`,e),!P){F=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,F);return}I(e)},150))}),s(()=>{L&&=(window.clearTimeout(L),null)});let R=a(()=>{let e=Array.isArray(M.flowData?.nodes)?M.flowData.nodes:[],t=new Set(M.executedNodeIds),n=new Set(M.failedNodeIds),r=M.currentNodeId;return e.map(e=>{let i;r&&e.id===r?i=`running`:n.has(e.id)?i=`failed`:t.has(e.id)&&(i=`success`);let a=[];return t.has(e.id)&&a.push(`exec-node-done`),{...e,data:{...e.data,execStatus:i},class:a.join(` `)}})}),z=a(()=>{let e=Array.isArray(M.flowData?.edges)?M.flowData.edges:[],t=new Set(M.executedEdgeIds);return e.map(e=>{let n=[];return t.has(e.id)&&n.push(`exec-edge-done`),{...e,class:n.join(` `)}})});return(e,n)=>(c(),d(`div`,O,[r(t(y),{id:k,nodes:R.value,edges:z.value,"node-types":j,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:l(()=>[r(t(g)),r(t(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,A as n,At as r,Bn as i,C as a,Dn as o,En as s,Er as c,Et as l,F as ee,G as u,Ht as d,I as f,In as p,J as m,K as h,Kt as g,M as _,N as v,Nn as y,On as b,Pn as x,Pr as S,Pt as C,Qn as te,Qr as w,Rn as T,S as ne,St as re,Tn as E,U as ie,Vn as ae,W as oe,Wn as se,Xn as D,Yn as ce,Zn as O,a as k,at as le,bn as A,br as j,bt as ue,cr as M,ct as de,dn as N,dt as P,er as F,gr as I,h as L,i as fe,kn as R,kt as z,l as B,lt as pe,or as V,pr as H,qr as me,rn as he,u as ge,w as U,x as _e,xn as W,y as ve,z as ye,zt as G}from"./element-plus-CgEuJBlB.js";import{b as be}from"./vendor-CDZ64WVU.js";import{n as K,t as q}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as xe}from"./dagre-Dfa6RS7s.js";import{t as Se}from"./SvgIcon-b50XyCO5.js";import{t as J}from"./IconButton-BvbRjQ_D.js";import{t as Y}from"./configStore-BMixvVAA.js";import{t as Ce}from"./CommonDialog-UrQUmb6G.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-tRJAB9jP.js";import{r as Oe}from"./index-CEEQaAF4.js";import{a as ke,c as Ae,i as X,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./UserInputNode-BFmTQYZP.js";var Ie=e(xe(),1);i(),H();var Z=p({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=j(!1);function s(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,r=a,l=U,ee=ne;return O(),o(ee,{trigger:`contextmenu`,onCommand:s,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:M(()=>[x(l,null,{default:M(()=>[x(r,{command:`executeFrom`},{default:M(()=>[x(n,null,{default:M(()=>[x(c(he))]),_:1}),t[1]||=y(` 从此处开始执行 `,-1)]),_:1}),x(r,{command:`executeSingle`},{default:M(()=>[x(n,null,{default:M(()=>[x(c(he))]),_:1}),t[2]||=y(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:M(()=>[F(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});i(),H(),S();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(p({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:n}){let i=e,a=n,l=j(!1),u=j([]),p=j(``),h=E({get:()=>i.modelValue,set:e=>{p.value=e,a(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);a(`change`,t||null)}}),g=E(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function _(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||[],h.value&&!u.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;k.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),k.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function v(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?S(e):e.error&&k.error(e.error)}catch(e){k.error(`浏览目录失败: ${e.message}`)}}function S(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){k.warning(`请输入目录路径`);return}C(e)};fe.alert(T(`div`,{class:`directory-browser`},[T(`div`,{class:`current-path`},[T(`span`,{class:`path-label`},`当前路径:`),T(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),T(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),T(`div`,{class:`directory-list`},[e.parentPath?T(`div`,{class:`directory-item parent-dir`,onClick:()=>C(e.parentPath)},[T(`span`,{class:`dir-icon`},T(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[T(`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`})])),T(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>T(`div`,{class:`directory-item`,onClick:()=>C(e.path)},[T(`span`,{class:`dir-icon`},T(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[T(`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`})])),T(`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){k.warning(`请输入目录路径`);return}_(n)}}})}async function C(e){try{fe.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?S(t):t.error&&k.error(t.error)}catch(e){k.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){k.error(`处理目录选择时出错: ${e.message}`)}}return _(),V(()=>i.modelValue,e=>{p.value=e},{immediate:!0}),(n,i)=>{let a=m,p=ee,S=f,C=ye,te=ge;return O(),R(`div`,Le,[s(`div`,Re,[x(S,{modelValue:h.value,"onUpdate:modelValue":i[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:M(()=>[(O(!0),R(W,null,t(g.value,e=>(O(),o(p,{key:e.value,label:e.label,value:e.value},{default:M(()=>[s(`div`,ze,[s(`div`,Be,[x(a,{class:`folder-icon`},{default:M(()=>[x(c(re))]),_:1}),s(`span`,Ve,w(e.label),1)]),s(`div`,He,w(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),x(C,{icon:l.value?c(r):c(d),loading:l.value,disabled:e.disabled,size:`default`,onClick:i[1]||=e=>_(),class:`refresh-btn`,title:`刷新当前项目`},{default:M(()=>[y(w(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),x(C,{icon:c(ue),disabled:e.disabled||l.value,size:`default`,onClick:v,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:M(()=>[...i[2]||=[y(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),R(`div`,Q,[x(te,{type:`info`,size:`small`},{default:M(()=>[...i[3]||=[y(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):b(``,!0)])}}}),[[`__scopeId`,`data-v-cae26f6e`]]);i(),S(),H();var $={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=q(p({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:n}){let r=e,i=n,a=E(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function l(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...a.value,e()];i(`update:modelValue`,t),i(`add`)}function ee(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(a.value.length<=t)return;let n=a.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let o=[...a.value];o.splice(e,1),i(`update:modelValue`,o),i(`remove`,e)}function u(e,t){return r.itemKey?r.itemKey(e,t):t}return(n,r)=>{let i=ye;return O(),R(`div`,$,[e.title!==void 0||e.addable?(O(),R(`div`,We,[e.title?(O(),R(`span`,Ge,w(e.title),1)):b(``,!0),s(`div`,Ke,[F(n.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),o(i,{key:0,type:`primary`,plain:``,icon:c(G),disabled:e.disableAdd||!e.createItem,onClick:l},null,8,[`icon`,`disabled`])):b(``,!0)])])):b(``,!0),a.value.length===0?(O(),R(`div`,qe,[F(n.$slots,`empty`,{},void 0,!0)])):(O(),R(`div`,Je,[(O(!0),R(W,null,t(a.value,(t,r)=>(O(),R(`div`,{key:u(t,r),class:me([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[s(`div`,Ye,[F(n.$slots,`row`,{item:t,index:r},void 0,!0)]),e.removable?(O(),R(`div`,Xe,[x(i,{type:`danger`,plain:``,icon:c(pe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(t,r):!1),onClick:e=>ee(r)},null,8,[`icon`,`disabled`,`onClick`])])):b(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-e8a38cd0`]]);i(),H(),S();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=q(p({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=j([]);V(()=>n.modelValue,e=>{i.value=e?[...e]:[]},{immediate:!0,deep:!0}),V(()=>n.paramNames,e=>{if(!e||e.length===0){i.value=[],r(`update:modelValue`,[]);return}let t=new Map(i.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});i.value=n,r(`update:modelValue`,n)},{immediate:!0});function a(e,t,n){if(!i.value[e])return;let a=[...i.value];a[e]={...a[e],[t]:n},t===`inputType`&&(n===`manual`?(a[e].referenceNodeId=void 0,a[e].referenceOutputKey=void 0):a[e].manualValue=void 0),i.value=a,r(`update:modelValue`,a)}function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=E(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:l(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,a]=t.split(`::`),o=[...i.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:a},i.value=o,r(`update:modelValue`,o)}function h(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,l=ee,u=f,g=m,_=B,v=L;return O(),R(`div`,Qe,[x(Ze,{"model-value":i.value,title:void 0,addable:!1,removable:!1},{empty:M(()=>[y(w(c(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:M(({item:t,index:n})=>[s(`div`,$e,[s(`div`,et,[s(`label`,tt,w(c(K)(`@NODEINPUT:参数名`)),1),x(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:c(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>a(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,nt,[s(`label`,rt,w(c(K)(`@NODEINPUT:类型`)),1),x(u,{"model-value":t.inputType,placeholder:c(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>a(n,`inputType`,e)},{default:M(()=>[x(l,{value:`manual`,label:c(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),x(l,{value:`reference`,label:c(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,it,[s(`label`,at,w(c(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),o(r,{key:0,"model-value":t.manualValue,placeholder:c(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>a(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),o(_,{key:1,"model-value":h(t),data:d.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:M(({data:e})=>[s(`span`,ot,[e.children?b(``,!0):(O(),o(g,{key:0},{default:M(()=>[x(c(z))]),_:1})),y(` `+w(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,st,[s(`label`,ct,w(c(K)(`@NODEINPUT:必填`)),1),x(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>a(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-27875a5d`]]);i(),H(),S();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=q(p({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);V(()=>r.modelValue,e=>{a.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||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=E(()=>!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 p(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function m(){let e=[...a.value,p()];a.value=e,i(`update:modelValue`,e)}t({addRow:m});function h(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function g(e,t){if(!t)return;let[n,r]=t.split(`::`);h(e,{ref:{nodeId:n,outputKey:r}})}function _(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,l=ee,u=f,m=B,v=L;return O(),R(`div`,ut,[x(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":p,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(w(c(K)(`@NODECFG:暂无输入参数`)),1)]),row:M(({item:t,index:n})=>[s(`div`,dt,[s(`div`,ft,[s(`label`,pt,w(c(K)(`@NODECFG:参数名`)),1),x(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>h(n,{name:e})],placeholder:c(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,mt,[s(`label`,ht,w(c(K)(`@NODECFG:参数值`)),1),x(u,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>h(n,{source:e})],style:{width:`110px`}},{default:M(()=>[x(l,{label:c(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),x(l,{label:c(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,gt,[s(`label`,_t,w(c(K)(`@NODECFG:值`)),1),t.source===`manual`?(O(),o(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>h(n,{manualValue:e})],placeholder:c(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),o(m,{key:1,"model-value":_(t),data:d.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,vt,[s(`label`,yt,w(c(K)(`@NODEINPUT:必填`)),1),x(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>h(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b90fd34c`]]);i(),H(),S();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=q(p({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);V(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...a.value,l()];a.value=e,i(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function h(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let g=E(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:h(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function _(e,t){if(!t)return;let[n,r]=t.split(`::`);d(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let p=ie,h=ee,S=f,C=m,te=B,T=L,ne=ye;return O(),R(`div`,xt,[x(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":l,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(w(c(K)(`@UINPUT:暂无输入参数`)),1)]),row:M(({item:e,index:t})=>[s(`div`,St,[s(`div`,Ct,[s(`label`,wt,w(c(K)(`@UINPUT:参数名`)),1),x(p,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:c(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,Tt,[s(`label`,Et,w(c(K)(`@UINPUT:类型`)),1),x(S,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:M(()=>[x(h,{label:c(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),x(h,{label:c(K)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,Dt,[s(`label`,Ot,w(e.source===`manual`?c(K)(`@UINPUT:默认值`):c(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),o(p,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:c(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),o(te,{key:1,"model-value":v(e),data:g.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>_(t,e)},{default:M(({data:e})=>[s(`span`,kt,[e.children?b(``,!0):(O(),o(C,{key:0},{default:M(()=>[x(c(z))]),_:1})),y(` `+w(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,At,[s(`label`,jt,w(c(K)(`@NODEINPUT:必填`)),1),x(T,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:M(()=>[e.addable===!1?b(``,!0):(O(),o(ne,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:M(()=>[y(w(c(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-ed92e4fb`]]);i(),H(),S();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,A as n,At as r,Bn as i,C as a,Dn as o,En as s,Er as c,Et as l,F as ee,G as u,Ht as d,I as f,In as p,J as m,K as h,Kt as g,M as _,N as v,Nn as y,On as b,Pn as x,Pr as S,Pt as C,Qn as te,Qr as w,Rn as T,S as ne,St as re,Tn as E,U as ie,Vn as ae,W as oe,Wn as se,Xn as D,Yn as ce,Zn as O,a as k,at as le,bn as A,br as j,bt as ue,cr as M,ct as de,dn as N,dt as P,er as F,gr as I,h as L,i as fe,kn as R,kt as z,l as B,lt as pe,or as V,pr as H,qr as me,rn as he,u as ge,w as U,x as _e,xn as W,y as ve,z as ye,zt as G}from"./element-plus-CgEuJBlB.js";import{b as be}from"./vendor-CDZ64WVU.js";import{n as K,t as q}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as xe}from"./dagre-Dfa6RS7s.js";import{t as Se}from"./SvgIcon-B-2iTLW-.js";import{t as J}from"./IconButton-BflzboUD.js";import{t as Y}from"./configStore-BFGSfIBp.js";import{t as Ce}from"./CommonDialog-kDck8ITZ.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-tRJAB9jP.js";import{r as Oe}from"./index-aNSr4k87.js";import{a as ke,c as Ae,i as X,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./UserInputNode-DIX4shBD.js";var Ie=e(xe(),1);i(),H();var Z=p({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=j(!1);function s(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=m,r=a,l=U,ee=ne;return O(),o(ee,{trigger:`contextmenu`,onCommand:s,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:M(()=>[x(l,null,{default:M(()=>[x(r,{command:`executeFrom`},{default:M(()=>[x(n,null,{default:M(()=>[x(c(he))]),_:1}),t[1]||=y(` 从此处开始执行 `,-1)]),_:1}),x(r,{command:`executeSingle`},{default:M(()=>[x(n,null,{default:M(()=>[x(c(he))]),_:1}),t[2]||=y(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:M(()=>[F(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});i(),H(),S();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(p({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:n}){let i=e,a=n,l=j(!1),u=j([]),p=j(``),h=E({get:()=>i.modelValue,set:e=>{p.value=e,a(`update:modelValue`,e);let t=u.value.find(t=>t.fullPath===e);a(`change`,t||null)}}),g=E(()=>u.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function _(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||[],h.value&&!u.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;k.success(`扫描 ${t} 完成,找到 ${u.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),k.error(`扫描失败: ${e.message}`),u.value=[]}finally{l.value=!1}}async function v(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?S(e):e.error&&k.error(e.error)}catch(e){k.error(`浏览目录失败: ${e.message}`)}}function S(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){k.warning(`请输入目录路径`);return}C(e)};fe.alert(T(`div`,{class:`directory-browser`},[T(`div`,{class:`current-path`},[T(`span`,{class:`path-label`},`当前路径:`),T(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),T(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),T(`div`,{class:`directory-list`},[e.parentPath?T(`div`,{class:`directory-item parent-dir`,onClick:()=>C(e.parentPath)},[T(`span`,{class:`dir-icon`},T(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[T(`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`})])),T(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>T(`div`,{class:`directory-item`,onClick:()=>C(e.path)},[T(`span`,{class:`dir-icon`},T(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[T(`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`})])),T(`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){k.warning(`请输入目录路径`);return}_(n)}}})}async function C(e){try{fe.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?S(t):t.error&&k.error(t.error)}catch(e){k.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){k.error(`处理目录选择时出错: ${e.message}`)}}return _(),V(()=>i.modelValue,e=>{p.value=e},{immediate:!0}),(n,i)=>{let a=m,p=ee,S=f,C=ye,te=ge;return O(),R(`div`,Le,[s(`div`,Re,[x(S,{modelValue:h.value,"onUpdate:modelValue":i[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||l.value,filterable:``,class:`package-select`},{default:M(()=>[(O(!0),R(W,null,t(g.value,e=>(O(),o(p,{key:e.value,label:e.label,value:e.value},{default:M(()=>[s(`div`,ze,[s(`div`,Be,[x(a,{class:`folder-icon`},{default:M(()=>[x(c(re))]),_:1}),s(`span`,Ve,w(e.label),1)]),s(`div`,He,w(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),x(C,{icon:l.value?c(r):c(d),loading:l.value,disabled:e.disabled,size:`default`,onClick:i[1]||=e=>_(),class:`refresh-btn`,title:`刷新当前项目`},{default:M(()=>[y(w(l.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),x(C,{icon:c(ue),disabled:e.disabled||l.value,size:`default`,onClick:v,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:M(()=>[...i[2]||=[y(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),u.value.length===0&&!l.value?(O(),R(`div`,Q,[x(te,{type:`info`,size:`small`},{default:M(()=>[...i[3]||=[y(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):b(``,!0)])}}}),[[`__scopeId`,`data-v-cae26f6e`]]);i(),S(),H();var $={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=q(p({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:n}){let r=e,i=n,a=E(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function l(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...a.value,e()];i(`update:modelValue`,t),i(`add`)}function ee(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(a.value.length<=t)return;let n=a.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let o=[...a.value];o.splice(e,1),i(`update:modelValue`,o),i(`remove`,e)}function u(e,t){return r.itemKey?r.itemKey(e,t):t}return(n,r)=>{let i=ye;return O(),R(`div`,$,[e.title!==void 0||e.addable?(O(),R(`div`,We,[e.title?(O(),R(`span`,Ge,w(e.title),1)):b(``,!0),s(`div`,Ke,[F(n.$slots,`title-actions`,{},void 0,!0),e.addable?(O(),o(i,{key:0,type:`primary`,plain:``,icon:c(G),disabled:e.disableAdd||!e.createItem,onClick:l},null,8,[`icon`,`disabled`])):b(``,!0)])])):b(``,!0),a.value.length===0?(O(),R(`div`,qe,[F(n.$slots,`empty`,{},void 0,!0)])):(O(),R(`div`,Je,[(O(!0),R(W,null,t(a.value,(t,r)=>(O(),R(`div`,{key:u(t,r),class:me([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[s(`div`,Ye,[F(n.$slots,`row`,{item:t,index:r},void 0,!0)]),e.removable?(O(),R(`div`,Xe,[x(i,{type:`danger`,plain:``,icon:c(pe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(t,r):!1),onClick:e=>ee(r)},null,8,[`icon`,`disabled`,`onClick`])])):b(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-e8a38cd0`]]);i(),H(),S();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=q(p({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=j([]);V(()=>n.modelValue,e=>{i.value=e?[...e]:[]},{immediate:!0,deep:!0}),V(()=>n.paramNames,e=>{if(!e||e.length===0){i.value=[],r(`update:modelValue`,[]);return}let t=new Map(i.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});i.value=n,r(`update:modelValue`,n)},{immediate:!0});function a(e,t,n){if(!i.value[e])return;let a=[...i.value];a[e]={...a[e],[t]:n},t===`inputType`&&(n===`manual`?(a[e].referenceNodeId=void 0,a[e].referenceOutputKey=void 0):a[e].manualValue=void 0),i.value=a,r(`update:modelValue`,a)}function l(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=E(()=>!n.predecessorNodes||n.predecessorNodes.length===0?[]:n.predecessorNodes.map(e=>({value:e.id,label:l(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,a]=t.split(`::`),o=[...i.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:a},i.value=o,r(`update:modelValue`,o)}function h(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,n)=>{let r=ie,l=ee,u=f,g=m,_=B,v=L;return O(),R(`div`,Qe,[x(Ze,{"model-value":i.value,title:void 0,addable:!1,removable:!1},{empty:M(()=>[y(w(c(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:M(({item:t,index:n})=>[s(`div`,$e,[s(`div`,et,[s(`label`,tt,w(c(K)(`@NODEINPUT:参数名`)),1),x(r,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:c(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>a(n,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,nt,[s(`label`,rt,w(c(K)(`@NODEINPUT:类型`)),1),x(u,{"model-value":t.inputType,placeholder:c(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>a(n,`inputType`,e)},{default:M(()=>[x(l,{value:`manual`,label:c(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),x(l,{value:`reference`,label:c(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,it,[s(`label`,at,w(c(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(O(),o(r,{key:0,"model-value":t.manualValue,placeholder:c(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>a(n,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(O(),o(_,{key:1,"model-value":h(t),data:d.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>p(n,e)},{default:M(({data:e})=>[s(`span`,ot,[e.children?b(``,!0):(O(),o(g,{key:0},{default:M(()=>[x(c(z))]),_:1})),y(` `+w(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,st,[s(`label`,ct,w(c(K)(`@NODEINPUT:必填`)),1),x(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>a(n,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-27875a5d`]]);i(),H(),S();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=q(p({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);V(()=>r.modelValue,e=>{a.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||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let d=E(()=>!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 p(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function m(){let e=[...a.value,p()];a.value=e,i(`update:modelValue`,e)}t({addRow:m});function h(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function g(e,t){if(!t)return;let[n,r]=t.split(`::`);h(e,{ref:{nodeId:n,outputKey:r}})}function _(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let r=ie,l=ee,u=f,m=B,v=L;return O(),R(`div`,ut,[x(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":p,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(w(c(K)(`@NODECFG:暂无输入参数`)),1)]),row:M(({item:t,index:n})=>[s(`div`,dt,[s(`div`,ft,[s(`label`,pt,w(c(K)(`@NODECFG:参数名`)),1),x(r,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>h(n,{name:e})],placeholder:c(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,mt,[s(`label`,ht,w(c(K)(`@NODECFG:参数值`)),1),x(u,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>h(n,{source:e})],style:{width:`110px`}},{default:M(()=>[x(l,{label:c(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),x(l,{label:c(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,gt,[s(`label`,_t,w(c(K)(`@NODECFG:值`)),1),t.source===`manual`?(O(),o(r,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>h(n,{manualValue:e})],placeholder:c(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),o(m,{key:1,"model-value":_(t),data:d.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(n,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,vt,[s(`label`,yt,w(c(K)(`@NODEINPUT:必填`)),1),x(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>h(n,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b90fd34c`]]);i(),H(),S();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=q(p({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=j([]);V(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function l(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...a.value,l()];a.value=e,i(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function h(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let g=E(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:h(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function _(e,t){if(!t)return;let[n,r]=t.split(`::`);d(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,n)=>{let p=ie,h=ee,S=f,C=m,te=B,T=L,ne=ye;return O(),R(`div`,xt,[x(Ze,{"model-value":a.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":l,"onUpdate:modelValue":n[0]||=e=>i(`update:modelValue`,e)},{empty:M(()=>[y(w(c(K)(`@UINPUT:暂无输入参数`)),1)]),row:M(({item:e,index:t})=>[s(`div`,St,[s(`div`,Ct,[s(`label`,wt,w(c(K)(`@UINPUT:参数名`)),1),x(p,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:c(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,Tt,[s(`label`,Et,w(c(K)(`@UINPUT:类型`)),1),x(S,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:M(()=>[x(h,{label:c(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),x(h,{label:c(K)(`@UINPUT:引用`),value:`reference`,disabled:!r.predecessorNodes||r.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,Dt,[s(`label`,Ot,w(e.source===`manual`?c(K)(`@UINPUT:默认值`):c(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(O(),o(p,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:c(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(O(),o(te,{key:1,"model-value":v(e),data:g.value,placeholder:c(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>_(t,e)},{default:M(({data:e})=>[s(`span`,kt,[e.children?b(``,!0):(O(),o(C,{key:0},{default:M(()=>[x(c(z))]),_:1})),y(` `+w(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,At,[s(`label`,jt,w(c(K)(`@NODEINPUT:必填`)),1),x(T,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:M(()=>[e.addable===!1?b(``,!0):(O(),o(ne,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:M(()=>[y(w(c(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-ed92e4fb`]]);i(),H(),S();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
2
2
|
const out = new Object()
|
|
3
3
|
out.key0 = param.input
|
|
4
4
|
return out
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,En as n,In as r,Pr as i,Tn as a,W as o,Yr as s,Zn as c,cr as l,dn as u,er as d,kn as f,pn as p,qr as m}from"./element-plus-CgEuJBlB.js";import{t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,En as n,In as r,Pr as i,Tn as a,W as o,Yr as s,Zn as c,cr as l,dn as u,er as d,kn as f,pn as p,qr as m}from"./element-plus-CgEuJBlB.js";import{t as h}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as g}from"./SvgIcon-B-2iTLW-.js";u(),e(),i();var _=[`disabled`,`aria-label`,`aria-pressed`],v=[`src`],y=h(r({__name:`IconButton`,props:{iconClass:{},imageUrl:{},size:{default:`medium`},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},tooltip:{default:``},ariaLabel:{default:``},pressed:{type:Boolean,default:!1},customClass:{default:``},color:{default:``},hoverColor:{default:`var(--color-primary)`}},emits:[`click`],setup(e,{emit:r}){p(e=>({v362f3d2f:e.hoverColor}));let i=e,u=r,h=a(()=>`icon-button--${i.size}`),y=e=>{i.disabled||u(`click`,e)};return(r,i)=>{let a=o;return c(),t(a,{content:e.tooltip,disabled:!e.tooltip,placement:`bottom`,"show-after":300},{default:l(()=>[n(`button`,{type:`button`,class:m([`icon-button`,[h.value,e.customClass,{"is-disabled":e.disabled,"is-active":e.active}]]),disabled:e.disabled,"aria-label":e.ariaLabel||e.tooltip||void 0,"aria-pressed":e.pressed?`true`:void 0,onClick:y},[e.iconClass?(c(),t(g,{key:0,"icon-class":e.iconClass,decorative:!0,style:s({color:e.color||void 0})},null,8,[`icon-class`,`style`])):e.imageUrl?(c(),f(`img`,{key:1,src:e.imageUrl,alt:``,"aria-hidden":`true`,class:`icon-image`},null,8,v)):d(r.$slots,`default`,{},void 0,!0,2)],10,_)]),_:3},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-b2bcfbaf`]]);export{y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,D as n,Dn as r,En as i,Er as a,F as o,I as s,In as c,J as l,L as u,Nn as d,On as f,Pn as p,Pr as m,Qr as h,Tn as g,U as ee,W as te,Wn as _,Wt as ne,Yn as re,Yr as ie,Zn as v,a as y,bn as b,br as x,cr as S,ct as ae,dn as oe,i as se,kn as C,lr as ce,m as le,o as ue,or as w,p as de,pr as T,pt as fe,qn as pe,qr as me,vn as he,vt as ge,wt as _e,xn as E,yn as D,z as O}from"./element-plus-CgEuJBlB.js";import{n as k,t as A}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,D as n,Dn as r,En as i,Er as a,F as o,I as s,In as c,J as l,L as u,Nn as d,On as f,Pn as p,Pr as m,Qr as h,Tn as g,U as ee,W as te,Wn as _,Wt as ne,Yn as re,Yr as ie,Zn as v,a as y,bn as b,br as x,cr as S,ct as ae,dn as oe,i as se,kn as C,lr as ce,m as le,o as ue,or as w,p as de,pr as T,pt as fe,qn as pe,qr as me,vn as he,vt as ge,wt as _e,xn as E,yn as D,z as O}from"./element-plus-CgEuJBlB.js";import{n as k,t as A}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{s as ve,t as ye}from"./FileDiffViewer-BxFkqvIA.js";import{t as be}from"./IconButton-BflzboUD.js";import{r as xe}from"./gitStore-BcrFZogC.js";import{t as Se}from"./toolsStore-B3LQrSEp.js";import{t as Ce}from"./CommonDialog-kDck8ITZ.js";var j=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function M(e){return 10+e*14}function N(e){return j[e%j.length]}function P(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 we(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 P(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 Te(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:N(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],g=N(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:g,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:g,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:g,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:N(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let ee=t.slice();i=Math.max(i,t.length);let te=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<ee.length&&ee[e]!==null&&ee[e].hash===t.hash&&te.push({lane:e,color:N(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:g,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:te,topCurves:p,bottomEdges:h,branches:[]})}let c=we(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}}t(),T(),m();var Ee={class:`graph-wrap`},De=[`viewBox`],Oe=[`x1`,`x2`,`stroke`],ke=[`x1`,`x2`],F=[`d`,`stroke`],Ae=[`d`],je=[`x1`,`x2`,`stroke`],I=[`d`,`stroke`],L=[`d`],R={class:`graph-layer graph-nodes`,"aria-hidden":`true`},z=[`cx`,`stroke`],B=[`cx`,`fill`],V=[`cx`,`stroke`],H=[`cx`],U=-1,Me=A(c({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(t){let n=t,r=g(()=>M(n.layout.commitLane)),o=k(`@A1833:暂不属于任何分支`);function s(e){return e.length>0?e.join(`, `):o}let c=g(()=>`${n.layout.hash.slice(0,7)} · ${s(n.layout.branches)}`),l=g(()=>n.layout.passes.map(e=>({x:M(e.lane),color:e.color,title:s(e.branches)}))),u=g(()=>n.layout.topCurves.map(e=>{let t=M(e.fromLane),n=r.value;return{d:`M ${t} ${U} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:s(e.branches)}})),d=g(()=>n.layout.bottomEdges.map(e=>{let t=r.value,n=M(e.toLane);return{d:e.kind===`straight`||t===n?`M ${t} 15 L ${n} 31`:`M ${t} 15 C ${t} 23, ${n} 23, ${n} 31`,color:e.color,title:s(e.branches)}}));return(n,o)=>(v(),C(`div`,Ee,[(v(),C(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${t.width} ${a(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(v(!0),C(E,null,e(l.value,(e,t)=>(v(),C(`line`,{key:`p`+t,x1:e.x,y1:U,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[i(`title`,null,h(e.title),1)],8,Oe))),128)),(v(!0),C(E,null,e(l.value,(e,t)=>(v(),C(`line`,{key:`ph`+t,x1:e.x,y1:U,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[i(`title`,null,h(e.title),1)],8,ke))),128)),(v(!0),C(E,null,e(u.value,(e,t)=>(v(),C(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[i(`title`,null,h(e.title),1)],8,F))),128)),(v(!0),C(E,null,e(u.value,(e,t)=>(v(),C(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[i(`title`,null,h(e.title),1)],8,Ae))),128)),t.layout.hasTopLine?(v(),C(`line`,{key:0,x1:r.value,y1:U,x2:r.value,y2:15,stroke:t.layout.color,"stroke-width":`2`},[i(`title`,null,h(s(t.layout.branches)),1)],8,je)):f(``,!0),(v(!0),C(E,null,e(d.value,(e,t)=>(v(),C(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[i(`title`,null,h(e.title),1)],8,I))),128)),(v(!0),C(E,null,e(d.value,(e,t)=>(v(),C(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[i(`title`,null,h(e.title),1)],8,L))),128))],8,De)),(v(),C(`svg`,R,[i(`g`,null,[i(`title`,null,h(c.value),1),t.layout.isMerge?(v(),C(`circle`,{key:0,cx:r.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:t.layout.color,"stroke-width":`2`},null,8,z)):(v(),C(`circle`,{key:1,cx:r.value,cy:`50%`,r:`4`,fill:t.layout.color},null,8,B)),t.layout.isHead?(v(),C(`circle`,{key:2,cx:r.value,cy:`50%`,r:`7`,fill:`none`,stroke:t.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,V)):f(``,!0),i(`circle`,{cx:r.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,H)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);t(),T(),m(),oe();var Ne={class:`log-header`},Pe={class:`header-left`},Fe={class:`log-actions`},Ie={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Le={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Re={key:0,class:`filter-panel-header`},ze={class:`filter-form`},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-item`},qe={class:`compact-label`},Je={class:`filter-actions`},Ye={key:0,role:`alert`,class:`log-error`},Xe={key:1,class:`log-empty-state`},Ze={class:`log-empty-text`},Qe={key:2,class:`content-area-content`},$e={class:`table-view-container`},et={class:`commit-message-cell`},tt={class:`message-content`},nt={key:0,class:`branch-container`},rt={class:`message-text`},it={class:`author-name`},at=[`title`,`aria-label`,`onClick`],ot={class:`commit-detail-container`},st={key:0,class:`commit-info`},ct={class:`commit-info-row`},lt={class:`info-item date-item`},ut={class:`info-label`},dt={class:`info-value`},ft={class:`info-item branch-item`},pt={class:`info-label`},mt={key:0,class:`branch-container`},ht={key:1,class:`info-value info-value-muted`},gt={class:`info-item message-item`},_t={class:`info-label`},vt={class:`info-message-wrapper`},yt={class:`info-message-title`},bt=[`innerHTML`],xt=[`aria-label`,`onKeydown`],St=`zen-gitsync:log-show-graph`,Ct=A(c({__name:`LogList`,setup(t,{expose:c}){let m=xe(),oe=Se(),T=x([]),A=x(``),j=x(!1),M=g(()=>m.isLoadingLog||j.value),N=x(!1),P=x(localStorage.getItem(St)!==`false`);w(P,e=>{localStorage.setItem(St,String(e))});let Ee=g(()=>P.value&&T.value.length>0?Te(T.value):null),De=g(()=>{let e=new Map;if(Ee.value)for(let t of Ee.value.rows)e.set(t.hash,t);return e}),Oe=g(()=>Math.max(Ee.value?.width??0,28)),ke=g(()=>we(T.value)),F=x(!1),Ae=x(null),je=x(!1),I=x(null),L=x([]),R=x(``),z=x(!1),B=x(``),V=x(`full-new`),H=x(``),U=x(``),Ct=g(()=>I.value?ke.value.get(I.value.hash)??[]:[]),W=x(!1),wt=g(()=>I.value?.message?I.value.message.split(`
|
|
2
2
|
`)[0].trim():``),Tt=g(()=>I.value?.message?I.value.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim():``),Et=g(()=>Tt.value.length>0),Dt=g(()=>Tt.value.replace(/\n/g,`<br>`)),G=x(!1),Ot=x([]),kt=x(``),K=x(null),At=x([]),jt=x([]),Mt=x([]),Nt=x(!1),Pt=x(0),Ft=x(0),q=x(null),It=x(null),Lt=g(()=>T.value),Rt=g(()=>L.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function J(e=!1,t=1){let n=xe();if(!n.isGitRepo){A.value=`当前目录不是Git仓库`;return}try{t>1?F.value=!0:j.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),Ot.value.length>0&&r.append(`author`,Ot.value.join(`,`)),jt.value.length>0&&r.append(`branch`,jt.value.join(`,`)),kt.value&&r.append(`message`,kt.value),K.value&&Array.isArray(K.value)&&K.value.length===2&&(r.append(`dateFrom`,K.value[0]),r.append(`dateTo`,K.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)){A.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?T.value=T.value.concat(i.data):Array.isArray(i.data)&&(T.value=i.data),n.currentPage=t,n.totalCommits=i.total??T.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&_(()=>{Wt(),setTimeout(Sn,200)}),A.value=``}catch(e){A.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?F.value=!1:j.value=!1}}function zt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function Bt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function Vt(e){return e?e.length>60||e.includes(`
|