@alwith/module-chat 0.5.0 → 0.5.2

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 (208) hide show
  1. package/README.md +23 -10
  2. package/dist/activity-host.d.ts +1 -0
  3. package/dist/activity-host.js +1 -1
  4. package/dist/approval/choice-elicitation-form.js +1 -1
  5. package/dist/approval/choice-schema.js +1 -1
  6. package/dist/approval/permission-options.js +1 -1
  7. package/dist/approval/permission-view.js +1 -1
  8. package/dist/approval/schema-elicitation-form.js +1 -1
  9. package/dist/approval/url-elicitation-card.js +1 -1
  10. package/dist/chunk-15nwm04a.js +2 -0
  11. package/dist/chunk-16y5rmm5.js +2 -0
  12. package/dist/chunk-1d4c9j8w.js +2 -0
  13. package/dist/chunk-20zcgxa5.js +4 -0
  14. package/dist/{chunk-kaeqvcew.js → chunk-2epnn4sq.js} +1 -1
  15. package/dist/chunk-2f19pcpn.js +2 -0
  16. package/dist/chunk-3vt71emt.js +2 -0
  17. package/dist/{chunk-1yy2jsnh.js → chunk-42zr8zpv.js} +2 -2
  18. package/dist/{chunk-k7s0drzk.js → chunk-4svwa5p8.js} +3 -3
  19. package/dist/chunk-4tkxmh52.js +2 -0
  20. package/dist/chunk-5grywgpq.js +4 -0
  21. package/dist/chunk-5h13saah.js +2 -0
  22. package/dist/chunk-5j3wnans.js +2 -0
  23. package/dist/{chunk-yw4e2tcz.js → chunk-6p5hgnpq.js} +1 -1
  24. package/dist/{chunk-kget6qfz.js → chunk-6qa5dt1k.js} +1 -1
  25. package/dist/{chunk-341yykkp.js → chunk-6qn5srgg.js} +1 -1
  26. package/dist/{chunk-1cy1j8gj.js → chunk-6vky4fcv.js} +2 -2
  27. package/dist/{chunk-p9wpghey.js → chunk-7kcdf82d.js} +2 -2
  28. package/dist/{chunk-1hy64ewz.js → chunk-7q7c0mds.js} +1 -1
  29. package/dist/{chunk-wjejhpgw.js → chunk-801v0awm.js} +1 -1
  30. package/dist/{chunk-evcrrxfp.js → chunk-8e7xf2tb.js} +1 -1
  31. package/dist/chunk-8k7wzkna.js +2 -0
  32. package/dist/chunk-8vvn71rf.js +2 -0
  33. package/dist/{chunk-0e1pdbec.js → chunk-9ab18v07.js} +2 -2
  34. package/dist/{chunk-ph7bk34y.js → chunk-9dsa5vm7.js} +2 -2
  35. package/dist/chunk-9pdj44jr.js +2 -0
  36. package/dist/{chunk-m5pbe513.js → chunk-9s1cgt7s.js} +1 -1
  37. package/dist/chunk-aqj0v5a9.js +7 -0
  38. package/dist/chunk-azmqtycn.js +2 -0
  39. package/dist/{chunk-3eg720sa.js → chunk-b5mkvr4d.js} +2 -2
  40. package/dist/chunk-bfe7xk9m.js +3 -0
  41. package/dist/{chunk-k1pd257q.js → chunk-bkbemt8g.js} +2 -2
  42. package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
  43. package/dist/chunk-cw9tg2sz.js +1 -0
  44. package/dist/{chunk-25na55ve.js → chunk-d675nr2b.js} +2 -2
  45. package/dist/{chunk-y2xbq7rb.js → chunk-d8gwsw6j.js} +3 -3
  46. package/dist/{chunk-1twg3evk.js → chunk-dgp9q950.js} +1 -1
  47. package/dist/chunk-dm31xvh3.js +2 -0
  48. package/dist/chunk-dr6z453e.js +2 -0
  49. package/dist/{chunk-4gayxp21.js → chunk-ea7zsd2s.js} +2 -2
  50. package/dist/chunk-fgsd4fsd.js +2 -0
  51. package/dist/chunk-fvnb8ds4.js +2 -0
  52. package/dist/{chunk-qj8r5xvx.js → chunk-h0dq9ztv.js} +2 -2
  53. package/dist/{chunk-66headm4.js → chunk-h38yw8y3.js} +1 -1
  54. package/dist/{chunk-hnt4tt1n.js → chunk-h6df4xfd.js} +2 -2
  55. package/dist/chunk-h87xp1gv.js +2 -0
  56. package/dist/{chunk-bwzjm3g8.js → chunk-hx6wfscz.js} +1 -1
  57. package/dist/chunk-j2mcvb68.js +7 -0
  58. package/dist/chunk-jeyvacx6.js +5 -0
  59. package/dist/chunk-jh8jske0.js +2 -0
  60. package/dist/chunk-jn2pj92h.js +2 -0
  61. package/dist/{chunk-r5d37dc0.js → chunk-jrrvpnf3.js} +1 -1
  62. package/dist/chunk-jsb0zged.js +2 -0
  63. package/dist/chunk-k2y4cpra.js +2 -0
  64. package/dist/{chunk-zt7a6b1m.js → chunk-k7zzrns3.js} +1 -1
  65. package/dist/chunk-m2myfd89.js +2 -0
  66. package/dist/chunk-m2wxz0sj.js +2 -0
  67. package/dist/chunk-nxarfyj2.js +2 -0
  68. package/dist/chunk-p1pd1twf.js +2 -0
  69. package/dist/chunk-p6558tbk.js +2 -0
  70. package/dist/{chunk-e9zndx26.js → chunk-phe3an96.js} +2 -2
  71. package/dist/{chunk-ftka421d.js → chunk-q7e2bdav.js} +2 -2
  72. package/dist/chunk-qh5fhcrh.js +3 -0
  73. package/dist/chunk-sky795ex.js +1 -0
  74. package/dist/chunk-t3vgbc9s.js +2 -0
  75. package/dist/{chunk-90rwhxdf.js → chunk-t5nstx0k.js} +2 -2
  76. package/dist/chunk-trgq8rq1.js +2 -0
  77. package/dist/{chunk-bf5fh35b.js → chunk-v0zn87k5.js} +2 -2
  78. package/dist/chunk-v72t4sf9.js +2 -0
  79. package/dist/chunk-vhat5rbz.js +2 -0
  80. package/dist/chunk-vw2hv2sq.js +2 -0
  81. package/dist/{chunk-3496tgga.js → chunk-w3yddw6n.js} +2 -2
  82. package/dist/chunk-x9pramem.js +2 -0
  83. package/dist/{chunk-arge74eh.js → chunk-xjen1yt6.js} +2 -2
  84. package/dist/{chunk-g20b01rn.js → chunk-ypvjzkfb.js} +2 -2
  85. package/dist/codex/activity-group.js +1 -1
  86. package/dist/codex/assistant-message.js +1 -2
  87. package/dist/codex/async-question-card.js +1 -3
  88. package/dist/codex/disclosure-state.js +1 -1
  89. package/dist/codex/edited-files-card.js +1 -1
  90. package/dist/codex/image-view-activity.js +1 -1
  91. package/dist/codex/markdown-renderer.js +1 -6
  92. package/dist/codex/navigation-audio.d.ts +5 -5
  93. package/dist/codex/navigation-audio.js +1 -1
  94. package/dist/codex/navigation-preview.js +1 -1
  95. package/dist/codex/navigation-rail.js +1 -1
  96. package/dist/codex/plan.js +1 -1
  97. package/dist/codex/styles.css +176 -0
  98. package/dist/codex/timeline-virtualizer.js +1 -1
  99. package/dist/codex/user-message.js +1 -1
  100. package/dist/codex/virtualized-turn-list.js +1 -1
  101. package/dist/composer/completion-filter.js +1 -1
  102. package/dist/composer/completion-menu.js +2 -2
  103. package/dist/composer/completion-trigger.js +1 -1
  104. package/dist/composer/effort-slider.js +1 -1
  105. package/dist/composer/menu-radio.js +1 -1
  106. package/dist/composer/model-select.js +1 -1
  107. package/dist/composer/permission-mode-select.js +1 -1
  108. package/dist/composer/prompt-input-attachments.js +1 -1
  109. package/dist/composer/prompt-input-clipboard.js +1 -1
  110. package/dist/composer/prompt-input-context.js +1 -1
  111. package/dist/composer/prompt-input-textarea.js +3 -3
  112. package/dist/composer/prompt-input.js +1 -1
  113. package/dist/image-lightbox.js +1 -1
  114. package/dist/image-preview-dialog.js +1 -1
  115. package/dist/lib/code-highlighter.js +1 -1
  116. package/dist/lib/fuzzy.js +1 -1
  117. package/dist/lib/group-blocks.js +1 -1
  118. package/dist/lib/image-encode.js +1 -1
  119. package/dist/lib/limits.js +1 -1
  120. package/dist/lib/markdown-parser.js +1 -1
  121. package/dist/lib/markdown-rules.js +1 -1
  122. package/dist/lib/model-name.js +1 -1
  123. package/dist/lib/pointer-centered-zoom.js +1 -1
  124. package/dist/lib/prepare-prompt-files.js +1 -1
  125. package/dist/lib/stream-style.js +1 -1
  126. package/dist/lib/streaming-markdown.js +1 -1
  127. package/dist/locales.d.ts +312 -0
  128. package/dist/locales.js +1 -1
  129. package/dist/search/chat-search.js +1 -1
  130. package/dist/search/dom-matches.js +1 -1
  131. package/dist/search/find-bar.js +1 -1
  132. package/dist/search/literal-matches.js +1 -1
  133. package/dist/session-timeline/activity-group.d.ts +7 -0
  134. package/dist/session-timeline/activity-group.js +1 -0
  135. package/dist/session-timeline/activity-projection.d.ts +3 -0
  136. package/dist/session-timeline/activity-projection.js +1 -0
  137. package/dist/session-timeline/assistant-content.d.ts +7 -0
  138. package/dist/session-timeline/assistant-content.js +1 -0
  139. package/dist/session-timeline/assistant-turn.d.ts +28 -0
  140. package/dist/session-timeline/assistant-turn.js +1 -0
  141. package/dist/session-timeline/async-questions.d.ts +5 -0
  142. package/dist/session-timeline/async-questions.js +1 -0
  143. package/dist/session-timeline/edited-files-card.d.ts +18 -0
  144. package/dist/session-timeline/edited-files-card.js +1 -0
  145. package/dist/session-timeline/history-timeline.d.ts +12 -0
  146. package/dist/session-timeline/history-timeline.js +1 -0
  147. package/dist/session-timeline/host.d.ts +14 -0
  148. package/dist/session-timeline/host.js +1 -0
  149. package/dist/session-timeline/navigation-rail.d.ts +10 -0
  150. package/dist/session-timeline/navigation-rail.js +1 -0
  151. package/dist/session-timeline/plan.d.ts +4 -0
  152. package/dist/session-timeline/plan.js +1 -0
  153. package/dist/session-timeline/question-reply.d.ts +8 -0
  154. package/dist/session-timeline/question-reply.js +1 -0
  155. package/dist/session-timeline/resource-content.d.ts +7 -0
  156. package/dist/session-timeline/resource-content.js +1 -0
  157. package/dist/session-timeline/session-timeline.d.ts +40 -0
  158. package/dist/session-timeline/session-timeline.js +1 -0
  159. package/dist/session-timeline/timeline-registry.d.ts +12 -0
  160. package/dist/session-timeline/timeline-registry.js +1 -0
  161. package/dist/session-timeline/turn-error.d.ts +14 -0
  162. package/dist/session-timeline/turn-error.js +1 -0
  163. package/dist/session-timeline/turn-retry.d.ts +2 -0
  164. package/dist/session-timeline/turn-retry.js +1 -0
  165. package/dist/session-timeline/turn-time.d.ts +5 -0
  166. package/dist/session-timeline/turn-time.js +1 -0
  167. package/dist/session-timeline/turns.d.ts +51 -0
  168. package/dist/session-timeline/turns.js +1 -0
  169. package/dist/session-timeline/types.d.ts +31 -0
  170. package/dist/session-timeline/types.js +0 -0
  171. package/dist/session-timeline/use-timeline-scroll.d.ts +12 -0
  172. package/dist/session-timeline/use-timeline-scroll.js +1 -0
  173. package/dist/session-timeline/user-message.d.ts +8 -0
  174. package/dist/session-timeline/user-message.js +1 -0
  175. package/dist/ui/badge.js +1 -1
  176. package/dist/ui/button.js +1 -1
  177. package/dist/ui/card.js +1 -1
  178. package/dist/ui/checkbox.js +1 -1
  179. package/dist/ui/dialog.js +1 -1
  180. package/dist/ui/dropdown-menu.js +1 -1
  181. package/dist/ui/field.js +1 -1
  182. package/dist/ui/hover-card.js +1 -1
  183. package/dist/ui/input-group-textarea.js +1 -1
  184. package/dist/ui/input-group.js +1 -1
  185. package/dist/ui/input.js +1 -1
  186. package/dist/ui/label.js +1 -1
  187. package/dist/ui/radio-group.js +1 -1
  188. package/dist/ui/separator.js +1 -1
  189. package/dist/ui/switch.js +1 -1
  190. package/dist/ui/textarea.js +1 -1
  191. package/dist/ui/tooltip.js +1 -1
  192. package/package.json +32 -4
  193. package/dist/chunk-2q9rzxbj.js +0 -2
  194. package/dist/chunk-36h9z1mt.js +0 -1
  195. package/dist/chunk-7tj0a2na.js +0 -2
  196. package/dist/chunk-8z8va1ws.js +0 -2
  197. package/dist/chunk-91nk8n6w.js +0 -2
  198. package/dist/chunk-c4cqqqqh.js +0 -2
  199. package/dist/chunk-cp20nzhv.js +0 -2
  200. package/dist/chunk-gfj69sqc.js +0 -2
  201. package/dist/chunk-mbrd76nh.js +0 -2
  202. package/dist/chunk-pc1yzf1x.js +0 -1
  203. package/dist/chunk-pqgtv07g.js +0 -2
  204. package/dist/chunk-reqrpvyy.js +0 -2
  205. package/dist/chunk-rgy601b7.js +0 -2
  206. package/dist/chunk-svmc952q.js +0 -7
  207. package/dist/chunk-tzdd96d0.js +0 -2
  208. package/dist/chunk-yvj5y06y.js +0 -2
@@ -1,2 +1,2 @@
1
- import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function T({entries:s}){let d=s.filter((a)=>a.status==="completed").length,t=s.find((a)=>a.status==="in_progress");return e("div",{className:"codex-plan",children:[e("div",{className:"codex-plan-summary",children:[e("span",{children:[d,"/",s.length]}),t!==void 0&&e("span",{className:"codex-plan-active",children:["· ",t.content]})]}),n("div",{className:"codex-plan-entries",children:s.map((a)=>e("div",{className:"codex-plan-entry","data-status":a.status,children:[a.status==="completed"&&n(c,{"aria-hidden":"true"}),a.status==="in_progress"&&n(i,{className:"codex-plan-spinner","aria-hidden":"true"}),a.status==="pending"&&n(o,{"aria-hidden":"true"}),n("span",{children:a.content})]},a.content))})]})}
2
- export{T};
1
+ import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function f({entries:s}){let d=s.filter((a)=>a.status==="completed").length,t=s.find((a)=>a.status==="in_progress");return e("div",{className:"codex-plan",children:[e("div",{className:"codex-plan-summary",children:[e("span",{children:[d,"/",s.length]}),t!==void 0&&e("span",{className:"codex-plan-active",children:["· ",t.content]})]}),n("div",{className:"codex-plan-entries",children:s.map((a)=>e("div",{className:"codex-plan-entry","data-status":a.status,children:[a.status==="completed"&&n(c,{"aria-hidden":"true"}),a.status==="in_progress"&&n(i,{className:"codex-plan-spinner","aria-hidden":"true"}),a.status==="pending"&&n(o,{"aria-hidden":"true"}),n("span",{children:a.content})]},a.content))})]})}
2
+ export{f};
@@ -0,0 +1,2 @@
1
+ var Vn=1e6,qn=5000000;function at(_,e){return _+e>5000000}function Kn(_){return(_/1e6).toFixed(1)}var me=5;
2
+ export{Vn,qn,at,Kn,me};
@@ -0,0 +1,2 @@
1
+ import{Ot}from"./chunk-j2mcvb68.js";import{Ft,Dt,Bt}from"./chunk-2f19pcpn.js";import{zt}from"./chunk-jn2pj92h.js";import{t}from"./chunk-vw2hv2sq.js";import{h}from"./chunk-fvnb8ds4.js";import{textOf as f}from"@alwith/api";import{nativeTurnId as I}from"@nyssance/codex-acp-v2/client";import{useMemo as N}from"react";import{jsx as r,jsxs as v,Fragment as y}from"react/jsx-runtime";function sn(i,n){return{installUnlock:n==="none"?()=>()=>{}:Dt,preload:()=>{if(n!=="none")Ft(i)},playSequence:(a,d,l)=>Bt(a,d,l,i,n)}}function _t(i,n={},a){let d=[];for(let e of i){if(e.user===null)continue;let o="";for(let m of e.final){let p=f(m.content).trim();if(p.length===0)continue;o=p}let u=n[e.user.id],s=e.items.map(I).find((m)=>m!==null);d.push({id:e.user.id,turnKey:e.key,label:h(e.user),response:o,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,...s===void 0?{}:{nativeTurnId:s}})}if(!a?.complete)return d;let l=new Map;for(let e of d){if(e.nativeTurnId===void 0)continue;let o=l.get(e.nativeTurnId)??[];o.push(e),l.set(e.nativeTurnId,o)}let c=new Set(a.turns.map((e)=>e.turnId)),g=new Set(a.loadedTurnIds);return[...a.turns.flatMap((e)=>{let o=l.get(e.turnId);if(o)return o;if(g.has(e.turnId))return[];let u=a.previews[e.turnId];return((u?.messages.length)?u.messages:[{id:"",label:"",response:""}]).map((s,m)=>({id:`history:${e.turnId}:${m===0?"0":s.id}`,messageId:s.id||void 0,turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,isLoaded:!1,previewState:u?.state??"loading",label:s.label,response:s.response,inputTokens:0,outputTokens:0}))}),...d.filter((e)=>e.nativeTurnId===void 0||!c.has(e.nativeTurnId))]}function T({item:i}){let n=t(),a=N(()=>({theme:n.theme,copyLabel:n.t("actions.copy"),openLink:()=>{},preview:!0}),[n]);if(i.previewState==="loading")return v("div",{role:"status",className:"animate-pulse space-y-2 py-1","aria-label":n.t("timeline.navigationLoading"),children:[r("div",{className:"bg-muted h-3 w-3/5 rounded"}),r("div",{className:"bg-muted h-3 rounded"}),r("div",{className:"bg-muted h-3 w-4/5 rounded"})]});return v(y,{children:[r("div",{className:"min-w-0 truncate font-medium",children:i.previewState==="unavailable"?n.t("timeline.navigationUnavailable"):i.label||n.t("timeline.navigationEmpty")}),i.response&&r("div",{className:"text-muted-foreground pointer-events-none mt-1 line-clamp-3 [&_img]:hidden [&_pre]:max-h-20 [&_table]:table-fixed","data-navigation-response":!0,children:r(Ot,{text:i.response,host:a})})]})}function Ht(i){return r(zt,{...i,renderPreview:(n)=>r(T,{item:n})})}
2
+ export{sn,_t,Ht};
@@ -0,0 +1,2 @@
1
+ import{en}from"./chunk-azmqtycn.js";import{createContext as r,useContext as s,useSyncExternalStore as u}from"react";import{jsx as o}from"react/jsx-runtime";var l=r(null),c=r(null);function Me({host:e,client:n,children:i}){return o(en,{host:e,children:o(l,{value:e,children:o(c,{value:n,children:i})})})}function t(){let e=s(l);if(e===null)throw Error("Timeline host is missing");return e}function b(){let e=s(c);if(e===null)throw Error("Timeline client is missing");return e}function Se(e,n){return u((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function g(e){let n=b();return Se(n.store,e)}function V(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
2
+ export{Me,t,b,Se,g,V};
@@ -1,2 +1,2 @@
1
- import{we}from"./chunk-ftka421d.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function W({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(we,{src:c,alt:"",onClose:()=>i(!1)})]})}function bt({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(W,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
- export{W,bt};
1
+ import{Ct}from"./chunk-q7e2bdav.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function xe({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(Ct,{src:c,alt:"",onClose:()=>i(!1)})]})}function kt({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(xe,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
+ export{xe,kt};
@@ -0,0 +1,2 @@
1
+ import{createStore as l}from"@alwith/api/client";var Ee=l({sessionId:null,turns:[],api:null,beforeReveal:null});function tn(e){Ee.setState(e)}function nn(e){if(Ee.getState().sessionId===e)Ee.setState({sessionId:null,turns:[],api:null,beforeReveal:null})}async function tr(e,t,n){let i=Ee.getState();if(n.aborted||e===null||i.sessionId!==e||i.api===null)return;if(i.beforeReveal===null)throw Error("Mounted timeline has no navigation lifecycle");i.beforeReveal(),await i.api.scrollToKey(t,void 0,{align:"top"})}
2
+ export{Ee,tn,nn,tr};
@@ -1,2 +1,2 @@
1
- import{se,Je}from"./chunk-hnt4tt1n.js";function c(t){return{key:t.name,label:t.name,description:t.description??void 0,payload:t.name}}function V(t,s,o=50){let i=new Set,r=t.filter((n)=>{if(i.has(n.name))return!1;return i.add(n.name),!0});if(!s)return r.slice(0,o).map(c);let l=s.toLowerCase(),e=[];for(let n of r){let a=se(n.name,s);if(a)e.push({c:n,score:a.score});else if(n.description?.toLowerCase().includes(l))e.push({c:n,score:-1})}return e.sort((n,a)=>a.score-n.score),e.slice(0,o).map((n)=>c(n.c))}function vt(t,s,o,i=50){let r=o?`${o.replace(/\/$/,"")}/`:"",l=t.map((e)=>({abs:e,rel:r&&e.startsWith(r)?e.slice(r.length):e}));return Je(l,s,(e)=>e.rel,i).map(({item:e})=>({key:e.abs,label:e.rel,payload:e.abs}))}
2
- export{V,vt};
1
+ import{pe,lt}from"./chunk-h6df4xfd.js";function c(t){return{key:t.name,label:t.name,description:t.description??void 0,payload:t.name}}function X(t,s,o=50){let i=new Set,r=t.filter((n)=>{if(i.has(n.name))return!1;return i.add(n.name),!0});if(!s)return r.slice(0,o).map(c);let l=s.toLowerCase(),e=[];for(let n of r){let a=pe(n.name,s);if(a)e.push({c:n,score:a.score});else if(n.description?.toLowerCase().includes(l))e.push({c:n,score:-1})}return e.sort((n,a)=>a.score-n.score),e.slice(0,o).map((n)=>c(n.c))}function In(t,s,o,i=50){let r=o?`${o.replace(/\/$/,"")}/`:"",l=t.map((e)=>({abs:e,rel:r&&e.startsWith(r)?e.slice(r.length):e}));return lt(l,s,(e)=>e.rel,i).map(({item:e})=>({key:e.abs,label:e.rel,payload:e.abs}))}
2
+ export{X,In};
@@ -1,2 +1,2 @@
1
- var t=new Map;var a=0;function ie(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=ie(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function Xe(e,n){return d??=new l,d.connect(e,n)}
2
- export{ie,Xe};
1
+ var t=new Map;var a=0;function Ce(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=Ce(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function qt(e,n){return d??=new l,d.connect(e,n)}
2
+ export{Ce,qt};
@@ -1 +1 @@
1
- import{xe,be}from"../chunk-svmc952q.js";import"../chunk-91nk8n6w.js";import"../chunk-rgy601b7.js";import"../chunk-pqgtv07g.js";import"../chunk-bf5fh35b.js";import"../chunk-p9wpghey.js";import"../chunk-y2xbq7rb.js";export{be as CodexActivityGroup,xe as CodexWorkSection};
1
+ import{Pt,O}from"../chunk-aqj0v5a9.js";import"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-d8gwsw6j.js";import"../chunk-7kcdf82d.js";import"../chunk-v0zn87k5.js";import"../chunk-azmqtycn.js";export{O as CodexActivityGroup,Pt as CodexWorkSection};
@@ -1,2 +1 @@
1
- import{t,u}from"../chunk-pqgtv07g.js";import{d}from"../chunk-y2xbq7rb.js";import{ze}from"../chunk-90rwhxdf.js";import"../chunk-p9wpghey.js";import"../chunk-rgy601b7.js";import"../chunk-91nk8n6w.js";import{T}from"../chunk-bf5fh35b.js";import{xe,be}from"../chunk-svmc952q.js";import{he}from"../chunk-k7s0drzk.js";import"../chunk-ftka421d.js";import{W}from"../chunk-3496tgga.js";import{cn as P}from"cn";import{jsx as n,jsxs as y}from"react/jsx-runtime";var R=new WeakMap,I=1;function N(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;let s=R.get(e);if(s!==void 0)return`${e.type}:${s}`;let i=I++;return R.set(e,i),`${e.type}:${i}`}function E({block:e,streaming:s,actions:i}){if(e.isApiError)return n("div",{className:"codex-stream-error",children:e.text});return y("div",{className:"codex-assistant-message",children:[n(u,{text:e.text,streaming:s}),i]})}function _({block:e,streaming:s,actions:i,renderText:r}){switch(e.type){case"text":return r===void 0?n(E,{block:e,streaming:s,actions:i}):r({block:e,streaming:s,actions:i});case"thinking":return e.thinking.length>0?n(u,{text:e.thinking,streaming:!e.isComplete}):null;case"plan":return n(T,{entries:e.entries});case"image":return n("img",{src:`data:${e.source.media_type};base64,${e.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var S=new Set;function z({message:e,isMostRecentTurn:s,hiddenTools:i=S,time:r,beforeCopy:a,afterCopy:x,providerIcon:B,renderText:M,renderEditedFiles:C}){if(e.streaming===!0&&e.content.every((o)=>o.type==="text"?o.text.length===0:o.type==="thinking"?o.thinking.length===0:!1))return n(A,{});let h=e.content.filter((o)=>o.type==="text").map((o)=>o.text).join(`
2
- `),b=!e.streaming&&h.trim().length>0?n(O,{text:h,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r}):null,l=ze(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),k=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),w=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),v=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(be,{blocks:c},`activity:${N(c[0])}`)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(_,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===w?b:void 0,renderText:M},N(o.block))},g=f===-1?0:k===-1?l.length:k;return n(U,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:B,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?n(he,{blocks:m}):C(m))})}function O({text:e,isMostRecentTurn:s=!1,beforeCopy:i,afterCopy:r,time:a}){let{t:x}=t();return y("div",{className:P("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",s?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[i,n(W,{text:e,label:x("actions.copy")}),r,a&&n("span",{className:"codex-user-time ms-1",title:a.full,children:a.short})]})}function A(){let{t:e}=t();return n("div",{className:"codex-pending-message py-2",role:"status",children:n("span",{className:"codex-activity-running",children:e("message.thinking")})})}function U({work:e,answer:s,footer:i,loading:r=!1,...a}){if(r)return n(A,{});return y("div",{className:"group/am codex-assistant-turn",children:[e.length>0&&n(xe,{...a,children:e}),s!==null&&(e.length===0?s:n("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s})),i]})}export{z as CodexAssistantMessage,U as CodexAssistantTurn,O as CodexMessageActions};
1
+ import{Wn,fe,he}from"../chunk-bfe7xk9m.js";import"../chunk-t5nstx0k.js";import"../chunk-4svwa5p8.js";import"../chunk-w3yddw6n.js";import"../chunk-q7e2bdav.js";import"../chunk-aqj0v5a9.js";import"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-d8gwsw6j.js";import"../chunk-7kcdf82d.js";import"../chunk-v0zn87k5.js";import"../chunk-azmqtycn.js";export{Wn as CodexAssistantMessage,he as CodexAssistantTurn,fe as CodexMessageActions};
@@ -1,3 +1 @@
1
- import{e}from"../chunk-wjejhpgw.js";import{r}from"../chunk-bwzjm3g8.js";import{c,a}from"../chunk-zt7a6b1m.js";import{o}from"../chunk-d0ptk8x8.js";import{useId as h}from"react";import{jsx as l,jsxs as g,Fragment as A}from"react/jsx-runtime";function p(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function D(n){if(!p(n)||!p(n.codex))return[];let s=n.codex,i=s.questions;if(s.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>p(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((d)=>typeof d==="string"))))return[];return i}function S(n,s){return JSON.stringify(["request_user_input_async",n,s])}function C(n){return{selected:n.options?.length?0:null,text:""}}function v(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function B(n){return`<send_user_message_question_reply>
2
- ${JSON.stringify([n])}
3
- </send_user_message_question_reply>`}function G(n){if(!p(n)||!p(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>p(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>p(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:d,answer:m})=>({questionItemId:t,question:d,answer:m}))}function L({question:n,draft:s,status:i,answer:t,error:d,onChange:m,onSubmit:w,onSkip:Q,t:u}){let f=h(),x=i==="pending",k=i==="answered"||i==="skipped";return g("section",{"aria-labelledby":`${f}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[l("h3",{id:`${f}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),k?l("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:u("asyncQuestion.skipped")}):g(A,{children:[(n.options?.length??0)>0&&g(c,{"aria-labelledby":`${f}-title`,disabled:!x,value:s.selected===null?"other":String(s.selected),onValueChange:(y)=>m({...s,selected:y==="other"?null:Number(y)}),children:[n.options?.map((y,b)=>g(r,{className:"flex items-start gap-2 text-sm",children:[l(a,{value:String(b)}),l("span",{className:"whitespace-pre-wrap",children:y})]},b)),g(r,{className:"flex items-center gap-2 text-sm",children:[l(a,{value:"other"}),u("asyncQuestion.other")]})]}),l(o,{"aria-label":u("asyncQuestion.answer"),placeholder:u("asyncQuestion.answer"),value:s.text,readOnly:!x,onChange:(y)=>m({selected:null,text:y.target.value})}),d&&l("p",{role:"alert",className:"text-destructive text-sm",children:d}),g("div",{className:"flex flex-wrap items-center gap-2",children:[l(e,{size:"sm",disabled:!x||v(n,s).trim().length===0,onClick:w,children:u(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),l(e,{size:"sm",variant:"ghost",disabled:!x,onClick:Q,children:u("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&l("span",{role:"status",className:"text-muted-foreground text-xs",children:u(`asyncQuestion.${i}`)})]})]})]})}export{L as AsyncQuestionCard,S as asyncQuestionId,D as asyncQuestions,C as initialQuestionDraft,v as questionAnswer,G as questionReplies,B as questionReplyEnvelope};
1
+ import{a,Ie,Yt,Pe,Zt,Ne,Jt}from"../chunk-5grywgpq.js";import"../chunk-k7zzrns3.js";import"../chunk-hx6wfscz.js";import"../chunk-c4621n0b.js";import"../chunk-801v0awm.js";export{Jt as AsyncQuestionCard,Ie as asyncQuestionId,a as asyncQuestions,Yt as initialQuestionDraft,Pe as questionAnswer,Ne as questionReplies,Zt as questionReplyEnvelope};
@@ -1 +1 @@
1
- import{i}from"../chunk-rgy601b7.js";export{i as useCodexDisclosureState};
1
+ import{d}from"../chunk-trgq8rq1.js";export{d as useCodexDisclosureState};
@@ -1 +1 @@
1
- import{at,he,st}from"../chunk-k7s0drzk.js";import"../chunk-pqgtv07g.js";export{he as CodexEditedFilesCard,st as EditedFilesCard,at as fileChanges};
1
+ import{xn,yt,ve}from"../chunk-4svwa5p8.js";import"../chunk-azmqtycn.js";export{yt as CodexEditedFilesCard,ve as EditedFilesCard,xn as fileChanges};
@@ -1 +1 @@
1
- import{f,ye}from"../chunk-91nk8n6w.js";import"../chunk-rgy601b7.js";import"../chunk-pqgtv07g.js";export{ye as ImageViewActivity,f as isImageView};
1
+ import{M,Nt}from"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-azmqtycn.js";export{Nt as ImageViewActivity,M as isImageView};
@@ -1,6 +1 @@
1
- import{tt}from"../chunk-25na55ve.js";import{ie,Xe}from"../chunk-g20b01rn.js";import{ne}from"../chunk-k1pd257q.js";import{decodeHTMLAttribute as v,decodeHTMLStrict as I}from"entities";import ae from"katex";import{CheckIcon as z,ChevronLeftIcon as se,ChevronRightIcon as ce,CopyIcon as de,DownloadIcon as le,FileIcon as ue,LinkIcon as me,MailIcon as ge,XIcon as fe}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as he,createElement as U,memo as B,startTransition as pe,useContext as ke,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as k,useState as h}from"react";import{jsx as a,jsxs as g,Fragment as re}from"react/jsx-runtime";var G=he(null);function C(){let e=ke(G);if(e===null)throw Error("Markdown host is missing");return e}var we=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,be=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,xe=/\uE200[^\uE201]*$/,Te=4,ve=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 y(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 Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!y(e,t)&&!J(e,t,n))return t;return-1}function Ne(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function Me(e){return Ne(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]==="`"&&!y(e,t))n+=1;t+=1}return n%2===1}function Le(e){return e.endsWith(`
2
- `)?`${e}\`\`\``:`${e}
3
- \`\`\``}function H(e,n){if(!e.includes(n)||Ce(e,n)%2===0)return e;let t=ye(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
4
- `)||V(r))return e;return`${e}${n}`}function Ee(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 Ie(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>Te&&!ve.has(u))return!1}return!0}function $e(e){let{path:n}=Z(e);if(Ee(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Re(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 Ie(t)||$e(t)?e.replace(A,"$1"):`${e})`}function Pe(e){let n=e.replace(xe,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&Me(n))return{isCodeFenceOpen:!0,markdown:Le(n)};if(n.includes("!["))n=n.replace(be,(t,r)=>r);if(n.includes("]("))n=Re(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Se(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Se(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
- `),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 Fe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(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"?Fe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Ae(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function He(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function _e(e){let n=He(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function Oe({href:e}){let n=X(()=>_e(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ge:o?ue:me;return g("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 je({children:e,href:n,title:t}){let r=C();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)=>Ae(o,n,r),children:g("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(Oe,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function We({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=tt(i,d);return o.current=f,()=>{f.dispose(),o.current=null}},[]),p(()=>{let f=o.current;if(f===null)throw Error("Code highlighter is not mounted");f.update(e,n)},[e,n]),c!==null)throw c;let x=s!==null&&s.code===e&&s.language===n?s.html:null;return g("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[g("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:()=>{navigator.clipboard.writeText(e),w(!0),window.setTimeout(()=>w(!1),2000)},children:u?a(z,{}):a(de,{})})})]}),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 qe({code:e,language:n}){return C().preview?a("span",{children:e}):a(Ke,{code:e,language:n})}function Ke({code:e,language:n}){let t=k(null),[r,o]=h(!1);if(p(()=>{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(We,{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 ze(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 Ue({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 g("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),g("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(se,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(le,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(ce,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(fe,{})})]})]})}function Be(e){return C().preview?a(re,{children:e.alt}):a(De,{...e})}function De({src:e,alt:n,title:t,allowWide:r}){let o=k(null),[s,i]=h();p(()=>{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 g(re,{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(ze(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(Ue,{preview:s,setPreview:i})})]})}function Ge({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");ae.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 Je=150,T=null;function j(e,n){let t=T;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,we)}function Ve(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(Ve(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),te(r,`${n}-${o}-${s}`)})}function Ze(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("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 Ye(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 Qe(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:g("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=v(e.href);if(!ne(r))return null;return a(Be,{src:r,alt:I(e.text),title:e.title==null?void 0:v(e.title),allowWide:t},n)}function te(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(I(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=v(t.href);return ne(o)?a(je,{href:o,title:t.title==null?void 0:v(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(qe,{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 Ye(e,n);case"list_item":return Ze(e,n);case"table":return Qe(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(Ge,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function b(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?I(n.text):n.tokens.map(b).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(b).join("");case"list":return e.items.map(b).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(b).join("")).join("")).join("")}default:return""}}function en({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},te(e,n)}finally{T=s}}var nn=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);E(l);let R=new Map,P=0;return l.map((M)=>{let L=ee(M),S=R.get(L)??0;R.set(L,S+1);let F=b(M),oe={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,oe})},[n]),s=o.map((l)=>l.visibleText).join(""),i=k({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,w=performance.now(),x=r&&d?c.runs.filter((l)=>w-l.firstSeenAtMs<Je):[],N=c.generation+(d?0:1),f={text:t,visibleText:s,runs:x.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:N};if(r&&s.length>u)f.runs.push({start:u,end:s.length,firstSeenAtMs:w});return D(()=>{i.current=f}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(en,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),tn=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>ie(n,t)),[i,c]=h(null);if(p(()=>{let d=Xe((u)=>{pe(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),p(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?Pe(n).markdown:n;d.update({source:u,text:n,isStreaming:t})},[t,n]),i!==null)throw i;return o===null?a("div",{"data-markdown-pending":!0}):a(nn,{result:o})});function mn({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=h(e);return p(()=>{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(tn,{text:r?o:e,isStreaming:r})})}export{mn as CodexMarkdownRenderer};
1
+ import{Ot}from"../chunk-j2mcvb68.js";import"../chunk-d675nr2b.js";import"../chunk-bkbemt8g.js";import"../chunk-ypvjzkfb.js";export{Ot as CodexMarkdownRenderer};
@@ -3,11 +3,11 @@ export interface NavigationTokenPair {
3
3
  inputTokens: number;
4
4
  outputTokens: number;
5
5
  }
6
- export declare function preloadThreadUserMessageNavigationInstrument(instrument: NavigationInstrument): void;
7
- export declare function armThreadUserMessageNavigationAudio(): void;
8
- export declare function installThreadUserMessageNavigationAudioUnlock(): () => void;
9
- export declare function playThreadUserMessageNavigationSequence(fromIndex: number, toIndex: number, tokenPairs: NavigationTokenPair[], instrument: NavigationInstrument, mode: NavigationSoundMode): void;
10
- export declare function playThreadUserMessageNavigationNote(itemIndex: number, itemCount: number, inputTokens: number, outputTokens: number, instrument: NavigationInstrument, mode: NavigationSoundMode): void;
6
+ export declare function preloadTimelineUserMessageNavigationInstrument(instrument: NavigationInstrument): void;
7
+ export declare function armTimelineUserMessageNavigationAudio(): void;
8
+ export declare function installTimelineUserMessageNavigationAudioUnlock(): () => void;
9
+ export declare function playTimelineUserMessageNavigationSequence(fromIndex: number, toIndex: number, tokenPairs: NavigationTokenPair[], instrument: NavigationInstrument, mode: NavigationSoundMode): void;
10
+ export declare function playTimelineUserMessageNavigationNote(itemIndex: number, itemCount: number, inputTokens: number, outputTokens: number, instrument: NavigationInstrument, mode: NavigationSoundMode): void;
11
11
  export declare function navigationMidiNote(itemIndex: number, itemCount: number, inputTokens: number, outputTokens: number, mode: NavigationSoundMode): number;
12
12
  export declare function automaticNavigationMidiNote(inputTokens: number, outputTokens: number): number;
13
13
  export declare function pianoKeyMidiNote(itemIndex: number, itemCount: number): number;
@@ -1 +1 @@
1
- import{CacheStorage as M,Soundfont as y}from"smplr";var T=4,b=21,d=88,s=[39,41,43,44,46,48,50],p=0.035,S=0.16,E=88,O=50,w="acoustic_grand_piano",U="MusyngKite",C="FluidR3_GM",f=[0,2,4,5,7,9,11],k=2,D=5,g=globalThis;if(g.__alwithThreadUserMessageNavigationAudio?.version!==T)g.__alwithThreadUserMessageNavigationAudio={version:T,context:null,storage:M("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var i=g.__alwithThreadUserMessageNavigationAudio;function l(){return i.context??=new AudioContext,i.context}function c(){let e=l();if(e.state==="running"){i.nextNoteTime=e.currentTime;return}e.resume().then(()=>{i.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function L(e){let n=l();return y(n,{instrument:e,kit:e===w?U:C,storage:i.storage,volume:O})}function m(e){let n=i.players.get(e);if(n!==void 0)return n;let t=L(e),r={player:t,ready:t.ready};return i.players.set(e,r),r}function z(e){m(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function q(){c()}function G(){if(i.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return i.unlockConsumerCount++,()=>{if(i.unlockConsumerCount--,i.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function H(e,n,t,r,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),A=Array.from({length:u},(V,I)=>{let N=e+a*(I+1),v=t[N];return _(N,t.length,v.inputTokens,v.outputTokens,o)});x(r,A)}function J(e,n,t,r,o,a){if(a==="none")return;x(o,[_(e,n,t,r,a)])}function _(e,n,t,r,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return P(t,r);return h(e,n)}function P(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,r=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(k+r%D+1)+f[o]}function h(e,n){return b+F(e,n)}function X(e,n){return R(h(e,n))}function F(e,n){if(n<=d)return K(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(d-1))}function K(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,r=s.at(-1)+1;while(n.size<e&&(t>=0||r<d)){if(t>=0&&n.size<e)n.add(t--);if(r<d&&n.size<e)n.add(r++)}for(let o=0;n.size<e&&o<d;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function R(e){return 440*2**((e-69)/12)}function x(e,n){let t=l();if(t.state!=="running")return;let{player:r,ready:o}=m(e);o.then(()=>{let a=Math.max(t.currentTime,i.nextNoteTime);for(let u=0;u<n.length;u++)r.start({note:n[u],time:a+u*p,duration:S,velocity:E});i.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function j(){return i.context?.state}function B(e){return m(e).ready}export{q as armThreadUserMessageNavigationAudio,P as automaticNavigationMidiNote,j as getNavigationAudioContextState,B as getNavigationInstrumentReady,G as installThreadUserMessageNavigationAudioUnlock,F as itemPianoKeyIndex,_ as navigationMidiNote,K as navigationPianoKeyIndexes,X as pianoKeyFrequency,h as pianoKeyMidiNote,J as playThreadUserMessageNavigationNote,H as playThreadUserMessageNavigationSequence,z as preloadThreadUserMessageNavigationInstrument};
1
+ import{Ft,Xn,Dt,Bt,Yn,ln,yn,dn,Zn,wn,kn,Jn,er}from"../chunk-2f19pcpn.js";export{Xn as armTimelineUserMessageNavigationAudio,yn as automaticNavigationMidiNote,Jn as getNavigationAudioContextState,er as getNavigationInstrumentReady,Dt as installTimelineUserMessageNavigationAudioUnlock,wn as itemPianoKeyIndex,ln as navigationMidiNote,kn as navigationPianoKeyIndexes,Zn as pianoKeyFrequency,dn as pianoKeyMidiNote,Yn as playTimelineUserMessageNavigationNote,Bt as playTimelineUserMessageNavigationSequence,Ft as preloadTimelineUserMessageNavigationInstrument};
@@ -1 +1 @@
1
- import{ve}from"../chunk-ph7bk34y.js";export{ve as NavigationPreview};
1
+ import{$t}from"../chunk-9dsa5vm7.js";export{$t as NavigationPreview};
@@ -1 +1 @@
1
- import{ve}from"../chunk-ph7bk34y.js";import{useCallback as xe,useEffect as P,useLayoutEffect as ye,useMemo as Q,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as ke,Fragment as Ne}from"react/jsx-runtime";var we=4,me=10;function Se(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((w)=>[w,c.key]))),p=Array(h.length),C;for(let c=h.length-1;c>=0;c--)C=v.get(h[c])??C,p[c]=C;let O=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,w]of h.entries()){let S=v.get(w),m=n.at(-1);if(!m||S!==void 0&&S!==m.key||S===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=S!==void 0&&!B.has(S)?S:O++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(w)}return n}function ge(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function Pe({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:O,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[w,S]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[W,A]=E(null),[X,U]=E(!1),[_,fe]=E(()=>new Set),[pe,be]=E(!0),[Ie,j]=E(null),{installUnlock:Z,preload:ee,playSequence:te}=h,K=I(null),M=I(null),R=I(!1),H=I(null),L=I(0),N=I(null),G=I(new Set),V=Q(()=>p.map((e)=>e.id).join("\x00"),[p]),F=I(p);F.current=p;let ne=I(_),ie=I(w),re=I({itemIdsKey:V,scrollRoot:n});if(re.current.scrollRoot!==n)L.current+=1,re.current={itemIdsKey:V,scrollRoot:n};let g=Q(()=>v===void 0?p.filter((e)=>_.has(e.id)):p,[v,p,_]),se=Q(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),z=I({ids:"",groups:[]}),ae=g.map((e)=>e.id).join("\x00");if(z.current.ids!==ae)z.current={ids:ae,groups:Se(g.map((e)=>e.id),z.current.groups)};P(()=>Z(),[Z]),P(()=>()=>{if(L.current+=1,N.current!==null)clearTimeout(N.current)},[]),P(()=>{y(null),U(!1),A(null),M.current=null,R.current=!1,H.current=null,j(null),G.current.clear()},[n]),P(()=>{ee()},[ee]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(F.current.map((o)=>o.id)),r=()=>{let o=new Set(t.values()),d=F.current.filter((f)=>o.has(f.id)).map((f)=>f.id),u=d.findIndex((f)=>e.has(f));if(u===-1)return;let b=u;for(let f=u+1;f<d.length;f++)if(e.has(d[f]))b=f;let k=new Set(d.slice(u,b+1));if(ge(ie.current,k))return;ie.current=k,S(k)},s=new IntersectionObserver((o)=>{for(let d of o){let u=t.get(d.target);if(d.isIntersecting)e.add(u);else e.delete(u)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),a=()=>{let o=new Set,d=new Set;for(let u of n.querySelectorAll("[data-content-search-unit-key]")){let b=u.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||o.has(b))continue;o.add(b);let k=u.closest("[data-turn-key]"),f=k===null||d.has(k)?u:k;if(d.add(f),t.has(f))continue;t.set(f,b),s.observe(f)}for(let u of t.keys()){if(d.has(u))continue;s.unobserve(u),e.delete(t.get(u)),t.delete(u)}if(r(),ge(ne.current,o))return;ne.current=o,fe(o)};a();let l=new MutationObserver((o)=>{if(o.some((u)=>[...u.addedNodes,...u.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))a()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),s.disconnect()}},[V,n,c]);let J=g.find((e)=>w.has(e.id))?.id??g.at(-1)?.id;ye(()=>{let e=K.current;if(e===null||M.current!==null||J===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(J)}"]`);if(t===null)return;let i=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(r.top<i.top)e.scrollTop+=r.top-i.top;else if(r.bottom>i.bottom)e.scrollTop+=r.bottom-i.bottom+1},[J,V]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),s=e.getBoundingClientRect();if(r.width===0||s.width===0)return;let a=n.offsetWidth>0?r.width/n.offsetWidth:1;be((s.left-r.left)/a>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let he=xe(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let i=L.current+1;L.current=i,x();let r=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),s=r(),a=s!==null&&n.clientHeight>0&&s.closest("[data-turn-key]")!==null&&Math.abs(s.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((s===null||a)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;s=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(s===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({behavior:l?"instant":t,block:"start"}),s.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]")?.animate?.([{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)"},{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)",offset:0.35},{backgroundColor:"transparent"}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})},[x,v,n]);if(g.length<we||!pe)return null;let Y=()=>{if(N.current!==null)clearTimeout(N.current);N.current=null},oe=(e,t=!1)=>{if(Y(),C===void 0||e.isLoaded!==!1||G.current.has(e.turnKey))return;let i=()=>{N.current=null,G.current.add(e.turnKey),C(e).catch(()=>G.current.delete(e.turnKey))};if(t)i();else N.current=setTimeout(i,150)},q=m===null?null:g.find((e)=>e.id===m.item.id)??g.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===m.item.nativeTurnId)??m.item,ue=(e,t="smooth")=>{he(e,t).catch((i)=>{if(B)B(i);else throw i})},le=g.findIndex((e)=>e.id===(W??Ie)),de=K.current,Te=m===null||!de?.contains(m.button)?0:Me(de,m.button),ce=(e)=>{let t=e?.closest("[data-timeline-user-message-navigation-item-id]"),i=K.current;if(t===void 0||t===null||!i.contains(t))return null;let r=t.dataset.timelineUserMessageNavigationItemId,s=g.findIndex((a)=>a.id===r);return{button:t,item:g[s],index:s}},D=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,A(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return T("nav",{"aria-label":"User messages",className:"timeline-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:T(ve,{open:X,onOpenChange:U,side:"inline-end",sideOffset:0,align:"center",alignOffset:Te,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":W===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Y();let t=ce(e.target instanceof Element?e.target:null);if(t===null)return;R.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),A(t.item.id),y(t),U(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=ce(e.target instanceof Element?e.target:null);if(l!==null){j(l.item.id);let o=H.current;if(o!==null&&o!==l.index)te(o,l.index,se);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),oe(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){D(e);return}let i=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(g.length-1,Math.floor((e.clientY-i.top+e.currentTarget.scrollTop)/me))),a={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(a.item.id===t.itemId)return;te(t.itemIndex,a.index,se),H.current=a.index,M.current={...t,itemId:a.item.id,itemIndex:a.index},R.current=!0,A(a.item.id),y(a),ue(a.item,"instant")},onPointerUp:D,onPointerCancel:D,onLostPointerCapture:D,onPointerLeave:()=>{if(Y(),j(null),H.current=null,M.current===null&&!X)y(null)},children:T("div",{className:"flex flex-col",children:z.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*me},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,s=Math.abs(r-le),a=le===-1||s>3?void 0:[1,0.7,0.4,0.2][s];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":W===t.id?"":void 0,"aria-current":w.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(R.current){R.current=!1;return}let o={button:l.currentTarget,item:t,index:r};y(o),U(!0),ue(t)},onFocus:(l)=>{oe(t,!0),y({button:l.currentTarget,item:t,index:r}),U(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:a===void 0?void 0:{"--marker-progress":a}})})},t.id)})},e.key))})}),children:q!==null&&T("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:O?O(q):ke(Ne,{children:[T("div",{className:"min-w-0 truncate font-medium",children:q.label}),q.response.length>0&&T("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response})]})})})})}function Me(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}export{Pe as TimelineUserMessageNavigationRail};
1
+ import{zt}from"../chunk-jn2pj92h.js";import"../chunk-9dsa5vm7.js";export{zt as TimelineUserMessageNavigationRail};
@@ -1 +1 @@
1
- import{T}from"../chunk-bf5fh35b.js";export{T as CodexPlan};
1
+ import{f}from"../chunk-v0zn87k5.js";export{f as CodexPlan};
@@ -1501,3 +1501,179 @@
1501
1501
  .codex-image-chevron-open {
1502
1502
  transform: rotate(90deg);
1503
1503
  }
1504
+
1505
+ /* Session timeline (session-timeline entry). */
1506
+ .codex-timeline-content {
1507
+ padding-inline: var(--codex-timeline-inline-padding, 20px);
1508
+ }
1509
+
1510
+ .codex-turn-errors {
1511
+ display: flex;
1512
+ flex-direction: column;
1513
+ gap: 16px;
1514
+ margin-block: 16px;
1515
+ }
1516
+
1517
+ /* Keep the fade in viewport coordinates so compositor scrolling cannot outrun it. */
1518
+ .codex-timeline-bottom-fade {
1519
+ position: absolute;
1520
+ inset-inline: 0 calc(var(--app-scrollbar-size, 0px) + var(--app-scrollbar-edge-gap, 0px));
1521
+ bottom: 0;
1522
+ height: 24px;
1523
+ pointer-events: none;
1524
+ background: linear-gradient(to bottom, transparent, var(--background));
1525
+ }
1526
+
1527
+ /* Scrollers inside a turn show their bar on hover only; the viewport has its own. */
1528
+ .codex-assistant-turn
1529
+ :is(
1530
+ .codex-markdown-table-scroller,
1531
+ .codex-markdown-code-placeholder,
1532
+ .codex-markdown-code-container,
1533
+ .codex-markdown-math-block,
1534
+ .codex-activity-group-body,
1535
+ .codex-activity-details,
1536
+ .codex-command-output,
1537
+ .codex-reasoning-details
1538
+ ) {
1539
+ &::-webkit-scrollbar {
1540
+ width: 0;
1541
+ height: 0;
1542
+ }
1543
+
1544
+ &:hover::-webkit-scrollbar {
1545
+ width: var(--codex-hover-scrollbar-size, 6px);
1546
+ height: var(--codex-hover-scrollbar-size, 6px);
1547
+ }
1548
+
1549
+ &::-webkit-scrollbar-track {
1550
+ background: transparent;
1551
+ }
1552
+
1553
+ &::-webkit-scrollbar-thumb {
1554
+ border-radius: 999px;
1555
+ background-color: color-mix(in oklab, var(--foreground) 18%, transparent);
1556
+ }
1557
+ }
1558
+
1559
+ .codex-edited-file-path {
1560
+ display: inline-flex;
1561
+ align-items: center;
1562
+ gap: 6px;
1563
+ min-width: 0;
1564
+ }
1565
+
1566
+ .codex-edited-file-icon {
1567
+ flex: 0 0 auto;
1568
+ }
1569
+
1570
+ .codex-edited-file-name {
1571
+ min-width: 0;
1572
+ overflow: hidden;
1573
+ text-overflow: ellipsis;
1574
+ white-space: nowrap;
1575
+ }
1576
+
1577
+ .codex-user-image {
1578
+ padding: 0;
1579
+ border: 0;
1580
+ }
1581
+
1582
+ /* Image generation: a placeholder while the tool runs, then the result as a preview card. */
1583
+ .codex-image-generation {
1584
+ position: relative;
1585
+ width: min(20rem, 100%);
1586
+ aspect-ratio: 1;
1587
+ overflow: hidden;
1588
+ border-radius: 1.75rem;
1589
+ background: var(--muted);
1590
+ }
1591
+
1592
+ .codex-image-generation-texture {
1593
+ position: absolute;
1594
+ inset: 0;
1595
+ background-image: radial-gradient(
1596
+ circle,
1597
+ color-mix(in srgb, var(--muted-foreground) 25%, transparent) 1px,
1598
+ transparent 1px
1599
+ );
1600
+ background-size: 12px 12px;
1601
+ mask-image: radial-gradient(ellipse at 35% 20%, black, transparent 75%);
1602
+ }
1603
+
1604
+ .codex-image-generation[aria-busy="true"] .codex-image-generation-texture {
1605
+ animation: codex-image-breathe 2.5s ease-in-out infinite alternate;
1606
+ }
1607
+
1608
+ .codex-image-generation-status {
1609
+ position: absolute;
1610
+ inset-inline-end: 1rem;
1611
+ bottom: 1rem;
1612
+ display: flex;
1613
+ align-items: center;
1614
+ gap: 0.5rem;
1615
+ padding: 0.65rem 1rem;
1616
+ border: 1px solid var(--border);
1617
+ border-radius: 999px;
1618
+ background: var(--background);
1619
+ color: var(--foreground);
1620
+ font-size: 0.875rem;
1621
+ font-weight: 500;
1622
+ box-shadow: 0 2px 5px color-mix(in srgb, var(--foreground) 6%, transparent);
1623
+ }
1624
+
1625
+ .codex-generated-image {
1626
+ position: relative;
1627
+ width: fit-content;
1628
+ max-width: min(40rem, 100%);
1629
+ overflow: hidden;
1630
+ border-radius: 1.5rem;
1631
+ }
1632
+
1633
+ .codex-generated-image-preview {
1634
+ display: block;
1635
+ overflow: hidden;
1636
+ border-radius: inherit;
1637
+ cursor: zoom-in;
1638
+ }
1639
+
1640
+ .codex-generated-image-download {
1641
+ position: absolute;
1642
+ inset-inline-start: 0.75rem;
1643
+ bottom: 0.75rem;
1644
+ border-radius: 999px;
1645
+ background: var(--background);
1646
+ color: var(--foreground);
1647
+ border: 1px solid var(--border);
1648
+ box-shadow: 0 2px 6px color-mix(in srgb, var(--foreground) 10%, transparent);
1649
+ }
1650
+
1651
+ @media (hover: hover) and (pointer: fine) {
1652
+ .codex-generated-image-download {
1653
+ opacity: 0;
1654
+ transition: opacity 150ms ease;
1655
+ }
1656
+ .codex-generated-image:hover .codex-generated-image-download,
1657
+ .codex-generated-image:focus-within .codex-generated-image-download,
1658
+ .codex-generated-image-download:disabled {
1659
+ opacity: 1;
1660
+ }
1661
+ }
1662
+
1663
+ @keyframes codex-image-breathe {
1664
+ from {
1665
+ opacity: 0.35;
1666
+ }
1667
+ to {
1668
+ opacity: 1;
1669
+ }
1670
+ }
1671
+
1672
+ @media (prefers-reduced-motion: reduce) {
1673
+ .codex-image-generation[aria-busy="true"] .codex-image-generation-texture {
1674
+ animation: none;
1675
+ }
1676
+ .codex-generated-image-download {
1677
+ transition: none;
1678
+ }
1679
+ }
@@ -1 +1 @@
1
- import{xt,me,g,K,pe,ge,fe}from"../chunk-yvj5y06y.js";export{xt as CODEX_UNKNOWN_TURN_HEIGHT,g as calculateCodexThreadVirtualRange,ge as calculateCodexTurnCenterDistanceFromBottom,fe as calculateCodexTurnTargetDistanceFromBottom,me as createCodexThreadVirtualLayout,pe as preserveCodexThreadDistanceFromBottom,K as preserveCodexThreadRenderedWindow};
1
+ import{Gn,ut,N,ge,mt,pt,gt}from"../chunk-nxarfyj2.js";export{Gn as CODEX_UNKNOWN_TURN_HEIGHT,N as calculateCodexThreadVirtualRange,pt as calculateCodexTurnCenterDistanceFromBottom,gt as calculateCodexTurnTargetDistanceFromBottom,ut as createCodexThreadVirtualLayout,mt as preserveCodexThreadDistanceFromBottom,ge as preserveCodexThreadRenderedWindow};
@@ -1 +1 @@
1
- import{W,bt}from"../chunk-3496tgga.js";import"../chunk-ftka421d.js";export{bt as CodexUserMessage,W as CopyAction};
1
+ import{xe,kt}from"../chunk-w3yddw6n.js";import"../chunk-q7e2bdav.js";export{kt as CodexUserMessage,xe as CopyAction};
@@ -1 +1 @@
1
- import{me,g,K,pe,ge,fe}from"../chunk-yvj5y06y.js";import{forwardRef as be,useCallback as L,useEffect as ye,useImperativeHandle as Pe,useLayoutEffect as M,useMemo as ie,useRef as s,useState as N}from"react";import{jsx as H,jsxs as oe}from"react/jsx-runtime";var Be=12,J=2,W=800,ve=new Map;function Ke({turnKey:_,heightPx:y,placeholder:U=!1,deferUntilReady:n=!1,observe:T,onReady:C,children:k}){let m=s(null),[b,G]=N(!1),X=L((f)=>{m.current=f,T(_,f)},[T,_]);return M(()=>{let f=m.current;if(f===null)throw Error("Codex turn element is missing");let P=()=>{C(f),G(!0)};if(f.querySelector("[data-markdown-pending]")===null){P();return}let d=new MutationObserver(()=>{if(f.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),P()});return d.observe(f,{childList:!0,subtree:!0}),()=>d.disconnect()},[C]),oe("div",{style:b?void 0:{position:"relative",height:y,overflow:"hidden"},children:[H("div",{ref:X,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":_,"aria-busy":!b||void 0,style:!b&&!U&&n?{visibility:"hidden"}:void 0,"data-turn-ready":b?"":void 0,children:k}),!b&&!U&&n&&H("div",{"aria-hidden":"true",className:"codex-turn-loading",children:oe("div",{className:"codex-turn-loading-lines",children:[H("span",{}),H("span",{}),H("span",{})]})})]})}var Ce=be(function({entries:y,renderTurn:U,scrollElement:n,sessionKey:T,leadingContent:C,leadingInsetPx:k=0,preserveViewport:m=!1},b){let G=s(null),[X,f]=N(k),P=C!==void 0&&C!==null;M(()=>{let e=G.current;if(e===null)return;let t=()=>f(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[P]);let d=ie(()=>ve.get(T),[T]),[Q,Y]=N(()=>d?.turnHeightsByKey??{}),i=ie(()=>me({entries:y,gapPx:Be,measuredHeightsByKey:Q,leadingInsetPx:P?X:k}),[y,Q,P,X,k]),Re=ie(()=>{let e=g({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:J,viewportHeightPx:W}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return K({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[I,ue]=N(Re),[v,ae]=N(W),[c,se]=N(null),S=s(d?.distanceFromBottomPx??0),E=s(I),ce=s(i.turnKeys),l=s(Q),D=s(i),de=s(i),B=s(new Map),p=s(null),F=s(null),O=s(null),A=s(new Map),Z=s(!1),le=s(()=>{}),V=s(null),he=L(()=>{if(!m||n===null||p.current!==null||V.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...B.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),h=D.current.turnIndexByKey.get(r),w=h===void 0?a.height:D.current.heightsPx[h];return{key:r,element:u,rect:a,bottom:a.top+w}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)V.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[m,n]),ee=s(he);ee.current=he;let R=L((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=g({distanceFromBottomPx:o,layout:i,overscanCount:J,viewportHeightPx:t}),u=E.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(S.current=o,E.current=a,ce.current=i.turnKeys,ae(t),a!==u)ue(a)},[i]),q=L((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),He=L((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;ee.current();let r={...l.current,[t]:o};l.current=r,Y(r)},[]),te=L(()=>{if(F.current!==null)return F.current;return F.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);A.current.set(r,u)}if(O.current!==null||A.current.size===0)return;O.current=requestAnimationFrame(()=>{O.current=null;let t=[...A.current].filter(([r,u])=>l.current[r]!==u);if(A.current.clear(),t.length===0)return;ee.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,Y(o)})}),F.current},[]),Te=L((e,t)=>{let o=B.current.get(e);if(o!==void 0)te().unobserve(o),B.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);B.current.set(e,t),te().observe(t)},[te]);ye(()=>()=>{if(F.current?.disconnect(),O.current!==null)cancelAnimationFrame(O.current);A.current.clear(),F.current=null,B.current.clear()},[]),M(()=>{le.current=()=>{if(n===null)return;let e=q(n);if(p.current!==null){S.current=e,ae(n.clientHeight||W);return}R(e,n.clientHeight||W)}},[q,n,R]),M(()=>{if(n===null)return;if(!Z.current){Z.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?D.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>le.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),M(()=>{if(n===null||c===null)return;let e=B.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let h={...l.current,[c.turnKey]:t};l.current=h,Y(h);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=fe({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),R(a,n.clientHeight||W),queueMicrotask(()=>{if(p.current!==c)return;c.complete(),p.current=null,se(null)})},[i,c,n,R]),M(()=>{let e=de.current;if(de.current=i,D.current=i,n===null||c!==null){V.current=null;return}let t=V.current;V.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:B.current.get(t.key);if(m&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,R(q(n),n.clientHeight);return}let r=S.current;if(m&&e!==i&&Z.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||m)&&e!==i){let u=q(n);if(u<=96&&!m){R(u,v);return}let a=g({distanceFromBottomPx:r,layout:e,overscanCount:0,viewportHeightPx:v}),h=e.turnKeys.slice(a.startIndex,a.endIndex).filter((x)=>i.turnIndexByKey.has(x)),w=h.find((x)=>l.current[x]!==void 0)??h[0];if(w!==void 0){let x=pe({anchorKey:w,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(x===null)throw Error(`Codex viewport anchor is missing: ${w}`);r=x,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}R(r,v)},[i,c,q,n,R,v,m]),M(()=>{E.current=I},[I]),ye(()=>()=>{p.current?.complete(),p.current=null;let e=E.current,o=D.current.turnKeys[e.startIndex];ve.set(T,{distanceFromBottomPx:S.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[T]),Pe(b,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){p.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=ge({layout:i,turnKey:e,viewportHeightPx:v});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let h=g({distanceFromBottomPx:a,layout:i,overscanCount:J,viewportHeightPx:v});return E.current=h,ue(h),new Promise((w)=>{let x={align:o.align,complete:w,getTargetElement:t,turnKey:u};p.current=x,se(x)})}}),[i,v]);let z=I,j=ce.current;if(!(j===i.turnKeys||j.length===i.turnKeys.length&&j.every((e,t)=>e===i.turnKeys[t]))){let e=j[I.startIndex];z=(e===void 0?null:K({anchorKey:e,layout:i,previousRange:I}))??g({distanceFromBottomPx:S.current,layout:i,overscanCount:J,viewportHeightPx:v})}let ne=y.length-1,xe=y[ne],re=y.slice(z.startIndex,Math.min(z.endIndex,ne)).map((e,t)=>({entry:e,index:z.startIndex+t}));if(xe!==void 0)re.push({entry:xe,index:ne});return oe("div",{"data-codex-timeline":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${z.startIndex}:${z.endIndex}`,"data-codex-virtualized-total-count":y.length,"data-codex-virtualized-turn-count":re.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[P&&H("div",{ref:G,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:C}),re.map(({entry:e,index:t})=>H("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:H(Ke,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:Te,onReady:He,children:U(e,t)})},e.turnKey))]})});export{Ce as VirtualizedTurnList};
1
+ import{ct}from"../chunk-jsb0zged.js";import"../chunk-nxarfyj2.js";export{ct as VirtualizedTurnList};
@@ -1 +1 @@
1
- import{V,vt}from"../chunk-arge74eh.js";import"../chunk-hnt4tt1n.js";export{vt as filterFiles,V as filterSlashCommands};
1
+ import{X,In}from"../chunk-xjen1yt6.js";import"../chunk-h6df4xfd.js";export{In as filterFiles,X as filterSlashCommands};
@@ -1,3 +1,3 @@
1
- import{e}from"../chunk-wjejhpgw.js";import{P}from"../chunk-66headm4.js";import"../chunk-hnt4tt1n.js";import{V}from"../chunk-arge74eh.js";import{ce}from"../chunk-1cy1j8gj.js";import{ue}from"../chunk-mbrd76nh.js";import{autoUpdate as st}from"@floating-ui/dom";import{cn as Y}from"cn";import{BookOpenTextIcon as it,FileIcon as lt,StoreIcon as ut}from"lucide-react";import{useCallback as at,useEffect as v,useLayoutEffect as Z,useMemo as _,useRef as R,useState as g}from"react";import{createPortal as ct}from"react-dom";import{jsx as p,jsxs as E,Fragment as mt}from"react/jsx-runtime";function Et({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:F,onSearchError:A,fileSearchDebounceMs:M=0,bashMode:j=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:O,fileStatusLabels:h,morePlugins:D}){let z=ue(),l=z.textInput.value,[K,U]=g(0),[y,q]=g(null),[b,L]=g(0),W=R(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>U(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let Q=_(()=>j&&l.startsWith("!")?null:ce(l,K),[l,K,j]),r=Q?.kind==="at"&&!u?null:Q,N=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[tt,et]=g(N);if(tt!==N)et(N),L(0);let I=R(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){q(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)q({query:x,search:u,items:s})},(s)=>{if(t)q({query:x,search:u,items:[]}),A(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,A]);let d=_(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return V(C,r.query);if(i)return V(C,"");return[]},[r,i,C,y,u]),[nt,S]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>S(!0),o=()=>{if(S(!1),i)f?.(!1)};return S(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=nt&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;W.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function G(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let H=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+H+l.slice(r.end),r.kind==="at")F?.(t.payload);s=r.start+H.length}else if(i)o=`${l.length===0||l.endsWith(`
1
+ import{e}from"../chunk-801v0awm.js";import{B}from"../chunk-h38yw8y3.js";import"../chunk-h6df4xfd.js";import{X}from"../chunk-xjen1yt6.js";import{Re}from"../chunk-6vky4fcv.js";import{_e}from"../chunk-t3vgbc9s.js";import{autoUpdate as st}from"@floating-ui/dom";import{cn as Y}from"cn";import{BookOpenTextIcon as it,FileIcon as lt,StoreIcon as ut}from"lucide-react";import{useCallback as at,useEffect as v,useLayoutEffect as Z,useMemo as _,useRef as R,useState as g}from"react";import{createPortal as ct}from"react-dom";import{jsx as p,jsxs as E,Fragment as mt}from"react/jsx-runtime";function Et({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:F,onSearchError:A,fileSearchDebounceMs:M=0,bashMode:j=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:O,fileStatusLabels:h,morePlugins:D}){let z=_e(),l=z.textInput.value,[K,U]=g(0),[y,P]=g(null),[b,L]=g(0),V=R(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>U(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=_(()=>j&&l.startsWith("!")?null:Re(l,K),[l,K,j]),r=W?.kind==="at"&&!u?null:W,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[tt,et]=g(q);if(tt!==q)et(q),L(0);let I=R(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),A(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,A]);let d=_(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return X(C,r.query);if(i)return X(C,"");return[]},[r,i,C,y,u]),[nt,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=nt&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;V.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function Q(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let H=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+H+l.slice(r.end),r.kind==="at")F?.(t.payload);s=r.start+H.length}else if(i)o=`${l.length===0||l.endsWith(`
2
2
  `)?l:`${l}
3
- `}/${t.payload} `,s=o.length,f?.(!1);else return;z.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)G(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)U(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,J]=g(null),[B,ot]=g(null),T=at(()=>{let t=c?.current;if(!t)return;let n=t.getBoundingClientRect();J({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[c]);if(Z(()=>{if(!m){J(null);return}T()},[m,T]),Z(()=>{let t=c?.current;if(!m||!t||!B)return;return st(t,B,T,{animationFrame:!0})},[m,B,c,T]),!m||c&&!k)return null;let w=r?r.kind==="slash":i,rt=w?it:lt,X=p("div",{ref:ot,className:c?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:c&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:E("div",{ref:W,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[E("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&p("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:O}),d.length===0&&!w&&h&&p("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===u?h.empty:h.loading}),d.map((t,n)=>E(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),G(t)},onMouseEnter:()=>L(n),className:Y("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[p(rt,{className:Y("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")}),p("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&p("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),w&&D&&E(mt,{children:[p(P,{}),E(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),D.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[p(ut,{"data-icon":"inline-start"}),D.label]})]})]})});return c?ct(X,document.body):X}export{Et as CompletionMenu};
3
+ `}/${t.payload} `,s=o.length,f?.(!1);else return;z.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)Q(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)U(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,ot]=g(null),T=at(()=>{let t=c?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[c]);if(Z(()=>{if(!m){G(null);return}T()},[m,T]),Z(()=>{let t=c?.current;if(!m||!t||!S)return;return st(t,S,T,{animationFrame:!0})},[m,S,c,T]),!m||c&&!k)return null;let w=r?r.kind==="slash":i,rt=w?it:lt,J=p("div",{ref:ot,className:c?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:c&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:E("div",{ref:V,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[E("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&p("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:O}),d.length===0&&!w&&h&&p("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===u?h.empty:h.loading}),d.map((t,n)=>E(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),Q(t)},onMouseEnter:()=>L(n),className:Y("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[p(rt,{className:Y("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")}),p("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&p("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),w&&D&&E(mt,{children:[p(B,{}),E(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),D.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[p(ut,{"data-icon":"inline-start"}),D.label]})]})]})});return c?ct(J,document.body):J}export{Et as CompletionMenu};
@@ -1 +1 @@
1
- import{ce}from"../chunk-1cy1j8gj.js";export{ce as detectTrigger};
1
+ import{Re}from"../chunk-6vky4fcv.js";export{Re as detectTrigger};
@@ -1 +1 @@
1
- import{O}from"../chunk-e9zndx26.js";export{O as EffortSlider};
1
+ import{Y}from"../chunk-phe3an96.js";export{Y as EffortSlider};
@@ -1 +1 @@
1
- import{n}from"../chunk-1yy2jsnh.js";import"../chunk-kaeqvcew.js";export{n as MenuRadioSelect};
1
+ import{r}from"../chunk-42zr8zpv.js";import"../chunk-2epnn4sq.js";export{r as MenuRadioSelect};