@nonoun/native-ui 0.1.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 (537) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/dist/a2ui/a2ui-adapter.d.ts +50 -0
  4. package/dist/a2ui/a2ui-adapter.d.ts.map +1 -0
  5. package/dist/a2ui/a2ui-component-map.d.ts +41 -0
  6. package/dist/a2ui/a2ui-component-map.d.ts.map +1 -0
  7. package/dist/a2ui/a2ui-converter.d.ts +34 -0
  8. package/dist/a2ui/a2ui-converter.d.ts.map +1 -0
  9. package/dist/a2ui/a2ui-surface.d.ts +33 -0
  10. package/dist/a2ui/a2ui-surface.d.ts.map +1 -0
  11. package/dist/a2ui/a2ui-transport.d.ts +80 -0
  12. package/dist/a2ui/a2ui-transport.d.ts.map +1 -0
  13. package/dist/a2ui/a2ui-types.d.ts +104 -0
  14. package/dist/a2ui/a2ui-types.d.ts.map +1 -0
  15. package/dist/a2ui/index.d.ts +13 -0
  16. package/dist/a2ui/index.d.ts.map +1 -0
  17. package/dist/components/ui-accordion/index.d.ts +4 -0
  18. package/dist/components/ui-accordion/index.d.ts.map +1 -0
  19. package/dist/components/ui-accordion/ui-accordion-element.d.ts +18 -0
  20. package/dist/components/ui-accordion/ui-accordion-element.d.ts.map +1 -0
  21. package/dist/components/ui-accordion/ui-accordion-item-element.d.ts +18 -0
  22. package/dist/components/ui-accordion/ui-accordion-item-element.d.ts.map +1 -0
  23. package/dist/components/ui-accordion/ui-accordion.d.ts +4 -0
  24. package/dist/components/ui-accordion/ui-accordion.d.ts.map +1 -0
  25. package/dist/components/ui-avatar/index.d.ts +3 -0
  26. package/dist/components/ui-avatar/index.d.ts.map +1 -0
  27. package/dist/components/ui-avatar/ui-avatar-element.d.ts +20 -0
  28. package/dist/components/ui-avatar/ui-avatar-element.d.ts.map +1 -0
  29. package/dist/components/ui-avatar/ui-avatar.d.ts +3 -0
  30. package/dist/components/ui-avatar/ui-avatar.d.ts.map +1 -0
  31. package/dist/components/ui-badge/index.d.ts +3 -0
  32. package/dist/components/ui-badge/index.d.ts.map +1 -0
  33. package/dist/components/ui-badge/ui-badge-element.d.ts +13 -0
  34. package/dist/components/ui-badge/ui-badge-element.d.ts.map +1 -0
  35. package/dist/components/ui-badge/ui-badge.d.ts +3 -0
  36. package/dist/components/ui-badge/ui-badge.d.ts.map +1 -0
  37. package/dist/components/ui-breadcrumb/index.d.ts +4 -0
  38. package/dist/components/ui-breadcrumb/index.d.ts.map +1 -0
  39. package/dist/components/ui-breadcrumb/ui-breadcrumb-element.d.ts +8 -0
  40. package/dist/components/ui-breadcrumb/ui-breadcrumb-element.d.ts.map +1 -0
  41. package/dist/components/ui-breadcrumb/ui-breadcrumb-item-element.d.ts +15 -0
  42. package/dist/components/ui-breadcrumb/ui-breadcrumb-item-element.d.ts.map +1 -0
  43. package/dist/components/ui-breadcrumb/ui-breadcrumb.d.ts +4 -0
  44. package/dist/components/ui-breadcrumb/ui-breadcrumb.d.ts.map +1 -0
  45. package/dist/components/ui-button/index.d.ts +3 -0
  46. package/dist/components/ui-button/index.d.ts.map +1 -0
  47. package/dist/components/ui-button/ui-button-element.d.ts +391 -0
  48. package/dist/components/ui-button/ui-button-element.d.ts.map +1 -0
  49. package/dist/components/ui-button/ui-button.d.ts +3 -0
  50. package/dist/components/ui-button/ui-button.d.ts.map +1 -0
  51. package/dist/components/ui-calendar/calendar-store.d.ts +61 -0
  52. package/dist/components/ui-calendar/calendar-store.d.ts.map +1 -0
  53. package/dist/components/ui-calendar/index.d.ts +5 -0
  54. package/dist/components/ui-calendar/index.d.ts.map +1 -0
  55. package/dist/components/ui-calendar/ui-calendar-element.d.ts +400 -0
  56. package/dist/components/ui-calendar/ui-calendar-element.d.ts.map +1 -0
  57. package/dist/components/ui-calendar/ui-calendar.d.ts +3 -0
  58. package/dist/components/ui-calendar/ui-calendar.d.ts.map +1 -0
  59. package/dist/components/ui-chat/index.d.ts +3 -0
  60. package/dist/components/ui-chat/index.d.ts.map +1 -0
  61. package/dist/components/ui-chat/ui-chat-input-element.d.ts +21 -0
  62. package/dist/components/ui-chat/ui-chat-input-element.d.ts.map +1 -0
  63. package/dist/components/ui-chat/ui-chat-input.d.ts +3 -0
  64. package/dist/components/ui-chat/ui-chat-input.d.ts.map +1 -0
  65. package/dist/components/ui-checkbox/index.d.ts +3 -0
  66. package/dist/components/ui-checkbox/index.d.ts.map +1 -0
  67. package/dist/components/ui-checkbox/ui-checkbox-element.d.ts +402 -0
  68. package/dist/components/ui-checkbox/ui-checkbox-element.d.ts.map +1 -0
  69. package/dist/components/ui-checkbox/ui-checkbox.d.ts +3 -0
  70. package/dist/components/ui-checkbox/ui-checkbox.d.ts.map +1 -0
  71. package/dist/components/ui-combobox/index.d.ts +4 -0
  72. package/dist/components/ui-combobox/index.d.ts.map +1 -0
  73. package/dist/components/ui-combobox/ui-combobox-element.d.ts +408 -0
  74. package/dist/components/ui-combobox/ui-combobox-element.d.ts.map +1 -0
  75. package/dist/components/ui-combobox/ui-combobox.d.ts +3 -0
  76. package/dist/components/ui-combobox/ui-combobox.d.ts.map +1 -0
  77. package/dist/components/ui-command/index.d.ts +13 -0
  78. package/dist/components/ui-command/index.d.ts.map +1 -0
  79. package/dist/components/ui-command/ui-command-element.d.ts +21 -0
  80. package/dist/components/ui-command/ui-command-element.d.ts.map +1 -0
  81. package/dist/components/ui-command/ui-command-empty-element.d.ts +5 -0
  82. package/dist/components/ui-command/ui-command-empty-element.d.ts.map +1 -0
  83. package/dist/components/ui-command/ui-command-empty.d.ts +3 -0
  84. package/dist/components/ui-command/ui-command-empty.d.ts.map +1 -0
  85. package/dist/components/ui-command/ui-command-group-element.d.ts +6 -0
  86. package/dist/components/ui-command/ui-command-group-element.d.ts.map +1 -0
  87. package/dist/components/ui-command/ui-command-group.d.ts +3 -0
  88. package/dist/components/ui-command/ui-command-group.d.ts.map +1 -0
  89. package/dist/components/ui-command/ui-command-input-element.d.ts +14 -0
  90. package/dist/components/ui-command/ui-command-input-element.d.ts.map +1 -0
  91. package/dist/components/ui-command/ui-command-input.d.ts +3 -0
  92. package/dist/components/ui-command/ui-command-input.d.ts.map +1 -0
  93. package/dist/components/ui-command/ui-command-item-element.d.ts +25 -0
  94. package/dist/components/ui-command/ui-command-item-element.d.ts.map +1 -0
  95. package/dist/components/ui-command/ui-command-item.d.ts +3 -0
  96. package/dist/components/ui-command/ui-command-item.d.ts.map +1 -0
  97. package/dist/components/ui-command/ui-command-list-element.d.ts +6 -0
  98. package/dist/components/ui-command/ui-command-list-element.d.ts.map +1 -0
  99. package/dist/components/ui-command/ui-command-list.d.ts +3 -0
  100. package/dist/components/ui-command/ui-command-list.d.ts.map +1 -0
  101. package/dist/components/ui-command/ui-command.d.ts +8 -0
  102. package/dist/components/ui-command/ui-command.d.ts.map +1 -0
  103. package/dist/components/ui-controller/index.d.ts +3 -0
  104. package/dist/components/ui-controller/index.d.ts.map +1 -0
  105. package/dist/components/ui-controller/ui-controller-element.d.ts +18 -0
  106. package/dist/components/ui-controller/ui-controller-element.d.ts.map +1 -0
  107. package/dist/components/ui-controller/ui-controller.d.ts +2 -0
  108. package/dist/components/ui-controller/ui-controller.d.ts.map +1 -0
  109. package/dist/components/ui-dialog/index.d.ts +3 -0
  110. package/dist/components/ui-dialog/index.d.ts.map +1 -0
  111. package/dist/components/ui-dialog/ui-dialog-element.d.ts +17 -0
  112. package/dist/components/ui-dialog/ui-dialog-element.d.ts.map +1 -0
  113. package/dist/components/ui-dialog/ui-dialog.d.ts +3 -0
  114. package/dist/components/ui-dialog/ui-dialog.d.ts.map +1 -0
  115. package/dist/components/ui-drawer/index.d.ts +3 -0
  116. package/dist/components/ui-drawer/index.d.ts.map +1 -0
  117. package/dist/components/ui-drawer/ui-drawer-element.d.ts +18 -0
  118. package/dist/components/ui-drawer/ui-drawer-element.d.ts.map +1 -0
  119. package/dist/components/ui-drawer/ui-drawer.d.ts +3 -0
  120. package/dist/components/ui-drawer/ui-drawer.d.ts.map +1 -0
  121. package/dist/components/ui-field/index.d.ts +3 -0
  122. package/dist/components/ui-field/index.d.ts.map +1 -0
  123. package/dist/components/ui-field/ui-field-element.d.ts +14 -0
  124. package/dist/components/ui-field/ui-field-element.d.ts.map +1 -0
  125. package/dist/components/ui-field/ui-field.d.ts +3 -0
  126. package/dist/components/ui-field/ui-field.d.ts.map +1 -0
  127. package/dist/components/ui-input/index.d.ts +3 -0
  128. package/dist/components/ui-input/index.d.ts.map +1 -0
  129. package/dist/components/ui-input/ui-input-element.d.ts +404 -0
  130. package/dist/components/ui-input/ui-input-element.d.ts.map +1 -0
  131. package/dist/components/ui-input/ui-input.d.ts +3 -0
  132. package/dist/components/ui-input/ui-input.d.ts.map +1 -0
  133. package/dist/components/ui-input-otp/index.d.ts +3 -0
  134. package/dist/components/ui-input-otp/index.d.ts.map +1 -0
  135. package/dist/components/ui-input-otp/ui-input-otp-element.d.ts +399 -0
  136. package/dist/components/ui-input-otp/ui-input-otp-element.d.ts.map +1 -0
  137. package/dist/components/ui-input-otp/ui-input-otp.d.ts +3 -0
  138. package/dist/components/ui-input-otp/ui-input-otp.d.ts.map +1 -0
  139. package/dist/components/ui-listbox/index.d.ts +9 -0
  140. package/dist/components/ui-listbox/index.d.ts.map +1 -0
  141. package/dist/components/ui-listbox/ui-listbox-element.d.ts +29 -0
  142. package/dist/components/ui-listbox/ui-listbox-element.d.ts.map +1 -0
  143. package/dist/components/ui-listbox/ui-listbox.d.ts +5 -0
  144. package/dist/components/ui-listbox/ui-listbox.d.ts.map +1 -0
  145. package/dist/components/ui-listbox/ui-option-element.d.ts +23 -0
  146. package/dist/components/ui-listbox/ui-option-element.d.ts.map +1 -0
  147. package/dist/components/ui-listbox/ui-option-group-element.d.ts +6 -0
  148. package/dist/components/ui-listbox/ui-option-group-element.d.ts.map +1 -0
  149. package/dist/components/ui-listbox/ui-option-group-header-element.d.ts +7 -0
  150. package/dist/components/ui-listbox/ui-option-group-header-element.d.ts.map +1 -0
  151. package/dist/components/ui-listbox/ui-option-group-header.d.ts +3 -0
  152. package/dist/components/ui-listbox/ui-option-group-header.d.ts.map +1 -0
  153. package/dist/components/ui-listbox/ui-option-group.d.ts +3 -0
  154. package/dist/components/ui-listbox/ui-option-group.d.ts.map +1 -0
  155. package/dist/components/ui-listbox/ui-option.d.ts +3 -0
  156. package/dist/components/ui-listbox/ui-option.d.ts.map +1 -0
  157. package/dist/components/ui-nav/index.d.ts +6 -0
  158. package/dist/components/ui-nav/index.d.ts.map +1 -0
  159. package/dist/components/ui-nav/ui-nav-element.d.ts +20 -0
  160. package/dist/components/ui-nav/ui-nav-element.d.ts.map +1 -0
  161. package/dist/components/ui-nav/ui-nav-group-element.d.ts +16 -0
  162. package/dist/components/ui-nav/ui-nav-group-element.d.ts.map +1 -0
  163. package/dist/components/ui-nav/ui-nav-group-header-element.d.ts +7 -0
  164. package/dist/components/ui-nav/ui-nav-group-header-element.d.ts.map +1 -0
  165. package/dist/components/ui-nav/ui-nav-item-element.d.ts +23 -0
  166. package/dist/components/ui-nav/ui-nav-item-element.d.ts.map +1 -0
  167. package/dist/components/ui-nav/ui-nav.d.ts +2 -0
  168. package/dist/components/ui-nav/ui-nav.d.ts.map +1 -0
  169. package/dist/components/ui-pagination/index.d.ts +3 -0
  170. package/dist/components/ui-pagination/index.d.ts.map +1 -0
  171. package/dist/components/ui-pagination/ui-pagination-element.d.ts +29 -0
  172. package/dist/components/ui-pagination/ui-pagination-element.d.ts.map +1 -0
  173. package/dist/components/ui-pagination/ui-pagination.d.ts +5 -0
  174. package/dist/components/ui-pagination/ui-pagination.d.ts.map +1 -0
  175. package/dist/components/ui-radio/index.d.ts +4 -0
  176. package/dist/components/ui-radio/index.d.ts.map +1 -0
  177. package/dist/components/ui-radio/ui-radio-element.d.ts +21 -0
  178. package/dist/components/ui-radio/ui-radio-element.d.ts.map +1 -0
  179. package/dist/components/ui-radio/ui-radio-group-element.d.ts +397 -0
  180. package/dist/components/ui-radio/ui-radio-group-element.d.ts.map +1 -0
  181. package/dist/components/ui-radio/ui-radio.d.ts +4 -0
  182. package/dist/components/ui-radio/ui-radio.d.ts.map +1 -0
  183. package/dist/components/ui-range/index.d.ts +3 -0
  184. package/dist/components/ui-range/index.d.ts.map +1 -0
  185. package/dist/components/ui-range/ui-range-element.d.ts +403 -0
  186. package/dist/components/ui-range/ui-range-element.d.ts.map +1 -0
  187. package/dist/components/ui-range/ui-range.d.ts +3 -0
  188. package/dist/components/ui-range/ui-range.d.ts.map +1 -0
  189. package/dist/components/ui-segmented-control/index.d.ts +4 -0
  190. package/dist/components/ui-segmented-control/index.d.ts.map +1 -0
  191. package/dist/components/ui-segmented-control/ui-segment-element.d.ts +21 -0
  192. package/dist/components/ui-segmented-control/ui-segment-element.d.ts.map +1 -0
  193. package/dist/components/ui-segmented-control/ui-segmented-control-element.d.ts +395 -0
  194. package/dist/components/ui-segmented-control/ui-segmented-control-element.d.ts.map +1 -0
  195. package/dist/components/ui-segmented-control/ui-segmented-control.d.ts +4 -0
  196. package/dist/components/ui-segmented-control/ui-segmented-control.d.ts.map +1 -0
  197. package/dist/components/ui-select/index.d.ts +4 -0
  198. package/dist/components/ui-select/index.d.ts.map +1 -0
  199. package/dist/components/ui-select/select-controller.d.ts +12 -0
  200. package/dist/components/ui-select/select-controller.d.ts.map +1 -0
  201. package/dist/components/ui-select/ui-select-element.d.ts +408 -0
  202. package/dist/components/ui-select/ui-select-element.d.ts.map +1 -0
  203. package/dist/components/ui-select/ui-select.d.ts +4 -0
  204. package/dist/components/ui-select/ui-select.d.ts.map +1 -0
  205. package/dist/components/ui-slideshow/index.d.ts +4 -0
  206. package/dist/components/ui-slideshow/index.d.ts.map +1 -0
  207. package/dist/components/ui-slideshow/ui-slide-element.d.ts +6 -0
  208. package/dist/components/ui-slideshow/ui-slide-element.d.ts.map +1 -0
  209. package/dist/components/ui-slideshow/ui-slideshow-element.d.ts +28 -0
  210. package/dist/components/ui-slideshow/ui-slideshow-element.d.ts.map +1 -0
  211. package/dist/components/ui-slideshow/ui-slideshow.d.ts +4 -0
  212. package/dist/components/ui-slideshow/ui-slideshow.d.ts.map +1 -0
  213. package/dist/components/ui-switch/index.d.ts +3 -0
  214. package/dist/components/ui-switch/index.d.ts.map +1 -0
  215. package/dist/components/ui-switch/ui-switch-element.d.ts +396 -0
  216. package/dist/components/ui-switch/ui-switch-element.d.ts.map +1 -0
  217. package/dist/components/ui-switch/ui-switch.d.ts +3 -0
  218. package/dist/components/ui-switch/ui-switch.d.ts.map +1 -0
  219. package/dist/components/ui-table/column-resize-controller.d.ts +13 -0
  220. package/dist/components/ui-table/column-resize-controller.d.ts.map +1 -0
  221. package/dist/components/ui-table/index.d.ts +12 -0
  222. package/dist/components/ui-table/index.d.ts.map +1 -0
  223. package/dist/components/ui-table/table-drag-controller.d.ts +12 -0
  224. package/dist/components/ui-table/table-drag-controller.d.ts.map +1 -0
  225. package/dist/components/ui-table/table-store.d.ts +24 -0
  226. package/dist/components/ui-table/table-store.d.ts.map +1 -0
  227. package/dist/components/ui-table/ui-table-body-element.d.ts +7 -0
  228. package/dist/components/ui-table/ui-table-body-element.d.ts.map +1 -0
  229. package/dist/components/ui-table/ui-table-cell-element.d.ts +7 -0
  230. package/dist/components/ui-table/ui-table-cell-element.d.ts.map +1 -0
  231. package/dist/components/ui-table/ui-table-element.d.ts +22 -0
  232. package/dist/components/ui-table/ui-table-element.d.ts.map +1 -0
  233. package/dist/components/ui-table/ui-table-head-element.d.ts +7 -0
  234. package/dist/components/ui-table/ui-table-head-element.d.ts.map +1 -0
  235. package/dist/components/ui-table/ui-table-header-element.d.ts +19 -0
  236. package/dist/components/ui-table/ui-table-header-element.d.ts.map +1 -0
  237. package/dist/components/ui-table/ui-table-row-element.d.ts +18 -0
  238. package/dist/components/ui-table/ui-table-row-element.d.ts.map +1 -0
  239. package/dist/components/ui-table/ui-table.d.ts +8 -0
  240. package/dist/components/ui-table/ui-table.d.ts.map +1 -0
  241. package/dist/components/ui-tabs/index.d.ts +6 -0
  242. package/dist/components/ui-tabs/index.d.ts.map +1 -0
  243. package/dist/components/ui-tabs/ui-tab-element.d.ts +21 -0
  244. package/dist/components/ui-tabs/ui-tab-element.d.ts.map +1 -0
  245. package/dist/components/ui-tabs/ui-tab-panel-element.d.ts +14 -0
  246. package/dist/components/ui-tabs/ui-tab-panel-element.d.ts.map +1 -0
  247. package/dist/components/ui-tabs/ui-tab-panels-element.d.ts +7 -0
  248. package/dist/components/ui-tabs/ui-tab-panels-element.d.ts.map +1 -0
  249. package/dist/components/ui-tabs/ui-tabs-element.d.ts +21 -0
  250. package/dist/components/ui-tabs/ui-tabs-element.d.ts.map +1 -0
  251. package/dist/components/ui-tabs/ui-tabs.d.ts +6 -0
  252. package/dist/components/ui-tabs/ui-tabs.d.ts.map +1 -0
  253. package/dist/components/ui-textarea/index.d.ts +3 -0
  254. package/dist/components/ui-textarea/index.d.ts.map +1 -0
  255. package/dist/components/ui-textarea/ui-textarea-element.d.ts +406 -0
  256. package/dist/components/ui-textarea/ui-textarea-element.d.ts.map +1 -0
  257. package/dist/components/ui-textarea/ui-textarea.d.ts +3 -0
  258. package/dist/components/ui-textarea/ui-textarea.d.ts.map +1 -0
  259. package/dist/components/ui-tooltip/index.d.ts +3 -0
  260. package/dist/components/ui-tooltip/index.d.ts.map +1 -0
  261. package/dist/components/ui-tooltip/ui-tooltip-element.d.ts +22 -0
  262. package/dist/components/ui-tooltip/ui-tooltip-element.d.ts.map +1 -0
  263. package/dist/components/ui-tooltip/ui-tooltip.d.ts +3 -0
  264. package/dist/components/ui-tooltip/ui-tooltip.d.ts.map +1 -0
  265. package/dist/components/ui-tree/index.d.ts +4 -0
  266. package/dist/components/ui-tree/index.d.ts.map +1 -0
  267. package/dist/components/ui-tree/ui-tree-element.d.ts +16 -0
  268. package/dist/components/ui-tree/ui-tree-element.d.ts.map +1 -0
  269. package/dist/components/ui-tree/ui-tree-item-element.d.ts +18 -0
  270. package/dist/components/ui-tree/ui-tree-item-element.d.ts.map +1 -0
  271. package/dist/components/ui-tree/ui-tree.d.ts +5 -0
  272. package/dist/components/ui-tree/ui-tree.d.ts.map +1 -0
  273. package/dist/components-lean.css +5107 -0
  274. package/dist/components.css +5183 -0
  275. package/dist/containers/ui-card/index.d.ts +3 -0
  276. package/dist/containers/ui-card/index.d.ts.map +1 -0
  277. package/dist/containers/ui-card/ui-card-element.d.ts +13 -0
  278. package/dist/containers/ui-card/ui-card-element.d.ts.map +1 -0
  279. package/dist/containers/ui-card/ui-card.d.ts +3 -0
  280. package/dist/containers/ui-card/ui-card.d.ts.map +1 -0
  281. package/dist/containers/ui-layout-chat/index.d.ts +3 -0
  282. package/dist/containers/ui-layout-chat/index.d.ts.map +1 -0
  283. package/dist/containers/ui-layout-chat/ui-layout-chat-element.d.ts +14 -0
  284. package/dist/containers/ui-layout-chat/ui-layout-chat-element.d.ts.map +1 -0
  285. package/dist/containers/ui-layout-chat/ui-layout-chat.d.ts +3 -0
  286. package/dist/containers/ui-layout-chat/ui-layout-chat.d.ts.map +1 -0
  287. package/dist/containers/ui-layout-inspector/index.d.ts +3 -0
  288. package/dist/containers/ui-layout-inspector/index.d.ts.map +1 -0
  289. package/dist/containers/ui-layout-inspector/ui-layout-inspector-element.d.ts +14 -0
  290. package/dist/containers/ui-layout-inspector/ui-layout-inspector-element.d.ts.map +1 -0
  291. package/dist/containers/ui-layout-inspector/ui-layout-inspector.d.ts +3 -0
  292. package/dist/containers/ui-layout-inspector/ui-layout-inspector.d.ts.map +1 -0
  293. package/dist/containers/ui-layout-sidebar/index.d.ts +4 -0
  294. package/dist/containers/ui-layout-sidebar/index.d.ts.map +1 -0
  295. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts +8 -0
  296. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts.map +1 -0
  297. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-trigger-element.d.ts +8 -0
  298. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-trigger-element.d.ts.map +1 -0
  299. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-trigger.d.ts +3 -0
  300. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-trigger.d.ts.map +1 -0
  301. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar.d.ts +4 -0
  302. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar.d.ts.map +1 -0
  303. package/dist/containers/ui-section/index.d.ts +3 -0
  304. package/dist/containers/ui-section/index.d.ts.map +1 -0
  305. package/dist/containers/ui-section/ui-section-element.d.ts +14 -0
  306. package/dist/containers/ui-section/ui-section-element.d.ts.map +1 -0
  307. package/dist/containers/ui-section/ui-section.d.ts +3 -0
  308. package/dist/containers/ui-section/ui-section.d.ts.map +1 -0
  309. package/dist/containers/ui-toolbar/index.d.ts +3 -0
  310. package/dist/containers/ui-toolbar/index.d.ts.map +1 -0
  311. package/dist/containers/ui-toolbar/ui-toolbar-element.d.ts +9 -0
  312. package/dist/containers/ui-toolbar/ui-toolbar-element.d.ts.map +1 -0
  313. package/dist/containers/ui-toolbar/ui-toolbar.d.ts +3 -0
  314. package/dist/containers/ui-toolbar/ui-toolbar.d.ts.map +1 -0
  315. package/dist/core/context.d.ts +731 -0
  316. package/dist/core/context.d.ts.map +1 -0
  317. package/dist/core/data-list.d.ts +42 -0
  318. package/dist/core/data-list.d.ts.map +1 -0
  319. package/dist/core/data-options.d.ts +18 -0
  320. package/dist/core/data-options.d.ts.map +1 -0
  321. package/dist/core/define.d.ts +2 -0
  322. package/dist/core/define.d.ts.map +1 -0
  323. package/dist/core/effects.d.ts +5 -0
  324. package/dist/core/effects.d.ts.map +1 -0
  325. package/dist/core/form-associable.d.ts +391 -0
  326. package/dist/core/form-associable.d.ts.map +1 -0
  327. package/dist/core/gesture-router.d.ts +36 -0
  328. package/dist/core/gesture-router.d.ts.map +1 -0
  329. package/dist/core/index.d.ts +21 -0
  330. package/dist/core/index.d.ts.map +1 -0
  331. package/dist/core/reactive-prop.d.ts +62 -0
  332. package/dist/core/reactive-prop.d.ts.map +1 -0
  333. package/dist/core/trait-options.d.ts +18 -0
  334. package/dist/core/trait-options.d.ts.map +1 -0
  335. package/dist/core/trait-registry.d.ts +11 -0
  336. package/dist/core/trait-registry.d.ts.map +1 -0
  337. package/dist/core/trait-runtime.d.ts +37 -0
  338. package/dist/core/trait-runtime.d.ts.map +1 -0
  339. package/dist/core/types.d.ts +9 -0
  340. package/dist/core/types.d.ts.map +1 -0
  341. package/dist/core/ui-element.d.ts +17 -0
  342. package/dist/core/ui-element.d.ts.map +1 -0
  343. package/dist/core/uid.d.ts +2 -0
  344. package/dist/core/uid.d.ts.map +1 -0
  345. package/dist/custom-elements.json +21202 -0
  346. package/dist/dialog-controller.js +754 -0
  347. package/dist/events.d.ts +168 -0
  348. package/dist/events.d.ts.map +1 -0
  349. package/dist/foundation.css +2003 -0
  350. package/dist/icons/icons.d.ts +30 -0
  351. package/dist/icons/icons.d.ts.map +1 -0
  352. package/dist/icons/index.d.ts +4 -0
  353. package/dist/icons/index.d.ts.map +1 -0
  354. package/dist/icons/registry.d.ts +4 -0
  355. package/dist/icons/registry.d.ts.map +1 -0
  356. package/dist/icons/ui-icon-element.d.ts +15 -0
  357. package/dist/icons/ui-icon-element.d.ts.map +1 -0
  358. package/dist/icons/ui-icon.d.ts +3 -0
  359. package/dist/icons/ui-icon.d.ts.map +1 -0
  360. package/dist/index.d.ts +102 -0
  361. package/dist/index.d.ts.map +1 -0
  362. package/dist/kernel/accessibility.d.ts +15 -0
  363. package/dist/kernel/accessibility.d.ts.map +1 -0
  364. package/dist/kernel/command-bus.d.ts +13 -0
  365. package/dist/kernel/command-bus.d.ts.map +1 -0
  366. package/dist/kernel/command-history.d.ts +18 -0
  367. package/dist/kernel/command-history.d.ts.map +1 -0
  368. package/dist/kernel/components.d.ts +26 -0
  369. package/dist/kernel/components.d.ts.map +1 -0
  370. package/dist/kernel/data-binding.d.ts +33 -0
  371. package/dist/kernel/data-binding.d.ts.map +1 -0
  372. package/dist/kernel/data-runtime.d.ts +43 -0
  373. package/dist/kernel/data-runtime.d.ts.map +1 -0
  374. package/dist/kernel/executor.d.ts +16 -0
  375. package/dist/kernel/executor.d.ts.map +1 -0
  376. package/dist/kernel/focus-router.d.ts +13 -0
  377. package/dist/kernel/focus-router.d.ts.map +1 -0
  378. package/dist/kernel/index.d.ts +32 -0
  379. package/dist/kernel/index.d.ts.map +1 -0
  380. package/dist/kernel/kernel.d.ts +44 -0
  381. package/dist/kernel/kernel.d.ts.map +1 -0
  382. package/dist/kernel/observability.d.ts +58 -0
  383. package/dist/kernel/observability.d.ts.map +1 -0
  384. package/dist/kernel/overlay-manager.d.ts +21 -0
  385. package/dist/kernel/overlay-manager.d.ts.map +1 -0
  386. package/dist/kernel/patch.d.ts +59 -0
  387. package/dist/kernel/patch.d.ts.map +1 -0
  388. package/dist/kernel/planner.d.ts +151 -0
  389. package/dist/kernel/planner.d.ts.map +1 -0
  390. package/dist/kernel/policy.d.ts +58 -0
  391. package/dist/kernel/policy.d.ts.map +1 -0
  392. package/dist/kernel/schema-catalog.d.ts +54 -0
  393. package/dist/kernel/schema-catalog.d.ts.map +1 -0
  394. package/dist/kernel/schema.d.ts +6 -0
  395. package/dist/kernel/schema.d.ts.map +1 -0
  396. package/dist/kernel/types.d.ts +81 -0
  397. package/dist/kernel/types.d.ts.map +1 -0
  398. package/dist/kernel/workflow-templates.d.ts +22 -0
  399. package/dist/kernel/workflow-templates.d.ts.map +1 -0
  400. package/dist/kernel/workflow.d.ts +70 -0
  401. package/dist/kernel/workflow.d.ts.map +1 -0
  402. package/dist/kernel.d.ts +27 -0
  403. package/dist/kernel.d.ts.map +1 -0
  404. package/dist/kernel.js +4137 -0
  405. package/dist/native-ui-lean.css +7111 -0
  406. package/dist/native-ui.css +7187 -0
  407. package/dist/native-ui.js +75 -0
  408. package/dist/reactivity/batch.d.ts +2 -0
  409. package/dist/reactivity/batch.d.ts.map +1 -0
  410. package/dist/reactivity/computed.d.ts +3 -0
  411. package/dist/reactivity/computed.d.ts.map +1 -0
  412. package/dist/reactivity/debug.d.ts +5 -0
  413. package/dist/reactivity/debug.d.ts.map +1 -0
  414. package/dist/reactivity/effect.d.ts +3 -0
  415. package/dist/reactivity/effect.d.ts.map +1 -0
  416. package/dist/reactivity/graph.d.ts +35 -0
  417. package/dist/reactivity/graph.d.ts.map +1 -0
  418. package/dist/reactivity/index.d.ts +8 -0
  419. package/dist/reactivity/index.d.ts.map +1 -0
  420. package/dist/reactivity/signal.d.ts +3 -0
  421. package/dist/reactivity/signal.d.ts.map +1 -0
  422. package/dist/reactivity/types.d.ts +18 -0
  423. package/dist/reactivity/types.d.ts.map +1 -0
  424. package/dist/reactivity/untrack.d.ts +2 -0
  425. package/dist/reactivity/untrack.d.ts.map +1 -0
  426. package/dist/register-all.d.ts +11 -0
  427. package/dist/register-all.d.ts.map +1 -0
  428. package/dist/register-all.js +3 -0
  429. package/dist/register-all2.js +1244 -0
  430. package/dist/traits/adapters/clippable-adapter.d.ts +4 -0
  431. package/dist/traits/adapters/clippable-adapter.d.ts.map +1 -0
  432. package/dist/traits/adapters/collapsible-adapter.d.ts +4 -0
  433. package/dist/traits/adapters/collapsible-adapter.d.ts.map +1 -0
  434. package/dist/traits/adapters/copyable-adapter.d.ts +4 -0
  435. package/dist/traits/adapters/copyable-adapter.d.ts.map +1 -0
  436. package/dist/traits/adapters/dialogable-adapter.d.ts +4 -0
  437. package/dist/traits/adapters/dialogable-adapter.d.ts.map +1 -0
  438. package/dist/traits/adapters/dismissable-adapter.d.ts +4 -0
  439. package/dist/traits/adapters/dismissable-adapter.d.ts.map +1 -0
  440. package/dist/traits/adapters/draggable-adapter.d.ts +4 -0
  441. package/dist/traits/adapters/draggable-adapter.d.ts.map +1 -0
  442. package/dist/traits/adapters/droppable-adapter.d.ts +4 -0
  443. package/dist/traits/adapters/droppable-adapter.d.ts.map +1 -0
  444. package/dist/traits/adapters/editable-adapter.d.ts +4 -0
  445. package/dist/traits/adapters/editable-adapter.d.ts.map +1 -0
  446. package/dist/traits/adapters/focus-trappable-adapter.d.ts +4 -0
  447. package/dist/traits/adapters/focus-trappable-adapter.d.ts.map +1 -0
  448. package/dist/traits/adapters/hoverable-adapter.d.ts +4 -0
  449. package/dist/traits/adapters/hoverable-adapter.d.ts.map +1 -0
  450. package/dist/traits/adapters/index.d.ts +25 -0
  451. package/dist/traits/adapters/index.d.ts.map +1 -0
  452. package/dist/traits/adapters/intersectable-adapter.d.ts +4 -0
  453. package/dist/traits/adapters/intersectable-adapter.d.ts.map +1 -0
  454. package/dist/traits/adapters/list-navigable-adapter.d.ts +4 -0
  455. package/dist/traits/adapters/list-navigable-adapter.d.ts.map +1 -0
  456. package/dist/traits/adapters/popoverable-adapter.d.ts +4 -0
  457. package/dist/traits/adapters/popoverable-adapter.d.ts.map +1 -0
  458. package/dist/traits/adapters/pressable-adapter.d.ts +4 -0
  459. package/dist/traits/adapters/pressable-adapter.d.ts.map +1 -0
  460. package/dist/traits/adapters/range-selectable-adapter.d.ts +4 -0
  461. package/dist/traits/adapters/range-selectable-adapter.d.ts.map +1 -0
  462. package/dist/traits/adapters/resizable-adapter.d.ts +4 -0
  463. package/dist/traits/adapters/resizable-adapter.d.ts.map +1 -0
  464. package/dist/traits/adapters/roving-focusable-adapter.d.ts +4 -0
  465. package/dist/traits/adapters/roving-focusable-adapter.d.ts.map +1 -0
  466. package/dist/traits/adapters/searchable-adapter.d.ts +4 -0
  467. package/dist/traits/adapters/searchable-adapter.d.ts.map +1 -0
  468. package/dist/traits/adapters/selectable-adapter.d.ts +4 -0
  469. package/dist/traits/adapters/selectable-adapter.d.ts.map +1 -0
  470. package/dist/traits/adapters/sortable-adapter.d.ts +4 -0
  471. package/dist/traits/adapters/sortable-adapter.d.ts.map +1 -0
  472. package/dist/traits/adapters/swipeable-adapter.d.ts +4 -0
  473. package/dist/traits/adapters/swipeable-adapter.d.ts.map +1 -0
  474. package/dist/traits/adapters/toastable-adapter.d.ts +4 -0
  475. package/dist/traits/adapters/toastable-adapter.d.ts.map +1 -0
  476. package/dist/traits/adapters/validatable-adapter.d.ts +4 -0
  477. package/dist/traits/adapters/validatable-adapter.d.ts.map +1 -0
  478. package/dist/traits/adapters/virtualizable-adapter.d.ts +4 -0
  479. package/dist/traits/adapters/virtualizable-adapter.d.ts.map +1 -0
  480. package/dist/traits/clipboard-controller.d.ts +24 -0
  481. package/dist/traits/clipboard-controller.d.ts.map +1 -0
  482. package/dist/traits/collapsible-controller.d.ts +17 -0
  483. package/dist/traits/collapsible-controller.d.ts.map +1 -0
  484. package/dist/traits/copy-controller.d.ts +15 -0
  485. package/dist/traits/copy-controller.d.ts.map +1 -0
  486. package/dist/traits/dialog-controller.d.ts +14 -0
  487. package/dist/traits/dialog-controller.d.ts.map +1 -0
  488. package/dist/traits/dismiss-controller.d.ts +10 -0
  489. package/dist/traits/dismiss-controller.d.ts.map +1 -0
  490. package/dist/traits/drag-controller.d.ts +22 -0
  491. package/dist/traits/drag-controller.d.ts.map +1 -0
  492. package/dist/traits/drop-zone-controller.d.ts +18 -0
  493. package/dist/traits/drop-zone-controller.d.ts.map +1 -0
  494. package/dist/traits/edit-controller.d.ts +22 -0
  495. package/dist/traits/edit-controller.d.ts.map +1 -0
  496. package/dist/traits/focus-trap-controller.d.ts +10 -0
  497. package/dist/traits/focus-trap-controller.d.ts.map +1 -0
  498. package/dist/traits/hover-controller.d.ts +18 -0
  499. package/dist/traits/hover-controller.d.ts.map +1 -0
  500. package/dist/traits/index.d.ts +71 -0
  501. package/dist/traits/index.d.ts.map +1 -0
  502. package/dist/traits/intersect-controller.d.ts +22 -0
  503. package/dist/traits/intersect-controller.d.ts.map +1 -0
  504. package/dist/traits/list-navigate-controller.d.ts +36 -0
  505. package/dist/traits/list-navigate-controller.d.ts.map +1 -0
  506. package/dist/traits/popover-controller.d.ts +10 -0
  507. package/dist/traits/popover-controller.d.ts.map +1 -0
  508. package/dist/traits/press-controller.d.ts +14 -0
  509. package/dist/traits/press-controller.d.ts.map +1 -0
  510. package/dist/traits/range-select-controller.d.ts +19 -0
  511. package/dist/traits/range-select-controller.d.ts.map +1 -0
  512. package/dist/traits/register-all.d.ts +6 -0
  513. package/dist/traits/register-all.d.ts.map +1 -0
  514. package/dist/traits/resize-controller.d.ts +25 -0
  515. package/dist/traits/resize-controller.d.ts.map +1 -0
  516. package/dist/traits/roving-focus-controller.d.ts +20 -0
  517. package/dist/traits/roving-focus-controller.d.ts.map +1 -0
  518. package/dist/traits/search-controller.d.ts +26 -0
  519. package/dist/traits/search-controller.d.ts.map +1 -0
  520. package/dist/traits/selection-controller.d.ts +28 -0
  521. package/dist/traits/selection-controller.d.ts.map +1 -0
  522. package/dist/traits/sort-controller.d.ts +19 -0
  523. package/dist/traits/sort-controller.d.ts.map +1 -0
  524. package/dist/traits/swipe-controller.d.ts +24 -0
  525. package/dist/traits/swipe-controller.d.ts.map +1 -0
  526. package/dist/traits/toast-controller.d.ts +12 -0
  527. package/dist/traits/toast-controller.d.ts.map +1 -0
  528. package/dist/traits/validate-controller.d.ts +24 -0
  529. package/dist/traits/validate-controller.d.ts.map +1 -0
  530. package/dist/traits/virtual-scroll-controller.d.ts +19 -0
  531. package/dist/traits/virtual-scroll-controller.d.ts.map +1 -0
  532. package/dist/traits-entry.d.ts +15 -0
  533. package/dist/traits-entry.d.ts.map +1 -0
  534. package/dist/traits.js +4 -0
  535. package/dist/ui-icon-element.js +4405 -0
  536. package/dist/uid.js +147 -0
  537. package/package.json +86 -0
package/dist/kernel.js ADDED
@@ -0,0 +1,4137 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./uid.js";
2
+ var o = class {
3
+ #e = /* @__PURE__ */ new Map();
4
+ #t = [];
5
+ #n = [];
6
+ #r = r(null);
7
+ #i = r(!1);
8
+ #a = r(null);
9
+ #o = 0;
10
+ lastCommand = e(() => this.#r.value);
11
+ dispatching = e(() => this.#i.value);
12
+ errors = e(() => this.#a.value);
13
+ on(e, t) {
14
+ if (typeof e == "string") {
15
+ let n = e, r = this.#e.get(n);
16
+ return r || (r = /* @__PURE__ */ new Set(), this.#e.set(n, r)), r.add(t), () => {
17
+ r.delete(t), r.size === 0 && this.#e.delete(n);
18
+ };
19
+ }
20
+ let n = {
21
+ filter: e,
22
+ handler: t
23
+ };
24
+ return this.#t.push(n), () => {
25
+ let e = this.#t.indexOf(n);
26
+ e !== -1 && this.#t.splice(e, 1);
27
+ };
28
+ }
29
+ use(e) {
30
+ return this.#n.push(e), () => {
31
+ let t = this.#n.indexOf(e);
32
+ t !== -1 && this.#n.splice(t, 1);
33
+ };
34
+ }
35
+ dispatch(e, t, n) {
36
+ let r = typeof e == "string" ? Object.freeze({
37
+ type: e,
38
+ payload: t ?? null,
39
+ id: a("cmd"),
40
+ timestamp: Date.now(),
41
+ source: "human",
42
+ ...n ? { meta: Object.freeze(n) } : {}
43
+ }) : e, o = this.#n, s = 0, c = () => {
44
+ if (s < o.length) {
45
+ let e = o[s++];
46
+ return e(r, c);
47
+ }
48
+ this.#s(r);
49
+ };
50
+ return c(), i(() => {
51
+ this.#r.value = r;
52
+ }), r;
53
+ }
54
+ #s(e) {
55
+ let t = this.#e.get(e.type);
56
+ if (t) for (let n of t) this.#c(n, e);
57
+ for (let t of this.#t) t.filter(e) && this.#c(t.handler, e);
58
+ }
59
+ #c(e, t) {
60
+ try {
61
+ let n = e(t);
62
+ n && typeof n.then == "function" && this.#l(n);
63
+ } catch (e) {
64
+ this.#a.value = e instanceof Error ? e : Error(String(e));
65
+ }
66
+ }
67
+ #l(e) {
68
+ this.#o++, this.#o === 1 && (this.#i.value = !0), e.catch((e) => {
69
+ this.#a.value = e instanceof Error ? e : Error(String(e));
70
+ }).finally(() => {
71
+ this.#o--, this.#o === 0 && (this.#i.value = !1);
72
+ });
73
+ }
74
+ };
75
+ function s() {
76
+ return new o();
77
+ }
78
+ var c = class {
79
+ #e = r([]);
80
+ #t = r([]);
81
+ #n = 100;
82
+ undoStack = e(() => this.#e.value);
83
+ redoStack = e(() => this.#t.value);
84
+ canUndo = e(() => this.#e.value.length > 0);
85
+ canRedo = e(() => this.#t.value.length > 0);
86
+ push(e) {
87
+ e.meta?.undoType && i(() => {
88
+ let t = [...this.#e.value, e];
89
+ t.length > this.#n && t.shift(), this.#e.value = t, this.#t.value = [];
90
+ });
91
+ }
92
+ undo(e) {
93
+ let t = this.#e.value;
94
+ if (t.length === 0) return null;
95
+ let n = t[t.length - 1];
96
+ return i(() => {
97
+ this.#e.value = t.slice(0, -1), this.#t.value = [...this.#t.value, n];
98
+ }), e.dispatch(n.meta.undoType, n.meta.undoPayload ?? null, { planId: n.meta?.planId }), n;
99
+ }
100
+ redo(e) {
101
+ let t = this.#t.value;
102
+ if (t.length === 0) return null;
103
+ let n = t[t.length - 1];
104
+ i(() => {
105
+ this.#t.value = t.slice(0, -1);
106
+ let e = [...this.#e.value, n];
107
+ e.length > this.#n && e.shift(), this.#e.value = e;
108
+ });
109
+ let r = Object.freeze({
110
+ ...n,
111
+ source: "replay"
112
+ });
113
+ return e.dispatch(r), n;
114
+ }
115
+ getLog() {
116
+ return this.#e.value;
117
+ }
118
+ setMaxSize(e) {
119
+ this.#n = e;
120
+ let t = this.#e.value;
121
+ t.length > e && (this.#e.value = t.slice(t.length - e));
122
+ }
123
+ clear() {
124
+ i(() => {
125
+ this.#e.value = [], this.#t.value = [];
126
+ });
127
+ }
128
+ };
129
+ function l(e) {
130
+ let t = new c();
131
+ return e !== void 0 && t.setMaxSize(e), t;
132
+ }
133
+ var u = 1e3, d = 10, f = class {
134
+ #e = r([]);
135
+ #t = !1;
136
+ stack = e(() => this.#e.value);
137
+ topOverlay = e(() => {
138
+ let e = this.#e.value;
139
+ return e.length > 0 ? e[e.length - 1] : null;
140
+ });
141
+ open(e) {
142
+ let t = a("overlay"), n = this.getNextZIndex(), r = Object.freeze({
143
+ id: t,
144
+ type: e.type,
145
+ element: e.element,
146
+ zIndex: n,
147
+ ...e.owner ? { owner: e.owner } : {}
148
+ });
149
+ return this.#e.value = [...this.#e.value, r], this.#n(), t;
150
+ }
151
+ close(e) {
152
+ let t = this.#e.value, n = t.findIndex((t) => t.id === e);
153
+ n !== -1 && (this.#e.value = [...t.slice(0, n), ...t.slice(n + 1)], this.#i());
154
+ }
155
+ closeAll() {
156
+ this.#e.value = [], this.#i();
157
+ }
158
+ closeType(e) {
159
+ this.#e.value = this.#e.value.filter((t) => t.type !== e), this.#i();
160
+ }
161
+ isOpen(e) {
162
+ return this.#e.value.some((t) => t.id === e);
163
+ }
164
+ getEntry(e) {
165
+ return this.#e.value.find((t) => t.id === e) ?? null;
166
+ }
167
+ getNextZIndex() {
168
+ return u += d, u;
169
+ }
170
+ destroy() {
171
+ this.#e.value = [], this.#r();
172
+ }
173
+ #n() {
174
+ this.#t ||= (document.addEventListener("pointerdown", this.#a, !0), document.addEventListener("keydown", this.#o), !0);
175
+ }
176
+ #r() {
177
+ this.#t &&= (document.removeEventListener("pointerdown", this.#a, !0), document.removeEventListener("keydown", this.#o), !1);
178
+ }
179
+ #i() {
180
+ this.#e.value.length === 0 && this.#r();
181
+ }
182
+ #a = (e) => {
183
+ let t = this.topOverlay.peek();
184
+ t && (t.element.contains(e.target) || t.owner?.contains(e.target) || this.close(t.id));
185
+ };
186
+ #o = (e) => {
187
+ if (e.key !== "Escape") return;
188
+ let t = this.topOverlay.peek();
189
+ t && (e.preventDefault(), this.close(t.id));
190
+ };
191
+ };
192
+ function p() {
193
+ return new f();
194
+ }
195
+ var m = 0, h = class {
196
+ #e = [];
197
+ #t = r(["global"]);
198
+ #n = !1;
199
+ activeScope = e(() => {
200
+ let e = this.#t.value;
201
+ return e[e.length - 1];
202
+ });
203
+ register(e) {
204
+ let t = {
205
+ shortcut: e,
206
+ id: m++
207
+ };
208
+ return this.#e.push(t), this.#r(), () => {
209
+ let e = this.#e.findIndex((e) => e.id === t.id);
210
+ e !== -1 && this.#e.splice(e, 1), this.#e.length === 0 && this.#i();
211
+ };
212
+ }
213
+ pushScope(e) {
214
+ this.#t.value = [...this.#t.value, e];
215
+ }
216
+ popScope() {
217
+ let e = this.#t.value;
218
+ e.length <= 1 || (this.#t.value = e.slice(0, -1));
219
+ }
220
+ getShortcuts(e) {
221
+ return e === void 0 ? this.#e.map((e) => e.shortcut) : this.#e.filter((t) => (t.shortcut.scope ?? "global") === e).map((e) => e.shortcut);
222
+ }
223
+ destroy() {
224
+ this.#e = [], this.#t.value = ["global"], this.#i();
225
+ }
226
+ #r() {
227
+ this.#n ||= (document.addEventListener("keydown", this.#a, !0), !0);
228
+ }
229
+ #i() {
230
+ this.#n &&= (document.removeEventListener("keydown", this.#a, !0), !1);
231
+ }
232
+ #a = (e) => {
233
+ let t = e.target;
234
+ if (t.isContentEditable || t.tagName === "INPUT" || t.tagName === "TEXTAREA") return;
235
+ let n = this.activeScope.peek();
236
+ for (let t of this.#e) {
237
+ let r = t.shortcut, i = r.scope ?? "global";
238
+ if (!(i !== n && i !== "global") && this.#o(e, r)) {
239
+ e.preventDefault(), e.stopPropagation(), r.handler(e);
240
+ return;
241
+ }
242
+ }
243
+ };
244
+ #o(e, t) {
245
+ if (e.key !== t.key) return !1;
246
+ let n = t.mod;
247
+ return n ? !(!!n.ctrl !== e.ctrlKey || !!n.meta !== e.metaKey || !!n.shift !== e.shiftKey || !!n.alt !== e.altKey) : !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey;
248
+ }
249
+ };
250
+ function ee() {
251
+ return new h();
252
+ }
253
+ var te = new Set([
254
+ "script",
255
+ "style",
256
+ "link",
257
+ "iframe",
258
+ "object",
259
+ "embed",
260
+ "base",
261
+ "meta"
262
+ ]), ne = new Set(/* @__PURE__ */ "a.abbr.address.article.aside.audio.b.bdi.bdo.blockquote.br.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.i.img.ins.kbd.label.legend.li.main.map.mark.menu.nav.ol.optgroup.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.small.source.span.strong.sub.summary.sup.table.tbody.td.template.tfoot.th.thead.time.tr.track.u.ul.var.video.wbr".split(".")), re = 20;
263
+ function g(e, t, n) {
264
+ let r = [], i = /* @__PURE__ */ new Set();
265
+ return _(e.root, t, "root", r, i, 0, n?.allowUnregistered ?? !1), {
266
+ valid: r.length === 0,
267
+ errors: r
268
+ };
269
+ }
270
+ function ie(e, t, n = "root") {
271
+ let r = [];
272
+ return _(e, t, n, r, /* @__PURE__ */ new Set(), 0, !1), r;
273
+ }
274
+ function _(e, t, n, r, i, a, o) {
275
+ if (a > re) {
276
+ r.push({
277
+ path: n,
278
+ code: "max_depth_exceeded",
279
+ message: `Nesting depth exceeds maximum of ${re}`
280
+ });
281
+ return;
282
+ }
283
+ i.has(e.id) && r.push({
284
+ path: n,
285
+ code: "duplicate_id",
286
+ message: `Duplicate node ID: "${e.id}"`
287
+ }), i.add(e.id);
288
+ let s = e.tag.toLowerCase();
289
+ if (te.has(s) && r.push({
290
+ path: n,
291
+ code: "forbidden_tag",
292
+ message: `Tag "${e.tag}" is not allowed`
293
+ }), !o) {
294
+ let i = ne.has(s), a = t.has(s), o = s.includes("-");
295
+ !i && !a && o && r.push({
296
+ path: n,
297
+ code: "unknown_tag",
298
+ message: `Custom element "${e.tag}" is not registered in the kernel`
299
+ });
300
+ }
301
+ if (e.attributes) for (let [t, i] of Object.entries(e.attributes)) typeof i != "string" && r.push({
302
+ path: `${n}.attributes.${t}`,
303
+ code: "invalid_attribute_type",
304
+ message: `Attribute "${t}" must be a string, got ${typeof i}`
305
+ });
306
+ if (e.children) for (let s = 0; s < e.children.length; s++) _(e.children[s], t, `${n}.children[${s}]`, r, i, a + 1, o);
307
+ }
308
+ var ae = new Set([
309
+ "innerHTML",
310
+ "outerHTML",
311
+ "innerText",
312
+ "textContent",
313
+ "style",
314
+ "className"
315
+ ]), oe = class {
316
+ #e;
317
+ #t = /* @__PURE__ */ new Map();
318
+ constructor(e) {
319
+ this.#e = e ?? /* @__PURE__ */ new Map();
320
+ }
321
+ execute(e, t, n, r) {
322
+ let i = g(e, this.#e, r);
323
+ if (!i.valid) {
324
+ let e = i.errors.map((e) => `${e.path}: ${e.message}`).join("; ");
325
+ throw Error(`Invalid plan: ${e}`);
326
+ }
327
+ let a = new AbortController(), o = /* @__PURE__ */ new Map();
328
+ this.#n(e.root, o, n, a.signal);
329
+ let s = o.get(e.root.id);
330
+ return s && t.appendChild(s), this.#t.set(e.id, {
331
+ container: t,
332
+ elements: o,
333
+ abort: a
334
+ }), o;
335
+ }
336
+ renderNode(e, t) {
337
+ let n = /* @__PURE__ */ new Map(), r = new AbortController();
338
+ return this.#n(e, n, t, r.signal), n.get(e.id);
339
+ }
340
+ getElements(e) {
341
+ return this.#t.get(e)?.elements ?? null;
342
+ }
343
+ getSignal(e) {
344
+ return this.#t.get(e)?.abort.signal ?? null;
345
+ }
346
+ renderNodeForPlan(e, t, n) {
347
+ let r = this.#t.get(e);
348
+ return r ? this.#n(t, r.elements, n, r.abort.signal) : null;
349
+ }
350
+ teardown(e) {
351
+ let t = this.#t.get(e);
352
+ if (t) {
353
+ t.abort.abort();
354
+ for (let e of t.elements.values()) e.remove();
355
+ this.#t.delete(e);
356
+ }
357
+ }
358
+ #n(e, t, n, r) {
359
+ let i = document.createElement(e.tag);
360
+ if (t.set(e.id, i), e.attributes) for (let [t, n] of Object.entries(e.attributes)) i.setAttribute(t, n);
361
+ if (e.properties) for (let [t, n] of Object.entries(e.properties)) ae.has(t) || (i[t] = n);
362
+ if (e.slot && i.setAttribute("slot", e.slot), e.events && n) for (let [t, a] of Object.entries(e.events)) i.addEventListener(t, (t) => {
363
+ let r = t instanceof CustomEvent ? t.detail : void 0;
364
+ n.dispatch(a, {
365
+ target: e.id,
366
+ event: t.type,
367
+ ...r === void 0 ? {} : { detail: r }
368
+ });
369
+ }, { signal: r });
370
+ if (e.textContent && (!e.children || e.children.length === 0) && (i.textContent = e.textContent), e.children) for (let a of e.children) {
371
+ let e = this.#n(a, t, n, r);
372
+ i.appendChild(e);
373
+ }
374
+ return i;
375
+ }
376
+ };
377
+ function se(e) {
378
+ return new oe(e);
379
+ }
380
+ var ce = class {
381
+ #e = r([]);
382
+ #t = 1e3;
383
+ entries = e(() => this.#e.value);
384
+ size = e(() => this.#e.value.length);
385
+ log(e) {
386
+ let t = Object.freeze({
387
+ id: a("log"),
388
+ timestamp: Date.now(),
389
+ ...e
390
+ }), n = [t, ...this.#e.value];
391
+ return n.length > this.#t && (n.length = this.#t), this.#e.value = n, t;
392
+ }
393
+ query(e) {
394
+ let t = this.#e.value;
395
+ if (e.category !== void 0 && (t = t.filter((t) => t.category === e.category)), e.source !== void 0 && (t = t.filter((t) => t.source === e.source)), e.planId !== void 0 && (t = t.filter((t) => t.planId === e.planId)), e.since !== void 0) {
396
+ let n = e.since;
397
+ t = t.filter((e) => e.timestamp >= n);
398
+ }
399
+ return e.limit !== void 0 && (t = t.slice(0, e.limit)), t;
400
+ }
401
+ clear() {
402
+ this.#e.value = [];
403
+ }
404
+ setMaxSize(e) {
405
+ this.#t = e;
406
+ let t = this.#e.value;
407
+ t.length > e && (this.#e.value = t.slice(0, e));
408
+ }
409
+ logCommand(e) {
410
+ return this.log({
411
+ category: "command",
412
+ source: e.source,
413
+ summary: `${e.source}:${e.type}`,
414
+ data: e.payload,
415
+ commandId: e.id,
416
+ planId: e.meta?.planId
417
+ });
418
+ }
419
+ logPlan(e, t, n, r) {
420
+ return this.log({
421
+ category: t === "patch" ? "patch" : "plan",
422
+ source: n,
423
+ summary: `plan:${t}:${e}`,
424
+ planId: e,
425
+ ...r === void 0 ? {} : { data: r }
426
+ });
427
+ }
428
+ logError(e, t) {
429
+ return this.log({
430
+ category: "error",
431
+ source: "generated",
432
+ summary: e.message,
433
+ data: {
434
+ name: e.name,
435
+ stack: e.stack
436
+ },
437
+ ...t
438
+ });
439
+ }
440
+ };
441
+ function le(e) {
442
+ let t = new ce();
443
+ return e !== void 0 && t.setMaxSize(e), t;
444
+ }
445
+ var v = class {
446
+ #e = r([]);
447
+ #t = 500;
448
+ samples = e(() => this.#e.value);
449
+ measure(e, t) {
450
+ let n = performance.now();
451
+ try {
452
+ return t();
453
+ } finally {
454
+ this.#n(e, performance.now() - n);
455
+ }
456
+ }
457
+ async measureAsync(e, t) {
458
+ let n = performance.now();
459
+ try {
460
+ return await t();
461
+ } finally {
462
+ this.#n(e, performance.now() - n);
463
+ }
464
+ }
465
+ getSummary(e) {
466
+ let t = this.#e.value.filter((t) => t.label === e);
467
+ if (t.length === 0) return null;
468
+ let n = t.map((e) => e.duration).sort((e, t) => e - t), r = n.length;
469
+ return {
470
+ count: r,
471
+ min: n[0],
472
+ max: n[r - 1],
473
+ avg: n.reduce((e, t) => e + t, 0) / r,
474
+ p95: n[Math.min(Math.ceil(r * .95) - 1, r - 1)]
475
+ };
476
+ }
477
+ clear() {
478
+ this.#e.value = [];
479
+ }
480
+ setMaxSamples(e) {
481
+ this.#t = e;
482
+ let t = this.#e.value;
483
+ t.length > e && (this.#e.value = t.slice(0, e));
484
+ }
485
+ #n(e, t) {
486
+ let n = [Object.freeze({
487
+ label: e,
488
+ duration: t,
489
+ timestamp: Date.now()
490
+ }), ...this.#e.value];
491
+ n.length > this.#t && (n.length = this.#t), this.#e.value = n;
492
+ }
493
+ };
494
+ function ue(e) {
495
+ let t = new v();
496
+ return e !== void 0 && t.setMaxSamples(e), t;
497
+ }
498
+ var de = 3, fe = 1e3;
499
+ function pe(e) {
500
+ return e.cacheKey ?? `${e.method ?? "GET"}:${e.source}`;
501
+ }
502
+ var y = class {
503
+ #e = /* @__PURE__ */ new Map();
504
+ #t = /* @__PURE__ */ new Map();
505
+ #n = r(!1);
506
+ #r = r(null);
507
+ #i = 0;
508
+ loading = e(() => this.#n.value);
509
+ error = e(() => this.#r.value);
510
+ query(t) {
511
+ let n = pe(t), i = t.cacheTtl ?? 0, a = this.#e.get(n);
512
+ if (a && i > 0 && Date.now() - a.entry.timestamp < i) return e(() => a.signal.value);
513
+ let o = a;
514
+ return o || (o = {
515
+ entry: {
516
+ data: null,
517
+ timestamp: 0
518
+ },
519
+ signal: r(null)
520
+ }, this.#e.set(n, o)), this.#a(t, n), e(() => o.signal.value);
521
+ }
522
+ async mutate(e, t) {
523
+ let n, a;
524
+ if (t) if (a = this.#e.get(t.key), n = a?.signal.peek() ?? null, a) a.signal.value = t.value, a.entry = Object.freeze({
525
+ data: t.value,
526
+ timestamp: Date.now()
527
+ });
528
+ else {
529
+ let e = r(t.value);
530
+ a = {
531
+ entry: Object.freeze({
532
+ data: t.value,
533
+ timestamp: Date.now()
534
+ }),
535
+ signal: e
536
+ }, this.#e.set(t.key, a);
537
+ }
538
+ try {
539
+ let n = await this.#s(e), a = pe(e);
540
+ return i(() => {
541
+ let e = Object.freeze({
542
+ data: n,
543
+ timestamp: Date.now()
544
+ }), i = this.#e.get(a);
545
+ if (i ? (i.signal.value = n, i.entry = e) : this.#e.set(a, {
546
+ entry: e,
547
+ signal: r(n)
548
+ }), t && t.key !== a) {
549
+ let r = this.#e.get(t.key);
550
+ r && (r.signal.value = n, r.entry = e);
551
+ }
552
+ }), n;
553
+ } catch (e) {
554
+ t && a && i(() => {
555
+ a.signal.value = n, a.entry = Object.freeze({
556
+ data: n,
557
+ timestamp: Date.now()
558
+ });
559
+ });
560
+ let r = e instanceof Error ? e : Error(String(e));
561
+ throw this.#r.value = r, r;
562
+ }
563
+ }
564
+ invalidate(e) {
565
+ let t = this.#e.get(e);
566
+ t && (t.entry = Object.freeze({
567
+ data: t.entry.data,
568
+ timestamp: 0,
569
+ ...t.entry.etag ? { etag: t.entry.etag } : {}
570
+ }));
571
+ }
572
+ invalidateAll() {
573
+ for (let e of this.#e.keys()) this.invalidate(e);
574
+ }
575
+ getCache(e) {
576
+ return this.#e.get(e)?.entry ?? null;
577
+ }
578
+ abort(e) {
579
+ let t = this.#t.get(e);
580
+ t && (t.abort(), this.#t.delete(e));
581
+ }
582
+ abortAll() {
583
+ for (let e of this.#t.values()) e.abort();
584
+ this.#t.clear();
585
+ }
586
+ destroy() {
587
+ this.abortAll(), this.#e.clear(), i(() => {
588
+ this.#n.value = !1, this.#r.value = null;
589
+ }), this.#i = 0;
590
+ }
591
+ async #a(e, t) {
592
+ this.#c();
593
+ try {
594
+ let n = await this.#o(e);
595
+ i(() => {
596
+ let e = Object.freeze({
597
+ data: n,
598
+ timestamp: Date.now()
599
+ }), i = this.#e.get(t);
600
+ i ? (i.signal.value = n, i.entry = e) : this.#e.set(t, {
601
+ entry: e,
602
+ signal: r(n)
603
+ }), this.#r.value = null;
604
+ });
605
+ } catch (e) {
606
+ if (e instanceof DOMException && e.name === "AbortError") return;
607
+ this.#r.value = e instanceof Error ? e : Error(String(e));
608
+ } finally {
609
+ this.#l();
610
+ }
611
+ }
612
+ async #o(e) {
613
+ let t = e.retries ?? de, n = e.retryDelay ?? fe;
614
+ this.abort(e.id);
615
+ let r = new AbortController();
616
+ this.#t.set(e.id, r);
617
+ let i;
618
+ for (let a = 0; a <= t; a++) {
619
+ if (a > 0) {
620
+ let e = n * 2 ** (a - 1);
621
+ await this.#u(e, r.signal);
622
+ }
623
+ if (r.signal.aborted) throw new DOMException("The operation was aborted.", "AbortError");
624
+ try {
625
+ let t = await this.#s(e, r.signal);
626
+ return this.#t.delete(e.id), t;
627
+ } catch (n) {
628
+ if (n instanceof DOMException && n.name === "AbortError") throw n;
629
+ if (n instanceof b && n.status >= 400 && n.status < 500) throw this.#t.delete(e.id), n;
630
+ if (i = n instanceof Error ? n : Error(String(n)), a === t) throw this.#t.delete(e.id), i;
631
+ }
632
+ }
633
+ throw this.#t.delete(e.id), i ?? /* @__PURE__ */ Error("Fetch failed");
634
+ }
635
+ async #s(e, t) {
636
+ let n = e.method ?? "GET", r = { ...e.headers }, i = {
637
+ method: n,
638
+ headers: r,
639
+ ...t ? { signal: t } : {}
640
+ };
641
+ e.body !== void 0 && n !== "GET" && n !== "DELETE" && (typeof e.body == "string" ? i.body = e.body : (i.body = JSON.stringify(e.body), !r["Content-Type"] && !r["content-type"] && (r["Content-Type"] = "application/json")));
642
+ let a = await fetch(e.source, i);
643
+ if (!a.ok) throw new b(a.status, a.statusText, e.source);
644
+ return (a.headers.get("content-type") ?? "").includes("application/json") ? await a.json() : await a.text();
645
+ }
646
+ #c() {
647
+ this.#i++, this.#i === 1 && (this.#n.value = !0);
648
+ }
649
+ #l() {
650
+ this.#i--, this.#i <= 0 && (this.#i = 0, this.#n.value = !1);
651
+ }
652
+ #u(e, t) {
653
+ return new Promise((n, r) => {
654
+ if (t.aborted) {
655
+ r(new DOMException("The operation was aborted.", "AbortError"));
656
+ return;
657
+ }
658
+ let i = setTimeout(n, e);
659
+ t.addEventListener("abort", () => {
660
+ clearTimeout(i), r(new DOMException("The operation was aborted.", "AbortError"));
661
+ }, { once: !0 });
662
+ });
663
+ }
664
+ }, b = class extends Error {
665
+ status;
666
+ statusText;
667
+ url;
668
+ constructor(e, t, n) {
669
+ super(`HTTP ${e} ${t}: ${n}`), this.name = "HttpError", this.status = e, this.statusText = t, this.url = n;
670
+ }
671
+ };
672
+ function me() {
673
+ return new y();
674
+ }
675
+ function x(e, t) {
676
+ return Object.freeze({
677
+ id: a("bind"),
678
+ source: e,
679
+ ...t
680
+ });
681
+ }
682
+ var he = new Set(/* @__PURE__ */ "alert.alertdialog.application.article.banner.button.cell.checkbox.columnheader.combobox.complementary.contentinfo.definition.dialog.directory.document.feed.figure.form.grid.gridcell.group.heading.img.link.list.listbox.listitem.log.main.marquee.math.menu.menubar.menuitem.menuitemcheckbox.menuitemradio.meter.navigation.none.note.option.presentation.progressbar.radio.radiogroup.region.row.rowgroup.rowheader.scrollbar.search.searchbox.separator.slider.spinbutton.status.switch.tab.table.tablist.tabpanel.term.textbox.timer.toolbar.tooltip.tree.treegrid.treeitem".split(".")), ge = new Set([
683
+ "button",
684
+ "a",
685
+ "input",
686
+ "select",
687
+ "textarea"
688
+ ]), _e = new Set([
689
+ "button",
690
+ "link",
691
+ "checkbox",
692
+ "radio",
693
+ "switch",
694
+ "tab",
695
+ "menuitem",
696
+ "option",
697
+ "combobox",
698
+ "listbox",
699
+ "slider"
700
+ ]), ve = new Set([
701
+ "ui-button",
702
+ "ui-checkbox",
703
+ "ui-switch",
704
+ "ui-radio",
705
+ "ui-input",
706
+ "ui-select",
707
+ "ui-combobox",
708
+ "ui-range",
709
+ "ui-textarea",
710
+ "ui-tab",
711
+ "ui-option",
712
+ "ui-command-item",
713
+ "ui-tree-item"
714
+ ]), ye = new Set([
715
+ "input",
716
+ "select",
717
+ "textarea"
718
+ ]), be = new Set([
719
+ "ui-input",
720
+ "ui-select",
721
+ "ui-combobox",
722
+ "ui-textarea",
723
+ "ui-range"
724
+ ]), xe = new Set([
725
+ "h1",
726
+ "h2",
727
+ "h3",
728
+ "h4",
729
+ "h5",
730
+ "h6"
731
+ ]), Se = {
732
+ checkbox: ["aria-checked"],
733
+ switch: ["aria-checked"],
734
+ radio: ["aria-checked"],
735
+ combobox: ["aria-expanded"],
736
+ slider: [
737
+ "aria-valuenow",
738
+ "aria-valuemin",
739
+ "aria-valuemax"
740
+ ],
741
+ spinbutton: [
742
+ "aria-valuenow",
743
+ "aria-valuemin",
744
+ "aria-valuemax"
745
+ ],
746
+ tab: ["aria-selected"],
747
+ heading: ["aria-level"]
748
+ };
749
+ function S(e, t) {
750
+ return e.attributes?.[t];
751
+ }
752
+ function C(e, t) {
753
+ return e.attributes?.[t] !== void 0;
754
+ }
755
+ function Ce(e) {
756
+ if (C(e, "aria-label") || C(e, "aria-labelledby") || e.textContent && e.textContent.trim().length > 0) return !0;
757
+ if (e.children) {
758
+ for (let t of e.children) if (t.textContent && t.textContent.trim().length > 0) return !0;
759
+ }
760
+ return !1;
761
+ }
762
+ function we(e) {
763
+ let t = e.tag.toLowerCase();
764
+ if (ge.has(t) || ve.has(t)) return !0;
765
+ let n = S(e, "role");
766
+ return !!(n && _e.has(n));
767
+ }
768
+ function Te(e) {
769
+ let t = e.tag.toLowerCase();
770
+ return ye.has(t) || be.has(t);
771
+ }
772
+ function Ee(e) {
773
+ let t = e.tag.toLowerCase();
774
+ if (xe.has(t)) return parseInt(t[1], 10);
775
+ if (S(e, "role") === "heading") {
776
+ let t = S(e, "aria-level");
777
+ if (t) {
778
+ let e = parseInt(t, 10);
779
+ if (!isNaN(e) && e >= 1 && e <= 6) return e;
780
+ }
781
+ }
782
+ return null;
783
+ }
784
+ function De(e, t, n) {
785
+ let r = e.tag.toLowerCase();
786
+ n.ids.has(e.id) && n.violations.push({
787
+ nodeId: e.id,
788
+ path: t,
789
+ rule: "no-duplicate-id",
790
+ severity: "error",
791
+ message: `Duplicate node ID: "${e.id}"`
792
+ }), n.ids.add(e.id), we(e) && !Ce(e) && n.violations.push({
793
+ nodeId: e.id,
794
+ path: t,
795
+ rule: "interactive-needs-name",
796
+ severity: "error",
797
+ message: `Interactive element <${e.tag}> is missing an accessible name (aria-label, aria-labelledby, or text content)`
798
+ }), r === "img" && !C(e, "alt") && n.violations.push({
799
+ nodeId: e.id,
800
+ path: t,
801
+ rule: "img-needs-alt",
802
+ severity: "error",
803
+ message: "<img> element is missing an alt attribute"
804
+ });
805
+ let i = S(e, "role");
806
+ if (i === "img" && !C(e, "aria-label") && !C(e, "aria-labelledby") && n.violations.push({
807
+ nodeId: e.id,
808
+ path: t,
809
+ rule: "img-role-needs-name",
810
+ severity: "error",
811
+ message: "Element with role=\"img\" is missing aria-label or aria-labelledby"
812
+ }), Te(e) && !C(e, "aria-label") && !C(e, "aria-labelledby") && n.violations.push({
813
+ nodeId: e.id,
814
+ path: t,
815
+ rule: "form-input-needs-label",
816
+ severity: "warning",
817
+ message: `Form element <${e.tag}> is missing a label (aria-label or aria-labelledby)`
818
+ }), i && !he.has(i) && n.violations.push({
819
+ nodeId: e.id,
820
+ path: t,
821
+ rule: "valid-role",
822
+ severity: "error",
823
+ message: `Invalid ARIA role: "${i}"`
824
+ }), i && i in Se) {
825
+ let r = Se[i];
826
+ for (let a of r) C(e, a) || n.violations.push({
827
+ nodeId: e.id,
828
+ path: t,
829
+ rule: "required-aria-props",
830
+ severity: "warning",
831
+ message: `Element with role="${i}" is missing required attribute "${a}"`
832
+ });
833
+ }
834
+ let a = Ee(e);
835
+ if (a !== null && n.headingLevels.push(a), (r === "main" || i === "main") && n.mainCount++, e.children) for (let r = 0; r < e.children.length; r++) De(e.children[r], `${t}.children[${r}]`, n);
836
+ }
837
+ function w(e) {
838
+ let t = {
839
+ violations: [],
840
+ ids: /* @__PURE__ */ new Set(),
841
+ headingLevels: [],
842
+ mainCount: 0
843
+ };
844
+ if (De(e, "root", t), t.headingLevels.length > 1) {
845
+ let e = [...t.headingLevels].sort((e, t) => e - t), n = [...new Set(e)];
846
+ for (let e = 1; e < n.length; e++) {
847
+ let r = n[e - 1], i = n[e];
848
+ i - r > 1 && t.violations.push({
849
+ nodeId: "",
850
+ path: "root",
851
+ rule: "heading-hierarchy",
852
+ severity: "warning",
853
+ message: `Heading hierarchy skips from h${r} to h${i}`
854
+ });
855
+ }
856
+ }
857
+ return t.mainCount > 1 && t.violations.push({
858
+ nodeId: "",
859
+ path: "root",
860
+ rule: "single-main-landmark",
861
+ severity: "warning",
862
+ message: `Found ${t.mainCount} main landmarks — there should be at most one`
863
+ }), {
864
+ valid: t.violations.every((e) => e.severity !== "error"),
865
+ violations: t.violations
866
+ };
867
+ }
868
+ function Oe(e) {
869
+ let t = [];
870
+ return je(e, "root", t), {
871
+ valid: t.every((e) => e.severity !== "error"),
872
+ violations: t
873
+ };
874
+ }
875
+ function ke(e) {
876
+ if (e.tabIndex >= 0) return !0;
877
+ let t = e.tagName.toLowerCase();
878
+ return !!(t === "button" || t === "input" || t === "select" || t === "textarea" || t === "a" && e.hasAttribute("href") || e.isContentEditable);
879
+ }
880
+ function Ae(e) {
881
+ if (e.getAttribute("aria-label") || e.getAttribute("aria-labelledby")) return !0;
882
+ let t = e.textContent?.trim();
883
+ return !!(t && t.length > 0 || e.getAttribute("title") || e.tagName.toLowerCase() === "input" && e.getAttribute("placeholder"));
884
+ }
885
+ function je(e, t, n) {
886
+ let r = e.id || e.tagName.toLowerCase();
887
+ ke(e) && !Ae(e) && n.push({
888
+ nodeId: r,
889
+ path: t,
890
+ rule: "focusable-needs-name",
891
+ severity: "error",
892
+ message: `Focusable element <${e.tagName.toLowerCase()}> is missing an accessible name`
893
+ }), e.tagName.toLowerCase() === "img" && !e.hasAttribute("alt") && n.push({
894
+ nodeId: r,
895
+ path: t,
896
+ rule: "img-needs-alt",
897
+ severity: "error",
898
+ message: "<img> element is missing an alt attribute"
899
+ });
900
+ for (let i of e.attributes) i.name.startsWith("aria-") && i.value === "" && n.push({
901
+ nodeId: r,
902
+ path: t,
903
+ rule: "no-empty-aria",
904
+ severity: "error",
905
+ message: `ARIA attribute "${i.name}" has an empty value`
906
+ });
907
+ let i = e.children;
908
+ for (let e = 0; e < i.length; e++) {
909
+ let r = i[e];
910
+ r instanceof HTMLElement && je(r, `${t}.children[${e}]`, n);
911
+ }
912
+ }
913
+ var Me = new Set([
914
+ "innerHTML",
915
+ "outerHTML",
916
+ "innerText",
917
+ "textContent",
918
+ "style",
919
+ "className"
920
+ ]);
921
+ function Ne(e, t) {
922
+ return `${e}::${t}`;
923
+ }
924
+ var Pe = /* @__PURE__ */ new Map();
925
+ function Fe(e) {
926
+ let t = Pe.get(e);
927
+ return t || (t = /* @__PURE__ */ new Map(), Pe.set(e, t)), t;
928
+ }
929
+ function Ie(e, t, n) {
930
+ let r = t.getElements(e.planId), i = t.getSignal(e.planId);
931
+ if (!r || !i) return {
932
+ applied: 0,
933
+ errors: e.ops.map((t) => ({
934
+ op: t,
935
+ message: `Plan "${e.planId}" not found`
936
+ }))
937
+ };
938
+ let a = Fe(e.planId), o = 0, s = [];
939
+ for (let c of e.ops) {
940
+ let l = Le(c, r, i, a, t, e.planId, n);
941
+ l ? s.push({
942
+ op: c,
943
+ message: l
944
+ }) : o++;
945
+ }
946
+ return {
947
+ applied: o,
948
+ errors: s
949
+ };
950
+ }
951
+ function Le(e, t, n, r, i, a, o) {
952
+ switch (e.type) {
953
+ case "add": return Re(e, t, i, a, o);
954
+ case "remove": return ze(e, t, r);
955
+ case "replace": return Ve(e, t, r, i, a, o);
956
+ case "set-attribute": return He(e, t);
957
+ case "remove-attribute": return Ue(e, t);
958
+ case "set-property": return We(e, t);
959
+ case "set-text": return Ge(e, t);
960
+ case "set-event": return Ke(e, t, n, r, o);
961
+ case "remove-event": return qe(e, t, r);
962
+ default: return `Unknown patch op type: "${e.type}"`;
963
+ }
964
+ }
965
+ function Re(e, t, n, r, i) {
966
+ let a = t.get(e.parentId);
967
+ if (!a) return `Parent element "${e.parentId}" not found`;
968
+ let o = n.renderNodeForPlan(r, e.node, i);
969
+ if (!o) return `Failed to render node for plan "${r}"`;
970
+ if (e.index !== void 0 && e.index < a.children.length) {
971
+ let t = a.children[e.index];
972
+ t ? a.insertBefore(o, t) : a.appendChild(o);
973
+ } else a.appendChild(o);
974
+ return null;
975
+ }
976
+ function ze(e, t, n) {
977
+ let r = t.get(e.targetId);
978
+ return r ? (r.remove(), T(r, t, n), null) : `Element "${e.targetId}" not found`;
979
+ }
980
+ /**
981
+ * Removes an element and all its tracked descendants from the elements map.
982
+ * Also aborts any patch-added event listeners for removed elements.
983
+ */
984
+ function T(e, t, n) {
985
+ for (let [r, i] of t) if (i === e) {
986
+ t.delete(r), Be(r, n);
987
+ break;
988
+ }
989
+ for (let r of Array.from(e.children)) r instanceof HTMLElement && T(r, t, n);
990
+ }
991
+ function Be(e, t) {
992
+ let n = `${e}::`;
993
+ for (let [e, r] of t) e.startsWith(n) && (r.abort(), t.delete(e));
994
+ }
995
+ function Ve(e, t, n, r, i, a) {
996
+ let o = t.get(e.targetId);
997
+ if (!o) return `Element "${e.targetId}" not found`;
998
+ let s = o.parentElement;
999
+ if (!s) return `Element "${e.targetId}" has no parent`;
1000
+ let c = r.renderNodeForPlan(i, e.node, a);
1001
+ return c ? (T(o, t, n), s.replaceChild(c, o), null) : `Failed to render replacement node for plan "${i}"`;
1002
+ }
1003
+ function He(e, t) {
1004
+ let n = t.get(e.targetId);
1005
+ return n ? (n.setAttribute(e.name, e.value), null) : `Element "${e.targetId}" not found`;
1006
+ }
1007
+ function Ue(e, t) {
1008
+ let n = t.get(e.targetId);
1009
+ return n ? (n.removeAttribute(e.name), null) : `Element "${e.targetId}" not found`;
1010
+ }
1011
+ function We(e, t) {
1012
+ let n = t.get(e.targetId);
1013
+ return n ? Me.has(e.name) ? `Property "${e.name}" is blocked` : (n[e.name] = e.value, null) : `Element "${e.targetId}" not found`;
1014
+ }
1015
+ function Ge(e, t) {
1016
+ let n = t.get(e.targetId);
1017
+ return n ? (n.textContent = e.text, null) : `Element "${e.targetId}" not found`;
1018
+ }
1019
+ function Ke(e, t, n, r, i) {
1020
+ let a = t.get(e.targetId);
1021
+ if (!a) return `Element "${e.targetId}" not found`;
1022
+ if (!i) return `No CommandBus provided — cannot wire event "${e.event}"`;
1023
+ let o = Ne(e.targetId, e.event), s = r.get(o);
1024
+ s && s.abort();
1025
+ let c = new AbortController();
1026
+ return n.addEventListener("abort", () => c.abort(), { once: !0 }), r.set(o, c), a.addEventListener(e.event, (t) => {
1027
+ let n = t instanceof CustomEvent ? t.detail : void 0;
1028
+ i.dispatch(e.commandType, {
1029
+ target: e.targetId,
1030
+ event: t.type,
1031
+ ...n === void 0 ? {} : { detail: n }
1032
+ });
1033
+ }, { signal: c.signal }), null;
1034
+ }
1035
+ function qe(e, t, n) {
1036
+ if (!t.get(e.targetId)) return `Element "${e.targetId}" not found`;
1037
+ let r = Ne(e.targetId, e.event), i = n.get(r);
1038
+ return i ? (i.abort(), n.delete(r), null) : `No patch-added listener for event "${e.event}" on element "${e.targetId}"`;
1039
+ }
1040
+ function E(e, t) {
1041
+ if (e === "*" || e === t) return !0;
1042
+ if (e.endsWith(".*")) {
1043
+ let n = e.slice(0, -2);
1044
+ return t === n || t.startsWith(n + ".");
1045
+ }
1046
+ return !1;
1047
+ }
1048
+ var D = class {
1049
+ #e = r([]);
1050
+ #t = r([]);
1051
+ #n = /* @__PURE__ */ new Map();
1052
+ #r = r(null);
1053
+ #i = r(0);
1054
+ capabilities = e(() => this.#e.value);
1055
+ rules = e(() => this.#t.value);
1056
+ lastDecision = e(() => this.#r.value);
1057
+ deniedCount = e(() => this.#i.value);
1058
+ grant(e) {
1059
+ let t = a("cap"), n = Object.freeze({
1060
+ id: t,
1061
+ ...e
1062
+ });
1063
+ return this.#e.value = [...this.#e.value, n], t;
1064
+ }
1065
+ revoke(e) {
1066
+ let t = this.#e.value.filter((t) => t.id !== e);
1067
+ t.length !== this.#e.value.length && (this.#e.value = t);
1068
+ }
1069
+ revokeAll() {
1070
+ this.#e.value = [];
1071
+ }
1072
+ hasCapability(e) {
1073
+ let t = Date.now();
1074
+ return this.#e.value.some((n) => n.name === e && (n.expiresAt === void 0 || n.expiresAt > t));
1075
+ }
1076
+ addRule(e) {
1077
+ let t = a("rule"), n = Object.freeze({
1078
+ id: t,
1079
+ ...e
1080
+ });
1081
+ return this.#t.value = [...this.#t.value, n], t;
1082
+ }
1083
+ removeRule(e) {
1084
+ let t = this.#t.value.filter((t) => t.id !== e);
1085
+ t.length !== this.#t.value.length && (this.#t.value = t);
1086
+ }
1087
+ addRateLimit(e) {
1088
+ this.#n.set(e.pattern, {
1089
+ limit: Object.freeze(e),
1090
+ timestamps: []
1091
+ });
1092
+ }
1093
+ removeRateLimit(e) {
1094
+ this.#n.delete(e);
1095
+ }
1096
+ evaluate(e) {
1097
+ let t = this.#a(e);
1098
+ if (t !== null) return t;
1099
+ let n = this.#o(e);
1100
+ if (n !== null) return n;
1101
+ let r = this.#c(e);
1102
+ return r === null ? Object.freeze({
1103
+ allowed: !0,
1104
+ reason: "No matching policy rule; default allow"
1105
+ }) : r;
1106
+ }
1107
+ middleware() {
1108
+ return (e, t) => {
1109
+ let n = this.evaluate(e);
1110
+ if (i(() => {
1111
+ this.#r.value = n, n.allowed || (this.#i.value = this.#i.value + 1);
1112
+ }), n.allowed) return t();
1113
+ };
1114
+ }
1115
+ destroy() {
1116
+ i(() => {
1117
+ this.#e.value = [], this.#t.value = [], this.#r.value = null, this.#i.value = 0;
1118
+ }), this.#n.clear();
1119
+ }
1120
+ #a(e) {
1121
+ let t = Date.now();
1122
+ for (let [n, r] of this.#n) {
1123
+ if (!E(r.limit.pattern, e.type)) continue;
1124
+ let n = t - r.limit.windowMs;
1125
+ if (r.timestamps = r.timestamps.filter((e) => e >= n), r.timestamps.length >= r.limit.maxPerWindow) return Object.freeze({
1126
+ allowed: !1,
1127
+ reason: `Rate limit exceeded for pattern '${r.limit.pattern}': ${r.limit.maxPerWindow} per ${r.limit.windowMs}ms`
1128
+ });
1129
+ r.timestamps.push(t);
1130
+ }
1131
+ return null;
1132
+ }
1133
+ #o(e) {
1134
+ let t = e.meta?.capabilities;
1135
+ if (!t || t.length === 0) return null;
1136
+ let n = Date.now(), r = this.#e.value.filter((e) => e.expiresAt === void 0 || e.expiresAt > n), i = [];
1137
+ for (let n of t) {
1138
+ let t = r.find((e) => e.name === n);
1139
+ if (!t) {
1140
+ i.push(n);
1141
+ continue;
1142
+ }
1143
+ if (!t.patterns.some((t) => E(t, e.type))) {
1144
+ i.push(n);
1145
+ continue;
1146
+ }
1147
+ t.scopes && t.scopes.length > 0 && (t.scopes.every((t) => this.#s(t, e)) || i.push(n));
1148
+ }
1149
+ return i.length > 0 ? Object.freeze({
1150
+ allowed: !1,
1151
+ reason: `Missing required capabilities: ${i.join(", ")}`,
1152
+ missingCapabilities: Object.freeze(i)
1153
+ }) : null;
1154
+ }
1155
+ #s(e, t) {
1156
+ switch (e.type) {
1157
+ case "source": return t.source === e.value;
1158
+ case "planId": return t.meta?.planId === e.value;
1159
+ case "custom": return !0;
1160
+ }
1161
+ }
1162
+ #c(e) {
1163
+ let t = [...this.#t.value].sort((e, t) => t.priority - e.priority);
1164
+ for (let n of t) if (n.patterns.some((t) => E(t, e.type)) && !(n.conditions && n.conditions.length > 0 && !n.conditions.every((t) => this.#l(t, e)))) return Object.freeze({
1165
+ allowed: n.effect === "allow",
1166
+ reason: n.description ?? `Matched rule '${n.id}' with effect '${n.effect}'`,
1167
+ matchedRule: n.id
1168
+ });
1169
+ return null;
1170
+ }
1171
+ #l(e, t) {
1172
+ let n = this.#u(e.field, t);
1173
+ switch (e.op) {
1174
+ case "eq": return n === e.value;
1175
+ case "neq": return n !== e.value;
1176
+ case "in": return (Array.isArray(e.value) ? e.value : [e.value]).includes(n);
1177
+ case "matches": return typeof e.value != "string" || typeof n != "string" ? !1 : E(e.value, n);
1178
+ }
1179
+ }
1180
+ #u(e, t) {
1181
+ switch (e) {
1182
+ case "source": return t.source;
1183
+ case "planId": return t.meta?.planId;
1184
+ case "capability": return this.#e.value.filter((e) => e.expiresAt === void 0 || e.expiresAt > Date.now()).map((e) => e.name).join(",");
1185
+ }
1186
+ }
1187
+ };
1188
+ function Je() {
1189
+ return new D();
1190
+ }
1191
+ function O(e) {
1192
+ return typeof e == "object" && !!e && "path" in e && typeof e.path == "string" && Object.keys(e).length === 1;
1193
+ }
1194
+ function Ye(e) {
1195
+ return "createSurface" in e;
1196
+ }
1197
+ function Xe(e) {
1198
+ return "updateComponents" in e;
1199
+ }
1200
+ function Ze(e) {
1201
+ return "updateDataModel" in e;
1202
+ }
1203
+ function Qe(e) {
1204
+ return "deleteSurface" in e;
1205
+ }
1206
+ function $e(e) {
1207
+ return "requestCatalog" in e;
1208
+ }
1209
+ function et(e) {
1210
+ return "action" in e;
1211
+ }
1212
+ function tt(e) {
1213
+ return "error" in e;
1214
+ }
1215
+ function nt(e) {
1216
+ return "catalog" in e;
1217
+ }
1218
+ /**
1219
+ * Parse a raw JSON string into a typed A2UI server message.
1220
+ * Returns null if the JSON is not a valid A2UI message.
1221
+ */
1222
+ function k(e) {
1223
+ try {
1224
+ let t = JSON.parse(e);
1225
+ return "createSurface" in t || "updateComponents" in t || "updateDataModel" in t || "deleteSurface" in t || "requestCatalog" in t ? t : null;
1226
+ } catch {
1227
+ return null;
1228
+ }
1229
+ }
1230
+ var rt = [
1231
+ {
1232
+ a2uiType: "Text",
1233
+ nativeTag: "span",
1234
+ childStrategy: "textContent"
1235
+ },
1236
+ {
1237
+ a2uiType: "Button",
1238
+ nativeTag: "ui-button",
1239
+ childStrategy: "slot-label",
1240
+ actionEvent: "ui-press",
1241
+ defaultAttributes: { size: "sm" },
1242
+ variantMap: {
1243
+ primary: "primary",
1244
+ borderless: "ghost"
1245
+ }
1246
+ },
1247
+ {
1248
+ a2uiType: "TextField",
1249
+ nativeTag: "ui-input",
1250
+ childStrategy: "none",
1251
+ actionEvent: "ui-input",
1252
+ defaultAttributes: { size: "sm" },
1253
+ propertyMap: {
1254
+ value: "value",
1255
+ placeholder: "placeholder"
1256
+ }
1257
+ },
1258
+ {
1259
+ a2uiType: "TextArea",
1260
+ nativeTag: "ui-textarea",
1261
+ childStrategy: "none",
1262
+ actionEvent: "ui-input",
1263
+ defaultAttributes: {
1264
+ size: "sm",
1265
+ rows: "2"
1266
+ },
1267
+ propertyMap: {
1268
+ value: "value",
1269
+ placeholder: "placeholder",
1270
+ rows: "rows"
1271
+ }
1272
+ },
1273
+ {
1274
+ a2uiType: "CheckBox",
1275
+ nativeTag: "ui-checkbox",
1276
+ childStrategy: "textContent",
1277
+ actionEvent: "ui-change",
1278
+ defaultAttributes: { size: "sm" }
1279
+ },
1280
+ {
1281
+ a2uiType: "Switch",
1282
+ nativeTag: "ui-switch",
1283
+ childStrategy: "textContent",
1284
+ actionEvent: "ui-change",
1285
+ defaultAttributes: { size: "sm" }
1286
+ },
1287
+ {
1288
+ a2uiType: "ChoicePicker",
1289
+ nativeTag: "ui-select",
1290
+ childStrategy: "children",
1291
+ actionEvent: "ui-change",
1292
+ defaultAttributes: { size: "sm" },
1293
+ propertyMap: { placeholder: "placeholder" }
1294
+ },
1295
+ {
1296
+ a2uiType: "Slider",
1297
+ nativeTag: "ui-range",
1298
+ childStrategy: "none",
1299
+ actionEvent: "ui-change",
1300
+ defaultAttributes: { size: "sm" },
1301
+ propertyMap: {
1302
+ min: "min",
1303
+ max: "max",
1304
+ value: "value"
1305
+ }
1306
+ },
1307
+ {
1308
+ a2uiType: "DateTimeInput",
1309
+ nativeTag: "ui-input",
1310
+ childStrategy: "none",
1311
+ actionEvent: "ui-change",
1312
+ defaultAttributes: { size: "sm" },
1313
+ propertyMap: {
1314
+ value: "value",
1315
+ min: "min",
1316
+ max: "max"
1317
+ }
1318
+ },
1319
+ {
1320
+ a2uiType: "Row",
1321
+ nativeTag: "div",
1322
+ childStrategy: "children"
1323
+ },
1324
+ {
1325
+ a2uiType: "Column",
1326
+ nativeTag: "div",
1327
+ childStrategy: "children"
1328
+ },
1329
+ {
1330
+ a2uiType: "Card",
1331
+ nativeTag: "ui-card",
1332
+ childStrategy: "children"
1333
+ },
1334
+ {
1335
+ a2uiType: "Modal",
1336
+ nativeTag: "ui-dialog",
1337
+ childStrategy: "children",
1338
+ actionEvent: "ui-dismiss"
1339
+ },
1340
+ {
1341
+ a2uiType: "Tabs",
1342
+ nativeTag: "ui-tabs",
1343
+ childStrategy: "children"
1344
+ },
1345
+ {
1346
+ a2uiType: "List",
1347
+ nativeTag: "ui-listbox",
1348
+ childStrategy: "children",
1349
+ actionEvent: "ui-select"
1350
+ },
1351
+ {
1352
+ a2uiType: "ListItem",
1353
+ nativeTag: "ui-option",
1354
+ childStrategy: "textContent"
1355
+ },
1356
+ {
1357
+ a2uiType: "Image",
1358
+ nativeTag: "img",
1359
+ childStrategy: "none",
1360
+ propertyMap: {
1361
+ url: "src",
1362
+ alt: "alt"
1363
+ }
1364
+ },
1365
+ {
1366
+ a2uiType: "Icon",
1367
+ nativeTag: "ui-icon",
1368
+ childStrategy: "none",
1369
+ defaultAttributes: { "aria-hidden": "true" },
1370
+ propertyMap: { name: "name" }
1371
+ },
1372
+ {
1373
+ a2uiType: "Divider",
1374
+ nativeTag: "ui-divider",
1375
+ childStrategy: "none"
1376
+ },
1377
+ {
1378
+ a2uiType: "Badge",
1379
+ nativeTag: "ui-badge",
1380
+ childStrategy: "textContent"
1381
+ },
1382
+ {
1383
+ a2uiType: "Avatar",
1384
+ nativeTag: "ui-avatar",
1385
+ childStrategy: "none",
1386
+ propertyMap: {
1387
+ src: "src",
1388
+ alt: "alt"
1389
+ }
1390
+ },
1391
+ {
1392
+ a2uiType: "Select",
1393
+ nativeTag: "ui-select",
1394
+ childStrategy: "children",
1395
+ actionEvent: "ui-change",
1396
+ propertyMap: { placeholder: "placeholder" }
1397
+ },
1398
+ {
1399
+ a2uiType: "Video",
1400
+ nativeTag: "video",
1401
+ childStrategy: "none",
1402
+ defaultAttributes: { controls: "" },
1403
+ propertyMap: {
1404
+ url: "src",
1405
+ poster: "poster"
1406
+ }
1407
+ },
1408
+ {
1409
+ a2uiType: "AudioPlayer",
1410
+ nativeTag: "audio",
1411
+ childStrategy: "none",
1412
+ defaultAttributes: { controls: "" },
1413
+ propertyMap: { url: "src" }
1414
+ }
1415
+ ], A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
1416
+ for (let e of rt) A.set(e.a2uiType, e), e.nativeTag !== "div" && e.nativeTag !== "span" && !j.has(e.nativeTag) && j.set(e.nativeTag, e);
1417
+ /** All component mappings, keyed by A2UI type */
1418
+ const it = A;
1419
+ function M(e) {
1420
+ return A.get(e) ?? null;
1421
+ }
1422
+ function at(e, t) {
1423
+ let n = t?.["data-a2ui"];
1424
+ if (n && A.has(n)) return n;
1425
+ let r = j.get(e);
1426
+ if (r) return r.a2uiType;
1427
+ if (e === "span") return "Text";
1428
+ if (e === "div") {
1429
+ let e = t?.style ?? "";
1430
+ return e.includes("flex-direction:column") || e.includes("flex-direction: column") ? "Column" : e.includes("display:flex") || e.includes("display: flex") ? "Row" : "Column";
1431
+ }
1432
+ return e === "img" ? "Image" : e === "video" ? "Video" : e === "audio" ? "AudioPlayer" : e === "hr" ? "Divider" : /^h[1-6]$/.test(e) ? "Text" : null;
1433
+ }
1434
+ var ot = {
1435
+ h1: "h1",
1436
+ h2: "h2",
1437
+ h3: "h3",
1438
+ h4: "h4",
1439
+ h5: "h5",
1440
+ caption: "small",
1441
+ body: "span"
1442
+ };
1443
+ /**
1444
+ * For A2UI Text components, resolve the variant to an HTML tag.
1445
+ * Returns 'span' by default.
1446
+ */
1447
+ function st(e) {
1448
+ return e ? ot[e] ?? "span" : "span";
1449
+ }
1450
+ /**
1451
+ * For A2UI DateTimeInput components, resolve enableDate/enableTime to HTML input type.
1452
+ */
1453
+ function ct(e, t) {
1454
+ return e && t ? "datetime-local" : t && !e ? "time" : "date";
1455
+ }
1456
+ var lt = {
1457
+ number: "number",
1458
+ obscured: "password",
1459
+ shortText: "text",
1460
+ longText: "text"
1461
+ };
1462
+ /**
1463
+ * For A2UI TextField components, resolve the variant to an HTML input type attribute.
1464
+ */
1465
+ function ut(e) {
1466
+ return e ? lt[e] ?? "text" : "text";
1467
+ }
1468
+ /**
1469
+ * Get all supported A2UI component types.
1470
+ */
1471
+ function N() {
1472
+ return Array.from(A.keys());
1473
+ }
1474
+ /**
1475
+ * A2UI Converter
1476
+ *
1477
+ * Bidirectional conversion between A2UI flat adjacency lists
1478
+ * and native-ui nested UINode trees.
1479
+ */
1480
+ var dt = new Set(/* @__PURE__ */ "id.component.children.child.text.label.variant.disabled.action.accessibility.value.placeholder.min.max.step.url.src.alt.name.fit.justify.align.weight.direction.enableDate.enableTime.options.filterable.displayStyle.validationRegexp.checks.trigger.content.tabs.poster".split("."));
1481
+ function P(e, t) {
1482
+ if (e.length === 0) return {
1483
+ root: {
1484
+ id: "empty-root",
1485
+ tag: "div"
1486
+ },
1487
+ bindings: /* @__PURE__ */ new Map(),
1488
+ warnings: ["No components provided"],
1489
+ orphans: []
1490
+ };
1491
+ let n = /* @__PURE__ */ new Map();
1492
+ for (let t of e) n.set(t.id, t);
1493
+ let r = /* @__PURE__ */ new Set();
1494
+ for (let t of e) {
1495
+ if (t.children) for (let e of t.children) r.add(e);
1496
+ t.child && r.add(t.child);
1497
+ }
1498
+ let i = t?.rootId;
1499
+ if (!i) {
1500
+ let t = e.filter((e) => !r.has(e.id));
1501
+ i = (t.find((e) => e.id === "root") ?? t[0])?.id;
1502
+ }
1503
+ if (!i || !n.has(i)) return {
1504
+ root: {
1505
+ id: "error-root",
1506
+ tag: "div",
1507
+ textContent: "Error: no root component found"
1508
+ },
1509
+ bindings: /* @__PURE__ */ new Map(),
1510
+ warnings: ["No root component found"],
1511
+ orphans: []
1512
+ };
1513
+ let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), s = [], c = t?.surfaceId ?? "default", l = F(i, n, a, o, s, c), u = e.filter((e) => !a.has(e.id)).map((e) => e.id);
1514
+ return u.length > 0 && s.push(`Orphan components not reachable from root: ${u.join(", ")}`), {
1515
+ root: l,
1516
+ bindings: o,
1517
+ warnings: s,
1518
+ orphans: u
1519
+ };
1520
+ }
1521
+ function F(e, t, n, r, i, a) {
1522
+ if (n.has(e)) return i.push(`Cycle detected at component "${e}"`), {
1523
+ id: `${e}-cycle`,
1524
+ tag: "div",
1525
+ textContent: `[Cycle: ${e}]`
1526
+ };
1527
+ n.add(e);
1528
+ let o = t.get(e);
1529
+ if (!o) return i.push(`Component "${e}" referenced but not found`), {
1530
+ id: e,
1531
+ tag: "div",
1532
+ textContent: `[Missing: ${e}]`
1533
+ };
1534
+ let s = M(o.component);
1535
+ if (!s) return i.push(`Unknown A2UI type "${o.component}" for component "${e}"`), {
1536
+ id: e,
1537
+ tag: "div",
1538
+ textContent: o.text ?? `[Unknown: ${o.component}]`
1539
+ };
1540
+ let c = s.nativeTag;
1541
+ o.component === "Text" && o.variant && (c = st(o.variant));
1542
+ let l = {};
1543
+ if (l["data-a2ui"] = o.component, s.defaultAttributes && Object.assign(l, s.defaultAttributes), o.variant && s.variantMap) {
1544
+ let e = s.variantMap[o.variant];
1545
+ e && (l.variant = e);
1546
+ } else o.variant && o.component !== "Text" && (l.variant = o.variant);
1547
+ if (s.propertyMap) for (let [t, n] of Object.entries(s.propertyMap)) {
1548
+ let i = o[t];
1549
+ if (i !== void 0) if (O(i)) {
1550
+ let t = r.get(e);
1551
+ t || (t = [], r.set(e, t)), t.push({
1552
+ property: n,
1553
+ path: i.path
1554
+ });
1555
+ } else l[n] = String(i);
1556
+ }
1557
+ if (o.disabled && (l.disabled = ""), o.accessibility?.label && (l["aria-label"] = o.accessibility.label), o.component === "TextField") {
1558
+ let e = ut(o.variant);
1559
+ e !== "text" && (l.type = e);
1560
+ }
1561
+ if (o.component === "DateTimeInput" && (l.type = ct(o.enableDate, o.enableTime)), (o.component === "TextField" || o.component === "DateTimeInput" || o.component === "Slider") && o.label) if (O(o.label)) {
1562
+ let t = r.get(e);
1563
+ t || (t = [], r.set(e, t)), t.push({
1564
+ property: "aria-label",
1565
+ path: o.label.path
1566
+ });
1567
+ } else l["aria-label"] = o.label;
1568
+ o.component === "Slider" && (o.min !== void 0 && (l.min = String(o.min)), o.max !== void 0 && (l.max = String(o.max)));
1569
+ let u;
1570
+ if (o.text !== void 0) if (O(o.text)) {
1571
+ let t = r.get(e);
1572
+ t || (t = [], r.set(e, t)), t.push({
1573
+ property: "textContent",
1574
+ path: o.text.path
1575
+ });
1576
+ } else u = o.text;
1577
+ for (let [e, t] of Object.entries(o)) dt.has(e) || typeof t == "string" && (l[e] = t);
1578
+ let d;
1579
+ o.action?.event && s.actionEvent && (d = { [s.actionEvent]: `a2ui:${a}:${e}:${o.action.event.name}` });
1580
+ let f, p = o.children ?? (o.child ? [o.child] : void 0);
1581
+ if (o.component === "Tabs" && p && p.length > 0) {
1582
+ f = [];
1583
+ let o = [];
1584
+ for (let e = 0; e < p.length; e++) {
1585
+ let s = p[e], c = t.get(s);
1586
+ if (!c) continue;
1587
+ n.add(s);
1588
+ let l = String(c.value ?? c.id ?? `tab-${e}`), u = String(c.label ?? c.text ?? `Tab ${e + 1}`);
1589
+ f.push({
1590
+ id: `${s}-tab`,
1591
+ tag: "ui-tab",
1592
+ attributes: { value: l },
1593
+ textContent: u
1594
+ });
1595
+ let d = c.children ?? (c.child ? [c.child] : void 0), m = d ? d.map((e) => F(e, t, n, r, i, a)) : void 0, h = typeof c.text == "string" ? c.text : void 0;
1596
+ o.push({
1597
+ id: `${s}-panel`,
1598
+ tag: "ui-tab-panel",
1599
+ attributes: { value: l },
1600
+ ...m && m.length > 0 ? { children: m } : {},
1601
+ ...h && !m ? { textContent: h } : {}
1602
+ });
1603
+ }
1604
+ if (f.push({
1605
+ id: `${e}-panels`,
1606
+ tag: "ui-tab-panels",
1607
+ children: o
1608
+ }), !l.value && p.length > 0) {
1609
+ let e = t.get(p[0]);
1610
+ l.value = String(e?.value ?? e?.id ?? "tab-0");
1611
+ }
1612
+ } else if ((o.component === "Select" || o.component === "ChoicePicker") && p && p.length > 0) {
1613
+ let e = [];
1614
+ for (let r of p) {
1615
+ let i = t.get(r);
1616
+ i && i.component === "ListItem" && (n.add(r), e.push({
1617
+ value: String(i.value ?? ""),
1618
+ label: String(i.label ?? i.text ?? ""),
1619
+ ...i.disabled ? { disabled: !0 } : {}
1620
+ }));
1621
+ }
1622
+ e.length > 0 && (l.options = JSON.stringify(e), l.placeholder = o.label ? String(o.label) : "Select…");
1623
+ } else p && p.length > 0 && (f = p.map((e) => F(e, t, n, r, i, a)));
1624
+ if (s.childStrategy === "slot-label" && u && !f) f = [{
1625
+ id: `${e}-label`,
1626
+ tag: "span",
1627
+ attributes: { slot: "label" },
1628
+ textContent: u
1629
+ }], u = void 0;
1630
+ else if (s.childStrategy === "textContent" && o.label && !u) if (O(o.label)) {
1631
+ let t = r.get(e);
1632
+ t || (t = [], r.set(e, t)), t.push({
1633
+ property: "textContent",
1634
+ path: o.label.path
1635
+ });
1636
+ } else u = o.label;
1637
+ if (o.component === "ListItem" && o.value !== void 0 && (l.value = String(o.value)), o.component === "Image" && o.url !== void 0) {
1638
+ if (O(o.url)) {
1639
+ let t = r.get(e);
1640
+ t || (t = [], r.set(e, t)), t.push({
1641
+ property: "src",
1642
+ path: o.url.path
1643
+ });
1644
+ } else l.src = o.url;
1645
+ o.alt && (l.alt = o.alt);
1646
+ }
1647
+ let m = Object.keys(l).length > 0 ? l : void 0;
1648
+ return {
1649
+ id: e,
1650
+ tag: c,
1651
+ ...m ? { attributes: m } : {},
1652
+ ...u === void 0 ? {} : { textContent: u },
1653
+ ...f && f.length > 0 ? { children: f } : {},
1654
+ ...d ? { events: d } : {}
1655
+ };
1656
+ }
1657
+ function ft(e, t) {
1658
+ let n = [];
1659
+ return pt(e, n, t?.surfaceId ?? "default"), n;
1660
+ }
1661
+ function pt(e, t, n) {
1662
+ let r = at(e.tag, e.attributes);
1663
+ if (!r) {
1664
+ let r = {
1665
+ id: e.id,
1666
+ component: "Column",
1667
+ ...e.children ? { children: e.children.map((e) => e.id) } : {},
1668
+ ...e.textContent ? { text: e.textContent } : {}
1669
+ };
1670
+ if (t.push(r), e.children) for (let r of e.children) pt(r, t, n);
1671
+ return;
1672
+ }
1673
+ let i = M(r), a = {
1674
+ id: e.id,
1675
+ component: r
1676
+ };
1677
+ if (e.children && e.children.length > 0) if (i?.childStrategy === "slot-label" && e.children.length === 1 && e.children[0].attributes?.slot === "label" && e.children[0].textContent) a.text = e.children[0].textContent;
1678
+ else {
1679
+ a.children = e.children.map((e) => e.id);
1680
+ for (let r of e.children) pt(r, t, n);
1681
+ }
1682
+ if (e.textContent && (r === "CheckBox" || r === "Switch" || r === "ListItem" ? a.label = e.textContent : a.text = e.textContent), e.attributes) {
1683
+ let t = i?.propertyMap ? mt(i.propertyMap) : {};
1684
+ for (let [n, r] of Object.entries(e.attributes)) n === "style" || n === "data-a2ui" || n === "slot" || (t[n] ? a[t[n]] = r : n === "aria-label" ? a.label = r : n === "disabled" && r === "" ? a.disabled = !0 : n === "variant" && (a.variant = (i?.variantMap ? mt(i.variantMap) : {})[r] ?? r));
1685
+ }
1686
+ if (e.events) for (let [t, n] of Object.entries(e.events)) {
1687
+ let e = n.split(":");
1688
+ e[0] === "a2ui" && e.length >= 4 && (a.action = { event: { name: e[3] } });
1689
+ }
1690
+ t.push(a);
1691
+ }
1692
+ function mt(e) {
1693
+ let t = {};
1694
+ for (let [n, r] of Object.entries(e)) t[r] = n;
1695
+ return t;
1696
+ }
1697
+ /**
1698
+ * Wrap a conversion result as a UIPlan.
1699
+ */
1700
+ function ht(e, t = "generated") {
1701
+ return Object.freeze({
1702
+ id: a("a2ui-plan"),
1703
+ version: 1,
1704
+ root: e.root,
1705
+ source: t,
1706
+ timestamp: Date.now()
1707
+ });
1708
+ }
1709
+ /**
1710
+ * A2UI Surface Manager
1711
+ *
1712
+ * Manages A2UI surface lifecycle: create → updateComponents → updateDataModel → delete.
1713
+ * Each surface maps to one UIPlan in the kernel.
1714
+ */
1715
+ function I(e, t) {
1716
+ if (!t || t === "/") return e;
1717
+ let n = t.replace(/^\//, "").split("/").map(_t), r = e;
1718
+ for (let e of n) {
1719
+ if (typeof r != "object" || !r) return;
1720
+ r = r[e];
1721
+ }
1722
+ return r;
1723
+ }
1724
+ function gt(e, t, n) {
1725
+ if (!t || t === "/") return;
1726
+ let r = t.replace(/^\//, "").split("/").map(_t), i = e;
1727
+ for (let e = 0; e < r.length - 1; e++) {
1728
+ let t = r[e];
1729
+ (i[t] == null || typeof i[t] != "object") && (i[t] = {}), i = i[t];
1730
+ }
1731
+ let a = r[r.length - 1];
1732
+ n === void 0 ? delete i[a] : i[a] = n;
1733
+ }
1734
+ function _t(e) {
1735
+ return e.replace(/~1/g, "/").replace(/~0/g, "~");
1736
+ }
1737
+ var L = class {
1738
+ #e;
1739
+ #t;
1740
+ #n;
1741
+ #r = /* @__PURE__ */ new Map();
1742
+ #i = r(0);
1743
+ surfaceCount = e(() => this.#i.value);
1744
+ constructor(e, t, n) {
1745
+ this.#e = e, this.#t = t, this.#n = n ?? null;
1746
+ }
1747
+ handleMessage(e, t) {
1748
+ Ye(e) ? this.#a(e, t) : Xe(e) ? this.#o(e, t) : Ze(e) ? this.#l(e) : Qe(e) && this.#u(e);
1749
+ }
1750
+ #a(e, t) {
1751
+ let { surfaceId: n, catalogId: i, theme: o } = e.createSurface, s = this.#r.get(n);
1752
+ if (s) {
1753
+ s.catalogId = i, s.theme = o;
1754
+ return;
1755
+ }
1756
+ let c = {
1757
+ surfaceId: n,
1758
+ planId: a("a2ui-plan"),
1759
+ catalogId: i,
1760
+ theme: o,
1761
+ container: t ?? document.createElement("div"),
1762
+ components: [],
1763
+ dataModel: r({}),
1764
+ bindings: /* @__PURE__ */ new Map(),
1765
+ bindingDisposers: [],
1766
+ actionDisposer: null,
1767
+ rendered: !1
1768
+ };
1769
+ this.#r.set(n, c), this.#i.value = this.#r.size;
1770
+ }
1771
+ #o(e, t) {
1772
+ let { surfaceId: n, components: i } = e.updateComponents, o = this.#r.get(n);
1773
+ o ? t && (o.container = t) : (o = {
1774
+ surfaceId: n,
1775
+ planId: a("a2ui-plan"),
1776
+ container: t ?? document.createElement("div"),
1777
+ components: [],
1778
+ dataModel: r({}),
1779
+ bindings: /* @__PURE__ */ new Map(),
1780
+ bindingDisposers: [],
1781
+ actionDisposer: null,
1782
+ rendered: !1
1783
+ }, this.#r.set(n, o), this.#i.value = this.#r.size), o.rendered ? (this.#c(o, i), o.components = [...i]) : (o.components = [...i], this.#s(o)), o.rendered && this.#n?.(o.surfaceId, o.container);
1784
+ }
1785
+ #s(e) {
1786
+ let t = P(e.components, { surfaceId: e.surfaceId });
1787
+ e.bindings = new Map(t.bindings);
1788
+ let n = ht(t);
1789
+ e.planId = n.id;
1790
+ try {
1791
+ let t = this.#e.executePlan(n, e.container);
1792
+ e.rendered = !0, this.#d(e, t), this.#f(e);
1793
+ } catch {}
1794
+ }
1795
+ #c(e, t) {
1796
+ let n = xt(e.components, t, e.surfaceId);
1797
+ if (n.length === 0) return;
1798
+ this.#e.patchPlan({
1799
+ planId: e.planId,
1800
+ ops: n,
1801
+ source: "generated",
1802
+ timestamp: Date.now()
1803
+ });
1804
+ let r = P(t, { surfaceId: e.surfaceId });
1805
+ e.bindings = new Map(r.bindings);
1806
+ for (let t of e.bindingDisposers) t();
1807
+ e.bindingDisposers = [];
1808
+ let i = this.#e.executor.getElements(e.planId);
1809
+ i && this.#d(e, i);
1810
+ }
1811
+ #l(e) {
1812
+ let { surfaceId: t, path: n, value: r } = e.updateDataModel, i = this.#r.get(t);
1813
+ if (!i) return;
1814
+ let a = { ...i.dataModel.value };
1815
+ !n || n === "/" ? i.dataModel.value = r ?? {} : (gt(a, n, r), i.dataModel.value = a);
1816
+ }
1817
+ #u(e) {
1818
+ let { surfaceId: t } = e.deleteSurface, n = this.#r.get(t);
1819
+ if (n) {
1820
+ n.rendered && this.#e.teardownPlan(n.planId);
1821
+ for (let e of n.bindingDisposers) e();
1822
+ n.bindingDisposers = [], n.actionDisposer?.(), this.#r.delete(t), this.#i.value = this.#r.size;
1823
+ }
1824
+ }
1825
+ #d(e, n) {
1826
+ for (let [r, i] of e.bindings) {
1827
+ let a = n.get(r);
1828
+ if (a) for (let n of i) {
1829
+ let r = t(() => {
1830
+ let t = e.dataModel.value, r = I(t, n.path);
1831
+ r !== void 0 && (n.property === "textContent" ? a.textContent = String(r) : n.property === "src" || n.property === "alt" || n.property.startsWith("aria-") ? a.setAttribute(n.property, String(r)) : a[n.property] = r);
1832
+ });
1833
+ e.bindingDisposers.push(r);
1834
+ }
1835
+ }
1836
+ }
1837
+ #f(e) {
1838
+ let t = `a2ui:${e.surfaceId}:`;
1839
+ e.actionDisposer = this.#e.bus.on((e) => e.type.startsWith(t), (t) => {
1840
+ let n = t.type.split(":");
1841
+ if (n.length < 4) return;
1842
+ let r = n[2], i = n[3], a = e.components.find((e) => e.id === r)?.action?.event?.context, o = a ? vt(a, e.dataModel.value) : void 0;
1843
+ this.#t({ action: {
1844
+ surfaceId: e.surfaceId,
1845
+ sourceComponentId: r,
1846
+ name: i,
1847
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1848
+ ...o ? { context: o } : {}
1849
+ } });
1850
+ });
1851
+ }
1852
+ getSurface(e) {
1853
+ let t = this.#r.get(e);
1854
+ return t ? {
1855
+ surfaceId: t.surfaceId,
1856
+ planId: t.planId,
1857
+ catalogId: t.catalogId,
1858
+ theme: t.theme,
1859
+ container: t.container,
1860
+ rendered: t.rendered
1861
+ } : null;
1862
+ }
1863
+ getSurfaceIds() {
1864
+ return Array.from(this.#r.keys());
1865
+ }
1866
+ getDataModel(e) {
1867
+ return this.#r.get(e)?.dataModel.value ?? null;
1868
+ }
1869
+ destroy() {
1870
+ for (let e of this.#r.keys()) this.#u({ deleteSurface: { surfaceId: e } });
1871
+ }
1872
+ };
1873
+ function vt(e, t) {
1874
+ let n = {};
1875
+ for (let [r, i] of Object.entries(e)) typeof i == "object" && i && "path" in i ? n[r] = I(t, i.path) : n[r] = i;
1876
+ return n;
1877
+ }
1878
+ /** A2UI properties that map to HTML attributes on the rendered element. */
1879
+ var yt = [
1880
+ "variant",
1881
+ "placeholder",
1882
+ "name",
1883
+ "min",
1884
+ "max",
1885
+ "step",
1886
+ "src",
1887
+ "alt",
1888
+ "poster",
1889
+ "fit"
1890
+ ], bt = ["value"];
1891
+ function xt(e, t, n) {
1892
+ let r = /* @__PURE__ */ new Map();
1893
+ for (let t of e) r.set(t.id, t);
1894
+ let i = /* @__PURE__ */ new Map();
1895
+ for (let e of t) i.set(e.id, e);
1896
+ let a = [];
1897
+ for (let [e] of r) i.has(e) || a.push({
1898
+ type: "remove",
1899
+ targetId: e
1900
+ });
1901
+ for (let [e, o] of i) if (!r.has(e)) {
1902
+ let r = St(e, t);
1903
+ if (r) {
1904
+ let t = P([o], {
1905
+ surfaceId: n,
1906
+ rootId: e
1907
+ });
1908
+ a.push({
1909
+ type: "add",
1910
+ parentId: r,
1911
+ node: t.root
1912
+ });
1913
+ }
1914
+ }
1915
+ for (let [e, o] of i) {
1916
+ let i = r.get(e);
1917
+ if (i) {
1918
+ if (o.component !== i.component) {
1919
+ let r = P(Ct(e, t), {
1920
+ surfaceId: n,
1921
+ rootId: e
1922
+ });
1923
+ a.push({
1924
+ type: "replace",
1925
+ targetId: e,
1926
+ node: r.root
1927
+ });
1928
+ continue;
1929
+ }
1930
+ if (JSON.stringify(i.children ?? i.child ?? []) !== JSON.stringify(o.children ?? o.child ?? [])) {
1931
+ let r = P(Ct(e, t), {
1932
+ surfaceId: n,
1933
+ rootId: e
1934
+ });
1935
+ a.push({
1936
+ type: "replace",
1937
+ targetId: e,
1938
+ node: r.root
1939
+ });
1940
+ continue;
1941
+ }
1942
+ o.text !== i.text && typeof o.text == "string" && a.push({
1943
+ type: "set-text",
1944
+ targetId: e,
1945
+ text: o.text
1946
+ }), o.label !== i.label && typeof o.label == "string" && a.push({
1947
+ type: "set-text",
1948
+ targetId: e,
1949
+ text: o.label
1950
+ }), o.disabled !== i.disabled && (o.disabled ? a.push({
1951
+ type: "set-attribute",
1952
+ targetId: e,
1953
+ name: "disabled",
1954
+ value: ""
1955
+ }) : a.push({
1956
+ type: "remove-attribute",
1957
+ targetId: e,
1958
+ name: "disabled"
1959
+ }));
1960
+ for (let t of yt) {
1961
+ let n = i[t], r = o[t];
1962
+ r !== n && (r == null || r === !1 ? a.push({
1963
+ type: "remove-attribute",
1964
+ targetId: e,
1965
+ name: t
1966
+ }) : a.push({
1967
+ type: "set-attribute",
1968
+ targetId: e,
1969
+ name: t,
1970
+ value: String(r)
1971
+ }));
1972
+ }
1973
+ for (let t of bt) {
1974
+ let n = i[t], r = o[t];
1975
+ r !== n && r !== void 0 && a.push({
1976
+ type: "set-property",
1977
+ targetId: e,
1978
+ name: t,
1979
+ value: r
1980
+ });
1981
+ }
1982
+ }
1983
+ }
1984
+ return a;
1985
+ }
1986
+ function St(e, t) {
1987
+ for (let n of t) if (n.children?.includes(e) || n.child === e) return n.id;
1988
+ return null;
1989
+ }
1990
+ function Ct(e, t) {
1991
+ let n = /* @__PURE__ */ new Map();
1992
+ for (let e of t) n.set(e.id, e);
1993
+ let r = [], i = /* @__PURE__ */ new Set();
1994
+ function a(e) {
1995
+ if (i.has(e)) return;
1996
+ i.add(e);
1997
+ let t = n.get(e);
1998
+ if (!t) return;
1999
+ r.push(t);
2000
+ let o = t.children ?? (t.child ? [t.child] : []);
2001
+ for (let e of o) a(e);
2002
+ }
2003
+ return a(e), r;
2004
+ }
2005
+ function wt(e, t) {
2006
+ return new L(e, t);
2007
+ }
2008
+ var R = class {
2009
+ #e;
2010
+ #t;
2011
+ constructor(e, t) {
2012
+ this.#t = t ?? {}, this.#e = new L(e, (e) => {
2013
+ this.#t.onClientMessage?.(e);
2014
+ }, (e, t) => {
2015
+ this.#t.onRender?.(e, t);
2016
+ });
2017
+ }
2018
+ /**
2019
+ * Process a raw A2UI server message.
2020
+ * Accepts either a parsed object or JSON string.
2021
+ * If a container is provided, it is used as the render target for new surfaces.
2022
+ */
2023
+ receive(e, t) {
2024
+ let n = typeof e == "string" ? k(e) : e;
2025
+ if (!n) {
2026
+ this.#t.onClientMessage?.({ error: {
2027
+ surfaceId: "",
2028
+ code: "PARSE_ERROR",
2029
+ message: "Failed to parse A2UI message"
2030
+ } });
2031
+ return;
2032
+ }
2033
+ if ($e(n)) {
2034
+ this.#n(n.requestCatalog.surfaceId);
2035
+ return;
2036
+ }
2037
+ this.#e.handleMessage(n, t);
2038
+ }
2039
+ #n(e) {
2040
+ let t = { catalog: {
2041
+ ...e ? { surfaceId: e } : {},
2042
+ supportedTypes: [...N()],
2043
+ version: this.#t.version ?? "0.9"
2044
+ } };
2045
+ this.#t.onClientMessage?.(t);
2046
+ }
2047
+ /**
2048
+ * Parse a JSON string into a typed A2UI server message.
2049
+ * Returns null if invalid.
2050
+ */
2051
+ parse(e) {
2052
+ return k(e);
2053
+ }
2054
+ /**
2055
+ * Convert a UIPlan to A2UI updateComponents format.
2056
+ */
2057
+ emit(e, t) {
2058
+ let n = t ?? e.id, r = {
2059
+ surfaceId: n,
2060
+ version: this.#t.version
2061
+ };
2062
+ return { updateComponents: {
2063
+ surfaceId: n,
2064
+ components: ft(e.root, r)
2065
+ } };
2066
+ }
2067
+ /**
2068
+ * Convert a Planner result to A2UI updateComponents format.
2069
+ */
2070
+ emitPlanResult(e, t) {
2071
+ return this.emit(e.plan, t);
2072
+ }
2073
+ getSurface(e) {
2074
+ return this.#e.getSurface(e);
2075
+ }
2076
+ getSurfaceIds() {
2077
+ return this.#e.getSurfaceIds();
2078
+ }
2079
+ getDataModel(e) {
2080
+ return this.#e.getDataModel(e);
2081
+ }
2082
+ /**
2083
+ * Returns the list of A2UI component types supported by this adapter.
2084
+ */
2085
+ getSupportedTypes() {
2086
+ return N();
2087
+ }
2088
+ destroy() {
2089
+ this.#e.destroy();
2090
+ }
2091
+ };
2092
+ function Tt(e, t) {
2093
+ return new R(e, t);
2094
+ }
2095
+ var Et = class {
2096
+ bus;
2097
+ history;
2098
+ overlays;
2099
+ focus;
2100
+ executor;
2101
+ log;
2102
+ perf;
2103
+ data;
2104
+ policy;
2105
+ #e = r(/* @__PURE__ */ new Map());
2106
+ #t;
2107
+ #n = null;
2108
+ registry = e(() => this.#e.value);
2109
+ /** Lazy-initialized A2UI protocol adapter. Only created on first access. */
2110
+ get a2ui() {
2111
+ return this.#n ||= new R(this), this.#n;
2112
+ }
2113
+ constructor(e) {
2114
+ this.#t = e ?? {}, this.bus = new o(), this.history = new c(), this.overlays = new f(), this.focus = new h(), this.executor = new oe(this.#e.peek()), this.log = new ce(), this.perf = new v(), this.data = new y(), this.policy = new D(), this.bus.use(this.policy.middleware()), this.#t.logCommands !== !1 && this.bus.use((e, t) => {
2115
+ t(), this.history.push(e), this.log.logCommand(e);
2116
+ });
2117
+ }
2118
+ register(e, t, n) {
2119
+ let r = Object.freeze({
2120
+ tag: e.toLowerCase(),
2121
+ elementClass: t,
2122
+ ...n?.formAssociated ? { formAssociated: !0 } : {}
2123
+ }), i = new Map(this.#e.peek());
2124
+ i.set(r.tag, r), this.#e.value = i;
2125
+ }
2126
+ registerAndDefine(e, t, r) {
2127
+ this.register(e, t, r), n(e, t);
2128
+ }
2129
+ executePlan(e, t) {
2130
+ let n = this.perf.measure("plan:execute", () => this.executor.execute(e, t, this.bus, { allowUnregistered: this.#t.allowUnregistered }));
2131
+ return this.log.logPlan(e.id, "execute", e.source), n;
2132
+ }
2133
+ validatePlanAccessibility(e) {
2134
+ return w(e.root);
2135
+ }
2136
+ patchPlan(e) {
2137
+ let t = this.perf.measure("plan:patch", () => Ie(e, this.executor, this.bus));
2138
+ return this.log.logPlan(e.planId, "patch", e.source, {
2139
+ applied: t.applied,
2140
+ errors: t.errors.length
2141
+ }), t;
2142
+ }
2143
+ teardownPlan(e) {
2144
+ this.executor.teardown(e), this.log.logPlan(e, "teardown", "human");
2145
+ }
2146
+ destroy() {
2147
+ this.#n?.destroy(), this.overlays.destroy(), this.focus.destroy(), this.history.clear(), this.data.destroy(), this.policy.destroy(), this.log.clear(), this.perf.clear();
2148
+ }
2149
+ }, z = null;
2150
+ function Dt(e) {
2151
+ return z ||= new Et(e), z;
2152
+ }
2153
+ function Ot() {
2154
+ z &&= (z.destroy(), null);
2155
+ }
2156
+ var kt = 200, At = class t {
2157
+ #e;
2158
+ #t;
2159
+ #n;
2160
+ #r;
2161
+ #i;
2162
+ #a;
2163
+ #o;
2164
+ #s;
2165
+ currentState;
2166
+ context;
2167
+ history;
2168
+ running;
2169
+ constructor(t, n) {
2170
+ this.#e = t, this.#t = n, this.#n = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#c(t.states, void 0), this.#i = r(t.initial), this.#a = r(t.context ? Object.freeze({ ...t.context }) : Object.freeze({})), this.#o = r(Object.freeze([])), this.#s = r(!1), this.currentState = e(() => this.#i.value), this.context = e(() => this.#a.value), this.history = e(() => this.#o.value), this.running = e(() => this.#s.value);
2171
+ }
2172
+ #c(e, t) {
2173
+ for (let n of e) this.#n.set(n.id, n), t !== void 0 && this.#r.set(n.id, t), n.children && this.#c(n.children, n.id);
2174
+ }
2175
+ start() {
2176
+ this.#s.peek() || i(() => {
2177
+ this.#s.value = !0, this.#l(this.#e.initial);
2178
+ });
2179
+ }
2180
+ send(e, t) {
2181
+ if (!this.#s.peek()) return null;
2182
+ let n = this.#i.peek(), r = this.#a.peek(), o = this.#p(n, e), s = [], c = [], l = null;
2183
+ for (let e of o) if (e.guard) {
2184
+ let t = e.guard.name || `${e.from}->${e.to}`;
2185
+ e.guard(r) ? (s.push(t), l ||= e) : c.push(t);
2186
+ } else l ||= e;
2187
+ if (!l) return null;
2188
+ let u = Object.freeze({
2189
+ id: a("wf"),
2190
+ timestamp: Date.now(),
2191
+ event: e,
2192
+ from: n,
2193
+ to: l.to,
2194
+ guardsPassed: Object.freeze(s),
2195
+ guardsBlocked: Object.freeze(c),
2196
+ action: l.action
2197
+ });
2198
+ return i(() => {
2199
+ this.#u(n), l.action && this.#m(l.action, {
2200
+ event: e,
2201
+ data: t
2202
+ }), this.#h(u), this.#i.value = l.to, this.#l(l.to);
2203
+ }), u;
2204
+ }
2205
+ stop() {
2206
+ this.#s.peek() && i(() => {
2207
+ this.#u(this.#i.peek()), this.#s.value = !1;
2208
+ });
2209
+ }
2210
+ setContext(e, t) {
2211
+ let n = this.#a.peek();
2212
+ this.#a.value = Object.freeze({
2213
+ ...n,
2214
+ [e]: t
2215
+ });
2216
+ }
2217
+ getContext(e) {
2218
+ return this.#a.peek()[e];
2219
+ }
2220
+ getAvailableEvents() {
2221
+ let e = this.#i.peek(), t = this.#f(e), n = /* @__PURE__ */ new Set();
2222
+ for (let e of this.#e.transitions) t.has(e.from) && n.add(e.event);
2223
+ return Object.freeze([...n]);
2224
+ }
2225
+ canSend(e) {
2226
+ if (!this.#s.peek()) return !1;
2227
+ let t = this.#i.peek(), n = this.#a.peek(), r = this.#p(t, e);
2228
+ for (let e of r) if (!e.guard || e.guard(n)) return !0;
2229
+ return !1;
2230
+ }
2231
+ explain(e) {
2232
+ let t = this.#i.peek(), n = this.#a.peek(), r = this.#p(t, e), i = [], a = null;
2233
+ for (let e of r) if (e.guard) {
2234
+ let t = e.guard.name || `${e.from}->${e.to}`;
2235
+ e.guard(n) ? a ||= e : i.push(t);
2236
+ } else a ||= e;
2237
+ return Object.freeze({
2238
+ would: a !== null,
2239
+ from: t,
2240
+ to: a?.to ?? null,
2241
+ blockedGuards: Object.freeze(i)
2242
+ });
2243
+ }
2244
+ snapshot() {
2245
+ return Object.freeze({
2246
+ definitionId: this.#e.id,
2247
+ currentState: this.#i.peek(),
2248
+ context: this.#a.peek(),
2249
+ history: this.#o.peek(),
2250
+ timestamp: Date.now()
2251
+ });
2252
+ }
2253
+ static restore(e, n, r) {
2254
+ let a = new t(n, r);
2255
+ return i(() => {
2256
+ a.#i.value = e.currentState, a.#a.value = Object.freeze({ ...e.context }), a.#o.value = Object.freeze([...e.history]), a.#s.value = !0;
2257
+ }), a;
2258
+ }
2259
+ destroy() {
2260
+ i(() => {
2261
+ this.#s.peek() && this.#u(this.#i.peek()), this.#s.value = !1, this.#o.value = Object.freeze([]), this.#n.clear(), this.#r.clear();
2262
+ });
2263
+ }
2264
+ #l(e) {
2265
+ let t = this.#n.get(e);
2266
+ t && (t.onEntry && this.#m(t.onEntry, { state: e }), t.children && t.initial && (this.#i.value = t.initial, this.#l(t.initial)));
2267
+ }
2268
+ #u(e) {
2269
+ let t = this.#n.get(e);
2270
+ if (t) {
2271
+ if (t.children) {
2272
+ let t = this.#i.peek();
2273
+ t !== e && this.#d(t, e) && this.#u(t);
2274
+ }
2275
+ t.onExit && this.#m(t.onExit, { state: e });
2276
+ }
2277
+ }
2278
+ #d(e, t) {
2279
+ let n = e;
2280
+ for (; n !== void 0;) {
2281
+ if (n === t) return !0;
2282
+ n = this.#r.get(n);
2283
+ }
2284
+ return !1;
2285
+ }
2286
+ #f(e) {
2287
+ let t = /* @__PURE__ */ new Set();
2288
+ t.add(e);
2289
+ let n = this.#r.get(e);
2290
+ for (; n !== void 0;) t.add(n), n = this.#r.get(n);
2291
+ return t;
2292
+ }
2293
+ #p(e, t) {
2294
+ let n = this.#f(e), r = [];
2295
+ for (let e of this.#e.transitions) e.event === t && n.has(e.from) && r.push(e);
2296
+ let i = (e) => {
2297
+ let t = 0, n = e;
2298
+ for (; n !== void 0;) t++, n = this.#r.get(n);
2299
+ return t;
2300
+ };
2301
+ return r.sort((e, t) => i(t.from) - i(e.from)), r;
2302
+ }
2303
+ #m(e, t) {
2304
+ this.#t && this.#t.dispatch(e, t);
2305
+ }
2306
+ #h(e) {
2307
+ let t = this.#o.peek(), n = t.length >= kt ? [...t.slice(t.length - kt + 1), e] : [...t, e];
2308
+ this.#o.value = Object.freeze(n);
2309
+ }
2310
+ };
2311
+ function jt(e, t) {
2312
+ return new At(e, t);
2313
+ }
2314
+ function B(e, t, n, r, i) {
2315
+ return Object.freeze({
2316
+ tag: e,
2317
+ module: t,
2318
+ formAssociated: r,
2319
+ events: i,
2320
+ category: n
2321
+ });
2322
+ }
2323
+ const V = Object.freeze([
2324
+ B("ui-button", "components/ui-button", "form", !0, ["ui-press"]),
2325
+ B("ui-input", "components/ui-input", "form", !0, ["ui-input", "ui-change"]),
2326
+ B("ui-checkbox", "components/ui-checkbox", "form", !0, ["ui-change"]),
2327
+ B("ui-switch", "components/ui-switch", "form", !0, ["ui-change"]),
2328
+ B("ui-radio-group", "components/ui-radio-group", "form", !0, ["ui-change"]),
2329
+ B("ui-select", "components/ui-select", "form", !0, ["ui-change"]),
2330
+ B("ui-combobox", "components/ui-combobox", "form", !0, ["ui-change", "ui-input"]),
2331
+ B("ui-textarea", "components/ui-textarea", "form", !0, ["ui-input", "ui-change"]),
2332
+ B("ui-range", "components/ui-range", "form", !0, ["ui-change"]),
2333
+ B("ui-segmented-control", "components/ui-segmented-control", "form", !0, ["ui-change"]),
2334
+ B("ui-input-otp", "components/ui-input-otp", "form", !0, ["ui-change"]),
2335
+ B("ui-calendar", "components/ui-calendar", "form", !0, ["ui-change"]),
2336
+ B("ui-listbox", "components/ui-listbox", "display", !1, ["ui-select"]),
2337
+ B("ui-option", "components/ui-option", "display", !1, ["ui-select"]),
2338
+ B("ui-option-group", "components/ui-option-group", "display", !1, []),
2339
+ B("ui-badge", "components/ui-badge", "display", !1, []),
2340
+ B("ui-avatar", "components/ui-avatar", "display", !1, []),
2341
+ B("ui-icon", "icons/ui-icon", "display", !1, []),
2342
+ B("ui-tabs", "components/ui-tabs", "navigation", !1, ["ui-change"]),
2343
+ B("ui-tab", "components/ui-tab", "navigation", !1, ["ui-select"]),
2344
+ B("ui-tab-panel", "components/ui-tab-panel", "navigation", !1, []),
2345
+ B("ui-tab-panels", "components/ui-tab-panels", "navigation", !1, []),
2346
+ B("ui-breadcrumb", "components/ui-breadcrumb", "navigation", !1, []),
2347
+ B("ui-breadcrumb-item", "components/ui-breadcrumb-item", "navigation", !1, ["ui-press"]),
2348
+ B("ui-pagination", "components/ui-pagination", "navigation", !1, ["ui-change"]),
2349
+ B("ui-tree", "components/ui-tree", "navigation", !1, ["ui-change"]),
2350
+ B("ui-tree-item", "components/ui-tree-item", "navigation", !1, ["ui-select"]),
2351
+ B("ui-dialog", "components/ui-dialog", "overlay", !1, ["close", "ui-dismiss"]),
2352
+ B("ui-drawer", "components/ui-drawer", "overlay", !1, ["close", "ui-dismiss"]),
2353
+ B("ui-tooltip", "components/ui-tooltip", "overlay", !1, []),
2354
+ B("ui-accordion", "components/ui-accordion", "overlay", !1, []),
2355
+ B("ui-accordion-item", "components/ui-accordion-item", "overlay", !1, ["ui-expand", "ui-collapse"]),
2356
+ B("ui-command", "components/ui-command", "navigation", !1, ["ui-change"]),
2357
+ B("ui-command-input", "components/ui-command", "form", !1, ["ui-input"]),
2358
+ B("ui-command-list", "components/ui-command", "display", !1, []),
2359
+ B("ui-command-item", "components/ui-command", "display", !1, ["ui-select"]),
2360
+ B("ui-command-group", "components/ui-command", "display", !1, []),
2361
+ B("ui-command-empty", "components/ui-command", "display", !1, []),
2362
+ B("ui-table", "components/ui-table", "display", !1, ["ui-sort", "ui-row-select"]),
2363
+ B("ui-table-head", "components/ui-table", "display", !1, []),
2364
+ B("ui-table-body", "components/ui-table", "display", !1, []),
2365
+ B("ui-table-row", "components/ui-table", "display", !1, []),
2366
+ B("ui-table-cell", "components/ui-table", "display", !1, []),
2367
+ B("ui-table-header", "components/ui-table", "display", !1, ["ui-sort"]),
2368
+ B("ui-card", "containers/ui-card", "container", !1, []),
2369
+ B("ui-section", "containers/ui-section", "container", !1, ["ui-expand", "ui-collapse"]),
2370
+ B("ui-toolbar", "containers/ui-toolbar", "container", !1, []),
2371
+ B("ui-field", "components/ui-field", "form", !1, []),
2372
+ B("ui-radio", "components/ui-radio", "form", !1, ["ui-select"]),
2373
+ B("ui-segment", "components/ui-segment", "form", !1, ["ui-select"])
2374
+ ]);
2375
+ var Mt = new Map(V.map((e) => [e.tag, e]));
2376
+ function Nt(e) {
2377
+ return Mt.get(e);
2378
+ }
2379
+ function Pt(e) {
2380
+ return V.filter((t) => t.category === e);
2381
+ }
2382
+ function Ft(e, t, n) {
2383
+ let r = n?.exclude ? new Set(n.exclude) : null, i = 0;
2384
+ for (let [n, a] of t) {
2385
+ if (r?.has(n)) continue;
2386
+ let t = Mt.get(n);
2387
+ t && (e.registerAndDefine(n, a, { formAssociated: t.formAssociated }), i++);
2388
+ }
2389
+ return i;
2390
+ }
2391
+ var It = Object.freeze([
2392
+ "ui-press",
2393
+ "ui-change",
2394
+ "ui-select",
2395
+ "ui-input",
2396
+ "ui-dismiss",
2397
+ "ui-expand",
2398
+ "ui-collapse",
2399
+ "ui-sort",
2400
+ "ui-row-select"
2401
+ ]);
2402
+ function Lt(e, t) {
2403
+ let n = t ?? document.body, r = e.bus, i = [];
2404
+ for (let e of It) {
2405
+ let t = new AbortController();
2406
+ i.push(t), n.addEventListener(e, (t) => {
2407
+ let n = t.target;
2408
+ if (!n?.tagName) return;
2409
+ let i = n.tagName.toLowerCase(), a = `${i}.${e.replace("ui-", "")}`, o = n.closest("[data-plan-id]")?.getAttribute("data-plan-id") ?? void 0;
2410
+ r.dispatch(a, {
2411
+ target: i,
2412
+ event: e,
2413
+ detail: t.detail
2414
+ }, o ? { planId: o } : void 0);
2415
+ }, { signal: t.signal });
2416
+ }
2417
+ return () => {
2418
+ for (let e of i) e.abort();
2419
+ };
2420
+ }
2421
+ function Rt(e, t) {
2422
+ let n = t.replace(/\[(\d+)\]/g, ".$1").split("."), r = e;
2423
+ for (let e of n) {
2424
+ if (typeof r != "object" || !r) return;
2425
+ r = r[e];
2426
+ }
2427
+ return r;
2428
+ }
2429
+ function zt(e) {
2430
+ return e.cacheKey ?? `${e.method ?? "GET"}:${e.source}`;
2431
+ }
2432
+ var Bt = class {
2433
+ #e;
2434
+ #t = r([]);
2435
+ #n = /* @__PURE__ */ new Map();
2436
+ #r = /* @__PURE__ */ new Map();
2437
+ activeBindings = e(() => this.#t.value);
2438
+ constructor(e) {
2439
+ this.#e = e;
2440
+ }
2441
+ bind(e, n, r, i, o) {
2442
+ let s = x(i.source, {
2443
+ method: i.method,
2444
+ headers: i.headers,
2445
+ cacheTtl: i.cacheTtl
2446
+ }), c = this.#e.query(s), l = t(() => {
2447
+ let e = c.value;
2448
+ if (e === null) return;
2449
+ let t = i.transform ? Rt(e, i.transform) : e;
2450
+ switch (i.target) {
2451
+ case "textContent":
2452
+ r.textContent = String(t ?? "");
2453
+ break;
2454
+ case "attribute":
2455
+ i.targetName && t != null && r.setAttribute(i.targetName, String(t));
2456
+ break;
2457
+ case "property":
2458
+ i.targetName && (r[i.targetName] = t);
2459
+ break;
2460
+ case "children":
2461
+ Array.isArray(t) && this.#o(r, t, o);
2462
+ break;
2463
+ }
2464
+ }), u = a("dbind"), d;
2465
+ i.refreshInterval && i.refreshInterval > 0 && (d = setInterval(() => {
2466
+ this.#e.invalidate(zt(s)), this.#e.query(s);
2467
+ }, i.refreshInterval)), this.#n.set(u, {
2468
+ effectDispose: l,
2469
+ intervalId: d
2470
+ });
2471
+ let f = Object.freeze({
2472
+ id: u,
2473
+ planId: e,
2474
+ nodeId: n,
2475
+ binding: i,
2476
+ dispose: () => {
2477
+ this.#i(u), this.#t.value = this.#t.value.filter((e) => e.id !== u), this.#a(e, u);
2478
+ }
2479
+ }), p = this.#r.get(e);
2480
+ return p || (p = /* @__PURE__ */ new Set(), this.#r.set(e, p)), p.add(u), this.#t.value = [...this.#t.value, f], f;
2481
+ }
2482
+ bindPlan(e, t, n, r) {
2483
+ let i = [];
2484
+ for (let [a, o] of n) {
2485
+ let n = t.get(a);
2486
+ n && i.push(this.bind(e, a, n, o, r));
2487
+ }
2488
+ return Object.freeze(i);
2489
+ }
2490
+ unbindPlan(e) {
2491
+ let t = this.#r.get(e);
2492
+ if (t) {
2493
+ for (let e of t) this.#i(e);
2494
+ this.#t.value = this.#t.value.filter((e) => !t.has(e.id)), this.#r.delete(e);
2495
+ }
2496
+ }
2497
+ unbind(e) {
2498
+ let t = this.#t.value.find((t) => t.id === e);
2499
+ t && t.dispose();
2500
+ }
2501
+ refresh(e) {
2502
+ let t = this.#t.value;
2503
+ for (let n of t) {
2504
+ if (n.planId !== e) continue;
2505
+ let t = x(n.binding.source, {
2506
+ method: n.binding.method,
2507
+ headers: n.binding.headers,
2508
+ cacheTtl: n.binding.cacheTtl
2509
+ });
2510
+ this.#e.invalidate(zt(t)), this.#e.query(t);
2511
+ }
2512
+ }
2513
+ destroy() {
2514
+ for (let e of this.#n.keys()) this.#i(e);
2515
+ this.#t.value = [], this.#r.clear();
2516
+ }
2517
+ #i(e) {
2518
+ let t = this.#n.get(e);
2519
+ t && (t.effectDispose(), t.intervalId !== void 0 && clearInterval(t.intervalId), this.#n.delete(e));
2520
+ }
2521
+ #a(e, t) {
2522
+ let n = this.#r.get(e);
2523
+ n && (n.delete(t), n.size === 0 && this.#r.delete(e));
2524
+ }
2525
+ #o(e, t, n) {
2526
+ e.innerHTML = "";
2527
+ for (let n of t) {
2528
+ if (n == null) continue;
2529
+ let t = document.createElement("div");
2530
+ if (typeof n == "string") t.textContent = n;
2531
+ else if (typeof n == "object") {
2532
+ let e = n;
2533
+ t.textContent = String(e.label ?? e.name ?? e.title ?? JSON.stringify(e)), e.value != null && t.setAttribute("data-value", String(e.value));
2534
+ }
2535
+ e.appendChild(t);
2536
+ }
2537
+ }
2538
+ };
2539
+ function Vt(e) {
2540
+ return new Bt(e);
2541
+ }
2542
+ function H(e) {
2543
+ return Object.freeze(e.map((e) => Object.freeze(e)));
2544
+ }
2545
+ function U(e) {
2546
+ return Object.freeze(e.map((e) => Object.freeze(e)));
2547
+ }
2548
+ function W(e, t) {
2549
+ return {
2550
+ id: e,
2551
+ onEntry: `${t}.${e}.entered`,
2552
+ onExit: `${t}.${e}.exited`
2553
+ };
2554
+ }
2555
+ function Ht(e) {
2556
+ let t = e.id ?? "form-wizard", n = e.steps, r = n.map((e) => W(e, t));
2557
+ r.push(W("complete", t)), r.push(W("cancelled", t));
2558
+ let i = [];
2559
+ for (let e = 0; e < n.length; e++) {
2560
+ let r = n[e];
2561
+ e < n.length - 1 ? i.push({
2562
+ from: r,
2563
+ event: "NEXT",
2564
+ to: n[e + 1],
2565
+ action: `${t}.next`
2566
+ }) : i.push({
2567
+ from: r,
2568
+ event: "SUBMIT",
2569
+ to: "complete",
2570
+ action: `${t}.submitted`
2571
+ }), e > 0 && i.push({
2572
+ from: r,
2573
+ event: "PREV",
2574
+ to: n[e - 1],
2575
+ action: `${t}.prev`
2576
+ }), i.push({
2577
+ from: r,
2578
+ event: "CANCEL",
2579
+ to: "cancelled",
2580
+ action: `${t}.cancelled`
2581
+ });
2582
+ }
2583
+ return Object.freeze({
2584
+ id: t,
2585
+ initial: n[0],
2586
+ states: H(r),
2587
+ transitions: U(i),
2588
+ context: Object.freeze({
2589
+ currentStep: 0,
2590
+ totalSteps: n.length
2591
+ })
2592
+ });
2593
+ }
2594
+ function Ut(e) {
2595
+ let t = e?.id ?? "confirm-flow";
2596
+ if (e?.requireDoubleConfirm ?? !1) {
2597
+ let e = [
2598
+ W("idle", t),
2599
+ W("confirming", t),
2600
+ W("confirmed", t)
2601
+ ], n = [
2602
+ {
2603
+ from: "idle",
2604
+ event: "CONFIRM",
2605
+ to: "confirming",
2606
+ action: `${t}.confirm`
2607
+ },
2608
+ {
2609
+ from: "confirming",
2610
+ event: "CONFIRM",
2611
+ to: "confirmed",
2612
+ action: `${t}.confirm`
2613
+ },
2614
+ {
2615
+ from: "confirming",
2616
+ event: "CANCEL",
2617
+ to: "idle",
2618
+ action: `${t}.cancel`
2619
+ }
2620
+ ];
2621
+ return Object.freeze({
2622
+ id: t,
2623
+ initial: "idle",
2624
+ states: H(e),
2625
+ transitions: U(n)
2626
+ });
2627
+ }
2628
+ let n = [
2629
+ W("idle", t),
2630
+ W("confirmed", t),
2631
+ W("cancelled", t)
2632
+ ], r = [{
2633
+ from: "idle",
2634
+ event: "CONFIRM",
2635
+ to: "confirmed",
2636
+ action: `${t}.confirm`
2637
+ }, {
2638
+ from: "idle",
2639
+ event: "CANCEL",
2640
+ to: "cancelled",
2641
+ action: `${t}.cancel`
2642
+ }];
2643
+ return Object.freeze({
2644
+ id: t,
2645
+ initial: "idle",
2646
+ states: H(n),
2647
+ transitions: U(r)
2648
+ });
2649
+ }
2650
+ function Wt(e) {
2651
+ let t = e?.id ?? "crud-lifecycle", n = e?.allowDelete ?? !1, r = [
2652
+ W("empty", t),
2653
+ W("loading", t),
2654
+ W("loaded", t),
2655
+ W("editing", t),
2656
+ W("saving", t),
2657
+ W("error", t)
2658
+ ];
2659
+ n && r.push(W("deleted", t));
2660
+ let i = [
2661
+ {
2662
+ from: "empty",
2663
+ event: "FETCH",
2664
+ to: "loading",
2665
+ action: `${t}.fetch`
2666
+ },
2667
+ {
2668
+ from: "loading",
2669
+ event: "SUCCESS",
2670
+ to: "loaded",
2671
+ action: `${t}.success`
2672
+ },
2673
+ {
2674
+ from: "loading",
2675
+ event: "FAILURE",
2676
+ to: "error",
2677
+ action: `${t}.failure`
2678
+ },
2679
+ {
2680
+ from: "loaded",
2681
+ event: "EDIT",
2682
+ to: "editing",
2683
+ action: `${t}.edit`
2684
+ },
2685
+ {
2686
+ from: "loaded",
2687
+ event: "REFRESH",
2688
+ to: "loading",
2689
+ action: `${t}.refresh`
2690
+ },
2691
+ {
2692
+ from: "editing",
2693
+ event: "SAVE",
2694
+ to: "saving",
2695
+ action: `${t}.save`
2696
+ },
2697
+ {
2698
+ from: "editing",
2699
+ event: "CANCEL",
2700
+ to: "loaded",
2701
+ action: `${t}.cancel`
2702
+ },
2703
+ {
2704
+ from: "saving",
2705
+ event: "SUCCESS",
2706
+ to: "loaded",
2707
+ action: `${t}.success`
2708
+ },
2709
+ {
2710
+ from: "saving",
2711
+ event: "FAILURE",
2712
+ to: "error",
2713
+ action: `${t}.failure`
2714
+ },
2715
+ {
2716
+ from: "error",
2717
+ event: "RETRY",
2718
+ to: "loading",
2719
+ action: `${t}.retry`
2720
+ },
2721
+ {
2722
+ from: "error",
2723
+ event: "DISMISS",
2724
+ to: "empty",
2725
+ action: `${t}.dismiss`
2726
+ }
2727
+ ];
2728
+ return n && i.push({
2729
+ from: "loaded",
2730
+ event: "DELETE",
2731
+ to: "deleted",
2732
+ action: `${t}.delete`
2733
+ }, {
2734
+ from: "deleted",
2735
+ event: "RESET",
2736
+ to: "empty",
2737
+ action: `${t}.reset`
2738
+ }), Object.freeze({
2739
+ id: t,
2740
+ initial: "empty",
2741
+ states: H(r),
2742
+ transitions: U(i)
2743
+ });
2744
+ }
2745
+ function Gt(e) {
2746
+ let t = e?.id ?? "auth-flow", n = e?.mfaRequired ?? !1, r = [W("unauthenticated", t), W("authenticating", t)];
2747
+ n && r.push(W("mfa-pending", t)), r.push(W("authenticated", t)), r.push(W("error", t));
2748
+ let i = [
2749
+ {
2750
+ from: "unauthenticated",
2751
+ event: "LOGIN",
2752
+ to: "authenticating",
2753
+ action: `${t}.login`
2754
+ },
2755
+ {
2756
+ from: "authenticating",
2757
+ event: "SUCCESS",
2758
+ to: n ? "mfa-pending" : "authenticated",
2759
+ action: `${t}.success`
2760
+ },
2761
+ {
2762
+ from: "authenticating",
2763
+ event: "FAILURE",
2764
+ to: "error",
2765
+ action: `${t}.failure`
2766
+ },
2767
+ {
2768
+ from: "authenticated",
2769
+ event: "LOGOUT",
2770
+ to: "unauthenticated",
2771
+ action: `${t}.logout`
2772
+ },
2773
+ {
2774
+ from: "error",
2775
+ event: "RETRY",
2776
+ to: "authenticating",
2777
+ action: `${t}.retry`
2778
+ },
2779
+ {
2780
+ from: "error",
2781
+ event: "DISMISS",
2782
+ to: "unauthenticated",
2783
+ action: `${t}.dismiss`
2784
+ }
2785
+ ];
2786
+ return n && i.push({
2787
+ from: "mfa-pending",
2788
+ event: "VERIFY",
2789
+ to: "authenticated",
2790
+ action: `${t}.verify`
2791
+ }, {
2792
+ from: "mfa-pending",
2793
+ event: "FAIL",
2794
+ to: "error",
2795
+ action: `${t}.fail`
2796
+ }), Object.freeze({
2797
+ id: t,
2798
+ initial: "unauthenticated",
2799
+ states: H(r),
2800
+ transitions: U(i)
2801
+ });
2802
+ }
2803
+ function Kt(e) {
2804
+ let t = e?.id ?? "toggle-flow", n = e?.initialState ?? "off", r = [W("off", t), W("on", t)], i = [{
2805
+ from: "off",
2806
+ event: "TOGGLE",
2807
+ to: "on",
2808
+ action: `${t}.toggle`
2809
+ }, {
2810
+ from: "on",
2811
+ event: "TOGGLE",
2812
+ to: "off",
2813
+ action: `${t}.toggle`
2814
+ }];
2815
+ return Object.freeze({
2816
+ id: t,
2817
+ initial: n,
2818
+ states: H(r),
2819
+ transitions: U(i)
2820
+ });
2821
+ }
2822
+ var G = Object.freeze({
2823
+ name: "size",
2824
+ type: "enum",
2825
+ values: Object.freeze([
2826
+ "xs",
2827
+ "sm",
2828
+ "md",
2829
+ "lg",
2830
+ "xl"
2831
+ ]),
2832
+ default: "md",
2833
+ description: "Controls the component size scale."
2834
+ }), K = Object.freeze({
2835
+ name: "intent",
2836
+ type: "enum",
2837
+ values: Object.freeze([
2838
+ "neutral",
2839
+ "accent",
2840
+ "info",
2841
+ "success",
2842
+ "warning",
2843
+ "danger"
2844
+ ]),
2845
+ default: "neutral",
2846
+ description: "Semantic color intent for the component."
2847
+ }), q = Object.freeze({
2848
+ name: "density",
2849
+ type: "enum",
2850
+ values: Object.freeze([
2851
+ "compact",
2852
+ "default",
2853
+ "loose"
2854
+ ]),
2855
+ default: "default",
2856
+ description: "Controls internal spacing density."
2857
+ }), J = Object.freeze({
2858
+ name: "radius",
2859
+ type: "enum",
2860
+ values: Object.freeze([
2861
+ "none",
2862
+ "sm",
2863
+ "round"
2864
+ ]),
2865
+ default: "round",
2866
+ description: "Border-radius variant."
2867
+ }), Y = Object.freeze({
2868
+ name: "disabled",
2869
+ type: "boolean",
2870
+ description: "Disables the component."
2871
+ }), X = Object.freeze({
2872
+ name: "placeholder",
2873
+ type: "string",
2874
+ description: "Placeholder text shown when empty."
2875
+ }), Z = Object.freeze({
2876
+ name: "",
2877
+ description: "Default slot for primary content."
2878
+ }), qt = Object.freeze({
2879
+ name: "leading",
2880
+ description: "Content placed before the main label (e.g. icon).",
2881
+ allowedTags: Object.freeze([
2882
+ "ui-icon",
2883
+ "span",
2884
+ "img"
2885
+ ])
2886
+ }), Jt = Object.freeze({
2887
+ name: "trailing",
2888
+ description: "Content placed after the main label (e.g. icon, badge).",
2889
+ allowedTags: Object.freeze([
2890
+ "ui-icon",
2891
+ "span",
2892
+ "img",
2893
+ "ui-badge"
2894
+ ])
2895
+ });
2896
+ function Q(e) {
2897
+ return Object.freeze(e);
2898
+ }
2899
+ function $(e) {
2900
+ return Object.freeze({
2901
+ ...e,
2902
+ attributes: Object.freeze(e.attributes),
2903
+ properties: Object.freeze(e.properties),
2904
+ slots: Object.freeze(e.slots),
2905
+ events: Object.freeze(e.events),
2906
+ aria: Object.freeze(e.aria),
2907
+ allowedChildren: e.allowedChildren ? Object.freeze(e.allowedChildren) : void 0
2908
+ });
2909
+ }
2910
+ var Yt = $({
2911
+ tag: "ui-button",
2912
+ category: "form",
2913
+ description: "Interactive button with variant, intent, and size support. Supports leading/trailing icon slots.",
2914
+ attributes: [
2915
+ Q({
2916
+ name: "variant",
2917
+ type: "enum",
2918
+ values: Object.freeze([
2919
+ "primary",
2920
+ "secondary",
2921
+ "default",
2922
+ "outline",
2923
+ "ghost"
2924
+ ]),
2925
+ default: "default",
2926
+ description: "Visual style variant. \"default\" uses neutral chrome with intent-colored text."
2927
+ }),
2928
+ K,
2929
+ G,
2930
+ q,
2931
+ J,
2932
+ Y,
2933
+ Q({
2934
+ name: "justify",
2935
+ type: "enum",
2936
+ values: Object.freeze(["spread"]),
2937
+ description: "Set to \"spread\" for trigger-mode layout (label fills space, trailing icon pushes right)."
2938
+ })
2939
+ ],
2940
+ properties: [],
2941
+ slots: [
2942
+ Q({
2943
+ name: "",
2944
+ description: "Label text content.",
2945
+ allowedTags: Object.freeze(["span"])
2946
+ }),
2947
+ qt,
2948
+ Jt
2949
+ ],
2950
+ events: [Q({
2951
+ name: "ui-press",
2952
+ description: "Fired on activation (click, Enter, Space)."
2953
+ })],
2954
+ aria: Q({
2955
+ role: "button",
2956
+ autoLabeled: !0
2957
+ }),
2958
+ formAssociated: !0
2959
+ }), Xt = $({
2960
+ tag: "ui-input",
2961
+ category: "form",
2962
+ description: "Text input field using contenteditable. Supports leading/trailing slots for icons or actions.",
2963
+ attributes: [
2964
+ Q({
2965
+ name: "variant",
2966
+ type: "enum",
2967
+ values: Object.freeze(["outline", "ghost"]),
2968
+ default: "outline",
2969
+ description: "Visual style variant."
2970
+ }),
2971
+ K,
2972
+ G,
2973
+ q,
2974
+ J,
2975
+ Y,
2976
+ X,
2977
+ Q({
2978
+ name: "type",
2979
+ type: "string",
2980
+ description: "Input type hint (e.g. \"email\", \"password\")."
2981
+ })
2982
+ ],
2983
+ properties: [Q({
2984
+ name: "value",
2985
+ type: "string",
2986
+ description: "Current input value."
2987
+ })],
2988
+ slots: [qt, Jt],
2989
+ events: [Q({
2990
+ name: "ui-input",
2991
+ description: "Fired on each keystroke / input change."
2992
+ }), Q({
2993
+ name: "ui-change",
2994
+ description: "Fired when value is committed (blur or Enter)."
2995
+ })],
2996
+ aria: Q({
2997
+ role: "textbox",
2998
+ requiredAttributes: Object.freeze(["aria-label"]),
2999
+ autoLabeled: !1
3000
+ }),
3001
+ formAssociated: !0
3002
+ }), Zt = $({
3003
+ tag: "ui-select",
3004
+ category: "form",
3005
+ description: "Dropdown select coordinator. Manual mode wraps ui-button + ui-listbox; data-driven mode stamps children from options/src attribute.",
3006
+ attributes: [
3007
+ X,
3008
+ G,
3009
+ K,
3010
+ q,
3011
+ Y,
3012
+ Q({
3013
+ name: "options",
3014
+ type: "string",
3015
+ description: "JSON array of {value, label, disabled?} for data-driven mode."
3016
+ }),
3017
+ Q({
3018
+ name: "src",
3019
+ type: "string",
3020
+ description: "URL to fetch options from for data-driven mode."
3021
+ })
3022
+ ],
3023
+ properties: [Q({
3024
+ name: "options",
3025
+ type: "array",
3026
+ description: "Array of SelectOption objects ({value, label, disabled?}) for data-driven mode."
3027
+ }), Q({
3028
+ name: "value",
3029
+ type: "string",
3030
+ description: "Currently selected value."
3031
+ })],
3032
+ slots: [Z],
3033
+ events: [Q({
3034
+ name: "ui-change",
3035
+ description: "Fired when the selected value changes.",
3036
+ detail: "{ value: string }"
3037
+ })],
3038
+ aria: Q({
3039
+ role: "combobox",
3040
+ requiredAttributes: Object.freeze(["aria-label"]),
3041
+ autoLabeled: !1
3042
+ }),
3043
+ allowedChildren: Object.freeze(["ui-button", "ui-listbox"]),
3044
+ formAssociated: !0
3045
+ }), Qt = $({
3046
+ tag: "ui-combobox",
3047
+ category: "form",
3048
+ description: "Filterable select coordinator. Wraps ui-input + ui-listbox with typeahead filtering.",
3049
+ attributes: [
3050
+ X,
3051
+ G,
3052
+ K,
3053
+ q,
3054
+ Y
3055
+ ],
3056
+ properties: [Q({
3057
+ name: "value",
3058
+ type: "string",
3059
+ description: "Currently selected value."
3060
+ })],
3061
+ slots: [Z],
3062
+ events: [Q({
3063
+ name: "ui-change",
3064
+ description: "Fired when the selected value changes.",
3065
+ detail: "{ value: string }"
3066
+ }), Q({
3067
+ name: "ui-input",
3068
+ description: "Fired on filter text input."
3069
+ })],
3070
+ aria: Q({
3071
+ role: "combobox",
3072
+ requiredAttributes: Object.freeze(["aria-label"]),
3073
+ autoLabeled: !1
3074
+ }),
3075
+ allowedChildren: Object.freeze(["ui-input", "ui-listbox"]),
3076
+ formAssociated: !0
3077
+ }), $t = $({
3078
+ tag: "ui-checkbox",
3079
+ category: "form",
3080
+ description: "Checkbox toggle with label content as default slot.",
3081
+ attributes: [
3082
+ G,
3083
+ K,
3084
+ Y
3085
+ ],
3086
+ properties: [Q({
3087
+ name: "checked",
3088
+ type: "boolean",
3089
+ description: "Whether the checkbox is checked."
3090
+ })],
3091
+ slots: [Q({
3092
+ name: "",
3093
+ description: "Label text content."
3094
+ })],
3095
+ events: [Q({
3096
+ name: "ui-change",
3097
+ description: "Fired when checked state changes.",
3098
+ detail: "{ checked: boolean }"
3099
+ })],
3100
+ aria: Q({
3101
+ role: "checkbox",
3102
+ autoLabeled: !0
3103
+ }),
3104
+ formAssociated: !0
3105
+ }), en = $({
3106
+ tag: "ui-switch",
3107
+ category: "form",
3108
+ description: "Toggle switch with on/off states. Self-labels from content.",
3109
+ attributes: [
3110
+ G,
3111
+ K,
3112
+ Y
3113
+ ],
3114
+ properties: [Q({
3115
+ name: "checked",
3116
+ type: "boolean",
3117
+ description: "Whether the switch is on."
3118
+ })],
3119
+ slots: [Q({
3120
+ name: "",
3121
+ description: "Label text content."
3122
+ })],
3123
+ events: [Q({
3124
+ name: "ui-change",
3125
+ description: "Fired when toggled.",
3126
+ detail: "{ checked: boolean }"
3127
+ })],
3128
+ aria: Q({
3129
+ role: "switch",
3130
+ autoLabeled: !0
3131
+ }),
3132
+ formAssociated: !0
3133
+ }), tn = $({
3134
+ tag: "ui-textarea",
3135
+ category: "form",
3136
+ description: "Multi-line text input area.",
3137
+ attributes: [
3138
+ Q({
3139
+ name: "variant",
3140
+ type: "enum",
3141
+ values: Object.freeze(["outline", "ghost"]),
3142
+ default: "outline",
3143
+ description: "Visual style variant."
3144
+ }),
3145
+ G,
3146
+ K,
3147
+ q,
3148
+ J,
3149
+ Y,
3150
+ X
3151
+ ],
3152
+ properties: [Q({
3153
+ name: "value",
3154
+ type: "string",
3155
+ description: "Current textarea value."
3156
+ })],
3157
+ slots: [],
3158
+ events: [Q({
3159
+ name: "ui-input",
3160
+ description: "Fired on each keystroke."
3161
+ }), Q({
3162
+ name: "ui-change",
3163
+ description: "Fired when value is committed."
3164
+ })],
3165
+ aria: Q({
3166
+ role: "textbox",
3167
+ requiredAttributes: Object.freeze(["aria-label"]),
3168
+ autoLabeled: !1
3169
+ }),
3170
+ formAssociated: !0
3171
+ }), nn = $({
3172
+ tag: "ui-range",
3173
+ category: "form",
3174
+ description: "Slider range input for numeric values.",
3175
+ attributes: [
3176
+ Q({
3177
+ name: "min",
3178
+ type: "string",
3179
+ default: "0",
3180
+ description: "Minimum value."
3181
+ }),
3182
+ Q({
3183
+ name: "max",
3184
+ type: "string",
3185
+ default: "100",
3186
+ description: "Maximum value."
3187
+ }),
3188
+ Q({
3189
+ name: "step",
3190
+ type: "string",
3191
+ default: "1",
3192
+ description: "Step increment."
3193
+ }),
3194
+ G,
3195
+ K,
3196
+ Y
3197
+ ],
3198
+ properties: [Q({
3199
+ name: "value",
3200
+ type: "number",
3201
+ description: "Current numeric value."
3202
+ })],
3203
+ slots: [],
3204
+ events: [Q({
3205
+ name: "ui-change",
3206
+ description: "Fired when value changes.",
3207
+ detail: "{ value: number }"
3208
+ })],
3209
+ aria: Q({
3210
+ role: "slider",
3211
+ requiredAttributes: Object.freeze(["aria-label"]),
3212
+ autoLabeled: !1
3213
+ }),
3214
+ formAssociated: !0
3215
+ }), rn = $({
3216
+ tag: "ui-listbox",
3217
+ category: "display",
3218
+ description: "Scrollable list of selectable options. Used standalone or as a child of ui-select/ui-combobox.",
3219
+ attributes: [
3220
+ Q({
3221
+ name: "variant",
3222
+ type: "enum",
3223
+ values: Object.freeze(["secondary", "ghost"]),
3224
+ default: "secondary",
3225
+ description: "Visual style variant."
3226
+ }),
3227
+ G,
3228
+ q
3229
+ ],
3230
+ properties: [],
3231
+ slots: [Z],
3232
+ events: [Q({
3233
+ name: "ui-select",
3234
+ description: "Fired when an option is selected.",
3235
+ detail: "{ value: string }"
3236
+ })],
3237
+ aria: Q({ role: "listbox" }),
3238
+ allowedChildren: Object.freeze(["ui-option", "ui-option-group"]),
3239
+ formAssociated: !1
3240
+ }), an = $({
3241
+ tag: "ui-option",
3242
+ category: "display",
3243
+ description: "Single selectable option inside a ui-listbox.",
3244
+ attributes: [Q({
3245
+ name: "value",
3246
+ type: "string",
3247
+ description: "Option value submitted on selection."
3248
+ }), Y],
3249
+ properties: [],
3250
+ slots: [
3251
+ Q({
3252
+ name: "",
3253
+ description: "Option label content."
3254
+ }),
3255
+ qt,
3256
+ Jt
3257
+ ],
3258
+ events: [Q({
3259
+ name: "ui-select",
3260
+ description: "Fired when this option is selected."
3261
+ })],
3262
+ aria: Q({
3263
+ role: "option",
3264
+ autoLabeled: !0
3265
+ }),
3266
+ formAssociated: !1
3267
+ }), on = $({
3268
+ tag: "ui-badge",
3269
+ category: "display",
3270
+ description: "Small status indicator or label tag.",
3271
+ attributes: [
3272
+ Q({
3273
+ name: "variant",
3274
+ type: "enum",
3275
+ values: Object.freeze([
3276
+ "primary",
3277
+ "secondary",
3278
+ "outline"
3279
+ ]),
3280
+ default: "secondary",
3281
+ description: "Visual style variant."
3282
+ }),
3283
+ K,
3284
+ G,
3285
+ J
3286
+ ],
3287
+ properties: [],
3288
+ slots: [Q({
3289
+ name: "",
3290
+ description: "Badge label content."
3291
+ })],
3292
+ events: [],
3293
+ aria: Q({ autoLabeled: !0 }),
3294
+ formAssociated: !1
3295
+ }), sn = $({
3296
+ tag: "ui-avatar",
3297
+ category: "display",
3298
+ description: "User avatar image or fallback initials.",
3299
+ attributes: [
3300
+ Q({
3301
+ name: "src",
3302
+ type: "string",
3303
+ description: "Image URL for the avatar."
3304
+ }),
3305
+ Q({
3306
+ name: "alt",
3307
+ type: "string",
3308
+ description: "Accessible alt text for the avatar image."
3309
+ }),
3310
+ G,
3311
+ J
3312
+ ],
3313
+ properties: [],
3314
+ slots: [Q({
3315
+ name: "",
3316
+ description: "Fallback content (e.g. initials) when no src is provided."
3317
+ })],
3318
+ events: [],
3319
+ aria: Q({
3320
+ role: "img",
3321
+ requiredAttributes: Object.freeze(["aria-label"])
3322
+ }),
3323
+ formAssociated: !1
3324
+ }), cn = $({
3325
+ tag: "ui-icon",
3326
+ category: "display",
3327
+ description: "Phosphor icon element. Renders an SVG icon by name from the global registry.",
3328
+ attributes: [Q({
3329
+ name: "name",
3330
+ type: "string",
3331
+ description: "Icon name from the Phosphor icon set (e.g. \"house\", \"caret-up-down\", \"check\")."
3332
+ }), G],
3333
+ properties: [],
3334
+ slots: [],
3335
+ events: [],
3336
+ aria: Q({
3337
+ requiredAttributes: Object.freeze(["aria-hidden"]),
3338
+ autoLabeled: !1
3339
+ }),
3340
+ formAssociated: !1
3341
+ }), ln = $({
3342
+ tag: "ui-tabs",
3343
+ category: "navigation",
3344
+ description: "Tab container that coordinates tab selection and panel visibility.",
3345
+ attributes: [G, q],
3346
+ properties: [Q({
3347
+ name: "value",
3348
+ type: "string",
3349
+ description: "Currently active tab value."
3350
+ })],
3351
+ slots: [Z],
3352
+ events: [Q({
3353
+ name: "ui-change",
3354
+ description: "Fired when the active tab changes.",
3355
+ detail: "{ value: string }"
3356
+ })],
3357
+ aria: Q({ role: "tablist" }),
3358
+ allowedChildren: Object.freeze(["ui-tab", "ui-tab-panels"]),
3359
+ formAssociated: !1
3360
+ }), un = $({
3361
+ tag: "ui-tab-panels",
3362
+ category: "navigation",
3363
+ description: "Container for tab panels within a ui-tabs component.",
3364
+ attributes: [],
3365
+ properties: [],
3366
+ slots: [Z],
3367
+ events: [],
3368
+ aria: Q({ role: "presentation" }),
3369
+ allowedChildren: Object.freeze(["ui-tab-panel"]),
3370
+ formAssociated: !1
3371
+ }), dn = $({
3372
+ tag: "ui-dialog",
3373
+ category: "overlay",
3374
+ description: "Modal dialog overlay. Wraps a native <dialog> and provides showModal()/close() API.",
3375
+ attributes: [Q({
3376
+ name: "no-close-on-escape",
3377
+ type: "boolean",
3378
+ description: "Prevents closing the dialog when Escape is pressed."
3379
+ }), Q({
3380
+ name: "no-close-on-backdrop",
3381
+ type: "boolean",
3382
+ description: "Prevents closing the dialog when the backdrop is clicked."
3383
+ })],
3384
+ properties: [],
3385
+ slots: [Z],
3386
+ events: [Q({
3387
+ name: "close",
3388
+ description: "Fired when the dialog is closed."
3389
+ }), Q({
3390
+ name: "ui-dismiss",
3391
+ description: "Fired when a dismiss action is triggered."
3392
+ })],
3393
+ aria: Q({
3394
+ role: "dialog",
3395
+ requiredAttributes: Object.freeze(["aria-label"]),
3396
+ autoLabeled: !1
3397
+ }),
3398
+ formAssociated: !1
3399
+ }), fn = $({
3400
+ tag: "ui-card",
3401
+ category: "container",
3402
+ description: "Bounded surface container with optional header and footer slots.",
3403
+ attributes: [
3404
+ G,
3405
+ q,
3406
+ J
3407
+ ],
3408
+ properties: [],
3409
+ slots: [
3410
+ Z,
3411
+ Q({
3412
+ name: "header",
3413
+ description: "Card header content area."
3414
+ }),
3415
+ Q({
3416
+ name: "footer",
3417
+ description: "Card footer content area."
3418
+ })
3419
+ ],
3420
+ events: [],
3421
+ aria: Q({}),
3422
+ formAssociated: !1
3423
+ }), pn = $({
3424
+ tag: "ui-field",
3425
+ category: "form",
3426
+ description: "Form field wrapper that pairs a label with a form control and displays validation messages.",
3427
+ attributes: [],
3428
+ properties: [],
3429
+ slots: [Z],
3430
+ events: [],
3431
+ aria: Q({}),
3432
+ allowedChildren: Object.freeze([
3433
+ "label",
3434
+ "ui-input",
3435
+ "ui-select",
3436
+ "ui-combobox",
3437
+ "ui-checkbox",
3438
+ "ui-switch",
3439
+ "ui-textarea",
3440
+ "ui-range",
3441
+ "span"
3442
+ ]),
3443
+ formAssociated: !1
3444
+ }), mn = Object.freeze([
3445
+ Yt,
3446
+ Xt,
3447
+ Zt,
3448
+ Qt,
3449
+ $t,
3450
+ en,
3451
+ tn,
3452
+ nn,
3453
+ rn,
3454
+ an,
3455
+ on,
3456
+ sn,
3457
+ cn,
3458
+ ln,
3459
+ un,
3460
+ dn,
3461
+ fn,
3462
+ pn
3463
+ ]);
3464
+ const hn = new Map(mn.map((e) => [e.tag, e]));
3465
+ function gn(e) {
3466
+ return hn.get(e);
3467
+ }
3468
+ function _n(e) {
3469
+ return mn.filter((t) => t.category === e);
3470
+ }
3471
+ function vn(e, t) {
3472
+ let n = hn.get(e);
3473
+ if (n) return n.attributes.find((e) => e.name === t);
3474
+ }
3475
+ /**
3476
+ * GenUI Planner
3477
+ *
3478
+ * Takes structured UIIntent objects and produces validated UIPlan objects.
3479
+ * Bridge between "what the AI wants to create" and the deterministic kernel execution.
3480
+ *
3481
+ * Intent → UINode tree → UIPlan → schema validation → accessibility audit → PlanResult
3482
+ */
3483
+ /** Tags that suppress the wrapper div when they are the sole root element. */
3484
+ var yn = new Set([
3485
+ "div",
3486
+ "form",
3487
+ "section",
3488
+ "main",
3489
+ "nav",
3490
+ "header",
3491
+ "footer",
3492
+ "article",
3493
+ "aside"
3494
+ ]), bn = new Set([
3495
+ "ui-button",
3496
+ "button",
3497
+ "a",
3498
+ "label",
3499
+ "h1",
3500
+ "h2",
3501
+ "h3",
3502
+ "h4",
3503
+ "h5",
3504
+ "h6",
3505
+ "p",
3506
+ "span",
3507
+ "li",
3508
+ "td",
3509
+ "th",
3510
+ "caption",
3511
+ "summary",
3512
+ "legend",
3513
+ "ui-option",
3514
+ "ui-command-item",
3515
+ "ui-breadcrumb-item",
3516
+ "ui-tab",
3517
+ "ui-switch",
3518
+ "ui-badge"
3519
+ ]), xn = new Set(["ui-button"]), Sn = 10;
3520
+ function Cn(e) {
3521
+ if (typeof e != "object" || !e) return e;
3522
+ Object.freeze(e);
3523
+ for (let t of Object.values(e)) typeof t == "object" && t && !Object.isFrozen(t) && Cn(t);
3524
+ return e;
3525
+ }
3526
+ function wn(e, t) {
3527
+ if (!e.children || e.children.length === 0) return t;
3528
+ let n = t;
3529
+ for (let r of e.children) {
3530
+ let e = wn(r, t + 1);
3531
+ e > n && (n = e);
3532
+ }
3533
+ return n;
3534
+ }
3535
+ var Tn = class e {
3536
+ #e;
3537
+ #t = 0;
3538
+ constructor(e) {
3539
+ this.#e = e ?? /* @__PURE__ */ new Map();
3540
+ }
3541
+ generate(e, t) {
3542
+ this.#t = 0;
3543
+ let n = this.#n(e), r = Cn({
3544
+ id: e.id ?? a("plan"),
3545
+ version: 1,
3546
+ root: n,
3547
+ source: t ?? "generated",
3548
+ timestamp: Date.now()
3549
+ });
3550
+ return Cn({
3551
+ plan: r,
3552
+ validation: g(r, this.#e, { allowUnregistered: !0 }),
3553
+ accessibility: w(r.root),
3554
+ warnings: Object.freeze(this.#c(e, r))
3555
+ });
3556
+ }
3557
+ #n(e) {
3558
+ let t = e.elements.map((e) => this.#r(e));
3559
+ if (t.length === 1) {
3560
+ let n = t[0];
3561
+ if (yn.has(n.tag.toLowerCase())) return e.title && !n.attributes?.["aria-label"] ? {
3562
+ ...n,
3563
+ attributes: {
3564
+ ...n.attributes,
3565
+ "aria-label": e.title
3566
+ }
3567
+ } : n;
3568
+ }
3569
+ let n = { role: "region" };
3570
+ return e.title && (n["aria-label"] = e.title), (e.type === "form" || e.type === "composite") && (n.style = "display: flex; flex-direction: column; gap: 1rem;"), {
3571
+ id: this.#i("div"),
3572
+ tag: "div",
3573
+ attributes: n,
3574
+ children: t
3575
+ };
3576
+ }
3577
+ #r(e) {
3578
+ let t = this.#a(e), n = this.#i(t.component), r = { ...t.attributes ?? {} }, i = this.#o(t.component, r, t), a = {
3579
+ ...r,
3580
+ ...i
3581
+ }, o, s;
3582
+ if (t.label) {
3583
+ let e = t.component.toLowerCase();
3584
+ xn.has(e) ? s = {
3585
+ id: this.#i("span"),
3586
+ tag: "span",
3587
+ attributes: { slot: "label" },
3588
+ textContent: t.label
3589
+ } : bn.has(e) ? o = t.label : a["aria-label"] ||= t.label;
3590
+ }
3591
+ let c = t.children ? t.children.map((e) => this.#r(e)) : void 0, l;
3592
+ return (s || c && c.length > 0) && (l = [], s && l.push(s), c && l.push(...c)), {
3593
+ id: n,
3594
+ tag: t.component,
3595
+ ...Object.keys(a).length > 0 ? { attributes: a } : {},
3596
+ ...t.properties ? { properties: t.properties } : {},
3597
+ ...t.events ? { events: t.events } : {},
3598
+ ...o === void 0 ? {} : { textContent: o },
3599
+ ...l && l.length > 0 ? { children: l } : {},
3600
+ ...t.slot ? { slot: t.slot } : {}
3601
+ };
3602
+ }
3603
+ #i(e) {
3604
+ return `${e}-${this.#t++}`;
3605
+ }
3606
+ /**
3607
+ * Transforms an ElementIntent to match native-ui component DOM requirements.
3608
+ * For example, `ui-select` with `ui-option` children gets converted to
3609
+ * data-driven mode (options attribute) since manual mode requires a complex
3610
+ * `ui-button` + `ui-listbox[popover]` structure.
3611
+ */
3612
+ #a(e) {
3613
+ if (e.component.toLowerCase() === "ui-select" && e.children && e.children.length > 0) {
3614
+ let t = e.children.filter((e) => e.component.toLowerCase() === "ui-option");
3615
+ if (t.length > 0) {
3616
+ let n = t.map((e) => ({
3617
+ value: e.attributes?.value ?? "",
3618
+ label: e.label ?? e.attributes?.label ?? e.attributes?.value ?? ""
3619
+ })), r = e.children.filter((e) => e.component.toLowerCase() !== "ui-option");
3620
+ return {
3621
+ ...e,
3622
+ attributes: {
3623
+ ...e.attributes ?? {},
3624
+ options: JSON.stringify(n)
3625
+ },
3626
+ children: r.length > 0 ? r : void 0
3627
+ };
3628
+ }
3629
+ }
3630
+ return e;
3631
+ }
3632
+ #o(e, t, n) {
3633
+ let r = {}, i;
3634
+ try {
3635
+ i = gn(e);
3636
+ } catch {}
3637
+ if (i && (i.aria?.role && !t.role && (r.role = i.aria.role), i.aria?.requiredAttributes)) for (let e of i.aria.requiredAttributes) t[e] || (r[e] = this.#s(e));
3638
+ return e.toLowerCase() === "ui-icon" && !t["aria-label"] && !n.label && (r["aria-hidden"] = "true"), r;
3639
+ }
3640
+ /** Sensible defaults for required ARIA attributes. */
3641
+ #s(e) {
3642
+ switch (e) {
3643
+ case "aria-checked": return "false";
3644
+ case "aria-expanded": return "false";
3645
+ case "aria-selected": return "false";
3646
+ case "aria-disabled": return "false";
3647
+ case "aria-hidden": return "false";
3648
+ case "aria-valuenow": return "0";
3649
+ case "aria-valuemin": return "0";
3650
+ case "aria-valuemax": return "100";
3651
+ case "aria-level": return "2";
3652
+ default: return "";
3653
+ }
3654
+ }
3655
+ #c(e, t) {
3656
+ let n = [];
3657
+ if (e.type === "form") for (let t of e.elements) this.#l(t, n);
3658
+ this.#u(e.elements, n);
3659
+ let r = wn(t.root, 0);
3660
+ return r > Sn && n.push(`Plan nesting depth is ${r} levels (recommended maximum: ${Sn}). Deep nesting may affect performance and accessibility.`), this.#d(e.elements, n), n;
3661
+ }
3662
+ #l(e, t) {
3663
+ let n = e.component.toLowerCase();
3664
+ if ((n === "ui-input" || n === "ui-select" || n === "ui-combobox" || n === "ui-textarea" || n === "ui-range" || n === "input" || n === "select" || n === "textarea") && !e.label && !e.attributes?.["aria-label"] && !e.attributes?.["aria-labelledby"] && t.push(`Form element <${e.component}> is missing a label.`), e.children) for (let n of e.children) this.#l(n, t);
3665
+ }
3666
+ #u(e, t) {
3667
+ for (let n of e) {
3668
+ let e = n.component.toLowerCase();
3669
+ (e === "ui-button" || e === "button") && (n.label || n.attributes?.["aria-label"] || n.attributes?.["aria-labelledby"] || t.push(`Button <${n.component}> has no text content or aria-label.`)), n.children && this.#u(n.children, t);
3670
+ }
3671
+ }
3672
+ #d(e, t) {
3673
+ for (let n of e) {
3674
+ let e = n.component.toLowerCase();
3675
+ if (e.includes("-")) {
3676
+ let r;
3677
+ try {
3678
+ r = gn(e);
3679
+ } catch {}
3680
+ r || t.push(`Custom element <${n.component}> is not in the schema catalog.`);
3681
+ }
3682
+ n.children && this.#d(n.children, t);
3683
+ }
3684
+ }
3685
+ /**
3686
+ * Build a form plan from field descriptors.
3687
+ * Produces a `<form>` with `ui-field` + `ui-input`/`ui-select`/`ui-textarea` per field,
3688
+ * plus a submit `ui-button` at the end.
3689
+ */
3690
+ static form(t, n) {
3691
+ let r = [];
3692
+ for (let e of t) {
3693
+ let t = e.type ?? "text", n;
3694
+ n = t === "select" && e.options ? {
3695
+ component: "ui-select",
3696
+ label: e.name,
3697
+ attributes: {
3698
+ options: JSON.stringify(e.options.map((e) => ({
3699
+ value: e.value,
3700
+ label: e.label
3701
+ }))),
3702
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
3703
+ ...e.required ? { required: "" } : {}
3704
+ }
3705
+ } : t === "textarea" ? {
3706
+ component: "ui-textarea",
3707
+ label: e.name,
3708
+ attributes: {
3709
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
3710
+ ...e.required ? { required: "" } : {}
3711
+ }
3712
+ } : {
3713
+ component: "ui-input",
3714
+ label: e.name,
3715
+ attributes: {
3716
+ type: t,
3717
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
3718
+ ...e.required ? { required: "" } : {}
3719
+ }
3720
+ }, r.push({
3721
+ component: "ui-field",
3722
+ children: [{
3723
+ component: "label",
3724
+ label: e.name,
3725
+ slot: "label"
3726
+ }, n]
3727
+ });
3728
+ }
3729
+ r.push({
3730
+ component: "ui-button",
3731
+ label: n?.submitLabel ?? "Submit",
3732
+ attributes: {
3733
+ variant: "primary",
3734
+ intent: "accent"
3735
+ },
3736
+ events: n?.submitCommand ? { "ui-press": n.submitCommand } : {}
3737
+ });
3738
+ let i = {
3739
+ type: "form",
3740
+ elements: [{
3741
+ component: "form",
3742
+ attributes: {
3743
+ novalidate: "",
3744
+ style: "display: flex; flex-direction: column; gap: 1rem;"
3745
+ },
3746
+ children: r
3747
+ }],
3748
+ title: n?.title
3749
+ };
3750
+ return new e(n?.registry).generate(i);
3751
+ }
3752
+ /**
3753
+ * Build a simple action bar from button descriptors.
3754
+ * Produces a horizontal `<div>` with `ui-button` children.
3755
+ */
3756
+ static actions(t, n) {
3757
+ let r = {
3758
+ type: "action",
3759
+ elements: [{
3760
+ component: "div",
3761
+ attributes: {
3762
+ style: "display: flex; gap: 0.5rem; align-items: center;",
3763
+ role: "toolbar"
3764
+ },
3765
+ children: t.map((e) => ({
3766
+ component: "ui-button",
3767
+ label: e.label,
3768
+ attributes: {
3769
+ variant: e.variant ?? "default",
3770
+ ...e.intent ? { intent: e.intent } : {}
3771
+ },
3772
+ events: { "ui-press": e.command }
3773
+ }))
3774
+ }]
3775
+ };
3776
+ return new e(n?.registry).generate(r);
3777
+ }
3778
+ /**
3779
+ * Build a content card with optional heading, body, media, and footer actions.
3780
+ * Produces a `<ui-card>` with slotted children.
3781
+ */
3782
+ static card(t, n) {
3783
+ let r = [];
3784
+ t.media && r.push({
3785
+ component: "img",
3786
+ slot: "media",
3787
+ attributes: {
3788
+ src: t.media.src,
3789
+ alt: t.media.alt,
3790
+ ...t.media.height ? { style: `height: ${t.media.height}; object-fit: cover;` } : {}
3791
+ }
3792
+ }), t.heading && r.push({
3793
+ component: "div",
3794
+ slot: "header",
3795
+ children: [{
3796
+ component: "span",
3797
+ label: t.heading
3798
+ }]
3799
+ }), r.push({
3800
+ component: "p",
3801
+ label: t.body
3802
+ }), t.footer && t.footer.length > 0 && r.push({
3803
+ component: "div",
3804
+ slot: "footer",
3805
+ children: t.footer.map((e) => ({
3806
+ component: "ui-button",
3807
+ label: e.label,
3808
+ attributes: {
3809
+ variant: e.variant ?? "ghost",
3810
+ ...e.intent ? { intent: e.intent } : {}
3811
+ },
3812
+ events: { "ui-press": e.command }
3813
+ }))
3814
+ });
3815
+ let i = {};
3816
+ t.interactive && (i.interactive = ""), t.href && (i.href = t.href, i.interactive = "");
3817
+ let a = {
3818
+ type: "display",
3819
+ elements: [{
3820
+ component: "ui-card",
3821
+ attributes: Object.keys(i).length > 0 ? i : void 0,
3822
+ children: r
3823
+ }]
3824
+ };
3825
+ return new e(n?.registry).generate(a);
3826
+ }
3827
+ /**
3828
+ * Build a confirmation/alert dialog.
3829
+ * Produces a `<ui-dialog>` with a styled panel containing title, body, and action buttons.
3830
+ */
3831
+ static dialog(t, n) {
3832
+ let r = [];
3833
+ (t.cancelLabel !== void 0 || t.cancelCommand) && r.push({
3834
+ component: "ui-button",
3835
+ label: t.cancelLabel ?? "Cancel",
3836
+ attributes: { variant: "ghost" },
3837
+ events: t.cancelCommand ? { "ui-press": t.cancelCommand } : {}
3838
+ }), r.push({
3839
+ component: "ui-button",
3840
+ label: t.confirmLabel ?? "Confirm",
3841
+ attributes: {
3842
+ variant: "primary",
3843
+ intent: t.intent ?? "accent"
3844
+ },
3845
+ events: { "ui-press": t.confirmCommand }
3846
+ });
3847
+ let i = {
3848
+ type: "composite",
3849
+ elements: [{
3850
+ component: "ui-dialog",
3851
+ children: [{
3852
+ component: "div",
3853
+ attributes: { style: "background: var(--neutral-body); border: 1px solid var(--neutral-border-muted); border-radius: 0.75rem; padding: 1.5rem; width: min(28rem, calc(100vw - 2rem));" },
3854
+ children: [
3855
+ {
3856
+ component: "h3",
3857
+ label: t.title
3858
+ },
3859
+ {
3860
+ component: "p",
3861
+ label: t.body,
3862
+ attributes: { style: "margin-block: 1rem 1.5rem;" }
3863
+ },
3864
+ {
3865
+ component: "div",
3866
+ attributes: { style: "display: flex; gap: 0.5rem; justify-content: flex-end;" },
3867
+ children: r
3868
+ }
3869
+ ]
3870
+ }]
3871
+ }]
3872
+ };
3873
+ return new e(n?.registry).generate(i);
3874
+ }
3875
+ /**
3876
+ * Build a settings toggle list.
3877
+ * Produces a vertical list of `ui-switch` elements with labels and optional descriptions.
3878
+ */
3879
+ static settings(t, n) {
3880
+ let r = t.map((e) => {
3881
+ let t = { name: e.name };
3882
+ e.checked && (t.checked = "");
3883
+ let n = {
3884
+ component: "ui-switch",
3885
+ label: e.label,
3886
+ attributes: t,
3887
+ events: e.command ? { "ui-change": e.command } : void 0
3888
+ };
3889
+ return e.description ? {
3890
+ component: "div",
3891
+ attributes: { style: "display: flex; flex-direction: column; gap: 0.25rem;" },
3892
+ children: [n, {
3893
+ component: "p",
3894
+ label: e.description,
3895
+ attributes: { style: "font-size: 0.875em; color: var(--neutral-ink-muted); margin: 0; padding-inline-start: 2.5rem;" }
3896
+ }]
3897
+ } : n;
3898
+ }), i = {
3899
+ type: "composite",
3900
+ title: n?.title,
3901
+ elements: [{
3902
+ component: "div",
3903
+ attributes: { style: "display: flex; flex-direction: column; gap: 1rem;" },
3904
+ children: r
3905
+ }]
3906
+ };
3907
+ return new e(n?.registry).generate(i);
3908
+ }
3909
+ /**
3910
+ * Build a tabbed interface.
3911
+ * Produces a `<ui-tabs>` with `<ui-tab>` triggers + `<ui-tab-panels>` container.
3912
+ */
3913
+ static tabs(t, n) {
3914
+ let r = [];
3915
+ for (let e of t) {
3916
+ let t = { value: e.value };
3917
+ e.disabled && (t.disabled = ""), r.push({
3918
+ component: "ui-tab",
3919
+ label: e.label,
3920
+ attributes: t
3921
+ });
3922
+ }
3923
+ let i = [];
3924
+ for (let e of t) i.push({
3925
+ component: "ui-tab-panel",
3926
+ attributes: { value: e.value },
3927
+ children: [{
3928
+ component: "p",
3929
+ label: e.content
3930
+ }]
3931
+ });
3932
+ r.push({
3933
+ component: "ui-tab-panels",
3934
+ children: i
3935
+ });
3936
+ let a = {}, o = n?.defaultValue ?? t[0]?.value;
3937
+ o && (a.value = o), n?.orientation && (a.orientation = n.orientation);
3938
+ let s = {
3939
+ type: "layout",
3940
+ elements: [{
3941
+ component: "ui-tabs",
3942
+ attributes: a,
3943
+ children: r
3944
+ }]
3945
+ };
3946
+ return new e(n?.registry).generate(s);
3947
+ }
3948
+ /**
3949
+ * Build a navigation list.
3950
+ * Produces a `<ui-listbox>` with `<ui-option>` items, optionally grouped with `<ui-option-group>`.
3951
+ */
3952
+ static nav(t, n) {
3953
+ let r = /* @__PURE__ */ new Map();
3954
+ for (let e of t) {
3955
+ let t = e.group, n = r.get(t);
3956
+ n || (n = [], r.set(t, n)), n.push(e);
3957
+ }
3958
+ let i = [];
3959
+ for (let [e, t] of r) {
3960
+ let n = t.map((e) => {
3961
+ let t = [];
3962
+ return e.icon && t.push({
3963
+ component: "ui-icon",
3964
+ attributes: {
3965
+ name: e.icon,
3966
+ slot: "leading"
3967
+ }
3968
+ }), {
3969
+ component: "ui-option",
3970
+ label: e.label,
3971
+ attributes: { value: e.value },
3972
+ children: t.length > 0 ? t : void 0
3973
+ };
3974
+ });
3975
+ if (e) {
3976
+ let r = [], a = t[0]?.icon;
3977
+ a && r.push({
3978
+ component: "ui-icon",
3979
+ attributes: { name: a }
3980
+ }), i.push({
3981
+ component: "ui-option-group",
3982
+ children: [{
3983
+ component: "span",
3984
+ label: e,
3985
+ slot: "heading",
3986
+ children: r.length > 0 ? r : void 0
3987
+ }, ...n]
3988
+ });
3989
+ } else i.push(...n);
3990
+ }
3991
+ let a = {
3992
+ type: "layout",
3993
+ title: n?.title,
3994
+ elements: [{
3995
+ component: "ui-listbox",
3996
+ attributes: { "aria-label": n?.title ?? "Navigation" },
3997
+ children: i
3998
+ }]
3999
+ };
4000
+ return new e(n?.registry).generate(a);
4001
+ }
4002
+ };
4003
+ function En(e) {
4004
+ return new Tn(e);
4005
+ }
4006
+ var Dn = class {
4007
+ #e;
4008
+ #t;
4009
+ #n;
4010
+ #r = null;
4011
+ #i = "disconnected";
4012
+ #a = 0;
4013
+ #o = null;
4014
+ constructor(e, t, n) {
4015
+ this.#e = e, this.#t = t, this.#n = n ?? {};
4016
+ }
4017
+ get state() {
4018
+ return this.#i;
4019
+ }
4020
+ /**
4021
+ * Open the WebSocket connection.
4022
+ * Messages are forwarded to adapter.receive() as they arrive.
4023
+ */
4024
+ connect() {
4025
+ if (this.#i === "connected" || this.#i === "connecting") return;
4026
+ this.#s(this.#a > 0 ? "reconnecting" : "connecting");
4027
+ let e = new WebSocket(this.#t, this.#n.protocols);
4028
+ this.#r = e, e.addEventListener("open", () => {
4029
+ this.#a = 0, this.#s("connected");
4030
+ }), e.addEventListener("message", (e) => {
4031
+ let t = typeof e.data == "string" ? e.data : "";
4032
+ if (t) try {
4033
+ let e = this.#e.parse(t);
4034
+ e && (this.#n.onMessage?.(e), this.#e.receive(e, this.#n.container));
4035
+ } catch (e) {
4036
+ this.#n.onError?.(e instanceof Error ? e : Error(String(e)));
4037
+ }
4038
+ }), e.addEventListener("close", () => {
4039
+ this.#r = null, this.#i !== "closed" && (this.#s("disconnected"), this.#c());
4040
+ }), e.addEventListener("error", () => {
4041
+ this.#n.onError?.(/* @__PURE__ */ Error(`WebSocket error on ${this.#t}`));
4042
+ });
4043
+ }
4044
+ /**
4045
+ * Send a client message (action, error) to the server.
4046
+ */
4047
+ send(e) {
4048
+ if (!this.#r || this.#r.readyState !== WebSocket.OPEN) {
4049
+ this.#n.onError?.(/* @__PURE__ */ Error("WebSocket not connected"));
4050
+ return;
4051
+ }
4052
+ this.#r.send(JSON.stringify(e));
4053
+ }
4054
+ /**
4055
+ * Close the connection. No reconnection will be attempted.
4056
+ */
4057
+ close() {
4058
+ this.#s("closed"), this.#o !== null && (clearTimeout(this.#o), this.#o = null), this.#r?.close(), this.#r = null;
4059
+ }
4060
+ #s(e) {
4061
+ this.#i !== e && (this.#i = e, this.#n.onStateChange?.(e));
4062
+ }
4063
+ #c() {
4064
+ let e = this.#n.reconnect !== !1, t = this.#n.maxReconnects ?? 5;
4065
+ if (!e || this.#a >= t) return;
4066
+ let n = (this.#n.reconnectDelay ?? 1e3) * 2 ** this.#a;
4067
+ this.#a++, this.#o = setTimeout(() => {
4068
+ this.#o = null, this.#i !== "closed" && this.connect();
4069
+ }, n);
4070
+ }
4071
+ }, On = class {
4072
+ #e;
4073
+ #t;
4074
+ #n;
4075
+ #r = null;
4076
+ #i = "disconnected";
4077
+ constructor(e, t, n) {
4078
+ this.#e = e, this.#t = t, this.#n = n ?? {};
4079
+ }
4080
+ get state() {
4081
+ return this.#i;
4082
+ }
4083
+ /**
4084
+ * Open the SSE connection.
4085
+ * Messages are forwarded to adapter.receive() as they arrive.
4086
+ */
4087
+ connect() {
4088
+ if (this.#i === "connected" || this.#i === "connecting") return;
4089
+ this.#a("connecting");
4090
+ let e = new EventSource(this.#t, this.#n.eventSourceInit);
4091
+ this.#r = e;
4092
+ let t = this.#n.eventName ?? "message";
4093
+ e.addEventListener("open", () => {
4094
+ this.#a("connected");
4095
+ }), e.addEventListener(t, (e) => {
4096
+ let t = e.data;
4097
+ if (!(typeof t != "string" || !t)) try {
4098
+ let e = this.#e.parse(t);
4099
+ e && (this.#n.onMessage?.(e), this.#e.receive(e, this.#n.container));
4100
+ } catch (e) {
4101
+ this.#n.onError?.(e instanceof Error ? e : Error(String(e)));
4102
+ }
4103
+ }), e.addEventListener("error", () => {
4104
+ e.readyState === EventSource.CLOSED ? this.#a("disconnected") : this.#a("reconnecting"), this.#n.onError?.(/* @__PURE__ */ Error(`SSE error on ${this.#t}`));
4105
+ });
4106
+ }
4107
+ /**
4108
+ * Send a client message to the server via POST.
4109
+ * Requires postUrl to be set in options.
4110
+ */
4111
+ async send(e) {
4112
+ let t = this.#n.postUrl;
4113
+ if (!t) throw Error("SSE transport: postUrl not configured for outbound messages");
4114
+ let n = await fetch(t, {
4115
+ method: "POST",
4116
+ headers: { "Content-Type": "application/json" },
4117
+ body: JSON.stringify(e)
4118
+ });
4119
+ if (!n.ok) throw Error(`SSE POST failed: ${n.status} ${n.statusText}`);
4120
+ }
4121
+ /**
4122
+ * Close the SSE connection.
4123
+ */
4124
+ close() {
4125
+ this.#a("closed"), this.#r?.close(), this.#r = null;
4126
+ }
4127
+ #a(e) {
4128
+ this.#i !== e && (this.#i = e, this.#n.onStateChange?.(e));
4129
+ }
4130
+ };
4131
+ function kn(e, t, n) {
4132
+ return new Dn(e, t, n);
4133
+ }
4134
+ function An(e, t, n) {
4135
+ return new On(e, t, n);
4136
+ }
4137
+ export { R as A2UIAdapter, Bt as BindingManager, V as COMPONENT_MANIFEST, it as COMPONENT_MAP, o as CommandBus, c as CommandHistory, y as DataStore, ce as EventLog, h as FocusRouter, b as HttpError, Et as Kernel, f as OverlayManager, v as PerfMetrics, oe as PlanExecutor, Tn as Planner, D as PolicyEngine, hn as SCHEMA_CATALOG, On as SSETransport, L as SurfaceManager, Dn as WebSocketTransport, At as WorkflowEngine, P as a2uiToUINode, Ie as applyPatch, Oe as auditDOM, Gt as authFlow, Ut as confirmFlow, ht as conversionToPlan, Tt as createA2UIAdapter, x as createBinding, Vt as createBindingManager, s as createCommandBus, l as createCommandHistory, me as createDataStore, le as createEventLog, ee as createFocusRouter, p as createOverlayManager, ue as createPerfMetrics, se as createPlanExecutor, En as createPlanner, Je as createPolicyEngine, An as createSSETransport, wt as createSurfaceManager, kn as createWebSocketTransport, jt as createWorkflowEngine, Wt as crudLifecycle, ct as dateTimeInputType, Ht as formWizard, Nt as getDescriptor, Pt as getDescriptorsByCategory, Dt as getKernel, gn as getSchema, vn as getSchemaAttribute, _n as getSchemasForCategory, N as getSupportedTypes, Lt as installEventBridge, et as isActionMessage, $e as isCatalogRequest, nt as isCatalogResponse, Ye as isCreateSurface, O as isDataBinding, Qe as isDeleteSurface, tt as isErrorMessage, Xe as isUpdateComponents, Ze as isUpdateDataModel, k as parseServerMessage, Ft as registerAll, Ot as resetKernel, at as resolveA2UIType, I as resolveJsonPointer, M as resolveNativeTag, gt as setJsonPointer, ut as textFieldInputType, st as textVariantTag, Kt as toggleFlow, ft as uiNodeToA2UI, w as validateAccessibility, ie as validateNode, g as validatePlan };