@kitn.ai/ui 0.18.2 → 0.20.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 (258) hide show
  1. package/LICENSE +6 -0
  2. package/NOTICE +54 -0
  3. package/dist/components/audio-visualizer/audio-visualizer.voice-fixture.d.ts +59 -0
  4. package/dist/components/audio-visualizer/aurora.glsl.d.ts +114 -0
  5. package/dist/components/audio-visualizer/index.d.ts +155 -0
  6. package/dist/components/audio-visualizer/shader-canvas.d.ts +130 -0
  7. package/dist/components/audio-visualizer/sizes.d.ts +25 -0
  8. package/dist/components/audio-visualizer/variant-aurora.d.ts +89 -0
  9. package/dist/components/audio-visualizer/variant-bar.d.ts +46 -0
  10. package/dist/components/audio-visualizer/variant-custom.d.ts +73 -0
  11. package/dist/components/audio-visualizer/variant-grid.d.ts +22 -0
  12. package/dist/components/audio-visualizer/variant-radial.d.ts +13 -0
  13. package/dist/components/audio-visualizer/variant-wave.d.ts +11 -0
  14. package/dist/components/audio-visualizer/wave.glsl.d.ts +16 -0
  15. package/dist/components/thread.d.ts +54 -0
  16. package/dist/create-tween-hvpmSuwW.js +7 -0
  17. package/dist/custom-elements.json +477 -0
  18. package/dist/elements/agent-card.js +1 -1
  19. package/dist/elements/artifact.js +1 -1
  20. package/dist/elements/attachments.js +1 -1
  21. package/dist/elements/audio-visualizer.d.ts +1 -0
  22. package/dist/elements/audio-visualizer.js +1 -0
  23. package/dist/elements/autoloader.js +1 -1
  24. package/dist/elements/avatar.js +1 -1
  25. package/dist/elements/badge.js +1 -1
  26. package/dist/elements/button.js +1 -1
  27. package/dist/elements/card.js +1 -1
  28. package/dist/elements/cards.js +1 -1
  29. package/dist/elements/chain-of-thought.js +1 -1
  30. package/dist/elements/chat-scope-picker.js +1 -1
  31. package/dist/elements/chat-workspace.js +1 -1
  32. package/dist/elements/chat.js +1 -1
  33. package/dist/elements/checkpoint.js +1 -1
  34. package/dist/elements/choice.js +1 -1
  35. package/dist/elements/chunks/{Icon-C2LTALdM.js → Icon-Tj58ES_d.js} +1 -1
  36. package/dist/elements/chunks/action-icons-ns1Fnedj.js +1 -0
  37. package/dist/elements/chunks/arrow-left-DQocUFvy.js +1 -0
  38. package/dist/elements/chunks/{attachments-DLJcWCDV.js → attachments-mCB5F1Fq.js} +1 -1
  39. package/dist/elements/chunks/audio-visualizer-BqNy7dfm.js +1 -0
  40. package/dist/elements/chunks/{badge-BTNZTODL.js → badge-B4Zuajl2.js} +1 -1
  41. package/dist/elements/chunks/{button-DBDZebGr.js → button-ZWNif3--.js} +1 -1
  42. package/dist/elements/chunks/{card-YfCyI4fH.js → card-BkHbp4BA.js} +1 -1
  43. package/dist/elements/chunks/chat-thread-CkRN6pZ7.js +1 -0
  44. package/dist/elements/chunks/check-B9-gn6SS.js +1 -0
  45. package/dist/elements/chunks/chevron-down-BNsxc2hk.js +1 -0
  46. package/dist/elements/chunks/chevron-right-Hv00StBO.js +1 -0
  47. package/dist/elements/chunks/circle-0e3KJTDr.js +1 -0
  48. package/dist/elements/chunks/circle-check-BNAS0JEy.js +1 -0
  49. package/dist/elements/chunks/{circle-x-pDtzlghQ.js → circle-x-B7faJFlY.js} +1 -1
  50. package/dist/elements/chunks/{code-block-DZ6mz6vs.js → code-block-BFUHn6Va.js} +1 -1
  51. package/dist/elements/chunks/collapsible-DM1Ckd4e.js +1 -0
  52. package/dist/elements/chunks/{composer-BZyPU6gD.js → composer-BguS0QL_.js} +7 -3
  53. package/dist/elements/chunks/{context-Cx6eQA_G.js → context-Cb7k4F-v.js} +1 -1
  54. package/dist/elements/chunks/{conversation-list-C4xTQSpT.js → conversation-list-CvoAkWhN.js} +1 -1
  55. package/dist/elements/chunks/create-tween-oVvAIG8r.js +7 -0
  56. package/dist/elements/chunks/{default-input-BZcwyKcP.js → default-input-Cqqilg9t.js} +1 -1
  57. package/dist/elements/chunks/define-D1din7Ld.js +1 -0
  58. package/dist/elements/chunks/{disclosure-BcBs--Jf.js → disclosure-CIZ5c8nO.js} +1 -1
  59. package/dist/elements/chunks/{download-BDQwcFav.js → download-Dsbg3ste.js} +1 -1
  60. package/dist/elements/chunks/{dropdown-wgs8xCJZ.js → dropdown-BDd1-Zgi.js} +1 -1
  61. package/dist/elements/chunks/{ellipsis-CUiEJ6R1.js → ellipsis-Dw6qrss-.js} +1 -1
  62. package/dist/elements/chunks/{external-link-DJUmC7g2.js → external-link-Vt74zAoL.js} +1 -1
  63. package/dist/elements/chunks/{file-text-DOYfYvrh.js → file-text-CZrZF6_v.js} +1 -1
  64. package/dist/elements/chunks/{file-tree-DQzNQrbr.js → file-tree-DF4okKyo.js} +1 -1
  65. package/dist/elements/chunks/{folder-DBDUBANz.js → folder-glP5rha4.js} +1 -1
  66. package/dist/elements/chunks/hover-card-Cmm6Q53m.js +1 -0
  67. package/dist/elements/chunks/icon-BLb8beoi.js +1 -0
  68. package/dist/elements/chunks/{info-DBQl-m6e.js → info-CIsv92JK.js} +1 -1
  69. package/dist/elements/chunks/{input-DZD67EvW.js → input-Dds1kFyt.js} +1 -1
  70. package/dist/elements/chunks/{kbd-DbyVrlnU.js → kbd-De_xbgi9.js} +1 -1
  71. package/dist/elements/chunks/{link-vko7AttA.js → link-i4r_k7z4.js} +1 -1
  72. package/dist/elements/chunks/{loader-Cg6rO8tQ.js → loader-BmQH4s3V.js} +1 -1
  73. package/dist/elements/chunks/{markdown-n3Xbj3PR.js → markdown-Zi21WhUz.js} +7 -7
  74. package/dist/elements/chunks/{message-CgKytiSB.js → message-BqyXDN3-.js} +1 -1
  75. package/dist/elements/chunks/{message-feedback-Ds3-US0e.js → message-feedback-Djr3z6Yb.js} +1 -1
  76. package/dist/elements/chunks/message-square-vFAgbDaX.js +1 -0
  77. package/dist/elements/chunks/{minimize-2-3kCdE0q3.js → minimize-2--ifeCGrl.js} +1 -1
  78. package/dist/elements/chunks/{model-switcher-BMtXGwLU.js → model-switcher-B94YAKsM.js} +1 -1
  79. package/dist/elements/chunks/{overlay-B1-MBI6h.js → overlay-kD8dwRv_.js} +1 -1
  80. package/dist/elements/chunks/{paperclip-DDEfmkHc.js → paperclip-q21dYOSK.js} +1 -1
  81. package/dist/elements/chunks/{progress-bar-Dwbiyv3s.js → progress-bar-BrAIIaaJ.js} +1 -1
  82. package/dist/elements/chunks/{prompt-suggestion-9lvgFcEa.js → prompt-suggestion-Bjn2K-fR.js} +1 -1
  83. package/dist/elements/chunks/{reasoning-DzHWsdAJ.js → reasoning-DTpCGtnY.js} +1 -1
  84. package/dist/elements/chunks/resizable-Dp4JExql.js +1 -0
  85. package/dist/elements/chunks/{rotate-cw-jpisOdOV.js → rotate-cw-CFWWkpj2.js} +1 -1
  86. package/dist/elements/chunks/{scroll-area-g5Ze3K6f.js → scroll-area-Bb0kHH1j.js} +1 -1
  87. package/dist/elements/chunks/scroll-button-B0cH5fXf.js +1 -0
  88. package/dist/elements/chunks/{separator-Bmjc5XyX.js → separator-9kRgr1X9.js} +1 -1
  89. package/dist/elements/chunks/{settings-Cz1bMJP9.js → settings-B8lmec4D.js} +1 -1
  90. package/dist/elements/chunks/{settings-group-9imY3kRA.js → settings-group-I0hEuXiN.js} +1 -1
  91. package/dist/elements/chunks/{share-BdenF0wQ.js → share-C3lTiYGt.js} +1 -1
  92. package/dist/elements/chunks/skeleton-DSXW5Yya.js +1 -0
  93. package/dist/elements/chunks/{slots-DkZ-Cmha.js → slots--V19HwUb.js} +1 -1
  94. package/dist/elements/chunks/{star-DY6z1UUH.js → star-CSJtGxgv.js} +1 -1
  95. package/dist/elements/chunks/{store-th4VyJXM.js → store-CHyW95TP.js} +1 -1
  96. package/dist/elements/chunks/{text-shimmer-CEi-tlXr.js → text-shimmer-Cn9TmNpI.js} +1 -1
  97. package/dist/elements/chunks/textarea-CUwqAX0G.js +1 -0
  98. package/dist/elements/chunks/{thumbs-up-BR33KLfA.js → thumbs-up-PNVVThEF.js} +1 -1
  99. package/dist/elements/chunks/{toast-store-BEMda0fv.js → toast-store-DKbQn3Wn.js} +1 -1
  100. package/dist/elements/chunks/{tool-TMued3WO.js → tool-DjTRpIpl.js} +1 -1
  101. package/dist/elements/chunks/tooltip-CgBZCVKp.js +1 -0
  102. package/dist/elements/chunks/{triangle-alert-B07fX3Q8.js → triangle-alert-DsHTHCPm.js} +1 -1
  103. package/dist/elements/chunks/use-card-resolution-BSu_XHjH.js +1 -0
  104. package/dist/elements/chunks/variant-aurora-Dc4nQUia.js +218 -0
  105. package/dist/elements/chunks/variant-custom-y_3kVQhS.js +1 -0
  106. package/dist/elements/chunks/variant-wave-D5OR1-9Z.js +116 -0
  107. package/dist/elements/chunks/{video-MKp3LmNT.js → video-B7vmenoC.js} +1 -1
  108. package/dist/elements/chunks/x-GRUeeQFT.js +1 -0
  109. package/dist/elements/coachmark.js +1 -1
  110. package/dist/elements/code-block.js +1 -1
  111. package/dist/elements/command.js +1 -1
  112. package/dist/elements/compare.js +1 -1
  113. package/dist/elements/composer.js +1 -1
  114. package/dist/elements/confirm-card.js +1 -1
  115. package/dist/elements/context-meter.js +1 -1
  116. package/dist/elements/conversation-list.js +1 -1
  117. package/dist/elements/define.d.ts +11 -0
  118. package/dist/elements/dialog.js +1 -1
  119. package/dist/elements/editable-label.js +1 -1
  120. package/dist/elements/embed.js +1 -1
  121. package/dist/elements/empty.js +1 -1
  122. package/dist/elements/feedback-bar.js +1 -1
  123. package/dist/elements/file-tree.js +1 -1
  124. package/dist/elements/file-upload.js +1 -1
  125. package/dist/elements/form.js +1 -1
  126. package/dist/elements/hover-card.js +1 -1
  127. package/dist/elements/icon.js +1 -1
  128. package/dist/elements/image.js +1 -1
  129. package/dist/elements/input.js +1 -1
  130. package/dist/elements/kbd.js +1 -1
  131. package/dist/elements/link-preview.js +1 -1
  132. package/dist/elements/loader.js +1 -1
  133. package/dist/elements/markdown.js +1 -1
  134. package/dist/elements/menu.js +1 -1
  135. package/dist/elements/message-skills.js +1 -1
  136. package/dist/elements/message.js +1 -1
  137. package/dist/elements/model-switcher.js +1 -1
  138. package/dist/elements/nav.js +1 -1
  139. package/dist/elements/notice.js +1 -1
  140. package/dist/elements/pane-group.js +1 -1
  141. package/dist/elements/pane.js +1 -1
  142. package/dist/elements/popover.js +1 -1
  143. package/dist/elements/progress-bar.js +1 -1
  144. package/dist/elements/prompt-dock.js +1 -1
  145. package/dist/elements/prompt-input.js +1 -1
  146. package/dist/elements/prompt-suggestions.js +1 -1
  147. package/dist/elements/reasoning.js +1 -1
  148. package/dist/elements/remote.js +1 -1
  149. package/dist/elements/resizable.js +1 -1
  150. package/dist/elements/response-stream.js +1 -1
  151. package/dist/elements/screen.js +1 -1
  152. package/dist/elements/scroll-area.js +1 -1
  153. package/dist/elements/scroll-button.js +1 -1
  154. package/dist/elements/search.js +1 -1
  155. package/dist/elements/segmented.js +1 -1
  156. package/dist/elements/separator.js +1 -1
  157. package/dist/elements/setting-item.js +1 -1
  158. package/dist/elements/settings-group.js +1 -1
  159. package/dist/elements/skeleton.js +1 -1
  160. package/dist/elements/slots.d.ts +15 -0
  161. package/dist/elements/source.js +1 -1
  162. package/dist/elements/status.js +1 -1
  163. package/dist/elements/switch.js +1 -1
  164. package/dist/elements/tabs.js +1 -1
  165. package/dist/elements/tasks.js +1 -1
  166. package/dist/elements/text-shimmer.js +1 -1
  167. package/dist/elements/thinking-bar.js +1 -1
  168. package/dist/elements/thread.d.ts +1 -0
  169. package/dist/elements/thread.js +1 -0
  170. package/dist/elements/toast.js +1 -1
  171. package/dist/elements/tool.js +1 -1
  172. package/dist/elements/tooltip.js +1 -1
  173. package/dist/elements/voice-input.js +1 -1
  174. package/dist/elements/voice-output.js +1 -1
  175. package/dist/elements.d.ts +62 -0
  176. package/dist/index.js +3411 -3328
  177. package/dist/kai.es.js +1 -1
  178. package/dist/llms/llms-full.txt +70 -4
  179. package/dist/llms/llms.txt +3 -3
  180. package/dist/primitives/audio-bands.d.ts +106 -0
  181. package/dist/primitives/create-tween.d.ts +33 -0
  182. package/dist/primitives/use-audio-analysis.d.ts +149 -0
  183. package/dist/primitives/use-sequencer.d.ts +13 -0
  184. package/dist/primitives/use-voice-recorder.d.ts +1 -0
  185. package/dist/primitives/visualizer-sequences.d.ts +39 -0
  186. package/dist/react/index.d.ts +105 -0
  187. package/dist/react/use-voice-input.d.ts +15 -0
  188. package/dist/react.js +269 -240
  189. package/dist/register-impl-DQyejdfb.js +145 -0
  190. package/dist/test-utils/fake-clock.d.ts +45 -0
  191. package/dist/ui/resizable.d.ts +9 -3
  192. package/dist/variant-aurora-DVtGqVH6.js +218 -0
  193. package/dist/variant-custom-Dif-IV4u.js +1 -0
  194. package/dist/variant-wave-DbfNdvSi.js +116 -0
  195. package/frameworks/react/index.tsx +74 -1
  196. package/frameworks/react/use-voice-input.tsx +59 -0
  197. package/llms-full.txt +70 -4
  198. package/llms.txt +3 -3
  199. package/package.json +32 -7
  200. package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +257 -0
  201. package/src/components/audio-visualizer/aurora.glsl.ts +330 -0
  202. package/src/components/audio-visualizer/index.tsx +442 -0
  203. package/src/components/audio-visualizer/shader-canvas.tsx +846 -0
  204. package/src/components/audio-visualizer/sizes.ts +54 -0
  205. package/src/components/audio-visualizer/variant-aurora.tsx +299 -0
  206. package/src/components/audio-visualizer/variant-bar.tsx +143 -0
  207. package/src/components/audio-visualizer/variant-custom.tsx +338 -0
  208. package/src/components/audio-visualizer/variant-grid.tsx +170 -0
  209. package/src/components/audio-visualizer/variant-radial.tsx +158 -0
  210. package/src/components/audio-visualizer/variant-wave.tsx +125 -0
  211. package/src/components/audio-visualizer/wave.glsl.ts +130 -0
  212. package/src/components/component-meta.json +34 -32
  213. package/src/components/composer.tsx +5 -0
  214. package/src/components/thread.tsx +177 -0
  215. package/src/elements/audio-visualizer.tsx +183 -0
  216. package/src/elements/chat-workspace.tsx +1 -1
  217. package/src/elements/compiled.css +1 -1
  218. package/src/elements/define.tsx +12 -1
  219. package/src/elements/element-manifest.json +8 -0
  220. package/src/elements/element-meta.json +287 -0
  221. package/src/elements/element-types.d.ts +62 -0
  222. package/src/elements/icon-names.json +2 -0
  223. package/src/elements/menu.tsx +7 -4
  224. package/src/elements/register-impl.ts +3 -0
  225. package/src/elements/resizable.tsx +78 -2
  226. package/src/elements/slots.ts +42 -0
  227. package/src/elements/thread.tsx +105 -0
  228. package/src/primitives/audio-bands.ts +174 -0
  229. package/src/primitives/create-tween.ts +214 -0
  230. package/src/primitives/use-audio-analysis.ts +321 -0
  231. package/src/primitives/use-sequencer.ts +53 -0
  232. package/src/primitives/use-voice-recorder.ts +16 -4
  233. package/src/primitives/visualizer-sequences.ts +350 -0
  234. package/src/test-utils/fake-clock.ts +88 -0
  235. package/src/ui/action-icons.ts +2 -1
  236. package/src/ui/icon.tsx +4 -0
  237. package/src/ui/overlay.tsx +8 -1
  238. package/src/ui/resizable.tsx +47 -9
  239. package/dist/elements/chunks/action-icons-Dtl8Ox5D.js +0 -1
  240. package/dist/elements/chunks/arrow-left-GbBceGBE.js +0 -1
  241. package/dist/elements/chunks/chat-thread-Dz2qbzvI.js +0 -1
  242. package/dist/elements/chunks/check-fhmRksq_.js +0 -1
  243. package/dist/elements/chunks/chevron-down-DcRg1aRU.js +0 -1
  244. package/dist/elements/chunks/chevron-right-ChzBcNJ-.js +0 -1
  245. package/dist/elements/chunks/circle-B4fTe9v6.js +0 -1
  246. package/dist/elements/chunks/circle-check-CJV-3Rem.js +0 -1
  247. package/dist/elements/chunks/collapsible-CWUAShMC.js +0 -1
  248. package/dist/elements/chunks/define-CNSKFZCd.js +0 -1
  249. package/dist/elements/chunks/hover-card-BQGdGAQ3.js +0 -1
  250. package/dist/elements/chunks/icon-CAyRqVrg.js +0 -1
  251. package/dist/elements/chunks/message-square-MmRkvc-M.js +0 -1
  252. package/dist/elements/chunks/resizable-Bq_eHxUm.js +0 -1
  253. package/dist/elements/chunks/skeleton-Pjc5jiaY.js +0 -1
  254. package/dist/elements/chunks/textarea-CboigarR.js +0 -1
  255. package/dist/elements/chunks/tooltip-Cft_Rxiw.js +0 -1
  256. package/dist/elements/chunks/use-card-resolution-M36zVciB.js +0 -1
  257. package/dist/elements/chunks/x-Ckwicf6g.js +0 -1
  258. package/dist/register-impl-DcjZDELj.js +0 -141
@@ -0,0 +1,89 @@
1
+ import { JSX } from 'solid-js';
2
+ import { VisualizerState } from '../../primitives/visualizer-sequences';
3
+ import { ShaderVariantProps } from './index';
4
+ /**
5
+ * Per-state uniform targets, straight from fact sheet section 5's measured
6
+ * table (`.superpowers/sdd/2026-08-07-audio-visualizers/reference/
7
+ * aura-prototype/lk-aura-factsheet.md`) and reconciled against `aurora.glsl.ts`'s
8
+ * own module doc / the Task 14 report's "Uniform list for Task 15" table.
9
+ *
10
+ * ATTRIBUTION: these same values are upstream's, and upstream's copy is
11
+ * Apache-2.0. They live in `packages/shadcn/hooks/agents-ui/
12
+ * use-agent-audio-visualizer-aura.ts` -- the aura DRIVING hook, which carries
13
+ * no Polyform header and is ordinary Apache-2.0 code, unlike the aura
14
+ * COMPONENT and its inline shader. Every row below matches that hook: the
15
+ * four state rows, the listening spring (1.0s, bounce 0.35), the tween and
16
+ * pulse cadences, and the analyser settings the visualizer feeds from
17
+ * (fftSize 512, smoothingTimeConstant 0.55). Recorded in `packages/ui/NOTICE`
18
+ * as an attribution rather than a port, since no code was copied. This is
19
+ * the BEHAVIOUR layer only -- `aurora.glsl.ts` (the rendering) is original
20
+ * work and owes the hook nothing. See `docs/provenance/aurora-clean-room.md`
21
+ * section 7 for the license map that separates the two upstream files.
22
+ *
23
+ * Deliberately NOT `shaderTargets()` (primitives/visualizer-sequences.ts):
24
+ * that helper only carries two axes -- a 0..1 "energy" intensity and a 1..4
25
+ * speed -- built for the OLD custom/aura convention. This shader's real table
26
+ * is non-monotonic across those same two axes (thinking/connecting has LOWER
27
+ * amplitude than idle despite HIGHER brightness) and every value below is a
28
+ * direct fact-sheet pass-through, not a normalized knob, so reusing that
29
+ * helper cannot reproduce it. The Task 14 report calls this out explicitly
30
+ * and asks for this shader's own mapping, parallel to how `waveTargets()`
31
+ * already exists alongside `shaderTargets()` for the wave shader.
32
+ *
33
+ * `speed` here is fact sheet section 5's `S / 20` (state speed 10..70,
34
+ * divided by 20) -- NOT the raw 10..70 value. `complexity` is `freqParam`
35
+ * directly.
36
+ *
37
+ * `rotation` (deg/s, positive = clockwise ON SCREEN) is NOT from the fact
38
+ * sheet: it is this port's own solid-body trim on top of the wind's
39
+ * emergent angular drift, calibrated offline (campaign task #6's probe,
40
+ * replicating scripts/aurora-audit.mjs's estimator at its capture cadence)
41
+ * so the audit-measured per-state rotation lands on the reference values:
42
+ * speaking ~+17 (their +12.9, Rob's reference ~20 CW), listening ~+4.6,
43
+ * thinking ~+9. The wind supplies most of the apparent motion (post-flip
44
+ * it reads ~+22 CW at speaking, ~0 elsewhere); these trims close the
45
+ * per-state gaps. Like `speed`, rotation is never tweened.
46
+ *
47
+ * Connecting originally carried the probe's -4.7 CCW as a -5.5 trim,
48
+ * flipped to the clockwise equivalent (same magnitude) 2026-08-10
49
+ * (supervisor call, Rob delegated): the direction split came from the
50
+ * screenshot-cadence estimator later shown unreliable (closing-sweep
51
+ * finding: IQR swamps the medians), upstream's hook drives thinking and
52
+ * connecting with identical dynamics, and opposite spins on adjacent
53
+ * transitional states read inconsistent. Single-line revert (connecting's
54
+ * `rotation` below) if the eye test ever disagrees.
55
+ */
56
+ declare function auroraTargets(state: VisualizerState): {
57
+ intensity: number | [number, number];
58
+ speed: number;
59
+ complexity: number;
60
+ amplitude: number;
61
+ scale: number;
62
+ rotation: number;
63
+ };
64
+ /**
65
+ * A glowing, drifting aura: 36 phase-offset rings folded through a warp
66
+ * cascade into soft veils. See `aurora.glsl.ts`'s module doc for the shader
67
+ * itself and its provenance.
68
+ *
69
+ * The uniform contract is a direct pass-through of fact sheet section 5's
70
+ * measured per-state table (`auroraTargets` above), NOT the 0..1 convention
71
+ * `wave` and `custom` use. There is deliberately no `uVolume` uniform: the
72
+ * shader would double-apply voice-driven growth if it read one itself on top
73
+ * of whatever this component also does at the state layer, so the live
74
+ * volume drives the scale TWEEN here, in exactly one place (the
75
+ * volume-override effect below), and nowhere else.
76
+ *
77
+ * `dark` is an extra field on top of `ShaderVariantProps`, not yet a member
78
+ * of that shared type: it is meant to carry the FACADE's already-resolved
79
+ * `theme="light"|"dark"|"auto"` decision (see `define.tsx`'s
80
+ * `createDarkMode`), threaded down through the dispatcher, once that wiring
81
+ * lands (see the task report for the exact shape requested). Optional, with
82
+ * a live `prefers-color-scheme` fallback, so this component still works
83
+ * correctly when mounted standalone (no facade above it resolving a
84
+ * `theme` attribute at all).
85
+ */
86
+ export default function AuroraVisualizer(props: ShaderVariantProps & {
87
+ dark?: boolean;
88
+ }): JSX.Element;
89
+ export { auroraTargets };
@@ -0,0 +1,46 @@
1
+ import { JSX } from 'solid-js';
2
+ import { VisualizerState } from '../../primitives/visualizer-sequences';
3
+ import { VisualizerSize } from './sizes';
4
+ /** Props every DOM variant takes. The dispatcher supplies all of them. */
5
+ export interface VariantProps {
6
+ state: VisualizerState;
7
+ size: VisualizerSize;
8
+ /** Multiband levels, 0..1. Only read while `state === 'speaking'`. */
9
+ bands: number[];
10
+ /** `prefers-reduced-motion`: pin the sequencer at its first frame. */
11
+ frozen: boolean;
12
+ /** Overrides the inherited `currentColor` the bars are painted with. */
13
+ color?: string;
14
+ class?: string;
15
+ /**
16
+ * Render each element yourself. Receives the element's static index plus
17
+ * `highlighted` and `value` as live accessors, not plain values: the
18
+ * markup is only mapped once per position (see the `<Index>` note below),
19
+ * so you must CALL `highlighted()` and `value()` from inside your own JSX
20
+ * for them to stay live. Destructuring them into a plain variable freezes
21
+ * them at that moment. `::part(bar)` / `::part(bar highlighted)` (or
22
+ * `cell`) handle restyling from outside; this render-prop is for replacing
23
+ * the markup outright.
24
+ *
25
+ * In bar and grid, your returned element IS the drawn item. Radial is the
26
+ * exception: it always wraps whatever you return in its own positioning
27
+ * element, because each spoke must be absolutely placed around the ring.
28
+ * You still control the markup inside that wrapper, just not its position.
29
+ */
30
+ children?: (item: {
31
+ index: number;
32
+ highlighted: () => boolean;
33
+ value: () => number;
34
+ }) => JSX.Element;
35
+ }
36
+ /**
37
+ * Vertical bars that rise with the audio while speaking, and run a scripted
38
+ * pattern in every other state.
39
+ *
40
+ * Ported from livekit/components-js
41
+ * `packages/shadcn/components/agents-ui/agent-audio-visualizer-bar.tsx`
42
+ * (Apache License 2.0).
43
+ */
44
+ export declare function BarVisualizer(props: VariantProps & {
45
+ barCount?: number;
46
+ }): JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { JSX } from 'solid-js';
2
+ import { UniformSpec } from './shader-canvas';
3
+ import { ShaderVariantProps } from './index';
4
+ /**
5
+ * Uniforms every custom shader receives without asking: the standard set
6
+ * (`uColor`, `uIntensity`, `uSpeed`, `uComplexity`) plus the audio pair that
7
+ * ONLY this variant gets. Upstream's shader path only ever hands a shader a
8
+ * scalar volume; `uBands` -- a per-band `float` array -- has no equivalent
9
+ * there, so a spectrum-reactive custom shader is possible here and not
10
+ * there. `iTime`/`iResolution`/`iMouse`/`iFrame`/`iDate` are declared by
11
+ * `ShaderCanvas` itself for every shader, custom or not, so they are not
12
+ * repeated here.
13
+ *
14
+ * `extra` is a consumer's `ShaderSpec.uniforms` -- untrusted input. Every
15
+ * entry is checked with `uniformProblem` before being merged in; a bad
16
+ * `type`/`value` pairing throws rather than being handed to `ShaderCanvas`,
17
+ * where the mismatch would otherwise throw a `TypeError` inside WebGL's
18
+ * `uniform*` setters, called from `ShaderCanvas`'s OWN
19
+ * `requestAnimationFrame` loop, where nothing catches it and the canvas
20
+ * silently stops animating. `CustomVisualizer` below is what turns that
21
+ * throw into the same `onUnavailable` seam every other shader failure uses
22
+ * -- see its own doc for how.
23
+ *
24
+ * Pure and synchronous: reads no signals, schedules nothing. Task 15 reuses
25
+ * it as-is.
26
+ */
27
+ export declare function customUniforms(values: {
28
+ color: string;
29
+ intensity: number;
30
+ speed: number;
31
+ complexity: number;
32
+ volume: number;
33
+ bands: number[];
34
+ }, extra?: Record<string, UniformSpec>): Record<string, UniformSpec>;
35
+ /**
36
+ * Renders a consumer-supplied fragment shader.
37
+ *
38
+ * The shader must define `mainImage(out vec4 fragColor, in vec2 fragCoord)`
39
+ * and gets the five ShaderToy built-ins (`iTime`, `iResolution`, `iMouse`,
40
+ * `iFrame`, `iDate`) plus every uniform `customUniforms` above declares.
41
+ * `ShaderCanvas` DECLARES all of them for you -- declaring the SAME name
42
+ * again inside the shader body is a GLSL redefinition and fails to compile.
43
+ *
44
+ * `fragColor` MUST be premultiplied: `vec4(rgb * alpha, alpha)`, never
45
+ * `vec4(rgb, alpha)`. The canvas composites using the browser's default
46
+ * `premultipliedAlpha: true`; a translucent edge written the natural
47
+ * (straight-alpha) way gets a dark fringe where it meets a light page. For
48
+ * example, a shader painting a soft circle that fades to transparent at its
49
+ * edge:
50
+ *
51
+ * ```glsl
52
+ * void mainImage(out vec4 fragColor, in vec2 fragCoord) {
53
+ * vec2 uv = fragCoord / iResolution.xy;
54
+ * float alpha = smoothstep(1.0, 0.0, length(uv - 0.5) * 2.0) * uIntensity;
55
+ * fragColor = vec4(uColor * alpha, alpha); // premultiplied -- NOT vec4(uColor, alpha)
56
+ * }
57
+ * ```
58
+ *
59
+ * `uVolume` (scalar) and `uBands` (a `float[N]` array, `N` tracking the
60
+ * visualizer's actual band count) are this task's differentiating feature:
61
+ * upstream's shader path only ever hands a shader a scalar, so a
62
+ * spectrum-reactive custom shader is only possible here.
63
+ *
64
+ * A bad `props.shader.uniforms` entry (an unrecognized `type`, or a `value`
65
+ * that does not match it) is logged loudly via `console.error` -- it is a
66
+ * bug in the consumer's shader spec they need to see -- and routed through
67
+ * `props.onUnavailable`, same as a shader compile or link failure. A
68
+ * missing WebGL context logs quietly via `console.warn`: that is an
69
+ * expected environment limitation, not a bug. `props.shader` being absent
70
+ * entirely is neither: it renders an empty placeholder and does not call
71
+ * `onUnavailable` at all, since nothing was ever asked to render.
72
+ */
73
+ export default function CustomVisualizer(props: ShaderVariantProps): JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { JSX } from 'solid-js';
2
+ import { VariantProps } from './variant-bar';
3
+ /**
4
+ * A grid of dots that pulses with the audio.
5
+ *
6
+ * Ported from livekit/components-js
7
+ * `packages/shadcn/components/agents-ui/agent-audio-visualizer-grid.tsx`
8
+ * (Apache License 2.0), except the speaking threshold remap — see the
9
+ * divergence note above.
10
+ */
11
+ export declare function GridVisualizer(props: VariantProps & {
12
+ /** Rows AND columns of the (always square) grid. Default from the size
13
+ * preset. Replaced the former independent rowCount/columnCount pre-1.0:
14
+ * columns alone carry the audio signal, so a non-square grid only ever
15
+ * changed threshold-ring resolution — never expression (Rob, 2026-08-09;
16
+ * upstream is square-by-default via `rowCount ?? columnCount` too). */
17
+ count?: number;
18
+ /** Ring distance from center for the connecting animation, in cells. */
19
+ spread?: number;
20
+ /** Ms between scripted frames. Default 100. */
21
+ interval?: number;
22
+ }): JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { JSX } from 'solid-js';
2
+ import { VariantProps } from './variant-bar';
3
+ /**
4
+ * Bars arranged around a circle, growing outward with the audio.
5
+ *
6
+ * Ported from livekit/components-js
7
+ * `packages/shadcn/components/agents-ui/agent-audio-visualizer-radial.tsx`
8
+ * (Apache License 2.0).
9
+ */
10
+ export declare function RadialVisualizer(props: VariantProps & {
11
+ barCount?: number;
12
+ radius?: number;
13
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ShaderVariantProps } from './index';
3
+ /**
4
+ * A flowing oscilloscope line.
5
+ *
6
+ * Ported from livekit/components-js `agent-audio-visualizer-wave.tsx`
7
+ * (Apache License 2.0). The shader itself (`wave.glsl.ts`) is copied
8
+ * verbatim; this wrapper replaces upstream's React component and its
9
+ * `motion` dependency with Solid signals and `createTween`.
10
+ */
11
+ export default function WaveVisualizer(props: ShaderVariantProps): JSX.Element;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Oscilloscope wave fragment shader.
3
+ *
4
+ * Copied verbatim from livekit/components-js
5
+ * `packages/shadcn/components/agents-ui/agent-audio-visualizer-wave.tsx`
6
+ * (Apache License 2.0). Unmodified apart from being extracted to its own
7
+ * module: no GLSL lines were added, removed, or reformatted. The source
8
+ * contained no `uniform ...;` declarations to strip -- `uFrequency`,
9
+ * `uSpeed`, `uAmplitude`, `uLineWidth`, `uSmoothing`, `uColor`,
10
+ * `uColorShift`, and `uMix` are all bound by the caller (see uses of
11
+ * `ShaderCanvas` below), which is what declares them.
12
+ *
13
+ * Uniforms are declared by ShaderCanvas. Do not declare them here.
14
+ */
15
+ declare const _default: "\nconst float TAU = 6.28318530718;\n\n// Noise for dithering\nvec2 randFibo(vec2 p) {\n p = fract(p * vec2(443.897, 441.423));\n p += dot(p, p.yx + 19.19);\n return fract((p.xx + p.yx) * p.xy);\n}\n\n// Luma for alpha\nfloat luma(vec3 color) {\n return dot(color, vec3(0.299, 0.587, 0.114));\n}\n\n// RGB to HSV\nvec3 rgb2hsv(vec3 c) {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\n// HSV to RGB\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n// Bell curve function for attenuation from center with rounded top\nfloat bellCurve(float distanceFromCenter, float maxDistance) {\n float normalizedDistance = distanceFromCenter / maxDistance;\n // Use cosine with high power for smooth rounded top\n return pow(cos(normalizedDistance * (3.14159265359 / 4.0)), 16.0);\n}\n\n// Calculate the sine wave\nfloat oscilloscopeWave(float x, float centerX, float time) {\n float relativeX = x - centerX;\n float maxDistance = centerX;\n float distanceFromCenter = abs(relativeX);\n\n // Apply bell curve for amplitude attenuation\n float bell = bellCurve(distanceFromCenter, maxDistance);\n\n // Calculate wave with uniforms and bell curve attenuation\n float wave = sin(relativeX * uFrequency + time * uSpeed) * uAmplitude * bell;\n\n return wave;\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = fragCoord / iResolution.xy;\n vec2 pos = uv - 0.5;\n\n // Calculate center and positions\n float centerX = 0.5;\n float centerY = 0.5;\n float x = uv.x;\n float y = uv.y;\n\n // Convert line width from pixels to UV space\n // Use the average of width and height to handle aspect ratio\n float pixelSize = 2.0 / (iResolution.x + iResolution.y);\n float lineWidthUV = uLineWidth * pixelSize;\n float smoothingUV = uSmoothing * pixelSize;\n\n // Find minimum distance to the wave by sampling nearby points\n // This gives us consistent line width without high-frequency artifacts\n const int NUM_SAMPLES = 50; // Must be const for GLSL loop\n float minDist = 1000.0;\n float sampleRange = 0.02; // Range to search for closest point\n\n for(int i = 0; i < NUM_SAMPLES; i++) {\n float offset = (float(i) / float(NUM_SAMPLES - 1) - 0.5) * sampleRange;\n float sampleX = x + offset;\n float waveY = centerY + oscilloscopeWave(sampleX, centerX, iTime);\n\n // Calculate distance from current pixel to this point on the wave\n vec2 wavePoint = vec2(sampleX, waveY);\n vec2 currentPoint = vec2(x, y);\n float dist = distance(currentPoint, wavePoint);\n\n minDist = min(minDist, dist);\n }\n\n // Solid line with smooth edges using minimum distance\n float line = smoothstep(lineWidthUV + smoothingUV, lineWidthUV - smoothingUV, minDist);\n\n vec3 color = uColor;\n if(abs(uColorShift) > 0.01) {\n // Keep the center 50% at base color, then ramp shift across outer 25% on each side.\n float centerBandHalfWidth = 0.2;\n float edgeBandWidth = 0.5;\n float distanceFromCenter = abs(x - centerX);\n float edgeFactor = clamp((distanceFromCenter - centerBandHalfWidth) / edgeBandWidth, 0.0, 1.0);\n vec3 hsv = rgb2hsv(color);\n // Hue shift is zero in the center band and strongest at far edges.\n hsv.x = fract(hsv.x + edgeFactor * uColorShift * 0.3);\n color = hsv2rgb(hsv);\n }\n\n // Apply line intensity\n color *= line;\n\n // Add dithering for smoother gradients\n // color += (randFibo(fragCoord).x - 0.5) / 255.0;\n\n // Calculate alpha based on line intensity\n float alpha = line * uMix;\n\n fragColor = vec4(color * uMix, alpha);\n}";
16
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { JSX } from 'solid-js';
2
+ import { MessageActionDetail } from '../primitives/message-feedback';
3
+ import { ChatMessage } from '../elements/chat-types';
4
+ import { ProseSize } from '../primitives/chat-config';
5
+ /** Imperative handle exposed via `controllerRef` — the thread's scroll control,
6
+ * forwarded onto `<kai-thread>` as the `scrollToBottom()` instance method. */
7
+ export interface ThreadController {
8
+ /** Scroll the message list to the bottom (default `'smooth'`). */
9
+ scrollToBottom(behavior?: ScrollBehavior): void;
10
+ }
11
+ export interface ThreadProps {
12
+ /** Extra classes for the thread root (e.g. `rounded-xl`). */
13
+ class?: string;
14
+ /** The full message thread to render, newest last. Each entry carries its role,
15
+ * content, and optional reasoning/tools/attachments/actions/avatar. A new array
16
+ * reference per streaming chunk re-renders (mutating in place does not). */
17
+ messages: ChatMessage[];
18
+ /** Show a typing indicator on the pending assistant turn — use while awaiting
19
+ * the assistant's reply. */
20
+ loading?: boolean;
21
+ /** Body/prose font scale for rendered markdown (`'xs' | 'sm' | 'base' | 'lg'`).
22
+ * Defaults to `'sm'`. */
23
+ proseSize?: ProseSize;
24
+ /** Shiki theme name for syntax-highlighted code blocks (e.g.
25
+ * `'github-dark-dimmed'`). */
26
+ codeTheme?: string;
27
+ /** Enable Shiki syntax highlighting in code blocks. Turn off to render plain
28
+ * `<pre>` blocks (lighter, no highlighter load). Default true. */
29
+ codeHighlight?: boolean;
30
+ /** Whether each message's action bar is always visible (`'always'`, default) or
31
+ * only revealed on hover of that message row (`'hover'`). */
32
+ actionsReveal?: 'always' | 'hover';
33
+ /** Show the scroll-to-bottom button inside the scroll area. Default true. */
34
+ scrollButton?: boolean;
35
+ /** Custom zero-state shown while the thread is empty. A sensible default renders
36
+ * when omitted (the `<kai-thread>` facade wires this to `slot="empty"`). */
37
+ empty?: JSX.Element;
38
+ /** Fired when a message's action button is clicked (copy / vote / regenerate /
39
+ * edit / custom). The facade re-dispatches this as `kai-message-action`. */
40
+ onMessageAction?: (detail: MessageActionDetail) => void;
41
+ /** Receive the imperative controller once mounted — the `<kai-thread>` facade
42
+ * forwards `scrollToBottom` onto the host. */
43
+ controllerRef?: (controller: ThreadController) => void;
44
+ }
45
+ /**
46
+ * `Thread` — the message-list slice of a chat, as a standalone composable: the
47
+ * scrolling list of messages + per-message rendering (markdown, code highlight,
48
+ * reasoning + tool panels, avatars, and the action row), stick-to-bottom scroll
49
+ * with a scroll-to-bottom button, an optional typing indicator, and an empty
50
+ * state. No composer, header, suggestions, or sidebar — those are sibling/preset
51
+ * concerns. This is the source of truth behind the `<kai-thread>` facade; it is
52
+ * composed from the same internal pieces `ChatThread` uses for its message list.
53
+ */
54
+ export declare function Thread(props: ThreadProps): JSX.Element;
@@ -0,0 +1,7 @@
1
+ import{t as we,u as Le,c as ye,e as Re}from"./register-impl-DQyejdfb.js";import{c as B,o as U,d as le,u as fe,b as Ie,f as ce}from"./kai.es.js";var Pe=we("<canvas part=canvas>");const ue="#1FD5F9";function me(e){const n=e.trim().match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(!n)return me(ue);const[,o,a,l]=n;return[parseInt(o,16)/255,parseInt(a,16)/255,parseInt(l,16)/255]}const Ce={"1f":"float","1i":"int","1fv":"float","2f":"vec2","3f":"vec3","3fv":"vec3","4f":"vec4","4fv":"vec4",Matrix2fv:"mat2",Matrix3fv:"mat3",Matrix4fv:"mat4"},_e={"1fv":1,"3fv":3,"4fv":4,Matrix2fv:4,Matrix3fv:9,Matrix4fv:16};function Oe(e){const n=_e[e.type];if(!n||!Array.isArray(e.value))return;const o=e.value.length/n;return o>1&&Number.isInteger(o)?o:void 0}function ve(e){return e.arraySize??Oe(e)}const ke=["uniform float iTime;","uniform vec2 iResolution;","uniform vec4 iMouse;","uniform int iFrame;","uniform vec4 iDate;"].join(`
2
+ `),Te=`
3
+ attribute vec3 aVertexPosition;
4
+ void main() { gl_Position = vec4(aVertexPosition, 1.0); }
5
+ `;function De(e,n,o){const a=Object.entries(n).map(([l,i])=>{const v=ve(i),m=v?`[${v}]`:"";return`uniform ${Ce[i.type]} ${l}${m};`}).join(`
6
+ `);return[`precision ${o} float;`,ke,a,e,"void main() { mainImage(gl_FragColor, gl_FragCoord.xy); }"].join(`
7
+ `)}function Be(e){return Object.keys(e).sort().map(n=>{const o=e[n];return`${n}:${o.type}:${ve(o)??""}`}).join("|")}function de(e,n,o){const a=e.createShader(n);if(!a)return"Could not create a WebGL shader.";if(e.shaderSource(a,o),e.compileShader(a),!e.getShaderParameter(a,e.COMPILE_STATUS)){const l=e.getShaderInfoLog(a)??"Unknown shader compile error.";return e.deleteShader(a),l}return a}function Ne(e,n,o){const a=o.value;switch(o.type){case"1f":e.uniform1f(n,a);break;case"1i":e.uniform1i(n,a);break;case"1fv":e.uniform1fv(n,a);break;case"2f":e.uniform2fv(n,a);break;case"3f":case"3fv":e.uniform3fv(n,a);break;case"4f":case"4fv":e.uniform4fv(n,a);break;case"Matrix2fv":e.uniformMatrix2fv(n,!1,a);break;case"Matrix3fv":e.uniformMatrix3fv(n,!1,a);break;case"Matrix4fv":e.uniformMatrix4fv(n,!1,a);break}}function $e(e){let n;const o=B(()=>Be(e.uniforms??{})),a=B(()=>e.fragment),l=B(()=>e.precision??"highp");let i="none",v=null,m=null,r=null,c=null,f=0,h=null,u=!1,M=!1,F=!1,E=!1,p,A=!1,w=!0,R=!1,I=0,P=0,q=0;const ge=()=>{var s;return v||(v=n.getContext("webgl")??n.getContext("experimental-webgl"),v&&(i="live",m=((s=v.getExtension)==null?void 0:s.call(v,"WEBGL_lose_context"))??null),v)},j=()=>{f!==0||!c||E||(P=performance.now(),f=requestAnimationFrame(c))},G=()=>{f!==0&&(cancelAnimationFrame(f),f=0,I+=Math.max(0,performance.now()-P))},T=()=>{G();const s=r;r=null,s?.()},be=()=>{!m||i!=="live"||(i="losing",m.loseContext())},V=()=>{m&&(i="restoring",m.restoreContext())},O=()=>{if(!(E||M||F))if(w||R){if(i==="losing"||i==="restoring")return;if(i==="lost"){V();return}Ae()}else m&&i==="live"?(T(),be()):G()},xe=s=>{s===w||E||(w=s,O())},H=s=>{var g;s.preventDefault();const L=i==="losing";if(i="lost",T(),L){O();return}F=!0,(g=e.onError)==null||g.call(e,"WebGL context was lost.")},Y=()=>{i="live",O()},pe=()=>{A||(A=!0,n.addEventListener("webglcontextlost",H,!1),n.addEventListener("webglcontextrestored",Y,!1),!(typeof IntersectionObserver>"u")&&(w=!1,p=new IntersectionObserver(s=>{const g=s[s.length-1];g&&xe(g.isIntersecting)},{threshold:0}),p.observe(n)))},Ae=()=>{var s,g,L,z,X;if(E||M||F||u)return;const K=h;if(!K)return;if(r){j();return}const t=ge();if(!t){M=!0,(s=e.onError)==null||s.call(e,"WebGL is not available in this browser.");return}if(t.isContextLost()){V();return}const{source:Se,uniforms:Fe}=K,y=de(t,t.VERTEX_SHADER,Te);if(typeof y=="string"){u=!0,(g=e.onError)==null||g.call(e,y);return}const C=de(t,t.FRAGMENT_SHADER,Se);if(typeof C=="string"){t.deleteShader(y),u=!0,(L=e.onError)==null||L.call(e,C);return}const b=t.createProgram();if(!b){t.deleteShader(y),t.deleteShader(C),u=!0,(z=e.onError)==null||z.call(e,"Could not create a WebGL program.");return}if(t.attachShader(b,y),t.attachShader(b,C),t.linkProgram(b),!t.getProgramParameter(b,t.LINK_STATUS)){const d=t.getProgramInfoLog(b)??"Shader program failed to link.";t.deleteProgram(b),t.deleteShader(y),t.deleteShader(C),u=!0,(X=e.onError)==null||X.call(e,d);return}t.useProgram(b);const J=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,J),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]),t.STATIC_DRAW);const Q=t.getAttribLocation(b,"aVertexPosition");t.enableVertexAttribArray(Q),t.vertexAttribPointer(Q,3,t.FLOAT,!1,0,0),t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA);const _=d=>t.getUniformLocation(b,d),Z=_("iTime"),ee=_("iResolution"),te=_("iMouse"),ne=_("iFrame"),re=_("iDate"),Ee=Object.keys(Fe).map(d=>[d,_(d)]),N=[0,0,0,0],oe=d=>{const x=n.getBoundingClientRect();N[0]=d.clientX-x.left,N[1]=x.height-(d.clientY-x.top)};n.addEventListener("pointermove",oe,{passive:!0});const $=()=>{const d=globalThis.devicePixelRatio??1,x=Math.max(1,Math.floor(n.clientWidth*d)),k=Math.max(1,Math.floor(n.clientHeight*d));(n.width!==x||n.height!==k)&&(n.width=x,n.height=k,t.viewport(0,0,x,k))},D=typeof ResizeObserver<"u"?new ResizeObserver($):void 0;D?.observe(n),$();const ae=d=>{var x;if(F||t.isContextLost())return;$();const k=Math.max(0,(I+(d-P))/1e3);if(Z&&t.uniform1f(Z,k),ee&&t.uniform2fv(ee,[n.width,n.height]),te&&t.uniform4fv(te,N),ne&&t.uniform1i(ne,q),re){const S=new Date;t.uniform4fv(re,[S.getFullYear(),S.getMonth(),S.getDate(),S.getHours()*3600+S.getMinutes()*60+S.getSeconds()])}for(const[S,ie]of Ee){const se=(x=e.uniforms)==null?void 0:x[S];se&&ie&&Ne(t,ie,se)}t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_STRIP,0,4),q++,f=requestAnimationFrame(ae)};r=()=>{c=null,D?.disconnect(),n.removeEventListener("pointermove",oe),t.deleteProgram(b),t.deleteShader(y),t.deleteShader(C),t.deleteBuffer(J)},c=ae,j()};U(()=>{E=!0,p?.disconnect(),A&&(n.removeEventListener("webglcontextlost",H),n.removeEventListener("webglcontextrestored",Y)),T(),m&&i==="live"&&m.loseContext()});const Me=B(()=>e.animateWhenNotVisible??!1);return le(()=>{R=Me(),O()}),le(()=>{const s=a(),g=l();o();const L=fe(()=>e.uniforms??{});h={source:De(s,L,g),uniforms:L},u=!1,pe(),O(),U(T)}),(()=>{var s=Pe(),g=n;return typeof g=="function"?Le(g,s):n=s,Ie(()=>ye(s,Re("block h-full w-full",e.class))),s})()}function W(e,n,o,a){const l=r=>3*(1-r)*(1-r)*r*e+3*(1-r)*r*r*o+r*r*r,i=r=>3*(1-r)*(1-r)*r*n+3*(1-r)*r*r*a+r*r*r,v=r=>3*(1-r)*(1-r)*e+6*(1-r)*r*(o-e)+3*r*r*(1-o);function m(r){let c=0,f=1;for(let h=0;h<30;h++){const u=(c+f)/2;l(u)<r?c=u:f=u}return(c+f)/2}return r=>{if(r<=0)return 0;if(r>=1)return 1;let c=r;for(let f=0;f<8;f++){const h=v(c);if(Math.abs(h)<1e-6)return i(m(r));const u=c-(l(c)-r)/h;if(u<=0||u>=1)return i(m(r));c=u}return i(c)}}const Ue={linear:e=>e,easeIn:W(.42,0,1,1),easeOut:W(0,0,.58,1),easeInOut:W(.42,0,.58,1)};function We(e,n){const o=Math.max(.05,1-Math.min(.95,n)),a=10,l=a*Math.sqrt(Math.max(0,1-o*o));return 1-Math.exp(-o*a*e)*(Math.cos(l*e)+o*a/(l||1)*Math.sin(l*e))}function he(e){return"type"in e&&e.type==="spring"}function qe(e){const[n,o]=ce(e),[a,l]=ce(!1);let i=0,v=!1;const m=()=>{i&&cancelAnimationFrame(i),i=0};U(()=>{v=!0,m(),l(!1)});function r(c,f){if(m(),v)return;const h=Array.isArray(c),[u,M]=h?c:[fe(n),c];if(!f||!he(f)&&f.duration===0){l(!1),o(h?u:M);return}const F=f.duration*1e3;if(F<=0){l(!1),o(M);return}if(typeof requestAnimationFrame>"u"){l(!1),o(M);return}const E=he(f)?I=>We(I,f.bounce):Ue[f.ease??"easeOut"];let p=u,A=M;h&&o(u);let w=performance.now();const R=I=>{const P=Math.min(1,(I-w)/F);if(o(p+(A-p)*E(P)),P<1){i=requestAnimationFrame(R);return}if(!h){o(A),i=0,l(!1);return}o(A),[p,A]=[A,p],w=performance.now(),i=requestAnimationFrame(R)};l(!0),i=requestAnimationFrame(R)}return{value:n,animating:a,to:r}}export{ue as D,$e as S,qe as c,me as h};