1import{u as rt,p as nt}from"./Ceewks1i.js";import{M as Y,I}from"./BDI6_ACu.js";import{M as E}from"./CtK_8Z2f.js";import P from"./D6C4TXaL.js";import{z as Z,x as ot,r as V,c as k,e as a,q as n,i as t,f as v,bs as N,h as O,c3 as G,c4 as K,t as p,bn as M,bS as J,c5 as at,j as D,g as y,F as b,l as $,bf as tt,k as X}from"#entry";const it={class:"task-bar-container"},lt={class:"current-task-display"},ut={key:0,class:"task-content"},ct={class:"task-icon"},dt={class:"task-info"},pt={class:"task-agent"},ft={class:"task-text"},mt={key:1,class:"task-placeholder"},ht={class:"text-gray-500 text-xs"},gt={class:"progress-summary"},yt={class:"completed-count"},vt={class:"total-count"},_t={class:"progress-bar-wrapper"},kt={key:0,class:"expanded-task-list"},xt={class:"task-list-header"},wt={class:"text-xs font-medium text-gray-300"},bt={class:"task-groups"},$t={class:"group-header"},At={class:"group-name"},Tt={class:"group-count"},St={class:"group-tasks"},Ct={class:"task-checkbox"},Mt={class:"task-text"},Rt=Z({__name:"TodoList",props:{todos:{},isStreaming:{type:Boolean,default:!1},agent:{default:void 0}},setup(f){const u=f,{t:z}=ot(),x=V(!1),A=c=>c.split("_").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join(" "),w=k(()=>{const c=u.todos.find(_=>_.status==="in_progress");if(c)return c;const d=u.todos.filter(_=>_.status==="completed");return d.length>0?d[d.length-1]:u.todos.find(_=>_.status==="pending")||null}),T=k(()=>u.todos.filter(c=>c.status==="completed").length),F=k(()=>u.todos.length===0?0:Math.round(T.value/u.todos.length*100)),R=k(()=>{const c={};return u.todos.forEach(d=>{const g=d.agent||u.agent||"default";c[g]||(c[g]=[]),c[g].push(d)}),Object.entries(c).map(([d,g])=>{const _=g.filter(j=>j.status==="completed").length;return{agent:d,todos:g,completed:_,total:g.length}})}),m=c=>c.status==="in_progress"?c.activeForm:c.content,S=c=>{switch(c){case"completed":return"todo-completed";case"in_progress":return"todo-in-progress";case"pending":return"todo-pending";default:return""}},B=c=>{switch(c){case"completed":return"text-completed";case"in_progress":return"text-in-progress";case"pending":return"text-pending";default:return""}};return(c,d)=>(n(),a("div",it,[t("div",lt,[w.value?(n(),a("div",ut,[t("div",ct,[w.value.status==="completed"?(n(),N(O(G),{key:0,class:"icon-completed"})):w.value.status==="in_progress"?(n(),N(O(K),{key:1,class:"icon-in-progress",spin:!0})):(n(),N(O(Y),{key:2,class:"icon-pending"}))]),t("div",dt,[t("div",pt,p(A(w.value.agent||"Unknown")),1),t("div",ft,p(m(w.value)),1)])])):(n(),a("div",mt,[t("span",ht,p(c.$t("todo.noActiveTasks")||"ææ æ´»å¨ä»»å¡"),1)]))]),t("div",gt,[t("div",{class:"progress-numbers",onClick:d[0]||(d[0]=g=>x.value=!x.value)},[t("span",yt,p(T.value),1),d[3]||(d[3]=t("span",{class:"separator"},"/",-1)),t("span",vt,p(f.todos.length),1),(n(),a("svg",{class:M(["expand-icon",{rotated:x.value}]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},[...d[2]||(d[2]=[t("path",{d:"M19 9L12 16L5 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),t("div",_t,[t("div",{class:"progress-bar-fill",style:J({width:F.value+"%"})},null,4)])]),v(at,{name:"task-expand"},{default:D(()=>[x.value?(n(),a("div",kt,[t("div",xt,[t("span",wt,p(c.$t("todo.allTasks")||"ææä»»å¡"),1),t("button",{onClick:d[1]||(d[1]=g=>x.value=!1),class:"close-btn"},[...d[4]||(d[4]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])]),t("div",bt,[(n(!0),a(b,null,$(R.value,g=>(n(),a("div",{key:g.agent,class:"task-group"},[t("div",$t,[t("span",At,p(A(g.agent)),1),t("span",Tt,p(g.completed)+"/"+p(g.total),1)]),t("div",St,[(n(!0),a(b,null,$(g.todos,(_,j)=>(n(),a("div",{key:j,class:M(["task-item",S(_.status)])},[t("div",Ct,[_.status==="completed"?(n(),N(O(G),{key:0,class:"icon-completed"})):_.status==="in_progress"?(n(),N(O(K),{key:1,class:"icon-in-progress",spin:!0})):(n(),N(O(Y),{key:2,class:"icon-pending"}))]),t("div",Mt,[t("span",{class:M(B(_.status))},p(m(_)),3)])],2))),128))])]))),128))])])):y("",!0)]),_:1})]))}}),jt=tt(Rt,[["__scopeId","data-v-6f52ae62"]]),Lt=f=>f?typeof f=="string"?f:Array.isArray(f)?f.filter(u=>u.type==="text"&&u.text).map(u=>u.text||"").join(` 2`):"":"",Et=f=>!f||typeof f=="string"?"":Array.isArray(f)?f.filter(u=>u.type==="thinking"&&u.thinking).map(u=>u.thinking||"").join(` 3`):"",Nt={key:0,class:"transition-all duration-400 ease-out",style:{opacity:"1",transform:"translateY(0)"}},Ot={key:0,class:"py-2"},Bt={class:"space-y-4"},It={key:0,class:"text-gray-300"},Dt={key:1,class:"space-y-2"},Ft={class:"text-sm font-semibold text-gray-400"},Pt={class:"list-disc list-inside space-y-1 text-sm text-gray-300"},Jt={key:2,class:"space-y-2"},zt={class:"text-sm font-semibold text-gray-400"},Wt={class:"list-disc list-inside space-y-1 text-sm text-gray-300"},qt={key:3,class:"space-y-2"},Ht={class:"text-sm font-semibold text-gray-400"},Vt={class:"space-y-2"},Ut=["href"],Qt={class:"font-medium"},Yt={key:4,class:"text-sm text-gray-500 italic"},Gt={key:1,class:"py-2 mb-2"},Kt={key:0,class:"border-l-2 border-gray-600 pl-3 text-sm text-gray-400"},Xt={key:2,class:"py-2"},Zt={key:3,class:"mt-4 pl-4"},te={class:"mt-2"},ee={key:4,class:"mt-4"},se={key:0},re={class:"font-medium italic"},ne={class:"max-w-[500px] overflow-hidden text-ellipsis whitespace-nowrap"},oe={class:"pr-4"},ae={key:0,class:"mt-2 flex flex-wrap gap-4"},ie=["href"],le=["href"],ue=["src","alt","data-error-id"],ce={key:1},de=["onClick"],pe={key:0},fe={key:0},me={class:"bg-accent mt-2 max-h-[400px] w-full overflow-y-auto rounded-md text-sm"},he={key:1},ge={class:"mt-4 font-medium italic"},ye={key:2},ve={class:"mt-2 flex flex-wrap gap-4"},_e={class:"text-muted-foreground bg-accent flex h-40 w-40 gap-2 rounded-md px-2 py-1 text-sm animate-slide-in-up",style:{"animation-delay":"0s","animation-fill-mode":"both"}},ke=["href"],xe={key:3},we=["onClick"],be={key:0},$e={class:"bg-accent mt-2 max-h-[400px] w-full overflow-y-auto rounded-md text-sm py-3"},Ae=Z({__name:"DeerflowResponse",props:{res:{},hideTodos:{type:Boolean,default:!1},threadId:{}},setup(f){const u=f,z=rt(),x=k(()=>Lt(u.res.message)),A=k(()=>Et(u.res.message)),w=V(!0),T=V({});function F(s){T.value[s]===void 0?T.value[s]=!1:T.value[s]=!T.value[s]}function R(s){return T.value[s]!==!1}const m=k(()=>
3{if(!x.value)return null;const s=x.value.trim();if(!s.startsWith("{")&&!s.startsWith("["))return null;try{const o=JSON.parse(s);if(o&&typeof o=="object")return o}catch{try{const e=nt.parse(s);if(e&&typeof e=="object"){const r={};if(typeof e.summary=="string"&&(r.summary=e.summary),Array.isArray(e.key_points)&&(r.key_points=e.key_points.filter(i=>typeof i=="string")),Array.isArray(e.facts)&&(r.facts=e.facts.filter(i=>typeof i=="string")),Array.isArray(e.citations)&&(r.citations=e.citations.filter(i=>i&&typeof i=="object"&&typeof i.title=="string"&&typeof i.url=="string")),r.summary||r.key_points&&r.key_points.length>0||r.facts&&r.facts.length>0||r.citations&&r.citations.length>0)return r}}catch{if(u.res.isStreaming&&s.length<10)return null}}return null}),S=k(()=>!u.res.tool_calls||u.res.tool_calls.length===0?[]:u.res.tool_calls.filter(s=>!(s.type==="TodoWrite"||s.name==="TodoWrite"))),B=k(()=>{if(!u.res.agent)return null;const s=u.threadId||z.currentThreadId;return s?z.getAgentTodoList(s,u.res.agent,u.res.id):null}),c=k(()=>B.value!==null&&B.value.length>0),d=k(()=>!(!x.value||x.value.trim().length===0||m.value)),g=k(()=>!!(m.value||u.res.reasoning&&u.res.reasoning.trim().length>0||A.value&&A.value.trim().length>0||d.value||S.value&&S.value.length>0||c.value&&!u.hideTodos));function _(s){try{if(s?.args&&typeof s.args=="object")return s.args.query||"";const o=s.arguments;if(o&&typeof o=="string")try{return JSON.parse(o)?.query||""}catch{}const r=j(s?.result)?.bot_usage?.action_details;if(Array.isArray(r))for(const i of r){const l=i?.tool_details;if(Array.isArray(l))for(const L of l){const h=L?.input?.queries?.[0];if(typeof h=="string"&&h.trim())return h.trim()}}}catch{}return""}function j(s){try{return typeof s=="string"?JSON.parse(s):s}catch{return}}function W(s){const o=j(s?.result);if(Array.isArray(o)){const r=o.filter(l=>l&&l.type==="page"),i=o.filter(l=>l&&l.type==="image");return{pageResults:r,imageResults:i}}const e=Array.isArray(o?.results)?o.results:Array.isArray(o?.data)?o.data:void 0;if(Array.isArray(e)){const r=e.filter(l=>l&&l.type==="page"),i=e.filter(l=>l&&l.type==="image");return{pageResults:r,imageResults:i}}try{const r=o?.bot_usage?.action_details;if(Array.isArray(r))for(const i of r){const l=i?.tool_details;if(Array.isArray(l))for(const L of l){const h=L?.output?.data?.data?.results||L?.output?.data?.results;if(Array.isArray(h))return{pageResults:h.map(C=>({type:"page",title:C?.title??C?.name??C?.url??"ç»æ",url:C?.url??"",content:C?.summary??""})).filter(C=>C.url),imageResults:[]}}}}catch{}try{const r=o?.choices?.[0]?.message?.content;if(typeof r=="string"){const i=JSON.parse(r);if(Array.isArray(i)){const l=i.map(h=>({type:h?.type||"page",title:h?.title??h?.name??h?.url??"ç»æ",url:h?.url??"",content:h?.summary??h?.content??""})).filter(h=>h.url),L=l.filter(h=>h.type==="image");return{pageResults:l.filter(h=>h.type==="page"),imageResults:L}}}}catch{}try{const r=o?.references;if(Array.isArray(r)){const i=r.map(l=>({type:"page",title:l?.title??l?.url??"åèèµæ",url:l?.url??"",content:l?.summary??""})).filter(l=>l.url);if(i.length)return{pageResults:i,imageResults:[]}}}catch{}return{pageResults:[],imageResults:[]}}const et=s=>{const o=s.target;if(o&&!o.dataset.errorHandled){o.dataset.errorHandled="true";const e=o.parentElement;e&&(e.innerHTML=` 4 <div style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; border-radius: 0.375rem; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); transition: all 0.2s ease;"> 5 <svg style="width: 3rem; height: 3rem; color: #6b7280;" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> 6 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path> 7 </svg> 8 </div> 9 `)}};function U(s){return s.args.url||""}function st(s){if(typeof s=="string")try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}try{return JSON.stringify(s,null,2)}catch{return String(s)}}function Q(s){return s.name==="execute_python_code"?s.args?.code||s.args||"":s.name==="python_repl_tool"&&s.args?.code||""}function q(s){const o=s.includes(`Error executing code: 10`)||s.includes("Error:");let e="";if(o){const r=["```\nError: ",`Error executing code: 11`,"Error:"];for(const i of r){const l=s.split(i);if(l.length>1){e=l[1].trim();break}}}else{const r=["```\nStdout: ",`Output: 12`,`Result: 13`];for(const i of r){const l=s.split(i);if(l.length>1){e=l[1].trim();break}}e||(e=s.trim())}return{hasError:o,output:e||"(empty)"}}function H(s,o="plaintext"){try{return` 14 15\`\`\`${o} 16${s??""} 17\`\`\` 18`}catch{return` 19 20\`\`\`${o} 21${String(s)} 22\`\`\` 23`}}return(s,o)=>g.value?(n(),a("div",Nt,[m.value?(n(),a("div",Ot,[t("div",Bt,[m.value.summary?(n(),a("div",It,[v(E,{baseFontSize:"14px",content:m.value.summary},null,8,["content"])])):y("",!0),m.value.key_points&&m.value.key_points.length?(n(),a("div",Dt,[t("h4",Ft,p(s.$t("researchActivity.keyPoints")),1),t("ul",Pt,[(n(!0),a(b,null,$(m.value.key_points,(e,r)=>(n(),a("li",{key:r},p(e),1))),128))])])):y("",!0),m.value.facts&&m.value.facts.length?(n(),a("div",Jt,[t("h4",zt,p(s.$t("researchActivity.keyFacts")),1),t("ul",Wt,[(n(!0),a(b,null,$(m.value.facts,(e,r)=>(n(),a("li",{key:r},p(e),1))),128))])])):y("",!0),m.value.citations&&m.value.citations.length?(n(),a("div",qt,[t("h4",Ht,p(s.$t("researchActivity.citations")||"å¼ç¨æ¥æº"),1),t("div",Vt,[(n(!0),a(b,null,$(m.value.citations,(e,r)=>(n(),a("div",{key:r,class:"text-sm"},[t("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"text-blue-400 hover:text-blue-300 hover:underline transition-colors duration-200 flex items-start space-x-2"},[o[1]||(o[1]=t("svg",{class:"w-3 h-3 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}
23)],-1)),t("span",Qt,p(e.title),1)],8,Ut)]))),128))])])):y("",!0),f.res.isStreaming&&(!m.value.summary||m.value.key_points&&m.value.key_points.length===0||m.value.facts&&m.value.facts.length===0)?(n(),a("div",Yt," æ£å¨è§£ææ°æ®... ")):y("",!0)])])):y("",!0),f.res.reasoning&&f.res.reasoning.trim().length>0||A.value&&A.value.trim().length>0?(n(),a("div",Gt,[t("div",{class:"flex items-center cursor-pointer mb-2 text-sm font-semibold",onClick:o[0]||(o[0]=e=>w.value=!w.value)},[t("span",null,p(s.$t("researchActivity.reasoning")||"æèä¸"),1),t("div",{class:M(["ml-2 transition-transform duration-200",{"rotate-180":w.value}])},[...o[2]||(o[2]=[t("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M19 9L12 16L5 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),w.value?(n(),a("div",Kt,[v(E,{content:A.value||f.res.reasoning||"",baseFontSize:"12px",baseColor:"#ababab"},null,8,["content"])])):y("",!0)])):y("",!0),d.value?(n(),a("div",Xt,[v(E,{baseFontSize:"14px",content:x.value},null,8,["content"])])):y("",!0),c.value&&!f.hideTodos?(n(),a("div",Zt,[t("div",te,[v(jt,{todos:B.value,isStreaming:f.res.isStreaming||!1,agent:f.res.agent},null,8,["todos","isStreaming","agent"])])])):y("",!0),S.value&&S.value.length?(n(),a("div",ee,[(n(!0),a(b,null,$(S.value,e=>(n(),a("div",{key:e.id},[e.type==="web_search"?(n(),a("div",se,[t("div",re,[v(P,{className:"flex items-center",animated:!e.result},{default:D(()=>[v(I,{name:"search",class:"w-4 h-4 mr-2"}),t("span",null,p(s.$t("researchActivity.searching"))+": ",1),t("span",ne,p(_(e)),1)]),_:2},1032,["animated"])]),t("div",oe,[W(e).pageResults?(n(),a("ul",ae,[e.result?(n(),a(b,{key:1},[(n(!0),a(b,null,$(W(e).pageResults.filter(r=>r.type==="page"),(r,i)=>(n(),a("li",{key:`search-result-${i}`,class:"flex h-40 w-40 gap-2 rounded-md px-3 py-2 text-sm animate-slide-in-up items-center justify-center search-result-card",style:J({animationDelay:`${i*.1}s`,animationFillMode:"both"})},[t("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",class:"hover:underline hover:text-blue-400 break-words line-clamp-6 text-center transition-colors"},p(r.title),9,ie)],4))),128)),(n(!0),a(b,null,$(W(e).imageResults,(r,i)=>(n(),a("li",{key:`image-result-${i}`,class:"animate-slide-in-up h-40 w-40",style:J({animationDelay:`${i*.1}s`,animationFillMode:"both"})},[t("a",{class:"flex h-full w-full overflow-hidden rounded-md opacity-75 transition-opacity duration-300 hover:opacity-100",href:r.image_url,target:"_blank",rel:"noopener noreferrer"},[t("img",{src:r.image_url,alt:r.image_description,class:"bg-accent h-full w-full rounded-md object-cover transition-transform duration-300 hover:scale-110",onError:et,"data-error-id":`image-${i}`},null,40,ue)],8,le)],4))),128))],64)):(n(),a(b,{key:0},$(6,r=>t("li",{key:`search-result-${r}`,class:"flex h-40 w-40 gap-2 rounded-md text-sm"},[t("div",{class:"h-full w-full rounded-md bg-gradient-to-tl from-slate-400 to-accent animate-pulse",style:J({animationDelay:`${r*.2}s`})},null,4)])),64))])):y("",!0)])])):e.type==="python"?(n(),a("div",ce,[t("div",{class:"flex items-center cursor-pointer font-medium italic",onClick:r=>F(e.id)},[v(I,{name:"python",class:"w-4 h-4 mr-2"}),v(P,{className:"text-base font-medium italic",animated:!e.result},{default:D(()=>[X(p(s.$t("python.runningCode")),1)]),_:1},8,["animated"]),t("div",{class:M(["ml-2 transition-transform duration-200",{"rotate-180":R(e.id)}])},[...o[3]||(o[3]=[t("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M19 9L12 16L5 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)],8,de),R(e.id)?(n(),a("div",pe,[Q(e)?(n(),a("div",fe,[t("div",me,[v(E,{content:H(Q(e),"python")},null,8,["content"])])])):y("",!0),e.result?(n(),a("div",he,[t("div",ge,p(q(e.result).hasError?s.$t("python.executionError"):s.$t("python.executionOutput")),1),t("div",{class:M(["bg-accent mt-2 max-h-[400px] w-full overflow-y-auto rounded-md text-sm",{"text-red-500":q(e.result).hasError}])},[v(E,{content:H(q(e.result).output,"plaintext")},null,8,["content"])],2)])):y("",!0)])):y("",!0)])):e.type==="crawl_tool"?(n(),a("div",ye,[t("div",null,[v(P,{className:"flex items-center text-base font-medium italic",animated:!e.result},{default:D(()=>[v(I,{name:"book-open",class:"w-4 h-4 mr-2"}),o[4]||(o[4]=t("span",null,"æ£å¨è¯»å",-1))]),_:1},8,["animated"])]),t("ul",ve,[t("li",_e,[v(I,{name:"globe",class:"mt-1 w-4 h-4"}),t("a",{href:U(e),target:"_blank",class:"h-full flex-grow overflow-hidden text-ellipsis whitespace-nowrap hover:underline"},p(U(e)),9,ke)])])])):(n(),a("div",xe,[t("div",{class:"flex items-center cursor-pointer font-medium italic",onClick:r=>F(e.id)},[v(I,{name:"wrench",class:"w-4 h-4 mr-2"}),v(P,{className:"text-base font-medium italic",animated:!e.result},{default:D(()=>[X(" Running "+p(e.name?e.name+"()":"MCP tool"),1)]),_:2},1032,["animated"]),t("div",{class:M(["ml-2 transition-transform duration-200",{"rotate-180":R(e.id)}])},[...o[5]||(o[5]=[t("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M19 9L12 16L5 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)],8,we),R(e.id)&&e.result?(n(),a("div",be,[t("div",$e,[v(E,{content:H(st(e.result),"python")},null,8,["content"])])])):y("",!0)]))]))),128))])):y("",!0)])):y("",!0)}}),Le=tt(Ae,[["__scopeId","data-v-bdf62947"]]);export{Le as D,jt as T,Et as a,Lt as e};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.