${Pn(o,!0)}`}br(o){return"An error occurred:
"+Pn(s.message+"",!0)+"";return l?Promise.resolve(c):c}if(l)return Promise.reject(s);throw s}}},Wr=new dm;function Le(o,l){return Wr.parse(o,l)}Le.options=Le.setOptions=function(o){return Wr.setOptions(o),Le.defaults=Wr.defaults,gf(Le.defaults),Le};Le.getDefaults=Ka;Le.defaults=Ur;Le.use=function(...o){return Wr.use(...o),Le.defaults=Wr.defaults,gf(Le.defaults),Le};Le.walkTokens=function(o,l){return Wr.walkTokens(o,l)};Le.parseInline=Wr.parseInline;Le.Parser=Yn;Le.parser=Yn.parse;Le.Renderer=_o;Le.TextRenderer=iu;Le.Lexer=Qn;Le.lexer=Qn.lex;Le.Tokenizer=bo;Le.Hooks=Lo;Le.parse=Le;Le.options;Le.setOptions;Le.use;Le.walkTokens;Le.parseInline;Yn.parse;Qn.lex;const lt={flex:"none",display:"block"};function Ha({size:o=13,color:l="var(--t3)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M1.5 4a1.5 1.5 0 0 1 1.5-1.5h2.6l1.3 1.5H11A1.5 1.5 0 0 1 12.5 5.5v5A1.5 1.5 0 0 1 11 12H3a1.5 1.5 0 0 1-1.5-1.5V4z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Ba({size:o=14,color:l="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.03 2.75 2.75 0 0 1-.4 6H4.5z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Cf({size:o=14,color:l="var(--t5)",strokeWidth:s=1.2,style:c}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...c},children:[u.jsx("rect",{x:"2",y:"3.5",width:"12",height:"7.5",rx:"1.4",stroke:l,strokeWidth:s}),u.jsx("path",{d:"M5.5 13.5h5",stroke:l,strokeWidth:s,strokeLinecap:"round"})]})}function Ho({size:o=11,color:l="var(--t4)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 12 12",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M6 2v8M2 6h8",stroke:l,strokeWidth:"1.4",strokeLinecap:"round"})})}function Rf({size:o=10,color:l="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M3.5 2L7 5 3.5 8",stroke:l,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Va({size:o=8,color:l="var(--t6)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",stroke:l,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nf({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("circle",{cx:"3",cy:"7",r:"1.1",fill:l}),u.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:l}),u.jsx("circle",{cx:"11",cy:"7",r:"1.1",fill:l})]})}function If({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("rect",{x:"2",y:"2.5",width:"10",height:"3",rx:"1",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M3 5.5v4A1.5 1.5 0 0 0 4.5 11h5A1.5 1.5 0 0 0 11 9.5v-4M5.5 7.5h3",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"})]})}function Oo({size:o=12,color:l="var(--err)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M2.5 3.5h9M5.5 3.5v-1h3v1M4 3.5l.5 7A1.5 1.5 0 0 0 6 12h2a1.5 1.5 0 0 0 1.5-1.5l.5-7",stroke:l,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function fm({size:o=15,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...s},children:[u.jsx("path",{d:"M6.8 1.8h2.4l.3 1.6c.5.2 1 .4 1.4.8l1.6-.6 1.2 2-1.3 1.1c.05.25.1.55.1.85s-.05.6-.1.85l1.3 1.1-1.2 2-1.6-.6c-.4.35-.9.6-1.4.8l-.3 1.6H6.8l-.3-1.6c-.5-.2-1-.45-1.4-.8l-1.6.6-1.2-2 1.3-1.1A4.6 4.6 0 0 1 3.5 8c0-.3.03-.6.1-.85L2.3 6l1.2-2 1.6.6c.4-.35.9-.6 1.4-.8l.3-2z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.9",stroke:l,strokeWidth:"1.2"})]})}function pm({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("path",{d:"M4 2.5v6.2a2 2 0 1 0 1.3.05V4.8",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"4.6",cy:"10.7",r:"1.6",stroke:l,strokeWidth:"1.2"}),u.jsx("circle",{cx:"9.4",cy:"3.3",r:"1.6",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M9.4 4.9v2.3a2 2 0 0 1-2 2h-.7",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"})]})}function hm({size:o=13,color:l="var(--t5)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M7 4v3.2l2.2 1.3",stroke:l,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mo({size:o=9,color:l="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M2 2l6 6M8 2L2 8",stroke:l,strokeWidth:"1.4",strokeLinecap:"round"})})}function zf({size:o=13,color:l="#fff",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M7 11.5V2.8M3.2 6.3 7 2.5l3.8 3.8",stroke:l,strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function gm({size:o=11,color:l="var(--t3)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 12 12",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M6 1.2 10 2.8v3c0 2.4-1.7 4.2-4 5-2.3-.8-4-2.6-4-5v-3L6 1.2z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Af({size:o=10,color:l="var(--ok)",strokeWidth:s=1.5,style:c}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...c},children:u.jsx("path",{d:"M1.5 5.5 4 8l4.5-6",stroke:l,strokeWidth:s,strokeLinecap:"round",strokeLinejoin:"round"})})}function mm({size:o=12,color:l="var(--acc)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 12 12",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M6 1c.4 2.6 1.4 3.6 4 4-2.6.4-3.6 1.4-4 4-.4-2.6-1.4-3.6-4-4 2.6-.4 3.6-1.4 4-4z",fill:l})})}function vm({size:o=8,color:l="var(--err)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 8 8",style:{...lt,...s},children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:l})})}function ym({size:o=13,color:l="var(--warn)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.8",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M7 4.2v3.3M7 9.6v.4",stroke:l,strokeWidth:"1.3",strokeLinecap:"round"})]})}function xm({size:o=10,color:l="var(--t1)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M6.5 2 3 5l3.5 3",stroke:l,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const Po={items:[],running:!1,usage:null,streamKind:"",turnEnded:!1,model:"",permMode:""},wm={approved:"已允许",denied:"已拒绝",timeout:"已超时(按拒绝处理)",cancelled:"已取消"};function $d(o){switch(o){case"allowed":return"已允许";case"rejected":return"已拒绝";case"expired":return"(已过期)";default:return wm[o]??o}}function ef(o,l,s){const c=o.items.slice(),f=c[c.length-1];return o.streamKind===l&&f&&f.kind===l?c[c.length-1]={...f,text:f.text+s}:c.push({kind:l,text:s}),{...o,items:c,streamKind:l}}function wr(o,l){return{...o,items:[...o.items,l],streamKind:""}}function tf(o){return o.map(l=>l.kind==="perm"&&l.state==="open"?{...l,state:"expired"}:l)}const Io=200;function km(o,l,s){const c=o.items.slice();for(let f=c.length-1;f>=0;f--){const h=c[f];if(!(h.kind!=="tool"||h.tcId!==l)){switch(s.kind){case"subagent_tool":{let y=(h.feed??[]).slice();const m=y.findIndex(w=>w.kind==="tool"&&w.id===s.id),S={kind:"tool",id:s.id??String(y.length),title:s.title??"",status:s.status??"run"};if(m>=0){const w=y[m];y[m]={...S,title:S.title||w.title}}else y.push(S),y.length>Io&&(y=y.slice(-Io));c[f]={...h,feed:y};break}case"subagent_text":{if(!s.line)break;let y=(h.feed??[]).slice();y.push({kind:"text",text:s.line}),y.length>Io&&(y=y.slice(-Io)),c[f]={...h,feed:y};break}case"output":c[f]={...h,lastLine:s.line};break;case"child_session":c[f]={...h,childSessionId:s.childSessionId};break}return{...o,items:c}}}return o}function Sm(o,l){var s,c;switch(l.sessionUpdate){case"agent_message_chunk":return ef(o,"agent",((s=l.content)==null?void 0:s.text)??"");case"agent_thought_chunk":return ef(o,"thought",((c=l.content)==null?void 0:c.text)??"");case"tool_call":return wr(o,{kind:"tool",tcId:l.toolCallId??"",title:l.title||l.kind||"工具调用",status:"run",out:""});case"tool_call_update":{if(l.status==="in_progress")return l.progress?km(o,l.toolCallId??"",l.progress):o;const f=o.items.slice();for(let h=f.length-1;h>=0;h--){const y=f[h];if(y.kind==="tool"&&y.tcId===l.toolCallId){const m=typeof l.rawOutput=="string"?l.rawOutput.split(` +`)[0].slice(0,160):"";f[h]={...y,status:l.status==="completed"?"ok":"fail",out:m,lastLine:void 0};break}}return{...o,items:f}}case"plan":{const f=o.items.slice();for(let h=f.length-1;h>=0;h--)if(f[h].kind==="plan")return f[h]={kind:"plan",entries:l.entries??[]},{...o,items:f,streamKind:""};return wr(o,{kind:"plan",entries:l.entries??[]})}case"llm_call_retry":return wr(o,{kind:"sys",text:`模型调用重试 #${l.attempt??"?"}: ${l.message??""}`});case"usage_update":return{...o,usage:{used:l.used??0,size:l.size??0}};case"compact_status":return wr(o,{kind:"sys",text:l.status==="started"?"⟳ 上下文接近上限,正在压缩…":"⟳ 上下文压缩完成"});case"model_update":{const f=l.model??"";return{...wr(o,{kind:"sys",text:`模型已切换为 ${f}`}),model:f}}case"permission_mode_update":{const f=l.mode??"default";return{...wr(o,{kind:"sys",text:f==="yolo"?"⚡ 已开启 YOLO 模式:所有操作不再询问,直接执行":"已恢复默认权限模式"}),permMode:f}}default:return o}}function Em(o,l){switch(l.type){case"task-started":return{...o,running:!0};case"task-ended":return{...o,running:!1,streamKind:"",turnEnded:!0,items:[...tf(o.items),{kind:"sys",text:"— 本轮结束 —"}]};case"task-error":{const s=ci(l);return{...o,running:!1,streamKind:"",items:[...tf(o.items),{kind:"sys",text:"✗ "+((s==null?void 0:s.error)||"未知错误"),error:!0}]}}case"user-input":{const s=ci(l);let c="";try{c=s!=null&&s.content?Za(s.content):""}catch{c=(s==null?void 0:s.content)??""}return wr(o,{kind:"user",text:c})}case"permission-req":{const s=ci(l);return s!=null&&s.id?wr(o,{kind:"perm",id:s.id,title:s.title??"",tool:s.tool??"",state:"open"}):o}case"permission-resolved":{const s=ci(l);return s!=null&&s.id?{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===s.id&&c.state==="open"?{...c,state:s.outcome??"expired"}:c)}:o}case"task-running":if(l.kind==="acp_event"){const s=ci(l);if(s!=null&&s.update)return Sm(o,s.update)}return o;default:return o}}function Lf(o,l){let s=o;for(const c of l)s=Em(s,c);return s}function Tm(o,l,s){return{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===l&&c.state==="open"?{...c,state:s?"allowed":"rejected"}:c)}}Le.setOptions({gfm:!0,breaks:!0});const Wt="ui-monospace,Menlo,monospace";function jm(o){const l=o.target.closest("a");if(!l)return;o.preventDefault();const s=l.getAttribute("href")||"";/^https?:/i.test(s)&&Gh(s)}function Cm({text:o}){const l=B.useMemo(()=>Ig.sanitize(Le.parse(o,{async:!1})),[o]);return u.jsx("div",{className:"md",onClick:jm,dangerouslySetInnerHTML:{__html:l}})}function Rm({text:o}){const[l,s]=B.useState(!1);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[u.jsxs("div",{onClick:()=>s(!l),style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--t4)",cursor:"pointer",userSelect:"none",lineHeight:1.6,minWidth:0},children:[u.jsx(mm,{}),u.jsx("span",{style:{fontWeight:600,color:"var(--t3)",flex:"none"},children:"思考"}),!l&&u.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.trim().replace(/\s+/g," ")}),l&&u.jsx("span",{style:{flex:1}}),u.jsx(Rf,{size:9,color:"var(--t6)",style:{transform:l?"rotate(90deg)":"none",transition:"transform .15s ease"}})]}),l&&u.jsx("div",{style:{marginLeft:5,borderLeft:"2px solid var(--line)",padding:"2px 0 2px 13px",fontSize:12,color:"var(--t4)",lineHeight:1.7,whiteSpace:"pre-wrap",wordBreak:"break-word",animation:"mcin .2s ease"},children:o})]})}const Pf={background:"var(--card)",border:"1px solid var(--cardBd)",borderRadius:10,boxShadow:"var(--cardSh)",padding:"11px 14px"};function Nm({entries:o}){const l=s=>s==="completed"?"☑":s==="in_progress"?"◐":"☐";return u.jsx("div",{style:{...Pf,fontSize:12.5,display:"flex",flexDirection:"column",gap:4,animation:"mcin .25s ease"},children:o.map((s,c)=>u.jsxs("div",{style:{color:s.status==="completed"?"var(--t5)":s.status==="in_progress"?"var(--acc)":"var(--t2)",textDecoration:s.status==="completed"?"line-through":"none"},children:[u.jsx("span",{style:{display:"inline-block",width:18},children:l(s.status)})," ",s.content]},c))})}function Im({status:o}){const l=o==="run";return u.jsx("span",{style:{width:7,height:7,borderRadius:"50%",flex:"none",border:`1.5px solid ${l?"var(--acc)":o==="ok"?"var(--t5)":"var(--err)"}`,background:l?"var(--accBd)":"transparent",animation:l?"mcpulse 1.4s infinite":"none"}})}function zm(o){return o==="ok"?u.jsx(Af,{size:10}):o==="fail"?u.jsx("span",{style:{color:"var(--err)",fontSize:10,flex:"none"},children:"✗"}):u.jsx("span",{style:{color:"var(--t5)",fontSize:10,flex:"none",animation:"mcpulse 1.2s infinite"},children:"◌"})}function Am({item:o,onOpenChild:l}){const s=o.feed??[],c=s.slice(-5),f=o.title.indexOf(" "),h=f>0?o.title.slice(0,f):"",y=f>0?o.title.slice(f+1):o.title,m={display:"flex",gap:7,alignItems:"center",paddingLeft:15,font:"11px/1.7 "+Wt,color:"var(--t3)",whiteSpace:"nowrap",minWidth:0};return u.jsxs("div",{style:{...Pf,display:"flex",flexDirection:"column",gap:7,fontSize:12.5},children:[u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",minWidth:0,whiteSpace:"nowrap"},children:[u.jsx(Im,{status:o.status}),h&&u.jsx("span",{style:{fontWeight:600,flex:"none",color:"var(--t1)"},children:h}),u.jsx("span",{style:{color:"var(--t3)",font:"12px "+Wt,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:y}),u.jsx("span",{style:{flex:1}}),o.out&&u.jsx("span",{style:{color:"var(--t5)",fontSize:11,flex:"none",maxWidth:"40%",overflow:"hidden",textOverflow:"ellipsis"},children:o.out}),o.childSessionId&&l&&u.jsx("a",{href:"#",onClick:S=>{S.preventDefault(),l(o.childSessionId)},style:{fontSize:11.5,fontWeight:600,flex:"none"},children:"查看子会话"})]}),c.length>0&&u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:c.map((S,w)=>u.jsx("div",{style:m,children:S.kind==="tool"?u.jsxs(u.Fragment,{children:[zm(S.status),u.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:S.title})]}):u.jsx("span",{style:{color:"var(--t5)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:S.text})},s.length-c.length+w))}),o.status==="run"&&o.lastLine&&u.jsx("div",{style:{...m,display:"block",color:"var(--t5)",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",animation:"mcpulse 1.2s infinite"},children:o.lastLine})]})}function nf(o){switch(o){case"allowed":case"approved":return{text:"✓ 已允许",color:"var(--ok)"};case"rejected":case"denied":return{text:"✕ 已拒绝",color:"var(--err)"};case"timeout":return{text:"✕ "+$d(o),color:"var(--err)"};default:return{text:$d(o),color:"var(--t5)"}}}function Lm({item:o,onAnswer:l}){const s={height:28,display:"flex",alignItems:"center",padding:"0 14px",background:"var(--card)",border:"1px solid var(--line)",color:"var(--t2)",borderRadius:8,cursor:"pointer",fontSize:12.5,fontWeight:600,userSelect:"none",whiteSpace:"nowrap"};return u.jsxs("div",{style:{border:"1px solid var(--warnBd)",borderRadius:12,background:"var(--warnBg)",padding:"13px 15px",maxWidth:560,animation:"mcin .25s ease"},children:[u.jsxs("div",{style:{fontSize:12.5,fontWeight:700,color:"var(--warn)",whiteSpace:"nowrap"},children:["需要确认 · ",o.tool||"执行操作"]}),u.jsx("div",{style:{margin:"9px 0 11px",padding:"8px 12px",background:"var(--card)",border:"1px solid var(--line2)",borderRadius:8,font:"12.5px "+Wt,color:"var(--t1)",wordBreak:"break-all"},children:o.title}),o.state==="open"?u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[u.jsx("div",{className:"hv-acc",onClick:()=>l(o.id,"allow"),style:{...s,background:"var(--acc)",borderColor:"var(--acc)",color:"var(--onAcc)"},children:"允许"}),u.jsx("div",{className:"hv",onClick:()=>l(o.id,"always"),style:s,children:"本会话始终"}),u.jsx("div",{className:"hv",onClick:()=>l(o.id,"persist"),style:s,children:"此项目永久"}),u.jsx("div",{className:"hv-errbg",onClick:()=>l(o.id,"deny"),style:{...s,background:"transparent",border:"1px solid rgba(194,80,62,.3)",color:"var(--err)"},children:"拒绝"}),u.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--t5)"},children:"⏎ 允许 · esc 拒绝"})]}):u.jsx("div",{style:{fontSize:12,color:nf(o.state).color},children:nf(o.state).text})]})}function Pm(){const o=u.jsx("span",{style:{flex:1,height:1,background:"var(--line2)"}});return u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--t6)",fontSize:10.5,letterSpacing:1},children:[o,"本轮结束",o]})}const Dm=/^\[图片\] (\S+)$/;function bm({text:o,uploadUrl:l}){const[s,c]=B.useState(null),f=o.split(` +`),h=[],y=[];for(const S of f){const w=S.match(Dm);w&&l?h.push(w[1]):y.push(S)}const m=y.join(` +`).trim();return u.jsxs("div",{style:{display:"flex",justifyContent:"flex-end"},children:[u.jsxs("div",{style:{maxWidth:"70%",background:"var(--userBg)",border:"1px solid var(--accBd)",borderRadius:"12px 12px 3px 12px",padding:"9px 15px",fontSize:13.5,lineHeight:1.6,color:"var(--t1)",whiteSpace:"pre-wrap",wordBreak:"break-word",animation:"mcin .25s ease"},children:[m,h.length>0&&u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:m?8:2},children:h.map(S=>u.jsx("img",{src:l(S),alt:S,title:S,onClick:()=>c(S),style:{maxWidth:150,maxHeight:120,borderRadius:8,border:"1px solid var(--accBd)",cursor:"zoom-in",display:"block"}},S))})]}),s&&u.jsx("div",{onClick:()=>c(null),style:{position:"fixed",inset:0,background:"rgba(20,30,25,.55)",zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out"},children:u.jsx("img",{src:l(s),alt:s,style:{maxWidth:"90vw",maxHeight:"90vh",borderRadius:10,boxShadow:"0 24px 70px rgba(0,0,0,.4)"}})})]})}function _m({item:o,onPermAnswer:l,uploadUrl:s}){switch(o.kind){case"user":return u.jsx(bm,{text:o.text,uploadUrl:s});case"agent":return u.jsx("div",{style:{maxWidth:"92%",wordBreak:"break-word",animation:"mcin .25s ease"},children:u.jsx(Cm,{text:o.text})});case"thought":return u.jsx(Rm,{text:o.text});case"plan":return u.jsx(Nm,{entries:o.entries});case"sys":return o.text==="— 本轮结束 —"?u.jsx(Pm,{}):u.jsx("div",{style:{color:o.error?"var(--err)":"var(--t5)",fontSize:11.5,textAlign:"center"},children:o.text});case"perm":return u.jsx(Lm,{item:o,onAnswer:l})}}function Df({items:o,onPermAnswer:l,onOpenChild:s,uploadUrl:c}){const f=[];for(let h=0;h