@markus-global/cli 0.9.9-rc.2 → 0.10.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +15 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +28 -14
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +66 -11
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/start.js +55 -3
- package/dist/commands/start.js.map +1 -1
- package/dist/lib/provider-models.d.ts +48 -0
- package/dist/lib/provider-models.d.ts.map +1 -0
- package/dist/lib/provider-models.js +88 -0
- package/dist/lib/provider-models.js.map +1 -0
- package/dist/markus.mjs +11590 -4895
- package/dist/web-ui/assets/{CommentInput-B_rgrhLD.js → CommentInput-DVEZsFdH.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-DyQHyRET.js → ContentRenderer-D7liy5Ei.js} +3 -3
- package/dist/web-ui/assets/DeliverableShareModal-3Z6n5SPB.js +1 -0
- package/dist/web-ui/assets/Deliverables-pJ0mZrCG.js +3 -0
- package/dist/web-ui/assets/{Notifications-DqIUg4CJ.js → Notifications-B7m8KM5F.js} +1 -1
- package/dist/web-ui/assets/{Search-kas6fpbv.js → Search-Dg1QnxMv.js} +1 -1
- package/dist/web-ui/assets/Settings-KeOQ8NBT.js +8 -0
- package/dist/web-ui/assets/{Store-BjE_14dA.js → Store-znN3kITL.js} +1 -1
- package/dist/web-ui/assets/Team-B3HjBTMx.js +84 -0
- package/dist/web-ui/assets/Work-CLAetrCe.js +12 -0
- package/dist/web-ui/assets/{arc-7GJS7CRG.js → arc-DLJKkSLU.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-16h4REV_.js → architectureDiagram-3BPJPVTR-CErxJL8z.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-D6t3zWC0.js → blockDiagram-GPEHLZMM-DhnC1GHJ.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-CzyobbUO.js → c4Diagram-AAUBKEIU-CWcg6zCh.js} +1 -1
- package/dist/web-ui/assets/channel-DXLppOOi.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-CvpDz6qL.js → chunk-2J33WTMH-BOcDAFHW.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-Df6veiXG.js → chunk-4BX2VUAB-Dc8q34rQ.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-CoTtIHdH.js → chunk-55IACEB6-CjeuFc0_.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-CdgCVHFp.js → chunk-727SXJPM-DsyO9cPr.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-D7eMOge4.js → chunk-AQP2D5EJ-DOhY_Zn6.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-FzZRkS5y.js → chunk-FMBD7UC4-C4wQwaKj.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-D48nYUwc.js → chunk-ND2GUHAM-DAxE9n6p.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-PNMJkmrK.js → chunk-QZHKN3VN-BqskBLc5.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-Ugc4ArHR.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-Ugc4ArHR.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DABmt_Nn.js → cose-bilkent-S5V4N54A-q7ZrVkOv.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-w0jd14q4.js → dagre-BM42HDAG-CzpG9RNW.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-ximFHjaP.js → diagram-2AECGRRQ-Cq3sRUJD.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-gWFsRPpD.js → diagram-5GNKFQAL-BZlWfVNc.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-BMzfhoWn.js → diagram-KO2AKTUF-BR3FEkPK.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-B9e-0A0Z.js → diagram-LMA3HP47-BhgVodCu.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-CLqQNd-r.js → diagram-OG6HWLK6-aEqNtQM7.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-BFPCRZPr.js → docx-preview-BCUdrB1J.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-qUR4XmIX.js → erDiagram-TEJ5UH35-CmKuqvTk.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-CjN2ub4S.js → flowDiagram-I6XJVG4X-B9PwU7vi.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-By-5cyGj.js → ganttDiagram-6RSMTGT7-D4eRLO6n.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-Bs13DgJn.js → gitGraphDiagram-PVQCEYII-BX5vzMBG.js} +1 -1
- package/dist/web-ui/assets/index-BrU2YO3p.js +713 -0
- package/dist/web-ui/assets/index-CT8Kx3sa.css +1 -0
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-Pyb2VrTD.js → infoDiagram-5YYISTIA-isLK7RCT.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-jISGKv-9.js → ishikawaDiagram-YF4QCWOH-D_KwMIC_.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BXnkNg9b.js → journeyDiagram-JHISSGLW-BERHrAd2.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BV4ynBuw.js → kanban-definition-UN3LZRKU-iWhVeCEA.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-DeC0XDN4.js → mermaid.core-DBb2SvbA.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CEPK_ZV-.js → mindmap-definition-RKZ34NQL-B1e7ShjO.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-DreL09eo.js → pieDiagram-4H26LBE5-CINLSMM2.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-Bh3oKDxD.js → quadrantDiagram-W4KKPZXB-5OsDJzw-.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-DWn-QfAY.js → requirementDiagram-4Y6WPE33-TckyECvk.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-BnzVNTOP.js → sankeyDiagram-5OEKKPKP-BBUaDX49.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-iUEb-afs.js → sequenceDiagram-3UESZ5HK-CDvlRmkY.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-COc-ItOe.js → stateDiagram-AJRCARHV-KuO58ZEJ.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DxZVvQnr.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-C8rO-noK.js → timeline-definition-PNZ67QCA-De3GteSx.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-Cpnk-2oH.js → vennDiagram-CIIHVFJN-B-XEM6Hx.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-BG39VhSj.js → wardley-L42UT6IY-DX7ioE-0.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-wpyKdMmG.js → wardleyDiagram-YWT4CUSO-BrOYIz-Z.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-CP0mGBV4.js → xychartDiagram-2RQKCTM6-CQANrcat.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/templates/skills/chrome-devtools/SKILL.md +55 -0
- package/dist/web-ui/assets/DeliverableShareModal-BY5ez6nr.js +0 -42
- package/dist/web-ui/assets/Deliverables-PJJKw5_I.js +0 -3
- package/dist/web-ui/assets/Settings-DaeT2xjy.js +0 -8
- package/dist/web-ui/assets/Team-ADpT-bid.js +0 -81
- package/dist/web-ui/assets/Work-BjU-XvpG.js +0 -11
- package/dist/web-ui/assets/channel-CSoBs8Wc.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-B2TGJzph.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-B2TGJzph.js +0 -1
- package/dist/web-ui/assets/index-BfGY_nvu.css +0 -1
- package/dist/web-ui/assets/index-nn4q01mt.js +0 -672
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DaMprGFB.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{u as Ke,j as e,r as a,a as vs,b as js,m as ks,d as ws,c as Ns,l as p,w as xt,o as Jt,p as Ss,P,n as ee,M as Cs,q as Ue,h as Is,i as Xt,s as Ls}from"./index-nn4q01mt.js";import{resolveFormat as Rs,ContentRenderer as Es}from"./ContentRenderer-DyQHyRET.js";import{c as Ts,a as Ps,O as Bs,D as Ms}from"./DeliverableShareModal-BY5ez6nr.js";function $(d){return Array.isArray(d)?d.map(o=>String(o).trim()).filter(Boolean):typeof d=="string"&&d?d.split(",").map(o=>o.trim()).filter(Boolean):[]}function As(d){return d.files&&typeof d.files=="object"&&!Array.isArray(d.files)?d.files:null}function te({label:d,value:o}){return o?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:o})]}):null}function de({label:d,value:o,color:c}){if(!o)return null;const r={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${r[c]??r.gray} capitalize inline-block`,children:o})]})}function ft({files:d}){const{t:o}=Ke(["builder","common"]),[c,r]=a.useState(Object.keys(d)[0]??""),u=Object.keys(d);return u.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o("builder:artifact.files",{count:u.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:u.map(v=>e.jsx("button",{onClick:()=>r(v),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${c===v?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:v},v))}),c&&d[c]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:d[c]})]})]})}function $s({artifact:d,mode:o}){const{t:c}=Ke(["builder","common"]),r=As(d),u=d.agent,v=d.team,S=d.dependencies,N=d.displayName??d.name;if(o==="agent"){const j=u?.roleName,E=u?.agentRole,k=u?.llmProvider,L=u?.llmModel,g=$(S?.env),R=$(S?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(te,{label:c("builder:artifact.name"),value:N}),e.jsx(te,{label:c("builder:artifact.description"),value:d.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[j&&e.jsx(de,{label:c("builder:artifact.baseTemplate"),value:j,color:"indigo"}),e.jsx(de,{label:c("builder:artifact.agentRole"),value:E,color:E==="manager"?"purple":"cyan"})]}),$(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:$(d.tags).map(w=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:w},w))}),(k||L)&&e.jsxs("div",{className:"flex gap-2",children:[k&&e.jsx(de,{label:c("builder:artifact.llmProvider"),value:k,color:"gray"}),L&&e.jsx(de,{label:c("builder:artifact.llmModel"),value:L,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(w=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:w},w))})]}),R.length>0&&e.jsx(te,{label:c("builder:artifact.skills"),value:R.join(", ")}),r&&e.jsx(ft,{files:r})]})}if(o==="team"){const E=v?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(te,{label:c("builder:artifact.name"),value:N}),e.jsx(te,{label:c("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(de,{label:c("builder:artifact.category"),value:d.category,color:"indigo"})}),$(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:$(d.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))}),r&&e.jsx(ft,{files:r}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:c("builder:artifact.members",{count:E.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:E.map((k,L)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${k.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:k.role==="manager"?"★":L+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:k.name}),typeof k.roleName=="string"&&k.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:k.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(k.count??1)]})]}),$(k.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:$(k.skills).map(g=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:g},g))})]},L))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(te,{label:c("builder:artifact.name"),value:N}),e.jsx(te,{label:c("builder:artifact.description"),value:d.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(de,{label:c("builder:artifact.category"),value:d.category,color:"indigo"})}),r&&e.jsx(ft,{files:r}),$(d.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:$(d.tags).map(j=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:j},j))})]})}const ue={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Ds=["file","directory"];function Oe(d){return/^https?:\/\//i.test(d)}function I(d){return d?.shareStatus??null}function Vs(d,o){const c=Date.now(),r=new Date(d).getTime(),u=c-r,v=Math.floor(u/6e4);if(v<1)return o("time.justNow");if(v<60)return o("time.minutesAgo",{count:v});const S=Math.floor(v/60);if(S<24)return o("time.hoursAgo",{count:S});const N=Math.floor(S/24);if(N===1)return o("time.yesterday");if(N<30)return o("time.daysAgo",{count:N});const j=Math.floor(N/30);return j<12?o("time.monthsAgo",{count:j}):o("time.yearsAgo",{count:Math.floor(j/12)})}const z={agent:{icon:"✦",color:"bg-brand-500/10 text-brand-500"},team:{icon:"◈",color:"bg-blue-500/10 text-blue-600"},skill:{icon:"⬡",color:"bg-amber-500/10 text-amber-600"}};function Us({authUser:d,previewMode:o,previewData:c}={}){const{t:r}=Ke(["deliverables","common"]),u=vs(),v=js(P.DELIVERABLES),S=ks({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[N,j]=a.useState(!1),E=a.useRef(N);E.current=N,a.useEffect(()=>{if(!u)return;const t=()=>{E.current&&j(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[u]);const k=100,L=5e3,[g,R]=a.useState(c?.items??[]),[w,D]=a.useState(c?.items?.length??0),[m,se]=a.useState(!1),[ze,ht]=a.useState(c?.projects??[]),[mt,pt]=a.useState(c?.agents??[]),[gt,es]=a.useState([]),[G,bt]=a.useState(!c),[Ie,Le]=a.useState(""),[fe,Re]=a.useState(""),[V,he]=a.useState(""),[W,me]=a.useState(""),[F,H]=a.useState(""),[re,Ee]=a.useState(""),[ts,Ge]=a.useState(!1),[B,yt]=a.useState("date"),[n,T]=a.useState(()=>c?.initialSelectedId&&c.items?c.items.find(t=>t.id===c.initialSelectedId)??c.items[0]??null:c?.items?.[0]??null),[qe,vt]=a.useState(null),[jt,kt]=a.useState(""),[q,ss]=a.useState(!0),[Ye,pe]=a.useState(()=>{const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([s])}),[Qe,rs]=a.useState(!1),[Je,wt]=a.useState(!1),ns=a.useMemo(()=>[{id:"date"},{id:"project"},{id:"team"},{id:"agent"}],[]),as=a.useCallback(t=>{yt(t)},[]),Nt=ws(ns,B,as),Y=a.useRef(null),[Te,Pe]=a.useState(null),[Be,St]=a.useState("markdown"),[ge,Ct]=a.useState(null),[be,It]=a.useState(null),[ne,Lt]=a.useState(null),[Rt,Et]=a.useState(!1),[Tt,ye]=a.useState(!1),[Me,Pt]=a.useState(!1),[Xe,Ae]=a.useState(null),[ls,Ze]=a.useState(!1),[et,is]=a.useState(""),[Bt,os]=a.useState(new Set),ve=ne&&n?.type==="file",[_,Q]=a.useState(!1),M=Ns(),ae=M?.keyboardPane??"content",[je,le]=a.useState(null),[ie,J]=a.useState(!1),[ke,tt]=a.useState(""),[U,X]=a.useState(!1),[st,Mt]=a.useState(!1),[rt,Z]=a.useState(null),nt=a.useRef(null),At=a.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),$t=a.useRef(void 0);a.useEffect(()=>{At(nt.current)},[ke,ie,At]);const A=(t,s)=>{vt({type:t,text:s}),setTimeout(()=>vt(null),3e3)},Dt=async t=>{await Ls(t)?(Pt(!0),setTimeout(()=>Pt(!1),1500)):A("error",r("detail.copyFailed"))},$e=a.useMemo(()=>new Map(mt.map(t=>[t.id,t])),[mt]),at=a.useMemo(()=>new Map(ze.map(t=>[t.id,t])),[ze]),Vt=a.useMemo(()=>new Map(gt.map(t=>[t.id,t])),[gt]),we=a.useCallback(t=>{if(!t||t==="default")return null;const s=at.get(t)?.name;return!s||s==="default"?null:s},[at]);a.useEffect(()=>{o||(p.projects.list().then(t=>ht(t.projects)).catch(()=>{}),p.agents.list().then(t=>pt(t.agents??[])).catch(()=>{}),p.teams.list().then(t=>es(t.teams??[])).catch(()=>{}),p.system.storage().then(t=>is(t.dataDir+"/shared")).catch(()=>{}),p.deliverables.checkHealth().then(t=>os(new Set(t.missingFiles))).catch(()=>{}))},[o]),a.useEffect(()=>($t.current=setTimeout(()=>Re(Ie),300),()=>clearTimeout($t.current)),[Ie]);const oe=a.useMemo(()=>({q:fe||void 0,projectId:re||void 0,type:V||void 0,artifactType:W||void 0,source:F||void 0}),[fe,V,W,re,F]),ce=B==="date"?k:L,lt=a.useCallback((t,s)=>s?{...s,hubShareId:s.hubShareId!=null?s.hubShareId:t.hubShareId??null,shareStatus:s.shareStatus!=null?s.shareStatus:t.shareStatus??null,shareUrl:s.shareUrl!=null?s.shareUrl:t.shareUrl??null,shareVisibility:s.shareVisibility!=null?s.shareVisibility:t.shareVisibility??null,shareReason:s.shareReason!=null?s.shareReason:t.shareReason}:t,[]),De=a.useCallback(async()=>{try{const{results:t,total:s}=await p.deliverables.search({...oe,offset:0,limit:ce});R(i=>i.map(l=>{const f=t.find(x=>x.id===l.id);return f?lt(l,f):l})),D(s),T(i=>{if(!i)return null;const l=t.find(f=>f.id===i.id);return l?lt(i,l):i})}catch{}},[oe,ce,lt]),O=a.useCallback(async()=>{bt(!0),Y.current?.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:s}=await p.deliverables.search({...oe,offset:0,limit:ce});R(t),D(s),T(i=>i&&t.some(l=>l.id===i.id)?i:null)}catch{R([]),D(0),T(null)}bt(!1)},[oe,ce]),Ve=a.useCallback(async()=>{if(!(m||g.length>=w)){se(!0);try{const{results:t,total:s}=await p.deliverables.search({...oe,offset:g.length,limit:ce});R(i=>[...i,...t]),D(s)}catch{}se(!1)}},[oe,ce,g.length,w,m]);a.useEffect(()=>{o||O()},[O,o]),a.useEffect(()=>{!o||!c||(R(c.items??[]),D(c.items?.length??0),ht(c.projects??[]),pt(c.agents??[]),c.initialSelectedId&&T(c.items?.find(t=>t.id===c.initialSelectedId)??c.items?.[0]??null))},[o,c]);const it=a.useRef(n);it.current=n,a.useEffect(()=>{if(o||!v)return;const t=xt.on("deliverable:created",()=>O()),s=xt.on("deliverable:updated",l=>{De();const f=l.payload?.deliverableId;f&&it.current?.id===f&&p.deliverables.get(f).then(x=>{x.deliverable&&(T(h=>({...h??x.deliverable,...x.deliverable,hubShareId:h?.hubShareId??x.deliverable.hubShareId??null,shareStatus:h?.shareStatus??x.deliverable.shareStatus??null,shareUrl:h?.shareUrl??x.deliverable.shareUrl??null,shareVisibility:h?.shareVisibility??x.deliverable.shareVisibility??null,shareReason:h?.shareReason??x.deliverable.shareReason??null})),Ht(x.deliverable))}).catch(()=>{})}),i=xt.on("deliverable:removed",()=>O());return()=>{t(),s(),i()}},[De,v,o]);const Wt=a.useMemo(()=>Ts(Jt,Is.getUrl()),[]);a.useEffect(()=>{if(o||!v||!Jt())return;let t=!1;const s=async()=>{try{const l=await Wt.listMine();if(t)return;const f=new Map,x=new Map;for(const b of l)b.id&&f.set(b.id,b),b.localId&&x.set(b.localId,b);const h=new Map;R(b=>b.map(y=>{const C=y.hubShareId&&f.get(y.hubShareId)||x.get(y.id);if(!C)return y;const Ce={hubShareId:y.hubShareId??C.id??null,shareStatus:C.status??null,shareUrl:C.url??null,shareVisibility:y.shareVisibility??C.visibility??null,...C.reason!=null?{shareReason:C.reason}:{}};return h.set(y.id,Ce),{...y,...Ce}})),T(b=>{if(!b)return b;const y=h.get(b.id);return y?{...b,...y}:b});for(const[b,y]of h)p.deliverables.update(b,y).catch(C=>{console.warn("[deliverables] Hub 分享状态本地持久化失败:",C)})}catch{}};s();const i=setInterval(s,3e4);return()=>{t=!0,clearInterval(i)}},[Wt,v,o]);const We=a.useRef(null),ot=a.useRef(g);ot.current=g;const Ne=a.useCallback(t=>{const s=l=>{T(l),u&&(j(!0),history.pushState({mobileDetail:P.DELIVERABLES},"",window.location.hash))},i=ot.current.find(l=>l.id===t);if(i){s(i);return}p.deliverables.get(t).then(l=>{l.deliverable&&s(l.deliverable)}).catch(()=>{})},[u]);a.useEffect(()=>{if(o)return;const t=window.location.hash.slice(1).split("/"),s=Ss(t[0])===P.DELIVERABLES?t[1]:void 0,i=localStorage.getItem("markus_nav_projectId"),l=localStorage.getItem("markus_nav_source");i&&(localStorage.removeItem("markus_nav_projectId"),Ee(i)),(l==="knowledge"||l==="agent")&&(localStorage.removeItem("markus_nav_source"),H(l));const f=localStorage.getItem("markus_nav_openDeliverable")||s;f&&(localStorage.removeItem("markus_nav_openDeliverable"),ot.current.length>0?Ne(f):We.current=f);const x=h=>{const y=h.detail?.params;y?.projectId&&Ee(y.projectId),(y?.source==="knowledge"||y?.source==="agent")&&H(y.source),y?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),Ne(y.openDeliverable))};return window.addEventListener("markus:navigate",x),()=>window.removeEventListener("markus:navigate",x)},[Ne,o]),a.useEffect(()=>{const t=We.current;!t||g.length===0||(We.current=null,Ne(t))},[g,Ne]);const Ft=a.useCallback(()=>{const t=Y.current;!t||G||m||g.length>=w||t.scrollHeight<=t.clientHeight+100&&Ve()},[G,m,g.length,w,Ve]);a.useEffect(()=>{const t=Y.current;if(!t)return;const s=()=>{t.scrollTop+t.clientHeight>=t.scrollHeight-100&&Ve()};return t.addEventListener("scroll",s,{passive:!0}),()=>t.removeEventListener("scroll",s)},[Ve]),a.useEffect(()=>{Ft()},[Ft,q,Ye]);const K=a.useMemo(()=>{const t=new Map;for(const i of g){let l,f;if(B==="project"){const x=we(i.projectId);l=x?i.projectId??"_none":"_none",f=x??r("noProject")}else if(B==="team"){const h=(i.agentId?$e.get(i.agentId):void 0)?.teamId??"_none";l=h,f=h!=="_none"?Vt.get(h)?.name??h:r("noTeam")}else if(B==="agent")l=i.agentId??"_none",f=i.agentId?$e.get(i.agentId)?.name??i.agentId:r("common:unknown");else{const x=new Date(i.updatedAt);l=`${x.getFullYear()}-${String(x.getMonth()+1).padStart(2,"0")}-${String(x.getDate()).padStart(2,"0")}`,f=l}t.has(l)||t.set(l,{label:f,items:[]}),t.get(l).items.push(i)}const s=[...t.entries()];return B==="date"?s.sort((i,l)=>l[0].localeCompare(i[0])):s.sort((i,l)=>i[1].label.localeCompare(l[1].label)),s},[g,B,at,$e,Vt,r]);a.useEffect(()=>{if(B==="date"&&q){const t=new Date,s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;pe(new Set([s]))}else pe(new Set)},[B]);const cs=async t=>{kt("remove");try{await p.deliverables.remove(t.id),A("success",r("removed")),T(null),O()}catch(s){A("error",r("common:error",{message:String(s)}))}kt("")},ds=a.useCallback(t=>{const s=it.current,i=s?.id;if(!i)return;const l={hubShareId:t.id??null,shareStatus:t.status??null,shareUrl:t.url??null,shareVisibility:t.visibility??null,...t.reason!=null||t.status==="rejected"?{shareReason:t.reason??s?.shareReason??null}:{}},f={...l,shareStatus:l.shareStatus??s?.shareStatus??null};T(x=>x&&x.id===i?{...x,...f}:x),R(x=>x.map(h=>h.id===i?{...h,...f}:h)),(async()=>{try{await p.deliverables.update(i,l)}catch(x){console.warn("[deliverables] 分享状态本地回写失败,将由 Hub 轮询补偿:",x)}De()})()},[De]),us=()=>{ee.navigate(P.BUILDER)},Ht=async t=>{if(t.reference&&!Oe(t.reference)){if(t.type==="directory"){ye(!0);return}Et(!0);try{const s=await p.files.preview(t.reference);if(s.type==="image"&&s.mimeType){const i=s.streamUrl||(s.path?p.files.streamUrl(s.path):p.files.streamUrl(t.reference));Ct({src:i,name:s.name})}else if(s.type==="audio"||s.type==="video"){const i=s.streamUrl||(s.path?p.files.streamUrl(s.path):p.files.streamUrl(t.reference));It({kind:s.type,src:i,name:s.name})}else if(s.type==="office"){const i=s.streamUrl||(s.path?p.files.streamUrl(s.path):p.files.streamUrl(t.reference));Lt({format:s.format||String(s.extension||"").replace(/^\./,"")||"pdf",streamUrl:i,name:s.name,size:s.size,reference:s.path||t.reference})}else s.type==="binary"?ye(!0):typeof s.content=="string"?(Pe(s.content),St(Rs({format:t.format,reference:t.reference,content:s.content}))):ye(!0)}catch{Pe(null),t.type==="file"&&ye(!0)}Et(!1)}};a.useEffect(()=>{o||(Pe(null),St("markdown"),Ct(null),It(null),Lt(null),ye(!1),n&&Ht(n))},[n?.id,o]);const _t=a.useCallback(t=>q!==Ye.has(t),[q,Ye]),Ut=K.length>0&&K.every(([t])=>_t(t)),xs=a.useCallback(t=>{pe(s=>{const i=new Set(s);return i.has(t)?i.delete(t):i.add(t),i})},[]),Ot=a.useCallback(t=>{pe(s=>{if(s.has(t)===q)return s;const i=new Set(s);return q?i.add(t):i.delete(t),i})},[q]),fs=a.useCallback(()=>{ss(t=>!t),pe(new Set)},[]),Fe=!!(V||W||F||re||fe),Kt=a.useCallback(()=>{he(""),me(""),H(""),Ee(""),Le(""),Re("")},[]),Se=a.useMemo(()=>K.flatMap(([,t])=>t.items),[K]);a.useEffect(()=>{o||u||G||n||We.current||Se.length!==0&&T(Se[0])},[o,u,G,n,Se]);const ct=a.useRef(null);a.useEffect(()=>{if(!n){ct.current=null;return}if(ct.current===n.id)return;const t=K.find(([,s])=>s.items.some(i=>i.id===n.id));t&&(ct.current=n.id,Ot(t[0]))},[n?.id,K,Ot]);const zt=a.useRef(null),Gt=a.useRef(null),He=a.useRef(!1),qt=a.useRef(ae);a.useEffect(()=>{if(o||u||!v)return;const t=qt.current;qt.current=ae,!(ae!=="l1"||t==="l1")&&_&&(He.current=!0,Q(!1))},[ae,o,u,v,_]),a.useEffect(()=>{if(o||u||!v)return;const t=s=>{if(s.metaKey||s.ctrlKey){if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(Xt(s.target))return;if(s.key==="f"){s.preventDefault(),zt.current?.focus();return}if(s.key.toLowerCase()==="b"){s.preventDefault(),Q(C=>{const Ce=!C;return Ce&&(He.current=!0,M?.setKeyboardPane("l1"),requestAnimationFrame(()=>Gt.current?.focus())),Ce});return}if(s.key.toLowerCase()==="l"){s.preventDefault(),ut();return}return s.altKey,void 0}if(M?.keyboardPane==="l0")return;if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement){s.key==="Escape"&&(s.target.blur(),s.preventDefault());return}if(Xt(s.target)||s.metaKey||s.ctrlKey||s.altKey)return;const l=s.key.length===1?s.key.toLowerCase():s.key;if(l==="h"||l==="ArrowLeft"){s.preventDefault(),_&&Q(!1),M?.setL0FocusPageId(P.DELIVERABLES),M?.setLeftCollapsed(!1),M?.setKeyboardPane("l0");return}if(l==="l"||l==="ArrowRight"){s.preventDefault(),_&&Q(!1),M?.keyboardPane!=="l1"&&M?.setKeyboardPane("l1");return}const f=l==="j"||l==="ArrowDown"?1:l==="k"||l==="ArrowUp"?-1:0;if(!f)return;s.preventDefault(),M?.setKeyboardPane("l1"),_&&(He.current=!0,Q(!1));const x=Se;if(x.length===0)return;const h=n?x.findIndex(C=>C.id===n.id):-1,b=h<0?f>0?-1:0:h,y=Math.max(0,Math.min(x.length-1,b+f));Yt(x[y]),requestAnimationFrame(()=>{document.querySelector(`[data-deliverable-id="${x[y].id}"]`)?.scrollIntoView({block:"nearest"})})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[Se,n,o,u,v,M,_]);const _e=a.useRef(null),hs=a.useCallback(t=>{if(!u)return;const s=Y.current;!s||s.scrollTop>0||(_e.current={y:t.touches[0].clientY,scrollTop:s.scrollTop})},[u]),ms=a.useCallback(t=>{if(!u||!_e.current||Je)return;const s=t.changedTouches[0].clientY-_e.current.y;_e.current=null,s>80&&Y.current&&Y.current.scrollTop<=0&&(wt(!0),O().finally(()=>wt(!1)))},[u,Je,O]),Yt=t=>{const s=()=>{T(t),Ze(!1),J(!1),X(!1),u&&(j(!0),history.pushState({mobileDetail:P.DELIVERABLES},"",window.location.hash))};U?Z({action:s}):s()},ps=()=>{if(!U){const t=Te??n?.summary??"";tt(t)}J(!0)},gs=()=>{U?Z({action:()=>{J(!1),X(!1)}}):J(!1)},Qt=async()=>{if(!(!n?.reference||st)){Mt(!0);try{await p.files.write(n.reference,ke),Pe(ke),X(!1),J(!1),A("success",r("detail.saved"))}catch(t){A("error",r("detail.saveFailed")+": "+String(t))}Mt(!1)}},bs=()=>{J(!1),X(!1),Z(null)};a.useEffect(()=>{if(!U)return;const t=s=>{s.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[U]),a.useEffect(()=>{if(!U)return;const t=s=>{s.preventDefault(),s.stopImmediatePropagation(),Z({action:()=>{J(!1),X(!1);const{page:i,params:l}=s.detail||{};i&&ee.navigate(i,l)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[U]);const dt=a.useRef(null),ut=a.useCallback((t,s)=>{const i=n?.agentId??"",l=n?.id??"",f={};l&&(f.openDeliverable=l);const x=[];if(l){const h=n?.title?.trim()||l,b=h.length>40?`${h.slice(0,24)}…${h.slice(-12)}`:h;x.push({label:`📄 ${b}`,content:["[deliverable]",`ID: ${l}`,`Title: ${n?.title??""}`,n?.reference?`Reference: ${n.reference}`:"",n?.taskId?`Task: ${n.taskId}`:"",n?.projectId?`Project: ${n.projectId}`:""].filter(Boolean).join(`
|
|
2
|
-
`)})}if(t?.trim()){const h=t.trim().length>40?`${t.trim().slice(0,24)}…${t.trim().slice(-12)}`:t.trim();if(s){const b=n?.reference??"";x.push({label:`🌐 ${h}`,content:["[html-selection]",`Text: "${t.trim()}"`,`CSS Selector: ${s.cssSelector}`,`XPath: ${s.xpath}`,b?`File: ${b}`:""].filter(Boolean).join(`
|
|
3
|
-
`)})}else x.push({label:`📝 ${h}`,content:t.trim()})}x.length>0&&(f.chatChips=JSON.stringify(x)),i&&(f.agentId=i),le(null),window.getSelection()?.removeAllRanges(),ee.navigate(P.TEAM,f)},[n]),ys=a.useCallback(t=>{if(!t.text.trim())return;const i=dt.current?.querySelector("iframe")?.getBoundingClientRect(),l=(i?.left??0)+t.rect.x+t.rect.width/2,f=(i?.top??0)+t.rect.y;le({x:l,y:f,text:t.text,htmlMeta:{xpath:t.xpath,cssSelector:t.cssSelector}})},[]);return a.useEffect(()=>{const t=dt.current;if(!t)return;const s=()=>{requestAnimationFrame(()=>{const l=window.getSelection(),f=l?.toString().trim();if(!f||!l?.rangeCount){le(null);return}const x=l.getRangeAt(0);if(!t.contains(x.commonAncestorContainer)){le(null);return}const h=x.getBoundingClientRect();le({x:h.left+h.width/2,y:h.top,text:f})})},i=l=>{const f=document.getElementById("selection-toolbar");f&&f.contains(l.target)||le(null)};return t.addEventListener("mouseup",s),document.addEventListener("mousedown",i),()=>{t.removeEventListener("mouseup",s),document.removeEventListener("mousedown",i)}},[]),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{ref:Gt,tabIndex:-1,"data-keyboard-pane":"l1",className:`${u?"flex-1 min-w-0":"shrink-0"} flex flex-col bg-surface-secondary rounded-xl m-1 mr-0 outline-none ${!u&&ae==="l1"?"ring-1 ring-inset ring-brand-500/30":""}`,style:u?N?{display:"none"}:void 0:_?{display:"none"}:{width:S.width},children:[e.jsxs("div",{"data-electron-drag":!0,className:"p-4 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u&&e.jsx(Cs,{}),!u&&e.jsx("button",{onClick:()=>Q(!0),className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 bg-brand-500/15 text-brand-500 hover:bg-brand-500/25",title:r("sidebar.collapse"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsxs("h2",{className:"text-sm font-semibold text-fg-secondary truncate",children:[r("title"),w>0&&e.jsxs("span",{className:"ml-1.5 text-fg-tertiary font-normal",children:["(",w,")"]})]})]})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:zt,value:Ie,onChange:t=>Le(t.target.value),placeholder:r("searchPlaceholder"),className:"w-full bg-surface-elevated border border-border-default rounded-lg pl-8 pr-8 py-2 text-sm text-fg-primary focus:border-brand-500 focus:outline-none transition-colors"}),Ie&&e.jsx("button",{onClick:()=>{Le(""),Re("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 flex items-center justify-center rounded-full bg-surface-overlay text-fg-tertiary hover:text-fg-secondary transition-colors",children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),et&&!u&&e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-elevated rounded-lg text-[10px] text-fg-tertiary",children:[e.jsx("span",{className:"truncate font-mono",children:et}),e.jsx("button",{onClick:()=>{p.system.openPath(et)},className:"shrink-0 underline hover:text-fg-secondary transition-colors",children:r("common:open")})]}),u&&e.jsxs("button",{onClick:()=>rs(t=>!t),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors ${Qe||Fe?"bg-brand-500/15 text-brand-500":"bg-surface-elevated text-fg-secondary"}`,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),e.jsx("line",{x1:"12",y1:"18",x2:"20",y2:"18"})]}),r("filters.filtersLabel"),Fe&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500"}),e.jsx("svg",{className:`w-3 h-3 ml-auto transition-transform ${Qe?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),e.jsxs("div",{className:u&&!Qe?"hidden":"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:r("filters.source")}),e.jsx(xe,{label:r("filters.allSources"),value:"",current:F,onClick:()=>H("")}),e.jsx(xe,{label:r("filters.sourceAgent"),value:"agent",current:F,onClick:t=>H(t||"")}),e.jsx(xe,{label:r("filters.sourceKnowledge"),value:"knowledge",current:F,onClick:t=>H(t||"")}),e.jsxs("button",{type:"button",onClick:()=>Ge(!0),className:"ml-auto shrink-0 flex items-center gap-1 px-2 py-1 rounded text-[10px] text-fg-tertiary hover:text-brand-500 hover:bg-surface-elevated transition-colors",title:r("filters.bindKnowledgeBase"),children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r("filters.bindKnowledgeBase")]})]}),e.jsxs("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx(xe,{label:r("filters.allTypes"),value:"",current:V||W||"",onClick:()=>{he(""),me("")}}),Ds.map(t=>e.jsx(xe,{label:`${ue[t]?.icon??""} ${t}`,value:t,current:V,onClick:s=>{he(s),me("")}},t)),["agent","team","skill"].map(t=>e.jsx(xe,{label:`${z[t].icon} ${r(`artifactTypes.${t}`)}`,value:t,current:W,onClick:s=>{me(s),he("")}},t))]}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:r("filters.group")}),["date","project","team","agent"].map(t=>e.jsx("button",{onClick:()=>{yt(t)},className:`px-2 py-1 rounded text-xs transition-colors ${B===t?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:r(`groupBy.${t}`)},t)),K.length>1&&e.jsx("button",{onClick:fs,className:"ml-auto px-1.5 py-1 rounded text-[10px] text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated transition-colors",title:r(Ut?"expandAllTooltip":"collapseAllTooltip"),children:r(Ut?"expandAll":"collapseAll")})]})]}),Fe&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[fe&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:["“",fe,"”",e.jsx("button",{onClick:()=>{Le(""),Re("")},className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),V&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[ue[V]?.icon," ",V,e.jsx("button",{onClick:()=>he(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),W&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[z[W]?.icon," ",r(`artifactTypes.${W}`),e.jsx("button",{onClick:()=>me(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),F&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[r(F==="knowledge"?"filters.sourceKnowledge":"filters.sourceAgent"),e.jsx("button",{onClick:()=>H(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),re&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[we(re)??re,e.jsx("button",{onClick:()=>Ee(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("button",{onClick:Kt,className:"text-[10px] text-fg-tertiary hover:text-brand-500 ml-auto transition-colors",children:r("filters.clearAll")})]})]}),qe&&e.jsx("div",{className:`mx-4 mt-2 px-3 py-1.5 text-xs rounded-lg ${qe.type==="success"?"bg-green-500/15 text-green-600":"bg-red-500/15 text-red-500"}`,children:qe.text}),e.jsxs("div",{ref:Y,className:"flex-1 overflow-y-auto p-2 space-y-1 transition-opacity duration-150",style:{opacity:G?.5:1},onTouchStart:u?t=>{Nt.onTouchStart(t),hs(t)}:void 0,onTouchEnd:u?t=>{Nt.onTouchEnd(t),ms(t)}:void 0,children:[Je&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-brand-500",children:[e.jsx(Zt,{})," ",e.jsx("span",{className:"text-[10px]",children:r("filters.refreshing")})]}),G?e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse space-y-2",children:[e.jsx("div",{className:"h-4 bg-surface-elevated rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-surface-elevated rounded w-1/2"})]},t))}):g.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("svg",{className:"w-12 h-12 text-fg-muted mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),Fe?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:r("empty.noResults")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:r("empty.noResultsHint")}),e.jsx("button",{onClick:Kt,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r("filters.clearAll")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:r("empty.title")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:r("empty.subtitle")}),e.jsx("button",{onClick:()=>ee.navigate(P.WORK),className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r("empty.goToWork")})]})]}):K.map(([t,s])=>{const i=_t(t);return e.jsxs("div",{className:"mb-1",children:[e.jsxs("button",{onClick:()=>xs(t),className:"w-full flex items-center gap-1.5 px-2 py-2 rounded-md hover:bg-surface-elevated/50 transition-colors group/header border-b border-border-subtle/50",children:[e.jsx("svg",{className:`w-3 h-3 text-fg-tertiary transition-transform duration-200 shrink-0 ${i?"":"rotate-90"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.jsx("span",{className:"text-[11px] font-semibold text-fg-tertiary uppercase tracking-wider truncate",children:s.label}),e.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated px-1.5 py-0.5 rounded-full shrink-0",children:[s.items.length,g.length<w?"+":""]})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ${i?"max-h-0 opacity-0":"max-h-[5000px] opacity-100"}`,children:s.items.map(l=>e.jsx("button",{"data-deliverable-id":l.id,onClick:()=>Yt(l),className:`w-full text-left px-3 py-2 rounded-lg transition-all duration-150 ${n?.id===l.id?ae==="l1"?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"bg-brand-600/15 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"hover:bg-surface-elevated/60 border-l-2 border-l-transparent border-y border-r border-transparent"}`,children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.artifactType&&z[l.artifactType]?e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium shrink-0 ${z[l.artifactType].color}`,children:z[l.artifactType].icon}):e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium uppercase shrink-0 ${ue[l.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:ue[l.type]?.icon??l.type.charAt(0)}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:l.title}),I(l)==="published"&&e.jsxs("svg",{className:"shrink-0 text-green-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":r("share.published",{defaultValue:"已发布到 Hub"}),children:[e.jsx("title",{children:r("share.published",{defaultValue:"已发布到 Hub"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),I(l)==="pending_review"&&e.jsxs("svg",{className:"shrink-0 text-amber-500 animate-pulse",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":r("share.pendingReview",{defaultValue:"Hub 审核中"}),children:[e.jsx("title",{children:r("share.pendingReview",{defaultValue:"Hub 审核中"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),I(l)==="rejected"&&e.jsxs("svg",{className:"shrink-0 text-red-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":r("share.rejected",{defaultValue:"Hub 已拒绝"}),children:[e.jsx("title",{children:r("share.rejected",{defaultValue:"Hub 已拒绝"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),Bt.has(l.id)&&e.jsx("span",{className:"shrink-0 text-amber-500",title:r("detail.fileMissing"),children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),e.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Vs(l.updatedAt,r)})]})},l.id))})]},t)}),m&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-fg-tertiary",children:[e.jsx(Zt,{})," ",e.jsx("span",{className:"text-[10px]",children:r("common:loadingMore")})]}),!G&&g.length>0&&e.jsx("div",{className:"text-center text-[10px] text-fg-tertiary py-2",children:g.length<w?r("count.partial",{loaded:g.length,total:w}):r("count.total",{total:w})})]})]}),!u&&e.jsx("div",{className:"w-2 shrink-0 cursor-col-resize group relative flex items-center justify-center hover:bg-brand-500/5 transition-colors",onMouseDown:S.onResizeStart,children:e.jsxs("div",{className:"flex flex-col gap-1 items-center opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"}),e.jsx("div",{className:"w-1 h-1 rounded-full bg-fg-muted"})]})}),(!u||N)&&e.jsxs("div",{"data-no-drag":!0,className:"flex-1 overflow-hidden min-w-0 flex relative self-stretch",children:[e.jsxs("div",{ref:dt,className:"flex-1 overflow-y-auto min-w-0 h-full",children:[_&&!u&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-primary/80 backdrop-blur-sm px-4 py-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{He.current=!0,Q(!1)},className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated",title:r("sidebar.expand"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsx("span",{className:"text-sm font-medium text-fg-secondary truncate",children:n?.title??r("detail.details")})]}),u&&e.jsxs("div",{className:"sticky top-0 z-10 bg-surface-secondary px-4 py-2.5 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>history.back(),className:"text-fg-secondary hover:text-fg-primary transition-colors p-1 -ml-1",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsx("span",{className:"text-sm font-medium truncate",children:n?.title??r("detail.details")})]}),n?e.jsxs("div",{className:`p-6 space-y-4 ${ve?"flex flex-col min-h-0 h-full":""}`,children:[!o&&Bt.has(n.id)&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/20 rounded-lg text-amber-600 text-xs",children:[e.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),e.jsx("span",{children:r("detail.fileMissing")})]}),e.jsxs("div",{className:`space-y-3 ${ve?"shrink-0":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h2",{className:"text-xl font-semibold text-fg-primary",children:n.title}),!o&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[Ps(n?.format)&&e.jsxs("button",{onClick:()=>Ze(!0),title:r("share.title",{defaultValue:"分享到 Markus Hub"}),"aria-label":r("share.title",{defaultValue:"分享到 Markus Hub"}),className:`relative p-1.5 rounded-lg transition-colors ${I(n)==="published"?"text-green-500 hover:text-green-400 hover:bg-green-500/10":I(n)==="pending_review"?"text-amber-500 hover:text-amber-400 hover:bg-amber-500/10":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),I(n)==="published"||I(n)==="pending_review"||I(n)==="rejected"?e.jsx("span",{className:`absolute top-0.5 right-0.5 w-2 h-2 rounded-full border border-surface-primary ${I(n)==="published"?"bg-green-500":I(n)==="pending_review"?"bg-amber-500 animate-pulse":"bg-red-500"}`,"aria-hidden":!0}):null]}),e.jsx("button",{onClick:()=>Ae(n),disabled:!!jt,className:"p-1.5 rounded-lg text-fg-tertiary hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 shrink-0",title:r("common:remove"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium uppercase ${ue[n.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:[ue[n.type]?.icon??""," ",n.type]}),n.artifactType&&z[n.artifactType]&&e.jsxs("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${z[n.artifactType].color}`,children:[z[n.artifactType].icon," ",r("detail.builderWithType",{type:r(`artifactTypes.${n.artifactType}`)})]}),n.tags.length>0&&n.tags.map(t=>e.jsx("span",{className:"px-2 py-0.5 text-xs bg-surface-elevated text-fg-secondary rounded",children:t},t)),I(n)==="published"&&e.jsxs("a",{href:n.shareUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-green-500/15 text-green-600 hover:bg-green-500/25 hover:underline",title:n.shareUrl??void 0,children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),r("share.published",{defaultValue:"已发布"})]}),I(n)==="pending_review"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-amber-500/15 text-amber-500",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),r("share.pendingReview",{defaultValue:"审核中"})]}),I(n)==="rejected"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-red-500/15 text-red-500",title:n.shareReason??void 0,children:[r("share.rejected",{defaultValue:"已拒绝"}),n.shareReason?e.jsxs("span",{className:"text-red-400/90 font-normal",children:["— ",n.shareReason]}):null]})]}),(n.taskId||n.agentId||we(n.projectId))&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.taskId&&e.jsx("button",{onClick:()=>ee.navigate(P.WORK,{openTask:n.taskId}),className:"text-xs text-brand-500 hover:underline bg-brand-500/10 px-2 py-0.5 rounded",children:r("links.task",{id:`${n.taskId.slice(0,12)}...`})}),n.agentId&&e.jsx("button",{onClick:()=>ee.navigate(P.TEAM,{selectAgent:n.agentId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:r("links.agent",{name:$e.get(n.agentId)?.name??n.agentId.slice(0,12)})}),we(n.projectId)&&e.jsx("button",{onClick:()=>ee.navigate(P.WORK,{projectId:n.projectId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:r("links.project",{name:we(n.projectId)})})]}),(n.diffStats||n.testResults)&&e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[n.diffStats&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[r("diffStats.title"),":"]}),e.jsx("span",{className:"text-fg-secondary",children:r("diffStats.files",{count:n.diffStats.filesChanged})}),e.jsxs("span",{className:"text-green-600",children:["+",n.diffStats.additions]}),e.jsxs("span",{className:"text-red-500",children:["-",n.diffStats.deletions]})]}),n.testResults&&e.jsxs("div",{className:"bg-surface-elevated rounded-lg px-3 py-2 text-xs flex items-center gap-2",children:[e.jsxs("span",{className:"text-fg-tertiary font-medium",children:[r("testResults.title"),":"]}),e.jsx("span",{className:"text-green-600",children:r("testResults.passed",{count:n.testResults.passed})}),e.jsx("span",{className:"text-red-500",children:r("testResults.failed",{count:n.testResults.failed})}),e.jsx("span",{className:"text-fg-secondary",children:r("testResults.skipped",{count:n.testResults.skipped})})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-fg-tertiary flex-wrap",children:[e.jsxs("span",{children:[r("metadata.created")," ",new Date(n.createdAt).toLocaleString()]}),e.jsxs("span",{children:[r("metadata.updated")," ",new Date(n.updatedAt).toLocaleString()]}),e.jsx("span",{className:"text-fg-muted select-all",children:n.id.slice(0,12)})]}),n.reference&&!Oe(n.reference)&&n.type==="file"&&e.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[e.jsx("button",{onClick:()=>{p.files.reveal(n.reference).catch(()=>A("error",r("detail.failedToOpenBrowser")))},className:"text-xs font-mono text-brand-500 hover:text-brand-500 hover:underline truncate flex-1 text-left cursor-pointer",title:r("detail.openInFileBrowser"),children:n.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(n.reference).catch(()=>A("error",r("detail.failedToOpenBrowser")))},className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",title:r("detail.revealInFinder"),children:r("common:open")}),e.jsx("button",{onClick:()=>Dt(n.reference),className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${Me?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,title:r("detail.copyPath"),children:r(Me?"common:copied":"common:copy")})]}),n.reference&&!Oe(n.reference)&&n.type!=="file"&&n.type!=="directory"&&e.jsx("span",{className:"text-xs text-fg-tertiary font-mono break-all",children:n.reference})]}),n.artifactType&&n.artifactData?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx($s,{artifact:n.artifactData,mode:n.artifactType})}),n.reference&&e.jsxs("div",{className:"px-3 py-2 bg-surface-elevated rounded-lg",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider block mb-1",children:r("detail.artifactDirectory")}),e.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all",children:n.reference})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx("button",{onClick:us,className:"flex-1 px-4 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:r("detail.openInBuilder")})}),n.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Ue,{content:n.summary,className:"text-fg-secondary text-sm"})})]}):n.reference&&Oe(n.reference)?e.jsxs("div",{className:"space-y-4",children:[n.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Ue,{content:n.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsxs("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:n.reference}),e.jsx("button",{onClick:()=>window.open(n.reference,"_blank","noopener,noreferrer"),className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:r("detail.openUrl")})]})]}):n.type==="directory"&&n.reference?e.jsxs("div",{className:"space-y-4",children:[n.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Ue,{content:n.summary,className:"text-fg-secondary text-sm"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsx("svg",{className:"w-10 h-10 text-fg-muted mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("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"})}),e.jsx("p",{className:"text-xs text-fg-tertiary font-mono mb-4 px-4 text-center break-all select-all",children:n.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(n.reference).catch(()=>A("error",r("detail.failedToOpenBrowser")))},className:"px-6 py-2.5 bg-brand-600 hover:bg-brand-500 text-white text-sm font-medium rounded-lg transition-colors",children:r("detail.openInFileBrowser")})]})]}):e.jsxs("div",{className:`bg-surface-elevated rounded-xl overflow-hidden ${ve?"flex flex-col h-full":""}`,children:[(Te||n.summary)&&!Rt&&!ge&&!Tt&&n.reference&&n.type==="file"&&(Be==="markdown"||Be==="text"||Be==="html")&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border-subtle bg-surface-secondary/50",children:[e.jsx("button",{onClick:gs,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ie?"text-fg-tertiary hover:text-fg-secondary":"bg-brand-600/20 text-brand-500"}`,children:r("detail.preview")}),e.jsx("button",{onClick:ps,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ie?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:r("detail.edit")}),e.jsx("div",{className:"flex-1"}),ie&&e.jsx("button",{onClick:Qt,disabled:!U||st,className:"px-3 py-1 rounded text-xs font-medium bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:r(st?"detail.saving":"detail.save")})]}),e.jsx("div",{className:ve?"flex-1 min-h-0 p-5 flex flex-col":"p-5",children:Rt?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-full"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-5/6"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-4/6"}),e.jsx("div",{className:"h-32 bg-surface-overlay/40 rounded-lg w-full mt-2"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-surface-overlay/60 rounded w-2/3"})]}):ge?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("img",{src:ge.src,alt:ge.name,className:"max-w-full max-h-[60vh] rounded-lg object-contain"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:ge.name})]}):ne?e.jsx("div",{className:ve?"flex-1 min-h-0":"h-[55vh]",children:e.jsx(Bs,{data:ne,reference:ne.reference,onFallback:ne.reference?()=>{p.files.reveal(ne.reference).catch(()=>{})}:void 0})}):be?e.jsxs("div",{className:"flex flex-col gap-3 py-4",children:[be.kind==="audio"?e.jsx("audio",{controls:!0,preload:"metadata",src:be.src,className:"w-full"}):e.jsx("video",{controls:!0,preload:"metadata",src:be.src,className:"w-full max-h-[60vh] rounded-lg bg-black"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:be.name})]}):Te?ie?e.jsx("div",{className:"animate-fadeIn",children:e.jsx("textarea",{ref:nt,value:ke,onChange:t=>{tt(t.target.value),X(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1})},"edit"):e.jsx("div",{className:"animate-fadeIn",children:e.jsx(Es,{content:Te,format:Be,className:"text-fg-secondary text-sm",onHtmlSelection:ys,basePath:n?.reference?n.reference.replace(/[/\\][^/\\]+$/,""):void 0})},"preview"):Tt?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:r("detail.cannotPreview",{type:n.type})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{p.files.reveal(n.reference).catch(()=>A("error",r("detail.failedToOpen")))},className:"text-xs bg-surface-elevated px-3 py-2 rounded text-brand-500 hover:text-brand-500 hover:underline flex-1 truncate text-left cursor-pointer font-mono",title:r("detail.openInFileBrowser"),children:n.reference}),e.jsx("button",{onClick:()=>{p.files.reveal(n.reference).catch(()=>A("error",r("detail.failedToOpen")))},className:"px-3 py-2 text-xs rounded-lg bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:r("common:open")}),e.jsx("button",{onClick:()=>Dt(n.reference),className:`px-3 py-2 text-xs rounded-lg transition-colors shrink-0 ${Me?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,children:r(Me?"common:copied":"common:copy")})]})]}):n.summary?ie?e.jsx("textarea",{ref:nt,value:ke,onChange:t=>{tt(t.target.value),X(!0)},className:"w-full min-h-[120px] p-3 text-sm font-mono bg-surface-primary border border-border-subtle rounded-lg text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50 overflow-hidden",style:{resize:"none"},spellCheck:!1}):e.jsx(Ue,{content:n.summary,className:"text-fg-secondary text-sm"}):e.jsx("p",{className:"text-sm text-fg-tertiary italic",children:r("detail.noContent")})})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsxs("div",{className:"text-center text-fg-tertiary space-y-3 max-w-xs",children:[e.jsx("div",{className:"w-16 h-16 mx-auto rounded-2xl bg-surface-elevated/60 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-fg-muted",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),e.jsx("p",{className:"text-sm text-fg-secondary",children:r("detail.selectToView")}),!u&&e.jsx("p",{className:"text-[10px] text-fg-muted",children:r("detail.keyboardHint")})]})})]}),n?.agentId&&!u&&e.jsx("button",{type:"button",onClick:()=>ut(),className:"absolute bottom-6 right-6 z-20 w-12 h-12 rounded-full bg-brand-600 hover:bg-brand-500 text-white shadow-lg shadow-black/20 flex items-center justify-center transition-transform hover:scale-105 animate-fab-in",title:r("chat.openChat",{defaultValue:"Open in Team Chat"}),children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})]}),je&&e.jsx("div",{id:"selection-toolbar",className:"fixed z-50 -translate-x-1/2 -translate-y-full bg-surface-elevated border border-border-default rounded-lg shadow-xl overflow-hidden",style:{left:je.x,top:je.y-8},children:e.jsxs("button",{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),ut(je.text,je.htmlMeta)},className:"px-3 py-1.5 text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-1.5 whitespace-nowrap",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),r("contextMenu.addToConversation")]})}),ls&&n&&e.jsx(Ms,{item:n,onClose:()=>Ze(!1),onShared:ds}),ts&&e.jsx(Ws,{projects:ze,onClose:()=>Ge(!1),onBound:()=>{Ge(!1),H("knowledge"),O()}}),Xe&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>Ae(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{className:"w-5 h-5 text-red-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:r("detail.confirmRemoveTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:r("detail.confirmRemoveMessage",{name:Xe.title})})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>Ae(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:r("common:cancel")}),e.jsx("button",{onClick:()=>{const t=Xe;Ae(null),cs(t)},disabled:!!jt,className:"px-4 py-1.5 text-xs bg-red-600 hover:bg-red-500 text-white rounded-lg transition-colors disabled:opacity-50",children:r("common:remove")})]})]})}),rt&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>Z(null),children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-sm mx-4 shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-amber-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary",children:r("detail.unsavedTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:r("detail.unsavedMessage")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>Z(null),className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:r("common:cancel")}),e.jsx("button",{onClick:()=>{bs(),rt.action()},className:"px-4 py-1.5 text-xs text-fg-secondary hover:text-fg-primary border border-border-default hover:border-gray-600 rounded-lg transition-colors",children:r("detail.discard")}),e.jsx("button",{onClick:async()=>{await Qt(),rt.action(),Z(null)},className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors",children:r("detail.saveAndLeave")})]})]})})]})}function Ws({projects:d,onClose:o,onBound:c}){const{t:r}=Ke("deliverables"),[u,v]=a.useState(""),[S,N]=a.useState(""),[j,E]=a.useState(!1),[k,L]=a.useState(""),g=d.find(m=>m.id===u),R=typeof window<"u"&&!!window.markusDesktop?.selectDirectory,w=async()=>{try{const m=await window.markusDesktop?.selectDirectory?.(r("bindBrowseTitle",{defaultValue:"Select knowledge base directory"}));m&&N(m)}catch(m){L(String(m))}},D=async()=>{if(!(!u||!S.trim()||j)){E(!0),L("");try{const m=S.trim(),se=[...new Set([...g?.knowledgeBasePaths??[],m])];await p.projects.update(u,{knowledgeBasePaths:se}),await p.projects.syncKnowledge(u),c()}catch(m){L(String(m))}finally{E(!1)}}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>{j||o()},children:e.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl",onClick:m=>m.stopPropagation(),children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary mb-1",children:r("bindKnowledgeBase")}),e.jsx("p",{className:"text-xs text-fg-secondary mb-4",children:r("bindKnowledgeBaseHint")}),e.jsx("label",{className:"block text-[10px] text-fg-tertiary mb-1",children:r("bindProject")}),e.jsxs("select",{value:u,onChange:m=>v(m.target.value),className:"w-full mb-3 px-2.5 py-2 text-xs bg-surface-primary border border-border-default rounded-lg text-fg-primary",children:[e.jsx("option",{value:"",children:r("bindProjectSelect")}),d.map(m=>e.jsx("option",{value:m.id,children:m.name},m.id))]}),e.jsx("label",{className:"block text-[10px] text-fg-tertiary mb-1",children:r("bindPath")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:S,onChange:m=>N(m.target.value),onKeyDown:m=>{m.key==="Enter"&&D()},placeholder:r("bindPathPlaceholder"),className:"flex-1 min-w-0 px-2.5 py-2 text-xs bg-surface-primary border border-border-default rounded-lg text-fg-primary placeholder:text-fg-tertiary font-mono"}),R&&e.jsx("button",{type:"button",onClick:()=>{w()},disabled:j,title:r("bindBrowse",{defaultValue:"Browse…"}),className:"shrink-0 px-3 py-2 text-xs bg-surface-overlay text-fg-secondary hover:text-fg-primary rounded-lg disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r("bindBrowse",{defaultValue:"Browse…"})})]}),g&&(g.knowledgeBasePaths??[]).length>0&&e.jsxs("div",{className:"mb-3 space-y-1",children:[e.jsx("div",{className:"text-[10px] text-fg-tertiary",children:r("bindCurrentPaths")}),(g.knowledgeBasePaths??[]).map((m,se)=>e.jsxs("div",{className:"text-[11px] text-fg-secondary font-mono truncate",title:m,children:["• ",m]},`${m}-${se}`))]}),k&&e.jsx("div",{className:"mb-3 px-2.5 py-1.5 text-[11px] rounded-md bg-red-500/15 text-red-500",children:k}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:o,disabled:j,className:"px-3 py-1.5 text-xs text-fg-tertiary hover:text-fg-secondary rounded-lg transition-colors",children:r("common:cancel",{defaultValue:"Cancel"})}),e.jsx("button",{onClick:()=>{D()},disabled:j||!u||!S.trim(),className:"px-3 py-1.5 text-xs bg-brand-600 text-white rounded-lg hover:bg-brand-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:j?r("bindSaving",{defaultValue:"Saving…"}):r("bindSave",{defaultValue:"Bind directory"})})]})]})})}function xe({label:d,value:o,current:c,onClick:r}){return e.jsx("button",{onClick:()=>r(c===o?"":o),className:`px-2 py-1 rounded text-xs whitespace-nowrap shrink-0 transition-colors ${c===o?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:d})}function Zt(){return e.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}export{Us as DeliverablesPage};
|