@rangka/client 0.1.0 → 0.1.2

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 (352) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/App.js +7 -1
  3. package/dist/App.js.map +1 -1
  4. package/dist/components/ui/input-group.d.ts +1 -1
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/main.d.ts.map +1 -1
  10. package/dist/main.js +20 -0
  11. package/dist/main.js.map +1 -1
  12. package/dist/shell/assets/AttachmentWidget-BTTGroHP.js +1 -0
  13. package/dist/shell/assets/AttachmentsWidget-DZgvmO9P.js +1 -0
  14. package/dist/shell/assets/BadgeWidget-DN6GsAAG.js +1 -0
  15. package/dist/shell/assets/CardWidget-qX-UvqJh.js +1 -0
  16. package/dist/shell/assets/CheckboxWidget-CYPZ85ih.js +1 -0
  17. package/dist/shell/assets/CodeWidget-DnVtHG1d.js +1 -0
  18. package/dist/shell/assets/ColumnWidget-CYmFCVOf.js +1 -0
  19. package/dist/shell/assets/ComputedWidget-BQApkfir.js +1 -0
  20. package/dist/shell/assets/DatePickerWidget-pEusSy9D.js +1 -0
  21. package/dist/shell/assets/DatetimeWidget-M0fEGDTD.js +1 -0
  22. package/dist/shell/assets/DividerWidget-hXVGhIKC.js +1 -0
  23. package/dist/shell/assets/DrawerWidget-DynL7EIy.js +1 -0
  24. package/dist/shell/assets/DynamicLinkWidget-ChMJ5DAf.js +1 -0
  25. package/dist/shell/assets/IconWidget-Cgo9txq1.js +1 -0
  26. package/dist/shell/assets/ImageWidget-YUv1_OQK.js +1 -0
  27. package/dist/shell/assets/JsonWidget-RHUHhXHJ.js +1 -0
  28. package/dist/shell/assets/LinkWidget-CIu7qmb2.js +1 -0
  29. package/dist/shell/assets/ManyToManyWidget-DCQnygvZ.js +1 -0
  30. package/dist/shell/assets/ModalWidget-FggzYaS2.js +1 -0
  31. package/dist/shell/assets/MoneyWidget-CKjOSucD.js +1 -0
  32. package/dist/shell/assets/RepeatWidget-Dfp4zW4d.js +1 -0
  33. package/dist/shell/assets/ScrollAreaWidget-CdFdf4rv.js +1 -0
  34. package/dist/shell/assets/SequenceWidget-DIXHZslz.js +1 -0
  35. package/dist/shell/assets/SpacerWidget-BgM4dC6x.js +1 -0
  36. package/dist/shell/assets/SplitWidget-_mcQkjQk.js +1 -0
  37. package/dist/shell/assets/StackWidget-BI_VIreo.js +1 -0
  38. package/dist/shell/assets/TableWidget-DuIvd6qR.js +1 -0
  39. package/dist/shell/assets/TextareaWidget-CATua7Ls.js +1 -0
  40. package/dist/shell/assets/TreeWidget-BoHlhfza.js +1 -0
  41. package/dist/shell/assets/calendar-DqckiKt1.js +1 -0
  42. package/dist/shell/assets/index-63v1sBS3.css +1 -0
  43. package/dist/shell/assets/index-D1wStSrO.js +8635 -0
  44. package/dist/shell/assets/popover-DywIKFaQ.js +1 -0
  45. package/dist/shell/assets/textarea-BVCZevA6.js +1 -0
  46. package/dist/shell/assets/useSurfaceContext-kzu9770H.js +1 -0
  47. package/dist/shell/assets/vendor-query-dRdWN_eK.js +1 -0
  48. package/dist/shell/assets/vendor-radix-D-Trh8JA.js +69 -0
  49. package/dist/shell/assets/vendor-router-B1WM9yRc.js +17 -0
  50. package/dist/shell/index.html +5 -2
  51. package/dist/theme.css +82 -0
  52. package/dist/widgets/components/lazy-manifest.d.ts +11 -0
  53. package/dist/widgets/components/lazy-manifest.d.ts.map +1 -0
  54. package/dist/widgets/components/lazy-manifest.js +32 -0
  55. package/dist/widgets/components/lazy-manifest.js.map +1 -0
  56. package/dist/widgets/components/register.d.ts.map +1 -1
  57. package/dist/widgets/components/register.js +0 -58
  58. package/dist/widgets/components/register.js.map +1 -1
  59. package/dist/widgets/loader.d.ts +3 -0
  60. package/dist/widgets/loader.d.ts.map +1 -0
  61. package/dist/widgets/loader.js +99 -0
  62. package/dist/widgets/loader.js.map +1 -0
  63. package/dist/widgets/renderer/LazyWidget.d.ts +8 -0
  64. package/dist/widgets/renderer/LazyWidget.d.ts.map +1 -0
  65. package/dist/widgets/renderer/LazyWidget.js +31 -0
  66. package/dist/widgets/renderer/LazyWidget.js.map +1 -0
  67. package/dist/widgets/renderer/WidgetErrorBoundary.d.ts +17 -0
  68. package/dist/widgets/renderer/WidgetErrorBoundary.d.ts.map +1 -0
  69. package/dist/widgets/renderer/WidgetErrorBoundary.js +18 -0
  70. package/dist/widgets/renderer/WidgetErrorBoundary.js.map +1 -0
  71. package/dist/widgets/renderer/WidgetRenderer.d.ts.map +1 -1
  72. package/dist/widgets/renderer/WidgetRenderer.js +8 -6
  73. package/dist/widgets/renderer/WidgetRenderer.js.map +1 -1
  74. package/package.json +7 -4
  75. package/.claude/skills/add-widget/SKILL.md +0 -101
  76. package/.turbo/turbo-build.log +0 -29
  77. package/CHANGELOG.md +0 -18
  78. package/CLAUDE.md +0 -236
  79. package/components.json +0 -25
  80. package/dist/components/ui/chart.d.ts +0 -45
  81. package/dist/components/ui/chart.d.ts.map +0 -1
  82. package/dist/components/ui/chart.js +0 -119
  83. package/dist/components/ui/chart.js.map +0 -1
  84. package/dist/shell/assets/index--35CAvcP.js +0 -8715
  85. package/dist/shell/assets/index-COLmoPYo.css +0 -1
  86. package/index.html +0 -12
  87. package/src/App.tsx +0 -44
  88. package/src/__tests__/setup.ts +0 -1
  89. package/src/api/auth.ts +0 -41
  90. package/src/api/boot.ts +0 -10
  91. package/src/api/client.ts +0 -26
  92. package/src/api/paths.ts +0 -3
  93. package/src/api/token.ts +0 -13
  94. package/src/auth/LoginForm.tsx +0 -67
  95. package/src/auth/SessionExpired.tsx +0 -24
  96. package/src/auth/SetupForm.tsx +0 -76
  97. package/src/boot/BootGate.tsx +0 -35
  98. package/src/boot/BootProvider.tsx +0 -28
  99. package/src/boot/types.ts +0 -9
  100. package/src/boot/useBoot.ts +0 -111
  101. package/src/components/Icon.tsx +0 -17
  102. package/src/components/ui/accordion.tsx +0 -82
  103. package/src/components/ui/alert-dialog.tsx +0 -180
  104. package/src/components/ui/alert.tsx +0 -76
  105. package/src/components/ui/aspect-ratio.tsx +0 -9
  106. package/src/components/ui/avatar.tsx +0 -94
  107. package/src/components/ui/badge.tsx +0 -45
  108. package/src/components/ui/breadcrumb.tsx +0 -104
  109. package/src/components/ui/button-group.tsx +0 -78
  110. package/src/components/ui/button.tsx +0 -65
  111. package/src/components/ui/calendar.tsx +0 -187
  112. package/src/components/ui/card.tsx +0 -85
  113. package/src/components/ui/carousel.tsx +0 -229
  114. package/src/components/ui/chart.tsx +0 -339
  115. package/src/components/ui/checkbox.tsx +0 -27
  116. package/src/components/ui/collapsible.tsx +0 -21
  117. package/src/components/ui/combobox.tsx +0 -275
  118. package/src/components/ui/command.tsx +0 -178
  119. package/src/components/ui/context-menu.tsx +0 -242
  120. package/src/components/ui/dialog.tsx +0 -146
  121. package/src/components/ui/direction.tsx +0 -20
  122. package/src/components/ui/drawer.tsx +0 -118
  123. package/src/components/ui/dropdown-menu.tsx +0 -247
  124. package/src/components/ui/empty.tsx +0 -94
  125. package/src/components/ui/field.tsx +0 -224
  126. package/src/components/ui/hover-card.tsx +0 -36
  127. package/src/components/ui/input-group.tsx +0 -142
  128. package/src/components/ui/input-otp.tsx +0 -86
  129. package/src/components/ui/input.tsx +0 -19
  130. package/src/components/ui/item.tsx +0 -182
  131. package/src/components/ui/kbd.tsx +0 -26
  132. package/src/components/ui/label.tsx +0 -19
  133. package/src/components/ui/menubar.tsx +0 -260
  134. package/src/components/ui/native-select.tsx +0 -55
  135. package/src/components/ui/navigation-menu.tsx +0 -160
  136. package/src/components/ui/pagination.tsx +0 -112
  137. package/src/components/ui/popover.tsx +0 -74
  138. package/src/components/ui/progress.tsx +0 -31
  139. package/src/components/ui/radio-group.tsx +0 -42
  140. package/src/components/ui/resizable.tsx +0 -42
  141. package/src/components/ui/scroll-area.tsx +0 -53
  142. package/src/components/ui/select.tsx +0 -185
  143. package/src/components/ui/separator.tsx +0 -26
  144. package/src/components/ui/sheet.tsx +0 -128
  145. package/src/components/ui/sidebar.tsx +0 -669
  146. package/src/components/ui/skeleton.tsx +0 -13
  147. package/src/components/ui/slider.tsx +0 -54
  148. package/src/components/ui/sonner.tsx +0 -43
  149. package/src/components/ui/spinner.tsx +0 -16
  150. package/src/components/ui/switch.tsx +0 -33
  151. package/src/components/ui/table.tsx +0 -87
  152. package/src/components/ui/tabs.tsx +0 -80
  153. package/src/components/ui/textarea.tsx +0 -18
  154. package/src/components/ui/toggle-group.tsx +0 -86
  155. package/src/components/ui/toggle.tsx +0 -44
  156. package/src/components/ui/tooltip.tsx +0 -53
  157. package/src/context/MetaContext.tsx +0 -22
  158. package/src/context/ModuleContext.tsx +0 -62
  159. package/src/context/PermissionsContext.tsx +0 -39
  160. package/src/context/ShellProviders.tsx +0 -33
  161. package/src/context/UserContext.tsx +0 -16
  162. package/src/data/QueryProvider.tsx +0 -7
  163. package/src/data/queryClient.ts +0 -18
  164. package/src/data/useModelMeta.ts +0 -17
  165. package/src/data/useMutation.ts +0 -60
  166. package/src/data/useRecord.ts +0 -29
  167. package/src/data/useSource.ts +0 -112
  168. package/src/hooks/use-mobile.ts +0 -19
  169. package/src/index.css +0 -260
  170. package/src/index.ts +0 -16
  171. package/src/lib/utils.ts +0 -6
  172. package/src/main.tsx +0 -17
  173. package/src/router/NotFound.tsx +0 -8
  174. package/src/router/RouterProvider.tsx +0 -7
  175. package/src/router/buildRouteTree.tsx +0 -63
  176. package/src/router/createShellRouter.ts +0 -9
  177. package/src/router/hooks.ts +0 -43
  178. package/src/shell/CommandPalette.tsx +0 -76
  179. package/src/shell/ConfirmDialog.tsx +0 -34
  180. package/src/shell/ConfirmProvider.tsx +0 -56
  181. package/src/shell/DrawerContext.tsx +0 -44
  182. package/src/shell/HeaderActions.tsx +0 -31
  183. package/src/shell/ModuleSelectorPage.tsx +0 -149
  184. package/src/shell/PageOutlet.tsx +0 -21
  185. package/src/shell/ShellContext.tsx +0 -45
  186. package/src/shell/ShellDevTools.tsx +0 -153
  187. package/src/shell/ShellLayout.tsx +0 -231
  188. package/src/shell/Toast.tsx +0 -58
  189. package/src/shell/ToastProvider.tsx +0 -60
  190. package/src/shell/app-sidebar/AppSidebar.tsx +0 -44
  191. package/src/shell/app-sidebar/ModuleSwitcher.tsx +0 -87
  192. package/src/shell/app-sidebar/NavMain.tsx +0 -64
  193. package/src/shell/app-sidebar/NavUser.tsx +0 -97
  194. package/src/shell/app-sidebar/SearchMenu.tsx +0 -22
  195. package/src/shell/app-sidebar/index.ts +0 -8
  196. package/src/shell/app-sidebar/types.ts +0 -38
  197. package/src/shell/types.ts +0 -6
  198. package/src/shell/useBreadcrumbs.ts +0 -42
  199. package/src/studio/bridge.ts +0 -125
  200. package/src/studio/index.ts +0 -3
  201. package/src/studio/overlay.ts +0 -47
  202. package/src/studio/types.ts +0 -32
  203. package/src/studio/walker.ts +0 -48
  204. package/src/vite-env.d.ts +0 -1
  205. package/src/widgets/__tests__/action-edge-cases.test.ts +0 -281
  206. package/src/widgets/__tests__/action.test.ts +0 -236
  207. package/src/widgets/__tests__/attachment-widget.test.tsx +0 -85
  208. package/src/widgets/__tests__/attachments-widget.test.tsx +0 -109
  209. package/src/widgets/__tests__/binding.test.ts +0 -76
  210. package/src/widgets/__tests__/button-widget.test.tsx +0 -145
  211. package/src/widgets/__tests__/checkbox-widget.test.tsx +0 -158
  212. package/src/widgets/__tests__/code-widget.test.tsx +0 -64
  213. package/src/widgets/__tests__/computed-widget.test.tsx +0 -62
  214. package/src/widgets/__tests__/condition-edge-cases.test.ts +0 -120
  215. package/src/widgets/__tests__/condition.test.ts +0 -221
  216. package/src/widgets/__tests__/context.test.ts +0 -99
  217. package/src/widgets/__tests__/data-widget.test.tsx +0 -204
  218. package/src/widgets/__tests__/datepicker-widget.test.tsx +0 -66
  219. package/src/widgets/__tests__/datetime-widget.test.tsx +0 -67
  220. package/src/widgets/__tests__/drawer-widget.test.tsx +0 -149
  221. package/src/widgets/__tests__/dynamic-link-widget.test.tsx +0 -52
  222. package/src/widgets/__tests__/edge-cases.test.ts +0 -232
  223. package/src/widgets/__tests__/evaluator.test.ts +0 -107
  224. package/src/widgets/__tests__/functions.test.ts +0 -147
  225. package/src/widgets/__tests__/grid-widget.test.tsx +0 -137
  226. package/src/widgets/__tests__/hooks.test.tsx +0 -249
  227. package/src/widgets/__tests__/icon-widget.test.tsx +0 -129
  228. package/src/widgets/__tests__/input-widget.test.tsx +0 -264
  229. package/src/widgets/__tests__/integration.test.ts +0 -116
  230. package/src/widgets/__tests__/json-widget.test.tsx +0 -70
  231. package/src/widgets/__tests__/link-widget.test.tsx +0 -92
  232. package/src/widgets/__tests__/many-to-many-widget.test.tsx +0 -93
  233. package/src/widgets/__tests__/modal-widget.test.tsx +0 -148
  234. package/src/widgets/__tests__/money-widget.test.tsx +0 -97
  235. package/src/widgets/__tests__/parser.test.ts +0 -171
  236. package/src/widgets/__tests__/reactive-variables.test.ts +0 -383
  237. package/src/widgets/__tests__/renderer.test.tsx +0 -300
  238. package/src/widgets/__tests__/repeat-widget.test.tsx +0 -229
  239. package/src/widgets/__tests__/select-widget.test.tsx +0 -231
  240. package/src/widgets/__tests__/sequence-widget.test.tsx +0 -58
  241. package/src/widgets/__tests__/shell-integration.test.tsx +0 -1343
  242. package/src/widgets/__tests__/split-widget.test.tsx +0 -133
  243. package/src/widgets/__tests__/state-edge-cases.test.ts +0 -118
  244. package/src/widgets/__tests__/state.test.ts +0 -106
  245. package/src/widgets/__tests__/table-data-binding.test.tsx +0 -482
  246. package/src/widgets/__tests__/table-filter-popover.test.tsx +0 -486
  247. package/src/widgets/__tests__/table-search.test.tsx +0 -305
  248. package/src/widgets/__tests__/table-widget.test.tsx +0 -509
  249. package/src/widgets/__tests__/textarea-widget.test.tsx +0 -105
  250. package/src/widgets/__tests__/tracker-validator-edge-cases.test.ts +0 -242
  251. package/src/widgets/__tests__/tracker.test.ts +0 -133
  252. package/src/widgets/__tests__/tree-widget.test.tsx +0 -97
  253. package/src/widgets/__tests__/use-model-source.test.ts +0 -67
  254. package/src/widgets/__tests__/validator.test.ts +0 -208
  255. package/src/widgets/action/dispatcher.ts +0 -334
  256. package/src/widgets/action/index.ts +0 -2
  257. package/src/widgets/binding/index.ts +0 -2
  258. package/src/widgets/binding/resolver.ts +0 -61
  259. package/src/widgets/components/AttachmentWidget.tsx +0 -111
  260. package/src/widgets/components/AttachmentsWidget.tsx +0 -121
  261. package/src/widgets/components/BadgeWidget.tsx +0 -35
  262. package/src/widgets/components/ButtonWidget.tsx +0 -43
  263. package/src/widgets/components/CardWidget.tsx +0 -68
  264. package/src/widgets/components/CheckboxWidget.tsx +0 -39
  265. package/src/widgets/components/CodeWidget.tsx +0 -44
  266. package/src/widgets/components/ColumnWidget.tsx +0 -22
  267. package/src/widgets/components/ComputedWidget.tsx +0 -49
  268. package/src/widgets/components/DataWidget.tsx +0 -189
  269. package/src/widgets/components/DatePickerWidget.tsx +0 -73
  270. package/src/widgets/components/DatetimeWidget.tsx +0 -160
  271. package/src/widgets/components/DividerWidget.tsx +0 -37
  272. package/src/widgets/components/DrawerWidget.tsx +0 -52
  273. package/src/widgets/components/DynamicLinkWidget.tsx +0 -130
  274. package/src/widgets/components/GridWidget.tsx +0 -134
  275. package/src/widgets/components/GroupWidget.tsx +0 -111
  276. package/src/widgets/components/IconWidget.tsx +0 -29
  277. package/src/widgets/components/ImageWidget.tsx +0 -28
  278. package/src/widgets/components/InputWidget.tsx +0 -70
  279. package/src/widgets/components/JsonWidget.tsx +0 -78
  280. package/src/widgets/components/LinkWidget.tsx +0 -99
  281. package/src/widgets/components/ManyToManyWidget.tsx +0 -125
  282. package/src/widgets/components/ModalWidget.tsx +0 -52
  283. package/src/widgets/components/MoneyWidget.tsx +0 -80
  284. package/src/widgets/components/RepeatWidget.tsx +0 -66
  285. package/src/widgets/components/ScrollAreaWidget.tsx +0 -40
  286. package/src/widgets/components/SectionWidget.tsx +0 -78
  287. package/src/widgets/components/SelectWidget.tsx +0 -63
  288. package/src/widgets/components/SequenceWidget.tsx +0 -32
  289. package/src/widgets/components/SpacerWidget.tsx +0 -29
  290. package/src/widgets/components/SplitWidget.tsx +0 -60
  291. package/src/widgets/components/StackWidget.tsx +0 -44
  292. package/src/widgets/components/TableWidget.tsx +0 -366
  293. package/src/widgets/components/TextWidget.tsx +0 -44
  294. package/src/widgets/components/TextareaWidget.tsx +0 -49
  295. package/src/widgets/components/TreeWidget.tsx +0 -109
  296. package/src/widgets/components/index.ts +0 -30
  297. package/src/widgets/components/register.ts +0 -93
  298. package/src/widgets/components/table/CellRenderers.tsx +0 -83
  299. package/src/widgets/components/table/TablePagination.tsx +0 -45
  300. package/src/widgets/components/table/TableToolbar.tsx +0 -285
  301. package/src/widgets/components/table/filter-operators.ts +0 -134
  302. package/src/widgets/components/table/index.ts +0 -11
  303. package/src/widgets/condition/evaluator.ts +0 -57
  304. package/src/widgets/condition/index.ts +0 -1
  305. package/src/widgets/context/builder.ts +0 -99
  306. package/src/widgets/context/index.ts +0 -8
  307. package/src/widgets/context/types.ts +0 -37
  308. package/src/widgets/data/index.ts +0 -5
  309. package/src/widgets/data/useModelQuery.ts +0 -116
  310. package/src/widgets/data/useModelRecord.ts +0 -37
  311. package/src/widgets/expression/evaluator.ts +0 -100
  312. package/src/widgets/expression/functions.ts +0 -131
  313. package/src/widgets/expression/index.ts +0 -13
  314. package/src/widgets/expression/parser.ts +0 -229
  315. package/src/widgets/expression/types.ts +0 -45
  316. package/src/widgets/form/FormContext.ts +0 -29
  317. package/src/widgets/form/FormProvider.tsx +0 -84
  318. package/src/widgets/form/FormWidget.tsx +0 -42
  319. package/src/widgets/form/index.ts +0 -4
  320. package/src/widgets/form/useFormState.ts +0 -127
  321. package/src/widgets/form/useFormSubmit.ts +0 -90
  322. package/src/widgets/form/useFormValidation.ts +0 -62
  323. package/src/widgets/hooks/index.ts +0 -8
  324. package/src/widgets/hooks/useAction.ts +0 -83
  325. package/src/widgets/hooks/useBind.ts +0 -34
  326. package/src/widgets/hooks/useCondition.ts +0 -21
  327. package/src/widgets/hooks/useDataQuery.ts +0 -48
  328. package/src/widgets/hooks/useExpression.ts +0 -14
  329. package/src/widgets/hooks/usePageState.ts +0 -21
  330. package/src/widgets/hooks/useSurfaceContext.ts +0 -11
  331. package/src/widgets/hooks/useWidgetContext.ts +0 -14
  332. package/src/widgets/index.ts +0 -80
  333. package/src/widgets/lib/layout-props.ts +0 -135
  334. package/src/widgets/reactivity/index.ts +0 -11
  335. package/src/widgets/reactivity/tracker.ts +0 -139
  336. package/src/widgets/reactivity/variables.ts +0 -213
  337. package/src/widgets/registry.ts +0 -41
  338. package/src/widgets/renderer/SlotRenderer.tsx +0 -47
  339. package/src/widgets/renderer/WidgetRenderer.tsx +0 -191
  340. package/src/widgets/renderer/index.ts +0 -4
  341. package/src/widgets/shell/WidgetSlotRenderer.tsx +0 -73
  342. package/src/widgets/shell/index.ts +0 -4
  343. package/src/widgets/shell/useActionHandlers.ts +0 -170
  344. package/src/widgets/state/index.ts +0 -2
  345. package/src/widgets/state/store.ts +0 -96
  346. package/src/widgets/types.ts +0 -28
  347. package/src/widgets/validation/index.ts +0 -2
  348. package/src/widgets/validation/validator.ts +0 -140
  349. package/tsconfig.json +0 -27
  350. package/tsconfig.tsbuildinfo +0 -1
  351. package/vite.config.ts +0 -21
  352. package/vitest.config.ts +0 -16
package/dist/App.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,GAAG,gCAMlB"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AA4CA,wBAAgB,GAAG,gCAMlB"}
package/dist/App.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
2
+ import { useEffect, useMemo } from 'react';
3
3
  import { BootProvider, useBootContext } from './boot/BootProvider.js';
4
4
  import { BootGate } from './boot/BootGate.js';
5
5
  import { ShellProviders } from './context/ShellProviders.js';
@@ -7,8 +7,14 @@ import { QueryProvider } from './data/QueryProvider.js';
7
7
  import { createQueryClient } from './data/queryClient.js';
8
8
  import { RouterProvider } from './router/RouterProvider.js';
9
9
  import { createShellRouter } from './router/createShellRouter.js';
10
+ import { loadCustomWidgets } from './widgets/loader.js';
10
11
  function AppInner() {
11
12
  const { state, handleSessionExpired } = useBootContext();
13
+ useEffect(() => {
14
+ if (state.status === 'ready') {
15
+ loadCustomWidgets();
16
+ }
17
+ }, [state.status]);
12
18
  const queryClient = useMemo(() => createQueryClient(handleSessionExpired), [handleSessionExpired]);
13
19
  const router = useMemo(() => {
14
20
  if (state.status === 'ready') {
package/dist/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,SAAS,QAAQ;IACf,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,cAAc,EAAE,CAAC;IAEzD,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAC7C,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,KAAC,QAAQ,cACN,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,IAAI,CACrC,KAAC,cAAc,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAC9B,KAAC,aAAa,IAAC,MAAM,EAAE,WAAW,YAChC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,GACpB,GACD,CAClB,GACQ,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,OAAO,CACL,KAAC,YAAY,cACX,KAAC,QAAQ,KAAG,GACC,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,SAAS,QAAQ;IACf,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,cAAc,EAAE,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,iBAAiB,EAAE,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAC7C,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,KAAC,QAAQ,cACN,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,IAAI,CACrC,KAAC,cAAc,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAC9B,KAAC,aAAa,IAAC,MAAM,EAAE,WAAW,YAChC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,GACpB,GACD,CAClB,GACQ,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,OAAO,CACL,KAAC,YAAY,cACX,KAAC,QAAQ,KAAG,GACC,CAChB,CAAC;AACJ,CAAC"}
@@ -3,7 +3,7 @@ import { type VariantProps } from 'class-variance-authority';
3
3
  import { Button } from '@/components/ui/button';
4
4
  declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
5
5
  declare const inputGroupAddonVariants: (props?: ({
6
- align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
6
+ align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
9
9
  declare const inputGroupButtonVariants: (props?: ({
package/dist/index.d.ts CHANGED
@@ -9,4 +9,6 @@ export { useMeta, type MetaData } from './context/MetaContext.js';
9
9
  export { useShell, type ShellAPI, type ToastType } from './shell/ShellContext.js';
10
10
  export { App } from './App.js';
11
11
  export { WidgetSlotRenderer, useActionHandlers, type UseActionHandlersOptions, type WidgetSlotRendererProps, } from './widgets/shell/index.js';
12
+ export { loadCustomWidgets, ensureWidget } from './widgets/loader.js';
13
+ export { registerWidget, getWidget, clearWidgetRegistry } from './widgets/registry.js';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -9,4 +9,6 @@ export { useMeta } from './context/MetaContext.js';
9
9
  export { useShell } from './shell/ShellContext.js';
10
10
  export { App } from './App.js';
11
11
  export { WidgetSlotRenderer, useActionHandlers, } from './widgets/shell/index.js';
12
+ export { loadCustomWidgets, ensureWidget } from './widgets/loader.js';
13
+ export { registerWidget, getWidget, clearWidgetRegistry } from './widgets/registry.js';
12
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAA+C,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAwB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,WAAW,EAA0B,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAuB,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiC,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAA+C,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAwB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,WAAW,EAA0B,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAuB,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiC,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC"}
package/dist/main.js CHANGED
@@ -1,9 +1,29 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import ReactDOM from 'react-dom';
2
4
  import { StrictMode } from 'react';
3
5
  import { createRoot } from 'react-dom/client';
4
6
  import './index.css';
5
7
  import { App } from './App.js';
6
8
  import { registerBuiltInWidgets } from './widgets/components/register.js';
9
+ import { usePageState } from './widgets/hooks/usePageState.js';
10
+ import { useWidgetContext } from './widgets/hooks/useWidgetContext.js';
11
+ import { useShell } from './shell/ShellContext.js';
12
+ import { useModelRecord } from './widgets/data/useModelRecord.js';
13
+ import { useModelQuery } from './widgets/data/useModelQuery.js';
14
+ // Expose React globals for custom widgets loaded via dynamic import()
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ window.__rangka_React = React;
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ window.__rangka_ReactDOM = ReactDOM;
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ window.__rangka_client = {
21
+ usePageState,
22
+ useWidgetContext,
23
+ useShell,
24
+ useModelRecord,
25
+ useModelQuery,
26
+ };
7
27
  registerBuiltInWidgets();
8
28
  createRoot(document.getElementById('root')).render(_jsx(StrictMode, { children: _jsx(App, {}) }));
9
29
  if (window.parent !== window) {
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,sBAAsB,EAAE,CAAC;AAEzB,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CAAC,CAAC,MAAM,CACjD,KAAC,UAAU,cACT,KAAC,GAAG,KAAG,GACI,CACd,CAAC;AAEF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,sEAAsE;AACtE,8DAA8D;AAC7D,MAAc,CAAC,cAAc,GAAG,KAAK,CAAC;AACvC,8DAA8D;AAC7D,MAAc,CAAC,iBAAiB,GAAG,QAAQ,CAAC;AAC7C,8DAA8D;AAC7D,MAAc,CAAC,eAAe,GAAG;IAChC,YAAY;IACZ,gBAAgB;IAChB,QAAQ;IACR,cAAc;IACd,aAAa;CACd,CAAC;AAEF,sBAAsB,EAAE,CAAC;AAEzB,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CAAC,CAAC,MAAM,CACjD,KAAC,UAAU,cACT,KAAC,GAAG,KAAG,GACI,CACd,CAAC;AAEF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1 @@
1
+ import{r as y,j as s}from"./vendor-radix-D-Trh8JA.js";import{L as z,M as N,j as D,c as b}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function R({props:d,bind:e,on:r}){var p,x;const f=d.label??((p=e.meta)==null?void 0:p.label)??"",h=d.accept??"",l=d.disabled??((x=e.meta)==null?void 0:x.readOnly)??!1,m=y.useRef(null),u=e.value,g=t=>{var c,n,i;const a=(c=t.target.files)==null?void 0:c[0];if(a){const o={name:a.name,size:a.size};(n=e.setValue)==null||n.call(e,o),(i=r.change)==null||i.call(r,o)}},v=t=>{var c,n,i;if(t.preventDefault(),l)return;const a=(c=t.dataTransfer.files)==null?void 0:c[0];if(a){const o={name:a.name,size:a.size};(n=e.setValue)==null||n.call(e,o),(i=r.change)==null||i.call(r,o)}},j=()=>{var t,a;(t=e.setValue)==null||t.call(e,null),(a=r.remove)==null||a.call(r),m.current&&(m.current.value="")};return s.jsxs(z,{children:[f&&s.jsx(N,{children:f}),u?s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input px-3 py-2",children:[s.jsx("span",{className:"flex-1 truncate text-sm",children:u.name}),u.size&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[(u.size/1024).toFixed(1)," KB"]}),!l&&s.jsx(D,{variant:"ghost",size:"sm",onClick:j,className:"h-5 px-1","aria-label":"Remove file",children:"×"})]}):s.jsx("div",{className:b("flex flex-col items-center justify-center rounded-md border-2 border-dashed border-input p-4 text-center transition-colors",!l&&"cursor-pointer hover:border-primary/50 hover:bg-accent/50",l&&"opacity-50 cursor-not-allowed"),onClick:()=>{var t;return!l&&((t=m.current)==null?void 0:t.click())},onDrop:v,onDragOver:t=>t.preventDefault(),role:"button","aria-label":"Upload file",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop a file here or click to browse"})}),s.jsx("input",{ref:m,type:"file",accept:h,onChange:g,className:"hidden",disabled:l})]})}R.widgetMeta={name:"attachment",label:"Attachment",category:"input",schema:{label:{type:"string"},accept:{type:"string"},maxSize:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","remove"],container:!1};export{R as AttachmentWidget};
@@ -0,0 +1 @@
1
+ import{r as z,j as a}from"./vendor-radix-D-Trh8JA.js";import{L as N,M as b,j as C,c as D}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function F({props:u,bind:t,on:s}){var h,f;const d=u.label??((h=t.meta)==null?void 0:h.label)??"",g=u.accept??"",p=u.maxCount??10,i=u.disabled??((f=t.meta)==null?void 0:f.readOnly)??!1,x=z.useRef(null),n=t.value??[],y=e=>{var c,m;const r=Array.from(e.target.files??[]).map(o=>({name:o.name,size:o.size})),l=[...n,...r].slice(0,p);(c=t.setValue)==null||c.call(t,l),(m=s.change)==null||m.call(s,l),x.current&&(x.current.value="")},j=e=>{var c,m;if(e.preventDefault(),i)return;const r=Array.from(e.dataTransfer.files).map(o=>({name:o.name,size:o.size})),l=[...n,...r].slice(0,p);(c=t.setValue)==null||c.call(t,l),(m=s.change)==null||m.call(s,l)},v=e=>{var l,c;const r=n.filter((m,o)=>o!==e);(l=t.setValue)==null||l.call(t,r),(c=s.remove)==null||c.call(s,e)};return a.jsxs(N,{children:[d&&a.jsx(b,{children:d}),n.length>0&&a.jsx("ul",{className:"mb-2 space-y-1",role:"list",children:n.map((e,r)=>a.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-input px-3 py-1.5",children:[a.jsx("span",{className:"flex-1 truncate text-sm",children:e.name}),e.size&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[(e.size/1024).toFixed(1)," KB"]}),!i&&a.jsx(C,{variant:"ghost",size:"sm",onClick:()=>v(r),className:"h-5 px-1","aria-label":`Remove ${e.name}`,children:"×"})]},`${e.name}-${r}`))}),n.length<p&&a.jsx("div",{className:D("flex flex-col items-center justify-center rounded-md border-2 border-dashed border-input p-4 text-center transition-colors",!i&&"cursor-pointer hover:border-primary/50 hover:bg-accent/50",i&&"opacity-50 cursor-not-allowed"),onClick:()=>{var e;return!i&&((e=x.current)==null?void 0:e.click())},onDrop:j,onDragOver:e=>e.preventDefault(),role:"button","aria-label":"Upload files",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Drop files here or click to browse (",n.length,"/",p,")"]})}),a.jsx("input",{ref:x,type:"file",accept:g,multiple:!0,onChange:y,className:"hidden",disabled:i})]})}F.widgetMeta={name:"attachments",label:"Attachments",category:"input",schema:{label:{type:"string"},accept:{type:"string"},maxSize:{type:"string"},maxCount:{type:"number",default:10},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","remove"],container:!1};export{F as AttachmentsWidget};
@@ -0,0 +1 @@
1
+ import{j as i}from"./vendor-radix-D-Trh8JA.js";import{B as l}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const r={solid:"default",outline:"outline",subtle:"secondary"};function s({props:e,bind:t}){const a=e.label,o=t.value??"",n=r[e.variant??"subtle"]??"secondary";return i.jsx(l,{variant:n,children:a||o})}s.widgetMeta={name:"badge",label:"Badge",category:"display",schema:{variant:{type:"enum",options:["solid","outline","subtle"],default:"subtle"},color:{type:"enum",options:["default","success","warning","error","info"],default:"default"},colorMap:{type:"object"}},binding:"field",triggers:[],container:!1};export{s as BadgeWidget};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-radix-D-Trh8JA.js";import{a as m,b as x,d as f,e as g,f as j,W as o,g as h,h as p}from"./index-D1wStSrO.js";import{S as u}from"./useSurfaceContext-kzu9770H.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function C({props:t,children:c}){const a=t.title,s=t.description,l=t.size??"default",i=t.actions,n=t.footer;return e.jsxs(m,{size:l,children:[(a||s||i)&&e.jsxs(x,{children:[a&&e.jsx(f,{children:a}),s&&e.jsx(g,{children:s}),i&&i.length>0&&e.jsx(j,{children:e.jsx("div",{className:"flex items-center gap-2",children:i.map((r,d)=>e.jsx(o,{node:r},r.id??d))})})]}),e.jsx(h,{children:e.jsx(u,{value:"card",children:c})}),n&&n.length>0&&e.jsx(p,{children:n.map((r,d)=>e.jsx(o,{node:r},r.id??d))})]})}C.widgetMeta={name:"card",label:"Card",category:"layout",schema:{title:{type:"string"},description:{type:"string"},size:{type:"enum",options:["default","sm"],default:"default"},actions:{type:"array"},footer:{type:"array"}},binding:"none",triggers:[],container:!0};export{C as CardWidget};
@@ -0,0 +1 @@
1
+ import{j as a,a0 as u,a1 as b}from"./vendor-radix-D-Trh8JA.js";import{C as g,c as h}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function m({className:r,...e}){return a.jsx(u,{"data-slot":"checkbox",className:h("peer relative flex size-4 shrink-0 items-center justify-center rounded-none border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",r),...e,children:a.jsx(b,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:a.jsx(g,{})})})}function f({props:r,bind:e,on:i}){var c,l;const t=r.label??((c=e.meta)==null?void 0:c.label)??"",x=r.disabled??((l=e.meta)==null?void 0:l.readOnly)??!1,s=e.error;return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(m,{checked:e.value??!1,onCheckedChange:d=>{var n,o;(n=e.setValue)==null||n.call(e,d),(o=i.change)==null||o.call(i,d)},disabled:x}),t&&a.jsx("span",{className:"text-sm text-foreground",children:t})]}),s&&a.jsx("p",{className:"text-xs text-destructive",children:s})]})}f.widgetMeta={name:"checkbox",label:"Checkbox",category:"input",schema:{label:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change"],container:!1};export{f as CheckboxWidget};
@@ -0,0 +1 @@
1
+ import{j as s}from"./vendor-radix-D-Trh8JA.js";import{T as f}from"./textarea-BVCZevA6.js";import{L as d,M as p}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function x({props:t,bind:l,on:e}){var u,c;const r=t.label??((u=l.meta)==null?void 0:u.label)??"",m=t.rows??6,g=t.disabled??((c=l.meta)==null?void 0:c.readOnly)??!1;return s.jsxs(d,{children:[r&&s.jsx(p,{children:r}),s.jsx(f,{value:l.value??"",onChange:a=>{var i,o;(i=l.setValue)==null||i.call(l,a.target.value),(o=e.change)==null||o.call(e,a.target.value)},onFocus:()=>{var a;return(a=e.focus)==null?void 0:a.call(e)},onBlur:()=>{var a;return(a=e.blur)==null?void 0:a.call(e)},rows:m,disabled:g,className:"font-mono text-xs",spellCheck:!1})]})}x.widgetMeta={name:"code",label:"Code",category:"input",schema:{label:{type:"string"},language:{type:"string"},rows:{type:"number",default:6},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","focus","blur"],container:!1};export{x as CodeWidget};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-radix-D-Trh8JA.js";function n({children:t}){return e.jsx(e.Fragment,{children:t})}n.widgetMeta={name:"column",label:"Column",category:"layout",schema:{label:{type:"string",required:!0},width:{type:"string"},align:{type:"enum",options:["left","center","right"],default:"left"},sortable:{type:"boolean"},filterable:{type:"boolean"}},binding:"none",triggers:[],container:!0};export{n as ColumnWidget};
@@ -0,0 +1 @@
1
+ import{j as r}from"./vendor-radix-D-Trh8JA.js";import{L as s,M as l}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function c({props:n,bind:i}){var a;const o=n.label??((a=i.meta)==null?void 0:a.label)??"",t=n.format??"text",m=i.value,u=e=>e==null?"—":t==="number"&&typeof e=="number"?e.toLocaleString():t==="currency"&&typeof e=="number"?e.toFixed(2):t==="date"&&typeof e=="string"?new Date(e).toLocaleDateString():String(e);return r.jsxs(s,{children:[o&&r.jsx(l,{children:o}),r.jsx("div",{className:"flex items-center h-7 text-sm","data-testid":"computed-value",children:u(m)})]})}c.widgetMeta={name:"computed",label:"Computed",category:"display",schema:{label:{type:"string"},format:{type:"enum",options:["text","number","currency","date"],default:"text"}},binding:"field",triggers:[],container:!1};export{c as ComputedWidget};
@@ -0,0 +1 @@
1
+ import{r as P,j as e}from"./vendor-radix-D-Trh8JA.js";import{P as y,a as v,b as w}from"./popover-DywIKFaQ.js";import{L as C,M,j as N,N as b}from"./index-D1wStSrO.js";import{p as k,f,C as D}from"./calendar-DqckiKt1.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function O({props:r,bind:t,on:a}){var c,d;const l=r.label??((c=t.meta)==null?void 0:c.label)??"",h=r.disabled??((d=t.meta)==null?void 0:d.readOnly)??!1,[g,o]=P.useState(!1),n=t.error,i=t.value,s=i?k(i):void 0,j=m=>{var p,u;if(m){const x=f(m,"yyyy-MM-dd");(p=t.setValue)==null||p.call(t,x),(u=a.change)==null||u.call(a,x)}o(!1)};return e.jsxs(C,{children:[l&&e.jsx(M,{children:l}),e.jsxs(y,{open:g,onOpenChange:o,children:[e.jsx(v,{asChild:!0,children:e.jsxs(N,{variant:"outline",disabled:h,className:"w-full justify-start text-left font-normal h-8 text-xs",children:[e.jsx(b,{className:"mr-2 size-3.5 text-muted-foreground"}),s?f(s,"PPP"):e.jsx("span",{className:"text-muted-foreground",children:"Pick a date"})]})}),e.jsx(w,{className:"w-auto p-0",align:"start",children:e.jsx(D,{mode:"single",selected:s,onSelect:j,captionLayout:"dropdown",startMonth:new Date(1900,0),endMonth:new Date(2100,11)})})]}),n&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:n})]})}O.widgetMeta={name:"datepicker",label:"Date Picker",category:"input",schema:{label:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change"],container:!1};export{O as DatePickerWidget};
@@ -0,0 +1 @@
1
+ import{r as T,j as e}from"./vendor-radix-D-Trh8JA.js";import{P as E,a as R,b as _}from"./popover-DywIKFaQ.js";import{L,M as F,j as U,N as k,O as u,P as g,Q as p,R as j,T as f}from"./index-D1wStSrO.js";import{t as D,p as z,f as B,C as Q}from"./calendar-DqckiKt1.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function W(l,a,n){const o=D(l,n==null?void 0:n.in);return o.setHours(a),o}function $(l,a,n){const o=D(l,n==null?void 0:n.in);return o.setMinutes(a),o}const q=Array.from({length:12},(l,a)=>(a===0?12:a).toString()),G=Array.from({length:60},(l,a)=>a.toString().padStart(2,"0")),J=["AM","PM"];function K({props:l,bind:a,on:n}){var y,v;const o=l.label??((y=a.meta)==null?void 0:y.label)??"",x=l.disabled??((v=a.meta)==null?void 0:v.readOnly)??!1,[b,O]=T.useState(!1),S=a.value,r=S?z(S):void 0,i=r?r.getHours():0,h=r?r.getMinutes():0,N=i>=12?"PM":"AM",M=i%12===0?12:i%12,m=(t,s,c)=>{var C,P;if(!t)return;let d=W(t,s);d=$(d,c);const w=d.toISOString();(C=a.setValue)==null||C.call(a,w),(P=n.change)==null||P.call(n,w)},V=t=>{t&&m(t,i,h)},I=t=>{const s=parseInt(t),c=N==="AM"?s===12?0:s:s===12?12:s+12;m(r??new Date,c,h)},A=t=>{const s=parseInt(t);m(r??new Date,i,s)},H=t=>{const s=M,c=t==="AM"?s===12?0:s:s===12?12:s+12;m(r??new Date,c,h)};return e.jsxs(L,{children:[o&&e.jsx(F,{children:o}),e.jsxs(E,{open:b,onOpenChange:O,children:[e.jsx(R,{asChild:!0,children:e.jsxs(U,{variant:"outline",disabled:x,className:"w-full justify-start text-left font-normal h-8 text-xs",children:[e.jsx(k,{className:"mr-2 size-3.5 text-muted-foreground"}),r?B(r,"PPP hh:mm a"):e.jsx("span",{className:"text-muted-foreground",children:"Pick date and time"})]})}),e.jsxs(_,{className:"w-auto p-0",align:"start",children:[e.jsx(Q,{mode:"single",selected:r,onSelect:V,captionLayout:"dropdown",startMonth:new Date(1900,0),endMonth:new Date(2100,11)}),e.jsxs("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[e.jsxs(u,{value:M.toString(),onValueChange:I,disabled:x,children:[e.jsx(g,{className:"w-16 h-7 text-xs",children:e.jsx(p,{})}),e.jsx(j,{position:"popper",className:"max-h-48",children:q.map(t=>e.jsx(f,{value:t,className:"text-xs",children:t},t))})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:":"}),e.jsxs(u,{value:h.toString().padStart(2,"0"),onValueChange:A,disabled:x,children:[e.jsx(g,{className:"w-16 h-7 text-xs",children:e.jsx(p,{})}),e.jsx(j,{position:"popper",className:"max-h-48",children:G.map(t=>e.jsx(f,{value:t,className:"text-xs",children:t},t))})]}),e.jsxs(u,{value:N,onValueChange:H,disabled:x,children:[e.jsx(g,{className:"w-16 h-7 text-xs",children:e.jsx(p,{})}),e.jsx(j,{children:J.map(t=>e.jsx(f,{value:t,className:"text-xs",children:t},t))})]})]})]})]})]})}K.widgetMeta={name:"datetime",label:"Date & Time",category:"input",schema:{label:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change"],container:!1};export{K as DatetimeWidget};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-radix-D-Trh8JA.js";import{S as o}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const n={none:"my-0",sm:"my-2",md:"my-4",lg:"my-6",xl:"my-8"};function r({props:m}){const e=m.margin??m.marginY??"md",i=n[e]??n.md;return t.jsx(o,{className:i})}r.widgetMeta={name:"divider",label:"Divider",category:"layout",schema:{margin:{type:"enum",options:["none","sm","md","lg","xl"]},marginY:{type:"enum",options:["none","sm","md","lg","xl"]}},binding:"none",triggers:[],container:!1};export{r as DividerWidget};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-radix-D-Trh8JA.js";import{s as m,z as h,A as g,D as u,E as w}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const f={sm:"w-80",md:"w-[28rem]",lg:"w-[40rem]"};function p({props:t,children:i}){const a=t.title??"",n=t.width??"md",l=t.closable??!0,s=t._visibleField,r=m(),o=c=>{if(!c&&l&&s&&s.startsWith("$state.")){const d=s.slice(7);r.set(d,!1)}};return e.jsx(h,{open:!0,onOpenChange:o,children:e.jsxs(g,{className:f[n],side:"right",children:[a&&e.jsx(u,{children:e.jsx(w,{children:a})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i})]})})}p.widgetMeta={name:"drawer",label:"Drawer",category:"layout",schema:{width:{type:"enum",options:["sm","md","lg"],default:"md"},title:{type:"string"},closable:{type:"boolean",default:!0}},binding:"none",triggers:[],container:!0};export{p as DrawerWidget};
@@ -0,0 +1 @@
1
+ import{r as v,j as a}from"./vendor-radix-D-Trh8JA.js";import{P as w,a as L,b as M}from"./popover-DywIKFaQ.js";import{L as O,M as P,O as k,P as E,Q as I,R,T,j as D,V as B,Y as G,Z as Q,_ as W,$ as Y,a0 as Z,c as _}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function $({props:r,bind:t,on:l,context:C}){var g,p,j;const c=r.label??((g=t.meta)==null?void 0:g.label)??"",d=r.disabled??((p=t.meta)==null?void 0:p.readOnly)??!1,S=r.models??[],[o,i]=v.useState(!1),[y,m]=v.useState(""),h=((j=t.meta)==null?void 0:j.options)??[],u=t.value,x=h.find(e=>e.value===u),b=r.modelField??"",n=C.record[b]??"",N=e=>{var s;(s=l.change)==null||s.call(l,{model:e,value:null})},F=e=>{var s,f;(s=t.setValue)==null||s.call(t,e),(f=l.change)==null||f.call(l,{model:n,value:e}),i(!1),m("")},V=e=>{var s;m(e),(s=l.search)==null||s.call(l,e)};return a.jsxs(O,{children:[c&&a.jsx(P,{children:c}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(k,{value:n,onValueChange:N,disabled:d,children:[a.jsx(E,{className:"w-40 h-7 text-xs",children:a.jsx(I,{placeholder:"Model..."})}),a.jsx(R,{children:S.map(e=>a.jsx(T,{value:e,children:e},e))})]}),a.jsxs(w,{open:o,onOpenChange:i,children:[a.jsx(L,{asChild:!0,children:a.jsx(D,{variant:"outline",role:"combobox","aria-expanded":o,disabled:d||!n,className:"flex-1 justify-between font-normal h-7 text-xs",children:x?x.label:a.jsx("span",{className:"text-muted-foreground",children:"Select record..."})})}),a.jsx(M,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(B,{shouldFilter:!1,children:[a.jsx(G,{placeholder:"Search...",value:y,onValueChange:V}),a.jsxs(Q,{children:[a.jsx(W,{children:"No results found."}),a.jsx(Y,{children:h.map(e=>a.jsx(Z,{value:e.value,onSelect:()=>F(e.value),className:_(e.value===u&&"bg-accent"),children:e.label},e.value))})]})]})})]})]})]})}$.widgetMeta={name:"dynamic-link",label:"Dynamic Link",category:"input",schema:{label:{type:"string"},modelField:{type:"string"},models:{type:"array"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","search"],container:!1};export{$ as DynamicLinkWidget};
@@ -0,0 +1 @@
1
+ import{j as n}from"./vendor-radix-D-Trh8JA.js";import{I as t}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function s({props:e,on:i}){const c=e.name??"circle",o=e.size,r=e.color;return n.jsx("span",{onClick:i.click,className:i.click?"cursor-pointer":void 0,children:n.jsx(t,{name:c,size:o,color:r})})}s.widgetMeta={name:"icon",label:"Icon",category:"display",schema:{name:{type:"string",required:!0},size:{type:"number",default:14},color:{type:"string"}},binding:"none",triggers:["click"],container:!1};export{s as IconWidget};
@@ -0,0 +1 @@
1
+ import{j as g}from"./vendor-radix-D-Trh8JA.js";function r({props:t,bind:i}){const e=i.value??t.src??"",n=t.alt??"",s=t.width,a=t.height;return e?g.jsx("img",{src:e,alt:n,style:{width:s,height:a},className:"max-w-full rounded-sm"}):null}r.widgetMeta={name:"image",label:"Image",category:"display",schema:{src:{type:"string"},alt:{type:"string"},width:{type:"string"},height:{type:"string"}},binding:"field",triggers:[],container:!1};export{r as ImageWidget};
@@ -0,0 +1 @@
1
+ import{r as x,j as c}from"./vendor-radix-D-Trh8JA.js";import{T as S}from"./textarea-BVCZevA6.js";import{L as v,M as J,c as O}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function w({props:o,bind:l,on:e}){var f,g;const m=o.label??((f=l.meta)==null?void 0:f.label)??"",p=o.rows??6,h=o.disabled??((g=l.meta)==null?void 0:g.readOnly)??!1,[n,u]=x.useState(null),r=l.value,y=typeof r=="string"?r:r!=null?JSON.stringify(r,null,2):"",[i,d]=x.useState(y),b=t=>{var s;const a=t.target.value;d(a),u(null),(s=e.change)==null||s.call(e,a)},j=()=>{var t,a;try{const s=JSON.parse(i),N=JSON.stringify(s,null,2);d(N),(t=l.setValue)==null||t.call(l,s),u(null)}catch{i.trim()!==""&&u("Invalid JSON")}(a=e.blur)==null||a.call(e)};return c.jsxs(v,{children:[m&&c.jsx(J,{children:m}),c.jsx(S,{value:i,onChange:b,onFocus:()=>{var t;return(t=e.focus)==null?void 0:t.call(e)},onBlur:j,rows:p,disabled:h,className:O("font-mono text-xs",n&&"border-destructive"),spellCheck:!1}),n&&c.jsx("p",{className:"text-xs text-destructive mt-1",role:"alert",children:n})]})}w.widgetMeta={name:"json",label:"JSON",category:"input",schema:{label:{type:"string"},rows:{type:"number",default:6},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","focus","blur"],container:!1};export{w as JsonWidget};
@@ -0,0 +1 @@
1
+ import{r as f,j as a}from"./vendor-radix-D-Trh8JA.js";import{P as y,a as w,b as L}from"./popover-DywIKFaQ.js";import{L as N,M as O,j as P,V,Y as k,Z as E,_ as F,$ as I,a0 as M,c as B}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function G({props:r,bind:s,on:l}){var u,p,x;const n=r.label??((u=s.meta)==null?void 0:u.label)??"",j=r.placeholder??"Select...",v=r.disabled??((p=s.meta)==null?void 0:p.readOnly)??!1,[c,o]=f.useState(!1),[C,i]=f.useState(""),d=((x=s.meta)==null?void 0:x.options)??[],m=s.value,h=d.find(e=>e.value===m),b=e=>{var t,g;(t=s.setValue)==null||t.call(s,e),(g=l.change)==null||g.call(l,e),o(!1),i("")},S=e=>{var t;i(e),(t=l.search)==null||t.call(l,e)};return a.jsxs(N,{children:[n&&a.jsx(O,{children:n}),a.jsxs(y,{open:c,onOpenChange:o,children:[a.jsx(w,{asChild:!0,children:a.jsx(P,{variant:"outline",role:"combobox","aria-expanded":c,disabled:v,className:"w-full justify-between font-normal h-7 text-xs",children:h?h.label:a.jsx("span",{className:"text-muted-foreground",children:j})})}),a.jsx(L,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(V,{shouldFilter:!1,children:[a.jsx(k,{placeholder:"Search...",value:C,onValueChange:S}),a.jsxs(E,{children:[a.jsx(F,{children:"No results found."}),a.jsx(I,{children:d.map(e=>a.jsx(M,{value:e.value,onSelect:()=>b(e.value),className:B(e.value===m&&"bg-accent"),children:e.label},e.value))})]})]})})]})]})}G.widgetMeta={name:"link",label:"Link",category:"input",schema:{label:{type:"string"},placeholder:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","search"],container:!1};export{G as LinkWidget};
@@ -0,0 +1 @@
1
+ import{r as f,j as a}from"./vendor-radix-D-Trh8JA.js";import{P as w,a as P,b as B}from"./popover-DywIKFaQ.js";import{L,M as V,j as E,B as F,V as O,Y as R,Z as T,_ as I,$,a0 as k,c as G}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function W({props:c,bind:l,on:t}){var p,x,g;const d=c.label??((p=l.meta)==null?void 0:p.label)??"",j=c.placeholder??"Select...",v=c.disabled??((x=l.meta)==null?void 0:x.readOnly)??!1,[m,y]=f.useState(!1),[C,b]=f.useState(""),h=((g=l.meta)==null?void 0:g.options)??[],r=l.value??[],N=e=>{var n,o;const s=r.includes(e)?r.filter(i=>i!==e):[...r,e];(n=l.setValue)==null||n.call(l,s),(o=t.change)==null||o.call(t,s)},S=e=>{var n,o;const s=r.filter(i=>i!==e);(n=l.setValue)==null||n.call(l,s),(o=t.change)==null||o.call(t,s)},M=e=>{var s;b(e),(s=t.search)==null||s.call(t,e)},u=r.map(e=>h.find(s=>s.value===e)).filter(Boolean);return a.jsxs(L,{children:[d&&a.jsx(V,{children:d}),a.jsxs(w,{open:m,onOpenChange:y,children:[a.jsx(P,{asChild:!0,children:a.jsx(E,{variant:"outline",role:"combobox","aria-expanded":m,disabled:v,className:"w-full justify-start font-normal h-auto min-h-7 text-xs flex-wrap gap-1 py-1",children:u.length>0?u.map(e=>a.jsxs(F,{variant:"secondary",className:"text-xs",children:[e.label,a.jsx("button",{type:"button",className:"ml-1 rounded-full hover:bg-muted",onClick:s=>{s.stopPropagation(),S(e.value)},"aria-label":`Remove ${e.label}`,children:"×"})]},e.value)):a.jsx("span",{className:"text-muted-foreground",children:j})})}),a.jsx(B,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(O,{shouldFilter:!1,children:[a.jsx(R,{placeholder:"Search...",value:C,onValueChange:M}),a.jsxs(T,{children:[a.jsx(I,{children:"No results found."}),a.jsx($,{children:h.map(e=>a.jsx(k,{value:e.value,onSelect:()=>N(e.value),className:G(r.includes(e.value)&&"bg-accent"),children:e.label},e.value))})]})]})})]})]})}W.widgetMeta={name:"many-to-many",label:"Many to Many",category:"input",schema:{label:{type:"string"},placeholder:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","search"],container:!1};export{W as ManyToManyWidget};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-radix-D-Trh8JA.js";import{s as d,G as g,H as u,J as x,K as h}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const b={sm:"sm:max-w-sm",md:"sm:max-w-lg",lg:"sm:max-w-3xl"};function p({props:e,children:i}){const a=e.title??"",o=e.size??"md",l=e.closable??!0,s=e._visibleField,n=d(),m=r=>{if(!r&&l&&s&&s.startsWith("$state.")){const c=s.slice(7);n.set(c,!1)}};return t.jsx(g,{open:!0,onOpenChange:m,children:t.jsxs(u,{className:b[o],showCloseButton:l,children:[a&&t.jsx(x,{children:t.jsx(h,{children:a})}),i]})})}p.widgetMeta={name:"modal",label:"Modal",category:"layout",schema:{size:{type:"enum",options:["sm","md","lg"],default:"md"},title:{type:"string"},closable:{type:"boolean",default:!0}},binding:"none",triggers:[],container:!0};export{p as ModalWidget};
@@ -0,0 +1 @@
1
+ import{r as V,j as s}from"./vendor-radix-D-Trh8JA.js";import{L as b,M as w,k as B}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function C({props:r,bind:t,on:e}){var m,x,f;const u=r.label??((m=t.meta)==null?void 0:m.label)??"",j=r.currency??"$",F=r.disabled??((x=t.meta)==null?void 0:x.readOnly)??!1,N=r.readOnly??((f=t.meta)==null?void 0:f.readOnly)??!1,n=t.error,i=t.value,[o,d]=V.useState(i!=null?i.toFixed(2):""),v=a=>{var y,p,g,h;const l=a.target.value;d(l);const c=parseFloat(l);isNaN(c)?l===""&&((g=t.setValue)==null||g.call(t,null),(h=e.change)==null||h.call(e,null)):((y=t.setValue)==null||y.call(t,c),(p=e.change)==null||p.call(e,c))},M=()=>{var a;(a=e.focus)==null||a.call(e)},O=()=>{var l;const a=parseFloat(o);isNaN(a)||d(a.toFixed(2)),(l=e.blur)==null||l.call(e)};return s.jsxs(b,{children:[u&&s.jsx(w,{children:u}),s.jsxs("div",{className:"flex items-center",children:[s.jsx("span",{className:"inline-flex h-8 items-center border border-r-0 border-input bg-muted px-2 text-xs text-muted-foreground",children:j}),s.jsx(B,{type:"text",inputMode:"decimal",value:o,onChange:v,onFocus:M,onBlur:O,disabled:F,readOnly:N,placeholder:"0.00"})]}),n&&s.jsx("p",{className:"text-xs text-destructive mt-1",children:n})]})}C.widgetMeta={name:"money",label:"Money",category:"input",schema:{label:{type:"string"},currency:{type:"string",default:"$"},disabled:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1}},binding:"field",triggers:["change","focus","blur"],container:!1};export{C as MoneyWidget};
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-radix-D-Trh8JA.js";import{r as g,x,y}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function f({props:e,bind:s,children:m}){const a=g(),l=e.layout??"list",p=e.columns??3,n=e.gap??"md";let i=[];Array.isArray(s.value)?i=s.value:a.records&&(i=a.records);const t={sm:"8px",md:"16px",lg:"24px"},u=l==="grid"?{display:"grid",gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`,gap:t[n]??t.md}:{display:"flex",flexDirection:"column",gap:t[n]??t.md};return o.jsx("div",{style:u,"data-widget":"repeat","data-layout":l,children:i.map((d,r)=>{const c=x(d,r,a);return o.jsx(y,{value:c,children:o.jsx("div",{"data-repeat-index":r,children:m})},d.id??r)})})}f.widgetMeta={name:"repeat",label:"Repeat",category:"data",schema:{layout:{type:"enum",options:["list","grid"],default:"list"},columns:{type:"number",default:3},gap:{type:"enum",options:["sm","md","lg"],default:"md"}},binding:"field",triggers:[],container:!0};export{f as RepeatWidget};
@@ -0,0 +1 @@
1
+ import{j as r,a2 as n,a3 as s,a4 as c,a5 as d,a6 as h}from"./vendor-radix-D-Trh8JA.js";import{c as l}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function u({className:a,children:t,...e}){return r.jsxs(n,{"data-slot":"scroll-area",className:l("relative",a),...e,children:[r.jsx(s,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:t}),r.jsx(m,{}),r.jsx(c,{})]})}function m({className:a,orientation:t="vertical",...e}){return r.jsx(d,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:l("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",a),...e,children:r.jsx(h,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-none bg-border"})})}function x({props:a,children:t}){const e=a.direction??"vertical",o=a.height,i=a.maxHeight;return r.jsx(u,{className:l(e==="horizontal"&&"overflow-x-auto",o&&(o==="100%"?"h-full":`h-[${o}]`),i&&`max-h-[${i}]`),children:t})}x.widgetMeta={name:"scroll-area",label:"Scroll Area",category:"layout",schema:{direction:{type:"enum",options:["vertical","horizontal","both"],default:"vertical"},height:{type:"string"},maxHeight:{type:"string"}},binding:"none",triggers:[],container:!0};export{x as ScrollAreaWidget};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-radix-D-Trh8JA.js";import{L as n,M as r,B as o}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function c({props:l,bind:a}){var s;const t=l.label??((s=a.meta)==null?void 0:s.label)??"",i=a.value;return e.jsxs(n,{children:[t&&e.jsx(r,{children:t}),e.jsx("div",{className:"flex items-center h-7",children:e.jsx(o,{variant:"secondary",className:"font-mono text-xs",children:i||"Auto"})})]})}c.widgetMeta={name:"sequence",label:"Sequence",category:"display",schema:{label:{type:"string"}},binding:"field",triggers:[],container:!1};export{c as SequenceWidget};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-radix-D-Trh8JA.js";import{c as i}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const a={xs:"h-1",sm:"h-2",md:"h-4",lg:"h-6",xl:"h-8"};function r({props:e}){const s=e.size??"md";return t.jsx("div",{className:i(a[s]??"h-4"),"aria-hidden":"true"})}r.widgetMeta={name:"spacer",label:"Spacer",category:"layout",schema:{size:{type:"enum",options:["xs","sm","md","lg","xl"],default:"md"}},binding:"none",triggers:[],container:!1};export{r as SpacerWidget};
@@ -0,0 +1 @@
1
+ var Re=e=>{throw TypeError(e)};var Me=(e,t,n)=>t.has(e)||Re("Cannot "+n);var ae=(e,t,n)=>(Me(e,t,"read from private field"),n?n.call(e):t.get(e)),Ee=(e,t,n)=>t.has(e)?Re("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),De=(e,t,n,o)=>(Me(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);import{r as L,j,R as gt}from"./vendor-radix-D-Trh8JA.js";import{c as be,W as vt}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function mt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function bt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function yt(e){return e/100*window.innerHeight}function zt(e){return e/100*window.innerWidth}function St(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function ie({groupSize:e,panelElement:t,styleProp:n}){let o;const[r,a]=St(n);switch(a){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=bt(t,r);break}case"em":{o=mt(t,r);break}case"vh":{o=yt(r);break}case"vw":{o=zt(r);break}}return o}function T(e){return parseFloat(e.toFixed(3))}function ne({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,r)=>(o+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o),0)}function ve(e){const{panels:t}=e,n=ne({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:r,panelConstraints:a}=o;let l=0;if(a.collapsedSize!==void 0){const c=ie({groupSize:n,panelElement:r,styleProp:a.collapsedSize});l=T(c/n*100)}let s;if(a.defaultSize!==void 0){const c=ie({groupSize:n,panelElement:r,styleProp:a.defaultSize});s=T(c/n*100)}let i=0;if(a.minSize!==void 0){const c=ie({groupSize:n,panelElement:r,styleProp:a.minSize});i=T(c/n*100)}let u=100;if(a.maxSize!==void 0){const c=ie({groupSize:n,panelElement:r,styleProp:a.maxSize});u=T(c/n*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:l,collapsible:a.collapsible===!0,defaultSize:s,disabled:a.disabled,minSize:i,maxSize:u,panelId:o.id}})}function P(e,t="Assertion error"){if(!e)throw Error(t)}function me(e,t){return Array.from(t).sort(e==="horizontal"?xt:wt)}function xt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function wt(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Je(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ue(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Ct({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,a=Number.MAX_VALUE;for(const l of t){const{x:s,y:i}=Ue(o,l),u=e==="horizontal"?s:i;u<a&&(a=u,r=l)}return P(r,"No rect found"),r}let de;function Pt(){return de===void 0&&(typeof matchMedia=="function"?de=!!matchMedia("(pointer:coarse)").matches:de=!1),de}function Ze(e){const{element:t,orientation:n,panels:o,separators:r}=e,a=me(n,Array.from(t.children).filter(Je).map(m=>({element:m}))).map(({element:m})=>m),l=[];let s=!1,i=!1,u=-1,c=-1,h=0,f,S=[];{let m=-1;for(const d of a)d.hasAttribute("data-panel")&&(m++,d.hasAttribute("data-disabled")||(h++,u===-1&&(u=m),c=m))}if(h>1){let m=-1;for(const d of a)if(d.hasAttribute("data-panel")){m++;const g=o.find(p=>p.element===d);if(g){if(f){const p=f.element.getBoundingClientRect(),b=d.getBoundingClientRect();let z;if(i){const y=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),v=n==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(S.length){case 0:{z=[y,v];break}case 1:{const k=S[0],R=Ct({orientation:n,rects:[p,b],targetRect:k.element.getBoundingClientRect()});z=[k,R===p?v:y];break}default:{z=S;break}}}else S.length?z=S:z=[n==="horizontal"?new DOMRect(p.right,b.top,b.left-p.right,b.height):new DOMRect(b.left,p.bottom,b.width,b.top-p.bottom)];for(const y of z){let v="width"in y?y:y.element.getBoundingClientRect();const k=Pt()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(v.width<k){const E=k-v.width;v=new DOMRect(v.x-E/2,v.y,v.width+E,v.height)}if(v.height<k){const E=k-v.height;v=new DOMRect(v.x,v.y-E/2,v.width,v.height+E)}const R=m<=u||m>c;!s&&!R&&l.push({group:e,groupSize:ne({group:e}),panels:[f,g],separator:"width"in y?void 0:y,rect:v}),s=!1}}i=!1,f=g,S=[]}}else if(d.hasAttribute("data-separator")){d.ariaDisabled!==null&&(s=!0);const g=r.find(p=>p.element===d);g?S.push(g):(f=void 0,S=[])}else i=!0}return l}var H;class Ke{constructor(){Ee(this,H,{})}addListener(t,n){const o=ae(this,H)[t];return o===void 0?ae(this,H)[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=ae(this,H)[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,a=null;const l=Array.from(o);for(let s=0;s<l.length;s++){const i=l[s];try{i.call(null,n)}catch(u){a===null&&(r=!0,a=u)}}if(r)throw a}}removeAllListeners(){De(this,H,{})}removeListener(t,n){const o=ae(this,H)[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}H=new WeakMap;let A=new Map;const Qe=new Ke;function Lt(e){A=new Map(A),A.delete(e)}function Ie(e,t){for(const[n]of A)if(n.id===e)return n}function V(e,t){for(const[n,o]of A)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function U(){return A}function ye(e,t){return Qe.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function W(e,t){const n=A.get(e);A=new Map(A),A.set(e,t),Qe.emit("groupChange",{group:e,prev:n,next:t})}function kt(e,t,n){let o,r={x:1/0,y:1/0};for(const a of t){const l=Ue(n,a.rect);switch(e){case"horizontal":{l.x<=r.x&&(o=a,r=l);break}case"vertical":{l.y<=r.y&&(o=a,r=l);break}}}return o?{distance:r,hitRegion:o}:void 0}function Rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Mt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ne(e),b:Ne(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();P(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:je(Te(n.a)),b:je(Te(n.b))};if(r.a===r.b){const a=o.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let s=a.length;for(;s--;){const i=a[s];if(i===l.a)return 1;if(i===l.b)return-1}}return Math.sign(r.a-r.b)}const Et=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Dt(e){const t=getComputedStyle(_e(e)??e).display;return t==="flex"||t==="inline-flex"}function It(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Dt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Et.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Te(e){let t=e.length;for(;t--;){const n=e[t];if(P(n,"Missing node"),It(n))return n}return null}function je(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ne(e){const t=[];for(;e;)t.push(e),e=_e(e);return t}function _e(e){const{parentNode:t}=e;return Rt(t)?t.host:t}function Tt(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function jt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Je(n)||n.contains(e)||e.contains(n))return!0;if(Mt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Tt(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function ze(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const a=Ze(r),l=kt(r.orientation,a,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&jt({groupElement:r.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function Nt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function I(e,t,n=0){return Math.abs(T(e)-T(t))<=n}function F(e,t){return I(e,t)?0:e>t?1:-1}function _({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsible:a,disabled:l,maxSize:s=100,minSize:i=0}=t;if(l&&!e)return n;if(F(o,i)<0)if(a){const u=(r+i)/2;F(o,u)<0?o=r:o=i}else o=i;return o=Math.min(s,o),o=T(o),o}function le({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:a}){if(I(e,0))return t;const l=a==="imperative-api",s=Object.values(t),i=Object.values(r),u=[...s],[c,h]=o;P(c!=null,"Invalid first pivot index"),P(h!=null,"Invalid second pivot index");let f=0;switch(a){case"keyboard":{{const d=e<0?h:c,g=n[d];P(g,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:z=0}=g;if(b){const y=s[d];if(P(y!=null,`Previous layout not found for panel index ${d}`),I(y,p)){const v=z-y;F(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}{const d=e<0?c:h,g=n[d];P(g,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:z=0}=g;if(b){const y=s[d];if(P(y!=null,`Previous layout not found for panel index ${d}`),I(y,z)){const v=y-p;F(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}break}default:{const d=e<0?h:c,g=n[d];P(g,`Panel constraints not found for index ${d}`);const p=s[d],{collapsible:b,collapsedSize:z,minSize:y}=g;if(b&&F(p,y)<0)if(e>0){const v=y-z,k=v/2,R=p+e;F(R,y)<0&&(e=F(e,k)<=0?0:v)}else{const v=y-z,k=100-v/2,R=p-e;F(R,y)<0&&(e=F(100+e,k)>0?0:-v)}break}}{const d=e<0?1:-1;let g=e<0?h:c,p=0;for(;;){const z=s[g];P(z!=null,`Previous layout not found for panel index ${g}`);const y=_({overrideDisabledPanels:l,panelConstraints:n[g],prevSize:z,size:100})-z;if(p+=y,g+=d,g<0||g>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-b:b}{let d=e<0?c:h;for(;d>=0&&d<n.length;){const g=Math.abs(e)-Math.abs(f),p=s[d];P(p!=null,`Previous layout not found for panel index ${d}`);const b=p-g,z=_({overrideDisabledPanels:l,panelConstraints:n[d],prevSize:p,size:b});if(!I(p,z)&&(f+=p-z,u[d]=z,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(Nt(i,u))return r;{const d=e<0?h:c,g=s[d];P(g!=null,`Previous layout not found for panel index ${d}`);const p=g+f,b=_({overrideDisabledPanels:l,panelConstraints:n[d],prevSize:g,size:p});if(u[d]=b,!I(b,p)){let z=p-b,y=e<0?h:c;for(;y>=0&&y<n.length;){const v=u[y];P(v!=null,`Previous layout not found for panel index ${y}`);const k=v+z,R=_({overrideDisabledPanels:l,panelConstraints:n[y],prevSize:v,size:k});if(I(v,R)||(z-=R-v,u[y]=R),I(z,0))break;e>0?y--:y++}}}const S=Object.values(u).reduce((d,g)=>g+d,0);if(!I(S,100,.1))return r;const m=Object.keys(r);return u.reduce((d,g,p)=>(d[m[p]]=g,d),{})}function X(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||F(e[n],t[n])!==0)return!1;return!0}function q({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],r=o.reduce((s,i)=>s+i,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(s=>`${s}%`).join(", ")}`);if(!I(r,100)&&o.length>0)for(let s=0;s<t.length;s++){const i=o[s];P(i!=null,`No layout data found for index ${s}`);const u=100/r*i;o[s]=u}let a=0;for(let s=0;s<t.length;s++){const i=n[s];P(i!=null,`No layout data found for index ${s}`);const u=o[s];P(u!=null,`No layout data found for index ${s}`);const c=_({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:i,size:u});u!=c&&(a+=u-c,o[s]=c)}if(!I(a,0))for(let s=0;s<t.length;s++){const i=o[s];P(i!=null,`No layout data found for index ${s}`);const u=i+a,c=_({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:i,size:u});if(i!==c&&(a-=c-i,o[s]=c,I(a,0)))break}const l=Object.keys(e);return o.reduce((s,i,u)=>(s[l[u]]=i,s),{})}function et({groupId:e,panelId:t}){const n=()=>{const i=U();for(const[u,{defaultLayoutDeferred:c,derivedPanelConstraints:h,layout:f,groupSize:S,separatorToPanels:m}]of i)if(u.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:u,groupSize:S,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},o=()=>{const i=n().derivedPanelConstraints.find(u=>u.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const i=n().group.panels.find(u=>u.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},l=({nextSize:i,panels:u,prevLayout:c,derivedPanelConstraints:h})=>{const f=a(),S=u.findIndex(g=>g.id===t),m=S===0,d=S===u.length-1;if(d&&i<f&&(m||u.slice(0,S).every((g,p)=>{const b=h[p];return(b==null?void 0:b.collapsible)&&I(b.collapsedSize,c[b.panelId])}))){const g=u.slice(0,S).reduce((p,b)=>p+c[b.id],0);return{...c,[t]:T(100-g)}}return le({delta:d?f-i:i-f,initialLayout:c,panelConstraints:h,pivotIndices:d?[S-1,S]:[S,S+1],prevLayout:c,trigger:"imperative-api"})},s=i=>{const u=a();if(i===u)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:f,groupSize:S,layout:m,separatorToPanels:d}=n(),g=l({nextSize:i,panels:f.panels,prevLayout:m,derivedPanelConstraints:h}),p=q({layout:g,panelConstraints:h});X(m,p)||W(f,{defaultLayoutDeferred:c,derivedPanelConstraints:h,groupSize:S,layout:p,separatorToPanels:d})};return{collapse:()=>{const{collapsible:i,collapsedSize:u}=o(),{mutableValues:c}=r(),h=a();i&&h!==u&&(c.expandToSize=h,s(u))},expand:()=>{const{collapsible:i,collapsedSize:u,minSize:c}=o(),{mutableValues:h}=r(),f=a();if(i&&f===u){let S=h.expandToSize??c;S===0&&(S=1),s(S)}},getSize:()=>{const{group:i}=n(),u=a(),{element:c}=r(),h=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:u,inPixels:h}},isCollapsed:()=>{const{collapsible:i,collapsedSize:u}=o(),c=a();return i&&I(u,c)},resize:i=>{const{group:u}=n(),{element:c}=r(),h=ne({group:u}),f=ie({groupSize:h,panelElement:c,styleProp:i}),S=T(f/h*100);s(S)}}}function Oe(e){if(e.defaultPrevented)return;const t=U();ze(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const o=n.panels.find(r=>r.panelConstraints.defaultSize!==void 0);if(o){const r=o.panelConstraints.defaultSize,a=et({groupId:n.group.id,panelId:o.id});a&&r!==void 0&&(a.resize(r),e.preventDefault())}}})}function pe(e){const t=U();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function tt({groupId:e}){const t=()=>{const n=U();for(const[o,r]of n)if(o.id===e)return{group:o,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:r,group:a,groupSize:l,layout:s,separatorToPanels:i}=t(),u=q({layout:n,panelConstraints:r});return o?s:(X(s,u)||W(a,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:l,layout:u,separatorToPanels:i}),u)}}}function Y(e,t){const n=pe(e),o=V(n.id,!0),r=n.separators.find(c=>c.element===e);P(r,"Matching separator not found");const a=o.separatorToPanels.get(r);P(a,"Matching panels not found");const l=a.map(c=>n.panels.indexOf(c)),s=tt({groupId:n.id}).getLayout(),i=le({delta:t,initialLayout:s,panelConstraints:o.derivedPanelConstraints,pivotIndices:l,prevLayout:s,trigger:"keyboard"}),u=q({layout:i,panelConstraints:o.derivedPanelConstraints});X(s,u)||W(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:u,separatorToPanels:o.separatorToPanels})}function Fe(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=pe(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Y(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Y(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Y(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Y(t,-5);break}case"End":{e.preventDefault(),Y(t,100);break}case"Enter":{e.preventDefault();const o=pe(t),r=V(o.id,!0),{derivedPanelConstraints:a,layout:l,separatorToPanels:s}=r,i=o.separators.find(f=>f.element===t);P(i,"Matching separator not found");const u=s.get(i);P(u,"Matching panels not found");const c=u[0],h=a.find(f=>f.panelId===c.id);if(P(h,"Panel metadata not found"),h.collapsible){const f=l[c.id],S=h.collapsedSize===f?o.mutableState.expandedPanelSizes[c.id]??h.minSize:h.collapsedSize;Y(t,S-f)}break}case"F6":{e.preventDefault();const o=pe(t).separators.map(l=>l.element),r=Array.from(o).findIndex(l=>l===e.currentTarget);P(r!==null,"Index not found");const a=e.shiftKey?r>0?r-1:o.length-1:r+1<o.length?r+1:0;o[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Y(t,-100);break}}}let ee={cursorFlags:0,state:"inactive"};const Se=new Ke;function J(){return ee}function Ot(e){return Se.addListener("change",e)}function Ft(e){const t=ee,n={...ee};n.cursorFlags=e,ee=n,Se.emit("change",{prev:t,next:n})}function te(e){const t=ee;ee=e,Se.emit("change",{prev:t,next:e})}function Ae(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=U(),n=ze(e,t),o=new Map;let r=!1;n.forEach(a=>{a.separator&&(r||(r=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=t.get(a.group);l&&o.set(a.group,l.layout)}),te({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const At=e=>e,ge=()=>{},nt=1,ot=2,rt=4,at=8,$e=3,Ge=12;let fe;function We(){return fe===void 0&&(fe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(fe=!0)),fe}function $t({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&We()){const a=(e&nt)!==0,l=(e&ot)!==0,s=(e&rt)!==0,i=(e&at)!==0;if(a)return s?"se-resize":i?"ne-resize":"e-resize";if(l)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}break}}return We()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Be=new WeakMap;function xe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Be.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=J();switch(o.state){case"active":case"hover":{const r=$t({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(l=>l.group),state:o.state}),a=`*, *:hover {cursor: ${r} !important; }`;if(t===a)return;t=a,r?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Be.set(e,{prevStyle:t,styleSheet:n})}function it({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:r,pointerDownAtPoint:a,prevCursorFlags:l}){let s=0;n.forEach(u=>{const{group:c,groupSize:h}=u,{orientation:f,panels:S}=c,{disableCursor:m}=c.mutableState;let d=0;a?f==="horizontal"?d=(t.clientX-a.x)/h*100:d=(t.clientY-a.y)/h*100:f==="horizontal"?d=t.clientX<0?-100:100:d=t.clientY<0?-100:100;const g=o.get(c),p=r.get(c);if(!g||!p)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:z,groupSize:y,layout:v,separatorToPanels:k}=p;if(z&&v&&k){const R=le({delta:d,initialLayout:g,panelConstraints:z,pivotIndices:u.panels.map(E=>S.indexOf(E)),prevLayout:v,trigger:"mouse-or-touch"});if(X(R,v)){if(d!==0&&!m)switch(f){case"horizontal":{s|=d<0?nt:ot;break}case"vertical":{s|=d<0?rt:at;break}}}else W(u.group,{defaultLayoutDeferred:b,derivedPanelConstraints:z,groupSize:y,layout:R,separatorToPanels:k})}});let i=0;t.movementX===0?i|=l&$e:i|=s&$e,t.movementY===0?i|=l&Ge:i|=s&Ge,Ft(i),xe(e)}function He(e){const t=U(),n=J();switch(n.state){case"active":it({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ve(e){var o,r;if(e.defaultPrevented)return;const t=J(),n=U();switch(t.state){case"active":{if(e.buttons===0){te({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(a=>{const l=V(a.group.id,!0);W(a.group,l)});return}for(const a of t.hitRegions)if(a.separator){const{element:l}=a.separator;(o=l.hasPointerCapture)!=null&&o.call(l,e.pointerId)||((r=l.setPointerCapture)==null||r.call(l,e.pointerId))}it({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const a=ze(e,n);a.length===0?t.state!=="inactive"&&te({cursorFlags:0,state:"inactive"}):te({cursorFlags:0,hitRegions:a,state:"hover"}),xe(e.currentTarget);break}}}function Ye(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(J().state){case"hover":te({cursorFlags:0,state:"inactive"})}}function Xe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=J();switch(t.state){case"active":te({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(xe(e.currentTarget),t.hitRegions.forEach(n=>{const o=V(n.group.id,!0);W(n.group,o)}),e.preventDefault())}}function qe(e){let t=0,n=0;const o={};for(const a of e)if(a.defaultSize!==void 0){t++;const l=T(a.defaultSize);n+=l,o[a.panelId]=l}else o[a.panelId]=void 0;const r=e.length-t;if(r!==0){const a=T((100-n)/r);for(const l of e)l.defaultSize===void 0&&(o[l.panelId]=a)}return o}function Gt(e,t,n){if(!n[0])return;const o=e.panels.find(i=>i.element===t);if(!o||!o.onResize)return;const r=ne({group:e}),a=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,l=o.mutableValues.prevSize,s={asPercentage:T(a/r*100),inPixels:a};o.mutableValues.prevSize=s,o.onResize(s,o.id,l)}function Wt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Bt({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,a=0,l=!1;const s=new Map,i=[];for(const h of e.panels){const f=o[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const S=f/100*n,m=T(S/t*100);s.set(h.id,m),r+=m;break}case"preserve-relative-size":default:{i.push(h.id),a+=f;break}}}if(!l||i.length===0)return o;const u=100-r,c={...o};if(s.forEach((h,f)=>{c[f]=h}),a>0)for(const h of i){const f=o[h]??0;c[h]=T(f/a*u)}else{const h=T(u/i.length);for(const f of i)c[f]=h}return c}function Ht(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}const Q=new Map;function Vt(e){let t=!0;P(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,a=new n(m=>{for(const d of m){const{borderBoxSize:g,target:p}=d;if(p===e.element){if(t){const b=ne({group:e});if(b===0)return;const z=V(e.id);if(!z)return;const y=ve(e),v=z.defaultLayoutDeferred?qe(y):z.layout,k=Bt({group:e,nextGroupSize:b,prevGroupSize:z.groupSize,prevLayout:v}),R=q({layout:k,panelConstraints:y});if(!z.defaultLayoutDeferred&&X(z.layout,R)&&Wt(z.derivedPanelConstraints,y)&&z.groupSize===b)return;W(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:y,groupSize:b,layout:R,separatorToPanels:z.separatorToPanels})}}else Gt(e,p,g)}});a.observe(e.element),e.panels.forEach(m=>{P(!o.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.onResize&&a.observe(m.element)});const l=ne({group:e}),s=ve(e),i=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(Ht(e.panels,u)||(u=void 0));const c=e.mutableState.layouts[i]??u??qe(s),h=q({layout:c,panelConstraints:s}),f=e.element.ownerDocument;Q.set(f,(Q.get(f)??0)+1);const S=new Map;return Ze(e).forEach(m=>{m.separator&&S.set(m.separator,m.panels)}),W(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:s,groupSize:l,layout:h,separatorToPanels:S}),e.separators.forEach(m=>{P(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",Fe)}),Q.get(f)===1&&(f.addEventListener("dblclick",Oe,!0),f.addEventListener("pointerdown",Ae,!0),f.addEventListener("pointerleave",He),f.addEventListener("pointermove",Ve),f.addEventListener("pointerout",Ye),f.addEventListener("pointerup",Xe,!0)),function(){t=!1,Q.set(f,Math.max(0,(Q.get(f)??0)-1)),Lt(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",Fe)}),Q.get(f)||(f.removeEventListener("dblclick",Oe,!0),f.removeEventListener("pointerdown",Ae,!0),f.removeEventListener("pointerleave",He),f.removeEventListener("pointermove",Ve),f.removeEventListener("pointerout",Ye),f.removeEventListener("pointerup",Xe,!0)),a.disconnect()}}function Yt(){const[e,t]=L.useState({}),n=L.useCallback(()=>t({}),[]);return[e,n]}function we(e){const t=L.useId();return`${e??t}`}const Z=typeof window<"u"?L.useLayoutEffect:L.useEffect;function se(e){const t=L.useRef(e);return Z(()=>{t.current=e},[e]),L.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[t])}function Ce(...e){return se(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Pe(e){const t=L.useRef({...e});return Z(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const st=L.createContext(null);function Xt(e,t){const n=L.useRef({getLayout:()=>({}),setLayout:At});L.useImperativeHandle(t,()=>n.current,[]),Z(()=>{Object.assign(n.current,tt({groupId:e}))})}function lt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:a,groupRef:l,id:s,onLayoutChange:i,onLayoutChanged:u,orientation:c="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...S}){const m=L.useRef({onLayoutChange:{},onLayoutChanged:{}}),d=se(x=>{X(m.current.onLayoutChange,x)||(m.current.onLayoutChange=x,i==null||i(x))}),g=se(x=>{X(m.current.onLayoutChanged,x)||(m.current.onLayoutChanged=x,u==null||u(x))}),p=we(s),b=L.useRef(null),[z,y]=Yt(),v=L.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),k=Ce(b,a);Xt(p,l);const R=se((x,w)=>{const M=J(),C=Ie(x),D=V(x);if(D){let N=!1;switch(M.state){case"active":{N=M.hitRegions.some(oe=>oe.group===C);break}}return{flexGrow:D.layout[w]??1,pointerEvents:N?"none":void 0}}if(n!=null&&n[w])return{flexGrow:n==null?void 0:n[w]}}),E=Pe({defaultLayout:n,disableCursor:o}),O=L.useMemo(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:R,id:p,orientation:c,registerPanel:x=>{const w=v.current;return w.panels=me(c,[...w.panels,x]),y(),()=>{w.panels=w.panels.filter(M=>M!==x),y()}},registerSeparator:x=>{const w=v.current;return w.separators=me(c,[...w.separators,x]),y(),()=>{w.separators=w.separators.filter(M=>M!==x),y()}},updatePanelProps:(x,{disabled:w})=>{const M=v.current.panels.find(N=>N.id===x);M&&(M.panelConstraints.disabled=w);const C=Ie(p),D=V(p);C&&D&&W(C,{...D,derivedPanelConstraints:ve(C)})},updateSeparatorProps:(x,{disabled:w,disableDoubleClick:M})=>{const C=v.current.separators.find(D=>D.id===x);C&&(C.disabled=w,C.disableDoubleClick=M)}}),[R,p,y,c,E]),$=L.useRef(null);return Z(()=>{const x=b.current;if(x===null)return;const w=v.current;let M;if(E.defaultLayout!==void 0&&Object.keys(E.defaultLayout).length===w.panels.length){M={};for(const B of w.panels){const K=E.defaultLayout[B.id];K!==void 0&&(M[B.id]=K)}}const C={disabled:!!r,element:x,id:p,mutableState:{defaultLayout:M,disableCursor:!!E.disableCursor,expandedPanelSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:c,panels:w.panels,resizeTargetMinimumSize:w.resizeTargetMinimumSize,separators:w.separators};$.current=C;const D=Vt(C),{defaultLayoutDeferred:N,derivedPanelConstraints:oe,layout:ue}=V(C.id,!0);!N&&oe.length>0&&(d(ue),g(ue));const re=ye(p,B=>{const{defaultLayoutDeferred:K,derivedPanelConstraints:ke,layout:ce}=B.next;if(K||ke.length===0)return;const dt=C.panels.map(({id:G})=>G).join(",");C.mutableState.layouts[dt]=ce,ke.forEach(G=>{if(G.collapsible){const{layout:he}=B.prev??{};if(he){const pt=I(G.collapsedSize,ce[G.panelId]),ht=I(G.collapsedSize,he[G.panelId]);pt&&!ht&&(C.mutableState.expandedPanelSizes[G.panelId]=he[G.panelId])}}});const ft=J().state!=="active";d(ce),ft&&g(ce)});return()=>{$.current=null,D(),re()}},[r,p,g,d,c,z,E]),L.useEffect(()=>{const x=$.current;x&&(x.mutableState.defaultLayout=n,x.mutableState.disableCursor=!!o)}),j.jsx(st.Provider,{value:O,children:j.jsx("div",{...S,className:t,"data-group":!0,"data-testid":p,id:p,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}lt.displayName="Group";function Le(){const e=L.useContext(st);return P(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function qt(e,t){const{id:n}=Le(),o=L.useRef({collapse:ge,expand:ge,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ge});L.useImperativeHandle(t,()=>o.current,[]),Z(()=>{Object.assign(o.current,et({groupId:n,panelId:e}))})}function ut({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:r,disabled:a,elementRef:l,groupResizeBehavior:s="preserve-relative-size",id:i,maxSize:u="100%",minSize:c="0%",onResize:h,panelRef:f,style:S,...m}){const d=!!i,g=we(i),p=Pe({disabled:a}),b=L.useRef(null),z=Ce(b,l),{getPanelStyles:y,id:v,orientation:k,registerPanel:R,updatePanelProps:E}=Le(),O=h!==null,$=se((C,D,N)=>{h==null||h(C,i,N)});Z(()=>{const C=b.current;if(C!==null){const D={element:C,id:g,idIsStable:d,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:O?$:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:o,defaultSize:r,disabled:p.disabled,maxSize:u,minSize:c}};return R(D)}},[s,n,o,r,O,g,d,u,c,$,R,p]),L.useEffect(()=>{E(g,{disabled:a})},[a,g,E]),qt(g,f);const x=()=>{const C=y(v,g);if(C)return JSON.stringify(C)},w=L.useSyncExternalStore(C=>ye(v,C),x,x);let M;return w?M=JSON.parse(w):r!==void 0?M={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:M={flexGrow:1},j.jsx("div",{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:z,style:{...Jt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...M},children:j.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:e})})}ut.displayName="Panel";const Jt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ut({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,a;const l=e[n],s=t.find(i=>i.panelId===n);if(s){const i=s.maxSize,u=s.collapsible?s.collapsedSize:s.minSize,c=[o,o+1];a=q({layout:le({delta:u-l,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=q({layout:le({delta:i-l,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:a,valueNow:l}}function ct({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:a,style:l,...s}){const i=we(a),u=Pe({disabled:n,disableDoubleClick:o}),[c,h]=L.useState({}),[f,S]=L.useState("inactive"),[m,d]=L.useState(!1),g=L.useRef(null),p=Ce(g,r),{disableCursor:b,id:z,orientation:y,registerSeparator:v,updateSeparatorProps:k}=Le(),R=y==="horizontal"?"vertical":"horizontal";Z(()=>{const $=g.current;if($!==null){const x={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:$,id:i},w=v(x),M=Ot(D=>{S(D.next.state!=="inactive"&&D.next.hitRegions.some(N=>N.separator===x)?D.next.state:"inactive")}),C=ye(z,D=>{const{derivedPanelConstraints:N,layout:oe,separatorToPanels:ue}=D.next,re=ue.get(x);if(re){const B=re[0],K=re.indexOf(B);h(Ut({layout:oe,panelConstraints:N,panelId:B.id,panelIndex:K}))}});return()=>{M(),C(),w()}}},[z,i,v,u]),L.useEffect(()=>{k(i,{disabled:n,disableDoubleClick:o})},[n,o,i,k]);let E;n&&!b&&(E="not-allowed");let O;if(n)O="disabled";else switch(f){case"active":{O="active";break}default:m?O="focus":O=f}return j.jsx("div",{...s,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":R,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":O,"data-testid":i,id:i,onBlur:()=>d(!1),onFocus:()=>d(!0),ref:p,role:"separator",style:{flexBasis:"auto",cursor:E,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}ct.displayName="Separator";function Zt({className:e,...t}){return j.jsx(lt,{"data-slot":"resizable-panel-group",className:be("flex h-full w-full aria-[orientation=vertical]:flex-col",e),...t})}function Kt({...e}){return j.jsx(ut,{"data-slot":"resizable-panel",...e})}function Qt({withHandle:e,className:t,...n}){return j.jsx(ct,{"data-slot":"resizable-handle",className:be("relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&j.jsx("div",{className:"z-10 flex h-6 w-1 shrink-0 rounded-none bg-border"})})}const _t={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"};function en({props:e,childNodes:t}){const n=e.sizes,o=e.direction??"horizontal",r=e.minSize??10,a=e.padding,l=t??[];return j.jsx(Zt,{orientation:o,className:be("h-full w-full",a&&_t[a]),children:l.map((s,i)=>j.jsxs(gt.Fragment,{children:[i>0&&j.jsx(Qt,{withHandle:!0}),j.jsx(Kt,{defaultSize:(n==null?void 0:n[i])??100/l.length,minSize:r,children:j.jsx(vt,{node:s})})]},s.id??i))})}en.widgetMeta={name:"split",label:"Split",category:"layout",schema:{sizes:{type:"array"},direction:{type:"enum",options:["horizontal","vertical"],default:"horizontal"},minSize:{type:"number",default:10},padding:{type:"enum",options:["none","xs","sm","md","lg","xl","2xl"]}},binding:"none",triggers:[],container:!0};export{en as SplitWidget};
@@ -0,0 +1 @@
1
+ import{j as i}from"./vendor-radix-D-Trh8JA.js";import{c as o}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";const p={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"};function s({props:e,children:a}){const t=e.height??"auto",n=e.padding;return i.jsx("div",{className:o("relative",t==="auto"?"h-auto":t==="100%"?"h-full":`h-[${t}]`,n&&p[n]),children:a})}s.widgetMeta={name:"stack",label:"Stack",category:"layout",schema:{height:{type:"string",default:"auto"},padding:{type:"enum",options:["none","xs","sm","md","lg","xl","2xl"]}},binding:"none",triggers:[],container:!0};export{s as StackWidget};
@@ -0,0 +1 @@
1
+ import{j as e,r as y,R as L}from"./vendor-radix-D-Trh8JA.js";import{c as W,i as R,X as O,B as D,u as A,j as q,F as U,k as G,l as I,m as H,n as K,o as B,p as T,q as F,r as Q,s as X,t as J,v as Y,w as Z,x as ee,y as te}from"./index-D1wStSrO.js";import{u as se}from"./useSurfaceContext-kzu9770H.js";import{P as ae,a as ne,b as le}from"./popover-DywIKFaQ.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function P({className:t,...s}){return e.jsx("div",{"data-slot":"skeleton",className:W("animate-pulse rounded-none bg-muted",t),...s})}const E=[{value:"like",label:"Contains",needsValue:!0},{value:"eq",label:"Equals",needsValue:!0},{value:"neq",label:"Not equals",needsValue:!0},{value:"empty",label:"Empty",needsValue:!1},{value:"not_empty",label:"Not empty",needsValue:!1}],re=[{value:"eq",label:"Equals",needsValue:!0},{value:"neq",label:"Not equals",needsValue:!0},{value:"gt",label:"Greater than",needsValue:!0},{value:"gte",label:"Greater or equal",needsValue:!0},{value:"lt",label:"Less than",needsValue:!0},{value:"lte",label:"Less or equal",needsValue:!0},{value:"empty",label:"Empty",needsValue:!1},{value:"not_empty",label:"Not empty",needsValue:!1}],ie=[{value:"eq",label:"Equals",needsValue:!0},{value:"gt",label:"After",needsValue:!0},{value:"gte",label:"On or after",needsValue:!0},{value:"lt",label:"Before",needsValue:!0},{value:"lte",label:"On or before",needsValue:!0},{value:"empty",label:"Empty",needsValue:!1},{value:"not_empty",label:"Not empty",needsValue:!1}],oe=[{value:"eq",label:"Is true",needsValue:!1},{value:"neq",label:"Is false",needsValue:!1}],ce=[{value:"eq",label:"Equals",needsValue:!0},{value:"neq",label:"Not equals",needsValue:!0}];function _(t){switch(t){case"string":case"text":return E;case"int":case"decimal":case"money":return re;case"date":case"datetime":return ie;case"boolean":return oe;case"enum":return ce;default:return E}}function de(t){return t==="string"||t==="text"?"like":"eq"}function ue(t){switch(t){case"eq":return"=";case"neq":return"≠";case"gt":return">";case"gte":return"≥";case"lt":return"<";case"lte":return"≤";case"like":return"≈";case"empty":return"is empty";case"not_empty":return"is not empty";default:return"="}}function pe(t,s,n){const r=`$filter.${s}.`,i=[];for(const l of t.keys()){if(!l.startsWith(r))continue;const u=t.get(l);if(u==null)continue;const d=l.slice(r.length);let f="eq",m=d;const a=d.match(/__(\w+)$/);a&&(f=a[1],m=d.slice(0,-a[0].length));const v=M(n,m),b=f==="empty"||f==="not_empty"?"":String(u);i.push({key:l,field:m,operator:f,label:v,displayValue:b})}return i}function M(t,s){var r;const n=t.find(i=>{var l;return((l=i.bind)==null?void 0:l.field)===s});return String(((r=n==null?void 0:n.props)==null?void 0:r.label)??s)}function xe({model:t,store:s,columns:n,hasSearch:r,hasFilters:i}){const[l,u]=y.useState(()=>{const a=s.get(`$search.${t}`);return a?String(a):""}),d=L.useRef(null),f=y.useCallback(a=>{u(a),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{s.set(`$search.${t}`,a||null),s.set(`$page.${t}`,1)},300)},[t,s]),m=pe(s,t,n);return e.jsxs("div",{className:"flex flex-col border-b border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 py-2",children:[r&&e.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("input",{type:"text",value:l,onChange:a=>f(a.target.value),placeholder:"Search...",className:"flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground"}),l&&e.jsx("button",{className:"rounded-sm p-0.5 hover:bg-muted",onClick:()=>f(""),"aria-label":"Clear search",children:e.jsx(O,{className:"h-3 w-3 text-muted-foreground"})})]}),i&&e.jsx(fe,{columns:n,model:t,store:s})]}),m.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 px-5 pb-2",children:m.map(a=>e.jsxs(D,{variant:"secondary",className:"gap-1 pr-1",children:[e.jsxs("span",{className:"text-xs",children:[a.label," ",ue(a.operator)," ",a.displayValue]}),e.jsx("button",{className:"ml-1 rounded-sm p-0.5 hover:bg-muted",onClick:()=>{s.set(a.key,null),s.set(`$page.${t}`,1)},"aria-label":`Remove ${a.label} filter`,children:e.jsx(O,{className:"h-3 w-3"})})]},a.key))})]})}function fe({columns:t,model:s,store:n}){const[r,i]=y.useState(!1),[l,u]=y.useState(null),[d,f]=y.useState(""),[m,a]=y.useState(""),[v,b]=y.useState(""),{modelMeta:p}=A(s),g=y.useCallback(o=>{const c=p==null?void 0:p.fields.find(x=>x.name===o);return(c==null?void 0:c.type)??"string"},[p]),h=y.useMemo(()=>{if(!v)return t.filter(c=>{var x;return(x=c.bind)==null?void 0:x.field});const o=v.toLowerCase();return t.filter(c=>{var j,C;return(j=c.bind)!=null&&j.field?String(((C=c.props)==null?void 0:C.label)??c.bind.field).toLowerCase().includes(o):!1})},[t,v]),k=o=>{u(o),f(de(g(o))),a(""),b("")},N=()=>{if(!l)return;const c=_(g(l)).find(z=>z.value===d);if(!c||c.needsValue&&!m)return;const x=d==="eq"?"":`__${d}`,j=`$filter.${s}.${l}${x}`;let C=m;d==="empty"||d==="not_empty"||d==="eq"&&g(l)==="boolean"?C="true":d==="neq"&&g(l)==="boolean"&&(C="false"),n.set(j,C),n.set(`$page.${s}`,1),i(!1),u(null),f(""),a("")},$=()=>{u(null),f(""),a("")},w=o=>{i(o),o||(u(null),f(""),a(""),b(""))},V=l?_(g(l)):[],S=V.find(o=>o.value===d);return e.jsxs(ae,{open:r,onOpenChange:w,children:[e.jsx(ne,{asChild:!0,children:e.jsxs(q,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs shrink-0",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(le,{className:"w-56 p-0",align:"end",children:l?e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"px-2.5 pt-2.5 pb-2",children:e.jsx("p",{className:"text-xs font-semibold",children:M(t,l)})}),e.jsxs("div",{className:"flex flex-col gap-2 px-2.5 pb-2.5",children:[e.jsx("select",{value:d,onChange:o=>{f(o.target.value),a("")},className:"h-7 w-full rounded-none border border-border bg-transparent px-2 text-xs outline-none focus:border-ring",children:V.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value))}),(S==null?void 0:S.needsValue)&&e.jsx(G,{value:m,onChange:o=>a(o.target.value),placeholder:"Value...",className:"h-7 text-xs",onKeyDown:o=>{o.key==="Enter"&&N()},autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border/50 px-2.5 py-2",children:[e.jsx(q,{variant:"ghost",size:"xs",onClick:$,children:"Back"}),e.jsx(q,{variant:"default",size:"xs",onClick:N,disabled:S!=null&&S.needsValue?!m:!1,children:"Apply"})]})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-2.5 py-2",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("input",{type:"text",value:v,onChange:o=>b(o.target.value),placeholder:"Search fields...",className:"flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col py-1 max-h-48 overflow-auto",children:[h.map(o=>{var x,j;const c=(x=o.bind)==null?void 0:x.field;return c?e.jsx("button",{className:"px-2.5 py-1.5 text-left text-xs hover:bg-muted transition-colors",onClick:()=>k(c),children:String(((j=o.props)==null?void 0:j.label)??c)},c):null}),h.length===0&&e.jsx("p",{className:"px-2.5 py-1.5 text-xs text-muted-foreground",children:"No fields found"})]})]})})]})}function me({page:t,pageSize:s,total:n,recordCount:r,onPageChange:i}){const l=(t-1)*s+1,u=n!=null?Math.min(t*s,n):l+r-1,d=t>1,f=n!=null?u<n:r>=s;return e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-5 py-2.5 text-sm",children:[e.jsx("span",{className:"text-muted-foreground tabular-nums",children:n!=null?`Showing ${l}–${u} of ${n}`:`Page ${t}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(q,{variant:"outline",size:"icon-sm",disabled:!d,onClick:()=>i(t-1),"aria-label":"Previous page",children:e.jsx(I,{className:"h-4 w-4"})}),e.jsx(q,{variant:"outline",size:"icon-sm",disabled:!f,onClick:()=>i(t+1),"aria-label":"Next page",children:e.jsx(H,{className:"h-3.5 w-3.5"})})]})]})}function be({node:t,rowCtx:s}){const n=K(t.type);if(!n)return e.jsx("span",{"data-widget-error":`Unknown: ${t.type}`});const r=n.component,i=B(s),l=ge(t.props,i),u=ve(t,s);return e.jsx(r,{props:l,bind:{value:u,setValue:void 0,meta:void 0},on:{},context:{record:s.record,model:s.model,mode:s.mode,index:s.index}})}function he({col:t,row:s}){var i;const n=(i=t.bind)==null?void 0:i.field;if(!n)return null;const r=s[n];return e.jsx(e.Fragment,{children:r!=null?String(r):""})}function ge(t,s){if(!t)return{};const n={};for(const[r,i]of Object.entries(t))if(typeof i=="string"&&i.includes("{{")){const l=i.trim();if(l.startsWith("{{")&&l.endsWith("}}")&&!l.slice(2,-2).includes("{{")){const u=T(l);n[r]=F(u,s)}else n[r]=i.replace(/\{\{(.+?)\}\}/g,(u,d)=>{const f=T(d.trim());return String(F(f,s)??"")})}else n[r]=i;return n}function ve(t,s){if(!t.bind)return null;if(t.bind.field)return s.record[t.bind.field]??null;if(t.bind.expression){const n=B(s),r=t.bind.expression,i=r.trim();if(i.startsWith("{{")&&i.endsWith("}}")){const l=T(i);return F(l,n)}return r}return null}function je({props:t,on:s}){const n=Q(),r=X(),i=se(),l=t.variant??(i==="card"?"flat":"card"),u=t.selectable,d=t.bordered,f=t.striped,m=t.pageSize,a=n.model,v=n.__columns??[],b=!!(a&&m),p=J({model:a||"",pageSize:m??20,enabled:b}),g=b?p.data:n.records??[],h=b&&p.isFetching,{modelMeta:k}=A(a),N=y.useMemo(()=>k?k.fields.some(c=>c.searchable):!1,[k]),$=v.filter(c=>{var x,j;return((x=c.props)==null?void 0:x.filterable)&&((j=c.bind)==null?void 0:j.field)}),w=y.useCallback(c=>{var C;if(!a)return;const x=(C=p.sort)==null?void 0:C[0];let j;(x==null?void 0:x.field)===c&&x.direction==="asc"?j=`-${c}`:(x==null?void 0:x.field)===c&&x.direction==="desc"?j=void 0:j=c,r.set(`$sort.${a}`,j??null),r.set(`$page.${a}`,1)},[a,p.sort,r]),V=y.useCallback(c=>{var x;a&&(r.set(`$page.${a}`,c),(x=s.pageChange)==null||x.call(s,c))},[a,r,s]),S=["flex flex-col",l==="card"?"bg-card text-card-foreground ring-1 ring-foreground/10":"-mx-(--card-spacing)"].filter(Boolean).join(" "),o=["w-full text-sm border-collapse table-fixed",d&&l==="card"?"ring-1 ring-border":""].filter(Boolean).join(" ");return e.jsxs("div",{"data-widget":"table",className:S,children:[b&&(N||$.length>0)&&e.jsx(xe,{model:a,store:r,columns:$,hasSearch:N,hasFilters:$.length>0}),e.jsx("div",{className:"overflow-auto",children:e.jsxs("table",{className:o,children:[e.jsx(ye,{columns:v,selectable:u,smartMode:b,currentSort:p.sort,onSort:w}),e.jsx(Ne,{columns:v,records:g,selectable:u,striped:f,isFetching:h,isLoading:p.isLoading,pageSize:m??20,emptyText:t.emptyText??"No data",ctx:n,onRowClick:s.rowClick,onSelect:s.select})]})}),b&&e.jsx(me,{page:p.page,pageSize:p.pageSize,total:p.total,recordCount:g.length,onPageChange:V})]})}function ye({columns:t,selectable:s,smartMode:n,currentSort:r,onSort:i}){return e.jsx("thead",{children:e.jsxs("tr",{className:"border-b-2 border-border",children:[s&&e.jsx("th",{className:"w-10 px-5 py-2 text-center",children:e.jsx("input",{type:"checkbox",className:"cursor-pointer","aria-label":"Select all"})}),t.map((l,u)=>{var p,g,h,k,N;const d=((p=l.props)==null?void 0:p.align)??"left",f=(g=l.props)==null?void 0:g.width,m=n&&((h=l.props)==null?void 0:h.sortable),a=(k=l.bind)==null?void 0:k.field,v=d==="center"?"text-center":d==="right"?"text-right":"text-left",b=m&&a?Se(r,a):null;return e.jsx("th",{"data-rangka-widget":"column","data-rangka-id":l.id??void 0,"data-rangka-field":a??void 0,className:`px-5 py-2 text-xs font-semibold text-muted-foreground ${v} ${m?"cursor-pointer select-none transition-colors hover:text-foreground":""}`,style:f?{width:f}:void 0,onClick:m&&a?()=>i(a):void 0,children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[String(((N=l.props)==null?void 0:N.label)??""),b==="asc"&&e.jsx(Y,{className:"h-3 w-3 text-foreground"}),b==="desc"&&e.jsx(Z,{className:"h-3 w-3 text-foreground"})]})},l.id??u)})]})})}function Ne({columns:t,records:s,selectable:n,striped:r,isFetching:i,isLoading:l,pageSize:u,emptyText:d,ctx:f,onRowClick:m,onSelect:a}){const v=i&&s.length>0?"opacity-50 transition-opacity duration-150":"transition-opacity duration-150";return l?e.jsx("tbody",{className:v,children:Array.from({length:u},(b,p)=>e.jsxs("tr",{className:"border-b border-border/50 last:border-b-0",children:[n&&e.jsx("td",{className:"w-10 px-5 py-2 text-center",children:e.jsx(P,{className:"h-4 w-4 mx-auto"})}),t.map((g,h)=>e.jsx("td",{className:"px-5 py-2",children:e.jsx(P,{className:"h-4 w-full max-w-[80%]"})},g.id??h))]},`skeleton-${p}`))}):s.length===0?e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:t.length+(n?1:0),className:"px-5 py-8 text-center text-muted-foreground",children:d})})}):e.jsx("tbody",{className:v,children:s.map((b,p)=>{const g=ee(b,p,f);return e.jsxs("tr",{"data-rangka-widget":"row","data-rangka-id":`row-${p}`,className:["border-b border-border/50 last:border-b-0",r&&p%2===1?"bg-muted/30":"",m?"cursor-pointer transition-colors hover:bg-muted/50":""].filter(Boolean).join(" "),onClick:()=>m==null?void 0:m(b),children:[n&&e.jsx("td",{className:"w-10 px-5 py-2 text-center",children:e.jsx("input",{type:"checkbox",className:"cursor-pointer","aria-label":`Select row ${p+1}`,onClick:h=>{h.stopPropagation(),a==null||a(b)}})}),t.map((h,k)=>{var w,V;const N=((w=h.props)==null?void 0:w.align)??"left",$=N==="center"?"text-center":N==="right"?"text-right tabular-nums":"text-left";return e.jsx("td",{"data-rangka-widget":"column","data-rangka-id":h.id??void 0,"data-rangka-field":((V=h.bind)==null?void 0:V.field)??void 0,className:`px-5 py-2 ${$}`,children:e.jsx(te,{value:g,children:h.children&&h.children.length>0?h.children.map((S,o)=>e.jsx(be,{node:S,rowCtx:g},S.id??o)):e.jsx(he,{col:h,row:b})})},h.id??k)})]},b.id??p)})})}function Se(t,s){if(!t)return null;const n=t.find(r=>r.field===s);return(n==null?void 0:n.direction)??null}je.widgetMeta={name:"table",label:"Table",category:"data",schema:{variant:{type:"enum",options:["card","flat"],default:"card"},selectable:{type:"boolean"},bordered:{type:"boolean"},striped:{type:"boolean"},pageSize:{type:"number"},emptyText:{type:"string"}},binding:"model",triggers:["rowClick","select","pageChange"],container:!0,accepts:["column"]};export{je as TableWidget};
@@ -0,0 +1 @@
1
+ import{j as r}from"./vendor-radix-D-Trh8JA.js";import{T as y}from"./textarea-BVCZevA6.js";import{L as h,M as p}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function b({props:l,bind:a,on:e}){var u,o,d;const s=l.label??((u=a.meta)==null?void 0:u.label)??"",f=l.placeholder??"",x=l.rows??4,g=l.disabled??((o=a.meta)==null?void 0:o.readOnly)??!1,n=l.readOnly??((d=a.meta)==null?void 0:d.readOnly)??!1,c=a.error;return r.jsxs(h,{children:[s&&r.jsx(p,{children:s}),r.jsx(y,{value:a.value??"",onChange:t=>{var i,m;(i=a.setValue)==null||i.call(a,t.target.value),(m=e.change)==null||m.call(e,t.target.value)},onFocus:()=>{var t;return(t=e.focus)==null?void 0:t.call(e)},onBlur:()=>{var t;return(t=e.blur)==null?void 0:t.call(e)},placeholder:f,rows:x,disabled:g,readOnly:n}),c&&r.jsx("p",{className:"text-xs text-destructive mt-1",children:c})]})}b.widgetMeta={name:"textarea",label:"Textarea",category:"input",schema:{label:{type:"string"},placeholder:{type:"string"},rows:{type:"number",default:4},disabled:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1}},binding:"field",triggers:["change","focus","blur"],container:!1};export{b as TextareaWidget};
@@ -0,0 +1 @@
1
+ import{r as j,j as a}from"./vendor-radix-D-Trh8JA.js";import{P as w,a as V,b as O}from"./popover-DywIKFaQ.js";import{L as P,M as E,j as F,V as L,Y as T,Z as I,_ as M,$ as B,a0 as f,c as G}from"./index-D1wStSrO.js";import"./vendor-query-dRdWN_eK.js";import"./vendor-router-B1WM9yRc.js";function R({props:r,bind:s,on:l}){var u,p,x;const o=r.label??((u=s.meta)==null?void 0:u.label)??"",v=r.placeholder??"Select parent...",C=r.disabled??((p=s.meta)==null?void 0:p.readOnly)??!1,[d,h]=j.useState(!1),[S,i]=j.useState(""),m=((x=s.meta)==null?void 0:x.options)??[],c=s.value,n=m.find(e=>e.value===c),N=e=>{var t,g;(t=s.setValue)==null||t.call(s,e),(g=l.change)==null||g.call(l,e),h(!1),i("")},y=()=>{var e,t;(e=s.setValue)==null||e.call(s,null),(t=l.change)==null||t.call(l,null)},b=e=>{var t;i(e),(t=l.search)==null||t.call(l,e)};return a.jsxs(P,{children:[o&&a.jsx(E,{children:o}),a.jsxs(w,{open:d,onOpenChange:h,children:[a.jsx(V,{asChild:!0,children:a.jsx(F,{variant:"outline",role:"combobox","aria-expanded":d,disabled:C,className:"w-full justify-between font-normal h-7 text-xs",children:n?a.jsx("span",{className:"truncate",children:n.path??n.label}):a.jsx("span",{className:"text-muted-foreground",children:v})})}),a.jsx(O,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(L,{shouldFilter:!1,children:[a.jsx(T,{placeholder:"Search...",value:S,onValueChange:b}),a.jsxs(I,{children:[a.jsx(M,{children:"No results found."}),a.jsxs(B,{children:[c&&a.jsx(f,{value:"",onSelect:y,className:"text-muted-foreground",children:"Clear selection"}),m.map(e=>a.jsx(f,{value:e.value,onSelect:()=>N(e.value),className:G(e.value===c&&"bg-accent"),children:a.jsx("span",{className:"truncate",children:e.path??e.label})},e.value))]})]})]})})]})]})}R.widgetMeta={name:"tree",label:"Tree",category:"input",schema:{label:{type:"string"},placeholder:{type:"string"},disabled:{type:"boolean",default:!1}},binding:"field",triggers:["change","search"],container:!1};export{R as TreeWidget};