zen-gitsync 2.19.5 → 2.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/package.json +3 -1
  2. package/src/peer/localAsk.js +9 -1
  3. package/src/ui/public/assets/AgentView-CxAsrb9l.js +15 -0
  4. package/src/ui/public/assets/{AgentView-BIehoDwa.css → AgentView-D5MiIZuz.css} +1 -1
  5. package/src/ui/public/assets/{AppVersionBadge-B-6BT87B.js → AppVersionBadge-DIzhkaZi.js} +2 -2
  6. package/src/ui/public/assets/{BranchSelector-C1Kct7NG.js → BranchSelector-Cf6de-E0.js} +1 -1
  7. package/src/ui/public/assets/{CommitForm-DoC-6rft.js → CommitForm-DB0Bthai.js} +1 -1
  8. package/src/ui/public/assets/{CommonDialog-D8XaOcNX.js → CommonDialog-C83HvDae.js} +1 -1
  9. package/src/ui/public/assets/EditorView-BX7nAElt.css +1 -0
  10. package/src/ui/public/assets/EditorView-D-Y2WEod.js +1 -0
  11. package/src/ui/public/assets/{FlowExecutionViewer-CKMH34Br.js → FlowExecutionViewer-BZSHJjqL.js} +1 -1
  12. package/src/ui/public/assets/{FlowOrchestrationWorkspace-CAFDGDim.js → FlowOrchestrationWorkspace-DF0kgwRn.js} +1 -1
  13. package/src/ui/public/assets/{LogList-DB6A2R6o.js → LogList-DiZFQLB8.js} +1 -1
  14. package/src/ui/public/assets/MindmapView-CohUDqAD.css +1 -0
  15. package/src/ui/public/assets/MindmapView-DcG7Q07c.js +1 -0
  16. package/src/ui/public/assets/{MonitorView-BjUS__Ze.js → MonitorView-Dsbfq-LO.js} +1 -1
  17. package/src/ui/public/assets/{ProjectManagerView-CWX1sSgn.js → ProjectManagerView-8Z1wtUUN.js} +1 -1
  18. package/src/ui/public/assets/{ProjectStartupButton-DdMFVPYI.js → ProjectStartupButton-BJ-feAjq.js} +1 -1
  19. package/src/ui/public/assets/{RemoteManagerDialog-fSp9IiCs.js → RemoteManagerDialog-Bx4-EAbj.js} +1 -1
  20. package/src/ui/public/assets/{RemoteRepoCard-Bs01mtmx.js → RemoteRepoCard-Bq-onnB-.js} +1 -1
  21. package/src/ui/public/assets/{SourceMapView-tdQu2qjL.js → SourceMapView-DP5gJQOd.js} +1 -1
  22. package/src/ui/public/assets/{SvgIcon-D5bT7QEj.js → SvgIcon-CvIjcHNr.js} +1 -1
  23. package/src/ui/public/assets/{UserInputNode-DbP3PjQX.js → UserInputNode-mZ2YRrD3.js} +1 -1
  24. package/src/ui/public/assets/{WorkbenchView-Ahoq6RyI.js → WorkbenchView-DYy1n0I0.js} +2 -2
  25. package/src/ui/public/assets/{WorkbenchView-BcG-GrWp.css → WorkbenchView-DjAMZ-KQ.css} +1 -1
  26. package/src/ui/public/assets/{_plugin-vue_export-helper-BRUY9DoQ.js → _plugin-vue_export-helper-CfbZLRTe.js} +4 -4
  27. package/src/ui/public/assets/{configStore-1qv5tdrb.js → configStore-DdpMp1OU.js} +1 -1
  28. package/src/ui/public/assets/{index-C4masR7z.js → index-Bnk5Un7L.js} +4 -4
  29. package/src/ui/public/assets/{relativeTime-nh6F0rop.js → relativeTime-BNBUCPAl.js} +1 -1
  30. package/src/ui/public/assets/taskExecutionExport-yVOVF_bE.js +15 -0
  31. package/src/ui/public/assets/{useWorkbenchProjects-CDT0eWCI.js → useWorkbenchProjects-Bqm9XLHt.js} +1 -1
  32. package/src/ui/public/index.html +5 -5
  33. package/src/ui/server/routes/fs.js +132 -0
  34. package/src/ui/server/routes/workbench/agentRoutes.js +253 -21
  35. package/src/ui/server/routes/workbench/agentSessionEvents.js +114 -0
  36. package/src/ui/server/routes/workbench/agentSessionEvents.test.js +56 -0
  37. package/src/ui/server/routes/workbench/sessionGate.js +109 -8
  38. package/src/ui/server/routes/workbench/sessionGate.test.js +103 -0
  39. package/src/ui/public/assets/AgentView-B4p1C7vE.js +0 -15
  40. package/src/ui/public/assets/EditorView-B666I1pz.css +0 -1
  41. package/src/ui/public/assets/EditorView-DrhO2YSI.js +0 -1
  42. package/src/ui/public/assets/MindmapView-C4L5u3S9.js +0 -1
  43. package/src/ui/public/assets/MindmapView-DuaVqeHO.css +0 -1
  44. package/src/ui/public/assets/taskExecutionExport-PEcuZQo1.js +0 -15
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Gn as i,Gr as a,In as o,Jr as s,Mn as c,On as ee,Sn as l,Sr as u,Tn as d,Un as f,Ur as p,W as m,Yn as h,_n as g,_r as te,ar as _,gn as ne,gr as v,hn as re,i as y,ir as ie,kn as b,ln as ae,lr as x,nr as S,on as C,pn as oe,qn as w,r as se,wn as T,xn as E,yn as ce}from"./element-plus-D8LubGQe.js";import{n as D,t as O}from"./_plugin-vue_export-helper-BRUY9DoQ.js";import{t as le}from"./SvgIcon-D5bT7QEj.js";import{t as ue}from"./configStore-1qv5tdrb.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e}from"./monaco-CuYd4DgX.js";import{r as k,t as A}from"./flow-mindmap-DwG2RDXe.js";import{at as ve,ct as ye,dt as be,ft as j,h as xe,ht as Se,it as Ce,lt as we,mt as Te,ot as Ee,pt as De,rt as Oe,s as ke,st as Ae,ut as je}from"./index-C4masR7z.js";import{t as Me}from"./clipboard-DTy2aO_N.js";o(),x(),t();var M=[`data-media-kind`,`data-media-path`],Ne={class:`media-preview-stage`},Pe={key:0,class:`media-preview-error`},N={class:`media-preview-error-title`},Fe={class:`media-preview-error-path`},Ie=[`src`],P={key:1,class:`media-preview-audio`},Le=[`title`],Re=[`src`],ze={key:2,class:`media-preview-loading`},Be={class:`media-preview-footer`},Ve={class:`media-preview-meta`},He=[`title`],Ue=O(c({__name:`MediaPreview`,props:{filePath:{},fileName:{}},setup(e){let t=e,n=E(()=>j(t.filePath)??`audio`),r=E(()=>De(t.filePath)),i=E(()=>t.fileName||t.filePath.split(/[\\/]/).pop()||``),a=v(!0),o=v(!1),c=v(0),f=v(0),p=v(0),m=v(0);async function h(){try{let e=await(await fetch(`/api/editor/file?path=${encodeURIComponent(t.filePath)}&meta=1`)).json();e?.success&&typeof e.size==`number`&&(f.value=e.size)}catch{}}S(()=>t.filePath,()=>{a.value=!0,o.value=!1,c.value=0,f.value=0,p.value=0,m.value=0,h()},{immediate:!0});function te(e){let t=e.target;Number.isFinite(t.duration)&&t.duration>0&&(c.value=t.duration),t instanceof HTMLVideoElement&&(p.value=t.videoWidth,m.value=t.videoHeight),a.value=!1}function _(){a.value=!1}function ne(){a.value=!1,o.value=!0}function re(e){if(!Number.isFinite(e)||e<=0)return`--:--`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(r).padStart(2,`0`);return i>0?`${i}:${a}:${String(n).padStart(2,`0`)}`:`${r}:${String(n).padStart(2,`0`)}`}function y(e){return!e||e<0?``:e>=1073741824?`${(e/1024/1024/1024).toFixed(2)} GB`:e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}let ie=E(()=>{let e=[n.value===`video`?D(`@EDITOR:视频`):D(`@EDITOR:音频`)];c.value>0&&e.push(re(c.value)),p.value>0&&m.value>0&&e.push(`${p.value} × ${m.value}`);let t=y(f.value);return t&&e.push(t),e.join(` · `)});return(e,c)=>(w(),d(`div`,{class:`media-preview`,"data-media-kind":n.value,"data-media-path":t.filePath},[l(`div`,Ne,[o.value?(w(),d(`div`,Pe,[c[0]||=l(`svg`,{viewBox:`0 0 24 24`,width:`40`,height:`40`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`13`}),l(`line`,{x1:`12`,y1:`16.5`,x2:`12`,y2:`16.6`})],-1),l(`p`,N,s(u(D)(`@EDITOR:无法播放该文件,可能是编码或格式不受支持`)),1),l(`p`,Fe,s(t.filePath),1)])):(w(),d(g,{key:1},[n.value===`video`?(w(),d(`video`,{key:t.filePath,class:`media-preview-video`,src:r.value,controls:``,playsinline:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Ie)):(w(),d(`div`,P,[c[1]||=ee(`<div class="media-preview-glyph" aria-hidden="true" data-v-f05d705f><svg viewBox="0 0 24 24" width="46" height="46" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-f05d705f><path d="M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" data-v-f05d705f></path><path d="M9 17v-13h10v13" data-v-f05d705f></path><path d="M9 8h10" data-v-f05d705f></path></svg></div>`,1),l(`p`,{class:`media-preview-title`,title:t.filePath},s(i.value),9,Le),(w(),d(`audio`,{key:t.filePath,class:`media-preview-audio-el`,src:r.value,controls:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Re))])),a.value?(w(),d(`div`,ze,[c[2]||=l(`span`,{class:`media-preview-spinner`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在载入媒体文件…`)),1)])):T(``,!0)],64))]),l(`div`,Be,[l(`span`,Ve,s(ie.value),1),n.value===`video`?(w(),d(`span`,{key:0,class:`media-preview-name`,title:t.filePath},s(i.value),9,He)):T(``,!0)])],8,M))}}),[[`__scopeId`,`data-v-f05d705f`]]);o(),x();var We={class:`mindmap-preview`},Ge={class:`mindmap-preview-canvas`},Ke=O(c({__name:`MindmapPreview`,props:{content:{}},setup(t){let n=t,r=E(()=>A(n.content||``,`未命名文档`));return(t,n)=>(w(),d(`div`,We,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,Ge,[e(u(k),{data:r.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]),qe=1080,Je=6e5,Ye=.86;function F(e){if(!e||e.startsWith(`data:`))return!1;if(e.startsWith(`blob:`)||e.startsWith(`/`))return!0;try{return new URL(e,location.href).origin===location.origin}catch{return!1}}async function I(e){try{let t=await fetch(e);if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result||``),t.onerror=()=>e(``),t.readAsDataURL(n)})}catch{return null}}function Xe(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};if(typeof Image>`u`){r(e);return}let i=new Image,a=setTimeout(()=>r(e),4e3);i.onload=()=>{if(clearTimeout(a),!(i.naturalWidth>qe||e.length>Je)){r(e);return}try{let t=Math.min(1,qe/i.naturalWidth),n=Math.max(1,Math.round(i.naturalWidth*t)),a=Math.max(1,Math.round(i.naturalHeight*t)),o=document.createElement(`canvas`);o.width=n,o.height=a;let s=o.getContext(`2d`);if(!s){r(e);return}s.fillStyle=`#ffffff`,s.fillRect(0,0,n,a),s.drawImage(i,0,0,n,a),r(o.toDataURL(`image/jpeg`,Ye))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function Ze(e){let t=await I(e);return t?Xe(t):null}async function Qe(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>F(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await Ze(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function $e(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var et={h1:`font-size:26px;font-weight:700;line-height:1.35;margin:28px 0 16px;color:#111;`,h2:`font-size:22px;font-weight:700;line-height:1.4;margin:26px 0 14px;color:#111;`,h3:`font-size:19px;font-weight:700;line-height:1.45;margin:22px 0 12px;color:#222;`,h4:`font-size:17px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:#333;`,h5:`font-size:16px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#333;`,h6:`font-size:15px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#555;`,p:`font-size:16px;line-height:1.8;margin:16px 0;color:#333;`,li:`font-size:16px;line-height:1.8;margin:0 0 6px;color:#333;`,ul:`margin:16px 0;padding-left:24px;`,ol:`margin:16px 0;padding-left:24px;`,blockquote:`margin:16px 0;padding:8px 16px;border-left:4px solid #e2e2e2;background:#f7f7f7;color:#666;font-size:15px;line-height:1.8;`,hr:`border:none;border-top:1px solid #e5e5e5;margin:26px 0;`,a:`color:#576b95;text-decoration:none;`,strong:`font-weight:700;color:#111;`,em:`font-style:italic;color:#555;`,code:`font-family:Menlo,Consolas,Monaco,monospace;font-size:0.92em;background:#f2f3f5;color:#c7254e;padding:1px 5px;border-radius:3px;`,pre:`font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.6;background:#f6f8fa;color:#24292f;padding:12px 14px;border-radius:6px;overflow-x:auto;margin:16px 0;`,table:`border-collapse:collapse;width:100%;margin:16px 0;font-size:14px;`,th:`border:1px solid #e0e0e0;padding:8px 10px;background:#f6f8fa;font-weight:600;text-align:left;color:#333;`,td:`border:1px solid #e0e0e0;padding:8px 10px;color:#333;`,img:`max-width:100%;height:auto;display:block;margin:16px auto;border-radius:6px;`};function tt(e){e.querySelectorAll(`*`).forEach(e=>{let t=et[e.tagName.toLowerCase()];t&&e.setAttribute(`style`,t)}),e.querySelectorAll(`pre code`).forEach(e=>e.setAttribute(`style`,`background:none;padding:0;color:inherit;font-size:inherit;`))}async function nt(e,t){let n=e.cloneNode(!0),r=t?await Qe(n):0;return{html:n.innerHTML,leftover:r}}async function rt(e,t){let n=e.cloneNode(!0),r=t.inline?await Qe(n):0;tt(n);let i=(t.title||``).trim();return{html:`<section style="font-size:16px;line-height:1.8;color:#333;word-break:break-word;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;">${i?`<h1 style="font-size:26px;font-weight:700;line-height:1.35;margin:0 0 22px;color:#111;">${$e(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x(),t(),C();var it={class:`sidebar-header`},at={class:`sidebar-title`},ot={class:`sidebar-actions`},st={class:`sidebar-search`},ct=[`placeholder`,`title`],lt=[`title`,`aria-label`],ut={key:0,class:`sidebar-tree`},dt={key:0,class:`search-section-head`},ft={key:1,class:`tree-arrow-spacer`},pt={class:`tree-icon mit-icon`,"aria-hidden":`true`},mt=[`xlink:href`],ht=[`onClick`,`onContextmenu`],gt={key:1,class:`tree-arrow-spacer`},_t={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},vt=[`xlink:href`],yt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},bt=[`xlink:href`],xt=[`title`],St={key:0,class:`tree-name-hit`},Ct={key:4,class:`tree-loading`},wt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Tt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Et=[`placeholder`],Dt={key:1,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Ot={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},kt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},At=[`placeholder`],jt=[`data-query`],Mt={key:0,class:`content-results-status`},Nt={class:`search-section-head`},Pt={class:`search-section-count`},Ft={key:0,class:`search-section-note`},It=[`title`,`onClick`],Lt={class:`tree-icon mit-icon`,"aria-hidden":`true`},Rt=[`xlink:href`],zt={class:`content-hit-name`},Bt={class:`content-hit-dir`},Vt={class:`content-hit-total`},Ht=[`title`,`onClick`],Ut={class:`content-hit-ln`},Wt={class:`content-hit-text`},Gt={key:0,class:`content-hit-mark`},Kt={key:3,class:`tree-empty`},qt={key:1,class:`sidebar-loading`},Jt={class:`editor-main`},Yt={class:`editor-tabs`},Xt=[`onClick`,`title`],Zt={class:`tab-name`},Qt={key:0,class:`tab-dirty-dot`},$t=[`onClick`],en=[`title`],tn=[`disabled`,`title`],nn={class:`editor-body`},rn={key:1,class:`image-tab-placeholder`},an={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`}},on={class:`image-tab-placeholder-title`},sn={class:`image-tab-placeholder-hint`},cn={class:`preview-header`},ln={class:`preview-title`},un={class:`preview-ext-badge`},dn=[`title`],fn={class:`preview-body`},pn={key:0,class:`preview-copybar`},mn=[`disabled`,`title`],hn=[`disabled`,`title`],gn=[`disabled`,`title`],_n=[`title`],vn=[`sandbox`,`srcdoc`],yn=2,bn=6e4,xn=3e4,Sn=300,Cn=320,wn=O(c({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new _e:t===`css`||t===`scss`||t===`less`?new he:t===`html`||t===`handlebars`||t===`razor`?new de:t===`typescript`||t===`javascript`?new pe:new fe}};let o=t,c=ue(),x=xe(),C=v([]),O=v(!1),k=v(``),A=v(``),j=null;function De(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)});let M=v([]),Ne=v(0),Pe=v(``),N=v(!1),Fe=v(!1),Ie=null,P=0;function Le(){Ie?.abort(),Ie=null,P+=1,M.value=[],Ne.value=0,Pe.value=``,N.value=!1,Fe.value=!1}async function Re(e){let t=e.trim(),n=c.currentDirectory;if(!n||t.length<yn){Le();return}if(t===Pe.value&&N.value)return;Ie?.abort();let r=++P,i=new AbortController;Ie=i,N.value=!0,Pe.value=t;try{let e=await(await fetch(`/api/search_content`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n,query:t}),signal:i.signal})).json().catch(()=>null);if(r!==P)return;if(!e?.success){M.value=[],Ne.value=0,Fe.value=!1;return}M.value=Array.isArray(e.files)?e.files:[],Ne.value=typeof e.totalMatches==`number`?e.totalMatches:0,Fe.value=!!e.truncated}catch(e){if(e?.name===`AbortError`||r!==P)return;M.value=[],Ne.value=0,Fe.value=!1}finally{r===P&&(N.value=!1)}}S(A,e=>{Re(e)}),f(()=>{j&&clearTimeout(j),Ie?.abort(),Ve(),$n()});let ze=null;function Be(){Ve(),c.ui.fileTreeAutoRefresh&&(ze=setInterval(()=>{document.hidden||c.currentDirectory&&(k.value.trim()||F())},bn))}function Ve(){ze&&=(clearInterval(ze),null)}S(()=>c.currentDirectory,async()=>{if(Fn=!1,Le(),Be(),await We(),L.value.some(e=>e.isDirty)){Fn=!0;return}L.value=[],R.value=null,Vn(),await Rn()}),S(()=>c.ui.fileTreeAutoRefresh,()=>{Be()});async function He(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 We(){let e=c.currentDirectory;if(e){O.value=!0;try{C.value=await He(e,0)}finally{O.value=!1}}}function Ge(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Ge(n.children,t));return t}function qe(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=qe(e.children,t+1),n.expanded=!0),n})}async function Je(e){let t=c.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:qe(n.items,0)}catch{return null}}function Ye(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)?Ye(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function F(e={}){if(!c.currentDirectory)return;let t=await Je([...Ge(C.value)]);if(!t){e.notifyOnError&&y.error(D(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Ye(C.value,t)&&(C.value=t)}async function I(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await He(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Xe(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Xe(n.children));return t}let Ze=E(()=>A.value.trim().toLowerCase());function Qe(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.name.toLowerCase().includes(t);if(r.type===`directory`){let i=r.children?Qe(r.children,t):[];if(!e&&i.length===0)continue;n.push({...r,expanded:!0,children:r.children===void 0?void 0:i})}else e&&n.push(r)}return n}function $e(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=$e(n.children,t);if(e)return e}}return null}let et=E(()=>Qe(C.value,Ze.value)),tt=E(()=>Ze.value.length>0&&et.value.length===0),wn=E(()=>tt.value&&M.value.length===0&&!N.value);function Tn(e){let t=A.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}async function En(e,t){if(await An({name:e.name,path:e.path,type:`file`,depth:0}),!t||t<1)return;await n();let r=B.value;r&&r.getModel()&&Mn()?.path===e.path&&(r.revealLineInCenter(t,ge.ScrollType.Smooth),r.setPosition({lineNumber:t,column:1}),r.focus())}let Dn=v(null);function On(){let e=Dn.value;e&&(e.focus(),e.select())}function kn(){k.value?(De(),Dn.value?.focus()):(Dn.value?.blur(),B.value?.focus())}let L=v([]),R=v(null),z=v(null);async function An(e){if(z.value=e,e.type!==`file`){I($e(C.value,e.path)??e);return}let t=L.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:L.value.length}),t){R.value=e.path,n(()=>Un());return}let r=e.name.split(`.`).pop()||``;if(be.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null};L.value.push(t),R.value=e.path;return}if(Ir.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};L.value.push(t),R.value=e.path,J.value=!0;return}if(je(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};L.value.push(t),R.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),n=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:n}),!n.success){y.error(`${D(`@EDITOR:打开文件失败: `)}${n.error}`);return}let i=ye(r),a=V.get(e.path);a&&!a.isDisposed()&&a.setValue(n.content);let o={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:i,diskMtimeMs:typeof n.mtimeMs==`number`?n.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),L.value.push(o),R.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,L.value.length,`activeTabPath=`,R.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),y.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await n();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await An({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function jn(e,t){t.stopPropagation();let n=L.value.findIndex(t=>t.path===e);n!==-1&&(!L.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(L.value.splice(n,1),R.value===e&&(R.value=L.value[Math.min(n,L.value.length-1)]?.path??null))}let Mn=()=>L.value.find(e=>e.path===R.value)??null,Nn=E(()=>({expandedDirs:[...Ge(C.value)],tabs:L.value.map(e=>e.path),activeTab:R.value})),Pn=!1,Fn=!1;function In(){Fn&&!Pn&&c.isUiLoaded&&c.saveEditorWorkspace(Nn.value)}S(Nn,()=>In());async function Ln(e){if(L.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(be.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null});return}if(Ir.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(je(t)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=V.get(e);i&&!i.isDisposed()&&B.value?.getModel()!==i&&(i.dispose(),V.delete(e)),L.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:ye(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Rn(){try{for(let e=0;e<100&&!c.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!c.isUiLoaded)return;ir.value=c.ui.editorSidebarWidth;let e=c.getEditorWorkspace();if(!e)return;Pn=!0;try{if(e.expandedDirs.length>0){let t=await Je(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await Ln(t);if(!o.pendingFilePath&&e.activeTab&&L.value.some(t=>t.path===e.activeTab)){R.value=e.activeTab;let t=Mn(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Ir.has(n)||je(t.name))&&(J.value=!0)}}finally{Pn=!1}}finally{Fn=!0,In()}}let zn=v(null),B=te(null),V=new Map;function Bn(e){let t=V.get(e.path);return(!t||t.isDisposed())&&(t=ge.createModel(e.content,e.language,me.file(e.path)),V.set(e.path,t)),t}function Vn(){B.value?.setModel(null);for(let e of V.values())e.isDisposed()||e.dispose();V.clear()}function Hn(){if(!zn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;B.value=ge.create(zn.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),B.value.onDidChangeModelContent(()=>{let e=Mn();if(!e)return;let t=B.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),B.value.onDidBlurEditorText(()=>{c.ui.editorAutoSave&&Mn()?.isDirty&&nr(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Un()})})}S(R,e=>{if(!B.value||!e)return;let t=L.value.find(t=>t.path===e);if(!t)return;let r=Bn(t);B.value.setModel(r),n(()=>Un()),Yn(e)});function Un(){if(!B.value)return;B.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let Wn=0,Gn=new Map;async function Kn(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 qn(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 Jn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=V.get(e.path);if(!r||r.isDisposed())return;let i=B.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function Yn(e){if(!e)return;let t=L.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++Wn,r=await Kn(e);if(n!==Wn||L.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Gn.get(e)===r.mtimeMs)return;Gn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await qn(e);i&&L.value.find(t=>t.path===e)===t&&Jn(t,i.content,i.mtimeMs)}function Xn(){document.hidden||Yn(R.value)}let Zn=null;function Qn(){$n(),Zn=setInterval(()=>{document.hidden||Yn(R.value)},xn)}function $n(){Zn&&=(clearInterval(Zn),null)}S(()=>L.value.filter(e=>e.isDirty).length,e=>{x.setDirtyCount(e)},{immediate:!0}),S(R,e=>{let t=L.value.find(t=>t.path===e)??null;x.setActiveFile(t?.path??``,t?.name??``)},{immediate:!0}),f(()=>x.setDirtyCount(0)),we(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ge.setTheme(e?`vs-dark`:`vs`)});let er=null;function tr(){if(er||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}er=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&R.value&&B.value&&(Yn(R.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||Un()}))});let n=er;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}i(async()=>{Hn(),await We(),await Rn(),tr(),Be(),window.addEventListener(`focus`,Xn),document.addEventListener(`visibilitychange`,Xn),Qn(),R.value&&n(()=>Un())}),f(()=>{er?.disconnect(),er=null,window.removeEventListener(`focus`,Xn),document.removeEventListener(`visibilitychange`,Xn),B.value?.dispose(),V.forEach(e=>e.dispose()),V.clear()});async function nr(e=!1){let t=Mn();if(t&&!(Rr.value||zr.value||Br.value))try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){y.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||y.success(D(`@EDITOR:已保存`))}catch(e){y.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function rr(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),On();return}t&&e.key===`s`&&(e.preventDefault(),nr())}i(()=>window.addEventListener(`keydown`,rr)),f(()=>window.removeEventListener(`keydown`,rr));let H=v(null),ir=v(c.ui.editorSidebarWidth),ar=!1,or=0,sr=0;function cr(e){ar=!0,or=e.clientX,sr=ir.value,document.addEventListener(`mousemove`,lr),document.addEventListener(`mouseup`,ur),e.preventDefault()}function lr(e){if(!ar)return;let t=e.clientX-or;ir.value=Math.max(140,Math.min(400,sr+t))}function ur(){ar=!1,document.removeEventListener(`mousemove`,lr),document.removeEventListener(`mouseup`,ur),ir.value!==c.ui.editorSidebarWidth&&c.setEditorSidebarWidth(ir.value)}function dr(e){return e.type===`directory`?Se(e.name):Te(e.name)}let U=v(null),W=v(null),G=v(null),fr=v(null);function pr(){let e=z.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):c.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:c.currentDirectory??``,afterNode:null,depth:0}}async function mr(){let e=pr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`file`,value:``},await n(),G.value?.focus()}async function hr(){let e=pr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`directory`,value:``},await n(),G.value?.focus()}function gr(){U.value=null}async function _r(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}U.value=null,await F()}function vr(e){e.key===`Enter`&&(e.preventDefault(),_r()),e.key===`Escape`&&(e.preventDefault(),gr())}let K=v(null),yr=v(null);function br(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function xr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=pr();U.value={...t,kind:`file`,value:``},await n(),G.value?.focus()}async function Sr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=pr();U.value={...t,kind:`directory`,value:``},await n(),G.value?.focus()}async function Cr(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await n(),fr.value?.focus(),fr.value?.select())}async function wr(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){y.error(r.error);return}let i=L.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,R.value===e.node.path&&(R.value=n)),W.value=null,await F()}function Tr(e){e.key===`Enter`&&(e.preventDefault(),wr()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Er(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){y.error(n.error);return}let r=L.value.findIndex(t=>t.path===e.path);r!==-1&&(L.value.splice(r,1),R.value===e.path&&(R.value=L.value[Math.max(0,r-1)]?.path??null)),y.success(D(`@EDITOR:已删除`)),await F()}async function Dr(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||y.error(t.error)}catch(e){y.error(e?.message||String(e))}}function Or(e){let t=c.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function kr(){let e=K.value?.node;q(),e&&(await Me(e.path)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function Ar(){let e=K.value?.node;if(q(),!e)return;let t=Or(e.path);await Me(t)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`))}async function jr(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||y.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){y.error(e?.message||String(e))}}let Mr=new Set([`html`,`htm`]),Nr=E(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Mr.has(t)});async function Pr(){let e=K.value?.node;if(q(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||y.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){y.error(e?.message||String(e))}}i(()=>{document.addEventListener(`click`,q)}),f(()=>{document.removeEventListener(`click`,q)});let Fr=new Set([`md`,`html`,`htm`,`svg`]),Ir=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),Lr=v(0),X=E(()=>L.value.find(e=>e.path===R.value)??null),Rr=E(()=>X.value?.language===`plaintext`&&X.value?.content===``),zr=E(()=>X.value?.language===`office`),Br=E(()=>X.value?.language===`media`),Z=E(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Vr=E(()=>Fr.has(Z.value)||Ir.has(Z.value)||je(Z.value)),Hr=E(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Ur=E(()=>Z.value===`md`&&Hr.value>0);S(R,()=>{J.value&&!Vr.value&&(J.value=!1),Y.value&&!Ur.value&&(Y.value=!1)});function Wr(){Vr.value&&(J.value||(Y.value=!1),J.value=!J.value)}function Gr(){Ur.value&&(Y.value||(J.value=!1),Y.value=!Y.value)}let Kr=E(()=>Lr.value<=0||L.value.length===0?{flexBasis:`0px`}:{flex:`0 0 ${Lr.value}px`,maxWidth:`calc(100% - 320px)`}),qr=v(null),Q=v(!1),$=v(``),Jr=v(!0),Yr=null,Xr=E(()=>!Y.value&&J.value&&Z.value===`md`&&!!X.value);function Zr(){return X.value?.content??``}function Qr(){return Zr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function $r(e,t,n){if(!e){y.error(D(`@EDITOR:复制失败`));return}$.value=n,Yr&&clearTimeout(Yr),Yr=setTimeout(()=>{$.value=``},1800),t>0?y.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):y.success(D(`@EDITOR:已复制`))}async function ei(){$r(await Me(Zr()),0,`md`)}async function ti(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await nt(e,Jr.value);$r(await Me(t),n,`html`)}finally{Q.value=!1}}}function ni(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0;`,t.innerHTML=e,document.body.appendChild(t);try{let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n);let r=document.execCommand(`copy`);return e?.removeAllRanges(),r}catch{return!1}finally{document.body.removeChild(t)}}async function ri(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await rt(e,{inline:Jr.value,title:Qr()}),r=Zr(),i=!1;try{navigator.clipboard?.write&&typeof ClipboardItem<`u`&&(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([r],{type:`text/plain`})})]),i=!0)}catch{i=!1}i||=ni(t),$r(i,n,`rich`)}finally{Q.value=!1}}}let ii=E(()=>{let e=X.value;if(!e)return``;let t=Z.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Ce(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),ai=!1,oi=0,si=0,ci=0;function li(e){let t=e.currentTarget,n=t.parentElement;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();ai=!0,oi=e.clientX,si=r.right-i.right,ci=Math.max(Sn,r.width-Cn),document.addEventListener(`mousemove`,ui),document.addEventListener(`mouseup`,di),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,e.preventDefault()}function ui(e){if(!ai)return;let t=oi-e.clientX;Lr.value=Math.round(Math.max(Sn,Math.min(ci,si+t)))}function di(){ai=!1,document.removeEventListener(`mousemove`,ui),document.removeEventListener(`mouseup`,di),document.body.style.cursor=``,document.body.style.userSelect=``}return(t,n)=>(w(),d(g,null,[l(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[l(`div`,{class:`editor-sidebar`,style:a({width:ir.value+`px`})},[l(`div`,it,[l(`span`,at,s(u(D)(`@EDITOR:资源管理器`)),1),l(`div`,ot,[e(u(m),{content:u(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:mr},[...n[11]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:hr},[...n[12]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:n[0]||=e=>F({notifyOnError:!0})},[...n[13]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),l(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,st,[n[15]||=l(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),_(l(`input`,{ref_key:`searchInputRef`,ref:Dn,"onUpdate:modelValue":n[1]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:u(D)(`@EDITOR:搜索文件名或内容...`),title:u(D)(`@EDITOR:搜索文件名或内容...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(kn,[`escape`])},null,40,ct),[[oe,k.value]]),k.value?(w(),d(`button`,{key:0,class:`sidebar-search-clear`,title:u(D)(`@EDITOR:清除搜索`),"aria-label":u(D)(`@EDITOR:清除搜索`),onClick:De},[...n[14]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,lt)):T(``,!0)]),O.value?(w(),d(`div`,qt,[...n[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(w(),d(`div`,ut,[Ze.value&&et.value.length>0?(w(),d(`div`,dt,s(u(D)(`@EDITOR:名称匹配`)),1)):T(``,!0),(w(!0),d(g,null,h(Xe(et.value),e=>(w(),d(g,{key:e.path},[W.value&&W.value.node.path===e.path?(w(),d(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[16]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,ft)),(w(),d(`svg`,pt,[l(`use`,{"xlink:href":`#${dr(e)}`},null,8,mt)])),_(l(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:fr,"onUpdate:modelValue":n[2]||=e=>W.value.value=e,onKeydown:Tr,onBlur:wr,onClick:n[3]||=ne(()=>{},[`stop`])},null,544),[[oe,W.value.value]])],4)):(w(),d(`div`,{key:1,class:p([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":R.value===e.path,"tree-node--selected":z.value?.path===e.path&&R.value!==e.path}]),style:a({paddingLeft:12+e.depth*14+`px`}),onClick:t=>An(e),onContextmenu:t=>br(t,e)},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,gt)),e.type===`directory`?(w(),d(`svg`,_t,[l(`use`,{"xlink:href":`#${dr(e)}`},null,8,vt)])):(w(),d(`svg`,yt,[l(`use`,{"xlink:href":`#${dr(e)}`},null,8,bt)])),l(`span`,{class:`tree-name`,title:e.path},[(w(!0),d(g,null,h(Tn(e.name),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,St,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))],8,xt),e.loading?(w(),d(`span`,Ct)):T(``,!0)],46,ht)),U.value&&U.value.afterNode?.path===e.path?(w(),d(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+U.value.depth*14+`px`})},[n[20]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,wt,[...n[18]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,Tt,[...n[19]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:vr,onBlur:gr,onClick:n[5]||=ne(()=>{},[`stop`])},null,40,Et),[[oe,U.value.value]])],4)):T(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(w(),d(`div`,Dt,[n[23]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Ot,[...n[21]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,kt,[...n[22]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:vr,onBlur:gr,onClick:n[7]||=ne(()=>{},[`stop`])},null,40,At),[[oe,U.value.value]])])):T(``,!0),Ze.value?(w(),d(`div`,{key:2,class:`content-results`,"data-query":Pe.value},[N.value?(w(),d(`div`,Mt,[n[24]||=l(`span`,{class:`content-search-spin`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在搜索文件内容...`)),1)])):M.value.length>0?(w(),d(g,{key:1},[l(`div`,Nt,[l(`span`,null,s(u(D)(`@EDITOR:内容匹配`)),1),l(`span`,Pt,s(Ne.value),1),Fe.value?(w(),d(`span`,Ft,s(u(D)(`@EDITOR:结果过多,已截断`)),1)):T(``,!0)]),(w(!0),d(g,null,h(M.value,e=>(w(),d(`div`,{key:e.path,class:`content-hit`},[l(`div`,{class:`content-hit-file`,title:e.relPath,onClick:t=>En(e,e.matches[0]?.line)},[(w(),d(`svg`,Lt,[l(`use`,{"xlink:href":`#${u(Te)(e.name)}`},null,8,Rt)])),l(`span`,zt,s(e.name),1),l(`span`,Bt,s(e.dir),1),l(`span`,Vt,s(e.total),1)],8,It),(w(!0),d(g,null,h(e.matches,t=>(w(),d(`div`,{key:`${e.path}:${t.line}`,class:`content-hit-line`,title:u(D)(`@EDITOR:点击跳到该行`),onClick:n=>En(e,t.line)},[l(`span`,Ut,s(t.line),1),l(`span`,Wt,[(w(!0),d(g,null,h(Tn(t.text),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,Gt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))])],8,Ht))),128))]))),128))],64)):T(``,!0)],8,jt)):T(``,!0),!U.value&&(wn.value||C.value.length===0)?(w(),d(`div`,Kt,s(wn.value?u(D)(`@EDITOR:未找到匹配文件`):u(D)(`@EDITOR:暂无文件`)),1)):T(``,!0)]))],4),l(`div`,{class:`editor-resizer`,onMousedown:cr},null,32),l(`div`,Jt,[l(`div`,Yt,[(w(!0),d(g,null,h(L.value,e=>(w(),d(`div`,{key:e.path,class:p([`editor-tab`,{active:R.value===e.path,dirty:e.isDirty}]),onClick:t=>R.value=e.path,title:e.path},[l(`span`,Zt,s(e.name),1),e.isDirty?(w(),d(`span`,Qt)):T(``,!0),l(`button`,{class:`tab-close`,onClick:t=>jn(e.path,t)},[...n[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$t)],10,Xt))),128)),n[29]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),Vr.value?(w(),d(`button`,{key:0,class:p([`preview-toggle-btn`,{active:J.value}]),title:J.value?u(D)(`@EDITOR:关闭预览`):u(D)(`@EDITOR:打开预览`),onClick:Wr},[n[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0`}),l(`path`,{d:`M21 12c-2.4 4-5.4 6-9 6c-3.6 0-6.6-2-9-6c2.4-4 5.4-6 9-6c3.6 0 6.6 2 9 6`})],-1),l(`span`,null,s(u(D)(`@EDITOR:预览`)),1)],10,en)):T(``,!0),Ur.value?(w(),d(`button`,{key:1,class:p([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!Ur.value}]),disabled:!Ur.value,title:Ur.value?Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:打开思维导图`):u(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Gr},[n[28]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" data-v-a94686db><path d="M8 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-a94686db></path><path d="M20 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-a94686db></path><path d="M8 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-a94686db></path><path d="M20 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-a94686db></path><path d="M14 12a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-a94686db></path><path d="M7.5 7.5l3 3" data-v-a94686db></path><path d="M7.5 16.5l3-3" data-v-a94686db></path><path d="M13.5 13.5l3 3" data-v-a94686db></path><path d="M16.5 7.5l-3 3" data-v-a94686db></path></svg>`,1),l(`span`,null,s(u(D)(`@EDITOR:思维导图`)),1)],10,tn)):T(``,!0)]),L.value.length===0?(w(),r(ke,{key:0,class:`editor-empty`,title:u(D)(`@EDITOR:从左侧选择文件打开`),hint:u(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ie(()=>[...n[30]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):T(``,!0),l(`div`,nn,[l(`div`,{class:p([`monaco-container`,{hidden:L.value.length===0||Rr.value||zr.value||Br.value}]),ref_key:`editorContainerRef`,ref:zn},null,2),Br.value&&X.value?(w(),r(Ue,{key:X.value.path,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):T(``,!0),Rr.value&&L.value.length>0&&!J.value&&!Y.value?(w(),d(`div`,rn,[(w(),d(`svg`,an,[...n[31]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,on,s(X.value?.name),1),l(`p`,sn,s(u(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:2,class:`preview-resizer`,onMousedown:li},null,32)):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:3,class:`preview-panel`,style:a(Kr.value)},[l(`div`,cn,[l(`span`,ln,s(Y.value?u(D)(`@EDITOR:思维导图`):u(D)(`@EDITOR:预览`)),1),l(`span`,un,s(Z.value.toUpperCase()),1),n[33]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:关闭预览`),onClick:n[8]||=e=>Y.value?Y.value=!1:J.value=!1},[...n[32]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,dn)]),l(`div`,fn,[Xr.value?(w(),d(`div`,pn,[l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制 Markdown 源码`),onClick:ei},[n[34]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,s($.value===`md`?u(D)(`@EDITOR:已复制`):`Markdown`),1)],10,mn),l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:ti},[n[35]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,s($.value===`html`?u(D)(`@EDITOR:已复制`):`HTML`),1)],10,hn),l(`button`,{class:p([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:ri},[n[36]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,s(Q.value?u(D)(`@EDITOR:转换图片中…`):$.value===`rich`?u(D)(`@EDITOR:已复制`):u(D)(`@EDITOR:复制富文本`)),1)],10,gn),l(`label`,{class:`preview-copy-embed`,title:u(D)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[_(l(`input`,{"onUpdate:modelValue":n[9]||=e=>Jr.value=e,type:`checkbox`},null,512),[[ae,Jr.value]]),l(`span`,null,s(u(D)(`@EDITOR:图片转 Base64`)),1)],8,_n)])):T(``,!0),Y.value&&Z.value===`md`&&X.value?(w(),r(Ke,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Z.value===`md`&&X.value?(w(),r(Ee,{ref_key:`mdPreviewRef`,ref:qr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):J.value&&[`html`,`htm`,`svg`].includes(Z.value)?(w(),d(`iframe`,{key:3,class:`preview-iframe`,sandbox:u(Oe),srcdoc:ii.value},null,8,vn)):J.value&&u(Ir).has(Z.value)&&X.value?(w(),r(Ae,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):J.value&&zr.value&&X.value?(w(),r(ve,{key:5,"file-path":X.value.path},null,8,[`file-path`])):T(``,!0)])],4)):T(``,!0)])])],512),(w(),r(ce,{to:`body`},[K.value?(w(),d(`div`,{key:0,ref_key:`ctxMenuRef`,ref:yr,class:`ctx-menu`,style:a({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:n[10]||=ne(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:xr},[n[37]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Sr},[n[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件夹`)),1)]),n[45]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:kr},[n[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667-2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1-2.667 2.667h-8.666a2.667 2.667 0 0 1-2.667-2.667l0-8.666`}),l(`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1-1.012-1.737v-10c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1`})],-1),b(` `+s(u(D)(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Ar},[n[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M9 15l6-6`}),l(`path`,{d:`M11 6l.463-.536a5 5 0 0 1 7.071 7.072l-.534.464`}),l(`path`,{d:`M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0a4.972 4.972 0 0 1 0-7.071l.524-.463`})],-1),b(` `+s(u(D)(`@EDITOR:复制相对路径`)),1)]),n[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),Nr.value?(w(),d(`button`,{key:0,class:`ctx-menu-item`,onClick:Pr},[n[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0`}),l(`path`,{d:`M3.6 9h16.8`}),l(`path`,{d:`M3.6 15h16.8`}),l(`path`,{d:`M11.5 3a17 17 0 0 0 0 18`}),l(`path`,{d:`M12.5 3a17 17 0 0 1 0 18`})],-1),b(` `+s(u(D)(`@EDITOR:在浏览器中打开`)),1)])):T(``,!0),l(`button`,{class:`ctx-menu-item`,onClick:Dr},[n[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M5 19l2.757-7.351a1 1 0 0 1 .936-.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1-1.964 1.625h-14.026a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2`})],-1),b(` `+s(u(D)(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:jr},[e(le,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),b(` `+s(u(D)(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Cr},[n[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 7h-1a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1`}),l(`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97l-8.415 8.385v3h3l8.385-8.415`}),l(`path`,{d:`M16 5l3 3`})],-1),b(` `+s(u(D)(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Er},[n[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M4 7l16 0`}),l(`path`,{d:`M10 11l0 6`}),l(`path`,{d:`M14 11l0 6`}),l(`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12`}),l(`path`,{d:`M9 7v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})],-1),b(` `+s(u(D)(`@EDITOR:删除`)),1)])],4)):T(``,!0)]))],64))}}),[[`__scopeId`,`data-v-a94686db`]]);export{wn as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Cn as n,Gn as r,Gr as i,In as a,J as ee,Jr as o,L as te,Mn as s,Sn as c,Sr as l,Tn as u,Un as d,Ur as f,W as ne,Yn as p,_n as m,a as h,ar as g,ct as re,gn as _,gr as v,i as y,ir as b,kn as x,lr as S,mn as ie,mt as ae,nr as C,on as w,qn as T,r as E,wn as D,xn as O,yn as oe,z as se}from"./element-plus-D8LubGQe.js";import{C as ce,m as le}from"./vendor-CUQALT_x.js";import{n as k,t as A}from"./_plugin-vue_export-helper-BRUY9DoQ.js";import{o as ue,t as de}from"./configStore-1qv5tdrb.js";import{n as fe,r as pe}from"./flow-mindmap-DwG2RDXe.js";import{U as me,a as he,o as j,s as M}from"./index-C4masR7z.js";a(),S(),t(),w();var N={class:`mindmap-view`},P={class:`mm-toolbar`},F={class:`mm-toolbar-left`},I={class:`mm-dir-tooltip`},L={key:1,class:`mm-dir-empty`},R={class:`mm-toolbar-right`},ge={key:0,class:`mm-status`},_e=[`title`],ve={key:0,class:`mm-status-dirty`},ye={class:`mm-body`},be={class:`mm-sidebar`},xe={class:`mm-sidebar-header`},Se={class:`mm-sidebar-title`},Ce={class:`mm-sidebar-list`},we={key:0,class:`mm-sidebar-error`},Te=[`title`,`onClick`,`onContextmenu`],Ee={class:`mm-group-info`},De={class:`mm-group-name`},Oe={class:`mm-group-title`},ke={class:`mm-group-count`},Ae={class:`mm-group-path`},je={class:`mm-group-body`},Me=[`title`],Ne=[`onClick`],Pe={class:`mm-file-info`},Fe=[`title`],Ie={class:`mm-file-meta`},Le={class:`mm-editor`},Re={class:`mm-stage`},ze={class:`mm-canvas`},Be=1500,z=A(s({__name:`MindmapView`,setup(t){let a=j(),s=de(),{currentLocale:S}=ce(ue()),w=O(()=>{let e=s.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),A=v(null),z=v(!1);function Ve(){z.value=!0}async function He(e){z.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await a.addDirs(t);e>0?y.success(k(`@MINDMAP:已添加目录`,{n:e})):y.info(k(`@MINDMAP:重复目录已忽略`))}catch(e){y.error(e?.message||k(`@MINDMAP:读取目录失败`))}}let B=v({});function Ue(e){B.value={...B.value,[e]:!B.value[e]},a.activeDir=e}function We(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function Ge(e){return!!a.activeDir&&a.activeDir.toLowerCase()===e.toLowerCase()}function V(){let{dir:e,ambiguous:t}=a.resolveTargetDir();return e||(y.warning(k(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function H(e){let t=e||V();if(!t||(e&&(a.activeDir=e),!await K()))return;let n=``;try{n=(await E.prompt(k(`@MINDMAP:输入文件名提示`),k(`@MINDMAP:新建思维导图`),{confirmButtonText:k(`@MINDMAP:新建`),cancelButtonText:k(`@MINDMAP:取消`),inputPlaceholder:k(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?k(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||k(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await a.createFile(n,!0,t),y.success(k(`@MINDMAP:已新建并打开`))}catch(e){y.error(e?.message||k(`@MINDMAP:新建失败`))}}async function U(e=!1){if(a.current)try{let t=A.value?.exportData();if(!t){e||y.warning(k(`@MINDMAP:无法获取数据`));return}await a.saveCurrent(t),e||y.success(k(`@MINDMAP:已保存`))}catch(e){y.error(e?.message||k(`@MINDMAP:保存失败`))}}let W=null;function Ke(){a.current&&a.dirty&&(W&&clearTimeout(W),W=setTimeout(()=>{W=null,a.current&&a.dirty&&U(!0)},Be))}function G(){W&&=(clearTimeout(W),null)}async function K(){if(!a.dirty||!a.current)return!0;try{await E.confirm(k(`@MINDMAP:未保存提示`,{title:a.current.title}),k(`@MINDMAP:未保存的改动`),{confirmButtonText:k(`@MINDMAP:保存`),cancelButtonText:k(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),G();let e=A.value?.exportData();return e&&(await a.saveCurrent(e),y.success(k(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(G(),!0)}}async function qe(e){if(!(a.current&&a.current.path===e)&&await K())try{await a.openFile(e,!0)}catch(e){y.error(e?.message||k(`@MINDMAP:打开失败`))}}async function q(e){let t=!!a.current&&he(a.current.path,e),n=k(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${k(`@MINDMAP:当前文件将保持打开`)}`);try{await E.confirm(n,k(`@MINDMAP:移除目录`),{confirmButtonText:k(`@MINDMAP:移除目录`),cancelButtonText:k(`@MINDMAP:取消`),type:`warning`})}catch{return}a.removeDir(e),y.success(k(`@MINDMAP:已移除目录`))}let J=v(null);function Je(e,t){e.preventDefault(),J.value={x:e.clientX,y:e.clientY,dir:t}}function Y(){J.value=null}async function Ye(){let e=J.value?.dir;if(Y(),!e)return;let t=await me(e);t.success?y.success(t.message||k(`@MINDMAP:已在文件管理器中打开`)):y.error(t.error||k(`@MINDMAP:打开目录失败`))}function Xe(){let e=J.value?.dir;Y(),e&&H(e)}function Ze(){let e=J.value?.dir;Y(),e&&q(e)}async function Qe(e){try{await E.confirm(k(`@MINDMAP:确认删除提示`,{title:e.title}),k(`@MINDMAP:删除`),{confirmButtonText:k(`@MINDMAP:删除`),cancelButtonText:k(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await a.deleteFile(e.path),y.success(k(`@MINDMAP:已删除`))}catch(e){y.error(e?.message||k(`@MINDMAP:删除失败`))}}async function $e(e){let t=``;try{t=(await E.prompt(k(`@MINDMAP:输入新名称提示`),k(`@MINDMAP:重命名`),{confirmButtonText:k(`@MINDMAP:确定`),cancelButtonText:k(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?k(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||k(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await a.renameFile(e.path,t),y.success(k(`@MINDMAP:已重命名`))}catch(e){y.error(e?.message||k(`@MINDMAP:重命名失败`))}}function et(e){a.markDirty(),Ke()}function X(e){}async function tt(e){let t=e||V();if(!t)return;let n=``,r=``;try{n=(await E.prompt(k(`@MINDMAP:粘贴Markdown提示`),k(`@MINDMAP:从Markdown导入`),{confirmButtonText:k(`@MINDMAP:导入`),cancelButtonText:k(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:k(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?k(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await E.prompt(k(`@MINDMAP:输入文件名提示`),k(`@MINDMAP:文件名`),{confirmButtonText:k(`@MINDMAP:新建`),cancelButtonText:k(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?k(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||k(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await a.createFile(r,!0,t);let e=fe(n,r),i=JSON.stringify(e,null,2);await a.saveCurrent(i),y.success(k(`@MINDMAP:已导入`))}catch(e){y.error(e?.message||k(`@MINDMAP:导入失败`))}}async function nt(){if(A.value)try{let e=A.value.getMarkdown();await navigator.clipboard.writeText(e),y.success(k(`@MINDMAP:已复制Markdown`))}catch(e){y.error(e?.message||k(`@MINDMAP:复制失败`))}}function Z(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),a.current&&a.dirty&&(G(),U()))}let Q=v(0);C(()=>a.current?.path,()=>{Q.value++});let $=v(!1);function rt(){$.value=!$.value}let it=O(()=>{let e=a.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});r(async()=>{window.addEventListener(`keydown`,Z),document.addEventListener(`click`,Y),await a.init()}),d(()=>{window.removeEventListener(`keydown`,Z),document.removeEventListener(`click`,Y),G()});function at(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?k(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${k(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${k(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ot(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(t,r)=>{let s=se,d=te,v=ne,y=ee,C=h;return T(),u(`div`,N,[c(`div`,P,[c(`div`,F,[e(s,{size:`small`,onClick:Ve},{icon:b(()=>[...r[7]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),c(`path`,{d:`M16 19h6`}),c(`path`,{d:`M19 16v6`})],-1)]]),default:b(()=>[x(` `+o(l(k)(`@MINDMAP:添加目录`)),1)]),_:1}),l(a).dirs.length>0?(T(),n(v,{key:0,placement:`bottom-start`,"show-after":200},{content:b(()=>[c(`div`,I,[(T(!0),u(m,null,p(l(a).dirs,e=>(T(),u(`div`,{key:e},o(e),1))),128))])]),default:b(()=>[e(d,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:b(()=>[x(o(l(k)(`@MINDMAP:个目录`,{n:l(a).dirs.length})),1)]),_:1})]),_:1})):(T(),u(`span`,L,o(l(k)(`@MINDMAP:请先添加目录`)),1))]),c(`div`,R,[e(s,{size:`small`,disabled:l(a).dirs.length===0,onClick:r[0]||=e=>H()},{icon:b(()=>[...r[8]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M12 5l0 14`}),c(`path`,{d:`M5 12l14 0`})],-1)]]),default:b(()=>[x(` `+o(l(k)(`@MINDMAP:新建`)),1)]),_:1},8,[`disabled`]),e(s,{size:`small`,disabled:l(a).dirs.length===0,onClick:r[1]||=e=>tt()},{icon:b(()=>[...r[9]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),c(`path`,{d:`M5 13v-8a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2h-5.5m-9.5-2h7m-3-3l3 3l-3 3`})],-1)]]),default:b(()=>[x(` `+o(l(k)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`disabled`]),e(s,{size:`small`,disabled:!l(a).current,onClick:nt},{icon:b(()=>[...r[10]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),c(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),c(`path`,{d:`M10 18l5-5a1.414 1.414 0 0 0-2-2l-5 5v2h2`})],-1)]]),default:b(()=>[x(` `+o(l(k)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`disabled`]),e(s,{size:`small`,type:`primary`,disabled:!l(a).current||!l(a).dirty,loading:l(a).loading,onClick:r[2]||=()=>{G(),U()}},{icon:b(()=>[...r[11]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M6 4h10l4 4v10a2 2 0 0 1-2 2h-12a2 2 0 0 1-2-2v-12a2 2 0 0 1 2-2`}),c(`path`,{d:`M10 14a2 2 0 1 0 4 0a2 2 0 1 0-4 0`}),c(`path`,{d:`M14 4l0 4l-6 0l0-4`})],-1)]]),default:b(()=>[x(` `+o(l(k)(`@MINDMAP:保存`)),1)]),_:1},8,[`disabled`,`loading`]),l(a).current?(T(),u(`span`,ge,[c(`span`,{class:`mm-status-title`,title:l(a).current.title},o(l(a).current.title),9,_e),l(a).dirty?(T(),u(`span`,ve,`●`)):D(``,!0)])):D(``,!0)])]),c(`div`,ye,[c(`div`,be,[c(`div`,xe,[c(`span`,Se,o(l(k)(`@MINDMAP:文件列表`)),1),e(s,{size:`small`,text:``,loading:l(a).refreshing,onClick:r[3]||=e=>l(a).refresh(),disabled:l(a).dirs.length===0},{icon:b(()=>[...r[12]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),c(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]]),_:1},8,[`loading`,`disabled`])]),g((T(),u(`div`,Ce,[l(a).error?(T(),u(`div`,we,o(l(a).error),1)):D(``,!0),l(a).dirs.length===0?(T(),n(M,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:l(k)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(T(!0),u(m,{key:2},p(l(a).groups,t=>(T(),u(`div`,{key:t.dir,class:`mm-group`},[c(`div`,{class:f([`mm-group-header`,{active:Ge(t.dir)}]),title:t.dir,onClick:e=>Ue(t.dir),onContextmenu:e=>Je(e,t.dir)},[e(y,{class:f([`mm-group-caret`,{collapsed:B.value[t.dir]}])},{default:b(()=>[...r[13]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[c(`path`,{d:`M6 9l6 6l6-6`})],-1)]]),_:1},8,[`class`]),c(`div`,Ee,[c(`div`,De,[c(`span`,Oe,o(We(t.dir)),1),c(`span`,ke,o(t.files.length),1)]),c(`div`,Ae,o(t.dir),1)])],42,Te),g(c(`div`,je,[t.error?(T(),u(`div`,{key:0,class:`mm-group-error`,title:t.error},[c(`span`,null,o(l(k)(`@MINDMAP:目录不存在或已删除`)),1),e(s,{size:`small`,text:``,type:`danger`,onClick:e=>q(t.dir)},{default:b(()=>[x(o(l(k)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Me)):t.files.length===0?(T(),n(M,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:l(k)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(T(!0),u(m,{key:2},p(t.files,t=>(T(),u(`div`,{key:t.path,class:f([`mm-file-item`,{active:l(a).current?.path===t.path}]),onClick:e=>qe(t.path)},[c(`div`,Pe,[c(`div`,{class:`mm-file-title`,title:t.title},o(t.title),9,Fe),c(`div`,Ie,o(at(t.mtime))+` · `+o(ot(t.size)),1)]),c(`div`,{class:`mm-file-actions`,onClick:r[4]||=_(()=>{},[`stop`])},[e(s,{size:`small`,text:``,icon:l(ae),onClick:e=>$e(t),title:l(k)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),e(s,{size:`small`,text:``,type:`danger`,icon:l(re),onClick:e=>Qe(t),title:l(k)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Ne))),128))],512),[[ie,!B.value[t.dir]]])]))),128))])),[[C,l(a).refreshing]])]),c(`div`,Le,[c(`div`,Re,[c(`div`,ze,[l(a).current?(T(),n(l(pe),{key:Q.value,ref_key:`mmRef`,ref:A,data:it.value,"preview-mode":$.value,onChange:et,onSelect:X,onCanvasTogglePreview:rt},null,8,[`data`,`preview-mode`])):(T(),n(M,{key:0,class:`mm-editor-empty`,title:l(k)(`@MINDMAP:思维导图编辑器`),hint:l(a).dirs.length>0?l(k)(`@MINDMAP:从左侧选择或新建`):l(k)(`@MINDMAP:先选择目录提示`)},{icon:b(()=>[...r[14]||=[c(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[c(`circle`,{cx:`12`,cy:`12`,r:`2`}),c(`circle`,{cx:`5`,cy:`5`,r:`2`}),c(`circle`,{cx:`19`,cy:`5`,r:`2`}),c(`circle`,{cx:`5`,cy:`19`,r:`2`}),c(`circle`,{cx:`19`,cy:`19`,r:`2`}),c(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),c(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),c(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),c(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])])])]),e(l(le),{visible:z.value,mode:`directory`,multiple:!0,theme:w.value?`dark`:`light`,locale:l(S),"default-path":l(a).activeDir||l(a).dirs[0]||``,onClose:r[5]||=e=>z.value=!1,onConfirm:He},null,8,[`visible`,`theme`,`locale`,`default-path`]),(T(),n(oe,{to:`body`},[J.value?(T(),u(`div`,{key:0,class:`ctx-menu`,style:i({left:J.value.x+`px`,top:J.value.y+`px`}),onClick:r[6]||=_(()=>{},[`stop`])},[c(`button`,{class:`ctx-menu-item`,onClick:Ye},[r[15]||=c(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[c(`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`}),c(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),x(` `+o(l(k)(`@MINDMAP:打开目录`)),1)]),c(`button`,{class:`ctx-menu-item`,onClick:Xe},[r[16]||=c(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[c(`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`}),c(`polyline`,{points:`14 2 14 8 20 8`}),c(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),c(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),x(` `+o(l(k)(`@MINDMAP:在此新建`)),1)]),r[18]||=c(`div`,{class:`ctx-menu-sep`},null,-1),c(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Ze},[r[17]||=c(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[c(`polyline`,{points:`3 6 5 6 21 6`}),c(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),c(`path`,{d:`M10 11v6`}),c(`path`,{d:`M14 11v6`}),c(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),x(` `+o(l(k)(`@MINDMAP:移除目录`)),1)])],4)):D(``,!0)]))])}}}),[[`__scopeId`,`data-v-82c3c79e`]]);export{z as default};
@@ -1 +0,0 @@
1
- .mindmap-view[data-v-82c3c79e]{background:var(--bg-page);flex-direction:column;height:100%;min-height:0;display:flex;overflow:hidden}.mm-toolbar[data-v-82c3c79e]{background:var(--bg-container);border-bottom:1px solid var(--border-color);flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:8px 14px;display:flex}.mm-toolbar-left[data-v-82c3c79e],.mm-toolbar-right[data-v-82c3c79e]{align-items:center;gap:8px;min-width:0;display:flex}.mm-toolbar-left[data-v-82c3c79e]{flex:1}.mm-toolbar-right[data-v-82c3c79e]{flex-shrink:0}.mm-toolbar-right[data-v-82c3c79e] .el-button--primary.is-disabled{background:var(--bg-hover);border-color:var(--border-color);color:var(--text-meta)}.mm-dir-tag[data-v-82c3c79e]{flex-shrink:0}.mm-dir-tooltip[data-v-82c3c79e]{word-break:break-all;max-width:520px;line-height:1.6}.mm-dir-empty[data-v-82c3c79e]{font-size:var(--font-size-sm);color:var(--text-meta);font-style:italic}.mm-status[data-v-82c3c79e]{font-size:var(--font-size-sm);color:var(--text-secondary);align-items:center;gap:4px;margin-left:4px;display:flex}.mm-status-title[data-v-82c3c79e]{white-space:nowrap;text-overflow:ellipsis;max-width:160px;font-weight:500;overflow:hidden}.mm-status-dirty[data-v-82c3c79e]{color:var(--color-warning-dark);font-size:var(--font-size-base);line-height:1}.mm-body[data-v-82c3c79e]{flex:1;min-height:0;display:flex;overflow:hidden}.mm-sidebar[data-v-82c3c79e]{background:var(--bg-container);border-right:1px solid var(--border-color);flex-direction:column;flex-shrink:0;width:240px;display:flex}.mm-sidebar-header[data-v-82c3c79e]{border-bottom:1px solid var(--border-color);background:var(--bg-panel);justify-content:space-between;align-items:center;padding:8px 12px;display:flex}.mm-sidebar-title[data-v-82c3c79e]{font-size:var(--font-size-sm);color:var(--text-secondary);letter-spacing:.5px;text-transform:uppercase;font-weight:600}.mm-sidebar-list[data-v-82c3c79e]{flex:1;min-height:0;padding:4px;overflow-y:auto}.mm-sidebar-empty[data-v-82c3c79e]{padding:24px 12px}.mm-sidebar-error[data-v-82c3c79e]{text-align:center;font-size:var(--font-size-sm);color:var(--color-danger-dark);padding:24px 12px}.mm-group[data-v-82c3c79e]{margin-bottom:2px}.mm-group-header[data-v-82c3c79e]{border-radius:var(--radius-md);cursor:pointer;transition:background var(--transition-fast) ease;align-items:center;gap:6px;padding:6px;display:flex}.mm-group-header[data-v-82c3c79e]:hover{background:var(--bg-container-hover)}.mm-group-header.active[data-v-82c3c79e]{background:color-mix(in srgb, var(--color-primary) 12%, var(--bg-container))}.mm-group-caret[data-v-82c3c79e]{font-size:var(--font-size-sm);color:var(--text-meta);transition:transform var(--transition-fast) ease;flex-shrink:0}.mm-group-caret.collapsed[data-v-82c3c79e]{transform:rotate(-90deg)}.mm-group-info[data-v-82c3c79e]{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.mm-group-name[data-v-82c3c79e]{align-items:baseline;gap:4px;min-width:0;display:flex}.mm-group-title[data-v-82c3c79e]{font-size:var(--font-size-mid);color:var(--text-primary);white-space:nowrap;text-overflow:ellipsis;font-weight:600;overflow:hidden}.mm-group-header.active .mm-group-title[data-v-82c3c79e]{color:var(--color-primary)}.mm-group-count[data-v-82c3c79e]{font-size:var(--font-size-xs);color:var(--text-meta);flex-shrink:0}.mm-group-path[data-v-82c3c79e]{font-size:var(--font-size-xs);color:var(--text-meta);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.mm-group-body[data-v-82c3c79e]{padding-left:8px}.mm-group-error[data-v-82c3c79e]{font-size:var(--font-size-sm);color:var(--color-danger-dark);justify-content:space-between;align-items:center;gap:4px;padding:8px 8px 8px 12px;display:flex}.mm-file-item[data-v-82c3c79e]{border-radius:var(--radius-md);cursor:pointer;transition:background var(--transition-fast) ease;align-items:center;gap:8px;padding:6px 8px;display:flex;position:relative}.mm-file-item[data-v-82c3c79e]:hover{background:var(--bg-container-hover)}.mm-file-item.active[data-v-82c3c79e]{background:color-mix(in srgb, var(--color-primary) 12%, var(--bg-container))}.mm-file-item.active .mm-file-title[data-v-82c3c79e]{color:var(--color-primary);font-weight:600}.mm-file-info[data-v-82c3c79e]{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.mm-file-title[data-v-82c3c79e]{font-size:var(--font-size-mid);color:var(--text-primary);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.mm-file-meta[data-v-82c3c79e]{font-size:var(--font-size-xs);color:var(--text-meta);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.mm-file-actions[data-v-82c3c79e]{background:inherit;opacity:0;pointer-events:none;transition:opacity var(--transition-fast) ease, background var(--transition-fast) ease;align-items:center;gap:2px;padding-left:8px;display:flex;position:absolute;top:0;bottom:0;right:8px}.mm-file-item:hover .mm-file-actions[data-v-82c3c79e]{opacity:1;pointer-events:auto}html:not(.dark) .mm-file-actions[data-v-82c3c79e] .el-button--danger{color:var(--git-status-locked)}.mm-editor[data-v-82c3c79e]{background:var(--bg-container);flex:1;min-width:0;min-height:0;display:flex;position:relative}.mm-stage[data-v-82c3c79e]{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.mm-canvas[data-v-82c3c79e]{flex:1;min-width:0;min-height:0;position:relative}.mm-canvas[data-v-82c3c79e] .zm-mindmap,.mm-canvas[data-v-82c3c79e]>*{width:100%;height:100%}.mm-editor-empty[data-v-82c3c79e]{position:absolute;inset:0}.ctx-menu[data-v-82c3c79e]{z-index:var(--z-menu-float);background:var(--bg-container);border:1px solid var(--border-color);border-radius:var(--radius-md);-webkit-user-select:none;user-select:none;min-width:160px;padding:4px;position:fixed;box-shadow:0 8px 24px #00000059}.ctx-menu-item[data-v-82c3c79e]{border-radius:var(--radius-base);cursor:pointer;width:100%;font-size:var(--font-size-mid);color:var(--text-primary);text-align:left;transition:background var(--transition-fast);background:0 0;border:none;align-items:center;gap:8px;padding:6px 10px;display:flex}.ctx-menu-item[data-v-82c3c79e]:hover{background:var(--bg-hover)}.ctx-menu-item--danger[data-v-82c3c79e]{color:var(--color-danger-dark)}.ctx-menu-item--danger[data-v-82c3c79e]:hover{background:#ef44441a}.ctx-menu-sep[data-v-82c3c79e]{background:var(--border-color);height:1px;margin:4px 2px}@media (width<=900px){.mm-sidebar[data-v-82c3c79e]{width:180px}}
@@ -1,15 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,C as n,Cn as r,Gn as i,In as a,J as o,Jr as s,Mn as c,S as l,Sn as u,Sr as d,Tn as f,Y as p,Yn as m,_n as h,et as g,gr as _,i as v,ir as y,lr as b,qn as x,w as ee,wn as S,xn as C}from"./element-plus-D8LubGQe.js";import{n as w,t as T}from"./_plugin-vue_export-helper-BRUY9DoQ.js";import{d as E,f as D,m as O,p as k,t as A}from"./configStore-1qv5tdrb.js";import{O as j,_ as M,g as te,vt as N,x as P}from"./index-C4masR7z.js";var F=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`],ne=/!\[([^\]]*)\]\(\s*(?:<([^<>\n]+)>|([^()\s]+))(\s+["'][^"']*["'])?\s*\)/g,re=/^\s*(`{3,}|~{3,})/,ie=/\.([a-z0-9]+)$/;function I(e){let t=e.trim().toLowerCase().match(ie);return!!t&&F.includes(t[1])}function ae(e){let t=String(e||``).trim();if(!t)return!1;if(/^[a-zA-Z]:[\\/]/.test(t))return I(t);let n=t.match(/^([a-z][a-z0-9+.-]+):/i);return n&&n[1].toLowerCase()!==`file`||t.startsWith(`//`)||t.startsWith(`/`)?!1:I(t)}function oe(e,t){return`/api/workbench/jobs/${encodeURIComponent(e)}/image?path=${encodeURIComponent(t)}`}function se(e,t){return`/api/agent/sessions/${encodeURIComponent(e)}/image?path=${encodeURIComponent(t)}`}function ce(e,t){return e.includes(`![`)?e.replace(ne,(e,n,r,i,a)=>{let o=(r??i??``).trim();return ae(o)?`![${n}](${t(o)}${a||``})`:e}):e}function L(e,t){let n=typeof e==`string`?e:``;if(!n||!t||!n.includes(`![`))return n;let r=n.split(`
2
- `),i=null,a=[];for(let e of r){let n=e.match(re);if(n){let t=n[1][0];i===null?i=t:i===t&&(i=null),a.push(e);continue}a.push(i===null?ce(e,t):e)}return a.join(`
3
- `)}function R(e,t){return L(e,t?e=>oe(t,e):null)}function z(e,t){return L(e,t?e=>se(t,e):null)}function B(e){if(!e)return``;try{let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=new Date,r=n.getTime()-t.getTime(),i=e=>String(e).padStart(2,`0`);if(t.toDateString()===n.toDateString())return`${i(t.getHours())}:${i(t.getMinutes())}`;if(r<6048e5){let e=Math.floor(r/864e5);return e===0?w(`@AGENT:今天`):`${e}${w(`@AGENT:天前`)}`}return`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())}`}catch{return e}}function V(e,t){return e.map(e=>({id:e.sessionId,title:e.title||w(`@AGENT:无标题`),meta:`${B(e.updatedAt)} · ${e.messageCount??0} ${w(`@AGENT:条`)}`,generatingText:e.isGenerating||t(e.sessionId)?w(`@AGENT:正在生成中...`):``,badge:e.source===`cli`?`CLI`:``,searchText:e.model}))}function H(){return{newConversation:w(`@AGENT:新建会话`),searchPlaceholder:w(`@AGENT:搜索会话...`),empty:w(`@AGENT:暂无会话`),emptyHint:w(`@AGENT:点击上方按钮开始对话`),noResult:w(`@AGENT:未找到匹配的会话`),loading:w(`@AGENT:加载会话中...`),rename:w(`@AGENT:重命名`),delete:w(`@AGENT:删除`),untitled:w(`@AGENT:无标题`),collapse:w(`@AGENT:收起会话列表`),expand:w(`@AGENT:展开会话列表`)}}var U={enable:!0},W={enable:!0,items:[`duration`],visibility:`always`};function G(){return{title:w(`@AGENT:等待你的回答`),placeholder:w(`@AGENT:输入回答`),submit:w(`@AGENT:提交回答`),answered:w(`@AGENT:已回答`),expand:w(`@AGENT:展开完整问答`),collapse:w(`@AGENT:收起完整问答`)}}function le(){return{title:w(`@AGENT:文件改动`),files:w(`@AGENT:个文件`),added:w(`@AGENT:新增行`),removed:w(`@AGENT:删除行`),expand:w(`@AGENT:查看改动`),collapse:w(`@AGENT:收起改动`),writeHint:w(`@AGENT:整体写入`),empty:w(`@AGENT:无可预览的差异`)}}function ue(){return{title:w(`@AGENT:排队中`),hint:w(`@AGENT:本轮结束后依次发送`),pausedHint:w(`@AGENT:已暂停,点「立即发送」继续`),send:w(`@AGENT:加入队列`),flush:w(`@AGENT:立即发送`),remove:w(`@AGENT:移出队列`)}}b();var de=1e5;function fe(){let e=_([]),t=_([]),n=_(de),r=_([]),i=_(null),a=_(!1),o=_(!1),s=_(``),c=_({}),l=_([]),u=_(!1),d=_(!1),f=_(M);async function p(o=!1){try{let l=await fetch(`/api/workbench/orchestrator`,{cache:`no-store`}).then(e=>e.json());return l?.success?(Number.isInteger(l.maxInstructionChars)&&l.maxInstructionChars>0&&(n.value=l.maxInstructionChars),e.value=Array.isArray(l.instructions)?l.instructions:[],t.value=Array.isArray(l.activity)?l.activity:[],r.value=Array.isArray(l.running)?l.running:[],te().setRunning(r.value.length),i.value=l.updatedAt||null,s.value=typeof l.defaultPrompt==`string`?l.defaultPrompt:``,c.value=l.projectPrompts&&typeof l.projectPrompts==`object`?l.projectPrompts:{},f.value=P(l.reportIntervalMs),a.value=!0,!0):(o||v.error(l?.error||w(`@WORKBENCH:读取编排状态失败`)),!1)}catch(e){return o||v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),!1}}async function m(e=!1){if(u.value)return!1;u.value=!0;try{let t=await fetch(`/api/workbench/orchestrator/reports`,{cache:`no-store`}).then(e=>e.json());return t?.success?(l.value=Array.isArray(t.reports)?t.reports:[],!0):(e||v.error(t?.error||w(`@WORKBENCH:读取进度报告失败`)),!1)}catch(t){return e||v.error(w(`@WORKBENCH:网络错误: `)+(t?.message||t)),!1}finally{u.value=!1}}async function h(){if(d.value)return null;d.value=!0;try{let e=String(A().locale||``).startsWith(`en`)?`en`:`zh`,t=await fetch(`/api/workbench/orchestrator/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({locale:e})}).then(e=>e.json());return t?.success?t.report?(l.value=[t.report,...l.value].slice(0,20),t.report):(v.info(w(`@WORKBENCH:当前没有正在执行的任务,没有可汇报的进度`)),null):(v.error(t?.error||w(`@WORKBENCH:生成进度报告失败`)),null)}catch(e){return v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),null}finally{d.value=!1}}async function g(e){try{let t=await fetch(`/api/workbench/orchestrator/report-interval`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({intervalMs:e})}).then(e=>e.json());return t?.success?(f.value=P(t.reportIntervalMs),!0):(v.error(t?.error||w(`@WORKBENCH:保存失败`)),!1)}catch(e){return v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),!1}}async function y(e){try{let t=await fetch(`/api/workbench/orchestrator/default-prompt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:e})}).then(e=>e.json());return t?.success?(s.value=typeof t.defaultPrompt==`string`?t.defaultPrompt:``,v.success(w(`@WORKBENCH:已保存全局预设提示词`)),!0):(v.error(t?.error||w(`@WORKBENCH:保存失败`)),!1)}catch(e){return v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),!1}}async function b(e,t){try{let n=await fetch(`/api/workbench/orchestrator/project-prompt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectPath:e,prompt:t})}).then(e=>e.json());return n?.success?(c.value=n.projectPrompts&&typeof n.projectPrompts==`object`?n.projectPrompts:{},v.success(w(`@WORKBENCH:已保存项目预设提示词`)),!0):(v.error(n?.error||w(`@WORKBENCH:保存失败`)),!1)}catch(e){return v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),!1}}async function x(e){if(o.value)return null;o.value=!0;try{let t=await fetch(`/api/workbench/orchestrator/dispatch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e.text,projectPath:e.projectPath||``,autoRun:e.autoRun!==!1,useDefaultPrompt:e.useDefaultPrompt!==!1,executor:e.executor,imageText:e.imageText,attachments:(e.attachments||[]).map(e=>({id:e.id,ext:e.ext,originalName:e.originalName}))})}).then(e=>e.json());return t?.success?(await p(!0),{task:t.task||null,ran:!!t.ran}):(v.error(t?.error||w(`@WORKBENCH:派发失败`)),null)}catch(e){return v.error(w(`@WORKBENCH:网络错误: `)+(e?.message||e)),null}finally{o.value=!1}}return{instructions:e,activity:t,running:r,updatedAt:i,loaded:a,dispatching:o,maxInstructionChars:n,defaultPrompt:s,projectPrompts:c,reports:l,loadingReports:u,generatingReport:d,reportIntervalMs:f,loadOrchestrator:p,dispatch:x,saveDefaultPrompt:y,saveProjectPrompt:b,loadReports:m,generateReport:h,setReportInterval:g}}a();function K(){let e=A(),t=N(),n=C({get:()=>e.resolvedTaskExecutor,set:t=>{D(t)&&e.setLastTaskExecutor(t)}}),r=C(()=>({claude:t.claudeAvailable,opencode:t.opencodeAvailable,codex:t.codexAvailable,codebuddy:t.codebuddyAvailable,pi:t.piAvailable,codearts:t.codeartsAvailable})),i=C(()=>E.some(e=>r.value[e.id])),a=C(()=>r.value[n.value]?n.value:Object.keys(r.value).find(e=>r.value[e])??n.value);function o(e){r.value[e]&&(n.value=e)}let s=C(()=>e.ui.dispatchExecutorPriority??[]),c=C(()=>s.value.length>0),l=C(()=>c.value?k(s.value,r.value,a.value):a.value);function u(e){return t.executorModelText(e)}function d(e){return[u(e),t.executorModelDetail(e)].filter(Boolean).join(` · `)}return{selected:n,active:a,priority:s,hasPriority:c,dispatchTarget:l,availability:r,hasAnyExecutor:i,choose:o,executorModelText:u,executorModelTitle:d}}a(),b(),t();var pe={key:0,class:`tep tep--static`},me=[`title`,`aria-label`],he={class:`tep__btn-name`},ge={class:`tep__btn-tag`},_e=[`title`,`aria-label`],ve={class:`tep__btn-name`},ye={class:`tep__item`},be={class:`tep__item-name`},xe=[`title`],Se={key:2,class:`tep__item-missing`},Ce=T(c({__name:`TaskExecutorPicker`,props:{title:{},readonly:{type:Boolean},value:{}},setup(t){let a=t,{active:c,availability:_,choose:v,executorModelText:b,executorModelTitle:T}=K(),D=C(()=>a.readonly&&a.value?a.value:c.value),k=N();i(()=>{k.fetchExecutorModels()});function A(){return[a.title,T(D.value)].filter(Boolean).join(` · `)}return(i,a)=>{let c=o,C=n,k=ee,M=l;return t.readonly?(x(),f(`span`,pe,[u(`span`,{class:`tep__btn`,title:A(),"aria-label":d(w)(`@WORKBENCH:任务执行器`)},[e(j,{executor:D.value,class:`tep__btn-icon`},null,8,[`executor`]),u(`span`,he,s(d(O)(D.value)),1),u(`span`,ge,s(d(w)(`@AGENT:按优先级`)),1)],8,me)])):(x(),r(M,{key:1,trigger:`click`,class:`tep`,onCommand:d(v)},{dropdown:y(()=>[e(k,null,{default:y(()=>[(x(!0),f(h,null,m(d(E),t=>(x(),r(C,{key:t.id,command:t.id,disabled:!d(_)[t.id]},{default:y(()=>[u(`span`,ye,[e(j,{executor:t.id,class:`tep__item-icon`},null,8,[`executor`]),u(`span`,be,s(t.name),1),d(b)(t.id)?(x(),f(`span`,{key:0,class:`tep__item-model`,title:d(T)(t.id)},s(d(b)(t.id)),9,xe)):S(``,!0),D.value===t.id?(x(),r(c,{key:1,class:`tep__item-check`},{default:y(()=>[e(d(g))]),_:1})):d(_)[t.id]?S(``,!0):(x(),f(`span`,Se,s(d(w)(`@42BB9:未安装`)),1))])]),_:2},1032,[`command`,`disabled`]))),128))]),_:1})]),default:y(()=>[u(`button`,{type:`button`,class:`tep__btn`,title:A(),"aria-label":d(w)(`@WORKBENCH:任务执行器`)},[e(j,{executor:D.value,class:`tep__btn-icon`},null,8,[`executor`]),u(`span`,ve,s(d(O)(D.value)),1),e(c,{class:`tep__btn-caret`},{default:y(()=>[e(d(p))]),_:1})],8,_e)]),_:1},8,[`onCommand`]))}}}),[[`__scopeId`,`data-v-52969d85`]]),we=8192;function Te(e,t){return e.length>t?`…(前文已截断)\n${e.slice(-t)}`:e}function Ee(e,t){let n=e||`done`;return n!==`pending`&&n!==`running`||t===`running`||t===`pending`?n:t===`cancelled`||t===`error`?`error`:`done`}function q(e){let t=e?.toolCalls;if(!Array.isArray(t)||t.length===0)return[];let n=e?.status||`done`,r=[];for(let e=0;e<t.length;e++){let i=t[e];if(!i||typeof i!=`object`)continue;let a=Ee(i.status,n),o=typeof i.result==`string`?i.result:``;r.push({id:typeof i.id==`string`&&i.id?i.id:`tool-${e}`,name:typeof i.name==`string`?i.name:``,argsPreview:typeof i.argsPreview==`string`?i.argsPreview:``,arguments:typeof i.arguments==`string`?i.arguments:``,result:o?Te(o,we):``,status:a,error:typeof i.error==`string`&&i.error?i.error:void 0})}return r}var De=`
4
-
5
- ---
6
-
7
- `,Oe=`[运行环境 ·`,ke=`## 跨会话记忆库`,Ae=/\n\n---\n本任务包含 \d+ 个附件(请按文件路径读取[\s\S]*$/,J=/\n\n续接 #\d+\s*$/;function Y(e){let t=e.indexOf(De);return t===-1?0:t+7}function X(e){let t=typeof e==`string`?e:``;return t?(t.startsWith(Oe)&&(t=t.slice(Y(t))),t.startsWith(ke)&&(t=t.slice(Y(t))),t=t.replace(Ae,``).replace(J,``),t.trim()):``}function Z(e){switch(e){case`todo`:return w(`@WORKBENCH:待执行`);case`running`:return w(`@WORKBENCH:执行中`);case`done`:return w(`@WORKBENCH:已完成`);case`error`:return w(`@WORKBENCH:出错`);case`cancelled`:return w(`@WORKBENCH:已取消`);case`pending`:return w(`@WORKBENCH:排队中`);default:return e}}function je(e){switch(e){case`running`:return`var(--color-primary)`;case`done`:return`#22c55e`;case`error`:return`#ef4444`;case`cancelled`:return`#9ca3af`;case`pending`:return`#f59e0b`;default:return`var(--text-tertiary)`}}function Q(e){let t=e?new Date(e):new Date;if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Me(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function Ne(e){let t=(e.match(/`+/g)||[]).reduce((e,t)=>Math.max(e,t.length),0),n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}function $(e,t){return`### ${e}\n\n${t.trim()}`}function Pe(e){let t=[];return e.forEach((e,n)=>{let r=e.name||w(`@WORKBENCH:工具`),i=Me(e.argsPreview||``);t.push(`${n+1}. **${r}**${i?` — \`${i}\``:``}`);let a=(e.status===`error`?e.error:e.result)||e.result||e.error||``;a.trim()&&t.push(``,Ne(a.trim()))}),t.join(`
8
- `)}function Fe(e,t={},n={}){let r=Array.isArray(e)?e.filter(Boolean):[],i=n.scope===`brief`,a=[];if(r.forEach((e,t)=>{let n=[],r=X(e.prompt);if(r&&n.push($(w(`@WORKBENCH:用户提示词`),r)),!i){let t=(e.thinking||``).trim();t&&n.push($(w(`@WORKBENCH:Claude 思考`),t));let r=Pe(q(e));r&&n.push($(w(`@WORKBENCH:工具调用`),r))}let o=(e.output||``).trim();o&&n.push($(w(`@WORKBENCH:模型返回`),o));let s=(e.error||e.agentError||``).trim();if(s&&n.push($(w(`@WORKBENCH:出错`),s)),n.length===0)return;let c=[O(e.agent),Z(e.status),Q(e.startedAt)].filter(Boolean);a.push(`## ${w(`@WORKBENCH:第 {n} 轮`,{n:t+1})}\n\n*${c.join(` · `)}*\n\n${n.join(`
9
-
10
- `)}`)}),a.length===0)return``;let o=[`# ${(t.title||``).trim()||w(`@WORKBENCH:未命名任务`)}`],s=(t.projectName||``).trim();return s&&o.push(``,`- ${w(`@WORKBENCH:项目:{name}`,{name:s})}`),o.push(`- ${w(`@WORKBENCH:导出时间:{time}`,{time:Q((t.now||new Date).toISOString())})}`),`${o.join(`
11
- `)}\n\n---\n\n${a.join(`
12
-
13
- ---
14
-
15
- `)}\n`}export{z as _,X as a,K as c,U as d,H as f,V as g,ue as h,Z as i,fe as l,G as m,Q as n,q as o,le as p,je as r,Ce as s,Fe as t,W as u,R as v};