@vertesia/ui 1.5.0-dev.20260806.125520Z → 1.5.0-dev.20260826.064249Z

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 (432) hide show
  1. package/README.md +1 -7
  2. package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js +1 -1
  3. package/lib/core/components/shadcn/filters/comboBox/DateCombobox.js.map +1 -1
  4. package/lib/core/components/shadcn/filters/filter/dateFilter.d.ts.map +1 -1
  5. package/lib/core/components/shadcn/filters/filter/dateFilter.js +1 -1
  6. package/lib/core/components/shadcn/filters/filter/dateFilter.js.map +1 -1
  7. package/lib/core/components/shadcn/filters/filters.d.ts.map +1 -1
  8. package/lib/core/components/shadcn/filters/filters.js +1 -1
  9. package/lib/core/components/shadcn/filters/filters.js.map +1 -1
  10. package/lib/core/components/shadcn/index.d.ts +1 -0
  11. package/lib/core/components/shadcn/index.d.ts.map +1 -1
  12. package/lib/core/components/shadcn/index.js +1 -0
  13. package/lib/core/components/shadcn/index.js.map +1 -1
  14. package/lib/core/components/shadcn/modal/dialog.d.ts.map +1 -1
  15. package/lib/core/components/shadcn/modal/dialog.js +1 -3
  16. package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
  17. package/lib/core/components/shadcn/overflowTabs.d.ts +59 -0
  18. package/lib/core/components/shadcn/overflowTabs.d.ts.map +1 -0
  19. package/lib/core/components/shadcn/overflowTabs.js +173 -0
  20. package/lib/core/components/shadcn/overflowTabs.js.map +1 -0
  21. package/lib/core/components/shadcn/selectBox.js +2 -2
  22. package/lib/core/components/shadcn/selectBox.js.map +1 -1
  23. package/lib/core/components/shadcn/theme/ThemeProvider.d.ts +3 -1
  24. package/lib/core/components/shadcn/theme/ThemeProvider.d.ts.map +1 -1
  25. package/lib/core/components/shadcn/theme/ThemeProvider.js +8 -9
  26. package/lib/core/components/shadcn/theme/ThemeProvider.js.map +1 -1
  27. package/lib/core/utils/dayjs.d.ts +12 -0
  28. package/lib/core/utils/dayjs.d.ts.map +1 -0
  29. package/lib/core/utils/dayjs.js +16 -0
  30. package/lib/core/utils/dayjs.js.map +1 -0
  31. package/lib/env/index.d.ts +17 -0
  32. package/lib/env/index.d.ts.map +1 -1
  33. package/lib/env/index.js +18 -1
  34. package/lib/env/index.js.map +1 -1
  35. package/lib/features/agent/PayloadBuilder.d.ts +1 -0
  36. package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
  37. package/lib/features/agent/PayloadBuilder.js +22 -5
  38. package/lib/features/agent/PayloadBuilder.js.map +1 -1
  39. package/lib/features/agent/chat/AgentRightPanel.d.ts.map +1 -1
  40. package/lib/features/agent/chat/AgentRightPanel.js +3 -135
  41. package/lib/features/agent/chat/AgentRightPanel.js.map +1 -1
  42. package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
  43. package/lib/features/agent/chat/ArtifactsTab.js +1 -1
  44. package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
  45. package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
  46. package/lib/features/agent/chat/AskUserWidget.js +19 -4
  47. package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
  48. package/lib/features/agent/chat/ModernAgentConversation.d.ts +6 -0
  49. package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  50. package/lib/features/agent/chat/ModernAgentConversation.js +99 -29
  51. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  52. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.d.ts.map +1 -1
  53. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js +10 -9
  54. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js.map +1 -1
  55. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  56. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -8
  57. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  58. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.d.ts.map +1 -1
  59. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js +45 -4
  60. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js.map +1 -1
  61. package/lib/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +1 -1
  62. package/lib/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +1 -1
  63. package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  64. package/lib/features/agent/chat/ModernAgentOutput/Header.js +3 -3
  65. package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  66. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  67. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +1 -1
  68. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  69. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +1 -1
  70. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.js +1 -1
  71. package/lib/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +1 -1
  72. package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +1 -1
  73. package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -1
  74. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -1
  75. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +9 -121
  76. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
  77. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts +6 -0
  78. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -1
  79. package/lib/features/agent/chat/ModernAgentOutput/utils.js +19 -11
  80. package/lib/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
  81. package/lib/features/agent/chat/VegaLiteChart.d.ts.map +1 -1
  82. package/lib/features/agent/chat/VegaLiteChart.js +11 -3
  83. package/lib/features/agent/chat/VegaLiteChart.js.map +1 -1
  84. package/lib/features/agent/chat/hooks/useAgentStream.d.ts.map +1 -1
  85. package/lib/features/agent/chat/hooks/useAgentStream.js +3 -0
  86. package/lib/features/agent/chat/hooks/useAgentStream.js.map +1 -1
  87. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -1
  88. package/lib/features/document-viewer/UniversalDocumentViewer.js +1 -1
  89. package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -1
  90. package/lib/features/facets/AgentRunnerFacetsNav.d.ts +14 -2
  91. package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
  92. package/lib/features/facets/AgentRunnerFacetsNav.js +20 -2
  93. package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
  94. package/lib/features/facets/CollectionsFacetsNav.d.ts +3 -3
  95. package/lib/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
  96. package/lib/features/facets/CollectionsFacetsNav.js +6 -1
  97. package/lib/features/facets/CollectionsFacetsNav.js.map +1 -1
  98. package/lib/features/facets/DocumentsFacetsNav.d.ts +3 -3
  99. package/lib/features/facets/DocumentsFacetsNav.d.ts.map +1 -1
  100. package/lib/features/facets/DocumentsFacetsNav.js +20 -8
  101. package/lib/features/facets/DocumentsFacetsNav.js.map +1 -1
  102. package/lib/features/facets/InteractionsFacetsNav.d.ts +3 -3
  103. package/lib/features/facets/InteractionsFacetsNav.d.ts.map +1 -1
  104. package/lib/features/facets/InteractionsFacetsNav.js +11 -1
  105. package/lib/features/facets/InteractionsFacetsNav.js.map +1 -1
  106. package/lib/features/facets/PromptsFacetsNav.d.ts +3 -3
  107. package/lib/features/facets/PromptsFacetsNav.d.ts.map +1 -1
  108. package/lib/features/facets/PromptsFacetsNav.js +6 -1
  109. package/lib/features/facets/PromptsFacetsNav.js.map +1 -1
  110. package/lib/features/facets/RunsFacetsNav.d.ts +4 -14
  111. package/lib/features/facets/RunsFacetsNav.d.ts.map +1 -1
  112. package/lib/features/facets/RunsFacetsNav.js +26 -15
  113. package/lib/features/facets/RunsFacetsNav.js.map +1 -1
  114. package/lib/features/facets/WorkflowExecutionsFacetsNav.d.ts +4 -3
  115. package/lib/features/facets/WorkflowExecutionsFacetsNav.d.ts.map +1 -1
  116. package/lib/features/facets/WorkflowExecutionsFacetsNav.js +18 -10
  117. package/lib/features/facets/WorkflowExecutionsFacetsNav.js.map +1 -1
  118. package/lib/features/facets/index.d.ts +1 -1
  119. package/lib/features/facets/index.d.ts.map +1 -1
  120. package/lib/features/facets/index.js.map +1 -1
  121. package/lib/features/facets/utils/SearchInterface.d.ts +4 -3
  122. package/lib/features/facets/utils/SearchInterface.d.ts.map +1 -1
  123. package/lib/features/facets/utils/SearchInterface.js +4 -0
  124. package/lib/features/facets/utils/SearchInterface.js.map +1 -1
  125. package/lib/features/layout/GenericPageNavHeader.d.ts +8 -1
  126. package/lib/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  127. package/lib/features/layout/GenericPageNavHeader.js +9 -1
  128. package/lib/features/layout/GenericPageNavHeader.js.map +1 -1
  129. package/lib/features/magic-pdf/DownloadPopover.d.ts +3 -2
  130. package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
  131. package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
  132. package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -1
  133. package/lib/features/magic-pdf/GroundedExtractionView.js +51 -64
  134. package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -1
  135. package/lib/features/oauth/McpConnectionsButton.d.ts +1 -1
  136. package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
  137. package/lib/features/oauth/McpConnectionsButton.js +2 -2
  138. package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
  139. package/lib/features/oauth/McpConnectionsDialog.d.ts +1 -1
  140. package/lib/features/oauth/McpConnectionsDialog.js +2 -2
  141. package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
  142. package/lib/features/oauth/useMcpConnections.d.ts +4 -5
  143. package/lib/features/oauth/useMcpConnections.d.ts.map +1 -1
  144. package/lib/features/oauth/useMcpConnections.js +20 -4
  145. package/lib/features/oauth/useMcpConnections.js.map +1 -1
  146. package/lib/features/pdf-viewer/PdfPageRenderer.d.ts.map +1 -1
  147. package/lib/features/pdf-viewer/PdfPageRenderer.js +9 -11
  148. package/lib/features/pdf-viewer/PdfPageRenderer.js.map +1 -1
  149. package/lib/features/pdf-viewer/lazyReactPdf.d.ts +10 -0
  150. package/lib/features/pdf-viewer/lazyReactPdf.d.ts.map +1 -0
  151. package/lib/features/pdf-viewer/lazyReactPdf.js +25 -0
  152. package/lib/features/pdf-viewer/lazyReactPdf.js.map +1 -0
  153. package/lib/features/store/collections/CollectionsTable.d.ts.map +1 -1
  154. package/lib/features/store/collections/CollectionsTable.js +1 -3
  155. package/lib/features/store/collections/CollectionsTable.js.map +1 -1
  156. package/lib/features/store/collections/EditCollectionView.js +1 -1
  157. package/lib/features/store/collections/EditCollectionView.js.map +1 -1
  158. package/lib/features/store/objects/ExportPropertiesModal.d.ts +3 -1
  159. package/lib/features/store/objects/ExportPropertiesModal.d.ts.map +1 -1
  160. package/lib/features/store/objects/ExportPropertiesModal.js +5 -5
  161. package/lib/features/store/objects/ExportPropertiesModal.js.map +1 -1
  162. package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  163. package/lib/features/store/objects/components/ContentOverview.js +4 -10
  164. package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
  165. package/lib/features/store/objects/components/TextEditorPanel.d.ts.map +1 -1
  166. package/lib/features/store/objects/components/TextEditorPanel.js +8 -3
  167. package/lib/features/store/objects/components/TextEditorPanel.js.map +1 -1
  168. package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
  169. package/lib/features/store/objects/layout/renderers.js +1 -5
  170. package/lib/features/store/objects/layout/renderers.js.map +1 -1
  171. package/lib/features/store/objects/search/DocumentSearchContext.d.ts +29 -62
  172. package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
  173. package/lib/features/store/objects/search/DocumentSearchContext.js +2 -0
  174. package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  175. package/lib/features/store/objects/upload/DocumentUploadModal.d.ts +6 -1
  176. package/lib/features/store/objects/upload/DocumentUploadModal.d.ts.map +1 -1
  177. package/lib/features/store/objects/upload/DocumentUploadModal.js +4 -3
  178. package/lib/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
  179. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
  180. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.js +2 -2
  181. package/lib/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
  182. package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
  183. package/lib/features/store/types/ContentObjectTypesTable.js +1 -3
  184. package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
  185. package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
  186. package/lib/features/store/types/IntakePolicyEditor.js +11 -1
  187. package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
  188. package/lib/features/store/types/ObjectSchemaEditor.d.ts.map +1 -1
  189. package/lib/features/store/types/ObjectSchemaEditor.js +6 -2
  190. package/lib/features/store/types/ObjectSchemaEditor.js.map +1 -1
  191. package/lib/features/store/types/TableLayoutEditor.d.ts.map +1 -1
  192. package/lib/features/store/types/TableLayoutEditor.js +2 -0
  193. package/lib/features/store/types/TableLayoutEditor.js.map +1 -1
  194. package/lib/features/store/types/TypeRegistry.d.ts +332 -0
  195. package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
  196. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +331 -0
  197. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
  198. package/lib/features/user/UserInfo.d.ts.map +1 -1
  199. package/lib/features/user/UserInfo.js +2 -4
  200. package/lib/features/user/UserInfo.js.map +1 -1
  201. package/lib/features/views/ViewActions.d.ts +32 -0
  202. package/lib/features/views/ViewActions.d.ts.map +1 -0
  203. package/lib/features/views/ViewActions.js +186 -0
  204. package/lib/features/views/ViewActions.js.map +1 -0
  205. package/lib/features/views/ViewDropTarget.d.ts +15 -0
  206. package/lib/features/views/ViewDropTarget.d.ts.map +1 -0
  207. package/lib/features/views/ViewDropTarget.js +79 -0
  208. package/lib/features/views/ViewDropTarget.js.map +1 -0
  209. package/lib/features/views/ViewExperience.d.ts +3 -2
  210. package/lib/features/views/ViewExperience.d.ts.map +1 -1
  211. package/lib/features/views/ViewExperience.js +103 -12
  212. package/lib/features/views/ViewExperience.js.map +1 -1
  213. package/lib/features/views/ViewNavigation.d.ts +1 -1
  214. package/lib/features/views/ViewNavigation.d.ts.map +1 -1
  215. package/lib/features/views/ViewNavigation.js +14 -5
  216. package/lib/features/views/ViewNavigation.js.map +1 -1
  217. package/lib/features/views/ViewResults.d.ts +1 -1
  218. package/lib/features/views/ViewResults.d.ts.map +1 -1
  219. package/lib/features/views/ViewResults.js +124 -34
  220. package/lib/features/views/ViewResults.js.map +1 -1
  221. package/lib/features/views/index.d.ts +1 -0
  222. package/lib/features/views/index.d.ts.map +1 -1
  223. package/lib/features/views/index.js +1 -0
  224. package/lib/features/views/index.js.map +1 -1
  225. package/lib/features/views/types.d.ts +46 -1
  226. package/lib/features/views/types.d.ts.map +1 -1
  227. package/lib/features/views/viewState.d.ts.map +1 -1
  228. package/lib/features/views/viewState.js +34 -0
  229. package/lib/features/views/viewState.js.map +1 -1
  230. package/lib/i18n/LanguageProvider.d.ts +3 -1
  231. package/lib/i18n/LanguageProvider.d.ts.map +1 -1
  232. package/lib/i18n/LanguageProvider.js +9 -7
  233. package/lib/i18n/LanguageProvider.js.map +1 -1
  234. package/lib/i18n/instance.d.ts +2 -0
  235. package/lib/i18n/instance.d.ts.map +1 -1
  236. package/lib/i18n/instance.js +45 -26
  237. package/lib/i18n/instance.js.map +1 -1
  238. package/lib/i18n/locales/ar.json +261 -15
  239. package/lib/i18n/locales/de.json +259 -13
  240. package/lib/i18n/locales/en.json +30 -4
  241. package/lib/i18n/locales/es.json +260 -14
  242. package/lib/i18n/locales/fr.json +259 -13
  243. package/lib/i18n/locales/it.json +259 -13
  244. package/lib/i18n/locales/ja.json +257 -10
  245. package/lib/i18n/locales/ko.json +257 -10
  246. package/lib/i18n/locales/pt.json +259 -13
  247. package/lib/i18n/locales/ru.json +256 -10
  248. package/lib/i18n/locales/tr.json +256 -10
  249. package/lib/i18n/locales/zh-TW.json +257 -10
  250. package/lib/i18n/locales/zh.json +257 -10
  251. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  252. package/lib/session/UserSessionProvider.js +8 -16
  253. package/lib/session/UserSessionProvider.js.map +1 -1
  254. package/lib/session/auth/composable.d.ts.map +1 -1
  255. package/lib/session/auth/composable.js +25 -19
  256. package/lib/session/auth/composable.js.map +1 -1
  257. package/lib/session/auth/firebase.js +1 -1
  258. package/lib/session/auth/firebase.js.map +1 -1
  259. package/lib/shell/VertesiaShell.d.ts.map +1 -1
  260. package/lib/shell/VertesiaShell.js +2 -1
  261. package/lib/shell/VertesiaShell.js.map +1 -1
  262. package/lib/shell/apps/AppInstallationProvider.d.ts +4 -2
  263. package/lib/shell/apps/AppInstallationProvider.d.ts.map +1 -1
  264. package/lib/shell/apps/IframeAppContextSync.d.ts +3 -0
  265. package/lib/shell/apps/IframeAppContextSync.d.ts.map +1 -0
  266. package/lib/shell/apps/IframeAppContextSync.js +95 -0
  267. package/lib/shell/apps/IframeAppContextSync.js.map +1 -0
  268. package/lib/shell/apps/iframe-auth.d.ts +55 -0
  269. package/lib/shell/apps/iframe-auth.d.ts.map +1 -0
  270. package/lib/shell/apps/iframe-auth.js +154 -0
  271. package/lib/shell/apps/iframe-auth.js.map +1 -0
  272. package/lib/shell/apps/index.d.ts +2 -0
  273. package/lib/shell/apps/index.d.ts.map +1 -1
  274. package/lib/shell/apps/index.js +2 -0
  275. package/lib/shell/apps/index.js.map +1 -1
  276. package/lib/vertesia-ui-core.js +4 -4
  277. package/lib/vertesia-ui-core.js.map +1 -1
  278. package/lib/vertesia-ui-env.js +1 -1
  279. package/lib/vertesia-ui-env.js.map +1 -1
  280. package/lib/vertesia-ui-features.js +32 -34
  281. package/lib/vertesia-ui-features.js.map +1 -1
  282. package/lib/vertesia-ui-i18n.js +16 -16
  283. package/lib/vertesia-ui-i18n.js.map +1 -1
  284. package/lib/vertesia-ui-rich-text.js +4 -4
  285. package/lib/vertesia-ui-rich-text.js.map +1 -1
  286. package/lib/vertesia-ui-router.js +1 -1
  287. package/lib/vertesia-ui-router.js.map +1 -1
  288. package/lib/vertesia-ui-session.js +1 -1
  289. package/lib/vertesia-ui-session.js.map +1 -1
  290. package/lib/vertesia-ui-shell.js +1 -1
  291. package/lib/vertesia-ui-shell.js.map +1 -1
  292. package/lib/vertesia-ui-widgets.js +20 -20
  293. package/lib/vertesia-ui-widgets.js.map +1 -1
  294. package/lib/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
  295. package/lib/widgets/markdown/MarkdownRenderer.js +43 -2
  296. package/lib/widgets/markdown/MarkdownRenderer.js.map +1 -1
  297. package/lib/widgets/markdown/MermaidDiagram.d.ts.map +1 -1
  298. package/lib/widgets/markdown/MermaidDiagram.js +35 -22
  299. package/lib/widgets/markdown/MermaidDiagram.js.map +1 -1
  300. package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
  301. package/lib/widgets/monacoEditor/MonacoEditor.js +14 -10
  302. package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
  303. package/lib/widgets/xml-viewer/hooks/useCollapsible.d.ts +1 -1
  304. package/package.json +25 -30
  305. package/src/core/components/shadcn/filters/comboBox/DateCombobox.tsx +1 -1
  306. package/src/core/components/shadcn/filters/filter/dateFilter.tsx +1 -1
  307. package/src/core/components/shadcn/filters/filters.tsx +1 -1
  308. package/src/core/components/shadcn/index.ts +1 -0
  309. package/src/core/components/shadcn/modal/dialog.test.tsx +35 -0
  310. package/src/core/components/shadcn/modal/dialog.tsx +0 -4
  311. package/src/core/components/shadcn/overflowTabs.tsx +320 -0
  312. package/src/core/components/shadcn/selectBox.tsx +2 -2
  313. package/src/core/components/shadcn/theme/ThemeProvider.tsx +10 -9
  314. package/src/core/utils/dayjs.ts +17 -0
  315. package/src/css/base.css +78 -0
  316. package/src/env/index.test.ts +94 -0
  317. package/src/env/index.ts +36 -1
  318. package/src/features/agent/PayloadBuilder.test.ts +68 -0
  319. package/src/features/agent/PayloadBuilder.tsx +28 -4
  320. package/src/features/agent/chat/AgentRightPanel.tsx +2 -252
  321. package/src/features/agent/chat/ArtifactsTab.tsx +1 -0
  322. package/src/features/agent/chat/AskUserWidget.test.tsx +20 -1
  323. package/src/features/agent/chat/AskUserWidget.tsx +22 -6
  324. package/src/features/agent/chat/ModernAgentConversation.test.tsx +160 -0
  325. package/src/features/agent/chat/ModernAgentConversation.tsx +111 -31
  326. package/src/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.tsx +86 -67
  327. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +90 -7
  328. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +4 -6
  329. package/src/features/agent/chat/ModernAgentOutput/AttachmentPreview.test.ts +103 -1
  330. package/src/features/agent/chat/ModernAgentOutput/AttachmentPreview.tsx +50 -4
  331. package/src/features/agent/chat/ModernAgentOutput/BatchProgressPanel.tsx +1 -1
  332. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +18 -1
  333. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +1 -1
  334. package/src/features/agent/chat/ModernAgentOutput/StreamingMessage.tsx +1 -1
  335. package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +1 -1
  336. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +37 -167
  337. package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +94 -0
  338. package/src/features/agent/chat/ModernAgentOutput/utils.ts +19 -10
  339. package/src/features/agent/chat/VegaLiteChart.tsx +32 -14
  340. package/src/features/agent/chat/hooks/useAgentStream.test.tsx +18 -0
  341. package/src/features/agent/chat/hooks/useAgentStream.ts +3 -0
  342. package/src/features/document-viewer/UniversalDocumentViewer.tsx +1 -1
  343. package/src/features/facets/AgentRunnerFacetsNav.tsx +44 -4
  344. package/src/features/facets/CollectionsFacetsNav.tsx +15 -4
  345. package/src/features/facets/DocumentsFacetsNav.tsx +25 -8
  346. package/src/features/facets/FacetQueryHandlers.test.ts +84 -0
  347. package/src/features/facets/InteractionsFacetsNav.tsx +20 -4
  348. package/src/features/facets/PromptsFacetsNav.tsx +15 -4
  349. package/src/features/facets/RunsFacetsNav.test.ts +59 -0
  350. package/src/features/facets/RunsFacetsNav.tsx +40 -30
  351. package/src/features/facets/WorkflowExecutionsFacetsNav.test.ts +57 -0
  352. package/src/features/facets/WorkflowExecutionsFacetsNav.tsx +36 -16
  353. package/src/features/facets/index.ts +1 -0
  354. package/src/features/facets/utils/SearchInterface.tsx +12 -3
  355. package/src/features/layout/GenericPageNavHeader.tsx +16 -0
  356. package/src/features/magic-pdf/DownloadPopover.tsx +1 -2
  357. package/src/features/magic-pdf/GroundedExtractionView.test.tsx +7 -1
  358. package/src/features/magic-pdf/GroundedExtractionView.tsx +162 -242
  359. package/src/features/oauth/McpConnectionsButton.test.tsx +18 -1
  360. package/src/features/oauth/McpConnectionsButton.tsx +6 -2
  361. package/src/features/oauth/McpConnectionsDialog.tsx +3 -3
  362. package/src/features/oauth/useMcpConnections.test.ts +1 -0
  363. package/src/features/oauth/useMcpConnections.ts +24 -7
  364. package/src/features/pdf-viewer/PdfPageRenderer.tsx +76 -71
  365. package/src/features/pdf-viewer/lazyReactPdf.ts +33 -0
  366. package/src/features/store/collections/CollectionsTable.tsx +1 -4
  367. package/src/features/store/collections/EditCollectionView.tsx +1 -1
  368. package/src/features/store/objects/ExportPropertiesModal.tsx +25 -16
  369. package/src/features/store/objects/components/ContentOverview.tsx +2 -28
  370. package/src/features/store/objects/components/TextEditorPanel.tsx +13 -3
  371. package/src/features/store/objects/layout/renderers.tsx +1 -6
  372. package/src/features/store/objects/search/DocumentSearchContext.ts +4 -2
  373. package/src/features/store/objects/upload/DocumentUploadModal.tsx +10 -3
  374. package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +15 -6
  375. package/src/features/store/types/ContentObjectTypesTable.tsx +1 -4
  376. package/src/features/store/types/IntakePolicyEditor.tsx +11 -1
  377. package/src/features/store/types/ObjectSchemaEditor.tsx +6 -2
  378. package/src/features/store/types/TableLayoutEditor.tsx +2 -0
  379. package/src/features/user/UserInfo.test.tsx +10 -0
  380. package/src/features/user/UserInfo.tsx +2 -7
  381. package/src/features/views/ViewActions.test.tsx +80 -0
  382. package/src/features/views/ViewActions.tsx +352 -0
  383. package/src/features/views/ViewDropTarget.test.tsx +150 -0
  384. package/src/features/views/ViewDropTarget.tsx +140 -0
  385. package/src/features/views/ViewExperience.test.tsx +72 -0
  386. package/src/features/views/ViewExperience.tsx +189 -22
  387. package/src/features/views/ViewMedia.test.tsx +180 -0
  388. package/src/features/views/ViewNavigation.test.tsx +42 -0
  389. package/src/features/views/ViewNavigation.tsx +43 -5
  390. package/src/features/views/ViewResults.tsx +243 -26
  391. package/src/features/views/index.ts +1 -0
  392. package/src/features/views/types.ts +50 -0
  393. package/src/features/views/viewState.test.ts +7 -1
  394. package/src/features/views/viewState.ts +32 -0
  395. package/src/i18n/LanguageProvider.tsx +15 -8
  396. package/src/i18n/instance.test.ts +30 -0
  397. package/src/i18n/instance.ts +67 -40
  398. package/src/i18n/locales/ar.json +1157 -911
  399. package/src/i18n/locales/de.json +1113 -867
  400. package/src/i18n/locales/en.json +30 -4
  401. package/src/i18n/locales/es.json +1124 -878
  402. package/src/i18n/locales/fr.json +1124 -878
  403. package/src/i18n/locales/it.json +1124 -878
  404. package/src/i18n/locales/ja.json +1113 -866
  405. package/src/i18n/locales/ko.json +1113 -866
  406. package/src/i18n/locales/pt.json +1124 -878
  407. package/src/i18n/locales/ru.json +1135 -889
  408. package/src/i18n/locales/tr.json +1113 -867
  409. package/src/i18n/locales/zh-TW.json +1113 -866
  410. package/src/i18n/locales/zh.json +1113 -866
  411. package/src/i18n/rtl.test.ts +16 -7
  412. package/src/rich-text/VertesiaRichTextEditor.test.tsx +33 -1
  413. package/src/session/UserSessionProvider.tsx +8 -20
  414. package/src/session/auth/composable.scope.test.ts +1 -1
  415. package/src/session/auth/composable.test.ts +61 -1
  416. package/src/session/auth/composable.ts +29 -23
  417. package/src/session/auth/firebase.ts +1 -1
  418. package/src/shell/VertesiaShell.tsx +2 -0
  419. package/src/shell/apps/IframeAppContextSync.test.tsx +196 -0
  420. package/src/shell/apps/IframeAppContextSync.tsx +101 -0
  421. package/src/shell/apps/iframe-auth.test.ts +118 -0
  422. package/src/shell/apps/iframe-auth.ts +193 -0
  423. package/src/shell/apps/index.ts +2 -0
  424. package/src/widgets/markdown/ArtifactEditingSurface.test.tsx +12 -3
  425. package/src/widgets/markdown/MarkdownRenderer.tsx +50 -2
  426. package/src/widgets/markdown/MermaidDiagram.tsx +38 -22
  427. package/src/widgets/monacoEditor/MonacoEditor.tsx +27 -20
  428. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +0 -25
  429. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +0 -1
  430. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +0 -42
  431. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +0 -1
  432. package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +0 -86
@@ -1,4 +1,4 @@
1
- import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as ce,useContext as P,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import W from"dayjs";import Se from"react-calendar";import*as G from"@radix-ui/react-popover";import{isEqual as Ce}from"lodash-es";import*as we from"@radix-ui/react-label";import*as Te from"@radix-ui/react-radio-group";import*as Ee from"react-resizable-panels";import*as De from"@radix-ui/react-separator";import*as Oe from"@radix-ui/react-slider";import*as ke from"@radix-ui/react-switch";import*as K from"@radix-ui/react-tabs";function Ae(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function je({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Ae(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Me({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`;return t(`span`,{className:`inline-block ${Ae(e||`md`)} overflow-hidden ${o} ${r} ${i}`,children:a})}function Ne({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Pe(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function Fe(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Ie=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap;break}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top);break}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=Fe(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Pe(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Le(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function ze(e,t,n,r){let i=new Ie(e.gap),a=i.computePosition(e,t,n),o=Re(a.rect,r,`x`),s=Re(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Ie(i.gap).computePosition(c,t,n),Le(a.rect,r)?a:null):null}function Be(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ve(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Be(e[n].getBoundingClientRect(),t),!t)return null;return t}function He(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function Ue(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)He(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var We=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=Ue(this.anchor,this.root),this.visibleClientRect=Ve(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=ze(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ge=ae(void 0);function Ke(){let e=P(Ge);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function qe({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new We({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ge.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Je({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(qe,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function Ye(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var Xe=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},Ze=class e extends Xe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},Qe=class e extends Ze{createItem(e){return e}static instance=new e};function $e(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:tt,Menu:rt,Toggle:nt}}function et({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L(Ye()),b=I(void 0),x=I(null),S=f?Object.assign($e(u,l),f):$e(u,l),C=N.useRef(null),w=it({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Je,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function tt({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function nt({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function rt({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function it(e){let[t,n]=L(new at(e));return F(()=>{t?.withState(n)},[t]),t}var at=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,e?this._filteredItems=this.adapter.filter(this.items,e):this._filteredItems=this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ot(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:st(this.highlightedIndex,e.length),!0)}}}};function ot(e,t){return(e+1)%t}function st(e,t){return(e-1+t)%t}function ct({options:e,creatable:n,...r}){return t(et,{adapter:n?Qe.instance:Ze.instance,items:e,...r})}function lt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function q(...e){return ge(i(e))}const ut=N.createContext(void 0);function dt(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function ft({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(ut),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){let t=dt(e,n);o(t)}else o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(ut.Provider,{value:a||void 0,children:e})}function pt(){return N.useContext(ut)}const mt=B.Provider,ht=B.Root,gt=B.Trigger,_t=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=pt();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:q(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});_t.displayName=B.Content.displayName;function vt({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(mt,{delayDuration:0,children:n(ht,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(gt,{className:`cursor-pointer`,asChild:s,children:r}),t(_t,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const yt=new Set;function bt(e,t,n){F(()=>{t&&!yt.has(e)&&(yt.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}function xt(e){return M.Children.toArray(e).some(e=>{if(typeof e==`string`)return e.trim().length>0;if(typeof e==`number`)return!0;if(M.isValidElement(e)){let t=e.props;return t[`aria-hidden`]===!0||t[`aria-hidden`]===`true`?!1:xt(t.children)}return!1})}const St=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),J=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,tooltipPlacement:f=`top`,onClick:p,type:m,...h},g)=>{bt(`Button.alt`,c!==void 0,"use `title` instead — it drives the same tooltip and the accessible name. `alt` remains an alias for one release.");let _=s?pe:`button`,v=s?m:m??`button`,y=d??c,b=h[`aria-label`]??c??(xt(h.children)?void 0:d),S=s?h.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),h.children]}),C=t(_,{className:r(q(St({variant:a,size:o})),i),disabled:l||u||h.disabled,ref:g,onClick:p,type:v,autoFocus:!1,...h,"aria-label":b,children:S});return y?t(vt,{description:y,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:f,children:C}):C});J.displayName=`Button`;const Ct=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();bt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(J,{ref:l,className:q(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});Ct.displayName=`CopyButton`;function wt({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(J,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function Tt(e){return e.isFile}function Et(e){return e.isDirectory}function Dt(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Ot({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(Dt(i.current.files))}})]})}function kt({onUpload:e}){return t(`div`,{...Nt({onUpload:e}),className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function At(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function jt(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function Mt(e){e&&delete e.__dragOver_cnt__}function Nt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),Mt(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(Tt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(Et(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{At(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{jt(r.current)&&r.current?.classList.remove(t)},ref:r}}function Pt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function Ft(){try{return _e.isDev}catch{return!1}}function It({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Pt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else Ft()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(vt,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function Lt(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Rt=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function zt({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:Lt(i)}:{};return t(`span`,{className:q(Rt({variant:n}),e),...o,...a,children:r})}const Bt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Vt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Ht({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:q(Bt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:q(Vt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function Ut({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(vt,{description:`click to remove`,children:t(zt,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Wt({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Gt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Gt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Kt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,qt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Kt,INPUT:`${Kt} py-1.5`};function Jt(e){return e==null||Number.isNaN(e)?``:e.toString()}const Yt=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(Jt(e));return F(()=>{if(e==null||!Number.isNaN(e)){let t=Jt(e);u(t)}},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,qt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function Xt({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=Zt(o),b=Qt(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(J,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(J,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function Zt(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function Qt(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const $t=`--tailwind-portal`;function en({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById($t);t||(t=e.createElement(`DIV`),t.id=$t,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function tn({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(sn,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(sn,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(cn,{children:n})};if(o.length<=r)return t(nn,{className:q(`w-full flex items-center`,i),children:t(rn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(an,{children:s(e)}),r<o.length-1&&t(ln,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(nn,{className:q(`w-full flex items-center`,i),children:n(rn,{children:[t(an,{children:t(un,{})}),t(ln,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(an,{children:s(e)}),r<c.length-1&&t(ln,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const nn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));nn.displayName=`Breadcrumb`;const rn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:q(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));rn.displayName=`BreadcrumbList`;const an=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:q(`inline-flex items-center gap-1.5 text-muted`,e),...n}));an.displayName=`BreadcrumbItem`;const on=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:q(`transition-colors hover:text-muted`,n),...r}));on.displayName=`BreadcrumbLink`;const sn=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(J,{variant:`ghost`,size:`md`,ref:a,className:q(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));sn.displayName=`BreadcrumbButton`;const cn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...n}));cn.displayName=`BreadcrumbPage`;const ln=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});ln.displayName=`BreadcrumbSeparator`;const un=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:q(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});un.displayName=`BreadcrumbEllipsis`;const dn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));dn.displayName=`Card`;const fn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex flex-col p-6`,e),...n}));fn.displayName=`CardHeader`;const pn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`font-semibold leading-none tracking-tight`,e),...n}));pn.displayName=`CardTitle`;const mn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`text-sm text-muted-foreground`,e),...n}));mn.displayName=`CardDescription`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`p-6 pt-0`,e),...n}));hn.displayName=`CardContent`;const gn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex items-center p-6 pt-0`,e),...n}));gn.displayName=`CardFooter`;const _n=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:q(`peer size-4 shrink-0 rounded-sm border border-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-white`,e),...n,children:t(be.Indicator,{className:q(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));_n.displayName=be.Root.displayName;function vn({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function yn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function bn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function xn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const Sn=ae(!1);function Cn(){return!!P(Sn)}function wn({children:e}){return t(Sn.Provider,{value:!0,children:e})}function Tn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;case`full`:return`h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(kn,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Nn,{className:`z-50 fixed inset-0 bg-black/80`}),t(xn,{children:t(Fn,{children:o})}),n(Pn,{className:q(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(Mn,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(J,{variant:`outline`,title:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(wn,{children:r})]})]})}const En=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(In,{className:q(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(Fn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(xn,{children:[t(In,{children:e}),a&&t(Fn,{children:a})]}),Dn=({children:e,className:n,...r})=>t(`div`,{className:q(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),On=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:q(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),kn=H.Root,An=H.Trigger,jn=H.Portal,Mn=H.Close,Nn=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:q(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Nn.displayName=H.Overlay.displayName;const Pn=M.forwardRef(({className:e,children:r,...i},a)=>{let o=pt();return n(jn,{container:o,children:[t(Nn,{}),t(H.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:q(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]})});Pn.displayName=H.Content.displayName;const Fn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:q(`text-sm text-muted`,e),...n}));Fn.displayName=H.Description.displayName;const In=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...n}));In.displayName=H.Title.displayName;const Ln=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));Ln.displayName=V.displayName;const Rn=({children:e,...n})=>t(kn,{...n,children:t(Pn,{className:`shadow-lg p-0 overflow-hidden`,children:t(Ln,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),zn=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:q(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));zn.displayName=V.Input.displayName;const Bn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:q(`overflow-y-auto overflow-x-hidden`,e),...n}));Bn.displayName=V.List.displayName;const Vn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Vn.displayName=V.Empty.displayName;const Y=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:q(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));Y.displayName=V.Group.displayName;const Hn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:q(`-mx-1 h-px bg-border`,e),...n}));Hn.displayName=V.Separator.displayName;const X=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:q(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));X.displayName=V.Item.displayName;const Un=({className:e,...n})=>t(`span`,{className:q(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});Un.displayName=`CommandShortcut`;const Wn=M.createContext(!1);function Gn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Kn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function qn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function Jn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function Yn({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function Xn({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:q(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function Zn({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function Qn({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function $n({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function er({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:q(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function tr({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`bg-border -mx-1 my-1 h-px`,e),...n})}function nr({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function rr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function ir({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:q(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function ar({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const or={left:`start`,center:`center`,right:`end`};function sr({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:q(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Wn.Provider,{value:!0,children:r})})})]}):n(Gn,{children:[t(qn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(Jn,{align:or[i],className:`w-max`,children:r})]})}function cr({children:e,label:r}){return n(Yn,{children:[r&&t(er,{children:r}),e]})}function lr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Wn),c=q(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(Xn,{className:q(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const ur=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:q(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})},dr=M.createContext(null),Z=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(dr.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(G.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function fr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Q=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(dr);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(G.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>fr(o,a,`enter`),onMouseLeave:()=>fr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Q.displayName=G.Trigger.displayName;const pr=G.Anchor,$=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(dr);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=pt();return t(G.Portal,{container:l,children:t(G.Content,{ref:a,align:n,side:r,onMouseEnter:()=>fr(c,s,`enter`),onMouseLeave:()=>fr(c,s,`leave`),className:q(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});$.displayName=G.Content.displayName;const mr=G.Close;mr.displayName=G.Close.displayName;function hr(){let e=M.useContext(dr);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const gr=`
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as P,useContext as ce,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import Se from"react-calendar";import Ce from"dayjs";import we from"dayjs/plugin/localizedFormat";import Te from"dayjs/plugin/relativeTime";import*as W from"@radix-ui/react-popover";import{isEqual as Ee}from"lodash-es";import*as De from"@radix-ui/react-label";import*as Oe from"@radix-ui/react-radio-group";import*as ke from"react-resizable-panels";import*as Ae from"@radix-ui/react-separator";import*as je from"@radix-ui/react-slider";import*as Me from"@radix-ui/react-switch";import*as Ne from"@radix-ui/react-tabs";function Pe(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function Fe({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Pe(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Ie({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`,s=Pe(e||`md`);return t(`span`,{className:`inline-block ${s} overflow-hidden ${o} ${r} ${i}`,children:a})}function Le({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Re(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function ze(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Be=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top)}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=ze(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Re(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Ve(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function He(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function Ue(e,t,n,r){let i=new Be(e.gap),a=i.computePosition(e,t,n),o=He(a.rect,r,`x`),s=He(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Be(i.gap).computePosition(c,t,n),Ve(a.rect,r)?a:null):null}function We(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ge(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=We(e[n].getBoundingClientRect(),t),!t)return null;return t}function Ke(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function qe(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)Ke(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var Je=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=qe(this.anchor,this.root),this.visibleClientRect=Ge(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=Ue(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ye=ae(void 0);function Xe(){let e=ce(Ye);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function Ze({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new Je({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ye.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Qe({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(Ze,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function $e(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var et=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},tt=class e extends et{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},nt=class e extends tt{createItem(e){return e}static instance=new e};function rt(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:at,Menu:st,Toggle:ot}}function it({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L($e()),b=I(void 0),x=I(null),S=f?Object.assign(rt(u,l),f):rt(u,l),C=N.useRef(null),w=ct({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Qe,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function at({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function ot({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function st({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function ct(e){let[t,n]=L(new lt(e));return F(()=>{t?.withState(n)},[t]),t}var lt=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,this._filteredItems=e?this.adapter.filter(this.items,e):this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ut(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:dt(this.highlightedIndex,e.length),!0)}}}};function ut(e,t){return(e+1)%t}function dt(e,t){return(e-1+t)%t}function ft({options:e,creatable:n,...r}){let i=n?nt.instance:tt.instance;return t(it,{adapter:i,items:e,...r})}function pt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function G(...e){return ge(i(e))}const mt=N.createContext(void 0);function ht(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function gt({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(mt),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){let t=ht(e,n);o(t)}else o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(mt.Provider,{value:a||void 0,children:e})}function _t(){return N.useContext(mt)}const vt=B.Provider,yt=B.Root,bt=B.Trigger,xt=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=_t();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:G(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});xt.displayName=B.Content.displayName;function St({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(vt,{delayDuration:0,children:n(yt,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(bt,{className:`cursor-pointer`,asChild:s,children:r}),t(xt,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const Ct=new Set;function wt(e,t,n){F(()=>{t&&!Ct.has(e)&&(Ct.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}function Tt(e){return M.Children.toArray(e).some(e=>{if(typeof e==`string`)return e.trim().length>0;if(typeof e==`number`)return!0;if(M.isValidElement(e)){let t=e.props;return t[`aria-hidden`]===!0||t[`aria-hidden`]===`true`?!1:Tt(t.children)}return!1})}const Et=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),K=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,tooltipPlacement:f=`top`,onClick:p,type:m,...h},g)=>{wt(`Button.alt`,c!==void 0,"use `title` instead — it drives the same tooltip and the accessible name. `alt` remains an alias for one release.");let _=s?pe:`button`,v=s?m:m??`button`,y=d??c,b=h[`aria-label`]??c??(Tt(h.children)?void 0:d),S=s?h.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),h.children]}),C=t(_,{className:r(G(Et({variant:a,size:o})),i),disabled:l||u||h.disabled,ref:g,onClick:p,type:v,autoFocus:!1,...h,"aria-label":b,children:S});return y?t(St,{description:y,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:f,children:C}):C});K.displayName=`Button`;const Dt=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();wt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(K,{ref:l,className:G(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});Dt.displayName=`CopyButton`;function Ot({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(K,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function kt(e){return e.isFile}function At(e){return e.isDirectory}function jt(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Mt({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(jt(i.current.files))}})]})}function Nt({onUpload:e}){let r=Lt({onUpload:e});return t(`div`,{...r,className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function Pt(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function Ft(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function It(e){e&&delete e.__dragOver_cnt__}function Lt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),It(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(kt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(At(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{Pt(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{Ft(r.current)&&r.current?.classList.remove(t)},ref:r}}function Rt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function zt(){try{return _e.isDev}catch{return!1}}function Bt({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Rt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else zt()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(St,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function Vt(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Ht=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function Ut({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:Vt(i)}:{};return t(`span`,{className:G(Ht({variant:n}),e),...o,...a,children:r})}const Wt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Gt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Kt({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:G(Wt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:G(Gt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function qt({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(St,{description:`click to remove`,children:t(Ut,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Jt({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Yt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Yt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Xt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,Zt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Xt,INPUT:`${Xt} py-1.5`};function Qt(e){return e==null||Number.isNaN(e)?``:e.toString()}const $t=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(Qt(e));return F(()=>{if(e==null||!Number.isNaN(e)){let t=Qt(e);u(t)}},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,Zt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function en({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=tn(o),b=nn(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(K,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(K,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function tn(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function nn(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const rn=`--tailwind-portal`;function an({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById(rn);t||(t=e.createElement(`DIV`),t.id=rn,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function on({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(dn,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(dn,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(fn,{children:n})};if(o.length<=r)return t(sn,{className:G(`w-full flex items-center`,i),children:t(cn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(ln,{children:s(e)}),r<o.length-1&&t(pn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(sn,{className:G(`w-full flex items-center`,i),children:n(cn,{children:[t(ln,{children:t(mn,{})}),t(pn,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(ln,{children:s(e)}),r<c.length-1&&t(pn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const sn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));sn.displayName=`Breadcrumb`;const cn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:G(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));cn.displayName=`BreadcrumbList`;const ln=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:G(`inline-flex items-center gap-1.5 text-muted`,e),...n}));ln.displayName=`BreadcrumbItem`;const un=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:G(`transition-colors hover:text-muted`,n),...r}));un.displayName=`BreadcrumbLink`;const dn=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(K,{variant:`ghost`,size:`md`,ref:a,className:G(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));dn.displayName=`BreadcrumbButton`;const fn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:G(`font-normal text-foreground`,e),...n}));fn.displayName=`BreadcrumbPage`;const pn=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:G(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});pn.displayName=`BreadcrumbSeparator`;const mn=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:G(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});mn.displayName=`BreadcrumbEllipsis`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));hn.displayName=`Card`;const gn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`flex flex-col p-6`,e),...n}));gn.displayName=`CardHeader`;const _n=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`font-semibold leading-none tracking-tight`,e),...n}));_n.displayName=`CardTitle`;const vn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`text-sm text-muted-foreground`,e),...n}));vn.displayName=`CardDescription`;const yn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`p-6 pt-0`,e),...n}));yn.displayName=`CardContent`;const bn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:G(`flex items-center p-6 pt-0`,e),...n}));bn.displayName=`CardFooter`;const xn=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:G(`peer size-4 shrink-0 rounded-sm border border-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-white`,e),...n,children:t(be.Indicator,{className:G(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));xn.displayName=be.Root.displayName;function Sn({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function Cn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function wn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function Tn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const En=ae(!1);function Dn(){return!!ce(En)}function On({children:e}){return t(En.Provider,{value:!0,children:e})}function kn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;case`full`:return`h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(Nn,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Ln,{className:`z-50 fixed inset-0 bg-black/80`}),t(Tn,{children:t(zn,{children:o})}),n(Rn,{className:G(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(In,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(K,{variant:`outline`,title:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(On,{children:r})]})]})}const An=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(Bn,{className:G(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(zn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(Tn,{children:[t(Bn,{children:e}),a&&t(zn,{children:a})]}),jn=({children:e,className:n,...r})=>t(`div`,{className:G(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),Mn=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:G(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),Nn=H.Root,Pn=H.Trigger,Fn=H.Portal,In=H.Close,Ln=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:G(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Ln.displayName=H.Overlay.displayName;const Rn=M.forwardRef(({className:e,children:r,...i},a)=>{let o=_t();return n(Fn,{container:o,children:[t(Ln,{}),t(H.Content,{ref:a,className:G(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]})});Rn.displayName=H.Content.displayName;const zn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:G(`text-sm text-muted`,e),...n}));zn.displayName=H.Description.displayName;const Bn=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:G(`text-lg font-semibold leading-none tracking-tight`,e),...n}));Bn.displayName=H.Title.displayName;const Vn=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:G(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));Vn.displayName=V.displayName;const Hn=({children:e,...n})=>t(Nn,{...n,children:t(Rn,{className:`shadow-lg p-0 overflow-hidden`,children:t(Vn,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),Un=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:G(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));Un.displayName=V.Input.displayName;const Wn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:G(`overflow-y-auto overflow-x-hidden`,e),...n}));Wn.displayName=V.List.displayName;const Gn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Gn.displayName=V.Empty.displayName;const q=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:G(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));q.displayName=V.Group.displayName;const Kn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:G(`-mx-1 h-px bg-border`,e),...n}));Kn.displayName=V.Separator.displayName;const J=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:G(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));J.displayName=V.Item.displayName;const qn=({className:e,...n})=>t(`span`,{className:G(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});qn.displayName=`CommandShortcut`;const Jn=M.createContext(!1);function Yn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Xn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function Zn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function Qn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:G(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function $n({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function er({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:G(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function tr({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:G(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function nr({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function rr({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:G(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function ir({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:G(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function ar({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:G(`bg-border -mx-1 my-1 h-px`,e),...n})}function or({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:G(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function sr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function cr({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:G(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function lr({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:G(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const ur={left:`start`,center:`center`,right:`end`};function dr({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:G(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Jn.Provider,{value:!0,children:r})})})]}):n(Yn,{children:[t(Zn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(Qn,{align:ur[i],className:`w-max`,children:r})]})}function fr({children:e,label:r}){return n($n,{children:[r&&t(ir,{children:r}),e]})}function pr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Jn),c=G(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(er,{className:G(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const mr=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:G(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})};Ce.extend(Te),Ce.extend(we);var Y=Ce;const hr=M.createContext(null),X=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(hr.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(W.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function gr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Z=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(hr);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(W.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>gr(o,a,`enter`),onMouseLeave:()=>gr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Z.displayName=W.Trigger.displayName;const _r=W.Anchor,Q=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(hr);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=_t();return t(W.Portal,{container:l,children:t(W.Content,{ref:a,align:n,side:r,onMouseEnter:()=>gr(c,s,`enter`),onMouseLeave:()=>gr(c,s,`leave`),className:G(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});Q.displayName=W.Content.displayName;const vr=W.Close;vr.displayName=W.Close.displayName;function yr(){let e=M.useContext(hr);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const br=`
2
2
  .calendar-wrapper .react-calendar__navigation {
3
3
  display: flex !important;
4
4
  justify-content: space-between !important;
@@ -84,12 +84,12 @@ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx a
84
84
  text-align: center !important;
85
85
  }
86
86
 
87
- `,_r=({filterValues:r,setFilterValues:i,isRange:a=!1})=>{let[o,s]=L(!1),[c,l]=L([null,null]),{t:u}=R(),d=r[0]?W(r[0]).toDate():void 0,f=a?[c[0]||(r[0]?W(r[0]).toDate():null),c[1]||(r[1]?W(r[1]).toDate():null)]:[null,null];F(()=>{a&&l([r[0]?W(r[0]).toDate():null,r[1]?W(r[1]).toDate():null])},[r,a]);let p=()=>a?f[0]&&f[1]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`-`}),t(`span`,{className:`font-medium`,children:W(f[1]).format(`MMMM DD, YYYY`)})]}):f[0]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`- Select end`})]}):t(`span`,{className:`text-muted-foreground`,children:u(`filter.selectRange`)}):d?W(d).format(`MMMM DD, YYYY`):`Pick a date`,m=e=>{if(a)Array.isArray(e)&&(l([e[0],e[1]]),e[0]&&e[1]?i([W(e[0]).format(`YYYY-MM-DD`),W(e[1]).format(`YYYY-MM-DD`)]):e[0]&&i([W(e[0]).format(`YYYY-MM-DD`)]));else if(e){let t=Array.isArray(e)?e[0]:e;t&&(i([W(t).format(`YYYY-MM-DD`)]),s(!1))}};return n(Z,{_open:o,onOpenChange:s,children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center min-h-[20px]`,children:p()})}),t($,{className:`w-auto p-0`,align:`start`,side:`bottom`,alignOffset:-4,sideOffset:6,children:t(`div`,{className:`p-2`,children:a?n(e,{children:[n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:f,onChange:m,selectRange:!0,returnValue:`range`,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(f[0]){let e=f[0].getTime();if(f[1]){let n=f[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}})]}),f[0]&&f[1]&&t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),t(J,{size:`sm`,onClick:()=>s(!1),children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:d,onChange:m,selectRange:!1,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(d&&t===d.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})})]})};function vr({value:n,labelRenderer:r,fallbackLabel:i}){let[a,o]=L(i||n),[s,c]=L(!1);return F(()=>{if(!r){o(i||n);return}(async()=>{c(!0);try{let e=r(n);if(e instanceof Promise){let t=await e;o(t)}else o(e)}catch(e){console.error(`Error rendering label:`,e),o(i||n)}finally{c(!1)}})()},[n,r,i]),s?t(`span`,{className:`text-muted-foreground`,children:`Loading...`}):t(e,{children:a})}const yr=({filterType:r,filterValues:i,setFilterValues:a,options:o,labelRenderer:s,multiple:c=!0})=>{let[l,u]=L(!1),[d,f]=L(``),p=I(null),{t:m}=R(),h=o?.filter(e=>!i.some(t=>t.value===e.value));return n(Z,{_open:l,onOpenChange:e=>{u(e),e||setTimeout(()=>{f(``)},200)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:i?.length===1?(()=>{let e=i[0];return t(vr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})})():`${i?.length} selected`})}),t($,{className:`w-[300px] p-0`,children:t(ur,{children:n(Ln,{children:[t(zn,{placeholder:r,className:`h-9`,value:d,onInputCapture:e=>{f(e.currentTarget.value)},ref:p}),n(Bn,{children:[t(Vn,{children:m(`filter.noResultsFound`)}),t(Y,{children:i.map(e=>n(X,{className:`group flex gap-2 items-center`,onSelect:()=>{a(i.filter(t=>t.value!==e.value)),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(`input`,{type:`checkbox`,checked:!0,onChange:()=>{}}),t(vr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})]},e.value))}),h?.length>0&&n(e,{children:[t(Hn,{}),t(Y,{children:h.filter(e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase())).map(e=>n(X,{className:`group flex gap-2 items-center`,value:String(e.label||e.value),onSelect:()=>{let t={value:e.value,label:e.label};a(c?[...i,t]:[t]),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(_n,{checked:!1,className:`opacity-0 group-data-[selected=true]:opacity-100`}),t(`span`,{className:`text-muted`,children:t(vr,{value:e.value||``,labelRenderer:e.labelRenderer||s,fallbackLabel:e.label})})]},e.value))})]})]})]})})})]})},br=({filterType:e,filterValues:r,setFilterValues:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&JSON.stringify(s)!==JSON.stringify(r)&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r.length>0?r.length===1?r[0]:`${r.length} tags`:`Add tags...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-3`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(Ut,{value:s,onChange:c,placeholder:`Add ${e.toLowerCase()}...`}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{size:`sm`,variant:`ghost`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})]})})]})},xr=z(``,{variants:{size:{xs:`rounded py-1 text-xs rounded-xs`,sm:`rounded text-xs rounded-sm`,md:`rounded-md py-2 text-sm`,lg:`rounded-md text-base`,xl:`rounded-md py-2.5 text-lg`},variant:{default:`flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,unstyled:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,noPadding:`block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`,legacy:`py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`}},defaultVariants:{size:`md`,variant:`default`}}),Sr=M.forwardRef(({className:e,type:r,size:i=`md`,variant:a=`default`,clearable:o=!0,onChange:s,value:c,invalid:l,...u},d)=>{let f=()=>{s?.(``)},p=e=>{s?.(e.target.value)},m=u[`aria-invalid`]??(l?!0:void 0);return n(`div`,{className:`w-full relative inline-block [&:hover_.clear-button]:opacity-100`,children:[t(`input`,{type:r,className:q(xr({size:i,variant:a}),e,o&&c?`pe-8`:``),ref:d,value:c??``,onChange:p,...u,"aria-invalid":m}),o&&c&&!u.readOnly&&!u.disabled&&t(J,{variant:`link`,size:`icon`,type:`button`,onClick:f,className:`clear-button opacity-0 transition-opacity duration-200
87
+ `,xr=({filterValues:r,setFilterValues:i,isRange:a=!1})=>{let[o,s]=L(!1),[c,l]=L([null,null]),{t:u}=R(),d=r[0]?Y(r[0]).toDate():void 0,f=a?[c[0]||(r[0]?Y(r[0]).toDate():null),c[1]||(r[1]?Y(r[1]).toDate():null)]:[null,null];F(()=>{a&&l([r[0]?Y(r[0]).toDate():null,r[1]?Y(r[1]).toDate():null])},[r,a]);let p=()=>a?f[0]&&f[1]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:Y(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`-`}),t(`span`,{className:`font-medium`,children:Y(f[1]).format(`MMMM DD, YYYY`)})]}):f[0]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:Y(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`- Select end`})]}):t(`span`,{className:`text-muted-foreground`,children:u(`filter.selectRange`)}):d?Y(d).format(`MMMM DD, YYYY`):`Pick a date`,m=e=>{if(a)Array.isArray(e)&&(l([e[0],e[1]]),e[0]&&e[1]?i([Y(e[0]).format(`YYYY-MM-DD`),Y(e[1]).format(`YYYY-MM-DD`)]):e[0]&&i([Y(e[0]).format(`YYYY-MM-DD`)]));else if(e){let t=Array.isArray(e)?e[0]:e;t&&(i([Y(t).format(`YYYY-MM-DD`)]),s(!1))}};return n(X,{_open:o,onOpenChange:s,children:[t(Z,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center min-h-[20px]`,children:p()})}),t(Q,{className:`w-auto p-0`,align:`start`,side:`bottom`,alignOffset:-4,sideOffset:6,children:t(`div`,{className:`p-2`,children:a?n(e,{children:[n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:br}),t(Se,{value:f,onChange:m,selectRange:!0,returnValue:`range`,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(f[0]){let e=f[0].getTime();if(f[1]){let n=f[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}})]}),f[0]&&f[1]&&t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),t(K,{size:`sm`,onClick:()=>s(!1),children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:br}),t(Se,{value:d,onChange:m,selectRange:!1,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(d&&t===d.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})})]})};function Sr({value:n,labelRenderer:r,fallbackLabel:i}){let[a,o]=L(i||n),[s,c]=L(!1);return F(()=>{if(!r){o(i||n);return}(async()=>{c(!0);try{let e=r(n);if(e instanceof Promise){let t=await e;o(t)}else o(e)}catch(e){console.error(`Error rendering label:`,e),o(i||n)}finally{c(!1)}})()},[n,r,i]),s?t(`span`,{className:`text-muted-foreground`,children:`Loading...`}):t(e,{children:a})}const Cr=({filterType:r,filterValues:i,setFilterValues:a,options:o,labelRenderer:s,multiple:c=!0})=>{let[l,u]=L(!1),[d,f]=L(``),p=I(null),{t:m}=R(),h=o?.filter(e=>!i.some(t=>t.value===e.value));return n(X,{_open:l,onOpenChange:e=>{u(e),e||setTimeout(()=>{f(``)},200)},children:[t(Z,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:i?.length===1?(()=>{let e=i[0];return t(Sr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})})():`${i?.length} selected`})}),t(Q,{className:`w-[300px] p-0`,children:t(mr,{children:n(Vn,{children:[t(Un,{placeholder:r,className:`h-9`,value:d,onInputCapture:e=>{f(e.currentTarget.value)},ref:p}),n(Wn,{children:[t(Gn,{children:m(`filter.noResultsFound`)}),t(q,{children:i.map(e=>n(J,{className:`group flex gap-2 items-center`,onSelect:()=>{a(i.filter(t=>t.value!==e.value)),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(`input`,{type:`checkbox`,checked:!0,onChange:()=>{}}),t(Sr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})]},e.value))}),h?.length>0&&n(e,{children:[t(Kn,{}),t(q,{children:h.filter(e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase())).map(e=>n(J,{className:`group flex gap-2 items-center`,value:String(e.label||e.value),onSelect:()=>{let t={value:e.value,label:e.label};a(c?[...i,t]:[t]),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(xn,{checked:!1,className:`opacity-0 group-data-[selected=true]:opacity-100`}),t(`span`,{className:`text-muted`,children:t(Sr,{value:e.value||``,labelRenderer:e.labelRenderer||s,fallbackLabel:e.label})})]},e.value))})]})]})]})})})]})},wr=({filterType:e,filterValues:r,setFilterValues:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(X,{_open:a,onOpenChange:e=>{o(e),!e&&JSON.stringify(s)!==JSON.stringify(r)&&c(r)},children:[t(Z,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r.length>0?r.length===1?r[0]:`${r.length} tags`:`Add tags...`})}),t(Q,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-3`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(qt,{value:s,onChange:c,placeholder:`Add ${e.toLowerCase()}...`}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{size:`sm`,variant:`ghost`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(K,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})]})})]})},Tr=z(``,{variants:{size:{xs:`rounded py-1 text-xs rounded-xs`,sm:`rounded text-xs rounded-sm`,md:`rounded-md py-2 text-sm`,lg:`rounded-md text-base`,xl:`rounded-md py-2.5 text-lg`},variant:{default:`flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,unstyled:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,noPadding:`block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`,legacy:`py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`}},defaultVariants:{size:`md`,variant:`default`}}),$=M.forwardRef(({className:e,type:r,size:i=`md`,variant:a=`default`,clearable:o=!0,onChange:s,value:c,invalid:l,...u},d)=>{let f=()=>{s?.(``)},p=e=>{s?.(e.target.value)},m=u[`aria-invalid`]??(l?!0:void 0);return n(`div`,{className:`w-full relative inline-block [&:hover_.clear-button]:opacity-100`,children:[t(`input`,{type:r,className:G(Tr({size:i,variant:a}),e,o&&c?`pe-8`:``),ref:d,value:c??``,onChange:p,...u,"aria-invalid":m}),o&&c&&!u.readOnly&&!u.disabled&&t(K,{variant:`link`,size:`icon`,type:`button`,onClick:f,className:`clear-button opacity-0 transition-opacity duration-200
88
88
  absolute top-1/2 -translate-y-1/2 text-muted !hover:text-destructive cursor-pointer
89
- flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});Sr.displayName=`Input`;const Cr=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(Sr,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function wr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:W(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?W(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:W(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:W(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function Tr({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value!==void 0&&t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}else return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(X,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(vr,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(J,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function Er({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(Ut,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Dr({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t(Sr,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(J,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function Or(e,n,r){switch(e.type){case`date`:return t(_r,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:W(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Cr,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(br,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(yr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function kr({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),Or(e,r,i),t(J,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const Ar=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),jr=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value))if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Fr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Fr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(Ar.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},Mr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(Ar),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Fr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Vn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(X,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(Z,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Q,{asChild:!0,children:n(J,{variant:`outline`,role:`combobox`,"aria-expanded":s,"aria-label":o(`filter.filter`),size:`md`,className:q(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t($,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(Ln,{children:[a.find(e=>e.name===l)?.type===`select`&&t(zn,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(Bn,{children:t(Y,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(wr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Dr,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(Er,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(Tr,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Nr=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(Ar);return t(`div`,{className:q(e),children:t(kr,{filters:n,setFilters:r,filterGroups:i})})},Pr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(Ar),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(J,{variant:`outline`,size:`md`,className:q(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Fr(e){return typeof e==`string`?e:e.value||``}var Ir;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(Ir||={});const Lr=oe(({className:e,level:n=3,...r},i)=>t(`h${n}`,{ref:i,className:q({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r}));Lr.displayName=`Heading`;function Rr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[ce,P]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?zr(e,w)===zr(l,w):typeof w==`function`?w(e,l):Ce(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;P(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?zr(e,w)===zr(t,w):typeof w==`function`?w(e,t):Ce(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(zr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l!=null&&ge(l,e);return t(X,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(mr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t(Sr,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(Ln,{className:`overflow-hidden`,children:n(Bn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Vn,{children:`No result found.`}),H?H.map(e=>t(Y,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(Y,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let W=!!g,Se=M??(W?void 0:typeof _==`string`?_:void 0),G=N??(W?me:void 0),we=!!b&&!!l&&(!Array.isArray(l)||l.length>0),Te=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(Z,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Q,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Se,"aria-labelledby":G,"aria-describedby":re,"aria-invalid":Te,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||Te?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,we&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(vt,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),we&&!E&&t(J,{variant:`link`,size:`icon`,disabled:p,"aria-label":te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t($,{id:pe,style:{width:`${ce}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function zr(e,t){return typeof e==`object`&&e?e[t]:void 0}const Br={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Vr({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Rr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>Br[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Hr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Ur=M.forwardRef(({className:e,required:r,...i},a)=>n(we.Root,{ref:a,className:q(Hr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Ur.displayName=we.Root.displayName;function Wr({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`;break}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Gr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(Wr,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(J,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Kr({title:e,className:n,children:r}){return t(Wr,{status:`info`,title:e,className:n,children:r})}function qr({title:e,className:n,children:r}){return t(Wr,{status:`warning`,title:e,className:n,children:r})}function Jr({title:e,className:n,children:r}){return t(Wr,{status:`success`,title:e,className:n,children:r})}function Yr({title:e,className:n,children:r}){return t(Wr,{status:`default`,title:e,className:n,children:r})}function Xr({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(Tn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(En,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(It,{label:l??u,children:t(Sr,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(On,{align:`right`,children:[t(J,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(J,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function Zr(){return P(Qr)}const Qr=ae(()=>{}),$r={success:h,error:g,warning:a,info:y},ei={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ti({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=ce(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=ce(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=$r[e.status]||y,u=ei[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ni({children:r}){let[i,a]=L(null),o=ce(e=>{a(e)},[]);return n(e,{children:[t(Qr.Provider,{value:o,children:r}),i&&t(en,{children:t(ti,{data:i,onClose:()=>o(null)})})]})}function ri({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=Zr();return t(Xr,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}function ii({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(vt,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(J,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function ai({className:e,...n}){return t(Te.Item,{"data-slot":`radio-group-item`,className:q(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Te.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var oi=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function si({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Te.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Te.Item,{value:o(e),className:q(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function ci({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(Ee.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:q(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function li(e){return typeof e==`number`?`${e}%`:e}function ui({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(Ee.Panel,{"data-slot":`resizable-panel`,defaultSize:li(e),minSize:li(n),maxSize:li(r),collapsedSize:li(i),...a})}function di({withHandle:e,className:n,...r}){return t(Ee.Separator,{"data-slot":`resizable-handle`,className:q(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const fi=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(De.Root,{ref:a,decorative:r,orientation:n,className:q(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));fi.displayName=De.Root.displayName;const pi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(Oe.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:q(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(Oe.Track,{"data-slot":`slider-track`,className:q(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(Oe.Range,{"data-slot":`slider-range`,className:q(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(Oe.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:q(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});pi.displayName=Oe.Root.displayName;const mi={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function hi({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=mi[r],f=t(ke.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:q(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(ke.Thumb,{"data-slot":`switch-thumb`,className:q(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:q(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const gi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),_i=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0,canChangeTab:f})=>{let p=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[m,h]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&p.some(e=>e.name===i)?i:n||p[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==m&&h(e)},[r,m]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&p.some(e=>e.name===t)?h(t):!e&&n&&h(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,p,n]);let g=M.useCallback(e=>{if(!(e!==m&&f&&!f(e,m))){if(h(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)}},[r,c,d,f,m]),_=M.useCallback(e=>{g(e)},[g]);return t(gi.Provider,{value:{tabs:p,size:a?p.length:0,current:m,setTab:_,responsive:l,variant:u,updateHash:d,canChangeTab:f},children:t(K.Root,{defaultValue:m||p[0]?.name,value:m,onValueChange:g,className:q(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},vi=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f,canChangeTab:p}=M.useContext(gi),m=s!==0,h=M.useCallback(e=>{if(!o||!l||e!==c&&p&&!p(e,c))return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f,p,c]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Rr,{label:`Tab`,className:q(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{h(e.name)}})}),t(bi,{size:s,variant:d,className:q(m?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(xi,{className:q(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>h(e.name),children:e.label},e.name))})]})},yi=({className:n})=>{let{tabs:r}=M.useContext(gi);return r?t(e,{children:r.map(e=>t(Si,{value:e.name,className:n,children:e.content},e.name))}):null},bi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(gi.Provider,{value:{size:n,variant:r},children:t(K.List,{ref:a,className:q(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));bi.displayName=K.List.displayName;const xi=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(gi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(K.Trigger,{ref:a,className:q(r===`tabs`?q(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):q(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});xi.displayName=K.Trigger.displayName;const Si=M.forwardRef(({className:e,...n},r)=>t(K.Content,{ref:r,className:q(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));Si.displayName=K.Content.displayName;const Ci=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),wi=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:q(Ci({size:n,weight:r,className:e})),...i}));wi.displayName=`Text`;function Ti({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=ce(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:q(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Ei=ae({theme:`system`,setTheme:()=>null});function Di({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s={theme:a,setTheme:e=>{localStorage.setItem(r,e),o(e)}};return t(Ei.Provider,{...i,value:s,children:e})}const Oi=()=>{let e=P(Ei);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function ki({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(J,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),title:a,children:i})}function Ai({label:e,className:r}={}){let{setTheme:i,theme:a}=Oi(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(ki,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(ki,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(ki,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function ji(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function Mi({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t(Sr,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(ji(e,r),i)):i=ji(e,r),t(Ni,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Ni({option:e,onSelect:i,layout:a,noCheck:o}){return n(J,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Pi({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX,i=Math.max(r+t,480);p(i)}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Fi,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Fi({onClose:e}){return t(J,{title:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Ii(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Li({size:e,className:i}){return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,Ii(e||`md`),i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Ri({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=P(dr),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Q,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t($,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:Lt(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(J,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function zi(e){return t(Z,{click:!0,children:t(Ri,{...e})})}function Bi({className:e,children:n,...i}){return t(`table`,{className:r(`
89
+ flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});$.displayName=`Input`;const Er=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(X,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Z,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t(Q,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t($,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(K,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function Dr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:Y(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:Y(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:Y(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:Y(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?Y(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:br}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(K,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:Y(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:Y(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:br}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function Or({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value!==void 0&&t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(J,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(Sr,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(K,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function kr({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(qt,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(K,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Ar({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t($,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(K,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(K,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function jr(e,n,r){switch(e.type){case`date`:return t(xr,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:Y(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Er,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(wr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(Cr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function Mr({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),jr(e,r,i),t(K,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const Nr=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),Pr=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value)){if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Rr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Rr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(Nr.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},Fr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(Nr),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Rr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Gn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(J,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(X,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Z,{asChild:!0,children:n(K,{variant:`outline`,role:`combobox`,"aria-expanded":s,"aria-label":o(`filter.filter`),size:`md`,className:G(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t(Q,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(Vn,{children:[a.find(e=>e.name===l)?.type===`select`&&t(Un,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(Wn,{children:t(q,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(Dr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Ar,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(kr,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(Or,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Ir=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(Nr);return t(`div`,{className:G(e),children:t(Mr,{filters:n,setFilters:r,filterGroups:i})})},Lr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(Nr),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(K,{variant:`outline`,size:`md`,className:G(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Rr(e){return typeof e==`string`?e:e.value||``}var zr;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(zr||={});const Br=oe(({className:e,level:n=3,...r},i)=>{let a=`h${n}`;return t(a,{ref:i,className:G({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r})});Br.displayName=`Heading`;function Vr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[P,ce]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?Hr(e,w)===Hr(l,w):typeof w==`function`?w(e,l):Ee(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;ce(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?Hr(e,w)===Hr(t,w):typeof w==`function`?w(e,t):Ee(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(Hr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l!=null&&ge(l,e);return t(J,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(vr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t($,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(Vn,{className:`overflow-hidden`,children:n(Wn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Gn,{children:`No result found.`}),H?H.map(e=>t(q,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(q,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let Se=!!g,Ce=M??(Se?void 0:typeof _==`string`?_:void 0),we=N??(Se?me:void 0),Te=!!b&&!!l&&(!Array.isArray(l)||l.length>0),W=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(X,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Z,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Ce,"aria-labelledby":we,"aria-describedby":re,"aria-invalid":W,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||W?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,Te&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(St,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),Te&&!E&&t(K,{variant:`link`,size:`icon`,disabled:p,title:te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-2 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t(Q,{id:pe,style:{width:`${P}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function Hr(e,t){return typeof e==`object`&&e?e[t]:void 0}const Ur={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Wr({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Vr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>Ur[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Gr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Kr=M.forwardRef(({className:e,required:r,...i},a)=>n(De.Root,{ref:a,className:G(Gr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Kr.displayName=De.Root.displayName;function qr({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Jr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(qr,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(K,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Yr({title:e,className:n,children:r}){return t(qr,{status:`info`,title:e,className:n,children:r})}function Xr({title:e,className:n,children:r}){return t(qr,{status:`warning`,title:e,className:n,children:r})}function Zr({title:e,className:n,children:r}){return t(qr,{status:`success`,title:e,className:n,children:r})}function Qr({title:e,className:n,children:r}){return t(qr,{status:`default`,title:e,className:n,children:r})}function $r({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(kn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(An,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(Bt,{label:l??u,children:t($,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(Mn,{align:`right`,children:[t(K,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(K,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function ei(){return ce(ti)}const ti=ae(()=>{}),ni={success:h,error:g,warning:a,info:y},ri={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ii({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=P(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=P(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=ni[e.status]||y,u=ri[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ai({children:r}){let[i,a]=L(null),o=P(e=>{a(e)},[]);return n(e,{children:[t(ti.Provider,{value:o,children:r}),i&&t(an,{children:t(ii,{data:i,onClose:()=>o(null)})})]})}function oi({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=ei();return t($r,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}const si=4,ci={tabs:{base:`flex items-center border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer shrink-0`,inactive:`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,active:`border-primary text-primary`,icon:`ms-1 size-4`},pills:{base:`flex items-center rounded-md px-2 py-1 text-xs font-medium whitespace-nowrap cursor-pointer shrink-0`,inactive:`text-muted-foreground hover:bg-muted/60`,active:`bg-muted text-foreground`,icon:`ms-0.5 size-3.5`}};function li(e,t,n=4){let r=I(null),i=I([]),a=I(null),[o,s]=L({count:e.length,promote:!1}),c=()=>{let o=r.current;if(!o)return;let c=o.clientWidth,l=e.map((e,t)=>i.current[t]?.offsetWidth??0),u=l.reduce((e,t)=>e+t,0)+n*Math.max(0,e.length-1),d=(t,r)=>{let i=0,a=0;for(let o=0;o<e.length;o++){if(o===r)continue;let e=i+(a>0?n:0)+l[o];if(e>t)break;i=e,a+=1}return a},f;if(u<=c)f={count:e.length,promote:!1};else{let r=a.current?.offsetWidth??0,i=Math.max(1,d(c-r-n,-1)),o=e.findIndex(t);f=o<0||o<i?{count:i,promote:!1}:{count:d(c-r-l[o]-n*2,o),promote:!0}}s(e=>e.count===f.count&&e.promote===f.promote?e:f)},l=I(c);l.current=c,ue(()=>{l.current()}),F(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>l.current());return t.observe(e),()=>t.disconnect()},[]);let u=e.findIndex(t),d,f;if(o.promote&&u>=0){let t=e.filter((e,t)=>t!==u);d=[...t.slice(0,o.count),e[u]],f=t.slice(o.count)}else d=e.slice(0,o.count),f=e.slice(o.count);return{containerRef:r,setItemRef:e=>t=>{i.current[e]=t},setMoreRef:e=>{a.current=e},visible:d,overflow:f,activeInOverflow:f.some(t)}}function ui({label:e,triggerClassName:r,icon:i,children:a}){let[o,s]=L(!1),c=I(null),u=I(!1),d=()=>{c.current&&=(clearTimeout(c.current),null)},f=()=>{d(),u.current=!0,s(!0)},p=()=>{d(),c.current=setTimeout(()=>s(!1),150)};return F(()=>()=>clearTimeout(c.current??void 0),[]),n(Yn,{modal:!1,open:o,onOpenChange:e=>{d(),e&&(u.current=!1),s(e)},children:[t(Zn,{asChild:!0,children:n(`button`,{type:`button`,onMouseEnter:f,onMouseLeave:p,className:r,children:[e,i??t(l,{className:`ms-1 size-4`})]})}),t(Qn,{align:`end`,className:`w-max`,onMouseEnter:d,onMouseLeave:p,onCloseAutoFocus:e=>{u.current&&e.preventDefault()},children:a})]})}function di({tabs:e,current:r,onTabChange:i,variant:a=`tabs`,className:o}){let{t:s}=R(),c=ci[a],{containerRef:u,setItemRef:d,setMoreRef:f,visible:p,overflow:m,activeInOverflow:h}=li(e,e=>e.name===r),g=s(`agent.moreTabs`);return n(`div`,{ref:u,className:G(`relative`,o),children:[n(`div`,{"aria-hidden":!0,className:`pointer-events-none invisible absolute start-0 top-0 flex w-max gap-1`,children:[e.map((e,n)=>t(`button`,{type:`button`,tabIndex:-1,ref:d(n),className:G(c.base,c.inactive),children:e.label},e.name)),n(`button`,{type:`button`,tabIndex:-1,ref:f,className:G(c.base,c.inactive),children:[g,t(l,{className:c.icon})]})]}),n(`div`,{className:G(`flex gap-1 overflow-hidden`,a===`tabs`&&`-mb-px border-b`),children:[p.map(e=>{let n=e.name===r;return t(`button`,{type:`button`,"aria-current":n?`page`:void 0,disabled:e.disabled,onClick:()=>i(e.name),className:G(c.base,n?c.active:c.inactive,`disabled:pointer-events-none disabled:opacity-50`),children:e.label},e.name)}),m.length>0&&t(ui,{label:g,triggerClassName:G(c.base,h?c.active:c.inactive),icon:t(l,{className:c.icon}),children:m.map(e=>t(er,{disabled:e.disabled,onClick:()=>i(e.name),className:G(e.name===r&&`text-primary`),children:e.label},e.name))})]})]})}function fi({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(St,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(K,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function pi({className:e,...n}){return t(Oe.Item,{"data-slot":`radio-group-item`,className:G(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Oe.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var mi=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function hi({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Oe.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Oe.Item,{value:o(e),className:G(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function gi({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(ke.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:G(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function _i(e){return typeof e==`number`?`${e}%`:e}function vi({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(ke.Panel,{"data-slot":`resizable-panel`,defaultSize:_i(e),minSize:_i(n),maxSize:_i(r),collapsedSize:_i(i),...a})}function yi({withHandle:e,className:n,...r}){return t(ke.Separator,{"data-slot":`resizable-handle`,className:G(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const bi=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(Ae.Root,{ref:a,decorative:r,orientation:n,className:G(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));bi.displayName=Ae.Root.displayName;const xi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(je.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:G(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(je.Track,{"data-slot":`slider-track`,className:G(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(je.Range,{"data-slot":`slider-range`,className:G(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(je.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:G(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});xi.displayName=je.Root.displayName;const Si={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function Ci({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=Si[r],f=t(Me.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:G(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(Me.Thumb,{"data-slot":`switch-thumb`,className:G(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:G(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const wi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),Ti=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0,canChangeTab:f})=>{let p=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[m,h]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&p.some(e=>e.name===i)?i:n||p[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==m&&h(e)},[r,m]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&p.some(e=>e.name===t)?h(t):!e&&n&&h(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,p,n]);let g=M.useCallback(e=>{if(!(e!==m&&f&&!f(e,m))){if(h(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)}},[r,c,d,f,m]),_=M.useCallback(e=>{g(e)},[g]);return t(wi.Provider,{value:{tabs:p,size:a?p.length:0,current:m,setTab:_,responsive:l,variant:u,updateHash:d,canChangeTab:f},children:t(Ne.Root,{defaultValue:m||p[0]?.name,value:m,onValueChange:g,className:G(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},Ei=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f,canChangeTab:p}=M.useContext(wi),m=s!==0,h=M.useCallback(e=>{if(!o||!l||e!==c&&p&&!p(e,c))return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f,p,c]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Vr,{label:`Tab`,className:G(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{h(e.name)}})}),t(Oi,{size:s,variant:d,className:G(m?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(ki,{className:G(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>h(e.name),children:e.label},e.name))})]})},Di=({className:n})=>{let{tabs:r}=M.useContext(wi);return r?t(e,{children:r.map(e=>t(Ai,{value:e.name,className:n,children:e.content},e.name))}):null},Oi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(wi.Provider,{value:{size:n,variant:r},children:t(Ne.List,{ref:a,className:G(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));Oi.displayName=Ne.List.displayName;const ki=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(wi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(Ne.Trigger,{ref:a,className:G(r===`tabs`?G(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):G(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});ki.displayName=Ne.Trigger.displayName;const Ai=M.forwardRef(({className:e,...n},r)=>t(Ne.Content,{ref:r,className:G(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));Ai.displayName=Ne.Content.displayName;const ji=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),Mi=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:G(ji({size:n,weight:r,className:e})),...i}));Mi.displayName=`Text`;function Ni({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=P(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:G(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Pi=ae({theme:`system`,setTheme:()=>null});function Fi({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s=P((e,t)=>{t?.persist!==!1&&localStorage.setItem(r,e),o(e)},[r]),c=de(()=>({theme:a,setTheme:s}),[s,a]);return t(Pi.Provider,{...i,value:c,children:e})}const Ii=()=>{let e=ce(Pi);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function Li({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(K,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),title:a,children:i})}function Ri({label:e,className:r}={}){let{setTheme:i,theme:a}=Ii(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(Li,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(Li,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(Li,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function zi(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function Bi({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t($,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(zi(e,r),i)):i=zi(e,r),t(Vi,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Vi({option:e,onSelect:i,layout:a,noCheck:o}){return n(K,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Hi({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX,i=Math.max(r+t,480);p(i)}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Ui,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Ui({onClose:e}){return t(K,{title:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Wi(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Gi({size:e,className:i}){let a=Wi(e||`md`);return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,a,i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Ki({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=ce(hr),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Z,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t(Q,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:Vt(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(K,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function qi(e){return t(X,{click:!0,children:t(Ki,{...e})})}function Ji({className:e,children:n,...i}){return t(`table`,{className:r(`
90
90
  divide-y divide-border
91
91
  [&>tbody]:divide-y [&>tbody]:divide-border
92
92
  [&_th]:text-start [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground
93
93
  [&_td]:px-3 [&_td]:py-4 [&_td]:text-sm
94
- `,e),...i,children:n})}function Vi({children:e}){return t(`thead`,{className:`sticky top-0 bg-background z-10 after:absolute after:bottom-0 after:start-0 after:w-full after:h-px after:bg-muted/20`,children:e})}function Hi({columns:e}){return t(`tr`,{className:`hover:bg-muted`,children:Array(e).fill(0).map((e,n)=>t(`td`,{children:t(`div`,{className:`animate-pulse rounded-xs h-5 bg-muted`})},`skeleton-cell-${n}`))})}function Ui({isLoading:e=!1,columns:n,rows:r=3,children:i}){let a=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return t(`tbody`,{children:e?a.map(e=>t(Hi,{columns:n},e)):i})}function Wi({className:e,children:n,...i}){return t(`tr`,{className:r(`hover:bg-muted hover:cursor-pointer`,e),...i,children:n})}function Gi({scope:e=`col`,children:n,...r}){return t(`th`,{scope:e,...r,children:n})}function Ki({sortDirection:e=`none`,onSort:r,sortIndicator:i,disabled:a=!1,children:o,className:s,scope:c=`col`,...l}){return t(`th`,{scope:c,"aria-sort":e,className:s,...l,children:a?n(`span`,{className:`inline-flex items-center gap-1`,children:[o,i?.(e)]}):n(`button`,{type:`button`,onClick:r,className:`inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 text-inherit font-inherit cursor-pointer hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm`,children:[o,i?.(e)]})})}var qi=class{_value;watchers=[];name;constructor(e,t){this._value=e,this.name=t}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function Ji(e){let t=N.createContext(void 0);return e.Context=t,t.Provider}var Yi=class{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e?.(this.current),this}};function Xi(e){let t=e.Context;if(!t)throw Error(`Context not defined for ${e.name}`);return P(t)}function Zi(e){let[t,n]=L(e.value);return F(()=>e.watch(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function Qi(e,t){return F(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function $i(e,t){F(()=>e.watch(t),[e,t])}function ea(e){let[t,n]=L(e.current);return F(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function ta(e,t){F(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function na(e,t){F(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}var ra=class{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(let e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){let e=this.compute();if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}get value(){return this._value}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}dispose(){for(let e of this.unsubscribers)e();this.watchers=[]}},ia=class{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function aa(e){let[t,n]=L(e.value);return F(()=>e.addWatcher(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function oa(e,t){let n=I(null);return F(()=>{let r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},i=window.setTimeout(()=>{document.addEventListener(`click`,r)},0);return()=>{window.clearTimeout(i),document.removeEventListener(`click`,r)}},[e,t]),n}function sa(){let[e,t]=L(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn(`Clipboard not supported`),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn(`Copy failed`,e),t(null),!1}}]}function ca(e){F(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=t=>e(t.matches);return t.addEventListener(`change`,n),e(t.matches),()=>t.removeEventListener(`change`,n)},[e])}function la(e,t){let[n,r]=L(e);return F(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function ua(e,t,n){let r=[],i=new EventSource(e);return i.addEventListener(`message`,e=>{let n=JSON.parse(e.data);n&&(r.push(n),t(r.join(``)))}),i.addEventListener(`close`,e=>{i.close(),n(JSON.parse(e.data))}),()=>{i.close()}}function da(e,t,n){let r=I(t),i=I(n);r.current=t,i.current=n,F(()=>{let t,n=!1,a=e=>r.current(e),o=e=>i.current(e);return typeof e==`function`?e().then(e=>{n||(t=ua(e,a,o))}):t=ua(e,a,o),()=>{n=!0,t?.()}},[e])}function fa(e){return e instanceof Error?e:Error(String(e))}function pa(e,t){Array.isArray(t)&&(t={deps:t});let n=t||{},[r,i]=L(void 0),[a,o]=L(!1),[s,c]=L(n.defaultValue),l=I(e);l.current=e;let u=I(n);u.current=n;let d=ce(()=>{let e=u.current;return e.start?.(),o(!0),l.current().then(t=>{c(t),e.onSuccess?.(t)}).catch(t=>{let n=fa(t);i(n),e.onError?.(n)}).finally(()=>{o(!1),e.end?.()})},[]);return F(()=>{let e=u.current;(!e.condition||e.condition())&&d()},[d,...n.deps??[]]),{data:s,isLoading:a,error:r,setData:c,refetch:d}}function ma(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),pa(e,t)}function ha(e=!1){let[t,n]=L(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function ga(e,t,n={}){let r=I(t);r.current=t;let i=I(n);i.current=n;let a=n.threshold||1;F(()=>{let t=e.current,n=new IntersectionObserver(e=>{let t=e[0].isIntersecting;i.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:a});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,a,...n.deps??[]])}function _a(){let e=I(!0);return F(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const va=typeof window<`u`?ue:F;function ya(e,t=[]){let n=e.pageSize||50,[r,i]=L(null),[a,o]=L(e.payload),[s,c]=L(null),[l,u]=L([]),[d,f]=L(null),[p,m]=L(!1),[h,g]=L(0),_=I(0),v=I(e.search);v.current=e.search;let y=e=>{i(null),u([]),f(null),o(e),g(e=>e+1)},b=()=>{d!==null&&i(d)};return F(()=>{_.current+=1;let e=_.current;m(!0),v.current(a,r,n).then(t=>{e===_.current&&(u(r===null?t.result:e=>[...e,...t.result]),f(t.nextPage),c(null))}).catch(t=>{e===_.current&&c(t)}).finally(()=>{e===_.current&&m(!1)})},[...t,a,h,r,n]),ga(e.nextPageTrigger,()=>{!p&&d&&b()},{threshold:.1,deps:[d,p]}),{search:y,refresh:()=>y(a),searchMore:b,result:l,page:r,hasMore:d!==null,error:s,isSearching:p}}function ba(e,t=[]){return ya({...e,async search(t,n,r){let i=n??0,a=i*r,o=await e.search(t,a,r);return{result:o,nextPage:o.length===0?null:i+1}}},t)}var xa=class{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}};function Sa(e){return new xa(L(e))}function Ca(...e){return ge(i(e))}function wa(e){return typeof e==`object`&&!!e&&`message`in e}function Ta(e,t=`An error occurred`){return e instanceof Error?e.message:typeof e==`string`?e:wa(e)&&typeof e.message==`string`?e.message:t}function Ea(e,t){let n=e.selectionStart,r=e.selectionEnd,i=e.value,a=`${i.slice(0,n)}\n${i.slice(r)}`;t?.(a),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{ur as AnimateChangeInHeight,je as Avatar,zt as Badge,tn as Breadcrumbs,J as Button,dn as Card,hn as CardContent,mn as CardDescription,gn as CardFooter,fn as CardHeader,pn as CardTitle,Ne as Center,_n as Checkbox,vn as Collapsible,bn as CollapsibleContent,yn as CollapsibleTrigger,et as ComboBox,Ln as Command,Rn as CommandDialog,Vn as CommandEmpty,Y as CommandGroup,zn as CommandInput,X as CommandItem,Bn as CommandList,Hn as CommandSeparator,Un as CommandShortcut,ra as ComputedProperty,Xr as ConfirmModal,Ct as CopyButton,qe as DOMPopup,_r as DateCombobox,Yr as DefaultBox,ri as DeleteModal,kn as Dialog,Mn as DialogClose,Pn as DialogContent,Fn as DialogDescription,Nn as DialogOverlay,jn as DialogPortal,In as DialogTitle,An as DialogTrigger,lt as Divider,Ht as DotBadge,kt as DropZone,sr as Dropdown,Gn as DropdownMenu,Zn as DropdownMenuCheckboxItem,Jn as DropdownMenuContent,Yn as DropdownMenuGroup,Xn as DropdownMenuItem,er as DropdownMenuLabel,Kn as DropdownMenuPortal,Qn as DropdownMenuRadioGroup,$n as DropdownMenuRadioItem,tr as DropdownMenuSeparator,nr as DropdownMenuShortcut,rr as DropdownMenuSub,ar as DropdownMenuSubContent,ir as DropdownMenuSubTrigger,qn as DropdownMenuTrigger,wt as EmptyCollection,Gr as ErrorBox,Ot as FileUploadInput,Nr as FilterBar,Mr as FilterBtn,Pr as FilterClear,Ir as FilterOperator,jr as FilterProvider,It as FormItem,Lr as Heading,Kr as InfoBox,Sr as Input,Ut as InputList,Ur as Label,Vr as LanguageSwitcher,Wt as Link,cr as MenuGroup,lr as MenuItem,Gt as MenuList,Wr as MessageBox,Tn as Modal,Dn as ModalBody,wn as ModalContextProvider,On as ModalFooter,En as ModalTitle,ki as ModeOption,Ai as ModeToggle,Yt as NumberInput,Xe as OptionAdapter,Xt as Overlay,ii as Panel,Z as Popover,pr as PopoverAnchor,mr as PopoverClose,$ as PopoverContent,dr as PopoverContext,Q as PopoverTrigger,Je as Popup,We as PopupController,en as Portal,ut as PortalContainerContext,ft as PortalContainerProvider,qi as Property,si as RadioGroup,oi as RadioGroupAdapter,ai as RadioGroupItem,di as ResizableHandle,ui as ResizablePanel,ci as ResizablePanelGroup,Hi as RowSkeleton,Rr as SelectBox,Mi as SelectList,yr as SelectionCombobox,fi as Separator,ia as SharedState,xa as SharedValue,Pi as SidePanel,ct as SimpleCombobox,pi as Slider,Yi as Slot,Ki as SortableTableHeaderCell,Li as Spinner,br as StringListCombobox,Ze as StringOptionAdapter,Qe as StringOptionAdapterWithCreate,qt as Styles,Jr as SuccessBox,Me as SvgAvatar,hi as Switch,Ui as TBody,Vi as THead,Wi as TR,Bi as Table,Gi as TableHeaderCell,_i as Tabs,vi as TabsBar,Si as TabsContent,bi as TabsList,yi as TabsPanel,xi as TabsTrigger,zi as TagsInput,wi as Text,Cr as TextCombobox,Ti as Textarea,Di as ThemeProvider,Ei as ThemeProviderContext,Qr as ToastContext,ni as ToastProvider,ht as Tooltip,_t as TooltipContent,mt as TooltipProvider,gt as TooltipTrigger,vt as VTooltip,qr as WarningBox,St as buttonVariants,Ca as cn,ze as computePosition,Ji as createCompositeStateProvider,Ta as errorMessage,$e as getDefaultComboBoxLayout,Ea as insertNewlineAtCursor,Lt as onActivateKey,oa as useClickOutside,it as useComboboxCtrl,Xi as useCompositeState,sa as useCopyToClipboard,ca as useDarkMode,la as useDebounce,ba as useDefaultScrollableSearch,na as useDefineSlot,Nt as useDropZone,da as useEventSource,pa as useFetch,ma as useFetchOnce,ha as useFlag,Zi as useGetCompositeStateProperty,ga as useIntersectionObserver,_a as useIsFirstRendering,Cn as useIsInModal,hr as usePopoverContext,Ke as usePopupController,pt as usePortalContainer,va as useSafeLayoutEffect,ya as useScrollableSearch,Qi as useSetCompositeStateProperty,Sa as useSharedValue,ea as useSlot,Oi as useTheme,Zr as useToast,$i as useWatchCompositeStateProperty,aa as useWatchSharedState,ta as useWatchSlot};
94
+ `,e),...i,children:n})}function Yi({children:e}){return t(`thead`,{className:`sticky top-0 bg-background z-10 after:absolute after:bottom-0 after:start-0 after:w-full after:h-px after:bg-muted/20`,children:e})}function Xi({columns:e}){return t(`tr`,{className:`hover:bg-muted`,children:Array(e).fill(0).map((e,n)=>t(`td`,{children:t(`div`,{className:`animate-pulse rounded-xs h-5 bg-muted`})},`skeleton-cell-${n}`))})}function Zi({isLoading:e=!1,columns:n,rows:r=3,children:i}){let a=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return t(`tbody`,{children:e?a.map(e=>t(Xi,{columns:n},e)):i})}function Qi({className:e,children:n,...i}){return t(`tr`,{className:r(`hover:bg-muted hover:cursor-pointer`,e),...i,children:n})}function $i({scope:e=`col`,children:n,...r}){return t(`th`,{scope:e,...r,children:n})}function ea({sortDirection:e=`none`,onSort:r,sortIndicator:i,disabled:a=!1,children:o,className:s,scope:c=`col`,...l}){return t(`th`,{scope:c,"aria-sort":e,className:s,...l,children:a?n(`span`,{className:`inline-flex items-center gap-1`,children:[o,i?.(e)]}):n(`button`,{type:`button`,onClick:r,className:`inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 text-inherit font-inherit cursor-pointer hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm`,children:[o,i?.(e)]})})}var ta=class{_value;watchers=[];name;constructor(e,t){this._value=e,this.name=t}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function na(e){let t=N.createContext(void 0);return e.Context=t,t.Provider}var ra=class{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e?.(this.current),this}};function ia(e){let t=e.Context;if(!t)throw Error(`Context not defined for ${e.name}`);return ce(t)}function aa(e){let[t,n]=L(e.value);return F(()=>e.watch(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function oa(e,t){return F(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function sa(e,t){F(()=>e.watch(t),[e,t])}function ca(e){let[t,n]=L(e.current);return F(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function la(e,t){F(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function ua(e,t){F(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}var da=class{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(let e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){let e=this.compute();if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}get value(){return this._value}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}dispose(){for(let e of this.unsubscribers)e();this.watchers=[]}},fa=class{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function pa(e){let[t,n]=L(e.value);return F(()=>e.addWatcher(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function ma(e,t){let n=I(null);return F(()=>{let r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},i=window.setTimeout(()=>{document.addEventListener(`click`,r)},0);return()=>{window.clearTimeout(i),document.removeEventListener(`click`,r)}},[e,t]),n}function ha(){let[e,t]=L(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn(`Clipboard not supported`),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn(`Copy failed`,e),t(null),!1}}]}function ga(e){F(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=t=>e(t.matches);return t.addEventListener(`change`,n),e(t.matches),()=>t.removeEventListener(`change`,n)},[e])}function _a(e,t){let[n,r]=L(e);return F(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function va(e,t,n){let r=[],i=new EventSource(e);return i.addEventListener(`message`,e=>{let n=JSON.parse(e.data);n&&(r.push(n),t(r.join(``)))}),i.addEventListener(`close`,e=>{i.close(),n(JSON.parse(e.data))}),()=>{i.close()}}function ya(e,t,n){let r=I(t),i=I(n);r.current=t,i.current=n,F(()=>{let t,n=!1,a=e=>r.current(e),o=e=>i.current(e);return typeof e==`function`?e().then(e=>{n||(t=va(e,a,o))}):t=va(e,a,o),()=>{n=!0,t?.()}},[e])}function ba(e){return e instanceof Error?e:Error(String(e))}function xa(e,t){Array.isArray(t)&&(t={deps:t});let n=t||{},[r,i]=L(void 0),[a,o]=L(!1),[s,c]=L(n.defaultValue),l=I(e);l.current=e;let u=I(n);u.current=n;let d=P(()=>{let e=u.current;return e.start?.(),o(!0),l.current().then(t=>{c(t),e.onSuccess?.(t)}).catch(t=>{let n=ba(t);i(n),e.onError?.(n)}).finally(()=>{o(!1),e.end?.()})},[]);return F(()=>{let e=u.current;(!e.condition||e.condition())&&d()},[d,...n.deps??[]]),{data:s,isLoading:a,error:r,setData:c,refetch:d}}function Sa(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),xa(e,t)}function Ca(e=!1){let[t,n]=L(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function wa(e,t,n={}){let r=I(t);r.current=t;let i=I(n);i.current=n;let a=n.threshold||1;F(()=>{let t=e.current,n=new IntersectionObserver(e=>{let t=e[0].isIntersecting;i.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:a});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,a,...n.deps??[]])}function Ta(){let e=I(!0);return F(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const Ea=typeof window<`u`?ue:F;function Da(e,t=[]){let n=e.pageSize||50,[r,i]=L(null),[a,o]=L(e.payload),[s,c]=L(null),[l,u]=L([]),[d,f]=L(null),[p,m]=L(!1),[h,g]=L(0),_=I(0),v=I(e.search);v.current=e.search;let y=e=>{i(null),u([]),f(null),o(e),g(e=>e+1)},b=()=>{d!==null&&i(d)};return F(()=>{_.current+=1;let e=_.current;m(!0),v.current(a,r,n).then(t=>{e===_.current&&(u(r===null?t.result:e=>[...e,...t.result]),f(t.nextPage),c(null))}).catch(t=>{e===_.current&&c(t)}).finally(()=>{e===_.current&&m(!1)})},[...t,a,h,r,n]),wa(e.nextPageTrigger,()=>{!p&&d&&b()},{threshold:.1,deps:[d,p]}),{search:y,refresh:()=>y(a),searchMore:b,result:l,page:r,hasMore:d!==null,error:s,isSearching:p}}function Oa(e,t=[]){return Da({...e,async search(t,n,r){let i=n??0,a=i*r,o=await e.search(t,a,r);return{result:o,nextPage:o.length===0?null:i+1}}},t)}var ka=class{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}};function Aa(e){return new ka(L(e))}function ja(...e){return ge(i(e))}function Ma(e){return typeof e==`object`&&!!e&&`message`in e}function Na(e,t=`An error occurred`){return e instanceof Error?e.message:typeof e==`string`?e:Ma(e)&&typeof e.message==`string`?e.message:t}function Pa(e,t){let n=e.selectionStart,r=e.selectionEnd,i=e.value,a=`${i.slice(0,n)}\n${i.slice(r)}`;t?.(a),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{mr as AnimateChangeInHeight,Fe as Avatar,Ut as Badge,on as Breadcrumbs,K as Button,hn as Card,yn as CardContent,vn as CardDescription,bn as CardFooter,gn as CardHeader,_n as CardTitle,Le as Center,xn as Checkbox,Sn as Collapsible,wn as CollapsibleContent,Cn as CollapsibleTrigger,it as ComboBox,Vn as Command,Hn as CommandDialog,Gn as CommandEmpty,q as CommandGroup,Un as CommandInput,J as CommandItem,Wn as CommandList,Kn as CommandSeparator,qn as CommandShortcut,da as ComputedProperty,$r as ConfirmModal,Dt as CopyButton,Ze as DOMPopup,xr as DateCombobox,Qr as DefaultBox,oi as DeleteModal,Nn as Dialog,In as DialogClose,Rn as DialogContent,zn as DialogDescription,Ln as DialogOverlay,Fn as DialogPortal,Bn as DialogTitle,Pn as DialogTrigger,pt as Divider,Kt as DotBadge,Nt as DropZone,dr as Dropdown,Yn as DropdownMenu,tr as DropdownMenuCheckboxItem,Qn as DropdownMenuContent,$n as DropdownMenuGroup,er as DropdownMenuItem,ir as DropdownMenuLabel,Xn as DropdownMenuPortal,nr as DropdownMenuRadioGroup,rr as DropdownMenuRadioItem,ar as DropdownMenuSeparator,or as DropdownMenuShortcut,sr as DropdownMenuSub,lr as DropdownMenuSubContent,cr as DropdownMenuSubTrigger,Zn as DropdownMenuTrigger,Ot as EmptyCollection,Jr as ErrorBox,Mt as FileUploadInput,Ir as FilterBar,Fr as FilterBtn,Lr as FilterClear,zr as FilterOperator,Pr as FilterProvider,Bt as FormItem,Br as Heading,Yr as InfoBox,$ as Input,qt as InputList,Kr as Label,Wr as LanguageSwitcher,Jt as Link,fr as MenuGroup,pr as MenuItem,Yt as MenuList,qr as MessageBox,kn as Modal,jn as ModalBody,On as ModalContextProvider,Mn as ModalFooter,An as ModalTitle,Li as ModeOption,Ri as ModeToggle,$t as NumberInput,si as OVERFLOW_TAB_GAP_PX,et as OptionAdapter,ui as OverflowMoreMenu,di as OverflowTabsBar,en as Overlay,fi as Panel,X as Popover,_r as PopoverAnchor,vr as PopoverClose,Q as PopoverContent,hr as PopoverContext,Z as PopoverTrigger,Qe as Popup,Je as PopupController,an as Portal,mt as PortalContainerContext,gt as PortalContainerProvider,ta as Property,hi as RadioGroup,mi as RadioGroupAdapter,pi as RadioGroupItem,yi as ResizableHandle,vi as ResizablePanel,gi as ResizablePanelGroup,Xi as RowSkeleton,Vr as SelectBox,Bi as SelectList,Cr as SelectionCombobox,bi as Separator,fa as SharedState,ka as SharedValue,Hi as SidePanel,ft as SimpleCombobox,xi as Slider,ra as Slot,ea as SortableTableHeaderCell,Gi as Spinner,wr as StringListCombobox,tt as StringOptionAdapter,nt as StringOptionAdapterWithCreate,Zt as Styles,Zr as SuccessBox,Ie as SvgAvatar,Ci as Switch,Zi as TBody,Yi as THead,Qi as TR,Ji as Table,$i as TableHeaderCell,Ti as Tabs,Ei as TabsBar,Ai as TabsContent,Oi as TabsList,Di as TabsPanel,ki as TabsTrigger,qi as TagsInput,Mi as Text,Er as TextCombobox,Ni as Textarea,Fi as ThemeProvider,Pi as ThemeProviderContext,ti as ToastContext,ai as ToastProvider,yt as Tooltip,xt as TooltipContent,vt as TooltipProvider,bt as TooltipTrigger,St as VTooltip,Xr as WarningBox,Et as buttonVariants,ja as cn,Ue as computePosition,na as createCompositeStateProvider,Na as errorMessage,rt as getDefaultComboBoxLayout,Pa as insertNewlineAtCursor,Vt as onActivateKey,ma as useClickOutside,ct as useComboboxCtrl,ia as useCompositeState,ha as useCopyToClipboard,ga as useDarkMode,_a as useDebounce,Oa as useDefaultScrollableSearch,ua as useDefineSlot,Lt as useDropZone,ya as useEventSource,xa as useFetch,Sa as useFetchOnce,Ca as useFlag,aa as useGetCompositeStateProperty,wa as useIntersectionObserver,Ta as useIsFirstRendering,Dn as useIsInModal,li as useOverflowTabs,yr as usePopoverContext,Xe as usePopupController,_t as usePortalContainer,Ea as useSafeLayoutEffect,Da as useScrollableSearch,oa as useSetCompositeStateProperty,Aa as useSharedValue,ca as useSlot,Ii as useTheme,ei as useToast,sa as useWatchCompositeStateProperty,pa as useWatchSharedState,la as useWatchSlot};
95
95
  //# sourceMappingURL=vertesia-ui-core.js.map