@alwith/module-chat 0.5.16 → 0.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/approval/choice-elicitation-form.js +1 -1
  2. package/dist/approval/choice-schema.js +1 -1
  3. package/dist/approval/schema-elicitation-form.js +1 -1
  4. package/dist/{chunk-20mzyay7.js → chunk-0dnwqm94.js} +1 -1
  5. package/dist/{chunk-g5gz25jy.js → chunk-0n3q4g7y.js} +2 -2
  6. package/dist/{chunk-6acs2hzs.js → chunk-0ss92kxr.js} +2 -2
  7. package/dist/{chunk-3w0wbv9c.js → chunk-14r2ktqe.js} +2 -2
  8. package/dist/{chunk-6k4mbmg1.js → chunk-1gp5f49d.js} +1 -1
  9. package/dist/{chunk-vk36fprb.js → chunk-2ahqcs3n.js} +2 -2
  10. package/dist/{chunk-7f89k828.js → chunk-2cbya1f5.js} +1 -1
  11. package/dist/{chunk-4andq00q.js → chunk-2mmhpb9s.js} +2 -2
  12. package/dist/{chunk-qpmjezsw.js → chunk-2rperg04.js} +1 -1
  13. package/dist/{chunk-40d5the9.js → chunk-2swp3nfs.js} +2 -2
  14. package/dist/{chunk-zzhwfrzb.js → chunk-3ebdnbcj.js} +1 -1
  15. package/dist/{chunk-dxnttcwd.js → chunk-3k5n3809.js} +1 -1
  16. package/dist/{chunk-0pv9mq6d.js → chunk-3my2mbn9.js} +2 -2
  17. package/dist/{chunk-z3mp9z01.js → chunk-465r54av.js} +1 -1
  18. package/dist/{chunk-rxc15vtr.js → chunk-4zzhckab.js} +2 -2
  19. package/dist/{chunk-c493d8ay.js → chunk-58wt406v.js} +1 -1
  20. package/dist/{chunk-61944cv6.js → chunk-59j0p8hy.js} +2 -2
  21. package/dist/{chunk-qvknvzqn.js → chunk-5p1cs4vg.js} +2 -2
  22. package/dist/{chunk-t1j88bvm.js → chunk-65m4bm74.js} +2 -2
  23. package/dist/{chunk-56e8naj1.js → chunk-6b1hdb25.js} +1 -1
  24. package/dist/{chunk-f4a1my6v.js → chunk-6nnwmqqp.js} +2 -2
  25. package/dist/{chunk-p1wnt0e5.js → chunk-74824tng.js} +1 -1
  26. package/dist/{chunk-4tff1nyj.js → chunk-7ap638hx.js} +1 -1
  27. package/dist/{chunk-1aeswxaf.js → chunk-7jdjdnh6.js} +1 -1
  28. package/dist/chunk-7mr1zajc.js +4 -0
  29. package/dist/{chunk-m2jsfvs2.js → chunk-7wyrcphh.js} +1 -1
  30. package/dist/{chunk-egqxz6f8.js → chunk-88cfz41t.js} +2 -2
  31. package/dist/{chunk-zjmqne2f.js → chunk-8bfnjqkg.js} +1 -1
  32. package/dist/{chunk-r4r5ythb.js → chunk-8g09jrj1.js} +2 -2
  33. package/dist/{chunk-7qrz8zq8.js → chunk-91h14q3y.js} +2 -2
  34. package/dist/{chunk-9zmkj0dp.js → chunk-9scwmd07.js} +3 -3
  35. package/dist/{chunk-q4btsq6a.js → chunk-9v7zgsa9.js} +3 -3
  36. package/dist/{chunk-0keppemg.js → chunk-as1cvbzm.js} +2 -2
  37. package/dist/{chunk-cjmjv7pv.js → chunk-bew4srqj.js} +1 -1
  38. package/dist/{chunk-h2gng003.js → chunk-bnj58bev.js} +2 -2
  39. package/dist/{chunk-2aqv0chk.js → chunk-bv4adcrd.js} +1 -1
  40. package/dist/{chunk-nbkkfyss.js → chunk-c1vavp0q.js} +1 -1
  41. package/dist/{chunk-n8kfbg68.js → chunk-c26vy827.js} +2 -2
  42. package/dist/{chunk-dyp6kjqz.js → chunk-c2bkhrcc.js} +2 -2
  43. package/dist/{chunk-7zrnt6zw.js → chunk-cazdmcwd.js} +2 -2
  44. package/dist/{chunk-7eje3z81.js → chunk-d94rmh12.js} +1 -1
  45. package/dist/{chunk-pzth3knm.js → chunk-ebmbz9tg.js} +1 -1
  46. package/dist/{chunk-cf5mxxyp.js → chunk-ewvhf3wb.js} +2 -2
  47. package/dist/{chunk-aarvddmn.js → chunk-gdpa9dp5.js} +1 -1
  48. package/dist/{chunk-25bzk1wv.js → chunk-h68f23r0.js} +1 -1
  49. package/dist/{chunk-pafshe3v.js → chunk-hfaarm10.js} +2 -2
  50. package/dist/{chunk-5cnw6yc7.js → chunk-jdjk6tf4.js} +1 -1
  51. package/dist/{chunk-2mkqpzzx.js → chunk-jfb6a7tz.js} +1 -1
  52. package/dist/{chunk-r9p03chx.js → chunk-kmhwwzga.js} +1 -1
  53. package/dist/{chunk-z4zm74ge.js → chunk-ktjma5ts.js} +2 -2
  54. package/dist/{chunk-y2z94rrh.js → chunk-m9en74e3.js} +2 -2
  55. package/dist/{chunk-b9hjn4a5.js → chunk-nqv69z6n.js} +2 -2
  56. package/dist/{chunk-2ecx1xed.js → chunk-qca5mhqd.js} +1 -1
  57. package/dist/{chunk-y3567zfn.js → chunk-rf9yxbes.js} +2 -2
  58. package/dist/{chunk-x7jtngzd.js → chunk-s0zbha64.js} +1 -1
  59. package/dist/{chunk-nt224frq.js → chunk-sf6ze845.js} +1 -1
  60. package/dist/{chunk-nact4a4b.js → chunk-t1yzfva7.js} +1 -1
  61. package/dist/{chunk-frqg34kq.js → chunk-txn8v2yc.js} +1 -1
  62. package/dist/{chunk-vzy4vwqr.js → chunk-tyngss2t.js} +2 -2
  63. package/dist/{chunk-10j68dch.js → chunk-tz96pyvx.js} +2 -2
  64. package/dist/{chunk-xe52kj6h.js → chunk-v29ww61x.js} +3 -3
  65. package/dist/{chunk-jzkmsbpe.js → chunk-v8cyw9xa.js} +1 -1
  66. package/dist/{chunk-aj5fk4ez.js → chunk-vp8fb7r8.js} +1 -1
  67. package/dist/chunk-w1awbykg.js +2 -0
  68. package/dist/{chunk-4ed8as5d.js → chunk-w390ewja.js} +1 -1
  69. package/dist/{chunk-jkwf97cs.js → chunk-wrkwz65x.js} +2 -2
  70. package/dist/chunk-xe3h32y1.js +4 -0
  71. package/dist/{chunk-7jyekmy9.js → chunk-yy4tw3nj.js} +2 -2
  72. package/dist/chunk-zbe8myhx.js +3 -0
  73. package/dist/codex/activity-group.js +1 -1
  74. package/dist/codex/assistant-message.js +1 -1
  75. package/dist/codex/async-question-card.js +1 -1
  76. package/dist/codex/edited-files-card.d.ts +2 -1
  77. package/dist/codex/edited-files-card.js +1 -1
  78. package/dist/codex/markdown-renderer.js +1 -1
  79. package/dist/codex/navigation-audio.js +1 -1
  80. package/dist/codex/timeline-virtualizer.js +1 -1
  81. package/dist/codex/user-message.js +1 -1
  82. package/dist/codex/virtualized-turn-list.js +1 -1
  83. package/dist/composer/completion-filter.js +1 -1
  84. package/dist/composer/completion-menu.js +1 -1
  85. package/dist/composer/effort-slider.js +1 -1
  86. package/dist/composer/menu-radio.js +1 -1
  87. package/dist/composer/model-select.js +1 -1
  88. package/dist/composer/permission-mode-select.js +1 -1
  89. package/dist/composer/prompt-input-attachments.js +1 -1
  90. package/dist/composer/prompt-input-context.js +1 -1
  91. package/dist/composer/prompt-input-textarea.js +1 -1
  92. package/dist/composer/prompt-input.js +1 -1
  93. package/dist/conversation/action-card.js +1 -1
  94. package/dist/conversation/composer/composer.js +1 -1
  95. package/dist/conversation/composer/drafts.js +1 -1
  96. package/dist/conversation/composer/long-text.js +1 -1
  97. package/dist/conversation/composer/mention-chips.js +1 -1
  98. package/dist/conversation/composer/mention-uri.js +1 -1
  99. package/dist/conversation/composer/model-menu.js +1 -1
  100. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  101. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  102. package/dist/conversation/composer/prediction.js +1 -1
  103. package/dist/conversation/composer/slash-command-button.js +1 -1
  104. package/dist/conversation/composer/submit-button.js +1 -1
  105. package/dist/conversation/composer/usage-meter.js +1 -1
  106. package/dist/conversation/context.js +1 -1
  107. package/dist/conversation/conversation-body.js +1 -1
  108. package/dist/conversation/conversation-view.js +1 -1
  109. package/dist/conversation/conversation.js +1 -1
  110. package/dist/conversation/session-actions.js +1 -1
  111. package/dist/conversation/subagent-sessions.js +1 -1
  112. package/dist/lib/fuzzy.js +1 -1
  113. package/dist/lib/markdown-parser.js +1 -1
  114. package/dist/lib/markdown-rules.js +1 -1
  115. package/dist/lib/model-name.js +1 -1
  116. package/dist/lib/streaming-markdown.js +1 -1
  117. package/dist/search/chat-search.js +1 -1
  118. package/dist/search/dom-matches.js +1 -1
  119. package/dist/search/literal-matches.js +1 -1
  120. package/dist/session-list/archived-sessions.js +1 -1
  121. package/dist/session-list/navigation.js +1 -1
  122. package/dist/session-list/session-info-card.js +1 -1
  123. package/dist/session-list/session-list.js +1 -1
  124. package/dist/session-list/session-row.js +1 -1
  125. package/dist/session-list/session-state-menu.js +1 -1
  126. package/dist/session-list/virtual-session-rows.js +1 -1
  127. package/dist/session-timeline/activity-group.js +1 -1
  128. package/dist/session-timeline/assistant-turn.js +1 -1
  129. package/dist/session-timeline/async-questions.js +1 -1
  130. package/dist/session-timeline/edited-files-card.js +1 -1
  131. package/dist/session-timeline/history-timeline.js +1 -1
  132. package/dist/session-timeline/navigation-rail.js +1 -1
  133. package/dist/session-timeline/session-timeline.js +1 -1
  134. package/dist/session-timeline/timeline-registry.js +1 -1
  135. package/dist/session-timeline/turn-error.js +1 -1
  136. package/dist/session-timeline/turns.js +1 -1
  137. package/dist/session-timeline/types.d.ts +3 -0
  138. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  139. package/dist/session-timeline/user-message.js +1 -1
  140. package/dist/ui/alert.js +1 -1
  141. package/dist/ui/dropdown-menu.js +1 -1
  142. package/dist/ui/field.js +1 -1
  143. package/dist/ui/input-group.js +1 -1
  144. package/dist/ui/select.js +1 -1
  145. package/dist/ui/skeleton.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunk-4r3ch7fk.js +0 -2
  148. package/dist/chunk-8e3wcvkd.js +0 -4
  149. package/dist/chunk-en8s7tet.js +0 -4
  150. package/dist/chunk-gtahrx8j.js +0 -3
@@ -0,0 +1,4 @@
1
+ import{e}from"./chunk-wpdn3rx8.js";import{v}from"./chunk-kjtd3wc3.js";import{Y,A}from"./chunk-0nkvfecf.js";import{k}from"./chunk-da6d6wze.js";import{useEffect as R,useId as N,useRef as w}from"react";import{jsx as l,jsxs as p,Fragment as _}from"react/jsx-runtime";function u(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function h(n){if(!u(n)||!u(n.codex))return[];let r=n.codex,i=r.questions;if(r.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>u(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((c)=>typeof c==="string"))))return[];return i}function dn(n,r){return JSON.stringify(["request_user_input_async",n,r])}function er(n){return{selected:n.options?.length?0:null,text:""}}function xt(n,r){return r.selected===null?r.text:n.options?.[r.selected]??""}function tr(n){return`<send_user_message_question_reply>
2
+ ${JSON.stringify([n])}
3
+ </send_user_message_question_reply>`}function un(n){if(!u(n)||!u(n.codex))return[];let r=n.codex;return(Array.isArray(r.questionReplyParts)?r.questionReplyParts.map((t)=>u(t)?{...t,answer:t.text}:t):[r.questionReply]).filter((t)=>u(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:c,answer:m})=>({questionItemId:t,question:c,answer:m}))}function nr({question:n,draft:r,status:i,answer:t,error:c,onChange:m,onSubmit:f,onSkip:b,t:a}){let y=N(),g=w(!1),o=w(null);R(()=>()=>{if(o.current!==null)cancelAnimationFrame(o.current)},[]);let d=i==="pending",Q=i==="answered"||i==="skipped";return p("section",{"aria-labelledby":`${y}-title`,className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 text-card-foreground",children:[l("h3",{id:`${y}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),Q?l("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:a("asyncQuestion.skipped")}):p(_,{children:[(n.options?.length??0)>0&&p(Y,{"aria-labelledby":`${y}-title`,disabled:!d,value:r.selected===null?"other":String(r.selected),onValueChange:(s)=>m({...r,selected:s==="other"?null:Number(s)}),children:[n.options?.map((s,x)=>p(v,{className:"flex items-start gap-2 text-sm",children:[l(A,{value:String(x)}),l("span",{className:"whitespace-pre-wrap",children:s})]},x)),p(v,{className:"flex items-center gap-2 text-sm",children:[l(A,{value:"other"}),a("asyncQuestion.other")]})]}),l(k,{rows:1,className:"min-h-0 resize-none",onCompositionStart:()=>{if(o.current!==null)cancelAnimationFrame(o.current);o.current=null,g.current=!0},onCompositionEnd:()=>{if(g.current=!1,o.current!==null)cancelAnimationFrame(o.current);o.current=requestAnimationFrame(()=>{o.current=null})},onKeyDown:(s)=>{if(s.key!=="Enter"||s.shiftKey||s.altKey||s.ctrlKey||s.metaKey||g.current||o.current!==null||s.nativeEvent.isComposing||s.nativeEvent.keyCode===229)return;if(s.preventDefault(),d&&xt(n,{...r,text:s.currentTarget.value}).trim().length>0)f()},"aria-label":a("asyncQuestion.answer"),placeholder:a("asyncQuestion.answer"),value:r.text,readOnly:!d,onChange:(s)=>m({selected:null,text:s.target.value})}),c&&l("p",{role:"alert",className:"text-sm text-destructive",children:c}),p("div",{className:"flex flex-wrap items-center gap-2",children:[l(e,{size:"sm",disabled:!d||xt(n,r).trim().length===0,onClick:f,children:a(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),l(e,{size:"sm",variant:"ghost",disabled:!d,onClick:b,children:a("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&l("span",{role:"status",className:"text-xs text-muted-foreground",children:a(`asyncQuestion.${i}`)})]})]})]})}
4
+ export{h,dn,er,xt,tr,un,nr};
@@ -1 +1 @@
1
- import{cn as t}from"cn";import{jsx as n}from"react/jsx-runtime";function It({className:e,...o}){return n("div",{"data-slot":"skeleton",className:t("animate-pulse rounded-md bg-muted",e),...o})}export{It};
1
+ import{cn as t}from"cn";import{jsx as n}from"react/jsx-runtime";function Pt({className:e,...o}){return n("div",{"data-slot":"skeleton",className:t("animate-pulse rounded-md bg-muted",e),...o})}export{Pt};
@@ -1,2 +1,2 @@
1
- function fn(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function St(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function ae(t){return t.type==="array"}function Ke(t){return(ae(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
2
- export{fn,St,ae,Ke};
1
+ function fn(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function It(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function ae(t){return t.type==="array"}function Ke(t){return(ae(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
2
+ export{fn,It,ae,Ke};
@@ -1,2 +1,2 @@
1
- import{_e}from"./chunk-7zrnt6zw.js";import{G,Gn}from"./chunk-r9p03chx.js";import{t}from"./chunk-q6km9nha.js";import{zn}from"./chunk-9j609g4n.js";import{ue,me,pe}from"./chunk-ea3582qy.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Bn({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=_e(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(G,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ue,{children:[o(me,{render:o(Gn,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(pe,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(zn,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
1
+ import{_e}from"./chunk-cazdmcwd.js";import{G,Gn}from"./chunk-kmhwwzga.js";import{t}from"./chunk-q6km9nha.js";import{zn}from"./chunk-9j609g4n.js";import{ue,me,pe}from"./chunk-ea3582qy.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Bn({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=_e(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(G,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ue,{children:[o(me,{render:o(Gn,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(pe,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(zn,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
2
  export{Bn};
@@ -1,2 +1,2 @@
1
- import{nt,J}from"./chunk-tq6ekz3s.js";import{_}from"./chunk-2pj3pcc7.js";import{q}from"./chunk-djmnmbm2.js";import{ee}from"./chunk-3919sqde.js";import{Se,ce,Ie}from"./chunk-2r3sfmyf.js";import{PreviewCard as x}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as I}from"lucide-react";import{createContext as S,useContext as k,useLayoutEffect as T,useState as R}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as G}from"react/jsx-runtime";function vn(o){if(o.as==="ul"){let{as:i,className:r,...a}=o;return e("ul",{className:p("flex w-full min-w-0 flex-col gap-0.5",r),...a})}let{as:t,className:n,...s}=o;return e("div",{className:p("flex w-full min-w-0 flex-col gap-0.5",n),...s})}function Te({className:o,...t}){return e("span",{"data-slot":"navigation-leading",className:p("flex size-6 shrink-0 items-center justify-center [&_.lucide]:size-3.5",o),...t})}function Ze({active:o,className:t,...n}){return e("button",{type:"button","data-active":o?"":void 0,"aria-current":o?"page":void 0,className:p("group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function At({open:o,onOpenChange:t,tooltip:n,leading:s,label:i,count:r,countLabel:a,active:l=!1,actions:N,headerChildren:f,wrapHeader:u,onHeaderClick:w,children:C}){let b=()=>{w?.(),t(!o)},m=p(Se,"relative flex h-[30px] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),h=d(G,{children:[s!=null&&e(Te,{children:s}),f??e(_,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(Ie,{content:r!==void 0?e(ce,{className:p("text-muted-foreground justify-end text-xs opacity-70",a&&"w-auto"),children:e("span",{dir:"ltr",children:a??r})}):void 0,actions:N})})]}),P=f==null?d("div",{"data-active":l?"":void 0,title:n,className:p(m,J),onClick:b,onKeyDown:(c)=>{if(c.target!==c.currentTarget)return;if(c.key!=="Enter"&&c.key!==" ")return;c.preventDefault(),b()},children:[e("button",{type:"button","aria-expanded":o,"aria-label":typeof i==="string"?i:n,className:"focus-visible:outline-ring absolute inset-0 rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]"}),h]}):e("div",{"data-active":l?"":void 0,className:m,children:h});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[u===void 0?P:u(P),o&&e(vn,{className:"mt-0.5",children:C})]})}var H=S(()=>{}),O=S(()=>{});function Je(){return k(O)}function et(){return k(H)}function tt({active:o=!1,state:t,interruption:n=null,leased:s=!1,media:i,title:r,hoverCard:a,onHoverCardOpenChange:l,subtitle:N,preview:f,listeningPorts:u,onOpenPort:w,accessory:C,meta:b,hint:m,actions:h,className:P,...c}){let y=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Se,nt,"group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(f||u!=null&&u.length>0)&&"h-auto min-h-[30px] py-2.5",P),...c,children:[e(Te,{children:t!=null?e(q,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(_,{className:p("leading-none",t==="done"&&"font-semibold"),children:r}),N!=null&&e(_,{className:"text-muted-foreground text-xs",children:N}),f&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:f}),u!=null&&u.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:u.map((v)=>w?d("button",{type:"button",className:"underline",onPointerDown:(g)=>g.stopPropagation(),onKeyDown:(g)=>g.stopPropagation(),onClick:(g)=>{g.stopPropagation(),w(v)},children:[":",v]},v):d("span",{children:[":",v]},v))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[s&&e(I,{className:"text-muted-foreground size-3"}),e(Ie,{content:C!=null?e(ce,{children:C}):b??e(ce,{}),actions:h}),m!=null&&e("span",{className:"pointer-events-none absolute end-1 top-1/2 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center",children:m})]})]});if(a==null)return y;return e(L,{row:y,onOpenChange:l,children:a})}function L({row:o,children:t,onOpenChange:n}){let[s,i]=R(!1),[r,a]=R(!1),l=s||r;return T(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(H.Provider,{value:a,children:e(O.Provider,{value:()=>{i(!1),a(!1)},children:e(E,{open:l,onOpenChange:i,trigger:o,children:t})})})}function E({open:o,onOpenChange:t,trigger:n,children:s,side:i="inline-end",sideOffset:r=2,align:a="start",alignOffset:l}){return ee(o),d(x.Root,{open:o,onOpenChange:t,children:[e(x.Trigger,{render:n,delay:700,closeDelay:100}),e(x.Portal,{children:e(x.Positioner,{side:i,sideOffset:r,align:a,alignOffset:l,className:"isolate z-50",children:e(x.Popup,{"data-slot":"codex-hover-card",className:"bg-popover text-popover-foreground ring-foreground/10 m-px flex w-80 max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md text-sm shadow-md ring-1 outline-hidden select-none",children:e("div",{className:"flex w-full min-w-0 flex-col px-0 py-1 break-words whitespace-normal",children:s})})})})]})}
2
- export{vn,Te,Ze,At,Je,et,tt};
1
+ import{nt,J}from"./chunk-tq6ekz3s.js";import{_}from"./chunk-2pj3pcc7.js";import{q}from"./chunk-djmnmbm2.js";import{ee}from"./chunk-3919sqde.js";import{Se,ce,Ie}from"./chunk-2r3sfmyf.js";import{PreviewCard as x}from"@base-ui/react/preview-card";import{cn as p}from"cn";import{LockIcon as I}from"lucide-react";import{createContext as S,useContext as k,useLayoutEffect as T,useState as R}from"react";import"@alwith/module-chat/session-list.css";import{jsx as e,jsxs as d,Fragment as G}from"react/jsx-runtime";function vn(o){if(o.as==="ul"){let{as:i,className:r,...a}=o;return e("ul",{className:p("flex w-full min-w-0 flex-col gap-0.5",r),...a})}let{as:t,className:n,...s}=o;return e("div",{className:p("flex w-full min-w-0 flex-col gap-0.5",n),...s})}function Te({className:o,...t}){return e("span",{"data-slot":"navigation-leading",className:p("flex size-6 shrink-0 items-center justify-center [&_.lucide]:size-3.5",o),...t})}function Ze({active:o,className:t,...n}){return e("button",{type:"button","data-active":o?"":void 0,"aria-current":o?"page":void 0,className:p("group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",t),...n})}function Lt({open:o,onOpenChange:t,tooltip:n,leading:s,label:i,count:r,countLabel:a,active:l=!1,actions:N,headerChildren:f,wrapHeader:u,onHeaderClick:w,children:C}){let b=()=>{w?.(),t(!o)},m=p(Se,"relative flex h-[30px] w-full items-center gap-1 rounded-[10px] ps-1 pe-1.5 text-start [corner-shape:superellipse(1.5)]"),h=d(G,{children:[s!=null&&e(Te,{children:s}),f??e(_,{className:"flex-1 text-sm opacity-70",children:i}),e("span",{className:"relative z-10 ms-auto",children:e(Ie,{content:r!==void 0?e(ce,{className:p("text-muted-foreground justify-end text-xs opacity-70",a&&"w-auto"),children:e("span",{dir:"ltr",children:a??r})}):void 0,actions:N})})]}),P=f==null?d("div",{"data-active":l?"":void 0,title:n,className:p(m,J),onClick:b,onKeyDown:(c)=>{if(c.target!==c.currentTarget)return;if(c.key!=="Enter"&&c.key!==" ")return;c.preventDefault(),b()},children:[e("button",{type:"button","aria-expanded":o,"aria-label":typeof i==="string"?i:n,className:"focus-visible:outline-ring absolute inset-0 rounded-[10px] outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]"}),h]}):e("div",{"data-active":l?"":void 0,className:m,children:h});return d("div",{className:"text-[#1a1c1f] dark:text-white",children:[u===void 0?P:u(P),o&&e(vn,{className:"mt-0.5",children:C})]})}var H=S(()=>{}),O=S(()=>{});function Je(){return k(O)}function et(){return k(H)}function tt({active:o=!1,state:t,interruption:n=null,leased:s=!1,media:i,title:r,hoverCard:a,onHoverCardOpenChange:l,subtitle:N,preview:f,listeningPorts:u,onOpenPort:w,accessory:C,meta:b,hint:m,actions:h,className:P,...c}){let y=d("div",{"data-slot":"navigation-session-item","data-active":o,className:p(Se,nt,"group/navigation-row focus-visible:outline-ring flex h-[30px] w-full items-center gap-1 overflow-hidden rounded-[10px] ps-1 pe-1.5 text-start text-sm outline-hidden [corner-shape:superellipse(1.5)] focus-visible:outline-2 focus-visible:outline-offset-[-2px]",(f||u!=null&&u.length>0)&&"h-auto min-h-[30px] py-2.5",P),...c,children:[e(Te,{children:t!=null?e(q,{state:t,title:n??void 0}):i}),d("span",{className:"flex min-w-0 flex-1 flex-col",children:[e(_,{className:p("leading-none",t==="done"&&"font-semibold"),children:r}),N!=null&&e(_,{className:"text-muted-foreground text-xs",children:N}),f&&e("span",{className:"text-muted-foreground mt-1.5 line-clamp-2 text-xs leading-[18px] [overflow-wrap:anywhere] break-words",children:f}),u!=null&&u.length>0&&e("span",{className:"text-muted-foreground mt-1.5 flex flex-wrap items-center gap-2 font-mono text-xs",children:u.map((v)=>w?d("button",{type:"button",className:"underline",onPointerDown:(g)=>g.stopPropagation(),onKeyDown:(g)=>g.stopPropagation(),onClick:(g)=>{g.stopPropagation(),w(v)},children:[":",v]},v):d("span",{children:[":",v]},v))})]}),d("span",{className:"relative ms-auto flex shrink-0 items-center gap-1",children:[s&&e(I,{className:"text-muted-foreground size-3"}),e(Ie,{content:C!=null?e(ce,{children:C}):b??e(ce,{}),actions:h}),m!=null&&e("span",{className:"pointer-events-none absolute end-1 top-1/2 flex h-5 min-w-5 -translate-y-1/2 items-center justify-center",children:m})]})]});if(a==null)return y;return e(L,{row:y,onOpenChange:l,children:a})}function L({row:o,children:t,onOpenChange:n}){let[s,i]=R(!1),[r,a]=R(!1),l=s||r;return T(()=>(n?.(l),()=>n?.(!1)),[l,n]),e(H.Provider,{value:a,children:e(O.Provider,{value:()=>{i(!1),a(!1)},children:e(E,{open:l,onOpenChange:i,trigger:o,children:t})})})}function E({open:o,onOpenChange:t,trigger:n,children:s,side:i="inline-end",sideOffset:r=2,align:a="start",alignOffset:l}){return ee(o),d(x.Root,{open:o,onOpenChange:t,children:[e(x.Trigger,{render:n,delay:700,closeDelay:100}),e(x.Portal,{children:e(x.Positioner,{side:i,sideOffset:r,align:a,alignOffset:l,className:"isolate z-50",children:e(x.Popup,{"data-slot":"codex-hover-card",className:"bg-popover text-popover-foreground ring-foreground/10 m-px flex w-80 max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-md text-sm shadow-md ring-1 outline-hidden select-none",children:e("div",{className:"flex w-full min-w-0 flex-col px-0 py-1 break-words whitespace-normal",children:s})})})})]})}
2
+ export{vn,Te,Ze,Lt,Je,et,tt};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-wpdn3rx8.js";import{t}from"./chunk-q6km9nha.js";import{codexTurnError as h}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as i}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function an({children:c}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:c})]})}function sn({error:c,retry:r}){let{t:f}=t(),p=h(c),[l]=i(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=i(r?.delaySeconds??null),[T,x]=i(!1),[g,w]=i(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((N)=>{let s=S.current;if(a.current||s===void 0)return;a.current=!0,x(!0),w(null),s(N).catch((n)=>{E.current=!0,a.current=!1,y(null),x(!1),w(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||l===null)return;let s=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((l-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(s)},[l,d]),m(an,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:T,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
2
- export{an,sn};
1
+ import{e}from"./chunk-wpdn3rx8.js";import{t}from"./chunk-q6km9nha.js";import{codexTurnError as h}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as i}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function sn({children:c}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:c})]})}function ln({error:c,retry:r}){let{t:f}=t(),p=h(c),[l]=i(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=i(r?.delaySeconds??null),[T,x]=i(!1),[g,w]=i(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((N)=>{let s=S.current;if(a.current||s===void 0)return;a.current=!0,x(!0),w(null),s(N).catch((n)=>{E.current=!0,a.current=!1,y(null),x(!1),w(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||l===null)return;let s=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((l-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(s)},[l,d]),m(sn,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:T,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
2
+ export{sn,ln};
@@ -1,3 +1,3 @@
1
- import{Jn}from"./chunk-a6b2vhmb.js";import{eo}from"./chunk-x7jtngzd.js";import{to}from"./chunk-m2xmz1ag.js";import{Be}from"./chunk-yh9qdb2k.js";import{n}from"./chunk-q6km9nha.js";import{o}from"./chunk-6acs2hzs.js";import{isContentEntry as f,isDiffEntry as g,isFormElicitation as x,isText as h,isToolCallSubject as b,isUrlElicitation as w}from"@nyssance/codex-acp-v2/client";import{jsx as a,jsxs as m}from"react/jsx-runtime";function ge(t){return t.kind==="elicitation"&&x(t.params)}function y(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let s=e.description;return typeof s==="string"?s:null}function A(t){let e=t.rawInput;if(typeof e!=="object"||e===null)return null;let s=e.command;if(typeof s==="string")return s;if(Array.isArray(s))return s.map(String).join(" ");return null}function v(t){for(let e of t.content??[])if(g(e)&&e.patch&&e.patch.text.length>0)return e.patch.text;return null}function R(t){return(t.content??[]).filter(f).map((e)=>h(e.content)?e.content.text:"").filter((e)=>e.length>0).join(`
2
- `)}function T({subject:t,requestTitle:e}){let{host:s}=o();if(!b(t))return null;let r=t.toolCall,l=A(r),i=v(r),c=R(r),p=s.toolTitle?.(r)??r.title;return m("div",{className:"flex flex-col gap-2",children:[p&&p!==e&&l===null&&a("div",{className:"text-sm font-medium",children:p}),l!==null&&m("pre",{className:"bg-muted overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:[a("span",{className:"text-muted-foreground select-none",children:"$ "}),l]}),i!==null&&a("div",{className:"max-h-80 overflow-auto rounded-lg border","data-stream-style":"codexUI",children:a(Be,{patch:i,theme:s.theme})}),i===null&&l===null&&c.length>0&&a("pre",{className:"bg-muted max-h-60 overflow-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:c}),(r.locations??[]).length>0&&a("ul",{className:"text-muted-foreground flex flex-col gap-0.5 text-xs",children:(r.locations??[]).map((u)=>a("li",{className:"truncate font-mono",children:u.path},`${u.path}:${u.line??""}`))})]})}function d(t,e){let{host:s,client:r}=o();return(l)=>{try{if(e)e(t.id,l);else r.respond(t.id,l)}catch(i){if(s.reportError)s.reportError(i);else console.error(i)}}}function C({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s),i=t.params,c=r.permissionTitle?.(i)??i.title;return m(Jn,{requestId:t.id,title:c,alwaysLabel:r.t("approval.always"),autoFocus:"if-idle",total:e,options:i.options.map((p)=>({...p,description:y(p)??void 0})),onRespond:(p)=>l({outcome:p===null?{outcome:"cancelled"}:{outcome:"selected",optionId:p}}),children:[i.description&&a("div",{className:"text-muted-foreground mt-0.5 text-xs",children:i.description}),i.subject&&a(T,{subject:i.subject,requestTitle:c})]})}function Fe({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s),i=n((c)=>t.sessionId===null?void 0:c.sessions[t.sessionId]);return a(eo,{requestId:t.id,schema:t.params.requestedSchema,message:i?.subagent?`${i.title??r.t("subagents.untitled")}: ${t.params.message}`:t.params.message,total:e,t:r.t,onRespond:l})}function ft({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s);if(t.kind==="permission")return a(C,{action:t,total:e,onRespond:s});if(ge(t))return a(Fe,{action:t,total:e??1,onRespond:s});let i=t.params;if(!w(i))throw Error("Unsupported elicitation mode");return a(to,{message:i.message,url:i.url,t:r.t,onOpen:r.openLink,onRespond:(c)=>l(c==="cancel"?{action:"cancel"}:{action:"decline"})})}
3
- export{ge,Fe,ft};
1
+ import{Jn}from"./chunk-a6b2vhmb.js";import{eo}from"./chunk-s0zbha64.js";import{to}from"./chunk-m2xmz1ag.js";import{Be}from"./chunk-yh9qdb2k.js";import{n}from"./chunk-q6km9nha.js";import{o}from"./chunk-0ss92kxr.js";import{isContentEntry as f,isDiffEntry as g,isFormElicitation as x,isText as h,isToolCallSubject as b,isUrlElicitation as w}from"@nyssance/codex-acp-v2/client";import{jsx as a,jsxs as m}from"react/jsx-runtime";function ge(t){return t.kind==="elicitation"&&x(t.params)}function y(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let s=e.description;return typeof s==="string"?s:null}function A(t){let e=t.rawInput;if(typeof e!=="object"||e===null)return null;let s=e.command;if(typeof s==="string")return s;if(Array.isArray(s))return s.map(String).join(" ");return null}function v(t){for(let e of t.content??[])if(g(e)&&e.patch&&e.patch.text.length>0)return e.patch.text;return null}function R(t){return(t.content??[]).filter(f).map((e)=>h(e.content)?e.content.text:"").filter((e)=>e.length>0).join(`
2
+ `)}function T({subject:t,requestTitle:e}){let{host:s}=o();if(!b(t))return null;let r=t.toolCall,l=A(r),i=v(r),c=R(r),p=s.toolTitle?.(r)??r.title;return m("div",{className:"flex flex-col gap-2",children:[p&&p!==e&&l===null&&a("div",{className:"text-sm font-medium",children:p}),l!==null&&m("pre",{className:"bg-muted overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:[a("span",{className:"text-muted-foreground select-none",children:"$ "}),l]}),i!==null&&a("div",{className:"max-h-80 overflow-auto rounded-lg border","data-stream-style":"codexUI",children:a(Be,{patch:i,theme:s.theme})}),i===null&&l===null&&c.length>0&&a("pre",{className:"bg-muted max-h-60 overflow-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:c}),(r.locations??[]).length>0&&a("ul",{className:"text-muted-foreground flex flex-col gap-0.5 text-xs",children:(r.locations??[]).map((u)=>a("li",{className:"truncate font-mono",children:u.path},`${u.path}:${u.line??""}`))})]})}function d(t,e){let{host:s,client:r}=o();return(l)=>{try{if(e)e(t.id,l);else r.respond(t.id,l)}catch(i){if(s.reportError)s.reportError(i);else console.error(i)}}}function C({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s),i=t.params,c=r.permissionTitle?.(i)??i.title;return m(Jn,{requestId:t.id,title:c,alwaysLabel:r.t("approval.always"),autoFocus:"if-idle",total:e,options:i.options.map((p)=>({...p,description:y(p)??void 0})),onRespond:(p)=>l({outcome:p===null?{outcome:"cancelled"}:{outcome:"selected",optionId:p}}),children:[i.description&&a("div",{className:"text-muted-foreground mt-0.5 text-xs",children:i.description}),i.subject&&a(T,{subject:i.subject,requestTitle:c})]})}function Oe({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s),i=n((c)=>t.sessionId===null?void 0:c.sessions[t.sessionId]);return a(eo,{requestId:t.id,schema:t.params.requestedSchema,message:i?.subagent?`${i.title??r.t("subagents.untitled")}: ${t.params.message}`:t.params.message,total:e,t:r.t,onRespond:l})}function ft({action:t,total:e,onRespond:s}){let{host:r}=o(),l=d(t,s);if(t.kind==="permission")return a(C,{action:t,total:e,onRespond:s});if(ge(t))return a(Oe,{action:t,total:e??1,onRespond:s});let i=t.params;if(!w(i))throw Error("Unsupported elicitation mode");return a(to,{message:i.message,url:i.url,t:r.t,onOpen:r.openLink,onRespond:(c)=>l(c==="cancel"?{action:"cancel"}:{action:"decline"})})}
3
+ export{ge,Oe,ft};
@@ -1,3 +1,3 @@
1
- import{a,x}from"./chunk-qxabrz98.js";import{E}from"./chunk-54941m0z.js";import{$o}from"./chunk-2rv3cq7q.js";import{X}from"./chunk-s0ef3h7b.js";import{zo,$e}from"./chunk-h2gng003.js";import{Wo}from"./chunk-gtahrx8j.js";import{nn}from"./chunk-vk36fprb.js";import{cn as M}from"cn";import{jsx as o,jsxs as y}from"react/jsx-runtime";var R=new WeakMap,w=1;function N(t){if(t.type==="tool_use"||t.type==="subagent"||t.type==="collab")return`${t.type}:${t.id}`;let n=R.get(t);if(n!==void 0)return`${t.type}:${n}`;let s=w++;return R.set(t,s),`${t.type}:${s}`}function P({block:t,streaming:n,actions:s}){if(t.isApiError)return o("div",{className:"codex-stream-error",children:t.text});return y("div",{className:"codex-assistant-message",children:[o(x,{text:t.text,streaming:n}),s]})}function I({block:t,streaming:n,actions:s,renderText:i}){switch(t.type){case"text":return i===void 0?o(P,{block:t,streaming:n,actions:s}):i({block:t,streaming:n,actions:s});case"thinking":return t.thinking.length>0?o(x,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return o(X,{entries:t.entries});case"image":return o("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var _=new Set;function Mi({message:t,isMostRecentTurn:n,hiddenTools:s=_,time:i,beforeCopy:r,afterCopy:d,providerIcon:u,renderText:T,renderEditedFiles:C}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return o(A,{});let h=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
2
- `),b=!t.streaming&&h.trim().length>0?o(Yt,{text:h,isMostRecentTurn:n,beforeCopy:r,afterCopy:d,time:i}):null,l=$o(t.content,"compact"),f=l.reduce((e,c,p)=>c.kind==="codexActivityGroup"?p:e,-1),k=l.findIndex((e,c)=>c>f&&e.kind==="block"&&e.block.type==="text"),B=[...t.content].toReversed().find((e)=>e.type==="text"),m=t.content.filter((e)=>e.type==="tool_use"&&E(e).category==="edit"),v=(e)=>{if(e.kind==="codexActivityGroup"){let c=e.blocks.filter((p)=>p.type!=="tool_use"||!s.has(p.name));return c.length===0?null:o($e,{blocks:c},`activity:${N(c[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return o(I,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===B?b:void 0,renderText:T},N(e.block))},g=f===-1?0:k===-1?l.length:k;return o(Zt,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:u,work:l.slice(0,g).map(v),answer:l.length>g?l.slice(g).map(v):null,footer:f!==-1&&m.length>0&&(C===void 0?o(Wo,{blocks:m}):C(m))})}function Yt({text:t,isMostRecentTurn:n=!1,beforeCopy:s,afterCopy:i,time:r}){let d=a(),{t:u}=d;return y("div",{className:M("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",n?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[s,o(nn,{text:t,label:u("actions.copy"),host:d}),i,r&&o("span",{className:"codex-user-time ms-1",title:r.full,children:r.short})]})}function A({label:t}){let{t:n}=a();return o("div",{className:"codex-pending-message py-2",role:"status",children:o("span",{className:"codex-activity-running",children:t??n("message.thinking")})})}function Zt({work:t,answer:n,footer:s,loading:i=!1,loadingLabel:r,...d}){if(i)return o(A,{label:r});return y("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&o(zo,{...d,children:t}),n!==null&&(t.length===0?n:o("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:n})),s]})}
3
- export{Mi,Yt,Zt};
1
+ import{a,x}from"./chunk-qxabrz98.js";import{E}from"./chunk-54941m0z.js";import{$o}from"./chunk-2rv3cq7q.js";import{X}from"./chunk-s0ef3h7b.js";import{zo,$e}from"./chunk-bnj58bev.js";import{Wo}from"./chunk-zbe8myhx.js";import{on}from"./chunk-2ahqcs3n.js";import{cn as M}from"cn";import{jsx as o,jsxs as y}from"react/jsx-runtime";var R=new WeakMap,w=1;function N(t){if(t.type==="tool_use"||t.type==="subagent"||t.type==="collab")return`${t.type}:${t.id}`;let n=R.get(t);if(n!==void 0)return`${t.type}:${n}`;let s=w++;return R.set(t,s),`${t.type}:${s}`}function P({block:t,streaming:n,actions:s}){if(t.isApiError)return o("div",{className:"codex-stream-error",children:t.text});return y("div",{className:"codex-assistant-message",children:[o(x,{text:t.text,streaming:n}),s]})}function I({block:t,streaming:n,actions:s,renderText:i}){switch(t.type){case"text":return i===void 0?o(P,{block:t,streaming:n,actions:s}):i({block:t,streaming:n,actions:s});case"thinking":return t.thinking.length>0?o(x,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return o(X,{entries:t.entries});case"image":return o("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var _=new Set;function Mi({message:t,isMostRecentTurn:n,hiddenTools:s=_,time:i,beforeCopy:r,afterCopy:d,providerIcon:u,renderText:T,renderEditedFiles:C}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return o(A,{});let h=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
2
+ `),b=!t.streaming&&h.trim().length>0?o(Zt,{text:h,isMostRecentTurn:n,beforeCopy:r,afterCopy:d,time:i}):null,l=$o(t.content,"compact"),f=l.reduce((e,c,p)=>c.kind==="codexActivityGroup"?p:e,-1),k=l.findIndex((e,c)=>c>f&&e.kind==="block"&&e.block.type==="text"),B=[...t.content].toReversed().find((e)=>e.type==="text"),m=t.content.filter((e)=>e.type==="tool_use"&&E(e).category==="edit"),v=(e)=>{if(e.kind==="codexActivityGroup"){let c=e.blocks.filter((p)=>p.type!=="tool_use"||!s.has(p.name));return c.length===0?null:o($e,{blocks:c},`activity:${N(c[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return o(I,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===B?b:void 0,renderText:T},N(e.block))},g=f===-1?0:k===-1?l.length:k;return o(Jt,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:u,work:l.slice(0,g).map(v),answer:l.length>g?l.slice(g).map(v):null,footer:f!==-1&&m.length>0&&(C===void 0?o(Wo,{blocks:m}):C(m))})}function Zt({text:t,isMostRecentTurn:n=!1,beforeCopy:s,afterCopy:i,time:r}){let d=a(),{t:u}=d;return y("div",{className:M("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",n?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[s,o(on,{text:t,label:u("actions.copy"),host:d}),i,r&&o("span",{className:"codex-user-time ms-1",title:r.full,children:r.short})]})}function A({label:t}){let{t:n}=a();return o("div",{className:"codex-pending-message py-2",role:"status",children:o("span",{className:"codex-activity-running",children:t??n("message.thinking")})})}function Jt({work:t,answer:n,footer:s,loading:i=!1,loadingLabel:r,...d}){if(i)return o(A,{label:r});return y("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&o(zo,{...d,children:t}),n!==null&&(t.length===0?n:o("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:n})),s]})}
3
+ export{Mi,Zt,Jt};
@@ -1,2 +1,2 @@
1
- import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function Oo(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
2
- export{Oo};
1
+ import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function Fo(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
2
+ export{Fo};
@@ -1,2 +1,2 @@
1
- import{_n}from"./chunk-pzth3knm.js";import{n}from"./chunk-q6km9nha.js";import{o,C}from"./chunk-6acs2hzs.js";import{N,c,M}from"./chunk-n1tjf64a.js";import{isBooleanOption as A,isGroupedSelect as Z,isSelectOption as D}from"@nyssance/codex-acp-v2/client";import{Zap as F}from"lucide-react";import{useRef as H}from"react";import{jsx as G}from"react/jsx-runtime";function pt({sessionId:l,options:p,disabled:I,onModelChange:O,onConfigChange:_,defaultGroup:x={id:"models",name:"Models"},catalog:L=(f)=>f,headerAction:P}){let{host:f,client:k}=o(),{t:i}=f,z=n((e)=>Boolean(e.configPending[l])),g=H({sessionId:l,model:!0}),v=z&&(g.current.sessionId!==l||g.current.model),R=n((e)=>{let r=e.sessions[l];return r?.state==="running"||r?.state==="requires_action"}),t=c(p,"model"),a=c(p,"thought_level"),S=p.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==a)),V=S.filter(D),m=S.filter(A);if(!t&&!a&&V.length===0&&m.length===0)return null;let u=(e,r)=>{if(r===e.currentValue)return Promise.resolve();g.current={sessionId:l,model:e===t};let d=_?_(e.configId,r):k.setConfig(l,e.configId,r);return C(f,d),d},h=a?N(a):[],E=h.reduce((e,r)=>r.name.length>=e.length?r.name:e,""),U=t?M(t):i("composer.model"),y=(e)=>({api_id:e.value,label:e.name}),w=L(t&&Z(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(y)})):[{...x,models:t?N(t).map(y):[]}]),B=w.flatMap((e)=>e.models),b=B.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:U},s=m.find((e)=>e.configId==="fast_mode"||e.configId==="fast-mode");return G(_n,{disabled:I||v||R,switching:v,value:{...b,label:b.shortLabel??b.label},compactCatalog:!0,models:B,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(O)O(e.api_id);else if(t)u(t,e.api_id)},header:{name:t?.name??i("composer.model"),action:P},modelGroups:w,t:i,effortConfig:a&&h.length>0?{name:"Effort",value:a.currentValue,levels:h,sizer:E,onChange:(e)=>u(a,e)}:void 0,selectOptions:V.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:N(e).map((r)=>({value:r.value,label:r.name})),onChange:(r)=>u(e,r)})),booleanOptions:[{id:"fast_mode",name:i("composer.fastMode"),currentValue:s?.currentValue??!1,disabled:!s,title:!s?i("composer.fastModeUnsupported"):void 0,icon:G(F,{className:"size-4","aria-hidden":"true"})},...m.filter((e)=>e!==s).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,r)=>{let d=e==="fast_mode"?s:m.find((q)=>q.configId===e);if(!d)throw Error(`Unknown boolean config: ${e}`);u(d,r)}})}
1
+ import{_n}from"./chunk-ebmbz9tg.js";import{n}from"./chunk-q6km9nha.js";import{o,C}from"./chunk-0ss92kxr.js";import{N,c,M}from"./chunk-n1tjf64a.js";import{isBooleanOption as A,isGroupedSelect as Z,isSelectOption as D}from"@nyssance/codex-acp-v2/client";import{Zap as F}from"lucide-react";import{useRef as H}from"react";import{jsx as G}from"react/jsx-runtime";function pt({sessionId:l,options:p,disabled:I,onModelChange:O,onConfigChange:_,defaultGroup:x={id:"models",name:"Models"},catalog:L=(f)=>f,headerAction:P}){let{host:f,client:k}=o(),{t:i}=f,z=n((e)=>Boolean(e.configPending[l])),g=H({sessionId:l,model:!0}),v=z&&(g.current.sessionId!==l||g.current.model),R=n((e)=>{let r=e.sessions[l];return r?.state==="running"||r?.state==="requires_action"}),t=c(p,"model"),a=c(p,"thought_level"),S=p.filter((e)=>e.configId!=="collaboration_mode"&&(e.category==="model_config"||e.category!=="mode"&&e!==t&&e!==a)),V=S.filter(D),m=S.filter(A);if(!t&&!a&&V.length===0&&m.length===0)return null;let u=(e,r)=>{if(r===e.currentValue)return Promise.resolve();g.current={sessionId:l,model:e===t};let d=_?_(e.configId,r):k.setConfig(l,e.configId,r);return C(f,d),d},h=a?N(a):[],E=h.reduce((e,r)=>r.name.length>=e.length?r.name:e,""),U=t?M(t):i("composer.model"),y=(e)=>({api_id:e.value,label:e.name}),w=L(t&&Z(t.options)?t.options.map((e)=>({id:e.groupId,name:e.name,models:e.options.map(y)})):[{...x,models:t?N(t).map(y):[]}]),B=w.flatMap((e)=>e.models),b=B.find((e)=>e.api_id===t?.currentValue)??{api_id:t?.currentValue??"",label:U},s=m.find((e)=>e.configId==="fast_mode"||e.configId==="fast-mode");return G(_n,{disabled:I||v||R,switching:v,value:{...b,label:b.shortLabel??b.label},compactCatalog:!0,models:B,showModelList:Boolean(t),onChange:(e)=>{if(e.api_id===t?.currentValue)return;if(O)O(e.api_id);else if(t)u(t,e.api_id)},header:{name:t?.name??i("composer.model"),action:P},modelGroups:w,t:i,effortConfig:a&&h.length>0?{name:"Effort",value:a.currentValue,levels:h,sizer:E,onChange:(e)=>u(a,e)}:void 0,selectOptions:V.map((e)=>({id:e.configId,name:e.name,value:e.currentValue,options:N(e).map((r)=>({value:r.value,label:r.name})),onChange:(r)=>u(e,r)})),booleanOptions:[{id:"fast_mode",name:i("composer.fastMode"),currentValue:s?.currentValue??!1,disabled:!s,title:!s?i("composer.fastModeUnsupported"):void 0,icon:G(F,{className:"size-4","aria-hidden":"true"})},...m.filter((e)=>e!==s).map((e)=>({id:e.configId,name:e.name,currentValue:e.currentValue}))],onBooleanChange:(e,r)=>{let d=e==="fast_mode"?s:m.find((q)=>q.configId===e);if(!d)throw Error(`Unknown boolean config: ${e}`);u(d,r)}})}
2
2
  export{pt};
@@ -1,7 +1,7 @@
1
- import{a,x}from"./chunk-qxabrz98.js";import{en}from"./chunk-z4zm74ge.js";import{E}from"./chunk-54941m0z.js";import{R}from"./chunk-s55n9cby.js";import{we,Uo}from"./chunk-qsg1c5cc.js";import{X}from"./chunk-s0ef3h7b.js";import{cn as h}from"cn";import{BotIcon as me,CheckIcon as pe,CopyIcon as ge}from"lucide-react";import{Fragment as fe,useEffect as O,useRef as U,useState as _}from"react";import{jsx as n,jsxs as p,Fragment as P}from"react/jsx-runtime";function W(e,t){let[o,i]=_(()=>({key:e,mounted:t})),r=t||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==r)i({key:e,mounted:r});return r}var q=new WeakMap,z=1;function N(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let t=q.get(e);if(t!==void 0)return`${e.type}:${t}`;let o=z;return z+=1,q.set(e,o),`${e.type}:${o}`}function b(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function Z(e,t){let o=Math.max(0,Math.round(e/1000)),i=Math.floor(o/3600),r=Math.floor(o%3600/60),s=o%60;if(s>=60)r+=Math.floor(s/60),s%=60;if(r>=60)i+=Math.floor(r/60),r%=60;let u=Intl.DurationFormat;if(u)try{return new u(t,{style:"narrow"}).format({hours:i,minutes:r,seconds:i>0?0:s})}catch{}if(i>0)return r>0?`${i}h ${r}m`:`${i}h`;if(r>0)return s>0?`${r}m ${s}s`:`${r}m`;return`${s}s`}var xe="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function I({expanded:e,className:t}){return n("svg",{className:h("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:xe})})}function Ce(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"})})}function ye(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"})})}function ve(){return p("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[n("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"}),n("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"}),n("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"})]})}function he(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"})})}function K(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"})})}function te({block:e}){if(e.type!=="tool_use")return null;if(V(e))return n(K,{});let t=E(e).category;if(t==="read")return n(Ce,{});if(t==="search"||t==="fetch")return n(ye,{});if(t==="execute")return n(ve,{});if(t==="edit")return n(he,{});return n(K,{})}function B(e,t){let o=e.rawInput[t];return typeof o==="string"&&o.length>0?o:void 0}function Le(e){return E(e).target}function j(e){return e.name==="mcp"||e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function V(e){return j(e)||e.name==="dynamic_tool"}function ne(e,t){let{category:o}=E(e),i=Le(e),r=b(e.status);if(V(e))return{leading:e.title};if(o==="execute"){let s=B(e,"command")?.split(`
1
+ import{a,x}from"./chunk-qxabrz98.js";import{tn}from"./chunk-ktjma5ts.js";import{E}from"./chunk-54941m0z.js";import{R}from"./chunk-s55n9cby.js";import{we,Uo}from"./chunk-qsg1c5cc.js";import{X}from"./chunk-s0ef3h7b.js";import{cn as h}from"cn";import{BotIcon as me,CheckIcon as pe,CopyIcon as ge}from"lucide-react";import{Fragment as fe,useEffect as O,useRef as U,useState as _}from"react";import{jsx as n,jsxs as p,Fragment as P}from"react/jsx-runtime";function W(e,t){let[o,i]=_(()=>({key:e,mounted:t})),r=t||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==r)i({key:e,mounted:r});return r}var q=new WeakMap,z=1;function N(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let t=q.get(e);if(t!==void 0)return`${e.type}:${t}`;let o=z;return z+=1,q.set(e,o),`${e.type}:${o}`}function b(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function Z(e,t){let o=Math.max(0,Math.round(e/1000)),i=Math.floor(o/3600),r=Math.floor(o%3600/60),s=o%60;if(s>=60)r+=Math.floor(s/60),s%=60;if(r>=60)i+=Math.floor(r/60),r%=60;let u=Intl.DurationFormat;if(u)try{return new u(t,{style:"narrow"}).format({hours:i,minutes:r,seconds:i>0?0:s})}catch{}if(i>0)return r>0?`${i}h ${r}m`:`${i}h`;if(r>0)return s>0?`${r}m ${s}s`:`${r}m`;return`${s}s`}var xe="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function I({expanded:e,className:t}){return n("svg",{className:h("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:xe})})}function Ce(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"})})}function ye(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"})})}function ve(){return p("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[n("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"}),n("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"}),n("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"})]})}function he(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"})})}function K(){return n("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:n("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"})})}function te({block:e}){if(e.type!=="tool_use")return null;if(V(e))return n(K,{});let t=E(e).category;if(t==="read")return n(Ce,{});if(t==="search"||t==="fetch")return n(ye,{});if(t==="execute")return n(ve,{});if(t==="edit")return n(he,{});return n(K,{})}function B(e,t){let o=e.rawInput[t];return typeof o==="string"&&o.length>0?o:void 0}function Le(e){return E(e).target}function j(e){return e.name==="mcp"||e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function V(e){return j(e)||e.name==="dynamic_tool"}function ne(e,t){let{category:o}=E(e),i=Le(e),r=b(e.status);if(V(e))return{leading:e.title};if(o==="execute"){let s=B(e,"command")?.split(`
2
2
  `)[0]??i;return s?{leading:t(r?"stream.codex.running":"stream.codex.ran"),trailing:s}:{leading:t(r?"stream.codex.runningCommand":"stream.codex.ranCommandGeneric")}}if(o==="search"){let s=B(e,"pattern")??B(e,"query")??i;return s?{leading:t(r?"stream.codex.searching":"stream.codex.searched"),trailing:t("stream.codex.forDetail",{detail:s})}:{leading:t(r?"stream.codex.searchingFiles":"stream.codex.searchedFiles")}}if(o==="fetch"){let s=B(e,"query")??B(e,"url")??i;return s?{leading:t(r?"stream.codex.searchingWeb":"stream.codex.searchedWeb"),trailing:t("stream.codex.forDetail",{detail:s})}:{leading:t(r?"stream.codex.searchingWeb":"stream.codex.searchedWeb")}}if(o==="read")return i?{leading:t("stream.codex.readLabel"),trailing:i}:{leading:t("stream.codex.readFiles")};if(o==="edit")return i?{leading:t(r?"stream.codex.editingLabel":"stream.codex.editedLabel"),trailing:i}:{leading:t(r?"stream.codex.editingFiles":"stream.codex.editedFiles")};if(o==="delete")return i?{leading:t(r?"stream.codex.deletingLabel":"stream.codex.deletedLabel"),trailing:i}:{leading:t(r?"stream.codex.deletingFiles":"stream.codex.deletedFiles")};if(o==="move")return i?{leading:t(r?"stream.codex.movingLabel":"stream.codex.movedLabel"),trailing:i}:{leading:t(r?"stream.codex.movingFiles":"stream.codex.movedFiles")};return{leading:e.title}}function Ne(e,t){let o=ne(e,t);return o.trailing===void 0?o.leading:`${o.leading} ${o.trailing}`}function be(e){return e.map((t)=>{if(t.type!=="content")return"";let o=t.content;return o.type==="text"?o.text:""}).filter(Boolean).join(`
3
3
  `).trim()}function Te(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="image"?[{data:o.data,mimeType:o.mimeType}]:[]})}function ke(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="audio"?[{data:o.data,mimeType:o.mimeType}]:[]})}function Ae(e){if(typeof e==="string"&&e.length>0)return e;return}function Be(e){return e.type==="diff"}function Ie(e){let t=e.content.find(Be);if(t===void 0)return;return t.changes.map((o)=>`${o.operation} ${o.path}`).join(`
4
4
  `)}function ae(e){let t=Ae(e.rawOutput);if(t!==void 0)return t;let o=be(e.content);if(o.length>0)return o;return Ie(e)}function J({block:e,command:t}){let{t:o,Output:i,commandStatus:r}=a(),[s,u]=_(!1),[c,l]=_(!1),m=ae(e),d=r===void 0?e.exitCode===void 0?void 0:o("stream.codex.exitCode",{code:e.exitCode}):r(e),g=()=>{navigator.clipboard.writeText([`$ ${t}`,m].filter((f)=>f!==void 0).join(`
5
5
  `)),u(!0),setTimeout(()=>u(!1),1500)};return n("div",{className:"codex-command-details",children:p("div",{className:"codex-command-card",children:[p("div",{className:"codex-command-line-row",children:[n("span",{className:"codex-command-prompt","aria-hidden":"true",children:"$"}),n("button",{type:"button",className:h("codex-command-line",!c&&"codex-command-line-clamped"),"data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((f)=>!f),children:t}),n("button",{type:"button",className:"codex-command-copy","aria-label":o("actions.copy"),onClick:g,children:s?n(pe,{}):n(ge,{})})]}),m!==void 0&&(i===void 0?n("pre",{className:"codex-command-output",children:m}):n(i,{text:m})),d!==void 0&&n("div",{className:"codex-command-footer",children:n("span",{className:"codex-command-status",children:d})})]})})}function oe({block:e}){let{t,openLink:o,Patch:i,openImage:r,commandStatus:s,expandToolOutput:u=!1}=a(),c=ae(e),l=i===void 0?void 0:e.content.flatMap((C)=>{if(C.type!=="diff")return[];let A=C;return A.patch?.text?[A.patch.text]:[]}).join(`
6
- `),m=Te(e.content),d=ke(e.content),[g,f]=R(`tool:${e.id}`,!1),y=W(`tool:${e.id}`,g),w=E(e),L=w.category,v=ne(e,t),T=L==="execute"?B(e,"command"):void 0;if(e.userShell&&T!==void 0)return n(J,{block:e,command:T});let k=T!==void 0||V(e)||m.length>0||d.length>0||Boolean(l)||u&&c!==void 0,M=!k&&!b(e.status)?w.filePath:void 0;if(L==="execute"&&!b(e.status)&&e.status!=="completed"){let C=s?.(e);if(C)v={...v,leading:C}}if(L==="read"&&b(e.status))return null;let S=p("span",{className:"codex-activity-label",children:[n(te,{block:e}),n("span",{className:"min-w-0 flex-1 truncate",children:b(e.status)?n("span",{className:"codex-activity-running",children:v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`}):p(P,{children:[n("span",{className:"codex-activity-leading",children:v.leading}),v.trailing!==void 0&&(M!==void 0?p(P,{children:[" ",n("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:M,onClick:()=>o(M),children:v.trailing})]}):p("span",{className:"codex-activity-trailing",children:[" ",v.trailing]}))]})})]});return p("div",{className:"codex-activity-item",children:[k?p("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`,"aria-expanded":g,onClick:()=>f((C)=>!C),children:[S,n(I,{expanded:g})]}):n("div",{className:"codex-activity-header codex-activity-header-static",children:S}),n("div",{className:h("codex-activity-details-grid",g&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:y&&p(P,{children:[T!==void 0?n(J,{block:e,command:T}):i!==void 0&&l?n(i,{patch:l}):c!==void 0&&n("pre",{className:"codex-activity-details",children:c}),m.length>0&&n("div",{className:"codex-activity-media",children:m.map((C)=>{let A=`data:${C.mimeType};base64,${C.data}`,G=n("img",{src:A,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${C.mimeType}:${C.data.slice(0,32)}`);return r===void 0?G:n("button",{type:"button",className:"cursor-pointer",onClick:()=>r(A),children:G},A)})}),d.map((C)=>n("audio",{className:"mt-1 w-full","aria-label":t("stream.codex.audioOutput"),controls:!0,src:`data:${C.mimeType};base64,${C.data}`},`${C.mimeType}:${C.data.slice(0,32)}`))]})})})]})}function ie({block:e}){if(e.type==="tool_use")return n(oe,{block:e});if(e.type==="thinking")return n(ue,{block:e});if(e.type==="collab")return n(le,{block:e});return n(re,{block:e})}function re({block:e}){let{t,openSession:o}=a(),i=b(e.status),[r,s]=R(`subagent:${e.id}`,i),u=U(i);O(()=>{if(i)s(!0);if(u.current&&!i)s(!1);u.current=i},[i,s]);let c=`${_e(e.activity,i,e.name,t)}${se(e.model,e.reasoningEffort,t)}`,l=e.threadId??"",m=e.blocks.length>0;return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:h("codex-activity-header",!m&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":m?r:void 0,disabled:!m,onClick:()=>s((d)=>!d),children:[p("span",{className:"codex-activity-label",children:[n(Se,{seed:e.threadId??e.id}),n("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?i?n("span",{className:"codex-activity-running",children:c}):c:n("span",{role:"link",tabIndex:0,className:h("codex-agent-link",i&&"codex-activity-running"),"aria-label":t("stream.codex.subagentOpen",{name:e.name}),onClick:(d)=>{d.stopPropagation(),o(l,e.name)},onKeyDown:(d)=>{if(d.key!=="Enter"&&d.key!==" ")return;d.preventDefault(),d.stopPropagation(),o(l,e.name)},children:c})})]}),m&&n(I,{expanded:r})]}),n("div",{className:h("codex-activity-details-grid",r&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-subagent-details",children:e.blocks.map((d)=>{if(d.type==="tool_use")return n(oe,{block:d},d.id);if(d.type==="thinking")return n(ue,{block:d},N(d));if(d.type==="subagent")return n(re,{block:d},d.id);if(d.type==="collab")return n(le,{block:d},d.id);if(d.type==="text")return n("div",{className:"codex-reasoning-details",children:n(x,{text:d.text,streaming:!1})},N(d));if(d.type==="plan")return n(X,{entries:d.entries},N(d));if(d.type==="image")return n("img",{src:`data:${d.source.media_type};base64,${d.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},N(d));return null})})})})]})}var Me=8;function Ee(e){let t=0;for(let o=0;o<e.length;o+=1)t=(t*31+e.charCodeAt(o))%2147483647;return t%Me}function Se({seed:e}){return n("span",{className:"codex-agent-avatar","data-hue":Ee(e),"aria-hidden":"true"})}function _e(e,t,o,i){switch(e){case"started":return i(t?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return i("stream.codex.subagentMessaged",{name:o});case"interrupted":return i("stream.codex.subagentInterrupted",{name:o});case"completed":return i("stream.codex.subagentFinished",{name:o})}}var Re=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function se(e,t,o){if(e===null)return"";if(t===null)return` · ${en(e)}`;let i=Re.has(t)?o(`stream.codex.reasoningEffort.${t}`):t;return` · ${en(e)} · ${i}`}var Fe={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function de(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function H(e,t,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let i=de(e.status);if(i==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${t}.${Fe[e.tool]}.${i}`)}function De(e){return e.agents.filter((t)=>t.nickname!==null)}function ce(e,t){let o=e.agents.length>0?e.agents.length:1;return`${H(e,"header",t)}${t("stream.codex.collab.agentCount",{count:o})}`}var F="\x01";function D(e,t,o,i){let r=Object.fromEntries(Object.keys(i).map((s)=>[s,`${F}${s}${F}`]));return e(t,{...o,...r}).split(new RegExp(`${F}(\\w+)${F}`,"u")).map((s,u)=>n(fe,{children:u%2===1?i[s]:s},`${u}:${s}`))}function Pe({agent:e,showModel:t}){let{t:o,openSession:i}=a(),r=e.nickname??"",s=i===void 0?n("span",{className:"font-medium",children:r}):n("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:r}),onClick:()=>i(e.threadId,r),children:r});return p("span",{children:[s,e.role!==null&&` (${e.role})`,t&&se(e.model,e.reasoningEffort,o)]})}function Q({prompt:e}){return n("span",{className:"codex-collab-prompt",title:e,children:e})}function Oe(e,t){let o=e.prompt?.trim()?e.prompt:null,i=de(e.status),r=e.tool==="spawnAgent"&&i==="completed"&&o!==null,s=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,u=De(e),c=[];if(u.length===0)c.push({key:"generic",node:H(e,"row",t)});for(let l of u){let m=n(Pe,{agent:l,showModel:e.tool==="spawnAgent"});if(r)c.push({key:l.threadId,node:n("span",{className:"codex-collab-line",children:D(t,"stream.codex.collab.createdWithInstructions",{},{agent:m,instructions:n(Q,{prompt:o})})})});else if(s)c.push({key:l.threadId,node:n("span",{className:"codex-collab-line",children:D(t,"stream.codex.collab.messagedWithPrompt",{action:i==="interrupted"?t("stream.codex.collab.interrupted"):t(`stream.codex.collab.messaged.${i}`)},{agent:m,prompt:n(Q,{prompt:o})})})});else{let g=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&l.state!==null&&l.state!==null?l.state.message?.trim()?t("stream.codex.collab.stateWithMessage",{state:t(`stream.codex.collab.state.${l.state.status}`),message:l.state.message}):t("stream.codex.collab.stateOnly",{state:t(`stream.codex.collab.state.${l.state.status}`)}):"";c.push({key:l.threadId,node:D(t,"stream.codex.collab.agentRow",{action:H(e,"row",t),state:g},{agent:m})})}}if(!r&&!s&&o!==null)c.push({key:"input",node:D(t,"stream.codex.collab.input",{},{prompt:n("span",{className:"codex-collab-input",children:o})})});return c}function le({block:e}){let{t}=a(),[o,i]=R(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let r=b(e.status),s=ce(e,t);return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>i((u)=>!u),children:[p("span",{className:"codex-activity-label",children:[n(me,{className:"size-4 shrink-0","aria-hidden":"true"}),n("span",{className:"min-w-0 flex-1 truncate",children:r?n("span",{className:"codex-activity-running",children:s}):s})]}),n(I,{expanded:o})]}),n("div",{className:h("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-subagent-details",children:Oe(e,t).map((u)=>n("div",{className:"codex-collab-row",children:u.node},u.key))})})})]})}function ue({block:e}){let{t,i18n:o}=a(),i=Boolean(e.isComplete),[r,s]=R(`thinking:${N(e)}`,!1),u=U(null),c=e.thinking.trim().length>0;O(()=>{if(i||!c)return;let d=u.current;if(d===null)throw Error("Thinking details are not mounted");let g=new ResizeObserver(()=>{d.scrollTop=d.scrollHeight}),f=null,y=()=>{let L=d.firstElementChild;if(L===f)return;if(f!==null)g.unobserve(f);if(f=L,f!==null)g.observe(f)},w=new MutationObserver(y);return w.observe(d,{childList:!0}),y(),()=>{w.disconnect(),g.disconnect()}},[c,i]);let l=i?e.durationMs!==void 0?t("stream.codex.thoughtFor",{duration:Z(e.durationMs,o.language)}):t("stream.codex.thought"):t("message.thinking"),m=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:h("codex-activity-header",!c&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":c?r:void 0,disabled:!c,onClick:()=>s((d)=>!d),children:[n("span",{className:"codex-activity-label",children:n("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:i?l:n("span",{className:"codex-activity-running",children:l})})}),c&&n(I,{expanded:r})]}),n("div",{className:h("codex-activity-details-grid",r&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:c&&n("div",{ref:u,className:"codex-reasoning-details",role:"region","aria-label":l,"aria-hidden":!r,tabIndex:0,inert:!r,children:n(x,{text:m,streaming:!i})})})})]})}function Ue(e){if(j(e))return"mcp";let t=E(e).category;return t==="think"||t==="switch_mode"?"other":t}function Ve(e,t,o,i){return i(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:t})}function Ze(e,t,o){let i=new Map,r=[],s=new Set;for(let c of e){if(j(c)&&typeof c.rawInput.server==="string"){if(s.size===0)r.push({kind:"integrations"});s.add(c.rawInput.server);continue}if(V(c)){if(!r.some((m)=>m.kind==="named"&&m.title===c.title))r.push({kind:"named",title:c.title});continue}let l=Ue(c);if(!i.has(l))r.push({kind:"category",category:l});i.set(l,(i.get(l)??0)+1)}let u=r.map((c,l)=>{if(c.kind==="named")return c.title;if(c.kind==="integrations")return t(`stream.codex.summary.integrations.${l===0?"leading":"following"}`,{count:s.size,sources:new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format([...s])});return Ve(c.category,i.get(c.category),l===0,t)});if(o.startsWith("zh"))return u.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(u)}function zo({stateKey:e,durationMs:t,durationKind:o="work",active:i,defaultExpanded:r=i,startedAt:s,providerId:u,providerIcon:c,children:l}){let{t:m,i18n:d}=a(),[g,f]=R(`work:${e}`,r,!0),y=W(`work:${e}`,g||i),w=U(null),[L,v]=_(0);O(()=>{if(!i||t!==void 0){w.current=null;return}w.current=s??Date.now();let k=()=>{let S=w.current;if(S===null)throw Error("Codex work section is ticking without a start time");v(Date.now()-S)};k();let M=window.setInterval(k,1000);return()=>window.clearInterval(M)},[i,s,t]);let T=t!==void 0?m(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:Z(t,d.language)}):i&&L>=1000?m("stream.codex.workingFor",{duration:Z(L,d.language)}):m(i?"stream.codex.working":"stream.codex.worked");return p("section",{className:"codex-work-section",children:[p("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":g,onClick:()=>f((k)=>!k),children:[u!==void 0&&n("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":u,"aria-hidden":"true",children:c}),n("span",{children:T}),n(I,{expanded:g,className:"codex-work-chevron"})]}),n("div",{className:"codex-work-separator","aria-hidden":"true"}),n("div",{className:h("codex-work-grid",g&&"codex-work-grid-open"),"aria-hidden":!g,inert:!g,children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-work-body",children:y&&l})})})]})}function He(e,t){if(e.type==="tool_use")return Ne(e,t);if(e.type==="thinking")return t("message.thinking");if(e.type==="collab")return ce(e,t);return t("stream.codex.subagentWorking",{name:e.name})}function Y(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return b(e.status);return!1}function We(e,t,o=1000){let[i,r]=_({text:e,live:t}),s=U(Date.now());return O(()=>{if(e===i.text&&t===i.live)return;let u=Date.now(),c=Math.max(0,s.current+o-u);if(c===0||t!==i.live){s.current=u,r({text:e,live:t});return}let l=window.setTimeout(()=>{s.current=Date.now(),r({text:e,live:t})},c);return()=>window.clearTimeout(l)},[i,t,o,e]),t===i.live?i.text:e}function je({blocks:e,defaultExpanded:t=!0}){let{t:o,i18n:i}=a(),r=e.some(Y),s=N(e[0]),u=e.every((y)=>y.type==="tool_use"&&E(y).category==="execute"),[c,l]=R(`group:${s}`,t&&!u),m=W(`group:${s}`,c),d=e.findLast(Y)??e.at(-1);if(d===void 0)throw Error("CodexActivityGroup requires at least one activity block");let g=e.filter((y)=>y.type==="tool_use"),f=We(r?He(d,o):Ze(g,o,i.language),r);return p("div",{className:"codex-activity-group",children:[p("button",{type:"button",className:"codex-activity-group-trigger","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((y)=>!y),children:[p("span",{className:"codex-activity-label",children:[n(te,{block:e[0]}),n("span",{className:"truncate",children:r?n("span",{className:"codex-activity-running",children:f}):f})]}),n(I,{expanded:c})]}),n("div",{className:h("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-activity-group-body",children:m&&e.map((y)=>n(ie,{block:y},N(y)))})})})]})}function ee({blocks:e,defaultExpanded:t}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return n(ie,{block:e[0]});return n(je,{blocks:e,defaultExpanded:t})}function $e({blocks:e,defaultExpanded:t}){if(!e.some(we))return n(ee,{blocks:e,defaultExpanded:t});let o=[];for(let i of e){let r=o.at(-1);if(r&&we(r[0])===we(i))r.push(i);else o.push([i])}return n(P,{children:o.map((i)=>we(i[0])?n(Uo,{blocks:i.filter(we)},N(i[0])):n(ee,{blocks:i,defaultExpanded:t},N(i[0])))})}
6
+ `),m=Te(e.content),d=ke(e.content),[g,f]=R(`tool:${e.id}`,!1),y=W(`tool:${e.id}`,g),w=E(e),L=w.category,v=ne(e,t),T=L==="execute"?B(e,"command"):void 0;if(e.userShell&&T!==void 0)return n(J,{block:e,command:T});let k=T!==void 0||V(e)||m.length>0||d.length>0||Boolean(l)||u&&c!==void 0,M=!k&&!b(e.status)?w.filePath:void 0;if(L==="execute"&&!b(e.status)&&e.status!=="completed"){let C=s?.(e);if(C)v={...v,leading:C}}if(L==="read"&&b(e.status))return null;let S=p("span",{className:"codex-activity-label",children:[n(te,{block:e}),n("span",{className:"min-w-0 flex-1 truncate",children:b(e.status)?n("span",{className:"codex-activity-running",children:v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`}):p(P,{children:[n("span",{className:"codex-activity-leading",children:v.leading}),v.trailing!==void 0&&(M!==void 0?p(P,{children:[" ",n("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:M,onClick:()=>o(M),children:v.trailing})]}):p("span",{className:"codex-activity-trailing",children:[" ",v.trailing]}))]})})]});return p("div",{className:"codex-activity-item",children:[k?p("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`,"aria-expanded":g,onClick:()=>f((C)=>!C),children:[S,n(I,{expanded:g})]}):n("div",{className:"codex-activity-header codex-activity-header-static",children:S}),n("div",{className:h("codex-activity-details-grid",g&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:y&&p(P,{children:[T!==void 0?n(J,{block:e,command:T}):i!==void 0&&l?n(i,{patch:l}):c!==void 0&&n("pre",{className:"codex-activity-details",children:c}),m.length>0&&n("div",{className:"codex-activity-media",children:m.map((C)=>{let A=`data:${C.mimeType};base64,${C.data}`,G=n("img",{src:A,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${C.mimeType}:${C.data.slice(0,32)}`);return r===void 0?G:n("button",{type:"button",className:"cursor-pointer",onClick:()=>r(A),children:G},A)})}),d.map((C)=>n("audio",{className:"mt-1 w-full","aria-label":t("stream.codex.audioOutput"),controls:!0,src:`data:${C.mimeType};base64,${C.data}`},`${C.mimeType}:${C.data.slice(0,32)}`))]})})})]})}function ie({block:e}){if(e.type==="tool_use")return n(oe,{block:e});if(e.type==="thinking")return n(ue,{block:e});if(e.type==="collab")return n(le,{block:e});return n(re,{block:e})}function re({block:e}){let{t,openSession:o}=a(),i=b(e.status),[r,s]=R(`subagent:${e.id}`,i),u=U(i);O(()=>{if(i)s(!0);if(u.current&&!i)s(!1);u.current=i},[i,s]);let c=`${_e(e.activity,i,e.name,t)}${se(e.model,e.reasoningEffort,t)}`,l=e.threadId??"",m=e.blocks.length>0;return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:h("codex-activity-header",!m&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":m?r:void 0,disabled:!m,onClick:()=>s((d)=>!d),children:[p("span",{className:"codex-activity-label",children:[n(Se,{seed:e.threadId??e.id}),n("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?i?n("span",{className:"codex-activity-running",children:c}):c:n("span",{role:"link",tabIndex:0,className:h("codex-agent-link",i&&"codex-activity-running"),"aria-label":t("stream.codex.subagentOpen",{name:e.name}),onClick:(d)=>{d.stopPropagation(),o(l,e.name)},onKeyDown:(d)=>{if(d.key!=="Enter"&&d.key!==" ")return;d.preventDefault(),d.stopPropagation(),o(l,e.name)},children:c})})]}),m&&n(I,{expanded:r})]}),n("div",{className:h("codex-activity-details-grid",r&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-subagent-details",children:e.blocks.map((d)=>{if(d.type==="tool_use")return n(oe,{block:d},d.id);if(d.type==="thinking")return n(ue,{block:d},N(d));if(d.type==="subagent")return n(re,{block:d},d.id);if(d.type==="collab")return n(le,{block:d},d.id);if(d.type==="text")return n("div",{className:"codex-reasoning-details",children:n(x,{text:d.text,streaming:!1})},N(d));if(d.type==="plan")return n(X,{entries:d.entries},N(d));if(d.type==="image")return n("img",{src:`data:${d.source.media_type};base64,${d.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},N(d));return null})})})})]})}var Me=8;function Ee(e){let t=0;for(let o=0;o<e.length;o+=1)t=(t*31+e.charCodeAt(o))%2147483647;return t%Me}function Se({seed:e}){return n("span",{className:"codex-agent-avatar","data-hue":Ee(e),"aria-hidden":"true"})}function _e(e,t,o,i){switch(e){case"started":return i(t?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return i("stream.codex.subagentMessaged",{name:o});case"interrupted":return i("stream.codex.subagentInterrupted",{name:o});case"completed":return i("stream.codex.subagentFinished",{name:o})}}var Re=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function se(e,t,o){if(e===null)return"";if(t===null)return` · ${tn(e)}`;let i=Re.has(t)?o(`stream.codex.reasoningEffort.${t}`):t;return` · ${tn(e)} · ${i}`}var Fe={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function de(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function H(e,t,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let i=de(e.status);if(i==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${t}.${Fe[e.tool]}.${i}`)}function De(e){return e.agents.filter((t)=>t.nickname!==null)}function ce(e,t){let o=e.agents.length>0?e.agents.length:1;return`${H(e,"header",t)}${t("stream.codex.collab.agentCount",{count:o})}`}var F="\x01";function D(e,t,o,i){let r=Object.fromEntries(Object.keys(i).map((s)=>[s,`${F}${s}${F}`]));return e(t,{...o,...r}).split(new RegExp(`${F}(\\w+)${F}`,"u")).map((s,u)=>n(fe,{children:u%2===1?i[s]:s},`${u}:${s}`))}function Pe({agent:e,showModel:t}){let{t:o,openSession:i}=a(),r=e.nickname??"",s=i===void 0?n("span",{className:"font-medium",children:r}):n("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:r}),onClick:()=>i(e.threadId,r),children:r});return p("span",{children:[s,e.role!==null&&` (${e.role})`,t&&se(e.model,e.reasoningEffort,o)]})}function Q({prompt:e}){return n("span",{className:"codex-collab-prompt",title:e,children:e})}function Oe(e,t){let o=e.prompt?.trim()?e.prompt:null,i=de(e.status),r=e.tool==="spawnAgent"&&i==="completed"&&o!==null,s=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,u=De(e),c=[];if(u.length===0)c.push({key:"generic",node:H(e,"row",t)});for(let l of u){let m=n(Pe,{agent:l,showModel:e.tool==="spawnAgent"});if(r)c.push({key:l.threadId,node:n("span",{className:"codex-collab-line",children:D(t,"stream.codex.collab.createdWithInstructions",{},{agent:m,instructions:n(Q,{prompt:o})})})});else if(s)c.push({key:l.threadId,node:n("span",{className:"codex-collab-line",children:D(t,"stream.codex.collab.messagedWithPrompt",{action:i==="interrupted"?t("stream.codex.collab.interrupted"):t(`stream.codex.collab.messaged.${i}`)},{agent:m,prompt:n(Q,{prompt:o})})})});else{let g=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&l.state!==null&&l.state!==null?l.state.message?.trim()?t("stream.codex.collab.stateWithMessage",{state:t(`stream.codex.collab.state.${l.state.status}`),message:l.state.message}):t("stream.codex.collab.stateOnly",{state:t(`stream.codex.collab.state.${l.state.status}`)}):"";c.push({key:l.threadId,node:D(t,"stream.codex.collab.agentRow",{action:H(e,"row",t),state:g},{agent:m})})}}if(!r&&!s&&o!==null)c.push({key:"input",node:D(t,"stream.codex.collab.input",{},{prompt:n("span",{className:"codex-collab-input",children:o})})});return c}function le({block:e}){let{t}=a(),[o,i]=R(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let r=b(e.status),s=ce(e,t);return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>i((u)=>!u),children:[p("span",{className:"codex-activity-label",children:[n(me,{className:"size-4 shrink-0","aria-hidden":"true"}),n("span",{className:"min-w-0 flex-1 truncate",children:r?n("span",{className:"codex-activity-running",children:s}):s})]}),n(I,{expanded:o})]}),n("div",{className:h("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-subagent-details",children:Oe(e,t).map((u)=>n("div",{className:"codex-collab-row",children:u.node},u.key))})})})]})}function ue({block:e}){let{t,i18n:o}=a(),i=Boolean(e.isComplete),[r,s]=R(`thinking:${N(e)}`,!1),u=U(null),c=e.thinking.trim().length>0;O(()=>{if(i||!c)return;let d=u.current;if(d===null)throw Error("Thinking details are not mounted");let g=new ResizeObserver(()=>{d.scrollTop=d.scrollHeight}),f=null,y=()=>{let L=d.firstElementChild;if(L===f)return;if(f!==null)g.unobserve(f);if(f=L,f!==null)g.observe(f)},w=new MutationObserver(y);return w.observe(d,{childList:!0}),y(),()=>{w.disconnect(),g.disconnect()}},[c,i]);let l=i?e.durationMs!==void 0?t("stream.codex.thoughtFor",{duration:Z(e.durationMs,o.language)}):t("stream.codex.thought"):t("message.thinking"),m=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return p("div",{className:"codex-activity-item",children:[p("button",{type:"button",className:h("codex-activity-header",!c&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":c?r:void 0,disabled:!c,onClick:()=>s((d)=>!d),children:[n("span",{className:"codex-activity-label",children:n("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:i?l:n("span",{className:"codex-activity-running",children:l})})}),c&&n(I,{expanded:r})]}),n("div",{className:h("codex-activity-details-grid",r&&"codex-activity-details-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:c&&n("div",{ref:u,className:"codex-reasoning-details",role:"region","aria-label":l,"aria-hidden":!r,tabIndex:0,inert:!r,children:n(x,{text:m,streaming:!i})})})})]})}function Ue(e){if(j(e))return"mcp";let t=E(e).category;return t==="think"||t==="switch_mode"?"other":t}function Ve(e,t,o,i){return i(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:t})}function Ze(e,t,o){let i=new Map,r=[],s=new Set;for(let c of e){if(j(c)&&typeof c.rawInput.server==="string"){if(s.size===0)r.push({kind:"integrations"});s.add(c.rawInput.server);continue}if(V(c)){if(!r.some((m)=>m.kind==="named"&&m.title===c.title))r.push({kind:"named",title:c.title});continue}let l=Ue(c);if(!i.has(l))r.push({kind:"category",category:l});i.set(l,(i.get(l)??0)+1)}let u=r.map((c,l)=>{if(c.kind==="named")return c.title;if(c.kind==="integrations")return t(`stream.codex.summary.integrations.${l===0?"leading":"following"}`,{count:s.size,sources:new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format([...s])});return Ve(c.category,i.get(c.category),l===0,t)});if(o.startsWith("zh"))return u.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(u)}function zo({stateKey:e,durationMs:t,durationKind:o="work",active:i,defaultExpanded:r=i,startedAt:s,providerId:u,providerIcon:c,children:l}){let{t:m,i18n:d}=a(),[g,f]=R(`work:${e}`,r,!0),y=W(`work:${e}`,g||i),w=U(null),[L,v]=_(0);O(()=>{if(!i||t!==void 0){w.current=null;return}w.current=s??Date.now();let k=()=>{let S=w.current;if(S===null)throw Error("Codex work section is ticking without a start time");v(Date.now()-S)};k();let M=window.setInterval(k,1000);return()=>window.clearInterval(M)},[i,s,t]);let T=t!==void 0?m(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:Z(t,d.language)}):i&&L>=1000?m("stream.codex.workingFor",{duration:Z(L,d.language)}):m(i?"stream.codex.working":"stream.codex.worked");return p("section",{className:"codex-work-section",children:[p("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":g,onClick:()=>f((k)=>!k),children:[u!==void 0&&n("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":u,"aria-hidden":"true",children:c}),n("span",{children:T}),n(I,{expanded:g,className:"codex-work-chevron"})]}),n("div",{className:"codex-work-separator","aria-hidden":"true"}),n("div",{className:h("codex-work-grid",g&&"codex-work-grid-open"),"aria-hidden":!g,inert:!g,children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-work-body",children:y&&l})})})]})}function He(e,t){if(e.type==="tool_use")return Ne(e,t);if(e.type==="thinking")return t("message.thinking");if(e.type==="collab")return ce(e,t);return t("stream.codex.subagentWorking",{name:e.name})}function Y(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return b(e.status);return!1}function We(e,t,o=1000){let[i,r]=_({text:e,live:t}),s=U(Date.now());return O(()=>{if(e===i.text&&t===i.live)return;let u=Date.now(),c=Math.max(0,s.current+o-u);if(c===0||t!==i.live){s.current=u,r({text:e,live:t});return}let l=window.setTimeout(()=>{s.current=Date.now(),r({text:e,live:t})},c);return()=>window.clearTimeout(l)},[i,t,o,e]),t===i.live?i.text:e}function je({blocks:e,defaultExpanded:t=!0}){let{t:o,i18n:i}=a(),r=e.some(Y),s=N(e[0]),u=e.every((y)=>y.type==="tool_use"&&E(y).category==="execute"),[c,l]=R(`group:${s}`,t&&!u),m=W(`group:${s}`,c),d=e.findLast(Y)??e.at(-1);if(d===void 0)throw Error("CodexActivityGroup requires at least one activity block");let g=e.filter((y)=>y.type==="tool_use"),f=We(r?He(d,o):Ze(g,o,i.language),r);return p("div",{className:"codex-activity-group",children:[p("button",{type:"button",className:"codex-activity-group-trigger","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((y)=>!y),children:[p("span",{className:"codex-activity-label",children:[n(te,{block:e[0]}),n("span",{className:"truncate",children:r?n("span",{className:"codex-activity-running",children:f}):f})]}),n(I,{expanded:c})]}),n("div",{className:h("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:n("div",{className:"min-h-0 overflow-hidden",children:n("div",{className:"codex-activity-group-body",children:m&&e.map((y)=>n(ie,{block:y},N(y)))})})})]})}function ee({blocks:e,defaultExpanded:t}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return n(ie,{block:e[0]});return n(je,{blocks:e,defaultExpanded:t})}function $e({blocks:e,defaultExpanded:t}){if(!e.some(we))return n(ee,{blocks:e,defaultExpanded:t});let o=[];for(let i of e){let r=o.at(-1);if(r&&we(r[0])===we(i))r.push(i);else o.push([i])}return n(P,{children:o.map((i)=>we(i[0])?n(Uo,{blocks:i.filter(we)},N(i[0])):n(ee,{blocks:i,defaultExpanded:t},N(i[0])))})}
7
7
  export{zo,$e};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-wpdn3rx8.js";import{H,O,S,F,te,I}from"./chunk-25bzk1wv.js";import{q}from"./chunk-djmnmbm2.js";import{jsx as t,jsxs as r}from"react/jsx-runtime";var u=["requires_action","running","done","idle"];function mr({sessions:l,onSelect:p,t:o}){return t("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":o("sessionList.states.title"),children:u.map((s)=>{let a=l.filter((n)=>n.state===s),i=o(`sessionList.states.${s}`);return r(H,{children:[r(O,{render:t(e,{variant:"ghost",size:"xs"}),"aria-label":`${i}: ${a.length}`,children:[t(q,{state:s,pulse:!1}),t("span",{className:"tabular-nums",children:a.length})]}),t(S,{"aria-label":i,className:"w-72 max-w-[calc(100vw-1rem)]",children:r(F,{children:[t(te,{children:i}),a.length===0?t(I,{disabled:!0,children:o("sessionList.states.empty")}):a.map((n)=>r(I,{onClick:()=>p(n),children:[t(q,{state:n.state,pulse:!1}),t("span",{className:"min-w-0 flex-1 truncate",children:n.title||o("sessionList.untitled")})]},n.sessionId))]})})]},s)})})}
1
+ import{e}from"./chunk-wpdn3rx8.js";import{H,F,S,O,te,I}from"./chunk-h68f23r0.js";import{q}from"./chunk-djmnmbm2.js";import{jsx as t,jsxs as r}from"react/jsx-runtime";var u=["requires_action","running","done","idle"];function mr({sessions:l,onSelect:p,t:o}){return t("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":o("sessionList.states.title"),children:u.map((s)=>{let a=l.filter((n)=>n.state===s),i=o(`sessionList.states.${s}`);return r(H,{children:[r(F,{render:t(e,{variant:"ghost",size:"xs"}),"aria-label":`${i}: ${a.length}`,children:[t(q,{state:s,pulse:!1}),t("span",{className:"tabular-nums",children:a.length})]}),t(S,{"aria-label":i,className:"w-72 max-w-[calc(100vw-1rem)]",children:r(O,{children:[t(te,{children:i}),a.length===0?t(I,{disabled:!0,children:o("sessionList.states.empty")}):a.map((n)=>r(I,{onClick:()=>p(n),children:[t(q,{state:n.state,pulse:!1}),t("span",{className:"min-w-0 flex-1 truncate",children:n.title||o("sessionList.untitled")})]},n.sessionId))]})})]},s)})})}
2
2
  export{mr};
@@ -1,2 +1,2 @@
1
- import{t}from"./chunk-q6km9nha.js";import{We}from"./chunk-9gv1zffv.js";import{e}from"./chunk-wpdn3rx8.js";import{kt}from"./chunk-4r3ch7fk.js";import{FileIcon as m,XIcon as r}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function lr({mentions:n,onRemove:s}){let{t:i}=t();if(n.length===0)return null;return a("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:n.map((o)=>l(We,{variant:"secondary",className:"gap-1 pe-0.5",title:o,children:[a(m,{className:"size-3"}),a("span",{className:"max-w-40 truncate",children:kt(o)}),a(e,{type:"button",variant:"ghost",size:"icon-xs",className:"size-4","aria-label":i("composer.removeMention",{name:kt(o)}),onClick:()=>s(o),children:a(r,{className:"size-3"})})]},o))})}
1
+ import{t}from"./chunk-q6km9nha.js";import{We}from"./chunk-9gv1zffv.js";import{e}from"./chunk-wpdn3rx8.js";import{Ct}from"./chunk-w1awbykg.js";import{FileIcon as m,XIcon as r}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function lr({mentions:n,onRemove:s}){let{t:i}=t();if(n.length===0)return null;return a("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:n.map((o)=>l(We,{variant:"secondary",className:"gap-1 pe-0.5",title:o,children:[a(m,{className:"size-3"}),a("span",{className:"max-w-40 truncate",children:Ct(o)}),a(e,{type:"button",variant:"ghost",size:"icon-xs",className:"size-4","aria-label":i("composer.removeMention",{name:Ct(o)}),onClick:()=>s(o),children:a(r,{className:"size-3"})})]},o))})}
2
2
  export{lr};
@@ -1,2 +1,2 @@
1
- import{g,l,ot,r,T}from"./chunk-da4m33bg.js";import{U}from"./chunk-ykp85wc1.js";import{tt}from"./chunk-r4r5ythb.js";import{Ye}from"./chunk-frbeen15.js";import{Ce,Qe}from"./chunk-aj5fk4ez.js";import{hasRename as L}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as F,ArchiveRestoreIcon as D,GitForkIcon as x,PencilIcon as A,Trash2Icon as H}from"lucide-react";import{useRef as N,useState as I}from"react";import{jsx as n,jsxs as C,Fragment as y}from"react/jsx-runtime";function Et({sessionRow:e,active:f,onSelect:u,onForked:p=u,onHoverCardOpenChange:i,actions:a}){let t=g(),{t:m,i18n:v}=t,S=l(),c=r((o)=>o.runStates[e.sessionId]),k=ot(),d=()=>u(e);return n(tt,{"data-session-id":e.sessionId,role:"button",tabIndex:0,active:f,onClick:d,onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),d()},state:c?.state,interruption:c?.interruption??null,title:e.title??m("sessionList.untitled"),onHoverCardOpenChange:i,hoverCard:n(R,{sessionRow:e,onDelete:()=>k(e),onForked:p,actions:a}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ce(e.updatedAt,v.language)}):void 0,actions:c!=null?n(Ye,{title:m("sessionList.stop"),onStop:()=>T(t,S.stopSession(e.sessionId))}):void 0})}function R({sessionRow:e,onDelete:f,onForked:u,actions:p}){let i=g(),{t:a}=i,t=l(),m=r((s)=>L(s.agent)),v=r((s)=>s.connection==="ready"&&s.agent?.capabilities?.session?.fork!=null),[S,c]=I(!1),[k,d]=I(!1),o=N(!1);return n(Qe,{sessionRow:e,renaming:S,onRename:(s)=>{if(c(!1),s!==null)T(i,t.renameSession(e.sessionId,s))},actions:C(y,{children:[m&&n(U,{icon:n(A,{}),label:a("sessionList.rename"),onClick:()=>c(!0)}),p,e.archived?n(U,{icon:n(D,{}),label:a("sessionList.unarchive"),onClick:()=>void T(i,t.unarchive(e.sessionId))}):C(y,{children:[n(U,{icon:n(x,{}),label:a("sessionList.fork"),disabled:!v||k,onClick:()=>{if(o.current)return;o.current=!0,d(!0),T(i,t.fork(e.sessionId,e.cwd).then((s)=>{let h=t.state.sessionList.find((b)=>b.sessionId===s);if(!h)throw Error("Forked chat is missing from the session list");u(h)}).finally(()=>{o.current=!1,d(!1)}))}}),n(U,{icon:n(F,{}),label:a("sessionList.archive"),onClick:()=>void T(i,t.archive(e.sessionId))})]}),n(U,{variant:"destructive",icon:n(H,{}),label:a("sessionList.delete"),onClick:f})]})})}
2
- export{Et};
1
+ import{g,l,ot,r,T}from"./chunk-da4m33bg.js";import{U}from"./chunk-ykp85wc1.js";import{tt}from"./chunk-8g09jrj1.js";import{Ye}from"./chunk-frbeen15.js";import{Ce,Qe}from"./chunk-vp8fb7r8.js";import{hasRename as L}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as F,ArchiveRestoreIcon as D,GitForkIcon as x,PencilIcon as A,Trash2Icon as H}from"lucide-react";import{useRef as N,useState as I}from"react";import{jsx as n,jsxs as C,Fragment as y}from"react/jsx-runtime";function At({sessionRow:e,active:f,onSelect:u,onForked:p=u,onHoverCardOpenChange:i,actions:a}){let t=g(),{t:m,i18n:v}=t,S=l(),c=r((o)=>o.runStates[e.sessionId]),k=ot(),d=()=>u(e);return n(tt,{"data-session-id":e.sessionId,role:"button",tabIndex:0,active:f,onClick:d,onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),d()},state:c?.state,interruption:c?.interruption??null,title:e.title??m("sessionList.untitled"),onHoverCardOpenChange:i,hoverCard:n(R,{sessionRow:e,onDelete:()=>k(e),onForked:p,actions:a}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ce(e.updatedAt,v.language)}):void 0,actions:c!=null?n(Ye,{title:m("sessionList.stop"),onStop:()=>T(t,S.stopSession(e.sessionId))}):void 0})}function R({sessionRow:e,onDelete:f,onForked:u,actions:p}){let i=g(),{t:a}=i,t=l(),m=r((s)=>L(s.agent)),v=r((s)=>s.connection==="ready"&&s.agent?.capabilities?.session?.fork!=null),[S,c]=I(!1),[k,d]=I(!1),o=N(!1);return n(Qe,{sessionRow:e,renaming:S,onRename:(s)=>{if(c(!1),s!==null)T(i,t.renameSession(e.sessionId,s))},actions:C(y,{children:[m&&n(U,{icon:n(A,{}),label:a("sessionList.rename"),onClick:()=>c(!0)}),p,e.archived?n(U,{icon:n(D,{}),label:a("sessionList.unarchive"),onClick:()=>void T(i,t.unarchive(e.sessionId))}):C(y,{children:[n(U,{icon:n(x,{}),label:a("sessionList.fork"),disabled:!v||k,onClick:()=>{if(o.current)return;o.current=!0,d(!0),T(i,t.fork(e.sessionId,e.cwd).then((s)=>{let h=t.state.sessionList.find((b)=>b.sessionId===s);if(!h)throw Error("Forked chat is missing from the session list");u(h)}).finally(()=>{o.current=!1,d(!1)}))}}),n(U,{icon:n(F,{}),label:a("sessionList.archive"),onClick:()=>void T(i,t.archive(e.sessionId))})]}),n(U,{variant:"destructive",icon:n(H,{}),label:a("sessionList.delete"),onClick:f})]})})}
2
+ export{At};
@@ -1,7 +1,7 @@
1
- import{Do}from"./chunk-dnsmr5nf.js";import{Xt,Ho}from"./chunk-pafshe3v.js";import{Qt}from"./chunk-y3567zfn.js";import{decodeHTMLAttribute as C,decodeHTMLStrict as R}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as k,useLayoutEffect as D,useMemo as X,useRef as w,useState as p}from"react";import{jsx as a,jsxs as f,Fragment as te}from"react/jsx-runtime";var G=ge(null);function y(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function N(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!N(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!N(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
1
+ import{Do}from"./chunk-dnsmr5nf.js";import{Yt,Ho}from"./chunk-hfaarm10.js";import{Xt}from"./chunk-rf9yxbes.js";import{decodeHTMLAttribute as C,decodeHTMLStrict as R}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as k,useLayoutEffect as D,useMemo as X,useRef as w,useState as p}from"react";import{jsx as a,jsxs as f,Fragment as te}from"react/jsx-runtime";var G=ge(null);function y(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function N(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!N(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!N(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
2
2
  `)?`${e}\`\`\``:`${e}
3
3
  \`\`\``}function H(e,n){if(!e.includes(n)||Te(e,n)%2===0)return e;let t=ve(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
4
4
  `)||V(r))return e;return`${e}${n}`}function Me(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Ee(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>be&&!xe.has(u))return!1}return!0}function Le(e){let{path:n}=Z(e);if(Me(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Ie(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Ee(t)||Le(t)?e.replace(A,"$1"):`${e})`}function $e(e){let n=e.replace(we,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&ye(n))return{isCodeFenceOpen:!0,markdown:Ne(n)};if(n.includes("!["))n=n.replace(ke,(t,r)=>r);if(n.includes("]("))n=Ie(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Re(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Re(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
5
5
  `),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function I(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);I(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))I(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=p(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return f("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=y();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:f("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r,copyText:o,onCopyError:s}=y(),i=w(null),[c,d]=p(null),[u,h]=p(null),[M,b]=p(!1);if(k(()=>{let g=Do(d,h);return i.current=g,()=>{g.dispose(),i.current=null}},[]),k(()=>{let g=i.current;if(g===null)throw Error("Code highlighter is not mounted");g.update(e,n)},[e,n]),u!==null)throw u;let x=c!==null&&c.code===e&&c.language===n?c.html:null,l=async()=>{b(!1);try{await(o?o(e):navigator.clipboard.writeText(e)),b(!0),window.setTimeout(()=>b(!1),2000)}catch(g){s?.(g)}};return f("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[f("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>void l(),children:M?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...x===null?{children:e}:{dangerouslySetInnerHTML:{__html:x}}})})]})}function je({code:e,language:n}){return y().preview?a("span",{children:e}):a(We,{code:e,language:n})}function We({code:e,language:n}){let t=w(null),[r,o]=p(!1);if(k(()=>{if(r)return;let s=t.current;if(s===null)throw Error("Codex code block placeholder is not mounted");if(typeof IntersectionObserver>"u"){let c=window.setTimeout(()=>o(!0),0);return()=>window.clearTimeout(c)}let i=new IntersectionObserver((c)=>{if(!c.some((d)=>d.isIntersecting))return;o(!0),i.disconnect()},{rootMargin:"600px 0px"});return i.observe(s),()=>i.disconnect()},[r]),r)return a(Oe,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function qe(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ke({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return f("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),f("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function ze(e){return y().preview?a(te,{children:e.alt}):a(Ue,{...e})}function Ue({src:e,alt:n,title:t,allowWide:r}){let o=w(null),[s,i]=p();k(()=>{let d=o.current;if(d===null)throw Error("Codex image preview dialog is not mounted");if(s===void 0){if(d.open)d.close();return}if(!d.open)d.showModal()},[s]);let c=n.length===0?"Open image preview":n;return f(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(qe(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ke,{preview:s,setPreview:i})})]})}function Be({value:e,display:n}){let t=w(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var De=150,v=null;function j(e,n){let t=v;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
6
- `,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return f("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?f("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:f("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=C(e.href);if(!Qt(r))return null;return a(ze,{src:r,alt:R(e.text),title:e.title==null?void 0:C(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(R(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=C(t.href);return Qt(o)?a(_e,{href:o,title:t.title==null?void 0:C(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function T(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?R(n.text):n.tokens.map(T).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(T).join("");case"list":return e.items.map(T).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(T).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=v;try{return v={cursor:t,runs:r,generation:o},ne(e,n)}finally{v=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);I(l);let g=new Map,P=0;return l.map((E)=>{let L=ee(E),S=g.get(L)??0;g.set(L,S+1);let F=T(E),re={token:E,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=w({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,h=performance.now(),M=r&&d?c.runs.filter((l)=>h-l.firstSeenAtMs<De):[],b=c.generation+(d?0:1),x={text:t,visibleText:s,runs:M.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:b};if(r&&s.length>u)x.runs.push({start:u,end:s.length,firstSeenAtMs:h});return D(()=>{i.current=x}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:x.runs,generation:b},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=w(null),[o,s]=p(()=>Xt(n,t)),i=w(o!==null),[c,d]=p(null);if(k(()=>{let u=Ho((h)=>{if(!i.current)i.current=!0,s(h);else fe(()=>s(h))},d);return r.current=u,()=>{u.dispose(),r.current=null}},[]),k(()=>{let u=r.current;if(u===null)throw Error("Markdown parser is not mounted");let h=t?$e(n).markdown:n;u.update({source:h,text:n,isStreaming:t})},[t,n]),c!==null)throw c;return o===null?a("div",{"data-markdown-pending":!0}):a(Ye,{result:o})});function No({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=p(e);return k(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(Qe,{text:r?o:e,isStreaming:r})})}
6
+ `,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return f("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?f("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:f("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=C(e.href);if(!Xt(r))return null;return a(ze,{src:r,alt:R(e.text),title:e.title==null?void 0:C(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(R(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=C(t.href);return Xt(o)?a(_e,{href:o,title:t.title==null?void 0:C(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function T(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?R(n.text):n.tokens.map(T).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(T).join("");case"list":return e.items.map(T).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(T).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=v;try{return v={cursor:t,runs:r,generation:o},ne(e,n)}finally{v=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);I(l);let g=new Map,P=0;return l.map((E)=>{let L=ee(E),S=g.get(L)??0;g.set(L,S+1);let F=T(E),re={token:E,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=w({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,h=performance.now(),M=r&&d?c.runs.filter((l)=>h-l.firstSeenAtMs<De):[],b=c.generation+(d?0:1),x={text:t,visibleText:s,runs:M.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:b};if(r&&s.length>u)x.runs.push({start:u,end:s.length,firstSeenAtMs:h});return D(()=>{i.current=x}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:x.runs,generation:b},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=w(null),[o,s]=p(()=>Yt(n,t)),i=w(o!==null),[c,d]=p(null);if(k(()=>{let u=Ho((h)=>{if(!i.current)i.current=!0,s(h);else fe(()=>s(h))},d);return r.current=u,()=>{u.dispose(),r.current=null}},[]),k(()=>{let u=r.current;if(u===null)throw Error("Markdown parser is not mounted");let h=t?$e(n).markdown:n;u.update({source:h,text:n,isStreaming:t})},[t,n]),c!==null)throw c;return o===null?a("div",{"data-markdown-pending":!0}):a(Ye,{result:o})});function No({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=p(e);return k(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(Qe,{text:r?o:e,isStreaming:r})})}
7
7
  export{No};
@@ -1,2 +1,2 @@
1
- import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as I,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var C=d(null),$t=d(null);function li(){return i($t)}var qt=d(null);function ci(){return i(qt)}var De=d(null);function _e(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var He=()=>i(C);function di(){let r=i(De);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(De);function Zn({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=A!==void 0,[G,J]=z(r),p=A??G,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)R?.(t);else J(t)},[T,R]),g=n(()=>P(""),[P]),x=U!==void 0,[K,N]=z([]),v=U??K,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else N(e)},[x,L]),j=I(null),w=I(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let k=n(()=>{w.current?.()},[]),b=q(()=>({files:v,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[v,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:W,clearSubmitted:c??g},attachments:b,__registerFileInput:H}),[p,P,g,W,c,b,H]);return D(C.Provider,{value:Q,children:D(De.Provider,{value:b,children:B})})}var Vt=d(null);function y(){let r=X(),l=i(Vt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
- export{$t,li,qt,ci,De,_e,He,di,Zn,Vt,y};
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as I,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var C=d(null),qt=d(null);function li(){return i(qt)}var Vt=d(null);function ci(){return i(Vt)}var De=d(null);function _e(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var He=()=>i(C);function di(){let r=i(De);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(De);function Zn({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=A!==void 0,[G,J]=z(r),p=A??G,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)R?.(t);else J(t)},[T,R]),g=n(()=>P(""),[P]),x=U!==void 0,[K,N]=z([]),v=U??K,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else N(e)},[x,L]),j=I(null),w=I(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let k=n(()=>{w.current?.()},[]),b=q(()=>({files:v,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[v,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:W,clearSubmitted:c??g},attachments:b,__registerFileInput:H}),[p,P,g,W,c,b,H]);return D(C.Provider,{value:Q,children:D(De.Provider,{value:b,children:B})})}var Wt=d(null);function y(){let r=X(),l=i(Wt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{qt,li,Vt,ci,De,_e,He,di,Zn,Wt,y};
@@ -1,2 +1,2 @@
1
- import{n}from"./chunk-q6km9nha.js";import{Pe,Ne,Me}from"./chunk-6wqbetcx.js";import{o}from"./chunk-6acs2hzs.js";import{c,M}from"./chunk-n1tjf64a.js";import{hasAccount as L,isGroupedSelect as H}from"@nyssance/codex-acp-v2/client";import{cn as W}from"cn";import{useEffect as T,useState as F}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var p=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),z=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),O=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function g(a){return typeof a==="number"&&!Number.isNaN(a)?Math.max(0,a):0}function A(a,t){let e=Math.min(100,a/t*100),f=e>=90?"text-destructive":e>=70?"text-foreground":"text-muted-foreground";return{pct:e,className:f}}function I(a){let t=c(a.configOptions,"model");return t===void 0?void 0:M(t)}function An(a,t){let e=a.windowDurationMins;if(e===null)return t("usage.usage");if(e%1440===0)return t("usage.windowDays",{count:e/1440});return t("usage.windowHours",{count:Math.round(e/60)})}function U(a){let{client:t}=o(),e=n((s)=>a&&s.connection==="ready"&&L(s.agent)),[f,l]=F(null);return T(()=>{if(!e){l(null);return}let s=!0;t.readRateLimits().then((m)=>{if(s)l(m)},()=>{return});let d=t.onRateLimits((m)=>{if(s)l(m)});return()=>{s=!1,d()}},[e,t]),e?f:null}function ct({session:a}){let{t}=o().host,e=c(a.configOptions,"model"),f=e!==void 0&&(H(e.options)?e.options.some((i)=>i.groupId==="chatgpt"&&i.options.some((y)=>y.value===e.currentValue)):!e.currentValue.startsWith("gateway:")&&e.options.some((i)=>i.value===e.currentValue)),l=U(f),{usage:s,lastTurnUsage:d}=a;if(s===null&&d===null)return null;let m=s&&s.size>0?A(s.used,s.size):null,h=7,b=2*Math.PI*h,N=g(d?.inputTokens),k=g(d?.outputTokens),x=g(d?.cachedReadTokens),w=g(d?.cachedWriteTokens),S=g(d?.totalTokens)||N+k+x+w,R=N+x,C=R>0?z.format(x/R):t("tokens.notAvailable"),D=[[t("tokens.input"),p.format(N)],[t("tokens.output"),p.format(k)],[t("tokens.cachedRead"),p.format(x)],[t("tokens.cachedWrite"),p.format(w)],[t("tokens.cacheHitRate"),C],[t("tokens.total"),p.format(S)]],v=I(a);return u(Pe,{children:[r(Ne,{delay:100,closeDelay:100,render:u("button",{type:"button",className:W("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",m?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),m!==null&&r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b*(1-m.pct/100),transform:"rotate(-90 9 9)"})]}),m!==null&&u("span",{children:[Math.round(m.pct),"%"]})]})}),u(Me,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[v!==void 0&&r("div",{className:"border-b px-3 py-2",children:r("p",{className:"text-foreground truncate text-xs font-semibold",title:v,children:v})}),u("div",{className:"flex flex-col gap-3 p-3",children:[d!==null&&u("div",{className:"flex flex-col gap-1.5",children:[r("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:D.map(([i,y])=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:i}),r("dd",{className:"text-end tabular-nums",children:y})]},i))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("tokens.context")}),r("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:p.format(s.used),limit:p.format(s.size),percent:O.format(s.used/s.size*100)})})]}),l!==null&&(l.primary!==null||l.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("usage.limits")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[l.primary,l.secondary].filter((i)=>i!==null).map((i)=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:An(i,t)}),r("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,i.usedPercent)))})})]},`${i.windowDurationMins??"window"}`))})]})]})]})]})}
1
+ import{n}from"./chunk-q6km9nha.js";import{Pe,Ne,Me}from"./chunk-6wqbetcx.js";import{o}from"./chunk-0ss92kxr.js";import{c,M}from"./chunk-n1tjf64a.js";import{hasAccount as L,isGroupedSelect as H}from"@nyssance/codex-acp-v2/client";import{cn as W}from"cn";import{useEffect as T,useState as F}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var p=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),z=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),O=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function g(a){return typeof a==="number"&&!Number.isNaN(a)?Math.max(0,a):0}function A(a,t){let e=Math.min(100,a/t*100),f=e>=90?"text-destructive":e>=70?"text-foreground":"text-muted-foreground";return{pct:e,className:f}}function I(a){let t=c(a.configOptions,"model");return t===void 0?void 0:M(t)}function An(a,t){let e=a.windowDurationMins;if(e===null)return t("usage.usage");if(e%1440===0)return t("usage.windowDays",{count:e/1440});return t("usage.windowHours",{count:Math.round(e/60)})}function U(a){let{client:t}=o(),e=n((s)=>a&&s.connection==="ready"&&L(s.agent)),[f,l]=F(null);return T(()=>{if(!e){l(null);return}let s=!0;t.readRateLimits().then((m)=>{if(s)l(m)},()=>{return});let d=t.onRateLimits((m)=>{if(s)l(m)});return()=>{s=!1,d()}},[e,t]),e?f:null}function ct({session:a}){let{t}=o().host,e=c(a.configOptions,"model"),f=e!==void 0&&(H(e.options)?e.options.some((i)=>i.groupId==="chatgpt"&&i.options.some((y)=>y.value===e.currentValue)):!e.currentValue.startsWith("gateway:")&&e.options.some((i)=>i.value===e.currentValue)),l=U(f),{usage:s,lastTurnUsage:d}=a;if(s===null&&d===null)return null;let m=s&&s.size>0?A(s.used,s.size):null,h=7,b=2*Math.PI*h,N=g(d?.inputTokens),k=g(d?.outputTokens),x=g(d?.cachedReadTokens),w=g(d?.cachedWriteTokens),S=g(d?.totalTokens)||N+k+x+w,R=N+x,C=R>0?z.format(x/R):t("tokens.notAvailable"),D=[[t("tokens.input"),p.format(N)],[t("tokens.output"),p.format(k)],[t("tokens.cachedRead"),p.format(x)],[t("tokens.cachedWrite"),p.format(w)],[t("tokens.cacheHitRate"),C],[t("tokens.total"),p.format(S)]],v=I(a);return u(Pe,{children:[r(Ne,{delay:100,closeDelay:100,render:u("button",{type:"button",className:W("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",m?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),m!==null&&r("circle",{cx:"9",cy:"9",r:h,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:b,strokeDashoffset:b*(1-m.pct/100),transform:"rotate(-90 9 9)"})]}),m!==null&&u("span",{children:[Math.round(m.pct),"%"]})]})}),u(Me,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[v!==void 0&&r("div",{className:"border-b px-3 py-2",children:r("p",{className:"text-foreground truncate text-xs font-semibold",title:v,children:v})}),u("div",{className:"flex flex-col gap-3 p-3",children:[d!==null&&u("div",{className:"flex flex-col gap-1.5",children:[r("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:D.map(([i,y])=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:i}),r("dd",{className:"text-end tabular-nums",children:y})]},i))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("tokens.context")}),r("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:p.format(s.used),limit:p.format(s.size),percent:O.format(s.used/s.size*100)})})]}),l!==null&&(l.primary!==null||l.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[r("p",{className:"text-xs font-medium",children:t("usage.limits")}),r("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[l.primary,l.secondary].filter((i)=>i!==null).map((i)=>u("div",{className:"contents",children:[r("dt",{className:"text-muted-foreground",children:An(i,t)}),r("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,i.usedPercent)))})})]},`${i.windowDurationMins??"window"}`))})]})]})]})]})}
2
2
  export{An,ct};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-wpdn3rx8.js";import{H,O,S,F,te,I,Re,Ee,Ae,Bt,P}from"./chunk-25bzk1wv.js";import{ze}from"./chunk-4s1rhts0.js";import{ue,me,pe}from"./chunk-ea3582qy.js";import{Ft}from"./chunk-t1j88bvm.js";import{f}from"./chunk-dxnttcwd.js";import{cn as m}from"cn";import{ArrowUpRight as se,ChevronUp as G,Loader2Icon as U,Zap as W}from"lucide-react";import{Fragment as ie,useState as Z}from"react";import{jsx as n,jsxs as s,Fragment as p}from"react/jsx-runtime";function _n({value:c,onChange:q,models:x,modelGroups:k,compactCatalog:l,effortPresentation:_="slider",unavailableEffort:v,providerMenu:h,header:w,className:R,condensed:C,stripLabelPrefix:T,showDescription:J,showModelList:K=!0,loading:Q,switching:A,isLoading:X,effortConfig:i,booleanOptions:D,onBooleanChange:V,selectOptions:Y=[],t:u,...r}){let[E,ee]=Z(!1),[ne,ae]=Z(!1),d=D?.find((a)=>a.id==="fast_mode"),z=l?D?.filter((a)=>a!==d):D,L=(a)=>T&&a.startsWith(T)?a.slice(T.length):a;if(Q)return n("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:s(e,{variant:"ghost",disabled:!0,className:m("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",R),children:[n(U,{className:"size-3 animate-spin"}),n("span",{className:"text-muted-foreground truncate",children:u("model.loadingModels")})]})});return s("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[h&&s(H,{open:E,onOpenChange:ee,children:[s(ue,{children:[n(me,{render:n(O,{render:s(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:r.disabled,className:m("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[h.icon,n(G,{className:"size-2.5 shrink-0 opacity-60"})]})})}),n(pe,{children:u("model.switchProvider")})]}),s(S,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[h.groups.map((a,t)=>s(ie,{children:[t>0&&a.length>0&&n(P,{}),n(f,{value:h.value,onValueChange:h.onChange,options:a})]},t)),h.moreAction&&s(p,{children:[n(P,{}),s(I,{onClick:h.moreAction,className:"whitespace-nowrap",children:[n("span",{className:"min-w-0 flex-1 truncate",children:u("model.moreModels")}),n(se,{className:"size-4"})]})]})]})]}),s(H,{open:ne,onOpenChange:ae,children:[s(ue,{children:[n(me,{render:n(O,{render:s(e,{"data-testid":"model-trigger","aria-busy":A,variant:"ghost",className:m("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",C&&"h-7 gap-1 px-1.5 text-[11px]",R),...r,children:[c.icon,D?.some((a)=>a.id==="fast_mode"&&a.currentValue&&!a.disabled)&&n(W,{"aria-hidden":"true",className:"size-3 shrink-0 fill-current"}),n("span",{className:m("min-w-0 flex-1 truncate text-start",C&&"text-[11px]"),children:L(c.label)||u("model.selectModel")}),i&&s("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[n("span",{className:"invisible col-start-1 row-start-1",children:i.sizer??i.levels.reduce((a,t)=>t.name.length>a.length?t.name:a,"")}),n("span",{className:"col-start-1 row-start-1",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),A?n(U,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"}):n(G,{className:m("size-3 shrink-0",C&&"size-2.5")})]})})}),n(pe,{children:u("model.switchModel")})]}),s(S,{side:"top",align:"end",sideOffset:4,className:m("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",l&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[l&&s(p,{children:[s(F,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-2 py-1",children:[i?_==="slider"?n("div",{role:"menuitem","aria-label":i.name,className:"min-w-0 flex-1 [&>div]:justify-between [&>div]:gap-3 [&>div]:px-0 [&>div]:py-1.5",children:n(Ft,{...i,disabled:r.disabled})}):s(Re,{children:[s(Ee,{disabled:r.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[n("span",{children:i.name}),n("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(Ae,{children:n(f,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):v?s(I,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[n("span",{children:v.name}),n("span",{className:"text-muted-foreground truncate text-xs",children:v.label})]}):n(te,{className:"min-w-0 flex-1 truncate",children:w?.name}),d&&n(Bt,{"aria-label":d.name,title:d.title??d.name,disabled:r.disabled||d.disabled,checked:d.currentValue,closeOnClick:!1,onCheckedChange:(a)=>V?.(d.id,a),className:m("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ms-auto -me-2 size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",d.currentValue&&!d.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:d.icon??n(W,{className:"size-4","aria-hidden":"true"})})]}),n(P,{className:"shrink-0"})]}),w&&!l&&s(p,{children:[s("div",{className:"flex items-center gap-2 px-2 py-2",children:[w.icon,n("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:w.name}),w.action]}),n(P,{})]}),s(F,{"data-model-menu-list":l?"":void 0,className:l?"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain":void 0,children:[K&&(X?n(I,{disabled:!0,className:"text-muted-foreground",children:u("model.loadingModels")}):x.length===0?n(I,{disabled:!0,className:"text-muted-foreground",children:u("model.noModelsAvailable")}):(()=>{let a=x.filter((o)=>!o.more),t=x.filter((o)=>o.more),j=a.length>0&&t.length>0,N=(o,g)=>({disabled:r.disabled,icon:o.icon,value:o.api_id,label:L(o.label),description:g?.noDescription?void 0:J?o.description:void 0}),M=(o)=>{let g=x.find((y)=>y.api_id===o);if(g)q(g)};if(l)return n(f,{value:c.api_id,onValueChange:M,itemClassName:"min-w-0 max-w-full font-normal whitespace-nowrap",options:x.map((o)=>N(o))});return s(p,{children:[k?k.map((o)=>{let g=o.models.filter((b)=>!b.more),y=o.models.filter((b)=>b.more),B=g.length>0&&y.length>0;return s(F,{children:[n(te,{className:"text-muted-foreground text-xs font-normal",children:o.name}),n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:(B?g:o.models).map((b)=>N(b))}),B&&s(Re,{children:[n(Ee,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(Ae,{children:n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:y.map((b)=>N(b,{noDescription:!0}))})})]})]},o.id)}):n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:(j?a:x).map((o)=>N(o))}),!k&&j&&s(Re,{children:[n(Ee,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(Ae,{children:n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:t.map((o)=>N(o,{noDescription:!0}))})})]})]})})()),!l&&i&&s(p,{children:[n(P,{}),_==="menu"?s(Re,{children:[s(Ee,{disabled:r.disabled,children:[n("span",{className:"flex-1",children:i.name}),n("span",{className:"text-muted-foreground",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(Ae,{children:n(f,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):n(Ft,{...i,disabled:r.disabled})]}),!l&&!i&&v&&s(p,{children:[n(P,{}),s(I,{disabled:!0,children:[n("span",{className:"flex-1",children:v.name}),n("span",{children:v.label})]})]}),Y.map((a)=>s(F,{children:[n(P,{}),n(te,{children:a.name}),n(f,{value:a.value,onValueChange:a.onChange,options:a.options,itemClassName:"whitespace-nowrap"})]},a.id)),z&&z.length>0&&s(p,{children:[!i&&n(P,{}),z.map((a)=>l?s(Bt,{"aria-label":a.name,title:a.title,disabled:r.disabled||a.disabled,checked:a.currentValue,closeOnClick:!1,onCheckedChange:(t)=>V?.(a.id,t),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[s("span",{className:"flex items-center gap-2",children:[a.icon,a.name]}),n("span",{"aria-hidden":"true",className:m("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",a.currentValue?"bg-primary":"bg-input"),children:n("span",{className:m("bg-background size-3.5 rounded-full shadow-xs transition-transform",a.currentValue&&"translate-x-3.5")})})]},a.id):s("div",{title:a.title,className:m("flex items-center justify-between gap-3 px-2 py-2.5",a.disabled&&"opacity-50"),children:[s("span",{className:"flex items-center gap-2 text-sm font-medium",children:[a.icon,a.name]}),n(ze,{"aria-label":a.name,disabled:r.disabled||a.disabled,checked:a.currentValue,onCheckedChange:(t)=>V?.(a.id,t)})]},a.id))]})]}),l&&w?.action&&s(p,{children:[n(P,{className:"shrink-0"}),n(F,{"data-model-menu-footer":!0,className:"shrink-0",children:w.action})]})]})]})]})}
1
+ import{e}from"./chunk-wpdn3rx8.js";import{H,F,S,O,te,I,Re,Ee,Ae,zt,P}from"./chunk-h68f23r0.js";import{ze}from"./chunk-4s1rhts0.js";import{ue,me,pe}from"./chunk-ea3582qy.js";import{Bt}from"./chunk-65m4bm74.js";import{f}from"./chunk-3k5n3809.js";import{cn as m}from"cn";import{ArrowUpRight as se,ChevronUp as G,Loader2Icon as U,Zap as W}from"lucide-react";import{Fragment as ie,useState as Z}from"react";import{jsx as n,jsxs as s,Fragment as p}from"react/jsx-runtime";function _n({value:c,onChange:q,models:x,modelGroups:k,compactCatalog:l,effortPresentation:_="slider",unavailableEffort:v,providerMenu:h,header:w,className:R,condensed:C,stripLabelPrefix:T,showDescription:J,showModelList:K=!0,loading:Q,switching:A,isLoading:X,effortConfig:i,booleanOptions:D,onBooleanChange:V,selectOptions:Y=[],t:u,...r}){let[E,ee]=Z(!1),[ne,ae]=Z(!1),d=D?.find((a)=>a.id==="fast_mode"),z=l?D?.filter((a)=>a!==d):D,L=(a)=>T&&a.startsWith(T)?a.slice(T.length):a;if(Q)return n("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:s(e,{variant:"ghost",disabled:!0,className:m("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",R),children:[n(U,{className:"size-3 animate-spin"}),n("span",{className:"text-muted-foreground truncate",children:u("model.loadingModels")})]})});return s("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[h&&s(H,{open:E,onOpenChange:ee,children:[s(ue,{children:[n(me,{render:n(F,{render:s(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:r.disabled,className:m("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[h.icon,n(G,{className:"size-2.5 shrink-0 opacity-60"})]})})}),n(pe,{children:u("model.switchProvider")})]}),s(S,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[h.groups.map((a,t)=>s(ie,{children:[t>0&&a.length>0&&n(P,{}),n(f,{value:h.value,onValueChange:h.onChange,options:a})]},t)),h.moreAction&&s(p,{children:[n(P,{}),s(I,{onClick:h.moreAction,className:"whitespace-nowrap",children:[n("span",{className:"min-w-0 flex-1 truncate",children:u("model.moreModels")}),n(se,{className:"size-4"})]})]})]})]}),s(H,{open:ne,onOpenChange:ae,children:[s(ue,{children:[n(me,{render:n(F,{render:s(e,{"data-testid":"model-trigger","aria-busy":A,variant:"ghost",className:m("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",C&&"h-7 gap-1 px-1.5 text-[11px]",R),...r,children:[c.icon,D?.some((a)=>a.id==="fast_mode"&&a.currentValue&&!a.disabled)&&n(W,{"aria-hidden":"true",className:"size-3 shrink-0 fill-current"}),n("span",{className:m("min-w-0 flex-1 truncate text-start",C&&"text-[11px]"),children:L(c.label)||u("model.selectModel")}),i&&s("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[n("span",{className:"invisible col-start-1 row-start-1",children:i.sizer??i.levels.reduce((a,t)=>t.name.length>a.length?t.name:a,"")}),n("span",{className:"col-start-1 row-start-1",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),A?n(U,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"}):n(G,{className:m("size-3 shrink-0",C&&"size-2.5")})]})})}),n(pe,{children:u("model.switchModel")})]}),s(S,{side:"top",align:"end",sideOffset:4,className:m("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",l&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[l&&s(p,{children:[s(O,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-2 py-1",children:[i?_==="slider"?n("div",{role:"menuitem","aria-label":i.name,className:"min-w-0 flex-1 [&>div]:justify-between [&>div]:gap-3 [&>div]:px-0 [&>div]:py-1.5",children:n(Bt,{...i,disabled:r.disabled})}):s(Re,{children:[s(Ee,{disabled:r.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[n("span",{children:i.name}),n("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(Ae,{children:n(f,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):v?s(I,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[n("span",{children:v.name}),n("span",{className:"text-muted-foreground truncate text-xs",children:v.label})]}):n(te,{className:"min-w-0 flex-1 truncate",children:w?.name}),d&&n(zt,{"aria-label":d.name,title:d.title??d.name,disabled:r.disabled||d.disabled,checked:d.currentValue,closeOnClick:!1,onCheckedChange:(a)=>V?.(d.id,a),className:m("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ms-auto -me-2 size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",d.currentValue&&!d.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:d.icon??n(W,{className:"size-4","aria-hidden":"true"})})]}),n(P,{className:"shrink-0"})]}),w&&!l&&s(p,{children:[s("div",{className:"flex items-center gap-2 px-2 py-2",children:[w.icon,n("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:w.name}),w.action]}),n(P,{})]}),s(O,{"data-model-menu-list":l?"":void 0,className:l?"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain":void 0,children:[K&&(X?n(I,{disabled:!0,className:"text-muted-foreground",children:u("model.loadingModels")}):x.length===0?n(I,{disabled:!0,className:"text-muted-foreground",children:u("model.noModelsAvailable")}):(()=>{let a=x.filter((o)=>!o.more),t=x.filter((o)=>o.more),j=a.length>0&&t.length>0,N=(o,g)=>({disabled:r.disabled,icon:o.icon,value:o.api_id,label:L(o.label),description:g?.noDescription?void 0:J?o.description:void 0}),M=(o)=>{let g=x.find((y)=>y.api_id===o);if(g)q(g)};if(l)return n(f,{value:c.api_id,onValueChange:M,itemClassName:"min-w-0 max-w-full font-normal whitespace-nowrap",options:x.map((o)=>N(o))});return s(p,{children:[k?k.map((o)=>{let g=o.models.filter((b)=>!b.more),y=o.models.filter((b)=>b.more),B=g.length>0&&y.length>0;return s(O,{children:[n(te,{className:"text-muted-foreground text-xs font-normal",children:o.name}),n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:(B?g:o.models).map((b)=>N(b))}),B&&s(Re,{children:[n(Ee,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(Ae,{children:n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:y.map((b)=>N(b,{noDescription:!0}))})})]})]},o.id)}):n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:(j?a:x).map((o)=>N(o))}),!k&&j&&s(Re,{children:[n(Ee,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(Ae,{children:n(f,{value:c.api_id,onValueChange:M,itemClassName:"font-medium whitespace-nowrap",options:t.map((o)=>N(o,{noDescription:!0}))})})]})]})})()),!l&&i&&s(p,{children:[n(P,{}),_==="menu"?s(Re,{children:[s(Ee,{disabled:r.disabled,children:[n("span",{className:"flex-1",children:i.name}),n("span",{className:"text-muted-foreground",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(Ae,{children:n(f,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):n(Bt,{...i,disabled:r.disabled})]}),!l&&!i&&v&&s(p,{children:[n(P,{}),s(I,{disabled:!0,children:[n("span",{className:"flex-1",children:v.name}),n("span",{children:v.label})]})]}),Y.map((a)=>s(O,{children:[n(P,{}),n(te,{children:a.name}),n(f,{value:a.value,onValueChange:a.onChange,options:a.options,itemClassName:"whitespace-nowrap"})]},a.id)),z&&z.length>0&&s(p,{children:[!i&&n(P,{}),z.map((a)=>l?s(zt,{"aria-label":a.name,title:a.title,disabled:r.disabled||a.disabled,checked:a.currentValue,closeOnClick:!1,onCheckedChange:(t)=>V?.(a.id,t),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[s("span",{className:"flex items-center gap-2",children:[a.icon,a.name]}),n("span",{"aria-hidden":"true",className:m("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",a.currentValue?"bg-primary":"bg-input"),children:n("span",{className:m("bg-background size-3.5 rounded-full shadow-xs transition-transform",a.currentValue&&"translate-x-3.5")})})]},a.id):s("div",{title:a.title,className:m("flex items-center justify-between gap-3 px-2 py-2.5",a.disabled&&"opacity-50"),children:[s("span",{className:"flex items-center gap-2 text-sm font-medium",children:[a.icon,a.name]}),n(ze,{"aria-label":a.name,disabled:r.disabled||a.disabled,checked:a.currentValue,onCheckedChange:(t)=>V?.(a.id,t)})]},a.id))]})]}),l&&w?.action&&s(p,{children:[n(P,{className:"shrink-0"}),n(O,{"data-model-menu-footer":!0,className:"shrink-0",children:w.action})]})]})]})]})}
2
2
  export{_n};