zen-gitsync 2.18.21 → 2.18.23

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.
Files changed (74) hide show
  1. package/package.json +2 -1
  2. package/src/cli/ai/agent.js +9 -2
  3. package/src/cli/ai/extensions.js +1 -1
  4. package/src/cli/ai/runtime.test.js +57 -1
  5. package/src/cli/ai/termui.js +11 -2
  6. package/src/cli/ai/tools.js +266 -5
  7. package/src/cli/ai/tools.test.js +81 -0
  8. package/src/cli/ai/transport.js +1 -1
  9. package/src/cli/ai/turn.js +59 -3
  10. package/src/config.js +60 -4
  11. package/src/mcp/install.js +548 -529
  12. package/src/ui/public/assets/{AgentView-zjXqXR6_.css → AgentView-Cb5CmQTA.css} +1 -1
  13. package/src/ui/public/assets/AgentView-DQOp7_6G.js +1 -0
  14. package/src/ui/public/assets/{AppVersionBadge-CAjnmlwK.js → AppVersionBadge-BBVS3HeA.js} +2 -2
  15. package/src/ui/public/assets/{BranchSelector-Bx7ZWY7i.js → BranchSelector-BwmMgaSS.js} +1 -1
  16. package/src/ui/public/assets/{ChatSilenceBadge-BGRTUX_g.js → ChatSilenceBadge-BnaLbCwp.js} +6 -6
  17. package/src/ui/public/assets/{CommitForm-BArPY3IJ.js → CommitForm-BtRxJodG.js} +1 -1
  18. package/src/ui/public/assets/{CommonDialog-C5Q6F8ql.js → CommonDialog-Qg_owAyQ.js} +1 -1
  19. package/src/ui/public/assets/{EditorView-x7dr5MPK.js → EditorView-DL3Lj4ho.js} +1 -1
  20. package/src/ui/public/assets/{FlowExecutionViewer-BHz9hKxX.js → FlowExecutionViewer-BsxAtCqd.js} +1 -1
  21. package/src/ui/public/assets/{FlowOrchestrationWorkspace-F7YGzQV-.js → FlowOrchestrationWorkspace-lcqnsQE-.js} +1 -1
  22. package/src/ui/public/assets/{LogList-DBc9xebA.js → LogList-CW3-fShz.js} +1 -1
  23. package/src/ui/public/assets/{MindmapView-Dz-gyQCR.js → MindmapView-ymN6XI7n.js} +1 -1
  24. package/src/ui/public/assets/{MonitorView-CvPb2Dji.js → MonitorView-C4fFNPb2.js} +1 -1
  25. package/src/ui/public/assets/{ProjectManagerView-BiV62lNF.js → ProjectManagerView-ph_imDtI.js} +1 -1
  26. package/src/ui/public/assets/{ProjectStartupButton--Q-S0DWw.js → ProjectStartupButton-C2dqnR-6.js} +1 -1
  27. package/src/ui/public/assets/{RemoteManagerDialog-BGib3iis.js → RemoteManagerDialog-DFkRW2O4.js} +1 -1
  28. package/src/ui/public/assets/{RemoteRepoCard-CzIWKirJ.js → RemoteRepoCard-BBnMjldy.js} +1 -1
  29. package/src/ui/public/assets/{SourceMapView-CuAuq9vv.js → SourceMapView-CQcK1acs.js} +1 -1
  30. package/src/ui/public/assets/{SvgIcon-9MndOhWP.js → SvgIcon-XBkgNKCj.js} +1 -1
  31. package/src/ui/public/assets/{TaskExecutorPicker-BNLwo3aN.js → TaskExecutorPicker-B6p57RJY.js} +1 -1
  32. package/src/ui/public/assets/{UserInputNode-B1wOq19j.js → UserInputNode-CkXLP8y4.js} +1 -1
  33. package/src/ui/public/assets/WorkbenchView-MUfM9DER.css +1 -0
  34. package/src/ui/public/assets/WorkbenchView-cucUmAwl.js +6 -0
  35. package/src/ui/public/assets/{_plugin-vue_export-helper-B-yhZnp1.js → _plugin-vue_export-helper-B3dZvHQf.js} +3 -3
  36. package/src/ui/public/assets/configStore-HDlssep1.js +1 -0
  37. package/src/ui/public/assets/{dagre-BD_lsknB.js → dagre-JTV5zPzI.js} +3 -3
  38. package/src/ui/public/assets/{element-plus-axsKECfO.js → element-plus-CN9J6t-d.js} +1 -1
  39. package/src/ui/public/assets/{flow-mindmap-B4ponDC1.js → flow-mindmap-CyZrdnd4.js} +1 -1
  40. package/src/ui/public/assets/index-CAWXBaPa.js +59 -0
  41. package/src/ui/public/assets/index-CigPOqV6.css +1 -0
  42. package/src/ui/public/assets/{monaco-Bu9hROZs.js → monaco-irXl5Eu9.js} +1 -1
  43. package/src/ui/public/assets/{office-docx-Bb8autKU.js → office-docx-C48cuZOS.js} +1 -1
  44. package/src/ui/public/assets/{office-excel-G4ohUqnx.js → office-excel-sA-LZnfv.js} +1 -1
  45. package/src/ui/public/assets/{office-pptx-CLAxHUkH.js → office-pptx-BLPWYpxZ.js} +1 -1
  46. package/src/ui/public/assets/{relativeTime-DnD6Qv_n.js → relativeTime-Ce-gekf_.js} +1 -1
  47. package/src/ui/public/assets/{taskExecutionExport-D6VIBn4K.js → taskExecutionExport-Hfww5P9_.js} +3 -3
  48. package/src/ui/public/assets/toolsStore-oZEAoHnG.js +1 -0
  49. package/src/ui/public/assets/{useWorkbenchProjects-VSSECz1J.js → useWorkbenchProjects-BifctigH.js} +1 -1
  50. package/src/ui/public/assets/{vendor-DMJR8zxK.js → vendor-Bs5KA16r.js} +220 -220
  51. package/src/ui/public/assets/{vendor-B2ISauoC.css → vendor-CAhoE06w.css} +1 -1
  52. package/src/ui/public/assets/{vue-flow-BgHev8Va.js → vue-flow-NLvet82_.js} +1 -1
  53. package/src/ui/public/index.html +14 -14
  54. package/src/ui/server/routes/config.js +13 -0
  55. package/src/ui/server/routes/fileOpen.js +1851 -1736
  56. package/src/ui/server/routes/fileOpen.test.js +39 -1
  57. package/src/ui/server/routes/workbench/agentChat.js +48 -8
  58. package/src/ui/server/routes/workbench/agentChatShared.test.js +584 -496
  59. package/src/ui/server/routes/workbench/agentEngines.js +7 -4
  60. package/src/ui/server/routes/workbench/executorModels.js +25 -4
  61. package/src/ui/server/routes/workbench/executorModels.test.js +557 -530
  62. package/src/ui/server/routes/workbench/jobActivity.js +2 -2
  63. package/src/ui/server/routes/workbench/taskRunner.codearts.test.js +308 -0
  64. package/src/ui/server/routes/workbench/taskRunner.codebuddy.test.js +317 -317
  65. package/src/ui/server/routes/workbench/taskRunner.js +280 -7
  66. package/src/ui/server/routes/workbench/taskRunner.opencode.test.js +130 -130
  67. package/src/ui/server/routes/workbench/taskRunner.pi.test.js +298 -298
  68. package/src/ui/public/assets/AgentView-BEtr0bKC.js +0 -1
  69. package/src/ui/public/assets/WorkbenchView-DGa_j7-z.css +0 -1
  70. package/src/ui/public/assets/WorkbenchView-DnHUwx2h.js +0 -6
  71. package/src/ui/public/assets/configStore-D9y28eJA.js +0 -1
  72. package/src/ui/public/assets/index-ArXbQKZJ.js +0 -59
  73. package/src/ui/public/assets/index-iTgY1Kwp.css +0 -1
  74. package/src/ui/public/assets/toolsStore-BWcMcQnZ.js +0 -1
@@ -1,2 +1,2 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,C as r,Cn as i,Dt as a,F as o,Gn as s,Gr as c,I as l,In as u,J as d,Jr as f,Mn as p,S as m,Sn as h,Sr as g,Tn as _,U as v,Ur as y,V as b,W as x,Y as S,Yn as ee,_n as C,ar as te,gn as w,gr as T,i as E,in as D,ir as O,lr as k,mn as ne,mr as A,mt as j,nr as M,on as N,q as re,qn as P,w as ie,wn as F,xn as I,yn as L,z as R}from"./element-plus-axsKECfO.js";import{n as z,t as B}from"./_plugin-vue_export-helper-B-yhZnp1.js";import{t as V}from"./SvgIcon-9MndOhWP.js";import{o as ae,t as oe}from"./configStore-D9y28eJA.js";import{C as H,S as U,St as se,b as W,bt as G,it as ce,u as le,x as K,xt as ue}from"./index-ArXbQKZJ.js";u(),t(),N();var q={class:`loading-container`},de={class:`loading-text`},J={key:0,class:`loading-progress`},fe=p({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:z(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(t){return(n,r)=>(P(),i(L,{to:`body`},[e(D,{name:`loading-fade`},{default:O(()=>[t.visible||t.mock?(P(),_(`div`,{key:0,class:`global-loading-overlay`,onClick:r[0]||=w(()=>{},[`stop`])},[h(`div`,q,[r[1]||=h(`div`,{class:`loading-spinner`},[h(`div`,{class:`spinner-ring`}),h(`div`,{class:`spinner-ring`}),h(`div`,{class:`spinner-ring`})],-1),h(`div`,de,f(t.text),1),t.showProgress||t.mock?(P(),_(`div`,J,[h(`div`,{class:y([`progress-bar`,{"is-mock":t.mock&&!t.showProgress}]),style:c(t.showProgress?{width:t.progress+`%`}:void 0)},null,6)])):F(``,!0)])])):F(``,!0)]),_:1})]))}}),pe=B(fe,[[`__scopeId`,`data-v-f4fe1f34`]]);u(),t(),N();var Y={class:`success-container`},X={class:`success-text`},me={key:0,class:`success-description`},he=p({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:z(`@71545:操作成功!`)},description:{default:``}},setup(t){return(n,r)=>(P(),i(L,{to:`body`},[e(D,{name:`success-fade`},{default:O(()=>[t.visible?(P(),_(`div`,{key:0,class:`success-overlay`,onClick:r[0]||=w(()=>{},[`stop`])},[h(`div`,Y,[r[1]||=h(`div`,{class:`success-icon`},[h(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[h(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),h(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),h(`div`,X,f(t.text),1),t.description?(P(),_(`div`,me,f(t.description),1)):F(``,!0)])])):F(``,!0)]),_:1})]))}}),ge=B(he,[[`__scopeId`,`data-v-3e82b431`]]);k();var Z=A({visible:!1,text:z(`@F2A3A:加载中...`),showProgress:!1,progress:0});function _e(){return{loadingState:Z,show:e=>{Z.visible=!0,Z.text=e?.text||z(`@F2A3A:加载中...`),Z.showProgress=e?.showProgress||!1,Z.progress=e?.progress||0},hide:()=>{Z.visible=!1},updateProgress:e=>{Z.progress=Math.max(0,Math.min(100,e))},updateText:e=>{Z.text=e},setText:e=>{Z.visible&&(Z.text=e)}}}k();var Q=A({visible:!1,text:z(`@B8591:操作成功!`),description:``});function ve(){let e=e=>{Q.visible=!0,Q.text=e?.text||z(`@B8591:操作成功!`),Q.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{Q.visible=!1};return{successState:Q,show:e,hide:t}}u(),k(),t();var ye={class:`one-commit-content`},be={class:`one-commit-text`},xe={class:`one-commit-title`},$={key:0,class:`one-commit-desc`},Se=B(p({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(t,{expose:n,emit:r}){let i=ue(),a=oe(),o=t,s=r,c=I(()=>i.fileList.some(e=>!G(e.path,a.lockedFiles))),l=I(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),u=I(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!l.value||!o.hasUserCommitMessage:!c.value||!o.hasUserCommitMessage),p=I(()=>i.isAddingFiles||i.isCommiting),m=I(()=>i.hasConflictedFiles?z(`@2E184:存在冲突文件,请先解决冲突`):i.isSelectionMode?i.selectedFiles.size===0?z(`@2E184:请先勾选要提交的文件`):i.selectedUnstagedPaths.length===0?z(`@2E184:所选文件无需暂存或被锁定`):o.hasUserCommitMessage?z(`@2E184:一键完成:仅暂存所选文件 → 提交`):z(`@2E184:请输入提交信息`):c.value?o.hasUserCommitMessage?z(`@2E184:一键完成:暂存所有更改 → 提交`):z(`@2E184:请输入提交信息`):z(`@2E184:没有需要提交的更改`)),v=I(()=>i.isSelectionMode&&l.value?z(`@2E184:一键提交所选`):z(`@2E184:一键提交`)),b=I(()=>o.from===`form`?i.isSelectionMode&&l.value?z(`@2E184:暂存所选 + 提交`):z(`@2E184:暂存 + 提交`):``);async function S(){s(`beforeCommit`);try{let e=await i.stageSelectedAndCommit(o.finalCommitMessage,o.skipHooks);e&&s(`clearFields`),s(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),s(`afterCommit`,!1)}}return n({triggerQuickCommit:S,isDisabled:u,isLoading:p,buttonTitle:v,buttonDesc:b,tooltipText:m}),(n,r)=>{let i=d,a=R;return P(),_(`div`,null,[e(g(x),{content:m.value,placement:`top`,"show-after":200},{default:O(()=>[e(a,{type:`primary`,onClick:S,loading:p.value,disabled:u.value,class:y([t.from,`one-commit-button`])},{default:O(()=>[h(`div`,ye,[e(i,{class:`one-commit-icon`},{default:O(()=>[e(g(j))]),_:1}),h(`div`,be,[h(`span`,xe,f(v.value),1),t.from===`form`?(P(),_(`span`,$,f(b.value),1)):F(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-cfc8c3a9`]]);u(),k(),t();var Ce={class:`qa-wrap`},we=[`aria-label`,`title`],Te={class:`qa-trigger__text`},Ee={class:`qa-trigger__title`},De={class:`qa-trigger__desc`},Oe={key:1,class:`qa-trigger__caret`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},ke={class:`qa-item`},Ae={class:`qa-item__text`},je={class:`qa-item__title`},Me={class:`qa-item__desc`},Ne={class:`qa-item`},Pe={class:`qa-item__text`},Fe={class:`qa-item__title`},Ie={class:`qa-item__desc`},Le={class:`qa-engines`,"aria-hidden":`true`},Re=B(p({__name:`QuickActionsDropdown`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`],setup(t,{expose:n,emit:o}){let s=t,c=o,l=T(null),u=T(null),p=I(()=>l.value?.isDisabled??!0),v=I(()=>l.value?.isLoading??!1),b=I(()=>l.value?.buttonTitle??z(`@2E184:一键提交`)),x=I(()=>p.value?l.value?.tooltipText??``:l.value?.buttonDesc??``),S=I(()=>l.value?.tooltipText??``),ee=I(()=>u.value?.isDisabled??!0),C=I(()=>u.value?.isLoading??!1),te=I(()=>u.value?.buttonTitle??z(`@2E184:一键推送所有`)),w=I(()=>ee.value?u.value?.tooltipText??``:u.value?.buttonDesc??``),E=I(()=>u.value?.tooltipText??``),D=I(()=>v.value||C.value),k=I(()=>p.value&&ee.value),ne=I(()=>u.value?.buttonDesc||z(`@2E184:暂存 + 提交 + 推送`));function A(e){e===`commit`?l.value?.triggerQuickCommit():e===`push`&&u.value?.triggerQuickPush()}return n({triggerQuickPush:()=>u.value?.triggerQuickPush()}),(t,n)=>{let o=d,v=r,C=ie,T=m;return P(),_(`div`,Ce,[e(T,{trigger:`click`,placement:`bottom-start`,"popper-class":`qa-dropdown-popper`,onCommand:A},{dropdown:O(()=>[e(C,null,{default:O(()=>[e(v,{disabled:p.value,command:`commit`},{default:O(()=>[h(`div`,ke,[n[7]||=h(`svg`,{class:`qa-item__icon`,viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[h(`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),h(`path`,{d:`M12 3l0 6`}),h(`path`,{d:`M12 15l0 6`})],-1),h(`div`,Ae,[h(`span`,je,f(b.value),1),h(`span`,Me,f(x.value||S.value),1)])])]),_:1},8,[`disabled`]),e(v,{disabled:ee.value,command:`push`},{default:O(()=>[h(`div`,Ne,[n[8]||=h(`svg`,{class:`qa-item__icon`,viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[h(`path`,{d:`M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1`}),h(`path`,{d:`M9 15l3 -3l3 3`}),h(`path`,{d:`M12 12l0 9`})],-1),h(`div`,Pe,[h(`span`,Fe,f(te.value),1),h(`span`,Ie,f(w.value||E.value),1)])])]),_:1},8,[`disabled`])]),_:1})]),default:O(()=>[h(`div`,{class:y([`qa-trigger`,{"is-quiet":k.value,"is-busy":D.value}]),role:`button`,tabindex:`0`,"aria-label":g(z)(`@2E184:提交并推送`),title:E.value},[h(`div`,Te,[h(`span`,Ee,f(g(z)(`@2E184:提交并推送`)),1),h(`span`,De,f(ne.value),1)]),D.value?(P(),i(o,{key:0,class:`is-loading qa-trigger__caret`},{default:O(()=>[e(g(a))]),_:1})):(P(),_(`svg`,Oe,[...n[6]||=[h(`path`,{d:`M6 9l6 6l6 -6`},null,-1)]]))],10,we)]),_:1}),h(`div`,Le,[e(Se,{ref_key:`quickCommitRef`,ref:l,from:s.from,"has-user-commit-message":s.hasUserCommitMessage,"final-commit-message":s.finalCommitMessage,"skip-hooks":s.skipHooks,onAfterCommit:n[0]||=e=>c(`afterCommit`,e),onClearFields:n[1]||=()=>c(`clearFields`)},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),e(W,{ref_key:`quickPushRef`,ref:u,from:s.from,"has-user-commit-message":s.hasUserCommitMessage,"final-commit-message":s.finalCommitMessage,"skip-hooks":s.skipHooks,onBeforePush:n[2]||=()=>c(`beforePush`),onPushStart:n[3]||=()=>c(`pushStart`),onAfterPush:n[4]||=e=>c(`afterPush`,e),onClearFields:n[5]||=()=>c(`clearFields`)},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])])}}}),[[`__scopeId`,`data-v-74ff0650`]]);u(),t(),k();var ze={class:`one-ai-push`},Be={class:`one-ai-push-content`},Ve={class:`one-ai-push-text`},He={class:`one-ai-push-title`},Ue={key:0,class:`one-ai-push-desc`},We=B(p({__name:`AiQuickPushButton`,props:{from:{default:`form`},generating:{type:Boolean,default:!1}},emits:[`trigger`],setup(t,{emit:n}){let r=ue(),i=oe(),a=t,o=n,s=I(()=>r.fileList.some(e=>!G(e.path,i.lockedFiles))),c=I(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),l=I(()=>!r.isSelectionMode&&!s.value&&r.branchAhead>0),u=I(()=>r.hasConflictedFiles||!r.hasUpstream?!0:r.isSelectionMode?!c.value:!s.value&&r.branchAhead===0),d=I(()=>a.generating||r.isAddingFiles||r.isCommiting||r.isPushing),p=I(()=>r.hasConflictedFiles?z(`@2E184:存在冲突文件,请先解决冲突`):r.hasUpstream?a.generating?z(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode?c.value?z(`@2E184:一键完成:AI 生成提交信息 → 仅暂存所选文件 → 提交 → 推送`):z(`@2E184:请先勾选要推送的文件`):!s.value&&r.branchAhead===0?z(`@2E184:没有需要提交或推送的更改`):s.value?z(`@2E184:一键完成:AI 生成提交信息 → 暂存所有更改 → 提交 → 推送`):z(`@2E184:本地已提交,AI 将直接推送到远程仓库`):z(`@2E184:当前分支没有上游分支`)),m=I(()=>a.generating?z(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode&&c.value?z(`@2E184:AI 提交并推送所选`):z(`@2E184:AI 提交并推送`)),v=I(()=>a.from!==`form`||a.generating?``:l.value?z(`@2E184:本地已提交,直接推送`):z(`@2E184:AI 生成信息 + 推送`));function b(){u.value||d.value||o(`trigger`)}return(n,r)=>{let i=R;return P(),_(`div`,ze,[e(g(x),{content:p.value,placement:`top`,"show-after":200},{default:O(()=>[e(i,{type:`primary`,onClick:b,loading:d.value,disabled:u.value,class:y([t.from,`one-ai-push-button`])},{default:O(()=>[h(`div`,Be,[e(V,{class:`one-ai-push-icon`,"icon-class":`message-chatbot`}),h(`div`,Ve,[h(`span`,He,f(m.value),1),t.from===`form`?(P(),_(`span`,Ue,f(v.value),1)):F(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-2c3e6bc2`]]);u(),k();var Ge={class:`form-bottom-actions`},Ke={class:`actions-flex-container`},qe={class:`left-actions`},Je={class:`button-grid`},Ye={class:`right-actions`},Xe=B(p({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`},aiGenerating:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`,`aiQuickPush`],setup(t,{expose:n,emit:r}){let i=r,a=T(null);function o(e){i(`afterCommit`,e)}function s(e){i(`afterPush`,e)}function c(){i(`beforePush`)}function l(){i(`pushStart`)}function u(){i(`clearFields`)}function d(){i(`aiQuickPush`)}async function f(){return a.value?.triggerQuickPush()}return n({triggerQuickPush:f}),(n,r)=>(P(),_(`div`,Ge,[h(`div`,Ke,[h(`div`,qe,[h(`div`,Je,[e(H,{onClick:()=>{},from:t.from},null,8,[`from`]),e(U,{"has-user-commit-message":t.hasUserCommitMessage,"final-commit-message":t.finalCommitMessage,"skip-hooks":t.skipHooks,onBeforeCommit:()=>{},onAfterCommit:o,onClick:()=>{},from:t.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),e(K,{onBeforePush:()=>{},onAfterPush:s,onClick:()=>{},from:t.from},null,8,[`from`])])]),h(`div`,Ye,[e(Re,{ref_key:`quickActionsRef`,ref:a,from:t.from,"has-user-commit-message":t.hasUserCommitMessage,"final-commit-message":t.finalCommitMessage,"skip-hooks":t.skipHooks,onAfterCommit:o,onAfterPush:s,onBeforePush:c,onPushStart:l,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),e(We,{from:t.from,generating:t.aiGenerating,onTrigger:d},null,8,[`from`,`generating`])])])]))}}),[[`__scopeId`,`data-v-c8e88c71`]]);u(),k(),t(),N();var Ze={class:`card-header app-card-header`},Qe={class:`header-left`},$e={class:`card-content app-card-content`},et={class:`layout-container`},tt={key:0,class:`git-config-warning`},nt={key:0,class:`merge-in-progress-banner`},rt={class:`commit-section`},it={key:0,class:`commit-form`},at={class:`description-container`},ot={key:1,class:`standard-commit-form`},st={class:`standard-commit-header`},ct={class:`type-scope-container`},lt={class:`scope-wrapper`},ut={class:`description-container description-inline`},dt=[`aria-expanded`],ft={class:`advanced-fields`},pt={key:0,class:`status-updating-indicator`},mt={key:0,class:`status-updating-indicator`},ht=B(p({__name:`CommitForm`,setup(t){let r=T(!1),c=T(!1);async function u(){let e=x.isSelectionMode&&x.selectedFiles.size>0?[...x.selectedFiles]:[],t=ae(),n=await(await fetch(`/api/config/generate-commit-message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedPaths:e,locale:t.currentLocale})})).json();if(!n.success){let e=n.code,t=n.error||z(`@76872:AI生成失败`),r=e?{TIMEOUT:`@76872:AI生成超时,请重试或检查模型响应速度`,NO_MODEL:`@76872:未配置AI模型,请先在通用设置中添加模型`,NO_JSON:`@76872:AI未返回有效结果,请重试`,PARSE_FAILED:`@76872:AI返回格式无法解析,请重试`,GENERATE_FAILED:`@76872:AI生成失败`,HTTP_ERR:`@76872:AI生成失败`}[e]:null;return E.error(r?z(r):t),!1}let r=[`feat`,`fix`,`docs`,`style`,`refactor`,`test`,`chore`];if(V.value)n.type&&r.includes(n.type)&&(H.value=n.type),n.scope!==void 0&&(U.value=n.scope),n.description&&(W.value=n.description);else{let e=n.type&&n.description?n.scope?`${n.type}(${n.scope}): ${n.description}`:`${n.type}: ${n.description}`:n.description||``;e&&(k.value=e)}return!0}async function p(){if(!r.value){r.value=!0;try{if(!await u())return;E.success(z(`@76872:AI已生成提交信息`))}catch(e){E.error(`${z(`@76872:AI生成失败`)}: ${e.message}`)}finally{r.value=!1}}}async function m(){if(!c.value){c.value=!0;try{let e=x.isSelectionMode&&x.selectedFiles.size>0,t=x.fileList.some(e=>!G(e.path,w.lockedFiles));if(e||t){if(!await u())return;if(await n(),!$.value){E.error(z(`@76872:AI生成失败`));return}}await Z.value?.triggerQuickPush?.()}catch(e){console.error(`AI 提交并推送失败:`,e),E.error(`${z(`@76872:AI生成失败`)}: ${e.message}`)}finally{c.value=!1}}}let x=ue(),w=oe(),k=T(``),{loadingState:A,show:j,hide:N,setText:ie}=_e(),{successState:L}=ve(),R=T(!1),B=T(``),V=I({get:()=>w.isStandardCommit,set:e=>{w.isStandardCommit=e}}),H=T(`feat`),U=T(``),W=T(``),K=T(``),q=T(``),de=T([]),J=T(!1),fe=T([]),Y=T(!1),X=T(!1),me=I({get:()=>w.skipHooks,set:e=>{w.skipHooks=e}}),he=I({get:()=>w.autoQuickPushOnEnter,set:e=>{w.autoQuickPushOnEnter=e}}),Z=T(null),Q=T(!1),ye=I(()=>[{value:`feat`,label:`feat: ${z(`@76872:新功能`)}`},{value:`fix`,label:`fix: ${z(`@76872:修复bug`)}`},{value:`docs`,label:`docs: ${z(`@76872:文档修改`)}`},{value:`style`,label:`style: ${z(`@76872:样式修改`)}`},{value:`refactor`,label:`refactor: ${z(`@76872:代码重构`)}`},{value:`test`,label:`test: ${z(`@76872:测试代码`)}`},{value:`chore`,label:`chore: ${z(`@76872:构建/工具修改`)}`}]),be=T([]),xe=I(()=>{if(!V.value)return k.value||B.value;let e=`${H.value||``}`;return U.value&&(e+=`(${U.value})`),e+=`: ${W.value}`,K.value&&(e+=`\n\n${K.value}`),q.value&&(e+=`\n\n${q.value}`),e}),$=I(()=>V.value?(x.isMergeInProgress||(H.value||``).trim()!==``)&&(W.value||``).trim()!==``:k.value.trim()!==``),Se=I(()=>x.hasConflictedFiles?!0:x.isMergeInProgress?!$.value:!x.fileList.some(e=>!G(e.path,w.lockedFiles))||!$.value),Ce=I(()=>{let e=`${z(`@76872:输入提交信息 (默认: `)}${B.value})`;return he.value?`${e}${z(`@76872:(按回车一键推送)`)}`:e}),we=I(()=>{let e=z(`@76872:简短描述(必填)`);return he.value?z(`@76872:简短描述(必填,按回车一键推送)`):e}),Te=I(()=>{let e=`git commit -m "${xe.value}"`;return me.value&&(e+=` --no-verify`),e});function Ee(){let e=w.config;e&&(B.value=e.defaultCommitMessage||``,e.descriptionTemplates&&Array.isArray(e.descriptionTemplates)&&(de.value=e.descriptionTemplates),e.scopeTemplates&&Array.isArray(e.scopeTemplates)&&(fe.value=e.scopeTemplates),e.messageTemplates&&Array.isArray(e.messageTemplates)&&(be.value=e.messageTemplates))}function De(e){W.value=e,J.value=!1}function Oe(e){U.value=e,Y.value=!1}function ke(){J.value=!0}function Ae(){Y.value=!0}function je(){k.value=``,W.value=``,K.value=``,q.value=``,H.value=`feat`,w.autoSetDefaultMessage&&w.defaultCommitMessage&&(V.value?W.value=w.defaultCommitMessage:k.value=w.defaultCommitMessage)}function Me(){j({text:z(`@76872:正在暂存文件…`),showProgress:!1})}function Ne(){N()}function Pe(e){if(N(),e){R.value=!0;try{setTimeout(async()=>{try{console.log(z(`@76872:推送成功,状态已更新`))}catch(e){console.error(`一键推送后处理失败:`,e)}finally{R.value=!1}},1e3)}catch(e){console.error(`一键推送后处理失败:`,e),R.value=!1}}}function Fe(e){k.value=e,X.value=!1}async function Ie(e){if(!he.value||!$.value)return;let t=x.fileList.some(e=>!G(e.path,w.lockedFiles)),n=x.hasConflictedFiles;if(t&&$.value&&x.hasUpstream&&!n&&e.key===`Enter`&&!e.shiftKey){e.preventDefault();try{await Z.value?.triggerQuickPush()}catch(e){console.error(`回车自动一键提交失败:`,e)}}}async function Le(e){try{await w.saveDefaultMessage(e)&&E.success(z(`@76872:默认提交信息设置成功`))}catch(e){E.error(`${z(`@76872:设置默认提交信息失败: `)}${e.message}`)}}M(()=>x.pendingMergeMessage,e=>{e&&(V.value?(H.value=``,W.value=e):k.value=e,x.pendingMergeMessage=``,E.info(z(`@76872:已自动填充合并提交信息`)))}),M(()=>x.isAddingFiles,e=>{e&&A.visible&&ie(z(`@76872:正在暂存文件…`))}),M(()=>x.isCommiting,e=>{e&&A.visible&&ie(z(`@76872:正在提交更改...`))}),M(()=>x.isPushing,e=>{e&&A.visible&&N()}),s(async()=>{M(()=>w.config,Ee,{immediate:!0}),w.config||await w.loadConfig(),w.autoSetDefaultMessage&&w.defaultCommitMessage&&(V.value?W.value||=w.defaultCommitMessage:k.value||=w.defaultCommitMessage),x.pendingMergeMessage&&(V.value?(H.value=``,W.value=x.pendingMergeMessage):k.value=x.pendingMergeMessage,x.pendingMergeMessage=``,E.info(z(`@76872:已自动填充合并提交信息`)))});function Re(e,t){t([...e?de.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):de.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function ze(e,t){t([...e?fe.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):fe.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Be(e){e.isSettings?(ke(),W.value=``):W.value=e.value}function Ve(e){e.isSettings?(Ae(),U.value=``):U.value=e.value}function He(e,t){t([...e?be.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):be.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Ue(e){e.isSettings?(X.value=!0,k.value=``):k.value=e.value}return(t,n)=>{let s=re,u=b,w=d,T=o,E=l,j=v;return P(),_(C,null,[h(`div`,{class:y([`card app-card`,{"is-pushing":g(x).isPushing}])},[h(`div`,Ze,[h(`div`,Qe,[g(x).userName!==``&&g(x).userEmail!==``?(P(),i(Xe,{key:0,ref_key:`gitActionButtonsRef`,ref:Z,"has-user-commit-message":$.value,"final-commit-message":xe.value,"skip-hooks":me.value,"ai-generating":c.value,onAfterCommit:n[0]||=e=>{e&&je()},onAfterPush:Pe,onBeforePush:Me,onPushStart:Ne,onClearFields:je,onAiQuickPush:m},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`ai-generating`])):F(``,!0)])]),h(`div`,$e,[h(`div`,et,[g(x).userName===``||g(x).userEmail===``?(P(),_(`div`,tt,[e(s,{title:g(z)(`@76872:Git用户信息未配置`),type:`warning`,closable:!1,"show-icon":``},{default:O(()=>[h(`p`,null,f(g(z)(`@76872:您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:`)),1),n[11]||=h(`pre`,{class:`config-command`},`git config --global user.name "Your Name"
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,C as r,Cn as i,Dt as a,F as o,Gn as s,Gr as c,I as l,In as u,J as d,Jr as f,Mn as p,S as m,Sn as h,Sr as g,Tn as _,U as v,Ur as y,V as b,W as x,Y as S,Yn as ee,_n as C,ar as te,gn as w,gr as T,i as E,in as D,ir as O,lr as k,mn as ne,mr as A,mt as j,nr as M,on as N,q as re,qn as P,w as ie,wn as F,xn as I,yn as L,z as R}from"./element-plus-CN9J6t-d.js";import{n as z,t as B}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as V}from"./SvgIcon-XBkgNKCj.js";import{o as ae,t as oe}from"./configStore-HDlssep1.js";import{C as H,S as U,St as se,b as W,bt as G,it as ce,u as le,x as K,xt as ue}from"./index-CAWXBaPa.js";u(),t(),N();var q={class:`loading-container`},de={class:`loading-text`},J={key:0,class:`loading-progress`},fe=p({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:z(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(t){return(n,r)=>(P(),i(L,{to:`body`},[e(D,{name:`loading-fade`},{default:O(()=>[t.visible||t.mock?(P(),_(`div`,{key:0,class:`global-loading-overlay`,onClick:r[0]||=w(()=>{},[`stop`])},[h(`div`,q,[r[1]||=h(`div`,{class:`loading-spinner`},[h(`div`,{class:`spinner-ring`}),h(`div`,{class:`spinner-ring`}),h(`div`,{class:`spinner-ring`})],-1),h(`div`,de,f(t.text),1),t.showProgress||t.mock?(P(),_(`div`,J,[h(`div`,{class:y([`progress-bar`,{"is-mock":t.mock&&!t.showProgress}]),style:c(t.showProgress?{width:t.progress+`%`}:void 0)},null,6)])):F(``,!0)])])):F(``,!0)]),_:1})]))}}),pe=B(fe,[[`__scopeId`,`data-v-f4fe1f34`]]);u(),t(),N();var Y={class:`success-container`},X={class:`success-text`},me={key:0,class:`success-description`},he=p({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:z(`@71545:操作成功!`)},description:{default:``}},setup(t){return(n,r)=>(P(),i(L,{to:`body`},[e(D,{name:`success-fade`},{default:O(()=>[t.visible?(P(),_(`div`,{key:0,class:`success-overlay`,onClick:r[0]||=w(()=>{},[`stop`])},[h(`div`,Y,[r[1]||=h(`div`,{class:`success-icon`},[h(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[h(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),h(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),h(`div`,X,f(t.text),1),t.description?(P(),_(`div`,me,f(t.description),1)):F(``,!0)])])):F(``,!0)]),_:1})]))}}),ge=B(he,[[`__scopeId`,`data-v-3e82b431`]]);k();var Z=A({visible:!1,text:z(`@F2A3A:加载中...`),showProgress:!1,progress:0});function _e(){return{loadingState:Z,show:e=>{Z.visible=!0,Z.text=e?.text||z(`@F2A3A:加载中...`),Z.showProgress=e?.showProgress||!1,Z.progress=e?.progress||0},hide:()=>{Z.visible=!1},updateProgress:e=>{Z.progress=Math.max(0,Math.min(100,e))},updateText:e=>{Z.text=e},setText:e=>{Z.visible&&(Z.text=e)}}}k();var Q=A({visible:!1,text:z(`@B8591:操作成功!`),description:``});function ve(){let e=e=>{Q.visible=!0,Q.text=e?.text||z(`@B8591:操作成功!`),Q.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{Q.visible=!1};return{successState:Q,show:e,hide:t}}u(),k(),t();var ye={class:`one-commit-content`},be={class:`one-commit-text`},xe={class:`one-commit-title`},$={key:0,class:`one-commit-desc`},Se=B(p({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(t,{expose:n,emit:r}){let i=ue(),a=oe(),o=t,s=r,c=I(()=>i.fileList.some(e=>!G(e.path,a.lockedFiles))),l=I(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),u=I(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!l.value||!o.hasUserCommitMessage:!c.value||!o.hasUserCommitMessage),p=I(()=>i.isAddingFiles||i.isCommiting),m=I(()=>i.hasConflictedFiles?z(`@2E184:存在冲突文件,请先解决冲突`):i.isSelectionMode?i.selectedFiles.size===0?z(`@2E184:请先勾选要提交的文件`):i.selectedUnstagedPaths.length===0?z(`@2E184:所选文件无需暂存或被锁定`):o.hasUserCommitMessage?z(`@2E184:一键完成:仅暂存所选文件 → 提交`):z(`@2E184:请输入提交信息`):c.value?o.hasUserCommitMessage?z(`@2E184:一键完成:暂存所有更改 → 提交`):z(`@2E184:请输入提交信息`):z(`@2E184:没有需要提交的更改`)),v=I(()=>i.isSelectionMode&&l.value?z(`@2E184:一键提交所选`):z(`@2E184:一键提交`)),b=I(()=>o.from===`form`?i.isSelectionMode&&l.value?z(`@2E184:暂存所选 + 提交`):z(`@2E184:暂存 + 提交`):``);async function S(){s(`beforeCommit`);try{let e=await i.stageSelectedAndCommit(o.finalCommitMessage,o.skipHooks);e&&s(`clearFields`),s(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),s(`afterCommit`,!1)}}return n({triggerQuickCommit:S,isDisabled:u,isLoading:p,buttonTitle:v,buttonDesc:b,tooltipText:m}),(n,r)=>{let i=d,a=R;return P(),_(`div`,null,[e(g(x),{content:m.value,placement:`top`,"show-after":200},{default:O(()=>[e(a,{type:`primary`,onClick:S,loading:p.value,disabled:u.value,class:y([t.from,`one-commit-button`])},{default:O(()=>[h(`div`,ye,[e(i,{class:`one-commit-icon`},{default:O(()=>[e(g(j))]),_:1}),h(`div`,be,[h(`span`,xe,f(v.value),1),t.from===`form`?(P(),_(`span`,$,f(b.value),1)):F(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-cfc8c3a9`]]);u(),k(),t();var Ce={class:`qa-wrap`},we=[`aria-label`,`title`],Te={class:`qa-trigger__text`},Ee={class:`qa-trigger__title`},De={class:`qa-trigger__desc`},Oe={key:1,class:`qa-trigger__caret`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},ke={class:`qa-item`},Ae={class:`qa-item__text`},je={class:`qa-item__title`},Me={class:`qa-item__desc`},Ne={class:`qa-item`},Pe={class:`qa-item__text`},Fe={class:`qa-item__title`},Ie={class:`qa-item__desc`},Le={class:`qa-engines`,"aria-hidden":`true`},Re=B(p({__name:`QuickActionsDropdown`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`],setup(t,{expose:n,emit:o}){let s=t,c=o,l=T(null),u=T(null),p=I(()=>l.value?.isDisabled??!0),v=I(()=>l.value?.isLoading??!1),b=I(()=>l.value?.buttonTitle??z(`@2E184:一键提交`)),x=I(()=>p.value?l.value?.tooltipText??``:l.value?.buttonDesc??``),S=I(()=>l.value?.tooltipText??``),ee=I(()=>u.value?.isDisabled??!0),C=I(()=>u.value?.isLoading??!1),te=I(()=>u.value?.buttonTitle??z(`@2E184:一键推送所有`)),w=I(()=>ee.value?u.value?.tooltipText??``:u.value?.buttonDesc??``),E=I(()=>u.value?.tooltipText??``),D=I(()=>v.value||C.value),k=I(()=>p.value&&ee.value),ne=I(()=>u.value?.buttonDesc||z(`@2E184:暂存 + 提交 + 推送`));function A(e){e===`commit`?l.value?.triggerQuickCommit():e===`push`&&u.value?.triggerQuickPush()}return n({triggerQuickPush:()=>u.value?.triggerQuickPush()}),(t,n)=>{let o=d,v=r,C=ie,T=m;return P(),_(`div`,Ce,[e(T,{trigger:`click`,placement:`bottom-start`,"popper-class":`qa-dropdown-popper`,onCommand:A},{dropdown:O(()=>[e(C,null,{default:O(()=>[e(v,{disabled:p.value,command:`commit`},{default:O(()=>[h(`div`,ke,[n[7]||=h(`svg`,{class:`qa-item__icon`,viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[h(`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),h(`path`,{d:`M12 3l0 6`}),h(`path`,{d:`M12 15l0 6`})],-1),h(`div`,Ae,[h(`span`,je,f(b.value),1),h(`span`,Me,f(x.value||S.value),1)])])]),_:1},8,[`disabled`]),e(v,{disabled:ee.value,command:`push`},{default:O(()=>[h(`div`,Ne,[n[8]||=h(`svg`,{class:`qa-item__icon`,viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[h(`path`,{d:`M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1`}),h(`path`,{d:`M9 15l3 -3l3 3`}),h(`path`,{d:`M12 12l0 9`})],-1),h(`div`,Pe,[h(`span`,Fe,f(te.value),1),h(`span`,Ie,f(w.value||E.value),1)])])]),_:1},8,[`disabled`])]),_:1})]),default:O(()=>[h(`div`,{class:y([`qa-trigger`,{"is-quiet":k.value,"is-busy":D.value}]),role:`button`,tabindex:`0`,"aria-label":g(z)(`@2E184:提交并推送`),title:E.value},[h(`div`,Te,[h(`span`,Ee,f(g(z)(`@2E184:提交并推送`)),1),h(`span`,De,f(ne.value),1)]),D.value?(P(),i(o,{key:0,class:`is-loading qa-trigger__caret`},{default:O(()=>[e(g(a))]),_:1})):(P(),_(`svg`,Oe,[...n[6]||=[h(`path`,{d:`M6 9l6 6l6 -6`},null,-1)]]))],10,we)]),_:1}),h(`div`,Le,[e(Se,{ref_key:`quickCommitRef`,ref:l,from:s.from,"has-user-commit-message":s.hasUserCommitMessage,"final-commit-message":s.finalCommitMessage,"skip-hooks":s.skipHooks,onAfterCommit:n[0]||=e=>c(`afterCommit`,e),onClearFields:n[1]||=()=>c(`clearFields`)},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),e(W,{ref_key:`quickPushRef`,ref:u,from:s.from,"has-user-commit-message":s.hasUserCommitMessage,"final-commit-message":s.finalCommitMessage,"skip-hooks":s.skipHooks,onBeforePush:n[2]||=()=>c(`beforePush`),onPushStart:n[3]||=()=>c(`pushStart`),onAfterPush:n[4]||=e=>c(`afterPush`,e),onClearFields:n[5]||=()=>c(`clearFields`)},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])])}}}),[[`__scopeId`,`data-v-74ff0650`]]);u(),t(),k();var ze={class:`one-ai-push`},Be={class:`one-ai-push-content`},Ve={class:`one-ai-push-text`},He={class:`one-ai-push-title`},Ue={key:0,class:`one-ai-push-desc`},We=B(p({__name:`AiQuickPushButton`,props:{from:{default:`form`},generating:{type:Boolean,default:!1}},emits:[`trigger`],setup(t,{emit:n}){let r=ue(),i=oe(),a=t,o=n,s=I(()=>r.fileList.some(e=>!G(e.path,i.lockedFiles))),c=I(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),l=I(()=>!r.isSelectionMode&&!s.value&&r.branchAhead>0),u=I(()=>r.hasConflictedFiles||!r.hasUpstream?!0:r.isSelectionMode?!c.value:!s.value&&r.branchAhead===0),d=I(()=>a.generating||r.isAddingFiles||r.isCommiting||r.isPushing),p=I(()=>r.hasConflictedFiles?z(`@2E184:存在冲突文件,请先解决冲突`):r.hasUpstream?a.generating?z(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode?c.value?z(`@2E184:一键完成:AI 生成提交信息 → 仅暂存所选文件 → 提交 → 推送`):z(`@2E184:请先勾选要推送的文件`):!s.value&&r.branchAhead===0?z(`@2E184:没有需要提交或推送的更改`):s.value?z(`@2E184:一键完成:AI 生成提交信息 → 暂存所有更改 → 提交 → 推送`):z(`@2E184:本地已提交,AI 将直接推送到远程仓库`):z(`@2E184:当前分支没有上游分支`)),m=I(()=>a.generating?z(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode&&c.value?z(`@2E184:AI 提交并推送所选`):z(`@2E184:AI 提交并推送`)),v=I(()=>a.from!==`form`||a.generating?``:l.value?z(`@2E184:本地已提交,直接推送`):z(`@2E184:AI 生成信息 + 推送`));function b(){u.value||d.value||o(`trigger`)}return(n,r)=>{let i=R;return P(),_(`div`,ze,[e(g(x),{content:p.value,placement:`top`,"show-after":200},{default:O(()=>[e(i,{type:`primary`,onClick:b,loading:d.value,disabled:u.value,class:y([t.from,`one-ai-push-button`])},{default:O(()=>[h(`div`,Be,[e(V,{class:`one-ai-push-icon`,"icon-class":`message-chatbot`}),h(`div`,Ve,[h(`span`,He,f(m.value),1),t.from===`form`?(P(),_(`span`,Ue,f(v.value),1)):F(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-2c3e6bc2`]]);u(),k();var Ge={class:`form-bottom-actions`},Ke={class:`actions-flex-container`},qe={class:`left-actions`},Je={class:`button-grid`},Ye={class:`right-actions`},Xe=B(p({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`},aiGenerating:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`,`aiQuickPush`],setup(t,{expose:n,emit:r}){let i=r,a=T(null);function o(e){i(`afterCommit`,e)}function s(e){i(`afterPush`,e)}function c(){i(`beforePush`)}function l(){i(`pushStart`)}function u(){i(`clearFields`)}function d(){i(`aiQuickPush`)}async function f(){return a.value?.triggerQuickPush()}return n({triggerQuickPush:f}),(n,r)=>(P(),_(`div`,Ge,[h(`div`,Ke,[h(`div`,qe,[h(`div`,Je,[e(H,{onClick:()=>{},from:t.from},null,8,[`from`]),e(U,{"has-user-commit-message":t.hasUserCommitMessage,"final-commit-message":t.finalCommitMessage,"skip-hooks":t.skipHooks,onBeforeCommit:()=>{},onAfterCommit:o,onClick:()=>{},from:t.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),e(K,{onBeforePush:()=>{},onAfterPush:s,onClick:()=>{},from:t.from},null,8,[`from`])])]),h(`div`,Ye,[e(Re,{ref_key:`quickActionsRef`,ref:a,from:t.from,"has-user-commit-message":t.hasUserCommitMessage,"final-commit-message":t.finalCommitMessage,"skip-hooks":t.skipHooks,onAfterCommit:o,onAfterPush:s,onBeforePush:c,onPushStart:l,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),e(We,{from:t.from,generating:t.aiGenerating,onTrigger:d},null,8,[`from`,`generating`])])])]))}}),[[`__scopeId`,`data-v-c8e88c71`]]);u(),k(),t(),N();var Ze={class:`card-header app-card-header`},Qe={class:`header-left`},$e={class:`card-content app-card-content`},et={class:`layout-container`},tt={key:0,class:`git-config-warning`},nt={key:0,class:`merge-in-progress-banner`},rt={class:`commit-section`},it={key:0,class:`commit-form`},at={class:`description-container`},ot={key:1,class:`standard-commit-form`},st={class:`standard-commit-header`},ct={class:`type-scope-container`},lt={class:`scope-wrapper`},ut={class:`description-container description-inline`},dt=[`aria-expanded`],ft={class:`advanced-fields`},pt={key:0,class:`status-updating-indicator`},mt={key:0,class:`status-updating-indicator`},ht=B(p({__name:`CommitForm`,setup(t){let r=T(!1),c=T(!1);async function u(){let e=x.isSelectionMode&&x.selectedFiles.size>0?[...x.selectedFiles]:[],t=ae(),n=await(await fetch(`/api/config/generate-commit-message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedPaths:e,locale:t.currentLocale})})).json();if(!n.success){let e=n.code,t=n.error||z(`@76872:AI生成失败`),r=e?{TIMEOUT:`@76872:AI生成超时,请重试或检查模型响应速度`,NO_MODEL:`@76872:未配置AI模型,请先在通用设置中添加模型`,NO_JSON:`@76872:AI未返回有效结果,请重试`,PARSE_FAILED:`@76872:AI返回格式无法解析,请重试`,GENERATE_FAILED:`@76872:AI生成失败`,HTTP_ERR:`@76872:AI生成失败`}[e]:null;return E.error(r?z(r):t),!1}let r=[`feat`,`fix`,`docs`,`style`,`refactor`,`test`,`chore`];if(V.value)n.type&&r.includes(n.type)&&(H.value=n.type),n.scope!==void 0&&(U.value=n.scope),n.description&&(W.value=n.description);else{let e=n.type&&n.description?n.scope?`${n.type}(${n.scope}): ${n.description}`:`${n.type}: ${n.description}`:n.description||``;e&&(k.value=e)}return!0}async function p(){if(!r.value){r.value=!0;try{if(!await u())return;E.success(z(`@76872:AI已生成提交信息`))}catch(e){E.error(`${z(`@76872:AI生成失败`)}: ${e.message}`)}finally{r.value=!1}}}async function m(){if(!c.value){c.value=!0;try{let e=x.isSelectionMode&&x.selectedFiles.size>0,t=x.fileList.some(e=>!G(e.path,w.lockedFiles));if(e||t){if(!await u())return;if(await n(),!$.value){E.error(z(`@76872:AI生成失败`));return}}await Z.value?.triggerQuickPush?.()}catch(e){console.error(`AI 提交并推送失败:`,e),E.error(`${z(`@76872:AI生成失败`)}: ${e.message}`)}finally{c.value=!1}}}let x=ue(),w=oe(),k=T(``),{loadingState:A,show:j,hide:N,setText:ie}=_e(),{successState:L}=ve(),R=T(!1),B=T(``),V=I({get:()=>w.isStandardCommit,set:e=>{w.isStandardCommit=e}}),H=T(`feat`),U=T(``),W=T(``),K=T(``),q=T(``),de=T([]),J=T(!1),fe=T([]),Y=T(!1),X=T(!1),me=I({get:()=>w.skipHooks,set:e=>{w.skipHooks=e}}),he=I({get:()=>w.autoQuickPushOnEnter,set:e=>{w.autoQuickPushOnEnter=e}}),Z=T(null),Q=T(!1),ye=I(()=>[{value:`feat`,label:`feat: ${z(`@76872:新功能`)}`},{value:`fix`,label:`fix: ${z(`@76872:修复bug`)}`},{value:`docs`,label:`docs: ${z(`@76872:文档修改`)}`},{value:`style`,label:`style: ${z(`@76872:样式修改`)}`},{value:`refactor`,label:`refactor: ${z(`@76872:代码重构`)}`},{value:`test`,label:`test: ${z(`@76872:测试代码`)}`},{value:`chore`,label:`chore: ${z(`@76872:构建/工具修改`)}`}]),be=T([]),xe=I(()=>{if(!V.value)return k.value||B.value;let e=`${H.value||``}`;return U.value&&(e+=`(${U.value})`),e+=`: ${W.value}`,K.value&&(e+=`\n\n${K.value}`),q.value&&(e+=`\n\n${q.value}`),e}),$=I(()=>V.value?(x.isMergeInProgress||(H.value||``).trim()!==``)&&(W.value||``).trim()!==``:k.value.trim()!==``),Se=I(()=>x.hasConflictedFiles?!0:x.isMergeInProgress?!$.value:!x.fileList.some(e=>!G(e.path,w.lockedFiles))||!$.value),Ce=I(()=>{let e=`${z(`@76872:输入提交信息 (默认: `)}${B.value})`;return he.value?`${e}${z(`@76872:(按回车一键推送)`)}`:e}),we=I(()=>{let e=z(`@76872:简短描述(必填)`);return he.value?z(`@76872:简短描述(必填,按回车一键推送)`):e}),Te=I(()=>{let e=`git commit -m "${xe.value}"`;return me.value&&(e+=` --no-verify`),e});function Ee(){let e=w.config;e&&(B.value=e.defaultCommitMessage||``,e.descriptionTemplates&&Array.isArray(e.descriptionTemplates)&&(de.value=e.descriptionTemplates),e.scopeTemplates&&Array.isArray(e.scopeTemplates)&&(fe.value=e.scopeTemplates),e.messageTemplates&&Array.isArray(e.messageTemplates)&&(be.value=e.messageTemplates))}function De(e){W.value=e,J.value=!1}function Oe(e){U.value=e,Y.value=!1}function ke(){J.value=!0}function Ae(){Y.value=!0}function je(){k.value=``,W.value=``,K.value=``,q.value=``,H.value=`feat`,w.autoSetDefaultMessage&&w.defaultCommitMessage&&(V.value?W.value=w.defaultCommitMessage:k.value=w.defaultCommitMessage)}function Me(){j({text:z(`@76872:正在暂存文件…`),showProgress:!1})}function Ne(){N()}function Pe(e){if(N(),e){R.value=!0;try{setTimeout(async()=>{try{console.log(z(`@76872:推送成功,状态已更新`))}catch(e){console.error(`一键推送后处理失败:`,e)}finally{R.value=!1}},1e3)}catch(e){console.error(`一键推送后处理失败:`,e),R.value=!1}}}function Fe(e){k.value=e,X.value=!1}async function Ie(e){if(!he.value||!$.value)return;let t=x.fileList.some(e=>!G(e.path,w.lockedFiles)),n=x.hasConflictedFiles;if(t&&$.value&&x.hasUpstream&&!n&&e.key===`Enter`&&!e.shiftKey){e.preventDefault();try{await Z.value?.triggerQuickPush()}catch(e){console.error(`回车自动一键提交失败:`,e)}}}async function Le(e){try{await w.saveDefaultMessage(e)&&E.success(z(`@76872:默认提交信息设置成功`))}catch(e){E.error(`${z(`@76872:设置默认提交信息失败: `)}${e.message}`)}}M(()=>x.pendingMergeMessage,e=>{e&&(V.value?(H.value=``,W.value=e):k.value=e,x.pendingMergeMessage=``,E.info(z(`@76872:已自动填充合并提交信息`)))}),M(()=>x.isAddingFiles,e=>{e&&A.visible&&ie(z(`@76872:正在暂存文件…`))}),M(()=>x.isCommiting,e=>{e&&A.visible&&ie(z(`@76872:正在提交更改...`))}),M(()=>x.isPushing,e=>{e&&A.visible&&N()}),s(async()=>{M(()=>w.config,Ee,{immediate:!0}),w.config||await w.loadConfig(),w.autoSetDefaultMessage&&w.defaultCommitMessage&&(V.value?W.value||=w.defaultCommitMessage:k.value||=w.defaultCommitMessage),x.pendingMergeMessage&&(V.value?(H.value=``,W.value=x.pendingMergeMessage):k.value=x.pendingMergeMessage,x.pendingMergeMessage=``,E.info(z(`@76872:已自动填充合并提交信息`)))});function Re(e,t){t([...e?de.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):de.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function ze(e,t){t([...e?fe.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):fe.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Be(e){e.isSettings?(ke(),W.value=``):W.value=e.value}function Ve(e){e.isSettings?(Ae(),U.value=``):U.value=e.value}function He(e,t){t([...e?be.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):be.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Ue(e){e.isSettings?(X.value=!0,k.value=``):k.value=e.value}return(t,n)=>{let s=re,u=b,w=d,T=o,E=l,j=v;return P(),_(C,null,[h(`div`,{class:y([`card app-card`,{"is-pushing":g(x).isPushing}])},[h(`div`,Ze,[h(`div`,Qe,[g(x).userName!==``&&g(x).userEmail!==``?(P(),i(Xe,{key:0,ref_key:`gitActionButtonsRef`,ref:Z,"has-user-commit-message":$.value,"final-commit-message":xe.value,"skip-hooks":me.value,"ai-generating":c.value,onAfterCommit:n[0]||=e=>{e&&je()},onAfterPush:Pe,onBeforePush:Me,onPushStart:Ne,onClearFields:je,onAiQuickPush:m},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`ai-generating`])):F(``,!0)])]),h(`div`,$e,[h(`div`,et,[g(x).userName===``||g(x).userEmail===``?(P(),_(`div`,tt,[e(s,{title:g(z)(`@76872:Git用户信息未配置`),type:`warning`,closable:!1,"show-icon":``},{default:O(()=>[h(`p`,null,f(g(z)(`@76872:您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:`)),1),n[11]||=h(`pre`,{class:`config-command`},`git config --global user.name "Your Name"
2
2
  git config --global user.email "your.email@example.com"`,-1)]),_:1},8,[`title`])])):(P(),_(C,{key:1},[g(x).isMergeInProgress?(P(),_(`div`,nt,[e(s,{title:g(z)(`@76872:合并进行中`),type:`warning`,closable:!1,"show-icon":``},{default:O(()=>[h(`span`,null,f(g(z)(`@76872:分支合并尚未完成,请输入提交信息后点击「提交」按钮完成合并。`)),1)]),_:1},8,[`title`])])):F(``,!0),h(`div`,rt,[V.value?(P(),_(`div`,ot,[h(`div`,st,[h(`div`,ct,[e(E,{modelValue:H.value,"onUpdate:modelValue":n[2]||=e=>H.value=e,placeholder:g(z)(`@76872:提交类型`),class:`type-select`,clearable:``},{default:O(()=>[(P(!0),_(C,null,ee(ye.value,e=>(P(),i(T,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),h(`div`,lt,[e(u,{modelValue:U.value,"onUpdate:modelValue":n[3]||=e=>U.value=e,"fetch-suggestions":ze,placeholder:g(z)(`@76872:作用域(可选)`),class:`scope-input`,clearable:``,onSelect:Ve},null,8,[`modelValue`,`placeholder`])]),h(`div`,ut,[e(u,{modelValue:W.value,"onUpdate:modelValue":n[4]||=e=>W.value=e,"fetch-suggestions":Re,placeholder:we.value,class:`description-input`,clearable:``,onSelect:Be,onKeydown:Ie},{suffix:O(()=>[e(se,{"custom-class":`ai-suffix-btn`,tooltip:g(z)(`@76872:AI生成提交信息`),"icon-class":r.value?``:`message-chatbot`,size:`small`,disabled:r.value,onClick:p},{default:O(()=>[r.value?(P(),i(w,{key:0,class:`is-loading`},{default:O(()=>[e(g(a))]),_:1})):F(``,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`])]),_:1},8,[`modelValue`,`placeholder`])])])]),h(`button`,{type:`button`,class:`advanced-options-toggle`,"aria-expanded":Q.value,onClick:n[5]||=e=>Q.value=!Q.value},[h(`span`,null,f(Q.value?g(z)(`@76872:收起`):g(z)(`@76872:正文及页脚`)),1),e(w,{class:y([`toggle-icon`,{"is-active":Q.value}])},{default:O(()=>[e(g(S))]),_:1},8,[`class`])],8,dt),te(h(`div`,ft,[e(j,{modelValue:K.value,"onUpdate:modelValue":n[6]||=e=>K.value=e,type:`textarea`,rows:4,placeholder:g(z)(`@76872:正文(可选):详细描述本次提交的内容和原因`),class:`body-input`,clearable:``},null,8,[`modelValue`,`placeholder`]),e(j,{modelValue:q.value,"onUpdate:modelValue":n[7]||=e=>q.value=e,placeholder:g(z)(`@76872:页脚(可选):如 Closes #123`),class:`footer-input`,clearable:``},null,8,[`modelValue`,`placeholder`])],512),[[ne,Q.value]])])):(P(),_(`div`,it,[h(`div`,at,[e(u,{modelValue:k.value,"onUpdate:modelValue":n[1]||=e=>k.value=e,"fetch-suggestions":He,placeholder:Ce.value,type:`textarea`,rows:3,resize:`none`,class:`commit-message-input`,onSelect:Ue,onKeydown:Ie},null,8,[`modelValue`,`placeholder`]),e(se,{"custom-class":`ai-suffix-btn ai-suffix-btn--ta`,tooltip:g(z)(`@76872:AI生成提交信息`),"icon-class":r.value?``:`message-chatbot`,size:`small`,disabled:r.value,onClick:p},{default:O(()=>[r.value?(P(),i(w,{key:0,class:`is-loading`},{default:O(()=>[e(g(a))]),_:1})):F(``,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`])])])),Se.value?F(``,!0):(P(),i(ce,{key:2,command:Te.value,title:g(z)(`@76872:提交命令预览:`),placeholder:`git commit -m "<提交信息>"`},null,8,[`command`,`title`]))])],64))])])],2),e(le,{visible:J.value,"onUpdate:visible":n[8]||=e=>J.value=e,type:`description`,title:g(z)(`@76872:简短描述模板设置`),placeholder:g(z)(`@76872:输入新模板内容`),"edit-placeholder":g(z)(`@76872:编辑模板内容`),"empty-description":g(z)(`@76872:暂无保存的模板`),onUseTemplate:De},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),e(le,{visible:Y.value,"onUpdate:visible":n[9]||=e=>Y.value=e,type:`scope`,title:g(z)(`@76872:作用域模板设置`),placeholder:g(z)(`@76872:输入新作用域模板`),"edit-placeholder":g(z)(`@76872:编辑作用域模板内容`),"empty-description":g(z)(`@76872:暂无保存的作用域`),onUseTemplate:Oe},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),e(le,{visible:X.value,"onUpdate:visible":n[10]||=e=>X.value=e,type:`message`,title:g(z)(`@76872:默认提交信息设置`),placeholder:g(z)(`@76872:输入新模板内容`),"edit-placeholder":g(z)(`@76872:编辑模板内容`),"empty-description":g(z)(`@76872:暂无保存的模板`),"show-default-section":!0,"show-help-text":!0,onUseTemplate:Fe,onSetDefault:Le},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),e(D,{name:`el-fade-in-linear`},{default:O(()=>[R.value?(P(),_(`div`,pt,[e(w,{class:`is-loading`},{default:O(()=>[e(g(a))]),_:1}),h(`span`,null,f(g(z)(`@76872:更新状态中...`)),1)])):F(``,!0)]),_:1}),e(pe,{visible:g(A).visible,text:g(A).text,"show-progress":g(A).showProgress,progress:g(A).progress},null,8,[`visible`,`text`,`show-progress`,`progress`]),e(ge,{visible:g(L).visible,text:g(L).text,description:g(L).description},null,8,[`visible`,`text`,`description`]),e(D,{name:`el-fade-in-linear`},{default:O(()=>[R.value?(P(),_(`div`,mt,[e(w,{class:`is-loading`},{default:O(()=>[e(g(a))]),_:1}),h(`span`,null,f(g(z)(`@76872:更新状态中...`)),1)])):F(``,!0)]),_:1})],64)}}}),[[`__scopeId`,`data-v-184a99b0`]]);export{ht as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Dn as i,E as a,Gr as o,In as s,Jr as c,Mn as l,Sn as u,Sr as d,Ur as f,Xn as p,er as m,ir as h,kn as g,lr as _,qn as v,wn as y,xn as b,z as x}from"./element-plus-axsKECfO.js";import{n as S,t as C}from"./_plugin-vue_export-helper-B-yhZnp1.js";s(),_(),t();var w=[`id`],T={class:`common-dialog__footer`},E=l({__name:`CommonDialog`,props:{modelValue:{type:Boolean},title:{},size:{default:`medium`},type:{default:`default`},width:{},height:{},top:{default:`50px`},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},customClass:{},modalClass:{},appendToBody:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},zIndex:{},showClose:{type:Boolean,default:!0},heightMode:{default:`max`},heightOffset:{default:`100px`},showFooter:{type:Boolean,default:!1},confirmText:{default:S(`@803A9:确定`)},cancelText:{default:S(`@803A9:取消`)},showCancel:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(t,{emit:s}){let l=t,_=s,S=b(()=>{if(l.width)return l.width;switch(l.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),C=m(),E=null;function D(){_(`opened`),n(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function O(){_(`closed`),E&&typeof E.focus==`function`&&(n(()=>E?.focus()),E=null)}function k(e){e&&!l.modelValue&&(E=document.activeElement),_(`update:modelValue`,e)}let A=b(()=>l.size===`fullscreen`?`0`:l.top),j=b(()=>{let e=[];return l.customClass&&e.push(l.customClass),l.type===`flex`&&e.push(`common-dialog--flex`),l.type===`full-height`&&e.push(`common-dialog--full-height`),l.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),M=b(()=>{if(l.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${l.heightOffset})`;return l.heightMode===`fixed`?{height:e}:{maxHeight:e}});function N(){_(`update:modelValue`,!1),_(`close`)}function P(){_(`confirm`)}function F(){_(`cancel`),N()}return(n,s)=>{let l=x;return v(),r(d(a),{"model-value":t.modelValue,title:t.title,width:S.value,top:A.value,style:o(M.value),"z-index":t.zIndex,fullscreen:t.size===`fullscreen`,"close-on-click-modal":t.closeOnClickModal,"close-on-press-escape":t.closeOnPressEscape,"destroy-on-close":t.destroyOnClose,draggable:t.draggable,class:f(j.value),"show-close":t.showClose,"modal-class":t.modalClass,"data-dialog-shell":`common`,"append-to-body":t.appendToBody,"lock-scroll":t.lockScroll,"aria-modal":!0,"aria-labelledby":d(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},i({header:h(({titleClass:e})=>[u(`span`,{id:d(C),class:f([`el-dialog__title`,e]),role:`heading`,"aria-level":`2`},c(t.title),11,w)]),default:h(()=>[p(n.$slots,`default`,{},void 0,!0)]),_:2},[t.showFooter||n.$slots.footer?{name:`footer`,fn:h(()=>[p(n.$slots,`footer`,{},()=>[u(`div`,T,[t.showCancel?(v(),r(l,{key:0,type:`button`,onClick:F},{default:h(()=>[g(c(t.cancelText),1)]),_:1})):y(``,!0),e(l,{type:`primary`,loading:t.confirmLoading,onClick:P},{default:h(()=>[g(c(t.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`show-close`,`modal-class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}}}),D=C(E,[[`__scopeId`,`data-v-6969f391`]]);export{D as t};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Dn as i,E as a,Gr as o,In as s,Jr as c,Mn as l,Sn as u,Sr as d,Ur as f,Xn as p,er as m,ir as h,kn as g,lr as _,qn as v,wn as y,xn as b,z as x}from"./element-plus-CN9J6t-d.js";import{n as S,t as C}from"./_plugin-vue_export-helper-B3dZvHQf.js";s(),_(),t();var w=[`id`],T={class:`common-dialog__footer`},E=l({__name:`CommonDialog`,props:{modelValue:{type:Boolean},title:{},size:{default:`medium`},type:{default:`default`},width:{},height:{},top:{default:`50px`},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},customClass:{},modalClass:{},appendToBody:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},zIndex:{},showClose:{type:Boolean,default:!0},heightMode:{default:`max`},heightOffset:{default:`100px`},showFooter:{type:Boolean,default:!1},confirmText:{default:S(`@803A9:确定`)},cancelText:{default:S(`@803A9:取消`)},showCancel:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(t,{emit:s}){let l=t,_=s,S=b(()=>{if(l.width)return l.width;switch(l.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),C=m(),E=null;function D(){_(`opened`),n(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function O(){_(`closed`),E&&typeof E.focus==`function`&&(n(()=>E?.focus()),E=null)}function k(e){e&&!l.modelValue&&(E=document.activeElement),_(`update:modelValue`,e)}let A=b(()=>l.size===`fullscreen`?`0`:l.top),j=b(()=>{let e=[];return l.customClass&&e.push(l.customClass),l.type===`flex`&&e.push(`common-dialog--flex`),l.type===`full-height`&&e.push(`common-dialog--full-height`),l.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),M=b(()=>{if(l.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${l.heightOffset})`;return l.heightMode===`fixed`?{height:e}:{maxHeight:e}});function N(){_(`update:modelValue`,!1),_(`close`)}function P(){_(`confirm`)}function F(){_(`cancel`),N()}return(n,s)=>{let l=x;return v(),r(d(a),{"model-value":t.modelValue,title:t.title,width:S.value,top:A.value,style:o(M.value),"z-index":t.zIndex,fullscreen:t.size===`fullscreen`,"close-on-click-modal":t.closeOnClickModal,"close-on-press-escape":t.closeOnPressEscape,"destroy-on-close":t.destroyOnClose,draggable:t.draggable,class:f(j.value),"show-close":t.showClose,"modal-class":t.modalClass,"data-dialog-shell":`common`,"append-to-body":t.appendToBody,"lock-scroll":t.lockScroll,"aria-modal":!0,"aria-labelledby":d(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},i({header:h(({titleClass:e})=>[u(`span`,{id:d(C),class:f([`el-dialog__title`,e]),role:`heading`,"aria-level":`2`},c(t.title),11,w)]),default:h(()=>[p(n.$slots,`default`,{},void 0,!0)]),_:2},[t.showFooter||n.$slots.footer?{name:`footer`,fn:h(()=>[p(n.$slots,`footer`,{},()=>[u(`div`,T,[t.showCancel?(v(),r(l,{key:0,type:`button`,onClick:F},{default:h(()=>[g(c(t.cancelText),1)]),_:1})):y(``,!0),e(l,{type:`primary`,loading:t.confirmLoading,onClick:P},{default:h(()=>[g(c(t.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`show-close`,`modal-class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}}}),D=C(E,[[`__scopeId`,`data-v-6969f391`]]);export{D as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Gn as i,Gr as a,In as o,Jr as s,Mn as c,On as ee,Sn as l,Sr as u,Tn as d,Un as f,Ur as p,W as m,Yn as h,_n as g,_r as te,ar as _,gn as ne,gr as v,hn as re,i as y,ir as ie,kn as b,ln as ae,lr as x,nr as S,on as C,pn as oe,qn as w,r as se,wn as T,xn as E,yn as ce}from"./element-plus-axsKECfO.js";import{n as D,t as O}from"./_plugin-vue_export-helper-B-yhZnp1.js";import{t as le}from"./SvgIcon-9MndOhWP.js";import{t as ue}from"./configStore-D9y28eJA.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e}from"./monaco-Bu9hROZs.js";import{r as k,t as A}from"./flow-mindmap-B4ponDC1.js";import{_t as ve,c as ye,ct as be,dt as xe,ft as Se,gt as j,ht as Ce,lt as we,mt as Te,pt as Ee,st as De,ut as Oe,vt as ke,w as Ae}from"./index-ArXbQKZJ.js";function je(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`}o(),x(),t();var M=[`data-media-kind`,`data-media-path`],Me={class:`media-preview-stage`},Ne={key:0,class:`media-preview-error`},N={class:`media-preview-error-title`},Pe={class:`media-preview-error-path`},Fe=[`src`],P={key:1,class:`media-preview-audio`},Ie=[`title`],Le=[`src`],Re={key:2,class:`media-preview-loading`},ze={class:`media-preview-footer`},Be={class:`media-preview-meta`},Ve=[`title`],He=O(c({__name:`MediaPreview`,props:{filePath:{},fileName:{}},setup(e){let t=e,n=E(()=>Ce(t.filePath)??`audio`),r=E(()=>j(t.filePath)),i=E(()=>t.fileName||t.filePath.split(/[\\/]/).pop()||``),a=v(!0),o=v(!1),c=v(0),f=v(0),p=v(0),m=v(0);async function h(){try{let e=await(await fetch(`/api/editor/file?path=${encodeURIComponent(t.filePath)}&meta=1`)).json();e?.success&&typeof e.size==`number`&&(f.value=e.size)}catch{}}S(()=>t.filePath,()=>{a.value=!0,o.value=!1,c.value=0,f.value=0,p.value=0,m.value=0,h()},{immediate:!0});function te(e){let t=e.target;Number.isFinite(t.duration)&&t.duration>0&&(c.value=t.duration),t instanceof HTMLVideoElement&&(p.value=t.videoWidth,m.value=t.videoHeight),a.value=!1}function _(){a.value=!1}function ne(){a.value=!1,o.value=!0}function re(e){if(!Number.isFinite(e)||e<=0)return`--:--`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(r).padStart(2,`0`);return i>0?`${i}:${a}:${String(n).padStart(2,`0`)}`:`${r}:${String(n).padStart(2,`0`)}`}function y(e){return!e||e<0?``:e>=1073741824?`${(e/1024/1024/1024).toFixed(2)} GB`:e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}let ie=E(()=>{let e=[n.value===`video`?D(`@EDITOR:视频`):D(`@EDITOR:音频`)];c.value>0&&e.push(re(c.value)),p.value>0&&m.value>0&&e.push(`${p.value} × ${m.value}`);let t=y(f.value);return t&&e.push(t),e.join(` · `)});return(e,c)=>(w(),d(`div`,{class:`media-preview`,"data-media-kind":n.value,"data-media-path":t.filePath},[l(`div`,Me,[o.value?(w(),d(`div`,Ne,[c[0]||=l(`svg`,{viewBox:`0 0 24 24`,width:`40`,height:`40`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`13`}),l(`line`,{x1:`12`,y1:`16.5`,x2:`12`,y2:`16.6`})],-1),l(`p`,N,s(u(D)(`@EDITOR:无法播放该文件,可能是编码或格式不受支持`)),1),l(`p`,Pe,s(t.filePath),1)])):(w(),d(g,{key:1},[n.value===`video`?(w(),d(`video`,{key:t.filePath,class:`media-preview-video`,src:r.value,controls:``,playsinline:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Fe)):(w(),d(`div`,P,[c[1]||=ee(`<div class="media-preview-glyph" aria-hidden="true" data-v-f05d705f><svg viewBox="0 0 24 24" width="46" height="46" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-f05d705f><path d="M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" data-v-f05d705f></path><path d="M9 17v-13h10v13" data-v-f05d705f></path><path d="M9 8h10" data-v-f05d705f></path></svg></div>`,1),l(`p`,{class:`media-preview-title`,title:t.filePath},s(i.value),9,Ie),(w(),d(`audio`,{key:t.filePath,class:`media-preview-audio-el`,src:r.value,controls:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Le))])),a.value?(w(),d(`div`,Re,[c[2]||=l(`span`,{class:`media-preview-spinner`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在载入媒体文件…`)),1)])):T(``,!0)],64))]),l(`div`,ze,[l(`span`,Be,s(ie.value),1),n.value===`video`?(w(),d(`span`,{key:0,class:`media-preview-name`,title:t.filePath},s(i.value),9,Ve)):T(``,!0)])],8,M))}}),[[`__scopeId`,`data-v-f05d705f`]]);o(),x();var Ue={class:`mindmap-preview`},We={class:`mindmap-preview-canvas`},Ge=O(c({__name:`MindmapPreview`,props:{content:{}},setup(t){let n=t,r=E(()=>A(n.content||``,`未命名文档`));return(t,n)=>(w(),d(`div`,Ue,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,We,[e(u(k),{data:r.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]),Ke=1080,qe=6e5,Je=.86;function F(e){if(!e||e.startsWith(`data:`))return!1;if(e.startsWith(`blob:`)||e.startsWith(`/`))return!0;try{return new URL(e,location.href).origin===location.origin}catch{return!1}}async function I(e){try{let t=await fetch(e);if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result||``),t.onerror=()=>e(``),t.readAsDataURL(n)})}catch{return null}}function Ye(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};if(typeof Image>`u`){r(e);return}let i=new Image,a=setTimeout(()=>r(e),4e3);i.onload=()=>{if(clearTimeout(a),!(i.naturalWidth>Ke||e.length>qe)){r(e);return}try{let t=Math.min(1,Ke/i.naturalWidth),n=Math.max(1,Math.round(i.naturalWidth*t)),a=Math.max(1,Math.round(i.naturalHeight*t)),o=document.createElement(`canvas`);o.width=n,o.height=a;let s=o.getContext(`2d`);if(!s){r(e);return}s.fillStyle=`#ffffff`,s.fillRect(0,0,n,a),s.drawImage(i,0,0,n,a),r(o.toDataURL(`image/jpeg`,Je))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function Xe(e){let t=await I(e);return t?Ye(t):null}async function Ze(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>F(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await Xe(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function Qe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var $e={h1:`font-size:26px;font-weight:700;line-height:1.35;margin:28px 0 16px;color:#111;`,h2:`font-size:22px;font-weight:700;line-height:1.4;margin:26px 0 14px;color:#111;`,h3:`font-size:19px;font-weight:700;line-height:1.45;margin:22px 0 12px;color:#222;`,h4:`font-size:17px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:#333;`,h5:`font-size:16px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#333;`,h6:`font-size:15px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#555;`,p:`font-size:16px;line-height:1.8;margin:16px 0;color:#333;`,li:`font-size:16px;line-height:1.8;margin:0 0 6px;color:#333;`,ul:`margin:16px 0;padding-left:24px;`,ol:`margin:16px 0;padding-left:24px;`,blockquote:`margin:16px 0;padding:8px 16px;border-left:4px solid #e2e2e2;background:#f7f7f7;color:#666;font-size:15px;line-height:1.8;`,hr:`border:none;border-top:1px solid #e5e5e5;margin:26px 0;`,a:`color:#576b95;text-decoration:none;`,strong:`font-weight:700;color:#111;`,em:`font-style:italic;color:#555;`,code:`font-family:Menlo,Consolas,Monaco,monospace;font-size:0.92em;background:#f2f3f5;color:#c7254e;padding:1px 5px;border-radius:3px;`,pre:`font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.6;background:#f6f8fa;color:#24292f;padding:12px 14px;border-radius:6px;overflow-x:auto;margin:16px 0;`,table:`border-collapse:collapse;width:100%;margin:16px 0;font-size:14px;`,th:`border:1px solid #e0e0e0;padding:8px 10px;background:#f6f8fa;font-weight:600;text-align:left;color:#333;`,td:`border:1px solid #e0e0e0;padding:8px 10px;color:#333;`,img:`max-width:100%;height:auto;display:block;margin:16px auto;border-radius:6px;`};function et(e){e.querySelectorAll(`*`).forEach(e=>{let t=$e[e.tagName.toLowerCase()];t&&e.setAttribute(`style`,t)}),e.querySelectorAll(`pre code`).forEach(e=>e.setAttribute(`style`,`background:none;padding:0;color:inherit;font-size:inherit;`))}async function tt(e,t){let n=e.cloneNode(!0),r=t?await Ze(n):0;return{html:n.innerHTML,leftover:r}}async function nt(e,t){let n=e.cloneNode(!0),r=t.inline?await Ze(n):0;et(n);let i=(t.title||``).trim();return{html:`<section style="font-size:16px;line-height:1.8;color:#333;word-break:break-word;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;">${i?`<h1 style="font-size:26px;font-weight:700;line-height:1.35;margin:0 0 22px;color:#111;">${Qe(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x(),t(),C();var rt={class:`sidebar-header`},it={class:`sidebar-title`},at={class:`sidebar-actions`},ot={class:`sidebar-search`},st=[`placeholder`,`title`],ct=[`title`,`aria-label`],lt={key:0,class:`sidebar-tree`},ut={key:0,class:`search-section-head`},dt={key:1,class:`tree-arrow-spacer`},ft={class:`tree-icon mit-icon`,"aria-hidden":`true`},pt=[`xlink:href`],mt=[`onClick`,`onContextmenu`],ht={key:1,class:`tree-arrow-spacer`},gt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},_t=[`xlink:href`],vt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},yt=[`xlink:href`],bt=[`title`],xt={key:0,class:`tree-name-hit`},St={key:4,class:`tree-loading`},Ct={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},wt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Tt=[`placeholder`],Et={key:1,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Dt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Ot={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},kt=[`placeholder`],At=[`data-query`],jt={key:0,class:`content-results-status`},Mt={class:`search-section-head`},Nt={class:`search-section-count`},Pt={key:0,class:`search-section-note`},Ft=[`title`,`onClick`],It={class:`tree-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={class:`content-hit-name`},zt={class:`content-hit-dir`},Bt={class:`content-hit-total`},Vt=[`title`,`onClick`],Ht={class:`content-hit-ln`},Ut={class:`content-hit-text`},Wt={key:0,class:`content-hit-mark`},Gt={key:3,class:`tree-empty`},Kt={key:1,class:`sidebar-loading`},qt={class:`editor-main`},Jt={class:`editor-tabs`},Yt=[`onClick`,`title`],Xt={class:`tab-name`},Zt={key:0,class:`tab-dirty-dot`},Qt=[`onClick`],$t=[`title`],en=[`disabled`,`title`],tn={class:`editor-body`},nn={key:1,class:`image-tab-placeholder`},rn={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`}},an={class:`image-tab-placeholder-title`},on={class:`image-tab-placeholder-hint`},sn={class:`preview-header`},cn={class:`preview-title`},ln={class:`preview-ext-badge`},un=[`title`],dn={class:`preview-body`},fn={key:0,class:`preview-copybar`},pn=[`disabled`,`title`],mn=[`disabled`,`title`],hn=[`disabled`,`title`],gn=[`title`],_n=[`sandbox`,`srcdoc`],vn=2,yn=6e4,bn=3e4,xn=300,Sn=320,Cn=O(c({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new _e:t===`css`||t===`scss`||t===`less`?new he:t===`html`||t===`handlebars`||t===`razor`?new de:t===`typescript`||t===`javascript`?new pe:new fe}};let o=t,c=ue(),x=Ae(),C=v([]),O=v(!1),k=v(``),A=v(``),j=null;function Ce(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)});let M=v([]),Me=v(0),Ne=v(``),N=v(!1),Pe=v(!1),Fe=null,P=0;function Ie(){Fe?.abort(),Fe=null,P+=1,M.value=[],Me.value=0,Ne.value=``,N.value=!1,Pe.value=!1}async function Le(e){let t=e.trim(),n=c.currentDirectory;if(!n||t.length<vn){Ie();return}if(t===Ne.value&&N.value)return;Fe?.abort();let r=++P,i=new AbortController;Fe=i,N.value=!0,Ne.value=t;try{let e=await(await fetch(`/api/search_content`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n,query:t}),signal:i.signal})).json().catch(()=>null);if(r!==P)return;if(!e?.success){M.value=[],Me.value=0,Pe.value=!1;return}M.value=Array.isArray(e.files)?e.files:[],Me.value=typeof e.totalMatches==`number`?e.totalMatches:0,Pe.value=!!e.truncated}catch(e){if(e?.name===`AbortError`||r!==P)return;M.value=[],Me.value=0,Pe.value=!1}finally{r===P&&(N.value=!1)}}S(A,e=>{Le(e)}),f(()=>{j&&clearTimeout(j),Fe?.abort(),Be(),Qn()});let Re=null;function ze(){Be(),c.ui.fileTreeAutoRefresh&&(Re=setInterval(()=>{document.hidden||c.currentDirectory&&(k.value.trim()||F())},yn))}function Be(){Re&&=(clearInterval(Re),null)}S(()=>c.currentDirectory,async()=>{if(Pn=!1,Ie(),ze(),await Ue(),L.value.some(e=>e.isDirty)){Pn=!0;return}L.value=[],R.value=null,Bn(),await Ln()}),S(()=>c.ui.fileTreeAutoRefresh,()=>{ze()});async function Ve(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 Ue(){let e=c.currentDirectory;if(e){O.value=!0;try{C.value=await Ve(e,0)}finally{O.value=!1}}}function We(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&We(n.children,t));return t}function Ke(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=Ke(e.children,t+1),n.expanded=!0),n})}async function qe(e){let t=c.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:Ke(n.items,0)}catch{return null}}function Je(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)?Je(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function F(e={}){if(!c.currentDirectory)return;let t=await qe([...We(C.value)]);if(!t){e.notifyOnError&&y.error(D(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Je(C.value,t)&&(C.value=t)}async function I(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ve(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ye(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ye(n.children));return t}let Xe=E(()=>A.value.trim().toLowerCase());function Ze(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.name.toLowerCase().includes(t);if(r.type===`directory`){let i=r.children?Ze(r.children,t):[];if(!e&&i.length===0)continue;n.push({...r,expanded:!0,children:r.children===void 0?void 0:i})}else e&&n.push(r)}return n}function Qe(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=Qe(n.children,t);if(e)return e}}return null}let $e=E(()=>Ze(C.value,Xe.value)),et=E(()=>Xe.value.length>0&&$e.value.length===0),Cn=E(()=>et.value&&M.value.length===0&&!N.value);function wn(e){let t=A.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}async function Tn(e,t){if(await kn({name:e.name,path:e.path,type:`file`,depth:0}),!t||t<1)return;await n();let r=B.value;r&&r.getModel()&&jn()?.path===e.path&&(r.revealLineInCenter(t,ge.ScrollType.Smooth),r.setPosition({lineNumber:t,column:1}),r.focus())}let En=v(null);function Dn(){let e=En.value;e&&(e.focus(),e.select())}function On(){k.value?(Ce(),En.value?.focus()):(En.value?.blur(),B.value?.focus())}let L=v([]),R=v(null),z=v(null);async function kn(e){if(z.value=e,e.type!==`file`){I(Qe(C.value,e.path)??e);return}let t=L.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:L.value.length}),t){R.value=e.path,n(()=>Hn());return}let r=e.name.split(`.`).pop()||``;if(Te.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null};L.value.push(t),R.value=e.path;return}if(Ir.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};L.value.push(t),R.value=e.path,J.value=!0;return}if(Ee(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};L.value.push(t),R.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),n=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:n}),!n.success){y.error(`${D(`@EDITOR:打开文件失败: `)}${n.error}`);return}let i=je(r),a=V.get(e.path);a&&!a.isDisposed()&&a.setValue(n.content);let o={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:i,diskMtimeMs:typeof n.mtimeMs==`number`?n.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),L.value.push(o),R.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,L.value.length,`activeTabPath=`,R.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),y.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await n();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await kn({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function An(e,t){t.stopPropagation();let n=L.value.findIndex(t=>t.path===e);n!==-1&&(!L.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(L.value.splice(n,1),R.value===e&&(R.value=L.value[Math.min(n,L.value.length-1)]?.path??null))}let jn=()=>L.value.find(e=>e.path===R.value)??null,Mn=E(()=>({expandedDirs:[...We(C.value)],tabs:L.value.map(e=>e.path),activeTab:R.value})),Nn=!1,Pn=!1;function Fn(){Pn&&!Nn&&c.isUiLoaded&&c.saveEditorWorkspace(Mn.value)}S(Mn,()=>Fn());async function In(e){if(L.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Te.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null});return}if(Ir.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Ee(t)){L.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=V.get(e);i&&!i.isDisposed()&&B.value?.getModel()!==i&&(i.dispose(),V.delete(e)),L.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:je(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Ln(){try{for(let e=0;e<100&&!c.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!c.isUiLoaded)return;rr.value=c.ui.editorSidebarWidth;let e=c.getEditorWorkspace();if(!e)return;Nn=!0;try{if(e.expandedDirs.length>0){let t=await qe(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await In(t);if(!o.pendingFilePath&&e.activeTab&&L.value.some(t=>t.path===e.activeTab)){R.value=e.activeTab;let t=jn(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Ir.has(n)||Ee(t.name))&&(J.value=!0)}}finally{Nn=!1}}finally{Pn=!0,Fn()}}let Rn=v(null),B=te(null),V=new Map;function zn(e){let t=V.get(e.path);return(!t||t.isDisposed())&&(t=ge.createModel(e.content,e.language,me.file(e.path)),V.set(e.path,t)),t}function Bn(){B.value?.setModel(null);for(let e of V.values())e.isDisposed()||e.dispose();V.clear()}function Vn(){if(!Rn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;B.value=ge.create(Rn.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}),B.value.onDidChangeModelContent(()=>{let e=jn();if(!e)return;let t=B.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),B.value.onDidBlurEditorText(()=>{c.ui.editorAutoSave&&jn()?.isDirty&&tr(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Hn()})})}S(R,e=>{if(!B.value||!e)return;let t=L.value.find(t=>t.path===e);if(!t)return;let r=zn(t);B.value.setModel(r),n(()=>Hn()),Jn(e)});function Hn(){if(!B.value)return;B.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let Un=0,Wn=new Map;async function Gn(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 Kn(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 qn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=V.get(e.path);if(!r||r.isDisposed())return;let i=B.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 Jn(e){if(!e)return;let t=L.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++Un,r=await Gn(e);if(n!==Un||L.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Wn.get(e)===r.mtimeMs)return;Wn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Kn(e);i&&L.value.find(t=>t.path===e)===t&&qn(t,i.content,i.mtimeMs)}function Yn(){document.hidden||Jn(R.value)}let Xn=null;function Zn(){Qn(),Xn=setInterval(()=>{document.hidden||Jn(R.value)},bn)}function Qn(){Xn&&=(clearInterval(Xn),null)}S(()=>L.value.filter(e=>e.isDirty).length,e=>{x.setDirtyCount(e)},{immediate:!0}),S(R,e=>{let t=L.value.find(t=>t.path===e)??null;x.setActiveFile(t?.path??``,t?.name??``)},{immediate:!0}),f(()=>x.setDirtyCount(0)),Se(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ge.setTheme(e?`vs-dark`:`vs`)});let $n=null;function er(){if($n||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}$n=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&R.value&&B.value&&(Jn(R.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Hn()}))});let n=$n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}i(async()=>{Vn(),await Ue(),await Ln(),er(),ze(),window.addEventListener(`focus`,Yn),document.addEventListener(`visibilitychange`,Yn),Zn(),R.value&&n(()=>Hn())}),f(()=>{$n?.disconnect(),$n=null,window.removeEventListener(`focus`,Yn),document.removeEventListener(`visibilitychange`,Yn),B.value?.dispose(),V.forEach(e=>e.dispose()),V.clear()});async function tr(e=!1){let t=jn();if(t&&!(Rr.value||zr.value||Br.value))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){y.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||y.success(D(`@EDITOR:已保存`))}catch(e){y.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function nr(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Dn();return}t&&e.key===`s`&&(e.preventDefault(),tr())}i(()=>window.addEventListener(`keydown`,nr)),f(()=>window.removeEventListener(`keydown`,nr));let H=v(null),rr=v(c.ui.editorSidebarWidth),ir=!1,ar=0,or=0;function sr(e){ir=!0,ar=e.clientX,or=rr.value,document.addEventListener(`mousemove`,cr),document.addEventListener(`mouseup`,lr),e.preventDefault()}function cr(e){if(!ir)return;let t=e.clientX-ar;rr.value=Math.max(140,Math.min(400,or+t))}function lr(){ir=!1,document.removeEventListener(`mousemove`,cr),document.removeEventListener(`mouseup`,lr),rr.value!==c.ui.editorSidebarWidth&&c.setEditorSidebarWidth(rr.value)}function ur(e){return e.type===`directory`?ke(e.name):ve(e.name)}let U=v(null),W=v(null),G=v(null),dr=v(null);function fr(){let e=z.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(/[\\/][^\\/]+$/,``):c.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:c.currentDirectory??``,afterNode:null,depth:0}}async function pr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`file`,value:``},await n(),G.value?.focus()}async function mr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`directory`,value:``},await n(),G.value?.focus()}function hr(){U.value=null}async function gr(){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){y.error(e.error);return}y.success(D(`@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){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}U.value=null,await F()}function _r(e){e.key===`Enter`&&(e.preventDefault(),gr()),e.key===`Escape`&&(e.preventDefault(),hr())}let K=v(null),vr=v(null);function yr(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function br(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`file`,value:``},await n(),G.value?.focus()}async function xr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`directory`,value:``},await n(),G.value?.focus()}async function Sr(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await n(),dr.value?.focus(),dr.value?.select())}async function Cr(){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){y.error(r.error);return}let i=L.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,R.value===e.node.path&&(R.value=n)),W.value=null,await F()}function wr(e){e.key===`Enter`&&(e.preventDefault(),Cr()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Tr(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){y.error(n.error);return}let r=L.value.findIndex(t=>t.path===e.path);r!==-1&&(L.value.splice(r,1),R.value===e.path&&(R.value=L.value[Math.max(0,r-1)]?.path??null)),y.success(D(`@EDITOR:已删除`)),await F()}async function Er(){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||y.error(t.error)}catch(e){y.error(e?.message||String(e))}}function Dr(e){let t=c.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 Or(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 kr(){let e=K.value?.node;q(),e&&(await Or(e.path)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function Ar(){let e=K.value?.node;q(),e&&(await Or(Dr(e.path))?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function jr(){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||y.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){y.error(e?.message||String(e))}}let Mr=new Set([`html`,`htm`]),Nr=E(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Mr.has(t)});async function Pr(){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||y.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){y.error(e?.message||String(e))}}i(()=>{document.addEventListener(`click`,q)}),f(()=>{document.removeEventListener(`click`,q)});let Fr=new Set([`md`,`html`,`htm`,`svg`]),Ir=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),Lr=v(0),X=E(()=>L.value.find(e=>e.path===R.value)??null),Rr=E(()=>X.value?.language===`plaintext`&&X.value?.content===``),zr=E(()=>X.value?.language===`office`),Br=E(()=>X.value?.language===`media`),Z=E(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Vr=E(()=>Fr.has(Z.value)||Ir.has(Z.value)||Ee(Z.value)),Hr=E(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Ur=E(()=>Z.value===`md`&&Hr.value>0);S(R,()=>{J.value&&!Vr.value&&(J.value=!1),Y.value&&!Ur.value&&(Y.value=!1)});function Wr(){Vr.value&&(J.value||(Y.value=!1),J.value=!J.value)}function Gr(){Ur.value&&(Y.value||(J.value=!1),Y.value=!Y.value)}let Kr=E(()=>Lr.value<=0||L.value.length===0?{flexBasis:`0px`}:{flex:`0 0 ${Lr.value}px`,maxWidth:`calc(100% - 320px)`}),qr=v(null),Q=v(!1),$=v(``),Jr=v(!0),Yr=null,Xr=E(()=>!Y.value&&J.value&&Z.value===`md`&&!!X.value);function Zr(){return X.value?.content??``}function Qr(){return Zr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function $r(e,t,n){if(!e){y.error(D(`@EDITOR:复制失败`));return}$.value=n,Yr&&clearTimeout(Yr),Yr=setTimeout(()=>{$.value=``},1800),t>0?y.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):y.success(D(`@EDITOR:已复制`))}async function ei(){$r(await Or(Zr()),0,`md`)}async function ti(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await tt(e,Jr.value);$r(await Or(t),n,`html`)}finally{Q.value=!1}}}function ni(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0;`,t.innerHTML=e,document.body.appendChild(t);try{let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n);let r=document.execCommand(`copy`);return e?.removeAllRanges(),r}catch{return!1}finally{document.body.removeChild(t)}}async function ri(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await nt(e,{inline:Jr.value,title:Qr()}),r=Zr(),i=!1;try{navigator.clipboard?.write&&typeof ClipboardItem<`u`&&(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([r],{type:`text/plain`})})]),i=!0)}catch{i=!1}i||=ni(t),$r(i,n,`rich`)}finally{Q.value=!1}}}let ii=E(()=>{let e=X.value;if(!e)return``;let t=Z.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?be(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>`:``}),ai=!1,oi=0,si=0,ci=0;function li(e){let t=e.currentTarget,n=t.parentElement;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();ai=!0,oi=e.clientX,si=r.right-i.right,ci=Math.max(xn,r.width-Sn),document.addEventListener(`mousemove`,ui),document.addEventListener(`mouseup`,di),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,e.preventDefault()}function ui(e){if(!ai)return;let t=oi-e.clientX;Lr.value=Math.round(Math.max(xn,Math.min(ci,si+t)))}function di(){ai=!1,document.removeEventListener(`mousemove`,ui),document.removeEventListener(`mouseup`,di),document.body.style.cursor=``,document.body.style.userSelect=``}return(t,n)=>(w(),d(g,null,[l(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[l(`div`,{class:`editor-sidebar`,style:a({width:rr.value+`px`})},[l(`div`,rt,[l(`span`,it,s(u(D)(`@EDITOR:资源管理器`)),1),l(`div`,at,[e(u(m),{content:u(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:pr},[...n[11]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:mr},[...n[12]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:n[0]||=e=>F({notifyOnError:!0})},[...n[13]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),l(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,ot,[n[15]||=l(`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`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),_(l(`input`,{ref_key:`searchInputRef`,ref:En,"onUpdate:modelValue":n[1]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:u(D)(`@EDITOR:搜索文件名或内容...`),title:u(D)(`@EDITOR:搜索文件名或内容...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(On,[`escape`])},null,40,st),[[oe,k.value]]),k.value?(w(),d(`button`,{key:0,class:`sidebar-search-clear`,title:u(D)(`@EDITOR:清除搜索`),"aria-label":u(D)(`@EDITOR:清除搜索`),onClick:Ce},[...n[14]||=[l(`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`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,ct)):T(``,!0)]),O.value?(w(),d(`div`,Kt,[...n[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(w(),d(`div`,lt,[Xe.value&&$e.value.length>0?(w(),d(`div`,ut,s(u(D)(`@EDITOR:名称匹配`)),1)):T(``,!0),(w(!0),d(g,null,h(Ye($e.value),e=>(w(),d(g,{key:e.path},[W.value&&W.value.node.path===e.path?(w(),d(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[16]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,dt)),(w(),d(`svg`,ft,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,pt)])),_(l(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:dr,"onUpdate:modelValue":n[2]||=e=>W.value.value=e,onKeydown:wr,onBlur:Cr,onClick:n[3]||=ne(()=>{},[`stop`])},null,544),[[oe,W.value.value]])],4)):(w(),d(`div`,{key:1,class:p([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":R.value===e.path,"tree-node--selected":z.value?.path===e.path&&R.value!==e.path}]),style:a({paddingLeft:12+e.depth*14+`px`}),onClick:t=>kn(e),onContextmenu:t=>yr(t,e)},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,ht)),e.type===`directory`?(w(),d(`svg`,gt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,_t)])):(w(),d(`svg`,vt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,yt)])),l(`span`,{class:`tree-name`,title:e.path},[(w(!0),d(g,null,h(wn(e.name),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,xt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))],8,bt),e.loading?(w(),d(`span`,St)):T(``,!0)],46,mt)),U.value&&U.value.afterNode?.path===e.path?(w(),d(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+U.value.depth*14+`px`})},[n[20]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Ct,[...n[18]||=[l(`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)]])):(w(),d(`svg`,wt,[...n[19]||=[l(`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),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[5]||=ne(()=>{},[`stop`])},null,40,Tt),[[oe,U.value.value]])],4)):T(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(w(),d(`div`,Et,[n[23]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Dt,[...n[21]||=[l(`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)]])):(w(),d(`svg`,Ot,[...n[22]||=[l(`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),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[7]||=ne(()=>{},[`stop`])},null,40,kt),[[oe,U.value.value]])])):T(``,!0),Xe.value?(w(),d(`div`,{key:2,class:`content-results`,"data-query":Ne.value},[N.value?(w(),d(`div`,jt,[n[24]||=l(`span`,{class:`content-search-spin`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在搜索文件内容...`)),1)])):M.value.length>0?(w(),d(g,{key:1},[l(`div`,Mt,[l(`span`,null,s(u(D)(`@EDITOR:内容匹配`)),1),l(`span`,Nt,s(Me.value),1),Pe.value?(w(),d(`span`,Pt,s(u(D)(`@EDITOR:结果过多,已截断`)),1)):T(``,!0)]),(w(!0),d(g,null,h(M.value,e=>(w(),d(`div`,{key:e.path,class:`content-hit`},[l(`div`,{class:`content-hit-file`,title:e.relPath,onClick:t=>Tn(e,e.matches[0]?.line)},[(w(),d(`svg`,It,[l(`use`,{"xlink:href":`#${u(ve)(e.name)}`},null,8,Lt)])),l(`span`,Rt,s(e.name),1),l(`span`,zt,s(e.dir),1),l(`span`,Bt,s(e.total),1)],8,Ft),(w(!0),d(g,null,h(e.matches,t=>(w(),d(`div`,{key:`${e.path}:${t.line}`,class:`content-hit-line`,title:u(D)(`@EDITOR:点击跳到该行`),onClick:n=>Tn(e,t.line)},[l(`span`,Ht,s(t.line),1),l(`span`,Ut,[(w(!0),d(g,null,h(wn(t.text),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,Wt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))])],8,Vt))),128))]))),128))],64)):T(``,!0)],8,At)):T(``,!0),!U.value&&(Cn.value||C.value.length===0)?(w(),d(`div`,Gt,s(Cn.value?u(D)(`@EDITOR:未找到匹配文件`):u(D)(`@EDITOR:暂无文件`)),1)):T(``,!0)]))],4),l(`div`,{class:`editor-resizer`,onMousedown:sr},null,32),l(`div`,qt,[l(`div`,Jt,[(w(!0),d(g,null,h(L.value,e=>(w(),d(`div`,{key:e.path,class:p([`editor-tab`,{active:R.value===e.path,dirty:e.isDirty}]),onClick:t=>R.value=e.path,title:e.path},[l(`span`,Xt,s(e.name),1),e.isDirty?(w(),d(`span`,Zt)):T(``,!0),l(`button`,{class:`tab-close`,onClick:t=>An(e.path,t)},[...n[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Qt)],10,Yt))),128)),n[29]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),Vr.value?(w(),d(`button`,{key:0,class:p([`preview-toggle-btn`,{active:J.value}]),title:J.value?u(D)(`@EDITOR:关闭预览`):u(D)(`@EDITOR:打开预览`),onClick:Wr},[n[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0`}),l(`path`,{d:`M21 12c-2.4 4-5.4 6-9 6c-3.6 0-6.6-2-9-6c2.4-4 5.4-6 9-6c3.6 0 6.6 2 9 6`})],-1),l(`span`,null,s(u(D)(`@EDITOR:预览`)),1)],10,$t)):T(``,!0),Ur.value?(w(),d(`button`,{key:1,class:p([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!Ur.value}]),disabled:!Ur.value,title:Ur.value?Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:打开思维导图`):u(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Gr},[n[28]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" data-v-2b76e179><path d="M8 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M8 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M14 12a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M7.5 7.5l3 3" data-v-2b76e179></path><path d="M7.5 16.5l3-3" data-v-2b76e179></path><path d="M13.5 13.5l3 3" data-v-2b76e179></path><path d="M16.5 7.5l-3 3" data-v-2b76e179></path></svg>`,1),l(`span`,null,s(u(D)(`@EDITOR:思维导图`)),1)],10,en)):T(``,!0)]),L.value.length===0?(w(),r(ye,{key:0,class:`editor-empty`,title:u(D)(`@EDITOR:从左侧选择文件打开`),hint:u(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ie(()=>[...n[30]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`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`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):T(``,!0),l(`div`,tn,[l(`div`,{class:p([`monaco-container`,{hidden:L.value.length===0||Rr.value||zr.value||Br.value}]),ref_key:`editorContainerRef`,ref:Rn},null,2),Br.value&&X.value?(w(),r(He,{key:X.value.path,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):T(``,!0),Rr.value&&L.value.length>0&&!J.value&&!Y.value?(w(),d(`div`,nn,[(w(),d(`svg`,rn,[...n[31]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,an,s(X.value?.name),1),l(`p`,on,s(u(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:2,class:`preview-resizer`,onMousedown:li},null,32)):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:3,class:`preview-panel`,style:a(Kr.value)},[l(`div`,sn,[l(`span`,cn,s(Y.value?u(D)(`@EDITOR:思维导图`):u(D)(`@EDITOR:预览`)),1),l(`span`,ln,s(Z.value.toUpperCase()),1),n[33]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:关闭预览`),onClick:n[8]||=e=>Y.value?Y.value=!1:J.value=!1},[...n[32]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,un)]),l(`div`,dn,[Xr.value?(w(),d(`div`,fn,[l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制 Markdown 源码`),onClick:ei},[n[34]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,s($.value===`md`?u(D)(`@EDITOR:已复制`):`Markdown`),1)],10,pn),l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:ti},[n[35]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,s($.value===`html`?u(D)(`@EDITOR:已复制`):`HTML`),1)],10,mn),l(`button`,{class:p([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:ri},[n[36]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,s(Q.value?u(D)(`@EDITOR:转换图片中…`):$.value===`rich`?u(D)(`@EDITOR:已复制`):u(D)(`@EDITOR:复制富文本`)),1)],10,hn),l(`label`,{class:`preview-copy-embed`,title:u(D)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[_(l(`input`,{"onUpdate:modelValue":n[9]||=e=>Jr.value=e,type:`checkbox`},null,512),[[ae,Jr.value]]),l(`span`,null,s(u(D)(`@EDITOR:图片转 Base64`)),1)],8,gn)])):T(``,!0),Y.value&&Z.value===`md`&&X.value?(w(),r(Ge,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Z.value===`md`&&X.value?(w(),r(Oe,{ref_key:`mdPreviewRef`,ref:qr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):J.value&&[`html`,`htm`,`svg`].includes(Z.value)?(w(),d(`iframe`,{key:3,class:`preview-iframe`,sandbox:u(De),srcdoc:ii.value},null,8,_n)):J.value&&u(Ir).has(Z.value)&&X.value?(w(),r(xe,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):J.value&&zr.value&&X.value?(w(),r(we,{key:5,"file-path":X.value.path},null,8,[`file-path`])):T(``,!0)])],4)):T(``,!0)])])],512),(w(),r(ce,{to:`body`},[K.value?(w(),d(`div`,{key:0,ref_key:`ctxMenuRef`,ref:vr,class:`ctx-menu`,style:a({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:n[10]||=ne(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:br},[n[37]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:xr},[n[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件夹`)),1)]),n[45]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:kr},[n[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667-2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1-2.667 2.667h-8.666a2.667 2.667 0 0 1-2.667-2.667l0-8.666`}),l(`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1-1.012-1.737v-10c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1`})],-1),b(` `+s(u(D)(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Ar},[n[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M9 15l6-6`}),l(`path`,{d:`M11 6l.463-.536a5 5 0 0 1 7.071 7.072l-.534.464`}),l(`path`,{d:`M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0a4.972 4.972 0 0 1 0-7.071l.524-.463`})],-1),b(` `+s(u(D)(`@EDITOR:复制相对路径`)),1)]),n[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),Nr.value?(w(),d(`button`,{key:0,class:`ctx-menu-item`,onClick:Pr},[n[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0`}),l(`path`,{d:`M3.6 9h16.8`}),l(`path`,{d:`M3.6 15h16.8`}),l(`path`,{d:`M11.5 3a17 17 0 0 0 0 18`}),l(`path`,{d:`M12.5 3a17 17 0 0 1 0 18`})],-1),b(` `+s(u(D)(`@EDITOR:在浏览器中打开`)),1)])):T(``,!0),l(`button`,{class:`ctx-menu-item`,onClick:Er},[n[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M5 19l2.757-7.351a1 1 0 0 1 .936-.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1-1.964 1.625h-14.026a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2`})],-1),b(` `+s(u(D)(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:jr},[e(le,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),b(` `+s(u(D)(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Sr},[n[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 7h-1a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1`}),l(`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97l-8.415 8.385v3h3l8.385-8.415`}),l(`path`,{d:`M16 5l3 3`})],-1),b(` `+s(u(D)(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Tr},[n[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M4 7l16 0`}),l(`path`,{d:`M10 11l0 6`}),l(`path`,{d:`M14 11l0 6`}),l(`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12`}),l(`path`,{d:`M9 7v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})],-1),b(` `+s(u(D)(`@EDITOR:删除`)),1)])],4)):T(``,!0)]))],64))}}),[[`__scopeId`,`data-v-2b76e179`]]);export{Cn as default};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Gn as i,Gr as a,In as o,Jr as s,Mn as c,On as ee,Sn as l,Sr as u,Tn as d,Un as f,Ur as p,W as m,Yn as h,_n as g,_r as te,ar as _,gn as ne,gr as v,hn as re,i as y,ir as ie,kn as b,ln as ae,lr as x,nr as S,on as C,pn as oe,qn as w,r as se,wn as T,xn as E,yn as ce}from"./element-plus-CN9J6t-d.js";import{n as D,t as O}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as le}from"./SvgIcon-XBkgNKCj.js";import{t as ue}from"./configStore-HDlssep1.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e}from"./monaco-irXl5Eu9.js";import{r as k,t as A}from"./flow-mindmap-CyZrdnd4.js";import{_t as ve,c as ye,ct as be,dt as xe,ft as Se,gt as j,ht as Ce,lt as we,mt as Te,pt as Ee,st as De,ut as Oe,vt as ke,w as Ae}from"./index-CAWXBaPa.js";function je(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`}o(),x(),t();var M=[`data-media-kind`,`data-media-path`],Me={class:`media-preview-stage`},Ne={key:0,class:`media-preview-error`},N={class:`media-preview-error-title`},Pe={class:`media-preview-error-path`},Fe=[`src`],P={key:1,class:`media-preview-audio`},Ie=[`title`],Le=[`src`],Re={key:2,class:`media-preview-loading`},ze={class:`media-preview-footer`},Be={class:`media-preview-meta`},Ve=[`title`],He=O(c({__name:`MediaPreview`,props:{filePath:{},fileName:{}},setup(e){let t=e,n=E(()=>Ce(t.filePath)??`audio`),r=E(()=>j(t.filePath)),i=E(()=>t.fileName||t.filePath.split(/[\\/]/).pop()||``),a=v(!0),o=v(!1),c=v(0),f=v(0),p=v(0),m=v(0);async function h(){try{let e=await(await fetch(`/api/editor/file?path=${encodeURIComponent(t.filePath)}&meta=1`)).json();e?.success&&typeof e.size==`number`&&(f.value=e.size)}catch{}}S(()=>t.filePath,()=>{a.value=!0,o.value=!1,c.value=0,f.value=0,p.value=0,m.value=0,h()},{immediate:!0});function te(e){let t=e.target;Number.isFinite(t.duration)&&t.duration>0&&(c.value=t.duration),t instanceof HTMLVideoElement&&(p.value=t.videoWidth,m.value=t.videoHeight),a.value=!1}function _(){a.value=!1}function ne(){a.value=!1,o.value=!0}function re(e){if(!Number.isFinite(e)||e<=0)return`--:--`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(r).padStart(2,`0`);return i>0?`${i}:${a}:${String(n).padStart(2,`0`)}`:`${r}:${String(n).padStart(2,`0`)}`}function y(e){return!e||e<0?``:e>=1073741824?`${(e/1024/1024/1024).toFixed(2)} GB`:e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}let ie=E(()=>{let e=[n.value===`video`?D(`@EDITOR:视频`):D(`@EDITOR:音频`)];c.value>0&&e.push(re(c.value)),p.value>0&&m.value>0&&e.push(`${p.value} × ${m.value}`);let t=y(f.value);return t&&e.push(t),e.join(` · `)});return(e,c)=>(w(),d(`div`,{class:`media-preview`,"data-media-kind":n.value,"data-media-path":t.filePath},[l(`div`,Me,[o.value?(w(),d(`div`,Ne,[c[0]||=l(`svg`,{viewBox:`0 0 24 24`,width:`40`,height:`40`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`13`}),l(`line`,{x1:`12`,y1:`16.5`,x2:`12`,y2:`16.6`})],-1),l(`p`,N,s(u(D)(`@EDITOR:无法播放该文件,可能是编码或格式不受支持`)),1),l(`p`,Pe,s(t.filePath),1)])):(w(),d(g,{key:1},[n.value===`video`?(w(),d(`video`,{key:t.filePath,class:`media-preview-video`,src:r.value,controls:``,playsinline:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Fe)):(w(),d(`div`,P,[c[1]||=ee(`<div class="media-preview-glyph" aria-hidden="true" data-v-f05d705f><svg viewBox="0 0 24 24" width="46" height="46" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-f05d705f><path d="M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" data-v-f05d705f></path><path d="M9 17v-13h10v13" data-v-f05d705f></path><path d="M9 8h10" data-v-f05d705f></path></svg></div>`,1),l(`p`,{class:`media-preview-title`,title:t.filePath},s(i.value),9,Ie),(w(),d(`audio`,{key:t.filePath,class:`media-preview-audio-el`,src:r.value,controls:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Le))])),a.value?(w(),d(`div`,Re,[c[2]||=l(`span`,{class:`media-preview-spinner`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在载入媒体文件…`)),1)])):T(``,!0)],64))]),l(`div`,ze,[l(`span`,Be,s(ie.value),1),n.value===`video`?(w(),d(`span`,{key:0,class:`media-preview-name`,title:t.filePath},s(i.value),9,Ve)):T(``,!0)])],8,M))}}),[[`__scopeId`,`data-v-f05d705f`]]);o(),x();var Ue={class:`mindmap-preview`},We={class:`mindmap-preview-canvas`},Ge=O(c({__name:`MindmapPreview`,props:{content:{}},setup(t){let n=t,r=E(()=>A(n.content||``,`未命名文档`));return(t,n)=>(w(),d(`div`,Ue,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,We,[e(u(k),{data:r.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]),Ke=1080,qe=6e5,Je=.86;function F(e){if(!e||e.startsWith(`data:`))return!1;if(e.startsWith(`blob:`)||e.startsWith(`/`))return!0;try{return new URL(e,location.href).origin===location.origin}catch{return!1}}async function I(e){try{let t=await fetch(e);if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result||``),t.onerror=()=>e(``),t.readAsDataURL(n)})}catch{return null}}function Ye(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};if(typeof Image>`u`){r(e);return}let i=new Image,a=setTimeout(()=>r(e),4e3);i.onload=()=>{if(clearTimeout(a),!(i.naturalWidth>Ke||e.length>qe)){r(e);return}try{let t=Math.min(1,Ke/i.naturalWidth),n=Math.max(1,Math.round(i.naturalWidth*t)),a=Math.max(1,Math.round(i.naturalHeight*t)),o=document.createElement(`canvas`);o.width=n,o.height=a;let s=o.getContext(`2d`);if(!s){r(e);return}s.fillStyle=`#ffffff`,s.fillRect(0,0,n,a),s.drawImage(i,0,0,n,a),r(o.toDataURL(`image/jpeg`,Je))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function Xe(e){let t=await I(e);return t?Ye(t):null}async function Ze(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>F(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await Xe(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function Qe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var $e={h1:`font-size:26px;font-weight:700;line-height:1.35;margin:28px 0 16px;color:#111;`,h2:`font-size:22px;font-weight:700;line-height:1.4;margin:26px 0 14px;color:#111;`,h3:`font-size:19px;font-weight:700;line-height:1.45;margin:22px 0 12px;color:#222;`,h4:`font-size:17px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:#333;`,h5:`font-size:16px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#333;`,h6:`font-size:15px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#555;`,p:`font-size:16px;line-height:1.8;margin:16px 0;color:#333;`,li:`font-size:16px;line-height:1.8;margin:0 0 6px;color:#333;`,ul:`margin:16px 0;padding-left:24px;`,ol:`margin:16px 0;padding-left:24px;`,blockquote:`margin:16px 0;padding:8px 16px;border-left:4px solid #e2e2e2;background:#f7f7f7;color:#666;font-size:15px;line-height:1.8;`,hr:`border:none;border-top:1px solid #e5e5e5;margin:26px 0;`,a:`color:#576b95;text-decoration:none;`,strong:`font-weight:700;color:#111;`,em:`font-style:italic;color:#555;`,code:`font-family:Menlo,Consolas,Monaco,monospace;font-size:0.92em;background:#f2f3f5;color:#c7254e;padding:1px 5px;border-radius:3px;`,pre:`font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.6;background:#f6f8fa;color:#24292f;padding:12px 14px;border-radius:6px;overflow-x:auto;margin:16px 0;`,table:`border-collapse:collapse;width:100%;margin:16px 0;font-size:14px;`,th:`border:1px solid #e0e0e0;padding:8px 10px;background:#f6f8fa;font-weight:600;text-align:left;color:#333;`,td:`border:1px solid #e0e0e0;padding:8px 10px;color:#333;`,img:`max-width:100%;height:auto;display:block;margin:16px auto;border-radius:6px;`};function et(e){e.querySelectorAll(`*`).forEach(e=>{let t=$e[e.tagName.toLowerCase()];t&&e.setAttribute(`style`,t)}),e.querySelectorAll(`pre code`).forEach(e=>e.setAttribute(`style`,`background:none;padding:0;color:inherit;font-size:inherit;`))}async function tt(e,t){let n=e.cloneNode(!0),r=t?await Ze(n):0;return{html:n.innerHTML,leftover:r}}async function nt(e,t){let n=e.cloneNode(!0),r=t.inline?await Ze(n):0;et(n);let i=(t.title||``).trim();return{html:`<section style="font-size:16px;line-height:1.8;color:#333;word-break:break-word;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;">${i?`<h1 style="font-size:26px;font-weight:700;line-height:1.35;margin:0 0 22px;color:#111;">${Qe(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x(),t(),C();var rt={class:`sidebar-header`},it={class:`sidebar-title`},at={class:`sidebar-actions`},ot={class:`sidebar-search`},st=[`placeholder`,`title`],ct=[`title`,`aria-label`],lt={key:0,class:`sidebar-tree`},ut={key:0,class:`search-section-head`},dt={key:1,class:`tree-arrow-spacer`},ft={class:`tree-icon mit-icon`,"aria-hidden":`true`},pt=[`xlink:href`],mt=[`onClick`,`onContextmenu`],ht={key:1,class:`tree-arrow-spacer`},gt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},_t=[`xlink:href`],vt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},yt=[`xlink:href`],bt=[`title`],xt={key:0,class:`tree-name-hit`},St={key:4,class:`tree-loading`},Ct={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},wt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Tt=[`placeholder`],Et={key:1,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Dt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Ot={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},kt=[`placeholder`],At=[`data-query`],jt={key:0,class:`content-results-status`},Mt={class:`search-section-head`},Nt={class:`search-section-count`},Pt={key:0,class:`search-section-note`},Ft=[`title`,`onClick`],It={class:`tree-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={class:`content-hit-name`},zt={class:`content-hit-dir`},Bt={class:`content-hit-total`},Vt=[`title`,`onClick`],Ht={class:`content-hit-ln`},Ut={class:`content-hit-text`},Wt={key:0,class:`content-hit-mark`},Gt={key:3,class:`tree-empty`},Kt={key:1,class:`sidebar-loading`},qt={class:`editor-main`},Jt={class:`editor-tabs`},Yt=[`onClick`,`title`],Xt={class:`tab-name`},Zt={key:0,class:`tab-dirty-dot`},Qt=[`onClick`],$t=[`title`],en=[`disabled`,`title`],tn={class:`editor-body`},nn={key:1,class:`image-tab-placeholder`},rn={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`}},an={class:`image-tab-placeholder-title`},on={class:`image-tab-placeholder-hint`},sn={class:`preview-header`},cn={class:`preview-title`},ln={class:`preview-ext-badge`},un=[`title`],dn={class:`preview-body`},fn={key:0,class:`preview-copybar`},pn=[`disabled`,`title`],mn=[`disabled`,`title`],hn=[`disabled`,`title`],gn=[`title`],_n=[`sandbox`,`srcdoc`],vn=2,yn=6e4,bn=3e4,xn=300,Sn=320,Cn=O(c({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new _e:t===`css`||t===`scss`||t===`less`?new he:t===`html`||t===`handlebars`||t===`razor`?new de:t===`typescript`||t===`javascript`?new pe:new fe}};let o=t,c=ue(),x=Ae(),C=v([]),O=v(!1),k=v(``),A=v(``),j=null;function Ce(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)});let M=v([]),Me=v(0),Ne=v(``),N=v(!1),Pe=v(!1),Fe=null,P=0;function Ie(){Fe?.abort(),Fe=null,P+=1,M.value=[],Me.value=0,Ne.value=``,N.value=!1,Pe.value=!1}async function Le(e){let t=e.trim(),n=c.currentDirectory;if(!n||t.length<vn){Ie();return}if(t===Ne.value&&N.value)return;Fe?.abort();let r=++P,i=new AbortController;Fe=i,N.value=!0,Ne.value=t;try{let e=await(await fetch(`/api/search_content`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n,query:t}),signal:i.signal})).json().catch(()=>null);if(r!==P)return;if(!e?.success){M.value=[],Me.value=0,Pe.value=!1;return}M.value=Array.isArray(e.files)?e.files:[],Me.value=typeof e.totalMatches==`number`?e.totalMatches:0,Pe.value=!!e.truncated}catch(e){if(e?.name===`AbortError`||r!==P)return;M.value=[],Me.value=0,Pe.value=!1}finally{r===P&&(N.value=!1)}}S(A,e=>{Le(e)}),f(()=>{j&&clearTimeout(j),Fe?.abort(),Be(),Qn()});let Re=null;function ze(){Be(),c.ui.fileTreeAutoRefresh&&(Re=setInterval(()=>{document.hidden||c.currentDirectory&&(k.value.trim()||F())},yn))}function Be(){Re&&=(clearInterval(Re),null)}S(()=>c.currentDirectory,async()=>{if(Pn=!1,Ie(),ze(),await Ue(),L.value.some(e=>e.isDirty)){Pn=!0;return}L.value=[],R.value=null,Bn(),await Ln()}),S(()=>c.ui.fileTreeAutoRefresh,()=>{ze()});async function Ve(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 Ue(){let e=c.currentDirectory;if(e){O.value=!0;try{C.value=await Ve(e,0)}finally{O.value=!1}}}function We(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&We(n.children,t));return t}function Ke(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=Ke(e.children,t+1),n.expanded=!0),n})}async function qe(e){let t=c.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:Ke(n.items,0)}catch{return null}}function Je(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)?Je(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function F(e={}){if(!c.currentDirectory)return;let t=await qe([...We(C.value)]);if(!t){e.notifyOnError&&y.error(D(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Je(C.value,t)&&(C.value=t)}async function I(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ve(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ye(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ye(n.children));return t}let Xe=E(()=>A.value.trim().toLowerCase());function Ze(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.name.toLowerCase().includes(t);if(r.type===`directory`){let i=r.children?Ze(r.children,t):[];if(!e&&i.length===0)continue;n.push({...r,expanded:!0,children:r.children===void 0?void 0:i})}else e&&n.push(r)}return n}function Qe(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=Qe(n.children,t);if(e)return e}}return null}let $e=E(()=>Ze(C.value,Xe.value)),et=E(()=>Xe.value.length>0&&$e.value.length===0),Cn=E(()=>et.value&&M.value.length===0&&!N.value);function wn(e){let t=A.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}async function Tn(e,t){if(await kn({name:e.name,path:e.path,type:`file`,depth:0}),!t||t<1)return;await n();let r=B.value;r&&r.getModel()&&jn()?.path===e.path&&(r.revealLineInCenter(t,ge.ScrollType.Smooth),r.setPosition({lineNumber:t,column:1}),r.focus())}let En=v(null);function Dn(){let e=En.value;e&&(e.focus(),e.select())}function On(){k.value?(Ce(),En.value?.focus()):(En.value?.blur(),B.value?.focus())}let L=v([]),R=v(null),z=v(null);async function kn(e){if(z.value=e,e.type!==`file`){I(Qe(C.value,e.path)??e);return}let t=L.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:L.value.length}),t){R.value=e.path,n(()=>Hn());return}let r=e.name.split(`.`).pop()||``;if(Te.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null};L.value.push(t),R.value=e.path;return}if(Ir.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};L.value.push(t),R.value=e.path,J.value=!0;return}if(Ee(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};L.value.push(t),R.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),n=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:n}),!n.success){y.error(`${D(`@EDITOR:打开文件失败: `)}${n.error}`);return}let i=je(r),a=V.get(e.path);a&&!a.isDisposed()&&a.setValue(n.content);let o={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:i,diskMtimeMs:typeof n.mtimeMs==`number`?n.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),L.value.push(o),R.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,L.value.length,`activeTabPath=`,R.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),y.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await n();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await kn({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function An(e,t){t.stopPropagation();let n=L.value.findIndex(t=>t.path===e);n!==-1&&(!L.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(L.value.splice(n,1),R.value===e&&(R.value=L.value[Math.min(n,L.value.length-1)]?.path??null))}let jn=()=>L.value.find(e=>e.path===R.value)??null,Mn=E(()=>({expandedDirs:[...We(C.value)],tabs:L.value.map(e=>e.path),activeTab:R.value})),Nn=!1,Pn=!1;function Fn(){Pn&&!Nn&&c.isUiLoaded&&c.saveEditorWorkspace(Mn.value)}S(Mn,()=>Fn());async function In(e){if(L.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Te.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null});return}if(Ir.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Ee(t)){L.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=V.get(e);i&&!i.isDisposed()&&B.value?.getModel()!==i&&(i.dispose(),V.delete(e)),L.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:je(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Ln(){try{for(let e=0;e<100&&!c.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!c.isUiLoaded)return;rr.value=c.ui.editorSidebarWidth;let e=c.getEditorWorkspace();if(!e)return;Nn=!0;try{if(e.expandedDirs.length>0){let t=await qe(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await In(t);if(!o.pendingFilePath&&e.activeTab&&L.value.some(t=>t.path===e.activeTab)){R.value=e.activeTab;let t=jn(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Ir.has(n)||Ee(t.name))&&(J.value=!0)}}finally{Nn=!1}}finally{Pn=!0,Fn()}}let Rn=v(null),B=te(null),V=new Map;function zn(e){let t=V.get(e.path);return(!t||t.isDisposed())&&(t=ge.createModel(e.content,e.language,me.file(e.path)),V.set(e.path,t)),t}function Bn(){B.value?.setModel(null);for(let e of V.values())e.isDisposed()||e.dispose();V.clear()}function Vn(){if(!Rn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;B.value=ge.create(Rn.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}),B.value.onDidChangeModelContent(()=>{let e=jn();if(!e)return;let t=B.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),B.value.onDidBlurEditorText(()=>{c.ui.editorAutoSave&&jn()?.isDirty&&tr(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Hn()})})}S(R,e=>{if(!B.value||!e)return;let t=L.value.find(t=>t.path===e);if(!t)return;let r=zn(t);B.value.setModel(r),n(()=>Hn()),Jn(e)});function Hn(){if(!B.value)return;B.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let Un=0,Wn=new Map;async function Gn(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 Kn(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 qn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=V.get(e.path);if(!r||r.isDisposed())return;let i=B.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 Jn(e){if(!e)return;let t=L.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++Un,r=await Gn(e);if(n!==Un||L.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Wn.get(e)===r.mtimeMs)return;Wn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Kn(e);i&&L.value.find(t=>t.path===e)===t&&qn(t,i.content,i.mtimeMs)}function Yn(){document.hidden||Jn(R.value)}let Xn=null;function Zn(){Qn(),Xn=setInterval(()=>{document.hidden||Jn(R.value)},bn)}function Qn(){Xn&&=(clearInterval(Xn),null)}S(()=>L.value.filter(e=>e.isDirty).length,e=>{x.setDirtyCount(e)},{immediate:!0}),S(R,e=>{let t=L.value.find(t=>t.path===e)??null;x.setActiveFile(t?.path??``,t?.name??``)},{immediate:!0}),f(()=>x.setDirtyCount(0)),Se(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ge.setTheme(e?`vs-dark`:`vs`)});let $n=null;function er(){if($n||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}$n=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&R.value&&B.value&&(Jn(R.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Hn()}))});let n=$n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}i(async()=>{Vn(),await Ue(),await Ln(),er(),ze(),window.addEventListener(`focus`,Yn),document.addEventListener(`visibilitychange`,Yn),Zn(),R.value&&n(()=>Hn())}),f(()=>{$n?.disconnect(),$n=null,window.removeEventListener(`focus`,Yn),document.removeEventListener(`visibilitychange`,Yn),B.value?.dispose(),V.forEach(e=>e.dispose()),V.clear()});async function tr(e=!1){let t=jn();if(t&&!(Rr.value||zr.value||Br.value))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){y.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||y.success(D(`@EDITOR:已保存`))}catch(e){y.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function nr(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Dn();return}t&&e.key===`s`&&(e.preventDefault(),tr())}i(()=>window.addEventListener(`keydown`,nr)),f(()=>window.removeEventListener(`keydown`,nr));let H=v(null),rr=v(c.ui.editorSidebarWidth),ir=!1,ar=0,or=0;function sr(e){ir=!0,ar=e.clientX,or=rr.value,document.addEventListener(`mousemove`,cr),document.addEventListener(`mouseup`,lr),e.preventDefault()}function cr(e){if(!ir)return;let t=e.clientX-ar;rr.value=Math.max(140,Math.min(400,or+t))}function lr(){ir=!1,document.removeEventListener(`mousemove`,cr),document.removeEventListener(`mouseup`,lr),rr.value!==c.ui.editorSidebarWidth&&c.setEditorSidebarWidth(rr.value)}function ur(e){return e.type===`directory`?ke(e.name):ve(e.name)}let U=v(null),W=v(null),G=v(null),dr=v(null);function fr(){let e=z.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(/[\\/][^\\/]+$/,``):c.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:c.currentDirectory??``,afterNode:null,depth:0}}async function pr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`file`,value:``},await n(),G.value?.focus()}async function mr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`directory`,value:``},await n(),G.value?.focus()}function hr(){U.value=null}async function gr(){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){y.error(e.error);return}y.success(D(`@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){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}U.value=null,await F()}function _r(e){e.key===`Enter`&&(e.preventDefault(),gr()),e.key===`Escape`&&(e.preventDefault(),hr())}let K=v(null),vr=v(null);function yr(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function br(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`file`,value:``},await n(),G.value?.focus()}async function xr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`directory`,value:``},await n(),G.value?.focus()}async function Sr(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await n(),dr.value?.focus(),dr.value?.select())}async function Cr(){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){y.error(r.error);return}let i=L.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,R.value===e.node.path&&(R.value=n)),W.value=null,await F()}function wr(e){e.key===`Enter`&&(e.preventDefault(),Cr()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Tr(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){y.error(n.error);return}let r=L.value.findIndex(t=>t.path===e.path);r!==-1&&(L.value.splice(r,1),R.value===e.path&&(R.value=L.value[Math.max(0,r-1)]?.path??null)),y.success(D(`@EDITOR:已删除`)),await F()}async function Er(){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||y.error(t.error)}catch(e){y.error(e?.message||String(e))}}function Dr(e){let t=c.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 Or(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 kr(){let e=K.value?.node;q(),e&&(await Or(e.path)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function Ar(){let e=K.value?.node;q(),e&&(await Or(Dr(e.path))?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function jr(){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||y.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){y.error(e?.message||String(e))}}let Mr=new Set([`html`,`htm`]),Nr=E(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Mr.has(t)});async function Pr(){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||y.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){y.error(e?.message||String(e))}}i(()=>{document.addEventListener(`click`,q)}),f(()=>{document.removeEventListener(`click`,q)});let Fr=new Set([`md`,`html`,`htm`,`svg`]),Ir=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),Lr=v(0),X=E(()=>L.value.find(e=>e.path===R.value)??null),Rr=E(()=>X.value?.language===`plaintext`&&X.value?.content===``),zr=E(()=>X.value?.language===`office`),Br=E(()=>X.value?.language===`media`),Z=E(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Vr=E(()=>Fr.has(Z.value)||Ir.has(Z.value)||Ee(Z.value)),Hr=E(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Ur=E(()=>Z.value===`md`&&Hr.value>0);S(R,()=>{J.value&&!Vr.value&&(J.value=!1),Y.value&&!Ur.value&&(Y.value=!1)});function Wr(){Vr.value&&(J.value||(Y.value=!1),J.value=!J.value)}function Gr(){Ur.value&&(Y.value||(J.value=!1),Y.value=!Y.value)}let Kr=E(()=>Lr.value<=0||L.value.length===0?{flexBasis:`0px`}:{flex:`0 0 ${Lr.value}px`,maxWidth:`calc(100% - 320px)`}),qr=v(null),Q=v(!1),$=v(``),Jr=v(!0),Yr=null,Xr=E(()=>!Y.value&&J.value&&Z.value===`md`&&!!X.value);function Zr(){return X.value?.content??``}function Qr(){return Zr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function $r(e,t,n){if(!e){y.error(D(`@EDITOR:复制失败`));return}$.value=n,Yr&&clearTimeout(Yr),Yr=setTimeout(()=>{$.value=``},1800),t>0?y.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):y.success(D(`@EDITOR:已复制`))}async function ei(){$r(await Or(Zr()),0,`md`)}async function ti(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await tt(e,Jr.value);$r(await Or(t),n,`html`)}finally{Q.value=!1}}}function ni(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0;`,t.innerHTML=e,document.body.appendChild(t);try{let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n);let r=document.execCommand(`copy`);return e?.removeAllRanges(),r}catch{return!1}finally{document.body.removeChild(t)}}async function ri(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await nt(e,{inline:Jr.value,title:Qr()}),r=Zr(),i=!1;try{navigator.clipboard?.write&&typeof ClipboardItem<`u`&&(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([r],{type:`text/plain`})})]),i=!0)}catch{i=!1}i||=ni(t),$r(i,n,`rich`)}finally{Q.value=!1}}}let ii=E(()=>{let e=X.value;if(!e)return``;let t=Z.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?be(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>`:``}),ai=!1,oi=0,si=0,ci=0;function li(e){let t=e.currentTarget,n=t.parentElement;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();ai=!0,oi=e.clientX,si=r.right-i.right,ci=Math.max(xn,r.width-Sn),document.addEventListener(`mousemove`,ui),document.addEventListener(`mouseup`,di),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,e.preventDefault()}function ui(e){if(!ai)return;let t=oi-e.clientX;Lr.value=Math.round(Math.max(xn,Math.min(ci,si+t)))}function di(){ai=!1,document.removeEventListener(`mousemove`,ui),document.removeEventListener(`mouseup`,di),document.body.style.cursor=``,document.body.style.userSelect=``}return(t,n)=>(w(),d(g,null,[l(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[l(`div`,{class:`editor-sidebar`,style:a({width:rr.value+`px`})},[l(`div`,rt,[l(`span`,it,s(u(D)(`@EDITOR:资源管理器`)),1),l(`div`,at,[e(u(m),{content:u(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:pr},[...n[11]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:mr},[...n[12]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:n[0]||=e=>F({notifyOnError:!0})},[...n[13]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),l(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,ot,[n[15]||=l(`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`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),_(l(`input`,{ref_key:`searchInputRef`,ref:En,"onUpdate:modelValue":n[1]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:u(D)(`@EDITOR:搜索文件名或内容...`),title:u(D)(`@EDITOR:搜索文件名或内容...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(On,[`escape`])},null,40,st),[[oe,k.value]]),k.value?(w(),d(`button`,{key:0,class:`sidebar-search-clear`,title:u(D)(`@EDITOR:清除搜索`),"aria-label":u(D)(`@EDITOR:清除搜索`),onClick:Ce},[...n[14]||=[l(`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`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,ct)):T(``,!0)]),O.value?(w(),d(`div`,Kt,[...n[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(w(),d(`div`,lt,[Xe.value&&$e.value.length>0?(w(),d(`div`,ut,s(u(D)(`@EDITOR:名称匹配`)),1)):T(``,!0),(w(!0),d(g,null,h(Ye($e.value),e=>(w(),d(g,{key:e.path},[W.value&&W.value.node.path===e.path?(w(),d(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[16]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,dt)),(w(),d(`svg`,ft,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,pt)])),_(l(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:dr,"onUpdate:modelValue":n[2]||=e=>W.value.value=e,onKeydown:wr,onBlur:Cr,onClick:n[3]||=ne(()=>{},[`stop`])},null,544),[[oe,W.value.value]])],4)):(w(),d(`div`,{key:1,class:p([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":R.value===e.path,"tree-node--selected":z.value?.path===e.path&&R.value!==e.path}]),style:a({paddingLeft:12+e.depth*14+`px`}),onClick:t=>kn(e),onContextmenu:t=>yr(t,e)},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,ht)),e.type===`directory`?(w(),d(`svg`,gt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,_t)])):(w(),d(`svg`,vt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,yt)])),l(`span`,{class:`tree-name`,title:e.path},[(w(!0),d(g,null,h(wn(e.name),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,xt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))],8,bt),e.loading?(w(),d(`span`,St)):T(``,!0)],46,mt)),U.value&&U.value.afterNode?.path===e.path?(w(),d(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+U.value.depth*14+`px`})},[n[20]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Ct,[...n[18]||=[l(`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)]])):(w(),d(`svg`,wt,[...n[19]||=[l(`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),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[5]||=ne(()=>{},[`stop`])},null,40,Tt),[[oe,U.value.value]])],4)):T(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(w(),d(`div`,Et,[n[23]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Dt,[...n[21]||=[l(`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)]])):(w(),d(`svg`,Ot,[...n[22]||=[l(`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),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[7]||=ne(()=>{},[`stop`])},null,40,kt),[[oe,U.value.value]])])):T(``,!0),Xe.value?(w(),d(`div`,{key:2,class:`content-results`,"data-query":Ne.value},[N.value?(w(),d(`div`,jt,[n[24]||=l(`span`,{class:`content-search-spin`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在搜索文件内容...`)),1)])):M.value.length>0?(w(),d(g,{key:1},[l(`div`,Mt,[l(`span`,null,s(u(D)(`@EDITOR:内容匹配`)),1),l(`span`,Nt,s(Me.value),1),Pe.value?(w(),d(`span`,Pt,s(u(D)(`@EDITOR:结果过多,已截断`)),1)):T(``,!0)]),(w(!0),d(g,null,h(M.value,e=>(w(),d(`div`,{key:e.path,class:`content-hit`},[l(`div`,{class:`content-hit-file`,title:e.relPath,onClick:t=>Tn(e,e.matches[0]?.line)},[(w(),d(`svg`,It,[l(`use`,{"xlink:href":`#${u(ve)(e.name)}`},null,8,Lt)])),l(`span`,Rt,s(e.name),1),l(`span`,zt,s(e.dir),1),l(`span`,Bt,s(e.total),1)],8,Ft),(w(!0),d(g,null,h(e.matches,t=>(w(),d(`div`,{key:`${e.path}:${t.line}`,class:`content-hit-line`,title:u(D)(`@EDITOR:点击跳到该行`),onClick:n=>Tn(e,t.line)},[l(`span`,Ht,s(t.line),1),l(`span`,Ut,[(w(!0),d(g,null,h(wn(t.text),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,Wt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))])],8,Vt))),128))]))),128))],64)):T(``,!0)],8,At)):T(``,!0),!U.value&&(Cn.value||C.value.length===0)?(w(),d(`div`,Gt,s(Cn.value?u(D)(`@EDITOR:未找到匹配文件`):u(D)(`@EDITOR:暂无文件`)),1)):T(``,!0)]))],4),l(`div`,{class:`editor-resizer`,onMousedown:sr},null,32),l(`div`,qt,[l(`div`,Jt,[(w(!0),d(g,null,h(L.value,e=>(w(),d(`div`,{key:e.path,class:p([`editor-tab`,{active:R.value===e.path,dirty:e.isDirty}]),onClick:t=>R.value=e.path,title:e.path},[l(`span`,Xt,s(e.name),1),e.isDirty?(w(),d(`span`,Zt)):T(``,!0),l(`button`,{class:`tab-close`,onClick:t=>An(e.path,t)},[...n[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Qt)],10,Yt))),128)),n[29]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),Vr.value?(w(),d(`button`,{key:0,class:p([`preview-toggle-btn`,{active:J.value}]),title:J.value?u(D)(`@EDITOR:关闭预览`):u(D)(`@EDITOR:打开预览`),onClick:Wr},[n[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0`}),l(`path`,{d:`M21 12c-2.4 4-5.4 6-9 6c-3.6 0-6.6-2-9-6c2.4-4 5.4-6 9-6c3.6 0 6.6 2 9 6`})],-1),l(`span`,null,s(u(D)(`@EDITOR:预览`)),1)],10,$t)):T(``,!0),Ur.value?(w(),d(`button`,{key:1,class:p([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!Ur.value}]),disabled:!Ur.value,title:Ur.value?Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:打开思维导图`):u(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Gr},[n[28]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" data-v-2b76e179><path d="M8 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M8 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M14 12a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M7.5 7.5l3 3" data-v-2b76e179></path><path d="M7.5 16.5l3-3" data-v-2b76e179></path><path d="M13.5 13.5l3 3" data-v-2b76e179></path><path d="M16.5 7.5l-3 3" data-v-2b76e179></path></svg>`,1),l(`span`,null,s(u(D)(`@EDITOR:思维导图`)),1)],10,en)):T(``,!0)]),L.value.length===0?(w(),r(ye,{key:0,class:`editor-empty`,title:u(D)(`@EDITOR:从左侧选择文件打开`),hint:u(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ie(()=>[...n[30]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`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`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):T(``,!0),l(`div`,tn,[l(`div`,{class:p([`monaco-container`,{hidden:L.value.length===0||Rr.value||zr.value||Br.value}]),ref_key:`editorContainerRef`,ref:Rn},null,2),Br.value&&X.value?(w(),r(He,{key:X.value.path,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):T(``,!0),Rr.value&&L.value.length>0&&!J.value&&!Y.value?(w(),d(`div`,nn,[(w(),d(`svg`,rn,[...n[31]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,an,s(X.value?.name),1),l(`p`,on,s(u(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:2,class:`preview-resizer`,onMousedown:li},null,32)):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:3,class:`preview-panel`,style:a(Kr.value)},[l(`div`,sn,[l(`span`,cn,s(Y.value?u(D)(`@EDITOR:思维导图`):u(D)(`@EDITOR:预览`)),1),l(`span`,ln,s(Z.value.toUpperCase()),1),n[33]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:关闭预览`),onClick:n[8]||=e=>Y.value?Y.value=!1:J.value=!1},[...n[32]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,un)]),l(`div`,dn,[Xr.value?(w(),d(`div`,fn,[l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制 Markdown 源码`),onClick:ei},[n[34]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,s($.value===`md`?u(D)(`@EDITOR:已复制`):`Markdown`),1)],10,pn),l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:ti},[n[35]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,s($.value===`html`?u(D)(`@EDITOR:已复制`):`HTML`),1)],10,mn),l(`button`,{class:p([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:ri},[n[36]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,s(Q.value?u(D)(`@EDITOR:转换图片中…`):$.value===`rich`?u(D)(`@EDITOR:已复制`):u(D)(`@EDITOR:复制富文本`)),1)],10,hn),l(`label`,{class:`preview-copy-embed`,title:u(D)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[_(l(`input`,{"onUpdate:modelValue":n[9]||=e=>Jr.value=e,type:`checkbox`},null,512),[[ae,Jr.value]]),l(`span`,null,s(u(D)(`@EDITOR:图片转 Base64`)),1)],8,gn)])):T(``,!0),Y.value&&Z.value===`md`&&X.value?(w(),r(Ge,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Z.value===`md`&&X.value?(w(),r(Oe,{ref_key:`mdPreviewRef`,ref:qr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):J.value&&[`html`,`htm`,`svg`].includes(Z.value)?(w(),d(`iframe`,{key:3,class:`preview-iframe`,sandbox:u(De),srcdoc:ii.value},null,8,_n)):J.value&&u(Ir).has(Z.value)&&X.value?(w(),r(xe,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):J.value&&zr.value&&X.value?(w(),r(we,{key:5,"file-path":X.value.path},null,8,[`file-path`])):T(``,!0)])],4)):T(``,!0)])])],512),(w(),r(ce,{to:`body`},[K.value?(w(),d(`div`,{key:0,ref_key:`ctxMenuRef`,ref:vr,class:`ctx-menu`,style:a({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:n[10]||=ne(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:br},[n[37]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:xr},[n[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件夹`)),1)]),n[45]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:kr},[n[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667-2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1-2.667 2.667h-8.666a2.667 2.667 0 0 1-2.667-2.667l0-8.666`}),l(`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1-1.012-1.737v-10c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1`})],-1),b(` `+s(u(D)(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Ar},[n[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M9 15l6-6`}),l(`path`,{d:`M11 6l.463-.536a5 5 0 0 1 7.071 7.072l-.534.464`}),l(`path`,{d:`M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0a4.972 4.972 0 0 1 0-7.071l.524-.463`})],-1),b(` `+s(u(D)(`@EDITOR:复制相对路径`)),1)]),n[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),Nr.value?(w(),d(`button`,{key:0,class:`ctx-menu-item`,onClick:Pr},[n[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0`}),l(`path`,{d:`M3.6 9h16.8`}),l(`path`,{d:`M3.6 15h16.8`}),l(`path`,{d:`M11.5 3a17 17 0 0 0 0 18`}),l(`path`,{d:`M12.5 3a17 17 0 0 1 0 18`})],-1),b(` `+s(u(D)(`@EDITOR:在浏览器中打开`)),1)])):T(``,!0),l(`button`,{class:`ctx-menu-item`,onClick:Er},[n[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M5 19l2.757-7.351a1 1 0 0 1 .936-.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1-1.964 1.625h-14.026a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2`})],-1),b(` `+s(u(D)(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:jr},[e(le,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),b(` `+s(u(D)(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Sr},[n[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 7h-1a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1`}),l(`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97l-8.415 8.385v3h3l8.385-8.415`}),l(`path`,{d:`M16 5l3 3`})],-1),b(` `+s(u(D)(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Tr},[n[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M4 7l16 0`}),l(`path`,{d:`M10 11l0 6`}),l(`path`,{d:`M14 11l0 6`}),l(`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12`}),l(`path`,{d:`M9 7v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})],-1),b(` `+s(u(D)(`@EDITOR:删除`)),1)])],4)):T(``,!0)]))],64))}}),[[`__scopeId`,`data-v-2b76e179`]]);export{Cn as default};
@@ -1 +1 @@
1
- import{An as e,Bn as t,In as n,Kn as r,Mn as i,Pn as a,Sr as o,Tn as s,fr as c,ir as l,lr as u,nr as d,qn as f,xn as p}from"./element-plus-axsKECfO.js";import{n as m,t as h}from"./_plugin-vue_export-helper-B-yhZnp1.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-BgHev8Va.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-B1wOq19j.js";n(),u();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(i({__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(n){function u(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=i({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>a(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:u(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return i({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=p(()=>{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()=>a(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:u(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:()=>a(e,{data:t.data,id:t.id})})}})}let j={start:c(h),command:c(A(E)),wait:c(A(w)),version:c(A(b)),confirm:c(A(S)),code:c(A(T)),condition:c(A(C)),user_input:c(A(D))},M=n,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let n=0;n<6;n+=1){if(await t(),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;d(()=>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))}),r(()=>{L&&=(window.clearTimeout(L),null)});let R=p(()=>{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=p(()=>{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(t,n)=>(f(),s(`div`,O,[e(o(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(()=>[e(o(g)),e(o(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
1
+ import{An as e,Bn as t,In as n,Kn as r,Mn as i,Pn as a,Sr as o,Tn as s,fr as c,ir as l,lr as u,nr as d,qn as f,xn as p}from"./element-plus-CN9J6t-d.js";import{n as m,t as h}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-NLvet82_.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-CkXLP8y4.js";n(),u();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(i({__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(n){function u(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=i({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>a(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:u(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return i({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=p(()=>{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()=>a(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:u(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:()=>a(e,{data:t.data,id:t.id})})}})}let j={start:c(h),command:c(A(E)),wait:c(A(w)),version:c(A(b)),confirm:c(A(S)),code:c(A(T)),condition:c(A(C)),user_input:c(A(D))},M=n,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let n=0;n<6;n+=1){if(await t(),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;d(()=>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))}),r(()=>{L&&=(window.clearTimeout(L),null)});let R=p(()=>{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=p(()=>{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(t,n)=>(f(),s(`div`,O,[e(o(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(()=>[e(o(g)),e(o(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,An as n,Ar as r,Bn as i,C as a,Cn as o,Ct as s,Dt as c,Et as l,F as ee,Ft as u,G as d,Gn as f,Ht as p,I as m,In as h,J as te,Jn as g,Jr as _,K as v,Kn as ne,Ln as re,M as y,Mn as b,Mt as ie,N as ae,Pn as x,Qt as S,Rt as oe,S as C,Sn as w,Sr as T,Tn as E,U as se,Ur as ce,W as le,Xn as D,Yn as O,_n as k,bt as ue,c as de,ct as fe,fr as A,gn as j,gr as M,i as N,ir as P,it as F,kn as I,l as L,lr as R,m as z,nr as B,on as pe,qn as V,r as me,st as he,ut as ge,w as _e,wn as H,x as U,xn as W,y as ve,yt as G,z as ye}from"./element-plus-axsKECfO.js";import{b as be}from"./vendor-DMJR8zxK.js";import{n as K,t as q}from"./_plugin-vue_export-helper-B-yhZnp1.js";import{t as xe}from"./dagre-BD_lsknB.js";import{t as Se}from"./SvgIcon-9MndOhWP.js";import{t as J}from"./configStore-D9y28eJA.js";import{t as Ce}from"./CommonDialog-C5Q6F8ql.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-BgHev8Va.js";import{St as Y,l as Oe}from"./index-ArXbQKZJ.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-B1wOq19j.js";var Ie=e(xe(),1);h(),R();var Z=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let r=e,i=t,s=M(!1);function c(e){e===`executeFrom`?i(`execute-from-node`,r.nodeId):e===`executeSingle`&&i(`execute-single-node`,r.nodeId)}return(e,t)=>{let r=te,i=a,l=_e,ee=C;return V(),o(ee,{trigger:`contextmenu`,onCommand:c,onVisibleChange:t[0]||=e=>s.value=e,"popper-class":`flow-node-dropdown`},{dropdown:P(()=>[n(l,null,{default:P(()=>[n(i,{command:`executeFrom`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[1]||=I(` 从此处开始执行 `,-1)]),_:1}),n(i,{command:`executeSingle`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[2]||=I(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:P(()=>[D(e.$slots,`default`,{dropdownVisible:s.value})]),_:3})}}});h(),R(),r();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(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,i=t,a=M(!1),s=M([]),l=M(``),u=W({get:()=>r.modelValue,set:e=>{l.value=e,i(`update:modelValue`,e);let t=s.value.find(t=>t.fullPath===e);i(`change`,t||null)}}),d=W(()=>s.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function f(e){a.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){s.value=r.packages||[],u.value&&!s.value.some(e=>e.fullPath===u.value)&&(u.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${s.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),s.value=[]}finally{a.value=!1}}async function p(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?h(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function h(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}g(e)};me.alert(x(`div`,{class:`directory-browser`},[x(`div`,{class:`current-path`},[x(`span`,{class:`path-label`},`当前路径:`),x(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),x(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),x(`div`,{class:`directory-list`},[e.parentPath?x(`div`,{class:`directory-item parent-dir`,onClick:()=>g(e.parentPath)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[x(`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`})])),x(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>x(`div`,{class:`directory-item`,onClick:()=>g(e.path)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[x(`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`})])),x(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){N.warning(`请输入目录路径`);return}f(n)}}})}async function g(e){try{me.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?h(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return f(),B(()=>r.modelValue,e=>{l.value=e},{immediate:!0}),(t,r)=>{let i=te,l=ee,h=m,g=ye,v=L;return V(),E(`div`,Le,[w(`div`,Re,[n(h,{modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||a.value,filterable:``,class:`package-select`},{default:P(()=>[(V(!0),E(k,null,O(d.value,e=>(V(),o(l,{key:e.value,label:e.label,value:e.value},{default:P(()=>[w(`div`,ze,[w(`div`,Be,[n(i,{class:`folder-icon`},{default:P(()=>[n(T(ue))]),_:1}),w(`span`,Ve,_(e.label),1)]),w(`div`,He,_(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),n(g,{icon:a.value?T(c):T(oe),loading:a.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>f(),class:`refresh-btn`,title:`刷新当前项目`},{default:P(()=>[I(_(a.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),n(g,{icon:T(G),disabled:e.disabled||a.value,size:`default`,onClick:p,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:P(()=>[...r[2]||=[I(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),s.value.length===0&&!a.value?(V(),E(`div`,Q,[n(v,{type:`info`,size:`small`},{default:P(()=>[...r[3]||=[I(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):H(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);h(),r(),R();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(b({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let r=e,i=t,a=W(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function s(){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 c(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 l(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let i=ye;return V(),E(`div`,$,[e.title!==void 0||e.addable?(V(),E(`div`,We,[e.title?(V(),E(`span`,Ge,_(e.title),1)):H(``,!0),w(`div`,Ke,[D(t.$slots,`title-actions`,{},void 0,!0),e.addable?(V(),o(i,{key:0,type:`primary`,plain:``,icon:T(u),disabled:e.disableAdd||!e.createItem,onClick:s},null,8,[`icon`,`disabled`])):H(``,!0)])])):H(``,!0),a.value.length===0?(V(),E(`div`,qe,[D(t.$slots,`empty`,{},void 0,!0)])):(V(),E(`div`,Je,[(V(!0),E(k,null,O(a.value,(r,o)=>(V(),E(`div`,{key:l(r,o),class:ce([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[w(`div`,Ye,[D(t.$slots,`row`,{item:r,index:o},void 0,!0)]),e.removable?(V(),E(`div`,Xe,[n(i,{type:`danger`,plain:``,icon:T(fe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(r,o):!1),onClick:e=>c(o)},null,8,[`icon`,`disabled`,`onClick`])])):H(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);h(),R(),r();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(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=M([]);B(()=>r.modelValue,e=>{a.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>r.paramNames,e=>{if(!e||e.length===0){a.value=[],i(`update:modelValue`,[]);return}let t=new Map(a.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:``});a.value=n,i(`update:modelValue`,n)},{immediate:!0});function s(e,t,n){if(!a.value[e])return;let r=[...a.value];r[e]={...r[e],[t]:n},t===`inputType`&&(n===`manual`?(r[e].referenceNodeId=void 0,r[e].referenceOutputKey=void 0):r[e].manualValue=void 0),a.value=r,i(`update:modelValue`,r)}function c(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=W(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:c(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,r]=t.split(`::`),o=[...a.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:r},a.value=o,i(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let i=se,c=ee,u=m,h=te,g=de,v=z;return V(),E(`div`,Qe,[n(Ze,{"model-value":a.value,title:void 0,addable:!1,removable:!1},{empty:P(()=>[I(_(T(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,$e,[w(`div`,et,[w(`label`,tt,_(T(K)(`@NODEINPUT:参数名`)),1),n(i,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:T(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>s(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,nt,[w(`label`,rt,_(T(K)(`@NODEINPUT:类型`)),1),n(u,{"model-value":t.inputType,placeholder:T(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>s(r,`inputType`,e)},{default:P(()=>[n(c,{value:`manual`,label:T(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),n(c,{value:`reference`,label:T(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,it,[w(`label`,at,_(T(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(V(),o(i,{key:0,"model-value":t.manualValue,placeholder:T(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>s(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(V(),o(g,{key:1,"model-value":p(t),data:d.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(r,e)},{default:P(({data:e})=>[w(`span`,ot,[e.children?H(``,!0):(V(),o(h,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,st,[w(`label`,ct,_(T(K)(`@NODEINPUT:必填`)),1),n(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>s(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);h(),R(),r();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(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(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 l(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 u=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:c(e),children:l(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function d(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function f(){let e=[...s.value,d()];s.value=e,a(`update:modelValue`,e)}t({addRow:f});function p(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,a(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);p(e,{ref:{nodeId:n,outputKey:r}})}function te(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let i=se,c=ee,l=m,f=de,g=z;return V(),E(`div`,ut,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":d,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@NODECFG:暂无输入参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,dt,[w(`div`,ft,[w(`label`,pt,_(T(K)(`@NODECFG:参数名`)),1),n(i,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>p(r,{name:e})],placeholder:T(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,mt,[w(`label`,ht,_(T(K)(`@NODECFG:参数值`)),1),n(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>p(r,{source:e})],style:{width:`110px`}},{default:P(()=>[n(c,{label:T(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),n(c,{label:T(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,gt,[w(`label`,_t,_(T(K)(`@NODECFG:值`)),1),t.source===`manual`?(V(),o(i,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>p(r,{manualValue:e})],placeholder:T(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(f,{key:1,"model-value":te(t),data:u.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,vt,[w(`label`,yt,_(T(K)(`@NODEINPUT:必填`)),1),n(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>p(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);h(),R(),r();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(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...s.value,c()];s.value=e,a(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,a(`update:modelValue`,n)}function f(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 p(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:f(e),children:p(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(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,r)=>{let f=se,p=ee,ne=m,re=te,y=de,b=z,ie=ye;return V(),E(`div`,xt,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":c,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@UINPUT:暂无输入参数`)),1)]),row:P(({item:e,index:t})=>[w(`div`,St,[w(`div`,Ct,[w(`label`,wt,_(T(K)(`@UINPUT:参数名`)),1),n(f,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:T(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,Tt,[w(`label`,Et,_(T(K)(`@UINPUT:类型`)),1),n(ne,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:P(()=>[n(p,{label:T(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),n(p,{label:T(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,Dt,[w(`label`,Ot,_(e.source===`manual`?T(K)(`@UINPUT:默认值`):T(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(V(),o(f,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:T(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(y,{key:1,"model-value":v(e),data:h.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:P(({data:e})=>[w(`span`,kt,[e.children?H(``,!0):(V(),o(re,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,At,[w(`label`,jt,_(T(K)(`@NODEINPUT:必填`)),1),n(b,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:P(()=>[e.addable===!1?H(``,!0):(V(),o(ie,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:P(()=>[I(_(T(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);h(),R(),r();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,An as n,Ar as r,Bn as i,C as a,Cn as o,Ct as s,Dt as c,Et as l,F as ee,Ft as u,G as d,Gn as f,Ht as p,I as m,In as h,J as te,Jn as g,Jr as _,K as v,Kn as ne,Ln as re,M as y,Mn as b,Mt as ie,N as ae,Pn as x,Qt as S,Rt as oe,S as C,Sn as w,Sr as T,Tn as E,U as se,Ur as ce,W as le,Xn as D,Yn as O,_n as k,bt as ue,c as de,ct as fe,fr as A,gn as j,gr as M,i as N,ir as P,it as F,kn as I,l as L,lr as R,m as z,nr as B,on as pe,qn as V,r as me,st as he,ut as ge,w as _e,wn as H,x as U,xn as W,y as ve,yt as G,z as ye}from"./element-plus-CN9J6t-d.js";import{b as be}from"./vendor-Bs5KA16r.js";import{n as K,t as q}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as xe}from"./dagre-JTV5zPzI.js";import{t as Se}from"./SvgIcon-XBkgNKCj.js";import{t as J}from"./configStore-HDlssep1.js";import{t as Ce}from"./CommonDialog-Qg_owAyQ.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-NLvet82_.js";import{St as Y,l as Oe}from"./index-CAWXBaPa.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-CkXLP8y4.js";var Ie=e(xe(),1);h(),R();var Z=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let r=e,i=t,s=M(!1);function c(e){e===`executeFrom`?i(`execute-from-node`,r.nodeId):e===`executeSingle`&&i(`execute-single-node`,r.nodeId)}return(e,t)=>{let r=te,i=a,l=_e,ee=C;return V(),o(ee,{trigger:`contextmenu`,onCommand:c,onVisibleChange:t[0]||=e=>s.value=e,"popper-class":`flow-node-dropdown`},{dropdown:P(()=>[n(l,null,{default:P(()=>[n(i,{command:`executeFrom`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[1]||=I(` 从此处开始执行 `,-1)]),_:1}),n(i,{command:`executeSingle`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[2]||=I(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:P(()=>[D(e.$slots,`default`,{dropdownVisible:s.value})]),_:3})}}});h(),R(),r();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(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,i=t,a=M(!1),s=M([]),l=M(``),u=W({get:()=>r.modelValue,set:e=>{l.value=e,i(`update:modelValue`,e);let t=s.value.find(t=>t.fullPath===e);i(`change`,t||null)}}),d=W(()=>s.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function f(e){a.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){s.value=r.packages||[],u.value&&!s.value.some(e=>e.fullPath===u.value)&&(u.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${s.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),s.value=[]}finally{a.value=!1}}async function p(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?h(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function h(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}g(e)};me.alert(x(`div`,{class:`directory-browser`},[x(`div`,{class:`current-path`},[x(`span`,{class:`path-label`},`当前路径:`),x(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),x(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),x(`div`,{class:`directory-list`},[e.parentPath?x(`div`,{class:`directory-item parent-dir`,onClick:()=>g(e.parentPath)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[x(`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`})])),x(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>x(`div`,{class:`directory-item`,onClick:()=>g(e.path)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[x(`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`})])),x(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){N.warning(`请输入目录路径`);return}f(n)}}})}async function g(e){try{me.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?h(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return f(),B(()=>r.modelValue,e=>{l.value=e},{immediate:!0}),(t,r)=>{let i=te,l=ee,h=m,g=ye,v=L;return V(),E(`div`,Le,[w(`div`,Re,[n(h,{modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||a.value,filterable:``,class:`package-select`},{default:P(()=>[(V(!0),E(k,null,O(d.value,e=>(V(),o(l,{key:e.value,label:e.label,value:e.value},{default:P(()=>[w(`div`,ze,[w(`div`,Be,[n(i,{class:`folder-icon`},{default:P(()=>[n(T(ue))]),_:1}),w(`span`,Ve,_(e.label),1)]),w(`div`,He,_(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),n(g,{icon:a.value?T(c):T(oe),loading:a.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>f(),class:`refresh-btn`,title:`刷新当前项目`},{default:P(()=>[I(_(a.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),n(g,{icon:T(G),disabled:e.disabled||a.value,size:`default`,onClick:p,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:P(()=>[...r[2]||=[I(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),s.value.length===0&&!a.value?(V(),E(`div`,Q,[n(v,{type:`info`,size:`small`},{default:P(()=>[...r[3]||=[I(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):H(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);h(),r(),R();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(b({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let r=e,i=t,a=W(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function s(){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 c(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 l(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let i=ye;return V(),E(`div`,$,[e.title!==void 0||e.addable?(V(),E(`div`,We,[e.title?(V(),E(`span`,Ge,_(e.title),1)):H(``,!0),w(`div`,Ke,[D(t.$slots,`title-actions`,{},void 0,!0),e.addable?(V(),o(i,{key:0,type:`primary`,plain:``,icon:T(u),disabled:e.disableAdd||!e.createItem,onClick:s},null,8,[`icon`,`disabled`])):H(``,!0)])])):H(``,!0),a.value.length===0?(V(),E(`div`,qe,[D(t.$slots,`empty`,{},void 0,!0)])):(V(),E(`div`,Je,[(V(!0),E(k,null,O(a.value,(r,o)=>(V(),E(`div`,{key:l(r,o),class:ce([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[w(`div`,Ye,[D(t.$slots,`row`,{item:r,index:o},void 0,!0)]),e.removable?(V(),E(`div`,Xe,[n(i,{type:`danger`,plain:``,icon:T(fe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(r,o):!1),onClick:e=>c(o)},null,8,[`icon`,`disabled`,`onClick`])])):H(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);h(),R(),r();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(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=M([]);B(()=>r.modelValue,e=>{a.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>r.paramNames,e=>{if(!e||e.length===0){a.value=[],i(`update:modelValue`,[]);return}let t=new Map(a.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:``});a.value=n,i(`update:modelValue`,n)},{immediate:!0});function s(e,t,n){if(!a.value[e])return;let r=[...a.value];r[e]={...r[e],[t]:n},t===`inputType`&&(n===`manual`?(r[e].referenceNodeId=void 0,r[e].referenceOutputKey=void 0):r[e].manualValue=void 0),a.value=r,i(`update:modelValue`,r)}function c(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=W(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:c(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,r]=t.split(`::`),o=[...a.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:r},a.value=o,i(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let i=se,c=ee,u=m,h=te,g=de,v=z;return V(),E(`div`,Qe,[n(Ze,{"model-value":a.value,title:void 0,addable:!1,removable:!1},{empty:P(()=>[I(_(T(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,$e,[w(`div`,et,[w(`label`,tt,_(T(K)(`@NODEINPUT:参数名`)),1),n(i,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:T(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>s(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,nt,[w(`label`,rt,_(T(K)(`@NODEINPUT:类型`)),1),n(u,{"model-value":t.inputType,placeholder:T(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>s(r,`inputType`,e)},{default:P(()=>[n(c,{value:`manual`,label:T(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),n(c,{value:`reference`,label:T(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,it,[w(`label`,at,_(T(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(V(),o(i,{key:0,"model-value":t.manualValue,placeholder:T(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>s(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(V(),o(g,{key:1,"model-value":p(t),data:d.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(r,e)},{default:P(({data:e})=>[w(`span`,ot,[e.children?H(``,!0):(V(),o(h,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,st,[w(`label`,ct,_(T(K)(`@NODEINPUT:必填`)),1),n(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>s(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);h(),R(),r();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(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(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 l(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 u=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:c(e),children:l(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function d(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function f(){let e=[...s.value,d()];s.value=e,a(`update:modelValue`,e)}t({addRow:f});function p(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,a(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);p(e,{ref:{nodeId:n,outputKey:r}})}function te(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let i=se,c=ee,l=m,f=de,g=z;return V(),E(`div`,ut,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":d,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@NODECFG:暂无输入参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,dt,[w(`div`,ft,[w(`label`,pt,_(T(K)(`@NODECFG:参数名`)),1),n(i,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>p(r,{name:e})],placeholder:T(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,mt,[w(`label`,ht,_(T(K)(`@NODECFG:参数值`)),1),n(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>p(r,{source:e})],style:{width:`110px`}},{default:P(()=>[n(c,{label:T(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),n(c,{label:T(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,gt,[w(`label`,_t,_(T(K)(`@NODECFG:值`)),1),t.source===`manual`?(V(),o(i,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>p(r,{manualValue:e})],placeholder:T(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(f,{key:1,"model-value":te(t),data:u.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,vt,[w(`label`,yt,_(T(K)(`@NODEINPUT:必填`)),1),n(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>p(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);h(),R(),r();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(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...s.value,c()];s.value=e,a(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!s.value[e])return;let n=[...s.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),s.value=n,a(`update:modelValue`,n)}function f(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 p(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let h=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:f(e),children:p(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(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,r)=>{let f=se,p=ee,ne=m,re=te,y=de,b=z,ie=ye;return V(),E(`div`,xt,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":c,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@UINPUT:暂无输入参数`)),1)]),row:P(({item:e,index:t})=>[w(`div`,St,[w(`div`,Ct,[w(`label`,wt,_(T(K)(`@UINPUT:参数名`)),1),n(f,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:T(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,Tt,[w(`label`,Et,_(T(K)(`@UINPUT:类型`)),1),n(ne,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:P(()=>[n(p,{label:T(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),n(p,{label:T(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,Dt,[w(`label`,Ot,_(e.source===`manual`?T(K)(`@UINPUT:默认值`):T(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(V(),o(f,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:T(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(y,{key:1,"model-value":v(e),data:h.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:P(({data:e})=>[w(`span`,kt,[e.children?H(``,!0):(V(),o(re,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,At,[w(`label`,jt,_(T(K)(`@NODEINPUT:必填`)),1),n(b,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:P(()=>[e.addable===!1?H(``,!0):(V(),o(ie,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:P(()=>[I(_(T(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);h(),R(),r();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