@rebasepro/cms 0.0.1-canary.4d4fb3e

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 (746) hide show
  1. package/LICENSE +6 -0
  2. package/dist/CollectionEditorDialog-DiZYNmYV.js +4731 -0
  3. package/dist/CollectionEditorDialog-DiZYNmYV.js.map +1 -0
  4. package/dist/CollectionsStudioView-BHVTfAuK.js +224 -0
  5. package/dist/CollectionsStudioView-BHVTfAuK.js.map +1 -0
  6. package/dist/PropertyEditView-BC5GO9AI.js +7776 -0
  7. package/dist/PropertyEditView-BC5GO9AI.js.map +1 -0
  8. package/dist/collection_editor/CollectionEditorDialogsContext.d.ts +19 -0
  9. package/dist/collection_editor/ConfigControllerProvider.d.ts +45 -0
  10. package/dist/collection_editor/_cms_internals.d.ts +29 -0
  11. package/dist/collection_editor/api/generateCollectionApi.d.ts +77 -0
  12. package/dist/collection_editor/api/index.d.ts +1 -0
  13. package/dist/collection_editor/index.d.ts +16 -0
  14. package/dist/collection_editor/pgColumnToProperty.d.ts +6 -0
  15. package/dist/collection_editor/types/collection_editor_controller.d.ts +56 -0
  16. package/dist/collection_editor/types/collection_inference.d.ts +10 -0
  17. package/dist/collection_editor/types/config_controller.d.ts +91 -0
  18. package/dist/collection_editor/types/config_permissions.d.ts +19 -0
  19. package/dist/collection_editor/ui/AddKanbanColumnAction.d.ts +11 -0
  20. package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +10 -0
  21. package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -0
  22. package/dist/collection_editor/ui/EditorCollectionActionStart.d.ts +2 -0
  23. package/dist/collection_editor/ui/EditorEntityAction.d.ts +2 -0
  24. package/dist/collection_editor/ui/HomePageEditorCollectionAction.d.ts +2 -0
  25. package/dist/collection_editor/ui/KanbanSetupAction.d.ts +10 -0
  26. package/dist/collection_editor/ui/MissingReferenceWidget.d.ts +3 -0
  27. package/dist/collection_editor/ui/NewCollectionButton.d.ts +1 -0
  28. package/dist/collection_editor/ui/NewCollectionCard.d.ts +2 -0
  29. package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +7 -0
  30. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.d.ts +36 -0
  31. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
  32. package/dist/collection_editor/ui/collection_editor/CollectionDetailsForm.d.ts +11 -0
  33. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +72 -0
  34. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.d.ts +19 -0
  35. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
  36. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +17 -0
  37. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.d.ts +12 -0
  38. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +1 -0
  39. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +5 -0
  40. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.d.ts +14 -0
  41. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +5 -0
  42. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
  43. package/dist/collection_editor/ui/collection_editor/EntityActionsEditTab.d.ts +5 -0
  44. package/dist/collection_editor/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
  45. package/dist/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +4 -0
  46. package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +12 -0
  47. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
  48. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.d.ts +6 -0
  49. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
  50. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
  51. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +47 -0
  52. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +16 -0
  53. package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +31 -0
  54. package/dist/collection_editor/ui/collection_editor/SubcollectionsEditTab.d.ts +11 -0
  55. package/dist/collection_editor/ui/collection_editor/SwitchControl.d.ts +8 -0
  56. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
  57. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +7 -0
  58. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +13 -0
  59. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +7 -0
  60. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.d.ts +7 -0
  61. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.d.ts +3 -0
  62. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.d.ts +10 -0
  63. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.d.ts +3 -0
  64. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.d.ts +9 -0
  65. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.d.ts +3 -0
  66. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.d.ts +7 -0
  67. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
  68. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.d.ts +3 -0
  69. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.d.ts +14 -0
  70. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +15 -0
  71. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.d.ts +9 -0
  72. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.d.ts +5 -0
  73. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.d.ts +5 -0
  74. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.d.ts +4 -0
  75. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +3 -0
  76. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
  77. package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +3 -0
  78. package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
  79. package/dist/collection_editor/ui/collection_editor/properties/conditions/index.d.ts +6 -0
  80. package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
  81. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +5 -0
  82. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +4 -0
  83. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.d.ts +3 -0
  84. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +11 -0
  85. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.d.ts +3 -0
  86. package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +2 -0
  87. package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +2 -0
  88. package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +2 -0
  89. package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +2 -0
  90. package/dist/collection_editor/ui/collection_editor/util.d.ts +5 -0
  91. package/dist/collection_editor/ui/collection_editor/utils/strings.d.ts +1 -0
  92. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.d.ts +3 -0
  93. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -0
  94. package/dist/collection_editor/useCollectionEditorController.d.ts +6 -0
  95. package/dist/collection_editor/useCollectionsConfigController.d.ts +6 -0
  96. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +6 -0
  97. package/dist/collection_editor/validateCollectionJson.d.ts +22 -0
  98. package/dist/collection_editor_ui.d.ts +8 -0
  99. package/dist/collection_editor_ui.js +11 -0
  100. package/dist/collection_editor_ui.js.map +1 -0
  101. package/dist/components/AdminModeSyncer.d.ts +17 -0
  102. package/dist/components/ArrayContainer.d.ts +59 -0
  103. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  104. package/dist/components/CollectionEditorDialogs.d.ts +15 -0
  105. package/dist/components/DefaultAppBar.d.ts +29 -0
  106. package/dist/components/DefaultDrawer.d.ts +29 -0
  107. package/dist/components/DeleteEntityDialog.d.ts +13 -0
  108. package/dist/components/DrawerNavigationGroup.d.ts +49 -0
  109. package/dist/components/DrawerNavigationItem.d.ts +10 -0
  110. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +39 -0
  111. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +27 -0
  112. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +129 -0
  113. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +26 -0
  114. package/dist/components/EntityCollectionTable/column_utils.d.ts +16 -0
  115. package/dist/components/EntityCollectionTable/fields/TableMultipleRelationField.d.ts +21 -0
  116. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +22 -0
  117. package/dist/components/EntityCollectionTable/fields/TableRelationField.d.ts +22 -0
  118. package/dist/components/EntityCollectionTable/fields/TableRelationSelectorField.d.ts +20 -0
  119. package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +35 -0
  120. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +12 -0
  121. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +9 -0
  122. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +8 -0
  123. package/dist/components/EntityCollectionTable/fields/VirtualTableSelect.d.ts +15 -0
  124. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +7 -0
  125. package/dist/components/EntityCollectionTable/fields/VirtualTableUserSelect.d.ts +12 -0
  126. package/dist/components/EntityCollectionTable/index.d.ts +6 -0
  127. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +14 -0
  128. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +32 -0
  129. package/dist/components/EntityCollectionTable/internal/EntityTableCellActions.d.ts +9 -0
  130. package/dist/components/EntityCollectionTable/internal/common.d.ts +5 -0
  131. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +27 -0
  132. package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +13 -0
  133. package/dist/components/EntityCollectionTable/internal/popup_field/useWindowSize.d.ts +6 -0
  134. package/dist/components/EntityCollectionTable/table_bindings.d.ts +28 -0
  135. package/dist/components/EntityCollectionView/Board.d.ts +2 -0
  136. package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
  137. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
  138. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
  139. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +27 -0
  140. package/dist/components/EntityCollectionView/EntityCard.d.ts +20 -0
  141. package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +21 -0
  142. package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +32 -0
  143. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +54 -0
  144. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +15 -0
  145. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +17 -0
  146. package/dist/components/EntityCollectionView/FiltersDialog.d.ts +15 -0
  147. package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
  148. package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
  149. package/dist/components/EntityCollectionView/hooks/useCollectionInlineEditor.d.ts +12 -0
  150. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +20 -0
  151. package/dist/components/EntityCollectionView/useBoardDataController.d.ts +61 -0
  152. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  153. package/dist/components/EntityCollectionView/utils.d.ts +3 -0
  154. package/dist/components/EntityEditView.d.ts +48 -0
  155. package/dist/components/EntityEditViewFormActions.d.ts +2 -0
  156. package/dist/components/EntityJsonPreview.d.ts +3 -0
  157. package/dist/components/EntityPreview.d.ts +56 -0
  158. package/dist/components/EntitySidePanel.d.ts +10 -0
  159. package/dist/components/EntityView.d.ts +12 -0
  160. package/dist/components/FieldCaption.d.ts +5 -0
  161. package/dist/components/HomePage/ContentHomePage.d.ts +11 -0
  162. package/dist/components/HomePage/FavouritesView.d.ts +3 -0
  163. package/dist/components/HomePage/HomePageDnD.d.ts +77 -0
  164. package/dist/components/HomePage/NavigationCard.d.ts +10 -0
  165. package/dist/components/HomePage/NavigationCardBinding.d.ts +18 -0
  166. package/dist/components/HomePage/NavigationGroup.d.ts +11 -0
  167. package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
  168. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  169. package/dist/components/HomePage/index.d.ts +4 -0
  170. package/dist/components/PropertyCollectionView.d.ts +24 -0
  171. package/dist/components/PropertyConfigBadge.d.ts +6 -0
  172. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  173. package/dist/components/RebaseAuthGate.d.ts +21 -0
  174. package/dist/components/RebaseCMS.d.ts +10 -0
  175. package/dist/components/RebaseLayout.d.ts +32 -0
  176. package/dist/components/RebaseNavigation.d.ts +24 -0
  177. package/dist/components/RebaseRouteDefs.d.ts +30 -0
  178. package/dist/components/RebaseShell.d.ts +25 -0
  179. package/dist/components/ReferenceTable/EntitySelectionTable.d.ts +59 -0
  180. package/dist/components/ReferenceWidget.d.ts +30 -0
  181. package/dist/components/RelationSelector.d.ts +32 -0
  182. package/dist/components/SearchIconsView.d.ts +5 -0
  183. package/dist/components/SelectableTable/SelectableTable.d.ts +89 -0
  184. package/dist/components/SelectableTable/SelectableTableContext.d.ts +4 -0
  185. package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +9 -0
  186. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +12 -0
  187. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +15 -0
  188. package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +12 -0
  189. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +13 -0
  190. package/dist/components/SideDialogs.d.ts +25 -0
  191. package/dist/components/SideEntityProvider.d.ts +32 -0
  192. package/dist/components/admin/RoleChip.d.ts +4 -0
  193. package/dist/components/admin/RolesView.d.ts +4 -0
  194. package/dist/components/admin/UsersView.d.ts +4 -0
  195. package/dist/components/admin/index.d.ts +3 -0
  196. package/dist/components/app/AppBar.d.ts +12 -0
  197. package/dist/components/app/Drawer.d.ts +19 -0
  198. package/dist/components/app/Scaffold.d.ts +34 -0
  199. package/dist/components/app/index.d.ts +4 -0
  200. package/dist/components/app/useApp.d.ts +17 -0
  201. package/dist/components/common/default_entity_actions.d.ts +4 -0
  202. package/dist/components/common/index.d.ts +1 -0
  203. package/dist/components/field_configs.d.ts +7 -0
  204. package/dist/components/history/EntityHistoryEntry.d.ts +17 -0
  205. package/dist/components/history/EntityHistoryView.d.ts +6 -0
  206. package/dist/components/history/LastEditedByFormAction.d.ts +6 -0
  207. package/dist/components/history/LastEditedByIndicator.d.ts +10 -0
  208. package/dist/components/history/UserChip.d.ts +4 -0
  209. package/dist/components/history/index.d.ts +5 -0
  210. package/dist/components/index.d.ts +42 -0
  211. package/dist/contexts/BreacrumbsContext.d.ts +8 -0
  212. package/dist/contexts/SideDialogsControllerContext.d.ts +3 -0
  213. package/dist/contexts/SideEntityControllerContext.d.ts +3 -0
  214. package/dist/data_export/export/BasicExportAction.d.ts +7 -0
  215. package/dist/data_export/export/ExportCollectionAction.d.ts +11 -0
  216. package/dist/data_export/export/export.d.ts +22 -0
  217. package/dist/data_export/export/index.d.ts +3 -0
  218. package/dist/data_export/index.d.ts +1 -0
  219. package/dist/data_import/components/DataNewPropertiesMapping.d.ts +13 -0
  220. package/dist/data_import/components/ImportFileUpload.d.ts +3 -0
  221. package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +9 -0
  222. package/dist/data_import/components/ImportSaveInProgress.d.ts +8 -0
  223. package/dist/data_import/components/index.d.ts +4 -0
  224. package/dist/data_import/hooks/index.d.ts +1 -0
  225. package/dist/data_import/hooks/useImportConfig.d.ts +2 -0
  226. package/dist/data_import/import/ImportCollectionAction.d.ts +15 -0
  227. package/dist/data_import/import/index.d.ts +1 -0
  228. package/dist/data_import/index.d.ts +5 -0
  229. package/dist/data_import/types/column_mapping.d.ts +20 -0
  230. package/dist/data_import/types/index.d.ts +1 -0
  231. package/dist/data_import/utils/data.d.ts +4 -0
  232. package/dist/data_import/utils/file_headers.d.ts +1 -0
  233. package/dist/data_import/utils/file_to_json.d.ts +16 -0
  234. package/dist/data_import/utils/get_import_inference_type.d.ts +2 -0
  235. package/dist/data_import/utils/get_properties_mapping.d.ts +1 -0
  236. package/dist/data_import/utils/index.d.ts +3 -0
  237. package/dist/editor/components/SlashCommandMenu.d.ts +6 -0
  238. package/dist/editor/components/editor-bubble-item.d.ts +8 -0
  239. package/dist/editor/components/editor-bubble.d.ts +8 -0
  240. package/dist/editor/components/image-bubble.d.ts +5 -0
  241. package/dist/editor/components/index.d.ts +16 -0
  242. package/dist/editor/components/table-bubble.d.ts +5 -0
  243. package/dist/editor/editor.d.ts +30 -0
  244. package/dist/editor/extensions/HighlightDecorationExtension.d.ts +24 -0
  245. package/dist/editor/extensions/Image/index.d.ts +6 -0
  246. package/dist/editor/extensions/Image.d.ts +6 -0
  247. package/dist/editor/extensions/TextLoadingDecorationExtension.d.ts +16 -0
  248. package/dist/editor/extensions/clipboard.d.ts +7 -0
  249. package/dist/editor/extensions/custom-keymap.d.ts +1 -0
  250. package/dist/editor/extensions/drag-and-drop.d.ts +9 -0
  251. package/dist/editor/hooks/useProseMirror.d.ts +13 -0
  252. package/dist/editor/hooks/useProseMirrorContext.d.ts +9 -0
  253. package/dist/editor/index.d.ts +2 -0
  254. package/dist/editor/markdown.d.ts +5 -0
  255. package/dist/editor/nodeViews/ImageComponent.d.ts +3 -0
  256. package/dist/editor/nodeViews/ReactNodeView.d.ts +29 -0
  257. package/dist/editor/nodeViews/TaskItemComponent.d.ts +3 -0
  258. package/dist/editor/nodeViews/index.d.ts +6 -0
  259. package/dist/editor/plugins/index.d.ts +2 -0
  260. package/dist/editor/plugins/inputrules.d.ts +6 -0
  261. package/dist/editor/plugins/placeholderPlugin.d.ts +3 -0
  262. package/dist/editor/plugins/slashCommandPlugin.d.ts +12 -0
  263. package/dist/editor/schema.d.ts +2 -0
  264. package/dist/editor/selectors/ai-selector.d.ts +0 -0
  265. package/dist/editor/selectors/color-selector.d.ts +10 -0
  266. package/dist/editor/selectors/link-selector.d.ts +8 -0
  267. package/dist/editor/selectors/node-selector.d.ts +15 -0
  268. package/dist/editor/selectors/text-buttons.d.ts +1 -0
  269. package/dist/editor/types.d.ts +5 -0
  270. package/dist/editor/useProseMirror.d.ts +16 -0
  271. package/dist/editor/utils/prosemirror-utils.d.ts +7 -0
  272. package/dist/editor/utils/remove_classes.d.ts +1 -0
  273. package/dist/editor/utils/useDebouncedCallback.d.ts +1 -0
  274. package/dist/form/EntityForm.d.ts +10 -0
  275. package/dist/form/EntityFormActions.d.ts +2 -0
  276. package/dist/form/PropertyFieldBinding.d.ts +30 -0
  277. package/dist/form/components/ErrorFocus.d.ts +4 -0
  278. package/dist/form/components/FieldHelperText.d.ts +12 -0
  279. package/dist/form/components/FormEntry.d.ts +6 -0
  280. package/dist/form/components/FormLayout.d.ts +5 -0
  281. package/dist/form/components/LabelWithIcon.d.ts +14 -0
  282. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  283. package/dist/form/components/LocalChangesMenu.d.ts +11 -0
  284. package/dist/form/components/StorageItemPreview.d.ts +14 -0
  285. package/dist/form/components/StorageUploadProgress.d.ts +10 -0
  286. package/dist/form/components/index.d.ts +5 -0
  287. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +10 -0
  288. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +13 -0
  289. package/dist/form/field_bindings/BlockFieldBinding.d.ts +11 -0
  290. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +12 -0
  291. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +8 -0
  292. package/dist/form/field_bindings/MapFieldBinding.d.ts +10 -0
  293. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +12 -0
  294. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +10 -0
  295. package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +10 -0
  296. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +11 -0
  297. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +10 -0
  298. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +10 -0
  299. package/dist/form/field_bindings/RelationFieldBinding.d.ts +3 -0
  300. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +11 -0
  301. package/dist/form/field_bindings/SelectFieldBinding.d.ts +11 -0
  302. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +21 -0
  303. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +10 -0
  304. package/dist/form/field_bindings/TextFieldBinding.d.ts +9 -0
  305. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +13 -0
  306. package/dist/form/index.d.ts +20 -0
  307. package/dist/form/useClearRestoreValue.d.ts +13 -0
  308. package/dist/form/validation.d.ts +21 -0
  309. package/dist/hooks/index.d.ts +15 -0
  310. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +5 -0
  311. package/dist/hooks/navigation/contexts/NavigationStateContext.d.ts +4 -0
  312. package/dist/hooks/navigation/contexts/UrlContext.d.ts +4 -0
  313. package/dist/hooks/navigation/contexts/index.d.ts +3 -0
  314. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +7 -0
  315. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +34 -0
  316. package/dist/hooks/navigation/useBuildUrlController.d.ts +7 -0
  317. package/dist/hooks/navigation/useNavigationRegistry.d.ts +11 -0
  318. package/dist/hooks/navigation/useNavigationResolution.d.ts +7 -0
  319. package/dist/hooks/navigation/useNavigationURLs.d.ts +11 -0
  320. package/dist/hooks/navigation/useResolvedCollections.d.ts +28 -0
  321. package/dist/hooks/navigation/useResolvedViews.d.ts +29 -0
  322. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +27 -0
  323. package/dist/hooks/navigation/utils.d.ts +12 -0
  324. package/dist/hooks/useBreadcrumbsController.d.ts +42 -0
  325. package/dist/hooks/useBuildSideDialogsController.d.ts +2 -0
  326. package/dist/hooks/useBuildSideEntityController.d.ts +6 -0
  327. package/dist/hooks/useCMSContext.d.ts +27 -0
  328. package/dist/hooks/useEntityHistory.d.ts +30 -0
  329. package/dist/hooks/useEntitySelectionDialog.d.ts +18 -0
  330. package/dist/hooks/useResolvedNavigationFrom.d.ts +73 -0
  331. package/dist/hooks/useSideDialogsController.d.ts +19 -0
  332. package/dist/hooks/useSideEntityController.d.ts +11 -0
  333. package/dist/index.d.ts +12 -0
  334. package/dist/index.js +2885 -0
  335. package/dist/index.js.map +1 -0
  336. package/dist/preview/PropertyPreview.d.ts +7 -0
  337. package/dist/preview/components/ArrayEnumPreview.d.ts +11 -0
  338. package/dist/preview/components/BooleanPreview.d.ts +11 -0
  339. package/dist/preview/components/DatePreview.d.ts +17 -0
  340. package/dist/preview/components/EmptyValue.d.ts +6 -0
  341. package/dist/preview/components/EnumValuesChip.d.ts +13 -0
  342. package/dist/preview/components/ImagePreview.d.ts +16 -0
  343. package/dist/preview/components/ReferencePreview.d.ts +17 -0
  344. package/dist/preview/components/RelationPreview.d.ts +17 -0
  345. package/dist/preview/components/StorageThumbnail.d.ts +15 -0
  346. package/dist/preview/components/UrlComponentPreview.d.ts +14 -0
  347. package/dist/preview/components/UserPreview.d.ts +9 -0
  348. package/dist/preview/index.d.ts +23 -0
  349. package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +6 -0
  350. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +6 -0
  351. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +6 -0
  352. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +6 -0
  353. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +6 -0
  354. package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +6 -0
  355. package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +6 -0
  356. package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +6 -0
  357. package/dist/preview/property_previews/MapPropertyPreview.d.ts +9 -0
  358. package/dist/preview/property_previews/NumberPropertyPreview.d.ts +7 -0
  359. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +14 -0
  360. package/dist/preview/property_previews/StringPropertyPreview.d.ts +7 -0
  361. package/dist/preview/util.d.ts +7 -0
  362. package/dist/routes/CustomViewRoute.d.ts +4 -0
  363. package/dist/routes/RebaseRoute.d.ts +1 -0
  364. package/dist/routes/index.d.ts +2 -0
  365. package/dist/types/components/EntityFormActionsProps.d.ts +19 -0
  366. package/dist/types/components/EntityFormProps.d.ts +48 -0
  367. package/dist/types/components/PropertyPreviewProps.d.ts +47 -0
  368. package/dist/types/components/formex.d.ts +40 -0
  369. package/dist/types/components/index.d.ts +3 -0
  370. package/dist/types/fields.d.ts +221 -0
  371. package/dist/types/index.d.ts +2 -0
  372. package/dist/util/entity_actions.d.ts +2 -0
  373. package/dist/util/index.d.ts +5 -0
  374. package/dist/util/navigation_utils.d.ts +32 -0
  375. package/dist/util/previews.d.ts +4 -0
  376. package/dist/util/property_utils.d.ts +24 -0
  377. package/dist/util/resolutions.d.ts +9 -0
  378. package/dist/util-W5Lh0Emr.js +32604 -0
  379. package/dist/util-W5Lh0Emr.js.map +1 -0
  380. package/package.json +170 -0
  381. package/src/collection_editor/CollectionEditorDialogsContext.tsx +25 -0
  382. package/src/collection_editor/ConfigControllerProvider.tsx +405 -0
  383. package/src/collection_editor/_cms_internals.ts +41 -0
  384. package/src/collection_editor/api/generateCollectionApi.ts +125 -0
  385. package/src/collection_editor/api/index.ts +1 -0
  386. package/src/collection_editor/index.ts +63 -0
  387. package/src/collection_editor/pgColumnToProperty.ts +274 -0
  388. package/src/collection_editor/types/collection_editor_controller.tsx +64 -0
  389. package/src/collection_editor/types/collection_inference.ts +17 -0
  390. package/src/collection_editor/types/config_controller.tsx +109 -0
  391. package/src/collection_editor/types/config_permissions.ts +20 -0
  392. package/src/collection_editor/ui/AddKanbanColumnAction.tsx +195 -0
  393. package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +49 -0
  394. package/src/collection_editor/ui/EditorCollectionAction.tsx +57 -0
  395. package/src/collection_editor/ui/EditorCollectionActionStart.tsx +92 -0
  396. package/src/collection_editor/ui/EditorEntityAction.tsx +53 -0
  397. package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +119 -0
  398. package/src/collection_editor/ui/KanbanSetupAction.tsx +40 -0
  399. package/src/collection_editor/ui/MissingReferenceWidget.tsx +40 -0
  400. package/src/collection_editor/ui/NewCollectionButton.tsx +26 -0
  401. package/src/collection_editor/ui/NewCollectionCard.tsx +52 -0
  402. package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +52 -0
  403. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +253 -0
  404. package/src/collection_editor/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
  405. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +437 -0
  406. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +991 -0
  407. package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +291 -0
  408. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
  409. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +600 -0
  410. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +331 -0
  411. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +224 -0
  412. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +103 -0
  413. package/src/collection_editor/ui/collection_editor/CollectionYupValidation.tsx +9 -0
  414. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +137 -0
  415. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +312 -0
  416. package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +164 -0
  417. package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +40 -0
  418. package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +39 -0
  419. package/src/collection_editor/ui/collection_editor/EnumForm.tsx +370 -0
  420. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +277 -0
  421. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +142 -0
  422. package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +195 -0
  423. package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +35 -0
  424. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +790 -0
  425. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +159 -0
  426. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +360 -0
  427. package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +255 -0
  428. package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +39 -0
  429. package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +41 -0
  430. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +66 -0
  431. package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +296 -0
  432. package/src/collection_editor/ui/collection_editor/import/clean_import_data.ts +54 -0
  433. package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +146 -0
  434. package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +41 -0
  435. package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +111 -0
  436. package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +205 -0
  437. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +124 -0
  438. package/src/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.tsx +20 -0
  439. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +150 -0
  440. package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +215 -0
  441. package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +115 -0
  442. package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +162 -0
  443. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +344 -0
  444. package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +106 -0
  445. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +366 -0
  446. package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +146 -0
  447. package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +90 -0
  448. package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +47 -0
  449. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +853 -0
  450. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
  451. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +593 -0
  452. package/src/collection_editor/ui/collection_editor/properties/conditions/index.ts +6 -0
  453. package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +93 -0
  454. package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +50 -0
  455. package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +61 -0
  456. package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +115 -0
  457. package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +152 -0
  458. package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +28 -0
  459. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +112 -0
  460. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +183 -0
  461. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +88 -0
  462. package/src/collection_editor/ui/collection_editor/templates/users_template.ts +42 -0
  463. package/src/collection_editor/ui/collection_editor/util.ts +28 -0
  464. package/src/collection_editor/ui/collection_editor/utils/strings.ts +16 -0
  465. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +33 -0
  466. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +281 -0
  467. package/src/collection_editor/useCollectionEditorController.tsx +9 -0
  468. package/src/collection_editor/useCollectionsConfigController.tsx +9 -0
  469. package/src/collection_editor/useLocalCollectionsConfigController.tsx +111 -0
  470. package/src/collection_editor/validateCollectionJson.ts +379 -0
  471. package/src/collection_editor_ui.ts +15 -0
  472. package/src/components/AdminModeSyncer.tsx +56 -0
  473. package/src/components/ArrayContainer.tsx +551 -0
  474. package/src/components/ClearFilterSortButton.tsx +47 -0
  475. package/src/components/CollectionEditorDialogs.tsx +68 -0
  476. package/src/components/DefaultAppBar.tsx +280 -0
  477. package/src/components/DefaultDrawer.tsx +276 -0
  478. package/src/components/DeleteEntityDialog.tsx +182 -0
  479. package/src/components/DrawerNavigationGroup.tsx +128 -0
  480. package/src/components/DrawerNavigationItem.tsx +65 -0
  481. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +232 -0
  482. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +380 -0
  483. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +171 -0
  484. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +342 -0
  485. package/src/components/EntityCollectionTable/column_utils.tsx +75 -0
  486. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +130 -0
  487. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +172 -0
  488. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +181 -0
  489. package/src/components/EntityCollectionTable/fields/TableRelationSelectorField.tsx +42 -0
  490. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +320 -0
  491. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +39 -0
  492. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +90 -0
  493. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +80 -0
  494. package/src/components/EntityCollectionTable/fields/VirtualTableSelect.tsx +133 -0
  495. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +32 -0
  496. package/src/components/EntityCollectionTable/fields/VirtualTableUserSelect.tsx +112 -0
  497. package/src/components/EntityCollectionTable/index.tsx +14 -0
  498. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +72 -0
  499. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +311 -0
  500. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +82 -0
  501. package/src/components/EntityCollectionTable/internal/common.tsx +73 -0
  502. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +418 -0
  503. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +96 -0
  504. package/src/components/EntityCollectionTable/internal/popup_field/useWindowSize.tsx +20 -0
  505. package/src/components/EntityCollectionTable/table_bindings.tsx +345 -0
  506. package/src/components/EntityCollectionView/Board.tsx +324 -0
  507. package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
  508. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
  509. package/src/components/EntityCollectionView/BoardSortableList.tsx +172 -0
  510. package/src/components/EntityCollectionView/EntityBoardCard.tsx +204 -0
  511. package/src/components/EntityCollectionView/EntityCard.tsx +219 -0
  512. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +609 -0
  513. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +249 -0
  514. package/src/components/EntityCollectionView/EntityCollectionView.tsx +1143 -0
  515. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +149 -0
  516. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +122 -0
  517. package/src/components/EntityCollectionView/FiltersDialog.tsx +249 -0
  518. package/src/components/EntityCollectionView/ViewModeToggle.tsx +197 -0
  519. package/src/components/EntityCollectionView/board_types.ts +113 -0
  520. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +79 -0
  521. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +151 -0
  522. package/src/components/EntityCollectionView/useBoardDataController.tsx +510 -0
  523. package/src/components/EntityCollectionView/useSelectionController.tsx +43 -0
  524. package/src/components/EntityCollectionView/utils.ts +19 -0
  525. package/src/components/EntityEditView.tsx +576 -0
  526. package/src/components/EntityEditViewFormActions.tsx +345 -0
  527. package/src/components/EntityJsonPreview.tsx +66 -0
  528. package/src/components/EntityPreview.tsx +366 -0
  529. package/src/components/EntitySidePanel.tsx +159 -0
  530. package/src/components/EntityView.tsx +69 -0
  531. package/src/components/FieldCaption.tsx +14 -0
  532. package/src/components/HomePage/ContentHomePage.tsx +553 -0
  533. package/src/components/HomePage/FavouritesView.tsx +60 -0
  534. package/src/components/HomePage/HomePageDnD.tsx +703 -0
  535. package/src/components/HomePage/NavigationCard.tsx +79 -0
  536. package/src/components/HomePage/NavigationCardBinding.tsx +110 -0
  537. package/src/components/HomePage/NavigationGroup.tsx +156 -0
  538. package/src/components/HomePage/RenameGroupDialog.tsx +123 -0
  539. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  540. package/src/components/HomePage/index.tsx +5 -0
  541. package/src/components/PropertyCollectionView.tsx +335 -0
  542. package/src/components/PropertyConfigBadge.tsx +27 -0
  543. package/src/components/PropertyIdCopyTooltip.tsx +47 -0
  544. package/src/components/RebaseAuthGate.tsx +42 -0
  545. package/src/components/RebaseCMS.tsx +22 -0
  546. package/src/components/RebaseLayout.tsx +73 -0
  547. package/src/components/RebaseNavigation.tsx +197 -0
  548. package/src/components/RebaseRouteDefs.tsx +127 -0
  549. package/src/components/RebaseShell.tsx +70 -0
  550. package/src/components/ReferenceTable/EntitySelectionTable.tsx +358 -0
  551. package/src/components/ReferenceWidget.tsx +155 -0
  552. package/src/components/RelationSelector.tsx +612 -0
  553. package/src/components/SearchIconsView.tsx +80 -0
  554. package/src/components/SelectableTable/SelectableTable.tsx +340 -0
  555. package/src/components/SelectableTable/SelectableTableContext.tsx +6 -0
  556. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +51 -0
  557. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +125 -0
  558. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +208 -0
  559. package/src/components/SelectableTable/filters/RelationFilterField.tsx +138 -0
  560. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +224 -0
  561. package/src/components/SideDialogs.tsx +207 -0
  562. package/src/components/SideEntityProvider.tsx +76 -0
  563. package/src/components/admin/RoleChip.tsx +23 -0
  564. package/src/components/admin/RolesView.tsx +424 -0
  565. package/src/components/admin/UsersView.tsx +707 -0
  566. package/src/components/admin/index.ts +3 -0
  567. package/src/components/app/AppBar.tsx +17 -0
  568. package/src/components/app/Drawer.tsx +30 -0
  569. package/src/components/app/Scaffold.tsx +239 -0
  570. package/src/components/app/index.ts +4 -0
  571. package/src/components/app/useApp.tsx +36 -0
  572. package/src/components/common/default_entity_actions.tsx +155 -0
  573. package/src/components/common/index.ts +1 -0
  574. package/src/components/field_configs.tsx +442 -0
  575. package/src/components/history/EntityHistoryEntry.tsx +175 -0
  576. package/src/components/history/EntityHistoryView.tsx +197 -0
  577. package/src/components/history/LastEditedByFormAction.tsx +24 -0
  578. package/src/components/history/LastEditedByIndicator.tsx +98 -0
  579. package/src/components/history/UserChip.tsx +15 -0
  580. package/src/components/history/index.tsx +5 -0
  581. package/src/components/index.ts +52 -0
  582. package/src/contexts/BreacrumbsContext.tsx +45 -0
  583. package/src/contexts/SideDialogsControllerContext.tsx +5 -0
  584. package/src/contexts/SideEntityControllerContext.tsx +5 -0
  585. package/src/data_export/export/BasicExportAction.tsx +152 -0
  586. package/src/data_export/export/ExportCollectionAction.tsx +275 -0
  587. package/src/data_export/export/export.ts +244 -0
  588. package/src/data_export/export/index.ts +3 -0
  589. package/src/data_export/index.ts +1 -0
  590. package/src/data_import/components/DataNewPropertiesMapping.tsx +243 -0
  591. package/src/data_import/components/ImportFileUpload.tsx +42 -0
  592. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +59 -0
  593. package/src/data_import/components/ImportSaveInProgress.tsx +121 -0
  594. package/src/data_import/components/index.ts +4 -0
  595. package/src/data_import/hooks/index.ts +1 -0
  596. package/src/data_import/hooks/useImportConfig.tsx +34 -0
  597. package/src/data_import/import/ImportCollectionAction.tsx +448 -0
  598. package/src/data_import/import/index.ts +1 -0
  599. package/src/data_import/index.ts +5 -0
  600. package/src/data_import/types/column_mapping.ts +32 -0
  601. package/src/data_import/types/index.ts +1 -0
  602. package/src/data_import/utils/data.ts +145 -0
  603. package/src/data_import/utils/file_headers.ts +90 -0
  604. package/src/data_import/utils/file_to_json.ts +106 -0
  605. package/src/data_import/utils/get_import_inference_type.ts +27 -0
  606. package/src/data_import/utils/get_properties_mapping.ts +67 -0
  607. package/src/data_import/utils/index.ts +3 -0
  608. package/src/editor/components/SlashCommandMenu.tsx +516 -0
  609. package/src/editor/components/editor-bubble-item.tsx +32 -0
  610. package/src/editor/components/editor-bubble.tsx +118 -0
  611. package/src/editor/components/image-bubble.tsx +158 -0
  612. package/src/editor/components/index.ts +14 -0
  613. package/src/editor/components/table-bubble.tsx +167 -0
  614. package/src/editor/editor.tsx +455 -0
  615. package/src/editor/extensions/HighlightDecorationExtension.ts +114 -0
  616. package/src/editor/extensions/Image/index.ts +133 -0
  617. package/src/editor/extensions/Image.ts +159 -0
  618. package/src/editor/extensions/TextLoadingDecorationExtension.tsx +107 -0
  619. package/src/editor/extensions/clipboard.ts +72 -0
  620. package/src/editor/extensions/custom-keymap.ts +25 -0
  621. package/src/editor/extensions/drag-and-drop.tsx +492 -0
  622. package/src/editor/hooks/useProseMirror.ts +124 -0
  623. package/src/editor/hooks/useProseMirrorContext.ts +15 -0
  624. package/src/editor/index.ts +2 -0
  625. package/src/editor/markdown.ts +172 -0
  626. package/src/editor/nodeViews/ImageComponent.tsx +20 -0
  627. package/src/editor/nodeViews/ReactNodeView.tsx +89 -0
  628. package/src/editor/nodeViews/TaskItemComponent.tsx +29 -0
  629. package/src/editor/nodeViews/index.ts +35 -0
  630. package/src/editor/plugins/index.ts +58 -0
  631. package/src/editor/plugins/inputrules.ts +82 -0
  632. package/src/editor/plugins/placeholderPlugin.ts +55 -0
  633. package/src/editor/plugins/slashCommandPlugin.ts +61 -0
  634. package/src/editor/schema.ts +240 -0
  635. package/src/editor/selectors/ai-selector.tsx +111 -0
  636. package/src/editor/selectors/color-selector.tsx +200 -0
  637. package/src/editor/selectors/link-selector.tsx +118 -0
  638. package/src/editor/selectors/node-selector.tsx +157 -0
  639. package/src/editor/selectors/text-buttons.tsx +86 -0
  640. package/src/editor/types.ts +6 -0
  641. package/src/editor/useProseMirror.ts +126 -0
  642. package/src/editor/utils/prosemirror-utils.ts +113 -0
  643. package/src/editor/utils/remove_classes.ts +17 -0
  644. package/src/editor/utils/useDebouncedCallback.ts +25 -0
  645. package/src/form/EntityForm.tsx +800 -0
  646. package/src/form/EntityFormActions.tsx +204 -0
  647. package/src/form/PropertyFieldBinding.tsx +344 -0
  648. package/src/form/components/ErrorFocus.tsx +44 -0
  649. package/src/form/components/FieldHelperText.tsx +45 -0
  650. package/src/form/components/FormEntry.tsx +22 -0
  651. package/src/form/components/FormLayout.tsx +16 -0
  652. package/src/form/components/LabelWithIcon.tsx +43 -0
  653. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  654. package/src/form/components/LocalChangesMenu.tsx +145 -0
  655. package/src/form/components/StorageItemPreview.tsx +81 -0
  656. package/src/form/components/StorageUploadProgress.tsx +105 -0
  657. package/src/form/components/index.tsx +5 -0
  658. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +107 -0
  659. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +169 -0
  660. package/src/form/field_bindings/BlockFieldBinding.tsx +274 -0
  661. package/src/form/field_bindings/DateTimeFieldBinding.tsx +72 -0
  662. package/src/form/field_bindings/KeyValueFieldBinding.tsx +567 -0
  663. package/src/form/field_bindings/MapFieldBinding.tsx +162 -0
  664. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +142 -0
  665. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +122 -0
  666. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +155 -0
  667. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +66 -0
  668. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +140 -0
  669. package/src/form/field_bindings/ReferenceFieldBinding.tsx +140 -0
  670. package/src/form/field_bindings/RelationFieldBinding.tsx +183 -0
  671. package/src/form/field_bindings/RepeatFieldBinding.tsx +139 -0
  672. package/src/form/field_bindings/SelectFieldBinding.tsx +109 -0
  673. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +493 -0
  674. package/src/form/field_bindings/SwitchFieldBinding.tsx +65 -0
  675. package/src/form/field_bindings/TextFieldBinding.tsx +155 -0
  676. package/src/form/field_bindings/UserSelectFieldBinding.tsx +98 -0
  677. package/src/form/index.tsx +27 -0
  678. package/src/form/useClearRestoreValue.tsx +36 -0
  679. package/src/form/validation.ts +592 -0
  680. package/src/hooks/index.ts +15 -0
  681. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +20 -0
  682. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +16 -0
  683. package/src/hooks/navigation/contexts/UrlContext.tsx +25 -0
  684. package/src/hooks/navigation/contexts/index.ts +14 -0
  685. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +155 -0
  686. package/src/hooks/navigation/useBuildNavigationStateController.tsx +123 -0
  687. package/src/hooks/navigation/useBuildUrlController.tsx +66 -0
  688. package/src/hooks/navigation/useNavigationRegistry.ts +146 -0
  689. package/src/hooks/navigation/useNavigationResolution.ts +130 -0
  690. package/src/hooks/navigation/useNavigationURLs.ts +56 -0
  691. package/src/hooks/navigation/useResolvedCollections.ts +133 -0
  692. package/src/hooks/navigation/useResolvedViews.tsx +197 -0
  693. package/src/hooks/navigation/useTopLevelNavigation.ts +257 -0
  694. package/src/hooks/navigation/utils.ts +171 -0
  695. package/src/hooks/useBreadcrumbsController.tsx +49 -0
  696. package/src/hooks/useBuildSideDialogsController.tsx +145 -0
  697. package/src/hooks/useBuildSideEntityController.tsx +309 -0
  698. package/src/hooks/useCMSContext.tsx +77 -0
  699. package/src/hooks/useEntityHistory.ts +168 -0
  700. package/src/hooks/useEntitySelectionDialog.tsx +57 -0
  701. package/src/hooks/useResolvedNavigationFrom.tsx +155 -0
  702. package/src/hooks/useSideDialogsController.tsx +25 -0
  703. package/src/hooks/useSideEntityController.tsx +13 -0
  704. package/src/index.ts +95 -0
  705. package/src/preview/PropertyPreview.tsx +291 -0
  706. package/src/preview/components/ArrayEnumPreview.tsx +39 -0
  707. package/src/preview/components/BooleanPreview.tsx +25 -0
  708. package/src/preview/components/DatePreview.tsx +93 -0
  709. package/src/preview/components/EmptyValue.tsx +10 -0
  710. package/src/preview/components/EnumValuesChip.tsx +39 -0
  711. package/src/preview/components/ImagePreview.tsx +142 -0
  712. package/src/preview/components/ReferencePreview.tsx +166 -0
  713. package/src/preview/components/RelationPreview.tsx +158 -0
  714. package/src/preview/components/StorageThumbnail.tsx +90 -0
  715. package/src/preview/components/UrlComponentPreview.tsx +114 -0
  716. package/src/preview/components/UserPreview.tsx +29 -0
  717. package/src/preview/index.ts +25 -0
  718. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +73 -0
  719. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +44 -0
  720. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +50 -0
  721. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +49 -0
  722. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +44 -0
  723. package/src/preview/property_previews/ArrayOneOfPreview.tsx +68 -0
  724. package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +35 -0
  725. package/src/preview/property_previews/ArrayPropertyPreview.tsx +70 -0
  726. package/src/preview/property_previews/MapPropertyPreview.tsx +146 -0
  727. package/src/preview/property_previews/NumberPropertyPreview.tsx +29 -0
  728. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +277 -0
  729. package/src/preview/property_previews/StringPropertyPreview.tsx +59 -0
  730. package/src/preview/util.ts +30 -0
  731. package/src/routes/CustomViewRoute.tsx +24 -0
  732. package/src/routes/RebaseRoute.tsx +265 -0
  733. package/src/routes/index.ts +2 -0
  734. package/src/types/components/EntityFormActionsProps.tsx +20 -0
  735. package/src/types/components/EntityFormProps.tsx +54 -0
  736. package/src/types/components/PropertyPreviewProps.tsx +59 -0
  737. package/src/types/components/formex.tsx +46 -0
  738. package/src/types/components/index.ts +3 -0
  739. package/src/types/fields.tsx +299 -0
  740. package/src/types/index.ts +4 -0
  741. package/src/util/entity_actions.ts +28 -0
  742. package/src/util/index.ts +5 -0
  743. package/src/util/navigation_utils.ts +223 -0
  744. package/src/util/previews.ts +50 -0
  745. package/src/util/property_utils.tsx +215 -0
  746. package/src/util/resolutions.ts +69 -0
package/dist/index.js ADDED
@@ -0,0 +1,2885 @@
1
+ import { a as useCMSContext, d as downloadEntitiesExport, b as useCollectionRegistryController, c as useEntitySelectionDialog, R as ReferencePreview, u as useUrlController, e as useNavigationStateController, N as NavigationCard, f as useBreadcrumbsController, D as Drawer, A as AppBar, S as SideDialogs, g as Scaffold, E as EntityCollectionView, h as EntityEditView, i as RolesView, U as UsersView, C as CollectionEditorDialogs, j as RebaseNavigation, P as PropertyPreview, k as useCollectionEditorController } from "./util-W5Lh0Emr.js";
2
+ import { l, m, n, o, p, q, r, s, t, v, B, w, x, y, z, F, G, H, I, J, K, L, M, O, Q, T, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN } from "./util-W5Lh0Emr.js";
3
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
4
+ import { c } from "react-compiler-runtime";
5
+ import { Tooltip, IconButton, DownloadIcon, Dialog, DialogTitle, DialogContent, cls, BooleanSwitchWithLabel, DialogActions, Button, Chip, StarIcon, Collapse, EditIcon, ExpandablePanel, Typography, WarningIcon, TextField, Container, SearchBar, ErrorBoundary, CircularProgressCenter } from "@rebasepro/ui";
6
+ import React__default, { useState, useEffect, useCallback, useMemo, useRef, useLayoutEffect } from "react";
7
+ import { useAdminModeController, useUserConfigurationPersistence, useTranslation, useRebaseContext, useSlot, IconForView, useCustomizationController, useCollapsedGroups, useRestoreScroll, useRebaseRegistryDispatch, useRebaseRegistry, useAuthController, LoginView, NotFoundPage, UnsavedChangesDialog, useInternalUserManagementController, UIReferenceView, RebaseRoutes, UserSettingsView, ErrorView } from "@rebasepro/core";
8
+ import "prosemirror-model";
9
+ import "@floating-ui/dom";
10
+ import "prosemirror-commands";
11
+ import "prosemirror-schema-list";
12
+ import "prosemirror-state";
13
+ import "fast-equals";
14
+ import { getNavigationEntriesFromPath, getReferenceFrom } from "@rebasepro/common";
15
+ import "@rebasepro/formex";
16
+ import "zod";
17
+ import { toArray, prettifyIdentifier } from "@rebasepro/utils";
18
+ import "date-fns";
19
+ import "date-fns/locale";
20
+ import "@rebasepro/types";
21
+ import { useLocation, useNavigate, Outlet, Route } from "react-router-dom";
22
+ import "prism-react-renderer";
23
+ import "@rebasepro/schema-inference";
24
+ import "xlsx";
25
+ import { useSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, closestCenter, pointerWithin, closestCorners, getFirstCollision, rectIntersection, useDroppable, useDndMonitor, DndContext, MeasuringStrategy, DragOverlay } from "@dnd-kit/core";
26
+ import { restrictToVerticalAxis, restrictToWindowEdges } from "@dnd-kit/modifiers";
27
+ import { useSortable, arrayMove, defaultAnimateLayoutChanges, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from "@dnd-kit/sortable";
28
+ import { CSS } from "@dnd-kit/utilities";
29
+ import "react-dropzone";
30
+ import Fuse from "fuse.js";
31
+ import { useLocation as useLocation$1, useBlocker } from "react-router";
32
+ function resolveNavigationFrom({
33
+ path,
34
+ context
35
+ }) {
36
+ const data = context.data;
37
+ const {
38
+ navigationStateController,
39
+ collectionRegistryController
40
+ } = context;
41
+ if (!navigationStateController || !collectionRegistryController) {
42
+ throw Error("Calling resolveNavigationFrom, but main navigation has not yet been initialised");
43
+ }
44
+ const navigationEntries = getNavigationEntriesFromPath({
45
+ path,
46
+ collections: collectionRegistryController.collections ?? []
47
+ });
48
+ const resultPromises = navigationEntries.map((entry) => {
49
+ if (entry.type === "collection") {
50
+ return Promise.resolve(entry);
51
+ } else if (entry.type === "entity") {
52
+ const collection = collectionRegistryController.getCollection(entry.slug);
53
+ if (!collection) {
54
+ throw Error(`No collection defined in the navigation for the entity with path ${entry.slug}`);
55
+ }
56
+ return data.collection(entry.slug).findById(entry.entityId).then((entity) => {
57
+ if (!entity) return void 0;
58
+ return {
59
+ ...entry,
60
+ entity
61
+ };
62
+ });
63
+ } else if (entry.type === "custom_view") {
64
+ return Promise.resolve(entry);
65
+ } else {
66
+ throw Error("Unmapped element in useEntitiesFromPath");
67
+ }
68
+ }).filter((v2) => Boolean(v2));
69
+ return Promise.all(resultPromises);
70
+ }
71
+ function useResolvedNavigationFrom(t0) {
72
+ const $2 = c(13);
73
+ const {
74
+ path
75
+ } = t0;
76
+ const context = useCMSContext();
77
+ const {
78
+ navigationStateController,
79
+ collectionRegistryController
80
+ } = context;
81
+ const [data, setData] = useState();
82
+ const [dataLoading, setDataLoading] = useState(false);
83
+ const [dataLoadingError, setDataLoadingError] = useState();
84
+ let t1;
85
+ if ($2[0] !== collectionRegistryController || $2[1] !== context || $2[2] !== navigationStateController || $2[3] !== path) {
86
+ t1 = () => {
87
+ if (navigationStateController && collectionRegistryController) {
88
+ setDataLoading(true);
89
+ setDataLoadingError(void 0);
90
+ resolveNavigationFrom({
91
+ path,
92
+ context
93
+ }).then(setData).catch((e) => setDataLoadingError(e)).finally(() => setDataLoading(false));
94
+ }
95
+ };
96
+ $2[0] = collectionRegistryController;
97
+ $2[1] = context;
98
+ $2[2] = navigationStateController;
99
+ $2[3] = path;
100
+ $2[4] = t1;
101
+ } else {
102
+ t1 = $2[4];
103
+ }
104
+ let t2;
105
+ if ($2[5] !== context || $2[6] !== path) {
106
+ t2 = [path, context];
107
+ $2[5] = context;
108
+ $2[6] = path;
109
+ $2[7] = t2;
110
+ } else {
111
+ t2 = $2[7];
112
+ }
113
+ useEffect(t1, t2);
114
+ if (!navigationStateController) {
115
+ let t32;
116
+ if ($2[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
117
+ t32 = {
118
+ dataLoading: true
119
+ };
120
+ $2[8] = t32;
121
+ } else {
122
+ t32 = $2[8];
123
+ }
124
+ return t32;
125
+ }
126
+ let t3;
127
+ if ($2[9] !== data || $2[10] !== dataLoading || $2[11] !== dataLoadingError) {
128
+ t3 = {
129
+ data,
130
+ dataLoading,
131
+ dataLoadingError
132
+ };
133
+ $2[9] = data;
134
+ $2[10] = dataLoading;
135
+ $2[11] = dataLoadingError;
136
+ $2[12] = t3;
137
+ } else {
138
+ t3 = $2[12];
139
+ }
140
+ return t3;
141
+ }
142
+ function BasicExportAction({
143
+ data,
144
+ properties,
145
+ propertiesOrder
146
+ }) {
147
+ const dateRef = React__default.useRef(/* @__PURE__ */ new Date());
148
+ const [flattenArrays, setFlattenArrays] = React__default.useState(true);
149
+ const [exportType, setExportType] = React__default.useState("csv");
150
+ const [dateExportType, setDateExportType] = React__default.useState("string");
151
+ const [open, setOpen] = React__default.useState(false);
152
+ const handleClickOpen = useCallback(() => {
153
+ setOpen(true);
154
+ }, [setOpen]);
155
+ const handleClose = useCallback(() => {
156
+ setOpen(false);
157
+ }, [setOpen]);
158
+ const onOkClicked = useCallback(() => {
159
+ downloadEntitiesExport({
160
+ data,
161
+ additionalData: [],
162
+ properties,
163
+ propertiesOrder,
164
+ name: "export.csv",
165
+ flattenArrays,
166
+ additionalHeaders: [],
167
+ exportType,
168
+ dateExportType
169
+ });
170
+ handleClose();
171
+ }, []);
172
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
173
+ /* @__PURE__ */ jsx(Tooltip, { title: "Export", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { size: "small", color: "primary", onClick: handleClickOpen, children: /* @__PURE__ */ jsx(DownloadIcon, { size: "small" }) }) }),
174
+ /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: setOpen, maxWidth: "xl", children: [
175
+ /* @__PURE__ */ jsx(DialogTitle, { variant: "h6", children: "Export data" }),
176
+ /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col gap-4 my-4", children: [
177
+ /* @__PURE__ */ jsx("div", { children: "Download the the content of this table as a CSV" }),
178
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4", children: [
179
+ /* @__PURE__ */ jsxs("div", { className: "p-4 flex flex-col", children: [
180
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
181
+ /* @__PURE__ */ jsx("input", { id: "radio-csv", type: "radio", value: "csv", name: "exportType", checked: exportType === "csv", onChange: () => setExportType("csv"), className: cls("w-4 bg-surface-100 border-surface-300 dark:bg-surface-700 dark:border-surface-600") }),
182
+ /* @__PURE__ */ jsx("label", { htmlFor: "radio-csv", className: "p-2 text-sm font-medium text-surface-900 dark:text-surface-accent-300", children: "CSV" })
183
+ ] }),
184
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
185
+ /* @__PURE__ */ jsx("input", { id: "radio-json", type: "radio", value: "json", name: "exportType", checked: exportType === "json", onChange: () => setExportType("json"), className: cls("w-4 bg-surface-100 border-surface-300 dark:bg-surface-700 dark:border-surface-600") }),
186
+ /* @__PURE__ */ jsx("label", { htmlFor: "radio-json", className: "p-2 text-sm font-medium text-surface-900 dark:text-surface-accent-300", children: "JSON" })
187
+ ] })
188
+ ] }),
189
+ /* @__PURE__ */ jsxs("div", { className: "p-4 flex flex-col", children: [
190
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
191
+ /* @__PURE__ */ jsx("input", { id: "radio-timestamp", type: "radio", value: "timestamp", name: "dateExportType", checked: dateExportType === "timestamp", onChange: () => setDateExportType("timestamp"), className: cls("w-4 bg-surface-100 border-surface-300 dark:bg-surface-700 dark:border-surface-600") }),
192
+ /* @__PURE__ */ jsxs("label", { htmlFor: "radio-timestamp", className: "p-2 text-sm font-medium text-surface-900 dark:text-surface-accent-300", children: [
193
+ "Dates as timestamps (",
194
+ dateRef.current.getTime(),
195
+ ")"
196
+ ] })
197
+ ] }),
198
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
199
+ /* @__PURE__ */ jsx("input", { id: "radio-string", type: "radio", value: "string", name: "dateExportType", checked: dateExportType === "string", onChange: () => setDateExportType("string"), className: cls("w-4 bg-surface-100 border-surface-300 dark:bg-surface-700 dark:border-surface-600") }),
200
+ /* @__PURE__ */ jsxs("label", { htmlFor: "radio-string", className: "p-2 text-sm font-medium text-surface-900 dark:text-surface-accent-300", children: [
201
+ "Dates as strings (",
202
+ dateRef.current.toISOString(),
203
+ ")"
204
+ ] })
205
+ ] })
206
+ ] })
207
+ ] }),
208
+ /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { size: "small", disabled: exportType !== "csv", value: flattenArrays, onValueChange: setFlattenArrays, label: "Flatten arrays" })
209
+ ] }),
210
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
211
+ /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "text", children: "Cancel" }),
212
+ /* @__PURE__ */ jsx(Button, { onClick: onOkClicked, children: "Download" })
213
+ ] })
214
+ ] })
215
+ ] });
216
+ }
217
+ function ReferenceWidget({
218
+ name,
219
+ multiselect = false,
220
+ path,
221
+ disabled,
222
+ value,
223
+ onReferenceSelected,
224
+ onMultipleReferenceSelected,
225
+ previewProperties,
226
+ forceFilter,
227
+ size,
228
+ className,
229
+ includeId,
230
+ includeEntityLink
231
+ }) {
232
+ const collectionRegistryController = useCollectionRegistryController();
233
+ const collection = useMemo(() => {
234
+ return collectionRegistryController.getCollection(path);
235
+ }, [path, collectionRegistryController.getCollection]);
236
+ const onSingleEntitySelected = useCallback((entity) => {
237
+ if (disabled) return;
238
+ if (onReferenceSelected) {
239
+ const reference = entity ? getReferenceFrom(entity) : null;
240
+ onReferenceSelected?.({
241
+ reference,
242
+ entity
243
+ });
244
+ }
245
+ }, [disabled, onReferenceSelected]);
246
+ const onMultipleEntitiesSelected = useCallback((entities) => {
247
+ if (disabled) return;
248
+ if (onMultipleReferenceSelected) {
249
+ const references = entities ? entities.map((e) => getReferenceFrom(e)) : null;
250
+ onMultipleReferenceSelected({
251
+ references,
252
+ entities
253
+ });
254
+ }
255
+ }, [disabled, onReferenceSelected]);
256
+ const referenceDialogController = useEntitySelectionDialog({
257
+ multiselect,
258
+ path,
259
+ collection,
260
+ onSingleEntitySelected,
261
+ onMultipleEntitiesSelected,
262
+ forceFilter
263
+ });
264
+ useCallback((e_0) => {
265
+ e_0.stopPropagation();
266
+ if (multiselect) {
267
+ onMultipleEntitiesSelected([]);
268
+ } else {
269
+ onSingleEntitySelected(null);
270
+ }
271
+ }, [onReferenceSelected]);
272
+ let child;
273
+ const onEntryClick = () => {
274
+ if (disabled) return;
275
+ referenceDialogController.open();
276
+ };
277
+ if (Array.isArray(value)) {
278
+ child = /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: value.map((ref, index) => {
279
+ return /* @__PURE__ */ jsx(ReferencePreview, { onClick: onEntryClick, reference: ref, disabled, previewProperties, size, includeId, includeEntityLink }, `reference_preview_${index}`);
280
+ }) });
281
+ } else if (value?.isEntityReference && value?.isEntityReference()) {
282
+ child = /* @__PURE__ */ jsx(ReferencePreview, { reference: value, onClick: onEntryClick, disabled, previewProperties, size, includeId, includeEntityLink });
283
+ }
284
+ return /* @__PURE__ */ jsxs("div", { className: cls("text-sm font-medium", "min-w-80 flex flex-col gap-4", "relative transition-colors duration-200 ease-in rounded-xs font-medium", disabled ? "bg-opacity-50" : "hover:bg-opacity-75", "dark:text-white/50 text-text-primary/50 dark:text-text-primary-dark/50 dark:text-white/50", className), children: [
285
+ child,
286
+ !value && /* @__PURE__ */ jsx("div", { className: "justify-center text-left", children: /* @__PURE__ */ jsxs(Button, { disabled, onClick: onEntryClick, children: [
287
+ "Edit ",
288
+ name
289
+ ] }) })
290
+ ] });
291
+ }
292
+ function AdminModeSyncer({
293
+ devViews
294
+ }) {
295
+ const location = useLocation();
296
+ const urlController = useUrlController();
297
+ const adminModeController = useAdminModeController();
298
+ const currentModeRef = React__default.useRef(adminModeController.mode);
299
+ currentModeRef.current = adminModeController.mode;
300
+ const setModeRef = React__default.useRef(adminModeController.setMode);
301
+ setModeRef.current = adminModeController.setMode;
302
+ useEffect(() => {
303
+ const path = location.pathname;
304
+ const isContentRoute = urlController.isUrlCollectionPath(path) || path === urlController.basePath;
305
+ const studioHomePath = urlController.basePath === "/" ? "/s" : `${urlController.basePath}/s`;
306
+ const isStudioRoute = path === studioHomePath || path.startsWith(studioHomePath + "/") || devViews?.some((view) => {
307
+ const viewPath = urlController.buildAppUrlPath(view.slug);
308
+ return path.startsWith(`${viewPath}/`) || path === viewPath;
309
+ });
310
+ if (isStudioRoute && currentModeRef.current !== "studio") {
311
+ setModeRef.current("studio");
312
+ } else if (isContentRoute && currentModeRef.current !== "content") {
313
+ setModeRef.current("content");
314
+ }
315
+ }, [location.pathname, urlController, devViews]);
316
+ return null;
317
+ }
318
+ function NavigationChip(t0) {
319
+ const $2 = c(18);
320
+ const {
321
+ entry
322
+ } = t0;
323
+ const navigate = useNavigate();
324
+ const userConfigurationPersistence = useUserConfigurationPersistence();
325
+ if (!userConfigurationPersistence) {
326
+ return null;
327
+ }
328
+ let t1;
329
+ if ($2[0] !== entry.slug || $2[1] !== userConfigurationPersistence.favouritePaths) {
330
+ t1 = userConfigurationPersistence.favouritePaths.includes(entry.slug);
331
+ $2[0] = entry.slug;
332
+ $2[1] = userConfigurationPersistence.favouritePaths;
333
+ $2[2] = t1;
334
+ } else {
335
+ t1 = $2[2];
336
+ }
337
+ const favourite = t1;
338
+ let t2;
339
+ if ($2[3] !== entry.slug || $2[4] !== favourite || $2[5] !== userConfigurationPersistence) {
340
+ t2 = (e) => {
341
+ e.preventDefault();
342
+ e.stopPropagation();
343
+ if (favourite) {
344
+ userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p2) => p2 !== entry.slug));
345
+ } else {
346
+ userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, entry.slug]);
347
+ }
348
+ };
349
+ $2[3] = entry.slug;
350
+ $2[4] = favourite;
351
+ $2[5] = userConfigurationPersistence;
352
+ $2[6] = t2;
353
+ } else {
354
+ t2 = $2[6];
355
+ }
356
+ const onIconClick = t2;
357
+ let t3;
358
+ if ($2[7] !== entry.url || $2[8] !== navigate) {
359
+ t3 = () => navigate(entry.url);
360
+ $2[7] = entry.url;
361
+ $2[8] = navigate;
362
+ $2[9] = t3;
363
+ } else {
364
+ t3 = $2[9];
365
+ }
366
+ const t4 = favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500";
367
+ let t5;
368
+ if ($2[10] !== onIconClick || $2[11] !== t4) {
369
+ t5 = /* @__PURE__ */ jsx(StarIcon, { onClick: onIconClick, size: 18, className: t4 });
370
+ $2[10] = onIconClick;
371
+ $2[11] = t4;
372
+ $2[12] = t5;
373
+ } else {
374
+ t5 = $2[12];
375
+ }
376
+ let t6;
377
+ if ($2[13] !== entry.name || $2[14] !== entry.slug || $2[15] !== t3 || $2[16] !== t5) {
378
+ t6 = /* @__PURE__ */ jsx(Chip, { onClick: t3, icon: t5, children: entry.name }, entry.slug);
379
+ $2[13] = entry.name;
380
+ $2[14] = entry.slug;
381
+ $2[15] = t3;
382
+ $2[16] = t5;
383
+ $2[17] = t6;
384
+ } else {
385
+ t6 = $2[17];
386
+ }
387
+ return t6;
388
+ }
389
+ function FavouritesView(t0) {
390
+ const $2 = c(17);
391
+ const navigationStateController = useNavigationStateController();
392
+ const userConfigurationPersistence = useUserConfigurationPersistence();
393
+ if (!userConfigurationPersistence) {
394
+ return null;
395
+ }
396
+ let t1;
397
+ if ($2[0] !== userConfigurationPersistence?.favouritePaths) {
398
+ t1 = userConfigurationPersistence?.favouritePaths ?? [];
399
+ $2[0] = userConfigurationPersistence?.favouritePaths;
400
+ $2[1] = t1;
401
+ } else {
402
+ t1 = $2[1];
403
+ }
404
+ let T0;
405
+ let t2;
406
+ let t3;
407
+ let t4;
408
+ if ($2[2] !== navigationStateController || $2[3] !== t1) {
409
+ let t52;
410
+ if ($2[8] !== navigationStateController) {
411
+ t52 = (path) => navigationStateController.topLevelNavigation?.navigationEntries.find((entry) => entry.slug === path);
412
+ $2[8] = navigationStateController;
413
+ $2[9] = t52;
414
+ } else {
415
+ t52 = $2[9];
416
+ }
417
+ const favouriteCollections = t1.map(t52).filter(Boolean);
418
+ T0 = Collapse;
419
+ t4 = favouriteCollections.length > 0;
420
+ t2 = "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]";
421
+ t3 = favouriteCollections.map(_temp$1);
422
+ $2[2] = navigationStateController;
423
+ $2[3] = t1;
424
+ $2[4] = T0;
425
+ $2[5] = t2;
426
+ $2[6] = t3;
427
+ $2[7] = t4;
428
+ } else {
429
+ T0 = $2[4];
430
+ t2 = $2[5];
431
+ t3 = $2[6];
432
+ t4 = $2[7];
433
+ }
434
+ let t5;
435
+ if ($2[10] !== t2 || $2[11] !== t3) {
436
+ t5 = /* @__PURE__ */ jsx("div", { className: t2, children: t3 });
437
+ $2[10] = t2;
438
+ $2[11] = t3;
439
+ $2[12] = t5;
440
+ } else {
441
+ t5 = $2[12];
442
+ }
443
+ let t6;
444
+ if ($2[13] !== T0 || $2[14] !== t4 || $2[15] !== t5) {
445
+ t6 = /* @__PURE__ */ jsx(T0, { in: t4, children: t5 });
446
+ $2[13] = T0;
447
+ $2[14] = t4;
448
+ $2[15] = t5;
449
+ $2[16] = t6;
450
+ } else {
451
+ t6 = $2[16];
452
+ }
453
+ return t6;
454
+ }
455
+ function _temp$1(entry_0) {
456
+ return /* @__PURE__ */ jsx(NavigationChip, { entry: entry_0 }, entry_0.slug);
457
+ }
458
+ function NavigationGroup(t0) {
459
+ const $2 = c(45);
460
+ const {
461
+ children,
462
+ group,
463
+ minimised,
464
+ isPreview,
465
+ isPotentialCardDropTarget,
466
+ onEditGroup,
467
+ dndDisabled,
468
+ collapsed,
469
+ onToggleCollapsed
470
+ } = t0;
471
+ const {
472
+ t: t2
473
+ } = useTranslation();
474
+ const [isHovered, setIsHovered] = useState(false);
475
+ let t1;
476
+ if ($2[0] !== group || $2[1] !== t2) {
477
+ t1 = group ?? t2("views_group");
478
+ $2[0] = group;
479
+ $2[1] = t2;
480
+ $2[2] = t1;
481
+ } else {
482
+ t1 = $2[2];
483
+ }
484
+ const currentGroupName = t1;
485
+ const showCaret = !isPreview && !!onToggleCollapsed;
486
+ const t22 = isPreview ? "px-1 py-0.5" : "";
487
+ let t3;
488
+ if ($2[3] !== t22) {
489
+ t3 = cls("flex items-center", t22);
490
+ $2[3] = t22;
491
+ $2[4] = t3;
492
+ } else {
493
+ t3 = $2[4];
494
+ }
495
+ const t4 = isPreview ? "body2" : "caption";
496
+ let t5;
497
+ if ($2[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
498
+ t5 = cls("p-4 py-2 rounded", "font-medium uppercase text-sm text-surface-600 dark:text-surface-400");
499
+ $2[5] = t5;
500
+ } else {
501
+ t5 = $2[5];
502
+ }
503
+ let t6;
504
+ if ($2[6] !== currentGroupName || $2[7] !== t4) {
505
+ t6 = /* @__PURE__ */ jsx(Typography, { variant: t4, component: "h2", color: "secondary", className: t5, children: currentGroupName });
506
+ $2[6] = currentGroupName;
507
+ $2[7] = t4;
508
+ $2[8] = t6;
509
+ } else {
510
+ t6 = $2[8];
511
+ }
512
+ let t7;
513
+ if ($2[9] !== currentGroupName || $2[10] !== dndDisabled || $2[11] !== isHovered || $2[12] !== isPreview || $2[13] !== onEditGroup) {
514
+ t7 = !isPreview && onEditGroup && !dndDisabled && /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (e) => {
515
+ e.stopPropagation();
516
+ onEditGroup(currentGroupName);
517
+ }, className: cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100"), children: /* @__PURE__ */ jsx(EditIcon, { size: "smallest" }) });
518
+ $2[9] = currentGroupName;
519
+ $2[10] = dndDisabled;
520
+ $2[11] = isHovered;
521
+ $2[12] = isPreview;
522
+ $2[13] = onEditGroup;
523
+ $2[14] = t7;
524
+ } else {
525
+ t7 = $2[14];
526
+ }
527
+ let t8;
528
+ if ($2[15] !== t3 || $2[16] !== t6 || $2[17] !== t7) {
529
+ t8 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
530
+ t6,
531
+ t7
532
+ ] });
533
+ $2[15] = t3;
534
+ $2[16] = t6;
535
+ $2[17] = t7;
536
+ $2[18] = t8;
537
+ } else {
538
+ t8 = $2[18];
539
+ }
540
+ const TitleContent = t8;
541
+ const t9 = !isPotentialCardDropTarget ? "my-10" : "my-6";
542
+ let t10;
543
+ if ($2[19] !== t9) {
544
+ t10 = cls(t9, "transition-all duration-200 ease-in-out");
545
+ $2[19] = t9;
546
+ $2[20] = t10;
547
+ } else {
548
+ t10 = $2[20];
549
+ }
550
+ let t11;
551
+ if ($2[21] !== TitleContent || $2[22] !== children || $2[23] !== isPreview) {
552
+ t11 = isPreview && /* @__PURE__ */ jsxs(Fragment, { children: [
553
+ /* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "p-4 py-2"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
554
+ children
555
+ ] });
556
+ $2[21] = TitleContent;
557
+ $2[22] = children;
558
+ $2[23] = isPreview;
559
+ $2[24] = t11;
560
+ } else {
561
+ t11 = $2[24];
562
+ }
563
+ let t12;
564
+ if ($2[25] !== TitleContent || $2[26] !== children || $2[27] !== collapsed || $2[28] !== isPreview || $2[29] !== minimised || $2[30] !== onToggleCollapsed || $2[31] !== showCaret) {
565
+ t12 = !isPreview && showCaret && /* @__PURE__ */ jsx(ExpandablePanel, { invisible: true, expanded: !collapsed, onExpandedChange: (open) => {
566
+ if (open !== !collapsed) {
567
+ onToggleCollapsed?.();
568
+ }
569
+ }, className: cls("mt-6"), titleClassName: cls("min-h-0 p-0 border-none", "rounded flex items-center justify-between w-full", "hover:bg-transparent", "cursor-pointer select-none", collapsed && "bg-surface-100 dark:bg-surface-800/50"), innerClassName: cls("mt-4", !minimised ? "pt-0" : ""), title: /* @__PURE__ */ jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), className: "flex items-center", children: TitleContent }), children: minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
570
+ minHeight: "50px"
571
+ } }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }) });
572
+ $2[25] = TitleContent;
573
+ $2[26] = children;
574
+ $2[27] = collapsed;
575
+ $2[28] = isPreview;
576
+ $2[29] = minimised;
577
+ $2[30] = onToggleCollapsed;
578
+ $2[31] = showCaret;
579
+ $2[32] = t12;
580
+ } else {
581
+ t12 = $2[32];
582
+ }
583
+ let t13;
584
+ if ($2[33] !== TitleContent || $2[34] !== children || $2[35] !== collapsed || $2[36] !== isPreview || $2[37] !== minimised || $2[38] !== showCaret) {
585
+ t13 = !isPreview && !showCaret && /* @__PURE__ */ jsxs(Fragment, { children: [
586
+ /* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "mt-6"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
587
+ !collapsed && (minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
588
+ minHeight: "50px"
589
+ } }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }))
590
+ ] });
591
+ $2[33] = TitleContent;
592
+ $2[34] = children;
593
+ $2[35] = collapsed;
594
+ $2[36] = isPreview;
595
+ $2[37] = minimised;
596
+ $2[38] = showCaret;
597
+ $2[39] = t13;
598
+ } else {
599
+ t13 = $2[39];
600
+ }
601
+ let t14;
602
+ if ($2[40] !== t10 || $2[41] !== t11 || $2[42] !== t12 || $2[43] !== t13) {
603
+ t14 = /* @__PURE__ */ jsxs("div", { className: t10, children: [
604
+ t11,
605
+ t12,
606
+ t13
607
+ ] });
608
+ $2[40] = t10;
609
+ $2[41] = t11;
610
+ $2[42] = t12;
611
+ $2[43] = t13;
612
+ $2[44] = t14;
613
+ } else {
614
+ t14 = $2[44];
615
+ }
616
+ return t14;
617
+ }
618
+ function NavigationCardBinding(t0) {
619
+ const $2 = c(30);
620
+ const {
621
+ slug,
622
+ collection,
623
+ view,
624
+ url,
625
+ name,
626
+ description,
627
+ onClick,
628
+ shrink
629
+ } = t0;
630
+ const userConfigurationPersistence = useUserConfigurationPersistence();
631
+ const t1 = collection ?? view;
632
+ let t2;
633
+ if ($2[0] !== t1) {
634
+ t2 = /* @__PURE__ */ jsx(IconForView, { collectionOrView: t1 });
635
+ $2[0] = t1;
636
+ $2[1] = t2;
637
+ } else {
638
+ t2 = $2[1];
639
+ }
640
+ const collectionIcon = t2;
641
+ const navigate = useNavigate();
642
+ const context = useRebaseContext();
643
+ let t3;
644
+ if ($2[2] !== userConfigurationPersistence?.favouritePaths) {
645
+ t3 = userConfigurationPersistence?.favouritePaths ?? [];
646
+ $2[2] = userConfigurationPersistence?.favouritePaths;
647
+ $2[3] = t3;
648
+ } else {
649
+ t3 = $2[3];
650
+ }
651
+ let t4;
652
+ if ($2[4] !== slug || $2[5] !== t3) {
653
+ t4 = t3.includes(slug);
654
+ $2[4] = slug;
655
+ $2[5] = t3;
656
+ $2[6] = t4;
657
+ } else {
658
+ t4 = $2[6];
659
+ }
660
+ const favourite = t4;
661
+ const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
662
+ e.preventDefault();
663
+ e.stopPropagation();
664
+ if (favourite) {
665
+ userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p2) => p2 !== slug));
666
+ } else {
667
+ userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, slug]);
668
+ }
669
+ }, children: /* @__PURE__ */ jsx(StarIcon, { size: "small", className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
670
+ let t5;
671
+ if ($2[7] !== collection || $2[8] !== context || $2[9] !== slug) {
672
+ t5 = {
673
+ slug,
674
+ collection,
675
+ context
676
+ };
677
+ $2[7] = collection;
678
+ $2[8] = context;
679
+ $2[9] = slug;
680
+ $2[10] = t5;
681
+ } else {
682
+ t5 = $2[10];
683
+ }
684
+ const pluginCardActions = useSlot("home.collection.actions", t5);
685
+ if (collection?.isTableMissing) {
686
+ const t62 = `Table mapped to "${collection?.slug || collection?.name}" is missing in the database. Run migrations.`;
687
+ let t72;
688
+ if ($2[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
689
+ t72 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(WarningIcon, { size: "small", className: "text-red-600 dark:text-red-400" }) });
690
+ $2[11] = t72;
691
+ } else {
692
+ t72 = $2[11];
693
+ }
694
+ let t82;
695
+ if ($2[12] !== t62) {
696
+ t82 = /* @__PURE__ */ jsx(Tooltip, { title: t62, children: t72 }, "warning");
697
+ $2[12] = t62;
698
+ $2[13] = t82;
699
+ } else {
700
+ t82 = $2[13];
701
+ }
702
+ actionsArray.unshift(t82);
703
+ }
704
+ let t6;
705
+ if ($2[14] !== actionsArray || $2[15] !== pluginCardActions) {
706
+ t6 = /* @__PURE__ */ jsxs(Fragment, { children: [
707
+ actionsArray,
708
+ pluginCardActions
709
+ ] });
710
+ $2[14] = actionsArray;
711
+ $2[15] = pluginCardActions;
712
+ $2[16] = t6;
713
+ } else {
714
+ t6 = $2[16];
715
+ }
716
+ const actions = t6;
717
+ let t7;
718
+ if ($2[17] !== navigate || $2[18] !== onClick || $2[19] !== slug || $2[20] !== url || $2[21] !== userConfigurationPersistence) {
719
+ t7 = () => {
720
+ onClick?.();
721
+ navigate(url);
722
+ if (userConfigurationPersistence) {
723
+ userConfigurationPersistence.setRecentlyVisitedPaths([slug, ...(userConfigurationPersistence.recentlyVisitedPaths ?? []).filter((p_0) => p_0 !== slug)]);
724
+ }
725
+ };
726
+ $2[17] = navigate;
727
+ $2[18] = onClick;
728
+ $2[19] = slug;
729
+ $2[20] = url;
730
+ $2[21] = userConfigurationPersistence;
731
+ $2[22] = t7;
732
+ } else {
733
+ t7 = $2[22];
734
+ }
735
+ let t8;
736
+ if ($2[23] !== actions || $2[24] !== collectionIcon || $2[25] !== description || $2[26] !== name || $2[27] !== shrink || $2[28] !== t7) {
737
+ t8 = /* @__PURE__ */ jsx(NavigationCard, { icon: collectionIcon, name, description, actions, onClick: t7, shrink });
738
+ $2[23] = actions;
739
+ $2[24] = collectionIcon;
740
+ $2[25] = description;
741
+ $2[26] = name;
742
+ $2[27] = shrink;
743
+ $2[28] = t7;
744
+ $2[29] = t8;
745
+ } else {
746
+ t8 = $2[29];
747
+ }
748
+ return t8;
749
+ }
750
+ const animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
751
+ ...args,
752
+ wasDragging: true
753
+ });
754
+ const dropAnimationConfig = {};
755
+ const cloneSerializableNavigationEntry = (entry) => {
756
+ const clonedEntry = {
757
+ id: entry.id,
758
+ slug: entry.slug,
759
+ url: entry.url,
760
+ name: entry.name,
761
+ type: entry.type,
762
+ collection: entry.collection ? {
763
+ ...entry.collection
764
+ } : void 0,
765
+ view: entry.view ? {
766
+ ...entry.view
767
+ } : void 0,
768
+ ...entry.group && {
769
+ group: entry.group
770
+ },
771
+ ...entry.description && {
772
+ description: entry.description
773
+ }
774
+ };
775
+ return clonedEntry;
776
+ };
777
+ const cloneItemsForDnd = (items) => items.map((g) => ({
778
+ name: g.name,
779
+ entries: g.entries.map(cloneSerializableNavigationEntry)
780
+ }));
781
+ function SortableNavigationCard(t0) {
782
+ const $2 = c(17);
783
+ const {
784
+ entry,
785
+ onClick
786
+ } = t0;
787
+ let t1;
788
+ if ($2[0] !== entry.url) {
789
+ t1 = {
790
+ id: entry.url,
791
+ animateLayoutChanges
792
+ };
793
+ $2[0] = entry.url;
794
+ $2[1] = t1;
795
+ } else {
796
+ t1 = $2[1];
797
+ }
798
+ const {
799
+ setNodeRef,
800
+ listeners,
801
+ attributes,
802
+ transform,
803
+ transition,
804
+ isDragging
805
+ } = useSortable(t1);
806
+ let t2;
807
+ if ($2[2] !== transform) {
808
+ t2 = transform ? CSS.Transform.toString(transform) : void 0;
809
+ $2[2] = transform;
810
+ $2[3] = t2;
811
+ } else {
812
+ t2 = $2[3];
813
+ }
814
+ const t3 = isDragging ? 0 : 1;
815
+ let t4;
816
+ if ($2[4] !== t2 || $2[5] !== t3 || $2[6] !== transition) {
817
+ t4 = {
818
+ transform: t2,
819
+ transition,
820
+ opacity: t3
821
+ };
822
+ $2[4] = t2;
823
+ $2[5] = t3;
824
+ $2[6] = transition;
825
+ $2[7] = t4;
826
+ } else {
827
+ t4 = $2[7];
828
+ }
829
+ const style = t4;
830
+ let t5;
831
+ if ($2[8] !== entry || $2[9] !== onClick) {
832
+ t5 = /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry, onClick });
833
+ $2[8] = entry;
834
+ $2[9] = onClick;
835
+ $2[10] = t5;
836
+ } else {
837
+ t5 = $2[10];
838
+ }
839
+ let t6;
840
+ if ($2[11] !== attributes || $2[12] !== listeners || $2[13] !== setNodeRef || $2[14] !== style || $2[15] !== t5) {
841
+ t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children: t5 });
842
+ $2[11] = attributes;
843
+ $2[12] = listeners;
844
+ $2[13] = setNodeRef;
845
+ $2[14] = style;
846
+ $2[15] = t5;
847
+ $2[16] = t6;
848
+ } else {
849
+ t6 = $2[16];
850
+ }
851
+ return t6;
852
+ }
853
+ function NavigationGroupDroppable(t0) {
854
+ const $2 = c(11);
855
+ const {
856
+ id,
857
+ itemIds,
858
+ children,
859
+ isPotentialCardDropTarget: t1
860
+ } = t0;
861
+ const isPotentialCardDropTarget = t1 === void 0 ? false : t1;
862
+ let t2;
863
+ if ($2[0] !== id) {
864
+ t2 = {
865
+ id
866
+ };
867
+ $2[0] = id;
868
+ $2[1] = t2;
869
+ } else {
870
+ t2 = $2[1];
871
+ }
872
+ const {
873
+ setNodeRef
874
+ } = useDroppable(t2);
875
+ const t3 = isPotentialCardDropTarget ? "p-2 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg" : void 0;
876
+ let t4;
877
+ if ($2[2] !== t3) {
878
+ t4 = cls(t3, "transition-all duration-200 ease-in-out");
879
+ $2[2] = t3;
880
+ $2[3] = t4;
881
+ } else {
882
+ t4 = $2[3];
883
+ }
884
+ let t5;
885
+ if ($2[4] !== children || $2[5] !== itemIds) {
886
+ t5 = /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: rectSortingStrategy, children });
887
+ $2[4] = children;
888
+ $2[5] = itemIds;
889
+ $2[6] = t5;
890
+ } else {
891
+ t5 = $2[6];
892
+ }
893
+ let t6;
894
+ if ($2[7] !== setNodeRef || $2[8] !== t4 || $2[9] !== t5) {
895
+ t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t4, children: t5 });
896
+ $2[7] = setNodeRef;
897
+ $2[8] = t4;
898
+ $2[9] = t5;
899
+ $2[10] = t6;
900
+ } else {
901
+ t6 = $2[10];
902
+ }
903
+ return t6;
904
+ }
905
+ function SortableNavigationGroup(t0) {
906
+ const $2 = c(15);
907
+ const {
908
+ groupName,
909
+ children,
910
+ disabled
911
+ } = t0;
912
+ let t1;
913
+ if ($2[0] !== disabled || $2[1] !== groupName) {
914
+ t1 = {
915
+ id: groupName,
916
+ animateLayoutChanges,
917
+ disabled
918
+ };
919
+ $2[0] = disabled;
920
+ $2[1] = groupName;
921
+ $2[2] = t1;
922
+ } else {
923
+ t1 = $2[2];
924
+ }
925
+ const {
926
+ attributes,
927
+ listeners,
928
+ setNodeRef,
929
+ transform,
930
+ transition,
931
+ isDragging
932
+ } = useSortable(t1);
933
+ let t2;
934
+ if ($2[3] !== transform) {
935
+ t2 = transform ? CSS.Transform.toString(transform) : void 0;
936
+ $2[3] = transform;
937
+ $2[4] = t2;
938
+ } else {
939
+ t2 = $2[4];
940
+ }
941
+ const t3 = isDragging ? 0 : 1;
942
+ let t4;
943
+ if ($2[5] !== t2 || $2[6] !== t3 || $2[7] !== transition) {
944
+ t4 = {
945
+ transform: t2,
946
+ transition,
947
+ opacity: t3
948
+ };
949
+ $2[5] = t2;
950
+ $2[6] = t3;
951
+ $2[7] = transition;
952
+ $2[8] = t4;
953
+ } else {
954
+ t4 = $2[8];
955
+ }
956
+ const style = t4;
957
+ let t5;
958
+ if ($2[9] !== attributes || $2[10] !== children || $2[11] !== listeners || $2[12] !== setNodeRef || $2[13] !== style) {
959
+ t5 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children });
960
+ $2[9] = attributes;
961
+ $2[10] = children;
962
+ $2[11] = listeners;
963
+ $2[12] = setNodeRef;
964
+ $2[13] = style;
965
+ $2[14] = t5;
966
+ } else {
967
+ t5 = $2[14];
968
+ }
969
+ return t5;
970
+ }
971
+ function useHomePageDnd({
972
+ items,
973
+ setItems,
974
+ disabled,
975
+ onCardMovedBetweenGroups,
976
+ onGroupMoved,
977
+ onNewGroupDrop,
978
+ onPersist
979
+ }) {
980
+ const dndItems = items;
981
+ const setDndItems = setItems;
982
+ const [activeId, setActiveId] = useState(null);
983
+ const [activeIsGroup, setActiveIsGroup] = useState(false);
984
+ const [currentDraggingGroupId, setCurrentDraggingGroupId] = useState(null);
985
+ const [dndKitActiveNode, setDndKitActiveNode] = useState(null);
986
+ const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);
987
+ const [dialogOpenForGroup, setDialogOpenForGroup] = useState(null);
988
+ const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] = useState(false);
989
+ const [pendingNewGroupName, setPendingNewGroupName] = useState(null);
990
+ const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState(null);
991
+ const preDragItemsRef = useRef(null);
992
+ const interimItemsRef = useRef(null);
993
+ useEffect(() => {
994
+ interimItemsRef.current = dndItems;
995
+ }, [dndItems]);
996
+ const mouseSensor = useSensor(MouseSensor, {
997
+ activationConstraint: {
998
+ distance: 10
999
+ }
1000
+ });
1001
+ const touchSensor = useSensor(TouchSensor, {
1002
+ activationConstraint: {
1003
+ delay: 150,
1004
+ tolerance: 5
1005
+ }
1006
+ });
1007
+ const keyboardSensor = useSensor(KeyboardSensor);
1008
+ const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor);
1009
+ const dndContainers = dndItems.map((g) => g.name);
1010
+ const findDndContainer = useCallback((id) => {
1011
+ if (!id) return void 0;
1012
+ const group = dndItems.find((g_0) => g_0.name === id);
1013
+ if (group) return group.name;
1014
+ for (const g_1 of dndItems) {
1015
+ if (g_1.entries.some((e) => e.url === id)) return g_1.name;
1016
+ }
1017
+ return void 0;
1018
+ }, [dndItems]);
1019
+ const lastOverId = useRef(null);
1020
+ const recentlyMovedToNewContainer = useRef(false);
1021
+ const collisionDetection = useCallback((args) => {
1022
+ if (disabled || !activeId) return [];
1023
+ if (activeIsGroup) {
1024
+ const groups = args.droppableContainers.filter((c2) => dndItems.some((g_2) => g_2.name === c2.id));
1025
+ if (!groups.length) return [];
1026
+ return closestCenter({
1027
+ ...args,
1028
+ droppableContainers: groups
1029
+ });
1030
+ }
1031
+ const pointer = pointerWithin(args);
1032
+ if (pointer.length) {
1033
+ const zone = pointer.find((c_0) => c_0.id === "new-group-drop-zone");
1034
+ if (zone) return [zone];
1035
+ const container = pointer.find((c_1) => dndItems.some((g_3) => g_3.name === c_1.id));
1036
+ if (container) {
1037
+ const itemsIn = dndItems.find((g_4) => g_4.name === container.id)?.entries;
1038
+ if (itemsIn?.length) {
1039
+ const closest = closestCorners({
1040
+ ...args,
1041
+ droppableContainers: args.droppableContainers.filter((c_2) => itemsIn.some((e_0) => e_0.url === c_2.id))
1042
+ });
1043
+ if (closest.length) return closest;
1044
+ }
1045
+ return [container];
1046
+ }
1047
+ const first = getFirstCollision(pointer, "id");
1048
+ if (first) return [{
1049
+ id: first
1050
+ }];
1051
+ }
1052
+ const rects = rectIntersection(args);
1053
+ const zoneRect = rects.find((c_3) => c_3.id === "new-group-drop-zone");
1054
+ if (zoneRect) return [zoneRect];
1055
+ let overId = getFirstCollision(rects, "id");
1056
+ if (overId != null) {
1057
+ const overIsContainer = dndItems.some((g_5) => g_5.name === overId);
1058
+ if (overIsContainer) {
1059
+ const itemsIn_0 = dndItems.find((g_6) => g_6.name === overId)?.entries;
1060
+ if (itemsIn_0?.length) {
1061
+ const closestItem = closestCorners({
1062
+ ...args,
1063
+ droppableContainers: args.droppableContainers.filter((c_4) => itemsIn_0.some((e_1) => e_1.url === c_4.id))
1064
+ })[0]?.id;
1065
+ if (closestItem) overId = closestItem;
1066
+ }
1067
+ }
1068
+ lastOverId.current = overId;
1069
+ return [{
1070
+ id: overId
1071
+ }];
1072
+ }
1073
+ if (recentlyMovedToNewContainer.current && lastOverId.current && !activeIsGroup) return [{
1074
+ id: lastOverId.current
1075
+ }];
1076
+ return [];
1077
+ }, [activeId, dndItems, disabled, activeIsGroup]);
1078
+ const handleDragStart = ({
1079
+ active
1080
+ }) => {
1081
+ setDndKitActiveNode(active);
1082
+ if (disabled) return;
1083
+ preDragItemsRef.current = cloneItemsForDnd(dndItems);
1084
+ const isGroup = dndItems.some((g_7) => g_7.name === active.id);
1085
+ if (!active.data.current) active.data.current = {};
1086
+ active.data.current.type = isGroup ? "group" : "item";
1087
+ setActiveId(active.id);
1088
+ setActiveIsGroup(isGroup);
1089
+ setIsDraggingCardOnly(!isGroup);
1090
+ if (isGroup) setCurrentDraggingGroupId(active.id);
1091
+ recentlyMovedToNewContainer.current = false;
1092
+ };
1093
+ const handleDragOver = ({
1094
+ active: active_0,
1095
+ over
1096
+ }) => {
1097
+ if (disabled || !over) return;
1098
+ const activeIdNow = active_0.id;
1099
+ const overIdNow = over.id;
1100
+ if (activeIdNow === overIdNow) return;
1101
+ if (activeIsGroup) return;
1102
+ const activeCont = findDndContainer(activeIdNow);
1103
+ const overCont = findDndContainer(overIdNow);
1104
+ if (!activeCont) return;
1105
+ if (overCont && activeCont !== overCont) {
1106
+ recentlyMovedToNewContainer.current = true;
1107
+ lastOverId.current = overIdNow;
1108
+ setDndItems((current) => {
1109
+ const newState = cloneItemsForDnd(current);
1110
+ const srcIdx = newState.findIndex((g_8) => g_8.name === activeCont);
1111
+ const tgtIdx = newState.findIndex((g_9) => g_9.name === overCont);
1112
+ if (srcIdx === -1 || tgtIdx === -1) return current;
1113
+ const src = newState[srcIdx];
1114
+ const tgt = newState[tgtIdx];
1115
+ const idxInSrc = src.entries.findIndex((e_2) => e_2.url === activeIdNow);
1116
+ if (idxInSrc === -1) return current;
1117
+ const [moved] = src.entries.splice(idxInSrc, 1);
1118
+ const overIsContainer_0 = overIdNow === overCont;
1119
+ if (overIsContainer_0) {
1120
+ tgt.entries.push(moved);
1121
+ } else {
1122
+ const overIdx = tgt.entries.findIndex((e_3) => e_3.url === overIdNow);
1123
+ if (overIdx !== -1) {
1124
+ tgt.entries.splice(overIdx, 0, moved);
1125
+ } else {
1126
+ tgt.entries.push(moved);
1127
+ }
1128
+ }
1129
+ return newState;
1130
+ });
1131
+ } else if (activeCont === overCont) {
1132
+ recentlyMovedToNewContainer.current = false;
1133
+ }
1134
+ };
1135
+ const handleDragEnd = ({
1136
+ active: active_1,
1137
+ over: over_0
1138
+ }) => {
1139
+ if (disabled || !over_0) {
1140
+ resetDragState();
1141
+ return;
1142
+ }
1143
+ const activeIdNow_0 = active_1.id;
1144
+ const overIdNow_0 = over_0.id;
1145
+ if (activeIsGroup) {
1146
+ if (activeIdNow_0 !== overIdNow_0 && dndItems.some((g_12) => g_12.name === overIdNow_0)) {
1147
+ const from = dndItems.findIndex((g_10) => g_10.name === activeIdNow_0);
1148
+ const to = dndItems.findIndex((g_11) => g_11.name === overIdNow_0);
1149
+ if (from !== -1 && to !== -1) {
1150
+ const newState_0 = arrayMove(dndItems, from, to);
1151
+ setDndItems(newState_0);
1152
+ onPersist?.(newState_0);
1153
+ onGroupMoved?.(activeIdNow_0, from, to);
1154
+ }
1155
+ }
1156
+ } else {
1157
+ const findContainerInState = (id_0, state) => {
1158
+ const group_0 = state.find((g_13) => g_13.name === id_0);
1159
+ if (group_0) return group_0.name;
1160
+ for (const g_14 of state) {
1161
+ if (g_14.entries.some((e_4) => e_4.url === id_0)) return g_14.name;
1162
+ }
1163
+ return void 0;
1164
+ };
1165
+ const sourceState = preDragItemsRef.current || dndItems;
1166
+ const activeCont_0 = findContainerInState(activeIdNow_0, sourceState);
1167
+ findDndContainer(overIdNow_0);
1168
+ if (overIdNow_0 === "new-group-drop-zone") {
1169
+ if (activeCont_0) {
1170
+ setStateBeforeNewGroup(cloneItemsForDnd(dndItems));
1171
+ const newState_1 = cloneItemsForDnd(dndItems);
1172
+ const srcIdx_0 = newState_1.findIndex((g_15) => g_15.name === activeCont_0);
1173
+ if (srcIdx_0 !== -1) {
1174
+ const src_0 = newState_1[srcIdx_0];
1175
+ const idxInSrc_0 = src_0.entries.findIndex((e_5) => e_5.url === activeIdNow_0);
1176
+ if (idxInSrc_0 !== -1) {
1177
+ const [dragged] = src_0.entries.splice(idxInSrc_0, 1);
1178
+ if (src_0.entries.length === 0) newState_1.splice(srcIdx_0, 1);
1179
+ let tentative = "New Group";
1180
+ let counter = 1;
1181
+ while (newState_1.some((g_16) => g_16.name === tentative)) tentative = `New Group ${counter++}`;
1182
+ newState_1.push({
1183
+ name: tentative,
1184
+ entries: [dragged]
1185
+ });
1186
+ setDndItems(newState_1);
1187
+ setPendingNewGroupName(tentative);
1188
+ setDialogOpenForGroup(tentative);
1189
+ onNewGroupDrop?.();
1190
+ }
1191
+ }
1192
+ }
1193
+ } else {
1194
+ const overCont_1 = findDndContainer(overIdNow_0);
1195
+ if (activeCont_0 === overCont_1) {
1196
+ const grpIdx = dndItems.findIndex((g_17) => g_17.name === activeCont_0);
1197
+ if (grpIdx !== -1) {
1198
+ const group_1 = dndItems[grpIdx];
1199
+ const oldIdx = group_1.entries.findIndex((e_6) => e_6.url === activeIdNow_0);
1200
+ let newIdx = group_1.entries.findIndex((e_7) => e_7.url === overIdNow_0);
1201
+ if (newIdx === -1 && overIdNow_0 === activeCont_0) newIdx = group_1.entries.length - 1;
1202
+ if (oldIdx !== -1 && newIdx !== -1 && oldIdx !== newIdx) {
1203
+ const reordered = arrayMove(group_1.entries, oldIdx, newIdx);
1204
+ const newState_2 = [...dndItems];
1205
+ newState_2[grpIdx] = {
1206
+ ...group_1,
1207
+ entries: reordered
1208
+ };
1209
+ setDndItems(newState_2);
1210
+ onPersist?.(newState_2);
1211
+ }
1212
+ }
1213
+ } else if (overCont_1 && activeCont_0 !== overCont_1) {
1214
+ const finalState = cloneItemsForDnd(sourceState);
1215
+ const finalOverId = lastOverId.current || overIdNow_0;
1216
+ const cleanOverCont = findContainerInState(finalOverId, sourceState) || overCont_1;
1217
+ const srcIdx_1 = finalState.findIndex((g_18) => g_18.name === activeCont_0);
1218
+ const tgtIdx_0 = finalState.findIndex((g_19) => g_19.name === cleanOverCont);
1219
+ if (srcIdx_1 !== -1 && tgtIdx_0 !== -1) {
1220
+ const src_1 = finalState[srcIdx_1];
1221
+ const tgt_0 = finalState[tgtIdx_0];
1222
+ const idxInSrc_1 = src_1.entries.findIndex((e_8) => e_8.url === activeIdNow_0);
1223
+ if (idxInSrc_1 !== -1) {
1224
+ const [moved_0] = src_1.entries.splice(idxInSrc_1, 1);
1225
+ const overIsContainer_1 = finalOverId === cleanOverCont;
1226
+ if (overIsContainer_1) {
1227
+ tgt_0.entries.push(moved_0);
1228
+ } else {
1229
+ const overIdx_0 = tgt_0.entries.findIndex((e_9) => e_9.url === finalOverId);
1230
+ if (overIdx_0 !== -1) {
1231
+ tgt_0.entries.splice(overIdx_0, 0, moved_0);
1232
+ } else {
1233
+ tgt_0.entries.push(moved_0);
1234
+ }
1235
+ }
1236
+ if (src_1.entries.length === 0) {
1237
+ finalState.splice(srcIdx_1, 1);
1238
+ }
1239
+ setDndItems(finalState);
1240
+ onPersist?.(finalState);
1241
+ onCardMovedBetweenGroups?.(moved_0);
1242
+ }
1243
+ }
1244
+ } else if (recentlyMovedToNewContainer.current) {
1245
+ console.error("Move between containers detected but conditions not met", {
1246
+ activeCont: activeCont_0,
1247
+ overCont: overCont_1,
1248
+ activeIdNow: activeIdNow_0,
1249
+ overIdNow: overIdNow_0
1250
+ });
1251
+ }
1252
+ }
1253
+ }
1254
+ resetDragState();
1255
+ };
1256
+ const resetDragState = () => {
1257
+ setDndKitActiveNode(null);
1258
+ setActiveId(null);
1259
+ setActiveIsGroup(false);
1260
+ setCurrentDraggingGroupId(null);
1261
+ setIsDraggingCardOnly(false);
1262
+ recentlyMovedToNewContainer.current = false;
1263
+ };
1264
+ const handleDragCancel = () => resetDragState();
1265
+ const handleRenameGroup = (oldName, newName) => {
1266
+ setDndItems((current_0) => {
1267
+ const idx = current_0.findIndex((g_20) => g_20.name === oldName);
1268
+ if (idx === -1) return current_0;
1269
+ if (current_0.some((g_21) => g_21.name === newName && g_21.name !== oldName)) return current_0;
1270
+ const updated = [...current_0];
1271
+ updated[idx] = {
1272
+ ...updated[idx],
1273
+ name: newName
1274
+ };
1275
+ onPersist?.(updated);
1276
+ return updated;
1277
+ });
1278
+ setPendingNewGroupName(null);
1279
+ setStateBeforeNewGroup(null);
1280
+ setDialogOpenForGroup(null);
1281
+ };
1282
+ const handleDialogClose = () => {
1283
+ if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) {
1284
+ setDndItems(stateBeforeNewGroup);
1285
+ }
1286
+ setPendingNewGroupName(null);
1287
+ setStateBeforeNewGroup(null);
1288
+ setDialogOpenForGroup(null);
1289
+ };
1290
+ const activeItemForOverlay = disabled || !activeId || activeIsGroup ? null : dndItems.flatMap((g_22) => g_22.entries).find((e_10) => e_10.url === activeId) || null;
1291
+ const activeGroupData = disabled || !activeId || !activeIsGroup ? null : dndItems.find((g_23) => g_23.name === activeId) || null;
1292
+ return {
1293
+ sensors,
1294
+ collisionDetection,
1295
+ onDragStart: handleDragStart,
1296
+ onDragOver: handleDragOver,
1297
+ onDragEnd: handleDragEnd,
1298
+ onDragCancel: handleDragCancel,
1299
+ dropAnimation: dropAnimationConfig,
1300
+ activeItemForOverlay,
1301
+ activeGroupData,
1302
+ draggingGroupId: currentDraggingGroupId,
1303
+ containers: dndContainers,
1304
+ dndKitActiveNode,
1305
+ isDraggingCardOnly,
1306
+ dialogOpenForGroup,
1307
+ setDialogOpenForGroup,
1308
+ handleRenameGroup,
1309
+ handleDialogClose,
1310
+ isHoveringNewGroupDropZone,
1311
+ setIsHoveringNewGroupDropZone
1312
+ };
1313
+ }
1314
+ function NewGroupDropZone(t0) {
1315
+ const $2 = c(15);
1316
+ const {
1317
+ disabled,
1318
+ setIsHovering
1319
+ } = t0;
1320
+ let t1;
1321
+ if ($2[0] !== disabled) {
1322
+ t1 = {
1323
+ id: "new-group-drop-zone",
1324
+ disabled
1325
+ };
1326
+ $2[0] = disabled;
1327
+ $2[1] = t1;
1328
+ } else {
1329
+ t1 = $2[1];
1330
+ }
1331
+ const {
1332
+ setNodeRef,
1333
+ isOver
1334
+ } = useDroppable(t1);
1335
+ const [isVisible, setIsVisible] = useState(false);
1336
+ let t2;
1337
+ if ($2[2] !== disabled) {
1338
+ t2 = {
1339
+ onDragStart(t32) {
1340
+ const {
1341
+ active
1342
+ } = t32;
1343
+ if (disabled) {
1344
+ return;
1345
+ }
1346
+ const tp = active.data.current?.type;
1347
+ setIsVisible(tp === "item");
1348
+ },
1349
+ onDragEnd() {
1350
+ setIsVisible(false);
1351
+ },
1352
+ onDragCancel() {
1353
+ setIsVisible(false);
1354
+ }
1355
+ };
1356
+ $2[2] = disabled;
1357
+ $2[3] = t2;
1358
+ } else {
1359
+ t2 = $2[3];
1360
+ }
1361
+ useDndMonitor(t2);
1362
+ let t3;
1363
+ let t4;
1364
+ if ($2[4] !== isOver || $2[5] !== isVisible || $2[6] !== setIsHovering) {
1365
+ t3 = () => {
1366
+ setIsHovering(isOver && isVisible);
1367
+ };
1368
+ t4 = [isOver, isVisible, setIsHovering];
1369
+ $2[4] = isOver;
1370
+ $2[5] = isVisible;
1371
+ $2[6] = setIsHovering;
1372
+ $2[7] = t3;
1373
+ $2[8] = t4;
1374
+ } else {
1375
+ t3 = $2[7];
1376
+ t4 = $2[8];
1377
+ }
1378
+ useEffect(t3, t4);
1379
+ if (!isVisible || disabled) {
1380
+ return null;
1381
+ }
1382
+ const t5 = isOver ? "bg-surface-accent-100 dark:bg-surface-accent-800 border-surface-300 dark:border-surface-600" : "bg-surface-50 dark:bg-surface-900 border-surface-200 dark:border-surface-700";
1383
+ let t6;
1384
+ if ($2[9] !== t5) {
1385
+ t6 = cls("fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all", t5);
1386
+ $2[9] = t5;
1387
+ $2[10] = t6;
1388
+ } else {
1389
+ t6 = $2[10];
1390
+ }
1391
+ let t7;
1392
+ if ($2[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1393
+ t7 = /* @__PURE__ */ jsx("div", { className: "text-center p-4", children: /* @__PURE__ */ jsx("span", { className: "block font-medium text-sm", children: "Drop here to create a new group" }) });
1394
+ $2[11] = t7;
1395
+ } else {
1396
+ t7 = $2[11];
1397
+ }
1398
+ let t8;
1399
+ if ($2[12] !== setNodeRef || $2[13] !== t6) {
1400
+ t8 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t6, children: t7 });
1401
+ $2[12] = setNodeRef;
1402
+ $2[13] = t6;
1403
+ $2[14] = t8;
1404
+ } else {
1405
+ t8 = $2[14];
1406
+ }
1407
+ return t8;
1408
+ }
1409
+ function RenameGroupDialog(t0) {
1410
+ const $2 = c(56);
1411
+ const {
1412
+ open,
1413
+ initialName,
1414
+ existingGroupNames,
1415
+ onClose,
1416
+ onRename
1417
+ } = t0;
1418
+ const {
1419
+ t: t2
1420
+ } = useTranslation();
1421
+ const [name, setName] = useState(initialName);
1422
+ const [error, setError] = useState(null);
1423
+ const inputRef = useRef(null);
1424
+ let t1;
1425
+ let t22;
1426
+ if ($2[0] !== initialName || $2[1] !== open) {
1427
+ t1 = () => {
1428
+ if (open) {
1429
+ setName(initialName);
1430
+ setError(null);
1431
+ setTimeout(() => {
1432
+ if (inputRef.current) {
1433
+ inputRef.current.focus();
1434
+ inputRef.current.select();
1435
+ }
1436
+ }, 100);
1437
+ }
1438
+ };
1439
+ t22 = [initialName, open];
1440
+ $2[0] = initialName;
1441
+ $2[1] = open;
1442
+ $2[2] = t1;
1443
+ $2[3] = t22;
1444
+ } else {
1445
+ t1 = $2[2];
1446
+ t22 = $2[3];
1447
+ }
1448
+ useEffect(t1, t22);
1449
+ let t3;
1450
+ if ($2[4] !== existingGroupNames || $2[5] !== t2) {
1451
+ t3 = (event) => {
1452
+ const newName = event.target.value;
1453
+ setName(newName);
1454
+ if (!newName.trim()) {
1455
+ setError(t2("group_name_empty_error"));
1456
+ } else {
1457
+ if (existingGroupNames.includes(newName.trim())) {
1458
+ setError(t2("group_name_exists_error"));
1459
+ } else {
1460
+ setError(null);
1461
+ }
1462
+ }
1463
+ };
1464
+ $2[4] = existingGroupNames;
1465
+ $2[5] = t2;
1466
+ $2[6] = t3;
1467
+ } else {
1468
+ t3 = $2[6];
1469
+ }
1470
+ const handleNameChange = t3;
1471
+ let t4;
1472
+ if ($2[7] !== error || $2[8] !== existingGroupNames || $2[9] !== name || $2[10] !== onClose || $2[11] !== onRename || $2[12] !== t2) {
1473
+ t4 = () => {
1474
+ const trimmedName = name.trim();
1475
+ if (!trimmedName) {
1476
+ setError(t2("group_name_empty_error"));
1477
+ return;
1478
+ }
1479
+ if (existingGroupNames.includes(trimmedName)) {
1480
+ setError(t2("group_name_exists_error"));
1481
+ return;
1482
+ }
1483
+ if (!error) {
1484
+ onRename(trimmedName);
1485
+ onClose();
1486
+ }
1487
+ };
1488
+ $2[7] = error;
1489
+ $2[8] = existingGroupNames;
1490
+ $2[9] = name;
1491
+ $2[10] = onClose;
1492
+ $2[11] = onRename;
1493
+ $2[12] = t2;
1494
+ $2[13] = t4;
1495
+ } else {
1496
+ t4 = $2[13];
1497
+ }
1498
+ const handleSave = t4;
1499
+ let t5;
1500
+ if ($2[14] !== existingGroupNames || $2[15] !== handleSave || $2[16] !== name || $2[17] !== t2) {
1501
+ t5 = (event_0) => {
1502
+ if (event_0.key === "Enter") {
1503
+ event_0.preventDefault();
1504
+ const trimmedName_0 = name.trim();
1505
+ let currentError = null;
1506
+ if (!trimmedName_0) {
1507
+ currentError = t2("group_name_empty_error");
1508
+ } else {
1509
+ if (existingGroupNames.includes(trimmedName_0)) {
1510
+ currentError = t2("group_name_exists_error");
1511
+ }
1512
+ }
1513
+ if (!currentError && trimmedName_0) {
1514
+ handleSave();
1515
+ } else {
1516
+ if (currentError) {
1517
+ setError(currentError);
1518
+ }
1519
+ }
1520
+ }
1521
+ };
1522
+ $2[14] = existingGroupNames;
1523
+ $2[15] = handleSave;
1524
+ $2[16] = name;
1525
+ $2[17] = t2;
1526
+ $2[18] = t5;
1527
+ } else {
1528
+ t5 = $2[18];
1529
+ }
1530
+ const handleKeyDown = t5;
1531
+ if (!open) {
1532
+ return null;
1533
+ }
1534
+ let t6;
1535
+ if ($2[19] !== t2) {
1536
+ t6 = t2("rename_group");
1537
+ $2[19] = t2;
1538
+ $2[20] = t6;
1539
+ } else {
1540
+ t6 = $2[20];
1541
+ }
1542
+ let t7;
1543
+ if ($2[21] !== t6) {
1544
+ t7 = /* @__PURE__ */ jsx(DialogTitle, { children: t6 });
1545
+ $2[21] = t6;
1546
+ $2[22] = t7;
1547
+ } else {
1548
+ t7 = $2[22];
1549
+ }
1550
+ let t8;
1551
+ if ($2[23] !== t2) {
1552
+ t8 = t2("group_name_label");
1553
+ $2[23] = t2;
1554
+ $2[24] = t8;
1555
+ } else {
1556
+ t8 = $2[24];
1557
+ }
1558
+ const t9 = !!error;
1559
+ const t10 = error ? "group-name-error" : void 0;
1560
+ let t11;
1561
+ if ($2[25] !== handleKeyDown || $2[26] !== handleNameChange || $2[27] !== name || $2[28] !== t10 || $2[29] !== t8 || $2[30] !== t9) {
1562
+ t11 = /* @__PURE__ */ jsx(TextField, { inputRef, label: t8, value: name, onChange: handleNameChange, onKeyDown: handleKeyDown, error: t9, "aria-describedby": t10 });
1563
+ $2[25] = handleKeyDown;
1564
+ $2[26] = handleNameChange;
1565
+ $2[27] = name;
1566
+ $2[28] = t10;
1567
+ $2[29] = t8;
1568
+ $2[30] = t9;
1569
+ $2[31] = t11;
1570
+ } else {
1571
+ t11 = $2[31];
1572
+ }
1573
+ let t12;
1574
+ if ($2[32] !== error) {
1575
+ t12 = error && /* @__PURE__ */ jsx("p", { id: "group-name-error", style: {
1576
+ display: "none"
1577
+ }, children: error });
1578
+ $2[32] = error;
1579
+ $2[33] = t12;
1580
+ } else {
1581
+ t12 = $2[33];
1582
+ }
1583
+ let t13;
1584
+ if ($2[34] !== t11 || $2[35] !== t12) {
1585
+ t13 = /* @__PURE__ */ jsxs(DialogContent, { children: [
1586
+ t11,
1587
+ t12
1588
+ ] });
1589
+ $2[34] = t11;
1590
+ $2[35] = t12;
1591
+ $2[36] = t13;
1592
+ } else {
1593
+ t13 = $2[36];
1594
+ }
1595
+ let t14;
1596
+ if ($2[37] !== t2) {
1597
+ t14 = t2("cancel");
1598
+ $2[37] = t2;
1599
+ $2[38] = t14;
1600
+ } else {
1601
+ t14 = $2[38];
1602
+ }
1603
+ let t15;
1604
+ if ($2[39] !== onClose || $2[40] !== t14) {
1605
+ t15 = /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "text", children: t14 });
1606
+ $2[39] = onClose;
1607
+ $2[40] = t14;
1608
+ $2[41] = t15;
1609
+ } else {
1610
+ t15 = $2[41];
1611
+ }
1612
+ const t16 = !!error || !name.trim();
1613
+ let t17;
1614
+ if ($2[42] !== t2) {
1615
+ t17 = t2("save");
1616
+ $2[42] = t2;
1617
+ $2[43] = t17;
1618
+ } else {
1619
+ t17 = $2[43];
1620
+ }
1621
+ let t18;
1622
+ if ($2[44] !== handleSave || $2[45] !== t16 || $2[46] !== t17) {
1623
+ t18 = /* @__PURE__ */ jsx(Button, { onClick: handleSave, disabled: t16, children: t17 });
1624
+ $2[44] = handleSave;
1625
+ $2[45] = t16;
1626
+ $2[46] = t17;
1627
+ $2[47] = t18;
1628
+ } else {
1629
+ t18 = $2[47];
1630
+ }
1631
+ let t19;
1632
+ if ($2[48] !== t15 || $2[49] !== t18) {
1633
+ t19 = /* @__PURE__ */ jsxs(DialogActions, { children: [
1634
+ t15,
1635
+ t18
1636
+ ] });
1637
+ $2[48] = t15;
1638
+ $2[49] = t18;
1639
+ $2[50] = t19;
1640
+ } else {
1641
+ t19 = $2[50];
1642
+ }
1643
+ let t20;
1644
+ if ($2[51] !== open || $2[52] !== t13 || $2[53] !== t19 || $2[54] !== t7) {
1645
+ t20 = /* @__PURE__ */ jsxs(Dialog, { open, children: [
1646
+ t7,
1647
+ t13,
1648
+ t19
1649
+ ] });
1650
+ $2[51] = open;
1651
+ $2[52] = t13;
1652
+ $2[53] = t19;
1653
+ $2[54] = t7;
1654
+ $2[55] = t20;
1655
+ } else {
1656
+ t20 = $2[55];
1657
+ }
1658
+ return t20;
1659
+ }
1660
+ const DEFAULT_GROUP_NAME = "Views";
1661
+ const ADMIN_GROUP_NAME = "Admin";
1662
+ function ContentHomePage({
1663
+ additionalActions,
1664
+ additionalChildrenStart,
1665
+ additionalChildrenEnd,
1666
+ sections,
1667
+ hiddenGroups
1668
+ }) {
1669
+ const context = useCMSContext();
1670
+ const {
1671
+ navigationStateController
1672
+ } = context;
1673
+ const customizationController = useCustomizationController();
1674
+ const {
1675
+ resolvedSlots
1676
+ } = customizationController;
1677
+ const breadcrumbs = useBreadcrumbsController();
1678
+ const {
1679
+ t: t2
1680
+ } = useTranslation();
1681
+ useEffect(() => {
1682
+ breadcrumbs.set({
1683
+ breadcrumbs: []
1684
+ });
1685
+ }, [breadcrumbs.set]);
1686
+ const {
1687
+ allowDragAndDrop = false,
1688
+ navigationEntries: rawNavigationEntries = [],
1689
+ groups: groupOrderFromNavController = [],
1690
+ onNavigationEntriesUpdate = () => {
1691
+ }
1692
+ } = navigationStateController.topLevelNavigation || {};
1693
+ const fuse = useRef(null);
1694
+ const [filteredUrls, setFilteredUrls] = useState(null);
1695
+ const performingSearch = Boolean(filteredUrls);
1696
+ const filteredNavigationEntries = useMemo(() => {
1697
+ return filteredUrls ? rawNavigationEntries.filter((e) => filteredUrls.includes(e.url)) : rawNavigationEntries;
1698
+ }, [filteredUrls, rawNavigationEntries]);
1699
+ useEffect(() => {
1700
+ fuse.current = new Fuse(rawNavigationEntries, {
1701
+ keys: ["name", "description", "group", "path"]
1702
+ });
1703
+ }, [rawNavigationEntries]);
1704
+ const updateSearch = useCallback((v2) => {
1705
+ if (!v2?.trim()) {
1706
+ setFilteredUrls(null);
1707
+ return;
1708
+ }
1709
+ const results = fuse.current?.search(v2.trim());
1710
+ setFilteredUrls(results ? results.map((x2) => x2.item.url) : []);
1711
+ }, []);
1712
+ const [items, setItems] = useState([]);
1713
+ const [adminGroupData, setAdminGroupData] = useState(null);
1714
+ const isDndDirtyRef = useRef(false);
1715
+ const dndDirtyTimeoutRef = useRef(null);
1716
+ const processedGroups = useMemo(() => {
1717
+ const src = filteredNavigationEntries;
1718
+ const entriesByGroup = {};
1719
+ src.forEach((e_0) => {
1720
+ const g = e_0.type === "admin" ? ADMIN_GROUP_NAME : e_0.group ?? DEFAULT_GROUP_NAME;
1721
+ (entriesByGroup[g] ??= []).push(e_0);
1722
+ });
1723
+ const hasPluginAdditionalCards = customizationController.resolvedSlots.some((s2) => s2.slot === "home.cards");
1724
+ let allProcessed;
1725
+ if (performingSearch) {
1726
+ const ordered = [...new Set(src.map((e_1) => e_1.group ?? DEFAULT_GROUP_NAME))];
1727
+ allProcessed = ordered.filter((g_0) => g_0 === DEFAULT_GROUP_NAME || g_0 === ADMIN_GROUP_NAME).map((name) => ({
1728
+ name,
1729
+ entries: entriesByGroup[name] || []
1730
+ })).filter((g_1) => g_1.entries.length);
1731
+ } else {
1732
+ const filteredGroupOrder = groupOrderFromNavController.filter((g_2) => g_2 === DEFAULT_GROUP_NAME || g_2 === ADMIN_GROUP_NAME);
1733
+ allProcessed = filteredGroupOrder.map((g_3) => ({
1734
+ name: g_3,
1735
+ entries: entriesByGroup[g_3] || []
1736
+ }));
1737
+ Object.keys(entriesByGroup).forEach((g_4) => {
1738
+ const shouldInclude = g_4 === DEFAULT_GROUP_NAME || g_4 === ADMIN_GROUP_NAME;
1739
+ if (!filteredGroupOrder.includes(g_4) && shouldInclude) allProcessed.push({
1740
+ name: g_4,
1741
+ entries: entriesByGroup[g_4]
1742
+ });
1743
+ });
1744
+ if (hasPluginAdditionalCards && !allProcessed.some((g_5) => g_5.name === DEFAULT_GROUP_NAME)) {
1745
+ allProcessed.push({
1746
+ name: DEFAULT_GROUP_NAME,
1747
+ entries: []
1748
+ });
1749
+ }
1750
+ allProcessed = allProcessed.filter((g_6) => g_6.entries.length || g_6.name === DEFAULT_GROUP_NAME && hasPluginAdditionalCards);
1751
+ }
1752
+ const admin = allProcessed.find((g_7) => g_7.name === ADMIN_GROUP_NAME);
1753
+ return {
1754
+ adminGroupData: admin || null,
1755
+ items: allProcessed.filter((g_8) => g_8.name !== ADMIN_GROUP_NAME && !hiddenGroups?.includes(g_8.name))
1756
+ };
1757
+ }, [filteredNavigationEntries, performingSearch, groupOrderFromNavController, customizationController.resolvedSlots, hiddenGroups]);
1758
+ useEffect(() => {
1759
+ if (isDndDirtyRef.current) {
1760
+ return;
1761
+ }
1762
+ setAdminGroupData(processedGroups.adminGroupData);
1763
+ setItems(processedGroups.items);
1764
+ }, [processedGroups]);
1765
+ const updateItems = (updater) => {
1766
+ setItems(updater);
1767
+ };
1768
+ const persistNavigationGroups = (latest) => {
1769
+ isDndDirtyRef.current = true;
1770
+ if (dndDirtyTimeoutRef.current) {
1771
+ clearTimeout(dndDirtyTimeoutRef.current);
1772
+ }
1773
+ dndDirtyTimeoutRef.current = setTimeout(() => {
1774
+ isDndDirtyRef.current = false;
1775
+ }, 1e3);
1776
+ const draggable = latest.map((g_9) => ({
1777
+ name: g_9.name,
1778
+ entries: g_9.entries.map((e_2) => e_2.slug)
1779
+ }));
1780
+ const all = adminGroupData ? [...draggable, {
1781
+ name: adminGroupData.name,
1782
+ entries: adminGroupData.entries.map((e_3) => e_3.slug)
1783
+ }] : draggable;
1784
+ onNavigationEntriesUpdate(all);
1785
+ };
1786
+ const groupNames = useMemo(() => [...items.map((item) => item.name), ...adminGroupData ? [adminGroupData.name] : []], [items, adminGroupData]);
1787
+ const {
1788
+ isGroupCollapsed,
1789
+ toggleGroupCollapsed
1790
+ } = useCollapsedGroups(groupNames, "home");
1791
+ const {
1792
+ sensors,
1793
+ collisionDetection,
1794
+ onDragStart,
1795
+ onDragOver,
1796
+ onDragEnd,
1797
+ dropAnimation,
1798
+ activeItemForOverlay,
1799
+ activeGroupData,
1800
+ draggingGroupId,
1801
+ containers,
1802
+ dndKitActiveNode,
1803
+ onDragCancel,
1804
+ isDraggingCardOnly,
1805
+ dialogOpenForGroup,
1806
+ setDialogOpenForGroup,
1807
+ handleRenameGroup,
1808
+ handleDialogClose,
1809
+ isHoveringNewGroupDropZone,
1810
+ setIsHoveringNewGroupDropZone
1811
+ } = useHomePageDnd({
1812
+ items,
1813
+ setItems: updateItems,
1814
+ disabled: !allowDragAndDrop || performingSearch,
1815
+ onPersist: persistNavigationGroups,
1816
+ onGroupMoved: (g_10) => context.analyticsController?.onAnalyticsEvent?.("home_move_group", {
1817
+ name: g_10
1818
+ }),
1819
+ onCardMovedBetweenGroups: (card) => context.analyticsController?.onAnalyticsEvent?.("home_move_card", {
1820
+ id: card.id
1821
+ }),
1822
+ onNewGroupDrop: () => context.analyticsController?.onAnalyticsEvent?.("home_drop_new_group")
1823
+ });
1824
+ const {
1825
+ containerRef,
1826
+ direction
1827
+ } = useRestoreScroll();
1828
+ const dndDisabled = !allowDragAndDrop || performingSearch;
1829
+ const dndModifiers = dndKitActiveNode?.data.current?.type === "group" ? [restrictToVerticalAxis, restrictToWindowEdges] : [restrictToWindowEdges];
1830
+ const sectionProps = {
1831
+ context
1832
+ };
1833
+ const additionalPluginChildrenStart = useSlot("home.children.start", sectionProps);
1834
+ const additionalPluginChildrenEnd = useSlot("home.children.end", sectionProps);
1835
+ const additionalPluginActions = useSlot("home.actions", sectionProps);
1836
+ const homeCardContributions = useMemo(() => {
1837
+ return resolvedSlots.filter((s_0) => s_0.slot === "home.cards").sort((a, b) => (a.order ?? 50) - (b.order ?? 50));
1838
+ }, [resolvedSlots]);
1839
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "py-2 overflow-auto h-full w-full", children: [
1840
+ /* @__PURE__ */ jsxs(Container, { maxWidth: "6xl", children: [
1841
+ /* @__PURE__ */ jsxs("div", { className: "w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4", style: {
1842
+ top: direction === "down" ? -84 : 0
1843
+ }, children: [
1844
+ /* @__PURE__ */ jsx(SearchBar, { onTextSearch: updateSearch, placeholder: t2("search_collections"), autoFocus: true, innerClassName: "w-full", className: "w-full grow" }),
1845
+ additionalActions,
1846
+ additionalPluginActions
1847
+ ] }),
1848
+ /* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
1849
+ additionalChildrenStart,
1850
+ additionalPluginChildrenStart,
1851
+ /* @__PURE__ */ jsxs(DndContext, { sensors, collisionDetection, measuring: {
1852
+ droppable: {
1853
+ strategy: MeasuringStrategy.Always,
1854
+ frequency: 500
1855
+ }
1856
+ }, onDragStart, onDragOver, onDragEnd, onDragCancel, modifiers: dndModifiers, children: [
1857
+ /* @__PURE__ */ jsx(SortableContext, { items: containers, strategy: verticalListSortingStrategy, children: items.map((groupData, groupIndex) => {
1858
+ const groupKey = groupData.name;
1859
+ const entriesInGroup = groupData.entries;
1860
+ const homeCardsProps = {
1861
+ group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey,
1862
+ context
1863
+ };
1864
+ const additionalCards = homeCardContributions.map((s_1, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(s_1.Component, { ...homeCardsProps, ...s_1.props ?? {} }) }, `home_cards_${groupKey}_${i}`));
1865
+ if (entriesInGroup.length === 0 && (additionalCards.length === 0 || performingSearch)) return null;
1866
+ return /* @__PURE__ */ jsx(SortableNavigationGroup, { groupName: groupKey, disabled: dndDisabled, children: /* @__PURE__ */ jsx(NavigationGroup, { group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey, minimised: draggingGroupId === groupKey && !isDraggingCardOnly, isPotentialCardDropTarget: isDraggingCardOnly, dndDisabled, onEditGroup: () => {
1867
+ if (dndDisabled) return;
1868
+ setDialogOpenForGroup(groupKey);
1869
+ }, collapsed: isGroupCollapsed(groupKey), onToggleCollapsed: () => toggleGroupCollapsed(groupKey), children: /* @__PURE__ */ jsx(NavigationGroupDroppable, { id: groupKey, itemIds: entriesInGroup.map((e_4) => e_4.url), isPotentialCardDropTarget: isDraggingCardOnly, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: [
1870
+ entriesInGroup.map((entry) => /* @__PURE__ */ jsx(SortableNavigationCard, { entry, onClick: () => {
1871
+ let event = "unmapped_event";
1872
+ if (entry.type === "collection") event = "home_navigate_to_collection";
1873
+ else if (entry.type === "view") event = "home_navigate_to_view";
1874
+ else if (entry.type === "admin") event = "home_navigate_to_admin_view";
1875
+ context.analyticsController?.onAnalyticsEvent?.(event, {
1876
+ path: entry.slug
1877
+ });
1878
+ } }, entry.url)),
1879
+ !performingSearch && groupKey.toLowerCase() !== ADMIN_GROUP_NAME.toLowerCase() && additionalCards
1880
+ ] }) }) }) }, `group-${groupIndex}`);
1881
+ }) }, JSON.stringify(containers)),
1882
+ /* @__PURE__ */ jsx(NewGroupDropZone, { disabled: dndDisabled, setIsHovering: setIsHoveringNewGroupDropZone }),
1883
+ /* @__PURE__ */ jsx(DragOverlay, { adjustScale: false, dropAnimation, children: activeGroupData && draggingGroupId === activeGroupData.name ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-transparent", style: {
1884
+ padding: 0,
1885
+ margin: 0
1886
+ }, children: /* @__PURE__ */ jsx(NavigationGroup, { group: activeGroupData.name === DEFAULT_GROUP_NAME ? void 0 : activeGroupData.name, isPreview: false, minimised: true }) }) : activeItemForOverlay ? /* @__PURE__ */ jsx(NavigationCardBinding, { ...activeItemForOverlay, shrink: isHoveringNewGroupDropZone }) : null })
1887
+ ] }),
1888
+ !performingSearch && adminGroupData && /* @__PURE__ */ jsx(NavigationGroup, { group: adminGroupData.name, collapsed: isGroupCollapsed(adminGroupData.name), onToggleCollapsed: () => toggleGroupCollapsed(adminGroupData.name), children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: adminGroupData.entries.map((entry_0) => /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry_0, onClick: () => {
1889
+ let event_0 = "unmapped_event";
1890
+ if (entry_0.type === "collection") event_0 = "home_navigate_to_collection";
1891
+ else if (entry_0.type === "view") event_0 = "home_navigate_to_view";
1892
+ else if (entry_0.type === "admin") event_0 = "home_navigate_to_admin_view";
1893
+ context.analyticsController?.onAnalyticsEvent?.(event_0, {
1894
+ path: entry_0.slug
1895
+ });
1896
+ } }, entry_0.url)) }) }),
1897
+ sections && sections.map((section) => /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, section.key)),
1898
+ additionalPluginChildrenEnd,
1899
+ additionalChildrenEnd
1900
+ ] }),
1901
+ dialogOpenForGroup && /* @__PURE__ */ jsx(RenameGroupDialog, { open: true, initialName: dialogOpenForGroup, existingGroupNames: items.map((g_11) => g_11.name).filter((n2) => n2 !== dialogOpenForGroup), onClose: handleDialogClose, onRename: (newName) => {
1902
+ handleRenameGroup(dialogOpenForGroup, newName);
1903
+ } })
1904
+ ] });
1905
+ }
1906
+ function RebaseCMS(t0) {
1907
+ const $2 = c(9);
1908
+ const {
1909
+ collections,
1910
+ homePage,
1911
+ entityViews,
1912
+ entityActions,
1913
+ plugins,
1914
+ collectionEditor
1915
+ } = t0;
1916
+ const dispatch = useRebaseRegistryDispatch();
1917
+ let t1;
1918
+ let t2;
1919
+ if ($2[0] !== collectionEditor || $2[1] !== collections || $2[2] !== dispatch || $2[3] !== entityActions || $2[4] !== entityViews || $2[5] !== homePage || $2[6] !== plugins) {
1920
+ t1 = () => {
1921
+ dispatch.registerCMS({
1922
+ collections,
1923
+ homePage,
1924
+ entityViews,
1925
+ entityActions,
1926
+ plugins,
1927
+ collectionEditor
1928
+ });
1929
+ return () => dispatch.unregisterCMS();
1930
+ };
1931
+ t2 = [dispatch, collections, homePage, entityViews, entityActions, plugins, collectionEditor];
1932
+ $2[0] = collectionEditor;
1933
+ $2[1] = collections;
1934
+ $2[2] = dispatch;
1935
+ $2[3] = entityActions;
1936
+ $2[4] = entityViews;
1937
+ $2[5] = homePage;
1938
+ $2[6] = plugins;
1939
+ $2[7] = t1;
1940
+ $2[8] = t2;
1941
+ } else {
1942
+ t1 = $2[7];
1943
+ t2 = $2[8];
1944
+ }
1945
+ useLayoutEffect(t1, t2);
1946
+ return null;
1947
+ }
1948
+ function RebaseAuthGate(t0) {
1949
+ const $2 = c(8);
1950
+ const {
1951
+ children
1952
+ } = t0;
1953
+ const registry = useRebaseRegistry();
1954
+ const authController = useAuthController();
1955
+ if (authController?.initialLoading) {
1956
+ let t12;
1957
+ if ($2[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1958
+ t12 = /* @__PURE__ */ jsx(CircularProgressCenter, { size: "large" });
1959
+ $2[0] = t12;
1960
+ } else {
1961
+ t12 = $2[0];
1962
+ }
1963
+ return t12;
1964
+ }
1965
+ if (!authController?.user) {
1966
+ let t12;
1967
+ if ($2[1] !== authController || $2[2] !== registry.authConfig?.loginView) {
1968
+ t12 = registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(LoginView, { authController });
1969
+ $2[1] = authController;
1970
+ $2[2] = registry.authConfig?.loginView;
1971
+ $2[3] = t12;
1972
+ } else {
1973
+ t12 = $2[3];
1974
+ }
1975
+ const ActiveLoginView = t12;
1976
+ let t2;
1977
+ if ($2[4] !== ActiveLoginView) {
1978
+ t2 = /* @__PURE__ */ jsx(Fragment, { children: ActiveLoginView });
1979
+ $2[4] = ActiveLoginView;
1980
+ $2[5] = t2;
1981
+ } else {
1982
+ t2 = $2[5];
1983
+ }
1984
+ return t2;
1985
+ }
1986
+ let t1;
1987
+ if ($2[6] !== children) {
1988
+ t1 = /* @__PURE__ */ jsx(Fragment, { children });
1989
+ $2[6] = children;
1990
+ $2[7] = t1;
1991
+ } else {
1992
+ t1 = $2[7];
1993
+ }
1994
+ return t1;
1995
+ }
1996
+ function RebaseLayout(props) {
1997
+ const $2 = c(17);
1998
+ const {
1999
+ title: t0,
2000
+ appBar,
2001
+ drawer,
2002
+ autoOpenDrawer: t1,
2003
+ devViews: t2
2004
+ } = props;
2005
+ const title = t0 === void 0 ? "Rebase" : t0;
2006
+ const autoOpenDrawer = t1 === void 0 ? false : t1;
2007
+ let t3;
2008
+ if ($2[0] !== t2) {
2009
+ t3 = t2 === void 0 ? [] : t2;
2010
+ $2[0] = t2;
2011
+ $2[1] = t3;
2012
+ } else {
2013
+ t3 = $2[1];
2014
+ }
2015
+ const devViews = t3;
2016
+ const adminModeController = useAdminModeController();
2017
+ let t4;
2018
+ if ($2[2] !== appBar) {
2019
+ t4 = appBar ?? /* @__PURE__ */ jsx(AppBar, {});
2020
+ $2[2] = appBar;
2021
+ $2[3] = t4;
2022
+ } else {
2023
+ t4 = $2[3];
2024
+ }
2025
+ const ActiveAppBar = t4;
2026
+ let t5;
2027
+ if ($2[4] !== adminModeController || $2[5] !== drawer || $2[6] !== title) {
2028
+ t5 = drawer ?? /* @__PURE__ */ jsx(Drawer, { title, logoDestination: adminModeController.mode === "studio" ? "/s" : "/" });
2029
+ $2[4] = adminModeController;
2030
+ $2[5] = drawer;
2031
+ $2[6] = title;
2032
+ $2[7] = t5;
2033
+ } else {
2034
+ t5 = $2[7];
2035
+ }
2036
+ const ActiveDrawer = t5;
2037
+ let t6;
2038
+ if ($2[8] !== devViews) {
2039
+ t6 = /* @__PURE__ */ jsx(AdminModeSyncer, { devViews });
2040
+ $2[8] = devViews;
2041
+ $2[9] = t6;
2042
+ } else {
2043
+ t6 = $2[9];
2044
+ }
2045
+ let t7;
2046
+ let t8;
2047
+ if ($2[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2048
+ t7 = /* @__PURE__ */ jsx(Outlet, {});
2049
+ t8 = /* @__PURE__ */ jsx(SideDialogs, {});
2050
+ $2[10] = t7;
2051
+ $2[11] = t8;
2052
+ } else {
2053
+ t7 = $2[10];
2054
+ t8 = $2[11];
2055
+ }
2056
+ let t9;
2057
+ if ($2[12] !== ActiveAppBar || $2[13] !== ActiveDrawer || $2[14] !== autoOpenDrawer || $2[15] !== t6) {
2058
+ t9 = /* @__PURE__ */ jsxs(Scaffold, { autoOpenDrawer, children: [
2059
+ t6,
2060
+ ActiveAppBar,
2061
+ ActiveDrawer,
2062
+ t7,
2063
+ t8
2064
+ ] });
2065
+ $2[12] = ActiveAppBar;
2066
+ $2[13] = ActiveDrawer;
2067
+ $2[14] = autoOpenDrawer;
2068
+ $2[15] = t6;
2069
+ $2[16] = t9;
2070
+ } else {
2071
+ t9 = $2[16];
2072
+ }
2073
+ return t9;
2074
+ }
2075
+ function RebaseRoute() {
2076
+ const $2 = c(37);
2077
+ const location = useLocation$1();
2078
+ const collectionRegistry = useCollectionRegistryController();
2079
+ const urlController = useUrlController();
2080
+ const breadcrumbs = useBreadcrumbsController();
2081
+ const hash = location.hash;
2082
+ const isSidePanel = hash.includes("#side");
2083
+ let t0;
2084
+ if ($2[0] !== hash) {
2085
+ t0 = hash.includes("#new") || hash.includes("#new_side");
2086
+ $2[0] = hash;
2087
+ $2[1] = t0;
2088
+ } else {
2089
+ t0 = $2[1];
2090
+ }
2091
+ const isNew = t0;
2092
+ let t1;
2093
+ if ($2[2] !== hash) {
2094
+ t1 = hash.includes("#copy");
2095
+ $2[2] = hash;
2096
+ $2[3] = t1;
2097
+ } else {
2098
+ t1 = $2[3];
2099
+ }
2100
+ const isCopy = t1;
2101
+ const pathname = location.pathname;
2102
+ let navigationEntries;
2103
+ let t2;
2104
+ let t3;
2105
+ let t4;
2106
+ if ($2[4] !== breadcrumbs || $2[5] !== collectionRegistry.collections || $2[6] !== pathname || $2[7] !== urlController) {
2107
+ const navigationPath = urlController.urlPathToDataPath(pathname);
2108
+ let t52;
2109
+ if ($2[12] !== collectionRegistry.collections) {
2110
+ t52 = collectionRegistry.collections ?? [];
2111
+ $2[12] = collectionRegistry.collections;
2112
+ $2[13] = t52;
2113
+ } else {
2114
+ t52 = $2[13];
2115
+ }
2116
+ navigationEntries = getNavigationEntriesFromPath({
2117
+ path: navigationPath,
2118
+ collections: t52
2119
+ });
2120
+ t3 = useEffect;
2121
+ t4 = () => {
2122
+ const lastEntry = navigationEntries[navigationEntries.length - 1];
2123
+ const isViewingCollection = lastEntry?.type === "collection";
2124
+ breadcrumbs.set({
2125
+ breadcrumbs: navigationEntries.map((entry, index) => {
2126
+ const isLastEntry = index === navigationEntries.length - 1;
2127
+ if (entry.type === "entity") {
2128
+ return {
2129
+ title: String(entry.entityId),
2130
+ url: urlController.buildUrlCollectionPath(entry.path)
2131
+ };
2132
+ } else {
2133
+ if (entry.type === "custom_view") {
2134
+ return {
2135
+ title: String(entry.view.name ?? entry.view.key),
2136
+ url: urlController.buildUrlCollectionPath(entry.path)
2137
+ };
2138
+ } else {
2139
+ if (entry.type === "collection") {
2140
+ const showCount = isLastEntry && isViewingCollection;
2141
+ return {
2142
+ title: entry.collection.name,
2143
+ url: urlController.buildUrlCollectionPath(entry.path),
2144
+ id: entry.path,
2145
+ ...showCount ? {
2146
+ count: null
2147
+ } : {}
2148
+ };
2149
+ } else {
2150
+ throw new Error("Unexpected navigation entry type");
2151
+ }
2152
+ }
2153
+ }
2154
+ })
2155
+ });
2156
+ };
2157
+ t2 = navigationEntries.map(_temp).join(",");
2158
+ $2[4] = breadcrumbs;
2159
+ $2[5] = collectionRegistry.collections;
2160
+ $2[6] = pathname;
2161
+ $2[7] = urlController;
2162
+ $2[8] = navigationEntries;
2163
+ $2[9] = t2;
2164
+ $2[10] = t3;
2165
+ $2[11] = t4;
2166
+ } else {
2167
+ navigationEntries = $2[8];
2168
+ t2 = $2[9];
2169
+ t3 = $2[10];
2170
+ t4 = $2[11];
2171
+ }
2172
+ let t5;
2173
+ if ($2[14] !== t2) {
2174
+ t5 = [t2];
2175
+ $2[14] = t2;
2176
+ $2[15] = t5;
2177
+ } else {
2178
+ t5 = $2[15];
2179
+ }
2180
+ t3(t4, t5);
2181
+ if (isNew) {
2182
+ let t62;
2183
+ if ($2[16] !== navigationEntries || $2[17] !== pathname) {
2184
+ t62 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew: true, isCopy: false });
2185
+ $2[16] = navigationEntries;
2186
+ $2[17] = pathname;
2187
+ $2[18] = t62;
2188
+ } else {
2189
+ t62 = $2[18];
2190
+ }
2191
+ return t62;
2192
+ }
2193
+ if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
2194
+ let t62;
2195
+ let t7;
2196
+ if ($2[19] !== collectionRegistry || $2[20] !== navigationEntries[0].id || $2[21] !== navigationEntries[0].slug) {
2197
+ t7 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
2198
+ bb0: {
2199
+ let collection;
2200
+ collection = collectionRegistry.getCollection(navigationEntries[0].id);
2201
+ if (!collection) {
2202
+ collection = collectionRegistry.getCollection(navigationEntries[0].slug);
2203
+ }
2204
+ if (!collection) {
2205
+ if (!collectionRegistry.initialised) {
2206
+ let t82;
2207
+ if ($2[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2208
+ t82 = /* @__PURE__ */ jsx(CircularProgressCenter, {});
2209
+ $2[24] = t82;
2210
+ } else {
2211
+ t82 = $2[24];
2212
+ }
2213
+ t7 = t82;
2214
+ break bb0;
2215
+ }
2216
+ t7 = null;
2217
+ break bb0;
2218
+ }
2219
+ let t8;
2220
+ if ($2[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2221
+ t8 = [];
2222
+ $2[25] = t8;
2223
+ } else {
2224
+ t8 = $2[25];
2225
+ }
2226
+ t62 = /* @__PURE__ */ jsx(EntityCollectionView, { parentCollectionIds: t8, path: collection.slug, updateUrl: true, ...collection, Actions: toArray(collection.Actions) }, `collection_view_${collection.slug}`);
2227
+ }
2228
+ $2[19] = collectionRegistry;
2229
+ $2[20] = navigationEntries[0].id;
2230
+ $2[21] = navigationEntries[0].slug;
2231
+ $2[22] = t62;
2232
+ $2[23] = t7;
2233
+ } else {
2234
+ t62 = $2[22];
2235
+ t7 = $2[23];
2236
+ }
2237
+ if (t7 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
2238
+ return t7;
2239
+ }
2240
+ return t62;
2241
+ }
2242
+ if (isSidePanel) {
2243
+ const lastCollectionEntry = [...navigationEntries].reverse().find(_temp2);
2244
+ if (lastCollectionEntry) {
2245
+ let t62;
2246
+ let t7;
2247
+ if ($2[26] !== collectionRegistry || $2[27] !== navigationEntries[0]) {
2248
+ t7 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
2249
+ bb1: {
2250
+ let collection_0;
2251
+ const firstEntry = navigationEntries[0];
2252
+ collection_0 = collectionRegistry.getCollection(firstEntry.id);
2253
+ if (!collection_0) {
2254
+ collection_0 = collectionRegistry.getCollection(firstEntry.slug);
2255
+ }
2256
+ if (!collection_0) {
2257
+ if (!collectionRegistry.initialised) {
2258
+ let t82;
2259
+ if ($2[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2260
+ t82 = /* @__PURE__ */ jsx(CircularProgressCenter, {});
2261
+ $2[30] = t82;
2262
+ } else {
2263
+ t82 = $2[30];
2264
+ }
2265
+ t7 = t82;
2266
+ break bb1;
2267
+ }
2268
+ t7 = null;
2269
+ break bb1;
2270
+ }
2271
+ let t8;
2272
+ if ($2[31] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2273
+ t8 = [];
2274
+ $2[31] = t8;
2275
+ } else {
2276
+ t8 = $2[31];
2277
+ }
2278
+ t62 = /* @__PURE__ */ jsx(EntityCollectionView, { parentCollectionIds: t8, path: collection_0.slug, updateUrl: true, ...collection_0, Actions: toArray(collection_0.Actions) }, `collection_view_${collection_0.slug}`);
2279
+ }
2280
+ $2[26] = collectionRegistry;
2281
+ $2[27] = navigationEntries[0];
2282
+ $2[28] = t62;
2283
+ $2[29] = t7;
2284
+ } else {
2285
+ t62 = $2[28];
2286
+ t7 = $2[29];
2287
+ }
2288
+ if (t7 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
2289
+ return t7;
2290
+ }
2291
+ return t62;
2292
+ }
2293
+ }
2294
+ let t6;
2295
+ if ($2[32] !== isCopy || $2[33] !== isNew || $2[34] !== navigationEntries || $2[35] !== pathname) {
2296
+ t6 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew, isCopy });
2297
+ $2[32] = isCopy;
2298
+ $2[33] = isNew;
2299
+ $2[34] = navigationEntries;
2300
+ $2[35] = pathname;
2301
+ $2[36] = t6;
2302
+ } else {
2303
+ t6 = $2[36];
2304
+ }
2305
+ return t6;
2306
+ }
2307
+ function _temp2(entry_1) {
2308
+ return entry_1.type === "collection";
2309
+ }
2310
+ function _temp(entry_0) {
2311
+ return entry_0.path;
2312
+ }
2313
+ function getSelectedTabFromUrl(isNew, lastCustomView) {
2314
+ if (isNew) {
2315
+ return void 0;
2316
+ } else if (lastCustomView) {
2317
+ if (lastCustomView.type === "custom_view") {
2318
+ return lastCustomView.view.key;
2319
+ } else if (lastCustomView.type === "collection") {
2320
+ return lastCustomView.id ?? lastCustomView.slug;
2321
+ }
2322
+ }
2323
+ return void 0;
2324
+ }
2325
+ function EntityFullScreenRoute({
2326
+ pathname,
2327
+ navigationEntries,
2328
+ isNew,
2329
+ isCopy
2330
+ }) {
2331
+ const collectionRegistry = useCollectionRegistryController();
2332
+ const urlController = useUrlController();
2333
+ const navigate = useNavigate();
2334
+ const navigationPath = urlController.urlPathToDataPath(pathname);
2335
+ const blocked = useRef(false);
2336
+ const lastEntityEntry = [...navigationEntries].reverse().find((entry) => entry.type === "entity");
2337
+ const navigationEntriesAfterEntity = lastEntityEntry ? navigationEntries.slice(navigationEntries.indexOf(lastEntityEntry) + 1) : [];
2338
+ const lastCustomView = [...navigationEntriesAfterEntity].reverse().find((entry_0) => entry_0.type === "custom_view" || entry_0.type === "collection");
2339
+ const entityId = lastEntityEntry && "entityId" in lastEntityEntry ? lastEntityEntry.entityId : void 0;
2340
+ const urlTab = getSelectedTabFromUrl(isNew, lastCustomView);
2341
+ const [selectedTab, setSelectedTab] = useState(urlTab);
2342
+ const parentCollectionIds = collectionRegistry.getParentCollectionIds(navigationPath);
2343
+ useEffect(() => {
2344
+ if (urlTab !== selectedTab) {
2345
+ setSelectedTab(urlTab);
2346
+ }
2347
+ }, [urlTab]);
2348
+ const basePath = !entityId || isNew ? pathname : pathname.substring(0, pathname.lastIndexOf(`/${entityId}`));
2349
+ const entityPath = basePath + `/${entityId}`;
2350
+ let blocker = void 0;
2351
+ try {
2352
+ blocker = useBlocker(({
2353
+ nextLocation
2354
+ }) => {
2355
+ if (nextLocation.pathname.startsWith(entityPath)) return false;
2356
+ return blocked.current;
2357
+ });
2358
+ } catch (e) {
2359
+ }
2360
+ const lastCollectionEntry = [...navigationEntries].reverse().find((entry_1) => entry_1.type === "collection");
2361
+ if (isNew && !lastCollectionEntry) {
2362
+ throw new Error("INTERNAL: No collection found in the navigation");
2363
+ }
2364
+ if (!isNew && !lastEntityEntry) {
2365
+ if (!collectionRegistry.initialised) {
2366
+ return /* @__PURE__ */ jsx(CircularProgressCenter, {});
2367
+ }
2368
+ return /* @__PURE__ */ jsx(NotFoundPage, {});
2369
+ }
2370
+ const collection = isNew ? lastCollectionEntry && "collection" in lastCollectionEntry ? lastCollectionEntry.collection : void 0 : lastEntityEntry && "parentCollection" in lastEntityEntry ? lastEntityEntry.parentCollection : void 0;
2371
+ const fullIdPath = isNew ? lastCollectionEntry.slug : lastEntityEntry.slug;
2372
+ const collectionPath = urlController.resolveDatabasePathsFrom(fullIdPath);
2373
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2374
+ /* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
2375
+ const newSelectedTab = params.selectedTab;
2376
+ const newEntityId = params.entityId;
2377
+ if (newSelectedTab) {
2378
+ navigate(`${basePath}/${newEntityId}/${newSelectedTab}`, {
2379
+ replace: true
2380
+ });
2381
+ } else {
2382
+ navigate(`${basePath}/${newEntityId}`, {
2383
+ replace: true
2384
+ });
2385
+ }
2386
+ }, onTabChange: (params_0) => {
2387
+ setSelectedTab(params_0.selectedTab);
2388
+ if (isNew) {
2389
+ return;
2390
+ }
2391
+ const newSelectedTab_0 = params_0.selectedTab;
2392
+ if (newSelectedTab_0) {
2393
+ navigate(`${basePath}/${entityId}/${newSelectedTab_0}`, {
2394
+ replace: true
2395
+ });
2396
+ } else {
2397
+ navigate(`${basePath}/${entityId}`, {
2398
+ replace: true
2399
+ });
2400
+ }
2401
+ }, parentCollectionIds }, collection.slug + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)),
2402
+ /* @__PURE__ */ jsx(UnsavedChangesDialog, { open: blocker?.state === "blocked", handleOk: () => blocker?.proceed?.(), handleCancel: () => blocker?.reset?.(), body: "You have unsaved changes in this entity." })
2403
+ ] });
2404
+ }
2405
+ function CustomViewRoute(t0) {
2406
+ const $2 = c(8);
2407
+ const {
2408
+ view
2409
+ } = t0;
2410
+ const breadcrumbs = useBreadcrumbsController();
2411
+ const urlController = useUrlController();
2412
+ let t1;
2413
+ if ($2[0] !== breadcrumbs || $2[1] !== urlController || $2[2] !== view.name || $2[3] !== view.slug) {
2414
+ t1 = () => {
2415
+ breadcrumbs.set({
2416
+ breadcrumbs: [{
2417
+ title: view.name,
2418
+ url: urlController.buildAppUrlPath(view.slug)
2419
+ }]
2420
+ });
2421
+ };
2422
+ $2[0] = breadcrumbs;
2423
+ $2[1] = urlController;
2424
+ $2[2] = view.name;
2425
+ $2[3] = view.slug;
2426
+ $2[4] = t1;
2427
+ } else {
2428
+ t1 = $2[4];
2429
+ }
2430
+ let t2;
2431
+ if ($2[5] !== urlController || $2[6] !== view.slug) {
2432
+ t2 = [view.slug, urlController];
2433
+ $2[5] = urlController;
2434
+ $2[6] = view.slug;
2435
+ $2[7] = t2;
2436
+ } else {
2437
+ t2 = $2[7];
2438
+ }
2439
+ useEffect(t1, t2);
2440
+ return view.view;
2441
+ }
2442
+ function SettingsView() {
2443
+ const {
2444
+ t: t2
2445
+ } = useTranslation();
2446
+ const breadcrumbs = useBreadcrumbsController();
2447
+ useEffect(() => {
2448
+ breadcrumbs.set({
2449
+ breadcrumbs: [{
2450
+ title: t2("project_settings"),
2451
+ url: "/settings"
2452
+ }]
2453
+ });
2454
+ }, []);
2455
+ return /* @__PURE__ */ jsx(UserSettingsView, {});
2456
+ }
2457
+ function RebaseRouteDefs({
2458
+ children,
2459
+ layout
2460
+ }) {
2461
+ const registry = useRebaseRegistry();
2462
+ const userManagement = useInternalUserManagementController();
2463
+ const navigationStateController = useNavigationStateController();
2464
+ const cmsHomePage = registry.cmsConfig?.homePage ?? /* @__PURE__ */ jsx(ContentHomePage, {});
2465
+ const studioHomePage = registry.studioConfig?.homePage;
2466
+ const combinedViews = useMemo(() => [...navigationStateController.views ?? [], ...navigationStateController.adminViews ?? []], [navigationStateController.views, navigationStateController.adminViews]);
2467
+ const routeContents = /* @__PURE__ */ jsxs(Fragment, { children: [
2468
+ /* @__PURE__ */ jsx(Route, { path: "/", element: cmsHomePage }),
2469
+ registry.studioConfig && /* @__PURE__ */ jsx(Route, { path: "/s", element: studioHomePage }),
2470
+ /* @__PURE__ */ jsx(Route, { path: "/c/*", element: /* @__PURE__ */ jsx(RebaseRoute, {}) }),
2471
+ /* @__PURE__ */ jsx(Route, { path: "/settings", element: /* @__PURE__ */ jsx(SettingsView, {}) }),
2472
+ userManagement && /* @__PURE__ */ jsx(Route, { path: "/roles", element: /* @__PURE__ */ jsx(RolesView, { userManagement }) }),
2473
+ userManagement && /* @__PURE__ */ jsx(Route, { path: "/users", element: /* @__PURE__ */ jsx(UsersView, { userManagement }) }),
2474
+ /* @__PURE__ */ jsx(Route, { path: "/debug/ui", element: /* @__PURE__ */ jsx(UIReferenceView, {}) }),
2475
+ combinedViews.map((view) => {
2476
+ const slugs = Array.isArray(view.slug) ? view.slug : [view.slug];
2477
+ return slugs.flatMap((slug) => {
2478
+ const routes = [/* @__PURE__ */ jsx(Route, { path: slug, element: /* @__PURE__ */ jsx(CustomViewRoute, { view }) }, slug)];
2479
+ if (view.nestedRoutes) {
2480
+ routes.push(/* @__PURE__ */ jsx(Route, { path: slug + "/*", element: /* @__PURE__ */ jsx(CustomViewRoute, { view }) }, slug + "/*"));
2481
+ }
2482
+ return routes;
2483
+ });
2484
+ }),
2485
+ children,
2486
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(NotFoundPage, {}) })
2487
+ ] });
2488
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2489
+ /* @__PURE__ */ jsx(RebaseRoutes, { children: layout ? /* @__PURE__ */ jsx(Route, { element: layout, children: routeContents }) : /* @__PURE__ */ jsx(Route, { element: /* @__PURE__ */ jsx(Fragment, { children: routeContents }), children: routeContents }) }),
2490
+ /* @__PURE__ */ jsx(CollectionEditorDialogs, {})
2491
+ ] });
2492
+ }
2493
+ function RebaseShell(props) {
2494
+ const $2 = c(11);
2495
+ const {
2496
+ title: t0,
2497
+ appBar,
2498
+ drawer,
2499
+ autoOpenDrawer: t1,
2500
+ children
2501
+ } = props;
2502
+ const title = t0 === void 0 ? "Rebase" : t0;
2503
+ const autoOpenDrawer = t1 === void 0 ? false : t1;
2504
+ const registry = useRebaseRegistry();
2505
+ registry.studioConfig?.devViews;
2506
+ let t2;
2507
+ let t3;
2508
+ if ($2[0] !== registry.studioConfig?.devViews) {
2509
+ t3 = registry.studioConfig?.devViews ?? [];
2510
+ $2[0] = registry.studioConfig?.devViews;
2511
+ $2[1] = t3;
2512
+ } else {
2513
+ t3 = $2[1];
2514
+ }
2515
+ t2 = t3;
2516
+ const devViews = t2;
2517
+ let t4;
2518
+ if ($2[2] !== appBar || $2[3] !== autoOpenDrawer || $2[4] !== devViews || $2[5] !== drawer || $2[6] !== title) {
2519
+ t4 = /* @__PURE__ */ jsx(RebaseLayout, { title, appBar, drawer, autoOpenDrawer, devViews });
2520
+ $2[2] = appBar;
2521
+ $2[3] = autoOpenDrawer;
2522
+ $2[4] = devViews;
2523
+ $2[5] = drawer;
2524
+ $2[6] = title;
2525
+ $2[7] = t4;
2526
+ } else {
2527
+ t4 = $2[7];
2528
+ }
2529
+ let t5;
2530
+ if ($2[8] !== children || $2[9] !== t4) {
2531
+ t5 = /* @__PURE__ */ jsx(RebaseAuthGate, { children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(RebaseRouteDefs, { layout: t4, children }) }) });
2532
+ $2[8] = children;
2533
+ $2[9] = t4;
2534
+ $2[10] = t5;
2535
+ } else {
2536
+ t5 = $2[10];
2537
+ }
2538
+ return t5;
2539
+ }
2540
+ function ArrayOfMapsPreview(t0) {
2541
+ const $2 = c(9);
2542
+ let t1;
2543
+ let t2;
2544
+ let t3;
2545
+ if ($2[0] !== t0) {
2546
+ t3 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
2547
+ bb0: {
2548
+ const {
2549
+ propertyKey,
2550
+ value,
2551
+ property,
2552
+ size
2553
+ } = t0;
2554
+ if (Array.isArray(property?.of)) {
2555
+ throw Error("Using array properties instead of single one in `of` in ArrayProperty");
2556
+ }
2557
+ if (property?.type !== "array" || !property.of || property.of.type !== "map") {
2558
+ throw Error("Picked wrong preview component ArrayOfMapsPreview");
2559
+ }
2560
+ const mapProperty = property.of;
2561
+ const properties = mapProperty.properties;
2562
+ if (!properties) {
2563
+ throw Error(`You need to specify a 'properties' prop (or specify a custom field) in your map property ${propertyKey}`);
2564
+ }
2565
+ const values = value;
2566
+ const previewProperties = mapProperty.previewProperties;
2567
+ if (!values) {
2568
+ t3 = null;
2569
+ break bb0;
2570
+ }
2571
+ let mapProperties;
2572
+ mapProperties = previewProperties;
2573
+ if (!mapProperties || !mapProperties.length) {
2574
+ mapProperties = Object.keys(properties);
2575
+ if (size) {
2576
+ mapProperties = mapProperties.slice(0, 3);
2577
+ }
2578
+ }
2579
+ t2 = "table-auto text-xs";
2580
+ t1 = values && values.map((v2, index) => /* @__PURE__ */ jsx("div", { className: "border-b last:border-b-0 py-2", children: mapProperties && mapProperties.map((key) => /* @__PURE__ */ jsx("div", { className: "table-cell", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key, value: v2[key], property: properties[key], size: "small" }) }) }, `table-cell-${key}`)) }, `table_${v2}_${index}`));
2581
+ }
2582
+ $2[0] = t0;
2583
+ $2[1] = t1;
2584
+ $2[2] = t2;
2585
+ $2[3] = t3;
2586
+ } else {
2587
+ t1 = $2[1];
2588
+ t2 = $2[2];
2589
+ t3 = $2[3];
2590
+ }
2591
+ if (t3 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
2592
+ return t3;
2593
+ }
2594
+ let t4;
2595
+ if ($2[4] !== t1) {
2596
+ t4 = /* @__PURE__ */ jsx("div", { children: t1 });
2597
+ $2[4] = t1;
2598
+ $2[5] = t4;
2599
+ } else {
2600
+ t4 = $2[5];
2601
+ }
2602
+ let t5;
2603
+ if ($2[6] !== t2 || $2[7] !== t4) {
2604
+ t5 = /* @__PURE__ */ jsx("div", { className: t2, children: t4 });
2605
+ $2[6] = t2;
2606
+ $2[7] = t4;
2607
+ $2[8] = t5;
2608
+ } else {
2609
+ t5 = $2[8];
2610
+ }
2611
+ return t5;
2612
+ }
2613
+ function MissingReferenceWidget(t0) {
2614
+ const $2 = c(18);
2615
+ const {
2616
+ path: pathProp
2617
+ } = t0;
2618
+ const registry = useCollectionRegistryController();
2619
+ const path = getLastSegment(pathProp);
2620
+ let t1;
2621
+ if ($2[0] !== pathProp || $2[1] !== registry) {
2622
+ t1 = registry.getParentCollectionIds(pathProp);
2623
+ $2[0] = pathProp;
2624
+ $2[1] = registry;
2625
+ $2[2] = t1;
2626
+ } else {
2627
+ t1 = $2[2];
2628
+ }
2629
+ const parentCollectionIds = t1;
2630
+ const collectionEditor = useCollectionEditorController();
2631
+ const {
2632
+ t: t2
2633
+ } = useTranslation();
2634
+ const t22 = "p-1 flex flex-col items-center";
2635
+ const T0 = ErrorView;
2636
+ const t3 = t2("studio_missing_reference_error", {
2637
+ path
2638
+ });
2639
+ let t4;
2640
+ if ($2[3] !== T0 || $2[4] !== t3) {
2641
+ t4 = /* @__PURE__ */ jsx(T0, { error: t3 });
2642
+ $2[3] = T0;
2643
+ $2[4] = t3;
2644
+ $2[5] = t4;
2645
+ } else {
2646
+ t4 = $2[5];
2647
+ }
2648
+ let t5;
2649
+ if ($2[6] !== collectionEditor || $2[7] !== parentCollectionIds || $2[8] !== path) {
2650
+ t5 = () => {
2651
+ collectionEditor.createCollection({
2652
+ initialValues: {
2653
+ path,
2654
+ name: prettifyIdentifier(path)
2655
+ },
2656
+ parentCollectionIds,
2657
+ redirect: false,
2658
+ sourceClick: "missing_reference"
2659
+ });
2660
+ };
2661
+ $2[6] = collectionEditor;
2662
+ $2[7] = parentCollectionIds;
2663
+ $2[8] = path;
2664
+ $2[9] = t5;
2665
+ } else {
2666
+ t5 = $2[9];
2667
+ }
2668
+ let t6;
2669
+ if ($2[10] !== t2) {
2670
+ t6 = t2("studio_missing_reference_create");
2671
+ $2[10] = t2;
2672
+ $2[11] = t6;
2673
+ } else {
2674
+ t6 = $2[11];
2675
+ }
2676
+ let t7;
2677
+ if ($2[12] !== t5 || $2[13] !== t6) {
2678
+ t7 = /* @__PURE__ */ jsx(Button, { className: "mx-2", size: "small", onClick: t5, children: t6 });
2679
+ $2[12] = t5;
2680
+ $2[13] = t6;
2681
+ $2[14] = t7;
2682
+ } else {
2683
+ t7 = $2[14];
2684
+ }
2685
+ let t8;
2686
+ if ($2[15] !== t4 || $2[16] !== t7) {
2687
+ t8 = /* @__PURE__ */ jsxs("div", { className: t22, children: [
2688
+ t4,
2689
+ t7
2690
+ ] });
2691
+ $2[15] = t4;
2692
+ $2[16] = t7;
2693
+ $2[17] = t8;
2694
+ } else {
2695
+ t8 = $2[17];
2696
+ }
2697
+ return t8;
2698
+ }
2699
+ function getLastSegment(path) {
2700
+ const segments = path.split("/");
2701
+ return segments[segments.length - 1];
2702
+ }
2703
+ export {
2704
+ AdminModeSyncer,
2705
+ AppBar,
2706
+ l as ArrayContainer,
2707
+ m as ArrayCustomShapedFieldBinding,
2708
+ n as ArrayEnumPreview,
2709
+ ArrayOfMapsPreview,
2710
+ o as ArrayOfReferencesFieldBinding,
2711
+ p as ArrayOfReferencesPreview,
2712
+ q as ArrayOfStorageComponentsPreview,
2713
+ r as ArrayOfStringsPreview,
2714
+ s as ArrayOneOfPreview,
2715
+ t as ArrayPropertyEnumPreview,
2716
+ v as ArrayPropertyPreview,
2717
+ BasicExportAction,
2718
+ B as BlockFieldBinding,
2719
+ w as BooleanPreview,
2720
+ x as CollectionGenerationApiError,
2721
+ y as CollectionRegistryContext,
2722
+ ContentHomePage,
2723
+ CustomViewRoute,
2724
+ z as DEFAULT_COLLECTION_GENERATION_ENDPOINT,
2725
+ F as DEFAULT_FIELD_CONFIGS,
2726
+ G as DataNewPropertiesMapping,
2727
+ H as DatePreview,
2728
+ I as DateTimeFieldBinding,
2729
+ Drawer,
2730
+ J as EmptyValue,
2731
+ K as EntityCard,
2732
+ L as EntityCollectionCardView,
2733
+ M as EntityCollectionRowActions,
2734
+ O as EntityCollectionTable,
2735
+ EntityCollectionView,
2736
+ Q as EntityCollectionViewActions,
2737
+ T as EntityForm,
2738
+ V as EntityPreview,
2739
+ W as EntitySelectionTable,
2740
+ X as EntityView,
2741
+ Y as EnumValuesChip,
2742
+ Z as ExportCollectionAction,
2743
+ _ as FieldCaption,
2744
+ $ as FieldHelperText,
2745
+ a0 as FormEntry,
2746
+ a1 as FormLayout,
2747
+ a2 as ImagePreview,
2748
+ a3 as ImportCollectionAction,
2749
+ a4 as ImportDataPreview,
2750
+ a5 as ImportFileUpload,
2751
+ a6 as ImportNewPropertyFieldPreview,
2752
+ a7 as ImportSaveInProgress,
2753
+ a8 as KeyValueFieldBinding,
2754
+ a9 as KeyValuePreview,
2755
+ aa as LabelWithIcon,
2756
+ ab as LabelWithIconAndTooltip,
2757
+ ac as MapFieldBinding,
2758
+ ad as MapPropertyPreview,
2759
+ ae as MarkdownEditorFieldBinding,
2760
+ MissingReferenceWidget,
2761
+ af as MultiSelectFieldBinding,
2762
+ ag as NavigationStateContext,
2763
+ ah as NumberPropertyPreview,
2764
+ ai as PropertyConfigBadge,
2765
+ aj as PropertyFieldBinding,
2766
+ ak as PropertyIdCopyTooltip,
2767
+ PropertyPreview,
2768
+ al as PropertySelectEntry,
2769
+ am as ReadOnlyFieldBinding,
2770
+ RebaseAuthGate,
2771
+ RebaseCMS,
2772
+ an as RebaseEditor,
2773
+ RebaseLayout,
2774
+ RebaseNavigation,
2775
+ RebaseRoute,
2776
+ RebaseRouteDefs,
2777
+ RebaseShell,
2778
+ ao as ReferenceAsStringFieldBinding,
2779
+ ap as ReferenceFieldBinding,
2780
+ ReferencePreview,
2781
+ ReferenceWidget,
2782
+ aq as RelationPreview,
2783
+ ar as RepeatFieldBinding,
2784
+ RolesView,
2785
+ Scaffold,
2786
+ as as SearchIconsView,
2787
+ at as SelectFieldBinding,
2788
+ au as SelectableTable,
2789
+ av as SelectableTableContext,
2790
+ SideDialogs,
2791
+ aw as SideEntityControllerContext,
2792
+ ax as SideEntityProvider,
2793
+ ay as SkeletonPropertyComponent,
2794
+ az as StorageThumbnail,
2795
+ aA as StorageThumbnailInternal,
2796
+ aB as StorageUploadFieldBinding,
2797
+ aC as StringPropertyPreview,
2798
+ aD as SwitchFieldBinding,
2799
+ aE as TextFieldBinding,
2800
+ aF as UrlComponentPreview,
2801
+ aG as UrlContext,
2802
+ aH as UserPreview,
2803
+ UsersView,
2804
+ aI as VirtualTableInput,
2805
+ aJ as addInitialSlash,
2806
+ aK as buildCollectionGenerationCallback,
2807
+ aL as buildSidePanelsFromUrl,
2808
+ aM as convertDataToEntity,
2809
+ aN as convertFileToJson,
2810
+ aO as copyEntityAction,
2811
+ aP as deleteEntityAction,
2812
+ aQ as downloadBlob,
2813
+ aR as downloadDataAsCsv,
2814
+ downloadEntitiesExport,
2815
+ aS as editEntityAction,
2816
+ aT as flattenEntry,
2817
+ aU as getBracketNotation,
2818
+ aV as getCollectionBySlugWithin,
2819
+ aW as getCollectionPathsCombinations,
2820
+ aX as getDefaultFieldConfig,
2821
+ aY as getDefaultFieldId,
2822
+ aZ as getDefaultPropertiesOrder,
2823
+ a_ as getEntityCSVExportableData,
2824
+ a$ as getEntityJsonExportableData,
2825
+ b0 as getEntityPreviewKeys,
2826
+ b1 as getEntityTitlePropertyKey,
2827
+ b2 as getEntityViewWidth,
2828
+ b3 as getFieldConfig,
2829
+ b4 as getFieldId,
2830
+ b5 as getFullId,
2831
+ b6 as getFullIdPath,
2832
+ b7 as getIconForProperty,
2833
+ b8 as getIconForWidget,
2834
+ b9 as getInferenceType,
2835
+ ba as getLastSegment,
2836
+ bb as getPropertiesWithPropertiesOrder,
2837
+ bc as getPropertyInPath,
2838
+ bd as getResolvedPropertyInPath,
2839
+ be as idToPropertiesPath,
2840
+ bf as isReferenceProperty,
2841
+ bg as isRelationProperty,
2842
+ bh as mergeEntityActions,
2843
+ bi as namespaceToPropertiesOrderPath,
2844
+ bj as namespaceToPropertiesPath,
2845
+ bk as processValueMapping,
2846
+ bl as removeInitialAndTrailingSlashes,
2847
+ bm as removeInitialSlash,
2848
+ bn as removeTrailingSlash,
2849
+ bo as renderSkeletonCaptionText,
2850
+ bp as renderSkeletonIcon,
2851
+ bq as renderSkeletonImageThumbnail,
2852
+ br as renderSkeletonText,
2853
+ bs as resolveCollectionPathIds,
2854
+ bt as resolveEntityAction,
2855
+ bu as resolveEntityView,
2856
+ resolveNavigationFrom,
2857
+ bv as unflattenObject,
2858
+ bw as useApp,
2859
+ useBreadcrumbsController,
2860
+ bx as useBuildCollectionRegistryController,
2861
+ by as useBuildNavigationStateController,
2862
+ bz as useBuildSideEntityController,
2863
+ bA as useBuildUrlController,
2864
+ useCMSContext,
2865
+ bB as useClearRestoreValue,
2866
+ useCollectionEditorController,
2867
+ useCollectionRegistryController,
2868
+ bC as useCollectionsConfigController,
2869
+ bD as useEntityHistory,
2870
+ useEntitySelectionDialog,
2871
+ bE as useImportConfig,
2872
+ bF as useLocalCollectionsConfigController,
2873
+ useNavigationStateController,
2874
+ bG as useResolvedCollections,
2875
+ useResolvedNavigationFrom,
2876
+ bH as useResolvedViews,
2877
+ bI as useSelectionController,
2878
+ bJ as useSideDialogsController,
2879
+ bK as useSideEntityController,
2880
+ bL as useTopLevelNavigation,
2881
+ useUrlController,
2882
+ bM as validateCollectionJson,
2883
+ bN as zodToFormErrors
2884
+ };
2885
+ //# sourceMappingURL=index.js.map