@tom2012/cc-web 2026.4.19-l → 2026.4.19-m

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 (36) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/index.d.ts.map +1 -1
  3. package/backend/dist/index.js +0 -2
  4. package/backend/dist/index.js.map +1 -1
  5. package/backend/dist/routes/hooks.d.ts.map +1 -1
  6. package/backend/dist/routes/hooks.js +0 -16
  7. package/backend/dist/routes/hooks.js.map +1 -1
  8. package/backend/dist/routes/information.d.ts.map +1 -1
  9. package/backend/dist/routes/information.js +0 -110
  10. package/backend/dist/routes/information.js.map +1 -1
  11. package/bin/ccweb-approval-hook.js +10 -2
  12. package/frontend/dist/assets/{AssistantMessageContent-B5xM5JJL.js → AssistantMessageContent-kuKO1ENb.js} +1 -1
  13. package/frontend/dist/assets/{GraphPreview-CP0HWB3D.js → GraphPreview-DkvgbpF6.js} +2 -2
  14. package/frontend/dist/assets/MobilePage-BOU3_tKW.js +14 -0
  15. package/frontend/dist/assets/{OfficePreview-aUpVn8X7.js → OfficePreview-CWGhg1Wp.js} +2 -2
  16. package/frontend/dist/assets/{PlanPanel-BUomc-uk.js → PlanPanel-BoQp2-7y.js} +2 -2
  17. package/frontend/dist/assets/{ProjectPage-DniZq70m.js → ProjectPage-UmIvZJ4k.js} +5 -5
  18. package/frontend/dist/assets/{SettingsPage-B1GOJwdi.js → SettingsPage-CB1c2i7n.js} +2 -2
  19. package/frontend/dist/assets/{ShareViewPage-0y_0_91E.js → ShareViewPage-cyEj4lar.js} +1 -1
  20. package/frontend/dist/assets/{SkillHubPage-Bz1iodHC.js → SkillHubPage-DYyLeKSy.js} +2 -2
  21. package/frontend/dist/assets/{bot-BPpxGUic.js → bot-CxI44eYt.js} +1 -1
  22. package/frontend/dist/assets/{chevron-down-CAohmFqo.js → chevron-down-UuHQeV8G.js} +1 -1
  23. package/frontend/dist/assets/{chevron-up-B6GEEk3k.js → chevron-up-XBj31x3m.js} +1 -1
  24. package/frontend/dist/assets/{index-Zh30nEgA.js → index-D3lPcUqb.js} +7 -7
  25. package/frontend/dist/assets/index-D7i6tikx.css +1 -0
  26. package/frontend/dist/assets/{index-BfxRnyJK.js → index-DFqWVtZP.js} +1 -1
  27. package/frontend/dist/assets/{index-DqQCNofi.js → index-Dflteh4x.js} +1 -1
  28. package/frontend/dist/assets/{jszip.min-DbeY1Bw4.js → jszip.min-DaPeZ2P4.js} +1 -1
  29. package/frontend/dist/assets/{maximize-2-CKeeGyUI.js → maximize-2-BDQ3tLwc.js} +1 -1
  30. package/frontend/dist/assets/{search-D6FWxasF.js → search-RdGoyPqx.js} +1 -1
  31. package/frontend/dist/assets/{user-BRwUyQma.js → user-Dk2P_Yds.js} +1 -1
  32. package/frontend/dist/index.html +2 -2
  33. package/package.json +1 -1
  34. package/frontend/dist/assets/MobilePage-CKJsA5Bl.js +0 -14
  35. package/frontend/dist/assets/index-B02WMOK_.css +0 -1
  36. package/frontend/dist/assets/matter-CJwWD_7Q.js +0 -28
@@ -0,0 +1,14 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-CWGhg1Wp.js","assets/index-D3lPcUqb.js","assets/index-D7i6tikx.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,a8 as t,aB as s,r as n,ba as r,j as a,bb as l,m as o,b as c,bc as i,N as d,L as u,au as x,av as m,t as h,at as p,bd as f,af as g,a9 as j,u as b,a as v,g as y,D as N,ad as w,e as k,R as C,_ as S,l as M,X as z,q as P,be as T,bf as E,C as I,A as D,v as $}from"./index-D3lPcUqb.js";import{A as R,S as A,M as L,r as O,a as B,b as U,h as _,o as q,c as F,I as H,F as W}from"./AssistantMessageContent-kuKO1ENb.js";import{C as K}from"./chevron-up-XBj31x3m.js";import{C as V}from"./chevron-down-UuHQeV8G.js";
3
+ /**
4
+ * @license lucide-react v0.309.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */const G=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),J=e("FileCode",[["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",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),Q=e("FileJson",[["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",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),X=e("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),Y=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Z=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
9
+ /**
10
+ * @license lucide-react v0.309.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */function ee({onSelectProject:e}){const d=t(),{projects:u,fetchProjects:x,hasFetched:m,loading:h}=s(),[p,f]=n.useState(new Map),[g,j]=n.useState(new Set),[b,v]=n.useState(!1);n.useEffect(()=>{x()},[x]);const y=n.useCallback(e=>{e.status&&f(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&j(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);r({onActivityUpdate:y});const N=u.filter(e=>!e.archived);return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[a.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),a.jsx(l,{}),a.jsx("button",{onClick:()=>{(async()=>{v(!0);try{await x()}finally{v(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:b,children:a.jsx(o,{className:c("h-4 w-4",b&&"animate-spin")})}),!Z&&a.jsx("button",{onClick:()=>d("/"),className:"text-muted-foreground active:text-foreground",title:"桌面模式",children:a.jsx(i,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[h&&!m&&a.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),m&&0===N.length&&a.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:N.map(t=>{var s;const n="running"===(s=t,p.get(s.id)??s.status??"stopped"),r=g.has(t.id),l=a.jsxs("button",{onClick:()=>e(t.id),className:c("w-full text-left rounded-lg border bg-card p-2.5 active:bg-accent transition-colors",r?"border-transparent":"border-border"),children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("span",{className:c("w-2 h-2 rounded-full shrink-0",n?"bg-green-500":"bg-zinc-400")}),a.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),a.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return a.jsx("div",{className:r?"card-active-glow rounded-lg":void 0,children:l},t.id)})})]})]})}function te({project:e,onBack:t,onOpenPanel:s,onContextUpdate:r}){const[l,o]=n.useState("running"===e.status?"live":"stopped"),[i,b]=n.useState([]),v=n.useRef(0),y=n.useCallback(()=>"m"+ ++v.current,[]),[N,w]=n.useState(""),k=n.useRef(null),C=n.useRef(null),S=n.useRef(null),M=n.useRef(!1),z=n.useRef([]),P=n.useRef(null),T=n.useRef(0),E=n.useRef([]),[I,D]=n.useState([]),[$,L]=n.useState(!1),O=n.useMemo(()=>[...I,...i],[I,i]),B=n.useMemo(()=>{for(let e=O.length-1;e>=0;e--)if("assistant"===O[e].role)return e;return-1},[O]),[U,_]=n.useState([]),[q,F]=n.useState([]),[H,W]=n.useState(null);n.useEffect(()=>{d().then(_).catch(()=>{}),u(e.id).then(F).catch(()=>{})},[e.id]);const J=n.useRef(0);J.current=i.length;const Q=n.useCallback(async()=>{try{const t=await x(e.id,1);if(0===t.length)return;const s=(await m(e.id,t[0].id,"latest","user")).content.split(/(?=^## [UA]\d+)/m).filter(Boolean),n=[];for(const e of s){const t=e.match(/^## ([UA])(\d+).*\n/);if(!t)continue;const s="U"===t[1]?"user":"assistant",r=e.slice(t[0].length).trim();r&&n.push({id:y(),role:s,content:r,ts:""})}0===J.current&&(E.current=n,D(n.slice(-20)),L(n.length>20))}catch{h.error("加载对话历史失败")}},[e.id,y]),Z=n.useCallback(()=>{const e=E.current;if(0===e.length)return;const t=I.length,s=Math.min(t+20,e.length),n=k.current,r=(null==n?void 0:n.scrollHeight)??0;D(e.slice(-s)),L(s<e.length),requestAnimationFrame(()=>{if(n){const e=n.scrollHeight;n.scrollTop+=e-r}})},[I.length]);n.useEffect(()=>{"stopped"===l&&Q()},[l,Q]),n.useEffect(()=>{if("live"!==l)return void(M.current=!1);const e=setTimeout(()=>{M.current||Q()},3e3);return()=>clearTimeout(e)},[l,Q]),n.useEffect(()=>{"running"!==e.status||"stopped"!==l&&"error"!==l?"stopped"===e.status&&"live"===l&&o("stopped"):(b([]),o("live"))},[e.status]);const ee=n.useRef(null),te=n.useCallback(()=>{ee.current&&(clearTimeout(ee.current.timer),ee.current=null)},[]);n.useEffect(()=>()=>te(),[te]);const se=n.useCallback(e=>{M.current=!0;const t=p(e.blocks);if(t.trim()){if("user"===e.role){const e=z.current.indexOf(t.trim());if(-1!==e)return z.current.splice(e,1),void te()}b(s=>[...s,{id:y(),role:e.role,content:t,ts:e.timestamp}].slice(-50))}},[te]),ne=n.useCallback(e=>{"stopped"===e&&o("stopped")},[]),{sendInput:re}=f({projectId:e.id,enabled:"live"===l||"waking"===l,onChatMessage:se,onStatusChange:ne,onContextUpdate:r}),ae=n.useCallback(e=>{re(e+"\r"),te();const t=s=>{const n=setTimeout(()=>{if(z.current.includes(e)){if(s>=20){const t=z.current.indexOf(e);return-1!==t&&z.current.splice(t,1),void(ee.current=null)}re("\r"),t(s+1)}else ee.current=null},3e3);ee.current={timer:n,attempts:s}};t(0)},[re,te]);n.useEffect(()=>{if("live"===l&&S.current){const e=S.current;S.current=null,ae(e)}},[l,ae]);const le=n.useRef(0);n.useEffect(()=>{var e;null==(e=k.current)||e.scrollTo({top:k.current.scrollHeight,behavior:"smooth"})},[i]),n.useEffect(()=>{var e;0===le.current&&I.length>0&&(null==(e=k.current)||e.scrollTo({top:k.current.scrollHeight})),le.current=I.length},[I]),n.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);const oe=n.useCallback(t=>{if(z.current.push(t),z.current.length>10&&z.current.shift(),b(e=>[...e,{id:y(),role:"user",content:t,ts:(new Date).toISOString()}].slice(-50)),"live"===l||"waking"===l)ae(t);else if("stopped"===l||"error"===l){S.current=t;const s=++T.current;o("waking"),g(e.id).then(()=>{s===T.current&&(P.current&&clearTimeout(P.current),o("live"))}).catch(e=>{s===T.current&&(h.error(`启动失败: ${e instanceof Error?e.message:String(e)}`),o("error"),S.current=null)}),P.current=setTimeout(()=>{s===T.current&&S.current&&(h.error("启动超时(10s)"),o("error"),S.current=null)},1e4)}},[l,e.id,ae]),ce=n.useCallback(()=>{const e=N.trim();e&&(w(""),C.current&&(C.current.style.height="auto"),oe(e))},[N,oe]),ie=n.useCallback(e=>{W(null),oe(e)},[oe]),de="live"===l,ue="waking"===l;return a.jsxs("div",{className:"flex flex-col h-full bg-background",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[a.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:a.jsx(j,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[a.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),a.jsx("span",{className:c("w-2 h-2 rounded-full shrink-0",de?"bg-green-500":ue?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),a.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:a.jsx(Y,{className:"h-5 w-5"})})]}),a.jsxs("div",{ref:k,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[$&&a.jsx("div",{className:"flex justify-center pb-1",children:a.jsxs("button",{onClick:Z,className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[a.jsx(K,{className:"h-3 w-3"}),"加载更早消息"]})}),O.map((e,t)=>{const s="user"===e.role;return a.jsx("div",{className:c("flex",s?"justify-end":"justify-start"),children:a.jsx("div",{className:c("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:a.jsx(R,{content:e.content,isLatest:t===B})})},e.id)}),0===O.length&&"stopped"===l&&a.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),ue&&a.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),H&&a.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:a.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===H?U:q).map(e=>a.jsxs("button",{onClick:()=>ie(e.command),disabled:ue,className:c("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",ue&&"opacity-50 cursor-not-allowed"),children:[a.jsx("div",{className:"font-medium text-xs",children:e.label}),a.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===H?U:q).length&&a.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷命令"})]})}),(U.length>0||q.length>0)&&a.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[a.jsxs("button",{onClick:()=>W(e=>"global"===e?null:"global"),className:c("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===H?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[a.jsx(X,{className:"h-3 w-3"}),"全局","global"===H&&a.jsx(V,{className:"h-3 w-3"})]}),a.jsxs("button",{onClick:()=>W(e=>"project"===e?null:"project"),className:c("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===H?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[a.jsx(G,{className:"h-3 w-3"}),"项目","project"===H&&a.jsx(V,{className:"h-3 w-3"})]})]}),a.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("textarea",{ref:C,value:N,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ce())},disabled:ue,placeholder:ue?"启动中...":"stopped"===l?"输入消息(自动启动)...":"输入消息...",rows:1,className:c("flex-1 resize-none rounded-lg border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",ue&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),a.jsx("button",{onClick:ce,disabled:ue||!N.trim(),className:c("shrink-0 p-2 rounded-lg transition-colors",N.trim()?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:a.jsx(A,{className:"h-5 w-5"})})]})})]})}const se=C.lazy(()=>S(()=>import("./OfficePreview-CWGhg1Wp.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),ne=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),re=new Set(["docx","xlsx","xls","pptx"]),ae={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function le(e){return e.split("/").pop()??e}function oe({filePath:e,onBack:t}){const[s,r]=n.useState(null),[l,o]=n.useState(!0),[c,i]=n.useState(null),{resolved:d}=b(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const n=t.lastIndexOf(".");return n>=0?t.slice(n+1).toLowerCase():""}(e),x=ne.has(u),m=re.has(u),h=ae[u],p="dark"===d;n.useEffect(()=>{x||m?o(!1):(o(!0),i(null),v(e).then(r).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>o(!1)))},[e,x,m]);const f=k(e),g=n.useMemo(()=>{const e=y();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),C=n.useMemo(()=>x?`${g}&t=${Date.now()}`:"",[g,x]);return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[a.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:a.jsx(j,{className:"h-5 w-5"})}),a.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:le(e)}),a.jsx("a",{href:g,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:a.jsx(N,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[l&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&a.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),x&&a.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:a.jsx("img",{src:C,alt:le(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&a.jsx(n.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:a.jsx(se,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&a.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[a.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${S=s.size,S<1024?`${S} B`:S<1048576?`${(S/1024).toFixed(1)} KB`:`${(S/1048576).toFixed(1)} MB`})`]}),a.jsxs("a",{href:g,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[a.jsx(N,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&a.jsxs(a.Fragment,{children:["md"===u&&a.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:a.jsx(L,{remarkPlugins:[B,U],rehypePlugins:[O],children:s.content})}),"md"!==u&&h&&a.jsx(_,{language:h,style:p?q:F,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&a.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var S}const ce=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ie=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),de=new Set(["json","yaml","yml","toml","csv","tsv"]);function ue({entry:e}){if("dir"===e.type)return a.jsx(P,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ce.has(t)?a.jsx(H,{className:"h-8 w-8 text-emerald-400"}):ie.has(t)?a.jsx(J,{className:"h-8 w-8 text-orange-400"}):de.has(t)?a.jsx(Q,{className:"h-8 w-8 text-yellow-400"}):"md"===t?a.jsx(W,{className:"h-8 w-8 text-sky-400"}):a.jsx(T,{className:"h-8 w-8 text-muted-foreground"})}function xe({rootPath:e,onClose:t}){const[s,r]=n.useState(e),[l,o]=n.useState([]),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await M(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));o(t),r(e)}catch{o([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?a.jsx(oe,{filePath:d,onBack:()=>u(null)}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[a.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:a.jsx(z,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&a.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:a.jsx(j,{className:"h-4 w-4"})}),a.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===l.length&&a.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&a.jsx("div",{className:"grid grid-cols-3 gap-1",children:l.map(e=>a.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-lg active:bg-accent transition-colors",children:[a.jsx(ue,{entry:e}),a.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function me(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function he(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function pe({projectName:e,cliTool:t,folderPath:s,contextData:r,onClose:l}){const[i,d]=n.useState(new Set(["context","usage","files"])),[u,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{d(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),E(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=r?Math.round(r.usedPercentage):null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[a.jsx("button",{onClick:l,className:"text-muted-foreground active:text-foreground p-1",children:a.jsx(z,{className:"h-5 w-5"})}),a.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[i.has("context")?a.jsx(V,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&a.jsxs("span",{className:c("text-xs font-mono ml-auto",me(f)),children:[f,"%"]})]}),i.has("context")&&a.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&r?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:a.jsx("div",{className:c("h-full rounded-full transition-all",he(f)),style:{width:`${Math.min(f,100)}%`}})}),a.jsxs("span",{className:c("text-xs font-mono w-10 text-right",me(f)),children:[f,"%"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:"窗口大小"}),a.jsx("span",{className:"text-right font-mono",children:r.contextWindowSize>=1e6?`${(r.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(r.contextWindowSize/1e3)}K`}),a.jsx("span",{children:"输入 tokens"}),a.jsx("span",{className:"text-right font-mono",children:r.inputTokens.toLocaleString()}),a.jsx("span",{children:"输出 tokens"}),a.jsx("span",{className:"text-right font-mono",children:r.outputTokens.toLocaleString()})]})]}):a.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),a.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[i.has("usage")?a.jsx(V,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"用量"}),a.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await S(async()=>{const{refreshUsage:e}=await import("./index-D3lPcUqb.js").then(e=>e.br);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:a.jsx(o,{className:c("h-3 w-3",m&&"animate-spin")})})]}),i.has("usage")&&a.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:u?a.jsxs("div",{className:"space-y-2",children:[u.planName&&a.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",a.jsx("span",{className:"font-medium text-foreground",children:u.planName})]}),a.jsx(fe,{label:"5h",bucket:u.fiveHour}),a.jsx(fe,{label:"7d",bucket:u.sevenDay}),u.sevenDaySonnet&&a.jsx(fe,{label:"7d Sonnet",bucket:u.sevenDaySonnet}),u.sevenDayOpus&&a.jsx(fe,{label:"7d Opus",bucket:u.sevenDayOpus}),!u.fiveHour&&!u.sevenDay&&a.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):a.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),a.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[i.has("files")?a.jsx(V,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(I,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),i.has("files")&&a.jsx("div",{className:"h-[60vh]",children:a.jsx(xe,{rootPath:s,onClose:()=>p("files")})})]})]})}function fe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,n=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),n=Math.floor(t%36e5/6e4);return s>0?`${s}h${n}m`:`${n}m`}(t.resetAt);return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),a.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:a.jsx("div",{className:c("h-full rounded-full",he(s)),style:{width:`${Math.min(s,100)}%`}})}),a.jsxs("span",{className:c("text-xs font-mono w-8 text-right",me(s)),children:[s,"%"]}),n&&a.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:n})]})}function ge(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[r,l]=n.useState(null),o=s(e=>e.projects),c=n.useCallback(e=>{t({screen:"chat",projectId:e}),l(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?o.find(t=>t.id===e.projectId):void 0;return a.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[a.jsxs(D,{mode:"wait",children:["list"===e.screen&&a.jsx($.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:a.jsx(ee,{onSelectProject:c})},"list"),"chat"===e.screen&&u&&a.jsx($.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:a.jsx(te,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:l})},`chat-${e.projectId}`)]}),a.jsx(D,{children:"panel"===e.screen&&u&&a.jsx($.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:a.jsx(pe,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:r,onClose:d})},"panel")})]})}export{ge as MobilePage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BfxRnyJK.js","assets/index-Zh30nEgA.js","assets/index-B02WMOK_.css","assets/jszip.min-DbeY1Bw4.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as t,_ as s,g as r,e as a}from"./index-Zh30nEgA.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-BfxRnyJK.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,m]=t.useState(null),[p,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),m(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||m(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),p?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-DbeY1Bw4.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DFqWVtZP.js","assets/index-D3lPcUqb.js","assets/index-D7i6tikx.css","assets/jszip.min-DaPeZ2P4.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as s,g as r,e as a}from"./index-D3lPcUqb.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-DFqWVtZP.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-DaPeZ2P4.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
@@ -1,4 +1,4 @@
1
- import{c as e,r as s,j as t,bt as a,bu as n,bv as r,t as l,bw as i,bx as c,by as o,bz as d,bA as u,B as h,ap as x}from"./index-Zh30nEgA.js";import{Z as m,a as f,P as y}from"./ProjectPage-DniZq70m.js";import{M as g}from"./maximize-2-CKeeGyUI.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-B5xM5JJL.js";import"./chevron-down-CAohmFqo.js";import"./chevron-up-B6GEEk3k.js";import"./index-DqQCNofi.js";import"./bot-BPpxGUic.js";import"./user-BRwUyQma.js";import"./search-D6FWxasF.js";
1
+ import{c as e,r as s,j as t,bi as a,bj as n,bk as r,t as l,bl as i,bm as c,bn as o,bo as d,bp as u,B as h,ad as x}from"./index-D3lPcUqb.js";import{Z as m,a as f,P as y}from"./ProjectPage-UmIvZJ4k.js";import{M as g}from"./maximize-2-BDQ3tLwc.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-kuKO1ENb.js";import"./chevron-down-UuHQeV8G.js";import"./chevron-up-XBj31x3m.js";import"./index-Dflteh4x.js";import"./bot-CxI44eYt.js";import"./user-Dk2P_Yds.js";import"./search-RdGoyPqx.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -10,4 +10,4 @@ import{c as e,r as s,j as t,bt as a,bu as n,bv as r,t as l,bw as i,bx as c,by as
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */function z({tree:e,currentLine:a}){const n=s.useRef(null),[r,l]=s.useState(1),[i,c]=s.useState({x:0,y:0}),o=s.useRef(!1),d=s.useRef({x:0,y:0}),[,u]=s.useState(0),[h,x]=s.useState(null),{layoutNodes:y,edges:p,bounds:j}=s.useMemo(()=>{const s=[],t=[];const a=function e(a,n,r,l){const i=[];let c=r;for(const o of a){const a=40+160*l,n={id:o.id,x:a,y:c,w:w,h:N,type:o.type,label:o.label,status:o.status,node_id:o.node_id,line:o.line,children:[]};if(o.children.length>0){const s=e(o.children,a,c+N+16,l+1);n.children=s.nodes,c=Math.max(c+N+16,c+N+16+s.height);for(const e of s.nodes)t.push({x1:n.x+70,y1:n.y+N,x2:e.x+70,y2:e.y,dashed:"call"===o.type})}else c+=52;i.push(n),s.push(n)}return{nodes:i,height:c-r}}(e,0,20,0);for(let e=1;e<a.nodes.length;e++){const s=a.nodes[e-1],n=a.nodes[e];if(s.x===n.x){const e=_(s);t.push({x1:s.x+70,y1:e,x2:n.x+70,y2:n.y})}}let n=1/0,r=1/0,l=-1/0,i=-1/0;for(const e of s)n=Math.min(n,e.x),r=Math.min(r,e.y),l=Math.max(l,e.x+e.w),i=Math.max(i,e.y+e.h);return{layoutNodes:s,edges:t,bounds:{minX:n,minY:r,maxX:l+40,maxY:i+20}}},[e]),b=s.useCallback(()=>{if(!n.current||0===y.length)return;const e=n.current.getBoundingClientRect(),s=j.maxX-j.minX,t=j.maxY-j.minY;if(0===s||0===t)return;const a=.9*Math.min(e.width/s,e.height/t,2);l(a),c({x:(e.width-s*a)/2-j.minX*a,y:(e.height-t*a)/2-j.minY*a})},[y,j]);s.useEffect(()=>{b()},[e,b]),s.useEffect(()=>{if(null===a)return;const e=y.find(e=>e.line===a);if(!e||!n.current)return;const s=n.current.getBoundingClientRect(),t=e.x+70,l=e.y+18;c({x:s.width/2-t*r,y:s.height/2-l*r})},[a,y,r]);const k=s.useCallback(e=>{e.preventDefault(),l(s=>Math.max(.2,Math.min(3,s+(e.deltaY>0?-.1:.1))))},[]),v=s.useCallback(e=>{0===e.button&&(o.current=!0,u(e=>e+1),c(s=>(d.current={x:e.clientX-s.x,y:e.clientY-s.y},s)))},[]),z=s.useCallback(e=>{o.current&&c({x:e.clientX-d.current.x,y:e.clientY-d.current.y})},[]),S=s.useCallback(()=>{o.current=!1,u(e=>e+1)},[]);return t.jsxs("div",{className:"relative w-full h-full",children:[t.jsxs("div",{className:"absolute top-1 right-1 z-10 flex gap-0.5",children:[t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.min(3,e+.2)),children:t.jsx(m,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.max(.2,e-.2)),children:t.jsx(f,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:b,children:t.jsx(g,{className:"h-3 w-3"})})]}),t.jsxs("svg",{ref:n,className:"w-full h-full",onWheel:k,onMouseDown:v,onMouseMove:z,onMouseUp:S,onMouseLeave:S,style:{cursor:o.current?"grabbing":"grab"},children:[t.jsx("defs",{children:t.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:t.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-muted-foreground"})})}),t.jsxs("g",{transform:`translate(${i.x},${i.y}) scale(${r})`,children:[p.map((e,s)=>t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,className:"stroke-muted-foreground",strokeWidth:1,strokeDasharray:e.dashed?"4,2":void 0,markerEnd:"url(#arrow)"},`e${s}`)),y.map(e=>{const s=C[e.status??""]??M,n=a===e.line;return t.jsxs("g",{onClick:()=>x(e),style:{cursor:"pointer"},children:[t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:s.fill,stroke:n?"#60a5fa":s.stroke,strokeWidth:n?2:1,strokeDasharray:"skipped"===e.status?"4,2":void 0}),"running"===e.status&&t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:"none",stroke:"#3b82f6",strokeWidth:2,opacity:.5,children:t.jsx("animate",{attributeName:"opacity",values:"0.5;0;0.5",dur:"2s",repeatCount:"indefinite"})}),t.jsx("text",{x:e.x+6,y:e.y+13,fontSize:9,className:"fill-muted-foreground",fontFamily:"monospace",children:e.type}),t.jsx("text",{x:e.x+6,y:e.y+26,fontSize:10,className:"fill-foreground",clipPath:"inset(0 0 0 0)",children:e.label.length>16?e.label.slice(0,16)+"…":e.label}),e.node_id&&t.jsxs("text",{x:e.x+e.w-4,y:e.y+10,fontSize:7,className:"fill-muted-foreground",textAnchor:"end",children:["#",e.node_id]})]},e.id)})]})]}),h&&t.jsxs("div",{className:"absolute bottom-2 left-2 right-2 bg-background/95 border border-border rounded-lg p-3 text-xs shadow-lg z-20",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-start mb-1",children:[t.jsxs("span",{className:"font-mono text-muted-foreground",children:[h.type," L",h.line]}),t.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>x(null),children:"✕"})]}),t.jsx("div",{className:"text-foreground mb-1",children:h.label}),h.status&&t.jsxs("div",{className:"text-muted-foreground",children:["状态: ",h.status]}),h.node_id&&t.jsxs("div",{className:"text-muted-foreground",children:["节点 ID: #",h.node_id]})]})]})}function _(e){return 0===e.children.length?e.y+e.h:Math.max(e.y+e.h,...e.children.map(_))}function S({projectId:e,planStatus:m,planNodeUpdate:f,planReplan:g}){const[w,N]=s.useState(null),[C,M]=s.useState(null),[_,S]=s.useState(null),[Y,L]=s.useState(!1);s.useEffect(()=>{let s=!1;return(async()=>{try{const t=await a(e);if(s||N(t),t.hasMainPc){const t=await n(e);s||S(t.tree)}}catch{}})(),()=>{s=!0}},[e]),s.useEffect(()=>{f&&S(e=>e?P(e,f.node_id,f.status):e)},[f]),s.useEffect(()=>{m&&N(e=>e?{...e,state:e.state?{...e.state,...m}:{status:m.status,current_line:m.current_line,executed_tasks:m.executed_tasks,estimated_tasks:m.estimated_tasks}}:e)},[m]),s.useEffect(()=>{0!==g&&n(e).then(e=>S(e.tree)).catch(()=>{})},[g,e]);const X=s.useCallback(async()=>{L(!0);try{await r(e);const s=await a(e);N(s),l.success("Plan Control 已初始化")}catch(s){l.error(s.message)}finally{L(!1)}},[e]),E=s.useCallback(async()=>{L(!0);try{const s=await i(e);if(M(s),s.valid){l.success("语法检查通过");const s=await n(e);S(s.tree)}else l.error(`${s.errors.length} 个语法错误`)}catch(s){l.error(s.message)}finally{L(!1)}},[e]),R=s.useCallback(async()=>{try{await c(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),A=s.useCallback(async()=>{try{await o(e)}catch(s){l.error(s.message)}},[e]),D=s.useCallback(async()=>{try{await d(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),W=s.useCallback(async()=>{try{await u(e)}catch(s){l.error(s.message)}},[e]),$=null==w?void 0:w.state,q=(null==$?void 0:$.status)??((null==w?void 0:w.hasMainPc)?"ready":(null==w?void 0:w.initialized)?"editing":"none");return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex-none h-8 flex items-center gap-1 px-2 border-b border-border text-xs",children:["none"===q&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:X,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):null,"初始化"]}),("editing"===q||"ready"===q)&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:E,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):t.jsx(j,{className:"h-3 w-3 mr-1"}),"检查"]}),(null==C?void 0:C.valid)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:R,children:[t.jsx(y,{className:"h-3 w-3 mr-1"}),"启动"]})]}),("running"===q||"waiting"===q)&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-muted-foreground",children:["已完成 ",(null==$?void 0:$.executed_tasks)??0,"(≥",(null==$?void 0:$.estimated_tasks)??0,")"]}),t.jsx("div",{className:"flex-1"}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:A,children:t.jsx(b,{className:"h-3 w-3"})}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:W,children:t.jsx(v,{className:"h-3 w-3"})})]}),("paused"===q||"stopped"===q)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:D,children:[t.jsx(k,{className:"h-3 w-3 mr-1"}),"继续"]}),"completed"===q&&t.jsxs("span",{className:"text-green-500 flex items-center gap-1",children:[t.jsx(j,{className:"h-3 w-3"})," 已完成"]})]}),C&&!C.valid&&t.jsx("div",{className:"flex-none max-h-24 overflow-y-auto px-2 py-1 border-b border-border bg-red-500/5",children:C.errors.map((e,s)=>t.jsxs("div",{className:"text-[10px] text-red-400 flex gap-1",children:[t.jsx(p,{className:"h-3 w-3 flex-shrink-0 mt-0.5"}),t.jsxs("span",{children:["第",e.line,"行: ",e.message]})]},s))}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:_?t.jsx(z,{tree:_,currentLine:(null==$?void 0:$.current_line)??null}):t.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:(null==w?void 0:w.initialized)?(null==w?void 0:w.hasMainPc)?'点击"检查"查看任务树':"等待 AI 编写计划...":'点击"初始化"开始'})})]})}function P(e,s,t){return e.map(e=>e.node_id===s?{...e,status:t}:e.children.length>0?{...e,children:P(e.children,s,t)}:e)}export{S as PlanPanel};
13
+ */function _({tree:e,currentLine:a}){const n=s.useRef(null),[r,l]=s.useState(1),[i,c]=s.useState({x:0,y:0}),o=s.useRef(!1),d=s.useRef({x:0,y:0}),[,u]=s.useState(0),[h,x]=s.useState(null),{layoutNodes:y,edges:p,bounds:j}=s.useMemo(()=>{const s=[],t=[];const a=function e(a,n,r,l){const i=[];let c=r;for(const o of a){const a=40+160*l,n={id:o.id,x:a,y:c,w:w,h:N,type:o.type,label:o.label,status:o.status,node_id:o.node_id,line:o.line,children:[]};if(o.children.length>0){const s=e(o.children,a,c+N+16,l+1);n.children=s.nodes,c=Math.max(c+N+16,c+N+16+s.height);for(const e of s.nodes)t.push({x1:n.x+70,y1:n.y+N,x2:e.x+70,y2:e.y,dashed:"call"===o.type})}else c+=52;i.push(n),s.push(n)}return{nodes:i,height:c-r}}(e,0,20,0);for(let e=1;e<a.nodes.length;e++){const s=a.nodes[e-1],n=a.nodes[e];if(s.x===n.x){const e=z(s);t.push({x1:s.x+70,y1:e,x2:n.x+70,y2:n.y})}}let n=1/0,r=1/0,l=-1/0,i=-1/0;for(const e of s)n=Math.min(n,e.x),r=Math.min(r,e.y),l=Math.max(l,e.x+e.w),i=Math.max(i,e.y+e.h);return{layoutNodes:s,edges:t,bounds:{minX:n,minY:r,maxX:l+40,maxY:i+20}}},[e]),b=s.useCallback(()=>{if(!n.current||0===y.length)return;const e=n.current.getBoundingClientRect(),s=j.maxX-j.minX,t=j.maxY-j.minY;if(0===s||0===t)return;const a=.9*Math.min(e.width/s,e.height/t,2);l(a),c({x:(e.width-s*a)/2-j.minX*a,y:(e.height-t*a)/2-j.minY*a})},[y,j]);s.useEffect(()=>{b()},[e,b]),s.useEffect(()=>{if(null===a)return;const e=y.find(e=>e.line===a);if(!e||!n.current)return;const s=n.current.getBoundingClientRect(),t=e.x+70,l=e.y+18;c({x:s.width/2-t*r,y:s.height/2-l*r})},[a,y,r]);const k=s.useCallback(e=>{e.preventDefault(),l(s=>Math.max(.2,Math.min(3,s+(e.deltaY>0?-.1:.1))))},[]),v=s.useCallback(e=>{0===e.button&&(o.current=!0,u(e=>e+1),c(s=>(d.current={x:e.clientX-s.x,y:e.clientY-s.y},s)))},[]),_=s.useCallback(e=>{o.current&&c({x:e.clientX-d.current.x,y:e.clientY-d.current.y})},[]),S=s.useCallback(()=>{o.current=!1,u(e=>e+1)},[]);return t.jsxs("div",{className:"relative w-full h-full",children:[t.jsxs("div",{className:"absolute top-1 right-1 z-10 flex gap-0.5",children:[t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.min(3,e+.2)),children:t.jsx(m,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:()=>l(e=>Math.max(.2,e-.2)),children:t.jsx(f,{className:"h-3 w-3"})}),t.jsx("button",{className:"p-1 rounded bg-muted/50 hover:bg-muted",onClick:b,children:t.jsx(g,{className:"h-3 w-3"})})]}),t.jsxs("svg",{ref:n,className:"w-full h-full",onWheel:k,onMouseDown:v,onMouseMove:_,onMouseUp:S,onMouseLeave:S,style:{cursor:o.current?"grabbing":"grab"},children:[t.jsx("defs",{children:t.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:t.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"fill-muted-foreground"})})}),t.jsxs("g",{transform:`translate(${i.x},${i.y}) scale(${r})`,children:[p.map((e,s)=>t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,className:"stroke-muted-foreground",strokeWidth:1,strokeDasharray:e.dashed?"4,2":void 0,markerEnd:"url(#arrow)"},`e${s}`)),y.map(e=>{const s=C[e.status??""]??M,n=a===e.line;return t.jsxs("g",{onClick:()=>x(e),style:{cursor:"pointer"},children:[t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:s.fill,stroke:n?"#60a5fa":s.stroke,strokeWidth:n?2:1,strokeDasharray:"skipped"===e.status?"4,2":void 0}),"running"===e.status&&t.jsx("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:6,fill:"none",stroke:"#3b82f6",strokeWidth:2,opacity:.5,children:t.jsx("animate",{attributeName:"opacity",values:"0.5;0;0.5",dur:"2s",repeatCount:"indefinite"})}),t.jsx("text",{x:e.x+6,y:e.y+13,fontSize:9,className:"fill-muted-foreground",fontFamily:"monospace",children:e.type}),t.jsx("text",{x:e.x+6,y:e.y+26,fontSize:10,className:"fill-foreground",clipPath:"inset(0 0 0 0)",children:e.label.length>16?e.label.slice(0,16)+"…":e.label}),e.node_id&&t.jsxs("text",{x:e.x+e.w-4,y:e.y+10,fontSize:7,className:"fill-muted-foreground",textAnchor:"end",children:["#",e.node_id]})]},e.id)})]})]}),h&&t.jsxs("div",{className:"absolute bottom-2 left-2 right-2 bg-background/95 border border-border rounded-lg p-3 text-xs shadow-lg z-20",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex justify-between items-start mb-1",children:[t.jsxs("span",{className:"font-mono text-muted-foreground",children:[h.type," L",h.line]}),t.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>x(null),children:"✕"})]}),t.jsx("div",{className:"text-foreground mb-1",children:h.label}),h.status&&t.jsxs("div",{className:"text-muted-foreground",children:["状态: ",h.status]}),h.node_id&&t.jsxs("div",{className:"text-muted-foreground",children:["节点 ID: #",h.node_id]})]})]})}function z(e){return 0===e.children.length?e.y+e.h:Math.max(e.y+e.h,...e.children.map(z))}function S({projectId:e,planStatus:m,planNodeUpdate:f,planReplan:g}){const[w,N]=s.useState(null),[C,M]=s.useState(null),[z,S]=s.useState(null),[Y,L]=s.useState(!1);s.useEffect(()=>{let s=!1;return(async()=>{try{const t=await a(e);if(s||N(t),t.hasMainPc){const t=await n(e);s||S(t.tree)}}catch{}})(),()=>{s=!0}},[e]),s.useEffect(()=>{f&&S(e=>e?P(e,f.node_id,f.status):e)},[f]),s.useEffect(()=>{m&&N(e=>e?{...e,state:e.state?{...e.state,...m}:{status:m.status,current_line:m.current_line,executed_tasks:m.executed_tasks,estimated_tasks:m.estimated_tasks}}:e)},[m]),s.useEffect(()=>{0!==g&&n(e).then(e=>S(e.tree)).catch(()=>{})},[g,e]);const X=s.useCallback(async()=>{L(!0);try{await r(e);const s=await a(e);N(s),l.success("Plan Control 已初始化")}catch(s){l.error(s.message)}finally{L(!1)}},[e]),E=s.useCallback(async()=>{L(!0);try{const s=await i(e);if(M(s),s.valid){l.success("语法检查通过");const s=await n(e);S(s.tree)}else l.error(`${s.errors.length} 个语法错误`)}catch(s){l.error(s.message)}finally{L(!1)}},[e]),R=s.useCallback(async()=>{try{await c(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),D=s.useCallback(async()=>{try{await o(e)}catch(s){l.error(s.message)}},[e]),W=s.useCallback(async()=>{try{await d(e);const s=await a(e);N(s)}catch(s){l.error(s.message)}},[e]),$=s.useCallback(async()=>{try{await u(e)}catch(s){l.error(s.message)}},[e]),q=null==w?void 0:w.state,A=(null==q?void 0:q.status)??((null==w?void 0:w.hasMainPc)?"ready":(null==w?void 0:w.initialized)?"editing":"none");return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex-none h-8 flex items-center gap-1 px-2 border-b border-border text-xs",children:["none"===A&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:X,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):null,"初始化"]}),("editing"===A||"ready"===A)&&t.jsxs(t.Fragment,{children:[t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:E,disabled:Y,children:[Y?t.jsx(x,{className:"h-3 w-3 animate-spin mr-1"}):t.jsx(j,{className:"h-3 w-3 mr-1"}),"检查"]}),(null==C?void 0:C.valid)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:R,children:[t.jsx(y,{className:"h-3 w-3 mr-1"}),"启动"]})]}),("running"===A||"waiting"===A)&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-muted-foreground",children:["已完成 ",(null==q?void 0:q.executed_tasks)??0,"(≥",(null==q?void 0:q.estimated_tasks)??0,")"]}),t.jsx("div",{className:"flex-1"}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:D,children:t.jsx(b,{className:"h-3 w-3"})}),t.jsx(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:$,children:t.jsx(v,{className:"h-3 w-3"})})]}),("paused"===A||"stopped"===A)&&t.jsxs(h,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:W,children:[t.jsx(k,{className:"h-3 w-3 mr-1"}),"继续"]}),"completed"===A&&t.jsxs("span",{className:"text-green-500 flex items-center gap-1",children:[t.jsx(j,{className:"h-3 w-3"})," 已完成"]})]}),C&&!C.valid&&t.jsx("div",{className:"flex-none max-h-24 overflow-y-auto px-2 py-1 border-b border-border bg-red-500/5",children:C.errors.map((e,s)=>t.jsxs("div",{className:"text-[10px] text-red-400 flex gap-1",children:[t.jsx(p,{className:"h-3 w-3 flex-shrink-0 mt-0.5"}),t.jsxs("span",{children:["第",e.line,"行: ",e.message]})]},s))}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?t.jsx(_,{tree:z,currentLine:(null==q?void 0:q.current_line)??null}):t.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:(null==w?void 0:w.initialized)?(null==w?void 0:w.hasMainPc)?'点击"检查"查看任务树':"等待 AI 编写计划...":'点击"初始化"开始'})})]})}function P(e,s,t){return e.map(e=>e.node_id===s?{...e,status:t}:e.children.length>0?{...e,children:P(e.children,s,t)}:e)}export{S as PlanPanel};