zen-gitsync 2.17.31 → 2.17.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +3 -1
- package/scripts/release.js +66 -29
- package/src/ui/public/assets/{AgentEngineSelector-bQmJlH1b.js → AgentEngineSelector-CPS9WawU.js} +1 -1
- package/src/ui/public/assets/{AgentView-DpNj6VFj.js → AgentView-CHj8Esf5.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-2etZBF2E.js → AppVersionBadge-CbYQ0KFm.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-BvbMlZW6.js → BranchSelector-i_DZoGr4.js} +1 -1
- package/src/ui/public/assets/{CommitForm-Bp41Q0Oo.js → CommitForm-DrAhqXPt.js} +1 -1
- package/src/ui/public/assets/{CommonDialog-UrQUmb6G.js → CommonDialog-Nwwi4-_9.js} +1 -1
- package/src/ui/public/assets/{EditorView-DIu2cIai.js → EditorView-Cj7r5oIY.js} +1 -1
- package/src/ui/public/assets/{FileDiffViewer-BlDGBxKd.js → FileDiffViewer-2vvvRZ_R.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-MPq4Fh6G.js → FlowExecutionViewer-STZphigj.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-ByBJ4B3G.js → FlowOrchestrationWorkspace-BdW1MijZ.js} +1 -1
- package/src/ui/public/assets/{IconButton-BvbRjQ_D.js → IconButton-BuiJBsJ3.js} +1 -1
- package/src/ui/public/assets/{LogList-Xs52JPC1.js → LogList-C14b7EUJ.js} +1 -1
- package/src/ui/public/assets/{MindmapView-Br7Fj7Ga.js → MindmapView-dcm1kcrO.js} +1 -1
- package/src/ui/public/assets/{MonitorView-DSV5_Q-6.js → MonitorView-7SOXc-I2.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-BCS2YQdX.js → ProjectStartupButton-BM2RrBbL.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-Dv47YPKL.js → RecentDirectoriesChat-CXxGKkqI.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-CIHTYzr7.js → RemoteManagerDialog-BTtVeges.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-DCYTEmuq.js → RemoteRepoCard-B0n8k5Go.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-BANSmwrh.js → SourceMapView-CT2C3tAc.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-b50XyCO5.js → SvgIcon-U-AI95UV.js} +1 -1
- package/src/ui/public/assets/{TemplateManager-D5-gC33Z.js → TemplateManager-BIMeoTp0.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-BFmTQYZP.js → UserInputNode-D_V8dhh9.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-BeC5sg_V.css +1 -0
- package/src/ui/public/assets/WorkbenchView-C74ciC03.js +20 -0
- package/src/ui/public/assets/{_plugin-vue_export-helper-MIPci_U9.js → _plugin-vue_export-helper-DkeTtFKF.js} +2 -2
- package/src/ui/public/assets/{agentConversations-D8mdZaNY.js → agentConversations-B2aTliJe.js} +1 -1
- package/src/ui/public/assets/{configStore-BMixvVAA.js → configStore-Y1biBqmb.js} +1 -1
- package/src/ui/public/assets/{gitStore-DriJnutC.js → gitStore-CiBz68_Z.js} +1 -1
- package/src/ui/public/assets/{index-CEEQaAF4.js → index-BoZNUwmd.js} +5 -5
- package/src/ui/public/assets/{previewSandbox-D86LH88s.js → previewSandbox-D7HcNin7.js} +1 -1
- package/src/ui/public/assets/{toolsStore-B1Lx5gWu.js → toolsStore-Dhfr-VDL.js} +1 -1
- package/src/ui/public/index.html +11 -11
- package/src/ui/server/routes/workbench/llmClient.js +17 -2
- package/src/ui/server/routes/workbench/progressReport.js +135 -50
- package/src/ui/server/routes/workbench/progressReport.test.js +101 -4
- package/src/utils/desktopNotify.js +199 -41
- package/src/utils/desktopNotify.test.js +84 -29
- package/src/ui/public/assets/WorkbenchView-Dc7bMMfe.css +0 -1
- package/src/ui/public/assets/WorkbenchView-DsPII7uQ.js +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Bt as r,C as i,Cn as a,Dn as o,Dt as s,En as c,Er as l,F as u,G as d,Gt as f,Ht as p,I as m,In as h,J as g,K as _,L as v,M as y,Nn as b,Nt as x,On as S,Pn as C,Pr as w,Q as T,Qr as E,S as D,T as O,Tn as k,U as A,V as j,W as M,Wt as N,Xn as P,Y as ee,Yn as te,Yr as F,Zn as I,_ as ne,a as L,at as re,bn as ie,br as R,cr as z,ct as B,dn as ae,ht as V,i as oe,j as se,kn as H,ln as ce,lr as le,lt as ue,mt as U,nn as de,nt as fe,o as pe,or as W,ot as me,pr as G,q as he,qr as K,qt as q,st as ge,tt as _e,vn as ve,vr as ye,w as be,x as xe,xn as J,z as Y,zt as Se}from"./element-plus-CgEuJBlB.js";import{b as Ce}from"./vendor-CDZ64WVU.js";import{n as X,t as Z}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as we}from"./IconButton-BvbRjQ_D.js";import{r as Te,t as Ee}from"./configStore-BMixvVAA.js";import{i as De,r as Q}from"./gitStore-DriJnutC.js";import{t as Oe}from"./CommonDialog-UrQUmb6G.js";import{t as ke}from"./TemplateManager-D5-gC33Z.js";import{C as Ae,S as je,T as Me,b as Ne,w as Pe,x as Fe,y as Ie}from"./index-CEEQaAF4.js";n(),G(),w();var Le={key:0},Re={key:1},ze=Z(h({__name:`StageButton`,props:{from:{default:`form`}},emits:[`click`],setup(e,{emit:t}){let n=t,r=Q(),i=Ee();function a(e){let t=e.replace(/\\/g,`/`);return i.lockedFiles.some(e=>{let n=e.replace(/\\/g,`/`);return t===n})}function s(){return i.lockedFiles.length!==0&&r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)?a(e.path):!1)}let c=k(()=>r.fileList.filter(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path)).length),u=k(()=>r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path))),d=k(()=>r.isSelectionMode&&r.hasSelectableFiles),f=k(()=>r.selectedUnstagedPaths.length),p=k(()=>r.isSelectionMode?f.value===0:!u.value),m=k(()=>d.value?`${X(`@29974:暂存所选 `)}${f.value}${X(`@29974: 个文件`)}`:u.value?s()?`${X(`@29974:暂存`)}${c.value}${X(`@29974:个未暂存文件(逐个添加)`)}`:`${X(`@29974:暂存所有更改(git add .)`)}`:X(`@29974:没有需要暂存的更改`));async function h(){n(`click`);try{if(d.value){await r.stageFiles(r.selectedUnstagedPaths);return}if(r.isSelectionMode)return;s()?await r.addToStage():await r.addAllToStage()}catch(e){console.error(`添加文件失败:`,e)}}return(t,n)=>{let i=Y,a=M;return I(),o(a,{content:m.value,placement:`top`},{default:z(()=>[C(i,{type:`primary`,icon:l(Se),onClick:h,loading:l(r).isAddingFiles,disabled:p.value,class:K([`stage-button`,`from-${e.from}`,{"is-selective":d.value}])},{default:z(()=>[b(E(d.value?l(X)(`@29974:暂存所选`):l(X)(`@29974:暂存`))+` `,1),d.value?(I(),H(`span`,Le,`(`+E(f.value)+`)`,1)):c.value>0?(I(),H(`span`,Re,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`class`])]),_:1},8,[`content`])}}}),[[`__scopeId`,`data-v-7c59a857`]]);n(),G(),w();var Be={key:0},Ve=Z(h({__name:`CommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`click`,`beforeCommit`,`afterCommit`],setup(e,{emit:n}){let r=e,i=n,a=Q(),s=Ee(),c=k(()=>a.fileList.filter(e=>e.type===`added`&&!Me(e.path,s.lockedFiles)).length),u=k(()=>c.value>0),d=k(()=>a.hasConflictedFiles||a.isCommiting?!0:a.isMergeInProgress?!r.hasUserCommitMessage:!u.value||!r.hasUserCommitMessage),f=k(()=>a.isCommiting?X(`@76A11:正在提交中…`):a.hasConflictedFiles?X(`@76A11:存在冲突文件,请先解决冲突`):a.isMergeInProgress?r.hasUserCommitMessage?X(`@76A11:提交并完成合并`):X(`@76A11:请输入提交信息`):u.value?r.hasUserCommitMessage?`${X(`@76A11:提交`)}${c.value}${X(`@76A11:个已暂存文件`)}`:X(`@76A11:请输入提交信息`):X(`@76A11:没有已暂存的更改`)),p=k(()=>a.isCommiting?X(`@76A11:提交中…`):X(`@76A11:提交`));async function m(){if(r.finalCommitMessage.trim()){i(`beforeCommit`),i(`click`);try{let e=await a.commitChanges(r.finalCommitMessage,r.skipHooks);i(`afterCommit`,e)}catch(e){console.error(`提交失败:`,e),i(`afterCommit`,!1)}}}return(n,r)=>{let i=Y,s=M;return I(),o(s,{content:f.value,placement:`top`,disabled:l(a).isCommiting},{default:z(()=>[C(i,{type:`primary`,onClick:m,icon:l(a).isCommiting?l(t):l(_e),loading:l(a).isCommiting,disabled:d.value,"aria-busy":l(a).isCommiting?`true`:void 0,"aria-label":l(a).isCommiting?l(X)(`@76A11:正在提交中…`):void 0,class:K([`commit-button`,`from-${e.from}`,{"is-committing":l(a).isCommiting}])},{default:z(()=>[b(E(p.value)+` `,1),c.value>0&&!l(a).isCommiting?(I(),H(`span`,Be,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`aria-busy`,`aria-label`,`class`])]),_:1},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-056f6f5d`]]);n(),G(),w();var He={class:`push-progress-container`},Ue={key:0,class:`pulling-section`},We={class:`pulling-text-wrap`},Ge={class:`pulling-title`},Ke={class:`pulling-sub`},qe={class:`stage-header`},Je={class:`stage-icon`},Ye={class:`stage-info`},Xe={class:`stage-label`},Ze={key:0,class:`stage-percent`},Qe={key:0,class:`stage-progress`},$e={key:2,class:`error-section`},et={class:`error-header`},tt={class:`error-title`},nt={class:`error-content`},rt={key:0,class:`error-suggestion`},it={key:3,class:`messages-section`},at={class:`messages-title`},ot=Z(h({__name:`PushProgressModal`,props:{modelValue:{type:Boolean}},emits:[`update:modelValue`,`complete`,`pull-requested`],setup(n,{expose:r,emit:i}){let{t:a}=Ce(),s=n,u=i,d=Ee(),f=Q(),p=R(`progress`),m=R([]),h=R(``),_=R(!1),v=k(()=>h.value.includes(`non-fast-forward`)||h.value.includes(`rejected`)&&h.value.includes(`fetch first`)),y=R(!1);async function x(){y.value=!0;try{(await f.gitPull()).success&&(O.value=!1,u(`pull-requested`))}finally{y.value=!1}}let w=ye([{name:`counting`,label:a(`@PUSH:计数对象`),status:`wait`,percent:0},{name:`compressing`,label:a(`@PUSH:压缩对象`),status:`wait`,percent:0},{name:`writing`,label:a(`@PUSH:写入对象`),status:`wait`,percent:0},{name:`resolving`,label:a(`@PUSH:解析增量`),status:`wait`,percent:0}]),T=R(0),D=R(null),O=k({get:()=>s.modelValue,set:e=>u(`update:modelValue`,e)}),A=k(()=>{if(_.value)return a(`@PUSH:正在拉取远程更新`);switch(p.value){case`progress`:return a(`@PUSH:正在推送`);case`success`:return a(`@PUSH:推送成功`);case`error`:return a(`@PUSH:推送失败`);default:return``}});function j(e){switch(e.type){case`progress`:e.message&&(m.value.push(e.message),setTimeout(()=>{D.value&&(D.value.scrollTop=D.value.scrollHeight)},0));break;case`stage-progress`:if(e.stage&&typeof e.percent==`number`){let t=w.findIndex(t=>t.name===e.stage);t!==-1&&(w[t].percent=e.percent,w[t].status=e.percent===100?`finish`:`process`,T.value=t,e.percent===100&&t<w.length-1&&(w[t+1].status=`wait`))}break;case`complete`:e.success?(p.value=`success`,w.forEach(e=>{(e.status===`process`||e.status===`wait`)&&(e.status=`finish`,e.percent=100)}),T.value=-1,d.autoClosePushModal?setTimeout(()=>{O.value=!1,u(`complete`,!0)},2e3):u(`complete`,!0)):(p.value=`error`,h.value=De(e),T.value<w.length&&(w[T.value].status=`error`),T.value=-1,u(`complete`,!1))}}function M(){p.value=`progress`,m.value=[],h.value=``,T.value=0,_.value=!1,w.forEach(e=>{e.status=`wait`,e.percent=0})}function N(e){_.value=e}return r({handleProgress:j,reset:M,setPulling:N}),(n,r)=>{let i=Y;return I(),o(Oe,{modelValue:O.value,"onUpdate:modelValue":r[0]||=e=>O.value=e,title:A.value,width:`650px`,type:`flex`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":p.value!==`progress`,"append-to-body":!0,"lock-scroll":!1,"destroy-on-close":``,"custom-class":`push-progress-dialog status-${p.value}`},{default:z(()=>[c(`div`,He,[_.value?(I(),H(`div`,Ue,[r[1]||=c(`div`,{class:`pulling-icon-wrap`},[c(`svg`,{class:`pulling-spinner`,viewBox:`0 0 50 50`},[c(`circle`,{class:`pulling-spinner-track`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`}),c(`circle`,{class:`pulling-spinner-arc`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`})])],-1),c(`div`,We,[c(`div`,Ge,E(l(a)(`@PUSH:正在拉取远程更新`)),1),c(`div`,Ke,E(l(a)(`@PUSH:拉取完成后自动继续推送`)),1)])])):(I(),H(`div`,{key:1,class:K([`stages-section`,{"is-loading":p.value===`progress`,"is-success":p.value===`success`}])},[(I(!0),H(J,null,e(w,(e,n)=>(I(),H(`div`,{key:e.name,class:K([`stage-item`,{active:T.value===n,finished:e.status===`finish`,error:e.status===`error`}])},[c(`div`,qe,[c(`div`,Je,[e.status===`finish`?(I(),o(l(g),{key:0,class:`icon-finish`},{default:z(()=>[C(l(fe))]),_:1})):e.status===`error`?(I(),o(l(g),{key:1,class:`icon-error`},{default:z(()=>[C(l(me))]),_:1})):e.status===`process`?(I(),o(l(g),{key:2,class:`icon-process rotating`},{default:z(()=>[C(l(t))]),_:1})):(I(),o(l(g),{key:3,class:`icon-wait`},{default:z(()=>[C(l(t))]),_:1}))]),c(`div`,Ye,[c(`div`,Xe,E(e.label),1),e.status===`process`||e.status===`finish`?(I(),H(`div`,Ze,E(e.percent)+`% `,1)):S(``,!0)])]),e.status===`process`||e.status===`finish`?(I(),H(`div`,Qe,[C(l(ne),{percentage:e.percent,"stroke-width":6,"show-text":!1,color:e.status===`finish`?`var(--color-success)`:`var(--color-primary)`},null,8,[`percentage`,`color`])])):S(``,!0)],2))),128))],2)),p.value===`error`&&h.value?(I(),H(`div`,$e,[c(`div`,et,[c(`div`,tt,E(l(a)(`@PUSH:错误详情`))+`:`,1),v.value?(I(),o(i,{key:0,type:`primary`,size:`small`,loading:y.value,onClick:x,class:`pull-button`},{default:z(()=>[C(l(g),null,{default:z(()=>[C(l(U))]),_:1}),b(` `+E(l(a)(`@PUSH:先拉取更新`)),1)]),_:1},8,[`loading`])):S(``,!0)]),c(`div`,nt,E(h.value),1),v.value?(I(),H(`div`,rt,E(l(a)(`@PUSH:检测到远程有新提交,请先拉取更新后再推送。`)),1)):S(``,!0)])):S(``,!0),m.value.length>0?(I(),H(`div`,it,[c(`div`,at,E(l(a)(`@PUSH:详细信息`))+`:`,1),c(`div`,{ref_key:`messagesContainerRef`,ref:D,class:`progress-messages`},[(I(!0),H(J,null,e(m.value,(e,t)=>(I(),H(`div`,{key:t,class:`message-item`},E(e),1))),128))],512)])):S(``,!0)])]),_:1},8,[`modelValue`,`title`,`show-close`,`custom-class`])}}}),[[`__scopeId`,`data-v-3d7c968a`]]);n(),G(),w();var st={class:`push-button-group`},ct={key:0},lt={class:`push-remote-item`},ut=Z(h({__name:`PushButton`,props:{from:{default:`form`}},emits:[`click`,`beforePush`,`afterPush`],setup(t,{emit:n}){let r=n,a=Q(),s=R(!1),u=R(null),d=k(()=>a.branchAhead>0),f=k(()=>a.fileList.some(e=>e.type===`added`)),p=k(()=>!a.hasConflictedFiles&&a.hasUpstream&&d.value&&!f.value),m=k(()=>!p.value),h=k(()=>a.hasConflictedFiles?X(`@F4137:存在冲突文件,请先解决冲突`):a.hasUpstream?d.value?f.value?X(`@F4137:有未提交的暂存更改,请先提交`):`${X(`@F4137:推送`)}${a.branchAhead}${X(`@F4137:个本地提交`)}`:X(`@F4137:没有需要推送的提交`):X(`@F4137:当前分支没有上游分支`)),g=k(()=>p.value?{backgroundColor:`var(--tint-success-14)`,borderColor:`var(--color-success)`,color:`var(--text-primary)`}:{});async function _(){r(`beforePush`),r(`click`);try{s.value=!0,u.value&&u.value.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value&&u.value.handleProgress(e)});e&&await new Promise(e=>setTimeout(e,200)),r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}function y(e){}let x=k(()=>[...a.remotes].sort((e,t)=>e.isUpstream===t.isUpstream?e.name.localeCompare(t.name):e.isUpstream?-1:1));async function w(e){if(e===`manage`){a.isRemoteManagerVisible=!0;return}if(e===`push-all`){await a.pushAllRemotes();return}if(!e.startsWith(`push:`))return;let t=e.slice(5);r(`beforePush`);try{s.value=!0,u.value?.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value?.handleProgress(e)},t);r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}return(n,r)=>{let f=Y,p=M,T=v,O=i,k=be,A=D;return I(),H(`div`,null,[c(`div`,st,[C(p,{content:h.value,placement:`top`},{default:z(()=>[C(f,{type:`primary`,icon:l(de),onClick:_,loading:l(a).isPushing,disabled:m.value,style:F(g.value),class:K([`push-button`,`from-${t.from}`])},{default:z(()=>[b(E(l(X)(`@F4137:推送`))+` `,1),d.value?(I(),H(`span`,ct,`(`+E(l(a).branchAhead)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`,`class`])]),_:1},8,[`content`]),l(a).hasMultipleRemotes?(I(),o(A,{key:0,trigger:`click`,placement:`top-end`,onCommand:w},{dropdown:z(()=>[C(k,null,{default:z(()=>[(I(!0),H(J,null,e(x.value,e=>(I(),o(O,{key:e.name,command:`push:${e.name}`},{default:z(()=>[c(`span`,lt,[c(`span`,null,E(l(X)(`@F4137:推送到`))+` `+E(e.name),1),e.isUpstream?(I(),o(T,{key:0,size:`small`,type:`success`,effect:`plain`},{default:z(()=>[b(E(l(X)(`@F4137:上游`)),1)]),_:1})):S(``,!0)])]),_:2},1032,[`command`]))),128)),C(O,{divided:``,command:`push-all`},{default:z(()=>[b(E(l(X)(`@F4137:推送到全部远程`)),1)]),_:1}),C(O,{divided:``,command:`manage`},{default:z(()=>[b(E(l(X)(`@F4137:管理远程…`)),1)]),_:1})]),_:1})]),default:z(()=>[C(f,{type:`primary`,icon:l(ee),style:F(g.value),class:K([`push-button__caret`,`from-${t.from}`]),"aria-label":l(X)(`@F4137:更多推送选项`)},null,8,[`icon`,`style`,`class`,`aria-label`])]),_:1})):S(``,!0)]),C(ot,{ref_key:`progressModalRef`,ref:u,modelValue:s.value,"onUpdate:modelValue":r[0]||=e=>s.value=e,onComplete:y},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-ed54022f`]]);n(),G(),w();var dt={class:`one-push-content`},ft={class:`one-push-text`},pt={class:`one-push-title`},mt={key:0,class:`one-push-desc`},ht=Z(h({__name:`QuickPushButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforePush`,`pushStart`,`afterPush`,`clearFields`],setup(e,{expose:t,emit:n}){let i=Q(),a=Ee(),o=R(!1),s=R(null),u=e,d=n,f=k(()=>i.fileList.some(e=>!Me(e.path,a.lockedFiles))),p=k(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),m=k(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!p.value||!u.hasUserCommitMessage||!i.hasUpstream:!f.value&&i.branchAhead===0||!u.hasUserCommitMessage||!i.hasUpstream),h=k(()=>i.isAddingFiles||i.isCommiting||i.isPushing),_=k(()=>{if(i.hasConflictedFiles)return X(`@2E184:存在冲突文件,请先解决冲突`);if(i.isSelectionMode)return i.selectedFiles.size===0?X(`@2E184:请先勾选要推送的文件`):i.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):u.hasUserCommitMessage?i.hasUpstream?X(`@2E184:一键完成:仅暂存所选文件 → 提交 → 推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`);let e=i.branchAhead>0;return!f.value&&!e?X(`@2E184:没有需要提交或推送的更改`):u.hasUserCommitMessage?i.hasUpstream?f.value?X(`@2E184:一键完成:暂存所有更改 → 提交 → 推送到远程仓库`):X(`@2E184:本地已提交,一键推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`)}),v=k(()=>i.isSelectionMode&&p.value?X(`@2E184:一键推送所选`):X(`@2E184:一键推送所有`)),y=k(()=>u.from===`form`?i.isSelectionMode&&p.value?X(`@2E184:暂存所选 + 提交 + 推送`):X(`@2E184:暂存 + 提交 + 推送`):``);async function b(){d(`beforePush`);try{let e=i.isSelectionMode&&p.value;if((e||f.value)&&!(e?await i.stageSelectedAndCommit(u.finalCommitMessage,u.skipHooks):await i.addAndCommit(u.finalCommitMessage,u.skipHooks))){d(`afterPush`,!1);return}if(d(`pushStart`),o.value=!0,a.pullBeforePush){s.value?.setPulling(!0);let e=await i.gitPull();if(s.value?.setPulling(!1),!e.success){L.error(X(`@2E184:拉取远程更新失败,已停止推送`)),o.value=!1,i.fetchStatus(),i.getBranchStatus(!0),d(`afterPush`,!1);return}}s.value&&s.value.reset();let t=await i.pushToRemoteWithProgress(e=>{s.value&&s.value.handleProgress(e)});if(t){try{window.dispatchEvent(new CustomEvent(`zen-gitsync:after-quick-push-success`))}catch{}d(`clearFields`)}d(`afterPush`,t)}catch(e){console.error(`一键推送失败:`,e),d(`afterPush`,!1)}}t({triggerQuickPush:b});function x(e){}return(t,n)=>{let i=g,a=Y;return I(),H(`div`,null,[C(l(M),{content:_.value,placement:`top`,"show-after":200},{default:z(()=>[C(a,{type:`primary`,onClick:b,loading:h.value,disabled:m.value,class:K([e.from,`one-push-button`])},{default:z(()=>[c(`div`,dt,[C(i,{class:`one-push-icon`},{default:z(()=>[C(l(r))]),_:1}),c(`div`,ft,[c(`span`,pt,E(v.value),1),e.from===`form`?(I(),H(`span`,mt,E(y.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`]),C(ot,{ref_key:`progressModalRef`,ref:s,modelValue:o.value,"onUpdate:modelValue":n[0]||=e=>o.value=e,onComplete:x,onPullRequested:b},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-c8c92c10`]]);n(),G(),w();var gt={class:`create-tag-button`},_t={class:`tag-dialog-content`},vt={class:`tag-info-card`},yt={class:`info-icon`},bt={class:`info-content`},xt={class:`form-tip`},St={class:`form-tip`},Ct={class:`form-tip`},wt=Z(h({__name:`CreateTagButton`,props:{variant:{default:`icon`}},setup(e){let t=e,n=Q(),r=R(!1),i=R(``),a=R(``),u=R(`lightweight`),f=R(``),p=R(!1);function m(){i.value=``,a.value=``,u.value=`lightweight`,f.value=``,r.value=!0}async function h(){if(!i.value.trim()){L.warning(X(`@TAG01:请输入标签名称`));return}if(!/^[a-zA-Z0-9._\/-]+$/.test(i.value)){L.warning(X(`@TAG01:标签名称只能包含字母、数字、点、下划线、斜杠和连字符`));return}try{p.value=!0;let e=await(await fetch(`/api/create-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:i.value.trim(),message:a.value.trim(),type:u.value,commit:f.value.trim()})})).json();e.success?(L.success(X(`@TAG01:标签创建成功`)),r.value=!1):L.error(e.error||X(`@TAG01:创建标签失败`))}catch(e){console.error(`创建标签失败:`,e),L.error(X(`@TAG01:创建标签失败`))}finally{p.value=!1}}let v=k(()=>u.value===`lightweight`?X(`@TAG01:轻量标签是指向提交对象的引用,不包含额外信息`):X(`@TAG01:附注标签是完整的Git对象,包含标签信息、日期、标签者和可选的签名`));return(e,x)=>{let w=g,T=Y,D=M,O=A,k=_,j=se,N=y,P=d;return I(),H(`div`,gt,[C(D,{content:l(X)(`@TAG01:为当前提交创建标签`),placement:`top`,"show-after":200,disabled:t.variant===`text`},{default:z(()=>[C(T,{type:`success`,onClick:m,disabled:!l(n).isGitRepo,circle:t.variant===`icon`,size:t.variant===`icon`?`small`:`default`,class:K(t.variant===`text`?`action-button`:``)},{default:z(()=>[t.variant===`icon`?(I(),o(w,{key:0},{default:z(()=>[C(l(q))]),_:1})):(I(),H(J,{key:1},[b(E(l(X)(`@TAG01:创建标签`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Oe,{modelValue:r.value,"onUpdate:modelValue":x[4]||=e=>r.value=e,title:l(X)(`@TAG01:创建 Git 标签`),size:`medium`,"close-on-click-modal":!1,"show-footer":``,"confirm-text":l(X)(`@TAG01:创建`),"cancel-text":l(X)(`@TAG01:取消`),"confirm-loading":p.value,"custom-class":`tag-dialog`,onConfirm:h},{default:z(()=>[c(`div`,_t,[c(`div`,vt,[c(`div`,yt,[C(w,null,{default:z(()=>[C(l(q))]),_:1})]),c(`div`,bt,[c(`h4`,null,E(l(X)(`@TAG01:Git 标签`)),1),c(`p`,null,E(l(X)(`@TAG01:标签用于标记项目的重要版本点,如发布版本 v1.0.0`)),1)])]),C(P,{"label-position":`top`,class:`tag-form`},{default:z(()=>[C(k,{label:l(X)(`@TAG01:标签名称`),required:``},{default:z(()=>[C(O,{modelValue:i.value,"onUpdate:modelValue":x[0]||=e=>i.value=e,placeholder:l(X)(`@TAG01:例如: v1.0.0 或 release-2024`),clearable:``,maxlength:`100`},{prefix:z(()=>[C(w,null,{default:z(()=>[C(l(q))]),_:1})]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,xt,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:建议使用语义化版本号,如 v1.0.0`)),1)])]),_:1},8,[`label`]),C(k,{label:l(X)(`@TAG01:标签类型`)},{default:z(()=>[C(N,{modelValue:u.value,"onUpdate:modelValue":x[1]||=e=>u.value=e,size:`default`},{default:z(()=>[C(j,{value:`lightweight`},{default:z(()=>[b(E(l(X)(`@TAG01:轻量标签`)),1)]),_:1}),C(j,{value:`annotated`},{default:z(()=>[b(E(l(X)(`@TAG01:附注标签`)),1)]),_:1})]),_:1},8,[`modelValue`]),c(`div`,St,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(v.value),1)])]),_:1},8,[`label`]),u.value===`annotated`?(I(),o(k,{key:0,label:l(X)(`@TAG01:标签说明`),required:u.value===`annotated`},{default:z(()=>[C(O,{modelValue:a.value,"onUpdate:modelValue":x[2]||=e=>a.value=e,placeholder:l(X)(`@TAG01:为此标签添加说明信息`),clearable:``,rows:3,type:`textarea`,resize:`none`,maxlength:`500`,"show-word-limit":``},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`required`])):S(``,!0),C(k,{label:l(X)(`@TAG01:目标提交(可选)`)},{default:z(()=>[C(O,{modelValue:f.value,"onUpdate:modelValue":x[3]||=e=>f.value=e,placeholder:l(X)(`@TAG01:留空则为当前HEAD,或输入commit SHA`),clearable:``,maxlength:`40`},{prefix:z(()=>[...x[5]||=[c(`span`,{class:`commit-prefix`},`commit:`,-1)]]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,Ct,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:默认为当前HEAD提交,也可以指定历史提交`)),1)])]),_:1},8,[`label`])]),_:1})])]),_:1},8,[`modelValue`,`title`,`confirm-text`,`cancel-text`,`confirm-loading`])])}}}),[[`__scopeId`,`data-v-871521cb`]]);n(),G(),w();var Tt={class:`tag-list-button`},Et={class:`tag-list-content`},Dt={key:0,class:`tag-header`},Ot={class:`tag-stats`},kt={class:`stat-item`},At={class:`stat-number`},jt={class:`stat-label`},Mt={class:`tag-actions-header`},Nt={class:`tag-list-container`},Pt={key:0,class:`empty-state`},Ft={class:`empty-text`},It={class:`empty-hint`},Lt={key:1,class:`tag-cards`},Rt={class:`tag-card-content`},zt={class:`tag-info`},Bt={class:`tag-main-info`},Vt={class:`tag-name-badge`},Ht={class:`tag-name-text`},Ut={class:`tag-meta`},Wt={class:`tag-commit`},Gt={class:`tag-date`},Kt={key:0,class:`tag-message`},qt={class:`tag-card-actions`},Jt={key:0,class:`tag-detail-content`},Yt={class:`detail-row`},Xt={class:`detail-label`},Zt={class:`detail-value`},Qt={class:`detail-row`},$t={class:`detail-label`},en={class:`detail-value`},tn={class:`detail-row`},nn={class:`detail-label`},rn={class:`detail-value`},an={class:`detail-row`},on={class:`detail-label`},sn={key:0,class:`detail-row detail-message`},cn={class:`detail-label`},ln={class:`message-content`},un=Z(h({__name:`TagListButton`,props:{variant:{default:`icon`}},setup(t){let n=t,r=Q(),i=R(!1),a=R([]),u=R(!1),d=R(!1),f=R(!1),m=R(!1),h=R(null);async function _(){i.value=!0,await y()}async function y(){try{u.value=!0;let e=await(await fetch(`/api/list-tags`)).json();e.success?a.value=e.tags||[]:L.error(e.error||X(`@TAG01:获取标签列表失败`))}catch(e){console.error(`获取标签列表失败:`,e),L.error(X(`@TAG01:获取标签列表失败`))}finally{u.value=!1}}function x(e){h.value=e,m.value=!0}async function w(e){oe.confirm(X(`@TAG01:确定要推送此标签到远程仓库吗?`),X(`@TAG01:推送标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let t=await(await fetch(`/api/push-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?L.success(X(`@TAG01:标签推送成功`)):L.error(t.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),L.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function T(){oe.confirm(X(`@TAG01:确定要推送所有标签到远程仓库吗?`),X(`@TAG01:推送所有标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let e=await(await fetch(`/api/push-all-tags`,{method:`POST`})).json();e.success?L.success(X(`@TAG01:所有标签推送成功`)):L.error(e.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),L.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function D(e){oe.confirm(X(`@TAG01:确定要删除此标签吗?此操作不可恢复。`),X(`@TAG01:删除标签`),{confirmButtonText:X(`@TAG01:删除`),cancelButtonText:X(`@TAG01:取消`),type:`warning`}).then(async()=>{await O(e)}).catch(()=>{})}async function O(e){try{d.value=!0;let t=await(await fetch(`/api/delete-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?(L.success(X(`@TAG01:标签删除成功`)),await y()):L.error(t.error||X(`@TAG01:删除标签失败`))}catch(e){console.error(`删除标签失败:`,e),L.error(X(`@TAG01:删除标签失败`))}finally{d.value=!1}}function k(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}return(t,O)=>{let A=g,j=Y,N=M,P=xe,ee=v,te=pe;return I(),H(`div`,Tt,[C(N,{content:l(X)(`@TAG01:查看和管理所有标签`),placement:`top`,"show-after":200,disabled:n.variant===`text`},{default:z(()=>[C(j,{type:`info`,onClick:_,disabled:!l(r).isGitRepo,circle:n.variant===`icon`,size:n.variant===`icon`?`small`:`default`,class:K(n.variant===`text`?`action-button`:``)},{default:z(()=>[n.variant===`icon`?(I(),o(A,{key:0},{default:z(()=>[C(l(q))]),_:1})):(I(),H(J,{key:1},[b(E(l(X)(`@TAG01:标签列表`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Oe,{modelValue:i.value,"onUpdate:modelValue":O[0]||=e=>i.value=e,title:l(X)(`@TAG01:Git 标签列表`),size:`large`,"show-footer":!1,"custom-class":`tag-list-dialog`},{default:z(()=>[c(`div`,Et,[u.value?S(``,!0):(I(),H(`div`,Dt,[c(`div`,Ot,[c(`div`,kt,[C(A,{class:`stat-icon`},{default:z(()=>[C(l(q))]),_:1}),c(`span`,At,E(a.value.length),1),c(`span`,jt,E(l(X)(`@TAG01:个标签`)),1)])]),c(`div`,Mt,[C(j,{type:`primary`,size:`small`,icon:l(p),onClick:y,loading:u.value,class:`refresh-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:刷新`)),1)]),_:1},8,[`icon`,`loading`]),a.value.length>0?(I(),o(j,{key:0,type:`success`,size:`small`,icon:l(de),onClick:T,loading:f.value,class:`push-all-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:推送所有标签`)),1)]),_:1},8,[`icon`,`loading`])):S(``,!0)])])),le((I(),H(`div`,Nt,[a.value.length===0&&!u.value?(I(),H(`div`,Pt,[C(P,{description:l(X)(`@TAG01:暂无标签`),"image-size":120},{image:z(()=>[C(A,{class:`empty-icon`},{default:z(()=>[C(l(q))]),_:1})]),description:z(()=>[c(`p`,Ft,E(l(X)(`@TAG01:还没有创建任何标签`)),1),c(`p`,It,E(l(X)(`@TAG01:使用创建标签功能为项目添加版本标记`)),1)]),_:1},8,[`description`])])):(I(),H(`div`,Lt,[(I(!0),H(J,null,e(a.value,e=>(I(),H(`div`,{key:e.name,class:`tag-card`},[c(`div`,Rt,[c(`div`,zt,[c(`div`,Bt,[c(`div`,Vt,[C(A,{class:`badge-icon`},{default:z(()=>[C(l(q))]),_:1}),c(`span`,Ht,E(e.name),1),C(ee,{size:`small`,type:e.type===`annotated`?`warning`:`info`,class:`type-tag`},{default:z(()=>[b(E(e.type===`annotated`?l(X)(`@TAG01:附注`):l(X)(`@TAG01:轻量`)),1)]),_:2},1032,[`type`])]),c(`div`,Ut,[c(`span`,Wt,[C(A,null,{default:z(()=>[C(l(s))]),_:1}),b(` `+E(e.commit.substring(0,8)),1)]),c(`span`,Gt,E(k(e.date)),1)]),e.message?(I(),H(`div`,Kt,E(e.message),1)):S(``,!0)])]),c(`div`,qt,[e.message?(I(),o(j,{key:0,size:`small`,type:`info`,onClick:t=>x(e),class:`action-btn view-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:查看`)),1)]),_:1},8,[`onClick`])):S(``,!0),C(j,{size:`small`,type:`success`,icon:l(de),onClick:t=>w(e.name),loading:f.value,class:`action-btn push-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:推送`)),1)]),_:1},8,[`icon`,`onClick`,`loading`]),C(j,{size:`small`,type:`danger`,icon:l(ue),onClick:t=>D(e.name),loading:d.value,class:`action-btn delete-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:删除`)),1)]),_:1},8,[`icon`,`onClick`,`loading`])])])]))),128))]))])),[[te,u.value]])])]),_:1},8,[`modelValue`,`title`]),C(Oe,{modelValue:m.value,"onUpdate:modelValue":O[1]||=e=>m.value=e,title:l(X)(`@TAG01:标签详情`),size:`medium`,"show-footer":!1,"custom-class":`tag-detail-dialog`},{default:z(()=>[h.value?(I(),H(`div`,Jt,[c(`div`,Yt,[c(`span`,Xt,E(l(X)(`@TAG01:标签名称:`)),1),c(`code`,Zt,E(h.value.name),1)]),c(`div`,Qt,[c(`span`,$t,E(l(X)(`@TAG01:提交SHA:`)),1),c(`code`,en,E(h.value.commit),1)]),c(`div`,tn,[c(`span`,nn,E(l(X)(`@TAG01:创建时间:`)),1),c(`span`,rn,E(k(h.value.date)),1)]),c(`div`,an,[c(`span`,on,E(l(X)(`@TAG01:类型:`)),1),C(ee,{type:h.value.type===`annotated`?`warning`:`info`,size:`small`},{default:z(()=>[b(E(h.value.type===`annotated`?l(X)(`@TAG01:附注标签`):l(X)(`@TAG01:轻量标签`)),1)]),_:1},8,[`type`])]),h.value.message?(I(),H(`div`,sn,[c(`span`,cn,E(l(X)(`@TAG01:标签说明:`)),1),c(`div`,ln,E(h.value.message),1)])):S(``,!0)])):S(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-366ce062`]]);n(),G(),w();var dn={class:`git-operations-button`},fn={class:`actions-section`},pn={class:`action-groups`},mn={class:`action-group`},hn={class:`group-title`},gn={class:`group-buttons`},_n={key:0},vn={class:`action-group`},yn={class:`group-title`},bn={class:`group-buttons`},xn={class:`action-group`},Sn={class:`group-title`},Cn={class:`group-buttons`},wn={key:0},Tn={class:`action-group`},En={class:`group-title`},Dn={class:`group-buttons`},On={class:`action-group`},kn={class:`group-title`},An={class:`group-buttons`},jn={class:`action-group`},Mn={class:`group-title`},Nn={class:`group-buttons`},Pn={class:`pull-error-content`},Fn={key:0},In={key:1},Ln={class:`pull-error-detail`},Rn={class:`pull-error-label`},zn={class:`pull-error-pre`},Bn=Z(h({__name:`GitOperationsButton`,props:{variant:{default:`icon`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`clearFields`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Q(),u=R(!1),d=R(!1),f=R({needsMerge:!1,error:``,fullError:``,pullOutput:``});function p(){u.value=!0}let m=k(()=>a.fileList.filter(e=>e.type===`added`).length),h=k(()=>a.branchBehind>0),_=k(()=>a.fileList.some(e=>[`modified`,`deleted`,`untracked`,`intent-to-add`].includes(e.type)));async function v(){try{let e=await a.gitPull();e.success?(await a.fetchStatus(),await a.fetchLog(!1)):(f.value={needsMerge:e.needsMerge,error:e.error,fullError:e.fullError,pullOutput:e.pullOutput},d.value=!0)}catch(e){console.error(`拉取失败:`,e)}}async function y(){try{await a.gitFetchAll(),await a.fetchStatus(),await a.fetchLog(!1)}catch(e){console.error(`获取远程分支失败:`,e)}}async function w(){if(r.hasUserCommitMessage)try{await a.addAndCommit(r.finalCommitMessage,r.skipHooks),a.fetchStatus(),a.fetchLog(),i(`afterCommit`,!0),i(`clearFields`)}catch(e){console.error(`暂存并提交失败:`,e)}}function T(){i(`beforePush`)}function D(e){i(`afterPush`,e)}function A(){i(`clearFields`)}return t({openGitOperationsDrawer:p}),(t,n)=>{let k=g,j=Y,P=M,ee=O;return I(),H(`div`,dn,[r.variant===`icon`?(I(),o(we,{key:0,tooltip:l(X)(`@F13B4:Git 操作`),size:`large`,"custom-class":`btn-rotate-on-hover`,onClick:p},{default:z(()=>[C(k,null,{default:z(()=>[C(l(x))]),_:1})]),_:1},8,[`tooltip`])):(I(),o(j,{key:1,type:`primary`,class:`action-button`,onClick:p},{default:z(()=>[b(E(l(X)(`@F13B4:Git 操作`)),1)]),_:1})),C(ee,{modelValue:u.value,"onUpdate:modelValue":n[2]||=e=>u.value=e,title:l(X)(`@76872:Git 操作`),direction:`rtl`,size:`362px`,"with-header":!0,"show-close":!0,"destroy-on-close":!1,"append-to-body":!0,class:`git-operations-drawer`},{default:z(()=>[c(`div`,fn,[c(`div`,pn,[c(`div`,mn,[c(`div`,hn,E(l(X)(`@76872:基础操作`)),1),c(`div`,gn,[C(ze,{onClick:()=>{},from:`drawer`}),C(Ne,{onClick:()=>{},from:`drawer`}),C(Ve,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:n[0]||=e=>i(`afterCommit`,e),onClick:()=>{},from:`drawer`},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(ut,{onBeforePush:()=>{},onAfterPush:n[1]||=e=>i(`afterPush`,e),onClick:()=>{},from:`drawer`}),C(P,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):h.value?`${l(X)(`@76872:拉取`)}${l(a).branchBehind}${l(X)(`@76872:个远程提交`)}`:`git pull`,placement:`top`},{default:z(()=>[C(j,{type:`primary`,icon:l(U),onClick:v,loading:l(a).isGitPulling,disabled:!l(a).hasUpstream||l(a).hasConflictedFiles,class:`action-button`,style:F(l(a).hasUpstream&&!l(a).hasConflictedFiles?{color:`white`,backgroundColor:`var(--color-primary)`,borderColor:`var(--color-primary)`}:{})},{default:z(()=>[b(E(l(X)(`@76872:拉取`))+` `,1),h.value?(I(),H(`span`,_n,`(`+E(l(a).branchBehind)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`])]),_:1},8,[`content`]),C(P,{content:`git fetch --all`,placement:`top`},{default:z(()=>[C(j,{type:`info`,icon:l(ge),onClick:y,loading:l(a).isGitFetching,class:`action-button`,style:{color:`white`,"background-color":`var(--color-primary)`,"border-color":`var(--color-primary)`}},{default:z(()=>[b(E(l(X)(`@76872:获取所有远程分支`)),1)]),_:1},8,[`icon`,`loading`])]),_:1})])]),c(`div`,vn,[c(`div`,yn,E(l(X)(`@76872:组合操作`)),1),c(`div`,bn,[C(P,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):`git add + git commit`,placement:`top`},{default:z(()=>[C(j,{type:`primary`,icon:l(V),onClick:w,loading:l(a).isAddingFiles||l(a).isCommiting,disabled:!_.value||!e.hasUserCommitMessage||l(a).hasConflictedFiles,class:`action-button`},{default:z(()=>[b(E(l(X)(`@76872:暂存并提交`)),1)]),_:1},8,[`icon`,`loading`,`disabled`])]),_:1},8,[`content`]),C(ht,{from:`drawer`,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:T,onAfterPush:D,onClearFields:A},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])]),c(`div`,xn,[c(`div`,Sn,E(l(X)(`@76872:重置操作`)),1),c(`div`,Cn,[C(P,{content:m.value>0?`${l(X)(`@76872:撤销`)}${m.value}${l(X)(`@76872:个已暂存文件`)}`:`git reset HEAD`,placement:`top`},{default:z(()=>[C(j,{type:`warning`,icon:l(N),onClick:l(a).resetHead,loading:l(a).isResetting,disabled:m.value===0||l(a).hasConflictedFiles,class:`action-button reset-button`},{default:z(()=>[b(E(l(X)(`@76872:重置暂存区`))+` `,1),m.value>0?(I(),H(`span`,wn,`(`+E(m.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`onClick`,`loading`,`disabled`])]),_:1},8,[`content`]),C(Ie,{variant:`text`})])]),c(`div`,Tn,[c(`div`,En,E(l(X)(`@76872:分支操作`)),1),c(`div`,Dn,[C(Fe,{variant:`text`})])]),c(`div`,On,[c(`div`,kn,E(l(X)(`@76872:储藏操作`)),1),c(`div`,An,[C(Pe,{variant:`text`}),C(Ae,{variant:`text`})])]),c(`div`,jn,[c(`div`,Mn,E(l(X)(`@TAG01:标签操作`)),1),c(`div`,Nn,[C(wt,{variant:`text`}),C(un,{variant:`text`})])])])])]),_:1},8,[`modelValue`,`title`]),C(Oe,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,title:f.value.needsMerge?l(X)(`@76872:需要合并更改`):l(X)(`@76872:拉取失败`),size:`medium`,"show-footer":!0,"show-cancel":!1,"confirm-text":l(X)(`@76872:我知道了`),"append-to-body":!0,onConfirm:n[4]||=e=>d.value=!1},{default:z(()=>[c(`div`,Pn,[c(`div`,{class:K([`pull-error-type`,f.value.needsMerge?`is-warning`:`is-error`])},[C(k,{class:`pull-error-icon`},{default:z(()=>[C(l(s))]),_:1}),f.value.needsMerge?(I(),H(`span`,Fn,E(l(X)(`@76872:本地存在未提交的更改,与远程内容冲突,请先处理本地更改后再拉取。`)),1)):(I(),H(`span`,In,E(l(X)(`@76872:执行 git pull 时发生错误,请查看详细信息。`)),1))],2),c(`div`,Ln,[c(`div`,Rn,E(l(X)(`@76872:错误详情`))+`:`,1),c(`pre`,zn,E(f.value.fullError||f.value.error),1)])])]),_:1},8,[`modelValue`,`title`,`confirm-text`])])}}}),[[`__scopeId`,`data-v-feb8c688`]]);n(),w(),ae();var Vn={class:`loading-container`},Hn={class:`loading-text`},Un={key:0,class:`loading-progress`},Wn=h({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),o(a,{to:`body`},[C(ce,{name:`loading-fade`},{default:z(()=>[e.visible||e.mock?(I(),H(`div`,{key:0,class:`global-loading-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Vn,[n[1]||=c(`div`,{class:`loading-spinner`},[c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`})],-1),c(`div`,Hn,E(e.text),1),e.showProgress||e.mock?(I(),H(`div`,Un,[c(`div`,{class:K([`progress-bar`,{"is-mock":e.mock&&!e.showProgress}]),style:F(e.showProgress?{width:e.progress+`%`}:void 0)},null,6)])):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Gn=Z(Wn,[[`__scopeId`,`data-v-691919d3`]]);n(),w(),ae();var Kn={class:`success-container`},qn={class:`success-text`},Jn={key:0,class:`success-description`},Yn=h({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@71545:操作成功!`)},description:{default:``}},setup(e){return(t,n)=>(I(),o(a,{to:`body`},[C(ce,{name:`success-fade`},{default:z(()=>[e.visible?(I(),H(`div`,{key:0,class:`success-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Kn,[n[1]||=c(`div`,{class:`success-icon`},[c(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[c(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),c(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),c(`div`,qn,E(e.text),1),e.description?(I(),H(`div`,Jn,E(e.description),1)):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Xn=Z(Yn,[[`__scopeId`,`data-v-c3fad05d`]]);G();var $=ye({visible:!1,text:X(`@F2A3A:加载中...`),showProgress:!1,progress:0});function Zn(){return{loadingState:$,show:e=>{$.visible=!0,$.text=e?.text||X(`@F2A3A:加载中...`),$.showProgress=e?.showProgress||!1,$.progress=e?.progress||0},hide:()=>{$.visible=!1},updateProgress:e=>{$.progress=Math.max(0,Math.min(100,e))},updateText:e=>{$.text=e},setText:e=>{$.visible&&($.text=e)}}}G();var Qn=ye({visible:!1,text:X(`@B8591:操作成功!`),description:``});function $n(){let e=e=>{Qn.visible=!0,Qn.text=e?.text||X(`@B8591:操作成功!`),Qn.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{Qn.visible=!1};return{successState:Qn,show:e,hide:t}}n(),G(),w();var er={class:`one-commit-content`},tr={class:`one-commit-text`},nr={class:`one-commit-title`},rr={key:0,class:`one-commit-desc`},ir=Z(h({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(e,{expose:t,emit:n}){let r=Q(),i=Ee(),a=e,o=n,s=k(()=>r.fileList.some(e=>!Me(e.path,i.lockedFiles))),u=k(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),d=k(()=>r.hasConflictedFiles?!0:r.isSelectionMode?!u.value||!a.hasUserCommitMessage:!s.value||!a.hasUserCommitMessage),f=k(()=>r.isAddingFiles||r.isCommiting),p=k(()=>r.hasConflictedFiles?X(`@2E184:存在冲突文件,请先解决冲突`):r.isSelectionMode?r.selectedFiles.size===0?X(`@2E184:请先勾选要提交的文件`):r.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):a.hasUserCommitMessage?X(`@2E184:一键完成:仅暂存所选文件 → 提交`):X(`@2E184:请输入提交信息`):s.value?a.hasUserCommitMessage?X(`@2E184:一键完成:暂存所有更改 → 提交`):X(`@2E184:请输入提交信息`):X(`@2E184:没有需要提交的更改`)),m=k(()=>r.isSelectionMode&&u.value?X(`@2E184:一键提交所选`):X(`@2E184:一键提交`)),h=k(()=>a.from===`form`?r.isSelectionMode&&u.value?X(`@2E184:暂存所选 + 提交`):X(`@2E184:暂存 + 提交`):``);async function _(){o(`beforeCommit`);try{let e=await r.stageSelectedAndCommit(a.finalCommitMessage,a.skipHooks);e&&o(`clearFields`),o(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),o(`afterCommit`,!1)}}return t({triggerQuickCommit:_}),(t,n)=>{let r=g,i=Y;return I(),H(`div`,null,[C(l(M),{content:p.value,placement:`top`,"show-after":200},{default:z(()=>[C(i,{type:`primary`,onClick:_,loading:f.value,disabled:d.value,class:K([e.from,`one-commit-button`])},{default:z(()=>[c(`div`,er,[C(r,{class:`one-commit-icon`},{default:z(()=>[C(l(V))]),_:1}),c(`div`,tr,[c(`span`,nr,E(m.value),1),e.from===`form`?(I(),H(`span`,rr,E(h.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-91c441c2`]]);n(),G();var ar={class:`form-bottom-actions`},or={class:`actions-flex-container`},sr={class:`left-actions`},cr={class:`button-grid`},lr={class:`right-actions`},ur=Z(h({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`],setup(e,{expose:t,emit:n}){let r=n,i=R(null);function a(e){r(`afterCommit`,e)}function o(e){r(`afterPush`,e)}function s(){r(`beforePush`)}function l(){r(`pushStart`)}function u(){r(`clearFields`)}async function d(){return i.value?.triggerQuickPush()}return t({triggerQuickPush:d}),(t,n)=>(I(),H(`div`,ar,[c(`div`,or,[c(`div`,sr,[c(`div`,cr,[C(ze,{onClick:()=>{},from:e.from},null,8,[`from`]),C(Ve,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:a,onClick:()=>{},from:e.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),C(ut,{onBeforePush:()=>{},onAfterPush:o,onClick:()=>{},from:e.from},null,8,[`from`])])]),c(`div`,lr,[C(ir,{from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onAfterCommit:a,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(ht,{ref_key:`quickPushRef`,ref:i,from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:s,onPushStart:l,onAfterPush:o,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])])]))}}),[[`__scopeId`,`data-v-6dc84697`]]);n(),G(),w(),ae();var dr={class:`dialog-toolbar`},fr={class:`filter-controls`},pr={class:`toolbar-actions`},mr=[`disabled`],hr={class:`btn-text`},gr=[`disabled`],_r={class:`btn-text`},vr=[`disabled`],yr={class:`btn-text`},br={class:`history-scroll`},xr={key:0,class:`loading-state`},Sr={class:`loading-text`},Cr={key:3,class:`history-list`},wr=[`onClick`],Tr={class:`command-info`},Er={class:`command-text`},Dr={class:`command-meta`},Or={class:`timestamp`},kr={class:`duration`},Ar={class:`item-actions`},jr={key:0,class:`item-details`},Mr={key:0,class:`output-section`},Nr={class:`output-header`},Pr=[`onClick`],Fr={class:`output-content`},Ir={key:0,class:`truncation-notice`},Lr={class:`output-header`},Rr={class:`output-content`},zr={key:0,class:`truncation-notice`},Br={key:2,class:`output-section error`},Vr={class:`output-header`},Hr={class:`output-content`},Ur=Z(h({__name:`CommandHistory`,setup(n){let r=Q(),i=R([]),a=R(!1);function s(e){return Array.isArray(e)?e.join(` `):e==null?``:String(e)}let d=R(!1),p=R(!1),h=R(!1),_=R(new Set),y=R(!1),x=R(!1),w=R(`all`),D=R(`all`),O=R(``),j=k(()=>{let e=i.value;if(w.value!==`all`&&(e=e.filter(e=>w.value===`success`?e.success:!e.success)),D.value!==`all`&&(e=e.filter(e=>{let t=s(e.command).startsWith(`git `);return D.value===`git`?t:!t})),O.value.trim()){let t=O.value.toLowerCase();e=e.filter(e=>s(e.command).toLowerCase().includes(t)||e.stdout&&e.stdout.toLowerCase().includes(t)||e.stderr&&e.stderr.toLowerCase().includes(t)||e.error&&e.error.toLowerCase().includes(t))}return e}),N=k(()=>i.value.filter(e=>e.success).length),F=k(()=>i.value.filter(e=>!e.success).length),ne=k(()=>i.value.filter(e=>s(e.command).startsWith(`git `)).length),ae=k(()=>i.value.filter(e=>!s(e.command).startsWith(`git `)).length);function V(){x.value=!0,i.value.length===0&&se()}async function se(){try{if(a.value=!0,r.socket&&r.socket.connected)r.socket.emit(`request_full_history`);else{let e=await(await fetch(`/api/command-history`)).json();e.success?i.value=e.history:L.error(`${X(`@81F0F:加载命令历史失败: `)}${e.error}`)}}catch(e){L.error(`${X(`@81F0F:加载命令历史失败: `)}${e.message}`)}finally{a.value=!1}}async function ce(){if(j.value.length===0){L.warning(X(`@81F0F:没有可复制的命令历史`));return}try{p.value=!0;let e=j.value.map(e=>{let t=`# ${de(e.timestamp)}${X(`@81F0F: (耗时: `)}${fe(e.executionTime)}) - ${e.success?X(`@81F0F:成功`):X(`@81F0F:失败`)}\n`;if(t+=`${s(e.command)}\n`,e.stdout&&(t+=`\n# 输出:\n${e.stdout}\n`),e.stderr){let n=q(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`\n# ${n}:\n${e.stderr}\n`}return e.error&&(t+=`\n# 错误信息:\n${e.error}\n`),t}).join(`
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Bt as r,C as i,Cn as a,Dn as o,Dt as s,En as c,Er as l,F as u,G as d,Gt as f,Ht as p,I as m,In as h,J as g,K as _,L as v,M as y,Nn as b,Nt as x,On as S,Pn as C,Pr as w,Q as T,Qr as E,S as D,T as O,Tn as k,U as A,V as j,W as M,Wt as N,Xn as P,Y as ee,Yn as te,Yr as F,Zn as I,_ as ne,a as L,at as re,bn as ie,br as R,cr as z,ct as B,dn as ae,ht as V,i as oe,j as se,kn as H,ln as ce,lr as le,lt as ue,mt as U,nn as de,nt as fe,o as pe,or as W,ot as me,pr as G,q as he,qr as K,qt as q,st as ge,tt as _e,vn as ve,vr as ye,w as be,x as xe,xn as J,z as Y,zt as Se}from"./element-plus-CgEuJBlB.js";import{b as Ce}from"./vendor-CDZ64WVU.js";import{n as X,t as Z}from"./_plugin-vue_export-helper-DkeTtFKF.js";import{t as we}from"./IconButton-BuiJBsJ3.js";import{r as Te,t as Ee}from"./configStore-Y1biBqmb.js";import{i as De,r as Q}from"./gitStore-CiBz68_Z.js";import{t as Oe}from"./CommonDialog-Nwwi4-_9.js";import{t as ke}from"./TemplateManager-BIMeoTp0.js";import{C as Ae,S as je,T as Me,b as Ne,w as Pe,x as Fe,y as Ie}from"./index-BoZNUwmd.js";n(),G(),w();var Le={key:0},Re={key:1},ze=Z(h({__name:`StageButton`,props:{from:{default:`form`}},emits:[`click`],setup(e,{emit:t}){let n=t,r=Q(),i=Ee();function a(e){let t=e.replace(/\\/g,`/`);return i.lockedFiles.some(e=>{let n=e.replace(/\\/g,`/`);return t===n})}function s(){return i.lockedFiles.length!==0&&r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)?a(e.path):!1)}let c=k(()=>r.fileList.filter(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path)).length),u=k(()=>r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path))),d=k(()=>r.isSelectionMode&&r.hasSelectableFiles),f=k(()=>r.selectedUnstagedPaths.length),p=k(()=>r.isSelectionMode?f.value===0:!u.value),m=k(()=>d.value?`${X(`@29974:暂存所选 `)}${f.value}${X(`@29974: 个文件`)}`:u.value?s()?`${X(`@29974:暂存`)}${c.value}${X(`@29974:个未暂存文件(逐个添加)`)}`:`${X(`@29974:暂存所有更改(git add .)`)}`:X(`@29974:没有需要暂存的更改`));async function h(){n(`click`);try{if(d.value){await r.stageFiles(r.selectedUnstagedPaths);return}if(r.isSelectionMode)return;s()?await r.addToStage():await r.addAllToStage()}catch(e){console.error(`添加文件失败:`,e)}}return(t,n)=>{let i=Y,a=M;return I(),o(a,{content:m.value,placement:`top`},{default:z(()=>[C(i,{type:`primary`,icon:l(Se),onClick:h,loading:l(r).isAddingFiles,disabled:p.value,class:K([`stage-button`,`from-${e.from}`,{"is-selective":d.value}])},{default:z(()=>[b(E(d.value?l(X)(`@29974:暂存所选`):l(X)(`@29974:暂存`))+` `,1),d.value?(I(),H(`span`,Le,`(`+E(f.value)+`)`,1)):c.value>0?(I(),H(`span`,Re,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`class`])]),_:1},8,[`content`])}}}),[[`__scopeId`,`data-v-7c59a857`]]);n(),G(),w();var Be={key:0},Ve=Z(h({__name:`CommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`click`,`beforeCommit`,`afterCommit`],setup(e,{emit:n}){let r=e,i=n,a=Q(),s=Ee(),c=k(()=>a.fileList.filter(e=>e.type===`added`&&!Me(e.path,s.lockedFiles)).length),u=k(()=>c.value>0),d=k(()=>a.hasConflictedFiles||a.isCommiting?!0:a.isMergeInProgress?!r.hasUserCommitMessage:!u.value||!r.hasUserCommitMessage),f=k(()=>a.isCommiting?X(`@76A11:正在提交中…`):a.hasConflictedFiles?X(`@76A11:存在冲突文件,请先解决冲突`):a.isMergeInProgress?r.hasUserCommitMessage?X(`@76A11:提交并完成合并`):X(`@76A11:请输入提交信息`):u.value?r.hasUserCommitMessage?`${X(`@76A11:提交`)}${c.value}${X(`@76A11:个已暂存文件`)}`:X(`@76A11:请输入提交信息`):X(`@76A11:没有已暂存的更改`)),p=k(()=>a.isCommiting?X(`@76A11:提交中…`):X(`@76A11:提交`));async function m(){if(r.finalCommitMessage.trim()){i(`beforeCommit`),i(`click`);try{let e=await a.commitChanges(r.finalCommitMessage,r.skipHooks);i(`afterCommit`,e)}catch(e){console.error(`提交失败:`,e),i(`afterCommit`,!1)}}}return(n,r)=>{let i=Y,s=M;return I(),o(s,{content:f.value,placement:`top`,disabled:l(a).isCommiting},{default:z(()=>[C(i,{type:`primary`,onClick:m,icon:l(a).isCommiting?l(t):l(_e),loading:l(a).isCommiting,disabled:d.value,"aria-busy":l(a).isCommiting?`true`:void 0,"aria-label":l(a).isCommiting?l(X)(`@76A11:正在提交中…`):void 0,class:K([`commit-button`,`from-${e.from}`,{"is-committing":l(a).isCommiting}])},{default:z(()=>[b(E(p.value)+` `,1),c.value>0&&!l(a).isCommiting?(I(),H(`span`,Be,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`aria-busy`,`aria-label`,`class`])]),_:1},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-056f6f5d`]]);n(),G(),w();var He={class:`push-progress-container`},Ue={key:0,class:`pulling-section`},We={class:`pulling-text-wrap`},Ge={class:`pulling-title`},Ke={class:`pulling-sub`},qe={class:`stage-header`},Je={class:`stage-icon`},Ye={class:`stage-info`},Xe={class:`stage-label`},Ze={key:0,class:`stage-percent`},Qe={key:0,class:`stage-progress`},$e={key:2,class:`error-section`},et={class:`error-header`},tt={class:`error-title`},nt={class:`error-content`},rt={key:0,class:`error-suggestion`},it={key:3,class:`messages-section`},at={class:`messages-title`},ot=Z(h({__name:`PushProgressModal`,props:{modelValue:{type:Boolean}},emits:[`update:modelValue`,`complete`,`pull-requested`],setup(n,{expose:r,emit:i}){let{t:a}=Ce(),s=n,u=i,d=Ee(),f=Q(),p=R(`progress`),m=R([]),h=R(``),_=R(!1),v=k(()=>h.value.includes(`non-fast-forward`)||h.value.includes(`rejected`)&&h.value.includes(`fetch first`)),y=R(!1);async function x(){y.value=!0;try{(await f.gitPull()).success&&(O.value=!1,u(`pull-requested`))}finally{y.value=!1}}let w=ye([{name:`counting`,label:a(`@PUSH:计数对象`),status:`wait`,percent:0},{name:`compressing`,label:a(`@PUSH:压缩对象`),status:`wait`,percent:0},{name:`writing`,label:a(`@PUSH:写入对象`),status:`wait`,percent:0},{name:`resolving`,label:a(`@PUSH:解析增量`),status:`wait`,percent:0}]),T=R(0),D=R(null),O=k({get:()=>s.modelValue,set:e=>u(`update:modelValue`,e)}),A=k(()=>{if(_.value)return a(`@PUSH:正在拉取远程更新`);switch(p.value){case`progress`:return a(`@PUSH:正在推送`);case`success`:return a(`@PUSH:推送成功`);case`error`:return a(`@PUSH:推送失败`);default:return``}});function j(e){switch(e.type){case`progress`:e.message&&(m.value.push(e.message),setTimeout(()=>{D.value&&(D.value.scrollTop=D.value.scrollHeight)},0));break;case`stage-progress`:if(e.stage&&typeof e.percent==`number`){let t=w.findIndex(t=>t.name===e.stage);t!==-1&&(w[t].percent=e.percent,w[t].status=e.percent===100?`finish`:`process`,T.value=t,e.percent===100&&t<w.length-1&&(w[t+1].status=`wait`))}break;case`complete`:e.success?(p.value=`success`,w.forEach(e=>{(e.status===`process`||e.status===`wait`)&&(e.status=`finish`,e.percent=100)}),T.value=-1,d.autoClosePushModal?setTimeout(()=>{O.value=!1,u(`complete`,!0)},2e3):u(`complete`,!0)):(p.value=`error`,h.value=De(e),T.value<w.length&&(w[T.value].status=`error`),T.value=-1,u(`complete`,!1))}}function M(){p.value=`progress`,m.value=[],h.value=``,T.value=0,_.value=!1,w.forEach(e=>{e.status=`wait`,e.percent=0})}function N(e){_.value=e}return r({handleProgress:j,reset:M,setPulling:N}),(n,r)=>{let i=Y;return I(),o(Oe,{modelValue:O.value,"onUpdate:modelValue":r[0]||=e=>O.value=e,title:A.value,width:`650px`,type:`flex`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":p.value!==`progress`,"append-to-body":!0,"lock-scroll":!1,"destroy-on-close":``,"custom-class":`push-progress-dialog status-${p.value}`},{default:z(()=>[c(`div`,He,[_.value?(I(),H(`div`,Ue,[r[1]||=c(`div`,{class:`pulling-icon-wrap`},[c(`svg`,{class:`pulling-spinner`,viewBox:`0 0 50 50`},[c(`circle`,{class:`pulling-spinner-track`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`}),c(`circle`,{class:`pulling-spinner-arc`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`})])],-1),c(`div`,We,[c(`div`,Ge,E(l(a)(`@PUSH:正在拉取远程更新`)),1),c(`div`,Ke,E(l(a)(`@PUSH:拉取完成后自动继续推送`)),1)])])):(I(),H(`div`,{key:1,class:K([`stages-section`,{"is-loading":p.value===`progress`,"is-success":p.value===`success`}])},[(I(!0),H(J,null,e(w,(e,n)=>(I(),H(`div`,{key:e.name,class:K([`stage-item`,{active:T.value===n,finished:e.status===`finish`,error:e.status===`error`}])},[c(`div`,qe,[c(`div`,Je,[e.status===`finish`?(I(),o(l(g),{key:0,class:`icon-finish`},{default:z(()=>[C(l(fe))]),_:1})):e.status===`error`?(I(),o(l(g),{key:1,class:`icon-error`},{default:z(()=>[C(l(me))]),_:1})):e.status===`process`?(I(),o(l(g),{key:2,class:`icon-process rotating`},{default:z(()=>[C(l(t))]),_:1})):(I(),o(l(g),{key:3,class:`icon-wait`},{default:z(()=>[C(l(t))]),_:1}))]),c(`div`,Ye,[c(`div`,Xe,E(e.label),1),e.status===`process`||e.status===`finish`?(I(),H(`div`,Ze,E(e.percent)+`% `,1)):S(``,!0)])]),e.status===`process`||e.status===`finish`?(I(),H(`div`,Qe,[C(l(ne),{percentage:e.percent,"stroke-width":6,"show-text":!1,color:e.status===`finish`?`var(--color-success)`:`var(--color-primary)`},null,8,[`percentage`,`color`])])):S(``,!0)],2))),128))],2)),p.value===`error`&&h.value?(I(),H(`div`,$e,[c(`div`,et,[c(`div`,tt,E(l(a)(`@PUSH:错误详情`))+`:`,1),v.value?(I(),o(i,{key:0,type:`primary`,size:`small`,loading:y.value,onClick:x,class:`pull-button`},{default:z(()=>[C(l(g),null,{default:z(()=>[C(l(U))]),_:1}),b(` `+E(l(a)(`@PUSH:先拉取更新`)),1)]),_:1},8,[`loading`])):S(``,!0)]),c(`div`,nt,E(h.value),1),v.value?(I(),H(`div`,rt,E(l(a)(`@PUSH:检测到远程有新提交,请先拉取更新后再推送。`)),1)):S(``,!0)])):S(``,!0),m.value.length>0?(I(),H(`div`,it,[c(`div`,at,E(l(a)(`@PUSH:详细信息`))+`:`,1),c(`div`,{ref_key:`messagesContainerRef`,ref:D,class:`progress-messages`},[(I(!0),H(J,null,e(m.value,(e,t)=>(I(),H(`div`,{key:t,class:`message-item`},E(e),1))),128))],512)])):S(``,!0)])]),_:1},8,[`modelValue`,`title`,`show-close`,`custom-class`])}}}),[[`__scopeId`,`data-v-3d7c968a`]]);n(),G(),w();var st={class:`push-button-group`},ct={key:0},lt={class:`push-remote-item`},ut=Z(h({__name:`PushButton`,props:{from:{default:`form`}},emits:[`click`,`beforePush`,`afterPush`],setup(t,{emit:n}){let r=n,a=Q(),s=R(!1),u=R(null),d=k(()=>a.branchAhead>0),f=k(()=>a.fileList.some(e=>e.type===`added`)),p=k(()=>!a.hasConflictedFiles&&a.hasUpstream&&d.value&&!f.value),m=k(()=>!p.value),h=k(()=>a.hasConflictedFiles?X(`@F4137:存在冲突文件,请先解决冲突`):a.hasUpstream?d.value?f.value?X(`@F4137:有未提交的暂存更改,请先提交`):`${X(`@F4137:推送`)}${a.branchAhead}${X(`@F4137:个本地提交`)}`:X(`@F4137:没有需要推送的提交`):X(`@F4137:当前分支没有上游分支`)),g=k(()=>p.value?{backgroundColor:`var(--tint-success-14)`,borderColor:`var(--color-success)`,color:`var(--text-primary)`}:{});async function _(){r(`beforePush`),r(`click`);try{s.value=!0,u.value&&u.value.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value&&u.value.handleProgress(e)});e&&await new Promise(e=>setTimeout(e,200)),r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}function y(e){}let x=k(()=>[...a.remotes].sort((e,t)=>e.isUpstream===t.isUpstream?e.name.localeCompare(t.name):e.isUpstream?-1:1));async function w(e){if(e===`manage`){a.isRemoteManagerVisible=!0;return}if(e===`push-all`){await a.pushAllRemotes();return}if(!e.startsWith(`push:`))return;let t=e.slice(5);r(`beforePush`);try{s.value=!0,u.value?.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value?.handleProgress(e)},t);r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}return(n,r)=>{let f=Y,p=M,T=v,O=i,k=be,A=D;return I(),H(`div`,null,[c(`div`,st,[C(p,{content:h.value,placement:`top`},{default:z(()=>[C(f,{type:`primary`,icon:l(de),onClick:_,loading:l(a).isPushing,disabled:m.value,style:F(g.value),class:K([`push-button`,`from-${t.from}`])},{default:z(()=>[b(E(l(X)(`@F4137:推送`))+` `,1),d.value?(I(),H(`span`,ct,`(`+E(l(a).branchAhead)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`,`class`])]),_:1},8,[`content`]),l(a).hasMultipleRemotes?(I(),o(A,{key:0,trigger:`click`,placement:`top-end`,onCommand:w},{dropdown:z(()=>[C(k,null,{default:z(()=>[(I(!0),H(J,null,e(x.value,e=>(I(),o(O,{key:e.name,command:`push:${e.name}`},{default:z(()=>[c(`span`,lt,[c(`span`,null,E(l(X)(`@F4137:推送到`))+` `+E(e.name),1),e.isUpstream?(I(),o(T,{key:0,size:`small`,type:`success`,effect:`plain`},{default:z(()=>[b(E(l(X)(`@F4137:上游`)),1)]),_:1})):S(``,!0)])]),_:2},1032,[`command`]))),128)),C(O,{divided:``,command:`push-all`},{default:z(()=>[b(E(l(X)(`@F4137:推送到全部远程`)),1)]),_:1}),C(O,{divided:``,command:`manage`},{default:z(()=>[b(E(l(X)(`@F4137:管理远程…`)),1)]),_:1})]),_:1})]),default:z(()=>[C(f,{type:`primary`,icon:l(ee),style:F(g.value),class:K([`push-button__caret`,`from-${t.from}`]),"aria-label":l(X)(`@F4137:更多推送选项`)},null,8,[`icon`,`style`,`class`,`aria-label`])]),_:1})):S(``,!0)]),C(ot,{ref_key:`progressModalRef`,ref:u,modelValue:s.value,"onUpdate:modelValue":r[0]||=e=>s.value=e,onComplete:y},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-ed54022f`]]);n(),G(),w();var dt={class:`one-push-content`},ft={class:`one-push-text`},pt={class:`one-push-title`},mt={key:0,class:`one-push-desc`},ht=Z(h({__name:`QuickPushButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforePush`,`pushStart`,`afterPush`,`clearFields`],setup(e,{expose:t,emit:n}){let i=Q(),a=Ee(),o=R(!1),s=R(null),u=e,d=n,f=k(()=>i.fileList.some(e=>!Me(e.path,a.lockedFiles))),p=k(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),m=k(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!p.value||!u.hasUserCommitMessage||!i.hasUpstream:!f.value&&i.branchAhead===0||!u.hasUserCommitMessage||!i.hasUpstream),h=k(()=>i.isAddingFiles||i.isCommiting||i.isPushing),_=k(()=>{if(i.hasConflictedFiles)return X(`@2E184:存在冲突文件,请先解决冲突`);if(i.isSelectionMode)return i.selectedFiles.size===0?X(`@2E184:请先勾选要推送的文件`):i.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):u.hasUserCommitMessage?i.hasUpstream?X(`@2E184:一键完成:仅暂存所选文件 → 提交 → 推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`);let e=i.branchAhead>0;return!f.value&&!e?X(`@2E184:没有需要提交或推送的更改`):u.hasUserCommitMessage?i.hasUpstream?f.value?X(`@2E184:一键完成:暂存所有更改 → 提交 → 推送到远程仓库`):X(`@2E184:本地已提交,一键推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`)}),v=k(()=>i.isSelectionMode&&p.value?X(`@2E184:一键推送所选`):X(`@2E184:一键推送所有`)),y=k(()=>u.from===`form`?i.isSelectionMode&&p.value?X(`@2E184:暂存所选 + 提交 + 推送`):X(`@2E184:暂存 + 提交 + 推送`):``);async function b(){d(`beforePush`);try{let e=i.isSelectionMode&&p.value;if((e||f.value)&&!(e?await i.stageSelectedAndCommit(u.finalCommitMessage,u.skipHooks):await i.addAndCommit(u.finalCommitMessage,u.skipHooks))){d(`afterPush`,!1);return}if(d(`pushStart`),o.value=!0,a.pullBeforePush){s.value?.setPulling(!0);let e=await i.gitPull();if(s.value?.setPulling(!1),!e.success){L.error(X(`@2E184:拉取远程更新失败,已停止推送`)),o.value=!1,i.fetchStatus(),i.getBranchStatus(!0),d(`afterPush`,!1);return}}s.value&&s.value.reset();let t=await i.pushToRemoteWithProgress(e=>{s.value&&s.value.handleProgress(e)});if(t){try{window.dispatchEvent(new CustomEvent(`zen-gitsync:after-quick-push-success`))}catch{}d(`clearFields`)}d(`afterPush`,t)}catch(e){console.error(`一键推送失败:`,e),d(`afterPush`,!1)}}t({triggerQuickPush:b});function x(e){}return(t,n)=>{let i=g,a=Y;return I(),H(`div`,null,[C(l(M),{content:_.value,placement:`top`,"show-after":200},{default:z(()=>[C(a,{type:`primary`,onClick:b,loading:h.value,disabled:m.value,class:K([e.from,`one-push-button`])},{default:z(()=>[c(`div`,dt,[C(i,{class:`one-push-icon`},{default:z(()=>[C(l(r))]),_:1}),c(`div`,ft,[c(`span`,pt,E(v.value),1),e.from===`form`?(I(),H(`span`,mt,E(y.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`]),C(ot,{ref_key:`progressModalRef`,ref:s,modelValue:o.value,"onUpdate:modelValue":n[0]||=e=>o.value=e,onComplete:x,onPullRequested:b},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-c8c92c10`]]);n(),G(),w();var gt={class:`create-tag-button`},_t={class:`tag-dialog-content`},vt={class:`tag-info-card`},yt={class:`info-icon`},bt={class:`info-content`},xt={class:`form-tip`},St={class:`form-tip`},Ct={class:`form-tip`},wt=Z(h({__name:`CreateTagButton`,props:{variant:{default:`icon`}},setup(e){let t=e,n=Q(),r=R(!1),i=R(``),a=R(``),u=R(`lightweight`),f=R(``),p=R(!1);function m(){i.value=``,a.value=``,u.value=`lightweight`,f.value=``,r.value=!0}async function h(){if(!i.value.trim()){L.warning(X(`@TAG01:请输入标签名称`));return}if(!/^[a-zA-Z0-9._\/-]+$/.test(i.value)){L.warning(X(`@TAG01:标签名称只能包含字母、数字、点、下划线、斜杠和连字符`));return}try{p.value=!0;let e=await(await fetch(`/api/create-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:i.value.trim(),message:a.value.trim(),type:u.value,commit:f.value.trim()})})).json();e.success?(L.success(X(`@TAG01:标签创建成功`)),r.value=!1):L.error(e.error||X(`@TAG01:创建标签失败`))}catch(e){console.error(`创建标签失败:`,e),L.error(X(`@TAG01:创建标签失败`))}finally{p.value=!1}}let v=k(()=>u.value===`lightweight`?X(`@TAG01:轻量标签是指向提交对象的引用,不包含额外信息`):X(`@TAG01:附注标签是完整的Git对象,包含标签信息、日期、标签者和可选的签名`));return(e,x)=>{let w=g,T=Y,D=M,O=A,k=_,j=se,N=y,P=d;return I(),H(`div`,gt,[C(D,{content:l(X)(`@TAG01:为当前提交创建标签`),placement:`top`,"show-after":200,disabled:t.variant===`text`},{default:z(()=>[C(T,{type:`success`,onClick:m,disabled:!l(n).isGitRepo,circle:t.variant===`icon`,size:t.variant===`icon`?`small`:`default`,class:K(t.variant===`text`?`action-button`:``)},{default:z(()=>[t.variant===`icon`?(I(),o(w,{key:0},{default:z(()=>[C(l(q))]),_:1})):(I(),H(J,{key:1},[b(E(l(X)(`@TAG01:创建标签`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Oe,{modelValue:r.value,"onUpdate:modelValue":x[4]||=e=>r.value=e,title:l(X)(`@TAG01:创建 Git 标签`),size:`medium`,"close-on-click-modal":!1,"show-footer":``,"confirm-text":l(X)(`@TAG01:创建`),"cancel-text":l(X)(`@TAG01:取消`),"confirm-loading":p.value,"custom-class":`tag-dialog`,onConfirm:h},{default:z(()=>[c(`div`,_t,[c(`div`,vt,[c(`div`,yt,[C(w,null,{default:z(()=>[C(l(q))]),_:1})]),c(`div`,bt,[c(`h4`,null,E(l(X)(`@TAG01:Git 标签`)),1),c(`p`,null,E(l(X)(`@TAG01:标签用于标记项目的重要版本点,如发布版本 v1.0.0`)),1)])]),C(P,{"label-position":`top`,class:`tag-form`},{default:z(()=>[C(k,{label:l(X)(`@TAG01:标签名称`),required:``},{default:z(()=>[C(O,{modelValue:i.value,"onUpdate:modelValue":x[0]||=e=>i.value=e,placeholder:l(X)(`@TAG01:例如: v1.0.0 或 release-2024`),clearable:``,maxlength:`100`},{prefix:z(()=>[C(w,null,{default:z(()=>[C(l(q))]),_:1})]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,xt,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:建议使用语义化版本号,如 v1.0.0`)),1)])]),_:1},8,[`label`]),C(k,{label:l(X)(`@TAG01:标签类型`)},{default:z(()=>[C(N,{modelValue:u.value,"onUpdate:modelValue":x[1]||=e=>u.value=e,size:`default`},{default:z(()=>[C(j,{value:`lightweight`},{default:z(()=>[b(E(l(X)(`@TAG01:轻量标签`)),1)]),_:1}),C(j,{value:`annotated`},{default:z(()=>[b(E(l(X)(`@TAG01:附注标签`)),1)]),_:1})]),_:1},8,[`modelValue`]),c(`div`,St,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(v.value),1)])]),_:1},8,[`label`]),u.value===`annotated`?(I(),o(k,{key:0,label:l(X)(`@TAG01:标签说明`),required:u.value===`annotated`},{default:z(()=>[C(O,{modelValue:a.value,"onUpdate:modelValue":x[2]||=e=>a.value=e,placeholder:l(X)(`@TAG01:为此标签添加说明信息`),clearable:``,rows:3,type:`textarea`,resize:`none`,maxlength:`500`,"show-word-limit":``},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`required`])):S(``,!0),C(k,{label:l(X)(`@TAG01:目标提交(可选)`)},{default:z(()=>[C(O,{modelValue:f.value,"onUpdate:modelValue":x[3]||=e=>f.value=e,placeholder:l(X)(`@TAG01:留空则为当前HEAD,或输入commit SHA`),clearable:``,maxlength:`40`},{prefix:z(()=>[...x[5]||=[c(`span`,{class:`commit-prefix`},`commit:`,-1)]]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,Ct,[C(w,null,{default:z(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:默认为当前HEAD提交,也可以指定历史提交`)),1)])]),_:1},8,[`label`])]),_:1})])]),_:1},8,[`modelValue`,`title`,`confirm-text`,`cancel-text`,`confirm-loading`])])}}}),[[`__scopeId`,`data-v-871521cb`]]);n(),G(),w();var Tt={class:`tag-list-button`},Et={class:`tag-list-content`},Dt={key:0,class:`tag-header`},Ot={class:`tag-stats`},kt={class:`stat-item`},At={class:`stat-number`},jt={class:`stat-label`},Mt={class:`tag-actions-header`},Nt={class:`tag-list-container`},Pt={key:0,class:`empty-state`},Ft={class:`empty-text`},It={class:`empty-hint`},Lt={key:1,class:`tag-cards`},Rt={class:`tag-card-content`},zt={class:`tag-info`},Bt={class:`tag-main-info`},Vt={class:`tag-name-badge`},Ht={class:`tag-name-text`},Ut={class:`tag-meta`},Wt={class:`tag-commit`},Gt={class:`tag-date`},Kt={key:0,class:`tag-message`},qt={class:`tag-card-actions`},Jt={key:0,class:`tag-detail-content`},Yt={class:`detail-row`},Xt={class:`detail-label`},Zt={class:`detail-value`},Qt={class:`detail-row`},$t={class:`detail-label`},en={class:`detail-value`},tn={class:`detail-row`},nn={class:`detail-label`},rn={class:`detail-value`},an={class:`detail-row`},on={class:`detail-label`},sn={key:0,class:`detail-row detail-message`},cn={class:`detail-label`},ln={class:`message-content`},un=Z(h({__name:`TagListButton`,props:{variant:{default:`icon`}},setup(t){let n=t,r=Q(),i=R(!1),a=R([]),u=R(!1),d=R(!1),f=R(!1),m=R(!1),h=R(null);async function _(){i.value=!0,await y()}async function y(){try{u.value=!0;let e=await(await fetch(`/api/list-tags`)).json();e.success?a.value=e.tags||[]:L.error(e.error||X(`@TAG01:获取标签列表失败`))}catch(e){console.error(`获取标签列表失败:`,e),L.error(X(`@TAG01:获取标签列表失败`))}finally{u.value=!1}}function x(e){h.value=e,m.value=!0}async function w(e){oe.confirm(X(`@TAG01:确定要推送此标签到远程仓库吗?`),X(`@TAG01:推送标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let t=await(await fetch(`/api/push-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?L.success(X(`@TAG01:标签推送成功`)):L.error(t.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),L.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function T(){oe.confirm(X(`@TAG01:确定要推送所有标签到远程仓库吗?`),X(`@TAG01:推送所有标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let e=await(await fetch(`/api/push-all-tags`,{method:`POST`})).json();e.success?L.success(X(`@TAG01:所有标签推送成功`)):L.error(e.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),L.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function D(e){oe.confirm(X(`@TAG01:确定要删除此标签吗?此操作不可恢复。`),X(`@TAG01:删除标签`),{confirmButtonText:X(`@TAG01:删除`),cancelButtonText:X(`@TAG01:取消`),type:`warning`}).then(async()=>{await O(e)}).catch(()=>{})}async function O(e){try{d.value=!0;let t=await(await fetch(`/api/delete-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?(L.success(X(`@TAG01:标签删除成功`)),await y()):L.error(t.error||X(`@TAG01:删除标签失败`))}catch(e){console.error(`删除标签失败:`,e),L.error(X(`@TAG01:删除标签失败`))}finally{d.value=!1}}function k(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}return(t,O)=>{let A=g,j=Y,N=M,P=xe,ee=v,te=pe;return I(),H(`div`,Tt,[C(N,{content:l(X)(`@TAG01:查看和管理所有标签`),placement:`top`,"show-after":200,disabled:n.variant===`text`},{default:z(()=>[C(j,{type:`info`,onClick:_,disabled:!l(r).isGitRepo,circle:n.variant===`icon`,size:n.variant===`icon`?`small`:`default`,class:K(n.variant===`text`?`action-button`:``)},{default:z(()=>[n.variant===`icon`?(I(),o(A,{key:0},{default:z(()=>[C(l(q))]),_:1})):(I(),H(J,{key:1},[b(E(l(X)(`@TAG01:标签列表`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Oe,{modelValue:i.value,"onUpdate:modelValue":O[0]||=e=>i.value=e,title:l(X)(`@TAG01:Git 标签列表`),size:`large`,"show-footer":!1,"custom-class":`tag-list-dialog`},{default:z(()=>[c(`div`,Et,[u.value?S(``,!0):(I(),H(`div`,Dt,[c(`div`,Ot,[c(`div`,kt,[C(A,{class:`stat-icon`},{default:z(()=>[C(l(q))]),_:1}),c(`span`,At,E(a.value.length),1),c(`span`,jt,E(l(X)(`@TAG01:个标签`)),1)])]),c(`div`,Mt,[C(j,{type:`primary`,size:`small`,icon:l(p),onClick:y,loading:u.value,class:`refresh-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:刷新`)),1)]),_:1},8,[`icon`,`loading`]),a.value.length>0?(I(),o(j,{key:0,type:`success`,size:`small`,icon:l(de),onClick:T,loading:f.value,class:`push-all-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:推送所有标签`)),1)]),_:1},8,[`icon`,`loading`])):S(``,!0)])])),le((I(),H(`div`,Nt,[a.value.length===0&&!u.value?(I(),H(`div`,Pt,[C(P,{description:l(X)(`@TAG01:暂无标签`),"image-size":120},{image:z(()=>[C(A,{class:`empty-icon`},{default:z(()=>[C(l(q))]),_:1})]),description:z(()=>[c(`p`,Ft,E(l(X)(`@TAG01:还没有创建任何标签`)),1),c(`p`,It,E(l(X)(`@TAG01:使用创建标签功能为项目添加版本标记`)),1)]),_:1},8,[`description`])])):(I(),H(`div`,Lt,[(I(!0),H(J,null,e(a.value,e=>(I(),H(`div`,{key:e.name,class:`tag-card`},[c(`div`,Rt,[c(`div`,zt,[c(`div`,Bt,[c(`div`,Vt,[C(A,{class:`badge-icon`},{default:z(()=>[C(l(q))]),_:1}),c(`span`,Ht,E(e.name),1),C(ee,{size:`small`,type:e.type===`annotated`?`warning`:`info`,class:`type-tag`},{default:z(()=>[b(E(e.type===`annotated`?l(X)(`@TAG01:附注`):l(X)(`@TAG01:轻量`)),1)]),_:2},1032,[`type`])]),c(`div`,Ut,[c(`span`,Wt,[C(A,null,{default:z(()=>[C(l(s))]),_:1}),b(` `+E(e.commit.substring(0,8)),1)]),c(`span`,Gt,E(k(e.date)),1)]),e.message?(I(),H(`div`,Kt,E(e.message),1)):S(``,!0)])]),c(`div`,qt,[e.message?(I(),o(j,{key:0,size:`small`,type:`info`,onClick:t=>x(e),class:`action-btn view-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:查看`)),1)]),_:1},8,[`onClick`])):S(``,!0),C(j,{size:`small`,type:`success`,icon:l(de),onClick:t=>w(e.name),loading:f.value,class:`action-btn push-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:推送`)),1)]),_:1},8,[`icon`,`onClick`,`loading`]),C(j,{size:`small`,type:`danger`,icon:l(ue),onClick:t=>D(e.name),loading:d.value,class:`action-btn delete-btn`},{default:z(()=>[b(E(l(X)(`@TAG01:删除`)),1)]),_:1},8,[`icon`,`onClick`,`loading`])])])]))),128))]))])),[[te,u.value]])])]),_:1},8,[`modelValue`,`title`]),C(Oe,{modelValue:m.value,"onUpdate:modelValue":O[1]||=e=>m.value=e,title:l(X)(`@TAG01:标签详情`),size:`medium`,"show-footer":!1,"custom-class":`tag-detail-dialog`},{default:z(()=>[h.value?(I(),H(`div`,Jt,[c(`div`,Yt,[c(`span`,Xt,E(l(X)(`@TAG01:标签名称:`)),1),c(`code`,Zt,E(h.value.name),1)]),c(`div`,Qt,[c(`span`,$t,E(l(X)(`@TAG01:提交SHA:`)),1),c(`code`,en,E(h.value.commit),1)]),c(`div`,tn,[c(`span`,nn,E(l(X)(`@TAG01:创建时间:`)),1),c(`span`,rn,E(k(h.value.date)),1)]),c(`div`,an,[c(`span`,on,E(l(X)(`@TAG01:类型:`)),1),C(ee,{type:h.value.type===`annotated`?`warning`:`info`,size:`small`},{default:z(()=>[b(E(h.value.type===`annotated`?l(X)(`@TAG01:附注标签`):l(X)(`@TAG01:轻量标签`)),1)]),_:1},8,[`type`])]),h.value.message?(I(),H(`div`,sn,[c(`span`,cn,E(l(X)(`@TAG01:标签说明:`)),1),c(`div`,ln,E(h.value.message),1)])):S(``,!0)])):S(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-366ce062`]]);n(),G(),w();var dn={class:`git-operations-button`},fn={class:`actions-section`},pn={class:`action-groups`},mn={class:`action-group`},hn={class:`group-title`},gn={class:`group-buttons`},_n={key:0},vn={class:`action-group`},yn={class:`group-title`},bn={class:`group-buttons`},xn={class:`action-group`},Sn={class:`group-title`},Cn={class:`group-buttons`},wn={key:0},Tn={class:`action-group`},En={class:`group-title`},Dn={class:`group-buttons`},On={class:`action-group`},kn={class:`group-title`},An={class:`group-buttons`},jn={class:`action-group`},Mn={class:`group-title`},Nn={class:`group-buttons`},Pn={class:`pull-error-content`},Fn={key:0},In={key:1},Ln={class:`pull-error-detail`},Rn={class:`pull-error-label`},zn={class:`pull-error-pre`},Bn=Z(h({__name:`GitOperationsButton`,props:{variant:{default:`icon`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`clearFields`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Q(),u=R(!1),d=R(!1),f=R({needsMerge:!1,error:``,fullError:``,pullOutput:``});function p(){u.value=!0}let m=k(()=>a.fileList.filter(e=>e.type===`added`).length),h=k(()=>a.branchBehind>0),_=k(()=>a.fileList.some(e=>[`modified`,`deleted`,`untracked`,`intent-to-add`].includes(e.type)));async function v(){try{let e=await a.gitPull();e.success?(await a.fetchStatus(),await a.fetchLog(!1)):(f.value={needsMerge:e.needsMerge,error:e.error,fullError:e.fullError,pullOutput:e.pullOutput},d.value=!0)}catch(e){console.error(`拉取失败:`,e)}}async function y(){try{await a.gitFetchAll(),await a.fetchStatus(),await a.fetchLog(!1)}catch(e){console.error(`获取远程分支失败:`,e)}}async function w(){if(r.hasUserCommitMessage)try{await a.addAndCommit(r.finalCommitMessage,r.skipHooks),a.fetchStatus(),a.fetchLog(),i(`afterCommit`,!0),i(`clearFields`)}catch(e){console.error(`暂存并提交失败:`,e)}}function T(){i(`beforePush`)}function D(e){i(`afterPush`,e)}function A(){i(`clearFields`)}return t({openGitOperationsDrawer:p}),(t,n)=>{let k=g,j=Y,P=M,ee=O;return I(),H(`div`,dn,[r.variant===`icon`?(I(),o(we,{key:0,tooltip:l(X)(`@F13B4:Git 操作`),size:`large`,"custom-class":`btn-rotate-on-hover`,onClick:p},{default:z(()=>[C(k,null,{default:z(()=>[C(l(x))]),_:1})]),_:1},8,[`tooltip`])):(I(),o(j,{key:1,type:`primary`,class:`action-button`,onClick:p},{default:z(()=>[b(E(l(X)(`@F13B4:Git 操作`)),1)]),_:1})),C(ee,{modelValue:u.value,"onUpdate:modelValue":n[2]||=e=>u.value=e,title:l(X)(`@76872:Git 操作`),direction:`rtl`,size:`362px`,"with-header":!0,"show-close":!0,"destroy-on-close":!1,"append-to-body":!0,class:`git-operations-drawer`},{default:z(()=>[c(`div`,fn,[c(`div`,pn,[c(`div`,mn,[c(`div`,hn,E(l(X)(`@76872:基础操作`)),1),c(`div`,gn,[C(ze,{onClick:()=>{},from:`drawer`}),C(Ne,{onClick:()=>{},from:`drawer`}),C(Ve,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:n[0]||=e=>i(`afterCommit`,e),onClick:()=>{},from:`drawer`},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(ut,{onBeforePush:()=>{},onAfterPush:n[1]||=e=>i(`afterPush`,e),onClick:()=>{},from:`drawer`}),C(P,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):h.value?`${l(X)(`@76872:拉取`)}${l(a).branchBehind}${l(X)(`@76872:个远程提交`)}`:`git pull`,placement:`top`},{default:z(()=>[C(j,{type:`primary`,icon:l(U),onClick:v,loading:l(a).isGitPulling,disabled:!l(a).hasUpstream||l(a).hasConflictedFiles,class:`action-button`,style:F(l(a).hasUpstream&&!l(a).hasConflictedFiles?{color:`white`,backgroundColor:`var(--color-primary)`,borderColor:`var(--color-primary)`}:{})},{default:z(()=>[b(E(l(X)(`@76872:拉取`))+` `,1),h.value?(I(),H(`span`,_n,`(`+E(l(a).branchBehind)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`])]),_:1},8,[`content`]),C(P,{content:`git fetch --all`,placement:`top`},{default:z(()=>[C(j,{type:`info`,icon:l(ge),onClick:y,loading:l(a).isGitFetching,class:`action-button`,style:{color:`white`,"background-color":`var(--color-primary)`,"border-color":`var(--color-primary)`}},{default:z(()=>[b(E(l(X)(`@76872:获取所有远程分支`)),1)]),_:1},8,[`icon`,`loading`])]),_:1})])]),c(`div`,vn,[c(`div`,yn,E(l(X)(`@76872:组合操作`)),1),c(`div`,bn,[C(P,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):`git add + git commit`,placement:`top`},{default:z(()=>[C(j,{type:`primary`,icon:l(V),onClick:w,loading:l(a).isAddingFiles||l(a).isCommiting,disabled:!_.value||!e.hasUserCommitMessage||l(a).hasConflictedFiles,class:`action-button`},{default:z(()=>[b(E(l(X)(`@76872:暂存并提交`)),1)]),_:1},8,[`icon`,`loading`,`disabled`])]),_:1},8,[`content`]),C(ht,{from:`drawer`,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:T,onAfterPush:D,onClearFields:A},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])]),c(`div`,xn,[c(`div`,Sn,E(l(X)(`@76872:重置操作`)),1),c(`div`,Cn,[C(P,{content:m.value>0?`${l(X)(`@76872:撤销`)}${m.value}${l(X)(`@76872:个已暂存文件`)}`:`git reset HEAD`,placement:`top`},{default:z(()=>[C(j,{type:`warning`,icon:l(N),onClick:l(a).resetHead,loading:l(a).isResetting,disabled:m.value===0||l(a).hasConflictedFiles,class:`action-button reset-button`},{default:z(()=>[b(E(l(X)(`@76872:重置暂存区`))+` `,1),m.value>0?(I(),H(`span`,wn,`(`+E(m.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`onClick`,`loading`,`disabled`])]),_:1},8,[`content`]),C(Ie,{variant:`text`})])]),c(`div`,Tn,[c(`div`,En,E(l(X)(`@76872:分支操作`)),1),c(`div`,Dn,[C(Fe,{variant:`text`})])]),c(`div`,On,[c(`div`,kn,E(l(X)(`@76872:储藏操作`)),1),c(`div`,An,[C(Pe,{variant:`text`}),C(Ae,{variant:`text`})])]),c(`div`,jn,[c(`div`,Mn,E(l(X)(`@TAG01:标签操作`)),1),c(`div`,Nn,[C(wt,{variant:`text`}),C(un,{variant:`text`})])])])])]),_:1},8,[`modelValue`,`title`]),C(Oe,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,title:f.value.needsMerge?l(X)(`@76872:需要合并更改`):l(X)(`@76872:拉取失败`),size:`medium`,"show-footer":!0,"show-cancel":!1,"confirm-text":l(X)(`@76872:我知道了`),"append-to-body":!0,onConfirm:n[4]||=e=>d.value=!1},{default:z(()=>[c(`div`,Pn,[c(`div`,{class:K([`pull-error-type`,f.value.needsMerge?`is-warning`:`is-error`])},[C(k,{class:`pull-error-icon`},{default:z(()=>[C(l(s))]),_:1}),f.value.needsMerge?(I(),H(`span`,Fn,E(l(X)(`@76872:本地存在未提交的更改,与远程内容冲突,请先处理本地更改后再拉取。`)),1)):(I(),H(`span`,In,E(l(X)(`@76872:执行 git pull 时发生错误,请查看详细信息。`)),1))],2),c(`div`,Ln,[c(`div`,Rn,E(l(X)(`@76872:错误详情`))+`:`,1),c(`pre`,zn,E(f.value.fullError||f.value.error),1)])])]),_:1},8,[`modelValue`,`title`,`confirm-text`])])}}}),[[`__scopeId`,`data-v-feb8c688`]]);n(),w(),ae();var Vn={class:`loading-container`},Hn={class:`loading-text`},Un={key:0,class:`loading-progress`},Wn=h({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),o(a,{to:`body`},[C(ce,{name:`loading-fade`},{default:z(()=>[e.visible||e.mock?(I(),H(`div`,{key:0,class:`global-loading-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Vn,[n[1]||=c(`div`,{class:`loading-spinner`},[c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`})],-1),c(`div`,Hn,E(e.text),1),e.showProgress||e.mock?(I(),H(`div`,Un,[c(`div`,{class:K([`progress-bar`,{"is-mock":e.mock&&!e.showProgress}]),style:F(e.showProgress?{width:e.progress+`%`}:void 0)},null,6)])):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Gn=Z(Wn,[[`__scopeId`,`data-v-691919d3`]]);n(),w(),ae();var Kn={class:`success-container`},qn={class:`success-text`},Jn={key:0,class:`success-description`},Yn=h({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@71545:操作成功!`)},description:{default:``}},setup(e){return(t,n)=>(I(),o(a,{to:`body`},[C(ce,{name:`success-fade`},{default:z(()=>[e.visible?(I(),H(`div`,{key:0,class:`success-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Kn,[n[1]||=c(`div`,{class:`success-icon`},[c(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[c(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),c(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),c(`div`,qn,E(e.text),1),e.description?(I(),H(`div`,Jn,E(e.description),1)):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Xn=Z(Yn,[[`__scopeId`,`data-v-c3fad05d`]]);G();var $=ye({visible:!1,text:X(`@F2A3A:加载中...`),showProgress:!1,progress:0});function Zn(){return{loadingState:$,show:e=>{$.visible=!0,$.text=e?.text||X(`@F2A3A:加载中...`),$.showProgress=e?.showProgress||!1,$.progress=e?.progress||0},hide:()=>{$.visible=!1},updateProgress:e=>{$.progress=Math.max(0,Math.min(100,e))},updateText:e=>{$.text=e},setText:e=>{$.visible&&($.text=e)}}}G();var Qn=ye({visible:!1,text:X(`@B8591:操作成功!`),description:``});function $n(){let e=e=>{Qn.visible=!0,Qn.text=e?.text||X(`@B8591:操作成功!`),Qn.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{Qn.visible=!1};return{successState:Qn,show:e,hide:t}}n(),G(),w();var er={class:`one-commit-content`},tr={class:`one-commit-text`},nr={class:`one-commit-title`},rr={key:0,class:`one-commit-desc`},ir=Z(h({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(e,{expose:t,emit:n}){let r=Q(),i=Ee(),a=e,o=n,s=k(()=>r.fileList.some(e=>!Me(e.path,i.lockedFiles))),u=k(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),d=k(()=>r.hasConflictedFiles?!0:r.isSelectionMode?!u.value||!a.hasUserCommitMessage:!s.value||!a.hasUserCommitMessage),f=k(()=>r.isAddingFiles||r.isCommiting),p=k(()=>r.hasConflictedFiles?X(`@2E184:存在冲突文件,请先解决冲突`):r.isSelectionMode?r.selectedFiles.size===0?X(`@2E184:请先勾选要提交的文件`):r.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):a.hasUserCommitMessage?X(`@2E184:一键完成:仅暂存所选文件 → 提交`):X(`@2E184:请输入提交信息`):s.value?a.hasUserCommitMessage?X(`@2E184:一键完成:暂存所有更改 → 提交`):X(`@2E184:请输入提交信息`):X(`@2E184:没有需要提交的更改`)),m=k(()=>r.isSelectionMode&&u.value?X(`@2E184:一键提交所选`):X(`@2E184:一键提交`)),h=k(()=>a.from===`form`?r.isSelectionMode&&u.value?X(`@2E184:暂存所选 + 提交`):X(`@2E184:暂存 + 提交`):``);async function _(){o(`beforeCommit`);try{let e=await r.stageSelectedAndCommit(a.finalCommitMessage,a.skipHooks);e&&o(`clearFields`),o(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),o(`afterCommit`,!1)}}return t({triggerQuickCommit:_}),(t,n)=>{let r=g,i=Y;return I(),H(`div`,null,[C(l(M),{content:p.value,placement:`top`,"show-after":200},{default:z(()=>[C(i,{type:`primary`,onClick:_,loading:f.value,disabled:d.value,class:K([e.from,`one-commit-button`])},{default:z(()=>[c(`div`,er,[C(r,{class:`one-commit-icon`},{default:z(()=>[C(l(V))]),_:1}),c(`div`,tr,[c(`span`,nr,E(m.value),1),e.from===`form`?(I(),H(`span`,rr,E(h.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-91c441c2`]]);n(),G();var ar={class:`form-bottom-actions`},or={class:`actions-flex-container`},sr={class:`left-actions`},cr={class:`button-grid`},lr={class:`right-actions`},ur=Z(h({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`],setup(e,{expose:t,emit:n}){let r=n,i=R(null);function a(e){r(`afterCommit`,e)}function o(e){r(`afterPush`,e)}function s(){r(`beforePush`)}function l(){r(`pushStart`)}function u(){r(`clearFields`)}async function d(){return i.value?.triggerQuickPush()}return t({triggerQuickPush:d}),(t,n)=>(I(),H(`div`,ar,[c(`div`,or,[c(`div`,sr,[c(`div`,cr,[C(ze,{onClick:()=>{},from:e.from},null,8,[`from`]),C(Ve,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:a,onClick:()=>{},from:e.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),C(ut,{onBeforePush:()=>{},onAfterPush:o,onClick:()=>{},from:e.from},null,8,[`from`])])]),c(`div`,lr,[C(ir,{from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onAfterCommit:a,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(ht,{ref_key:`quickPushRef`,ref:i,from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:s,onPushStart:l,onAfterPush:o,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])])]))}}),[[`__scopeId`,`data-v-6dc84697`]]);n(),G(),w(),ae();var dr={class:`dialog-toolbar`},fr={class:`filter-controls`},pr={class:`toolbar-actions`},mr=[`disabled`],hr={class:`btn-text`},gr=[`disabled`],_r={class:`btn-text`},vr=[`disabled`],yr={class:`btn-text`},br={class:`history-scroll`},xr={key:0,class:`loading-state`},Sr={class:`loading-text`},Cr={key:3,class:`history-list`},wr=[`onClick`],Tr={class:`command-info`},Er={class:`command-text`},Dr={class:`command-meta`},Or={class:`timestamp`},kr={class:`duration`},Ar={class:`item-actions`},jr={key:0,class:`item-details`},Mr={key:0,class:`output-section`},Nr={class:`output-header`},Pr=[`onClick`],Fr={class:`output-content`},Ir={key:0,class:`truncation-notice`},Lr={class:`output-header`},Rr={class:`output-content`},zr={key:0,class:`truncation-notice`},Br={key:2,class:`output-section error`},Vr={class:`output-header`},Hr={class:`output-content`},Ur=Z(h({__name:`CommandHistory`,setup(n){let r=Q(),i=R([]),a=R(!1);function s(e){return Array.isArray(e)?e.join(` `):e==null?``:String(e)}let d=R(!1),p=R(!1),h=R(!1),_=R(new Set),y=R(!1),x=R(!1),w=R(`all`),D=R(`all`),O=R(``),j=k(()=>{let e=i.value;if(w.value!==`all`&&(e=e.filter(e=>w.value===`success`?e.success:!e.success)),D.value!==`all`&&(e=e.filter(e=>{let t=s(e.command).startsWith(`git `);return D.value===`git`?t:!t})),O.value.trim()){let t=O.value.toLowerCase();e=e.filter(e=>s(e.command).toLowerCase().includes(t)||e.stdout&&e.stdout.toLowerCase().includes(t)||e.stderr&&e.stderr.toLowerCase().includes(t)||e.error&&e.error.toLowerCase().includes(t))}return e}),N=k(()=>i.value.filter(e=>e.success).length),F=k(()=>i.value.filter(e=>!e.success).length),ne=k(()=>i.value.filter(e=>s(e.command).startsWith(`git `)).length),ae=k(()=>i.value.filter(e=>!s(e.command).startsWith(`git `)).length);function V(){x.value=!0,i.value.length===0&&se()}async function se(){try{if(a.value=!0,r.socket&&r.socket.connected)r.socket.emit(`request_full_history`);else{let e=await(await fetch(`/api/command-history`)).json();e.success?i.value=e.history:L.error(`${X(`@81F0F:加载命令历史失败: `)}${e.error}`)}}catch(e){L.error(`${X(`@81F0F:加载命令历史失败: `)}${e.message}`)}finally{a.value=!1}}async function ce(){if(j.value.length===0){L.warning(X(`@81F0F:没有可复制的命令历史`));return}try{p.value=!0;let e=j.value.map(e=>{let t=`# ${de(e.timestamp)}${X(`@81F0F: (耗时: `)}${fe(e.executionTime)}) - ${e.success?X(`@81F0F:成功`):X(`@81F0F:失败`)}\n`;if(t+=`${s(e.command)}\n`,e.stdout&&(t+=`\n# 输出:\n${e.stdout}\n`),e.stderr){let n=q(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`\n# ${n}:\n${e.stderr}\n`}return e.error&&(t+=`\n# 错误信息:\n${e.error}\n`),t}).join(`
|
|
2
2
|
---
|
|
3
3
|
|
|
4
4
|
`);await navigator.clipboard.writeText(e),L({message:X(`@81F0F:命令历史已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){L.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}finally{p.value=!1}}async function le(){if(j.value.length===0){L.warning(X(`@81F0F:没有可复制的命令`));return}try{y.value=!0;let e=j.value.map(e=>s(e.command)).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,In as a,Nn as o,On as s,Pn as c,Pr as l,Qr as u,Tn as d,Wn as f,Yr as p,Zn as m,cr as h,er as g,ir as _,jn as v,pr as y,qr as b,z as x}from"./element-plus-CgEuJBlB.js";import{n as S,t as C}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,In as a,Nn as o,On as s,Pn as c,Pr as l,Qr as u,Tn as d,Wn as f,Yr as p,Zn as m,cr as h,er as g,ir as _,jn as v,pr as y,qr as b,z as x}from"./element-plus-CgEuJBlB.js";import{n as S,t as C}from"./_plugin-vue_export-helper-DkeTtFKF.js";e(),y(),l();var w=[`id`],T={class:`common-dialog__footer`},E=a({__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(e,{emit:a}){let l=e,y=a,S=d(()=>{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=_(),E=null;function D(){y(`opened`),f(()=>{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(){y(`closed`),E&&typeof E.focus==`function`&&(f(()=>E?.focus()),E=null)}function k(e){e&&!l.modelValue&&(E=document.activeElement),y(`update:modelValue`,e)}let A=d(()=>l.size===`fullscreen`?`0`:l.top),j=d(()=>{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=d(()=>{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(){y(`update:modelValue`,!1),y(`close`)}function P(){y(`confirm`)}function F(){y(`cancel`),N()}return(a,l)=>{let d=x;return m(),t(i(n),{"model-value":e.modelValue,title:e.title,width:S.value,top:A.value,style:p(M.value),"z-index":e.zIndex,fullscreen:e.size===`fullscreen`,"close-on-click-modal":e.closeOnClickModal,"close-on-press-escape":e.closeOnPressEscape,"destroy-on-close":e.destroyOnClose,draggable:e.draggable,class:b(j.value),"show-close":e.showClose,"modal-class":e.modalClass,"data-dialog-shell":`common`,"append-to-body":e.appendToBody,"lock-scroll":e.lockScroll,"aria-modal":!0,"aria-labelledby":i(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},v({header:h(({titleClass:t})=>[r(`span`,{id:i(C),class:b([`el-dialog__title`,t]),role:`heading`,"aria-level":`2`},u(e.title),11,w)]),default:h(()=>[g(a.$slots,`default`,{},void 0,!0)]),_:2},[e.showFooter||a.$slots.footer?{name:`footer`,fn:h(()=>[g(a.$slots,`footer`,{},()=>[r(`div`,T,[e.showCancel?(m(),t(d,{key:0,type:`button`,onClick:F},{default:h(()=>[o(u(e.cancelText),1)]),_:1})):s(``,!0),c(d,{type:`primary`,loading:e.confirmLoading,onClick:P},{default:h(()=>[o(u(e.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{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-MIPci_U9.js";import{t as de}from"./SvgIcon-b50XyCO5.js";import{t as fe}from"./configStore-BMixvVAA.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-D86LH88s.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-CEEQaAF4.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-D8mdZaNY.js";import{n as Re,t as j}from"./AgentEngineSelector-bQmJlH1b.js";function M(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},mt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},vt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(e){let t=u.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:Ie(n.items,0)}catch{return null}}function Re(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(e);return}let t=F.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:F.value.length}),t){I.value=e.path,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ye(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(t)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function dn(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(I.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){let e=L.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(e){let t=u.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function Kn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?_e(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-DkeTtFKF.js";import{t as de}from"./SvgIcon-U-AI95UV.js";import{t as fe}from"./configStore-Y1biBqmb.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-D7HcNin7.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-BoZNUwmd.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-B2aTliJe.js";import{n as Re,t as j}from"./AgentEngineSelector-CPS9WawU.js";function M(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},mt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},vt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(e){let t=u.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:Ie(n.items,0)}catch{return null}}function Re(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(e);return}let t=F.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:F.value.length}),t){I.value=e.path,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ye(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(t)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function dn(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(I.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){let e=L.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(e){let t=u.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function Kn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?_e(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|