@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
@@ -440,7 +440,7 @@ export interface KaiCardsElement extends HTMLElement {
440
440
  /** JSON Schemas for the card types this app renders, keyed by envelope type. The companion of `types`, 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.schemas = { '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, matching `mergeCardTags`, where your entry is spread over ours. 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. See `CardSchemaMap` in components/card-renderer.tsx. */
441
441
  schemas?: Record<string, object>;
442
442
  /** Optional CardPolicy handling child events. Property: `el.policy`. */
443
- policy?: { onSubmit?: ((cardId: string, data: unknown) => void); onAction?: ((cardId: string, action: string, payload?: unknown) => void); onSendPrompt?: ((text: string, opts: { mode: "compose" | "send"; context?: unknown; }) => void); onOpen?: ((url: string, target: "tab" | "artifact") => void); onState?: ((cardId: string, patch: unknown) => void); onDismiss?: ((cardId: string) => void); onReopen?: ((cardId: string) => void); onError?: ((cardId: string, message: string) => void); maxSendPromptMode?: "compose" | "send" };
443
+ policy?: { onSubmit?: ((cardId: string, data: unknown) => void); onAction?: ((cardId: string, action: string, payload?: unknown) => void); onSendPrompt?: ((text: string, opts: { mode: "compose" | "send"; context?: unknown }) => void); onOpen?: ((url: string, target: "tab" | "artifact") => void); onState?: ((cardId: string, patch: unknown) => void); onDismiss?: ((cardId: string) => void); onReopen?: ((cardId: string) => void); onError?: ((cardId: string, message: string) => void); maxSendPromptMode?: "compose" | "send" };
444
444
  /** Validate each envelope's `data` against the schema for its type before rendering it, using a built-in's own schema or yours from `schemas`. Default `true`; set `validate-cards="false"` (or `el.validateCards = false`) to opt out. A hard failure (wrong type, a missing required field) renders a diagnostic naming the field instead of the card; a soft failure (bounds) renders the card unchanged. Both emit a contract `error` event. On in production too: a model emitting a bad shape is a production failure mode, so stripping the check there would hide it from exactly the person who needs to see it. */
445
445
  validateCards?: boolean;
446
446
  /** Programmatically resolve a child card by id: set that envelope's `resolution` so the child re-renders into its read-only/resolved view. The imperative twin of the consumer mutating the cards array. No-op for an unknown id. */
@@ -541,6 +541,12 @@ export interface KaiChatElement extends HTMLElement {
541
541
  cardTypes?: Record<string, string>;
542
542
  /** 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. */
543
543
  cardSchemas?: Record<string, object>;
544
+ /** 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. */
545
+ conversations?: boolean;
546
+ /** 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?)`. */
547
+ store?: { list: () => Promise<{ id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string; lastReadAt?: string }[]>; load: (id: string) => Promise<{ id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; raw?: { source: string; payload: unknown } } | { type: "reasoning"; text: string; label?: string; index?: number; streamId?: string; signature?: string; raw?: { source: string; payload: unknown } } | { type: "tool"; tool: { type: string; kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic"; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; rawInput?: string; output?: Record<string, unknown>; toolCallId?: string; errorText?: string; raw?: { source: string; payload: unknown } }; raw?: { source: string; payload: unknown } } | { type: "card"; envelope: { type: string; id: string; data: unknown; title?: string; resolution?: { kind: "action"; action: string; payload?: unknown; at?: string } | { kind: "submit"; data: unknown; at?: string } | { kind: "dismissed"; at?: string } | { kind: "expired"; reason?: string; at?: string } }; raw?: { source: string; payload: unknown } } | { type: "source"; source: { id?: string; url?: string; title?: string; snippet?: string; index?: number }; raw?: { source: string; payload: unknown } } | { type: "file"; attachment: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }; raw?: { source: string; payload: unknown } })[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: string; tooltip?: string })[]; avatar?: { src?: string; fallback?: string; alt?: string }; feedback?: "like" | "dislike" }[]>; save: (id: string, messages: { id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; raw?: { source: string; payload: unknown } } | { type: "reasoning"; text: string; label?: string; index?: number; streamId?: string; signature?: string; raw?: { source: string; payload: unknown } } | { type: "tool"; tool: { type: string; kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic"; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; rawInput?: string; output?: Record<string, unknown>; toolCallId?: string; errorText?: string; raw?: { source: string; payload: unknown } }; raw?: { source: string; payload: unknown } } | { type: "card"; envelope: { type: string; id: string; data: unknown; title?: string; resolution?: { kind: "action"; action: string; payload?: unknown; at?: string } | { kind: "submit"; data: unknown; at?: string } | { kind: "dismissed"; at?: string } | { kind: "expired"; reason?: string; at?: string } }; raw?: { source: string; payload: unknown } } | { type: "source"; source: { id?: string; url?: string; title?: string; snippet?: string; index?: number }; raw?: { source: string; payload: unknown } } | { type: "file"; attachment: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }; raw?: { source: string; payload: unknown } })[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: string; tooltip?: string })[]; avatar?: { src?: string; fallback?: string; alt?: string }; feedback?: "like" | "dislike" }[]) => Promise<void>; markRead?: ((id: string) => Promise<void>) };
548
+ /** 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). */
549
+ home?: { greeting?: { title?: string; subtitle?: string }; recentConversation?: boolean; newConversation?: { label?: string }; links?: { label: string; href?: string; description?: string; icon?: string }[] };
544
550
  /** Focus the composer, meaning the contenteditable (or textarea) inside the shadow root. A native `focus()` on the host lands on the host itself and never reaches it, so this is the only way to focus the input programmatically. */
545
551
  focus(options?: FocusOptions): void;
546
552
  /** Blur whatever currently holds focus inside the shadow root. The companion to `focus()`, for the same reason: a native `blur()` on the host misses the real focus target. */
@@ -803,7 +809,7 @@ export interface KaiConversationsElement extends HTMLElement {
803
809
  /** The list's section headers (`{ id, name, sortOrder, createdAt }`), rendered in array order. A group carries no conversations of its own; it is matched against `conversations` by id, so the two props are complementary rather than alternatives. Omit for an ungrouped list. Set as a JS property. */
804
810
  groups: { id: string; userId?: string; teamId?: string; name: string; sortOrder: number; createdAt: string }[];
805
811
  /** Every conversation the list renders, flat. Each one is filed under the group whose `id` equals its `groupId`; one with no `groupId`, or with a `groupId` matching no entry in `groups`, falls into a trailing "Ungrouped" section, so nothing you pass in is ever dropped. There is no recency bucketing. Set as a JS property. Omit to supply them as `<kai-conversation>` light-DOM children instead, or for the empty state. A search query that matches nothing shows a visible "No conversations match your search" state, distinct from the zero-conversations empty state. Slotted `<kai-conversation-item>` children switch the list into item mode instead: your own rows win and this array is not rendered. */
806
- conversations: { id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string }[];
812
+ conversations: { id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string; lastReadAt?: string }[];
807
813
  /** The id of the currently-open conversation, highlighted in the list. */
808
814
  activeId?: string;
809
815
  /** Controlled collapsed state. Set as a JS property (`el.collapsed = true`) to drive the rail from your app, updating it in response to `kai-collapse-toggle`. Omit for uncontrolled (the element manages it). Collapsed shrinks the rail to a floating reopen button. */
@@ -2391,7 +2397,7 @@ export interface KaiCardsElementProps {
2391
2397
  /** JSON Schemas for the card types this app renders, keyed by envelope type. The companion of `types`, 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.schemas = { '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, matching `mergeCardTags`, where your entry is spread over ours. 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. See `CardSchemaMap` in components/card-renderer.tsx. */
2392
2398
  schemas?: Record<string, object>;
2393
2399
  /** Optional CardPolicy handling child events. Property: `el.policy`. */
2394
- policy?: { onSubmit?: ((cardId: string, data: unknown) => void); onAction?: ((cardId: string, action: string, payload?: unknown) => void); onSendPrompt?: ((text: string, opts: { mode: "compose" | "send"; context?: unknown; }) => void); onOpen?: ((url: string, target: "tab" | "artifact") => void); onState?: ((cardId: string, patch: unknown) => void); onDismiss?: ((cardId: string) => void); onReopen?: ((cardId: string) => void); onError?: ((cardId: string, message: string) => void); maxSendPromptMode?: "compose" | "send" };
2400
+ policy?: { onSubmit?: ((cardId: string, data: unknown) => void); onAction?: ((cardId: string, action: string, payload?: unknown) => void); onSendPrompt?: ((text: string, opts: { mode: "compose" | "send"; context?: unknown }) => void); onOpen?: ((url: string, target: "tab" | "artifact") => void); onState?: ((cardId: string, patch: unknown) => void); onDismiss?: ((cardId: string) => void); onReopen?: ((cardId: string) => void); onError?: ((cardId: string, message: string) => void); maxSendPromptMode?: "compose" | "send" };
2395
2401
  /** Validate each envelope's `data` against the schema for its type before rendering it, using a built-in's own schema or yours from `schemas`. Default `true`; set `validate-cards="false"` (or `el.validateCards = false`) to opt out. A hard failure (wrong type, a missing required field) renders a diagnostic naming the field instead of the card; a soft failure (bounds) renders the card unchanged. Both emit a contract `error` event. On in production too: a model emitting a bad shape is a production failure mode, so stripping the check there would hide it from exactly the person who needs to see it. */
2396
2402
  validateCards?: boolean;
2397
2403
  }
@@ -2480,6 +2486,12 @@ export interface KaiChatElementProps {
2480
2486
  cardTypes?: Record<string, string>;
2481
2487
  /** 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. */
2482
2488
  cardSchemas?: Record<string, object>;
2489
+ /** 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. */
2490
+ conversations?: boolean;
2491
+ /** 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?)`. */
2492
+ store?: { list: () => Promise<{ id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string; lastReadAt?: string }[]>; load: (id: string) => Promise<{ id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; raw?: { source: string; payload: unknown } } | { type: "reasoning"; text: string; label?: string; index?: number; streamId?: string; signature?: string; raw?: { source: string; payload: unknown } } | { type: "tool"; tool: { type: string; kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic"; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; rawInput?: string; output?: Record<string, unknown>; toolCallId?: string; errorText?: string; raw?: { source: string; payload: unknown } }; raw?: { source: string; payload: unknown } } | { type: "card"; envelope: { type: string; id: string; data: unknown; title?: string; resolution?: { kind: "action"; action: string; payload?: unknown; at?: string } | { kind: "submit"; data: unknown; at?: string } | { kind: "dismissed"; at?: string } | { kind: "expired"; reason?: string; at?: string } }; raw?: { source: string; payload: unknown } } | { type: "source"; source: { id?: string; url?: string; title?: string; snippet?: string; index?: number }; raw?: { source: string; payload: unknown } } | { type: "file"; attachment: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }; raw?: { source: string; payload: unknown } })[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: string; tooltip?: string })[]; avatar?: { src?: string; fallback?: string; alt?: string }; feedback?: "like" | "dislike" }[]>; save: (id: string, messages: { id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; raw?: { source: string; payload: unknown } } | { type: "reasoning"; text: string; label?: string; index?: number; streamId?: string; signature?: string; raw?: { source: string; payload: unknown } } | { type: "tool"; tool: { type: string; kind?: "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic"; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; rawInput?: string; output?: Record<string, unknown>; toolCallId?: string; errorText?: string; raw?: { source: string; payload: unknown } }; raw?: { source: string; payload: unknown } } | { type: "card"; envelope: { type: string; id: string; data: unknown; title?: string; resolution?: { kind: "action"; action: string; payload?: unknown; at?: string } | { kind: "submit"; data: unknown; at?: string } | { kind: "dismissed"; at?: string } | { kind: "expired"; reason?: string; at?: string } }; raw?: { source: string; payload: unknown } } | { type: "source"; source: { id?: string; url?: string; title?: string; snippet?: string; index?: number }; raw?: { source: string; payload: unknown } } | { type: "file"; attachment: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }; raw?: { source: string; payload: unknown } })[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: string; tooltip?: string })[]; avatar?: { src?: string; fallback?: string; alt?: string }; feedback?: "like" | "dislike" }[]) => Promise<void>; markRead?: ((id: string) => Promise<void>) };
2493
+ /** 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). */
2494
+ home?: { greeting?: { title?: string; subtitle?: string }; recentConversation?: boolean; newConversation?: { label?: string }; links?: { label: string; href?: string; description?: string; icon?: string }[] };
2483
2495
  }
2484
2496
 
2485
2497
  export interface KaiCheckboxElementProps {
@@ -2682,7 +2694,7 @@ export interface KaiConversationsElementProps {
2682
2694
  /** The list's section headers (`{ id, name, sortOrder, createdAt }`), rendered in array order. A group carries no conversations of its own; it is matched against `conversations` by id, so the two props are complementary rather than alternatives. Omit for an ungrouped list. Set as a JS property. */
2683
2695
  groups?: { id: string; userId?: string; teamId?: string; name: string; sortOrder: number; createdAt: string }[];
2684
2696
  /** Every conversation the list renders, flat. Each one is filed under the group whose `id` equals its `groupId`; one with no `groupId`, or with a `groupId` matching no entry in `groups`, falls into a trailing "Ungrouped" section, so nothing you pass in is ever dropped. There is no recency bucketing. Set as a JS property. Omit to supply them as `<kai-conversation>` light-DOM children instead, or for the empty state. A search query that matches nothing shows a visible "No conversations match your search" state, distinct from the zero-conversations empty state. Slotted `<kai-conversation-item>` children switch the list into item mode instead: your own rows win and this array is not rendered. */
2685
- conversations?: { id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string }[];
2697
+ conversations?: { id: string; title: string; groupId?: string; scope?: { type: "document" | "collection"; documentId?: string; filters?: { tags?: string[]; authors?: string[]; contentType?: "transcript" | "markdown"; dateRange?: { from: string; to: string } } }; messageCount: number; lastMessageAt?: string; updatedAt: string; trailing?: string; lastReadAt?: string }[];
2686
2698
  /** The id of the currently-open conversation, highlighted in the list. */
2687
2699
  activeId?: string;
2688
2700
  /** Controlled collapsed state. Set as a JS property (`el.collapsed = true`) to drive the rail from your app, updating it in response to `kai-collapse-toggle`. Omit for uncontrolled (the element manages it). Collapsed shrinks the rail to a floating reopen button. */
@@ -3758,6 +3770,10 @@ export interface KaiChatElementEvents {
3758
3770
  onKaiAttachmentsChange?: (event: CustomEvent<{ attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
3759
3771
  /** One or more picked files were refused because `accept` excluded them. The element renders NO message of its own: it reports the facts (name, media type, whether the kit could have sent it) and what the user should see is the application's call. Only ever fires when `accept` is set. */
3760
3772
  onKaiAttachmentsRejected?: (event: CustomEvent<{ rejected: { filename: string; mediaType: string; reason: "filtered" | "unsupported" }[] }>) => void;
3773
+ /** 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. */
3774
+ onKaiConversationLoad?: (event: CustomEvent<{ id: string | undefined; messages: { id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; raw?: undefined | { source: string; payload: unknown } } | { type: "reasoning"; text: string; label?: undefined | string; index?: undefined | number; streamId?: undefined | string; signature?: undefined | string; raw?: undefined | { source: string; payload: unknown } } | { type: "tool"; tool: { type: string; kind?: undefined | "command" | "file-change" | "search" | "fetch" | "mcp" | "image" | "generic"; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; rawInput?: undefined | string; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string; raw?: undefined | { source: string; payload: unknown } }; raw?: undefined | { source: string; payload: unknown } } | { type: "card"; envelope: { type: string; id: string; data: unknown; title?: undefined | string; resolution?: undefined | { kind: "action"; action: string; payload?: unknown; at?: undefined | string } | { kind: "submit"; data: unknown; at?: undefined | string } | { kind: "dismissed"; at?: undefined | string } | { kind: "expired"; reason?: undefined | string; at?: undefined | string } }; raw?: undefined | { source: string; payload: unknown } } | { type: "source"; source: { id?: undefined | string; url?: undefined | string; title?: undefined | string; snippet?: undefined | string; index?: undefined | number }; raw?: undefined | { source: string; payload: unknown } } | { type: "file"; attachment: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }; raw?: undefined | { source: string; payload: unknown } })[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: undefined | string; tooltip?: undefined | string })[]; avatar?: undefined | { src?: undefined | string; fallback?: undefined | string; alt?: undefined | string }; feedback?: undefined | "like" | "dislike" }[] }>) => void;
3775
+ /** A `home.links` entry with no `href` was activated (tapped/clicked/Enter). Meaningful only when `home` is set. */
3776
+ onKaiHomeLink?: (event: CustomEvent<{ entry: { label: string; href?: undefined | string; description?: undefined | string; icon?: undefined | string } }>) => void;
3761
3777
  /** 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. */
3762
3778
  onKaiMessageAction?: (event: CustomEvent<{ messageId: string; action: string; state?: undefined | "on" | "off" }>) => void;
3763
3779
  /** The header model switcher changed. */
@@ -1 +1 @@
1
- import{I as r}from"./Icon-BnFKqqtY.js";import{c as e,q as i}from"./define-CGGX-7Vg.js";var l=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],a=c=>e(r,i(c,{name:"Ellipsis",iconNode:l})),o=a;export{o as e};
1
+ import{I as r}from"./Icon-DObhsRtm.js";import{c as e,q as i}from"./define-By-uL588.js";var l=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],a=c=>e(r,i(c,{name:"Ellipsis",iconNode:l})),o=a;export{o as e};
@@ -1 +1 @@
1
- import{c as l,q as A,s as G,g as P,k as g,o as H,j as D,x as M,p as J,i as u,S as w,u as K,a as y,d as m,l as Q,t as f,e as W}from"./define-CGGX-7Vg.js";import{c as X}from"./cn-DN5AWfiS.js";import{p as ee}from"./play-OFIvYXUQ.js";import{e as re}from"./external-link-u9d85ORQ.js";import{t as te}from"./triangle-alert-DHohDOCy.js";import{I as oe}from"./Icon-BnFKqqtY.js";var ne=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ae=e=>l(oe,A(e,{name:"Video",iconNode:ne})),ie=ae;const k="allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",$="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",se=new Set;function le(e){const r=N(e);return r!==void 0&&se.has(r)}function N(e){try{return new URL(e).origin}catch{return}}function O(e){let r;try{r=new URL(e)}catch{return}const n=r.hostname.replace(/^www\./,"");if(n==="youtu.be")return E(r.pathname.slice(1));if(n==="youtube.com"||n==="m.youtube.com"||n==="youtube-nocookie.com"){const i=r.searchParams.get("v");if(i)return E(i);const h=r.pathname.match(/^\/(?:shorts|embed|v)\/([^/?#]+)/);if(h)return E(h[1])}}function T(e){let r;try{r=new URL(e)}catch{return}const n=r.hostname.replace(/^www\./,"");if(n!=="vimeo.com"&&n!=="player.vimeo.com")return;const i=r.pathname.match(/(?:^|\/)(\d+)(?:\/|$)/);return i?i[1]:void 0}function E(e){return/^[A-Za-z0-9_-]+$/.test(e)?e:void 0}function ue(e){const r=e.start?`&start=${e.start}`:"";switch(e.provider){case"youtube":{const n=e.id??(e.url?O(e.url):void 0);if(!n)throw new Error("youtube embed: missing or unparseable id/url");return{embedUrl:`https://www.youtube-nocookie.com/embed/${n}?autoplay=1&rel=0${r}`,posterUrl:e.poster??`https://i.ytimg.com/vi/${n}/hqdefault.jpg`,sandbox:k,allow:$}}case"vimeo":{const n=e.id??(e.url?T(e.url):void 0);if(!n)throw new Error("vimeo embed: missing or unparseable id/url");return{embedUrl:`https://player.vimeo.com/video/${n}?autoplay=1&dnt=1${e.start?`#t=${e.start}s`:""}`,posterUrl:e.poster,sandbox:k,allow:$}}case"generic":{if(!e.url)throw new Error("generic embed: missing url");if(ce(e.url),!le(e.url))throw new Error(`generic embed: origin not allowlisted \u2014 call configureEmbedAllowlist([...]) to permit ${N(e.url)??e.url}`);return{embedUrl:e.url,posterUrl:e.poster,sandbox:k,allow:$}}}}function ce(e){let r;try{r=new URL(e).protocol}catch{throw new Error(`generic embed: invalid url "${e}"`)}if(r!=="https:")throw new Error(`generic embed: only https player URLs are allowed (got ${r})`)}function de(e){switch(e.provider){case"youtube":{const r=e.id??(e.url?O(e.url):void 0);return r?`https://www.youtube.com/watch?v=${r}`:e.url}case"vimeo":{const r=e.id??(e.url?T(e.url):void 0);return r?`https://vimeo.com/${r}`:e.url}case"generic":return e.url}}function me(e){switch(e){case"youtube":return"YouTube";case"vimeo":return"Vimeo";case"generic":return"site"}}function fe(e){switch(e){case"4:3":return"4 / 3";case"1:1":return"1 / 1";case"9:16":return"9 / 16";default:return"16 / 9"}}var pe=f('<div tabindex=-1 class="absolute inset-0 outline-none"><iframe allowfullscreen class="absolute inset-0 h-full w-full border-0">'),ve=f('<button type=button class="inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">Open on '),be=f('<div><div class="relative w-full bg-black"></div><div class="flex items-center justify-between gap-2 px-3 py-2"><span class="flex min-w-0 items-center gap-1.5 text-sm text-foreground"><span class=truncate>'),he=f(`<div role=img aria-label="Can't load this video"class="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-muted p-4 text-center text-sm text-muted-foreground"><span>Can't load this video`),ge=f('<img class="absolute inset-0 h-full w-full object-cover">'),we=f('<button type=button class="group absolute inset-0 flex h-full w-full items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"><span class="relative flex h-14 w-14 items-center justify-center rounded-full bg-black/60 text-white shadow-lg transition-transform motion-safe:group-hover:scale-110"aria-hidden=true>'),ye=f('<div class="absolute inset-0 bg-gradient-to-br from-zinc-800 to-zinc-950"aria-hidden=true>');function xe(e){const[r,n]=G(e,["cardId","data","onEmit","class"]),i=o=>{var p;return(p=r.onEmit)==null?void 0:p.call(r,o)},[h,U]=P(!1),[Y,C]=P(!1);let x;const c=g(()=>{try{return{ok:!0,value:ue(r.data)}}catch(o){return{ok:!1,error:o instanceof Error?o.message:String(o)}}}),Z=g(()=>fe(r.data.aspectRatio)),_=()=>r.data.title??"Embedded video",I=g(()=>c().ok&&!Y()?c().value.posterUrl:void 0),j=g(()=>de(r.data)),z=()=>me(r.data.provider);H(()=>i({kind:"ready",cardId:r.cardId})),D(M(c,o=>{o.ok||i({kind:"error",cardId:r.cardId,message:o.error})})),D(M(()=>r.data,()=>{U(!1),C(!1)},{defer:!0}));const L=()=>{c().ok&&(U(!0),queueMicrotask(()=>x?.focus()))},B=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),L())},F=()=>{const o=j();o&&i({kind:"open",cardId:r.cardId,url:o,target:"tab"})};return(()=>{var o=be(),p=o.firstChild,R=p.nextSibling,S=R.firstChild,q=S.firstChild;return J(o,A({get class(){return X("overflow-hidden rounded-xl border border-border bg-card text-card-foreground",r.class)}},n),!1,!0),u(p,l(w,{get when(){return c().ok},get fallback(){return(()=>{var t=he(),s=t.firstChild;return u(t,l(te,{size:28,"aria-hidden":"true"}),s),t})()},get children(){return l(w,{get when(){return h()},get fallback(){return(()=>{var t=we(),s=t.firstChild;return t.$$keydown=B,t.$$click=()=>L(),u(t,l(w,{get when(){return I()},get fallback(){return ye()},get children(){var a=ge();return a.addEventListener("error",()=>C(!0)),y(d=>{var v=I(),b=r.data.title??"";return v!==d.e&&m(a,"src",d.e=v),b!==d.t&&m(a,"alt",d.t=b),d},{e:void 0,t:void 0}),a}}),s),u(s,l(ee,{size:26,fill:"currentColor"})),y(()=>m(t,"aria-label",`Play ${r.data.title??"video"}`)),t})()},get children(){var t=pe(),s=t.firstChild;return K(a=>x=a,t),y(a=>{var d=c().value.embedUrl,v=_(),b=c().value.sandbox,V=c().value.allow;return d!==a.e&&m(s,"src",a.e=d),v!==a.t&&m(s,"title",a.t=v),b!==a.a&&m(s,"sandbox",a.a=b),V!==a.o&&m(s,"allow",a.o=V),a},{e:void 0,t:void 0,a:void 0,o:void 0}),t}})}})),u(S,l(ie,{size:14,class:"shrink-0 opacity-70","aria-hidden":"true"}),q),u(q,()=>r.data.title??z()),u(R,l(w,{get when(){return j()},get children(){var t=ve();return t.firstChild,t.$$click=()=>F(),u(t,z,null),u(t,l(re,{size:12,"aria-hidden":"true"}),null),t}}),null),y(t=>Q(p,"aspect-ratio",Z())),o})()}W(["click","keydown"]);export{xe as E};
1
+ import{c as l,q as A,s as G,g as P,k as g,o as H,j as D,x as M,p as J,i as u,S as w,u as K,a as y,d as m,l as Q,t as f,e as W}from"./define-By-uL588.js";import{c as X}from"./cn-DN5AWfiS.js";import{p as ee}from"./play-BvKKq3fX.js";import{e as re}from"./external-link-ByXAwBBQ.js";import{t as te}from"./triangle-alert-DlQ68ppf.js";import{I as oe}from"./Icon-DObhsRtm.js";var ne=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ae=e=>l(oe,A(e,{name:"Video",iconNode:ne})),ie=ae;const k="allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",$="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",se=new Set;function le(e){const r=N(e);return r!==void 0&&se.has(r)}function N(e){try{return new URL(e).origin}catch{return}}function O(e){let r;try{r=new URL(e)}catch{return}const n=r.hostname.replace(/^www\./,"");if(n==="youtu.be")return E(r.pathname.slice(1));if(n==="youtube.com"||n==="m.youtube.com"||n==="youtube-nocookie.com"){const i=r.searchParams.get("v");if(i)return E(i);const h=r.pathname.match(/^\/(?:shorts|embed|v)\/([^/?#]+)/);if(h)return E(h[1])}}function T(e){let r;try{r=new URL(e)}catch{return}const n=r.hostname.replace(/^www\./,"");if(n!=="vimeo.com"&&n!=="player.vimeo.com")return;const i=r.pathname.match(/(?:^|\/)(\d+)(?:\/|$)/);return i?i[1]:void 0}function E(e){return/^[A-Za-z0-9_-]+$/.test(e)?e:void 0}function ue(e){const r=e.start?`&start=${e.start}`:"";switch(e.provider){case"youtube":{const n=e.id??(e.url?O(e.url):void 0);if(!n)throw new Error("youtube embed: missing or unparseable id/url");return{embedUrl:`https://www.youtube-nocookie.com/embed/${n}?autoplay=1&rel=0${r}`,posterUrl:e.poster??`https://i.ytimg.com/vi/${n}/hqdefault.jpg`,sandbox:k,allow:$}}case"vimeo":{const n=e.id??(e.url?T(e.url):void 0);if(!n)throw new Error("vimeo embed: missing or unparseable id/url");return{embedUrl:`https://player.vimeo.com/video/${n}?autoplay=1&dnt=1${e.start?`#t=${e.start}s`:""}`,posterUrl:e.poster,sandbox:k,allow:$}}case"generic":{if(!e.url)throw new Error("generic embed: missing url");if(ce(e.url),!le(e.url))throw new Error(`generic embed: origin not allowlisted \u2014 call configureEmbedAllowlist([...]) to permit ${N(e.url)??e.url}`);return{embedUrl:e.url,posterUrl:e.poster,sandbox:k,allow:$}}}}function ce(e){let r;try{r=new URL(e).protocol}catch{throw new Error(`generic embed: invalid url "${e}"`)}if(r!=="https:")throw new Error(`generic embed: only https player URLs are allowed (got ${r})`)}function de(e){switch(e.provider){case"youtube":{const r=e.id??(e.url?O(e.url):void 0);return r?`https://www.youtube.com/watch?v=${r}`:e.url}case"vimeo":{const r=e.id??(e.url?T(e.url):void 0);return r?`https://vimeo.com/${r}`:e.url}case"generic":return e.url}}function me(e){switch(e){case"youtube":return"YouTube";case"vimeo":return"Vimeo";case"generic":return"site"}}function fe(e){switch(e){case"4:3":return"4 / 3";case"1:1":return"1 / 1";case"9:16":return"9 / 16";default:return"16 / 9"}}var pe=f('<div tabindex=-1 class="absolute inset-0 outline-none"><iframe allowfullscreen class="absolute inset-0 h-full w-full border-0">'),ve=f('<button type=button class="inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">Open on '),be=f('<div><div class="relative w-full bg-black"></div><div class="flex items-center justify-between gap-2 px-3 py-2"><span class="flex min-w-0 items-center gap-1.5 text-sm text-foreground"><span class=truncate>'),he=f(`<div role=img aria-label="Can't load this video"class="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-muted p-4 text-center text-sm text-muted-foreground"><span>Can't load this video`),ge=f('<img class="absolute inset-0 h-full w-full object-cover">'),we=f('<button type=button class="group absolute inset-0 flex h-full w-full items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"><span class="relative flex h-14 w-14 items-center justify-center rounded-full bg-black/60 text-white shadow-lg transition-transform motion-safe:group-hover:scale-110"aria-hidden=true>'),ye=f('<div class="absolute inset-0 bg-gradient-to-br from-zinc-800 to-zinc-950"aria-hidden=true>');function xe(e){const[r,n]=G(e,["cardId","data","onEmit","class"]),i=o=>{var p;return(p=r.onEmit)==null?void 0:p.call(r,o)},[h,U]=P(!1),[Y,C]=P(!1);let x;const c=g(()=>{try{return{ok:!0,value:ue(r.data)}}catch(o){return{ok:!1,error:o instanceof Error?o.message:String(o)}}}),Z=g(()=>fe(r.data.aspectRatio)),_=()=>r.data.title??"Embedded video",I=g(()=>c().ok&&!Y()?c().value.posterUrl:void 0),j=g(()=>de(r.data)),z=()=>me(r.data.provider);H(()=>i({kind:"ready",cardId:r.cardId})),D(M(c,o=>{o.ok||i({kind:"error",cardId:r.cardId,message:o.error})})),D(M(()=>r.data,()=>{U(!1),C(!1)},{defer:!0}));const L=()=>{c().ok&&(U(!0),queueMicrotask(()=>x?.focus()))},B=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),L())},F=()=>{const o=j();o&&i({kind:"open",cardId:r.cardId,url:o,target:"tab"})};return(()=>{var o=be(),p=o.firstChild,R=p.nextSibling,S=R.firstChild,q=S.firstChild;return J(o,A({get class(){return X("overflow-hidden rounded-xl border border-border bg-card text-card-foreground",r.class)}},n),!1,!0),u(p,l(w,{get when(){return c().ok},get fallback(){return(()=>{var t=he(),s=t.firstChild;return u(t,l(te,{size:28,"aria-hidden":"true"}),s),t})()},get children(){return l(w,{get when(){return h()},get fallback(){return(()=>{var t=we(),s=t.firstChild;return t.$$keydown=B,t.$$click=()=>L(),u(t,l(w,{get when(){return I()},get fallback(){return ye()},get children(){var a=ge();return a.addEventListener("error",()=>C(!0)),y(d=>{var v=I(),b=r.data.title??"";return v!==d.e&&m(a,"src",d.e=v),b!==d.t&&m(a,"alt",d.t=b),d},{e:void 0,t:void 0}),a}}),s),u(s,l(ee,{size:26,fill:"currentColor"})),y(()=>m(t,"aria-label",`Play ${r.data.title??"video"}`)),t})()},get children(){var t=pe(),s=t.firstChild;return K(a=>x=a,t),y(a=>{var d=c().value.embedUrl,v=_(),b=c().value.sandbox,V=c().value.allow;return d!==a.e&&m(s,"src",a.e=d),v!==a.t&&m(s,"title",a.t=v),b!==a.a&&m(s,"sandbox",a.a=b),V!==a.o&&m(s,"allow",a.o=V),a},{e:void 0,t:void 0,a:void 0,o:void 0}),t}})}})),u(S,l(ie,{size:14,class:"shrink-0 opacity-70","aria-hidden":"true"}),q),u(q,()=>r.data.title??z()),u(R,l(w,{get when(){return j()},get children(){var t=ve();return t.firstChild,t.$$click=()=>F(),u(t,z,null),u(t,l(re,{size:12,"aria-hidden":"true"}),null),t}}),null),y(t=>Q(p,"aspect-ratio",Z())),o})()}W(["click","keydown"]);export{xe as E};
@@ -1 +1 @@
1
- import{I as e}from"./Icon-BnFKqqtY.js";import{c as r,q as t}from"./define-CGGX-7Vg.js";var o=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],p=a=>r(e,t(a,{name:"ExternalLink",iconNode:o})),h=p;export{h as e};
1
+ import{I as e}from"./Icon-DObhsRtm.js";import{c as r,q as t}from"./define-By-uL588.js";var o=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],p=a=>r(e,t(a,{name:"ExternalLink",iconNode:o})),h=p;export{h as e};
@@ -1 +1 @@
1
- import{I as t}from"./Icon-BnFKqqtY.js";import{c as e,q as r}from"./define-CGGX-7Vg.js";var p=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],h=a=>e(t,r(a,{name:"FileText",iconNode:p})),o=h;export{o as f};
1
+ import{I as t}from"./Icon-DObhsRtm.js";import{c as e,q as r}from"./define-By-uL588.js";var p=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],h=a=>e(t,r(a,{name:"FileText",iconNode:p})),o=h;export{o as f};
@@ -1 +1 @@
1
- import{c,q as E,s as Y,k as V,g as j,i as s,S as w,a as O,b as z,d as S,p as ee,F as L,t as b,n as R,e as te}from"./define-CGGX-7Vg.js";import{c as $}from"./cn-DN5AWfiS.js";import{c as ne}from"./chevron-right-B7l_fMgx.js";import{I as N}from"./Icon-BnFKqqtY.js";import{f as re}from"./file-text-CX7_x42o.js";import{f as ae}from"./folder-V-YdIL8f.js";var ie=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],oe=e=>c(N,E(e,{name:"FileImage",iconNode:ie})),de=oe,le=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]],se=e=>c(N,E(e,{name:"FileType",iconNode:le})),ue=se,ce=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],he=e=>c(N,E(e,{name:"File",iconNode:ce})),fe=he,pe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ge=e=>c(N,E(e,{name:"FolderOpen",iconNode:pe})),ve=ge,me=b('<span class="text-tool-green tabular-nums">+'),ke=b('<span class="text-tool-red tabular-nums">-'),xe=b("<button type=button>"),be=b('<div part=summary class="flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground border-b border-border"><span class="font-medium text-foreground"> <!> changed'),ye=b("<div role=tree aria-label=Files>"),we=b("<div role=group>"),Se=b('<div role=none><div role=treeitem data-tree-kind=folder><span class="truncate font-medium">'),Fe=b('<span part=stat-additions class="text-tool-green tabular-nums">+'),$e=b('<span part=stat-deletions class="text-tool-red tabular-nums">-'),Ce=b("<span part=status>"),De=b('<span class="ml-auto flex items-center gap-1.5 shrink-0 pl-2 text-xs"aria-hidden=true>'),qe=b('<div role=treeitem data-tree-kind=file><span class="w-3.5 shrink-0"></span><span>');const T={added:{letter:"A",label:"added",class:"text-tool-green"},modified:{letter:"M",label:"modified",class:"text-tool-amber"},deleted:{letter:"D",label:"deleted",class:"text-tool-red"},renamed:{letter:"R",label:"renamed",class:"text-tool-blue"},untracked:{letter:"U",label:"untracked",class:"text-muted-foreground"}};function Me(e){const t={children:[]};for(const r of e){const h=r.path.split("/").filter(l=>l.length>0);if(h.length===0)continue;let v=t;for(let l=0;l<h.length-1;l++){const m=h[l],a=h.slice(0,l+1).join("/");let d=v.children.find(x=>x.kind==="folder"&&x.name===m);d||(d={kind:"folder",name:m,path:a,children:[]},v.children.push(d)),v=d}const F=h[h.length-1],u=v.children.find(l=>l.kind==="file"&&l.name===F);u?u.file=r:v.children.push({kind:"file",name:F,path:r.path,file:r})}return U(t.children),t.children}function U(e){e.sort((t,r)=>t.kind!==r.kind?t.kind==="folder"?-1:1:t.name.localeCompare(r.name,void 0,{sensitivity:"base"}));for(const t of e)t.kind==="folder"&&U(t.children)}function _(e,t,r=[]){for(const h of e)r.push(h),h.kind==="folder"&&t(h.path)&&_(h.children,t,r);return r}function Ae(e){switch(e){case"image":return de;case"pdf":return ue;case"html":return re;default:return fe}}function B(e,t=[]){for(const r of e)r.kind==="folder"&&(t.push(r.path),B(r.children,t));return t}function G(e,t=[]){for(const r of e)r.kind==="folder"?G(r.children,t):t.push(r.file);return t}function Ee(e){return e.status!==void 0||e.additions!==void 0||e.deletions!==void 0}function ze(e,t){if(!Ee(t))return;const r=[];return t.status&&r.push(T[t.status].label),t.additions!==void 0&&r.push(`${t.additions} addition${t.additions===1?"":"s"}`),t.deletions!==void 0&&r.push(`${t.deletions} deletion${t.deletions===1?"":"s"}`),[e,...r].join(", ")}function He(e){const[t,r]=Y(e,["files","activeFile","onSelect","defaultExpanded","summary","class"]),h=V(()=>Me(t.files)),v=()=>t.defaultExpanded===void 0,[F,u]=j(new Set(t.defaultExpanded??[]),{equals:!1}),[l,m]=j(new Set,{equals:!1}),a=n=>v()?!l().has(n):F().has(n),d=n=>{v()?m(o=>{const p=new Set(o);return p.has(n)?p.delete(n):p.add(n),p}):u(o=>{const p=new Set(o);return p.has(n)?p.delete(n):p.add(n),p})},x=V(()=>B(h())),y=V(()=>G(h())),i=()=>y().length,f=()=>y().reduce((n,o)=>n+(o.additions??0),0),q=()=>y().reduce((n,o)=>n+(o.deletions??0),0),C=()=>x().some(n=>a(n)),H=()=>{v()?m(new Set(x())):u(new Set)},P=()=>{v()?m(new Set):u(new Set(x()))},K=()=>C()?H():P(),[Q,Z]=j(),I=n=>{var o;Z(n.path),(o=t.onSelect)==null||o.call(t,n.path,n.file)},W=(n,o)=>{const p=_(h(),a),D=p.findIndex(k=>k.path===o.path&&k.kind===o.kind),g=k=>{var M,A;if(!k)return;Z(k.path);const X=`[data-tree-path="${Ke(k.path)}"][data-tree-kind="${k.kind}"]`;(A=(M=n.currentTarget.closest('[role="tree"]'))==null?void 0:M.querySelector(X))==null||A.focus()};switch(n.key){case"ArrowDown":n.preventDefault(),g(p[D+1]);break;case"ArrowUp":n.preventDefault(),g(p[D-1]);break;case"ArrowRight":n.preventDefault(),o.kind==="folder"&&(a(o.path)?g(p[D+1]):d(o.path));break;case"ArrowLeft":n.preventDefault(),o.kind==="folder"&&a(o.path)&&d(o.path);break;case"Enter":case" ":n.preventDefault(),o.kind==="folder"?d(o.path):I(o);break}};return[c(w,{get when(){return t.summary},get children(){var n=be(),o=n.firstChild,p=o.firstChild,D=p.nextSibling;return D.nextSibling,s(o,i,p),s(o,()=>i()===1?"file":"files",D),s(n,c(w,{get when(){return f()>0},get children(){var g=me();return g.firstChild,s(g,f,null),g}}),null),s(n,c(w,{get when(){return q()>0},get children(){var g=ke();return g.firstChild,s(g,q,null),g}}),null),s(n,c(w,{get when(){return x().length>0},get children(){var g=xe();return g.$$click=K,s(g,()=>C()?"Collapse all":"Expand all"),O(k=>{var M=$("ml-auto rounded-md px-1.5 py-0.5 font-medium text-muted-foreground outline-none","hover:bg-muted hover:text-foreground","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"),A=C()?"Collapse all folders":"Expand all folders";return M!==k.e&&z(g,k.e=M),A!==k.t&&S(g,"aria-label",k.t=A),k},{e:void 0,t:void 0}),g}}),null),n}}),(()=>{var n=ye();return ee(n,E({get class(){return $("text-sm select-none",t.class)}},r),!1,!0),s(n,c(L,{get each(){return h()},children:o=>c(J,{node:o,depth:0,isOpen:a,toggle:d,activeFile:()=>t.activeFile,focusedPath:Q,onSelectFile:I,onKeyDown:W})})),n})()]}function J(e){const t=()=>e.node,r=()=>e.node.kind==="folder"&&e.isOpen(e.node.path),h=()=>e.node.kind==="file"&&e.activeFile()===e.node.path,v=()=>{const u=e.focusedPath();return u!==void 0?e.node.path===u?0:-1:h()?0:-1},F=()=>({"padding-left":`${e.depth*12+8}px`});return c(w,{get when(){return e.node.kind==="folder"},get fallback(){const u=e.node.file,l=ze(t().name,u),m=l!==void 0,a=u.status?T[u.status]:void 0;return(()=>{var d=qe(),x=d.firstChild,y=x.nextSibling;return d.$$keydown=i=>e.onKeyDown(i,e.node),d.$$click=()=>e.onSelectFile(e.node),S(d,"aria-label",l),s(d,()=>{const i=Ae(u.type);return c(i,{size:14,class:"shrink-0 opacity-70","aria-hidden":"true"})},y),s(y,()=>t().name),s(d,c(w,{when:m,get children(){var i=De();return s(i,c(w,{get when(){return u.additions!==void 0},get children(){var f=Fe();return f.firstChild,s(f,()=>u.additions,null),f}}),null),s(i,c(w,{get when(){return u.deletions!==void 0},get children(){var f=$e();return f.firstChild,s(f,()=>u.deletions,null),f}}),null),s(i,c(w,{when:a,get children(){var f=Ce();return s(f,()=>a.letter),O(()=>z(f,$("w-3 text-center font-mono font-semibold",a.class))),f}}),null),i}}),null),O(i=>{var f=h(),q=e.node.path,C=v(),H=$("flex items-center gap-1.5 rounded-md py-1 pr-2 cursor-pointer outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",h()?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground"),P=F(),K=$("truncate",m&&"min-w-0 flex-1");return f!==i.e&&S(d,"aria-selected",i.e=f),q!==i.t&&S(d,"data-tree-path",i.t=q),C!==i.a&&S(d,"tabindex",i.a=C),H!==i.o&&z(d,i.o=H),i.i=R(d,P,i.i),K!==i.n&&z(y,i.n=K),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),d})()},get children(){var u=Se(),l=u.firstChild,m=l.firstChild;return l.$$keydown=a=>e.onKeyDown(a,e.node),l.$$click=()=>e.toggle(e.node.path),s(l,c(ne,{size:14,get class(){return $("shrink-0 transition-transform opacity-70",r()&&"rotate-90")},"aria-hidden":"true"}),m),s(l,()=>{const a=r()?ve:ae;return c(a,{size:14,class:"shrink-0 text-foreground/80","aria-hidden":"true"})},m),s(m,()=>t().name),s(u,c(w,{get when(){return r()},get children(){var a=we();return s(a,c(L,{get each(){return e.node.children},children:d=>c(J,{node:d,get depth(){return e.depth+1},get isOpen(){return e.isOpen},get toggle(){return e.toggle},get activeFile(){return e.activeFile},get focusedPath(){return e.focusedPath},get onSelectFile(){return e.onSelectFile},get onKeyDown(){return e.onKeyDown}})})),a}}),null),O(a=>{var d=r(),x=e.node.path,y=v(),i=$("flex items-center gap-1.5 rounded-md py-1 pr-2 cursor-pointer outline-none text-foreground","hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"),f=F();return d!==a.e&&S(l,"aria-expanded",a.e=d),x!==a.t&&S(l,"data-tree-path",a.t=x),y!==a.a&&S(l,"tabindex",a.a=y),i!==a.o&&z(l,a.o=i),a.i=R(l,f,a.i),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),u}})}function Ke(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}te(["click","keydown"]);export{He as F};
1
+ import{c,q as E,s as Y,k as V,g as j,i as s,S as w,a as O,b as z,d as S,p as ee,F as L,t as b,n as R,e as te}from"./define-By-uL588.js";import{c as $}from"./cn-DN5AWfiS.js";import{c as ne}from"./chevron-right-BatuHzUm.js";import{I as N}from"./Icon-DObhsRtm.js";import{f as re}from"./file-text-DMib2qwt.js";import{f as ae}from"./folder-_BAb929C.js";var ie=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],oe=e=>c(N,E(e,{name:"FileImage",iconNode:ie})),de=oe,le=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]],se=e=>c(N,E(e,{name:"FileType",iconNode:le})),ue=se,ce=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],he=e=>c(N,E(e,{name:"File",iconNode:ce})),fe=he,pe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ge=e=>c(N,E(e,{name:"FolderOpen",iconNode:pe})),ve=ge,me=b('<span class="text-tool-green tabular-nums">+'),ke=b('<span class="text-tool-red tabular-nums">-'),xe=b("<button type=button>"),be=b('<div part=summary class="flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground border-b border-border"><span class="font-medium text-foreground"> <!> changed'),ye=b("<div role=tree aria-label=Files>"),we=b("<div role=group>"),Se=b('<div role=none><div role=treeitem data-tree-kind=folder><span class="truncate font-medium">'),Fe=b('<span part=stat-additions class="text-tool-green tabular-nums">+'),$e=b('<span part=stat-deletions class="text-tool-red tabular-nums">-'),Ce=b("<span part=status>"),De=b('<span class="ml-auto flex items-center gap-1.5 shrink-0 pl-2 text-xs"aria-hidden=true>'),qe=b('<div role=treeitem data-tree-kind=file><span class="w-3.5 shrink-0"></span><span>');const T={added:{letter:"A",label:"added",class:"text-tool-green"},modified:{letter:"M",label:"modified",class:"text-tool-amber"},deleted:{letter:"D",label:"deleted",class:"text-tool-red"},renamed:{letter:"R",label:"renamed",class:"text-tool-blue"},untracked:{letter:"U",label:"untracked",class:"text-muted-foreground"}};function Me(e){const t={children:[]};for(const r of e){const h=r.path.split("/").filter(l=>l.length>0);if(h.length===0)continue;let v=t;for(let l=0;l<h.length-1;l++){const m=h[l],a=h.slice(0,l+1).join("/");let d=v.children.find(x=>x.kind==="folder"&&x.name===m);d||(d={kind:"folder",name:m,path:a,children:[]},v.children.push(d)),v=d}const F=h[h.length-1],u=v.children.find(l=>l.kind==="file"&&l.name===F);u?u.file=r:v.children.push({kind:"file",name:F,path:r.path,file:r})}return U(t.children),t.children}function U(e){e.sort((t,r)=>t.kind!==r.kind?t.kind==="folder"?-1:1:t.name.localeCompare(r.name,void 0,{sensitivity:"base"}));for(const t of e)t.kind==="folder"&&U(t.children)}function _(e,t,r=[]){for(const h of e)r.push(h),h.kind==="folder"&&t(h.path)&&_(h.children,t,r);return r}function Ae(e){switch(e){case"image":return de;case"pdf":return ue;case"html":return re;default:return fe}}function B(e,t=[]){for(const r of e)r.kind==="folder"&&(t.push(r.path),B(r.children,t));return t}function G(e,t=[]){for(const r of e)r.kind==="folder"?G(r.children,t):t.push(r.file);return t}function Ee(e){return e.status!==void 0||e.additions!==void 0||e.deletions!==void 0}function ze(e,t){if(!Ee(t))return;const r=[];return t.status&&r.push(T[t.status].label),t.additions!==void 0&&r.push(`${t.additions} addition${t.additions===1?"":"s"}`),t.deletions!==void 0&&r.push(`${t.deletions} deletion${t.deletions===1?"":"s"}`),[e,...r].join(", ")}function He(e){const[t,r]=Y(e,["files","activeFile","onSelect","defaultExpanded","summary","class"]),h=V(()=>Me(t.files)),v=()=>t.defaultExpanded===void 0,[F,u]=j(new Set(t.defaultExpanded??[]),{equals:!1}),[l,m]=j(new Set,{equals:!1}),a=n=>v()?!l().has(n):F().has(n),d=n=>{v()?m(o=>{const p=new Set(o);return p.has(n)?p.delete(n):p.add(n),p}):u(o=>{const p=new Set(o);return p.has(n)?p.delete(n):p.add(n),p})},x=V(()=>B(h())),y=V(()=>G(h())),i=()=>y().length,f=()=>y().reduce((n,o)=>n+(o.additions??0),0),q=()=>y().reduce((n,o)=>n+(o.deletions??0),0),C=()=>x().some(n=>a(n)),H=()=>{v()?m(new Set(x())):u(new Set)},P=()=>{v()?m(new Set):u(new Set(x()))},K=()=>C()?H():P(),[Q,Z]=j(),I=n=>{var o;Z(n.path),(o=t.onSelect)==null||o.call(t,n.path,n.file)},W=(n,o)=>{const p=_(h(),a),D=p.findIndex(k=>k.path===o.path&&k.kind===o.kind),g=k=>{var M,A;if(!k)return;Z(k.path);const X=`[data-tree-path="${Ke(k.path)}"][data-tree-kind="${k.kind}"]`;(A=(M=n.currentTarget.closest('[role="tree"]'))==null?void 0:M.querySelector(X))==null||A.focus()};switch(n.key){case"ArrowDown":n.preventDefault(),g(p[D+1]);break;case"ArrowUp":n.preventDefault(),g(p[D-1]);break;case"ArrowRight":n.preventDefault(),o.kind==="folder"&&(a(o.path)?g(p[D+1]):d(o.path));break;case"ArrowLeft":n.preventDefault(),o.kind==="folder"&&a(o.path)&&d(o.path);break;case"Enter":case" ":n.preventDefault(),o.kind==="folder"?d(o.path):I(o);break}};return[c(w,{get when(){return t.summary},get children(){var n=be(),o=n.firstChild,p=o.firstChild,D=p.nextSibling;return D.nextSibling,s(o,i,p),s(o,()=>i()===1?"file":"files",D),s(n,c(w,{get when(){return f()>0},get children(){var g=me();return g.firstChild,s(g,f,null),g}}),null),s(n,c(w,{get when(){return q()>0},get children(){var g=ke();return g.firstChild,s(g,q,null),g}}),null),s(n,c(w,{get when(){return x().length>0},get children(){var g=xe();return g.$$click=K,s(g,()=>C()?"Collapse all":"Expand all"),O(k=>{var M=$("ml-auto rounded-md px-1.5 py-0.5 font-medium text-muted-foreground outline-none","hover:bg-muted hover:text-foreground","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"),A=C()?"Collapse all folders":"Expand all folders";return M!==k.e&&z(g,k.e=M),A!==k.t&&S(g,"aria-label",k.t=A),k},{e:void 0,t:void 0}),g}}),null),n}}),(()=>{var n=ye();return ee(n,E({get class(){return $("text-sm select-none",t.class)}},r),!1,!0),s(n,c(L,{get each(){return h()},children:o=>c(J,{node:o,depth:0,isOpen:a,toggle:d,activeFile:()=>t.activeFile,focusedPath:Q,onSelectFile:I,onKeyDown:W})})),n})()]}function J(e){const t=()=>e.node,r=()=>e.node.kind==="folder"&&e.isOpen(e.node.path),h=()=>e.node.kind==="file"&&e.activeFile()===e.node.path,v=()=>{const u=e.focusedPath();return u!==void 0?e.node.path===u?0:-1:h()?0:-1},F=()=>({"padding-left":`${e.depth*12+8}px`});return c(w,{get when(){return e.node.kind==="folder"},get fallback(){const u=e.node.file,l=ze(t().name,u),m=l!==void 0,a=u.status?T[u.status]:void 0;return(()=>{var d=qe(),x=d.firstChild,y=x.nextSibling;return d.$$keydown=i=>e.onKeyDown(i,e.node),d.$$click=()=>e.onSelectFile(e.node),S(d,"aria-label",l),s(d,()=>{const i=Ae(u.type);return c(i,{size:14,class:"shrink-0 opacity-70","aria-hidden":"true"})},y),s(y,()=>t().name),s(d,c(w,{when:m,get children(){var i=De();return s(i,c(w,{get when(){return u.additions!==void 0},get children(){var f=Fe();return f.firstChild,s(f,()=>u.additions,null),f}}),null),s(i,c(w,{get when(){return u.deletions!==void 0},get children(){var f=$e();return f.firstChild,s(f,()=>u.deletions,null),f}}),null),s(i,c(w,{when:a,get children(){var f=Ce();return s(f,()=>a.letter),O(()=>z(f,$("w-3 text-center font-mono font-semibold",a.class))),f}}),null),i}}),null),O(i=>{var f=h(),q=e.node.path,C=v(),H=$("flex items-center gap-1.5 rounded-md py-1 pr-2 cursor-pointer outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",h()?"bg-primary/10 text-foreground font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground"),P=F(),K=$("truncate",m&&"min-w-0 flex-1");return f!==i.e&&S(d,"aria-selected",i.e=f),q!==i.t&&S(d,"data-tree-path",i.t=q),C!==i.a&&S(d,"tabindex",i.a=C),H!==i.o&&z(d,i.o=H),i.i=R(d,P,i.i),K!==i.n&&z(y,i.n=K),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),d})()},get children(){var u=Se(),l=u.firstChild,m=l.firstChild;return l.$$keydown=a=>e.onKeyDown(a,e.node),l.$$click=()=>e.toggle(e.node.path),s(l,c(ne,{size:14,get class(){return $("shrink-0 transition-transform opacity-70",r()&&"rotate-90")},"aria-hidden":"true"}),m),s(l,()=>{const a=r()?ve:ae;return c(a,{size:14,class:"shrink-0 text-foreground/80","aria-hidden":"true"})},m),s(m,()=>t().name),s(u,c(w,{get when(){return r()},get children(){var a=we();return s(a,c(L,{get each(){return e.node.children},children:d=>c(J,{node:d,get depth(){return e.depth+1},get isOpen(){return e.isOpen},get toggle(){return e.toggle},get activeFile(){return e.activeFile},get focusedPath(){return e.focusedPath},get onSelectFile(){return e.onSelectFile},get onKeyDown(){return e.onKeyDown}})})),a}}),null),O(a=>{var d=r(),x=e.node.path,y=v(),i=$("flex items-center gap-1.5 rounded-md py-1 pr-2 cursor-pointer outline-none text-foreground","hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"),f=F();return d!==a.e&&S(l,"aria-expanded",a.e=d),x!==a.t&&S(l,"data-tree-path",a.t=x),y!==a.a&&S(l,"tabindex",a.a=y),i!==a.o&&z(l,a.o=i),a.i=R(l,f,a.i),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),u}})}function Ke(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}te(["click","keydown"]);export{He as F};
@@ -1 +1 @@
1
- import{I as o}from"./Icon-BnFKqqtY.js";import{c as r,q as e}from"./define-CGGX-7Vg.js";var t=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],m=a=>r(o,e(a,{name:"Folder",iconNode:t})),p=m;export{p as f};
1
+ import{I as o}from"./Icon-DObhsRtm.js";import{c as r,q as e}from"./define-By-uL588.js";var t=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],m=a=>r(o,e(a,{name:"Folder",iconNode:t})),p=m;export{p as f};
@@ -1 +1 @@
1
- import{c as i,q as x,i as g,S as k,m as ye,p as re,y as ke,u as we,d as j,a as M,F as O,k as L,g as $e,t as $,e as Ie,s as Se,j as R,x as K,o as je,E as Ae,b as Le,I as Ce}from"./define-CGGX-7Vg.js";import{c as ne,u as T,p as B}from"./store-7eoadydQ.js";import{c as V}from"./cn-DN5AWfiS.js";import{B as q}from"./button-BH6rN0U-.js";import{u as Oe,a as Be,C as J,D as qe}from"./use-card-resolution-CJW4grFa.js";import{e as Me}from"./card-routing-DifQgS7n.js";import{I as F,F as Ee,a as Ne,f as Re,c as U,n as ze,b as De,d as Ke}from"./input-d1Yuu-hz.js";import{T as Te}from"./textarea-3ay2Me2-.js";import{S as Ve}from"./slider-BAKRYUlz.js";import{S as Je}from"./select-CWmu00tS.js";import{S as Fe}from"./switch-CViARZCy.js";import{C as Ue}from"./checkbox-Dc9Yov_B.js";import{R as _e}from"./radio-DcL23cNJ.js";import{C as He}from"./checkbox-group-B1kDLLYk.js";import{s as We}from"./star-CBMZvLuN.js";import{x as Ge}from"./x-C5m1JFgi.js";import{c as Pe}from"./check-DPeeMUYx.js";function _(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ye(e,t){switch(t){case"integer":return typeof e=="number"&&Number.isInteger(e);case"number":return typeof e=="number"&&Number.isFinite(e);case"array":return Array.isArray(e);case"null":return e===null;case"object":return _(e)==="object";default:return typeof e===t}}function H(e,t,r,n){const l=r||"(root)",s=(a,o,y=l)=>{n.push({path:y,keyword:a,message:`${y}: ${o}`})};if(e.type&&!Ye(t,e.type)){s("type",`expected ${e.type}, got ${_(t)}`);return}if("const"in e&&JSON.stringify(t)!==JSON.stringify(e.const)&&s("const",`must equal const ${JSON.stringify(e.const)}`),e.enum&&!e.enum.some(a=>JSON.stringify(a)===JSON.stringify(t))&&s("enum",`must be one of ${JSON.stringify(e.enum)}`),typeof t=="number"&&(e.minimum!==void 0&&t<e.minimum&&s("minimum",`< minimum ${e.minimum}`),e.maximum!==void 0&&t>e.maximum&&s("maximum",`> maximum ${e.maximum}`),e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum&&s("exclusiveMinimum","<= exclusiveMinimum"),e.exclusiveMaximum!==void 0&&t>=e.exclusiveMaximum&&s("exclusiveMaximum",">= exclusiveMaximum")),typeof t=="string"&&(e.minLength!==void 0&&t.length<e.minLength&&s("minLength",`shorter than minLength ${e.minLength}`),e.maxLength!==void 0&&t.length>e.maxLength&&s("maxLength",`longer than maxLength ${e.maxLength}`),e.pattern!==void 0&&!new RegExp(e.pattern).test(t)&&s("pattern","does not match pattern")),Array.isArray(t)&&(e.minItems!==void 0&&t.length<e.minItems&&s("minItems",`fewer than minItems ${e.minItems}`),e.maxItems!==void 0&&t.length>e.maxItems&&s("maxItems",`more than maxItems ${e.maxItems}`),e.uniqueItems&&new Set(t.map(a=>JSON.stringify(a))).size!==t.length&&s("uniqueItems","items not unique"),e.items&&t.forEach((a,o)=>H(e.items,a,`${l}[${o}]`,n))),_(t)==="object"){const a=t;for(const o of e.required??[])(!(o in a)||a[o]===void 0)&&s("required","required",`${l}.${o}`);if(e.properties)for(const[o,y]of Object.entries(e.properties))o in a&&a[o]!==void 0&&H(y,a[o],`${l}.${o}`,n)}}function ie(e,t){const r=[];return H(e,t,"",r),{valid:r.length===0,errors:r.map(n=>n.message),issues:r}}var Ze=$('<span class="self-end text-xs text-muted-foreground">/'),Qe=$('<div class="flex flex-col gap-1">'),Xe=$("<div role=radiogroup>"),et=$('<button type=button role=radio class="rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">'),tt=$('<label class="-mx-1.5 inline-flex cursor-pointer items-center gap-2.5 rounded-md px-1.5 py-1.5 text-sm text-foreground transition-colors hover:bg-muted/60"><span>'),rt=$('<div class="flex flex-col gap-2"role=group><div class="flex flex-wrap gap-1.5"></div><div class="flex items-center gap-2">'),nt=$('<span class="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground">');function z(e){return e.labelledBy!==void 0?{"aria-labelledby":e.labelledBy}:{"aria-label":e.label}}function A(e){return{"aria-required":e.required||void 0,"aria-invalid":e.invalid||void 0,"aria-describedby":e.describedBy}}function it(e){const t=()=>{switch(e.variant){case"email":return"email";case"url":return"url";case"date":return"date";case"datetime":return"datetime-local";case"time":return"time";case"password":return"password";default:return"text"}};return i(F,x({get id(){return e.id},"data-control":!0,get type(){return t()},get value(){return e.value??""},get placeholder(){return e.placeholder},get invalid(){return e.invalid},get disabled(){return e.disabled},get minLength(){return e.field.minLength},get maxLength(){return e.field.maxLength},get format(){var r;return(r=e.mask)==null?void 0:r.format},get guide(){var r;return(r=e.mask)==null?void 0:r.guide},get semantic(){var r;return(r=e.mask)==null?void 0:r.semantic}},()=>A(e),{onValueInput:r=>e.onInput(r),onValueChange:()=>e.onBlur()}))}function at(e){const t=()=>(e.value??"").length;return(()=>{var r=Qe();return g(r,i(Te,x({get id(){return e.id},"data-control":!0,get class(){return V(Ee,e.invalid&&"border-destructive dark:border-red-400/70")},get value(){return e.value??""},get placeholder(){return e.placeholder},get disabled(){return e.disabled},get maxLength(){return e.field.maxLength}},()=>A(e),{onInput:n=>e.onInput(n.currentTarget.value),get onBlur(){return e.onBlur}})),null),g(r,i(k,{get when(){return e.field.maxLength!==void 0},get children(){var n=Ze(),l=n.firstChild;return g(n,t,l),g(n,()=>e.field.maxLength,null),n}}),null),r})()}function st(e){const t=()=>e.field["x-kai-step"]??(e.field.type==="integer"?1:void 0);return i(F,x({get id(){return e.id},"data-control":!0,type:"number",get value(){return ye(()=>e.value===void 0||e.value===null)()?"":String(e.value)},get placeholder(){return e.placeholder},get invalid(){return e.invalid},get disabled(){return e.disabled},get min(){return e.field.minimum},get max(){return e.field.maximum},get step(){return t()}},()=>A(e),{onValueInput:r=>e.onInput(r),onValueChange:()=>e.onBlur()}))}function ot(e){const t=()=>e.field.minimum??0,r=()=>e.field.maximum??100,n=()=>e.field["x-kai-step"]??(e.field.type==="integer"?1:void 0),l=()=>e.value===void 0||e.value===null?t():Number(e.value);return i(Ve,x({get id(){return e.id},"data-control":!0,get value(){return l()},get min(){return t()},get max(){return r()},get step(){return n()},get disabled(){return e.disabled},valueLabel:!0,get"aria-valuetext"(){return String(l())}},()=>A(e),{onInput:s=>e.onInput(Number(s.currentTarget.value)),get onBlur(){return e.onBlur}}))}function ut(e){const t=()=>e.field.maximum??5,r=()=>e.field.minimum??1,n=()=>Number(e.value??0),l=()=>Array.from({length:t()},(c,p)=>p+1),s=()=>n()>=r()&&n()<=t()?n():r(),a=new Map,o=c=>{var p;const f=Math.min(t(),Math.max(r(),c));e.onInput(f),(p=a.get(f))==null||p.focus()},y=c=>{e.disabled||(c.key==="ArrowRight"||c.key==="ArrowUp"?(c.preventDefault(),o(n()+1)):c.key==="ArrowLeft"||c.key==="ArrowDown"?(c.preventDefault(),o(n()-1)):c.key==="Home"?(c.preventDefault(),o(r())):c.key==="End"&&(c.preventDefault(),o(t())))};return(()=>{var c=Xe();return re(c,x(()=>z(e),{class:"flex items-center gap-1 rounded-md"},()=>A(e)),!1,!0),g(c,i(O,{get each(){return l()},children:p=>(()=>{var f=et();return ke(f,"blur",e.onBlur),f.$$click=()=>o(p),f.$$keydown=y,we(b=>a.set(p,b),f),j(f,"aria-label",`${p} ${p===1?"star":"stars"}`),g(f,i(We,{size:20,get class(){return V(p<=n()?"fill-current text-[var(--color-primary)]":"")},"aria-hidden":"true"})),M(b=>{var I=s()===p?"":void 0,w=n()===p,v=s()===p?0:-1,N=e.disabled;return I!==b.e&&j(f,"data-control",b.e=I),w!==b.t&&j(f,"aria-checked",b.t=w),v!==b.a&&j(f,"tabindex",b.a=v),N!==b.o&&(f.disabled=b.o=N),b},{e:void 0,t:void 0,a:void 0,o:void 0}),f})()})),c})()}function lt(e){const t=()=>e.value===!0;return i(Fe,x({get id(){return e.id},"data-control":"",get checked(){return t()},get disabled(){return e.disabled},get label(){return e.label}},()=>A(e),{onChange:r=>{e.onInput(r),e.onBlur()}}))}function dt(e){return(()=>{var t=tt(),r=t.firstChild;return g(t,i(Ue,x({get id(){return e.id},"data-control":"",get checked(){return e.value===!0},get disabled(){return e.disabled}},()=>A(e),{onChange:n=>{e.onInput(n.currentTarget.checked),e.onBlur()}})),r),g(r,()=>e.label),t})()}function ct(e){const t=L(()=>(e.field.enum??[]).map(r=>({value:r,label:String(r)})));return i(_e,x({"data-control":""},()=>z(e),{get name(){return e.id},get options(){return t()},get value(){return e.value},get disabled(){return e.disabled}},()=>A(e),{onChange:r=>{e.onInput(r),e.onBlur()}}))}function mt(e){const t=L(()=>(e.field.enum??[]).map(r=>({value:r,label:String(r)})));return i(Je,x({get id(){return e.id},"data-control":!0,get options(){return t()},get value(){return e.value},get placeholder(){return e.placeholder??"Select\u2026"},get invalid(){return e.invalid},get disabled(){return e.disabled}},()=>A(e),{onChange:r=>{e.onInput(r.currentTarget.value),e.onBlur()}}))}function gt(e){const t=e.items;return t&&"enum"in t&&Array.isArray(t.enum)?t.enum:[]}function ae(e){const t=()=>Array.isArray(e.value)?e.value:[],r=L(()=>gt(e.field).map(n=>({value:n,label:String(n)})));return i(He,x({"data-control":""},()=>z(e),{get name(){return e.id},get class(){return e.class},get options(){return r()},get value(){return t()},get disabled(){return e.disabled}},()=>A(e),{onChange:n=>{e.onInput(n),e.onBlur()}}))}function ft(e){return i(ae,x(e,{class:"max-h-60 overflow-y-auto"}))}function pt(e){const t=()=>Array.isArray(e.value)?e.value:[],[r,n]=$e(""),l=()=>{const a=r().trim();a&&(e.onInput([...t(),a]),n(""),e.onBlur())},s=a=>{e.onInput(t().filter((o,y)=>y!==a)),e.onBlur()};return(()=>{var a=rt(),o=a.firstChild,y=o.nextSibling;return re(a,x(()=>z(e)),!1,!0),g(o,i(O,{get each(){return t()},children:(c,p)=>(()=>{var f=nt();return g(f,c,null),g(f,i(q,{type:"button",variant:"ghost",size:"icon-sm",class:"size-4 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground","aria-label":`Remove ${c}`,get disabled(){return e.disabled},onClick:()=>s(p()),get children(){return i(Ge,{size:12,"aria-hidden":"true"})}}),null),f})()})),g(y,i(F,x({get id(){return e.id},"data-control":!0,type:"text",get value(){return r()},get placeholder(){return e.placeholder??"Add\u2026"},get disabled(){return e.disabled}},()=>A(e),{onValueInput:c=>n(c),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())}})),null),g(y,i(q,{type:"button",variant:"outline",size:"md",get disabled(){return e.disabled},onClick:l,children:"Add"}),null),a})()}Ie(["keydown","click"]);var ht=$("<form novalidate>"),vt=$('<div class="flex w-full flex-wrap items-center justify-between gap-2"><div class="ml-auto flex flex-wrap items-center gap-2">'),bt=$('<div class="flex flex-col gap-3"><p class="flex items-center gap-2 text-sm font-medium text-foreground"><span>Submitted</span></p><dl class="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5">'),xt=$('<dt class="text-xs text-muted-foreground">'),yt=$('<dd class="m-0 text-sm font-medium text-foreground">'),kt=$('<span class="text-destructive dark:text-red-400"aria-hidden=true> *'),wt=$('<label class="text-sm font-medium text-foreground">'),se=$('<p class="text-xs text-muted-foreground">'),$t=$('<p role=alert class="text-xs text-destructive dark:text-red-400">'),It=$('<div class="flex flex-col gap-2 rounded-xl bg-surface p-3.5">'),St=$('<p class="rounded-md border border-dashed border-border p-2 text-xs text-muted-foreground">Unsupported field "<!>".'),jt=$('<fieldset class="flex flex-col gap-3 rounded-lg border border-border p-3"><legend class="px-1 text-sm font-medium text-foreground">'),At=$('<fieldset class="flex flex-col gap-3 rounded-lg border border-border p-3"data-control><legend class="px-1 text-sm font-medium text-foreground">'),Lt=$('<div class="flex flex-col gap-2 rounded-md border border-border/60 p-2"><div class="flex items-center justify-between"><span class="text-xs text-muted-foreground">Item ');const W=4,Ct=new Set(["textarea","slider","rating","radio","select","checkbox","password","switch"]);function Ot(e,t){const r=e["x-kai-widget"];if(r&&Ct.has(r))switch(r){case"textarea":return"textarea";case"slider":return"slider";case"rating":return"rating";case"radio":return"radio";case"select":return"select";case"checkbox":return"checkbox";case"password":return"password";case"switch":return"switch"}switch(e.type){case"string":{if(Array.isArray(e.enum))return e.enum.length<=t?"radio":"select";switch(e.format){case"email":return"email";case"uri":case"url":return"url";case"date":return"date";case"date-time":return"datetime";case"time":return"time"}return e.maxLength!==void 0&&e.maxLength>120?"textarea":"text"}case"number":case"integer":return"number";case"boolean":return"switch";case"array":{const n=e.items;return n&&"enum"in n&&Array.isArray(n.enum)?n.enum.length<=t?"checkbox-group":"multiselect":n&&"type"in n&&n.type==="object"?"repeater":(n&&"type"in n&&n.type,"taglist")}case"object":return"fieldset";default:return"unsupported"}}const Bt=Object.freeze({warnings:[]}),oe=new WeakMap;function qt(e,t){let r=oe.get(e);r===void 0&&(r=new Set,oe.set(e,r)),!r.has(t)&&(r.add(t),console.warn(t))}function E(e){return e.length<=32?e:`${e.slice(0,32)}\u2026 (${e.length} chars)`}const ue=Ne;function Mt(e,t=""){const r=e["x-kai-format"],n=e["x-kai-mask"],l=e["x-kai-mask-guide"],s=t?` on field "${E(t)}"`:"";if(r===void 0)return typeof n=="string"||typeof l=="string"?{warnings:[`kai-form: x-kai-mask${s} has no x-kai-format and is ignored. Set "x-kai-format": "custom" to mask with it.`]}:{warnings:[]};if(typeof r!="string"||!ue.includes(r))return{warnings:[`kai-form: x-kai-format "${E(String(r))}"${s} is not one of ${ue.join(", ")}. Rendering an unmasked text field.`]};const a=r,o=[],y=a==="custom";!y&&typeof n=="string"&&o.push(`kai-form: x-kai-mask${s} is read only with x-kai-format "custom"; "${a}" brings its own format. The mask is ignored.`);const c=y?n:Re(a).defaultFormat;if(typeof c!="string"||c==="")return o.push(`kai-form: x-kai-format "custom"${s} needs an x-kai-mask pattern. Rendering an unmasked text field.`),{warnings:o};let p;try{p=U(c)}catch(b){return o.push(`kai-form: x-kai-mask "${E(c)}"${s} did not compile (${b instanceof Error?b.message:String(b)}). Rendering an unmasked text field.`),{warnings:o}}if(p.capacity===0)return o.push(`kai-form: x-kai-mask "${E(c)}"${s} has no fill positions, so nothing could ever be typed into it. Use # for a digit, @ for a letter or digit, * for an obscurable one (e.g. "##/##/####", with "mm/dd/yyyy" as x-kai-mask-guide). Rendering an unmasked text field.`),{warnings:o};let f=typeof l=="string"?l:void 0;if(f!==void 0)try{U(c,f)}catch(b){o.push(`kai-form: x-kai-mask-guide "${E(f)}"${s} does not align with the pattern (${b instanceof Error?b.message:String(b)}). Using the pattern's own guide.`),f=void 0}return{format:c,guide:f,semantic:a,hint:`Format: ${f??c}`,warnings:o}}function Et(e,t){if(e.format===void 0||typeof t!="string"||t==="")return t;try{const r=U(e.format,e.guide),n=ze(r,t);return e.guide===void 0?De(r,n):Ke(r,n)}catch{return t}}function G(e){return e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Nt(e){const t=Object.keys(e.properties??{}),r=e["x-kai-order"];if(Array.isArray(r)){const s=r.filter(o=>t.includes(o)),a=t.filter(o=>!s.includes(o));return[...s,...a]}const n=(e.required??[]).filter(s=>t.includes(s)),l=t.filter(s=>!n.includes(s));return[...n,...l]}function Rt(e,t){if(e.type==="number"||e.type==="integer"){if(t===""||t===null||t===void 0)return;const r=typeof t=="number"?t:Number(t);return Number.isNaN(r)?t:r}return e.type==="boolean"?!!t:t}const zt="^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";function Dt(e){const t={type:e.type};return e.enum&&(t.enum=e.enum),e.minimum!==void 0&&(t.minimum=e.minimum),e.maximum!==void 0&&(t.maximum=e.maximum),e.minLength!==void 0&&(t.minLength=e.minLength),e.maxLength!==void 0&&(t.maxLength=e.maxLength),e.minItems!==void 0&&(t.minItems=e.minItems),e.maxItems!==void 0&&(t.maxItems=e.maxItems),e.pattern!==void 0?t.pattern=e.pattern:e.format==="email"&&(t.pattern=zt),t}function le(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function D(e,t){const r={},n=new Set(e.required??[]);for(const[l,s]of Object.entries(e.properties??{})){const a=t[l];if(n.has(l)&&le(a)){r[l]=`${s.title??G(l)} is required.`;continue}if(le(a))continue;const o=ie(Dt(s),a);o.valid||(r[l]=Kt(s,l,o.errors[0]))}return{valid:Object.keys(r).length===0,fieldErrors:r}}function Kt(e,t,r){const n=e.title??G(t);return r?r.includes("minimum")?`${n} must be at least ${e.minimum}.`:r.includes("maximum")?`${n} must be at most ${e.maximum}.`:r.includes("minLength")?`${n} must be at least ${e.minLength} characters.`:r.includes("maxLength")?`${n} must be at most ${e.maxLength} characters.`:r.includes("pattern")?e.format==="email"?`${n} must be a valid email address.`:`${n} is not in the expected format.`:r.includes("one of")?`${n} must be one of the allowed options.`:r.includes("expected integer")?`${n} must be a whole number.`:r.includes("expected")?`${n} is invalid.`:r.includes("minItems")?`${n}: choose at least ${e.minItems}.`:r.includes("maxItems")?`${n}: choose at most ${e.maxItems}.`:`${n} is invalid.`:`${n} is invalid.`}function Tt(e,t){return e?.["x-kai-widget"]==="password"?t==null||t===""?"\u2014":"\u2022\u2022\u2022\u2022":typeof t=="boolean"?t?"Yes":"No":t==null||t===""?"\u2014":Array.isArray(t)?t.length?t.map(r=>String(r)).join(", "):"\u2014":String(t)}function Vt(e,t){const r=e.properties??{};return(Array.isArray(e["x-kai-order"])&&e["x-kai-order"].length>0?e["x-kai-order"].filter(n=>n in r):Object.keys(r)).map(n=>{const l=r[n];return{key:n,label:l?.title??n,value:Tt(l,t[n])}})}function de(e,t){const r={};for(const n of Object.keys(e.properties??{})){const l=e.properties[n],s=Rt(l,t[n]);s===void 0||s===""||Array.isArray(s)&&s.length===0||(r[n]=s)}return r}const ce={type:"object",properties:{}};function Jt(e){const t=x({cardId:"kai-form"},e),[r]=Se(t,["data","cardId","heading","host","hostElement","class","resolution","values","defaultValues","disabled","onValuesChange","controllerRef"]),n=Oe(),l=u=>{const d=r.host??n;d?d.emit(u):r.hostElement&&Me(r.hostElement,u)},s=L(()=>{const u=r.data;return u?u.type!=="object"||typeof u.properties!="object"||u.properties===null?{ok:!1,message:"This form couldn't be displayed."}:{ok:!0,message:""}:{ok:!1,message:"No form definition provided."}}),a=L(()=>s().ok?r.data??ce:ce),o=()=>a()["x-kai-inlineMax"]??W,y=L(()=>Nt(a())),c=Be({prop:()=>r.resolution,data:()=>r.data}),[p,f]=ne({}),[b,I]=ne({}),w=u=>{const d={};for(const[m,h]of Object.entries(u.properties??{}))h.default!==void 0?d[m]=h.default:h.type==="array"&&(d[m]=[]);return r.defaultValues&&Object.assign(d,r.defaultValues),r.values&&Object.assign(d,r.values),d},v=u=>{const d=w(u);f(B(m=>{for(const h of Object.keys(m))delete m[h];Object.assign(m,d)})),I(B(m=>{for(const h of Object.keys(m))delete m[h]}))},N=()=>{const u=a(),d={};for(const[m,h]of Object.entries(u.properties??{}))h.default!==void 0?d[m]=h.default:h.type==="array"&&(d[m]=[]);f(B(m=>{for(const h of Object.keys(m))delete m[h];Object.assign(m,d)})),I(B(m=>{for(const h of Object.keys(m))delete m[h]}))};R(K(()=>r.data,()=>{s().ok&&v(a())})),R(K(()=>r.values,u=>{u&&f(B(d=>{for(const m of Object.keys(d))delete d[m];Object.assign(d,u)}))},{defer:!0})),R(K(s,u=>{u.ok?l({kind:"ready",cardId:r.cardId}):l({kind:"error",cardId:r.cardId,message:u.message})})),R(()=>{var u;const d=r.hostElement;d&&(((u=c.resolution())==null?void 0:u.kind)==="submit"?d.setAttribute("data-kai-resolved","submitted"):d.removeAttribute("data-kai-resolved"))});const ge=(u,d)=>{var m;f(u,d),b[u]&&I(u,void 0);const h=T(p),S=de(a(),h),{valid:C}=D(a(),h);(m=r.onValuesChange)==null||m.call(r,{values:S,valid:C})},fe=u=>{const d=a().properties[u];if(!d)return;const m=D({required:a().required,properties:{[u]:d}},{[u]:p[u]});I(u,m.fieldErrors[u])},Y=u=>{var d;return u?.closest("form")??u??((d=r.hostElement)==null?void 0:d.shadowRoot)??document},Z=(u,d,m)=>{var h;(h=d.querySelector(`[data-field="${Yt(u)}"] [data-control]`))==null||h.focus(m)},Q=u=>{if(c.isResolved())return!1;const d=T(p),m=D(a(),d);if(I(B(S=>{for(const C of Object.keys(S))delete S[C];Object.assign(S,m.fieldErrors)})),!m.valid){const S=y().find(C=>m.fieldErrors[C]);if(S){const C=Y(u);queueMicrotask(()=>Z(S,C))}return!1}const h=de(a(),d);return l({kind:"submit",cardId:r.cardId,data:h}),c.setLocal({kind:"submit",data:h}),!0},pe=u=>{u.preventDefault(),Q(u.currentTarget)},X=()=>{c.isResolved()||(l({kind:"dismiss",cardId:r.cardId}),c.setLocal({kind:"dismissed"}))},ee=()=>l({kind:"reopen",cardId:r.cardId}),te=()=>r.disabled===!0;je(()=>{var u;(u=r.controllerRef)==null||u.call(r,{focus:d=>{const m=Y(),h=y().find(S=>b[S])??y()[0];h&&Z(h,m,d)},send:()=>{Q()},validate:()=>{const d=T(p),m=D(a(),d);return I(B(h=>{for(const S of Object.keys(h))delete h[S];Object.assign(h,m.fieldErrors)})),m.valid?{valid:!0}:{valid:!1,errors:m.fieldErrors}},reset:()=>N(),dismiss:()=>X(),reopen:()=>ee()})});const he=L(()=>a()["x-kai-actions"]??[]),ve=()=>a()["x-kai-submitLabel"]??"Submit",be=()=>a()["x-kai-dismissible"]===!0,xe=L(()=>{const u=c.resolution();return!u||u.kind!=="submit"?[]:Vt(a(),u.data??{})});return i(k,{get when(){return s().ok},get fallback(){return i(J,{get heading(){return r.heading},get errorMessage(){return s().message}})},get children(){return i(Ae,{fallback:()=>(l({kind:"error",cardId:r.cardId,message:"The form failed to render."}),i(J,{get heading(){return r.heading},errorMessage:"The form failed to render."})),get children(){return i(k,{get when(){return!c.isDeferred()},get fallback(){return i(qe,{type:"form",get title(){return r.heading??a().title},onReopen:ee})},get children(){return i(J,{get heading(){return r.heading??a().title},get description(){return a().description},get actions(){return i(k,{get when(){return!c.isResolved()},fallback:void 0,get children(){var u=vt(),d=u.firstChild;return g(u,i(k,{get when(){return be()},get children(){return i(q,{type:"button",variant:"ghost",onClick:X,children:"Dismiss"})}}),d),g(d,i(O,{get each(){return he()},children:m=>i(q,{type:"button",get variant(){return m.variant??"ghost"},onClick:()=>l({kind:"action",cardId:r.cardId,action:m.id}),get children(){return m.label}})}),null),g(d,i(q,{type:"submit",get form(){return me()},get disabled(){return te()},get children(){return ve()}}),null),u}})},get children(){return i(k,{get when(){return!c.isResolved()},get fallback(){return i(_t,{get rows(){return xe()},get optimistic(){return c.isOptimistic()}})},get children(){var u=ht();return u.addEventListener("submit",pe),g(u,i(O,{get each(){return y()},children:d=>i(P,{fieldKey:d,get field(){return a().properties[d]},get required(){return(a().required??[]).includes(d)},get inlineMax(){return o()},value:()=>p[d],error:()=>b[d],get disabled(){return te()},onInput:m=>ge(d,m),onBlur:()=>fe(d)})})),M(d=>{var m=me(),h=V("flex flex-col gap-3",r.class);return m!==d.e&&j(u,"id",d.e=m),h!==d.t&&Le(u,d.t=h),d},{e:void 0,t:void 0}),u}})}})}})}})}})}let Ft=0;const Ut=`kai-form-${++Ft}`;function me(){return Ut}function _t(e){return(()=>{var t=bt(),r=t.firstChild,n=r.firstChild,l=r.nextSibling;return g(r,i(Pe,{size:16,"aria-hidden":"true"}),n),g(l,i(O,{get each(){return e.rows},children:s=>[(()=>{var a=xt();return g(a,()=>s.label),a})(),(()=>{var a=yt();return g(a,()=>s.value),a})()]})),M(()=>j(t,"role",e.optimistic?"status":void 0)),t})()}function P(e){const t=`f-${e.fieldKey}-${Math.random().toString(36).slice(2,8)}`,r=`${t}-label`,n=`${t}-err`,l=`${t}-desc`,s=`${t}-fmt`,a=()=>e.field.title??G(e.fieldKey),o=L(()=>Ot(e.field,e.inlineMax)),y=()=>e.field["x-kai-placeholder"],c=L(()=>{const w=Mt(e.field,e.fieldKey);for(const v of w.warnings)qt(e.field,v);return w}),p=()=>[e.field.description?l:"",c().hint?s:"",e.error()?n:""].filter(Boolean).join(" ")||void 0,f=()=>["fieldset","repeater"].includes(o()),b=()=>["radio","checkbox-group","multiselect"].includes(o()),I=Ht(e,t,y,a,p,c,()=>f()?void 0:r);return(()=>{var w=It();return g(w,i(k,{get when(){return!f()},get children(){var v=wt();return j(v,"id",r),g(v,a,null),g(v,i(k,{get when(){return e.required},get children(){return kt()}}),null),M(()=>j(v,"for",b()?void 0:t)),v}}),null),g(w,i(k,{get when(){return e.field.description},get children(){var v=se();return j(v,"id",l),g(v,()=>e.field.description),v}}),null),g(w,i(k,{get when(){return c().hint},get children(){var v=se();return j(v,"id",s),g(v,()=>c().hint),v}}),null),g(w,i(Wt,{get widget(){return o()},common:I,get fieldKey(){return e.fieldKey}}),null),g(w,i(k,{get when(){return e.error()},get children(){var v=$t();return j(v,"id",n),g(v,()=>e.error()),v}}),null),M(()=>j(w,"data-field",e.fieldKey)),w})()}function Ht(e,t,r,n,l=()=>{},s=()=>Bt,a=()=>{}){return{id:t,get value(){return Et(s(),e.value())},get mask(){return s()},get field(){return e.field},get disabled(){return e.disabled||e.field.readOnly===!0},get placeholder(){return r()},get required(){return e.required},get invalid(){return!!e.error()},get describedBy(){return l()},get label(){return n()},get labelledBy(){return a()},onInput:o=>e.onInput(o),onBlur:()=>e.onBlur()}}function Wt(e){const t=()=>e.widget,r=()=>e.common;return[i(k,{get when(){return t()==="text"||t()==="email"||t()==="url"||t()==="date"||t()==="datetime"||t()==="time"||t()==="password"},get children(){return i(it,x(r,{get variant(){return t()}}))}}),i(k,{get when(){return t()==="textarea"},get children(){return i(at,x(r))}}),i(k,{get when(){return t()==="number"},get children(){return i(st,x(r))}}),i(k,{get when(){return t()==="slider"},get children(){return i(ot,x(r))}}),i(k,{get when(){return t()==="rating"},get children(){return i(ut,x(r))}}),i(k,{get when(){return t()==="switch"},get children(){return i(lt,x(r))}}),i(k,{get when(){return t()==="checkbox"},get children(){return i(dt,x(r))}}),i(k,{get when(){return t()==="radio"},get children(){return i(ct,x(r))}}),i(k,{get when(){return t()==="select"},get children(){return i(mt,x(r))}}),i(k,{get when(){return t()==="checkbox-group"},get children(){return i(ae,x(r))}}),i(k,{get when(){return t()==="multiselect"},get children(){return i(ft,x(r))}}),i(k,{get when(){return t()==="taglist"},get children(){return i(pt,x(r))}}),i(k,{get when(){return t()==="repeater"},get children(){return i(Pt,x(r,{inlineMax:W}))}}),i(k,{get when(){return t()==="fieldset"},get children(){return i(Gt,x(r,{inlineMax:W}))}}),i(k,{get when(){return t()==="unsupported"},get children(){var n=St(),l=n.firstChild,s=l.nextSibling;return s.nextSibling,g(n,()=>e.fieldKey,s),n}})]}function Gt(e){const t=()=>e.field.properties??{},r=()=>e.value&&typeof e.value=="object"?e.value:{},n=(l,s)=>{e.onInput({...r(),[l]:s})};return(()=>{var l=jt(),s=l.firstChild;return g(s,()=>e.label),g(l,i(O,{get each(){return Object.keys(t())},children:a=>i(P,{fieldKey:a,get field(){return t()[a]},get required(){return(e.field.required??[]).includes(a)},get inlineMax(){return e.inlineMax},value:()=>r()[a],error:()=>{},get disabled(){return e.disabled},onInput:o=>n(a,o),get onBlur(){return e.onBlur}})}),null),l})()}function Pt(e){const t=()=>e.field.items??{type:"object",properties:{}},r=()=>Array.isArray(e.value)?e.value:[],n=o=>e.onInput(o),l=()=>n([...r(),{}]),s=o=>n(r().filter((y,c)=>c!==o)),a=(o,y,c)=>{const p=r().slice();p[o]={...p[o],[y]:c},n(p)};return(()=>{var o=At(),y=o.firstChild;return g(y,()=>e.label),g(o,i(Ce,{get each(){return r()},children:(c,p)=>(()=>{var f=Lt(),b=f.firstChild,I=b.firstChild;return I.firstChild,g(I,p+1,null),g(b,i(q,{type:"button",size:"icon-sm",variant:"ghost","aria-label":`Remove row ${p+1}`,get disabled(){return e.disabled},onClick:()=>s(p),children:"\u2715"}),null),g(f,i(O,{get each(){return Object.keys(t().properties??{})},children:w=>i(P,{fieldKey:w,get field(){return t().properties[w]},get required(){return(t().required??[]).includes(w)},get inlineMax(){return e.inlineMax},value:()=>{var v;return(v=c())==null?void 0:v[w]},error:()=>{},get disabled(){return e.disabled},onInput:v=>a(p,w,v),get onBlur(){return e.onBlur}})}),null),f})()}),null),g(o,i(q,{type:"button",variant:"outline",size:"sm",get disabled(){return e.disabled},onClick:l,children:"Add item"}),null),o})()}function Yt(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}export{Jt as F,ie as v};
1
+ import{c as i,q as x,i as g,S as k,m as ye,p as re,y as ke,u as we,d as j,a as M,F as O,k as L,g as $e,t as $,e as Ie,s as Se,j as R,x as K,o as je,E as Ae,b as Le,I as Ce}from"./define-By-uL588.js";import{c as ne,u as T,p as B}from"./store-Ciyk6eZG.js";import{c as V}from"./cn-DN5AWfiS.js";import{B as q}from"./button-DkuOnGLy.js";import{u as Oe,a as Be,C as J,D as qe}from"./use-card-resolution-DaZqAdWf.js";import{e as Me}from"./card-routing-0YidER_3.js";import{I as F,F as Ee,a as Ne,f as Re,c as U,n as ze,b as De,d as Ke}from"./input-DKbmkMos.js";import{T as Te}from"./textarea-Dpvbngbg.js";import{S as Ve}from"./slider-DDR9U-i0.js";import{S as Je}from"./select-2cLRtPGT.js";import{S as Fe}from"./switch-KkeQIbuH.js";import{C as Ue}from"./checkbox-D7iRB3nL.js";import{R as _e}from"./radio-BsoBMhkF.js";import{C as He}from"./checkbox-group-B2_rpoPM.js";import{s as We}from"./star-CilHq8GP.js";import{x as Ge}from"./x-Z5UntkIJ.js";import{c as Pe}from"./check-njkVdZu2.js";function _(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ye(e,t){switch(t){case"integer":return typeof e=="number"&&Number.isInteger(e);case"number":return typeof e=="number"&&Number.isFinite(e);case"array":return Array.isArray(e);case"null":return e===null;case"object":return _(e)==="object";default:return typeof e===t}}function H(e,t,r,n){const l=r||"(root)",s=(a,o,y=l)=>{n.push({path:y,keyword:a,message:`${y}: ${o}`})};if(e.type&&!Ye(t,e.type)){s("type",`expected ${e.type}, got ${_(t)}`);return}if("const"in e&&JSON.stringify(t)!==JSON.stringify(e.const)&&s("const",`must equal const ${JSON.stringify(e.const)}`),e.enum&&!e.enum.some(a=>JSON.stringify(a)===JSON.stringify(t))&&s("enum",`must be one of ${JSON.stringify(e.enum)}`),typeof t=="number"&&(e.minimum!==void 0&&t<e.minimum&&s("minimum",`< minimum ${e.minimum}`),e.maximum!==void 0&&t>e.maximum&&s("maximum",`> maximum ${e.maximum}`),e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum&&s("exclusiveMinimum","<= exclusiveMinimum"),e.exclusiveMaximum!==void 0&&t>=e.exclusiveMaximum&&s("exclusiveMaximum",">= exclusiveMaximum")),typeof t=="string"&&(e.minLength!==void 0&&t.length<e.minLength&&s("minLength",`shorter than minLength ${e.minLength}`),e.maxLength!==void 0&&t.length>e.maxLength&&s("maxLength",`longer than maxLength ${e.maxLength}`),e.pattern!==void 0&&!new RegExp(e.pattern).test(t)&&s("pattern","does not match pattern")),Array.isArray(t)&&(e.minItems!==void 0&&t.length<e.minItems&&s("minItems",`fewer than minItems ${e.minItems}`),e.maxItems!==void 0&&t.length>e.maxItems&&s("maxItems",`more than maxItems ${e.maxItems}`),e.uniqueItems&&new Set(t.map(a=>JSON.stringify(a))).size!==t.length&&s("uniqueItems","items not unique"),e.items&&t.forEach((a,o)=>H(e.items,a,`${l}[${o}]`,n))),_(t)==="object"){const a=t;for(const o of e.required??[])(!(o in a)||a[o]===void 0)&&s("required","required",`${l}.${o}`);if(e.properties)for(const[o,y]of Object.entries(e.properties))o in a&&a[o]!==void 0&&H(y,a[o],`${l}.${o}`,n)}}function ie(e,t){const r=[];return H(e,t,"",r),{valid:r.length===0,errors:r.map(n=>n.message),issues:r}}var Ze=$('<span class="self-end text-xs text-muted-foreground">/'),Qe=$('<div class="flex flex-col gap-1">'),Xe=$("<div role=radiogroup>"),et=$('<button type=button role=radio class="rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">'),tt=$('<label class="-mx-1.5 inline-flex cursor-pointer items-center gap-2.5 rounded-md px-1.5 py-1.5 text-sm text-foreground transition-colors hover:bg-muted/60"><span>'),rt=$('<div class="flex flex-col gap-2"role=group><div class="flex flex-wrap gap-1.5"></div><div class="flex items-center gap-2">'),nt=$('<span class="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground">');function z(e){return e.labelledBy!==void 0?{"aria-labelledby":e.labelledBy}:{"aria-label":e.label}}function A(e){return{"aria-required":e.required||void 0,"aria-invalid":e.invalid||void 0,"aria-describedby":e.describedBy}}function it(e){const t=()=>{switch(e.variant){case"email":return"email";case"url":return"url";case"date":return"date";case"datetime":return"datetime-local";case"time":return"time";case"password":return"password";default:return"text"}};return i(F,x({get id(){return e.id},"data-control":!0,get type(){return t()},get value(){return e.value??""},get placeholder(){return e.placeholder},get invalid(){return e.invalid},get disabled(){return e.disabled},get minLength(){return e.field.minLength},get maxLength(){return e.field.maxLength},get format(){var r;return(r=e.mask)==null?void 0:r.format},get guide(){var r;return(r=e.mask)==null?void 0:r.guide},get semantic(){var r;return(r=e.mask)==null?void 0:r.semantic}},()=>A(e),{onValueInput:r=>e.onInput(r),onValueChange:()=>e.onBlur()}))}function at(e){const t=()=>(e.value??"").length;return(()=>{var r=Qe();return g(r,i(Te,x({get id(){return e.id},"data-control":!0,get class(){return V(Ee,e.invalid&&"border-destructive dark:border-red-400/70")},get value(){return e.value??""},get placeholder(){return e.placeholder},get disabled(){return e.disabled},get maxLength(){return e.field.maxLength}},()=>A(e),{onInput:n=>e.onInput(n.currentTarget.value),get onBlur(){return e.onBlur}})),null),g(r,i(k,{get when(){return e.field.maxLength!==void 0},get children(){var n=Ze(),l=n.firstChild;return g(n,t,l),g(n,()=>e.field.maxLength,null),n}}),null),r})()}function st(e){const t=()=>e.field["x-kai-step"]??(e.field.type==="integer"?1:void 0);return i(F,x({get id(){return e.id},"data-control":!0,type:"number",get value(){return ye(()=>e.value===void 0||e.value===null)()?"":String(e.value)},get placeholder(){return e.placeholder},get invalid(){return e.invalid},get disabled(){return e.disabled},get min(){return e.field.minimum},get max(){return e.field.maximum},get step(){return t()}},()=>A(e),{onValueInput:r=>e.onInput(r),onValueChange:()=>e.onBlur()}))}function ot(e){const t=()=>e.field.minimum??0,r=()=>e.field.maximum??100,n=()=>e.field["x-kai-step"]??(e.field.type==="integer"?1:void 0),l=()=>e.value===void 0||e.value===null?t():Number(e.value);return i(Ve,x({get id(){return e.id},"data-control":!0,get value(){return l()},get min(){return t()},get max(){return r()},get step(){return n()},get disabled(){return e.disabled},valueLabel:!0,get"aria-valuetext"(){return String(l())}},()=>A(e),{onInput:s=>e.onInput(Number(s.currentTarget.value)),get onBlur(){return e.onBlur}}))}function ut(e){const t=()=>e.field.maximum??5,r=()=>e.field.minimum??1,n=()=>Number(e.value??0),l=()=>Array.from({length:t()},(c,p)=>p+1),s=()=>n()>=r()&&n()<=t()?n():r(),a=new Map,o=c=>{var p;const f=Math.min(t(),Math.max(r(),c));e.onInput(f),(p=a.get(f))==null||p.focus()},y=c=>{e.disabled||(c.key==="ArrowRight"||c.key==="ArrowUp"?(c.preventDefault(),o(n()+1)):c.key==="ArrowLeft"||c.key==="ArrowDown"?(c.preventDefault(),o(n()-1)):c.key==="Home"?(c.preventDefault(),o(r())):c.key==="End"&&(c.preventDefault(),o(t())))};return(()=>{var c=Xe();return re(c,x(()=>z(e),{class:"flex items-center gap-1 rounded-md"},()=>A(e)),!1,!0),g(c,i(O,{get each(){return l()},children:p=>(()=>{var f=et();return ke(f,"blur",e.onBlur),f.$$click=()=>o(p),f.$$keydown=y,we(b=>a.set(p,b),f),j(f,"aria-label",`${p} ${p===1?"star":"stars"}`),g(f,i(We,{size:20,get class(){return V(p<=n()?"fill-current text-[var(--color-primary)]":"")},"aria-hidden":"true"})),M(b=>{var I=s()===p?"":void 0,w=n()===p,v=s()===p?0:-1,N=e.disabled;return I!==b.e&&j(f,"data-control",b.e=I),w!==b.t&&j(f,"aria-checked",b.t=w),v!==b.a&&j(f,"tabindex",b.a=v),N!==b.o&&(f.disabled=b.o=N),b},{e:void 0,t:void 0,a:void 0,o:void 0}),f})()})),c})()}function lt(e){const t=()=>e.value===!0;return i(Fe,x({get id(){return e.id},"data-control":"",get checked(){return t()},get disabled(){return e.disabled},get label(){return e.label}},()=>A(e),{onChange:r=>{e.onInput(r),e.onBlur()}}))}function dt(e){return(()=>{var t=tt(),r=t.firstChild;return g(t,i(Ue,x({get id(){return e.id},"data-control":"",get checked(){return e.value===!0},get disabled(){return e.disabled}},()=>A(e),{onChange:n=>{e.onInput(n.currentTarget.checked),e.onBlur()}})),r),g(r,()=>e.label),t})()}function ct(e){const t=L(()=>(e.field.enum??[]).map(r=>({value:r,label:String(r)})));return i(_e,x({"data-control":""},()=>z(e),{get name(){return e.id},get options(){return t()},get value(){return e.value},get disabled(){return e.disabled}},()=>A(e),{onChange:r=>{e.onInput(r),e.onBlur()}}))}function mt(e){const t=L(()=>(e.field.enum??[]).map(r=>({value:r,label:String(r)})));return i(Je,x({get id(){return e.id},"data-control":!0,get options(){return t()},get value(){return e.value},get placeholder(){return e.placeholder??"Select\u2026"},get invalid(){return e.invalid},get disabled(){return e.disabled}},()=>A(e),{onChange:r=>{e.onInput(r.currentTarget.value),e.onBlur()}}))}function gt(e){const t=e.items;return t&&"enum"in t&&Array.isArray(t.enum)?t.enum:[]}function ae(e){const t=()=>Array.isArray(e.value)?e.value:[],r=L(()=>gt(e.field).map(n=>({value:n,label:String(n)})));return i(He,x({"data-control":""},()=>z(e),{get name(){return e.id},get class(){return e.class},get options(){return r()},get value(){return t()},get disabled(){return e.disabled}},()=>A(e),{onChange:n=>{e.onInput(n),e.onBlur()}}))}function ft(e){return i(ae,x(e,{class:"max-h-60 overflow-y-auto"}))}function pt(e){const t=()=>Array.isArray(e.value)?e.value:[],[r,n]=$e(""),l=()=>{const a=r().trim();a&&(e.onInput([...t(),a]),n(""),e.onBlur())},s=a=>{e.onInput(t().filter((o,y)=>y!==a)),e.onBlur()};return(()=>{var a=rt(),o=a.firstChild,y=o.nextSibling;return re(a,x(()=>z(e)),!1,!0),g(o,i(O,{get each(){return t()},children:(c,p)=>(()=>{var f=nt();return g(f,c,null),g(f,i(q,{type:"button",variant:"ghost",size:"icon-sm",class:"size-4 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground","aria-label":`Remove ${c}`,get disabled(){return e.disabled},onClick:()=>s(p()),get children(){return i(Ge,{size:12,"aria-hidden":"true"})}}),null),f})()})),g(y,i(F,x({get id(){return e.id},"data-control":!0,type:"text",get value(){return r()},get placeholder(){return e.placeholder??"Add\u2026"},get disabled(){return e.disabled}},()=>A(e),{onValueInput:c=>n(c),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())}})),null),g(y,i(q,{type:"button",variant:"outline",size:"md",get disabled(){return e.disabled},onClick:l,children:"Add"}),null),a})()}Ie(["keydown","click"]);var ht=$("<form novalidate>"),vt=$('<div class="flex w-full flex-wrap items-center justify-between gap-2"><div class="ml-auto flex flex-wrap items-center gap-2">'),bt=$('<div class="flex flex-col gap-3"><p class="flex items-center gap-2 text-sm font-medium text-foreground"><span>Submitted</span></p><dl class="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5">'),xt=$('<dt class="text-xs text-muted-foreground">'),yt=$('<dd class="m-0 text-sm font-medium text-foreground">'),kt=$('<span class="text-destructive dark:text-red-400"aria-hidden=true> *'),wt=$('<label class="text-sm font-medium text-foreground">'),se=$('<p class="text-xs text-muted-foreground">'),$t=$('<p role=alert class="text-xs text-destructive dark:text-red-400">'),It=$('<div class="flex flex-col gap-2 rounded-xl bg-surface p-3.5">'),St=$('<p class="rounded-md border border-dashed border-border p-2 text-xs text-muted-foreground">Unsupported field "<!>".'),jt=$('<fieldset class="flex flex-col gap-3 rounded-lg border border-border p-3"><legend class="px-1 text-sm font-medium text-foreground">'),At=$('<fieldset class="flex flex-col gap-3 rounded-lg border border-border p-3"data-control><legend class="px-1 text-sm font-medium text-foreground">'),Lt=$('<div class="flex flex-col gap-2 rounded-md border border-border/60 p-2"><div class="flex items-center justify-between"><span class="text-xs text-muted-foreground">Item ');const W=4,Ct=new Set(["textarea","slider","rating","radio","select","checkbox","password","switch"]);function Ot(e,t){const r=e["x-kai-widget"];if(r&&Ct.has(r))switch(r){case"textarea":return"textarea";case"slider":return"slider";case"rating":return"rating";case"radio":return"radio";case"select":return"select";case"checkbox":return"checkbox";case"password":return"password";case"switch":return"switch"}switch(e.type){case"string":{if(Array.isArray(e.enum))return e.enum.length<=t?"radio":"select";switch(e.format){case"email":return"email";case"uri":case"url":return"url";case"date":return"date";case"date-time":return"datetime";case"time":return"time"}return e.maxLength!==void 0&&e.maxLength>120?"textarea":"text"}case"number":case"integer":return"number";case"boolean":return"switch";case"array":{const n=e.items;return n&&"enum"in n&&Array.isArray(n.enum)?n.enum.length<=t?"checkbox-group":"multiselect":n&&"type"in n&&n.type==="object"?"repeater":(n&&"type"in n&&n.type,"taglist")}case"object":return"fieldset";default:return"unsupported"}}const Bt=Object.freeze({warnings:[]}),oe=new WeakMap;function qt(e,t){let r=oe.get(e);r===void 0&&(r=new Set,oe.set(e,r)),!r.has(t)&&(r.add(t),console.warn(t))}function E(e){return e.length<=32?e:`${e.slice(0,32)}\u2026 (${e.length} chars)`}const ue=Ne;function Mt(e,t=""){const r=e["x-kai-format"],n=e["x-kai-mask"],l=e["x-kai-mask-guide"],s=t?` on field "${E(t)}"`:"";if(r===void 0)return typeof n=="string"||typeof l=="string"?{warnings:[`kai-form: x-kai-mask${s} has no x-kai-format and is ignored. Set "x-kai-format": "custom" to mask with it.`]}:{warnings:[]};if(typeof r!="string"||!ue.includes(r))return{warnings:[`kai-form: x-kai-format "${E(String(r))}"${s} is not one of ${ue.join(", ")}. Rendering an unmasked text field.`]};const a=r,o=[],y=a==="custom";!y&&typeof n=="string"&&o.push(`kai-form: x-kai-mask${s} is read only with x-kai-format "custom"; "${a}" brings its own format. The mask is ignored.`);const c=y?n:Re(a).defaultFormat;if(typeof c!="string"||c==="")return o.push(`kai-form: x-kai-format "custom"${s} needs an x-kai-mask pattern. Rendering an unmasked text field.`),{warnings:o};let p;try{p=U(c)}catch(b){return o.push(`kai-form: x-kai-mask "${E(c)}"${s} did not compile (${b instanceof Error?b.message:String(b)}). Rendering an unmasked text field.`),{warnings:o}}if(p.capacity===0)return o.push(`kai-form: x-kai-mask "${E(c)}"${s} has no fill positions, so nothing could ever be typed into it. Use # for a digit, @ for a letter or digit, * for an obscurable one (e.g. "##/##/####", with "mm/dd/yyyy" as x-kai-mask-guide). Rendering an unmasked text field.`),{warnings:o};let f=typeof l=="string"?l:void 0;if(f!==void 0)try{U(c,f)}catch(b){o.push(`kai-form: x-kai-mask-guide "${E(f)}"${s} does not align with the pattern (${b instanceof Error?b.message:String(b)}). Using the pattern's own guide.`),f=void 0}return{format:c,guide:f,semantic:a,hint:`Format: ${f??c}`,warnings:o}}function Et(e,t){if(e.format===void 0||typeof t!="string"||t==="")return t;try{const r=U(e.format,e.guide),n=ze(r,t);return e.guide===void 0?De(r,n):Ke(r,n)}catch{return t}}function G(e){return e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\b\w/g,t=>t.toUpperCase())}function Nt(e){const t=Object.keys(e.properties??{}),r=e["x-kai-order"];if(Array.isArray(r)){const s=r.filter(o=>t.includes(o)),a=t.filter(o=>!s.includes(o));return[...s,...a]}const n=(e.required??[]).filter(s=>t.includes(s)),l=t.filter(s=>!n.includes(s));return[...n,...l]}function Rt(e,t){if(e.type==="number"||e.type==="integer"){if(t===""||t===null||t===void 0)return;const r=typeof t=="number"?t:Number(t);return Number.isNaN(r)?t:r}return e.type==="boolean"?!!t:t}const zt="^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";function Dt(e){const t={type:e.type};return e.enum&&(t.enum=e.enum),e.minimum!==void 0&&(t.minimum=e.minimum),e.maximum!==void 0&&(t.maximum=e.maximum),e.minLength!==void 0&&(t.minLength=e.minLength),e.maxLength!==void 0&&(t.maxLength=e.maxLength),e.minItems!==void 0&&(t.minItems=e.minItems),e.maxItems!==void 0&&(t.maxItems=e.maxItems),e.pattern!==void 0?t.pattern=e.pattern:e.format==="email"&&(t.pattern=zt),t}function le(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function D(e,t){const r={},n=new Set(e.required??[]);for(const[l,s]of Object.entries(e.properties??{})){const a=t[l];if(n.has(l)&&le(a)){r[l]=`${s.title??G(l)} is required.`;continue}if(le(a))continue;const o=ie(Dt(s),a);o.valid||(r[l]=Kt(s,l,o.errors[0]))}return{valid:Object.keys(r).length===0,fieldErrors:r}}function Kt(e,t,r){const n=e.title??G(t);return r?r.includes("minimum")?`${n} must be at least ${e.minimum}.`:r.includes("maximum")?`${n} must be at most ${e.maximum}.`:r.includes("minLength")?`${n} must be at least ${e.minLength} characters.`:r.includes("maxLength")?`${n} must be at most ${e.maxLength} characters.`:r.includes("pattern")?e.format==="email"?`${n} must be a valid email address.`:`${n} is not in the expected format.`:r.includes("one of")?`${n} must be one of the allowed options.`:r.includes("expected integer")?`${n} must be a whole number.`:r.includes("expected")?`${n} is invalid.`:r.includes("minItems")?`${n}: choose at least ${e.minItems}.`:r.includes("maxItems")?`${n}: choose at most ${e.maxItems}.`:`${n} is invalid.`:`${n} is invalid.`}function Tt(e,t){return e?.["x-kai-widget"]==="password"?t==null||t===""?"\u2014":"\u2022\u2022\u2022\u2022":typeof t=="boolean"?t?"Yes":"No":t==null||t===""?"\u2014":Array.isArray(t)?t.length?t.map(r=>String(r)).join(", "):"\u2014":String(t)}function Vt(e,t){const r=e.properties??{};return(Array.isArray(e["x-kai-order"])&&e["x-kai-order"].length>0?e["x-kai-order"].filter(n=>n in r):Object.keys(r)).map(n=>{const l=r[n];return{key:n,label:l?.title??n,value:Tt(l,t[n])}})}function de(e,t){const r={};for(const n of Object.keys(e.properties??{})){const l=e.properties[n],s=Rt(l,t[n]);s===void 0||s===""||Array.isArray(s)&&s.length===0||(r[n]=s)}return r}const ce={type:"object",properties:{}};function Jt(e){const t=x({cardId:"kai-form"},e),[r]=Se(t,["data","cardId","heading","host","hostElement","class","resolution","values","defaultValues","disabled","onValuesChange","controllerRef"]),n=Oe(),l=u=>{const d=r.host??n;d?d.emit(u):r.hostElement&&Me(r.hostElement,u)},s=L(()=>{const u=r.data;return u?u.type!=="object"||typeof u.properties!="object"||u.properties===null?{ok:!1,message:"This form couldn't be displayed."}:{ok:!0,message:""}:{ok:!1,message:"No form definition provided."}}),a=L(()=>s().ok?r.data??ce:ce),o=()=>a()["x-kai-inlineMax"]??W,y=L(()=>Nt(a())),c=Be({prop:()=>r.resolution,data:()=>r.data}),[p,f]=ne({}),[b,I]=ne({}),w=u=>{const d={};for(const[m,h]of Object.entries(u.properties??{}))h.default!==void 0?d[m]=h.default:h.type==="array"&&(d[m]=[]);return r.defaultValues&&Object.assign(d,r.defaultValues),r.values&&Object.assign(d,r.values),d},v=u=>{const d=w(u);f(B(m=>{for(const h of Object.keys(m))delete m[h];Object.assign(m,d)})),I(B(m=>{for(const h of Object.keys(m))delete m[h]}))},N=()=>{const u=a(),d={};for(const[m,h]of Object.entries(u.properties??{}))h.default!==void 0?d[m]=h.default:h.type==="array"&&(d[m]=[]);f(B(m=>{for(const h of Object.keys(m))delete m[h];Object.assign(m,d)})),I(B(m=>{for(const h of Object.keys(m))delete m[h]}))};R(K(()=>r.data,()=>{s().ok&&v(a())})),R(K(()=>r.values,u=>{u&&f(B(d=>{for(const m of Object.keys(d))delete d[m];Object.assign(d,u)}))},{defer:!0})),R(K(s,u=>{u.ok?l({kind:"ready",cardId:r.cardId}):l({kind:"error",cardId:r.cardId,message:u.message})})),R(()=>{var u;const d=r.hostElement;d&&(((u=c.resolution())==null?void 0:u.kind)==="submit"?d.setAttribute("data-kai-resolved","submitted"):d.removeAttribute("data-kai-resolved"))});const ge=(u,d)=>{var m;f(u,d),b[u]&&I(u,void 0);const h=T(p),S=de(a(),h),{valid:C}=D(a(),h);(m=r.onValuesChange)==null||m.call(r,{values:S,valid:C})},fe=u=>{const d=a().properties[u];if(!d)return;const m=D({required:a().required,properties:{[u]:d}},{[u]:p[u]});I(u,m.fieldErrors[u])},Y=u=>{var d;return u?.closest("form")??u??((d=r.hostElement)==null?void 0:d.shadowRoot)??document},Z=(u,d,m)=>{var h;(h=d.querySelector(`[data-field="${Yt(u)}"] [data-control]`))==null||h.focus(m)},Q=u=>{if(c.isResolved())return!1;const d=T(p),m=D(a(),d);if(I(B(S=>{for(const C of Object.keys(S))delete S[C];Object.assign(S,m.fieldErrors)})),!m.valid){const S=y().find(C=>m.fieldErrors[C]);if(S){const C=Y(u);queueMicrotask(()=>Z(S,C))}return!1}const h=de(a(),d);return l({kind:"submit",cardId:r.cardId,data:h}),c.setLocal({kind:"submit",data:h}),!0},pe=u=>{u.preventDefault(),Q(u.currentTarget)},X=()=>{c.isResolved()||(l({kind:"dismiss",cardId:r.cardId}),c.setLocal({kind:"dismissed"}))},ee=()=>l({kind:"reopen",cardId:r.cardId}),te=()=>r.disabled===!0;je(()=>{var u;(u=r.controllerRef)==null||u.call(r,{focus:d=>{const m=Y(),h=y().find(S=>b[S])??y()[0];h&&Z(h,m,d)},send:()=>{Q()},validate:()=>{const d=T(p),m=D(a(),d);return I(B(h=>{for(const S of Object.keys(h))delete h[S];Object.assign(h,m.fieldErrors)})),m.valid?{valid:!0}:{valid:!1,errors:m.fieldErrors}},reset:()=>N(),dismiss:()=>X(),reopen:()=>ee()})});const he=L(()=>a()["x-kai-actions"]??[]),ve=()=>a()["x-kai-submitLabel"]??"Submit",be=()=>a()["x-kai-dismissible"]===!0,xe=L(()=>{const u=c.resolution();return!u||u.kind!=="submit"?[]:Vt(a(),u.data??{})});return i(k,{get when(){return s().ok},get fallback(){return i(J,{get heading(){return r.heading},get errorMessage(){return s().message}})},get children(){return i(Ae,{fallback:()=>(l({kind:"error",cardId:r.cardId,message:"The form failed to render."}),i(J,{get heading(){return r.heading},errorMessage:"The form failed to render."})),get children(){return i(k,{get when(){return!c.isDeferred()},get fallback(){return i(qe,{type:"form",get title(){return r.heading??a().title},onReopen:ee})},get children(){return i(J,{get heading(){return r.heading??a().title},get description(){return a().description},get actions(){return i(k,{get when(){return!c.isResolved()},fallback:void 0,get children(){var u=vt(),d=u.firstChild;return g(u,i(k,{get when(){return be()},get children(){return i(q,{type:"button",variant:"ghost",onClick:X,children:"Dismiss"})}}),d),g(d,i(O,{get each(){return he()},children:m=>i(q,{type:"button",get variant(){return m.variant??"ghost"},onClick:()=>l({kind:"action",cardId:r.cardId,action:m.id}),get children(){return m.label}})}),null),g(d,i(q,{type:"submit",get form(){return me()},get disabled(){return te()},get children(){return ve()}}),null),u}})},get children(){return i(k,{get when(){return!c.isResolved()},get fallback(){return i(_t,{get rows(){return xe()},get optimistic(){return c.isOptimistic()}})},get children(){var u=ht();return u.addEventListener("submit",pe),g(u,i(O,{get each(){return y()},children:d=>i(P,{fieldKey:d,get field(){return a().properties[d]},get required(){return(a().required??[]).includes(d)},get inlineMax(){return o()},value:()=>p[d],error:()=>b[d],get disabled(){return te()},onInput:m=>ge(d,m),onBlur:()=>fe(d)})})),M(d=>{var m=me(),h=V("flex flex-col gap-3",r.class);return m!==d.e&&j(u,"id",d.e=m),h!==d.t&&Le(u,d.t=h),d},{e:void 0,t:void 0}),u}})}})}})}})}})}let Ft=0;const Ut=`kai-form-${++Ft}`;function me(){return Ut}function _t(e){return(()=>{var t=bt(),r=t.firstChild,n=r.firstChild,l=r.nextSibling;return g(r,i(Pe,{size:16,"aria-hidden":"true"}),n),g(l,i(O,{get each(){return e.rows},children:s=>[(()=>{var a=xt();return g(a,()=>s.label),a})(),(()=>{var a=yt();return g(a,()=>s.value),a})()]})),M(()=>j(t,"role",e.optimistic?"status":void 0)),t})()}function P(e){const t=`f-${e.fieldKey}-${Math.random().toString(36).slice(2,8)}`,r=`${t}-label`,n=`${t}-err`,l=`${t}-desc`,s=`${t}-fmt`,a=()=>e.field.title??G(e.fieldKey),o=L(()=>Ot(e.field,e.inlineMax)),y=()=>e.field["x-kai-placeholder"],c=L(()=>{const w=Mt(e.field,e.fieldKey);for(const v of w.warnings)qt(e.field,v);return w}),p=()=>[e.field.description?l:"",c().hint?s:"",e.error()?n:""].filter(Boolean).join(" ")||void 0,f=()=>["fieldset","repeater"].includes(o()),b=()=>["radio","checkbox-group","multiselect"].includes(o()),I=Ht(e,t,y,a,p,c,()=>f()?void 0:r);return(()=>{var w=It();return g(w,i(k,{get when(){return!f()},get children(){var v=wt();return j(v,"id",r),g(v,a,null),g(v,i(k,{get when(){return e.required},get children(){return kt()}}),null),M(()=>j(v,"for",b()?void 0:t)),v}}),null),g(w,i(k,{get when(){return e.field.description},get children(){var v=se();return j(v,"id",l),g(v,()=>e.field.description),v}}),null),g(w,i(k,{get when(){return c().hint},get children(){var v=se();return j(v,"id",s),g(v,()=>c().hint),v}}),null),g(w,i(Wt,{get widget(){return o()},common:I,get fieldKey(){return e.fieldKey}}),null),g(w,i(k,{get when(){return e.error()},get children(){var v=$t();return j(v,"id",n),g(v,()=>e.error()),v}}),null),M(()=>j(w,"data-field",e.fieldKey)),w})()}function Ht(e,t,r,n,l=()=>{},s=()=>Bt,a=()=>{}){return{id:t,get value(){return Et(s(),e.value())},get mask(){return s()},get field(){return e.field},get disabled(){return e.disabled||e.field.readOnly===!0},get placeholder(){return r()},get required(){return e.required},get invalid(){return!!e.error()},get describedBy(){return l()},get label(){return n()},get labelledBy(){return a()},onInput:o=>e.onInput(o),onBlur:()=>e.onBlur()}}function Wt(e){const t=()=>e.widget,r=()=>e.common;return[i(k,{get when(){return t()==="text"||t()==="email"||t()==="url"||t()==="date"||t()==="datetime"||t()==="time"||t()==="password"},get children(){return i(it,x(r,{get variant(){return t()}}))}}),i(k,{get when(){return t()==="textarea"},get children(){return i(at,x(r))}}),i(k,{get when(){return t()==="number"},get children(){return i(st,x(r))}}),i(k,{get when(){return t()==="slider"},get children(){return i(ot,x(r))}}),i(k,{get when(){return t()==="rating"},get children(){return i(ut,x(r))}}),i(k,{get when(){return t()==="switch"},get children(){return i(lt,x(r))}}),i(k,{get when(){return t()==="checkbox"},get children(){return i(dt,x(r))}}),i(k,{get when(){return t()==="radio"},get children(){return i(ct,x(r))}}),i(k,{get when(){return t()==="select"},get children(){return i(mt,x(r))}}),i(k,{get when(){return t()==="checkbox-group"},get children(){return i(ae,x(r))}}),i(k,{get when(){return t()==="multiselect"},get children(){return i(ft,x(r))}}),i(k,{get when(){return t()==="taglist"},get children(){return i(pt,x(r))}}),i(k,{get when(){return t()==="repeater"},get children(){return i(Pt,x(r,{inlineMax:W}))}}),i(k,{get when(){return t()==="fieldset"},get children(){return i(Gt,x(r,{inlineMax:W}))}}),i(k,{get when(){return t()==="unsupported"},get children(){var n=St(),l=n.firstChild,s=l.nextSibling;return s.nextSibling,g(n,()=>e.fieldKey,s),n}})]}function Gt(e){const t=()=>e.field.properties??{},r=()=>e.value&&typeof e.value=="object"?e.value:{},n=(l,s)=>{e.onInput({...r(),[l]:s})};return(()=>{var l=jt(),s=l.firstChild;return g(s,()=>e.label),g(l,i(O,{get each(){return Object.keys(t())},children:a=>i(P,{fieldKey:a,get field(){return t()[a]},get required(){return(e.field.required??[]).includes(a)},get inlineMax(){return e.inlineMax},value:()=>r()[a],error:()=>{},get disabled(){return e.disabled},onInput:o=>n(a,o),get onBlur(){return e.onBlur}})}),null),l})()}function Pt(e){const t=()=>e.field.items??{type:"object",properties:{}},r=()=>Array.isArray(e.value)?e.value:[],n=o=>e.onInput(o),l=()=>n([...r(),{}]),s=o=>n(r().filter((y,c)=>c!==o)),a=(o,y,c)=>{const p=r().slice();p[o]={...p[o],[y]:c},n(p)};return(()=>{var o=At(),y=o.firstChild;return g(y,()=>e.label),g(o,i(Ce,{get each(){return r()},children:(c,p)=>(()=>{var f=Lt(),b=f.firstChild,I=b.firstChild;return I.firstChild,g(I,p+1,null),g(b,i(q,{type:"button",size:"icon-sm",variant:"ghost","aria-label":`Remove row ${p+1}`,get disabled(){return e.disabled},onClick:()=>s(p),children:"\u2715"}),null),g(f,i(O,{get each(){return Object.keys(t().properties??{})},children:w=>i(P,{fieldKey:w,get field(){return t().properties[w]},get required(){return(t().required??[]).includes(w)},get inlineMax(){return e.inlineMax},value:()=>{var v;return(v=c())==null?void 0:v[w]},error:()=>{},get disabled(){return e.disabled},onInput:v=>a(p,w,v),get onBlur(){return e.onBlur}})}),null),f})()}),null),g(o,i(q,{type:"button",variant:"outline",size:"sm",get disabled(){return e.disabled},onClick:l,children:"Add item"}),null),o})()}function Yt(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}export{Jt as F,ie as v};
@@ -1 +1 @@
1
- import{s as L,c as d,g as v,m as A,h as m,A as C,P as S,y as f,u as q,i as I,a as P,n as k,d as b,b as z,S as H,w as R,G as $,t as O,B,e as G}from"./define-CGGX-7Vg.js";import{c as h}from"./cn-DN5AWfiS.js";import{A as M,c as j,u as F,a as J}from"./overlay-C1od6LOz.js";var K=O("<div data-hovercard-content class=z-50 style=position:fixed;background:transparent><div>");const x=B(),w=()=>{const t=$(x);if(!t)throw new Error("HoverCard parts must be used within <HoverCardRoot>");return t};function D(t){var e;const[s,a]=v(t.defaultOpen??!1),[i,o]=v(),[l,n]=v(),c=R();let r;(e=t.controllerRef)==null||e.call(t,{open:s,setOpen:a});const u=()=>{t.disabled||(clearTimeout(r),r=window.setTimeout(()=>a(!0),t.openDelay??0))},g=()=>{clearTimeout(r),r=window.setTimeout(()=>a(!1),t.closeDelay??300)},p=()=>{clearTimeout(r),a(!1)};return m(()=>clearTimeout(r)),d(x.Provider,{value:{open:s,enter:u,leave:g,close:p,setTrigger:o,setContent:n,trigger:i,content:l,contentId:c,disabled:()=>t.disabled??!1},get children(){return t.children}})}const y='a[href],button,input,select,textarea,summary,[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex^="-"])',N=t=>t.querySelector(y)?!0:Array.from(t.querySelectorAll("slot")).some(e=>e.assignedElements().some(s=>s.matches(y)||s.querySelector(y)));function E(t){const e=w(),[s,a]=v(!1),i=()=>(t.focusable??s())&&!e.disabled();return d(M,{as:"span",get class(){return h("inline-block",i()&&"rounded-sm focus-visible:[outline-style:solid] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",t.class)},ref:o=>{e.setTrigger(o);const l=()=>e.enter(),n=()=>e.leave();o.addEventListener("focusin",l),o.addEventListener("focusout",n),m(()=>{o.removeEventListener("focusin",l),o.removeEventListener("focusout",n)});const c=()=>a(!N(o));c();for(const r of Array.from(o.querySelectorAll("slot")))r.addEventListener("slotchange",c),m(()=>r.removeEventListener("slotchange",c))},get tabIndex(){return i()?0:void 0},get"aria-describedby"(){return A(()=>!!(i()&&e.open()))()?e.contentId:void 0},get onPointerEnter(){return e.enter},get onPointerLeave(){return e.leave},get children(){return t.children}})}const Q=8;function U(t,e){const s=t.split("-")[0];return{[{bottom:"padding-top",top:"padding-bottom",left:"padding-right",right:"padding-left"}[s]??"padding-top"]:`${e}px`}}function T(t){const e=w(),s=C(),a=j(e.open),i=F(e.trigger,e.content,{placement:t.placement??"bottom",gutter:0,onDisconnect:()=>e.close()});return J({enabled:e.open,onDismiss:()=>e.close(),refs:()=>[e.trigger(),e.content()]}),d(H,{get when(){return a.present()},get children(){return d(S,{get mount(){return s.portalMount()},get children(){var o=K(),l=o.firstChild;return f(o,"focusout",e.leave,!0),f(o,"focusin",e.enter,!0),f(o,"pointerleave",e.leave),f(o,"pointerenter",e.enter),q(n=>{e.setContent(n),a.setRef(n)},o),I(l,()=>t.children),P(n=>{var c={left:`${i.pos().x}px`,top:`${i.pos().y}px`,visibility:i.hidden()?"hidden":"visible",...U(i.pos().placement,Q)},r=e.contentId,u=a.state()==="open"?"":void 0,g=a.state()==="closed"?"":void 0,p=h("rounded-lg bg-card kai-elevation","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",t.class);return n.e=k(o,c,n.e),r!==n.t&&b(l,"id",n.t=r),u!==n.a&&b(l,"data-expanded",n.a=u),g!==n.o&&b(l,"data-closed",n.o=g),p!==n.i&&z(l,n.i=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o}})}})}function Y(t){const[e]=L(t,["trigger","children","class","openDelay","closeDelay","placement"]);return d(D,{get openDelay(){return e.openDelay},get closeDelay(){return e.closeDelay},get children(){return[d(E,{get children(){return e.trigger}}),d(T,{get class(){return h("w-64 p-4",e.class)},get placement(){return e.placement},get children(){return e.children}})]}})}G(["focusin","focusout"]);export{D as H,E as a,T as b,Y as c};
1
+ import{s as L,c as d,g as v,m as A,h as m,A as C,P as S,y as f,u as q,i as H,a as I,n as P,d as b,b as k,S as z,w as R,H as $,t as O,G,e as M}from"./define-By-uL588.js";import{c as h}from"./cn-DN5AWfiS.js";import{A as j,c as B,u as F,a as J}from"./overlay-Cb-MkyDa.js";var K=O("<div data-hovercard-content class=z-50 style=position:fixed;background:transparent><div>");const x=G(),w=()=>{const t=$(x);if(!t)throw new Error("HoverCard parts must be used within <HoverCardRoot>");return t};function D(t){var e;const[s,a]=v(t.defaultOpen??!1),[i,o]=v(),[l,n]=v(),c=R();let r;(e=t.controllerRef)==null||e.call(t,{open:s,setOpen:a});const u=()=>{t.disabled||(clearTimeout(r),r=window.setTimeout(()=>a(!0),t.openDelay??0))},g=()=>{clearTimeout(r),r=window.setTimeout(()=>a(!1),t.closeDelay??300)},p=()=>{clearTimeout(r),a(!1)};return m(()=>clearTimeout(r)),d(x.Provider,{value:{open:s,enter:u,leave:g,close:p,setTrigger:o,setContent:n,trigger:i,content:l,contentId:c,disabled:()=>t.disabled??!1},get children(){return t.children}})}const y='a[href],button,input,select,textarea,summary,[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex^="-"])',N=t=>t.querySelector(y)?!0:Array.from(t.querySelectorAll("slot")).some(e=>e.assignedElements().some(s=>s.matches(y)||s.querySelector(y)));function E(t){const e=w(),[s,a]=v(!1),i=()=>(t.focusable??s())&&!e.disabled();return d(j,{as:"span",get class(){return h("inline-block",i()&&"rounded-sm focus-visible:[outline-style:solid] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",t.class)},ref:o=>{e.setTrigger(o);const l=()=>e.enter(),n=()=>e.leave();o.addEventListener("focusin",l),o.addEventListener("focusout",n),m(()=>{o.removeEventListener("focusin",l),o.removeEventListener("focusout",n)});const c=()=>a(!N(o));c();for(const r of Array.from(o.querySelectorAll("slot")))r.addEventListener("slotchange",c),m(()=>r.removeEventListener("slotchange",c))},get tabIndex(){return i()?0:void 0},get"aria-describedby"(){return A(()=>!!(i()&&e.open()))()?e.contentId:void 0},get onPointerEnter(){return e.enter},get onPointerLeave(){return e.leave},get children(){return t.children}})}const Q=8;function U(t,e){const s=t.split("-")[0];return{[{bottom:"padding-top",top:"padding-bottom",left:"padding-right",right:"padding-left"}[s]??"padding-top"]:`${e}px`}}function T(t){const e=w(),s=C(),a=B(e.open),i=F(e.trigger,e.content,{placement:t.placement??"bottom",gutter:0,onDisconnect:()=>e.close()});return J({enabled:e.open,onDismiss:()=>e.close(),refs:()=>[e.trigger(),e.content()]}),d(z,{get when(){return a.present()},get children(){return d(S,{get mount(){return s.portalMount()},get children(){var o=K(),l=o.firstChild;return f(o,"focusout",e.leave,!0),f(o,"focusin",e.enter,!0),f(o,"pointerleave",e.leave),f(o,"pointerenter",e.enter),q(n=>{e.setContent(n),a.setRef(n)},o),H(l,()=>t.children),I(n=>{var c={left:`${i.pos().x}px`,top:`${i.pos().y}px`,visibility:i.hidden()?"hidden":"visible",...U(i.pos().placement,Q)},r=e.contentId,u=a.state()==="open"?"":void 0,g=a.state()==="closed"?"":void 0,p=h("rounded-lg bg-card kai-elevation","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",t.class);return n.e=P(o,c,n.e),r!==n.t&&b(l,"id",n.t=r),u!==n.a&&b(l,"data-expanded",n.a=u),g!==n.o&&b(l,"data-closed",n.o=g),p!==n.i&&k(l,n.i=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o}})}})}function Y(t){const[e]=L(t,["trigger","children","class","openDelay","closeDelay","placement"]);return d(D,{get openDelay(){return e.openDelay},get closeDelay(){return e.closeDelay},get children(){return[d(E,{get children(){return e.trigger}}),d(T,{get class(){return h("w-64 p-4",e.class)},get placement(){return e.placement},get children(){return e.children}})]}})}M(["focusin","focusout"]);export{D as H,E as a,T as b,Y as c};
@@ -1 +1 @@
1
- import{c as a,q as i,d as c,a as p,b as s,i as g,t as d}from"./define-CGGX-7Vg.js";import{p as w}from"./play-OFIvYXUQ.js";import{I as r}from"./Icon-BnFKqqtY.js";import{a as N}from"./arrow-down-Br0qtpsz.js";import{a as b}from"./arrow-left-Dj7xgE12.js";import{e as q,d as z,a as j,r as A,h as L,c as C}from"./rotate-cw-DOB9IGcU.js";import{b as H}from"./bell-sn17Ip9v.js";import{t as S,f as V,b as B,s as P,p as G}from"./trash-2-BR1RxGky.js";import{c as O}from"./check-DPeeMUYx.js";import{c as Z}from"./chevron-down-CHSWk7ZT.js";import{c as U}from"./chevron-right-B7l_fMgx.js";import{c as E}from"./circle-check-BGZpCiz7.js";import{c as F}from"./circle-x-wobWkoSx.js";import{c as I}from"./circle-Bb0yOpqM.js";import{c as R}from"./copy-B6DO4PqB.js";import{e as l}from"./ellipsis-DFr4Vqr3.js";import{e as T}from"./external-link-u9d85ORQ.js";import{f as W}from"./file-text-CX7_x42o.js";import{f as D}from"./folder-V-YdIL8f.js";import{i as J,g as _,p as $}from"./paperclip-BDNoZFJP.js";import{i as K}from"./info-8mFsIjS3.js";import{l as Q}from"./link-DlZZBGaR.js";import{m as X,a as Y}from"./minimize-2-UEZmP2QT.js";import{m as ee}from"./message-circle-Xf8Q-vZp.js";import{m as ae}from"./message-square-Cxnwgkns.js";import{p as ie}from"./panel-right-ryET0yyn.js";import{r as re}from"./rotate-ccw-0DLRDHH5.js";import{s as te}from"./settings-CE-78SvZ.js";import{t as oe}from"./triangle-alert-DHohDOCy.js";import{u as ye}from"./upload-BbGW6A_u.js";import{x as ne}from"./x-C5m1JFgi.js";var he=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],me=e=>a(r,i(e,{name:"Archive",iconNode:he})),ce=me,pe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],se=e=>a(r,i(e,{name:"ArrowUp",iconNode:pe})),de=se,le=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],ke=e=>a(r,i(e,{name:"AudioLines",iconNode:le})),xe=ke,ve=[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]],fe=e=>a(r,i(e,{name:"BookOpen",iconNode:ve})),ue=fe,Me=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],ge=e=>a(r,i(e,{name:"Box",iconNode:Me})),we=ge,Ne=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],be=e=>a(r,i(e,{name:"Briefcase",iconNode:Ne})),qe=be,ze=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],je=e=>a(r,i(e,{name:"ChevronLeft",iconNode:ze})),Ae=je,Le=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ce=e=>a(r,i(e,{name:"ChevronUp",iconNode:Le})),He=Ce,Se=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ve=e=>a(r,i(e,{name:"CircleAlert",iconNode:Se})),k=Ve,Be=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Pe=e=>a(r,i(e,{name:"Clock",iconNode:Be})),Ge=Pe,Oe=[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],Ze=e=>a(r,i(e,{name:"EyeOff",iconNode:Oe})),Ue=Ze,Ee=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Fe=e=>a(r,i(e,{name:"GitBranch",iconNode:Ee})),Ie=Fe,Re=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Te=e=>a(r,i(e,{name:"GitPullRequest",iconNode:Re})),We=Te,De=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Je=e=>a(r,i(e,{name:"Github",iconNode:De})),_e=Je,$e=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],Ke=e=>a(r,i(e,{name:"Laptop",iconNode:$e})),Qe=Ke,Xe=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Ye=e=>a(r,i(e,{name:"ListFilter",iconNode:Xe})),e1=Ye,a1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],i1=e=>a(r,i(e,{name:"Lock",iconNode:a1})),r1=i1,t1=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],o1=e=>a(r,i(e,{name:"Mic",iconNode:t1})),x=o1,y1=[["path",{d:"M5 12h14",key:"1ays0h"}]],n1=e=>a(r,i(e,{name:"Minus",iconNode:y1})),h1=n1,m1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],c1=e=>a(r,i(e,{name:"Monitor",iconNode:m1})),v=c1,p1=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],s1=e=>a(r,i(e,{name:"Moon",iconNode:p1})),d1=s1,l1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],k1=e=>a(r,i(e,{name:"PanelLeft",iconNode:l1})),x1=k1,v1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],f1=e=>a(r,i(e,{name:"Plus",iconNode:v1})),u1=f1,M1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],g1=e=>a(r,i(e,{name:"Search",iconNode:M1})),w1=g1,N1=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],b1=e=>a(r,i(e,{name:"SlidersHorizontal",iconNode:N1})),q1=b1,z1=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],j1=e=>a(r,i(e,{name:"Smartphone",iconNode:z1})),f=j1,A1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],L1=e=>a(r,i(e,{name:"Smile",iconNode:A1})),C1=L1,H1=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],S1=e=>a(r,i(e,{name:"Sparkles",iconNode:H1})),V1=S1,B1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],P1=e=>a(r,i(e,{name:"SquarePen",iconNode:B1})),G1=P1,O1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Z1=e=>a(r,i(e,{name:"Square",iconNode:O1})),u=Z1,U1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],E1=e=>a(r,i(e,{name:"Sun",iconNode:U1})),F1=E1,I1=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],R1=e=>a(r,i(e,{name:"Tablet",iconNode:I1})),T1=R1,W1=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],D1=e=>a(r,i(e,{name:"Workflow",iconNode:W1})),J1=D1,_1=d("<img alt>"),$1=d("<span>");const M={plus:u1,paperclip:$,github:_e,globe:_,sparkles:V1,settings:te,"file-text":W,folder:D,image:J,monitor:v,"message-circle":ee,"message-square":ae,search:w1,mic:x,"audio-lines":xe,x:ne,"chevron-down":Z,pencil:G,"book-open":ue,code:C,smile:C1,share:P,"arrow-left":b,"more-horizontal":l,"chevron-left":Ae,home:L,clock:Ge,lock:r1,box:we,briefcase:qe,"panel-left":x1,circle:I,"sliders-horizontal":q1,workflow:J1,"square-pen":G1,archive:ce,"arrow-up":de,bookmark:B,copy:R,ellipsis:l,"external-link":T,flag:V,"git-branch":Ie,"git-pull-request":We,"list-filter":e1,"rotate-cw":A,moon:d1,sun:F1,desktop:v,laptop:Qe,tablet:T1,smartphone:f,mobile:f,"chevron-right":U,"chevron-up":He,"arrow-right":j,"arrow-down":N,"panel-right":ie,check:O,info:K,"triangle-alert":oe,"circle-check":E,"circle-alert":k,"circle-x":F,trash:S,download:z,upload:ye,link:Q,"rotate-ccw":re,"maximize-2":Y,"minimize-2":X,eye:q,"eye-off":Ue,bell:H,square:u,minus:h1,play:w};Object.keys(M).sort();function K1(e,t){if(!e)return null;const n=M[e];return n?a(n,{get class(){return t?.imgClass??t?.class??"mr-2 size-4 shrink-0"}}):/^(https?:|\/|data:)/.test(e)?(()=>{var o=_1();return c(o,"src",e),p(()=>s(o,t?.imgClass??t?.class??"size-4 shrink-0")),o})():(()=>{var o=$1();return g(o,e),p(y=>{var h=t?.spanClass??t?.class??"size-4 shrink-0",m=t!=null&&t.ariaHidden?"true":void 0;return h!==y.e&&s(o,y.e=h),m!==y.t&&c(o,"aria-hidden",y.t=m),y},{e:void 0,t:void 0}),o})()}export{k as c,x as m,K1 as r,u as s};
1
+ import{c as a,q as i,d as c,a as p,b as s,i as g,t as d}from"./define-By-uL588.js";import{p as w}from"./play-BvKKq3fX.js";import{I as r}from"./Icon-DObhsRtm.js";import{a as N}from"./arrow-down-CjRU3JgV.js";import{a as b}from"./arrow-left-Bnpb1UEW.js";import{e as q,d as z,a as j,r as A,h as L,c as C}from"./rotate-cw-CMVLoCyH.js";import{b as H}from"./bell-DQAAOpDz.js";import{t as S,f as V,b as B,s as P,p as G}from"./trash-2-jBKxjGGQ.js";import{c as O}from"./check-njkVdZu2.js";import{c as Z}from"./chevron-down-B72s6PXR.js";import{c as U}from"./chevron-right-BatuHzUm.js";import{c as E}from"./circle-check-B62pODB3.js";import{c as F}from"./circle-x-BPG0iPst.js";import{c as I}from"./circle-zx0ByzY9.js";import{c as R}from"./copy-n9u9rqpi.js";import{e as l}from"./ellipsis-CbOpJnU3.js";import{e as T}from"./external-link-ByXAwBBQ.js";import{f as W}from"./file-text-DMib2qwt.js";import{f as D}from"./folder-_BAb929C.js";import{i as J,g as _,p as $}from"./paperclip-ByY3UVO6.js";import{i as K}from"./info-DsFjGuI_.js";import{l as Q}from"./link-zF8PzWfF.js";import{m as X,a as Y}from"./minimize-2-BQRoBV1V.js";import{m as ee}from"./message-circle-DruwObfX.js";import{m as ae}from"./message-square-BG6q6mlm.js";import{p as ie}from"./panel-right-i8warFxT.js";import{r as re}from"./rotate-ccw-B2xn93py.js";import{s as te}from"./settings-BBR63jLg.js";import{t as oe}from"./triangle-alert-DlQ68ppf.js";import{u as ye}from"./upload-TcAHXv9W.js";import{x as ne}from"./x-Z5UntkIJ.js";var he=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],me=e=>a(r,i(e,{name:"Archive",iconNode:he})),ce=me,pe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],se=e=>a(r,i(e,{name:"ArrowUp",iconNode:pe})),de=se,le=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],ke=e=>a(r,i(e,{name:"AudioLines",iconNode:le})),xe=ke,ve=[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]],fe=e=>a(r,i(e,{name:"BookOpen",iconNode:ve})),ue=fe,Me=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],ge=e=>a(r,i(e,{name:"Box",iconNode:Me})),we=ge,Ne=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],be=e=>a(r,i(e,{name:"Briefcase",iconNode:Ne})),qe=be,ze=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],je=e=>a(r,i(e,{name:"ChevronLeft",iconNode:ze})),Ae=je,Le=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ce=e=>a(r,i(e,{name:"ChevronUp",iconNode:Le})),He=Ce,Se=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ve=e=>a(r,i(e,{name:"CircleAlert",iconNode:Se})),k=Ve,Be=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Pe=e=>a(r,i(e,{name:"Clock",iconNode:Be})),Ge=Pe,Oe=[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],Ze=e=>a(r,i(e,{name:"EyeOff",iconNode:Oe})),Ue=Ze,Ee=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Fe=e=>a(r,i(e,{name:"GitBranch",iconNode:Ee})),Ie=Fe,Re=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Te=e=>a(r,i(e,{name:"GitPullRequest",iconNode:Re})),We=Te,De=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Je=e=>a(r,i(e,{name:"Github",iconNode:De})),_e=Je,$e=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],Ke=e=>a(r,i(e,{name:"Laptop",iconNode:$e})),Qe=Ke,Xe=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Ye=e=>a(r,i(e,{name:"ListFilter",iconNode:Xe})),e1=Ye,a1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],i1=e=>a(r,i(e,{name:"Lock",iconNode:a1})),r1=i1,t1=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],o1=e=>a(r,i(e,{name:"Mic",iconNode:t1})),x=o1,y1=[["path",{d:"M5 12h14",key:"1ays0h"}]],n1=e=>a(r,i(e,{name:"Minus",iconNode:y1})),h1=n1,m1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],c1=e=>a(r,i(e,{name:"Monitor",iconNode:m1})),v=c1,p1=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],s1=e=>a(r,i(e,{name:"Moon",iconNode:p1})),d1=s1,l1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],k1=e=>a(r,i(e,{name:"PanelLeft",iconNode:l1})),x1=k1,v1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],f1=e=>a(r,i(e,{name:"Plus",iconNode:v1})),u1=f1,M1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],g1=e=>a(r,i(e,{name:"Search",iconNode:M1})),w1=g1,N1=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],b1=e=>a(r,i(e,{name:"SlidersHorizontal",iconNode:N1})),q1=b1,z1=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],j1=e=>a(r,i(e,{name:"Smartphone",iconNode:z1})),f=j1,A1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],L1=e=>a(r,i(e,{name:"Smile",iconNode:A1})),C1=L1,H1=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],S1=e=>a(r,i(e,{name:"Sparkles",iconNode:H1})),V1=S1,B1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],P1=e=>a(r,i(e,{name:"SquarePen",iconNode:B1})),G1=P1,O1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Z1=e=>a(r,i(e,{name:"Square",iconNode:O1})),u=Z1,U1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],E1=e=>a(r,i(e,{name:"Sun",iconNode:U1})),F1=E1,I1=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]],R1=e=>a(r,i(e,{name:"Tablet",iconNode:I1})),T1=R1,W1=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],D1=e=>a(r,i(e,{name:"Workflow",iconNode:W1})),J1=D1,_1=d("<img alt>"),$1=d("<span>");const M={plus:u1,paperclip:$,github:_e,globe:_,sparkles:V1,settings:te,"file-text":W,folder:D,image:J,monitor:v,"message-circle":ee,"message-square":ae,search:w1,mic:x,"audio-lines":xe,x:ne,"chevron-down":Z,pencil:G,"book-open":ue,code:C,smile:C1,share:P,"arrow-left":b,"more-horizontal":l,"chevron-left":Ae,home:L,clock:Ge,lock:r1,box:we,briefcase:qe,"panel-left":x1,circle:I,"sliders-horizontal":q1,workflow:J1,"square-pen":G1,archive:ce,"arrow-up":de,bookmark:B,copy:R,ellipsis:l,"external-link":T,flag:V,"git-branch":Ie,"git-pull-request":We,"list-filter":e1,"rotate-cw":A,moon:d1,sun:F1,desktop:v,laptop:Qe,tablet:T1,smartphone:f,mobile:f,"chevron-right":U,"chevron-up":He,"arrow-right":j,"arrow-down":N,"panel-right":ie,check:O,info:K,"triangle-alert":oe,"circle-check":E,"circle-alert":k,"circle-x":F,trash:S,download:z,upload:ye,link:Q,"rotate-ccw":re,"maximize-2":Y,"minimize-2":X,eye:q,"eye-off":Ue,bell:H,square:u,minus:h1,play:w};Object.keys(M).sort();function K1(e,t){if(!e)return null;const n=M[e];return n?a(n,{get class(){return t?.imgClass??t?.class??"mr-2 size-4 shrink-0"}}):/^(https?:|\/|data:)/.test(e)?(()=>{var o=_1();return c(o,"src",e),p(()=>s(o,t?.imgClass??t?.class??"size-4 shrink-0")),o})():(()=>{var o=$1();return g(o,e),p(y=>{var h=t?.spanClass??t?.class??"size-4 shrink-0",m=t!=null&&t.ariaHidden?"true":void 0;return h!==y.e&&s(o,y.e=h),m!==y.t&&c(o,"aria-hidden",y.t=m),y},{e:void 0,t:void 0}),o})()}export{k as c,x as m,K1 as r,u as s};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { ModelOption, SearchFilters, ConversationScope, ConversationSummary, ConversationGroup } from './types.js';
1
+ export type { ModelOption, SearchFilters, ConversationScope, ConversationSummary, ConversationGroup, HomeConfig, HomeLinkEntry } from './types.js';
2
2
  export { cn } from './utils/cn.js';
3
3
  export { createKaiChat } from './primitives/create-kai-chat.js';
4
4
  export type { CreateKaiChatOptions, KaiChatStore } from './primitives/create-kai-chat.js';
@@ -14,6 +14,8 @@ export { configureCodeHighlighting, isCodeHighlightingEnabled } from './primitiv
14
14
  export type { CodeHighlightingOptions } from './primitives/highlighter.js';
15
15
  export { configurePdfPreview, isPdfPreviewEnabled } from './primitives/pdf-preview.js';
16
16
  export type { PdfPreviewOptions } from './primitives/pdf-preview.js';
17
+ export { localStorageStore, fetchStore, byRecency, LEGACY_THREAD_MIGRATED_TITLE } from './primitives/conversation-store.js';
18
+ export type { ConversationStore } from './primitives/conversation-store.js';
17
19
  export { toast, configureToasts, ensureMounted as ensureToastRegion, getToasts } from './primitives/toast-store.js';
18
20
  export type { ToastItem, ToastVariant, ToastAction, ToastOptions, ToastHandle, ToastFn, ToastConfig, } from './primitives/toast-store.js';
19
21
  export { Toast, ToastRegion } from './components/toast.js';