@tai42/studio-sdk 0.2.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 (422) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +15 -0
  3. package/README.md +318 -0
  4. package/SECURITY.md +51 -0
  5. package/dist/components/badge.d.ts +13 -0
  6. package/dist/components/badge.d.ts.map +1 -0
  7. package/dist/components/badge.js +14 -0
  8. package/dist/components/badge.js.map +1 -0
  9. package/dist/components/checkbox.d.ts +24 -0
  10. package/dist/components/checkbox.d.ts.map +1 -0
  11. package/dist/components/checkbox.js +31 -0
  12. package/dist/components/checkbox.js.map +1 -0
  13. package/dist/components/code-block.d.ts +7 -0
  14. package/dist/components/code-block.d.ts.map +1 -0
  15. package/dist/components/code-block.js +23 -0
  16. package/dist/components/code-block.js.map +1 -0
  17. package/dist/components/completion-input.d.ts +31 -0
  18. package/dist/components/completion-input.d.ts.map +1 -0
  19. package/dist/components/completion-input.js +61 -0
  20. package/dist/components/completion-input.js.map +1 -0
  21. package/dist/components/components.css +2212 -0
  22. package/dist/components/confirm-dialog.d.ts +40 -0
  23. package/dist/components/confirm-dialog.d.ts.map +1 -0
  24. package/dist/components/confirm-dialog.js +11 -0
  25. package/dist/components/confirm-dialog.js.map +1 -0
  26. package/dist/components/control-styles.d.ts +12 -0
  27. package/dist/components/control-styles.d.ts.map +1 -0
  28. package/dist/components/control-styles.js +14 -0
  29. package/dist/components/control-styles.js.map +1 -0
  30. package/dist/components/copy-field.d.ts +8 -0
  31. package/dist/components/copy-field.d.ts.map +1 -0
  32. package/dist/components/copy-field.js +106 -0
  33. package/dist/components/copy-field.js.map +1 -0
  34. package/dist/components/dialog.d.ts +21 -0
  35. package/dist/components/dialog.d.ts.map +1 -0
  36. package/dist/components/dialog.js +25 -0
  37. package/dist/components/dialog.js.map +1 -0
  38. package/dist/components/drawer.d.ts +22 -0
  39. package/dist/components/drawer.d.ts.map +1 -0
  40. package/dist/components/drawer.js +32 -0
  41. package/dist/components/drawer.js.map +1 -0
  42. package/dist/components/error-boundary.d.ts +33 -0
  43. package/dist/components/error-boundary.d.ts.map +1 -0
  44. package/dist/components/error-boundary.js +36 -0
  45. package/dist/components/error-boundary.js.map +1 -0
  46. package/dist/components/extension-combo-builder.d.ts +70 -0
  47. package/dist/components/extension-combo-builder.d.ts.map +1 -0
  48. package/dist/components/extension-combo-builder.js +154 -0
  49. package/dist/components/extension-combo-builder.js.map +1 -0
  50. package/dist/components/extension-grouping.d.ts +65 -0
  51. package/dist/components/extension-grouping.d.ts.map +1 -0
  52. package/dist/components/extension-grouping.js +78 -0
  53. package/dist/components/extension-grouping.js.map +1 -0
  54. package/dist/components/extension-picker.d.ts +35 -0
  55. package/dist/components/extension-picker.d.ts.map +1 -0
  56. package/dist/components/extension-picker.js +31 -0
  57. package/dist/components/extension-picker.js.map +1 -0
  58. package/dist/components/external-link.d.ts +19 -0
  59. package/dist/components/external-link.d.ts.map +1 -0
  60. package/dist/components/external-link.js +12 -0
  61. package/dist/components/external-link.js.map +1 -0
  62. package/dist/components/field.d.ts +64 -0
  63. package/dist/components/field.d.ts.map +1 -0
  64. package/dist/components/field.js +56 -0
  65. package/dist/components/field.js.map +1 -0
  66. package/dist/components/fleet-report.d.ts +39 -0
  67. package/dist/components/fleet-report.d.ts.map +1 -0
  68. package/dist/components/fleet-report.js +50 -0
  69. package/dist/components/fleet-report.js.map +1 -0
  70. package/dist/components/fonts.css +22 -0
  71. package/dist/components/icons.d.ts +142 -0
  72. package/dist/components/icons.d.ts.map +1 -0
  73. package/dist/components/icons.js +139 -0
  74. package/dist/components/icons.js.map +1 -0
  75. package/dist/components/inputs.d.ts +52 -0
  76. package/dist/components/inputs.d.ts.map +1 -0
  77. package/dist/components/inputs.js +35 -0
  78. package/dist/components/inputs.js.map +1 -0
  79. package/dist/components/json-diff.d.ts +40 -0
  80. package/dist/components/json-diff.d.ts.map +1 -0
  81. package/dist/components/json-diff.js +119 -0
  82. package/dist/components/json-diff.js.map +1 -0
  83. package/dist/components/json-tree.d.ts +8 -0
  84. package/dist/components/json-tree.d.ts.map +1 -0
  85. package/dist/components/json-tree.js +70 -0
  86. package/dist/components/json-tree.js.map +1 -0
  87. package/dist/components/modal-focus.d.ts +15 -0
  88. package/dist/components/modal-focus.d.ts.map +1 -0
  89. package/dist/components/modal-focus.js +136 -0
  90. package/dist/components/modal-focus.js.map +1 -0
  91. package/dist/components/page-header.d.ts +56 -0
  92. package/dist/components/page-header.d.ts.map +1 -0
  93. package/dist/components/page-header.js +24 -0
  94. package/dist/components/page-header.js.map +1 -0
  95. package/dist/components/primitives.d.ts +186 -0
  96. package/dist/components/primitives.d.ts.map +1 -0
  97. package/dist/components/primitives.js +204 -0
  98. package/dist/components/primitives.js.map +1 -0
  99. package/dist/components/progress-bar.d.ts +29 -0
  100. package/dist/components/progress-bar.d.ts.map +1 -0
  101. package/dist/components/progress-bar.js +48 -0
  102. package/dist/components/progress-bar.js.map +1 -0
  103. package/dist/components/radio-group.d.ts +37 -0
  104. package/dist/components/radio-group.d.ts.map +1 -0
  105. package/dist/components/radio-group.js +56 -0
  106. package/dist/components/radio-group.js.map +1 -0
  107. package/dist/components/reveal-input.d.ts +13 -0
  108. package/dist/components/reveal-input.d.ts.map +1 -0
  109. package/dist/components/reveal-input.js +31 -0
  110. package/dist/components/reveal-input.js.map +1 -0
  111. package/dist/components/scroll-region.d.ts +85 -0
  112. package/dist/components/scroll-region.d.ts.map +1 -0
  113. package/dist/components/scroll-region.js +574 -0
  114. package/dist/components/scroll-region.js.map +1 -0
  115. package/dist/components/select.d.ts +53 -0
  116. package/dist/components/select.d.ts.map +1 -0
  117. package/dist/components/select.js +33 -0
  118. package/dist/components/select.js.map +1 -0
  119. package/dist/components/table.d.ts +59 -0
  120. package/dist/components/table.d.ts.map +1 -0
  121. package/dist/components/table.js +20 -0
  122. package/dist/components/table.js.map +1 -0
  123. package/dist/components/tabs.d.ts +15 -0
  124. package/dist/components/tabs.d.ts.map +1 -0
  125. package/dist/components/tabs.js +13 -0
  126. package/dist/components/tabs.js.map +1 -0
  127. package/dist/components/tags.d.ts +46 -0
  128. package/dist/components/tags.d.ts.map +1 -0
  129. package/dist/components/tags.js +68 -0
  130. package/dist/components/tags.js.map +1 -0
  131. package/dist/components/tokens.css +392 -0
  132. package/dist/components/tokens.d.ts +15 -0
  133. package/dist/components/tokens.d.ts.map +1 -0
  134. package/dist/components/tokens.js +101 -0
  135. package/dist/components/tokens.js.map +1 -0
  136. package/dist/components/tool-picker.d.ts +24 -0
  137. package/dist/components/tool-picker.d.ts.map +1 -0
  138. package/dist/components/tool-picker.js +97 -0
  139. package/dist/components/tool-picker.js.map +1 -0
  140. package/dist/components/tooltip.d.ts +17 -0
  141. package/dist/components/tooltip.d.ts.map +1 -0
  142. package/dist/components/tooltip.js +18 -0
  143. package/dist/components/tooltip.js.map +1 -0
  144. package/dist/components/version-history-panel.d.ts +71 -0
  145. package/dist/components/version-history-panel.d.ts.map +1 -0
  146. package/dist/components/version-history-panel.js +148 -0
  147. package/dist/components/version-history-panel.js.map +1 -0
  148. package/dist/download.d.ts +7 -0
  149. package/dist/download.d.ts.map +1 -0
  150. package/dist/download.js +18 -0
  151. package/dist/download.js.map +1 -0
  152. package/dist/element-slot.d.ts +4 -0
  153. package/dist/element-slot.d.ts.map +1 -0
  154. package/dist/element-slot.js +20 -0
  155. package/dist/element-slot.js.map +1 -0
  156. package/dist/elicitation/ElicitationForm.d.ts +34 -0
  157. package/dist/elicitation/ElicitationForm.d.ts.map +1 -0
  158. package/dist/elicitation/ElicitationForm.js +24 -0
  159. package/dist/elicitation/ElicitationForm.js.map +1 -0
  160. package/dist/errors.d.ts +9 -0
  161. package/dist/errors.d.ts.map +1 -0
  162. package/dist/errors.js +15 -0
  163. package/dist/errors.js.map +1 -0
  164. package/dist/extension-combos.d.ts +13 -0
  165. package/dist/extension-combos.d.ts.map +1 -0
  166. package/dist/extension-combos.js +9 -0
  167. package/dist/extension-combos.js.map +1 -0
  168. package/dist/hooks/useApi.d.ts +1222 -0
  169. package/dist/hooks/useApi.d.ts.map +1 -0
  170. package/dist/hooks/useApi.js +22 -0
  171. package/dist/hooks/useApi.js.map +1 -0
  172. package/dist/hooks/useAuth.d.ts +13 -0
  173. package/dist/hooks/useAuth.d.ts.map +1 -0
  174. package/dist/hooks/useAuth.js +53 -0
  175. package/dist/hooks/useAuth.js.map +1 -0
  176. package/dist/hooks/useBreakpoint.d.ts +10 -0
  177. package/dist/hooks/useBreakpoint.d.ts.map +1 -0
  178. package/dist/hooks/useBreakpoint.js +66 -0
  179. package/dist/hooks/useBreakpoint.js.map +1 -0
  180. package/dist/hooks/useCapabilities.d.ts +88 -0
  181. package/dist/hooks/useCapabilities.d.ts.map +1 -0
  182. package/dist/hooks/useCapabilities.js +203 -0
  183. package/dist/hooks/useCapabilities.js.map +1 -0
  184. package/dist/hooks/useSse.d.ts +13 -0
  185. package/dist/hooks/useSse.d.ts.map +1 -0
  186. package/dist/hooks/useSse.js +298 -0
  187. package/dist/hooks/useSse.js.map +1 -0
  188. package/dist/hooks/useTheme.d.ts +20 -0
  189. package/dist/hooks/useTheme.d.ts.map +1 -0
  190. package/dist/hooks/useTheme.js +97 -0
  191. package/dist/hooks/useTheme.js.map +1 -0
  192. package/dist/hooks/useUnauthorized.d.ts +3 -0
  193. package/dist/hooks/useUnauthorized.d.ts.map +1 -0
  194. package/dist/hooks/useUnauthorized.js +18 -0
  195. package/dist/hooks/useUnauthorized.js.map +1 -0
  196. package/dist/host.d.ts +11 -0
  197. package/dist/host.d.ts.map +1 -0
  198. package/dist/host.js +10 -0
  199. package/dist/host.js.map +1 -0
  200. package/dist/index.d.ts +118 -0
  201. package/dist/index.d.ts.map +1 -0
  202. package/dist/index.js +91 -0
  203. package/dist/index.js.map +1 -0
  204. package/dist/navigation/context.d.ts +25 -0
  205. package/dist/navigation/context.d.ts.map +1 -0
  206. package/dist/navigation/context.js +45 -0
  207. package/dist/navigation/context.js.map +1 -0
  208. package/dist/navigation/index.d.ts +4 -0
  209. package/dist/navigation/index.d.ts.map +1 -0
  210. package/dist/navigation/index.js +2 -0
  211. package/dist/navigation/index.js.map +1 -0
  212. package/dist/navigation/types.d.ts +97 -0
  213. package/dist/navigation/types.d.ts.map +1 -0
  214. package/dist/navigation/types.js +16 -0
  215. package/dist/navigation/types.js.map +1 -0
  216. package/dist/plugin/host-state.d.ts +45 -0
  217. package/dist/plugin/host-state.d.ts.map +1 -0
  218. package/dist/plugin/host-state.js +62 -0
  219. package/dist/plugin/host-state.js.map +1 -0
  220. package/dist/plugin/registry.d.ts +35 -0
  221. package/dist/plugin/registry.d.ts.map +1 -0
  222. package/dist/plugin/registry.js +129 -0
  223. package/dist/plugin/registry.js.map +1 -0
  224. package/dist/plugin/types.d.ts +165 -0
  225. package/dist/plugin/types.d.ts.map +1 -0
  226. package/dist/plugin/types.js +2 -0
  227. package/dist/plugin/types.js.map +1 -0
  228. package/dist/plugin/version.d.ts +34 -0
  229. package/dist/plugin/version.d.ts.map +1 -0
  230. package/dist/plugin/version.js +37 -0
  231. package/dist/plugin/version.js.map +1 -0
  232. package/dist/query-keys.d.ts +31 -0
  233. package/dist/query-keys.d.ts.map +1 -0
  234. package/dist/query-keys.js +31 -0
  235. package/dist/query-keys.js.map +1 -0
  236. package/dist/schema-editor/SchemaEditor.d.ts +43 -0
  237. package/dist/schema-editor/SchemaEditor.d.ts.map +1 -0
  238. package/dist/schema-editor/SchemaEditor.js +106 -0
  239. package/dist/schema-editor/SchemaEditor.js.map +1 -0
  240. package/dist/schema-editor/index.d.ts +10 -0
  241. package/dist/schema-editor/index.d.ts.map +1 -0
  242. package/dist/schema-editor/index.js +8 -0
  243. package/dist/schema-editor/index.js.map +1 -0
  244. package/dist/schema-editor/lint.d.ts +37 -0
  245. package/dist/schema-editor/lint.d.ts.map +1 -0
  246. package/dist/schema-editor/lint.js +49 -0
  247. package/dist/schema-editor/lint.js.map +1 -0
  248. package/dist/schema-form/SchemaForm.d.ts +70 -0
  249. package/dist/schema-form/SchemaForm.d.ts.map +1 -0
  250. package/dist/schema-form/SchemaForm.js +13 -0
  251. package/dist/schema-form/SchemaForm.js.map +1 -0
  252. package/dist/schema-form/array-field.d.ts +20 -0
  253. package/dist/schema-form/array-field.d.ts.map +1 -0
  254. package/dist/schema-form/array-field.js +39 -0
  255. package/dist/schema-form/array-field.js.map +1 -0
  256. package/dist/schema-form/classify.d.ts +87 -0
  257. package/dist/schema-form/classify.d.ts.map +1 -0
  258. package/dist/schema-form/classify.js +199 -0
  259. package/dist/schema-form/classify.js.map +1 -0
  260. package/dist/schema-form/context.d.ts +4 -0
  261. package/dist/schema-form/context.d.ts.map +1 -0
  262. package/dist/schema-form/context.js +14 -0
  263. package/dist/schema-form/context.js.map +1 -0
  264. package/dist/schema-form/default-value.d.ts +8 -0
  265. package/dist/schema-form/default-value.d.ts.map +1 -0
  266. package/dist/schema-form/default-value.js +64 -0
  267. package/dist/schema-form/default-value.js.map +1 -0
  268. package/dist/schema-form/enum-field.d.ts +19 -0
  269. package/dist/schema-form/enum-field.d.ts.map +1 -0
  270. package/dist/schema-form/enum-field.js +26 -0
  271. package/dist/schema-form/enum-field.js.map +1 -0
  272. package/dist/schema-form/field-group.d.ts +9 -0
  273. package/dist/schema-form/field-group.d.ts.map +1 -0
  274. package/dist/schema-form/field-group.js +32 -0
  275. package/dist/schema-form/field-group.js.map +1 -0
  276. package/dist/schema-form/field-node.d.ts +24 -0
  277. package/dist/schema-form/field-node.d.ts.map +1 -0
  278. package/dist/schema-form/field-node.js +51 -0
  279. package/dist/schema-form/field-node.js.map +1 -0
  280. package/dist/schema-form/index.d.ts +13 -0
  281. package/dist/schema-form/index.d.ts.map +1 -0
  282. package/dist/schema-form/index.js +11 -0
  283. package/dist/schema-form/index.js.map +1 -0
  284. package/dist/schema-form/media-field.d.ts +24 -0
  285. package/dist/schema-form/media-field.d.ts.map +1 -0
  286. package/dist/schema-form/media-field.js +169 -0
  287. package/dist/schema-form/media-field.js.map +1 -0
  288. package/dist/schema-form/media.d.ts +40 -0
  289. package/dist/schema-form/media.d.ts.map +1 -0
  290. package/dist/schema-form/media.js +65 -0
  291. package/dist/schema-form/media.js.map +1 -0
  292. package/dist/schema-form/object-fields.d.ts +20 -0
  293. package/dist/schema-form/object-fields.d.ts.map +1 -0
  294. package/dist/schema-form/object-fields.js +24 -0
  295. package/dist/schema-form/object-fields.js.map +1 -0
  296. package/dist/schema-form/resolve.d.ts +41 -0
  297. package/dist/schema-form/resolve.d.ts.map +1 -0
  298. package/dist/schema-form/resolve.js +102 -0
  299. package/dist/schema-form/resolve.js.map +1 -0
  300. package/dist/schema-form/string-field.d.ts +20 -0
  301. package/dist/schema-form/string-field.d.ts.map +1 -0
  302. package/dist/schema-form/string-field.js +68 -0
  303. package/dist/schema-form/string-field.js.map +1 -0
  304. package/dist/schema-form/styles.d.ts +18 -0
  305. package/dist/schema-form/styles.d.ts.map +1 -0
  306. package/dist/schema-form/styles.js +18 -0
  307. package/dist/schema-form/styles.js.map +1 -0
  308. package/dist/schema-form/types.d.ts +67 -0
  309. package/dist/schema-form/types.d.ts.map +1 -0
  310. package/dist/schema-form/types.js +10 -0
  311. package/dist/schema-form/types.js.map +1 -0
  312. package/dist/schema-form/union-field.d.ts +24 -0
  313. package/dist/schema-form/union-field.d.ts.map +1 -0
  314. package/dist/schema-form/union-field.js +55 -0
  315. package/dist/schema-form/union-field.js.map +1 -0
  316. package/dist/schema-form/union.d.ts +4 -0
  317. package/dist/schema-form/union.d.ts.map +1 -0
  318. package/dist/schema-form/union.js +68 -0
  319. package/dist/schema-form/union.js.map +1 -0
  320. package/dist/schema-form/unsupported-notice.d.ts +18 -0
  321. package/dist/schema-form/unsupported-notice.d.ts.map +1 -0
  322. package/dist/schema-form/unsupported-notice.js +8 -0
  323. package/dist/schema-form/unsupported-notice.js.map +1 -0
  324. package/dist/schema-form/validate.d.ts +18 -0
  325. package/dist/schema-form/validate.d.ts.map +1 -0
  326. package/dist/schema-form/validate.js +162 -0
  327. package/dist/schema-form/validate.js.map +1 -0
  328. package/dist/structured-output/StructuredOutput.d.ts +27 -0
  329. package/dist/structured-output/StructuredOutput.d.ts.map +1 -0
  330. package/dist/structured-output/StructuredOutput.js +41 -0
  331. package/dist/structured-output/StructuredOutput.js.map +1 -0
  332. package/dist/testing.d.ts +80 -0
  333. package/dist/testing.d.ts.map +1 -0
  334. package/dist/testing.js +207 -0
  335. package/dist/testing.js.map +1 -0
  336. package/package.json +101 -0
  337. package/src/components/badge.tsx +31 -0
  338. package/src/components/checkbox.tsx +93 -0
  339. package/src/components/code-block.tsx +37 -0
  340. package/src/components/completion-input.tsx +137 -0
  341. package/src/components/components.css +2212 -0
  342. package/src/components/confirm-dialog.tsx +77 -0
  343. package/src/components/control-styles.ts +14 -0
  344. package/src/components/copy-field.tsx +178 -0
  345. package/src/components/dialog.tsx +76 -0
  346. package/src/components/drawer.tsx +83 -0
  347. package/src/components/error-boundary.tsx +56 -0
  348. package/src/components/extension-combo-builder.tsx +305 -0
  349. package/src/components/extension-grouping.ts +116 -0
  350. package/src/components/extension-picker.tsx +97 -0
  351. package/src/components/external-link.tsx +40 -0
  352. package/src/components/field.tsx +169 -0
  353. package/src/components/fleet-report.tsx +136 -0
  354. package/src/components/fonts.css +22 -0
  355. package/src/components/icons.tsx +504 -0
  356. package/src/components/inputs.tsx +125 -0
  357. package/src/components/json-diff.tsx +192 -0
  358. package/src/components/json-tree.tsx +129 -0
  359. package/src/components/modal-focus.ts +150 -0
  360. package/src/components/page-header.tsx +107 -0
  361. package/src/components/primitives.tsx +489 -0
  362. package/src/components/progress-bar.tsx +100 -0
  363. package/src/components/radio-group.tsx +160 -0
  364. package/src/components/reveal-input.tsx +87 -0
  365. package/src/components/scroll-region.tsx +703 -0
  366. package/src/components/select.tsx +149 -0
  367. package/src/components/table.tsx +94 -0
  368. package/src/components/tabs.tsx +51 -0
  369. package/src/components/tags.tsx +137 -0
  370. package/src/components/tokens.css +392 -0
  371. package/src/components/tokens.ts +102 -0
  372. package/src/components/tool-picker.tsx +175 -0
  373. package/src/components/tooltip.tsx +46 -0
  374. package/src/components/version-history-panel.tsx +407 -0
  375. package/src/css.d.ts +2 -0
  376. package/src/download.ts +17 -0
  377. package/src/element-slot.ts +22 -0
  378. package/src/elicitation/ElicitationForm.tsx +87 -0
  379. package/src/errors.ts +12 -0
  380. package/src/extension-combos.ts +18 -0
  381. package/src/hooks/useApi.ts +27 -0
  382. package/src/hooks/useAuth.ts +67 -0
  383. package/src/hooks/useBreakpoint.ts +78 -0
  384. package/src/hooks/useCapabilities.ts +242 -0
  385. package/src/hooks/useSse.ts +314 -0
  386. package/src/hooks/useTheme.ts +133 -0
  387. package/src/hooks/useUnauthorized.ts +20 -0
  388. package/src/host.ts +15 -0
  389. package/src/index.ts +267 -0
  390. package/src/navigation/context.tsx +90 -0
  391. package/src/navigation/index.ts +9 -0
  392. package/src/navigation/types.ts +90 -0
  393. package/src/plugin/host-state.ts +93 -0
  394. package/src/plugin/registry.ts +174 -0
  395. package/src/plugin/types.ts +178 -0
  396. package/src/plugin/version.ts +44 -0
  397. package/src/query-keys.ts +34 -0
  398. package/src/schema-editor/SchemaEditor.tsx +186 -0
  399. package/src/schema-editor/index.ts +9 -0
  400. package/src/schema-editor/lint.ts +70 -0
  401. package/src/schema-form/SchemaForm.tsx +107 -0
  402. package/src/schema-form/array-field.tsx +110 -0
  403. package/src/schema-form/classify.ts +302 -0
  404. package/src/schema-form/context.ts +17 -0
  405. package/src/schema-form/default-value.ts +65 -0
  406. package/src/schema-form/enum-field.tsx +65 -0
  407. package/src/schema-form/field-group.tsx +71 -0
  408. package/src/schema-form/field-node.tsx +161 -0
  409. package/src/schema-form/index.ts +12 -0
  410. package/src/schema-form/media-field.tsx +281 -0
  411. package/src/schema-form/media.ts +69 -0
  412. package/src/schema-form/object-fields.tsx +74 -0
  413. package/src/schema-form/resolve.ts +114 -0
  414. package/src/schema-form/string-field.tsx +161 -0
  415. package/src/schema-form/styles.ts +20 -0
  416. package/src/schema-form/types.ts +71 -0
  417. package/src/schema-form/union-field.tsx +122 -0
  418. package/src/schema-form/union.ts +78 -0
  419. package/src/schema-form/unsupported-notice.tsx +39 -0
  420. package/src/schema-form/validate.ts +183 -0
  421. package/src/structured-output/StructuredOutput.tsx +81 -0
  422. package/src/testing.ts +235 -0
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Owned DS primitives, wearing the design-system classes from
3
+ * `components.css`. These cover the shared UI states every feature drives from
4
+ * TanStack Query: loading skeletons, a shared empty state, and a loud error
5
+ * surface. Plugins consume these — never raw Tailwind utilities.
6
+ *
7
+ * `Button` is ONE implementation for both an action and a link. Given an `href`
8
+ * it renders an anchor, and that href is checked against an http/https
9
+ * allow-list: a reference beginning `/`, `?`, `#`, `./` or `../` stays in-app, an
10
+ * absolute `http://`/`https://` URL opens in a new tab with
11
+ * `rel="noopener noreferrer external"`, and everything else — another scheme
12
+ * (`javascript:`, `data:`, …), a protocol-relative `//host`, a bare `page.html` —
13
+ * is NEUTRALIZED, rendered as plain text with no href, so a hostile URL can never
14
+ * become a live navigation target. This is an XSS pin. The neutralized text names
15
+ * BOTH admitted forms, because an in-app reference is not an http(s) URL either
16
+ * and saying only "not an http(s) URL" would describe `/tools` as blocked.
17
+ *
18
+ * The check reads the NORMALIZED reference and the anchor is given that same
19
+ * normalized string, because the raw input and the URL the browser resolves are
20
+ * not the same URL. See `normalizeHref`.
21
+ */
22
+ import type { AnchorHTMLAttributes, ButtonHTMLAttributes, CSSProperties, ReactNode, Ref } from 'react';
23
+ /**
24
+ * The absolute http(s) URL `href` denotes, or `undefined` when it denotes none.
25
+ *
26
+ * The `//` is required rather than inferred from a successful `new URL()`,
27
+ * because for a scheme that matches the document's own, the authority-less
28
+ * spelling is a PATH: an anchor with `href="https:/settings"` on an https page
29
+ * navigates to `/settings` on the CURRENT origin, while `new URL()` with no base
30
+ * reads the same string as the host `settings`. Only the `//` form means the same
31
+ * thing to both.
32
+ *
33
+ * Callers render the returned string rather than their input, so the URL that was
34
+ * judged is always the URL that is navigated.
35
+ */
36
+ export declare function safeHttpUrl(href: string): string | undefined;
37
+ /** True only for an absolute `http://`/`https://` URL. Everything else is unsafe. */
38
+ export declare function isSafeHttpUrl(url: string): boolean;
39
+ /**
40
+ * A blocked href, rendered as inert text: no anchor, no `href`, no handlers, so
41
+ * it can never become a live navigation target. Shared by `Button`'s link form
42
+ * and by `ExternalLinkButton`, which applies the stricter http(s)-only policy.
43
+ *
44
+ * Its surface is DELIBERATELY narrow. It takes the paint, the id and the name,
45
+ * and nothing else the caller wrote on the anchor: the props a live link needs
46
+ * are the props a dead one must not have, so they are refused here rather than
47
+ * spread onto the span.
48
+ *
49
+ * It stays ROLE-LESS on purpose — it is not a link and must not be announced as
50
+ * one. That is also why the caller's name arrives as visually-hidden TEXT rather
51
+ * than `aria-label`: ARIA prohibits both naming attributes on the `generic` role
52
+ * a bare `<span>` maps to, so a platform that honours the prohibition computes NO
53
+ * name from them and an icon-only blocked link announces as nothing at all. Text
54
+ * has no such restriction — a generic element contributes no accessible NAME, but
55
+ * its content is still read. `aria-disabled` stays because
56
+ * `.tai-btn[aria-disabled='true']` is what paints the disabled look; it is inert
57
+ * on a role-less element, and the missing `href` is what actually says this does
58
+ * not navigate.
59
+ *
60
+ * A caller-supplied `label` REPLACES the children for assistive tech, exactly as
61
+ * the `aria-label` it comes from would have done on the live anchor: the children
62
+ * go behind an `aria-hidden` wrapper that is `display: contents`, so it generates
63
+ * no box and the button's own flex layout is unchanged. Without that the children
64
+ * and the label are both read and a blocked link announces its name twice.
65
+ */
66
+ export declare function NeutralizedLink({ className, style, children, id, label, }: {
67
+ readonly className?: string;
68
+ readonly style?: CSSProperties;
69
+ readonly children?: ReactNode;
70
+ /** Kept so an external `aria-labelledby`/`aria-describedby` IDREF still lands. */
71
+ readonly id?: string;
72
+ /**
73
+ * The name the caller gave the link, rendered as hidden text. An icon-only
74
+ * link carries its whole meaning here, and when it is given the children are
75
+ * hidden from assistive tech so the name is read once, not twice.
76
+ */
77
+ readonly label?: string;
78
+ }): import("react").JSX.Element;
79
+ /**
80
+ * What every primitive in this file accepts alongside its own props: the
81
+ * design-system class it wears is its own, and the caller's `className` is
82
+ * APPENDED to it rather than replacing it, so a surface can never lose its paint
83
+ * by being positioned.
84
+ */
85
+ interface SurfaceProps {
86
+ readonly className?: string;
87
+ readonly style?: CSSProperties;
88
+ }
89
+ export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
90
+ /** The variant a `Button` wears when the caller names none. */
91
+ export declare const DEFAULT_BUTTON_VARIANT: ButtonVariant;
92
+ /**
93
+ * The one prop both forms share. Deliberately NOT on the public surface: it is a
94
+ * shared base, and declaration emit keeps it visible inside `primitives.d.ts`
95
+ * where `ButtonProps`/`LinkButtonProps` reference it, so consumers still see
96
+ * `variant` and can still `extends` either interface.
97
+ */
98
+ interface ButtonVariantProps {
99
+ readonly variant?: ButtonVariant;
100
+ }
101
+ /**
102
+ * The ACTION form of `Button`: button attributes, no anchor ones.
103
+ *
104
+ * This stays an INTERFACE extending `ButtonHTMLAttributes<HTMLButtonElement>`
105
+ * because it is published plugin API: a plugin may write
106
+ * `interface MyButton extends ButtonProps {}` (a union cannot be extended —
107
+ * TS2312) and may hand a `ButtonProps` value to a slot typed as plain
108
+ * `ButtonHTMLAttributes<HTMLButtonElement>` (a union including anchor attributes
109
+ * is not assignable — TS2322). The link form is the ADDITIVE `LinkButtonProps`,
110
+ * and `Button` accepts either.
111
+ *
112
+ * It declares NO `href` member. `href?: undefined` here would make
113
+ * `interface MyButton extends ButtonProps { href: string }` a TS2430
114
+ * ("incorrectly extends"), which is a narrowing of a surface that is additive
115
+ * only. The discriminant `Button` narrows on lives on `ButtonActionProps`.
116
+ */
117
+ export interface ButtonProps extends ButtonVariantProps, ButtonHTMLAttributes<HTMLButtonElement> {
118
+ /** A consumer ref for the `<button>`; the prop spread forwards it. */
119
+ readonly ref?: Ref<HTMLButtonElement>;
120
+ }
121
+ /**
122
+ * The action form as `Button` ACCEPTS it: `ButtonProps` plus the absent-`href`
123
+ * discriminant, which is what lets the body narrow `props.href` without a cast.
124
+ *
125
+ * Like `ButtonVariantProps` this is deliberately off the public surface — a
126
+ * plugin extends `ButtonProps` — and declaration emit keeps it visible inside
127
+ * `primitives.d.ts`, where `Button`'s signature references it.
128
+ */
129
+ interface ButtonActionProps extends ButtonProps {
130
+ readonly href?: undefined;
131
+ }
132
+ /**
133
+ * The LINK form of `Button`: an `href`, so it carries anchor attributes and no
134
+ * button ones.
135
+ *
136
+ * `target` and `rel` are inherited from `AnchorHTMLAttributes` and are settable,
137
+ * but on the EXTERNAL branch they are not the caller's to choose: an absolute
138
+ * http(s) URL always renders `target="_blank"` with
139
+ * `rel="noopener noreferrer external"`, whatever the caller passed. On the
140
+ * in-app branch `target` is the caller's and `rel` is pinned only when they ask
141
+ * for `_blank`.
142
+ *
143
+ * It declares NO `ref`, and that is a REFUSAL rather than an omission: a blocked
144
+ * href renders a {@link NeutralizedLink} span and no anchor at all, so a
145
+ * `Ref<HTMLAnchorElement>` would be filled on two of the three renderings and
146
+ * left null on the third — a ref that silently does nothing for exactly the
147
+ * input the check exists to catch. A caller that needs the element wraps the
148
+ * button.
149
+ */
150
+ export interface LinkButtonProps extends ButtonVariantProps, AnchorHTMLAttributes<HTMLAnchorElement> {
151
+ readonly href: string;
152
+ }
153
+ /** The variant class plus the caller's, which sorts last so it can override. */
154
+ export declare function buttonClass(variant: ButtonVariant, className: string | undefined): string;
155
+ export declare function Button(props: ButtonActionProps | LinkButtonProps): import("react").JSX.Element;
156
+ export interface CardProps extends SurfaceProps {
157
+ readonly children: ReactNode;
158
+ /** Opt in to the hover/focus lift. A card that is not itself an affordance stays flat. */
159
+ readonly interactive?: boolean;
160
+ /** A consumer ref for the card element itself. */
161
+ readonly ref?: Ref<HTMLDivElement>;
162
+ }
163
+ export declare function Card({ children, interactive, className, style, ref }: CardProps): import("react").JSX.Element;
164
+ export interface SkeletonProps extends SurfaceProps {
165
+ readonly height?: number | string;
166
+ readonly width?: number | string;
167
+ }
168
+ export declare function Skeleton({ height, width, className, style }: SkeletonProps): import("react").JSX.Element;
169
+ export interface EmptyStateProps extends SurfaceProps {
170
+ readonly title: string;
171
+ readonly description?: string;
172
+ /** The guidance line's on-screen action — the control the description names. */
173
+ readonly action?: ReactNode;
174
+ }
175
+ export declare function EmptyState({ title, description, action, className, style }: EmptyStateProps): import("react").JSX.Element;
176
+ export interface ErrorStateProps extends SurfaceProps {
177
+ readonly message: string;
178
+ readonly onRetry?: () => void;
179
+ }
180
+ export declare function ErrorState({ message, onRetry, className, style }: ErrorStateProps): import("react").JSX.Element;
181
+ export interface SpinnerProps extends SurfaceProps {
182
+ readonly label?: string;
183
+ }
184
+ export declare function Spinner({ label, className, style }: SpinnerProps): import("react").JSX.Element;
185
+ export {};
186
+ //# sourceMappingURL=primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/components/primitives.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAC;AA2Bf;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5D;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAkCD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,EAAE,EACF,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,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EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,YAAY,+BAS5E"}
@@ -0,0 +1,204 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { XCircleIcon } from './icons';
3
+ // -- Link safety --------------------------------------------------------------
4
+ /**
5
+ * The reference with the characters the URL parser throws away before it parses:
6
+ * ASCII tab, LF and CR ANYWHERE in the string, plus leading and trailing C0
7
+ * controls and spaces.
8
+ *
9
+ * Reading the raw string instead means checking a different URL from the one the
10
+ * browser resolves. `/<TAB>/evil.com` is not a root-relative path — the parser
11
+ * deletes the tab, making it the protocol-relative `//evil.com`, which is
12
+ * cross-origin.
13
+ */
14
+ function normalizeHref(href) {
15
+ const inner = href.replaceAll(/[\t\n\r]/g, '');
16
+ // The leading/trailing strip walks code points rather than using a character
17
+ // class, so it covers every C0 control without a control-character regex.
18
+ let start = 0;
19
+ let end = inner.length;
20
+ while (start < end && inner.charCodeAt(start) <= 0x20)
21
+ start++;
22
+ while (end > start && inner.charCodeAt(end - 1) <= 0x20)
23
+ end--;
24
+ return inner.slice(start, end);
25
+ }
26
+ /**
27
+ * The absolute http(s) URL `href` denotes, or `undefined` when it denotes none.
28
+ *
29
+ * The `//` is required rather than inferred from a successful `new URL()`,
30
+ * because for a scheme that matches the document's own, the authority-less
31
+ * spelling is a PATH: an anchor with `href="https:/settings"` on an https page
32
+ * navigates to `/settings` on the CURRENT origin, while `new URL()` with no base
33
+ * reads the same string as the host `settings`. Only the `//` form means the same
34
+ * thing to both.
35
+ *
36
+ * Callers render the returned string rather than their input, so the URL that was
37
+ * judged is always the URL that is navigated.
38
+ */
39
+ export function safeHttpUrl(href) {
40
+ const normalized = normalizeHref(href);
41
+ if (!/^https?:\/\//i.test(normalized))
42
+ return undefined;
43
+ try {
44
+ return new URL(normalized).href;
45
+ }
46
+ catch {
47
+ return undefined;
48
+ }
49
+ }
50
+ /** True only for an absolute `http://`/`https://` URL. Everything else is unsafe. */
51
+ export function isSafeHttpUrl(url) {
52
+ return safeHttpUrl(url) !== undefined;
53
+ }
54
+ /**
55
+ * A same-document, root-relative or explicitly relative reference. The negative
56
+ * lookahead rejects a protocol-relative `//host` (and its `/\` spelling), which
57
+ * inherits the page scheme and so resolves to a cross-origin target rather than
58
+ * an in-app one. Tested against the NORMALIZED reference — see `normalizeHref`.
59
+ *
60
+ * The lookahead belongs to the `/` branch ALONE. Applied to `#` and `?` as well
61
+ * it rejected `#/agents` — a hash route, the most common client-routed reference
62
+ * form there is, and one of the five spellings this module's own docblock says
63
+ * "stays in-app" — sending it to the neutralized span reserved for
64
+ * `javascript:`. Neither `#//evil.example` nor `?//evil.example` can be
65
+ * cross-origin: both resolve against the current document, so the lookahead
66
+ * bought nothing on those two branches and cost a whole routing style.
67
+ */
68
+ const RELATIVE_HREF = /^(?:\/(?![/\\])|[?#]|\.{1,2}\/)/;
69
+ /**
70
+ * The text a neutralized href carries in place of a navigation. It names both
71
+ * admitted forms: `/tools` and `#/agents` are in-app references rather than
72
+ * http(s) URLs and DO render as live anchors, so a reason citing only the
73
+ * http(s) rule would state a rule this component does not enforce.
74
+ */
75
+ const BLOCKED_HREF_TITLE = 'This link was blocked because it is neither an in-app reference nor an http(s) URL.';
76
+ /**
77
+ * Takes a subtree out of the accessibility tree without taking it out of the
78
+ * layout: `display: contents` generates no box, so wrapped children stay direct
79
+ * flex items of the button surface around them.
80
+ */
81
+ const hiddenFromReadersStyle = { display: 'contents' };
82
+ /**
83
+ * A blocked href, rendered as inert text: no anchor, no `href`, no handlers, so
84
+ * it can never become a live navigation target. Shared by `Button`'s link form
85
+ * and by `ExternalLinkButton`, which applies the stricter http(s)-only policy.
86
+ *
87
+ * Its surface is DELIBERATELY narrow. It takes the paint, the id and the name,
88
+ * and nothing else the caller wrote on the anchor: the props a live link needs
89
+ * are the props a dead one must not have, so they are refused here rather than
90
+ * spread onto the span.
91
+ *
92
+ * It stays ROLE-LESS on purpose — it is not a link and must not be announced as
93
+ * one. That is also why the caller's name arrives as visually-hidden TEXT rather
94
+ * than `aria-label`: ARIA prohibits both naming attributes on the `generic` role
95
+ * a bare `<span>` maps to, so a platform that honours the prohibition computes NO
96
+ * name from them and an icon-only blocked link announces as nothing at all. Text
97
+ * has no such restriction — a generic element contributes no accessible NAME, but
98
+ * its content is still read. `aria-disabled` stays because
99
+ * `.tai-btn[aria-disabled='true']` is what paints the disabled look; it is inert
100
+ * on a role-less element, and the missing `href` is what actually says this does
101
+ * not navigate.
102
+ *
103
+ * A caller-supplied `label` REPLACES the children for assistive tech, exactly as
104
+ * the `aria-label` it comes from would have done on the live anchor: the children
105
+ * go behind an `aria-hidden` wrapper that is `display: contents`, so it generates
106
+ * no box and the button's own flex layout is unchanged. Without that the children
107
+ * and the label are both read and a blocked link announces its name twice.
108
+ */
109
+ export function NeutralizedLink({ className, style, children, id, label, }) {
110
+ return (_jsxs("span", { "data-neutralized": "true", "aria-disabled": "true", title: BLOCKED_HREF_TITLE, className: className, style: style, id: id, children: [label === undefined ? (children) : (_jsx("span", { "aria-hidden": "true", style: hiddenFromReadersStyle, children: children })), _jsx("span", { className: "tai-visually-hidden", children: label === undefined ? BLOCKED_HREF_TITLE : `${label}. ${BLOCKED_HREF_TITLE}` })] }));
111
+ }
112
+ /**
113
+ * Sorts an href into the three link forms the button renders, and returns the
114
+ * normalized reference alongside. Rendering the caller's raw string instead
115
+ * would let the anchor navigate somewhere the check never saw.
116
+ */
117
+ function resolveHref(href) {
118
+ const external = safeHttpUrl(href);
119
+ if (external !== undefined)
120
+ return { kind: 'external', href: external };
121
+ const normalized = normalizeHref(href);
122
+ if (RELATIVE_HREF.test(normalized))
123
+ return { kind: 'internal', href: normalized };
124
+ return { kind: 'blocked', href: '' };
125
+ }
126
+ /** The surface's own class plus the caller's, which sorts last so it can override. */
127
+ function surfaceClass(base, className) {
128
+ return className === undefined ? base : `${base} ${className}`;
129
+ }
130
+ /** The variant a `Button` wears when the caller names none. */
131
+ export const DEFAULT_BUTTON_VARIANT = 'secondary';
132
+ const VARIANT_CLASS = {
133
+ primary: 'tai-btn tai-btn-primary',
134
+ secondary: 'tai-btn tai-btn-secondary',
135
+ ghost: 'tai-btn tai-btn-ghost',
136
+ danger: 'tai-btn tai-btn-danger',
137
+ };
138
+ /** The variant class plus the caller's, which sorts last so it can override. */
139
+ export function buttonClass(variant, className) {
140
+ return surfaceClass(VARIANT_CLASS[variant], className);
141
+ }
142
+ export function Button(props) {
143
+ if (props.href === undefined) {
144
+ const { variant = DEFAULT_BUTTON_VARIANT, className, href: _href, ...rest } = props;
145
+ return _jsx("button", { ...rest, className: buttonClass(variant, className) });
146
+ }
147
+ const { variant = DEFAULT_BUTTON_VARIANT, className, style, href, children, ...rest } = props;
148
+ const classes = buttonClass(variant, className);
149
+ const link = resolveHref(href);
150
+ if (link.kind === 'blocked') {
151
+ // Only the four props that survive the neutralization cross: the paint, the
152
+ // id an external IDREF may point at, and the caller's name (as text). Every
153
+ // other anchor prop is REFUSED rather than forwarded — `target`/`rel`
154
+ // describe a navigation that is not happening, and a handler spread onto the
155
+ // span would make the dead link live again, which is the whole defect.
156
+ return (_jsx(NeutralizedLink, { className: classes, style: style, id: rest.id, label: rest['aria-label'], children: children }));
157
+ }
158
+ if (link.kind === 'internal') {
159
+ return (_jsx("a", { ...rest, href: link.href, ...(rest.target === '_blank' ? { rel: 'noopener noreferrer' } : {}), className: classes, style: style, children: children }));
160
+ }
161
+ return (_jsx("a", { ...rest,
162
+ // REVERSE TABNABBING. `target`/`rel` are settable on `LinkButtonProps`, so
163
+ // the hardening is carried by JSX property ORDER alone: the spread comes
164
+ // FIRST and these two are written after it, which is what makes them
165
+ // unoverridable. Below the spread, `rel="opener" target="_self"` from a
166
+ // caller would open a cross-origin `_blank` with a live `window.opener`
167
+ // onto the operator's authenticated tab.
168
+ href: link.href, target: "_blank", rel: "noopener noreferrer external", className: classes, style: style, children: children }));
169
+ }
170
+ export function Card({ children, interactive = false, className, style, ref }) {
171
+ const base = interactive ? 'tai-card tai-card-interactive' : 'tai-card';
172
+ return (_jsx("div", { className: surfaceClass(base, className), style: style, ref: ref, children: children }));
173
+ }
174
+ export function Skeleton({ height = 16, width = '100%', className, style }) {
175
+ // The block's extent is per-instance; the sheen animation lives in the class.
176
+ return (_jsx("div", { "aria-hidden": "true", className: surfaceClass('tai-skeleton', className), style: { height, width, ...style } }));
177
+ }
178
+ export function EmptyState({ title, description, action, className, style }) {
179
+ return (_jsxs("div", { role: "status", className: surfaceClass('tai-empty-state', className), style: style, children: [_jsx("p", { className: "tai-empty-state-title", children: title }), description === undefined ? null : (_jsx("p", { style: { margin: 'var(--tai-space-2) 0 0' }, children: description })), action === undefined ? null : (_jsx("div", { style: { marginTop: 'var(--tai-space-4)' }, children: action }))] }));
180
+ }
181
+ // -- ErrorState (loud, visible) ----------------------------------------------
182
+ /**
183
+ * The headline every `ErrorState` wears.
184
+ *
185
+ * It is fixed, and the whole surface says one thing with it: `role="alert"`
186
+ * interrupts, the crossed circle is the ERROR mark, and `.tai-error-state` is the
187
+ * error ground. A DELIBERATE refusal — a permission denial, a server's dry-run
188
+ * "no" — is an answer rather than a malfunction, and swapping this headline alone
189
+ * would leave the mark, the ground and the live-region politeness all still
190
+ * announcing a system failure. Such a surface takes the design system's warn
191
+ * ground instead — `.tai-warn-state` for a warning block (`advisories.tsx`,
192
+ * `fleet-report.tsx`, `RunPanel.tsx`), or `role="status"` with a warn `Badge` for
193
+ * a verdict that only lands after the reader acts (`verdict.tsx`). The live-region
194
+ * politeness — `role="alert"` for a warning that interrupts, `role="status"` for
195
+ * one the reader came to find — is the surface's to choose, not this headline's.
196
+ */
197
+ const ERROR_TITLE = 'Something went wrong';
198
+ export function ErrorState({ message, onRetry, className, style }) {
199
+ return (_jsxs("div", { role: "alert", className: surfaceClass('tai-error-state', className), style: style, children: [_jsxs("strong", { className: "tai-error-state-title", children: [_jsx(XCircleIcon, {}), ERROR_TITLE] }), _jsx("p", { style: { margin: 'var(--tai-space-2) 0 0', whiteSpace: 'pre-wrap' }, children: message }), onRetry === undefined ? null : (_jsx("div", { style: { marginTop: 'var(--tai-space-3)' }, children: _jsx(Button, { type: "button", onClick: onRetry, children: "Retry" }) }))] }));
200
+ }
201
+ export function Spinner({ label = 'Loading', className, style }) {
202
+ return (_jsx("span", { role: "status", "aria-label": label, className: surfaceClass('tai-spinner', className), style: style }));
203
+ }
204
+ //# sourceMappingURL=primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/components/primitives.tsx"],"names":[],"mappings":";AA6BA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,gFAAgF;AAEhF;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC/C,6EAA6E;IAC7E,0EAA0E;IAC1E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QAAE,KAAK,EAAE,CAAC;IAC/D,OAAO,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,IAAI;QAAE,GAAG,EAAE,CAAC;IAC/D,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,SAAS,CAAC;IACxD,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAClC,CAAC;IAAC,MAA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AC,OAAO,EAAC,SAAS,EAAE,YAAY,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,aAInF,kBAAQ,SAAS,EAAC,uBAAuB,aACvC,KAAC,WAAW,KAAG,EACd,WAAW,IACL,EACT,YAAG,KAAK,EAAE,EAAE,MAAM,EAAE,wBAAwB,EAAE,UAAU,EAAE,UAAU,EAAE,YAAG,OAAO,GAAK,EACpF,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC9B,cAAK,KAAK,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,YAC7C,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,sBAE7B,GACL,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAE,KAAK,EAAgB;IAC3E,OAAO,CACL,eACE,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,SAAS,EAAE,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,EACjD,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `ProgressBar` — a design-system, accessible progress indicator for a running
3
+ * tool that reports progress (`ctx.report_progress`). Determinate when a
4
+ * positive `total` is known (fills to `value/total`); otherwise indeterminate.
5
+ *
6
+ * The track and fill are classes; only the determinate fill's WIDTH stays inline,
7
+ * because it is the one genuinely per-instance value here. The indeterminate
8
+ * sweep is `tai-progress-fill-indeterminate`.
9
+ *
10
+ * Reusable by any feature's run surface — it takes only the raw
11
+ * progress/total/message a `report_progress` notification carries and renders
12
+ * a native `role="progressbar"` element with the ARIA value fields set.
13
+ */
14
+ import type { ReactNode } from 'react';
15
+ export interface ProgressBarProps {
16
+ /** Current progress. Clamped to `[0, total]` when `total` is known. */
17
+ readonly value?: number;
18
+ /** Upper bound. When absent or non-positive the bar is INDETERMINATE. */
19
+ readonly total?: number;
20
+ /** Optional human-readable status shown alongside the bar. */
21
+ readonly message?: string;
22
+ }
23
+ /**
24
+ * Render a progress bar. With a positive `total`, `value/total` fills the track
25
+ * and the percentage is announced via `aria-valuenow`; without one, the bar is
26
+ * indeterminate (no `aria-valuenow`, per ARIA).
27
+ */
28
+ export declare function ProgressBar({ value, total, message }: ProgressBarProps): ReactNode;
29
+ //# sourceMappingURL=progress-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-bar.d.ts","sourceRoot":"","sources":["../../src/components/progress-bar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA6BD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,gBAAgB,GAAG,SAAS,CA2CtF"}
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function clampFraction(value, total) {
3
+ if (!(total > 0))
4
+ return 0;
5
+ const fraction = value / total;
6
+ // Written as `>= 0` rather than `< 0` so that NaN — which compares false to
7
+ // everything, and would otherwise reach the width and the label as `NaN%` —
8
+ // falls through to the floor.
9
+ if (!(fraction >= 0))
10
+ return 0;
11
+ if (fraction > 1)
12
+ return 1;
13
+ return fraction;
14
+ }
15
+ /**
16
+ * The value to ANNOUNCE, clamped into `[0, total]`. Derived from `value`
17
+ * directly rather than by multiplying the fraction back up: `value / total *
18
+ * total` does not round-trip in binary floating point, so `value={7}
19
+ * total={25}` announced `7.000000000000001`, and a non-finite `total` announced
20
+ * `NaN`. The same `>= 0` shape as `clampFraction` keeps NaN at the floor.
21
+ */
22
+ function clampValue(value, total) {
23
+ if (!(value >= 0))
24
+ return 0;
25
+ if (!(value <= total))
26
+ return total;
27
+ return value;
28
+ }
29
+ /** The status sits at one end of the row and the percentage at the other. */
30
+ const labelRowStyle = { justifyContent: 'space-between' };
31
+ /**
32
+ * Render a progress bar. With a positive `total`, `value/total` fills the track
33
+ * and the percentage is announced via `aria-valuenow`; without one, the bar is
34
+ * indeterminate (no `aria-valuenow`, per ARIA).
35
+ */
36
+ export function ProgressBar({ value = 0, total, message }) {
37
+ // A determinate bar has to announce a real `aria-valuemax`. `Number.isFinite`
38
+ // rather than `> 0` alone: `total={Infinity}` passes the positivity test but
39
+ // announces `aria-valuemax="Infinity"`, which is not a number any assistive
40
+ // technology can place `aria-valuenow` against, and draws a 0 % fill while
41
+ // announcing the raw value. An unbounded total is exactly the indeterminate
42
+ // case, so it renders as one.
43
+ const determinate = typeof total === 'number' && Number.isFinite(total) && total > 0;
44
+ const fraction = determinate ? clampFraction(value, total) : undefined;
45
+ const percent = fraction === undefined ? undefined : Math.round(fraction * 100);
46
+ return (_jsxs("div", { className: "tai-stack tai-stack-2", children: [_jsxs("div", { className: "tai-row tai-field-hint", style: labelRowStyle, children: [_jsx("span", { children: message ?? 'Working…' }), percent !== undefined && _jsxs("span", { children: [percent, "%"] })] }), _jsx("div", { role: "progressbar", className: "tai-progress-track", "aria-valuemin": 0, "aria-valuemax": determinate ? total : undefined, "aria-valuenow": determinate && fraction !== undefined ? clampValue(value, total) : undefined, "aria-label": message ?? 'Progress', children: determinate ? (_jsx("div", { className: "tai-progress-fill", style: { width: `${String((fraction ?? 0) * 100)}%` } })) : (_jsx("div", { className: "tai-progress-fill tai-progress-fill-indeterminate" })) })] }));
47
+ }
48
+ //# sourceMappingURL=progress-bar.js.map
@@ -0,0 +1 @@
1
+ {"version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AK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;IAEhF,OAAO,CACL,eAAK,SAAS,EAAC,uBAAuB,aAKpC,eAAK,SAAS,EAAC,wBAAwB,EAAC,KAAK,EAAE,aAAa,aAC1D,yBAAO,OAAO,IAAI,UAAU,GAAQ,EACnC,OAAO,KAAK,SAAS,IAAI,2BAAO,OAAO,SAAS,IAC7C,EACN,cACE,IAAI,EAAC,aAAa,EAClB,SAAS,EAAC,oBAAoB,mBACf,CAAC,mBACD,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,mBAI/B,WAAW,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,gBAC/E,OAAO,IAAI,UAAU,YAEhC,WAAW,CAAC,CAAC,CAAC,CACb,cACE,SAAS,EAAC,mBAAmB,EAC7B,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,GACrD,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,mDAAmD,GAAG,CACtE,GACG,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface RadioOption {
3
+ readonly value: string;
4
+ readonly label: string;
5
+ readonly disabled?: boolean;
6
+ /** Mark rendered alongside the label. Decorative — the label carries the name. */
7
+ readonly icon?: ReactNode;
8
+ /** Render the label for screen readers only; it stays the option's accessible name. */
9
+ readonly visuallyHiddenLabel?: boolean;
10
+ }
11
+ export interface RadioGroupProps {
12
+ readonly options: readonly RadioOption[];
13
+ readonly value?: string;
14
+ readonly defaultValue?: string;
15
+ readonly onValueChange?: (value: string) => void;
16
+ readonly disabled?: boolean;
17
+ readonly name?: string;
18
+ /** Visible group label, rendered above the options and wired as the group's name. */
19
+ readonly label?: string;
20
+ /**
21
+ * Accessible group name when `label` supplies none. `label` wins where both are
22
+ * given — it names the group from visible text, and emitting both would leave
23
+ * this string computed by nothing.
24
+ */
25
+ readonly 'aria-label'?: string;
26
+ /**
27
+ * Layout, and — when given — the arrow-key axis. Omitted, the options stack
28
+ * and BOTH axes move between them, which is what Radix does with no
29
+ * orientation and what every caller that never passed one already had. Pass a
30
+ * value only to pin the axis as well.
31
+ */
32
+ readonly orientation?: 'horizontal' | 'vertical';
33
+ /** `list` is a stack of labelled radios; `segmented` is a compact segment strip. */
34
+ readonly variant?: 'list' | 'segmented';
35
+ }
36
+ export declare function RadioGroup({ options, value, defaultValue, onValueChange, disabled, name, label, 'aria-label': ariaLabel, orientation, variant, }: RadioGroupProps): import("react").JSX.Element;
37
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/components/radio-group.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACjD,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACzC;AAWD,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,WAAW,EACX,OAAgB,GACjB,EAAE,eAAe,+BA0EjB"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * `RadioGroup` — a design-system wrapper over Radix RadioGroup (role `radiogroup`
4
+ * with `radio` items), in two shapes.
5
+ *
6
+ * `list` (the default) renders one row per option: a dot indicator inside a
7
+ * linked `<label>`, so the option text is the radio's accessible name.
8
+ * `segmented` renders each option AS a segment — the Radix item itself is the
9
+ * control, carrying its icon and its label with no dot — which is the shape a
10
+ * compact single-choice control (a light / dark / system switcher) needs.
11
+ *
12
+ * The group takes its accessible name from a `label` it renders itself or from
13
+ * `aria-label`. It does NOT read one from an enclosing `Field`: a group `Field`
14
+ * renders its own named `role="group"` container around this component, so the
15
+ * name lives one level up and this component would otherwise duplicate it. A
16
+ * `Field` WITHOUT `group` around a RadioGroup is a mistake — the field's
17
+ * `<label for>` dangles at an id no element carries and neither element ends up
18
+ * named — and `field-group.test.ts` fails the build on it.
19
+ *
20
+ * Roving tabindex and arrow-key movement belong to Radix; this component only
21
+ * chooses the layout that matches `orientation` and passes the prop straight
22
+ * through, so a caller that names no orientation keeps Radix's both-axes default
23
+ * rather than being pinned to one.
24
+ */
25
+ import * as RadixRadioGroup from '@radix-ui/react-radio-group';
26
+ import { useId } from 'react';
27
+ import { useFieldControl } from './field';
28
+ /** The option's name text, hidden from sight but not from assistive tech on request. */
29
+ function OptionLabel({ option }) {
30
+ return (_jsx("span", { className: option.visuallyHiddenLabel === true ? 'tai-visually-hidden' : undefined, children: option.label }));
31
+ }
32
+ export function RadioGroup({ options, value, defaultValue, onValueChange, disabled, name, label, 'aria-label': ariaLabel, orientation, variant = 'list', }) {
33
+ const field = useFieldControl();
34
+ const baseId = useId();
35
+ const ownLabelId = `${baseId}-label`;
36
+ // `label` is the STANDALONE fallback name. Inside a group `Field`, the Field
37
+ // renders the named `role="group"` container itself, so this component neither
38
+ // knows nor needs the field's label id — the group is named by construction.
39
+ const labelledBy = label === undefined ? undefined : ownLabelId;
40
+ const rootClassName = variant === 'segmented'
41
+ ? 'tai-segmented'
42
+ : orientation === 'horizontal'
43
+ ? 'tai-row'
44
+ : 'tai-stack tai-stack-2';
45
+ const group = (_jsx(RadixRadioGroup.Root, { className: rootClassName, "aria-labelledby": labelledBy, "aria-label": labelledBy === undefined ? ariaLabel : undefined, "aria-describedby": field['aria-describedby'], "aria-invalid": field['aria-invalid'], value: value, defaultValue: defaultValue, onValueChange: onValueChange, disabled: disabled, name: name, orientation: orientation, children: options.map((option) => {
46
+ if (variant === 'segmented') {
47
+ return (_jsxs(RadixRadioGroup.Item, { className: "tai-segment", value: option.value, disabled: option.disabled, children: [option.icon, _jsx(OptionLabel, { option: option })] }, option.value));
48
+ }
49
+ const itemId = `${baseId}-${option.value}`;
50
+ return (_jsxs("label", { htmlFor: itemId, className: "tai-choice", children: [_jsx(RadixRadioGroup.Item, { id: itemId, className: "tai-radio", value: option.value, disabled: option.disabled, children: _jsx(RadixRadioGroup.Indicator, { className: "tai-radio-indicator" }) }), option.icon, _jsx(OptionLabel, { option: option })] }, option.value));
51
+ }) }));
52
+ if (label === undefined)
53
+ return group;
54
+ return (_jsxs("div", { className: "tai-stack tai-stack-2", children: [_jsx("span", { id: ownLabelId, className: "tai-field-label", children: label }), group] }));
55
+ }
56
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/components/radio-group.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAsC1C,wFAAwF;AACxF,SAAS,WAAW,CAAC,EAAE,MAAM,EAAoC;IAC/D,OAAO,CACL,eAAM,SAAS,EAAE,MAAM,CAAC,mBAAmB,KAAK,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,YACrF,MAAM,CAAC,KAAK,GACR,CACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,WAAW,EACX,OAAO,GAAG,MAAM,GACA;IAChB,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,UAAU,GAAG,GAAG,MAAM,QAAQ,CAAC;IACrC,6EAA6E;IAC7E,+EAA+E;IAC/E,6EAA6E;IAC7E,MAAM,UAAU,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;IAEhE,MAAM,aAAa,GACjB,OAAO,KAAK,WAAW;QACrB,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,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,MAAM,EAAE,MAAM,GAAI,KAVrB,MAAM,CAAC,KAAK,CAWhB,CACT,CAAC;QACJ,CAAC,CAAC,GACmB,CACxB,CAAC;IAEF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,CACL,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAM,EAAE,EAAE,UAAU,EAAE,SAAS,EAAC,iBAAiB,YAC9C,KAAK,GACD,EACN,KAAK,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface RevealInputProps {
2
+ readonly value: string;
3
+ readonly onChange?: (value: string) => void;
4
+ readonly readOnly?: boolean;
5
+ readonly disabled?: boolean;
6
+ readonly idPrefix?: string;
7
+ readonly label?: string;
8
+ readonly placeholder?: string;
9
+ /** Accessible name for the inner input when no visual `label` is rendered. */
10
+ readonly 'aria-label'?: string;
11
+ }
12
+ export declare function RevealInput({ value, onChange, readOnly, disabled, idPrefix, label, placeholder, 'aria-label': ariaLabel, }: RevealInputProps): import("react").JSX.Element;
13
+ //# sourceMappingURL=reveal-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-input.d.ts","sourceRoot":"","sources":["../../src/components/reveal-input.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAyB,EACzB,KAAK,EACL,WAAW,EACX,YAAY,EAAE,SAAS,GACxB,EAAE,gBAAgB,+BA+ClB"}