@markus-global/cli 0.12.3-rc.1 → 0.12.3-rc.3
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/markus.mjs +108 -23
- package/dist/web-ui/assets/{AsyncState-CQsFZGLc.js → AsyncState-D2omBzdj.js} +1 -1
- package/dist/web-ui/assets/{ChatComponents-LjH-fjd-.js → ChatComponents-lSVBiM5B.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-CPjXc_17.js → ContentRenderer-DxgRNOd1.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-PcKMNhu7.js → DeliverableShareModal-DU0PupsS.js} +1 -1
- package/dist/web-ui/assets/Deliverables-BYacAH8w.js +6 -0
- package/dist/web-ui/assets/{MarkdownMessage-BlBvOQYU.js → MarkdownMessage-DwxvYN4X.js} +1 -1
- package/dist/web-ui/assets/{Search-CQy9LrSw.js → Search-jBc36ZOH.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-DcltUxRE.js → SendToChat-13m2h7gu.js} +1 -1
- package/dist/web-ui/assets/{Settings-DReYkkRI.js → Settings-BkKMrBt2.js} +1 -1
- package/dist/web-ui/assets/{Store-6WS6Sc_W.js → Store-dLubNc0P.js} +1 -1
- package/dist/web-ui/assets/{Switch-C6jh49IG.js → Switch-CXRQn2gn.js} +1 -1
- package/dist/web-ui/assets/{Team-DZGZTsKU.js → Team-zVv87kaX.js} +36 -36
- package/dist/web-ui/assets/Work-DbPgRas-.js +142 -0
- package/dist/web-ui/assets/{arc-D6V0uo8n.js → arc-C6rhmRdi.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CvDfDgVS.js → architectureDiagram-3BPJPVTR-BvaRSMDl.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-7ubD6s3w.js → blockDiagram-GPEHLZMM-DP7IwNLE.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-CH9AI6RF.js → c4Diagram-AAUBKEIU-CEQJBqku.js} +1 -1
- package/dist/web-ui/assets/channel-pUJ_pqAp.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-BA_ZgNE_.js → chunk-2J33WTMH-BtGwhrHv.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-D6kqoaHd.js → chunk-4BX2VUAB-DNKfs4jy.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-SUAyH2BF.js → chunk-55IACEB6-Bd4eMlUg.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-C9RIOnPX.js → chunk-727SXJPM-CHmRT5rY.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-CSNX1S4h.js → chunk-AQP2D5EJ-CmoWgw5d.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-pHRTKB4U.js → chunk-FMBD7UC4-Csafnaj6.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-wj45Fv5O.js → chunk-ND2GUHAM-Cip_3Llj.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-CjEMXdK-.js → chunk-QZHKN3VN-C0WlO578.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-Cs9dF-hf.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-Cs9dF-hf.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-6FM-SaTU.js → cose-bilkent-S5V4N54A-ByhHiryW.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-D5iRxo_9.js → dagre-BM42HDAG-B5-K3iqP.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-D47RZTup.js → diagram-2AECGRRQ-Ci16wMOI.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-BJFNETx5.js → diagram-5GNKFQAL-Dfnzu_xA.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-DigJIT0I.js → diagram-KO2AKTUF-K9NvC1S4.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-BsLW2gME.js → diagram-LMA3HP47-CaKq8BY-.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-DQY8Krzm.js → diagram-OG6HWLK6-DqY8Y9OR.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-CuT0jrbu.js → docx-preview-DS9aOywt.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CvsERlfh.js → erDiagram-TEJ5UH35-iW17lrM1.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-DhqXk-4Z.js → flowDiagram-I6XJVG4X-BBkXZBPV.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-Uj6WM-3X.js → ganttDiagram-6RSMTGT7-J2QuVqg4.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-eL4UT3wa.js → gitGraphDiagram-PVQCEYII-EhZa3sGY.js} +1 -1
- package/dist/web-ui/assets/{index-Di4rk9mR.js → index-BHu6brRf.js} +56 -56
- package/dist/web-ui/assets/index-CzHSs0Vd.css +1 -0
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-Cp2MK76S.js → infoDiagram-5YYISTIA-BaiNGDG7.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-5FdLbnU3.js → ishikawaDiagram-YF4QCWOH-BYN0gLmP.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-DeGDkjDm.js → journeyDiagram-JHISSGLW-CKUGXjL8.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-CCeOQsBL.js → kanban-definition-UN3LZRKU-iKb5H8rf.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-83h547Y5.js → mermaid.core-BSghRCEC.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-BCHLW6QN.js → mindmap-definition-RKZ34NQL-JjtDu_0Z.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CVXC-GmM.js → pieDiagram-4H26LBE5-BDXCI_g9.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-21f0SZxC.js → quadrantDiagram-W4KKPZXB-bATU3F6v.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-CC5CR7T7.js → requirementDiagram-4Y6WPE33-BNJWpDxg.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-C_lykOWv.js → sankeyDiagram-5OEKKPKP-C3B8NPUe.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CAuS77Dx.js → sequenceDiagram-3UESZ5HK-DhGwy4UV.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-BcvG2EZj.js → stateDiagram-AJRCARHV-BtfcmNhI.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BOaSwLIS.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-C9zqVPmR.js → timeline-definition-PNZ67QCA-BpY3qMyG.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B1gko5s5.js → vennDiagram-CIIHVFJN-S0f15t2D.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-DMqazX2H.js → wardley-L42UT6IY-BdcJNPNt.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-5aKkLHJG.js → wardleyDiagram-YWT4CUSO-mR-gwtcd.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-CRRCgk7-.js → xychartDiagram-2RQKCTM6-Dq0PtvdL.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/web-ui/assets/Deliverables-DPY5TpzQ.js +0 -3
- package/dist/web-ui/assets/Work-BfK3a2b7.js +0 -142
- package/dist/web-ui/assets/channel-DhkGdPEn.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-DiGU691-.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-DiGU691-.js +0 -1
- package/dist/web-ui/assets/index-CjwBVJDR.css +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-IjQiT1GD.js +0 -1
package/dist/web-ui/assets/{DeliverableShareModal-PcKMNhu7.js → DeliverableShareModal-DU0PupsS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as de,r as u,h as R,V as ue,$ as fe,k as N,j as r}from"./index-Di4rk9mR.js";const G=50*1024*1024,q=new Set(["markdown","html"]);function be(e){return e||"markdown"}function he(e){return q.has(be(e))}class S extends Error{constructor(t){super(t),this.name="DeliverableShareError"}}class Q extends S{constructor(){super("需要登录 Markus Hub 账号后才能分享产出物。"),this.name="NotLoggedIntoHubError"}}class pe extends S{bytes;limit;constructor(t,a){super(`产出物文件大小 ${t} 字节超过上限 ${a} 字节(50MB),请压缩或拒绝分享。`),this.name="DeliverableTooLargeError",this.bytes=t,this.limit=a}}class me extends S{status;constructor(t,a){super(`Hub 请求失败 (HTTP ${t}): ${a}`),this.name="HubApiError",this.status=t}}function ge(e){const t=e.replace(/\s+/g,"");if(!t)return 0;let a=0;return t.endsWith("==")?a=2:t.endsWith("=")&&(a=1),Math.floor(t.length*3/4)-a}function C(e,t){const a=e&&typeof e=="object"?e:{},l=a.share??a.deliverable??{},s=m=>a[m]??l[m],i=s("id")??s("shareId")??"",c=s("slug"),o=c!=null?String(c):void 0,d=s("url")??s("shareUrl");let b=null;d!=null?b=String(d):o&&t&&(b=`${t.replace(/\/+$/,"")}/deliverable/${encodeURIComponent(o)}`);const f=s("reason")??s("rejectNote"),p=s("localDeliverableId")??s("localId");return{id:String(i),slug:o,visibility:s("visibility")??"public",status:s("status")??"pending_review",url:b,reason:f!=null?String(f):null,localId:p!=null?String(p):null}}class xe{basePath;fetchImpl;hubOrigin;constructor(t){this.getHubToken=t.getHubToken,this.hubOrigin=t.hubUrl,this.basePath=(t.proxyBasePath??"/api/hub").replace(/\/+$/,""),this.fetchImpl=t.fetch??(globalThis.fetch?globalThis.fetch.bind(globalThis):(()=>{throw new Error("fetch unavailable")}))}getHubToken;isHubLoggedIn(){return!!this.getHubToken()}assertHubLoggedIn(){if(!this.getHubToken())throw new Q}async doFetch(t,a){const l=this.getHubToken(),s={"Content-Type":"application/json",...a.headers};l&&(s.Authorization=`Bearer ${l}`);const i=await this.fetchImpl(`${this.basePath}${t}`,{...a,headers:s,credentials:"include"});let c=null;try{c=await i.json()}catch{c=null}if(!i.ok){const o=c&&typeof c=="object"&&"error"in c?String(c.error):i.statusText||`HTTP ${i.status}`;throw new me(i.status,o)}return{status:i.status,data:c}}async publish(t){this.assertHubLoggedIn();const a=t.fileSizeBytes??(t.fileBase64?ge(t.fileBase64):0);if(a>G)throw new pe(a,G);const l={localDeliverableId:t.localId,visibility:t.visibility,title:t.title,summary:t.summary,tags:t.tags,filename:t.filename,format:t.format,producerAgent:{id:t.producerAgent.id,name:t.producerAgent.name,source:t.producerAgent.source}};t.content&&(l.content=t.content),t.fileBase64&&(l.fileBase64=t.fileBase64);const{data:s}=await this.doFetch("/deliverables/publish",{method:"POST",body:JSON.stringify(l)});return C(s,this.hubOrigin)}async pollStatus(t){this.assertHubLoggedIn();const{data:a}=await this.doFetch(`/deliverables/status?localId=${encodeURIComponent(t)}`,{method:"GET"});return C(a,this.hubOrigin)}async listMine(){this.assertHubLoggedIn();const{data:t}=await this.doFetch("/deliverables/mine",{method:"GET"}),a=t&&typeof t=="object"?t:{};return(Array.isArray(a.shares)?a.shares:[]).map(s=>C(s,this.hubOrigin))}async revoke(t){this.assertHubLoggedIn();const{data:a}=await this.doFetch("/deliverables/revoke",{method:"POST",body:JSON.stringify({localId:t})});return{...C(a,this.hubOrigin),status:"revoked",url:null}}}function ye(e,t){return new xe({getHubToken:e,hubUrl:t,proxyBasePath:"/api/hub"})}const ve=/\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)$/i,ke=/\.(mp4|webm|mp3|wav|ogg|m4a|mov|avi|mkv|flac)$/i;function X(e){return ve.test(e)?"image":ke.test(e)?"media":"other"}function je(e){return e.replace(/^file:\/\//i,"").replace(/^file:/i,"")}function J(e){const t=e.match(/!?\[[^\]]*\]\(([^)]+)\)/);if(t)return t[1].trim().split(/\s+(?="|')/)[0].trim()||null;const a=e.match(/(?:src|href|poster)\s*=\s*["']([^"']+)["']/i);return a?a[1]:null}function Z(e){return!e||/^(https?:|data:|mailto:|tel:|#)/i.test(e)||e.startsWith("//")?!1:(e.startsWith("/api/files/"),!0)}function Y(e,t){if(!e)return null;const a=e.trim(),l=a.match(/^\/api\/files\/(?:image|stream|preview)\?path=([^&]+)/i);if(l)try{return decodeURIComponent(l[1])||null}catch{return l[1]||null}return/^file:\/\//i.test(a)?je(a).replace(/\\/g,"/"):/^[a-zA-Z]:[\\/]/.test(a)?a.replace(/\\/g,"/"):a.startsWith("/")?a:t&&(a.startsWith("./")||a.startsWith("../")||!a.includes("://"))?`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${a.replace(/^\.\//,"").replace(/\\/g,"/")}`:null}function we(e,t){const a=[],l=new Set,s=/!?\[[^\]]*\]\(([^)\s]+(?:\s+["'][^"']*["'])?)\)/g;for(const c of e.matchAll(s)){const o=c[0],d=J(o);if(!d||!Z(d))continue;const b=Y(d,t);!b||l.has(o)||(l.add(o),a.push({raw:o,localPath:b,kind:X(b.split("?")[0])}))}const i=/<[a-zA-Z][^>]*(?:src|href|poster)\s*=\s*["'][^"']+["'][^>]*>/gi;for(const c of e.matchAll(i)){const o=c[0],d=J(o);if(!d||!Z(d))continue;const b=Y(d,t);!b||l.has(o)||(l.add(o),a.push({raw:o,localPath:b,kind:X(b.split("?")[0])}))}return{refs:a,baseDir:t??""}}function Ne(e,t){let a=e;for(const[l,s]of t){const i=Se(l,s);a=a.split(l).join(i)}return a}function Se(e,t){const a=e.match(/^(!?\[[^\]]*\])\([^)]*\)$/);if(a)return`${a[1]}(${t})`;const l=e.match(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i);return l?e.replace(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i,`${l[1]}${l[2]}${l[3]}${t}${l[3]}`):t}function Ve(e,t){return/^https?:\/\//i.test(e)?e:`${t.replace(/\/+$/,"")}${e.startsWith("/")?"":"/"}${e}`}function He(e,t,a){const l=new Map,s=new Map(e.map(i=>[i.localPath,i]));for(const i of t){if(!i.key)continue;const c=s.get(i.key);!c||!i.url||l.set(c.raw,Ve(i.url,a))}return l}async function Ie(e){try{const t=N.files.streamUrl(e),a=await fetch(t).then(d=>d.ok?d.blob():null);if(!a)return null;const l=await a.arrayBuffer(),s=new Uint8Array(l);let i="";const c=32768;for(let d=0;d<s.length;d+=c)i+=String.fromCharCode.apply(null,Array.from(s.subarray(d,d+c)));const o=e.split("/").pop()||"media";return{base64:btoa(i),filename:o}}catch{return null}}async function Te(e,t){const a=new Map;if(e.length===0)return a;const l=[];for(const c of e){const o=await Ie(c.localPath);o&&l.push({key:c.localPath,filename:o.filename,base64:o.base64})}if(l.length===0)return a;const{files:s,errors:i}=await R.uploadMediaBatch(l);return i.length>0&&console.warn("[deliverable-share] media upload errors:",i),He(e,s,t)}async function $e(e,t,a){if(!e||t==="directory"||e.startsWith("http://")||e.startsWith("https://"))return{};try{const l=await N.files.preview(e);if((l.type==="text"||l.type==="markdown"||l.type==="html"||l.type==="json"||l.type==="csv")&&typeof l.content=="string"){if(!(l.type==="markdown"||l.type==="html"))return{content:l.content};const i=e.replace(/[/\\]/g,"/").split("/").slice(0,-1).join("/"),{refs:c}=we(l.content,i);if(c.length===0)return{content:l.content};const o=await Te(c,a);return o.size===0?{content:l.content}:{content:Ne(l.content,o),uploadedMedia:o.size}}if(l.type==="image"||l.type==="audio"||l.type==="video"||l.type==="binary"){const s=l.streamUrl||(l.path?N.files.streamUrl(l.path):N.files.streamUrl(e)),c=await(await fetch(s).then(f=>f.blob())).arrayBuffer(),o=new Uint8Array(c);let d="";const b=32768;for(let f=0;f<o.length;f+=b)d+=String.fromCharCode.apply(null,Array.from(o.subarray(f,f+b)));return{fileBase64:btoa(d)}}return{}}catch{return{}}}function Ee({item:e,onClose:t,onShared:a,service:l}){const{t:s}=de(["deliverables","common"]),i=u.useMemo(()=>l??ye(ue,R.getUrl()),[l]),[c,o]=u.useState(()=>i?i.isHubLoggedIn():null),[d,b]=u.useState(!1),[f,p]=u.useState(()=>{const n=e.shareStatus;return n==="published"?"published":n==="pending_review"?"pending_review":n==="rejected"?"rejected":"form"}),[m,M]=u.useState("public"),[V,ee]=u.useState(e.title||""),[E,te]=u.useState(e.summary||""),[x,L]=u.useState(Array.isArray(e.tags)?[...e.tags]:[]),[k,P]=u.useState(""),[A,re]=u.useState(null),[H,U]=u.useState(!1),[I,g]=u.useState(null),F=u.useRef(a);F.current=a;const y=u.useCallback(n=>{re(n);const h=n.status;p(h==="published"?"published":h==="rejected"?"rejected":h==="revoked"?"revoked":h==="pending_review"?"pending_review":"form"),F.current?.(n)},[]);u.useEffect(()=>{o(i.isHubLoggedIn())},[i]);const se=u.useCallback(async()=>{b(!0),g(null);try{await fe({force:!0}),o(i.isHubLoggedIn())}catch{o(i.isHubLoggedIn())}finally{b(!1)}},[i]),B=u.useCallback(()=>{const n=k.trim().replace(/^#/,"");n&&!x.includes(n)&&L(h=>[...h,n]),P("")},[k,x]),ae=u.useCallback(n=>{L(h=>h.filter(v=>v!==n))},[]),le=u.useCallback(n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),B()):n.key==="Backspace"&&!k&&x.length&&L(h=>h.slice(0,-1))},[B,k,x.length]),D=u.useCallback(()=>{const n=A?.url??e.shareUrl;n&&navigator.clipboard?.writeText(n).then(()=>{U(!0),setTimeout(()=>U(!1),1500)}).catch(()=>{})},[A,e.shareUrl]),ne=u.useCallback(async()=>{if(!he(e.format)){g(`分享仅支持 ${[...q].join(" / ")} 格式`);return}g(null),p("busy");try{const n=e.reference.replace(/[/\\]/g,"/").split("/").pop()||"deliverable",h=R.getUrl(),{content:v,fileBase64:ie,uploadedMedia:z}=await $e(e.reference,e.type,h);z&&console.info(`[deliverable-share] uploaded ${z} local media reference(s) to Hub`);const j=e.agentId??"";let O=j;if(j)try{const{agents:oe}=await N.agents.list({lean:!0}),K=oe.find(ce=>ce.id===j);K&&(O=K.name||j)}catch{}const w=await i.publish({localId:e.id,title:V.trim()||e.title,summary:E.trim(),tags:x,visibility:m,filename:n,format:e.format||"markdown",content:v,fileBase64:ie,producerAgent:{id:j,name:O,source:"local"}});y(w),w.status==="rejected"?g(typeof w.reason=="string"&&w.reason?w.reason:"分享被拒绝"):t()}catch(n){if(p("form"),n instanceof Q){o(!1);return}g(n instanceof S||n instanceof Error?n.message:String(n))}},[i,e,V,E,x,m,y]),_=u.useCallback(async()=>{g(null);try{const n=await i.revoke(e.id);y({...n,status:"revoked",url:null})}catch(n){g(n instanceof S?n.message:String(n))}},[i,e.id,y]),W=u.useCallback(()=>{p("form"),g(null)},[]);u.useEffect(()=>{if(f!=="pending_review")return;let n=!1;const h=setInterval(async()=>{try{const v=await i.pollStatus(e.id);if(n)return;v.status!=="pending_review"&&y(v)}catch{}},8e3);return()=>{n=!0,clearInterval(h)}},[f,i,e.id,y]),u.useEffect(()=>{const n=h=>{h.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]);const T=m==="link",$=A?.url??e.shareUrl;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:t,children:[r.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-md max-h-[85vh] overflow-y-auto",onClick:n=>n.stopPropagation(),children:[r.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-center justify-between rounded-t-2xl z-10",children:[r.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:s("deliverables:share.title",{defaultValue:"分享到 Markus Hub"})}),r.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors text-fg-tertiary hover:text-fg-primary",children:r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsx("div",{className:"px-5 py-4 space-y-4",children:c===!1?r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-amber-500/10 border border-amber-500/25 p-3",children:[r.jsx("span",{className:"text-lg",children:"🔑"}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.needHubLogin",{defaultValue:"需登录 Markus Hub 账号后才能分享产出物。"})})]}),r.jsx("button",{onClick:()=>{se()},disabled:d,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors disabled:opacity-60",children:d?s("deliverables:share.loggingIn",{defaultValue:"正在打开登录…"}):s("deliverables:share.loginHub",{defaultValue:"登录 Markus Hub 账号"})}),r.jsx("p",{className:"text-[11px] text-fg-tertiary",children:s("deliverables:share.loginHint",{defaultValue:"解锁后将支持一键公开/链接分享产出物。"})})]}):r.jsx(r.Fragment,{children:f==="published"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-green-500/15 text-green-500 font-medium",children:s("deliverables:share.published",{defaultValue:"已发布"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),$?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:$}),r.jsx("button",{onClick:D,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${H?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:H?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):r.jsx("p",{className:"text-xs text-fg-tertiary",children:s("deliverables:share.urlPending",{defaultValue:"链接生成中,稍后刷新查看…"})}),r.jsx("button",{onClick:()=>{_()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="pending_review"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-amber-500/15 text-amber-500 font-medium",children:s("deliverables:share.pendingReview",{defaultValue:"审核中"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.pendingHint",{defaultValue:"你的产出物已公开,其他人现在就能通过链接访问。管理员审核通过后,内容将进入搜索引擎收录。"})}),$?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:$}),r.jsx("button",{onClick:D,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${H?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:H?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):null,r.jsx("button",{onClick:()=>{_()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="rejected"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-red-500/15 text-red-500 font-medium",children:s("deliverables:share.rejected",{defaultValue:"已拒绝"})})}),I&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:I}),r.jsx("button",{onClick:W,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors",children:s("deliverables:share.resubmit",{defaultValue:"重新提交"})})]}):f==="revoked"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.revoked",{defaultValue:"已取消分享,该产出物不再公开可访问。"})}),r.jsx("button",{onClick:W,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors",children:s("deliverables:share.shareAgain",{defaultValue:"重新分享"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.visibility",{defaultValue:"可见性"})}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-border-default hover:bg-surface-elevated":"border-brand-500/50 bg-brand-500/5"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:!T,onChange:()=>M("public"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.public",{defaultValue:"公开(所有人可见 + 搜索引擎)"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.publicHint",{defaultValue:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索"})})]})]}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-brand-500/50 bg-brand-500/5":"border-border-default hover:bg-surface-elevated"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:T,onChange:()=>M("link"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.link",{defaultValue:"有链接可见"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.linkHint",{defaultValue:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核"})})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.titleField",{defaultValue:"标题"})}),r.jsx("input",{value:V,onChange:n=>ee(n.target.value),placeholder:s("deliverables:share.titlePlaceholder",{defaultValue:"清晰、可检索的标题"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.summary",{defaultValue:"摘要"})}),r.jsx("textarea",{value:E,onChange:n=>te(n.target.value),rows:3,placeholder:s("deliverables:share.summaryPlaceholder",{defaultValue:"简要描述该产出物…"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none resize-y"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.tags",{defaultValue:"标签"})}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:x.map(n=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-secondary",children:[n,r.jsx("button",{onClick:()=>ae(n),className:"text-fg-tertiary hover:text-red-500","aria-label":"remove",children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},n))}),r.jsx("input",{value:k,onChange:n=>P(n.target.value),onKeyDown:le,onBlur:B,placeholder:s("deliverables:share.tagsPlaceholder",{defaultValue:"输入标签后回车添加"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),I&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:I}),r.jsxs("button",{type:"button",onClick:()=>{ne()},disabled:f==="busy"||!V.trim(),className:"w-full px-3 py-2.5 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[f==="busy"&&r.jsxs("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),f==="busy"?s("deliverables:share.sharing",{defaultValue:"分享中…"}):s("deliverables:share.shareToHub",{defaultValue:"分享到 Hub"})]})]})})})]})]})}export{Ee as D,he as a,ye as c};
|
|
1
|
+
import{u as de,r as u,h as R,V as ue,$ as fe,k as N,j as r}from"./index-BHu6brRf.js";const G=50*1024*1024,q=new Set(["markdown","html"]);function be(e){return e||"markdown"}function he(e){return q.has(be(e))}class S extends Error{constructor(t){super(t),this.name="DeliverableShareError"}}class Q extends S{constructor(){super("需要登录 Markus Hub 账号后才能分享产出物。"),this.name="NotLoggedIntoHubError"}}class pe extends S{bytes;limit;constructor(t,a){super(`产出物文件大小 ${t} 字节超过上限 ${a} 字节(50MB),请压缩或拒绝分享。`),this.name="DeliverableTooLargeError",this.bytes=t,this.limit=a}}class me extends S{status;constructor(t,a){super(`Hub 请求失败 (HTTP ${t}): ${a}`),this.name="HubApiError",this.status=t}}function ge(e){const t=e.replace(/\s+/g,"");if(!t)return 0;let a=0;return t.endsWith("==")?a=2:t.endsWith("=")&&(a=1),Math.floor(t.length*3/4)-a}function C(e,t){const a=e&&typeof e=="object"?e:{},l=a.share??a.deliverable??{},s=m=>a[m]??l[m],i=s("id")??s("shareId")??"",c=s("slug"),o=c!=null?String(c):void 0,d=s("url")??s("shareUrl");let b=null;d!=null?b=String(d):o&&t&&(b=`${t.replace(/\/+$/,"")}/deliverable/${encodeURIComponent(o)}`);const f=s("reason")??s("rejectNote"),p=s("localDeliverableId")??s("localId");return{id:String(i),slug:o,visibility:s("visibility")??"public",status:s("status")??"pending_review",url:b,reason:f!=null?String(f):null,localId:p!=null?String(p):null}}class xe{basePath;fetchImpl;hubOrigin;constructor(t){this.getHubToken=t.getHubToken,this.hubOrigin=t.hubUrl,this.basePath=(t.proxyBasePath??"/api/hub").replace(/\/+$/,""),this.fetchImpl=t.fetch??(globalThis.fetch?globalThis.fetch.bind(globalThis):(()=>{throw new Error("fetch unavailable")}))}getHubToken;isHubLoggedIn(){return!!this.getHubToken()}assertHubLoggedIn(){if(!this.getHubToken())throw new Q}async doFetch(t,a){const l=this.getHubToken(),s={"Content-Type":"application/json",...a.headers};l&&(s.Authorization=`Bearer ${l}`);const i=await this.fetchImpl(`${this.basePath}${t}`,{...a,headers:s,credentials:"include"});let c=null;try{c=await i.json()}catch{c=null}if(!i.ok){const o=c&&typeof c=="object"&&"error"in c?String(c.error):i.statusText||`HTTP ${i.status}`;throw new me(i.status,o)}return{status:i.status,data:c}}async publish(t){this.assertHubLoggedIn();const a=t.fileSizeBytes??(t.fileBase64?ge(t.fileBase64):0);if(a>G)throw new pe(a,G);const l={localDeliverableId:t.localId,visibility:t.visibility,title:t.title,summary:t.summary,tags:t.tags,filename:t.filename,format:t.format,producerAgent:{id:t.producerAgent.id,name:t.producerAgent.name,source:t.producerAgent.source}};t.content&&(l.content=t.content),t.fileBase64&&(l.fileBase64=t.fileBase64);const{data:s}=await this.doFetch("/deliverables/publish",{method:"POST",body:JSON.stringify(l)});return C(s,this.hubOrigin)}async pollStatus(t){this.assertHubLoggedIn();const{data:a}=await this.doFetch(`/deliverables/status?localId=${encodeURIComponent(t)}`,{method:"GET"});return C(a,this.hubOrigin)}async listMine(){this.assertHubLoggedIn();const{data:t}=await this.doFetch("/deliverables/mine",{method:"GET"}),a=t&&typeof t=="object"?t:{};return(Array.isArray(a.shares)?a.shares:[]).map(s=>C(s,this.hubOrigin))}async revoke(t){this.assertHubLoggedIn();const{data:a}=await this.doFetch("/deliverables/revoke",{method:"POST",body:JSON.stringify({localId:t})});return{...C(a,this.hubOrigin),status:"revoked",url:null}}}function ye(e,t){return new xe({getHubToken:e,hubUrl:t,proxyBasePath:"/api/hub"})}const ve=/\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)$/i,ke=/\.(mp4|webm|mp3|wav|ogg|m4a|mov|avi|mkv|flac)$/i;function X(e){return ve.test(e)?"image":ke.test(e)?"media":"other"}function je(e){return e.replace(/^file:\/\//i,"").replace(/^file:/i,"")}function J(e){const t=e.match(/!?\[[^\]]*\]\(([^)]+)\)/);if(t)return t[1].trim().split(/\s+(?="|')/)[0].trim()||null;const a=e.match(/(?:src|href|poster)\s*=\s*["']([^"']+)["']/i);return a?a[1]:null}function Z(e){return!e||/^(https?:|data:|mailto:|tel:|#)/i.test(e)||e.startsWith("//")?!1:(e.startsWith("/api/files/"),!0)}function Y(e,t){if(!e)return null;const a=e.trim(),l=a.match(/^\/api\/files\/(?:image|stream|preview)\?path=([^&]+)/i);if(l)try{return decodeURIComponent(l[1])||null}catch{return l[1]||null}return/^file:\/\//i.test(a)?je(a).replace(/\\/g,"/"):/^[a-zA-Z]:[\\/]/.test(a)?a.replace(/\\/g,"/"):a.startsWith("/")?a:t&&(a.startsWith("./")||a.startsWith("../")||!a.includes("://"))?`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${a.replace(/^\.\//,"").replace(/\\/g,"/")}`:null}function we(e,t){const a=[],l=new Set,s=/!?\[[^\]]*\]\(([^)\s]+(?:\s+["'][^"']*["'])?)\)/g;for(const c of e.matchAll(s)){const o=c[0],d=J(o);if(!d||!Z(d))continue;const b=Y(d,t);!b||l.has(o)||(l.add(o),a.push({raw:o,localPath:b,kind:X(b.split("?")[0])}))}const i=/<[a-zA-Z][^>]*(?:src|href|poster)\s*=\s*["'][^"']+["'][^>]*>/gi;for(const c of e.matchAll(i)){const o=c[0],d=J(o);if(!d||!Z(d))continue;const b=Y(d,t);!b||l.has(o)||(l.add(o),a.push({raw:o,localPath:b,kind:X(b.split("?")[0])}))}return{refs:a,baseDir:t??""}}function Ne(e,t){let a=e;for(const[l,s]of t){const i=Se(l,s);a=a.split(l).join(i)}return a}function Se(e,t){const a=e.match(/^(!?\[[^\]]*\])\([^)]*\)$/);if(a)return`${a[1]}(${t})`;const l=e.match(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i);return l?e.replace(/(src|href|poster)(\s*=\s*)(["'])[^"']*\3/i,`${l[1]}${l[2]}${l[3]}${t}${l[3]}`):t}function Ve(e,t){return/^https?:\/\//i.test(e)?e:`${t.replace(/\/+$/,"")}${e.startsWith("/")?"":"/"}${e}`}function He(e,t,a){const l=new Map,s=new Map(e.map(i=>[i.localPath,i]));for(const i of t){if(!i.key)continue;const c=s.get(i.key);!c||!i.url||l.set(c.raw,Ve(i.url,a))}return l}async function Ie(e){try{const t=N.files.streamUrl(e),a=await fetch(t).then(d=>d.ok?d.blob():null);if(!a)return null;const l=await a.arrayBuffer(),s=new Uint8Array(l);let i="";const c=32768;for(let d=0;d<s.length;d+=c)i+=String.fromCharCode.apply(null,Array.from(s.subarray(d,d+c)));const o=e.split("/").pop()||"media";return{base64:btoa(i),filename:o}}catch{return null}}async function Te(e,t){const a=new Map;if(e.length===0)return a;const l=[];for(const c of e){const o=await Ie(c.localPath);o&&l.push({key:c.localPath,filename:o.filename,base64:o.base64})}if(l.length===0)return a;const{files:s,errors:i}=await R.uploadMediaBatch(l);return i.length>0&&console.warn("[deliverable-share] media upload errors:",i),He(e,s,t)}async function $e(e,t,a){if(!e||t==="directory"||e.startsWith("http://")||e.startsWith("https://"))return{};try{const l=await N.files.preview(e);if((l.type==="text"||l.type==="markdown"||l.type==="html"||l.type==="json"||l.type==="csv")&&typeof l.content=="string"){if(!(l.type==="markdown"||l.type==="html"))return{content:l.content};const i=e.replace(/[/\\]/g,"/").split("/").slice(0,-1).join("/"),{refs:c}=we(l.content,i);if(c.length===0)return{content:l.content};const o=await Te(c,a);return o.size===0?{content:l.content}:{content:Ne(l.content,o),uploadedMedia:o.size}}if(l.type==="image"||l.type==="audio"||l.type==="video"||l.type==="binary"){const s=l.streamUrl||(l.path?N.files.streamUrl(l.path):N.files.streamUrl(e)),c=await(await fetch(s).then(f=>f.blob())).arrayBuffer(),o=new Uint8Array(c);let d="";const b=32768;for(let f=0;f<o.length;f+=b)d+=String.fromCharCode.apply(null,Array.from(o.subarray(f,f+b)));return{fileBase64:btoa(d)}}return{}}catch{return{}}}function Ee({item:e,onClose:t,onShared:a,service:l}){const{t:s}=de(["deliverables","common"]),i=u.useMemo(()=>l??ye(ue,R.getUrl()),[l]),[c,o]=u.useState(()=>i?i.isHubLoggedIn():null),[d,b]=u.useState(!1),[f,p]=u.useState(()=>{const n=e.shareStatus;return n==="published"?"published":n==="pending_review"?"pending_review":n==="rejected"?"rejected":"form"}),[m,M]=u.useState("public"),[V,ee]=u.useState(e.title||""),[E,te]=u.useState(e.summary||""),[x,L]=u.useState(Array.isArray(e.tags)?[...e.tags]:[]),[k,P]=u.useState(""),[A,re]=u.useState(null),[H,U]=u.useState(!1),[I,g]=u.useState(null),F=u.useRef(a);F.current=a;const y=u.useCallback(n=>{re(n);const h=n.status;p(h==="published"?"published":h==="rejected"?"rejected":h==="revoked"?"revoked":h==="pending_review"?"pending_review":"form"),F.current?.(n)},[]);u.useEffect(()=>{o(i.isHubLoggedIn())},[i]);const se=u.useCallback(async()=>{b(!0),g(null);try{await fe({force:!0}),o(i.isHubLoggedIn())}catch{o(i.isHubLoggedIn())}finally{b(!1)}},[i]),B=u.useCallback(()=>{const n=k.trim().replace(/^#/,"");n&&!x.includes(n)&&L(h=>[...h,n]),P("")},[k,x]),ae=u.useCallback(n=>{L(h=>h.filter(v=>v!==n))},[]),le=u.useCallback(n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),B()):n.key==="Backspace"&&!k&&x.length&&L(h=>h.slice(0,-1))},[B,k,x.length]),D=u.useCallback(()=>{const n=A?.url??e.shareUrl;n&&navigator.clipboard?.writeText(n).then(()=>{U(!0),setTimeout(()=>U(!1),1500)}).catch(()=>{})},[A,e.shareUrl]),ne=u.useCallback(async()=>{if(!he(e.format)){g(`分享仅支持 ${[...q].join(" / ")} 格式`);return}g(null),p("busy");try{const n=e.reference.replace(/[/\\]/g,"/").split("/").pop()||"deliverable",h=R.getUrl(),{content:v,fileBase64:ie,uploadedMedia:z}=await $e(e.reference,e.type,h);z&&console.info(`[deliverable-share] uploaded ${z} local media reference(s) to Hub`);const j=e.agentId??"";let O=j;if(j)try{const{agents:oe}=await N.agents.list({lean:!0}),K=oe.find(ce=>ce.id===j);K&&(O=K.name||j)}catch{}const w=await i.publish({localId:e.id,title:V.trim()||e.title,summary:E.trim(),tags:x,visibility:m,filename:n,format:e.format||"markdown",content:v,fileBase64:ie,producerAgent:{id:j,name:O,source:"local"}});y(w),w.status==="rejected"?g(typeof w.reason=="string"&&w.reason?w.reason:"分享被拒绝"):t()}catch(n){if(p("form"),n instanceof Q){o(!1);return}g(n instanceof S||n instanceof Error?n.message:String(n))}},[i,e,V,E,x,m,y]),_=u.useCallback(async()=>{g(null);try{const n=await i.revoke(e.id);y({...n,status:"revoked",url:null})}catch(n){g(n instanceof S?n.message:String(n))}},[i,e.id,y]),W=u.useCallback(()=>{p("form"),g(null)},[]);u.useEffect(()=>{if(f!=="pending_review")return;let n=!1;const h=setInterval(async()=>{try{const v=await i.pollStatus(e.id);if(n)return;v.status!=="pending_review"&&y(v)}catch{}},8e3);return()=>{n=!0,clearInterval(h)}},[f,i,e.id,y]),u.useEffect(()=>{const n=h=>{h.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]);const T=m==="link",$=A?.url??e.shareUrl;return r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:t,children:[r.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),r.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-md max-h-[85vh] overflow-y-auto",onClick:n=>n.stopPropagation(),children:[r.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-center justify-between rounded-t-2xl z-10",children:[r.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:s("deliverables:share.title",{defaultValue:"分享到 Markus Hub"})}),r.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors text-fg-tertiary hover:text-fg-primary",children:r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r.jsx("div",{className:"px-5 py-4 space-y-4",children:c===!1?r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-amber-500/10 border border-amber-500/25 p-3",children:[r.jsx("span",{className:"text-lg",children:"🔑"}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.needHubLogin",{defaultValue:"需登录 Markus Hub 账号后才能分享产出物。"})})]}),r.jsx("button",{onClick:()=>{se()},disabled:d,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors disabled:opacity-60",children:d?s("deliverables:share.loggingIn",{defaultValue:"正在打开登录…"}):s("deliverables:share.loginHub",{defaultValue:"登录 Markus Hub 账号"})}),r.jsx("p",{className:"text-[11px] text-fg-tertiary",children:s("deliverables:share.loginHint",{defaultValue:"解锁后将支持一键公开/链接分享产出物。"})})]}):r.jsx(r.Fragment,{children:f==="published"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-green-500/15 text-green-500 font-medium",children:s("deliverables:share.published",{defaultValue:"已发布"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),$?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:$}),r.jsx("button",{onClick:D,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${H?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:H?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):r.jsx("p",{className:"text-xs text-fg-tertiary",children:s("deliverables:share.urlPending",{defaultValue:"链接生成中,稍后刷新查看…"})}),r.jsx("button",{onClick:()=>{_()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="pending_review"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-amber-500/15 text-amber-500 font-medium",children:s("deliverables:share.pendingReview",{defaultValue:"审核中"})}),r.jsx("span",{className:"text-[11px] text-fg-tertiary",children:m==="link"?s("deliverables:share.linkVisibility",{defaultValue:"有链接可见"}):s("deliverables:share.publicVisibility",{defaultValue:"公开"})})]}),r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.pendingHint",{defaultValue:"你的产出物已公开,其他人现在就能通过链接访问。管理员审核通过后,内容将进入搜索引擎收录。"})}),$?r.jsxs("div",{className:"flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:$}),r.jsx("button",{onClick:D,className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${H?"bg-green-500/20 text-green-500":"bg-brand-600/20 text-brand-500 hover:bg-brand-600/30"}`,children:H?s("common:copied",{defaultValue:"已复制"}):s("common:copy",{defaultValue:"复制链接"})})]}):null,r.jsx("button",{onClick:()=>{_()},className:"w-full px-3 py-2 text-xs font-medium rounded-lg text-red-500 border border-red-500/30 hover:bg-red-500/10 transition-colors",children:s("deliverables:share.revoke",{defaultValue:"取消分享"})})]}):f==="rejected"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"px-2 py-0.5 text-[11px] rounded-full bg-red-500/15 text-red-500 font-medium",children:s("deliverables:share.rejected",{defaultValue:"已拒绝"})})}),I&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:I}),r.jsx("button",{onClick:W,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors",children:s("deliverables:share.resubmit",{defaultValue:"重新提交"})})]}):f==="revoked"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-fg-secondary",children:s("deliverables:share.revoked",{defaultValue:"已取消分享,该产出物不再公开可访问。"})}),r.jsx("button",{onClick:W,className:"w-full px-3 py-2 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors",children:s("deliverables:share.shareAgain",{defaultValue:"重新分享"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.visibility",{defaultValue:"可见性"})}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-border-default hover:bg-surface-elevated":"border-brand-500/50 bg-brand-500/5"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:!T,onChange:()=>M("public"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.public",{defaultValue:"公开(所有人可见 + 搜索引擎)"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.publicHint",{defaultValue:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索"})})]})]}),r.jsxs("label",{className:`flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors ${T?"border-brand-500/50 bg-brand-500/5":"border-border-default hover:bg-surface-elevated"}`,children:[r.jsx("input",{type:"radio",name:"visibility",checked:T,onChange:()=>M("link"),className:"mt-0.5 accent-brand-500"}),r.jsxs("span",{className:"space-y-0.5",children:[r.jsx("span",{className:"block text-sm font-medium text-fg-primary",children:s("deliverables:share.link",{defaultValue:"有链接可见"})}),r.jsx("span",{className:"block text-[11px] text-fg-tertiary",children:s("deliverables:share.linkHint",{defaultValue:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核"})})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.titleField",{defaultValue:"标题"})}),r.jsx("input",{value:V,onChange:n=>ee(n.target.value),placeholder:s("deliverables:share.titlePlaceholder",{defaultValue:"清晰、可检索的标题"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.summary",{defaultValue:"摘要"})}),r.jsx("textarea",{value:E,onChange:n=>te(n.target.value),rows:3,placeholder:s("deliverables:share.summaryPlaceholder",{defaultValue:"简要描述该产出物…"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none resize-y"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:s("deliverables:share.tags",{defaultValue:"标签"})}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:x.map(n=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-secondary",children:[n,r.jsx("button",{onClick:()=>ae(n),className:"text-fg-tertiary hover:text-red-500","aria-label":"remove",children:r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},n))}),r.jsx("input",{value:k,onChange:n=>P(n.target.value),onKeyDown:le,onBlur:B,placeholder:s("deliverables:share.tagsPlaceholder",{defaultValue:"输入标签后回车添加"}),className:"w-full px-3 py-2 text-sm rounded-lg bg-surface-elevated border border-border-default focus:border-brand-500/60 outline-none"})]}),I&&r.jsx("div",{className:"rounded-lg bg-red-500/10 border border-red-500/25 px-3 py-2 text-xs text-red-500",children:I}),r.jsxs("button",{type:"button",onClick:()=>{ne()},disabled:f==="busy"||!V.trim(),className:"w-full px-3 py-2.5 text-sm font-medium rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 transition-colors disabled:opacity-60 flex items-center justify-center gap-2",children:[f==="busy"&&r.jsxs("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),r.jsx("path",{d:"M22 12a10 10 0 0 0-10-10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),f==="busy"?s("deliverables:share.sharing",{defaultValue:"分享中…"}):s("deliverables:share.shareToHub",{defaultValue:"分享到 Hub"})]})]})})})]})]})}export{Ee as D,he as a,ye as c};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{u as Qe,j as e,r as a,a as Bs,b as As,Q as Ms,R as ns,c as $s,k as h,U as wt,V as as,W as Ds,P as I,n as J,X as Vs,Y as Fs,Z as Hs,h as Ws,i as ls,N as _s}from"./index-BHu6brRf.js";import{MarkdownMessage as Nt}from"./MarkdownMessage-DwxvYN4X.js";import{resolveFormat as Us,ContentRenderer as Os}from"./ContentRenderer-DxgRNOd1.js";import{c as Ks,a as zs,D as Gs}from"./DeliverableShareModal-DU0PupsS.js";import{S as Ys,s as qs}from"./SendToChat-13m2h7gu.js";import"./chatChips-DVIRVTpT.js";function M(o){return Array.isArray(o)?o.map(d=>String(d).trim()).filter(Boolean):typeof o=="string"&&o?o.split(",").map(d=>d.trim()).filter(Boolean):[]}function Qs(o){return o.files&&typeof o.files=="object"&&!Array.isArray(o.files)?o.files:null}function ee({label:o,value:d}){return d?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:d})]}):null}function xe({label:o,value:d,color:u}){if(!d)return null;const s={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:o}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${s[u]??s.gray} capitalize inline-block`,children:d})]})}function St({files:o}){const{t:d}=Qe(["builder","common"]),[u,s]=a.useState(Object.keys(o)[0]??""),c=Object.keys(o);return c.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d("builder:artifact.files",{count:c.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:c.map(b=>e.jsx("button",{onClick:()=>s(b),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${u===b?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:b},b))}),u&&o[u]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:o[u]})]})]})}function Xs({artifact:o,mode:d}){const{t:u}=Qe(["builder","common"]),s=Qs(o),c=o.agent,b=o.team,S=o.dependencies,w=o.displayName??o.name;if(d==="agent"){const j=c?.roleName,P=c?.agentRole,k=c?.llmProvider,R=c?.llmModel,g=M(S?.env),E=M(S?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[j&&e.jsx(xe,{label:u("builder:artifact.baseTemplate"),value:j,color:"indigo"}),e.jsx(xe,{label:u("builder:artifact.agentRole"),value:P,color:P==="manager"?"purple":"cyan"})]}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:N},N))}),(k||R)&&e.jsxs("div",{className:"flex gap-2",children:[k&&e.jsx(xe,{label:u("builder:artifact.llmProvider"),value:k,color:"gray"}),R&&e.jsx(xe,{label:u("builder:artifact.llmModel"),value:R,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:N},N))})]}),E.length>0&&e.jsx(ee,{label:u("builder:artifact.skills"),value:E.join(", ")}),s&&e.jsx(St,{files:s})]})}if(d==="team"){const P=b?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.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))}),s&&e.jsx(St,{files:s}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.members",{count:P.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:P.map((k,R)=>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"?"★":R+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)]})]}),M(k.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:M(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))})]},R))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),s&&e.jsx(St,{files:s}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.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))})]})}function is(o){const d=document.scrollingElement,s=!!o&&o.scrollHeight>o.clientHeight+1?o:d,c=s?.scrollTop??0,b=s?.clientHeight??window.innerHeight,S=s?.scrollHeight??document.body.scrollHeight;return{scrollTop:c,clientHeight:b,scrollHeight:S,atTop:c<=0,atBottom:c+b>=S-1}}const fe={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Zs=["file","directory"];function qe(o){return/^https?:\/\//i.test(o)}function L(o){return o?.shareStatus??null}function Js(o,d){const u=Date.now(),s=new Date(o).getTime(),c=u-s,b=Math.floor(c/6e4);if(b<1)return d("time.justNow");if(b<60)return d("time.minutesAgo",{count:b});const S=Math.floor(b/60);if(S<24)return d("time.hoursAgo",{count:S});const w=Math.floor(S/24);if(w===1)return d("time.yesterday");if(w<30)return d("time.daysAgo",{count:w});const j=Math.floor(w/30);return j<12?d("time.monthsAgo",{count:j}):d("time.yearsAgo",{count:Math.floor(j/12)})}function Ct(o){const d=o.title?.trim()||o.id;return{kind:"deliverable",label:`📄 ${qs(d)}`,content:["[deliverable]",`ID: ${o.id}`,`Title: ${o.title??""}`,o.reference?`Reference: ${o.reference}`:"",o.taskId?`Task: ${o.taskId}`:"",o.projectId?`Project: ${o.projectId}`:""].filter(Boolean).join(`
|
|
2
|
+
`)}}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 ir({authUser:o,previewMode:d,previewData:u}={}){const{t:s}=Qe(["deliverables","common"]),c=Bs(),b=As(I.DELIVERABLES),S=Ms({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[w,j]=a.useState(!1),P=a.useRef(w);P.current=w,a.useEffect(()=>(ns(I.DELIVERABLES,c&&w?1:0),()=>ns(I.DELIVERABLES,0)),[c,w]),a.useEffect(()=>{if(!c)return;const t=()=>{P.current&&j(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[c]);const k=20,R=60,[g,E]=a.useState(u?.items??[]),[N,D]=a.useState(u?.items?.length??0),[m,te]=a.useState(!1),[Xe,It]=a.useState(u?.projects??[]),[Ze,Lt]=a.useState(u?.agents??[]),[cs,ds]=a.useState([]),[us,Rt]=a.useState(!1),[Et,xs]=a.useState([]),[me,Pt]=a.useState(!u),[Pe,Te]=a.useState(""),[pe,Be]=a.useState(""),[V,ge]=a.useState(""),[F,be]=a.useState(""),[H,W]=a.useState(""),[se,Ae]=a.useState(""),[fs,Je]=a.useState(!1),[$,hs]=a.useState("date"),[n,T]=a.useState(()=>u?.initialSelectedId&&u.items?u.items.find(t=>t.id===u.initialSelectedId)??u.items[0]??null:u?.items?.[0]??null),[et,Tt]=a.useState(null),[Bt,At]=a.useState(""),[re,ms]=a.useState(!0),[Mt,ye]=a.useState(()=>{const t=new Date,r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([r])}),[tt,ps]=a.useState(!1),[st,$t]=a.useState(!1),Me=a.useRef(null),[$e,ne]=a.useState(null),[De,Dt]=a.useState("markdown"),[ve,rt]=a.useState(null),[je,nt]=a.useState(null),[ae,at]=a.useState(null),[G,ke]=a.useState(null),[lt,le]=a.useState(!1),[Vt,Y]=a.useState(!1),[we,Ft]=a.useState(!1),[Ht,Ve]=a.useState(null),[it,Fe]=a.useState(null),[ot,He]=a.useState(null),[gs,ct]=a.useState(!1),[dt,bs]=a.useState(""),[Wt,ys]=a.useState(new Set),_t=ae&&n?.type==="file",We=_t||!!G&&n?.type==="directory",[_,q]=a.useState(!1),A=$s(),ie=A?.keyboardPane??"content",[Ne,oe]=a.useState(null),[ce,Q]=a.useState(!1),[Se,ut]=a.useState(""),[U,X]=a.useState(!1),[xt,Ut]=a.useState(!1),[ft,Z]=a.useState(null),ht=a.useRef(null),Ot=a.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),Kt=a.useRef(void 0);a.useEffect(()=>{Ot(ht.current)},[Se,ce,Ot]);const B=(t,r)=>{Tt({type:t,text:r}),setTimeout(()=>Tt(null),3e3)},_e=async t=>{await _s(t)?(Ft(!0),setTimeout(()=>Ft(!1),1500)):B("error",s("detail.copyFailed"))},Ue=a.useMemo(()=>new Map(Ze.map(t=>[t.id,t])),[Ze]),mt=a.useMemo(()=>new Map(Xe.map(t=>[t.id,t])),[Xe]),zt=a.useMemo(()=>new Map(Et.map(t=>[t.id,t])),[Et]),Ce=a.useCallback(t=>{if(!t||t==="default")return null;const r=mt.get(t)?.name;return!r||r==="default"?null:r},[mt]);a.useEffect(()=>{d||(h.projects.list().then(t=>It(t.projects)).catch(()=>{}),h.agents.list().then(t=>Lt(t.agents??[])).catch(()=>{}),h.users.list().then(t=>ds(t.users??[])).catch(()=>{}),h.teams.list().then(t=>xs(t.teams??[])).catch(()=>{}),h.system.info().then(t=>bs(t.dataDir+"/shared")).catch(()=>{}),h.deliverables.checkHealth().then(t=>ys(new Set(t.missingFiles))).catch(()=>{}))},[d]),a.useEffect(()=>(Kt.current=setTimeout(()=>Be(Pe),300),()=>clearTimeout(Kt.current)),[Pe]);const de=a.useMemo(()=>({q:pe||void 0,projectId:se||void 0,type:V||void 0,artifactType:F||void 0,source:H||void 0}),[pe,V,F,se,H]),ue=$==="date"?k:R,pt=a.useCallback((t,r)=>r?{...r,hubShareId:r.hubShareId!=null?r.hubShareId:t.hubShareId??null,shareStatus:r.shareStatus!=null?r.shareStatus:t.shareStatus??null,shareUrl:r.shareUrl!=null?r.shareUrl:t.shareUrl??null,shareVisibility:r.shareVisibility!=null?r.shareVisibility:t.shareVisibility??null,shareReason:r.shareReason!=null?r.shareReason:t.shareReason}:t,[]),Oe=a.useCallback(async()=>{try{const{results:t,total:r}=await h.deliverables.search({...de,offset:0,limit:ue});E(i=>i.map(l=>{const f=t.find(x=>x.id===l.id);return f?pt(l,f):l})),D(r),T(i=>{if(!i)return null;const l=t.find(f=>f.id===i.id);return l?pt(i,l):i})}catch{}},[de,ue,pt]),O=a.useCallback(async()=>{Pt(!0),Me.current?.scrollTo({top:0,behavior:"instant"}),window.scrollY>0&&window.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:r}=await h.deliverables.search({...de,offset:0,limit:ue});E(t),D(r),T(i=>i&&t.some(l=>l.id===i.id)?i:null)}catch{E([]),D(0),T(null)}Pt(!1)},[de,ue]),vs=a.useCallback(async()=>{if(!(m||g.length>=N)){te(!0);try{const{results:t,total:r}=await h.deliverables.search({...de,offset:g.length,limit:ue});E(i=>[...i,...t]),D(r)}catch{}te(!1)}},[de,ue,g.length,N,m]);a.useEffect(()=>{d||O()},[O,d]),a.useEffect(()=>{!d||!u||(E(u.items??[]),D(u.items?.length??0),It(u.projects??[]),Lt(u.agents??[]),u.initialSelectedId&&T(u.items?.find(t=>t.id===u.initialSelectedId)??u.items?.[0]??null))},[d,u]);const gt=a.useRef(n);gt.current=n,a.useEffect(()=>{if(d||!b)return;const t=wt.on("deliverable:created",()=>O()),r=wt.on("deliverable:updated",l=>{Oe();const f=l.payload?.deliverableId;f&>.current?.id===f&&h.deliverables.get(f).then(x=>{x.deliverable&&(T(p=>({...p??x.deliverable,...x.deliverable,hubShareId:p?.hubShareId??x.deliverable.hubShareId??null,shareStatus:p?.shareStatus??x.deliverable.shareStatus??null,shareUrl:p?.shareUrl??x.deliverable.shareUrl??null,shareVisibility:p?.shareVisibility??x.deliverable.shareVisibility??null,shareReason:p?.shareReason??x.deliverable.shareReason??null})),Yt(x.deliverable))}).catch(()=>{})}),i=wt.on("deliverable:removed",()=>O());return()=>{t(),r(),i()}},[Oe,b,d]);const Gt=a.useMemo(()=>Ks(as,Ws.getUrl()),[]);a.useEffect(()=>{if(d||!b||!as())return;let t=!1;const r=async()=>{try{const l=await Gt.listMine();if(t)return;const f=new Map,x=new Map;for(const v of l)v.id&&f.set(v.id,v),v.localId&&x.set(v.localId,v);const p=new Map;E(v=>v.map(y=>{const C=y.hubShareId&&f.get(y.hubShareId)||x.get(y.id);if(!C)return y;const Ee={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 p.set(y.id,Ee),{...y,...Ee}})),T(v=>{if(!v)return v;const y=p.get(v.id);return y?{...v,...y}:v});for(const[v,y]of p)h.deliverables.update(v,y).catch(C=>{console.warn("[deliverables] Hub 分享状态本地持久化失败:",C)})}catch{}};r();const i=setInterval(r,3e4);return()=>{t=!0,clearInterval(i)}},[Gt,b,d]);const Ke=a.useRef(null),bt=a.useRef(g);bt.current=g;const Ie=a.useCallback(t=>{const r=l=>{T(l),c&&(j(!0),history.pushState({mobileDetail:I.DELIVERABLES},"",window.location.hash))},i=bt.current.find(l=>l.id===t);if(i){r(i);return}h.deliverables.get(t).then(l=>{l.deliverable&&r(l.deliverable)}).catch(()=>{})},[c]);a.useEffect(()=>{if(d)return;const t=window.location.hash.slice(1).split("/"),r=Ds(t[0])===I.DELIVERABLES?t[1]:void 0,i=localStorage.getItem("markus_nav_projectId"),l=localStorage.getItem("markus_nav_source");i&&(localStorage.removeItem("markus_nav_projectId"),Ae(i)),(l==="knowledge"||l==="agent")&&(localStorage.removeItem("markus_nav_source"),W(l));const f=localStorage.getItem("markus_nav_openDeliverable")||r;f&&(localStorage.removeItem("markus_nav_openDeliverable"),bt.current.length>0?Ie(f):Ke.current=f);const x=p=>{const y=p.detail?.params;y?.projectId&&Ae(y.projectId),(y?.source==="knowledge"||y?.source==="agent")&&W(y.source),y?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),Ie(y.openDeliverable))};return window.addEventListener("markus:navigate",x),()=>window.removeEventListener("markus:navigate",x)},[Ie,d]),a.useEffect(()=>{const t=Ke.current;!t||g.length===0||(Ke.current=null,Ie(t))},[g,Ie]);const K=a.useMemo(()=>{const t=new Map;for(const i of g){let l,f;if($==="project"){const x=Ce(i.projectId);l=x?i.projectId??"_none":"_none",f=x??s("noProject")}else if($==="team"){const p=(i.agentId?Ue.get(i.agentId):void 0)?.teamId??"_none";l=p,f=p!=="_none"?zt.get(p)?.name??p:s("noTeam")}else if($==="agent")l=i.agentId??"_none",f=i.agentId?Ue.get(i.agentId)?.name??i.agentId:s("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 r=[...t.entries()];return $==="date"?r.sort((i,l)=>l[0].localeCompare(i[0])):r.sort((i,l)=>i[1].label.localeCompare(l[1].label)),r},[g,$,mt,Ue,zt,s]);a.useEffect(()=>{if($==="date"&&re){const t=new Date,r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;ye(new Set([r]))}else ye(new Set)},[$]);const js=async t=>{At("remove");try{await h.deliverables.remove(t.id),B("success",s("removed")),T(null),O()}catch(r){B("error",s("common:error",{message:String(r)}))}At("")},ks=a.useCallback(t=>{const r=gt.current,i=r?.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??r?.shareReason??null}:{}},f={...l,shareStatus:l.shareStatus??r?.shareStatus??null};T(x=>x&&x.id===i?{...x,...f}:x),E(x=>x.map(p=>p.id===i?{...p,...f}:p)),(async()=>{try{await h.deliverables.update(i,l)}catch(x){console.warn("[deliverables] 分享状态本地回写失败,将由 Hub 轮询补偿:",x)}Oe()})()},[Oe]),ws=()=>{J.navigate(I.BUILDER)},Le=a.useCallback(async(t,r,i)=>{if(t.type==="directory"&&Array.isArray(t.entries))ke({path:t.path,name:t.name,entries:t.entries});else if(t.type==="image"&&t.mimeType){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));rt({src:l,name:t.name})}else if(t.type==="audio"||t.type==="video"){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));nt({kind:t.type,src:l,name:t.name})}else if(t.type==="office"){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));at({format:t.format||String(t.extension||"").replace(/^\./,"")||"pdf",streamUrl:l,name:t.name,size:t.size,reference:t.path||r})}else t.type==="binary"?Y(!0):typeof t.content=="string"?(ne(t.content),Dt(Us({format:i,reference:r,content:t.content}))):Y(!0)},[]),yt=a.useCallback(async t=>{le(!0),ne(null),rt(null),nt(null),at(null),Y(!1),ke(null),Ve(null),Fe(null);try{const r=await h.files.preview(t);r.type==="directory"&&Array.isArray(r.entries)?ke({path:r.path,name:r.name,entries:r.entries}):await Le(r,t)}catch{Y(!0)}le(!1)},[Le]),Ns=a.useCallback(async(t,r)=>{le(!0),Ve(r??null),Fe(t),ke(null);try{const i=await h.files.preview(t);await Le(i,t)}catch{ne(null),Y(!0)}le(!1)},[Le]),Yt=async t=>{if(t.reference&&!qe(t.reference)){if(t.type==="directory"){yt(t.reference);return}le(!0);try{const r=await h.files.preview(t.reference);await Le(r,t.reference,t.format)}catch{ne(null),t.type==="file"&&Y(!0)}le(!1)}};a.useEffect(()=>{d||(ne(null),Dt("markdown"),rt(null),nt(null),at(null),ke(null),Y(!1),Ve(null),Fe(null),n&&Yt(n))},[n?.id,d]);const qt=a.useCallback(t=>re!==Mt.has(t),[re,Mt]),Qt=K.length>0&&K.every(([t])=>qt(t)),Ss=a.useCallback(t=>{ye(r=>{const i=new Set(r);return i.has(t)?i.delete(t):i.add(t),i})},[]),Xt=a.useCallback(t=>{ye(r=>{if(r.has(t)===re)return r;const i=new Set(r);return re?i.add(t):i.delete(t),i})},[re]),Cs=a.useCallback(()=>{ms(t=>!t),ye(new Set)},[]),ze=!!(V||F||H||se||pe),Zt=a.useCallback(()=>{ge(""),be(""),W(""),Ae(""),Te(""),Be("")},[]),Re=a.useMemo(()=>K.flatMap(([,t])=>t.items),[K]);a.useEffect(()=>{d||c||me||n||Ke.current||Re.length!==0&&T(Re[0])},[d,c,me,n,Re]);const vt=a.useRef(null);a.useEffect(()=>{if(!n){vt.current=null;return}if(vt.current===n.id)return;const t=K.find(([,r])=>r.items.some(i=>i.id===n.id));t&&(vt.current=n.id,Xt(t[0]))},[n?.id,K,Xt]);const Jt=a.useRef(null),es=a.useRef(null),Ge=a.useRef(!1),ts=a.useRef(ie);a.useEffect(()=>{if(d||c||!b)return;const t=ts.current;ts.current=ie,!(ie!=="l1"||t==="l1")&&_&&(Ge.current=!0,q(!1))},[ie,d,c,b,_]),a.useEffect(()=>{if(d||c||!b)return;const t=r=>{if(r.metaKey||r.ctrlKey){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement){r.key==="Escape"&&(r.target.blur(),r.preventDefault());return}if(ls(r.target))return;if(r.key==="f"){r.preventDefault(),Jt.current?.focus();return}if(r.key.toLowerCase()==="b"){r.preventDefault(),q(C=>{const Ee=!C;return Ee&&(Ge.current=!0,A?.setKeyboardPane("l1"),requestAnimationFrame(()=>es.current?.focus())),Ee});return}if(r.key.toLowerCase()==="l"){r.preventDefault(),kt();return}return r.altKey,void 0}if(A?.keyboardPane==="l0")return;if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement){r.key==="Escape"&&(r.target.blur(),r.preventDefault());return}if(ls(r.target)||r.metaKey||r.ctrlKey||r.altKey)return;const l=r.key.length===1?r.key.toLowerCase():r.key;if(l==="h"||l==="ArrowLeft"){r.preventDefault(),_&&q(!1),A?.setL0FocusPageId(I.DELIVERABLES),A?.setLeftCollapsed(!1),A?.setKeyboardPane("l0");return}if(l==="l"||l==="ArrowRight"){r.preventDefault(),_&&q(!1),A?.keyboardPane!=="l1"&&A?.setKeyboardPane("l1");return}const f=l==="j"||l==="ArrowDown"?1:l==="k"||l==="ArrowUp"?-1:0;if(!f)return;r.preventDefault(),A?.setKeyboardPane("l1"),_&&(Ge.current=!0,q(!1));const x=Re;if(x.length===0)return;const p=n?x.findIndex(C=>C.id===n.id):-1,v=p<0?f>0?-1:0:p,y=Math.max(0,Math.min(x.length-1,v+f));ss(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)},[Re,n,d,c,b,A,_]);const Ye=a.useRef(null),Is=a.useCallback(t=>{if(!c||!is(Me.current).atTop)return;const r=t.touches[0];r&&(Ye.current={y:r.clientY,x:r.clientX})},[c]),Ls=a.useCallback(t=>{if(!c||!Ye.current||st)return;const r=t.changedTouches[0],i=Ye.current;if(Ye.current=null,!r)return;const l=r.clientY-i.y,f=Math.abs(r.clientX-i.x);l<72||f>l||is(Me.current).atTop&&($t(!0),O().finally(()=>$t(!1)))},[c,st,O]),ss=t=>{const r=()=>{T(t),ct(!1),Q(!1),X(!1),c&&(j(!0),history.pushState({mobileDetail:I.DELIVERABLES},"",window.location.hash))};U?Z({action:r}):r()},Rs=()=>{if(!U){const t=$e??n?.summary??"";ut(t)}Q(!0)},Es=()=>{U?Z({action:()=>{Q(!1),X(!1)}}):Q(!1)},rs=async()=>{if(!(!n?.reference||xt)){Ut(!0);try{await h.files.write(n.reference,Se),ne(Se),X(!1),Q(!1),B("success",s("detail.saved"))}catch(t){B("error",s("detail.saveFailed")+": "+String(t))}Ut(!1)}},Ps=()=>{Q(!1),X(!1),Z(null)};a.useEffect(()=>{if(!U)return;const t=r=>{r.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[U]),a.useEffect(()=>{if(!U)return;const t=r=>{r.preventDefault(),r.stopImmediatePropagation(),Z({action:()=>{Q(!1),X(!1);const{page:i,params:l}=r.detail||{};i&&J.navigate(i,l)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[U]);const jt=a.useRef(null),kt=a.useCallback((t,r)=>{const i=n?.agentId??"",l=n?.id??"",f={};l&&(f.openDeliverable=l);const x=[];if(n&&x.push(Ct(n)),t?.trim()){const p=t.trim().length>40?`${t.trim().slice(0,24)}…${t.trim().slice(-12)}`:t.trim();if(r){const v=n?.reference??"";x.push({label:`🌐 ${p}`,content:["[html-selection]",`Text: "${t.trim()}"`,`CSS Selector: ${r.cssSelector}`,`XPath: ${r.xpath}`,v?`File: ${v}`:""].filter(Boolean).join(`
|
|
3
|
+
`)})}else x.push({label:`📝 ${p}`,content:t.trim()})}x.length>0&&(f.chatChips=JSON.stringify(x)),i&&(f.agentId=i),oe(null),window.getSelection()?.removeAllRanges(),J.navigate(I.TEAM,f)},[n]),Ts=a.useCallback(t=>{if(!t.text.trim())return;const i=jt.current?.querySelector("iframe")?.getBoundingClientRect(),l=(i?.left??0)+t.rect.x+t.rect.width/2,f=(i?.top??0)+t.rect.y;oe({x:l,y:f,text:t.text,htmlMeta:{xpath:t.xpath,cssSelector:t.cssSelector}})},[]);return a.useEffect(()=>{const t=jt.current;if(!t)return;const r=()=>{requestAnimationFrame(()=>{const l=window.getSelection(),f=l?.toString().trim();if(!f||!l?.rangeCount){oe(null);return}const x=l.getRangeAt(0);if(!t.contains(x.commonAncestorContainer)){oe(null);return}const p=x.getBoundingClientRect();oe({x:p.left+p.width/2,y:p.top,text:f})})},i=l=>{const f=document.getElementById("selection-toolbar");f&&f.contains(l.target)||oe(null)};return t.addEventListener("mouseup",r),document.addEventListener("mousedown",i),()=>{t.removeEventListener("mouseup",r),document.removeEventListener("mousedown",i)}},[]),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{ref:es,tabIndex:-1,"data-keyboard-pane":"l1",className:`${c?"flex-1 min-w-0":"shrink-0"} flex flex-col bg-surface-secondary rounded-xl m-1 mr-0 outline-none ${!c&&ie==="l1"?"ring-1 ring-inset ring-brand-500/30":""}`,style:c?w?{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:[c&&e.jsx(Vs,{}),!c&&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:s("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:[s("title"),N>0&&e.jsxs("span",{className:"ml-1.5 text-fg-tertiary font-normal",children:["(",N,")"]})]})]})}),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:Jt,value:Pe,onChange:t=>Te(t.target.value),placeholder:s("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"}),Pe&&e.jsx("button",{onClick:()=>{Te(""),Be("")},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"})]})})]}),dt&&!c&&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:dt}),e.jsx("button",{onClick:()=>{h.system.openPath(dt)},className:"shrink-0 underline hover:text-fg-secondary transition-colors",children:s("common:open")})]}),c&&e.jsxs("button",{onClick:()=>ps(t=>!t),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors ${tt||ze?"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"})]}),s("filters.filtersLabel"),ze&&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 ${tt?"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:c&&!tt?"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:s("filters.source")}),e.jsx(he,{label:s("filters.allSources"),value:"",current:H,onClick:()=>W("")}),e.jsx(he,{label:s("filters.sourceAgent"),value:"agent",current:H,onClick:t=>W(t||"")}),e.jsx(he,{label:s("filters.sourceKnowledge"),value:"knowledge",current:H,onClick:t=>W(t||"")}),e.jsxs("button",{type:"button",onClick:()=>Je(!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:s("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"})]}),s("filters.bindKnowledgeBase")]})]}),e.jsxs("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx(he,{label:s("filters.allTypes"),value:"",current:V||F||"",onClick:()=>{ge(""),be("")}}),Zs.map(t=>e.jsx(he,{label:`${fe[t]?.icon??""} ${t}`,value:t,current:V,onClick:r=>{ge(r),be("")}},t)),["agent","team","skill"].map(t=>e.jsx(he,{label:`${z[t].icon} ${s(`artifactTypes.${t}`)}`,value:t,current:F,onClick:r=>{be(r),ge("")}},t))]}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:s("filters.group")}),["date","project","team","agent"].map(t=>e.jsx("button",{onClick:()=>{hs(t)},className:`px-2 py-1 rounded text-xs transition-colors ${$===t?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:s(`groupBy.${t}`)},t)),K.length>1&&e.jsx("button",{onClick:Cs,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:s(Qt?"expandAllTooltip":"collapseAllTooltip"),children:s(Qt?"expandAll":"collapseAll")})]})]}),ze&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[pe&&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:["“",pe,"”",e.jsx("button",{onClick:()=>{Te(""),Be("")},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:[fe[V]?.icon," ",V,e.jsx("button",{onClick:()=>ge(""),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:[z[F]?.icon," ",s(`artifactTypes.${F}`),e.jsx("button",{onClick:()=>be(""),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"})]})})]}),H&&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:[s(H==="knowledge"?"filters.sourceKnowledge":"filters.sourceAgent"),e.jsx("button",{onClick:()=>W(""),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"})]})})]}),se&&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:[Ce(se)??se,e.jsx("button",{onClick:()=>Ae(""),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:Zt,className:"text-[10px] text-fg-tertiary hover:text-brand-500 ml-auto transition-colors",children:s("filters.clearAll")})]})]}),et&&e.jsx("div",{className:`mx-4 mt-2 px-3 py-1.5 text-xs rounded-lg ${et.type==="success"?"bg-green-500/15 text-green-600":"bg-red-500/15 text-red-500"}`,children:et.text}),e.jsxs("div",{ref:Me,className:"flex-1 overflow-y-auto p-2 space-y-1 transition-opacity duration-150",style:{opacity:me?.5:1},onTouchStart:c?Is:void 0,onTouchEnd:c?Ls:void 0,children:[st&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-brand-500",children:[e.jsx(os,{})," ",e.jsx("span",{className:"text-[10px]",children:s("filters.refreshing")})]}),me?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"})}),ze?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:s("empty.noResults")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:s("empty.noResultsHint")}),e.jsx("button",{onClick:Zt,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand transition-colors",children:s("filters.clearAll")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:s("empty.title")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:s("empty.subtitle")}),e.jsx("button",{onClick:()=>J.navigate(I.WORK),className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand transition-colors",children:s("empty.goToWork")})]})]}):K.map(([t,r])=>{const i=qt(t);return e.jsxs("div",{className:"mb-1 cv-row",children:[e.jsxs("button",{onClick:()=>Ss(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:r.label}),e.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated px-1.5 py-0.5 rounded-full shrink-0",children:[r.items.length,g.length<N?"+":""]})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ${i?"max-h-0 opacity-0":"max-h-[5000px] opacity-100"}`,children:r.items.map(l=>e.jsx("button",{"data-deliverable-id":l.id,onClick:()=>ss(l),className:`cv-row w-full text-left px-3 py-2 rounded-lg transition-all duration-150 ${n?.id===l.id?ie==="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 ${fe[l.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:fe[l.type]?.icon??l.type.charAt(0)}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:l.title}),L(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":s("share.published",{defaultValue:"已发布到 Hub"}),children:[e.jsx("title",{children:s("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"})]}),L(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":s("share.pendingReview",{defaultValue:"Hub 审核中"}),children:[e.jsx("title",{children:s("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"})]}),L(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":s("share.rejected",{defaultValue:"Hub 已拒绝"}),children:[e.jsx("title",{children:s("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"})]}),Wt.has(l.id)&&e.jsx("span",{className:"shrink-0 text-amber-500",title:s("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:Js(l.updatedAt,s)})]})},l.id))})]},t)}),g.length<N&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("button",{type:"button",disabled:m,onClick:()=>{vs()},className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-lg
|
|
4
|
+
border border-border-default text-fg-secondary bg-surface-elevated/60
|
|
5
|
+
hover:text-fg-primary hover:bg-surface-elevated hover:border-brand-400/40
|
|
6
|
+
disabled:opacity-60 disabled:cursor-not-allowed transition-colors`,children:m?e.jsxs(e.Fragment,{children:[e.jsx(os,{})," ",e.jsx("span",{children:s("common:loadingMore")})]}):e.jsx("span",{children:s("count.loadMore",{remaining:N-g.length})})})}),!me&&g.length>0&&e.jsx("div",{className:"text-center text-[10px] text-fg-tertiary py-2",children:g.length<N?s("count.partial",{loaded:g.length,total:N}):s("count.total",{total:N})})]})]}),!c&&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"})]})}),(!c||w)&&e.jsxs("div",{"data-no-drag":!0,className:"flex-1 overflow-hidden min-w-0 flex relative self-stretch",children:[e.jsxs("div",{ref:jt,className:"flex-1 overflow-y-auto min-w-0 h-full",children:[_&&!c&&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:()=>{Ge.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:s("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??s("detail.details")})]}),c&&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??s("detail.details")})]}),n?e.jsxs("div",{className:`px-3 py-3 md:p-6 space-y-4 ${We?"flex flex-col min-h-0 h-full":""}`,children:[!d&&Wt.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:s("detail.fileMissing")})]}),e.jsxs("div",{className:`space-y-3 ${We?"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}),!d&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[zs(n?.format)&&e.jsxs("button",{onClick:()=>ct(!0),title:s("share.title",{defaultValue:"分享到 Markus Hub"}),"aria-label":s("share.title",{defaultValue:"分享到 Markus Hub"}),className:`relative p-1.5 rounded-lg transition-colors ${L(n)==="published"?"text-green-500 hover:text-green-400 hover:bg-green-500/10":L(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"})]}),L(n)==="published"||L(n)==="pending_review"||L(n)==="rejected"?e.jsx("span",{className:`absolute top-0.5 right-0.5 w-2 h-2 rounded-full border border-surface-primary ${L(n)==="published"?"bg-green-500":L(n)==="pending_review"?"bg-amber-500 animate-pulse":"bg-red-500"}`,"aria-hidden":!0}):null]}),e.jsx("button",{onClick:()=>He(n),disabled:!!Bt,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:s("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 ${fe[n.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:[fe[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," ",s("detail.builderWithType",{type:s(`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)),L(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"})]}),s("share.published",{defaultValue:"已发布"})]}),L(n)==="pending_review"&&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-amber-500/15 text-amber-500 hover:bg-amber-500/25 hover:underline",title:`${n.shareUrl??void 0} · ${s("share.pendingReview",{defaultValue:"审核中"})}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),s("share.pendingReview",{defaultValue:"审核中"})]}),L(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:[s("share.rejected",{defaultValue:"已拒绝"}),n.shareReason?e.jsxs("span",{className:"text-red-400/90 font-normal",children:["— ",n.shareReason]}):null]})]}),(n.taskId||n.agentId||Ce(n.projectId))&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.taskId&&e.jsx("button",{onClick:()=>J.navigate(I.WORK,{openTask:n.taskId}),className:"text-xs text-brand-500 hover:underline bg-brand-500/10 px-2 py-0.5 rounded",children:s("links.task",{id:`${n.taskId.slice(0,12)}...`})}),n.agentId&&e.jsx("button",{onClick:()=>J.navigate(I.TEAM,{selectAgent:n.agentId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:s("links.agent",{name:Ue.get(n.agentId)?.name??n.agentId.slice(0,12)})}),Ce(n.projectId)&&e.jsx("button",{onClick:()=>J.navigate(I.WORK,{projectId:n.projectId}),className:"text-xs text-blue-600 hover:underline bg-blue-500/10 px-2 py-0.5 rounded",children:s("links.project",{name:Ce(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:[s("diffStats.title"),":"]}),e.jsx("span",{className:"text-fg-secondary",children:s("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:[s("testResults.title"),":"]}),e.jsx("span",{className:"text-green-600",children:s("testResults.passed",{count:n.testResults.passed})}),e.jsx("span",{className:"text-red-500",children:s("testResults.failed",{count:n.testResults.failed})}),e.jsx("span",{className:"text-fg-secondary",children:s("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:[s("metadata.created")," ",new Date(n.createdAt).toLocaleString()]}),e.jsxs("span",{children:[s("metadata.updated")," ",new Date(n.updatedAt).toLocaleString()]}),e.jsx("span",{className:"text-fg-muted select-all",children:n.id.slice(0,12)})]}),n.reference&&!qe(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:()=>{h.files.reveal(n.reference).catch(()=>B("error",s("detail.failedToOpenBrowser")))},className:"text-xs font-mono text-brand-500 hover:text-brand-500 hover:underline truncate flex-1 text-left cursor-pointer",title:s("detail.openInFileBrowser"),children:n.reference}),e.jsx("button",{onClick:()=>{h.files.reveal(n.reference).catch(()=>B("error",s("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:s("detail.revealInFinder"),children:s("common:open")}),e.jsx("button",{onClick:()=>_e(n.reference),className:`px-2 py-1 text-[10px] rounded transition-colors shrink-0 ${we?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,title:s("detail.copyPath"),children:s(we?"common:copied":"common:copy")})]}),n.reference&&!qe(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(Xs,{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:s("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:ws,className:"flex-1 px-4 py-2.5 bg-brand-600 hover:bg-brand-500 text-on-brand text-sm font-medium rounded-lg transition-colors",children:s("detail.openInBuilder")})}),n.summary&&e.jsx("div",{className:"bg-surface-elevated rounded-xl p-5",children:e.jsx(Nt,{content:n.summary,className:"text-fg-secondary text-sm"})})]}):n.reference&&qe(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(Nt,{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-on-brand text-sm font-medium rounded-lg transition-colors",children:s("detail.openUrl")})]})]}):e.jsxs("div",{className:`bg-surface-elevated rounded-xl overflow-hidden ${We?"flex flex-col h-full":""}`,children:[($e||n.summary)&&!lt&&!ve&&!G&&!Vt&&n.reference&&n.type==="file"&&(De==="markdown"||De==="text"||De==="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:Es,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ce?"text-fg-tertiary hover:text-fg-secondary":"bg-brand-600/20 text-brand-500"}`,children:s("detail.preview")}),e.jsx("button",{onClick:Rs,className:`px-3 py-1 rounded text-xs font-medium transition-colors ${ce?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:s("detail.edit")}),e.jsx("div",{className:"flex-1"}),ce&&e.jsx("button",{onClick:rs,disabled:!U||xt,className:"px-3 py-1 rounded text-xs font-medium bg-brand-600 hover:bg-brand-500 text-on-brand transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s(xt?"detail.saving":"detail.save")})]}),e.jsxs("div",{className:We?"flex-1 min-h-0 p-5 flex flex-col":"p-5",children:[Ht&&it&&!G&&!lt&&e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 border border-border-subtle bg-surface-secondary/50 rounded-lg shrink-0",children:[e.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-fg-secondary hover:text-brand-500 transition-colors cursor-pointer",onClick:()=>{const t=Ht;Ve(null),Fe(null),yt(t)},children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M17 10a.75.75 0 01-.75.75H5.612l4.158 3.96a.75.75 0 11-1.04 1.08l-5.5-5.25a.75.75 0 010-1.08l5.5-5.25a.75.75 0 111.04 1.08L5.612 9.25H16.25A.75.75 0 0117 10z",clipRule:"evenodd"})}),"返回上级目录"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{className:"shrink-0 text-xs text-fg-secondary hover:text-fg-primary hover:underline cursor-pointer",onClick:()=>_e(it),children:we?s("common:copied"):s("common:copyPath",{defaultValue:"复制路径"})}),e.jsx("button",{className:"shrink-0 text-xs text-fg-secondary hover:text-fg-primary hover:underline cursor-pointer",onClick:()=>{h.files.reveal(it).catch(()=>B("error",s("detail.failedToOpenBrowser")))},children:s("detail.openInFileBrowser",{defaultValue:"在文件浏览器中显示"})})]}),lt?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"})]}):G?e.jsx("div",{className:n.type==="directory"?"flex-1 min-h-0":"h-[50vh] min-h-[300px]",children:e.jsx(Fs,{path:G.path,entries:G.entries,onNavigate:t=>{yt(t)},onOpenFile:t=>{Ns(t,G?.path)},onReveal:t=>{h.files.reveal(t).catch(()=>B("error",s("detail.failedToOpenBrowser")))},onCopyPath:t=>_e(t)})}):ve?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("img",{src:ve.src,alt:ve.name,className:"max-w-full max-h-[60vh] rounded-lg object-contain"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:ve.name})]}):ae?e.jsx("div",{className:_t?"flex-1 min-h-0":"h-[55vh]",children:e.jsx(Hs,{data:ae,reference:ae.reference,onFallback:ae.reference?()=>{h.files.reveal(ae.reference).catch(()=>{})}:void 0})}):je?e.jsxs("div",{className:"flex flex-col gap-3 py-4",children:[je.kind==="audio"?e.jsx("audio",{controls:!0,preload:"metadata",src:je.src,className:"w-full"}):e.jsx("video",{controls:!0,preload:"metadata",src:je.src,className:"w-full max-h-[60vh] rounded-lg bg-black"}),e.jsx("span",{className:"text-xs text-fg-tertiary",children:je.name})]}):$e?ce?e.jsx("div",{className:"animate-fadeIn",children:e.jsx("textarea",{ref:ht,value:Se,onChange:t=>{ut(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(Os,{content:$e,format:De,className:"text-fg-secondary text-sm",onHtmlSelection:Ts,basePath:n?.reference?n.reference.replace(/[/\\][^/\\]+$/,""):void 0,copyVariant:"preview"})},"preview"):Vt?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:s("detail.cannotPreview",{type:n.type})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{h.files.reveal(n.reference).catch(()=>B("error",s("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:s("detail.openInFileBrowser"),children:n.reference}),e.jsx("button",{onClick:()=>{h.files.reveal(n.reference).catch(()=>B("error",s("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:s("common:open")}),e.jsx("button",{onClick:()=>_e(n.reference),className:`px-3 py-2 text-xs rounded-lg transition-colors shrink-0 ${we?"bg-green-500/20 text-green-600":"bg-surface-overlay/50 text-fg-secondary hover:bg-surface-overlay"}`,children:s(we?"common:copied":"common:copy")})]})]}):n.summary?ce?e.jsx("textarea",{ref:ht,value:Se,onChange:t=>{ut(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(Nt,{content:n.summary,className:"text-fg-secondary text-sm"}):e.jsx("p",{className:"text-sm text-fg-tertiary italic",children:s("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:s("detail.selectToView")}),!c&&e.jsx("p",{className:"text-[10px] text-fg-muted",children:s("detail.keyboardHint")})]})})]}),n?.agentId&&e.jsx("button",{type:"button",onClick:()=>{c?Rt(!0):kt()},className:`${c?"fixed bottom-[calc(1.25rem+env(safe-area-inset-bottom))] right-4 z-40":"absolute bottom-6 right-6 z-20"} w-12 h-12 rounded-full bg-brand-600 hover:bg-brand-500 text-on-brand shadow-lg shadow-black/20 flex items-center justify-center transition-transform hover:scale-105 animate-fab-in`,title:c?s("chat.sendToChat",{defaultValue:"Send to conversation"}):s("chat.openChat",{defaultValue:"Open in Team Chat"}),"aria-label":c?s("chat.sendToChat",{defaultValue:"Send to conversation"}):s("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"})})}),us&&n&&e.jsx(Ys,{chipKind:"deliverable",chipLabel:Ct(n).label,chipContent:Ct(n).content,agents:Ze,users:cs,defaultTarget:n.agentId?`agent:${n.agentId}`:void 0,onClose:()=>Rt(!1)})]}),Ne&&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:Ne.x,top:Ne.y-8},children:e.jsxs("button",{onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),kt(Ne.text,Ne.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"})}),s("contextMenu.addToConversation")]})}),gs&&n&&e.jsx(Gs,{item:n,onClose:()=>ct(!1),onShared:ks}),fs&&e.jsx(er,{projects:Xe,onClose:()=>Je(!1),onBound:()=>{Je(!1),W("knowledge"),O()}}),ot&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>He(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:s("detail.confirmRemoveTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:s("detail.confirmRemoveMessage",{name:ot.title})})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>He(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:s("common:cancel")}),e.jsx("button",{onClick:()=>{const t=ot;He(null),js(t)},disabled:!!Bt,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:s("common:remove")})]})]})}),ft&&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:s("detail.unsavedTitle")}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:s("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:s("common:cancel")}),e.jsx("button",{onClick:()=>{Ps(),ft.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:s("detail.discard")}),e.jsx("button",{onClick:async()=>{await rs(),ft.action(),Z(null)},className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-on-brand rounded-lg transition-colors",children:s("detail.saveAndLeave")})]})]})})]})}function er({projects:o,onClose:d,onBound:u}){const{t:s}=Qe("deliverables"),[c,b]=a.useState(""),[S,w]=a.useState(""),[j,P]=a.useState(!1),[k,R]=a.useState(""),g=o.find(m=>m.id===c),E=typeof window<"u"&&!!window.markusDesktop?.selectDirectory,N=async()=>{try{const m=await window.markusDesktop?.selectDirectory?.(s("bindBrowseTitle",{defaultValue:"Select knowledge base directory"}));m&&w(m)}catch(m){R(String(m))}},D=async()=>{if(!(!c||!S.trim()||j)){P(!0),R("");try{const m=S.trim(),te=[...new Set([...g?.knowledgeBasePaths??[],m])];await h.projects.update(c,{knowledgeBasePaths:te}),await h.projects.syncKnowledge(c),u()}catch(m){R(String(m))}finally{P(!1)}}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:()=>{j||d()},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:s("bindKnowledgeBase")}),e.jsx("p",{className:"text-xs text-fg-secondary mb-4",children:s("bindKnowledgeBaseHint")}),e.jsx("label",{className:"block text-[10px] text-fg-tertiary mb-1",children:s("bindProject")}),e.jsxs("select",{value:c,onChange:m=>b(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:s("bindProjectSelect")}),o.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:s("bindPath")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("input",{value:S,onChange:m=>w(m.target.value),onKeyDown:m=>{m.key==="Enter"&&D()},placeholder:s("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"}),E&&e.jsx("button",{type:"button",onClick:()=>{N()},disabled:j,title:s("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:s("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:s("bindCurrentPaths")}),(g.knowledgeBasePaths??[]).map((m,te)=>e.jsxs("div",{className:"text-[11px] text-fg-secondary font-mono truncate",title:m,children:["• ",m]},`${m}-${te}`))]}),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:d,disabled:j,className:"px-3 py-1.5 text-xs text-fg-tertiary hover:text-fg-secondary rounded-lg transition-colors",children:s("common:cancel",{defaultValue:"Cancel"})}),e.jsx("button",{onClick:()=>{D()},disabled:j||!c||!S.trim(),className:"px-3 py-1.5 text-xs bg-brand-600 text-on-brand rounded-lg hover:bg-brand-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:j?s("bindSaving",{defaultValue:"Saving…"}):s("bindSave",{defaultValue:"Bind directory"})})]})]})})}function he({label:o,value:d,current:u,onClick:s}){return e.jsx("button",{onClick:()=>s(u===d?"":d),className:`px-2 py-1 rounded text-xs whitespace-nowrap shrink-0 transition-colors ${u===d?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:o})}function os(){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{ir as DeliverablesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as T,r as i,j as e,c as z,m as x,o as H,E as A,M as S,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-Di4rk9mR.js";const R="markus-copy-typography",C={fontFamily:"default",fontSize:15,headingScale:"standard"};function P(){try{const t=localStorage.getItem(R);if(t)return{...C,...JSON.parse(t)}}catch{}return C}function se(t){localStorage.setItem(R,JSON.stringify(t))}function ne(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:n[t.headingScale]??n.standard}}function ae({onClose:t}){const{t:r}=T("common"),[n,s]=i.useState(P);i.useEffect(()=>{se(n)},[n]);const l=i.useCallback((o,u)=>{s(d=>({...d,[o]:u}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:n.fontFamily,onChange:o=>l("fontFamily",o.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:o=>l("fontSize",Number(o.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(o=>e.jsx("button",{onClick:()=>l("headingScale",o),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===o?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${o.charAt(0).toUpperCase()+o.slice(1)}`)},o))})]})]})}const M=[B,O,G],L=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function E(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const n=W(t);return K(n)?n:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let n=t.replace(oe,(s,l)=>{const o=l.trim();return o&&r.push(o),""});return n=n.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:n.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,n]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const s=window.matchMedia(`(max-width: ${t-1}px)`),l=o=>n(o.matches);return s.addEventListener("change",l),n(s.matches),()=>s.removeEventListener("change",l)},[t]),r}function me({content:t,contentRef:r,variant:n}){const{t:s}=T("common"),[l,o]=i.useState(!1),[u,d]=i.useState(!1),[g,h]=i.useState(!1),[y,w]=i.useState(null),f=i.useRef(null),p=de();i.useEffect(()=>{if(!l)return;const a=m=>{f.current&&!f.current.contains(m.target)&&(o(!1),d(!1),h(!1))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[l]);const k=i.useCallback(a=>{w(a),setTimeout(()=>w(null),1500)},[]),v=async()=>{const a=await te(t);k(s(a?"markdown.copied":"markdown.failed")),o(!1)},b=async a=>{const m=r.current?.firstElementChild;if(!m)return;const I=P(),j=ne(I),N=await re(m,a,t,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),F=s(a==="light"?"markdown.themeLight":"markdown.themeDark");k(N.ok?N.method==="html"?s("markdown.htmlCopied",{theme:F}):s("markdown.textCopied"):s("markdown.failed")),o(!1)},c=le[n];return e.jsxs("div",{className:c.wrapper,ref:f,"data-copy-variant":n,children:[y&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:y}),e.jsxs("button",{onClick:()=>o(a=>!a),className:c.button,title:s("markdown.copyContent"),children:[e.jsx("svg",{className:c.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),c.labelled&&e.jsx("span",{className:"leading-none",children:s("markdown.copy")})]}),l&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:g?e.jsx(ae,{onClose:()=>h(!1)}):u?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:s("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:s("markdown.mdAbbrev")})," — ",s("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",s("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",s("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:s("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>h(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:v,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:s("markdown.mdAbbrev")}),s(p?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>b("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),s(p?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>b("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),s(p?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:n="",onMentionClick:s,knownNames:l,basePath:o,copyVariant:u="inline"}){const{thinking:d,rest:g}=ie(r),h=i.useRef(null),[y,w]=i.useState(null),f=z(),p=i.useCallback(c=>{let a=x(c,V);return a=x(a,Y),a=x(a,J),a=x(a,Q),a=x(a,X),a=x(a,m=>Z(m,l)),a=x(a,ee),a},[l]),k=i.useMemo(()=>p(g),[g,p]),v=ce[u],b=H({onMentionClick:s,basePath:o,onImagePreview:w,contentRef:h,hostAvailable:f?.hostAvailable,openRightPanel:f?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:h,variant:u}),e.jsx("div",{ref:h,children:e.jsx(A,{resetKeys:[k],fallback:e.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap ${v} text-fg-secondary ${n}`,children:g}),children:e.jsxs("div",{className:`prose prose-sm max-w-none break-words ${v} text-fg-secondary ${n}`,children:[d.length>0&&(()=>{const c=d.join(`
|
|
1
|
+
import{u as T,r as i,j as e,c as z,m as x,o as H,E as A,M as S,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-BHu6brRf.js";const R="markus-copy-typography",C={fontFamily:"default",fontSize:15,headingScale:"standard"};function P(){try{const t=localStorage.getItem(R);if(t)return{...C,...JSON.parse(t)}}catch{}return C}function se(t){localStorage.setItem(R,JSON.stringify(t))}function ne(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:n[t.headingScale]??n.standard}}function ae({onClose:t}){const{t:r}=T("common"),[n,s]=i.useState(P);i.useEffect(()=>{se(n)},[n]);const l=i.useCallback((o,u)=>{s(d=>({...d,[o]:u}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:n.fontFamily,onChange:o=>l("fontFamily",o.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:o=>l("fontSize",Number(o.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(o=>e.jsx("button",{onClick:()=>l("headingScale",o),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===o?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${o.charAt(0).toUpperCase()+o.slice(1)}`)},o))})]})]})}const M=[B,O,G],L=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function E(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const n=W(t);return K(n)?n:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let n=t.replace(oe,(s,l)=>{const o=l.trim();return o&&r.push(o),""});return n=n.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:n.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,n]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const s=window.matchMedia(`(max-width: ${t-1}px)`),l=o=>n(o.matches);return s.addEventListener("change",l),n(s.matches),()=>s.removeEventListener("change",l)},[t]),r}function me({content:t,contentRef:r,variant:n}){const{t:s}=T("common"),[l,o]=i.useState(!1),[u,d]=i.useState(!1),[g,h]=i.useState(!1),[y,w]=i.useState(null),f=i.useRef(null),p=de();i.useEffect(()=>{if(!l)return;const a=m=>{f.current&&!f.current.contains(m.target)&&(o(!1),d(!1),h(!1))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[l]);const k=i.useCallback(a=>{w(a),setTimeout(()=>w(null),1500)},[]),v=async()=>{const a=await te(t);k(s(a?"markdown.copied":"markdown.failed")),o(!1)},b=async a=>{const m=r.current?.firstElementChild;if(!m)return;const I=P(),j=ne(I),N=await re(m,a,t,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),F=s(a==="light"?"markdown.themeLight":"markdown.themeDark");k(N.ok?N.method==="html"?s("markdown.htmlCopied",{theme:F}):s("markdown.textCopied"):s("markdown.failed")),o(!1)},c=le[n];return e.jsxs("div",{className:c.wrapper,ref:f,"data-copy-variant":n,children:[y&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:y}),e.jsxs("button",{onClick:()=>o(a=>!a),className:c.button,title:s("markdown.copyContent"),children:[e.jsx("svg",{className:c.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),c.labelled&&e.jsx("span",{className:"leading-none",children:s("markdown.copy")})]}),l&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:g?e.jsx(ae,{onClose:()=>h(!1)}):u?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:s("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:s("markdown.mdAbbrev")})," — ",s("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",s("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",s("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:s("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>h(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:v,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:s("markdown.mdAbbrev")}),s(p?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>b("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),s(p?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>b("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),s(p?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:n="",onMentionClick:s,knownNames:l,basePath:o,copyVariant:u="inline"}){const{thinking:d,rest:g}=ie(r),h=i.useRef(null),[y,w]=i.useState(null),f=z(),p=i.useCallback(c=>{let a=x(c,V);return a=x(a,Y),a=x(a,J),a=x(a,Q),a=x(a,X),a=x(a,m=>Z(m,l)),a=x(a,ee),a},[l]),k=i.useMemo(()=>p(g),[g,p]),v=ce[u],b=H({onMentionClick:s,basePath:o,onImagePreview:w,contentRef:h,hostAvailable:f?.hostAvailable,openRightPanel:f?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:h,variant:u}),e.jsx("div",{ref:h,children:e.jsx(A,{resetKeys:[k],fallback:e.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap ${v} text-fg-secondary ${n}`,children:g}),children:e.jsxs("div",{className:`prose prose-sm max-w-none break-words ${v} text-fg-secondary ${n}`,children:[d.length>0&&(()=>{const c=d.join(`
|
|
2
2
|
|
|
3
3
|
`),a=c.split(`
|
|
4
4
|
`)[0]??"",m=a.length>80?a.slice(0,80)+"…":a;return e.jsxs("details",{className:"mb-3 rounded-lg bg-surface-elevated/60 border border-border-default/50 overflow-hidden group/think",children:[e.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-secondary hover:text-fg-secondary transition-colors flex items-center gap-1.5 min-w-0",children:[e.jsx("svg",{className:"w-3 h-3 shrink-0 transition-transform group-open/think:rotate-90",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),e.jsx("span",{className:"shrink-0",children:"Thinking"}),e.jsx("span",{className:"truncate text-fg-tertiary ml-1 group-open/think:hidden",children:m})]}),e.jsx("div",{className:"px-3 pb-3 border-t border-border-default/50",children:e.jsx("div",{className:"mt-2 pl-3 border-l-2 border-brand-500/40 text-xs text-fg-secondary leading-relaxed",children:e.jsx(S,{remarkPlugins:M,rehypePlugins:L,components:b,urlTransform:E,children:p(c)})})})]})})(),e.jsx(S,{remarkPlugins:M,rehypePlugins:L,components:b,urlTransform:E,children:k})]})})}),y&&e.jsx($,{src:y,onClose:()=>w(null)})]})},(t,r)=>t.content===r.content&&t.className===r.className&&t.basePath===r.basePath&&t.copyVariant===r.copyVariant&&t.onMentionClick===r.onMentionClick&&he(t.knownNames,r.knownNames));function he(t,r){if(t===r)return!0;if(!t||!r||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n])return!1;return!0}export{$ as ImagePreviewModal,xe as MarkdownMessage,E as chatUrlTransform};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-Di4rk9mR.js";import{P as $,E as D}from"./AsyncState-CQsFZGLc.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],T=C.status==="fulfilled"?C.value.tasks:[],M=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:T,requirements:M,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover: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:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&w&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",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.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",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("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
|
|
1
|
+
import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-BHu6brRf.js";import{P as $,E as D}from"./AsyncState-D2omBzdj.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],T=C.status==="fulfilled"?C.value.tasks:[],M=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:T,requirements:M,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover: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:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&w&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",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.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",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("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-Di4rk9mR.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",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"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};
|
|
1
|
+
import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-BHu6brRf.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",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"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};
|