@alwith/module-chat 0.5.8 → 0.5.10

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 (305) hide show
  1. package/dist/activity-host.js +1 -1
  2. package/dist/approval/choice-elicitation-form.js +1 -1
  3. package/dist/approval/choice-schema.js +1 -1
  4. package/dist/approval/permission-options.js +1 -1
  5. package/dist/approval/permission-view.js +1 -1
  6. package/dist/approval/schema-elicitation-form.js +1 -1
  7. package/dist/approval/url-elicitation-card.js +1 -1
  8. package/dist/{chunk-zk3j2f24.js → chunk-0fr24sxr.js} +3 -3
  9. package/dist/{chunk-zsxt5bbk.js → chunk-0sdhavk8.js} +2 -2
  10. package/dist/{chunk-9r0g5jc9.js → chunk-115a3p9z.js} +2 -2
  11. package/dist/{chunk-syffw61b.js → chunk-12swy4za.js} +4 -4
  12. package/dist/{chunk-tdwk5dct.js → chunk-13y1xqbb.js} +2 -2
  13. package/dist/chunk-1jzxmw98.js +2 -0
  14. package/dist/{chunk-0mm2wh23.js → chunk-1k1e55de.js} +1 -1
  15. package/dist/chunk-1wxebrbt.js +2 -0
  16. package/dist/chunk-1xg1qw4g.js +4 -0
  17. package/dist/{chunk-377s443r.js → chunk-2879v3ps.js} +2 -2
  18. package/dist/{chunk-zz734bzf.js → chunk-2pj3pcc7.js} +2 -2
  19. package/dist/{chunk-5n1xv5w0.js → chunk-2ymhbrf9.js} +3 -3
  20. package/dist/{chunk-0pz9ryqh.js → chunk-34a7aha4.js} +2 -2
  21. package/dist/chunk-3g8ck68k.js +2 -0
  22. package/dist/chunk-3wg25354.js +2 -0
  23. package/dist/chunk-3xnbypjz.js +2 -0
  24. package/dist/{chunk-ryz4c13z.js → chunk-46gb51y9.js} +2 -2
  25. package/dist/chunk-4ecdn9z1.js +2 -0
  26. package/dist/{chunk-401q6mpb.js → chunk-4t6bd8j7.js} +2 -2
  27. package/dist/{chunk-jn0q0b7k.js → chunk-5c4z345j.js} +2 -2
  28. package/dist/{chunk-ksv9pjc2.js → chunk-5d94195x.js} +1 -1
  29. package/dist/{chunk-rky16ygr.js → chunk-5f4m4ptz.js} +3 -3
  30. package/dist/{chunk-88xay4pa.js → chunk-5nqhvv28.js} +2 -2
  31. package/dist/chunk-60ks28ef.js +2 -0
  32. package/dist/chunk-62x983rq.js +2 -0
  33. package/dist/{chunk-xxkdv1zf.js → chunk-64hrczd9.js} +1 -1
  34. package/dist/chunk-6f2h379x.js +2 -0
  35. package/dist/{chunk-cg97byvk.js → chunk-6kn920c5.js} +1 -1
  36. package/dist/chunk-6xp64b2e.js +2 -0
  37. package/dist/{chunk-gzff19t3.js → chunk-6z9r27t2.js} +2 -2
  38. package/dist/{chunk-p2prcbq9.js → chunk-76xfekar.js} +2 -2
  39. package/dist/chunk-78x93ef2.js +2 -0
  40. package/dist/{chunk-gjkrfb1m.js → chunk-7awdgc0t.js} +2 -2
  41. package/dist/chunk-7e1m1d9x.js +2 -0
  42. package/dist/{chunk-qfk24bq6.js → chunk-7q07tm0w.js} +1 -1
  43. package/dist/{chunk-sr5rcdza.js → chunk-83dkw1mh.js} +2 -2
  44. package/dist/chunk-8dtaq4eh.js +2 -0
  45. package/dist/{chunk-gd9s35b8.js → chunk-8tn17nw7.js} +2 -2
  46. package/dist/{chunk-znx2e9e7.js → chunk-90c0tynf.js} +2 -2
  47. package/dist/{chunk-m8sp44qa.js → chunk-94r5frad.js} +2 -2
  48. package/dist/{chunk-0n240acr.js → chunk-951wn2bd.js} +2 -2
  49. package/dist/{chunk-1drkvxzk.js → chunk-9bjywaze.js} +1 -1
  50. package/dist/{chunk-q256c3hn.js → chunk-9cbpmdqf.js} +2 -2
  51. package/dist/{chunk-1dw0dx23.js → chunk-9h86hvc3.js} +2 -2
  52. package/dist/chunk-9tgtskz4.js +2 -0
  53. package/dist/{chunk-3arz4kfx.js → chunk-9w0w5by0.js} +2 -2
  54. package/dist/chunk-a7nqzhxj.js +2 -0
  55. package/dist/chunk-aafg3jqm.js +3 -0
  56. package/dist/{chunk-6r5s4bjp.js → chunk-akcs13sj.js} +2 -2
  57. package/dist/{chunk-9evhky1b.js → chunk-anshr0mw.js} +1 -1
  58. package/dist/{chunk-xb1wvyky.js → chunk-b616t3fp.js} +2 -2
  59. package/dist/{chunk-tv89wh8b.js → chunk-b81yxz7f.js} +2 -2
  60. package/dist/chunk-b8ywzj88.js +2 -0
  61. package/dist/chunk-b9ew8dwr.js +2 -0
  62. package/dist/{chunk-wdyyy8c1.js → chunk-bhrnw36x.js} +2 -2
  63. package/dist/{chunk-6ss1981q.js → chunk-bm4s6n8a.js} +2 -2
  64. package/dist/{chunk-tjgq4882.js → chunk-bq05e911.js} +2 -2
  65. package/dist/{chunk-svt0t387.js → chunk-btjqewxj.js} +2 -2
  66. package/dist/chunk-cc6vp2sg.js +2 -0
  67. package/dist/{chunk-n8yj6reh.js → chunk-ct5wk01a.js} +3 -3
  68. package/dist/{chunk-gc9g67j5.js → chunk-d8rf7rff.js} +2 -2
  69. package/dist/{chunk-6edz9f7j.js → chunk-dnhmnmgf.js} +2 -2
  70. package/dist/{chunk-30wqrz8v.js → chunk-dzx4rypz.js} +2 -2
  71. package/dist/{chunk-qq9p31a7.js → chunk-eg1d1gbc.js} +2 -2
  72. package/dist/{chunk-jtaph5am.js → chunk-erzjz56d.js} +1 -1
  73. package/dist/{chunk-ty6yjhwk.js → chunk-et0rpfh9.js} +1 -1
  74. package/dist/{chunk-bbwb4555.js → chunk-f4e289mj.js} +2 -2
  75. package/dist/chunk-fb6vxbmc.js +2 -0
  76. package/dist/chunk-fcyzhbmn.js +2 -0
  77. package/dist/{chunk-w8qmh6he.js → chunk-fjwg3y8h.js} +2 -2
  78. package/dist/chunk-fw3emcqw.js +2 -0
  79. package/dist/{chunk-s9sf8hqk.js → chunk-gajhc4bp.js} +2 -2
  80. package/dist/{chunk-qgm2pqvw.js → chunk-gc1m6aw5.js} +2 -2
  81. package/dist/{chunk-ab3thrqy.js → chunk-gq30yqjk.js} +2 -2
  82. package/dist/{chunk-f7kngj14.js → chunk-grncrd31.js} +2 -2
  83. package/dist/{chunk-7ncycdpp.js → chunk-gthvary5.js} +1 -1
  84. package/dist/chunk-h7ks1p6h.js +2 -0
  85. package/dist/chunk-j4cm74nv.js +4 -0
  86. package/dist/{chunk-4q3w2353.js → chunk-j8fybkv1.js} +2 -2
  87. package/dist/{chunk-4svcj9c6.js → chunk-jbz530rv.js} +2 -2
  88. package/dist/{chunk-temeekck.js → chunk-jegkf64h.js} +2 -2
  89. package/dist/chunk-jjtgsnj0.js +2 -0
  90. package/dist/chunk-jnrcqphc.js +2 -0
  91. package/dist/chunk-jyy20tw1.js +2 -0
  92. package/dist/{chunk-34e5ad6w.js → chunk-k583q9wq.js} +3 -3
  93. package/dist/chunk-k7wta28t.js +2 -0
  94. package/dist/{chunk-e11qjnb4.js → chunk-kathd6f3.js} +2 -2
  95. package/dist/{chunk-zb8cdt79.js → chunk-kgkrtc3r.js} +1 -1
  96. package/dist/{chunk-ek06eyp4.js → chunk-kjtd3wc3.js} +1 -1
  97. package/dist/chunk-ksmcznp2.js +3 -0
  98. package/dist/chunk-m2ab6p4w.js +2 -0
  99. package/dist/chunk-n89jvr5q.js +2 -0
  100. package/dist/{chunk-6amcjhqh.js → chunk-nsns7rgs.js} +2 -2
  101. package/dist/chunk-nvya2g1d.js +2 -0
  102. package/dist/{chunk-qgkj3wee.js → chunk-pmpeh7e8.js} +2 -2
  103. package/dist/{chunk-460phps1.js → chunk-ptws0wtt.js} +2 -2
  104. package/dist/{chunk-85xjmqq8.js → chunk-r55p44ys.js} +2 -2
  105. package/dist/{chunk-rnzphmk6.js → chunk-r67bkrmr.js} +2 -2
  106. package/dist/{chunk-hjnf5kvc.js → chunk-r828rqdv.js} +2 -2
  107. package/dist/{chunk-b65vdzz3.js → chunk-rawfwgmw.js} +1 -1
  108. package/dist/{chunk-t6t6hgzx.js → chunk-rg5vskrr.js} +2 -2
  109. package/dist/{chunk-294gms5s.js → chunk-rmv0t2ee.js} +2 -2
  110. package/dist/{chunk-0v0mgxb4.js → chunk-rqnvygqy.js} +6 -6
  111. package/dist/{chunk-k3375qqd.js → chunk-rw9bsnyp.js} +2 -2
  112. package/dist/chunk-s1z1418w.js +2 -0
  113. package/dist/{chunk-t0fs5s5v.js → chunk-s4tydqhr.js} +2 -2
  114. package/dist/chunk-sgy6b5me.js +2 -0
  115. package/dist/chunk-sk14wfkj.js +2 -0
  116. package/dist/chunk-sx4fhs54.js +2 -0
  117. package/dist/{chunk-yvnad5k0.js → chunk-t1yd4a57.js} +1 -1
  118. package/dist/{chunk-ak0k5vg6.js → chunk-tc85dd04.js} +1 -1
  119. package/dist/{chunk-sc57jf2x.js → chunk-tjhwk02y.js} +1 -1
  120. package/dist/{chunk-hxhptw6e.js → chunk-v2bbgpvw.js} +2 -2
  121. package/dist/{chunk-0yvbqccv.js → chunk-vdeh7n7d.js} +2 -2
  122. package/dist/chunk-vmcxp5e2.js +2 -0
  123. package/dist/{chunk-abwjd5yv.js → chunk-vpt3vyfc.js} +2 -2
  124. package/dist/{chunk-x4jqabfz.js → chunk-vvk1knxf.js} +1 -1
  125. package/dist/{chunk-18mgzmdc.js → chunk-vxm45kym.js} +2 -2
  126. package/dist/{chunk-c0ac9k7h.js → chunk-vyf9wx2w.js} +2 -2
  127. package/dist/{chunk-989btr3w.js → chunk-wp673je0.js} +1 -1
  128. package/dist/{chunk-5ar229ya.js → chunk-wqrn3428.js} +1 -1
  129. package/dist/{chunk-hzxyj69n.js → chunk-wzjq9j6g.js} +3 -3
  130. package/dist/{chunk-2407f23n.js → chunk-x66yhg5y.js} +2 -2
  131. package/dist/{chunk-ncekagm6.js → chunk-xjtqdp82.js} +1 -1
  132. package/dist/{chunk-jg1ntm7n.js → chunk-xv3qen27.js} +2 -2
  133. package/dist/{chunk-b91ggk46.js → chunk-y0ppdmcv.js} +2 -2
  134. package/dist/{chunk-t3ew92b3.js → chunk-y8qmxd0j.js} +2 -2
  135. package/dist/{chunk-2pha46d9.js → chunk-ybwgmphj.js} +1 -1
  136. package/dist/{chunk-5hv3f2z9.js → chunk-zbnjrtye.js} +5 -5
  137. package/dist/{chunk-dwwpe6se.js → chunk-zse2yz8e.js} +3 -3
  138. package/dist/codex/activity-group.js +1 -1
  139. package/dist/codex/assistant-message.js +1 -1
  140. package/dist/codex/async-question-card.js +1 -1
  141. package/dist/codex/edited-files-card.js +1 -1
  142. package/dist/codex/image-view-activity.js +1 -1
  143. package/dist/codex/markdown-renderer.js +1 -1
  144. package/dist/codex/navigation-audio.js +1 -1
  145. package/dist/codex/navigation-preview.js +1 -1
  146. package/dist/codex/navigation-rail.js +1 -1
  147. package/dist/codex/patch-view.js +1 -1
  148. package/dist/codex/plan.js +1 -1
  149. package/dist/codex/timeline-virtualizer.js +1 -1
  150. package/dist/codex/turn-activity.js +1 -1
  151. package/dist/codex/user-message.js +1 -1
  152. package/dist/codex/virtualized-turn-list.js +1 -1
  153. package/dist/composer/completion-filter.js +1 -1
  154. package/dist/composer/completion-menu.js +1 -1
  155. package/dist/composer/completion-trigger.js +1 -1
  156. package/dist/composer/effort-slider.js +1 -1
  157. package/dist/composer/menu-radio.js +1 -1
  158. package/dist/composer/model-select.js +1 -1
  159. package/dist/composer/permission-mode-select.js +1 -1
  160. package/dist/composer/prompt-input-attachments.js +1 -1
  161. package/dist/composer/prompt-input-clipboard.js +1 -1
  162. package/dist/composer/prompt-input-context.js +1 -1
  163. package/dist/composer/prompt-input-textarea.js +1 -1
  164. package/dist/composer/prompt-input.js +1 -1
  165. package/dist/conversation/action-card.js +1 -1
  166. package/dist/conversation/composer/composer.js +1 -1
  167. package/dist/conversation/composer/config-options.js +1 -1
  168. package/dist/conversation/composer/context.js +1 -1
  169. package/dist/conversation/composer/drafts.js +1 -1
  170. package/dist/conversation/composer/file-items.js +1 -1
  171. package/dist/conversation/composer/long-text.js +1 -1
  172. package/dist/conversation/composer/mention-chips.js +1 -1
  173. package/dist/conversation/composer/mention-uri.js +1 -1
  174. package/dist/conversation/composer/model-menu.js +1 -1
  175. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  176. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  177. package/dist/conversation/composer/prediction.js +1 -1
  178. package/dist/conversation/composer/slash-command-button.js +1 -1
  179. package/dist/conversation/composer/submit-button.js +1 -1
  180. package/dist/conversation/composer/usage-meter.d.ts +1 -2
  181. package/dist/conversation/composer/usage-meter.js +1 -1
  182. package/dist/conversation/context.js +1 -1
  183. package/dist/conversation/conversation-body.js +1 -1
  184. package/dist/conversation/conversation-view.js +1 -1
  185. package/dist/conversation/conversation.js +1 -1
  186. package/dist/conversation/diff-modal.js +1 -1
  187. package/dist/conversation/session-actions.js +1 -1
  188. package/dist/image-lightbox.js +1 -1
  189. package/dist/image-preview-dialog.js +1 -1
  190. package/dist/lib/code-highlighter.js +1 -1
  191. package/dist/lib/fuzzy.js +1 -1
  192. package/dist/lib/group-blocks.js +1 -1
  193. package/dist/lib/image-encode.js +1 -1
  194. package/dist/lib/limits.js +1 -1
  195. package/dist/lib/markdown-parser.js +1 -1
  196. package/dist/lib/markdown-rules.js +1 -1
  197. package/dist/lib/model-name.js +1 -1
  198. package/dist/lib/pointer-centered-zoom.js +1 -1
  199. package/dist/lib/prepare-prompt-files.js +1 -1
  200. package/dist/lib/stream-style.js +1 -1
  201. package/dist/lib/streaming-markdown.js +1 -1
  202. package/dist/search/chat-search.js +1 -1
  203. package/dist/search/dom-matches.js +1 -1
  204. package/dist/search/find-bar.js +1 -1
  205. package/dist/search/literal-matches.js +1 -1
  206. package/dist/session-list/archived-sessions.js +1 -1
  207. package/dist/session-list/highlight.js +1 -1
  208. package/dist/session-list/host.js +1 -1
  209. package/dist/session-list/hover-info-card.js +1 -1
  210. package/dist/session-list/navigation.js +1 -1
  211. package/dist/session-list/overflow-marquee.js +1 -1
  212. package/dist/session-list/row-stop-button.js +1 -1
  213. package/dist/session-list/session-groups.js +1 -1
  214. package/dist/session-list/session-info-card.js +1 -1
  215. package/dist/session-list/session-list.d.ts +1 -0
  216. package/dist/session-list/session-list.js +1 -1
  217. package/dist/session-list/session-row.js +1 -1
  218. package/dist/session-list/session-state-dot.js +1 -1
  219. package/dist/session-list/session-state-menu.js +1 -1
  220. package/dist/session-list/sidebar-overlay.js +1 -1
  221. package/dist/session-list/trailing-swap.js +1 -1
  222. package/dist/session-list/use-activity-preview.js +1 -1
  223. package/dist/session-list/use-project-sessions.js +1 -1
  224. package/dist/session-list/virtual-session-rows.js +1 -1
  225. package/dist/session-timeline/activity-group.js +1 -1
  226. package/dist/session-timeline/activity-projection.js +1 -1
  227. package/dist/session-timeline/assistant-content.js +1 -1
  228. package/dist/session-timeline/assistant-turn.js +1 -1
  229. package/dist/session-timeline/async-questions.js +1 -1
  230. package/dist/session-timeline/edited-files-card.js +1 -1
  231. package/dist/session-timeline/history-timeline.js +1 -1
  232. package/dist/session-timeline/host.js +1 -1
  233. package/dist/session-timeline/navigation-rail.js +1 -1
  234. package/dist/session-timeline/plan.js +1 -1
  235. package/dist/session-timeline/question-reply.js +1 -1
  236. package/dist/session-timeline/resource-content.js +1 -1
  237. package/dist/session-timeline/session-timeline.js +1 -1
  238. package/dist/session-timeline/timeline-registry.js +1 -1
  239. package/dist/session-timeline/turn-activity.js +1 -1
  240. package/dist/session-timeline/turn-error.js +1 -1
  241. package/dist/session-timeline/turn-retry.js +1 -1
  242. package/dist/session-timeline/turn-time.js +1 -1
  243. package/dist/session-timeline/turns.js +1 -1
  244. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  245. package/dist/session-timeline/user-message.js +1 -1
  246. package/dist/ui/alert.js +1 -1
  247. package/dist/ui/badge.js +1 -1
  248. package/dist/ui/button.js +1 -1
  249. package/dist/ui/card.js +1 -1
  250. package/dist/ui/checkbox.js +1 -1
  251. package/dist/ui/dialog.js +1 -1
  252. package/dist/ui/dropdown-menu.js +1 -1
  253. package/dist/ui/empty.js +1 -1
  254. package/dist/ui/field.js +1 -1
  255. package/dist/ui/hover-card.js +1 -1
  256. package/dist/ui/input-group-textarea.js +1 -1
  257. package/dist/ui/input-group.js +1 -1
  258. package/dist/ui/kbd.js +1 -1
  259. package/dist/ui/label.js +1 -1
  260. package/dist/ui/radio-group.js +1 -1
  261. package/dist/ui/select.js +1 -1
  262. package/dist/ui/separator.js +1 -1
  263. package/dist/ui/skeleton.js +1 -1
  264. package/dist/ui/spinner.js +1 -1
  265. package/dist/ui/switch.js +1 -1
  266. package/dist/ui/textarea.js +1 -1
  267. package/dist/ui/tooltip.js +1 -1
  268. package/package.json +1 -1
  269. package/dist/chunk-0bcmb1tj.js +0 -4
  270. package/dist/chunk-0j0xezr5.js +0 -2
  271. package/dist/chunk-2qhzvpzz.js +0 -2
  272. package/dist/chunk-31x6chk8.js +0 -2
  273. package/dist/chunk-4hj619eb.js +0 -2
  274. package/dist/chunk-5d0a5ykg.js +0 -2
  275. package/dist/chunk-6ceybn6m.js +0 -3
  276. package/dist/chunk-8b8hc0b7.js +0 -2
  277. package/dist/chunk-8pktp9pc.js +0 -2
  278. package/dist/chunk-9fbkfhsv.js +0 -2
  279. package/dist/chunk-aprxk7c2.js +0 -2
  280. package/dist/chunk-asyfbagd.js +0 -3
  281. package/dist/chunk-b9m454cd.js +0 -2
  282. package/dist/chunk-bjg1zasm.js +0 -2
  283. package/dist/chunk-bztgv33r.js +0 -2
  284. package/dist/chunk-cyatvpv4.js +0 -2
  285. package/dist/chunk-dp8pjv6r.js +0 -2
  286. package/dist/chunk-e0n346aa.js +0 -2
  287. package/dist/chunk-fcqkxfv3.js +0 -2
  288. package/dist/chunk-g5tsnsqt.js +0 -2
  289. package/dist/chunk-jhe1aqmm.js +0 -2
  290. package/dist/chunk-jsjgymb4.js +0 -2
  291. package/dist/chunk-m8djwdd5.js +0 -2
  292. package/dist/chunk-mvv28374.js +0 -2
  293. package/dist/chunk-ncwd36vj.js +0 -2
  294. package/dist/chunk-nfeea6s7.js +0 -4
  295. package/dist/chunk-nfwmx8by.js +0 -2
  296. package/dist/chunk-pth2ajxw.js +0 -2
  297. package/dist/chunk-qpc4ca5y.js +0 -2
  298. package/dist/chunk-s6k9sg4g.js +0 -2
  299. package/dist/chunk-sgy0gbar.js +0 -2
  300. package/dist/chunk-ssmhqn6a.js +0 -2
  301. package/dist/chunk-szanfktp.js +0 -2
  302. package/dist/chunk-tjbn0y8j.js +0 -2
  303. package/dist/chunk-vc5nsece.js +0 -2
  304. package/dist/chunk-ve686fw1.js +0 -2
  305. package/dist/chunk-ysc51tpb.js +0 -2
@@ -1 +1 @@
1
- import{sr,a,v}from"./chunk-ryz4c13z.js";export{sr as ActivityHostProvider,v as ActivityMarkdown,a as useActivityHost};
1
+ import{fo,a,g}from"./chunk-46gb51y9.js";export{fo as ActivityHostProvider,g as ActivityMarkdown,a as useActivityHost};
@@ -1 +1 @@
1
- import{qe}from"../chunk-x4jqabfz.js";import{e}from"../chunk-cg97byvk.js";import{ue}from"../chunk-1drkvxzk.js";import{l}from"../chunk-1hy64ewz.js";import{f}from"../chunk-ek06eyp4.js";import{j,S}from"../chunk-jtaph5am.js";import{k}from"../chunk-ncekagm6.js";import{mn,Ct,ae,We}from"../chunk-t6t6hgzx.js";import{autoUpdate as G}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as R,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as V,useState as F}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:A,anchorRef:N,t:p,onAccept:I,onDecline:L}){let x=_(()=>r?mn(r.requestedSchema):[],[r]),[y,b]=F({}),C=V(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!ae(o)){let u=We(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&C.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")C.current.focus()},[r?.elicitationId]);let[E,q]=F(null),[U,z]=F(null),T=R(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){T();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,T,N]),O(()=>{let t=N.current;if(!r||!t||!U)return;return G(t,U,T,{animationFrame:!0})},[r,U,N,T]);let P=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=y[t];if(!o)return!1;if(ae(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,y]),D=R(async()=>{if(!r)return;if(!P)return;let t={},a={};for(let{key:o,property:u}of x){let d=y[o];if(!d)continue;let g;if(ae(u))t[o]=[...d.selectedSet??[]].map((v)=>v===c?(d.otherText??"").trim():v).filter(Boolean);else{let v=d.selected??"";if(t[o]=v===c?(d.otherText??"").trim():v,v!==c)g=We(u).find((s)=>s.value===v)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await I(r.elicitationId,t,a)},[r,x,y,P,I]),B=R(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!E)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:E.left,width:E.width,bottom:E.bottom,maxHeight:"70vh"},ref:(t)=>{C.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),A>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${A}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=y[t],d=u?.selected,g=u?.selectedSet??new Set,h=We(a),v=ae(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(qe,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Ct(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Ct(a).description})]}),v?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let Q=new Set(w[t]?.selectedSet??new Set);if(n)Q.add(s.value);else Q.delete(s.value);return{...w,[t]:{...w[t],selectedSet:Q}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(j,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(S,{value:s.value,id:n}),m(f,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:H("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(S,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(f,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!v&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!P,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
1
+ import{Ue}from"../chunk-vvk1knxf.js";import{e}from"../chunk-6kn920c5.js";import{ge}from"../chunk-9bjywaze.js";import{l}from"../chunk-1hy64ewz.js";import{v}from"../chunk-kjtd3wc3.js";import{K,E}from"../chunk-erzjz56d.js";import{C}from"../chunk-xjtqdp82.js";import{kn,Ct,le,ct}from"../chunk-rg5vskrr.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as R,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as G,useState as F}from"react";import{createPortal as V}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function ae({current:r,total:A,anchorRef:N,t:p,onAccept:I,onDecline:L}){let x=_(()=>r?kn(r.requestedSchema):[],[r]),[S,b]=F({}),T=G(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!le(o)){let u=ct(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[r?.elicitationId]);let[k,q]=F(null),[U,z]=F(null),y=R(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){y();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,y,N]),O(()=>{let t=N.current;if(!r||!t||!U)return;return j(t,U,y,{animationFrame:!0})},[r,U,N,y]);let P=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(le(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),D=R(async()=>{if(!r)return;if(!P)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(le(u))t[o]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[o]=f===c?(d.otherText??"").trim():f,f!==c)g=ct(u).find((s)=>s.value===f)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await I(r.elicitationId,t,a)},[r,x,S,P,I]),B=R(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!k)return null;return V(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:k.left,width:k.width,bottom:k.bottom,maxHeight:"70vh"},ref:(t)=>{T.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),A>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${A}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=ct(a),f=le(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(Ue,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Ct(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Ct(a).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let Q=new Set(w[t]?.selectedSet??new Set);if(n)Q.add(s.value);else Q.delete(s.value);return{...w,[t]:{...w[t],selectedSet:Q}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(K,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(E,{value:s.value,id:n}),m(v,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:H("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(E,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(v,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(C,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!P,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{ae as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{mn,Ct,ae,We}from"../chunk-t6t6hgzx.js";export{mn as elicitationFields,Ct as elicitationLabels,We as elicitationOptions,ae as isMultiSelect};
1
+ import{kn,Ct,le,ct}from"../chunk-rg5vskrr.js";export{kn as elicitationFields,Ct as elicitationLabels,ct as elicitationOptions,le as isMultiSelect};
@@ -1 +1 @@
1
- import{fr,kn,Xr,Yr}from"../chunk-bztgv33r.js";export{fr as PERMISSION_KIND_GROUP_ORDER,Xr as isAllowKind,Yr as isAlwaysKind,kn as sortPermissionOptions};
1
+ import{gr,wn,Wr,jr}from"../chunk-62x983rq.js";export{gr as PERMISSION_KIND_GROUP_ORDER,Wr as isAllowKind,jr as isAlwaysKind,wn as sortPermissionOptions};
@@ -1 +1 @@
1
- import{yn}from"../chunk-qq9p31a7.js";import"../chunk-bztgv33r.js";export{yn as PermissionView};
1
+ import{bn}from"../chunk-eg1d1gbc.js";import"../chunk-62x983rq.js";export{bn as PermissionView};
@@ -1 +1 @@
1
- import{Sr,gr,Pr,bn}from"../chunk-fcqkxfv3.js";import"../chunk-1drkvxzk.js";import"../chunk-989btr3w.js";import"../chunk-1hy64ewz.js";import"../chunk-jtaph5am.js";import"../chunk-ek06eyp4.js";import"../chunk-ksv9pjc2.js";import"../chunk-ty6yjhwk.js";import"../chunk-ak0k5vg6.js";import"../chunk-ncekagm6.js";import"../chunk-cg97byvk.js";export{bn as SchemaElicitationForm,Sr as elicitationFields,gr as initialValues,Pr as isAnswered};
1
+ import{Sr,dr,Ir,pn}from"../chunk-60ks28ef.js";import"../chunk-9bjywaze.js";import"../chunk-1hy64ewz.js";import"../chunk-tc85dd04.js";import"../chunk-erzjz56d.js";import"../chunk-et0rpfh9.js";import"../chunk-6kn920c5.js";import"../chunk-xjtqdp82.js";import"../chunk-wp673je0.js";import"../chunk-5d94195x.js";import"../chunk-kjtd3wc3.js";export{pn as SchemaElicitationForm,Sr as elicitationFields,dr as initialValues,Ir as isAnswered};
@@ -1 +1 @@
1
- import{wn}from"../chunk-18mgzmdc.js";import"../chunk-7ncycdpp.js";import"../chunk-cg97byvk.js";export{wn as UrlElicitationCard};
1
+ import{yn}from"../chunk-vxm45kym.js";import"../chunk-gthvary5.js";import"../chunk-6kn920c5.js";export{yn as UrlElicitationCard};
@@ -1,3 +1,3 @@
1
- import{An,Ne}from"./chunk-377s443r.js";import{t,ke}from"./chunk-dp8pjv6r.js";import{d,u,b,m,w}from"./chunk-ty6yjhwk.js";import{createStore as f}from"@alwith/api/client";import{jsx as i,jsxs as l}from"react/jsx-runtime";var c=f({request:null});function nt(e){c.setState({request:{path:e.path,patch:xn(e.patch,e.path)}})}function xn(e,a){let n=e.split(/^(?=diff --git )/m).filter((o)=>o.length>0);if(n.length<=1)return e;return n.find((o)=>{let r=o.split(`
2
- `,1)[0]??"";return r.endsWith(` b/${a}`)||r.endsWith(` ${a}`)||r.includes(`/${a} `)})??e}function ot(){let{t:e,theme:a}=t(),n=ke(c,(o)=>o.request),s=n===null?null:An(n.patch);return i(d,{open:n!==null,onOpenChange:(o)=>!o&&c.setState({request:null}),children:l(u,{className:"flex h-[calc(100vh-2.5rem)] max-h-[900px] flex-col gap-3 sm:max-w-[min(1400px,calc(100vw-2.5rem))]",children:[l(b,{children:[i(m,{className:"truncate pe-8 font-mono text-sm font-normal",children:n?.path}),s!==null&&l(w,{children:[l("span",{className:"codex-diff-additions",children:["+",s.additions]})," ",l("span",{className:"codex-diff-deletions",children:["-",s.deletions]})," ",i("span",{children:e("conversation.changedLines")})]})]}),i("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden rounded-lg border [&>.codex-patch-view]:h-full","data-stream-style":"codexUI",children:n!==null&&i(Ne,{patch:n.patch,theme:a})})]})})}
3
- export{nt,xn,ot};
1
+ import{no,Ne}from"./chunk-2879v3ps.js";import{t,ce}from"./chunk-3g8ck68k.js";import{d,u,w,m,k}from"./chunk-et0rpfh9.js";import{createStore as f}from"@alwith/api/client";import{jsx as i,jsxs as l}from"react/jsx-runtime";var c=f({request:null});function We(e){c.setState({request:{path:e.path,patch:dn(e.patch,e.path)}})}function dn(e,a){let n=e.split(/^(?=diff --git )/m).filter((o)=>o.length>0);if(n.length<=1)return e;return n.find((o)=>{let r=o.split(`
2
+ `,1)[0]??"";return r.endsWith(` b/${a}`)||r.endsWith(` ${a}`)||r.includes(`/${a} `)})??e}function je(){let{t:e,theme:a}=t(),n=ce(c,(o)=>o.request),s=n===null?null:no(n.patch);return i(d,{open:n!==null,onOpenChange:(o)=>!o&&c.setState({request:null}),children:l(u,{className:"flex h-[calc(100vh-2.5rem)] max-h-[900px] flex-col gap-3 sm:max-w-[min(1400px,calc(100vw-2.5rem))]",children:[l(w,{children:[i(m,{className:"truncate pe-8 font-mono text-sm font-normal",children:n?.path}),s!==null&&l(k,{children:[l("span",{className:"codex-diff-additions",children:["+",s.additions]})," ",l("span",{className:"codex-diff-deletions",children:["-",s.deletions]})," ",i("span",{children:e("conversation.changedLines")})]})]}),i("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden rounded-lg border [&>.codex-patch-view]:h-full","data-stream-style":"codexUI",children:n!==null&&i(Ne,{patch:n.patch,theme:a})})]})})}
3
+ export{We,dn,je};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{Do}from"./chunk-tdwk5dct.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{x}from"./chunk-pth2ajxw.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(De,{align:"start",...n})}function No({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Ae,{children:[t(Le,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Do,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Mo({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
2
- export{No,Mo};
1
+ import{e}from"./chunk-6kn920c5.js";import{Uo}from"./chunk-13y1xqbb.js";import{$e,qe,Ve}from"./chunk-rawfwgmw.js";import{y}from"./chunk-3wg25354.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(Ve,{align:"start",...n})}function Fo({data:n,t:r,className:u,...c}){let p=y(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),x=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",x,{passive:!1}),()=>window.removeEventListener("keydown",x)},[d]),o(R,{children:[o($e,{children:[t(qe,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Uo,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Bo({children:n,className:r,...u}){let c=y();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
2
+ export{Fo,Bo};
@@ -1,2 +1,2 @@
1
- import{Jo,oe}from"./chunk-ncwd36vj.js";import{er}from"./chunk-6amcjhqh.js";import{nr,on,rn}from"./chunk-sc57jf2x.js";import{sn,ln,Be,Ue,cn}from"./chunk-pth2ajxw.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Y,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function Z(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var jo=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ee,globalDrop:C,syncHiddenInput:R,maxFiles:z,maxFileSize:H,onError:b,onSubmit:te,children:re,...ne})=>{let s=Ue(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),k=M(!1),[ie,D]=Pe([]),c=l?s.attachments.files:ie,U=M(c);U.current=c;let ae=h(()=>{x.current?.click()},[]),B=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),O=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>B(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>H?i.size<=H:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}D((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let Q=[];for(let T of _){let V=I?.sourcePath(T);Q.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:O(T),filename:T.name,size:T.size,lastModified:T.lastModified,...V===void 0?{}:{sourcePath:V}})}return[...i,...Q]})},[I,O,B,z,H,b]),le=h((e)=>D((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>D((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),W=l?s.attachments.add:ue,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Jo(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${oe}MB.`});return}}W(r)},[c,W,b]),G=l?s.attachments.remove:le,N=l?s.attachments.clear:pe,j=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(R&&x.current&&c.length===0)x.current.value=""},[c,R]),F(()=>{let e=A.current;if(!e)return;if(C)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,C]),F(()=>{if(!C)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,C]),F(()=>()=>{if(!l){for(let e of U.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},q=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:G,clear:N,openFileDialog:j,fileInputRef:x}),[c,L,G,N,j]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let X=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(k.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:Z(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(Z(t)===n)t.reset();N()};k.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await er(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await te({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{k.current=!1}},ce=(e)=>{e.preventDefault(),X(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),J=a(ln.Provider,{value:()=>X(null),children:ye(sn.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ee,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...ne,children:a(nr,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:re})})]})});return l?a(Be.Provider,{value:q,children:J}):a(cn.Provider,{value:q,children:J})};function Ko({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Qo({className:u,...o}){return a(on,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Xo({className:u,...o}){return a(on,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Yo({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var K=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Y.count(y.children)<=1?"icon-xs":"xs";return a(rn,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Y.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Zo=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(rn,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:o,...f,children:y??g})};
2
- export{jo,Ko,Qo,Xo,Yo,K,Zo};
1
+ import{Do,te}from"./chunk-8dtaq4eh.js";import{_o}from"./chunk-nsns7rgs.js";import{rr,rn,an}from"./chunk-tjhwk02y.js";import{Wt,jt,Re,Ae,Kt}from"./chunk-3wg25354.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Y,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function Z(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var No=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:ee,globalDrop:C,syncHiddenInput:R,maxFiles:z,maxFileSize:H,onError:b,onSubmit:re,children:ne,...oe})=>{let s=Ae(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),k=M(!1),[ie,D]=Pe([]),c=l?s.attachments.files:ie,B=M(c);B.current=c;let ae=h(()=>{x.current?.click()},[]),O=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),W=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>O(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>H?i.size<=H:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}D((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let Q=[];for(let T of _){let V=I?.sourcePath(T);Q.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:W(T),filename:T.name,size:T.size,lastModified:T.lastModified,...V===void 0?{}:{sourcePath:V}})}return[...i,...Q]})},[I,W,O,z,H,b]),le=h((e)=>D((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>D((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),G=l?s.attachments.add:ue,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Do(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${te}MB.`});return}}G(r)},[c,G,b]),j=l?s.attachments.remove:le,N=l?s.attachments.clear:pe,q=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(R&&x.current&&c.length===0)x.current.value=""},[c,R]),F(()=>{let e=A.current;if(!e)return;if(C)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,C]),F(()=>{if(!C)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,C]),F(()=>()=>{if(!l){for(let e of B.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},X=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:j,clear:N,openFileDialog:q,fileInputRef:x}),[c,L,j,N,q]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let J=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(k.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:Z(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(Z(t)===n)t.reset();N()};k.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await _o(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await re({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{k.current=!1}},ce=(e)=>{e.preventDefault(),J(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),K=a(jt.Provider,{value:()=>J(null),children:ye(Wt.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:ee,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...oe,children:a(rr,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:ne})})]})});return l?a(Re.Provider,{value:X,children:K}):a(Kt.Provider,{value:X,children:K})};function Mo({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Ro({className:u,...o}){return a(rn,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Eo({className:u,...o}){return a(rn,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Ao({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var U=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Y.count(y.children)<=1?"icon-xs":"xs";return a(an,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Y.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Lo=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(an,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:o,...f,children:y??g})};
2
+ export{No,Mo,Ro,Eo,Ao,U,Lo};
@@ -1,7 +1,7 @@
1
- import{Jn}from"./chunk-jn0q0b7k.js";import{Ot,to}from"./chunk-88xay4pa.js";import{Ht}from"./chunk-30wqrz8v.js";import{decodeHTMLAttribute as C,decodeHTMLStrict as R}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as b,useState as h}from"react";import{jsx as a,jsxs as f,Fragment as te}from"react/jsx-runtime";var G=ge(null);function y(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function N(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!N(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!N(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
1
+ import{yo}from"./chunk-5c4z345j.js";import{zt,xo}from"./chunk-5nqhvv28.js";import{Ut}from"./chunk-dzx4rypz.js";import{decodeHTMLAttribute as C,decodeHTMLStrict as R}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as b,useState as h}from"react";import{jsx as a,jsxs as f,Fragment as te}from"react/jsx-runtime";var G=ge(null);function y(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,ke=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,we=/\uE200[^\uE201]*$/,be=4,xe=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function N(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function Te(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ve(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!N(e,t)&&!J(e,t,n))return t;return-1}function Ce(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!N(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e){return Ce(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!N(e,t))n+=1;t+=1}return n%2===1}function Ne(e){return e.endsWith(`
2
2
  `)?`${e}\`\`\``:`${e}
3
3
  \`\`\``}function H(e,n){if(!e.includes(n)||Te(e,n)%2===0)return e;let t=ve(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
4
4
  `)||V(r))return e;return`${e}${n}`}function Me(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Ee(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>be&&!xe.has(u))return!1}return!0}function Le(e){let{path:n}=Z(e);if(Me(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Ie(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Ee(t)||Le(t)?e.replace(A,"$1"):`${e})`}function $e(e){let n=e.replace(we,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&ye(n))return{isCodeFenceOpen:!0,markdown:Ne(n)};if(n.includes("!["))n=n.replace(ke,(t,r)=>r);if(n.includes("]("))n=Ie(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Re(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Re(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
5
- `),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function I(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);I(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))I(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return f("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=y();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:f("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r,copyText:o,onCopyError:s}=y(),i=b(null),[c,d]=h(null),[u,T]=h(null),[M,k]=h(!1);if(p(()=>{let g=Jn(d,T);return i.current=g,()=>{g.dispose(),i.current=null}},[]),p(()=>{let g=i.current;if(g===null)throw Error("Code highlighter is not mounted");g.update(e,n)},[e,n]),u!==null)throw u;let w=c!==null&&c.code===e&&c.language===n?c.html:null,l=async()=>{k(!1);try{await(o?o(e):navigator.clipboard.writeText(e)),k(!0),window.setTimeout(()=>k(!1),2000)}catch(g){s?.(g)}};return f("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[f("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>void l(),children:M?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...w===null?{children:e}:{dangerouslySetInnerHTML:{__html:w}}})})]})}function je({code:e,language:n}){return y().preview?a("span",{children:e}):a(We,{code:e,language:n})}function We({code:e,language:n}){let t=b(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(Oe,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function qe(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ke({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return f("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),f("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function ze(e){return y().preview?a(te,{children:e.alt}):a(Ue,{...e})}function Ue({src:e,alt:n,title:t,allowWide:r}){let o=b(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 f(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(qe(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ke,{preview:s,setPreview:i})})]})}function Be({value:e,display:n}){let t=b(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var De=150,v=null;function j(e,n){let t=v;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
6
- `,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return f("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?f("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:f("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=C(e.href);if(!Ht(r))return null;return a(ze,{src:r,alt:R(e.text),title:e.title==null?void 0:C(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(R(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=C(t.href);return Ht(o)?a(_e,{href:o,title:t.title==null?void 0:C(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function x(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?R(n.text):n.tokens.map(x).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(x).join("");case"list":return e.items.map(x).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(x).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=v;try{return v={cursor:t,runs:r,generation:o},ne(e,n)}finally{v=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);I(l);let g=new Map,P=0;return l.map((E)=>{let L=ee(E),S=g.get(L)??0;g.set(L,S+1);let F=x(E),re={token:E,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=b({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,T=performance.now(),M=r&&d?c.runs.filter((l)=>T-l.firstSeenAtMs<De):[],k=c.generation+(d?0:1),w={text:t,visibleText:s,runs:M.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:k};if(r&&s.length>u)w.runs.push({start:u,end:s.length,firstSeenAtMs:T});return D(()=>{i.current=w}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:w.runs,generation:k},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=b(null),[o,s]=h(()=>Ot(n,t)),[i,c]=h(null);if(p(()=>{let d=to((u)=>{fe(()=>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?$e(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(Ye,{result:o})});function jn({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(Qe,{text:r?o:e,isStreaming:r})})}
7
- export{jn};
5
+ `),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Pe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function I(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Pe(o):o);I(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))I(n.tokens)}}function Se(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Fe(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function Ae(e){let n=Fe(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function He({href:e}){let n=X(()=>Ae(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return f("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function _e({children:e,href:n,title:t}){let r=y();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Se(o,n,r),children:f("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(He,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function Oe({code:e,language:n}){let{theme:t,copyLabel:r,copyText:o,onCopyError:s}=y(),i=b(null),[c,d]=h(null),[u,T]=h(null),[M,k]=h(!1);if(p(()=>{let g=yo(d,T);return i.current=g,()=>{g.dispose(),i.current=null}},[]),p(()=>{let g=i.current;if(g===null)throw Error("Code highlighter is not mounted");g.update(e,n)},[e,n]),u!==null)throw u;let w=c!==null&&c.code===e&&c.language===n?c.html:null,l=async()=>{k(!1);try{await(o?o(e):navigator.clipboard.writeText(e)),k(!0),window.setTimeout(()=>k(!1),2000)}catch(g){s?.(g)}};return f("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[f("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>void l(),children:M?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...w===null?{children:e}:{dangerouslySetInnerHTML:{__html:w}}})})]})}function je({code:e,language:n}){return y().preview?a("span",{children:e}):a(We,{code:e,language:n})}function We({code:e,language:n}){let t=b(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(Oe,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function qe(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ke({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return f("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),f("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function ze(e){return y().preview?a(te,{children:e.alt}):a(Ue,{...e})}function Ue({src:e,alt:n,title:t,allowWide:r}){let o=b(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 f(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(qe(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ke,{preview:s,setPreview:i})})]})}function Be({value:e,display:n}){let t=b(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var De=150,v=null;function j(e,n){let t=v;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
6
+ `,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Xe(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Xe(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ge(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return f("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?f("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Je(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ve(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:f("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=C(e.href);if(!Ut(r))return null;return a(ze,{src:r,alt:R(e.text),title:e.title==null?void 0:C(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(R(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=C(t.href);return Ut(o)?a(_e,{href:o,title:t.title==null?void 0:C(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(je,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Je(e,n);case"list_item":return Ge(e,n);case"table":return Ve(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Be,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function x(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?R(n.text):n.tokens.map(x).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(x).join("");case"list":return e.items.map(x).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(x).join("")).join("")).join("")}default:return""}}function Ze({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=v;try{return v={cursor:t,runs:r,generation:o},ne(e,n)}finally{v=s}}var Ye=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);I(l);let g=new Map,P=0;return l.map((E)=>{let L=ee(E),S=g.get(L)??0;g.set(L,S+1);let F=x(E),re={token:E,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=b({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,T=performance.now(),M=r&&d?c.runs.filter((l)=>T-l.firstSeenAtMs<De):[],k=c.generation+(d?0:1),w={text:t,visibleText:s,runs:M.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:k};if(r&&s.length>u)w.runs.push({start:u,end:s.length,firstSeenAtMs:T});return D(()=>{i.current=w}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Ze,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:w.runs,generation:k},l.tokenKey))})}),Qe=B(function({text:n,isStreaming:t}){let r=b(null),[o,s]=h(()=>zt(n,t)),[i,c]=h(null);if(p(()=>{let d=xo((u)=>{fe(()=>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?$e(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(Ye,{result:o})});function vo({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(Qe,{text:r?o:e,isStreaming:r})})}
7
+ export{vo};
@@ -1,2 +1,2 @@
1
- import{Ho}from"./chunk-t3ew92b3.js";import{d,rr,u,m}from"./chunk-ty6yjhwk.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Do({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(rr,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?Ho({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
- export{Do};
1
+ import{$o}from"./chunk-y8qmxd0j.js";import{d,Yo,u,m}from"./chunk-et0rpfh9.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Uo({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(Yo,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?$o({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
+ export{Uo};
@@ -0,0 +1,2 @@
1
+ import{U}from"./chunk-115a3p9z.js";import{t}from"./chunk-3g8ck68k.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function mn({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(U,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
2
+ export{mn};
@@ -1 +1 @@
1
- import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function q({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function Et({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function V({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function Qr({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{q,Et,V,Qr};
1
+ import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function W({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function on({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function j({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function vi({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{W,on,j,vi};
@@ -0,0 +1,2 @@
1
+ import{C}from"./chunk-xjtqdp82.js";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function sn({className:r,...e}){return o(C,{"data-slot":"input-group-control",className:n("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",r),...e})}
2
+ export{sn};
@@ -0,0 +1,4 @@
1
+ import{lo}from"./chunk-83dkw1mh.js";import{t}from"./chunk-3g8ck68k.js";import{Mn,Rn}from"./chunk-ptws0wtt.js";import{A}from"./chunk-s4tydqhr.js";import{B}from"./chunk-34a7aha4.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@nyssance/codex-acp-v2/client";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var Nn=p(function({item:s,messageTime:c}){let l=t(),o=Rn(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
2
+ ${e.text}`).join(`
3
+ `):B(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=Mn(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return h("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(A,{block:e},`${s.id}:${n}`))}),r(lo,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
4
+ export{Nn};
@@ -1,3 +1,3 @@
1
- import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function An(e){let t=0,i=0;for(let o of e.split(`
1
+ import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function no(e){let t=0,i=0;for(let o of e.split(`
2
2
  `)){if(o.startsWith("+++")||o.startsWith("---"))continue;if(o.startsWith("+"))t+=1;else if(o.startsWith("-"))i+=1}return{additions:t,deletions:i}}function Ne({patch:e,theme:t}){let i=s(()=>n(e,{drawFileList:!1,outputFormat:"line-by-line",matching:"lines",colorScheme:t==="dark"?r.DARK:r.LIGHT}),[e,t]);return a("div",{className:"codex-patch-view",dangerouslySetInnerHTML:{__html:i}})}
3
- export{An,Ne};
3
+ export{no,Ne};
@@ -1,2 +1,2 @@
1
- import{cn as a}from"cn";import{useRef as u,useState as E}from"react";import{jsx as l}from"react/jsx-runtime";var M=45,d=8;function A({className:i,children:p,onMouseEnter:c,onMouseLeave:f,...m}){let s=u(null),[t,r]=E(0);return l("span",{className:a("min-w-0 overflow-hidden",i),onMouseEnter:(e)=>{let n=s.current;if(!n)return;let o=n.scrollWidth-n.clientWidth;if(o>d)r(getComputedStyle(n).direction==="rtl"?o:-o);c?.(e)},onMouseLeave:(e)=>{r(0),f?.(e)},...m,children:l("span",{ref:s,className:a("block whitespace-nowrap",t===0?"truncate":"overflow-visible"),style:{transform:`translateX(${t}px)`,transition:`transform ${Math.abs(t)/M}s linear`},children:p})})}
2
- export{A};
1
+ import{cn as a}from"cn";import{useRef as u,useState as E}from"react";import{jsx as l}from"react/jsx-runtime";var M=45,d=8;function _({className:i,children:p,onMouseEnter:c,onMouseLeave:f,...m}){let s=u(null),[t,r]=E(0);return l("span",{className:a("min-w-0 overflow-hidden",i),onMouseEnter:(e)=>{let n=s.current;if(!n)return;let o=n.scrollWidth-n.clientWidth;if(o>d)r(getComputedStyle(n).direction==="rtl"?o:-o);c?.(e)},onMouseLeave:(e)=>{r(0),f?.(e)},...m,children:l("span",{ref:s,className:a("block whitespace-nowrap",t===0?"truncate":"overflow-visible"),style:{transform:`translateX(${t}px)`,transition:`transform ${Math.abs(t)/M}s linear`},children:p})})}
2
+ export{_};
@@ -1,3 +1,3 @@
1
- var ui=["full","compact","codexUI"];function co(t){return t==="compact"||t==="codexUI"}var Ar=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function D(t){let o=Ar.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
- `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function mi(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
- export{ui,co,Ar,D,mi};
1
+ var oi=["full","compact","codexUI"];function mo(t){return t==="compact"||t==="codexUI"}var Hr=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function L(t){let o=Hr.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
+ `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function ri(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
+ export{oi,mo,Hr,L,ri};
@@ -1,2 +1,2 @@
1
- import{g}from"./chunk-nfeea6s7.js";import{codexMessageError as A,nativeTurnId as m,textOf as S,turns as _}from"@nyssance/codex-acp-v2/client";function Or(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function fo(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(A(e)!==null){let u=m(e),f=t.errors.findIndex((p)=>u!==null&&m(p)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=g(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(g(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function ho(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Or(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],p,k=null;for(let r of i.items){let a=m(r),l=d.get(a??"");if(a!==null&&k!==null&&a!==k||l!==void 0&&p!==void 0&&l>p+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")k=a;if(l!==void 0)p=l}return f.flatMap((r)=>_({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let I=`turn:${l.kind}:${l.id}`,h=r.endedAt??Math.max(...a.map((c)=>c.at)),y=o.get(I);if(y!==void 0&&K(y.items,a)&&y.endedAt===h)return y;let x={key:I,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:h,replayed:a.every(qt),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,b)=>j(x,c,b<v,a[b-1])),x})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function qt(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function G(t){return S(t.content)}function Ee(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Vt(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function vo(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function xo(t,e,n){if(n?.user==null)return!1;let o=e.items.map(m).find((i)=>i!==null),s=m(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function yo(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!xo(t,e[n-1],o))break;n--}return e[n]?.key}function bo(t,e,n){let o=n,s=n;while(o>0&&xo(t,e[o-1],e[o]))o--;while(s+1<e.length&&xo(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
2
- export{Or,fo,ho,qt,G,Ee,Vt,vo,xo,yo,bo};
1
+ import{p}from"./chunk-j4cm74nv.js";import{codexMessageError as A,nativeTurnId as y,textOf as S,turns as _}from"@nyssance/codex-acp-v2/client";function Ar(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function On(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(A(e)!==null){let u=y(e),f=t.errors.findIndex((m)=>u!==null&&y(m)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=p(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(p(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function Fn(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Ar(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],m,I=null;for(let r of i.items){let a=y(r),l=d.get(a??"");if(a!==null&&I!==null&&a!==I||l!==void 0&&m!==void 0&&l>m+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")I=a;if(l!==void 0)m=l}return f.flatMap((r)=>_({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let h=`turn:${l.kind}:${l.id}`,x=r.endedAt??Math.max(...a.map((c)=>c.at)),k=o.get(h);if(k!==void 0&&K(k.items,a)&&k.endedAt===x)return k;let b={key:h,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:x,replayed:a.every(Pt),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,g)=>j(b,c,g<v,a[g-1])),b})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function Pt(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function B(t){return S(t.content)}function Ie(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Nt(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Bn(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function zn(t,e,n){if(n?.user==null)return!1;let o=e.items.map(y).find((i)=>i!==null),s=y(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function Un(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!zn(t,e[n-1],o))break;n--}return e[n]?.key}function $n(t,e,n){let o=n,s=n;while(o>0&&zn(t,e[o-1],e[o]))o--;while(s+1<e.length&&zn(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
2
+ export{Ar,On,Fn,Pt,B,Ie,Nt,Bn,zn,Un,$n};
@@ -0,0 +1,2 @@
1
+ import{fo}from"./chunk-46gb51y9.js";import{createContext as s,useContext as l,useSyncExternalStore as m}from"react";import{jsx as r}from"react/jsx-runtime";var c=s(null),u=s(null);function J({host:e,client:n,children:i}){return r(fo,{host:e,children:r(c,{value:e,children:r(u,{value:n,children:i})})})}function t(){let e=l(c);if(e===null)throw Error("Timeline host is missing");return e}function ee(){let e=l(u);if(e===null)throw Error("Timeline client is missing");return e}function ce(e,n){return m((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function o(e){let n=ee();return ce(n.store,e)}function Pe(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
2
+ export{J,t,ee,ce,o,Pe};
@@ -0,0 +1,2 @@
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as I,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var C=d(null),Wt=d(null);function ci(){return i(Wt)}var jt=d(null);function di(){return i(jt)}var Re=d(null);function Ee(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var Ae=()=>i(C);function ui(){let r=i(Re);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(Re);function zo({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=A!==void 0,[G,J]=z(r),p=A??G,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)R?.(t);else J(t)},[T,R]),g=n(()=>P(""),[P]),x=U!==void 0,[K,N]=z([]),v=U??K,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else N(e)},[x,L]),j=I(null),w=I(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let k=n(()=>{w.current?.()},[]),b=q(()=>({files:v,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[v,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:W,clearSubmitted:c??g},attachments:b,__registerFileInput:H}),[p,P,g,W,c,b,H]);return D(C.Provider,{value:Q,children:D(Re.Provider,{value:b,children:B})})}var Kt=d(null);function y(){let r=X(),l=i(Kt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{Wt,ci,jt,di,Re,Ee,Ae,ui,zo,Kt,y};
@@ -0,0 +1,2 @@
1
+ import{Ee}from"./chunk-3wg25354.js";import{U,Lo}from"./chunk-115a3p9z.js";import{t}from"./chunk-3g8ck68k.js";import{Xo}from"./chunk-kgkrtc3r.js";import{be,we,ke}from"./chunk-7q07tm0w.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function un({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=Ee(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(U,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(be,{children:[o(we,{render:o(Lo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(ke,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Xo,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
+ export{un};
@@ -1,2 +1,2 @@
1
- import{createContext as i,useContext as r}from"react";import{jsx as e}from"react/jsx-runtime";var n=i(null);function sr({host:t,children:o}){return e(n.Provider,{value:t,children:o})}function a(){let t=r(n);if(t===null)throw Error("Activity host is missing");return t}function v(t){let{Markdown:o}=a();return e(o,{...t})}
2
- export{sr,a,v};
1
+ import{createContext as i,useContext as r}from"react";import{jsx as e}from"react/jsx-runtime";var n=i(null);function fo({host:t,children:o}){return e(n.Provider,{value:t,children:o})}function a(){let t=r(n);if(t===null)throw Error("Activity host is missing");return t}function g(t){let{Markdown:o}=a();return e(o,{...t})}
2
+ export{fo,a,g};
@@ -0,0 +1,2 @@
1
+ import{Wn}from"./chunk-9h86hvc3.js";import{e}from"./chunk-6kn920c5.js";import{J,t,ee,o,Pe}from"./chunk-3g8ck68k.js";import{Fn,Ie,Nt,Un,$n}from"./chunk-34a7aha4.js";import{Se}from"./chunk-vyf9wx2w.js";import{Tn}from"./chunk-ksmcznp2.js";import{Pn}from"./chunk-r67bkrmr.js";import{_n,Hn}from"./chunk-gc1m6aw5.js";import{Vn,Gn}from"./chunk-y0ppdmcv.js";import{qn}from"./chunk-v2bbgpvw.js";import{En}from"./chunk-vdeh7n7d.js";import{Nn}from"./chunk-1xg1qw4g.js";import{codexExtensionCapabilities as Ve,codexMessageError as Be,codexRetryNotice as qe,codexTurnError as Oe,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Fe}from"lucide-react";import{useCallback as V,useEffect as A,useLayoutEffect as ve,useMemo as Y,useRef as b,useState as _}from"react";import{flushSync as Te}from"react-dom";import{jsx as l,jsxs as L}from"react/jsx-runtime";var ye=24;function Ke(n){let m=Math.max(0,n.turnTopPx-ye),v=Math.max(0,n.scrollHeightPx-n.viewportHeightPx),c=m-v;return{scrollTopPx:m,spacerPx:c>0?n.spacerPx+c:n.spacerPx}}function Ue({viewportRef:n,viewportProps:m,children:v}){return l("div",{ref:n,...m,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:v})}function _e({sessionId:n,turnId:m,root:v,error:c,connected:S}){let C=b(null),w=ee(),{t:N}=t(),R=V(()=>{w.loadHistoryTurn(n,m).catch(()=>{})},[w,n,m]);return A(()=>{if(!v||!C.current||!S||c)return;let B=new IntersectionObserver((T)=>{if(T.some((P)=>P.isIntersecting))B.disconnect(),R()},{root:v,rootMargin:"800px 0px"});return B.observe(C.current),()=>B.disconnect()},[v,S,c,R]),l("div",{ref:C,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":m,"data-markdown-pending":!0,children:c?L("div",{className:"flex flex-col items-center gap-2",children:[l("p",{role:"alert",className:"text-destructive text-xs",children:c}),l(e,{variant:"outline",size:"sm",onClick:R,disabled:!S,children:N("timeline.navigationRetry")})]}):L("div",{role:"status","aria-label":N("timeline.navigationLoading"),className:"space-y-3",children:[l("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),l("div",{className:"bg-muted h-3 w-4/5 rounded"}),l("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function $e(n,m){let v=b([]),c=b(null);if(c.current?.items!==n.items||c.current.state!==n.state||c.current.ended!==n.turnEndedAt||c.current.usage!==n.turnUsage||c.current.historyOrder!==m)c.current={state:n.state,items:n.items,ended:n.turnEndedAt,usage:n.turnUsage,historyOrder:m,turns:Fn(n,v.current,m)};let S=c.current.turns;return v.current=S,S}function Cn(n){return l(J,{host:n.host,client:n.client,children:l(De,{...n})})}function De({session:n,leading:m,afterTurn:v,answerActions:c,turnFooter:S,renderUserMessage:C,insert:w,navigation:N,anchorNewTurn:R=!1,Viewport:B=Ue}){let T=ee(),P=t(),y=o((r)=>r.historyNavigation[n.id]),d=$e(n,y?.turns),M=d.at(-1)?.key,xe=Un(n,d),x=n.state!=="idle",D=Y(()=>Pn(d,y),[d,y]),Z=Y(()=>D.flatMap((r)=>r.turn===void 0?[]:[{...r.turn,key:r.turnKey}]),[D]),he=Y(()=>N===void 0?[]:_n(d,n.turnUsage,y),[N,d,n.turnUsage,y]),te=w&&w.afterItemId!==null?d.findIndex((r)=>r.items.some((u)=>u.id===w.afterItemId)):-1,j=b(d);j.current=d;let[a,be]=_(null),h=o((r)=>r.historyPages[n.id]),I=o((r)=>r.connection==="ready"),we=o((r)=>Ve(r.agent).sessionRetry),ne=h!==void 0;A(()=>{if(I&&ne&&!n.restoring)T.loadHistoryNavigation(n.id).catch(()=>{})},[T,I,ne,n.id,n.restoring]);let[Re,He]=_(!1),F=b(null),[Ne,re]=_(!1),ie=b(0),W=b({key:M,running:x});W.current={key:M,running:x};let[oe,K]=_(0),k=b(0),E=b(null);k.current=oe;let ke=V(()=>{if(E.current!==null)E.current.keepTop=!1},[]),{isFollowing:z,scrollToBottom:X,stopFollowing:q,schedulePin:le,contentResized:ae,beginLocate:ue,cancelLocation:se}=En(a,x,ke),ce=V(()=>{if(a===null||!x)return;let r=d.at(-1)?.key;if(r===void 0)return;let u=ue(!0),s=()=>u.isCurrent()&&W.current.running&&W.current.key===r,i=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!s())return;let g=a.querySelector(`[data-codex-turn="${CSS.escape(r)}"]`);if(g===null)return;let f=a.scrollTop+g.getBoundingClientRect().top-a.getBoundingClientRect().top,H=Ke({turnTopPx:f,scrollHeightPx:a.scrollHeight,viewportHeightPx:a.clientHeight,spacerPx:k.current});E.current=H.spacerPx>0?{element:g,heightPx:g.getBoundingClientRect().height+H.spacerPx,keepTop:!0}:null,Te(()=>K(H.spacerPx)),requestAnimationFrame(()=>{if(s())u.finish(H.scrollTopPx)})})),p=F.current;if(p===null)return;p.scrollToKey(r,void 0,{align:"top"}).then(()=>{if(s())i()})},[ue,x,a,d]);ve(()=>{if(!R||x)return;se(),E.current=null,k.current=0,K(0)},[R,se,x]);let G=V(()=>{q(),T.loadOlderHistory(n.id).catch(()=>{})},[T,n.id,q]);A(()=>{if(a===null)return;let r=()=>{let u=a.scrollTop<600;if(He(u),u&&!y?.complete&&I&&!n.restoring&&!z&&h?.cursor&&!h.loading&&!h.error)G()};return r(),a.addEventListener("scroll",r,{passive:!0}),()=>a.removeEventListener("scroll",r)},[I,h,z,G,a,n.restoring,y?.complete]),A(()=>{Vn({sessionId:n.id,turns:Z,api:F.current,beforeReveal:q,terminals:n.terminals})},[n.id,n.terminals,Z,q]),A(()=>()=>Gn(n.id),[n.id]);let Ee=V(async(r,u)=>{let s=++ie.current;re(!0);try{if(r.isLoaded===!1&&r.nativeTurnId!==void 0)await T.loadHistoryTurn(n.id,r.nativeTurnId),await new Promise((f)=>requestAnimationFrame(()=>f()));if(!u())return null;let i=j.current.find((f)=>f.user?.id===(r.messageId??r.id))??j.current.find((f)=>f.user!==null&&r.nativeTurnId!==void 0&&f.items.some((H)=>ge(H)===r.nativeTurnId));if(!i?.user)return null;let p=i.user.id,g=F.current;if(g===null)throw Error("Virtual timeline is not mounted");return await g.scrollToKey(i.key,(f)=>f.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(ie.current===s)re(!1)}},[T,n.id]),Ae=V(async(r)=>{if(r.nativeTurnId!==void 0)await T.previewHistoryTurn(n.id,r.nativeTurnId)},[T,n.id]);A(()=>{if(a===null)return;let r=a.querySelector("[data-codex-timeline]");if(r===null)throw Error("Timeline content element is missing");let u=new ResizeObserver(()=>{let s=E.current,i=null;if(s!==null){let p=Math.max(0,s.heightPx-s.element.getBoundingClientRect().height);if(p!==k.current&&(p<k.current||s.keepTop)){if(k.current=p,Te(()=>K(p)),p===0)E.current=null}if(p>0&&s.keepTop)i=a.scrollTop+s.element.getBoundingClientRect().top-a.getBoundingClientRect().top-ye}ae(i)});if(u.observe(r),u.observe(a),M!==void 0){let s=a.querySelector(`[data-codex-turn="${CSS.escape(M)}"]`);if(s===null)throw Error("Latest turn is not mounted");u.observe(s)}return()=>u.disconnect()},[ae,M,a]),A(()=>{if(n.items.length===0)return;le()},[le,n.items]);let de=b(null);ve(()=>{if(a===null)return;let r=d.at(-1),u=de.current;if(de.current=r===void 0?null:{key:r.key,running:x},r===void 0||u===null||r.user===null||r.replayed)return;if(R){if(x&&n.turnEndedAt[r.user.id]===void 0&&(r.key!==u.key||!u.running))E.current=null,k.current=0,K(0),ce()}else if(r.key!==u.key)X()},[ce,R,x,X,a,n.turnEndedAt,d]);let Le=(r,u)=>{let s=r,i=s.turn;if(i===void 0){if(s.nativeTurnId===void 0)throw Error(`Turn is missing at index ${u}`);return l(_e,{sessionId:n.id,turnId:s.nativeTurnId,root:a,error:y?.turnErrors[s.nativeTurnId],connected:I&&!z&&!Ne})}let p=d.indexOf(i),g=i.key===xe,f=$n(n,d,p),H=!g&&f.continued,U=i.key===M,O=i.errors.at(-1),me=O===void 0?null:Be(O),Q=O===void 0?null:ge(O),Ce=U&&!g&&I&&we&&n.attached&&!n.readOnly&&!n.restoring&&O===n.items.at(-1)&&me!==null&&Oe(me).category==="overloaded"&&Q!==null&&n.lastStopReason!=="end_turn"&&n.lastStopReason!=="cancelled",fe=S?.(i)??null,Me=i.work.length>0||i.final.length>0||i.errors.length>0||g||fe!==null||Ie(i)||Nt(i)||U&&(n.error!==null||n.lastStopReason==="cancelled"),pe=i.user===null?null:Se(i);return L("div",{"data-virtualized-turn-content":!0,"data-codex-turn":i.key,className:"flex flex-col gap-1.5",children:[i.user!==null&&(C===void 0?l(Nn,{item:i.user,messageTime:pe}):C(i.user,pe)),Me&&l(Tn,{sessionId:n.id,turn:i,terminals:n.terminals,active:g,blocked:n.state==="requires_action",continued:H,edits:f.edits,activityItems:f.items,workStartedAt:f.startedAt,isLast:U,error:n.error,retrying:g?qe(n._meta)??void 0:void 0,retry:Ce?{turnId:Q,delaySeconds:qn(d),run:(ze)=>T.retrySession(n.id,Q,ze)}:void 0,interrupted:Nt(i)||!g&&U&&n.lastStopReason==="cancelled",answerActions:c?.(i),footer:fe}),u===te&&w?.node,v?.(i)]})};return L("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[l(B,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":P.t("timeline.label")},children:l("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:L("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[w&&te===-1&&w.node,l(Wn,{ref:F,entries:D,renderTurn:Le,scrollElement:a,sessionKey:n.id,preserveViewport:!z,leadingInsetPx:12,leadingContent:m===void 0?void 0:l("div",{className:"pt-3",children:m})}),R&&l("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:oe}}),l("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),l("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),y?.error&&l("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:l(e,{variant:"outline",size:"sm",disabled:!I,title:y.error,onClick:()=>{T.loadHistoryNavigation(n.id).catch(()=>{})},children:P.t("timeline.navigationRetry")})}),Re&&h?.cursor&&!y?.complete&&L("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[l(e,{variant:"outline",size:"sm",disabled:!I||n.restoring||h.loading,onClick:G,children:h.loading?P.t("timeline.loadingEarlier"):P.t("timeline.loadEarlier")}),h.error&&l("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:h.error})]}),N!==void 0&&l(Hn,{items:he,audio:N.audio,scrollRoot:a,beforeReveal:q,ensureItemMounted:Ee,onPreviewItem:Ae,onRevealError:(r)=>Pe(P,r),targetTopMarginPx:16},n.id),l("button",{type:"button",className:z?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:z?-1:void 0,onClick:X,"aria-label":P.t("timeline.scrollToBottom"),children:x?L("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"}),l("span",{className:"codex-wave-dot"})]}):l(Fe,{})})]})}
2
+ export{Cn};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{ce}from"./chunk-xxkdv1zf.js";import{SquareIcon as u}from"lucide-react";import{useRef as c,useState as f}from"react";import{jsx as a}from"react/jsx-runtime";function Qe({title:t,onStop:s}){let[o,i]=f(!1),n=c(!1),l=async()=>{if(n.current)return;n.current=!0,i(!0);try{await s()}finally{n.current=!1,i(!1)}};return a(e,{variant:"ghost",size:"icon",className:"size-5",title:t,"aria-label":t,"aria-busy":o,disabled:o,onKeyDown:(r)=>r.stopPropagation(),onClick:(r)=>{r.stopPropagation(),l()},children:o?a(ce,{className:"size-3","aria-label":t}):a(u,{className:"size-3 fill-current"})})}
2
- export{Qe};
1
+ import{e}from"./chunk-6kn920c5.js";import{fe}from"./chunk-64hrczd9.js";import{SquareIcon as u}from"lucide-react";import{useRef as c,useState as f}from"react";import{jsx as a}from"react/jsx-runtime";function mt({title:t,onStop:s}){let[o,i]=f(!1),n=c(!1),l=async()=>{if(n.current)return;n.current=!0,i(!0);try{await s()}finally{n.current=!1,i(!1)}};return a(e,{variant:"ghost",size:"icon",className:"size-5",title:t,"aria-label":t,"aria-busy":o,disabled:o,onKeyDown:(r)=>r.stopPropagation(),onClick:(r)=>{r.stopPropagation(),l()},children:o?a(fe,{className:"size-3","aria-label":t}):a(u,{className:"size-3 fill-current"})})}
2
+ export{mt};
@@ -1,2 +1,2 @@
1
- class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function Jn(i,e){return n??=new s,n.connect(i,e)}
2
- export{Jn};
1
+ class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function yo(i,e){return n??=new s,n.connect(i,e)}
2
+ export{yo};
@@ -1 +1 @@
1
- import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function Q({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{Q};
1
+ import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function X({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{X};
@@ -1,3 +1,3 @@
1
- import{a}from"./chunk-ryz4c13z.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
- `).length}function Hr(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function mo({blocks:e}){return s(Ut,{files:Hr(e)})}function Ut({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
- export{Hr,mo,Ut};
1
+ import{a}from"./chunk-46gb51y9.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
+ `).length}function Or(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function go({blocks:e}){return s(Bt,{files:Or(e)})}function Bt({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
+ export{Or,go,Bt};
@@ -1,2 +1,2 @@
1
- var t=new Map;var a=0;function Ot(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=Ot(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 to(e,n){return d??=new l,d.connect(e,n)}
2
- export{Ot,to};
1
+ var t=new Map;var a=0;function zt(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=zt(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 xo(e,n){return d??=new l,d.connect(e,n)}
2
+ export{zt,xo};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-6kn920c5.js";import{ge}from"./chunk-9bjywaze.js";import{d,u,w,Q,m,k}from"./chunk-et0rpfh9.js";import{v}from"./chunk-kjtd3wc3.js";import{ln,cn,ir,ar,sr,wt}from"./chunk-wp673je0.js";import{l}from"./chunk-1hy64ewz.js";import{K,E}from"./chunk-erzjz56d.js";import{ze}from"./chunk-tc85dd04.js";import{C}from"./chunk-xjtqdp82.js";import{isArrayProperty as D,isBooleanProperty as S,isNumberProperty as A,isStringProperty as N}from"@nyssance/codex-acp-v2/client";import{useEffect as V,useMemo as R,useState as q}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function P(r){if(!N(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function L(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function Sr(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:P(i),multiOptions:D(i)?L(i.items):null}))}function dr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(S(n.property))t[n.key]=!1;else if(D(n.property))t[n.key]=[]}return t}function Ir(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function O({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(v,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function G({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(ln,{children:[o(cn,{variant:"label",children:t.title}),t.description&&o(wt,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let f=`${r}:${c.value}`;return o(O,{id:f,...c,control:o(ge,{id:f,checked:a.has(c.value),onCheckedChange:(y)=>{let g=new Set(a);if(y)g.add(c.value);else g.delete(c.value);i([...g])}})},c.value)})})]})}if(t.options)return p(ln,{children:[o(cn,{variant:"label",children:t.title}),t.description&&o(wt,{children:t.description}),o(K,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(O,{id:c,...a,control:o(E,{value:a.value,id:c})},a.value)})})]});return p(ar,{children:[o(sr,{htmlFor:r,children:t.title}),S(t.property)?o(ze,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):A(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(C,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(wt,{children:t.description})]})}function pn({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let f=R(()=>Sr(t),[t]),[y,g]=q(()=>dr(f));V(()=>g(dr(f)),[r,f]);let b=f.every((s)=>Ir(s,y[s.key])),x=()=>{if(!b)return;let s={};for(let[h,F]of Object.entries(y))if(F!==void 0)s[h]=F;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),x()},children:[p(w,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(k,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(ir,{children:f.map((s)=>o(G,{id:`${r}:${s.key}`,field:s,value:y[s.key],onChange:(h)=>g((F)=>({...F,[s.key]:h}))},s.key))})}),p(Q,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!b,onClick:x,children:a("actions.submit")})]})]})})}
2
+ export{Sr,dr,Ir,pn};
@@ -0,0 +1,2 @@
1
+ var gr={allow_once:0,allow_always:1,reject_once:2,reject_always:3};function wn(e){return[...e].toSorted((o,n)=>(gr[o.kind]??99)-(gr[n.kind]??99))}function Wr(e){return e==="allow_once"||e==="allow_always"}function jr(e){return e==="allow_always"||e==="reject_always"}
2
+ export{gr,wn,Wr,jr};
@@ -1 +1 @@
1
- import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ce({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{ce};
1
+ import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function fe({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{fe};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-3g8ck68k.js";import{ae,Ce,Qe}from"./chunk-ct5wk01a.js";import{jsx as t,jsxs as d,Fragment as r}from"react/jsx-runtime";var a=[];function Ge({sessionId:s}){let e=o((n)=>n.actions),c=e.some((n)=>n.sessionId===s)?e.filter((n)=>n.sessionId===s):a,i=c.filter(ae),l=c.filter((n)=>!ae(n));return d(r,{children:[l.length>0&&t("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-3 px-6 pb-3","data-session-actions":!0,children:l.map((n)=>t(Qe,{action:n},n.id))}),i[0]!==void 0&&t(Ce,{action:i[0],total:i.length},i[0].id)]})}
2
+ export{Ge};
@@ -1 +1 @@
1
- import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Vr=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Vr({variant:t,size:i,className:r})),...a})}export{Vr,e};
1
+ import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Gr=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Gr({variant:t,size:i,className:r})),...a})}export{Gr,e};
@@ -0,0 +1,2 @@
1
+ import{g}from"./chunk-46gb51y9.js";import{z}from"./chunk-fjwg3y8h.js";import{isPlanItems as n,isPlanMarkdown as r}from"@nyssance/codex-acp-v2/client";import{jsx as e}from"react/jsx-runtime";function Sn({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(g,{text:t.content,streaming:!1})});if(!n(t))return null;return e(z,{entries:t.entries})}
2
+ export{Sn};