@kitn.ai/ui 0.27.0 → 0.28.0

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 (266) hide show
  1. package/README.md +10 -2
  2. package/dist/{Icon-BnFKqqtY.js → Icon-DObhsRtm.js} +1 -1
  3. package/dist/{action-icons-CBskfBMz.js → action-icons-CcgNN2oT.js} +1 -1
  4. package/dist/arrow-down-CjRU3JgV.js +1 -0
  5. package/dist/arrow-left-Bnpb1UEW.js +1 -0
  6. package/dist/{artifact-CvXEm1lS.js → artifact-Bwt7OgcR.js} +1 -1
  7. package/dist/{attachments-C43ZegEq.js → attachments-Qr4kg-2b.js} +1 -1
  8. package/dist/{audio-visualizer-B-79y1Tj.js → audio-visualizer-DToYdfSc.js} +1 -1
  9. package/dist/{badge-BpUbq8c0.js → badge-CdEu_jn2.js} +1 -1
  10. package/dist/{bell-sn17Ip9v.js → bell-DQAAOpDz.js} +1 -1
  11. package/dist/{button-BH6rN0U-.js → button-DkuOnGLy.js} +1 -1
  12. package/dist/{card-renderer-Cb1gQmth.js → card-renderer-Jx70m6_l.js} +1 -1
  13. package/dist/{card-routing-DifQgS7n.js → card-routing-0YidER_3.js} +1 -1
  14. package/dist/check-njkVdZu2.js +1 -0
  15. package/dist/{checkbox-Dc9Yov_B.js → checkbox-D7iRB3nL.js} +1 -1
  16. package/dist/{checkbox-group-B1kDLLYk.js → checkbox-group-B2_rpoPM.js} +1 -1
  17. package/dist/chevron-down-B72s6PXR.js +1 -0
  18. package/dist/chevron-right-BatuHzUm.js +1 -0
  19. package/dist/{choice-card-BT3c1S8g.js → choice-card-m0BYqqOK.js} +1 -1
  20. package/dist/circle-check-B62pODB3.js +1 -0
  21. package/dist/{circle-x-wobWkoSx.js → circle-x-BPG0iPst.js} +1 -1
  22. package/dist/circle-zx0ByzY9.js +1 -0
  23. package/dist/code-block-ClMLKb7C.js +1 -0
  24. package/dist/{collapsible-CPJbf6FM.js → collapsible-B4DlWicL.js} +1 -1
  25. package/dist/components/chat-thread.d.ts +89 -1
  26. package/dist/components/conversation-item.d.ts +16 -0
  27. package/dist/components/conversation-panel.d.ts +29 -0
  28. package/dist/components/home-panel.d.ts +34 -0
  29. package/dist/components/widget-tab-bar.d.ts +16 -0
  30. package/dist/{composer-CjngLzal.js → composer-sQ0HcvyG.js} +3 -3
  31. package/dist/{confirm-card-DCx_A4bU.js → confirm-card-rQWDQsnC.js} +1 -1
  32. package/dist/construct-cli.es.js +182 -14
  33. package/dist/{context-BY8V-Nlp.js → context-0kg4ZX1J.js} +1 -1
  34. package/dist/controllable-CnGpMF6r.js +1 -0
  35. package/dist/conversation-item-BxwQLaFJ.js +1 -0
  36. package/dist/conversation-list-BCfGN1JU.js +1 -0
  37. package/dist/{copy-B6DO4PqB.js → copy-n9u9rqpi.js} +1 -1
  38. package/dist/{create-tween-CnMHviKB.js → create-tween-C-q-JCM-.js} +1 -1
  39. package/dist/{create-tween-D1aiGZZh.js → create-tween-CRrJXxBd.js} +1 -1
  40. package/dist/{create-tween-BPzaefTp.js → create-tween-DZ3RRDHD.js} +1 -1
  41. package/dist/{create-tween-DUSQUKpr.js → create-tween-uPkArjIG.js} +1 -1
  42. package/dist/custom-elements.json +51 -2
  43. package/dist/{default-input-CucQEOqH.js → default-input-CaMrJkgH.js} +1 -1
  44. package/dist/define-By-uL588.js +1 -0
  45. package/dist/define.js +2 -2
  46. package/dist/define.server.js +2 -2
  47. package/dist/{disclosure-CbLtajUQ.js → disclosure-WUImBbDv.js} +1 -1
  48. package/dist/{dropdown-BwhViJFd.js → dropdown-wZVeJOMd.js} +1 -1
  49. package/dist/elements/agent-card.js +1 -1
  50. package/dist/elements/artifact.js +1 -1
  51. package/dist/elements/attachments.js +1 -1
  52. package/dist/elements/audio-visualizer.js +1 -1
  53. package/dist/elements/avatar.js +1 -1
  54. package/dist/elements/badge.js +1 -1
  55. package/dist/elements/button.js +1 -1
  56. package/dist/elements/card.js +1 -1
  57. package/dist/elements/cards.js +1 -1
  58. package/dist/elements/chain-of-thought.js +1 -1
  59. package/dist/elements/chat-scope-picker.js +1 -1
  60. package/dist/elements/chat-workspace.js +1 -1
  61. package/dist/elements/chat.js +1 -1
  62. package/dist/elements/checkbox-group.js +1 -1
  63. package/dist/elements/checkbox.js +1 -1
  64. package/dist/elements/checkpoint.js +1 -1
  65. package/dist/elements/choice.js +1 -1
  66. package/dist/elements/coachmark.js +1 -1
  67. package/dist/elements/code-block.js +1 -1
  68. package/dist/elements/command.js +1 -1
  69. package/dist/elements/compare.js +1 -1
  70. package/dist/elements/composer.js +1 -1
  71. package/dist/elements/confirm-card.js +1 -1
  72. package/dist/elements/context-meter.js +1 -1
  73. package/dist/elements/conversation-item.js +1 -1
  74. package/dist/elements/conversation-list.js +1 -1
  75. package/dist/elements/dialog.js +1 -1
  76. package/dist/elements/dock.js +3 -3
  77. package/dist/elements/dropdown.js +1 -1
  78. package/dist/elements/editable-label.js +1 -1
  79. package/dist/elements/embed.js +1 -1
  80. package/dist/elements/empty.js +1 -1
  81. package/dist/elements/feedback-bar.js +1 -1
  82. package/dist/elements/file-tree.js +1 -1
  83. package/dist/elements/file-upload.js +1 -1
  84. package/dist/elements/form.js +1 -1
  85. package/dist/elements/hover-card.js +1 -1
  86. package/dist/elements/icon.js +1 -1
  87. package/dist/elements/image.js +1 -1
  88. package/dist/elements/input.js +1 -1
  89. package/dist/elements/kbd.js +1 -1
  90. package/dist/elements/link-preview.js +1 -1
  91. package/dist/elements/loader.js +1 -1
  92. package/dist/elements/markdown.js +1 -1
  93. package/dist/elements/menu.js +1 -1
  94. package/dist/elements/message-skills.js +1 -1
  95. package/dist/elements/message.js +1 -1
  96. package/dist/elements/model-switcher.js +1 -1
  97. package/dist/elements/nav.js +1 -1
  98. package/dist/elements/notice.js +1 -1
  99. package/dist/elements/pane-grid.js +1 -1
  100. package/dist/elements/pane-group.js +1 -1
  101. package/dist/elements/pane.js +1 -1
  102. package/dist/elements/popover.js +1 -1
  103. package/dist/elements/progress-bar.js +1 -1
  104. package/dist/elements/prompt-dock.js +1 -1
  105. package/dist/elements/prompt-input.js +1 -1
  106. package/dist/elements/prompt-suggestions.js +1 -1
  107. package/dist/elements/radio-group.js +1 -1
  108. package/dist/elements/reasoning.js +1 -1
  109. package/dist/elements/remote.js +1 -1
  110. package/dist/elements/resizable.js +1 -1
  111. package/dist/elements/response-stream.js +1 -1
  112. package/dist/elements/screen.js +1 -1
  113. package/dist/elements/scroll-area.js +1 -1
  114. package/dist/elements/scroll-button.js +1 -1
  115. package/dist/elements/search.js +1 -1
  116. package/dist/elements/segmented.js +1 -1
  117. package/dist/elements/select.js +1 -1
  118. package/dist/elements/separator.js +1 -1
  119. package/dist/elements/setting-item.js +1 -1
  120. package/dist/elements/settings-group.js +1 -1
  121. package/dist/elements/skeleton.js +1 -1
  122. package/dist/elements/slider.js +1 -1
  123. package/dist/elements/source.js +1 -1
  124. package/dist/elements/status.js +1 -1
  125. package/dist/elements/switch.js +1 -1
  126. package/dist/elements/tabs.js +1 -1
  127. package/dist/elements/tasks.js +1 -1
  128. package/dist/elements/text-shimmer.js +1 -1
  129. package/dist/elements/thinking-bar.js +1 -1
  130. package/dist/elements/thread.js +1 -1
  131. package/dist/elements/toast.js +1 -1
  132. package/dist/elements/tool.js +1 -1
  133. package/dist/elements/tooltip.js +1 -1
  134. package/dist/elements/voice-input.js +1 -1
  135. package/dist/elements/voice-output.js +1 -1
  136. package/dist/elements.d.ts +20 -4
  137. package/dist/{ellipsis-DFr4Vqr3.js → ellipsis-CbOpJnU3.js} +1 -1
  138. package/dist/{embed-5s_vU4J0.js → embed-CrfjkbUG.js} +1 -1
  139. package/dist/{external-link-u9d85ORQ.js → external-link-ByXAwBBQ.js} +1 -1
  140. package/dist/{file-text-CX7_x42o.js → file-text-DMib2qwt.js} +1 -1
  141. package/dist/{file-tree-D3kBjXI5.js → file-tree-CJqM2aP7.js} +1 -1
  142. package/dist/{folder-V-YdIL8f.js → folder-_BAb929C.js} +1 -1
  143. package/dist/{form-BRNUMCN2.js → form-DSZgZQZk.js} +1 -1
  144. package/dist/{hover-card-DaeiYrTA.js → hover-card-BQbul9eq.js} +1 -1
  145. package/dist/{icon-BpixdZNq.js → icon-CdcfRhYI.js} +1 -1
  146. package/dist/index.d.ts +3 -1
  147. package/dist/index.js +2842 -2703
  148. package/dist/index.server.js +2820 -2681
  149. package/dist/{info-8mFsIjS3.js → info-DsFjGuI_.js} +1 -1
  150. package/dist/{input-d1Yuu-hz.js → input-DKbmkMos.js} +1 -1
  151. package/dist/kai.es.js +1 -1
  152. package/dist/{kbd-961zMPFB.js → kbd-PvdGhX4s.js} +1 -1
  153. package/dist/{link-preview-DIIbV2Sd.js → link-preview-DbM1866N.js} +1 -1
  154. package/dist/{link-DlZZBGaR.js → link-zF8PzWfF.js} +1 -1
  155. package/dist/{loader-YQszHFaW.js → loader-BM4CEz4G.js} +1 -1
  156. package/dist/{markdown-CVk1MPsj.js → markdown-LMvmAyBk.js} +7 -7
  157. package/dist/mcp.es.js +78 -4
  158. package/dist/{message-CwKVEdZg.js → message-BSsgvHvf.js} +1 -1
  159. package/dist/{message-DS8lzHc1.js → message-BYZECyek.js} +1 -1
  160. package/dist/message-circle-DruwObfX.js +1 -0
  161. package/dist/message-square-BG6q6mlm.js +1 -0
  162. package/dist/{minimize-2-UEZmP2QT.js → minimize-2-BQRoBV1V.js} +1 -1
  163. package/dist/{model-switcher-Kk1jEQ5t.js → model-switcher-CMpCOYcB.js} +1 -1
  164. package/dist/{overlay-C1od6LOz.js → overlay-Cb-MkyDa.js} +1 -1
  165. package/dist/{panel-right-ryET0yyn.js → panel-right-i8warFxT.js} +1 -1
  166. package/dist/{paperclip-BDNoZFJP.js → paperclip-ByY3UVO6.js} +1 -1
  167. package/dist/play-BvKKq3fX.js +1 -0
  168. package/dist/primitives/conversation-store.d.ts +54 -0
  169. package/dist/{progress-bar-BvYX0aoy.js → progress-bar-jVAHvMUf.js} +1 -1
  170. package/dist/{prompt-suggestion-BRFu2lcu.js → prompt-suggestion-CD-qtNgC.js} +1 -1
  171. package/dist/{radio-DcL23cNJ.js → radio-BsoBMhkF.js} +1 -1
  172. package/dist/react/index.d.ts +393 -0
  173. package/dist/react.js +20 -20
  174. package/dist/{reasoning-Cackq4Rh.js → reasoning-4kBPtlTx.js} +1 -1
  175. package/dist/register-impl-B1hLkrI8.js +424 -0
  176. package/dist/{resizable-Cp9HUYih.js → resizable-uPmY9VY-.js} +1 -1
  177. package/dist/{rotate-ccw-0DLRDHH5.js → rotate-ccw-B2xn93py.js} +1 -1
  178. package/dist/{rotate-cw-DOB9IGcU.js → rotate-cw-CMVLoCyH.js} +1 -1
  179. package/dist/{scroll-area-emVmWP4K.js → scroll-area-BqLUo8ZZ.js} +1 -1
  180. package/dist/{scroll-button-CeP_gv1x.js → scroll-button-DslXiJyL.js} +1 -1
  181. package/dist/{select-CWmu00tS.js → select-2cLRtPGT.js} +1 -1
  182. package/dist/{separator-CE6vly6z.js → separator-BWQtNJcM.js} +1 -1
  183. package/dist/{settings-CE-78SvZ.js → settings-BBR63jLg.js} +1 -1
  184. package/dist/{settings-group-ZFWNxFQR.js → settings-group-B2ciy-Iw.js} +1 -1
  185. package/dist/{skeleton-BebdP4mf.js → skeleton-CkHI-HgC.js} +1 -1
  186. package/dist/{slider-BAKRYUlz.js → slider-DDR9U-i0.js} +1 -1
  187. package/dist/{solid-BE5ui6sy.js → solid-BzCFdL25.js} +7720 -7058
  188. package/dist/{solid-DFhsce3O.js → solid-DruVOXnf.js} +5864 -5283
  189. package/dist/solid.d.ts +6 -2
  190. package/dist/solid.js +217 -210
  191. package/dist/solid.server.js +217 -210
  192. package/dist/{source-B0FlguSx.js → source-GEnFF528.js} +1 -1
  193. package/dist/{star-CBMZvLuN.js → star-CilHq8GP.js} +1 -1
  194. package/dist/store-Ciyk6eZG.js +1 -0
  195. package/dist/{switch-CViARZCy.js → switch-KkeQIbuH.js} +1 -1
  196. package/dist/{tasks-card-MjCcOhR_.js → tasks-card-BrN4bggJ.js} +1 -1
  197. package/dist/{text-shimmer-DKlwRF2G.js → text-shimmer-Dcj1MHuq.js} +1 -1
  198. package/dist/{textarea-3ay2Me2-.js → textarea-Dpvbngbg.js} +1 -1
  199. package/dist/theme.tokens.css +28 -0
  200. package/dist/{thumbs-up-DQcu2HMO.js → thumbs-up-CsT9Wzb9.js} +1 -1
  201. package/dist/{toast-store-C6yKOhbk.js → toast-store-tgK6MuMv.js} +1 -1
  202. package/dist/{tool-BCYNlfKy.js → tool-DzUjIBT8.js} +1 -1
  203. package/dist/{tooltip-05zI4hjs.js → tooltip-Bkkg_4t0.js} +1 -1
  204. package/dist/{trash-2-BR1RxGky.js → trash-2-jBKxjGGQ.js} +1 -1
  205. package/dist/{triangle-alert-DHohDOCy.js → triangle-alert-DlQ68ppf.js} +1 -1
  206. package/dist/types.d.ts +48 -3
  207. package/dist/ui/dock.d.ts +29 -0
  208. package/dist/{upload-BbGW6A_u.js → upload-TcAHXv9W.js} +1 -1
  209. package/dist/{url-scheme-policy-DHpoTJwB.js → url-scheme-policy-DR5DgvkM.js} +1 -1
  210. package/dist/{use-card-resolution-CJW4grFa.js → use-card-resolution-DaZqAdWf.js} +1 -1
  211. package/dist/{variant-aurora-xiMPty8f.js → variant-aurora-BhLuYxJR.js} +1 -1
  212. package/dist/{variant-aurora-BUOVgPOB.js → variant-aurora-CNmfHhcx.js} +2 -2
  213. package/dist/{variant-aurora-CUsUJvFI.js → variant-aurora-D6GsdTPA.js} +2 -2
  214. package/dist/{variant-aurora-CW2i4bfr.js → variant-aurora-DbW_OWL2.js} +1 -1
  215. package/dist/{variant-custom-D91HjAKz.js → variant-custom-BRvaNHSi.js} +1 -1
  216. package/dist/{variant-custom-BQtOnmeO.js → variant-custom-BvYHR62b.js} +1 -1
  217. package/dist/{variant-custom-CAnzzppW.js → variant-custom-DMTrEO5w.js} +2 -2
  218. package/dist/{variant-custom-CAm9L-E5.js → variant-custom-DV2x254s.js} +2 -2
  219. package/dist/{variant-wave-Ca1Ls4_y.js → variant-wave-BNMGrDfj.js} +2 -2
  220. package/dist/{variant-wave-uY5crU_K.js → variant-wave-BpDd8t3Z.js} +1 -1
  221. package/dist/{variant-wave-CxX39DKd.js → variant-wave-CyBueXj9.js} +2 -2
  222. package/dist/{variant-wave-DYyzIIZv.js → variant-wave-sp-qwsdI.js} +1 -1
  223. package/dist/x-Z5UntkIJ.js +1 -0
  224. package/frameworks/react/index.tsx +14 -4
  225. package/llms-full.txt +7 -2
  226. package/package.json +1 -1
  227. package/src/agent-tooling/README.md +192 -0
  228. package/src/agent-tooling/catalog/invariants.ts +2 -2
  229. package/src/agent-tooling/construct/cli.ts +16 -0
  230. package/src/agent-tooling/construct/codegen.ts +309 -27
  231. package/src/agent-tooling/construct/construct.v1.schema.json +69 -0
  232. package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +11 -2
  233. package/src/agent-tooling/construct/schema.ts +81 -0
  234. package/src/components/chat-thread.tsx +532 -36
  235. package/src/components/conversation-item.tsx +23 -0
  236. package/src/components/conversation-panel.tsx +118 -0
  237. package/src/components/home-panel.tsx +159 -0
  238. package/src/components/widget-tab-bar.tsx +73 -0
  239. package/src/elements/chat.tsx +94 -2
  240. package/src/elements/compiled.css +1 -1
  241. package/src/elements/element-meta.json +49 -6
  242. package/src/elements/element-nonscalar.json +2 -0
  243. package/src/elements/element-types.d.ts +20 -4
  244. package/src/index.ts +3 -1
  245. package/src/primitives/conversation-store.ts +248 -0
  246. package/src/solid.ts +10 -2
  247. package/src/types.ts +45 -3
  248. package/src/ui/dock.tsx +47 -1
  249. package/theme.css +28 -0
  250. package/dist/arrow-down-Br0qtpsz.js +0 -1
  251. package/dist/arrow-left-Dj7xgE12.js +0 -1
  252. package/dist/check-DPeeMUYx.js +0 -1
  253. package/dist/chevron-down-CHSWk7ZT.js +0 -1
  254. package/dist/chevron-right-B7l_fMgx.js +0 -1
  255. package/dist/circle-Bb0yOpqM.js +0 -1
  256. package/dist/circle-check-BGZpCiz7.js +0 -1
  257. package/dist/code-block-CUQ5mtv0.js +0 -1
  258. package/dist/controllable-D43BKmtX.js +0 -1
  259. package/dist/conversation-list-D4lLU_yS.js +0 -1
  260. package/dist/define-CGGX-7Vg.js +0 -1
  261. package/dist/message-circle-Xf8Q-vZp.js +0 -1
  262. package/dist/message-square-Cxnwgkns.js +0 -1
  263. package/dist/play-OFIvYXUQ.js +0 -1
  264. package/dist/register-impl-C7rENvPK.js +0 -424
  265. package/dist/store-7eoadydQ.js +0 -1
  266. package/dist/x-C5m1JFgi.js +0 -1
@@ -529,6 +529,274 @@ export interface ChatProps extends WebComponentProps {
529
529
  cardTypes?: Record<string, string>;
530
530
  /** JSON Schemas for the card types this app renders, keyed by envelope type. The companion of `cardTypes`, which says what DRAWS a card while this says what a VALID one looks like. An OBJECT, so it is a JS property only: `el.cardSchemas = { 'pricing-table': pricingSchema }`, never an attribute. `createCardRegistry(...).validationSchemas` is exactly this shape. Without it the kit validates its own seven built-ins and leaves your own card type, the one your app actually cares about, as the only unchecked thing on screen. A schema here WINS over a built-in of the same name. Typed `Record<string, object>` rather than `Record<string, JsonSchema>` deliberately: an imported `.json` schema widens `"type"` to `string`, and an authored one carries `$schema`/`title`/`description`/`additionalProperties`, so the tighter type would reject both of the normal ways to supply one. */
531
531
  cardSchemas?: Record<string, object>;
532
+ /** Turns on the prior-conversations list (a list-toggle button in the header, plus a second list view sharing the panel, C-1). Attribute- settable like every other boolean flag on this element: `<kai-chat conversations>`. Requires `store`. A row select, "new conversation," or the visitor's mount-time auto-restore all deliver their messages the same way: listen for `kai-conversation-load` and set `el.messages` from `event.detail.messages` (a fresh array): this element does not update `messages` for you. Set with no `store`, the underlying `ChatThread` decides loudly (one console.error) and stays visually off; this facade always supplies its own internal load handler (the `kai-conversation-load` dispatch below), so the second ChatThread guard, missing `onConversationLoad`, never trips here, even for a consumer who never listens for the event. Default false. */
533
+ conversations?: boolean;
534
+ /** The adapter this thread persists conversations through: an object of three functions (`list`/`load`/`save`; `ConversationStore`, exported from `@kitn.ai/ui`'s `primitives/conversation-store`). A JS PROPERTY ONLY: `el.store = myAdapter`. It can never be an attribute, since a function-bearing object has no HTML string form, the same reasoning that keeps `messages`/`cardSchemas` property-only (the kai- contract: array/object props are JS properties, never attributes). Two built-ins ship: `localStorageStore(name, userId?)` and `fetchStore(url, userId?)`. */
535
+ store?: {
536
+ list: () => Promise<{
537
+ id: string;
538
+ title: string;
539
+ groupId?: string;
540
+ scope?: {
541
+ type: "document" | "collection";
542
+ documentId?: string;
543
+ filters?: {
544
+ tags?: string[];
545
+ authors?: string[];
546
+ contentType?: "transcript" | "markdown";
547
+ dateRange?: {
548
+ from: string;
549
+ to: string;
550
+ };
551
+ };
552
+ };
553
+ messageCount: number;
554
+ lastMessageAt?: string;
555
+ updatedAt: string;
556
+ trailing?: string;
557
+ lastReadAt?: string;
558
+ }[]>;
559
+ load: (id: string) => Promise<{
560
+ id: string;
561
+ role: "user" | "assistant";
562
+ parts: ({
563
+ type: "text";
564
+ text: string;
565
+ raw?: {
566
+ source: string;
567
+ payload: unknown;
568
+ };
569
+ } | {
570
+ type: "reasoning";
571
+ text: string;
572
+ label?: string;
573
+ index?: number;
574
+ streamId?: string;
575
+ signature?: string;
576
+ raw?: {
577
+ source: string;
578
+ payload: unknown;
579
+ };
580
+ } | {
581
+ type: "tool";
582
+ tool: {
583
+ type: string;
584
+ kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic";
585
+ state: "input-streaming" | "input-available" | "output-available" | "output-error";
586
+ input?: Record<string, unknown>;
587
+ rawInput?: string;
588
+ output?: Record<string, unknown>;
589
+ toolCallId?: string;
590
+ errorText?: string;
591
+ raw?: {
592
+ source: string;
593
+ payload: unknown;
594
+ };
595
+ };
596
+ raw?: {
597
+ source: string;
598
+ payload: unknown;
599
+ };
600
+ } | {
601
+ type: "card";
602
+ envelope: {
603
+ type: string;
604
+ id: string;
605
+ data: unknown;
606
+ title?: string;
607
+ resolution?: {
608
+ kind: "action";
609
+ action: string;
610
+ payload?: unknown;
611
+ at?: string;
612
+ } | {
613
+ kind: "submit";
614
+ data: unknown;
615
+ at?: string;
616
+ } | {
617
+ kind: "dismissed";
618
+ at?: string;
619
+ } | {
620
+ kind: "expired";
621
+ reason?: string;
622
+ at?: string;
623
+ };
624
+ };
625
+ raw?: {
626
+ source: string;
627
+ payload: unknown;
628
+ };
629
+ } | {
630
+ type: "source";
631
+ source: {
632
+ id?: string;
633
+ url?: string;
634
+ title?: string;
635
+ snippet?: string;
636
+ index?: number;
637
+ };
638
+ raw?: {
639
+ source: string;
640
+ payload: unknown;
641
+ };
642
+ } | {
643
+ type: "file";
644
+ attachment: {
645
+ id: string;
646
+ type: "file" | "source-document";
647
+ filename?: string;
648
+ mediaType?: string;
649
+ url?: string;
650
+ title?: string;
651
+ };
652
+ raw?: {
653
+ source: string;
654
+ payload: unknown;
655
+ };
656
+ })[];
657
+ actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | {
658
+ id: string;
659
+ label: string;
660
+ icon?: string;
661
+ tooltip?: string;
662
+ })[];
663
+ avatar?: {
664
+ src?: string;
665
+ fallback?: string;
666
+ alt?: string;
667
+ };
668
+ feedback?: "like" | "dislike";
669
+ }[]>;
670
+ save: (id: string, messages: {
671
+ id: string;
672
+ role: "user" | "assistant";
673
+ parts: ({
674
+ type: "text";
675
+ text: string;
676
+ raw?: {
677
+ source: string;
678
+ payload: unknown;
679
+ };
680
+ } | {
681
+ type: "reasoning";
682
+ text: string;
683
+ label?: string;
684
+ index?: number;
685
+ streamId?: string;
686
+ signature?: string;
687
+ raw?: {
688
+ source: string;
689
+ payload: unknown;
690
+ };
691
+ } | {
692
+ type: "tool";
693
+ tool: {
694
+ type: string;
695
+ kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic";
696
+ state: "input-streaming" | "input-available" | "output-available" | "output-error";
697
+ input?: Record<string, unknown>;
698
+ rawInput?: string;
699
+ output?: Record<string, unknown>;
700
+ toolCallId?: string;
701
+ errorText?: string;
702
+ raw?: {
703
+ source: string;
704
+ payload: unknown;
705
+ };
706
+ };
707
+ raw?: {
708
+ source: string;
709
+ payload: unknown;
710
+ };
711
+ } | {
712
+ type: "card";
713
+ envelope: {
714
+ type: string;
715
+ id: string;
716
+ data: unknown;
717
+ title?: string;
718
+ resolution?: {
719
+ kind: "action";
720
+ action: string;
721
+ payload?: unknown;
722
+ at?: string;
723
+ } | {
724
+ kind: "submit";
725
+ data: unknown;
726
+ at?: string;
727
+ } | {
728
+ kind: "dismissed";
729
+ at?: string;
730
+ } | {
731
+ kind: "expired";
732
+ reason?: string;
733
+ at?: string;
734
+ };
735
+ };
736
+ raw?: {
737
+ source: string;
738
+ payload: unknown;
739
+ };
740
+ } | {
741
+ type: "source";
742
+ source: {
743
+ id?: string;
744
+ url?: string;
745
+ title?: string;
746
+ snippet?: string;
747
+ index?: number;
748
+ };
749
+ raw?: {
750
+ source: string;
751
+ payload: unknown;
752
+ };
753
+ } | {
754
+ type: "file";
755
+ attachment: {
756
+ id: string;
757
+ type: "file" | "source-document";
758
+ filename?: string;
759
+ mediaType?: string;
760
+ url?: string;
761
+ title?: string;
762
+ };
763
+ raw?: {
764
+ source: string;
765
+ payload: unknown;
766
+ };
767
+ })[];
768
+ actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | {
769
+ id: string;
770
+ label: string;
771
+ icon?: string;
772
+ tooltip?: string;
773
+ })[];
774
+ avatar?: {
775
+ src?: string;
776
+ fallback?: string;
777
+ alt?: string;
778
+ };
779
+ feedback?: "like" | "dislike";
780
+ }[]) => Promise<void>;
781
+ markRead?: ((id: string) => Promise<void>);
782
+ };
783
+ /** Turns on the widget home screen (Intercom-pattern): the panel boots into a `home` view, with a greeting, most-recent-conversation card, a "new conversation" CTA, and host-defined links, plus a Home/Messages tab bar for switching back to the thread. An OBJECT, so it is a JS property only: `el.home = { greeting: { title: 'Hey' }, links: [...] }`, never an attribute (the kai- contract: array/object props are JS properties). A `links` entry with no `href` fires `kai-home-link` with that entry when tapped, rather than navigating; one WITH `href` opens it directly (only when the URL passes the kit's own scheme allowlist). Omit for the no-home widget (chat view only, unchanged). */
784
+ home?: {
785
+ greeting?: {
786
+ title?: string;
787
+ subtitle?: string;
788
+ };
789
+ recentConversation?: boolean;
790
+ newConversation?: {
791
+ label?: string;
792
+ };
793
+ links?: {
794
+ label: string;
795
+ href?: string;
796
+ description?: string;
797
+ icon?: string;
798
+ }[];
799
+ };
532
800
  /** The staged attachments changed (file added or removed). Carries the full current list so a consumer can react in real time. */
533
801
  onAttachmentsChange?: (event: CustomEvent<{
534
802
  attachments: {
@@ -548,6 +816,130 @@ export interface ChatProps extends WebComponentProps {
548
816
  reason: "filtered" | "unsupported";
549
817
  }[];
550
818
  }>) => void;
819
+ /** A conversation's history loaded: a row tap in the list, "new conversation," or the visitor's own mount-time auto-restore of their most recent thread (only fires when `conversations` is on and a `store` is set). `detail.id` is that conversation's id, `undefined` for the "new conversation" case (no id exists until the first message mints one, C-6). Set `el.messages = event.detail.messages` (already a fresh array) to actually render it, since this element does not do that for you; `messages` stays your own state like everywhere else on this element. */
820
+ onConversationLoad?: (event: CustomEvent<{
821
+ id: string | undefined;
822
+ messages: {
823
+ id: string;
824
+ role: "user" | "assistant";
825
+ parts: ({
826
+ type: "text";
827
+ text: string;
828
+ raw?: undefined | {
829
+ source: string;
830
+ payload: unknown;
831
+ };
832
+ } | {
833
+ type: "reasoning";
834
+ text: string;
835
+ label?: undefined | string;
836
+ index?: undefined | number;
837
+ streamId?: undefined | string;
838
+ signature?: undefined | string;
839
+ raw?: undefined | {
840
+ source: string;
841
+ payload: unknown;
842
+ };
843
+ } | {
844
+ type: "tool";
845
+ tool: {
846
+ type: string;
847
+ kind?: undefined | "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic";
848
+ state: "input-streaming" | "input-available" | "output-available" | "output-error";
849
+ input?: undefined | Record<string, unknown>;
850
+ rawInput?: undefined | string;
851
+ output?: undefined | Record<string, unknown>;
852
+ toolCallId?: undefined | string;
853
+ errorText?: undefined | string;
854
+ raw?: undefined | {
855
+ source: string;
856
+ payload: unknown;
857
+ };
858
+ };
859
+ raw?: undefined | {
860
+ source: string;
861
+ payload: unknown;
862
+ };
863
+ } | {
864
+ type: "card";
865
+ envelope: {
866
+ type: string;
867
+ id: string;
868
+ data: unknown;
869
+ title?: undefined | string;
870
+ resolution?: undefined | {
871
+ kind: "action";
872
+ action: string;
873
+ payload?: unknown;
874
+ at?: undefined | string;
875
+ } | {
876
+ kind: "submit";
877
+ data: unknown;
878
+ at?: undefined | string;
879
+ } | {
880
+ kind: "dismissed";
881
+ at?: undefined | string;
882
+ } | {
883
+ kind: "expired";
884
+ reason?: undefined | string;
885
+ at?: undefined | string;
886
+ };
887
+ };
888
+ raw?: undefined | {
889
+ source: string;
890
+ payload: unknown;
891
+ };
892
+ } | {
893
+ type: "source";
894
+ source: {
895
+ id?: undefined | string;
896
+ url?: undefined | string;
897
+ title?: undefined | string;
898
+ snippet?: undefined | string;
899
+ index?: undefined | number;
900
+ };
901
+ raw?: undefined | {
902
+ source: string;
903
+ payload: unknown;
904
+ };
905
+ } | {
906
+ type: "file";
907
+ attachment: {
908
+ id: string;
909
+ type: "file" | "source-document";
910
+ filename?: undefined | string;
911
+ mediaType?: undefined | string;
912
+ url?: undefined | string;
913
+ title?: undefined | string;
914
+ };
915
+ raw?: undefined | {
916
+ source: string;
917
+ payload: unknown;
918
+ };
919
+ })[];
920
+ actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit" | {
921
+ id: string;
922
+ label: string;
923
+ icon?: undefined | string;
924
+ tooltip?: undefined | string;
925
+ })[];
926
+ avatar?: undefined | {
927
+ src?: undefined | string;
928
+ fallback?: undefined | string;
929
+ alt?: undefined | string;
930
+ };
931
+ feedback?: undefined | "like" | "dislike";
932
+ }[];
933
+ }>) => void;
934
+ /** A `home.links` entry with no `href` was activated (tapped/clicked/Enter). Meaningful only when `home` is set. */
935
+ onHomeLink?: (event: CustomEvent<{
936
+ entry: {
937
+ label: string;
938
+ href?: undefined | string;
939
+ description?: undefined | string;
940
+ icon?: undefined | string;
941
+ };
942
+ }>) => void;
551
943
  /** An action button on a message was clicked. `action` is the built-in name or custom id. `state` is present only for the toggleable feedback votes: `'on'` when a like/dislike is set, `'off'` when re-tapped to clear. */
552
944
  onMessageAction?: (event: CustomEvent<{
553
945
  messageId: string;
@@ -1016,6 +1408,7 @@ export interface ConversationsProps extends WebComponentProps {
1016
1408
  lastMessageAt?: string;
1017
1409
  updatedAt: string;
1018
1410
  trailing?: string;
1411
+ lastReadAt?: string;
1019
1412
  }[];
1020
1413
  /** The id of the currently-open conversation, highlighted in the list. */
1021
1414
  activeId?: string;
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { forwardRef as M, useRef as x, useImperativeHandle as E, useLayoutEffect as T, createElement as L, useState as I, useCallback as k, useMemo as P } from "react";
2
+ import { forwardRef as M, useRef as x, useImperativeHandle as E, useLayoutEffect as T, createElement as L, useState as I, useCallback as g, useMemo as P } from "react";
3
3
  const O = /* @__PURE__ */ new Set();
4
4
  let w;
5
5
  function V(e, t) {
@@ -25,8 +25,8 @@ function a(e, t, n, i) {
25
25
  const d = l.current;
26
26
  if (!d) return;
27
27
  const h = () => {
28
- for (const g of t)
29
- g in m && m[g] !== void 0 && (d[g] = m[g]);
28
+ for (const k of t)
29
+ k in m && m[k] !== void 0 && (d[k] = m[k]);
30
30
  };
31
31
  h(), typeof customElements < "u" && !customElements.get(e) && customElements.whenDefined(e).then(h);
32
32
  }), T(() => {
@@ -35,14 +35,14 @@ function a(e, t, n, i) {
35
35
  const d = l.current;
36
36
  if (!d) return;
37
37
  const h = [];
38
- for (const [g, f] of r) {
38
+ for (const [k, f] of r) {
39
39
  const C = (y) => {
40
- const S = b.current[g];
40
+ const S = b.current[k];
41
41
  typeof S == "function" && S(y);
42
42
  };
43
43
  d.addEventListener(f, C), h.push([f, C]);
44
44
  }
45
- return () => h.forEach(([g, f]) => d.removeEventListener(g, f));
45
+ return () => h.forEach(([k, f]) => d.removeEventListener(k, f));
46
46
  }, []), L(
47
47
  e,
48
48
  {
@@ -259,10 +259,10 @@ function ee(e, t) {
259
259
  function ne(e = {}) {
260
260
  const [t, n] = I(() => [...e.initialMessages ?? []]), [i, r] = I(() => [...e.initialSuggestions ?? []]), [c, o] = I(!1), s = x(e.onSubmit);
261
261
  s.current = e.onSubmit;
262
- const l = k((u) => n(u), []), m = k((u) => l((p) => _(p, u)), [l]), b = k(
262
+ const l = g((u) => n(u), []), m = g((u) => l((p) => _(p, u)), [l]), b = g(
263
263
  (u, p) => l((A) => Y(A, u, p)),
264
264
  [l]
265
- ), d = k((u) => l((p) => J(p, u)), [l]), h = k((u) => r((p) => Q(p, u)), []), g = k((u) => r((p) => X(p, u)), []), f = k(() => r([]), []), C = k((u) => (o(!0), ee($(l, u), () => o(!1))), [l]), y = k(
265
+ ), d = g((u) => l((p) => J(p, u)), [l]), h = g((u) => r((p) => Q(p, u)), []), k = g((u) => r((p) => X(p, u)), []), f = g(() => r([]), []), C = g((u) => (o(!0), ee($(l, u), () => o(!1))), [l]), y = g(
266
266
  (u) => {
267
267
  var p;
268
268
  (p = s.current) == null || p.call(s, u.detail);
@@ -282,7 +282,7 @@ function ne(e = {}) {
282
282
  update: b,
283
283
  remove: d,
284
284
  addSuggestion: h,
285
- removeSuggestion: g,
285
+ removeSuggestion: k,
286
286
  clearSuggestions: f,
287
287
  streamAssistant: C,
288
288
  bind: S
@@ -296,7 +296,7 @@ function R() {
296
296
  function ie(e) {
297
297
  const t = x(e);
298
298
  t.current = e;
299
- const n = R() !== void 0, i = k(() => {
299
+ const n = R() !== void 0, i = g(() => {
300
300
  const r = R();
301
301
  if (!r) return;
302
302
  const c = new r();
@@ -354,12 +354,12 @@ const oe = /* @__PURE__ */ a(
354
354
  ["theme", "steps", "type", "value", "defaultValue"],
355
355
  { onValueChange: "kai-value-change" },
356
356
  () => import("@kitn.ai/ui/elements/chain-of-thought")
357
- ), ge = /* @__PURE__ */ a(
357
+ ), ke = /* @__PURE__ */ a(
358
358
  "kai-chat",
359
- ["theme", "value", "placeholder", "loading", "suggestions", "suggestionMode", "persistSuggestions", "proseSize", "codeTheme", "codeHighlight", "reasoning", "reasoningOpen", "chatTitle", "models", "currentModel", "context", "scrollButton", "headerStart", "headerEnd", "headerFull", "sidebar", "empty", "composer", "composerActions", "footer", "attach", "webSearch", "voice", "triggers", "kindIcons", "actionsReveal", "accept", "messages", "cardTypes", "cardSchemas"],
360
- { onAttachmentsChange: "kai-attachments-change", onAttachmentsRejected: "kai-attachments-rejected", onMessageAction: "kai-message-action", onModelChange: "kai-model-change", onSubmit: "kai-submit", onSuggestionClick: "kai-suggestion-click", onValueChange: "kai-value-change", onVoice: "kai-voice", onWebSearch: "kai-web-search" },
359
+ ["theme", "value", "placeholder", "loading", "suggestions", "suggestionMode", "persistSuggestions", "proseSize", "codeTheme", "codeHighlight", "reasoning", "reasoningOpen", "chatTitle", "models", "currentModel", "context", "scrollButton", "headerStart", "headerEnd", "headerFull", "sidebar", "empty", "composer", "composerActions", "footer", "attach", "webSearch", "voice", "triggers", "kindIcons", "actionsReveal", "accept", "messages", "cardTypes", "cardSchemas", "conversations", "store", "home"],
360
+ { onAttachmentsChange: "kai-attachments-change", onAttachmentsRejected: "kai-attachments-rejected", onConversationLoad: "kai-conversation-load", onHomeLink: "kai-home-link", onMessageAction: "kai-message-action", onModelChange: "kai-model-change", onSubmit: "kai-submit", onSuggestionClick: "kai-suggestion-click", onValueChange: "kai-value-change", onVoice: "kai-voice", onWebSearch: "kai-web-search" },
361
361
  () => import("@kitn.ai/ui/elements/chat")
362
- ), ke = /* @__PURE__ */ a(
362
+ ), ge = /* @__PURE__ */ a(
363
363
  "kai-checkbox",
364
364
  ["theme", "checked", "defaultChecked", "indeterminate", "disabled", "required", "label", "name", "value"],
365
365
  { onChange: "kai-change" },
@@ -624,12 +624,12 @@ const oe = /* @__PURE__ */ a(
624
624
  ["theme", "for", "variant", "size", "label", "showLabel"],
625
625
  { onScroll: "kai-scroll" },
626
626
  () => import("@kitn.ai/ui/elements/scroll-button")
627
- ), gt = /* @__PURE__ */ a(
627
+ ), kt = /* @__PURE__ */ a(
628
628
  "kai-search",
629
629
  ["theme", "value", "placeholder", "icon", "debounce", "loading", "shortcut"],
630
630
  { onChange: "kai-change", onSearch: "kai-search", onSubmit: "kai-submit" },
631
631
  () => import("@kitn.ai/ui/elements/search")
632
- ), kt = /* @__PURE__ */ a(
632
+ ), gt = /* @__PURE__ */ a(
633
633
  "kai-segmented",
634
634
  ["theme", "options", "value", "size"],
635
635
  { onChange: "kai-change" },
@@ -761,8 +761,8 @@ export {
761
761
  ue as Card,
762
762
  pe as Cards,
763
763
  he as ChainOfThought,
764
- ge as Chat,
765
- ke as Checkbox,
764
+ ke as Chat,
765
+ ge as Checkbox,
766
766
  be as CheckboxGroup,
767
767
  fe as Checkpoint,
768
768
  ve as Choice,
@@ -815,8 +815,8 @@ export {
815
815
  ut as Screen,
816
816
  pt as ScrollArea,
817
817
  ht as ScrollButton,
818
- gt as Search,
819
- kt as Segmented,
818
+ kt as Search,
819
+ gt as Segmented,
820
820
  bt as Select,
821
821
  ft as Separator,
822
822
  vt as SettingItem,
@@ -1 +1 @@
1
- import{s as b,g as y,j as R,w as z,c as f,i as h,a as x,b as O,u as w,d as S,p as k,q as H,S as $,t as m,B as A,G as B,h as E,e as M}from"./define-CGGX-7Vg.js";import{c as v}from"./cn-DN5AWfiS.js";import{M as j}from"./markdown-CVk1MPsj.js";import{T as q}from"./text-shimmer-DKlwRF2G.js";import{c as G}from"./chevron-down-CHSWk7ZT.js";const N=1;function P(l,r){let e=-1;const s=new ResizeObserver(c=>{var d;const t=((d=c[c.length-1])==null?void 0:d.contentRect.height)??l.getBoundingClientRect().height;(e<0||Math.abs(t-e)>N)&&(e=t,r(t))});return s.observe(l),()=>s.disconnect()}var D=m("<div>"),F=m("<button type=button><div>"),L=m("<span class=text-foreground>"),V=m("<div style=max-height:0px><div>");const I=A();function T(){const l=B(I);if(!l)throw new Error("useReasoningContext must be used within a Reasoning provider");return l}function X(l){var r;const[e]=b(l,["children","class","open","defaultOpen","onOpenChange","isStreaming","disabled","controllerRef","openOnStream"]),[s,c]=y(e.defaultOpen??!1),[d,t]=y(!1),a=()=>e.open!==void 0,g=()=>a()?e.open:s(),n=()=>!!e.disabled,o=i=>{var C;g()!==i&&(a()||c(i),(C=e.onOpenChange)==null||C.call(e,i))};R(()=>{if(!e.openOnStream)return;const i=e.isStreaming;i&&!d()&&(a()||c(!0),t(!0)),!i&&d()&&(a()||c(!1),t(!1))}),(r=e.controllerRef)==null||r.call(e,{open:g,setOpen:o});const u=z();let p;return f(I.Provider,{value:{isOpen:g,onOpenChange:o,disabled:n,contentId:u,registerTrigger:i=>{p=i},trigger:()=>p,isStreaming:()=>!!e.isStreaming},get children(){var i=D();return h(i,()=>e.children),x(()=>O(i,e.class)),i}})}function Y(l){const[r,e]=b(l,["children","class","ref"]),{isOpen:s,onOpenChange:c,disabled:d,contentId:t,registerTrigger:a,isStreaming:g}=T();return(()=>{var n=F(),o=n.firstChild;return n.$$click=()=>{d()||c(!s())},w(u=>{a(u),typeof r.ref=="function"&&r.ref(u)},n),S(n,"aria-controls",t),k(n,H({get class(){return v("flex cursor-pointer items-center gap-2 text-meta",r.class)},get disabled(){return d()||void 0},get"aria-expanded"(){return s()},get"data-expanded"(){return s()?"":void 0},get"data-closed"(){return s()?void 0:""},get"data-state"(){return s()?"open":"closed"}},e),!1,!0),h(n,f($,{get when(){return g()},get fallback(){return(()=>{var u=L();return h(u,()=>r.children),u})()},get children(){return f(q,{class:"font-medium",get children(){return r.children}})}}),o),h(o,f(G,{class:"size-4"})),x(()=>O(o,v("transform transition-transform",s()?"rotate-180":""))),n})()}function _(l){const[r,e]=b(l,["children","class","contentClass","markdown"]),{isOpen:s,contentId:c,trigger:d}=T();let t,a;const g=()=>{var n;if(!t)return;const o=t.getRootNode().activeElement;o&&t.contains(o)&&((n=d())==null||n.focus())};return R(()=>{if(!t||!a)return;const n=P(a,()=>{t&&a&&s()&&(t.style.maxHeight=`${a.scrollHeight}px`)});s()?(t.style.maxHeight=`${a.scrollHeight}px`,t.removeAttribute("inert")):(t.style.maxHeight="0px",g(),t.setAttribute("inert","")),E(n)}),(()=>{var n=V(),o=n.firstChild,u=t;typeof u=="function"?w(u,n):t=n,S(n,"id",c),k(n,H({get class(){return v("overflow-hidden transition-[max-height] duration-150 ease-out",r.class)},get"data-state"(){return s()?"open":"closed"}},e),!1,!0);var p=a;return typeof p=="function"?w(p,o):a=o,h(o,f($,{get when(){return r.markdown},get fallback(){return r.children},get children(){return f(j,{get content(){return r.children}})}})),x(()=>O(o,v("text-muted-foreground text-body",r.contentClass))),n})()}M(["click"]);export{X as R,Y as a,_ as b};
1
+ import{s as b,g as y,j as R,w as z,c as f,i as h,a as x,b as O,u as w,d as S,p as k,q as H,S as $,t as m,G as A,H as E,h as M,e as j}from"./define-By-uL588.js";import{c as v}from"./cn-DN5AWfiS.js";import{M as q}from"./markdown-LMvmAyBk.js";import{T as B}from"./text-shimmer-Dcj1MHuq.js";import{c as G}from"./chevron-down-B72s6PXR.js";const N=1;function P(l,r){let e=-1;const s=new ResizeObserver(c=>{var d;const t=((d=c[c.length-1])==null?void 0:d.contentRect.height)??l.getBoundingClientRect().height;(e<0||Math.abs(t-e)>N)&&(e=t,r(t))});return s.observe(l),()=>s.disconnect()}var D=m("<div>"),F=m("<button type=button><div>"),L=m("<span class=text-foreground>"),V=m("<div style=max-height:0px><div>");const I=A();function T(){const l=E(I);if(!l)throw new Error("useReasoningContext must be used within a Reasoning provider");return l}function X(l){var r;const[e]=b(l,["children","class","open","defaultOpen","onOpenChange","isStreaming","disabled","controllerRef","openOnStream"]),[s,c]=y(e.defaultOpen??!1),[d,t]=y(!1),a=()=>e.open!==void 0,g=()=>a()?e.open:s(),n=()=>!!e.disabled,o=i=>{var C;g()!==i&&(a()||c(i),(C=e.onOpenChange)==null||C.call(e,i))};R(()=>{if(!e.openOnStream)return;const i=e.isStreaming;i&&!d()&&(a()||c(!0),t(!0)),!i&&d()&&(a()||c(!1),t(!1))}),(r=e.controllerRef)==null||r.call(e,{open:g,setOpen:o});const u=z();let p;return f(I.Provider,{value:{isOpen:g,onOpenChange:o,disabled:n,contentId:u,registerTrigger:i=>{p=i},trigger:()=>p,isStreaming:()=>!!e.isStreaming},get children(){var i=D();return h(i,()=>e.children),x(()=>O(i,e.class)),i}})}function Y(l){const[r,e]=b(l,["children","class","ref"]),{isOpen:s,onOpenChange:c,disabled:d,contentId:t,registerTrigger:a,isStreaming:g}=T();return(()=>{var n=F(),o=n.firstChild;return n.$$click=()=>{d()||c(!s())},w(u=>{a(u),typeof r.ref=="function"&&r.ref(u)},n),S(n,"aria-controls",t),k(n,H({get class(){return v("flex cursor-pointer items-center gap-2 text-meta",r.class)},get disabled(){return d()||void 0},get"aria-expanded"(){return s()},get"data-expanded"(){return s()?"":void 0},get"data-closed"(){return s()?void 0:""},get"data-state"(){return s()?"open":"closed"}},e),!1,!0),h(n,f($,{get when(){return g()},get fallback(){return(()=>{var u=L();return h(u,()=>r.children),u})()},get children(){return f(B,{class:"font-medium",get children(){return r.children}})}}),o),h(o,f(G,{class:"size-4"})),x(()=>O(o,v("transform transition-transform",s()?"rotate-180":""))),n})()}function _(l){const[r,e]=b(l,["children","class","contentClass","markdown"]),{isOpen:s,contentId:c,trigger:d}=T();let t,a;const g=()=>{var n;if(!t)return;const o=t.getRootNode().activeElement;o&&t.contains(o)&&((n=d())==null||n.focus())};return R(()=>{if(!t||!a)return;const n=P(a,()=>{t&&a&&s()&&(t.style.maxHeight=`${a.scrollHeight}px`)});s()?(t.style.maxHeight=`${a.scrollHeight}px`,t.removeAttribute("inert")):(t.style.maxHeight="0px",g(),t.setAttribute("inert","")),M(n)}),(()=>{var n=V(),o=n.firstChild,u=t;typeof u=="function"?w(u,n):t=n,S(n,"id",c),k(n,H({get class(){return v("overflow-hidden transition-[max-height] duration-150 ease-out",r.class)},get"data-state"(){return s()?"open":"closed"}},e),!1,!0);var p=a;return typeof p=="function"?w(p,o):a=o,h(o,f($,{get when(){return r.markdown},get fallback(){return r.children},get children(){return f(q,{get content(){return r.children}})}})),x(()=>O(o,v("text-muted-foreground text-body",r.contentClass))),n})()}j(["click"]);export{X as R,Y as a,_ as b};