@vertesia/ui 1.4.0-dev.20260615.042549Z → 1.4.0-dev.20260629.130134Z

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 (337) hide show
  1. package/lib/core/components/shadcn/dropdown.d.ts.map +1 -1
  2. package/lib/core/components/shadcn/dropdown.js +6 -2
  3. package/lib/core/components/shadcn/dropdown.js.map +1 -1
  4. package/lib/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
  5. package/lib/core/components/shadcn/filters/filterBar.js +9 -2
  6. package/lib/core/components/shadcn/filters/filterBar.js.map +1 -1
  7. package/lib/core/components/shadcn/modal/ConfirmModal.d.ts +16 -1
  8. package/lib/core/components/shadcn/modal/ConfirmModal.d.ts.map +1 -1
  9. package/lib/core/components/shadcn/modal/ConfirmModal.js +25 -3
  10. package/lib/core/components/shadcn/modal/ConfirmModal.js.map +1 -1
  11. package/lib/core/components/shadcn/modal/dialog.js +1 -1
  12. package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
  13. package/lib/core/components/shadcn/popover.d.ts.map +1 -1
  14. package/lib/core/components/shadcn/popover.js +3 -1
  15. package/lib/core/components/shadcn/popover.js.map +1 -1
  16. package/lib/core/components/shadcn/switch.js +3 -3
  17. package/lib/core/components/shadcn/switch.js.map +1 -1
  18. package/lib/core/components/shadcn/tabs.js +1 -1
  19. package/lib/core/components/shadcn/tabs.js.map +1 -1
  20. package/lib/core/components/shadcn/tooltip.d.ts.map +1 -1
  21. package/lib/core/components/shadcn/tooltip.js +3 -1
  22. package/lib/core/components/shadcn/tooltip.js.map +1 -1
  23. package/lib/env/index.d.ts +0 -19
  24. package/lib/env/index.d.ts.map +1 -1
  25. package/lib/env/index.js +0 -6
  26. package/lib/env/index.js.map +1 -1
  27. package/lib/features/agent/PayloadBuilder.d.ts +4 -0
  28. package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
  29. package/lib/features/agent/PayloadBuilder.js +16 -0
  30. package/lib/features/agent/PayloadBuilder.js.map +1 -1
  31. package/lib/features/agent/chat/AgentApprovalModeSelector.d.ts +10 -0
  32. package/lib/features/agent/chat/AgentApprovalModeSelector.d.ts.map +1 -0
  33. package/lib/features/agent/chat/AgentApprovalModeSelector.js +50 -0
  34. package/lib/features/agent/chat/AgentApprovalModeSelector.js.map +1 -0
  35. package/lib/features/agent/chat/AgentChatFixtureReplay.d.ts +2 -1
  36. package/lib/features/agent/chat/AgentChatFixtureReplay.d.ts.map +1 -1
  37. package/lib/features/agent/chat/AgentChatFixtureReplay.js +3 -3
  38. package/lib/features/agent/chat/AgentChatFixtureReplay.js.map +1 -1
  39. package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts +5 -2
  40. package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
  41. package/lib/features/agent/chat/AgentRequestInputOverlay.js +41 -7
  42. package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
  43. package/lib/features/agent/chat/AgentRightPanel.d.ts.map +1 -1
  44. package/lib/features/agent/chat/AgentRightPanel.js +133 -12
  45. package/lib/features/agent/chat/AgentRightPanel.js.map +1 -1
  46. package/lib/features/agent/chat/AnimatedThinkingDots.js +1 -1
  47. package/lib/features/agent/chat/AnimatedThinkingDots.js.map +1 -1
  48. package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
  49. package/lib/features/agent/chat/ArtifactsTab.js +11 -65
  50. package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
  51. package/lib/features/agent/chat/AskUserWidget.d.ts +3 -1
  52. package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
  53. package/lib/features/agent/chat/AskUserWidget.js +4 -3
  54. package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
  55. package/lib/features/agent/chat/ModernAgentConversation.d.ts +10 -2
  56. package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  57. package/lib/features/agent/chat/ModernAgentConversation.js +526 -117
  58. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  59. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.d.ts +8 -0
  60. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.d.ts.map +1 -0
  61. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js +19 -0
  62. package/lib/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.js.map +1 -0
  63. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +8 -2
  64. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  65. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +551 -92
  66. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  67. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.d.ts.map +1 -1
  68. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js +7 -6
  69. package/lib/features/agent/chat/ModernAgentOutput/AttachmentPreview.js.map +1 -1
  70. package/lib/features/agent/chat/ModernAgentOutput/Header.js +2 -2
  71. package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  72. package/lib/features/agent/chat/ModernAgentOutput/MessageDeliveryStatus.d.ts +8 -0
  73. package/lib/features/agent/chat/ModernAgentOutput/MessageDeliveryStatus.d.ts.map +1 -0
  74. package/lib/features/agent/chat/ModernAgentOutput/MessageDeliveryStatus.js +61 -0
  75. package/lib/features/agent/chat/ModernAgentOutput/MessageDeliveryStatus.js.map +1 -0
  76. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +15 -2
  77. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
  78. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +28 -38
  79. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  80. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +1 -1
  81. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  82. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +3 -2
  83. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  84. package/lib/features/agent/chat/ModernAgentOutput/SlideInPanel.js +2 -1
  85. package/lib/features/agent/chat/ModernAgentOutput/SlideInPanel.js.map +1 -1
  86. package/lib/features/agent/chat/ModernAgentOutput/SlidingMessages.js +1 -1
  87. package/lib/features/agent/chat/ModernAgentOutput/SlidingMessages.js.map +1 -1
  88. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts +5 -0
  89. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts.map +1 -1
  90. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js +59 -4
  91. package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js.map +1 -1
  92. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +2 -2
  93. package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
  94. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts +9 -0
  95. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts.map +1 -1
  96. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js +180 -0
  97. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js.map +1 -1
  98. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts +6 -0
  99. package/lib/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -1
  100. package/lib/features/agent/chat/ModernAgentOutput/utils.js +92 -2
  101. package/lib/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
  102. package/lib/features/agent/chat/clipboardFiles.d.ts +15 -0
  103. package/lib/features/agent/chat/clipboardFiles.d.ts.map +1 -0
  104. package/lib/features/agent/chat/clipboardFiles.js +35 -0
  105. package/lib/features/agent/chat/clipboardFiles.js.map +1 -0
  106. package/lib/features/agent/chat/hooks/useAgentStream.d.ts +6 -0
  107. package/lib/features/agent/chat/hooks/useAgentStream.d.ts.map +1 -1
  108. package/lib/features/agent/chat/hooks/useAgentStream.js +218 -37
  109. package/lib/features/agent/chat/hooks/useAgentStream.js.map +1 -1
  110. package/lib/features/agent/chat/hooks/useArtifacts.d.ts +1 -8
  111. package/lib/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -1
  112. package/lib/features/agent/chat/hooks/useArtifacts.js +10 -28
  113. package/lib/features/agent/chat/hooks/useArtifacts.js.map +1 -1
  114. package/lib/features/agent/chat/index.d.ts +2 -1
  115. package/lib/features/agent/chat/index.d.ts.map +1 -1
  116. package/lib/features/agent/chat/index.js +2 -1
  117. package/lib/features/agent/chat/index.js.map +1 -1
  118. package/lib/features/agent/chat/workstreams.d.ts +1 -0
  119. package/lib/features/agent/chat/workstreams.d.ts.map +1 -1
  120. package/lib/features/agent/chat/workstreams.js +28 -0
  121. package/lib/features/agent/chat/workstreams.js.map +1 -1
  122. package/lib/features/facets/AgentRunnerFacetsNav.d.ts +10 -1
  123. package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
  124. package/lib/features/facets/AgentRunnerFacetsNav.js +6 -3
  125. package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
  126. package/lib/features/facets/CollectionsFacetsNav.d.ts +10 -1
  127. package/lib/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
  128. package/lib/features/facets/CollectionsFacetsNav.js +14 -5
  129. package/lib/features/facets/CollectionsFacetsNav.js.map +1 -1
  130. package/lib/features/facets/PromptsFacetsNav.d.ts +10 -1
  131. package/lib/features/facets/PromptsFacetsNav.d.ts.map +1 -1
  132. package/lib/features/facets/PromptsFacetsNav.js +14 -5
  133. package/lib/features/facets/PromptsFacetsNav.js.map +1 -1
  134. package/lib/features/facets/RunsFacetsNav.d.ts +10 -1
  135. package/lib/features/facets/RunsFacetsNav.d.ts.map +1 -1
  136. package/lib/features/facets/RunsFacetsNav.js +14 -5
  137. package/lib/features/facets/RunsFacetsNav.js.map +1 -1
  138. package/lib/features/index.d.ts +0 -1
  139. package/lib/features/index.d.ts.map +1 -1
  140. package/lib/features/index.js +0 -1
  141. package/lib/features/index.js.map +1 -1
  142. package/lib/features/oauth/McpConnectionsButton.d.ts +30 -0
  143. package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -0
  144. package/lib/features/oauth/McpConnectionsButton.js +70 -0
  145. package/lib/features/oauth/McpConnectionsButton.js.map +1 -0
  146. package/lib/features/oauth/McpConnectionsDialog.d.ts +25 -0
  147. package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -0
  148. package/lib/features/oauth/McpConnectionsDialog.js +26 -0
  149. package/lib/features/oauth/McpConnectionsDialog.js.map +1 -0
  150. package/lib/features/oauth/RemoteMcpConnectionButton.d.ts.map +1 -1
  151. package/lib/features/oauth/RemoteMcpConnectionButton.js +14 -6
  152. package/lib/features/oauth/RemoteMcpConnectionButton.js.map +1 -1
  153. package/lib/features/oauth/index.d.ts +3 -0
  154. package/lib/features/oauth/index.d.ts.map +1 -1
  155. package/lib/features/oauth/index.js +3 -0
  156. package/lib/features/oauth/index.js.map +1 -1
  157. package/lib/features/oauth/useMcpConnections.d.ts +44 -0
  158. package/lib/features/oauth/useMcpConnections.d.ts.map +1 -0
  159. package/lib/features/oauth/useMcpConnections.js +168 -0
  160. package/lib/features/oauth/useMcpConnections.js.map +1 -0
  161. package/lib/features/permissions/UserPermissionsProvider.d.ts +4 -6
  162. package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
  163. package/lib/features/permissions/UserPermissionsProvider.js +40 -42
  164. package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
  165. package/lib/features/store/objects/DocumentPreviewPanel.d.ts.map +1 -1
  166. package/lib/features/store/objects/DocumentPreviewPanel.js +2 -1
  167. package/lib/features/store/objects/DocumentPreviewPanel.js.map +1 -1
  168. package/lib/features/store/objects/DocumentQuickFilter.d.ts +23 -0
  169. package/lib/features/store/objects/DocumentQuickFilter.d.ts.map +1 -0
  170. package/lib/features/store/objects/DocumentQuickFilter.js +30 -0
  171. package/lib/features/store/objects/DocumentQuickFilter.js.map +1 -0
  172. package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  173. package/lib/features/store/objects/DocumentSearchResults.js +17 -1
  174. package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
  175. package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  176. package/lib/features/store/objects/components/ContentOverview.js +17 -74
  177. package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
  178. package/lib/features/store/objects/layout/DocumentTableColumn.d.ts +7 -1
  179. package/lib/features/store/objects/layout/DocumentTableColumn.d.ts.map +1 -1
  180. package/lib/features/store/objects/layout/DocumentTableColumn.js +27 -3
  181. package/lib/features/store/objects/layout/DocumentTableColumn.js.map +1 -1
  182. package/lib/features/store/objects/layout/documentLayout.js +1 -1
  183. package/lib/features/store/objects/layout/renderers.d.ts +2 -1
  184. package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
  185. package/lib/features/store/objects/layout/renderers.js +27 -20
  186. package/lib/features/store/objects/layout/renderers.js.map +1 -1
  187. package/lib/features/store/types/ContentObjectTypesSearch.d.ts.map +1 -1
  188. package/lib/features/store/types/ContentObjectTypesSearch.js +4 -1
  189. package/lib/features/store/types/ContentObjectTypesSearch.js.map +1 -1
  190. package/lib/features/store/types/ContentObjectTypesTable.d.ts +2 -1
  191. package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
  192. package/lib/features/store/types/ContentObjectTypesTable.js +8 -3
  193. package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
  194. package/lib/i18n/instance.d.ts.map +1 -1
  195. package/lib/i18n/instance.js +1 -0
  196. package/lib/i18n/instance.js.map +1 -1
  197. package/lib/i18n/locales/ar.json +72 -45
  198. package/lib/i18n/locales/de.json +65 -34
  199. package/lib/i18n/locales/en.json +63 -47
  200. package/lib/i18n/locales/es.json +65 -35
  201. package/lib/i18n/locales/fr.json +65 -35
  202. package/lib/i18n/locales/it.json +72 -42
  203. package/lib/i18n/locales/ja.json +72 -41
  204. package/lib/i18n/locales/ko.json +72 -41
  205. package/lib/i18n/locales/pt.json +72 -42
  206. package/lib/i18n/locales/ru.json +72 -43
  207. package/lib/i18n/locales/tr.json +72 -41
  208. package/lib/i18n/locales/zh-TW.json +72 -41
  209. package/lib/i18n/locales/zh.json +72 -41
  210. package/lib/session/UserSession.d.ts +0 -6
  211. package/lib/session/UserSession.d.ts.map +1 -1
  212. package/lib/session/UserSession.js +0 -15
  213. package/lib/session/UserSession.js.map +1 -1
  214. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  215. package/lib/session/UserSessionProvider.js +39 -98
  216. package/lib/session/UserSessionProvider.js.map +1 -1
  217. package/lib/session/auth/composable.d.ts.map +1 -1
  218. package/lib/session/auth/composable.js +3 -33
  219. package/lib/session/auth/composable.js.map +1 -1
  220. package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
  221. package/lib/shell/login/SignInPrimitives.js +3 -2
  222. package/lib/shell/login/SignInPrimitives.js.map +1 -1
  223. package/lib/vertesia-ui-core.js +1 -1
  224. package/lib/vertesia-ui-core.js.map +1 -1
  225. package/lib/vertesia-ui-env.js +1 -1
  226. package/lib/vertesia-ui-env.js.map +1 -1
  227. package/lib/vertesia-ui-features.js +1 -1
  228. package/lib/vertesia-ui-features.js.map +1 -1
  229. package/lib/vertesia-ui-i18n.js +1 -1
  230. package/lib/vertesia-ui-i18n.js.map +1 -1
  231. package/lib/vertesia-ui-session.js +1 -1
  232. package/lib/vertesia-ui-session.js.map +1 -1
  233. package/lib/vertesia-ui-shell.js +1 -1
  234. package/lib/vertesia-ui-shell.js.map +1 -1
  235. package/lib/vertesia-ui-widgets.js +1 -1
  236. package/lib/vertesia-ui-widgets.js.map +1 -1
  237. package/lib/widgets/schema-editor/editor/Editable.js +1 -1
  238. package/lib/widgets/schema-editor/editor/Editable.js.map +1 -1
  239. package/llms.txt +70 -70
  240. package/package.json +35 -32
  241. package/src/core/components/shadcn/dropdown.tsx +2 -0
  242. package/src/core/components/shadcn/filters/filterBar.tsx +9 -2
  243. package/src/core/components/shadcn/modal/ConfirmModal.tsx +65 -3
  244. package/src/core/components/shadcn/modal/dialog.tsx +1 -1
  245. package/src/core/components/shadcn/popover.tsx +1 -0
  246. package/src/core/components/shadcn/switch.tsx +4 -4
  247. package/src/core/components/shadcn/tabs.tsx +1 -1
  248. package/src/core/components/shadcn/tooltip.tsx +1 -0
  249. package/src/env/index.ts +0 -24
  250. package/src/features/agent/PayloadBuilder.tsx +18 -0
  251. package/src/features/agent/chat/AgentApprovalModeSelector.tsx +130 -0
  252. package/src/features/agent/chat/AgentChatFixtureReplay.test.tsx +22 -2
  253. package/src/features/agent/chat/AgentChatFixtureReplay.tsx +33 -27
  254. package/src/features/agent/chat/AgentRequestInputOverlay.test.tsx +122 -0
  255. package/src/features/agent/chat/AgentRequestInputOverlay.tsx +91 -17
  256. package/src/features/agent/chat/AgentRightPanel.tsx +238 -50
  257. package/src/features/agent/chat/AnimatedThinkingDots.tsx +1 -1
  258. package/src/features/agent/chat/ArtifactsTab.tsx +21 -155
  259. package/src/features/agent/chat/AskUserWidget.tsx +6 -2
  260. package/src/features/agent/chat/ModernAgentConversation.test.tsx +1157 -47
  261. package/src/features/agent/chat/ModernAgentConversation.tsx +703 -136
  262. package/src/features/agent/chat/ModernAgentOutput/ActiveWorkstreamsSummary.tsx +74 -0
  263. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +1420 -126
  264. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +934 -111
  265. package/src/features/agent/chat/ModernAgentOutput/AttachmentPreview.tsx +31 -40
  266. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +28 -28
  267. package/src/features/agent/chat/ModernAgentOutput/MessageDeliveryStatus.tsx +83 -0
  268. package/src/features/agent/chat/ModernAgentOutput/MessageInput.test.tsx +38 -2
  269. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +121 -98
  270. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +7 -1
  271. package/src/features/agent/chat/ModernAgentOutput/SlideInPanel.tsx +3 -3
  272. package/src/features/agent/chat/ModernAgentOutput/SlidingMessages.tsx +1 -1
  273. package/src/features/agent/chat/ModernAgentOutput/SummaryConversation.ts +82 -2
  274. package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +2 -2
  275. package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.ts +216 -0
  276. package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +149 -0
  277. package/src/features/agent/chat/ModernAgentOutput/utils.ts +103 -2
  278. package/src/features/agent/chat/clipboardFiles.ts +33 -0
  279. package/src/features/agent/chat/hooks/useAgentStream.test.tsx +355 -4
  280. package/src/features/agent/chat/hooks/useAgentStream.ts +270 -43
  281. package/src/features/agent/chat/hooks/useArtifacts.ts +11 -44
  282. package/src/features/agent/chat/index.ts +10 -1
  283. package/src/features/agent/chat/workstreams.ts +42 -0
  284. package/src/features/facets/AgentRunnerFacetsNav.tsx +23 -3
  285. package/src/features/facets/CollectionsFacetsNav.tsx +30 -5
  286. package/src/features/facets/PromptsFacetsNav.tsx +30 -5
  287. package/src/features/facets/RunsFacetsNav.tsx +32 -5
  288. package/src/features/index.ts +0 -1
  289. package/src/features/oauth/McpConnectionsButton.test.tsx +248 -0
  290. package/src/features/oauth/McpConnectionsButton.tsx +269 -0
  291. package/src/features/oauth/McpConnectionsDialog.tsx +142 -0
  292. package/src/features/oauth/RemoteMcpConnectionButton.tsx +37 -14
  293. package/src/features/oauth/index.ts +3 -0
  294. package/src/features/oauth/useMcpConnections.test.ts +94 -0
  295. package/src/features/oauth/useMcpConnections.ts +210 -0
  296. package/src/features/permissions/UserPermissionsProvider.tsx +41 -59
  297. package/src/features/store/objects/DocumentPreviewPanel.tsx +4 -2
  298. package/src/features/store/objects/DocumentQuickFilter.tsx +72 -0
  299. package/src/features/store/objects/DocumentSearchResults.tsx +30 -11
  300. package/src/features/store/objects/components/ContentOverview.tsx +30 -99
  301. package/src/features/store/objects/layout/DocumentTableColumn.tsx +29 -4
  302. package/src/features/store/objects/layout/documentLayout.tsx +1 -1
  303. package/src/features/store/objects/layout/renderers.tsx +80 -20
  304. package/src/features/store/types/ContentObjectTypesSearch.tsx +7 -1
  305. package/src/features/store/types/ContentObjectTypesTable.tsx +34 -4
  306. package/src/i18n/instance.ts +1 -0
  307. package/src/i18n/locales/ar.json +72 -45
  308. package/src/i18n/locales/de.json +65 -34
  309. package/src/i18n/locales/en.json +63 -47
  310. package/src/i18n/locales/es.json +65 -35
  311. package/src/i18n/locales/fr.json +65 -35
  312. package/src/i18n/locales/it.json +72 -42
  313. package/src/i18n/locales/ja.json +72 -41
  314. package/src/i18n/locales/ko.json +72 -41
  315. package/src/i18n/locales/pt.json +72 -42
  316. package/src/i18n/locales/ru.json +72 -43
  317. package/src/i18n/locales/tr.json +72 -41
  318. package/src/i18n/locales/zh-TW.json +72 -41
  319. package/src/i18n/locales/zh.json +72 -41
  320. package/src/i18n/rtl.test.ts +57 -1
  321. package/src/session/UserSession.ts +0 -16
  322. package/src/session/UserSessionProvider.tsx +51 -123
  323. package/src/session/auth/composable.ts +3 -34
  324. package/src/shell/login/SignInPrimitives.tsx +3 -2
  325. package/src/widgets/schema-editor/editor/Editable.tsx +1 -1
  326. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts +0 -73
  327. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +0 -1
  328. package/lib/features/document-viewer/UniversalDocumentViewer.js +0 -415
  329. package/lib/features/document-viewer/UniversalDocumentViewer.js.map +0 -1
  330. package/lib/features/document-viewer/index.d.ts +0 -2
  331. package/lib/features/document-viewer/index.d.ts.map +0 -1
  332. package/lib/features/document-viewer/index.js +0 -2
  333. package/lib/features/document-viewer/index.js.map +0 -1
  334. package/src/features/document-viewer/UniversalDocumentViewer.test.tsx +0 -123
  335. package/src/features/document-viewer/UniversalDocumentViewer.tsx +0 -746
  336. package/src/features/document-viewer/index.ts +0 -1
  337. package/src/session/auth/composable.test.ts +0 -79
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{clsx as a}from"clsx";import{ChevronUpIcon as i,ChevronDownIcon as s,XIcon as l,Loader2 as o,Check as c,CopyIcon as d,Plus as u,Info as m,X as p,ChevronRight as h,MoreHorizontal as f,Search as g,CheckIcon as v,ChevronRightIcon as x,ListFilter as b,LoaderCircle as y,AlertTriangle as w,ChevronsUpDown as N,SearchIcon as k,SquarePlus as C,CircleCheck as _,CircleX as z,TriangleAlert as I,ChevronDown as T,ChevronUp as R,Minus as M,Computer as O,Sun as S,Moon as $}from"lucide-react";import*as L from"react";import D,{createContext as A,useRef as E,useState as P,useEffect as j,useContext as F,useId as V,Children as Y,isValidElement as B,Fragment as H,cloneElement as W,forwardRef as U,useMemo as G,useCallback as K,useLayoutEffect as q}from"react";import{createPortal as J}from"react-dom";import{Slot as X}from"@radix-ui/react-slot";import{useUITranslation as Q,useLanguage as Z,SUPPORTED_LANGUAGES as ee}from"@vertesia/ui/i18n";import{cva as te}from"class-variance-authority";import{twMerge as ne}from"tailwind-merge";import*as re from"@radix-ui/react-tooltip";import{Env as ae}from"@vertesia/ui/env";import{motion as ie,AnimatePresence as se}from"framer-motion";import*as le from"@radix-ui/react-checkbox";import*as oe from"@radix-ui/react-collapsible";import{Command as ce}from"cmdk";import*as de from"@radix-ui/react-dialog";import*as ue from"@radix-ui/react-dropdown-menu";import me from"dayjs";import pe from"react-calendar";import*as he from"@radix-ui/react-popover";import{isEqual as fe}from"lodash-es";import*as ge from"@radix-ui/react-label";import*as ve from"@radix-ui/react-radio-group";import*as xe from"react-resizable-panels";import*as be from"@radix-ui/react-separator";import*as ye from"@radix-ui/react-slider";import*as we from"@radix-ui/react-switch";import*as Ne from"@radix-ui/react-tabs";function ke(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 new Error(`Unexpected size: ${e}`)}}function Ce({size:t,src:n,name:r,shape:a="circle",color:i="bg-gray-500",className:s}){const l="circle"===a?"rounded-full":"rounded-md",o=ke(t||"md");if(n)return e("img",{className:`inline-block ${o} ${l} ${i} ${s}`,src:n,alt:r||n,title:r});if(r){const[n,a]=r.split(" "),c=a?`${n[0]}${a[0]}`:`${n[0]}${n[1]}`;return e("span",{className:`inline-flex ${o} items-center justify-center ${l} ${i} ${s}`,title:r,children:e("span",{className:("xs"!==t?"text-xs":"text-[0.6rem]")+" font-medium leading-none text-white",children:c})})}return e("span",{className:`inline-block ${o} overflow-hidden ${l} ${i}`,children:e("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e("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 _e({size:t,shape:n="circle",color:r="bg-gray-500",className:a,children:i}){const s="circle"===n?"rounded-full":"rounded-md",l=ke(t||"md");return e("span",{className:`inline-block ${l} overflow-hidden ${s} ${r} ${a}`,children:i})}function ze({className:t,children:n}){return e("div",{className:r("flex items-center justify-center",t),children:n})}class Ie{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":"x"===this.alignAxis?this.left=t.left:this.top=t.top;break;case"end":"x"===this.alignAxis?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case"center":"x"===this.alignAxis?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case"fill":"x"===this.alignAxis?(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 new Error("Invalid position. Cannot compute x,y coordinates");const r=null!=this.width,a=null!=this.height,i=r?this.width:t.width,s=a?this.height:t.height;return{rect:new DOMRect(this.left,this.top,i,s),constrainWidth:r,constrainHeight:a,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){const t=function(e){switch(e){case"start":return"end";case"end":return"start";default:return e}}(e.align);if(t!==e.align)return{...e,align:t}}}else{const t=function(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}}(e.position);if(t!==e.position)return{...e,position:t}}return null}}function Te(e,t,n){return"x"===n?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n,r){const a=new Ie(e.gap);let i=a.computePosition(e,t,n);const s=Te(i.rect,r,"x"),l=Te(i.rect,r,"y");if(s&&l)return i;let o=null;return s||(o=a.flipAxis(e,"x")),l||(o=a.flipAxis(o||e,"y")),o?(i=new Ie(a.gap).computePosition(o,t,n),function(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}(i.rect,r)?i:null):null}function Me(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),i=Math.min(e.bottom,t.bottom);return a<=n||i<=r?null:new DOMRect(n,r,a-n,i-r)}function Oe(e){const t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){const r=getComputedStyle(e);if(t&&"visible"!==r.overflowY||n&&"visible"!==r.overflowX)return!0}return!1}class Se{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=function(e,t=document.documentElement){const n=[];let r=e.parentElement;for(;r&&r!==t;)Oe(r)&&n.push(r),r=r.parentElement;return n.push(t),n}(this.anchor,this.root),this.visibleClientRect=function(e){if(0===e.length)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Me(e[n].getBoundingClientRect(),t),!t)return null;return t}(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){const t=this.scrollableParents,n=()=>{this.update()};window.addEventListener("resize",n);for(const e of t)e.addEventListener("scroll",n);let r,a;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener("click",r)},0)),this.options.closeOnEsc&&(a=e=>{"Escape"===e.key&&this.tryClose()},window.setTimeout(()=>{a&&document.addEventListener("keydown",a)},0));const i=this.options.blockPageScroll;return i&&(document.body.style.overflow="hidden",document.body.style.height="100%"),()=>{window.removeEventListener("resize",n);for(const e of t)e.removeEventListener("scroll",n);r&&document.removeEventListener("click",r),a&&document.removeEventListener("keydown",a),i&&(document.body.style.overflow="",document.body.style.height="")}}open(e,t){if(this.context)throw new 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 new 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",this.context=void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;const e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),a=this.visibleClientRect;if(!a)return;const i=Re(t,n,r,a);this.context.position=i||void 0,i&&(i.constrainHeight&&(e.style.height=`${i.rect.height}px`),i.constrainWidth&&(e.style.width=`${i.rect.width}px`),e.style.left=`${i.rect.left}px`,e.style.top=`${i.rect.top}px`,e.style.visibility="visible")}createPopupElement(){const 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 $e=A(void 0);function Le(){const e=F($e);if(!e)throw new Error("usePopupController must be used inside a Popup component");return e}function De({ctrlRef:t,id:n,constraints:r,isOpen:a,children:i,className:s,onClose:l,onOpen:o,zIndex:c,position:d,anchor:u,root:m,closeOnClick:p,closeOnEsc:h,blockPageScroll:f}){const g=E(null),[v,x]=P(),b=E(l),y=E(o);return b.current=l,y.current=o,j(()=>{if(!u)throw new Error("Anchor element is required");const e=new Se({anchor:u,root:m,closeOnClick:p,closeOnEsc:h,blockPageScroll:f,onClose:()=>b.current?.(),onOpen:()=>y.current?.()});return x(e),()=>{e.tryClose()}},[u,f,p,h,m]),j(()=>{t&&(t.current=v)},[v,t]),j(()=>{v&&g.current?v.isOpen!==a&&(a?v.open(g.current,r):v.close()):v?.isOpen&&!a&&v.close()},[r,a,v]),e($e.Provider,{value:v,children:a&&J(e("div",{id:n,style:{visibility:"hidden",position:d||"absolute",zIndex:c||100},ref:g,className:s,children:i}),document.body)})}function Ae({anchor:t,root:n,children:r,...a}){return!t.current||n&&!n.current?null:e(De,{anchor:t.current,root:n?.current||void 0,...a,children:r})}class Ee{filter(e,t){const 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}}class Pe extends Ee{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new Pe}class je extends Pe{createItem(e){return e}static instance=new je}function Fe(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:Ye,Menu:He,Toggle:Be}}function Ve({menuAlign:r="fill",menuGap:a,focusOnMount:i,onSelect:s,value:l,zIndex:o,unstyledInput:c,fullWidth:d,api:u,layout:m,adapter:p,items:h,placeholder:f,clearable:g,noMatchMessage:v,openOnFocus:x}){const[b]=P(`combobox-popup-${Math.floor(1e6*Math.random())}`),y=E(void 0),w=E(null),N=m?Object.assign(Fe(d,c),m):Fe(d,c),k=D.useRef(null),C=We({adapter:p,items:h,value:l,popupId:b});j(()=>{w.current&&i&&w.current.focus()},[i]),j(()=>{C.onSelect=s,C.popupCtrl=y.current},[C,s]),j(()=>{if(u&&C&&w.current)return u.current={open:()=>C.openMenu(),close:()=>C.closeMenu(),toggle:()=>C.toggleMenu(),setInputValue:e=>C.inputText=e,inputValue:C.inputText||"",selectedItem:C.selectedItem,focus:()=>w.current?.focus()},()=>{u.current=null}},[u,C]);const _=C.isMenuOpen&&(C.filteredItems.length>0||!!v);return t(n,{children:[e(N.Input,{boxRef:k,inputRef:w,ctrl:C,layout:N,placeholder:f,clearable:g,openOnFocus:x}),e(Ae,{id:b,ctrlRef:y,className:"combobox-popup",closeOnClick:!0,closeOnEsc:!0,onClose:()=>C.closeMenu(),isOpen:_,anchor:k,zIndex:o,constraints:{position:"bottom",align:r,gap:null!=a?a:4},children:e(N.Menu,{fillWidth:"fill"===r,items:C.filteredItems,ctrl:C,layout:N,adapter:p,noMatchMessage:v})})]})}function Ye({inputRef:n,placeholder:r,boxRef:a,ctrl:i,layout:s,clearable:o,openOnFocus:c}){const d=s.Toggle,u=o&&null!=i.selectedItem,m=(d?1:0)+(u?1:0),p=m>0?{paddingRight:`${s.buttonWidth*m+s.buttonRight}px`}:void 0;return t("div",{className:"relative",ref:a,children:[e("input",{ref:n,placeholder:r,...i.getInputProps(),onFocus:c?()=>i.openMenu():void 0,style:p,className:s.inputClass}),t("div",{style:{position:"absolute",right:`${s.buttonRight}px`,top:0,bottom:0,display:"flex",alignItems:"center",gap:"2px"},children:[u&&e("button",{type:"button",style:{border:"none",padding:0,margin:0,backgroundColor:"transparent",cursor:"pointer",display:"flex",alignItems:"center",width:`${s.buttonWidth}px`},onClick:()=>{i.selectedItem=null},children:e(l,{className:"w-4 h-4"})}),d&&e("button",{type:"button",style:{width:`${s.buttonWidth}px`,border:"none",padding:0,margin:0,backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},...i.getToggleButtonProps(),children:e(d,{ctrl:i,layout:s})})]})]})}function Be({ctrl:t}){return t.isMenuOpen?e(i,{className:"w-4 h-4"}):e(s,{className:"w-4 h-4"})}function He({fillWidth:t,items:n,layout:a,ctrl:i,adapter:s,noMatchMessage:l}){const{highlightedIndex:o,selectedItem:c}=i;return 0===n.length?l?e("div",{style:{width:t?"100%":void 0},className:a.menuClass,children:l}):null:e("ul",{style:{width:t?"100%":void 0,maxHeight:a.maxMenuHeight?`${a.maxMenuHeight}px`:"240px"},className:a.menuClass,...i.getMenuProps(),children:n.map((t,n)=>e("li",{"data-index":n,className:r(a.optionClass,o===n&&"option-highlighted",c===t&&"option-selected"),...i.getItemProps(t,n),children:s.renderOption(t)},s.idOf(t)))})}function We(e){const[t,n]=P(new Ue(e));return j(()=>{t?.withState(n)},[t]),t}class Ue{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,"string"==typeof n?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(){const e=new Ue({adapter:this.adapter,items:this.items,popupId:this.popupId});return e.setState=this.setState,e.onSelect=this.onSelect,e._inputText=this._inputText,e._highlightedIndex=this._highlightedIndex,e._selectedItem=this._selectedItem,e._isMenuOpen=this._isMenuOpen,e._filteredItems=this._filteredItems,e.popupCtrl=this.popupCtrl,e}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){const e=this.popupCtrl,t=e.context?.position?.position;t&&"top"===t&&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;const 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(){const e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{const t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{const n=t.key;if("Enter"===n){if(null!=this.highlightedIndex)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){const e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else"ArrowDown"===n?this.isMenuOpen?this.highlightIndex(null===this.highlightedIndex?0:(r=this.highlightedIndex,a=e.length,(r+1)%a),!1):this.openMenu():"ArrowUp"===n&&this.isMenuOpen&&this.highlightIndex(null===this.highlightedIndex?0:function(e,t){return(e-1+t)%t}(this.highlightedIndex,e.length),!0);var r,a}}}}function Ge({options:t,creatable:n,...r}){return e(Ve,{adapter:n?je.instance:Pe.instance,items:t,...r})}function Ke({className:t}){return e("hr",{className:r("w-full h-0.5 border-t-0 bg-border",t)})}function qe(...e){return ne(a(e))}const Je=D.createContext(void 0);function Xe({children:t,id:n="plugin-portal-container"}){const r=D.useContext(Je),a=D.useRef(null),[i,s]=D.useState(r||void 0);return D.useEffect(()=>{if(r)s(r);else if(a.current){const e=a.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){const t=function(e,t="plugin-portal-container"){const n=e instanceof Document?e.body:e;for(const e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;const r=document.createElement("div");return r.id=t,n.appendChild(r),r}(e,n);s(t)}else s(null)}},[n,r]),void 0===i?e("div",{ref:a,style:{display:"none"}}):e(Je.Provider,{value:i||void 0,children:t})}function Qe(){return D.useContext(Je)}const Ze=re.Provider,et=re.Root,tt=re.Trigger,nt=L.forwardRef(({className:t,sideOffset:n=4,side:r="top",...a},i)=>{const s=Qe();return e(re.Portal,{container:s,children:e(re.Content,{ref:i,sideOffset:n,side:r,style:{zIndex:100},className:qe("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",t),...a})})});function rt({description:n,children:r,size:a="sm",placement:i="top",className:s,asChild:l}){const[o,c]=L.useState(!1),d=L.useRef(!1);return L.useEffect(()=>{const e=()=>{c(!1),d.current=!0,requestAnimationFrame(()=>{d.current=!1})};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e)}},[]),e(Ze,{delayDuration:0,children:t(et,{open:o,onOpenChange:e=>{d.current||c(e)},children:[e(tt,{className:"cursor-pointer",asChild:l,children:r}),e(nt,{side:i,className:`px-3 py-1.5 max-w-${a} text-${a} px-3 ${s}`,children:n})]})})}nt.displayName=re.Content.displayName;const at=new Set;function it(e,t,n){j(()=>{t&&!at.has(e)&&(at.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}const st=te("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"}}),lt=L.forwardRef(({className:a,variant:i,size:s,asChild:l=!1,alt:c,isDisabled:d,isLoading:u,title:m,onClick:p,type:h,...f},g)=>{it("Button.alt",void 0!==c,"use aria-label for the accessible name and wrap in <VTooltip> for a visual tooltip. `alt` is forwarded to both for one release.");const v=l?X:"button",x=l?h:h??"button",b=f["aria-label"]??c,y=l?f.children:t(n,{children:[u&&e(o,{className:"animate-spin"}),f.children]}),w=e(v,{className:r(qe(st({variant:i,size:s})),a),disabled:d||u||f.disabled,ref:g,onClick:p,type:x,autoFocus:!1,...f,"aria-label":b,children:y});return c||m?e(rt,{description:c||m,asChild:!0,className:"cursor-pointer",size:"xs",placement:"top",children:w}):w});lt.displayName="Button";const ot=L.forwardRef(({size:t,content:n,toast:r,className:a,alt:i,"aria-label":s,...l},o)=>{const[u,m]=P(!1),{t:p}=Q();it("CopyButton.alt",void 0!==i,"use aria-label for the accessible name. `alt` is forwarded for one release.");const h=s??i??p("misc.copy");return e(lt,{ref:o,className:qe(a),variant:"unstyled",size:t||"sm",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{m(!0),setTimeout(()=>m(!1),2e3),r?.toast&&r.toast({status:"success",title:r.message||p("misc.copiedToClipboard"),duration:2e3})}).catch(e=>{console.error("Failed to copy text: ",e),r?.toast&&r.toast({status:"error",title:p("misc.failedToCopy"),duration:2e3})})},...l,"aria-label":h,title:h,children:u?e(c,{className:"text-success"}):e(d,{className:"size-4"})})});function ct({buttonLabel:n,title:r,children:a,onClick:i}){return e("div",{className:"flex items-center justify-center h-full text-center",children:t("div",{className:"py-12",children:[e("svg",{className:"mx-auto size-12",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e("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"})}),e("h3",{className:"mt-2 text-sm font-semibold",children:r}),e("p",{className:"mt-1 text-sm text-muted",children:a}),e("div",{className:"mt-6",children:t(lt,{onClick:i,children:[e(u,{className:"-ms-0.5 me-1.5 size-5","aria-hidden":"true"}),n]})})]})})}function dt({children:n,onUpload:r}){const a=E(null);return t("label",{style:{cursor:"pointer"},children:[n,e("input",{ref:a,type:"file",style:{display:"none"},onChange:()=>{a.current?.files&&r(function(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}(a.current.files))}})]})}function ut({onUpload:n}){const r=mt({onUpload:n});return e("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:t("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-full",children:[t("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[e("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:e("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"})}),t("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[e("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),e("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),e("input",{id:"dropzone-file",type:"file",className:"hidden"})]})})}function mt({onUpload:e,dragOverClass:t="is-drag-over-on",dropEffect:n="copy"}){const r=E(null);return{onDrop:n=>{var a;n.preventDefault(),(a=r.current)&&delete a.__dragOver_cnt__,r.current?.classList.remove(t);const i=n.dataTransfer.items;if(i){const t=[],n=(e,t="")=>new Promise(r=>{if(e.isFile)e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(function(e){return e.isDirectory}(e)){const a=e.createReader(),i=[],s=()=>{a.readEntries(a=>{if(a.length){for(const r of a)i.push(n(r,`${t+e.name}/`));s()}else Promise.all(i).then(e=>r(e.flat()))})};s()}});for(let e=0;e<i.length;e++){const r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{const n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{(function(e){if(!e)return!1;const t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t})(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{(function(e){if(!e)return!1;const t=e.__dragOver_cnt__;return!!t&&(e.__dragOver_cnt__=t-1,1===t)})(r.current)&&r.current?.classList.remove(t)},ref:r}}function pt({description:n,helpText:a,error:i,required:s,label:l,className:o,direction:c="column",children:d,disabled:u=!1,fullWidthLabel:p=!1,childrenId:h}){const f=V(),g=V(),v=V(),x=h??f,b=E(!1),y=Y.toArray(d).filter(B),w=1===y.length?y[0]:void 0;let N=!1,k=d;if(!!w&&!(w?.type===H)&&w){const e=w,t=e.props??{},n=function(...e){const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length>0?t.join(" "):void 0}(t["aria-describedby"],a?g:void 0,i?v:void 0),r=t["aria-invalid"]??(!!i||void 0);k=W(e,{id:t.id??x,"aria-describedby":n,"aria-invalid":r}),N=!0}else(function(){try{return ae.isDev}catch{return!1}})()&&!b.current&&(a||i||void 0===h)&&(b.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."));const C=N||h?x:void 0;return t("div",{className:r("flex w-full space-y-1",o,"row"===c?"flex-row justify-between items-center gap-2":"row-reverse"===c?"flex-row-reverse justify-between items-center gap-2":"flex-col"),children:[t("div",{className:r("flex items-center gap-1 mb-0",p&&"w-full"),children:[t("label",{htmlFor:C,className:`text-sm font-medium mb-1 ${u?"text-muted":""} ${p&&"flex-1"}`,children:[l,s?e("span",{className:"text-destructive -mt-4 ms-1",children:"*"}):""]}),n&&e("div",{className:"mx-2 flex w-4 items-center",children:e(rt,{description:n,children:e(m,{className:"size-3 text-muted"})})})]}),k,a&&e("p",{id:g,className:"text-xs text-muted",children:a}),i&&e("p",{id:v,className:"text-xs text-destructive",children:i})]})}function ht(e){return t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e(t))}}ot.displayName="CopyButton";const ft=te("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"}},defaultVariants:{variant:"default"}});function gt({className:t,variant:n,children:r,onClick:a,...i}){const s=a?{role:"button",tabIndex:0,onClick:a,onKeyDown:ht(a)}:{};return e("span",{className:qe(ft({variant:n}),t),...s,...i,children:r})}const vt=te("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:""}},defaultVariants:{variant:"default"}}),xt=te("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"}},defaultVariants:{variant:"default"}});function bt({variant:n,className:r,dotClassName:a,children:i,...s}){return t("span",{className:qe(vt({variant:n}),r),...s,children:[e("div",{className:"flex-shrink-0",children:e("svg",{className:qe(xt({variant:n}),a),viewBox:"0 0 6 6","aria-hidden":"true",children:e("circle",{cx:3,cy:3,r:3})})}),e("span",{className:"truncate",children:i})]})}const yt=te("",{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"}}),wt=L.forwardRef(({className:n,type:r,size:a="md",variant:i="default",clearable:s=!0,onChange:l,value:o,invalid:c,...d},u)=>{const m=d["aria-invalid"]??(!!c||void 0);return t("div",{className:"w-full relative inline-block [&:hover_.clear-button]:opacity-100",children:[e("input",{type:r,className:qe(yt({size:a,variant:i}),n,s&&o?"pe-8":""),ref:u,value:null==o?"":o,onChange:e=>{l?.(e.target.value)},...d,"aria-invalid":m}),s&&o&&!d.readOnly&&!d.disabled&&e(lt,{variant:"link",size:"icon",type:"button",onClick:()=>{l?.("")},className:"clear-button opacity-0 transition-opacity duration-200\n absolute top-1/2 -translate-y-1/2 text-muted !hover:text-destructive cursor-pointer\n flex items-center justify-center size-6 rounded end-2","aria-label":"Clear input",children:e(p,{size:16})})]})});function Nt({value:n=[],onChange:a,className:i,delimiters:s=", ",placeholder:l,autoFocus:o,disabled:c=!1}){const[d,u]=P("");return t("div",{className:r(i,"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",c&&"opacity-50 cursor-not-allowed"),children:[n&&n.length>0&&n.map((t,i)=>e(rt,{description:"click to remove",children:e(gt,{variant:"secondary",onClick:()=>(e=>{c||n&&n.length>0&&(n.splice(e,1),a([...n]))})(i),className:r("flex-shrink-0 transition-colors",c?"cursor-not-allowed":"cursor-pointer hover:bg-destructive hover:text-destructive"),title:t,children:e("span",{className:"break-all",children:t})},i)},i)),e(wt,{clearable:!1,className:"placeholder:text-muted px-1 flex-1 min-w-[120px]",variant:"unstyled",type:"text",value:d,onBlur:e=>{if(c)return;const t=e.currentTarget.value;t?.trim()&&(a([...n,t.trim()]),u(""))},onKeyDown:e=>{if(c)return;const t=e.currentTarget.value,r=!t.trim(),i=e.key;"Enter"===i||s.indexOf(i)>-1?(e.preventDefault(),n&&!r&&(a([...n,t.trim()]),u(""))):"Backspace"===i&&r&&n&&n.length>0&&(n.pop(),a([...n]))},onPaste:e=>{if(c)return;const t=e.clipboardData.getData("text");if(t){e.preventDefault();const r=s.split("").map(e=>" "===e?"\\s":e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),i=new RegExp(`[${r}]+`),l=t.split(i).map(e=>e.trim()).filter(e=>e.length>0);l.length>0&&a([...n,...l]),u("")}},onChange:u,placeholder:n&&0!==n.length?"":l,autoFocus:o,disabled:c})]})}function kt({underline:t="always",className:n,children:a,...i}){let s;return"always"===t?s="underline":"hover"===t&&(s="hover:underline"),e("a",{className:r("text-indigo-800 dark:text-indigo-300",n,s),...i,children:a})}function Ct({className:t,children:n}){return e("ul",{className:`${t} space-y-1 flex flex-col items-start`,children:n})}wt.displayName="Input";const _t=U(function(t,n){const{current:a,children:i,className:s,href:l="#",onClick:o,...c}=t;return e("li",{className:r(s,a?"bg-muted":"","w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted"),children:e("a",{ref:n,href:l,onClick:e=>{o?(e.preventDefault(),o(e)):"#"===l&&e.preventDefault()},className:"w-full flex items-center gap-x-3",...c,children:i})})});Ct.Item=_t;const zt="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",It={INPUT_UNSTYLED:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",INPUT_NO_PADDING:zt,INPUT:`${zt} py-1.5`};function Tt(e){return null==e||Number.isNaN(e)?"":e.toString()}const Rt=D.forwardRef(({value:t,onChange:n,className:a,noScroll:i=!1,noSpinners:s=!1,...l},o)=>{const[c,d]=D.useState(Tt(t));return j(()=>{if(null==t||!Number.isNaN(t)){const e=Tt(t);d(e)}},[t]),e("input",{onWheel:i?e=>{e.currentTarget.blur()}:l.onWheel,type:"number",value:c,onChange:e=>{const t=e.target.value;if(d(t),""===t)n?.(void 0,t);else{const e=parseFloat(t);n?.(e,t)}},className:r(a,It.INPUT,{"no-spinners":s},s&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"),ref:o,...l})});function Mt({children:n,overlayContent:r,className:a="",overlayClassName:i="",position:s="right",width:l,height:o,showCloseButton:c=!0,onOpen:d,onClose:u,triggerClassName:m="",backdropClassName:h="",animationConfig:f={type:"spring",stiffness:300,damping:30}}){const[g,v]=P(!1),x=function(e){switch(e){case"left":return{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"}};case"right":default: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}}}}(s),b=function(e,t,n){const 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":default: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"}`}}(s,l,o);return t("div",{className:`flex items-center justify-center w-full ${a}`,children:[e(lt,{variant:"unstyled",size:"none",onClick:()=>{v(!0),d?.()},className:`w-full align-left cursor-pointer ${m}`,children:n}),g&&e("div",{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${h}`,children:t(ie.div,{...x,transition:f,className:`${b} ${i}`,children:[c&&e("div",{className:"absolute top-2 end-2 z-10",children:e(lt,{onClick:()=>{v(!1),u?.()},variant:"primary",children:e(p,{})})}),e("div",{className:c?"mt-8":"",children:r})]})})]})}const Ot="--tailwind-portal";function St({children:t}){const n=E(null),[r,a]=P(null);return j(()=>{if(n.current){const e=n.current.ownerDocument;let t=e.getElementById(Ot);t||(t=e.createElement("DIV"),t.id=Ot,e.body.appendChild(t)),a(t)}},[]),r?J(t,r):e("span",{ref:n})}function $t({path:n,maxItems:r=3,className:a,separator:i}){const s=n||[],l=t=>{const n="string"==typeof t.label&&t.label.length>20?`${t.label.slice(0,17)}...`:t.label;return t.onClick?e(Et,{onClick:t.onClick,href:t.href,title:"string"==typeof t.label?t.label:void 0,children:n}):t.href?e(Et,{href:t.href,title:"string"==typeof t.label?t.label:void 0,children:n}):e(Pt,{children:n})};if(s.length<=r)return e(Lt,{className:qe("w-full flex items-center",a),children:e(Dt,{children:s.map((n,r)=>t(L.Fragment,{children:[e(At,{children:l(n)}),r<s.length-1&&e(jt,{children:i??e(h,{className:"cn-rtl-flip"})})]},r))})});const o=s.slice(-(r-1));return e(Lt,{className:qe("w-full flex items-center",a),children:t(Dt,{children:[e(At,{children:e(Ft,{})}),e(jt,{children:i??e(h,{className:"cn-rtl-flip"})}),o.map((n,r)=>t(L.Fragment,{children:[e(At,{children:l(n)}),r<o.length-1&&e(jt,{children:i??e(h,{className:"cn-rtl-flip"})})]},r))]})})}const Lt=L.forwardRef(({...t},n)=>e("nav",{ref:n,"aria-label":"breadcrumb",...t}));Lt.displayName="Breadcrumb";const Dt=L.forwardRef(({className:t,...n},r)=>e("ol",{ref:r,className:qe("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5",t),...n}));Dt.displayName="BreadcrumbList";const At=L.forwardRef(({className:t,...n},r)=>e("li",{ref:r,className:qe("inline-flex items-center gap-1.5 text-muted",t),...n}));At.displayName="BreadcrumbItem";L.forwardRef(({asChild:t,className:n,...r},a)=>e("a",{ref:a,className:qe("transition-colors hover:text-muted",n),...r})).displayName="BreadcrumbLink";const Et=L.forwardRef(({className:t,href:n,onClick:r,...a},i)=>e(lt,{variant:"ghost",size:"md",ref:i,className:qe("p-0! hover:underline! hover:bg-background!",t),onClick:e=>{e.preventDefault(),r&&r(e)},...a}));Et.displayName="BreadcrumbButton";const Pt=L.forwardRef(({className:t,...n},r)=>e("span",{ref:r,"aria-current":"page",className:qe("font-normal text-foreground",t),...n}));Pt.displayName="BreadcrumbPage";const jt=({children:t,className:n,...r})=>e("li",{role:"presentation","aria-hidden":"true",className:qe("[&>svg]:w-3.5 [&>svg]:h-3.5",n),...r,children:t??e(h,{className:"cn-rtl-flip"})});jt.displayName="BreadcrumbSeparator";const Ft=({className:n,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:qe("flex h-9 w-9 items-center justify-center",n),...r,children:[e(f,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"More"})]});Ft.displayName="BreadcrumbEllipsis";const Vt=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("rounded-xl border bg-card text-card-foreground shadow",t),...n}));Vt.displayName="Card";const Yt=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("flex flex-col p-6",t),...n}));Yt.displayName="CardHeader";const Bt=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("font-semibold leading-none tracking-tight",t),...n}));Bt.displayName="CardTitle";const Ht=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("text-sm text-muted-foreground",t),...n}));Ht.displayName="CardDescription";const Wt=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("p-6 pt-0",t),...n}));Wt.displayName="CardContent";const Ut=L.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("flex items-center p-6 pt-0",t),...n}));Ut.displayName="CardFooter";const Gt=L.forwardRef(({className:t,...n},r)=>e(le.Root,{ref:r,className:qe("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",t),...n,children:e(le.Indicator,{className:qe("flex items-center justify-center text-current"),children:e(c,{className:"size-4"})})}));function Kt({...t}){return e(oe.Root,{"data-slot":"collapsible",...t})}function qt({...t}){return e(oe.Trigger,{"data-slot":"collapsible-trigger",...t})}function Jt({...t}){return e(oe.Content,{"data-slot":"collapsible-content",...t})}function Xt({children:t}){return e("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:t})}Gt.displayName=le.Root.displayName;const Qt=A(!1);function Zt(){return!!F(Qt)}function en({children:t}){return e(Qt.Provider,{value:!0,children:t})}function tn({className:n,children:r,isOpen:a,onClose:i,description:s="Modal Description",noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1,size:d="md",action:u}){const m=e=>{e||i()};return t(sn,{open:a,onOpenChange:e=>{c&&!e||m(e)},children:[o&&e(dn,{className:"z-50 fixed inset-0 bg-black/80"}),e(Xt,{children:e(mn,{children:s})}),t(un,{className:qe("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",function(){switch(d){case"sm":return"max-w-[20vw]";case"md":default: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]"}}(),n),children:[e("div",{className:"top-4 end-4 absolute",children:t("div",{className:"flex gap-2",children:[u&&u,!l&&e(cn,{onClick:()=>m(!1),asChild:!0,autoFocus:!1,children:e(lt,{variant:"outline",alt:"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:e(p,{className:"size-4"})})})]})}),e(en,{children:r})]})]})}const nn=({children:n,show:r=!0,className:a,description:i,showDivider:s=!1,...l})=>r?t(pn,{className:qe(s?"border-b-solid border-b border-b-1 pb-2 mb-4":"","text-lg font-semibold leading-6 tracking-tight",{"py-2":!i},a),...l,children:[n,i&&e(mn,{className:"text-sm !font-normal text-muted-foreground pb-2",children:i})]}):t(Xt,{children:[e(pn,{children:n}),i&&e(mn,{children:i})]}),rn=({children:t,className:n,...r})=>e("div",{className:qe("text-sm max-h-[80vh] overflow-y-auto",n),...r,children:t}),an=({align:t="right",children:n,className:r,...a})=>e("div",{className:qe("w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end sm:space-x-2",{left:"justify-start",center:"justify-center",right:"justify-end"}[t],r),...a,children:n}),sn=de.Root,ln=de.Trigger,on=de.Portal,cn=de.Close,dn=L.forwardRef(({className:t,...n},r)=>e(de.Overlay,{ref:r,className:qe("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",t),...n}));dn.displayName=de.Overlay.displayName;const un=L.forwardRef(({className:n,children:r,...a},i)=>{const s=Qe();return t(on,{container:s,children:[e(dn,{}),e(de.Content,{ref:i,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:qe("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",n),...a,children:r})]})});un.displayName=de.Content.displayName;const mn=L.forwardRef(({className:t,...n},r)=>e(de.Description,{ref:r,className:qe("text-sm text-muted",t),...n}));mn.displayName=de.Description.displayName;const pn=L.forwardRef(({className:t,...n},r)=>e(de.Title,{ref:r,className:qe("text-lg font-semibold leading-none tracking-tight",t),...n}));pn.displayName=de.Title.displayName;const hn=L.forwardRef(({className:t,...n},r)=>e(ce,{ref:r,className:qe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n}));hn.displayName=ce.displayName;const fn=({children:t,...n})=>e(sn,{...n,children:e(un,{className:"shadow-lg p-0 overflow-hidden",children:e(hn,{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:t})})}),gn=L.forwardRef(({className:n,...r},a)=>t("div",{className:"flex items-center px-3 border-b","cmdk-input-wrapper":"",children:[e(g,{className:"opacity-50 size-4 shrink-0"}),e(ce.Input,{ref:a,className:qe("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",n),...r})]}));gn.displayName=ce.Input.displayName;const vn=L.forwardRef(({className:t,...n},r)=>e(ce.List,{ref:r,className:qe("overflow-y-auto overflow-x-hidden",t),...n}));vn.displayName=ce.List.displayName;const xn=L.forwardRef((t,n)=>e(ce.Empty,{ref:n,className:"py-2 text-sm text-center",...t}));xn.displayName=ce.Empty.displayName;const bn=L.forwardRef(({className:t,...n},r)=>e(ce.Group,{ref:r,className:qe("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",t),...n}));bn.displayName=ce.Group.displayName;const yn=L.forwardRef(({className:t,...n},r)=>e(ce.Separator,{ref:r,className:qe("-mx-1 h-px bg-border",t),...n}));yn.displayName=ce.Separator.displayName;const wn=L.forwardRef(({className:t,...n},r)=>e(ce.Item,{ref:r,className:qe("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",t),...n}));wn.displayName=ce.Item.displayName;const Nn=({className:t,...n})=>e("span",{className:qe("ms-auto text-xs tracking-widest text-muted-foreground",t),...n});Nn.displayName="CommandShortcut";const kn=L.createContext(!1);function Cn({...t}){return e(ue.Root,{"data-slot":"dropdown-menu",...t})}function _n({...t}){return e(ue.Portal,{"data-slot":"dropdown-menu-portal",...t})}function zn({...t}){return e(ue.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function In({className:t,align:n="start",sideOffset:r=4,...a}){return e(ue.Portal,{children:e(ue.Content,{"data-slot":"dropdown-menu-content",sideOffset:r,align:n,className:qe("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",t),...a})})}function Tn({...t}){return e(ue.Group,{"data-slot":"dropdown-menu-group",...t})}function Rn({className:t,inset:n,variant:r="default",...a}){return e(ue.Item,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:qe("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",t),...a})}function Mn({className:n,children:r,checked:a,inset:i,...s}){return t(ue.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":i,className:qe("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",n),checked:a,...s,children:[e("span",{className:"absolute end-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-checkbox-item-indicator",children:e(ue.ItemIndicator,{children:e(v,{})})}),r]})}function On({...t}){return e(ue.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function Sn({className:n,children:r,inset:a,...i}){return t(ue.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:qe("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",n),...i,children:[e("span",{className:"absolute end-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:e(ue.ItemIndicator,{children:e(v,{})})}),r]})}function $n({className:t,inset:n,...r}){return e(ue.Label,{"data-slot":"dropdown-menu-label","data-inset":n,className:qe("text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7",t),...r})}function Ln({className:t,...n}){return e(ue.Separator,{"data-slot":"dropdown-menu-separator",className:qe("bg-border -mx-1 my-1 h-px",t),...n})}function Dn({className:t,...n}){return e("span",{"data-slot":"dropdown-menu-shortcut",className:qe("text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest",t),...n})}function An({...t}){return e(ue.Sub,{"data-slot":"dropdown-menu-sub",...t})}function En({className:n,inset:r,children:a,...i}){return t(ue.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":r,className:qe("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",n),...i,children:[a,e(x,{className:"cn-rtl-flip ms-auto"})]})}function Pn({className:t,...n}){return e(ue.SubContent,{"data-slot":"dropdown-menu-sub-content",className:qe("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",t),...n})}const jn={left:"start",center:"center",right:"end"};function Fn({trigger:n,children:r,align:a="right",hover:i}){const[s,l]=L.useState(!1),o=L.useRef(null);if(i){return t("div",{className:"relative inline-flex",onMouseEnter:()=>{o.current&&clearTimeout(o.current),l(!0)},onMouseLeave:()=>{o.current=setTimeout(()=>l(!1),80)},children:[n,s&&e("div",{className:qe("absolute top-full pt-1 z-50","right"===a?"end-0":"center"===a?"left-1/2 -translate-x-1/2":"start-0"),children:e("div",{className:"min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground",children:e(kn.Provider,{value:!0,children:r})})})]})}return t(Cn,{children:[e(zn,{asChild:!0,children:e("span",{className:"-m-1.5 flex items-center p-1.5",children:n})}),e(In,{align:jn[a],className:"w-max",children:r})]})}function Vn({children:n,label:r}){return t(Tn,{children:[r&&e($n,{children:r}),n]})}function Yn({children:t,href:n,onClick:r,isDisabled:a=!1,variant:i="default",className:s}){const l=L.useContext(kn),o=qe("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","destructive"===i?"text-destructive":"",a?"pointer-events-none opacity-50":"hover:bg-muted focus:bg-muted",s);if(l){const i=e=>{e.stopPropagation(),r?.(e)};return n?e("a",{href:n,className:o,children:t}):e("button",{type:"button",className:o,disabled:a,onClick:i,children:t})}return e(Rn,{className:qe("data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap",s),disabled:a,variant:i,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?e("a",{href:n,children:t}):t})}const Bn=({children:t,className:n})=>{const r=E(null),[a,i]=P("auto");return j(()=>{if(r.current){const e=new ResizeObserver(e=>{const t=e[0].contentRect.height;i(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),e("div",{className:qe(n,"overflow-hidden transition-all duration-100 ease-in"),style:{height:a},children:e("div",{ref:r,children:t})})},Hn=L.createContext(null),Wn=({hover:t=!1,click:n=!1,modal:r,children:a,_open:i,onOpenChange:s})=>{const[l,o]=L.useState(i||!1);return e(Hn.Provider,{value:{open:l,setOpen:o,hover:t,click:n},children:e(he.Root,{open:l,onOpenChange:e=>{o(e),s&&s(e)},modal:r,children:a})})};function Un(e=!1,t=()=>{},n){e&&t("enter"===n)}const Gn=L.forwardRef(({children:t,...n},r)=>{const a=L.useContext(Hn);if(!a)throw new Error("PopoverTrigger must be used within a Popover");const{setOpen:i,hover:s,click:l}=a;return e(he.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>Un(s,i,"enter"),onMouseLeave:()=>Un(s,i,"leave"),onClick:()=>{l&&i(e=>!e)},...n,children:t})});Gn.displayName=he.Trigger.displayName;const Kn=he.Anchor,qn=L.forwardRef(({className:t,align:n="center",side:r="bottom",...a},i)=>{const s=L.useContext(Hn);if(!s)throw new Error("PopoverContent must be used within a Popover");const{setOpen:l,hover:o}=s,c=Qe();return e(he.Portal,{container:c,children:e(he.Content,{ref:i,align:n,side:r,onMouseEnter:()=>Un(o,l,"enter"),onMouseLeave:()=>Un(o,l,"leave"),className:qe("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",t),...a})})});qn.displayName=he.Content.displayName;const Jn=he.Close;function Xn(){const e=L.useContext(Hn);if(!e)throw new Error("usePopoverContext must be used within a Popover");return{...e,close:()=>e.setOpen(!1)}}Jn.displayName=he.Close.displayName;const Qn="\n.calendar-wrapper .react-calendar__navigation {\n display: flex !important;\n justify-content: space-between !important;\n align-items: center !important;\n gap: 8px !important;\n padding: 8px !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__label {\n flex: 1 !important;\n text-align: center !important;\n font-weight: 500 !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__arrow {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n min-width: 32px !important;\n height: 32px !important;\n border-radius: 4px !important;\n border: 1px solid hsl(var(--border)) !important;\n background: hsl(var(--background)) !important;\n color: hsl(var(--foreground)) !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__arrow:hover {\n background: oklch(var(--muted)) !important;\n}\n\n.calendar-wrapper .react-calendar__tile {\n cursor: pointer !important;\n width: 0.5rem !important;\n font-size: 0.875rem !important;\n}\n\n.calendar-wrapper .react-calendar__tile:hover,\n.calendar-wrapper .react-calendar__month-view__days__day:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year:hover,\n.calendar-wrapper .react-calendar__year-view__months__month:hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile:not(.react-calendar__tile--active):hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile--hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile--disabled,\n.calendar-wrapper .react-calendar__tile:disabled,\n.calendar-wrapper .react-calendar__month-view__days__day--disabled,\n.calendar-wrapper .react-calendar__month-view__days__day:disabled,\n.calendar-wrapper .react-calendar__year-view__months__month--disabled,\n.calendar-wrapper .react-calendar__year-view__months__month:disabled,\n.calendar-wrapper .react-calendar__decade-view__years__year--disabled,\n.calendar-wrapper .react-calendar__decade-view__years__year:disabled {\n cursor: not-allowed !important;\n color: #9ca3af !important;\n}\n\n.calendar-wrapper .react-calendar__tile--disabled:hover,\n.calendar-wrapper .react-calendar__tile:disabled:hover,\n.calendar-wrapper .react-calendar__month-view__days__day--disabled:hover,\n.calendar-wrapper .react-calendar__month-view__days__day:disabled:hover,\n.calendar-wrapper .react-calendar__year-view__months__month--disabled:hover,\n.calendar-wrapper .react-calendar__year-view__months__month:disabled:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year--disabled:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year:disabled:hover {\n background: transparent !important;\n}\n\n\n.calendar-wrapper .react-calendar__month-view__weekdays {\n font-size: 0.75rem !important;\n}\n\n.calendar-wrapper .react-calendar__month-view__weekdays__weekday {\n width: 0.75rem !important;\n font-size: 0.75rem !important;\n text-align: center !important;\n}\n \n",Zn=({filterValues:r,setFilterValues:a,isRange:i=!1})=>{const[s,l]=P(!1),[o,c]=P([null,null]),{t:d}=Q(),u=r[0]?me(r[0]).toDate():void 0,m=i?[o[0]||(r[0]?me(r[0]).toDate():null),o[1]||(r[1]?me(r[1]).toDate():null)]:[null,null];j(()=>{i&&c([r[0]?me(r[0]).toDate():null,r[1]?me(r[1]).toDate():null])},[r,i]);const p=e=>{if(i)Array.isArray(e)&&(c([e[0],e[1]]),e[0]&&e[1]?a([me(e[0]).format("YYYY-MM-DD"),me(e[1]).format("YYYY-MM-DD")]):e[0]&&a([me(e[0]).format("YYYY-MM-DD")]));else if(e){const t=Array.isArray(e)?e[0]:e;t&&(a([me(t).format("YYYY-MM-DD")]),l(!1))}};return t(Wn,{_open:s,onOpenChange:l,children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center min-h-[20px]",children:i?m[0]&&m[1]?t("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium",children:me(m[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted-foreground",children:"-"}),e("span",{className:"font-medium",children:me(m[1]).format("MMMM DD, YYYY")})]}):m[0]?t("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium",children:me(m[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted-foreground",children:"- Select end"})]}):e("span",{className:"text-muted-foreground",children:d("filter.selectRange")}):u?me(u).format("MMMM DD, YYYY"):"Pick a date"})}),e(qn,{className:"w-auto p-0",align:"start",side:"bottom",alignOffset:-4,sideOffset:6,children:e("div",{className:"p-2",children:i?t(n,{children:[t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:m,onChange:p,selectRange:!0,returnValue:"range",maxDate:(()=>{const e=new Date;return e.setHours(23,59,59,999),e})(),className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(m[0]){const e=m[0].getTime();if(m[1]){const n=m[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""}})]}),m[0]&&m[1]&&e("div",{className:"border-t pt-2",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:()=>l(!1),children:"Cancel"}),e(lt,{size:"sm",onClick:()=>l(!1),children:"Apply"})]})})]}):t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:u,onChange:p,selectRange:!1,maxDate:(()=>{const e=new Date;return e.setHours(23,59,59,999),e})(),className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(u&&t===u.getTime())return"bg-primary text-primary-foreground rounded-md font-semibold"}return""}})]})})})]})};function er({value:t,labelRenderer:r,fallbackLabel:a}){const[i,s]=P(a||t),[l,o]=P(!1);return j(()=>{if(!r)return void s(a||t);(async()=>{o(!0);try{const e=r(t);if(e instanceof Promise){const t=await e;s(t)}else s(e)}catch(e){console.error("Error rendering label:",e),s(a||t)}finally{o(!1)}})()},[t,r,a]),l?e("span",{className:"text-muted-foreground",children:"Loading..."}):e(n,{children:i})}const tr=({filterType:r,filterValues:a,setFilterValues:i,options:s,labelRenderer:l,multiple:o=!0})=>{const[c,d]=P(!1),[u,m]=P(""),p=E(null),{t:h}=Q(),f=s?.filter(e=>!a.some(t=>t.value===e.value));return t(Wn,{_open:c,onOpenChange:e=>{d(e),e||setTimeout(()=>{m("")},200)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0",children:e("div",{className:"flex gap-1.5 items-center",children:1===a?.length?(()=>{const t=a[0];return e(er,{value:t.value||"",labelRenderer:l,fallbackLabel:t.label})})():`${a?.length} selected`})}),e(qn,{className:"w-[300px] p-0",children:e(Bn,{children:t(hn,{children:[e(gn,{placeholder:r,className:"h-9",value:u,onInputCapture:e=>{m(e.currentTarget.value)},ref:p}),t(vn,{children:[e(xn,{children:h("filter.noResultsFound")}),e(bn,{children:a.map(n=>t(wn,{className:"group flex gap-2 items-center",onSelect:()=>{i(a.filter(e=>e.value!==n.value)),setTimeout(()=>{m("")},200),d(!1)},children:[o&&e("input",{type:"checkbox",checked:!0,onChange:()=>{}}),e(er,{value:n.value||"",labelRenderer:l,fallbackLabel:n.label})]},n.value))}),f?.length>0&&t(n,{children:[e(yn,{}),e(bn,{children:f.filter(e=>String(e.label||e.value).toLowerCase().includes(u.toLowerCase())).map(n=>t(wn,{className:"group flex gap-2 items-center",value:String(n.label||n.value),onSelect:()=>{const e={value:n.value,label:n.label};i(o?[...a,e]:[e]),setTimeout(()=>{m("")},200),d(!1)},children:[o&&e(Gt,{checked:!1,className:"opacity-0 group-data-[selected=true]:opacity-100"}),e("span",{className:"text-muted",children:e(er,{value:n.value||"",labelRenderer:n.labelRenderer||l,fallbackLabel:n.label})})]},n.value))})]})]})]})})})]})},nr=({filterType:n,filterValues:r,setFilterValues:a})=>{const[i,s]=P(!1),[l,o]=P(r);return t(Wn,{_open:i,onOpenChange:e=>{s(e),e||JSON.stringify(l)===JSON.stringify(r)||o(r)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r.length>0?1===r.length?r[0]:`${r.length} tags`:"Add tags..."})}),e(qn,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-3",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(Nt,{value:l,onChange:o,placeholder:`Add ${n.toLowerCase()}...`}),t("div",{className:"flex gap-2 justify-end",children:[e(lt,{size:"sm",variant:"ghost",onClick:()=>{o(r),s(!1)},children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{a(l),s(!1)},children:"Apply"})]})]})})]})},rr=({filterType:n,filterValue:r,setFilterValue:a})=>{const[i,s]=P(!1),[l,o]=P(r);return t(Wn,{_open:i,onOpenChange:e=>{s(e),e||l===r||o(r)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r||"Enter text..."})}),e(qn,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(wt,{autoFocus:!0,type:"text",size:"sm",value:l,onChange:o,onKeyDown:e=>{"Enter"===e.key&&(a(l),s(!1))},placeholder:"Enter text..."}),e("div",{className:"mt-2 p-2 border-t",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:()=>{o(r),s(!1)},children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{a(l),s(!1)},children:"Apply"})]})})]})})]})};function ar({selectedView:r,selectedDate:a,setSelectedDate:i,setFilters:s,filters:l,handleClose:o,filterGroups:c}){const{t:d}=Q(),[u,m]=P([null,null]),[p,h]=P([null,null]),f=c.find(e=>e.name===r),g=f?.multiple,v=new Date;v.setHours(23,59,59,999);const x=[p[0]||u[0],p[1]||u[1]],b=e=>{if(g)Array.isArray(e)?(h([e[0],e[1]]),m([e[0],e[1]])):(h([e,null]),m([e,null]));else{const t=Array.isArray(e)?e[0]:e;if(i(t||void 0),t){const e=new Date(t);e.setHours(0,0,0,0),s([...l,{name:r||"",placeholder:f?.placeholder,value:[{value:e.toISOString(),label:me(e).format("LLL dd, y")}],type:f?.type||"date",multiple:f?.multiple||!1}]),o()}}};return e("div",{className:"p-2",children:g?t(n,{children:[e("div",{children:g?x[0]&&x[1]?t("span",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs text-muted",children:d("filter.from")}),e("span",{className:"text-xs font-medium",children:me(x[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted",children:d("filter.to")}),e("span",{className:"text-xs font-medium",children:me(x[1]).format("MMMM DD, YYYY")})]}):x[0]?t("span",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs text-muted",children:d("filter.from")}),e("span",{className:"text-xs font-medium",children:me(x[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted",children:"→ Select end date"})]}):e("span",{className:"text-muted text-xs",children:f?.placeholder||f?.name||r||"Select date range"}):a?me(a).format("MMMM DD, YYYY"):"Pick a date"}),t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:x,onChange:b,selectRange:!0,returnValue:"range",maxDate:v,className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(x[0]){const e=x[0].getTime();if(x[1]){const n=x[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""}},`${x[0]?.getTime()}-${x[1]?.getTime()}`)]}),e("div",{className:"border-t pt-2",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{if(u[0]){const e=new Date(u[0]),t=u[1]?new Date(u[1]):new Date(u[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);const n=[];n.push({value:e.toISOString(),label:me(e).format("LLL dd, y")}),u[1]&&u[0].getTime()!==u[1].getTime()&&n.push({value:t.toISOString(),label:me(t).format("LLL dd, y")}),s([...l,{name:r||"",placeholder:f?.placeholder,value:n,type:f?.type||"date",multiple:f?.multiple||!1}]),o()}},disabled:!x[0],children:"Apply"})]})})]}):t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:a,onChange:b,selectRange:!1,maxDate:v,className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(a&&t===a.getTime())return"bg-primary text-primary-foreground rounded-md font-semibold"}return""}})]})})}function ir({selectedView:n,commandInput:r,setFilters:a,handleClose:i,filterGroups:s}){const[l,o]=P([]);if(!n)return null;const c=(e=>{const t=s.find(t=>t.name===e);if(!t)return[];const n=t.options||[];if(!r.trim())return n;if(t.filterBy){const e=r.toLowerCase();return n.filter(n=>void 0!==n.value&&t.filterBy?.(n.value,e))}const a=r.toLowerCase();return n.filter(e=>String(e.value||"").toLowerCase().includes(a))})(n),d=s.find(e=>e.name===n);return t("div",{className:"flex flex-col h-full",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted shrink-0",children:e("span",{children:d?.placeholder||d?.name})}),e("div",{className:"flex-1 overflow-hidden min-h-0",children:e("div",{className:"max-h-[200px] overflow-y-auto",children:c.length>0&&c.map(r=>{const s=l.some(e=>e.value===r.value);return t(wn,{className:"group flex gap-2 items-center w-full hover:bg-muted "+(d?.multiple&&s?"bg-muted":""),onSelect:()=>(e=>{const t={value:e.value,label:e.label};if(d?.multiple){const n=l.some(t=>t.value===e.value);o(n?t=>t.filter(t=>t.value!==e.value):e=>[...e,t])}else a(e=>{const r=e.findIndex(e=>e.name===n);if(r>=0){const n=[...e];return n[r]={...n[r],value:[t]},n}return[...e,{name:n||"",placeholder:d?.placeholder||"",value:[t],type:d?.type||"select",multiple:d?.multiple||!1}]}),i()})(r),children:[e(er,{value:r.value||"",labelRenderer:r.labelRenderer||d?.labelRenderer,fallbackLabel:r.label}),d?.multiple&&s&&e("span",{className:"ms-auto text-xs text-success",children:"✓"})]},r.value||`option-${Math.random()}`)})})}),d?.multiple&&e("div",{className:"p-2 border-t shrink-0",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{l.length>0&&a(e=>[...e.filter(e=>e.name!==n),{name:n||"",placeholder:d?.placeholder||"",value:l,type:d?.type||"select",multiple:d?.multiple||!1}]),i()},disabled:0===l.length,children:"Apply"})]})})]})}function sr({selectedView:n,setFilters:r,handleClose:a,filterGroups:i}){const[s,l]=P([]),o=i.find(e=>e.name===n);return t("div",{className:"p-2 space-y-3",children:[e("div",{className:"space-y-2",children:e(Nt,{value:s,onChange:l,placeholder:o?.placeholder||`Add ${n}...`,autoFocus:!0})}),t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{s.length>0&&r(e=>[...e.filter(e=>e.name!==n),{name:n,placeholder:o?.placeholder,value:s,type:"stringList"}]),a()},disabled:0===s.length,children:"Apply"})]})]})}function lr({selectedView:n,textValue:r,setTextValue:a,setFilters:i,handleClose:s,filterGroups:l}){const o=()=>{i(e=>[...e,{name:n||"",placeholder:l.find(e=>e.name===n)?.placeholder,value:[{value:r,label:r}],type:"text"}]),s()};return t("div",{className:"p-2 flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:l.find(e=>e.name===n)?.placeholder})}),e(wt,{autoFocus:!0,type:"text",size:"sm",value:r,onChange:a,onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Enter text..."}),e("div",{className:"mt-2 p-2 border-t",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:s,children:"Cancel"}),e(lt,{size:"sm",onClick:o,disabled:!r.trim(),children:"Apply"})]})})]})}function or(t,n,r){switch(t.type){case"date":return e(Zn,{filterValues:Array.isArray(t.value)&&"object"==typeof t.value[0]?t.value.map(e=>e.value||""):[],isRange:t.multiple,setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e.length>0?e.map(e=>({value:e,label:me(e).format("LLL dd, y")})):[]}:n))}});case"text":return e(rr,{filterType:t.placeholder||t.name,filterValue:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]&&t.value[0].value||"",setFilterValue:e=>{n(n=>n.map(n=>n===t?{...n,value:[{value:e,label:e}]}:n))}});case"stringList":return e(nr,{filterType:t.placeholder||t.name,filterValues:Array.isArray(t.value)&&"string"==typeof t.value[0]?t.value:[],setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e}:n))}});default:{const a=r.find(e=>e.name===t.name);return e(tr,{filterType:t.placeholder||t.name,filterValues:Array.isArray(t.value)&&"object"==typeof t.value[0]?t.value:[],setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e}:n))},options:a?.options||[],labelRenderer:a?.labelRenderer,multiple:t.multiple??a?.multiple})}}}function cr({filters:n,setFilters:r,filterGroups:a}){return e("div",{className:"flex gap-2 flex-wrap justify-start",children:n.filter(e=>e.value?.length>0).map(n=>t("div",{className:"flex gap-[1px] items-center text-sm",children:[e("div",{className:"flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center",children:n.placeholder||n.name}),or(n,r,a),e(lt,{variant:"ghost",size:"icon",onClick:()=>{r(e=>e.filter(e=>e!==n))},className:"bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0",children:e(p,{className:"size-6"})})]},`${n.name}-${"date"===n.type?"date":"stringList"===n.type&&"string"==typeof n.value[0]?n.value.join(","):Array.isArray(n.value)?n.value.map(e=>e.value).join(","):""}`))})}const dr=D.createContext({filters:[],setFilters:()=>{},filterGroups:[]}),ur=({filters:t,setFilters:n,filterGroups:r,children:a,inModal:i})=>{const s=new URL(window.location.href).searchParams.toString(),[l]=D.useState(()=>new URLSearchParams(window.location.search).get("filters")),o=D.useRef(new Set),c=D.useRef(i||!l);return j(()=>{if(!i&&c.current)try{const e=new URLSearchParams(s);if(t.length>0){const n=t.map(e=>{let t;if("stringList"===e.type&&Array.isArray(e.value)&&"string"==typeof e.value[0])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{const n=e.value[0];t="string"==typeof n?encodeURIComponent(n):"object"==typeof n&&void 0!==n?.value?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||""))}else t=encodeURIComponent(e.value||"");return`${encodeURIComponent(e.name)}:${t}`}).join(";");e.set("filters",n)}else e.delete("filters");const n=`${window.location.pathname}?${e.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},"",n)}catch(e){console.error("Failed to update URL with filters:",e)}},[t,i,s]),j(()=>{if(!i&&l&&0!==r.length)try{const e=l.split(";"),t=[];for(const n of e){const[e,a]=n.split(":"),i=decodeURIComponent(e);if(o.current.has(i))continue;const s=r.find(e=>e.name===i);if(!s)continue;let l,c;if(o.current.add(i),a.startsWith("[")&&a.endsWith("]")){const e=a.slice(1,-1);l=e?e.split(",").map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];c="stringList"===s.type?l:"text"===s.type?1===l.length?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{const t=s.options?.find(t=>t.value===e);let 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("]")||("stringList"===s.type?c=l:Array.isArray(c)||(c=[c])),t.push({name:i,type:s.type,placeholder:s.placeholder,value:c,multiple:s.multiple})}t.length>0&&n(e=>[...e,...t]),c.current=!0}catch(e){}},[r,i,l,n]),e(dr.Provider,{value:{filters:t,setFilters:n,filterGroups:r},children:a})},mr=({className:n})=>{const{filters:r,setFilters:a,filterGroups:i}=D.useContext(dr),{t:s}=Q(),[l,o]=D.useState(!1),[c,d]=D.useState(null),[u,m]=D.useState(""),p=D.useRef(null),[h,f]=D.useState(),[g,v]=D.useState(""),x=()=>{o(!1),setTimeout(()=>{d(null),m(""),f(void 0)},200)};return t(Wn,{_open:l,onOpenChange:e=>{o(e),e||setTimeout(()=>{d(null),m(""),v("")},200)},children:[e(Gn,{asChild:!0,children:t(lt,{variant:"outline",role:"combobox","aria-expanded":l,size:"md",className:qe("transition group flex gap-1.5",n),children:[e(b,{className:"size-4 shrink-0 transition-all text-muted"}),s("filter.filter")]})}),e(qn,{className:"w-[300px] p-0",align:"start",sideOffset:4,children:t(hn,{children:["select"===i.find(e=>e.name===c)?.type&&e(gn,{placeholder:c?s("filter.filterBy",{view:c}):s("filter.filterPlaceholder"),className:"h-9 ring-0",value:u,onValueChange:e=>{m(e)},ref:p,autoFocus:!0}),e(vn,{children:e(bn,{children:c?(()=>{if(!c)return null;const t=i.find(e=>e.name===c)?.type;switch(t){case"date":return e(ar,{selectedView:c,selectedDate:h,setSelectedDate:f,setFilters:a,filters:r,handleClose:x,filterGroups:i});case"text":return e(lr,{selectedView:c,textValue:g,setTextValue:v,setFilters:a,handleClose:x,filterGroups:i});case"stringList":return e(sr,{selectedView:c,setFilters:a,handleClose:x,filterGroups:i});default:return e(ir,{selectedView:c,commandInput:u,setFilters:a,handleClose:x,filterGroups:i})}})():(()=>{const t=i.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>"date"===n.type?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&"string"==typeof n.value[0]?n.value.some(e=>e===t.value):n.value.some(e=>fr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||"date"===e.type&&!r.some(t=>t.name===e.name)||"text"===e.type&&!r.some(t=>t.name===e.name)||"stringList"===e.type&&!r.some(t=>t.name===e.name));return 0===t.length?e(xn,{children:s("filter.noAvailableFilters")}):t.map((t,n)=>e(wn,{onSelect:()=>{return e=t.name,d(e),m(""),void p.current?.focus();var e},className:"group flex gap-2 items-center hover:bg-muted",children:e("span",{children:t.placeholder??t.name})},n))})()})})]})})]})},pr=({className:t})=>{const{filters:n,setFilters:r,filterGroups:a}=D.useContext(dr);return e("div",{className:qe(t),children:e(cr,{filters:n,setFilters:r,filterGroups:a})})},hr=({className:t})=>{const{filters:n,setFilters:r}=D.useContext(dr),{t:a}=Q();return n.filter(e=>e.value?.length>0).length>0?e(lt,{variant:"outline",size:"md",className:qe("transition group",t),onClick:()=>r([]),children:a("filter.clearAll")}):null};function fr(e){return"string"==typeof e?e:e.value||""}var gr;!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"}(gr||(gr={}));const vr=U(({className:t,level:n=3,...r},a)=>e(`h${n}`,{ref:a,className:qe({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",t),...r}));function xr({options:a,optionLabel:i,value:s,onChange:l,addNew:o,addNewLabel:d,disabled:u,filterBy:m,label:h,placeholder:f,className:g,popupClass:v,isClearable:x,border:b=!0,multiple:_=!1,by:z,inline:I=!1,isLoading:T=!1,warnOnMissingValue:R=!0,missingValueWarning:M="Value not in options list, may not be valid",clearIcon:O,clearTitle:S,"aria-label":$,"aria-labelledby":L,id:D,"aria-describedby":A,"aria-invalid":F}){const Y=E(null),[B,H]=P(!1),[W,U]=P(0),[K,q]=P(""),J=V(),X=V(),Q=G(()=>!(!R||_||null==s||!a)&&!a.some(e=>"string"==typeof z?br(e,z)===br(s,z):"function"==typeof z?z(e,s):fe(e,s)),[R,_,s,a,z]);j(()=>{const e=Y.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;U(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);const Z=(e,t)=>!(!t||0===t.length)&&t.some(t=>ee(t,e)),ee=(e,t)=>null==e||null==t?e===t:"string"==typeof z?br(e,z)===br(t,z):"function"==typeof z?z(e,t):fe(e,t);let te=a||[];const ne=K.toLowerCase(),re=function(e){return e?"string"==typeof e?t=>String(br(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}(m);te=te.filter(e=>re(e).includes(ne));const ae=()=>t(n,{children:[m&&t("div",{className:"flex justify-start items-center mb-1",children:[e("div",{className:"mx-2",children:e(k,{className:"size-4"})}),e(wt,{variant:"unstyled",value:K,onChange:q,className:"w-full p-1 rounded-md",placeholder:"Search..."})]}),e(hn,{className:"overflow-hidden",children:t(vn,{className:I?"max-h-full overflow-y-auto":"max-h-[200px] overflow-y-auto",onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[e(xn,{children:"No result found."}),e(bn,{children:te?.map((n,r)=>{const a=_?Z(n,Array.isArray(s)?s:[]):null!=s&&ee(s,n);return e(wn,{onSelect:()=>(e=>{if(_){const t=Array.isArray(s)?s:[];if(Z(e,t)){const n=t.filter(t=>!ee(t,e));l(n)}else l([...t,e])}else l(e)})(n),className:"w-full",children:_||I?t("div",{className:"w-full flex justify-between items-center cursor-pointer",children:[e("div",{className:"w-full truncate text-start",children:i?i(n):n}),a&&e(c,{className:"size-4"})]}):t(Jn,{className:"w-full flex justify-between items-center",children:[e("div",{className:"w-full truncate text-start",children:i?i(n):n}),a&&e(c,{className:"size-4"})]})},r)})})]})}),o&&e("div",{className:"p-1",children:t("button",{type:"button",onClick:o,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:[e(C,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),d]})})]});if(I)return e("div",{className:r(g,b&&"border border-border rounded-md","bg-popover p-1",v),children:T?e("div",{className:"flex justify-center items-center p-2 text-muted text-sm",children:e(y,{className:"size-4 animate-spin"})}):ae()});const ie=!!h,se=$??(ie?void 0:"string"==typeof f?f:void 0),le=L??(ie?X:void 0),oe=!!x&&!!s&&(!Array.isArray(s)||s.length>0),ce=!(!0!==F&&"true"!==F&&!Q)||!1!==F&&"false"!==F&&void 0;return t(Wn,{onOpenChange:H,children:[t("div",{ref:Y,className:r("relative",g),children:[e(Gn,{asChild:!0,children:e("button",{type:"button",id:D,disabled:u||T,"aria-haspopup":"dialog","aria-expanded":B,"aria-controls":J,"aria-label":se,"aria-labelledby":le,"aria-describedby":A,"aria-invalid":ce,className:r(T?"flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent":r(b&&(Q||ce?"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",u?"cursor-not-allowed text-muted":"cursor-pointer hover:bg-muted",oe&&"pe-10")),children:T?e(y,{className:"size-4 animate-spin"}):t(n,{children:[t("div",{className:r("flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate"),children:[h&&e("div",{id:X,className:"w-full text-start text-xs font-semibold",children:h}),t("div",{className:r("w-full text-start ",Q&&"text-destructive"),children:[Q&&e(rt,{description:M,placement:"top",asChild:!0,children:e(w,{className:"inline-block size-4 me-1 -mt-0.5 cursor-help"})}),_?(()=>{const n=Array.isArray(s)?s:s?[s]:[];return 0===n.length?e("span",{className:"text-muted",children:f}):1===n.length?i?i(n[0]):n[0]:t("div",{className:"flex flex-wrap gap-1",children:[n.slice(0,1).map((t,n)=>e("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded",children:i?i(t):t},n)),n.length>1&&t("span",{className:"inline-flex items-center px-2 py-1 text-xs bg-muted rounded",children:["+",n.length-1," more"]})]})})():(()=>{if(!s||Array.isArray(s)&&0===s.length)return e("span",{className:"text-muted",children:f});const t=Array.isArray(s)?s[0]:s;return i?i(t):t})()]})]}),!u&&e(N,{className:"size-4 opacity-50 shrink-0","aria-hidden":"true"})]})})}),oe&&!T&&e(lt,{variant:"link",size:"icon",disabled:u,"aria-label":S||"Clear selection",onClick:e=>{e.stopPropagation(),l(_?[]:void 0)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.stopPropagation()},className:"absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1",children:O||e(p,{className:"size-4"})})]}),e(qn,{id:J,style:{width:`${W}px`,zIndex:1e6},className:r("min-w-[8rem] w-64 bg-popover p-1 border shadow","divide-y divide-border",v),children:ae()})]})}function br(e,t){return"object"==typeof e&&null!==e?e[t]:void 0}vr.displayName="Heading";const yr={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:n,className:r}={}){const{language:a,setLanguage:i}=Z(),{t:s}=Q(),l=!1!==n&&(n??s("language.label"));return t("div",{className:r??(l?"flex justify-between px-2 items-center gap-3":"flex items-center"),children:[l&&e("p",{className:"text-sm font-semibold",children:l}),e(xr,{options:ee,value:a,onChange:e=>i(e),optionLabel:e=>yr[e],placeholder:s("language.placeholder"),isClearable:!1,warnOnMissingValue:!1,className:"min-w-40"})]})}const Nr=te("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),kr=L.forwardRef(({className:n,required:r,...a},i)=>t(ge.Root,{ref:i,className:qe(Nr(),n),...a,children:[a.children,r&&e("span",{className:"text-destructive-foreground ms-1",children:"*"})]}));function Cr({icon:n,status:r,title:a,children:i,className:s}){let l,o,c,d;switch(r){case"error":l=e(z,{className:"size-5 text-destructive","aria-hidden":"true"}),o="text-destructive",c="text-foreground",d="bg-destructive border border-destructive";break;case"warning":l=e(w,{className:"size-5 text-attention","aria-hidden":"true"}),o="",c="text-foreground",d="bg-attention border border-attention";break;case"success":l=e(_,{className:"size-5 text-success","aria-hidden":"true"}),o="",c="text-foreground",d="bg-success border border-success";break;case"info":l=e(m,{className:"size-5 text-info","aria-hidden":"true"}),o="",c="text-foreground",d="bg-info border border-info";break;case"default":l=e(m,{className:"size-5 text-muted","aria-hidden":"true"}),o="",c="text-foreground",d="bg-muted border border-muted";break;case"done":l=e(m,{className:"size-5 text-done","aria-hidden":"true"}),o="",c="text-foreground",d="bg-done border border-done"}return e("div",{className:`rounded-md p-4 ${d} ${s}`,children:t("div",{className:"flex",children:[e("div",{className:"shrink-0",children:n??l}),t("div",{className:"w-full ms-2 px-1",children:[a&&e("h3",{className:`text-md font-medium mb-2 ${o}`,children:a}),e("div",{className:`text-sm ${c} break-words`,children:i})]})]})})}function _r({title:n,className:r,children:a,action:i,actionLabel:s}){return t(Cr,{status:"error",title:n,className:`${r} flex flex-col items-center justify-center text-center`,children:[e("pre",{className:"whitespace-pre-wrap break-words",children:a}),i&&s&&e(lt,{onClick:i,variant:"ghost",size:"sm",className:"mt-4",children:s})]})}function zr({title:t,className:n,children:r}){return e(Cr,{status:"info",title:t,className:n,children:r})}function Ir({title:t,className:n,children:r}){return e(Cr,{status:"warning",title:t,className:n,children:r})}function Tr({title:t,className:n,children:r}){return e(Cr,{status:"success",title:t,className:n,children:r})}function Rr({title:t,className:n,children:r}){return e(Cr,{status:"default",title:t,className:n,children:r})}function Mr({title:n,content:r,onConfirm:a,onCancel:i,isOpen:s,isLoading:l}){const{t:o}=Q(),c=E(null);return t(tn,{isOpen:s,onClose:i,description:"Confirm Modal",children:[t("div",{className:"sm:flex sm:items-start p-2",children:[e("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:e(I,{className:"size-6 text-red-600","aria-hidden":"true"})}),t("div",{className:"mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start",children:[e(nn,{className:"leading-6",show:!0,children:n}),e("div",{className:"mt-2",children:e("div",{className:"prose text-sm text-gray-500",children:r})})]})]}),t(an,{align:"right",children:[e(lt,{variant:"destructive",onClick:a,isLoading:l,children:o("modal.confirm")}),e(lt,{variant:"outline",onClick:i,ref:c,children:o("modal.cancel")})]})]})}function Or(){return F(Sr)}kr.displayName=ge.Root.displayName;const Sr=A(()=>{}),$r={success:_,error:z,warning:w,info:m},Lr={success:"text-success",error:"text-destructive",warning:"text-attention",info:"text-info"};function Dr({data:n,onClose:r}){const[a,i]=P(!0),s=E(null),l=K(()=>{s.current&&(globalThis.clearTimeout(s.current),s.current=null)},[]),o=K(()=>{l(),n.duration&&(s.current=setTimeout(()=>i(!1),n.duration))},[l,n.duration]);j(()=>(o(),l),[l,o]);const c=$r[n.status]||m,d=Lr[n.status]||"text-info";return e("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:e("div",{className:"flex w-full flex-col items-center space-y-4 sm:items-end",children:e(se,{onExitComplete:r,children:a&&e(ie.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:l,onMouseLeave:o,children:e("div",{className:"p-5",children:t("div",{className:"flex items-start",children:[e("div",{className:"shrink-0",children:e(c,{className:`size-6 ${d}`,"aria-hidden":"true"})}),t("div",{className:"ms-3 flex-1 pt-0.5 min-w-0",children:[e("p",{className:"text-sm font-semibold text-foreground break-words",children:n.title}),n.description&&e("p",{className:"mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed",children:n.description})]}),e("div",{className:"ms-4 flex shrink-0",children:t("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:()=>i(!1),children:[e("span",{className:"sr-only",children:"Close"}),e(p,{className:"size-5","aria-hidden":"true"})]})})]})})})})})})}function Ar({children:r}){const[a,i]=P(null),s=K(e=>{i(e)},[]);return t(n,{children:[e(Sr.Provider,{value:s,children:r}),a&&e(St,{children:e(Dr,{data:a,onClose:()=>s(null)})})]})}function Er({idToDelete:t,title:n,content:r,setIdToDelete:a,deleteApi:i}){const{t:s}=Q(),l=Or();return e(Mr,{title:n,content:r,isOpen:!!t,onConfirm:async()=>{if(t)return i(t).then(()=>{l({title:s("modal.delete.succeeded"),status:"success"})}).catch(e=>{l({title:s("modal.delete.failed"),description:e instanceof Error?e.message:s("modal.delete.error"),status:"error"})}).finally(()=>{a(void 0)})},onCancel:()=>{a(void 0)}})}function Pr({children:r,action:a,title:i,description:s,footer:l,className:o,collapsible:c,defaultCollapsed:d=!1,size:u="md",clickableHeader:p=!1}){const[h,f]=P(d),g=c&&p,v="sm"===u,x=v||g,b=e(h?T:R,{className:"size-4 text-muted"}),y=t(n,{children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"font-semibold "+(v?"text-sm":"text-lg"),children:i}),s&&e(rt,{description:s,children:e(m,{className:"size-4 text-muted"})})]}),t("div",{className:"flex gap-2 items-center",children:[a,c&&(g?b:e(lt,{variant:"ghost",size:"icon",onClick:()=>f(!h),children:b}))]})]}),w=v?"px-4 py-2":"px-4 py-3",N=v?"px-4 pt-3 pb-3":"p-4",k=v?"px-4 pb-3":"px-4 pb-4";return t("div",{className:`flex flex-col ${x?"":"p-4 gap-2"} rounded-sm border bg-card ${g?"overflow-hidden":""} ${o??""}`,children:[g?e("button",{type:"button",className:`w-full flex items-center justify-between ${w} hover:bg-muted/50 transition-colors`,onClick:()=>f(!h),children:y}):e("div",{className:`flex items-center justify-between ${x?w:""}`,children:y}),!h&&(x?e("div",{className:N,children:r}):r),l&&e("div",{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${x?k:""}`,children:l})]})}function jr({className:t,...n}){return e(ve.Item,{"data-slot":"radio-group-item",className:qe("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",t),...n,children:e(ve.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}class Fr{descriptionOf(e){}selectedClassName(e){return"border-accent-foreground"}}function Vr({onSelect:n,selected:r,options:a,adapter:i}){const s=e=>i?i.idOf(e):e.id,l=e=>i?i.labelOf(e):e.label,o=e=>i?i.descriptionOf(e):e.description;return e(ve.Root,{"data-slot":"radio-group",value:r?s(r):void 0,onValueChange:e=>{const t=a.find(t=>s(t)===e);t&&n(t)},className:"space-y-4",children:a.map(n=>{const a=!!r&&s(r)===s(n);return e(ve.Item,{value:s(n),className:qe("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",a&&(c=n,i?i.selectedClassName(c):"border-primary")),children:e("span",{className:"flex items-center",children:t("span",{className:"flex flex-col text-sm",children:[e("span",{className:"font-medium text-text",children:l(n)}),o(n)&&e("span",{className:"text-muted-foreground",children:o(n)})]})})},s(n));var c})})}function Yr({className:t,direction:n="horizontal",orientation:r,...a}){const i=r??n;return e(xe.Group,{"data-slot":"resizable-panel-group","data-panel-group-direction":i,orientation:i,className:qe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a})}function Br({...t}){return e(xe.Panel,{"data-slot":"resizable-panel",...t})}function Hr({withHandle:t,className:n,...r}){return e(xe.Separator,{"data-slot":"resizable-handle",className:qe("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:t&&e("div",{className:"z-10 flex size-4 items-center justify-center rounded-xs font-semibold",children:e(M,{className:"size-4 rotate-90"})})})}const Wr=L.forwardRef(({className:t,orientation:n="horizontal",decorative:r=!0,...a},i)=>e(be.Root,{ref:i,decorative:r,orientation:n,className:qe("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Wr.displayName=be.Root.displayName;const Ur=L.forwardRef(({className:n,trackClassName:r,rangeClassName:a,thumbClassName:i,value:s,defaultValue:l,min:o=0,max:c=100,"aria-label":d,...u},m)=>{const p=L.useId(),h=Array.isArray(s)?s.length:Array.isArray(l)?l.length:1,f=L.useMemo(()=>Array.from({length:Math.max(1,h)},(e,t)=>`${p}-thumb-${t}`),[p,h]);return t(ye.Root,{ref:m,"data-slot":"slider",value:s,defaultValue:l,min:o,max:c,...u,className:qe("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",n),children:[e(ye.Track,{"data-slot":"slider-track",className:qe("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:e(ye.Range,{"data-slot":"slider-range",className:qe("absolute h-full bg-primary data-[orientation=vertical]:w-full",a)})}),f.map(t=>e(ye.Thumb,{"data-slot":"slider-thumb","aria-label":d,className:qe("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",i)},t))]})});Ur.displayName=ye.Root.displayName;const Gr={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 Kr({className:n,size:r="md",value:a,onChange:i,children:s,disabled:l,...o}){const[c,d,u]=Gr[r],m=e(we.Root,{"data-slot":"switch",checked:a,onCheckedChange:i,disabled:l,...o,className:qe("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",c,!s&&n),children:e(we.Thumb,{"data-slot":"switch-thumb",className:qe("bg-white rounded-full pointer-events-none block ring-0 transition-transform",d,a?u:"translate-x-1 rtl:-translate-x-1")})});return s?t("div",{className:qe("flex items-center",n),children:[m,e("span",{className:"px-2",children:s})]}):m}const qr=L.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:"tabs",updateHash:!0}),Jr=({tabs:t,defaultValue:n,current:r,className:a,fullWidth:i,fullHeight:s,children:l,onTabChange:o,responsive:c=!1,variant:d="tabs",updateHash:u=!0})=>{const m=L.useMemo(()=>t.filter(e=>void 0===e.is_allowed||!0===e.is_allowed),[t]),[p,h]=L.useState(()=>{const e="function"==typeof r?r():r;if(e)return e;const t=window.location.hash,a=t?t.substring(1):void 0;return a&&m.some(e=>e.name===a)?a:n||m[0]?.name});L.useEffect(()=>{const e="function"==typeof r?r():r;e&&e!==p&&h(e)},[r,p]),L.useEffect(()=>{if(r)return;const e=()=>{const e=window.location.hash,t=e?e.substring(1):void 0;t&&m.some(e=>e.name===t)?h(t):!e&&n&&h(n)};return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[r,m,n]);const f=L.useCallback(e=>{if(h(e),u&&!r){const t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,"",n)}o&&o(e)},[r,o,u]),g=L.useCallback(e=>{f(e)},[f]);return e(qr.Provider,{value:{tabs:m,size:i?m.length:0,current:p,setTab:g,responsive:c,variant:d,updateHash:u},children:e(Ne.Root,{defaultValue:p||m[0]?.name,value:p,onValueChange:f,className:qe("flex-1 flex flex-col min-h-0 px-2",s&&"h-full",a),children:l})})},Xr=({className:r,sticky:a,direction:i})=>{const{tabs:s,size:l,current:o,setTab:c,responsive:d,variant:u,updateHash:m}=L.useContext(qr),p=0!==l,h=L.useCallback(e=>{if(!s||!c)return;const t=s.find(t=>t.name===e);if(t?.href&&m){const e=window.history.state;window.history.pushState(e,"",t.href)}c(e)},[s,c,m]);return s&&c?t(n,{children:[d&&e("div",{className:"px-2 block lg:hidden",children:e(xr,{label:"Tab",className:qe(a&&"sticky top-0 bg-background z-10",r),options:s,optionLabel:e=>"string"==typeof e.label?e.label:String(e.label),value:s.find(e=>e.name===o),onChange:e=>{h(e.name)}})}),e(Zr,{size:l,variant:u,className:qe(p?"w-full":"",a&&"sticky top-0 bg-background z-10","vertical"===i?"flex-col items-start":"flex-row",d?"hidden lg:flex":"",r),children:s.map(t=>e(ea,{className:qe("vertical"===i?"w-full text-start":""),value:t.name,disabled:t.disabled,href:t.href,variant:u,onClick:()=>h(t.name),children:t.label},t.name))})]}):(console.warn("TabsBar: No tabs provided or setTab not available"),null)},Qr=({className:t})=>{const{tabs:r}=L.useContext(qr);return r?e(n,{children:r.map(n=>e(ta,{value:n.name,className:t,children:n.content},n.name))}):null},Zr=L.forwardRef(({className:t,size:n,variant:r="tabs",...a},i)=>e(qr.Provider,{value:{size:n,variant:r},children:e(Ne.List,{ref:i,className:qe("tabs"===r?"border-b -mb-px flex space-x-4":"flex space-x-2 p-1 rounded-md",t),...a})}));Zr.displayName=Ne.List.displayName;const ea=L.forwardRef(({className:t,href:n,variant:r="tabs",...a},i)=>{const{size:s}=L.useContext(qr),l=L.useCallback(e=>{if(n){e.preventDefault();const t=window.history.state;window.history.pushState(t,"",n)}a.onClick&&a.onClick(e)},[n,a.onClick]);return e(Ne.Trigger,{ref:i,className:qe("tabs"===r?qe("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"):qe("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"),t,s?`w-1/${s}`:""),onClick:l,...a})});ea.displayName=Ne.Trigger.displayName;const ta=L.forwardRef(({className:t,...n},r)=>e(Ne.Content,{ref:r,className:qe("focus-visible:outline-none","flex-1 overflow-y-auto min-h-0 pt-2 pb-4",t),...n}));ta.displayName=Ne.Content.displayName;const na=te("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"}}),ra=U(({className:t,size:n,weight:r,...a},i)=>e("p",{ref:i,className:qe(na({size:n,weight:r,className:t})),...a}));function aa({className:t,minLines:n,maxLines:r,value:a,...i}){const s=E(null),l=void 0!==n||void 0!==r,o=K(()=>{const e=s.current;if(!e)return;const t=getComputedStyle(e),a=parseFloat(t.lineHeight)||1.5*parseFloat(t.fontSize),i=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),l=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),o=r??1/0,c=(n??1)*a+i+l,d=o===1/0?1/0:o*a+i+l;e.style.height="auto";const u=Math.min(Math.max(e.scrollHeight,c),d);e.style.height=`${u}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?"auto":"hidden"},[n,r]);return q(()=>{l&&o()}),e("textarea",{ref:s,"data-slot":"textarea",value:a,className:qe("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",l&&"resize-none",t),...i})}ra.displayName="Text";const ia=A({theme:"system",setTheme:()=>null});function sa({children:t,defaultTheme:n="system",storageKey:r="vite-ui-theme",...a}){const[i,s]=P(()=>localStorage.getItem(r)||n);j(()=>{const e=window.document.documentElement;if(e.classList.remove("light","dark"),"system"===i){const t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return void e.classList.add(t)}e.classList.add(i)},[i]);const l={theme:i,setTheme:e=>{localStorage.setItem(r,e),s(e)}};return e(ia.Provider,{...a,value:l,children:t})}const la=()=>{const e=F(ia);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e};function oa({option:t,current:n,setTheme:r,icon:a,alt:i}){return e(lt,{variant:n===t?"secondary":"outline",size:"sm",onClick:()=>r(t),alt:i,children:a})}function ca({label:n,className:r}={}){const{setTheme:a,theme:i}=la(),{t:s}=Q(),l=!1!==n&&(n??s("theme.label"));return t("div",{className:r??(l?"flex justify-between px-2 items-center":"flex items-center gap-1"),children:[l&&e("p",{className:"text-sm font-semibold",children:l}),t("div",{className:"flex gap-2",children:[e(oa,{current:i,option:"system",setTheme:a,icon:e(O,{}),alt:s("theme.system")}),e(oa,{current:i,option:"light",setTheme:a,icon:e(S,{}),alt:s("theme.light")}),e(oa,{current:i,option:"dark",setTheme:a,icon:e($,{}),alt:s("theme.dark")})]})]})}function da(t,n){return{label:String(t),check:e(n?c:"div",{className:"size-4"}),reverse:!1,className:"flex-1 px-2 py-2 hover:bg-accent nowrap"}}function ua({value:n,options:a,onChange:i,className:s,optionLayout:l,by:o,noCheck:c,filterBy:d}){const{t:u}=Q(),[m,p]=P(n),[h,f]=P(""),g=e=>{p(e),i(e)},v=G(()=>"string"==typeof o?(e,t)=>e[o]===t[o]:o||((e,t)=>e===t),[o]);return t("div",{className:r("",s),children:[d&&e(wt,{type:"text",placeholder:u("form.filter"),value:h,onChange:e=>f(e)}),a.map((t,n)=>{if(d&&!d(h)(t))return null;const r=!!m&&v(m,t);let a;return l?(a=l(t,r),a=Object.assign(da(t,r),a)):a=da(t,r),e(ma,{option:t,onSelect:g,layout:a,noCheck:c},n)})]})}function ma({option:n,onSelect:a,layout:i,noCheck:s}){return t(lt,{variant:"unstyled",size:"none",className:r("group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted",i.reverse&&"flex-row-reverse",i.className),onClick:()=>a(n),children:[s?null:e("div",{className:"",children:i.check}),e("div",{className:"flex-1",children:i.label})]})}function pa({isOpen:n,title:r,onClose:a,children:i,panelWidth:s=768,backdrop:l=!1,side:o="right",resizable:c=!0,className:d,contentClassName:u}){const[m,p]=P(s),h="left"===o,f=h?"left-0":"right-0",g=h?"pr-10 sm:pr-16":"pl-10 sm:pl-16",v=h?"border-r":"border-l",x=h?"-right-1":"-left-1",b=h?"-100%":"100%";return e(se,{children:n&&t("div",{className:"relative z-20",children:[l&&e(ie.div,{className:"fixed inset-0 bg-black/70",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a}),e("div",{className:`fixed inset-y-0 ${f} overflow-hidden`,children:e("div",{className:"absolute inset-0 overflow-hidden",children:e("div",{className:`pointer-events-none fixed inset-y-0 ${f} flex max-w-full ${g}`,children:e(ie.div,{className:`pointer-events-auto ${v}`,style:{width:`${m}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:"spring",stiffness:300,damping:30},children:t("div",{className:"relative flex h-full",children:[c&&e("div",{"aria-label":"Resize panel",className:`absolute ${x} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:e=>{e.preventDefault();let t=!0;const n=e.pageX,r=m,a=e=>{if(t){const t=n-e.pageX,a=Math.max(r+t,480);p(a)}},i=()=>{t=!1,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",i)},children:e(M,{className:"rotate-90 font-semibold",strokeWidth:4})}),t("div",{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${d}`,children:[r&&e("div",{className:"sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b",children:t("div",{className:"flex items-start justify-between",children:[e("h2",{className:"w-full text-base font-semibold leading-6",children:e("div",{className:"text-2xl",children:r??""})}),e("div",{className:"ms-3 flex h-7 items-center",children:e(ha,{onClose:a})})]})}),e("div",{className:u??"flex-1 overflow-auto px-2 sm:px-4 py-4",children:e("div",{className:"w-full h-full flex-1 flex flex-col",children:i})})]})]})})})})})]})})}function ha({onClose:t}){return e(lt,{alt:"Close panel",variant:"ghost",onClick:t,children:e(p,{className:"size-6","aria-hidden":"true"})})}function fa({size:n,className:a}){const i=function(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 new Error(`Unexpected size: ${e}`)}}(n||"md");return t("svg",{className:r("animate-[spin_0.8s_linear_infinite] text-indigo-500",i,a),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"img","aria-label":"Loading",children:[e("title",{children:"Loading"}),e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e("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 ga({options:a,value:i,onChange:s,onOptionsChange:l,placeholder:o,className:c,disabled:d,layout:u="horizontal",creatable:m=!1,createText:h='Create "%value%"',maxDropdownHeight:f=200}){const g=F(Hn),[v,x]=P(""),[b,y]=P(0),[w,N]=P(0),[k,C]=P(null),_=E(null),z=E(null),I=E(null),T=E(null),R=g?.open??!1,M=g?.setOpen??(()=>{});j(()=>{const e=z.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;N(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);const O=a.filter(e=>!i.includes(e)&&e.toLowerCase().includes(v.toLowerCase())),S=m&&v&&!i.includes(v)&&!a.includes(v),$=O.length+(S?1:0);j(()=>{""!==v&&C(null)},[v]),j(()=>{R&&b>=0&&T.current&&I.current&&T.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[b,R]),j(()=>{R?_.current?.focus():x("")},[R]);const L=e=>{s([...i,e]),x(""),M(!1),y(0),C(null)},D=e=>{s([...i,e]),l&&!a.includes(e)&&l([...a,e]),x(""),M(!1),y(0),C(null)},A=(e,t)=>{t.stopPropagation(),s(i.filter(t=>t!==e)),C(null)};return t("div",{className:r("relative",c),children:[e(Gn,{asChild:!0,children:t("div",{ref:z,className:r("min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2","flex items-center gap-1","horizontal"===u?"flex-wrap":"flex-col items-stretch","cursor-text","ring-offset-background",d&&"opacity-50 cursor-not-allowed",R?"ring-1 ring-inset ring-ring":""),onClick:()=>{d||_.current?.focus()},children:["vertical"===u&&i.length>0&&e("div",{className:"flex flex-col gap-1 w-full",children:i.map((n,a)=>t("span",{className:r("inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/10 text-primary rounded-md w-full transition-all",k===a&&"ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]"),children:[e("span",{className:"truncate",children:n}),e("button",{type:"button",onClick:e=>A(n,e),disabled:d,className:"hover:bg-primary/20 rounded-sm transition-colors flex-shrink-0",children:e(p,{className:"h-3 w-3"})})]},n))}),"horizontal"===u&&i.map((n,a)=>t("span",{className:r("inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/10 text-primary rounded-md transition-all",k===a&&"ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]"),children:[n,e("button",{type:"button",onClick:e=>A(n,e),disabled:d,className:"hover:bg-primary/20 rounded-sm transition-colors",children:e(p,{className:"h-3 w-3"})})]},n)),e("input",{ref:_,type:"text",value:v,onChange:e=>{x(e.target.value),y(0)},onKeyDown:e=>{if("Enter"===e.key&&R&&$>0)return e.preventDefault(),e.stopPropagation(),void(b===O.length&&S?D(v):b<O.length&&L(O[b]));if("ArrowDown"===e.key)return e.preventDefault(),e.stopPropagation(),void(R?y(e=>e<$-1?e+1:e):M(!0));if("ArrowUp"===e.key)return e.preventDefault(),e.stopPropagation(),void(R?y(e=>e>0?e-1:0):M(!0));if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void M(!1);if("Backspace"===e.key&&""===v&&i.length>0){e.stopPropagation();const t=i.length-1;return void(k===t?(s(i.slice(0,-1)),C(null)):C(t))}R||1!==e.key.length||M(!0)},onClick:e=>{e.stopPropagation(),d||M(!0)},onFocus:()=>{d||M(!0)},disabled:d,placeholder:0===i.length?o:"",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","vertical"===u&&"w-full")})]})}),e(qn,{style:{width:`${w}px`},className:"p-0 bg-popover border border-border shadow-lg",align:"start",side:"bottom",onOpenAutoFocus:e=>{e.preventDefault()},children:e("div",{ref:I,className:"overflow-y-auto",style:{maxHeight:`${f}px`},children:0!==O.length||S?t(n,{children:[O.length>0&&e("ul",{className:"py-1",children:O.map((t,n)=>e("li",{ref:e=>{n===b&&(T.current=e)},role:"option","aria-selected":n===b,tabIndex:0,onClick:()=>L(t),onKeyDown:ht(()=>L(t)),onMouseEnter:()=>y(n),className:r("px-3 py-2 text-sm cursor-pointer transition-colors",n===b?"bg-blue-500/20 text-foreground":"hover:bg-accent/50"),children:t},t))}),S&&t(n,{children:[O.length>0&&e("div",{className:"border-t border-border"}),e(lt,{ref:e=>{b===O.length&&(T.current=e)},variant:"unstyled",size:"none",onClick:()=>D(v),onMouseEnter:()=>y(O.length),className:r("!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary",b===O.length?"bg-blue-500/20":"hover:bg-accent/50"),children:h.replace("%value%",v)})]})]}):e("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:v?"No options found":"No more options available"})})})]})}function va(t){return e(Wn,{click:!0,children:e(ga,{...t})})}function xa({className:t,children:n,...a}){return e("table",{className:r("\ndivide-y divide-border\n[&>tbody]:divide-y [&>tbody]:divide-border\n[&_th]:text-start [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground\n[&_td]:px-3 [&_td]:py-4 [&_td]:text-sm\n",t),...a,children:n})}function ba({children:t}){return e("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:t})}function ya({columns:t}){return e("tr",{className:"hover:bg-muted",children:Array(t).fill(0).map((t,n)=>e("td",{children:e("div",{className:"animate-pulse rounded-xs h-5 bg-muted"})},n))})}function wa({isLoading:t=!1,columns:n,rows:r=3,children:a}){const i=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return e("tbody",{children:t?i.map(t=>e(ya,{columns:n},t)):a})}function Na({className:t,children:n,...a}){return e("tr",{className:r("hover:bg-muted hover:cursor-pointer",t),...a,children:n})}function ka({scope:t="col",children:n,...r}){return e("th",{scope:t,...r,children:n})}function Ca({sortDirection:n="none",onSort:r,sortIndicator:a,disabled:i=!1,children:s,className:l,scope:o="col",...c}){return e("th",{scope:o,"aria-sort":n,className:l,...c,children:i?t("span",{className:"inline-flex items-center gap-1",children:[s,a?.(n)]}):t("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:[s,a?.(n)]})})}class _a{_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(const t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}}function za(e){const t=D.createContext(void 0);return e.Context=t,t.Provider}class Ia{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 Ta(e){const t=e.Context;if(!t)throw new Error(`Context not defined for ${e.name}`);return F(t)}function Ra(e){const[t,n]=P(e.value);return j(()=>e.watch(e=>{n("function"==typeof e?()=>e:e)}),[e]),t}function Ma(e,t){return j(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function Oa(e,t){j(()=>e.watch(t),[e,t])}function Sa(e){const[t,n]=P(e.current);return j(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function $a(e,t){j(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function La(e,t){j(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}class Da{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(const e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){const e=this.compute();if(e!==this._value){this._value=e;for(const 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(const e of this.unsubscribers)e();this.watchers=[]}}class Aa{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}}function Ea(e){const[t,n]=P(e.value);return j(()=>e.addWatcher(e=>{n("function"==typeof e?()=>e:e)}),[e]),t}function Pa(e,t){const n=E(null);return j(()=>{const r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},a=window.setTimeout(()=>{document.addEventListener("click",r)},0);return()=>{window.clearTimeout(a),document.removeEventListener("click",r)}},[e,t]),n}function ja(){const[e,t]=P(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 Fa(e){j(()=>{const 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 Va(e,t){const[n,r]=P(e);return j(()=>{const n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function Ya(e,t,n){const r=[],a=new EventSource(e);return a.addEventListener("message",e=>{const n=JSON.parse(e.data);n&&(r.push(n),t(r.join("")))}),a.addEventListener("close",e=>{a.close();const t=JSON.parse(e.data);n(t)}),()=>{a.close()}}function Ba(e,t,n){const r=E(t),a=E(n);r.current=t,a.current=n,j(()=>{let t,n=!1;const i=e=>r.current(e),s=e=>a.current(e);return"function"==typeof e?e().then(e=>{n||(t=Ya(e,i,s))}):t=Ya(e,i,s),()=>{n=!0,t?.()}},[e])}function Ha(e,t){Array.isArray(t)&&(t={deps:t});const n=t||{},[r,a]=P(void 0),[i,s]=P(!1),[l,o]=P(n.defaultValue),c=E(e);c.current=e;const d=E(n);d.current=n;const u=K(()=>{const e=d.current;return e.start?.(),s(!0),c.current().then(t=>{o(t),e.onSuccess?.(t)}).catch(t=>{const n=function(e){return e instanceof Error?e:new Error(String(e))}(t);a(n),e.onError?.(n)}).finally(()=>{s(!1),e.end?.()})},[]);return j(()=>{const e=d.current;e.condition&&!e.condition()||u()},[u,...n.deps??[]]),{data:l,isLoading:i,error:r,setData:o,refetch:u}}function Wa(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),Ha(e,t)}function Ua(e=!1){const[t,n]=P(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function Ga(e,t,n={}){const r=E(t);r.current=t;const a=E(n);a.current=n;const i=n.threshold||1;j(()=>{const t=e.current,n=new IntersectionObserver(e=>{const t=e[0].isIntersecting;a.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:i});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,i])}function Ka(){const e=E(!0);return j(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const qa="undefined"!=typeof window?q:j;function Ja(e,t=[]){const n=e.pageSize||50,[r,a]=P(null),[i,s]=P(e.payload),[l,o]=P(null),[c,d]=P([]),[u,m]=P(null),[p,h]=P(!1),f=E(0),g=e=>{a(null),d([]),m(null),s(e)},v=()=>{null!==u&&a(u)};return j(()=>{f.current+=1;const t=f.current;h(!0),e.search(i,r,n).then(e=>{t===f.current&&(d(null===r?e.result:t=>[...t,...e.result]),m(e.nextPage),o(null))}).catch(e=>{t===f.current&&o(e)}).finally(()=>{t===f.current&&h(!1)})},[...t,i,e.search,r,n]),Ga(e.nextPageTrigger,()=>{!p&&u&&v()},{threshold:.1,deps:[u,p]}),{search:g,refresh:()=>g(i),searchMore:v,result:c,page:r,hasMore:null!==u,error:l,isSearching:p}}function Xa(e,t=[]){return Ja({...e,async search(t,n,r){const a=n??0,i=a*r,s=await e.search(t,i,r);return{result:s,nextPage:0===s.length?null:a+1}}},t)}class Qa{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}}function Za(e){const t=P(e);return new Qa(t)}function ei(...e){return ne(a(e))}function ti(e,t="An error occurred"){return e instanceof Error?e.message:"string"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:t}function ni(e,t){const n=e.selectionStart,r=e.selectionEnd,a=e.value,i=`${a.slice(0,n)}\n${a.slice(r)}`;t?.(i),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{Bn as AnimateChangeInHeight,Ce as Avatar,gt as Badge,$t as Breadcrumbs,lt as Button,Vt as Card,Wt as CardContent,Ht as CardDescription,Ut as CardFooter,Yt as CardHeader,Bt as CardTitle,ze as Center,Gt as Checkbox,Kt as Collapsible,Jt as CollapsibleContent,qt as CollapsibleTrigger,Ve as ComboBox,hn as Command,fn as CommandDialog,xn as CommandEmpty,bn as CommandGroup,gn as CommandInput,wn as CommandItem,vn as CommandList,yn as CommandSeparator,Nn as CommandShortcut,Da as ComputedProperty,Mr as ConfirmModal,ot as CopyButton,De as DOMPopup,Zn as DateCombobox,Rr as DefaultBox,Er as DeleteModal,sn as Dialog,cn as DialogClose,un as DialogContent,mn as DialogDescription,dn as DialogOverlay,on as DialogPortal,pn as DialogTitle,ln as DialogTrigger,Ke as Divider,bt as DotBadge,ut as DropZone,Fn as Dropdown,Cn as DropdownMenu,Mn as DropdownMenuCheckboxItem,In as DropdownMenuContent,Tn as DropdownMenuGroup,Rn as DropdownMenuItem,$n as DropdownMenuLabel,_n as DropdownMenuPortal,On as DropdownMenuRadioGroup,Sn as DropdownMenuRadioItem,Ln as DropdownMenuSeparator,Dn as DropdownMenuShortcut,An as DropdownMenuSub,Pn as DropdownMenuSubContent,En as DropdownMenuSubTrigger,zn as DropdownMenuTrigger,ct as EmptyCollection,_r as ErrorBox,dt as FileUploadInput,pr as FilterBar,mr as FilterBtn,hr as FilterClear,gr as FilterOperator,ur as FilterProvider,pt as FormItem,vr as Heading,zr as InfoBox,wt as Input,Nt as InputList,kr as Label,wr as LanguageSwitcher,kt as Link,Vn as MenuGroup,Yn as MenuItem,Ct as MenuList,Cr as MessageBox,tn as Modal,rn as ModalBody,en as ModalContextProvider,an as ModalFooter,nn as ModalTitle,oa as ModeOption,ca as ModeToggle,Rt as NumberInput,Ee as OptionAdapter,Mt as Overlay,Pr as Panel,Wn as Popover,Kn as PopoverAnchor,Jn as PopoverClose,qn as PopoverContent,Hn as PopoverContext,Gn as PopoverTrigger,Ae as Popup,Se as PopupController,St as Portal,Je as PortalContainerContext,Xe as PortalContainerProvider,_a as Property,Vr as RadioGroup,Fr as RadioGroupAdapter,jr as RadioGroupItem,Hr as ResizableHandle,Br as ResizablePanel,Yr as ResizablePanelGroup,ya as RowSkeleton,xr as SelectBox,ua as SelectList,tr as SelectionCombobox,Wr as Separator,Aa as SharedState,Qa as SharedValue,pa as SidePanel,Ge as SimpleCombobox,Ur as Slider,Ia as Slot,Ca as SortableTableHeaderCell,fa as Spinner,nr as StringListCombobox,Pe as StringOptionAdapter,je as StringOptionAdapterWithCreate,It as Styles,Tr as SuccessBox,_e as SvgAvatar,Kr as Switch,wa as TBody,ba as THead,Na as TR,xa as Table,ka as TableHeaderCell,Jr as Tabs,Xr as TabsBar,ta as TabsContent,Zr as TabsList,Qr as TabsPanel,ea as TabsTrigger,va as TagsInput,ra as Text,rr as TextCombobox,aa as Textarea,sa as ThemeProvider,ia as ThemeProviderContext,Sr as ToastContext,Ar as ToastProvider,et as Tooltip,nt as TooltipContent,Ze as TooltipProvider,tt as TooltipTrigger,rt as VTooltip,Ir as WarningBox,st as buttonVariants,ei as cn,Re as computePosition,za as createCompositeStateProvider,ti as errorMessage,Fe as getDefaultComboBoxLayout,ni as insertNewlineAtCursor,ht as onActivateKey,Pa as useClickOutside,We as useComboboxCtrl,Ta as useCompositeState,ja as useCopyToClipboard,Fa as useDarkMode,Va as useDebounce,Xa as useDefaultScrollableSearch,La as useDefineSlot,mt as useDropZone,Ba as useEventSource,Ha as useFetch,Wa as useFetchOnce,Ua as useFlag,Ra as useGetCompositeStateProperty,Ga as useIntersectionObserver,Ka as useIsFirstRendering,Zt as useIsInModal,Xn as usePopoverContext,Le as usePopupController,Qe as usePortalContainer,qa as useSafeLayoutEffect,Ja as useScrollableSearch,Ma as useSetCompositeStateProperty,Za as useSharedValue,Sa as useSlot,la as useTheme,Or as useToast,Oa as useWatchCompositeStateProperty,Ea as useWatchSharedState,$a as useWatchSlot};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{clsx as a}from"clsx";import{ChevronUpIcon as i,ChevronDownIcon as s,XIcon as l,Loader2 as o,Check as c,CopyIcon as d,Plus as u,Info as m,X as p,ChevronRight as h,MoreHorizontal as f,Search as g,CheckIcon as v,ChevronRightIcon as x,ListFilter as b,LoaderCircle as y,AlertTriangle as w,ChevronsUpDown as N,SearchIcon as k,SquarePlus as C,CircleCheck as _,CircleX as z,TriangleAlert as I,ChevronDown as T,ChevronUp as R,Minus as M,Computer as O,Sun as S,Moon as L}from"lucide-react";import*as $ from"react";import D,{createContext as E,useRef as A,useState as P,useEffect as j,useContext as F,useId as V,Children as Y,isValidElement as B,Fragment as H,cloneElement as W,forwardRef as U,useMemo as G,useCallback as K,useLayoutEffect as q}from"react";import{createPortal as J}from"react-dom";import{Slot as X}from"@radix-ui/react-slot";import{useUITranslation as Q,useLanguage as Z,SUPPORTED_LANGUAGES as ee}from"@vertesia/ui/i18n";import{cva as te}from"class-variance-authority";import{twMerge as ne}from"tailwind-merge";import*as re from"@radix-ui/react-tooltip";import{Env as ae}from"@vertesia/ui/env";import{motion as ie,AnimatePresence as se}from"framer-motion";import*as le from"@radix-ui/react-checkbox";import*as oe from"@radix-ui/react-collapsible";import{Command as ce}from"cmdk";import*as de from"@radix-ui/react-dialog";import*as ue from"@radix-ui/react-dropdown-menu";import me from"dayjs";import pe from"react-calendar";import*as he from"@radix-ui/react-popover";import{isEqual as fe}from"lodash-es";import*as ge from"@radix-ui/react-label";import*as ve from"@radix-ui/react-radio-group";import*as xe from"react-resizable-panels";import*as be from"@radix-ui/react-separator";import*as ye from"@radix-ui/react-slider";import*as we from"@radix-ui/react-switch";import*as Ne from"@radix-ui/react-tabs";function ke(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 new Error(`Unexpected size: ${e}`)}}function Ce({size:t,src:n,name:r,shape:a="circle",color:i="bg-gray-500",className:s}){const l="circle"===a?"rounded-full":"rounded-md",o=ke(t||"md");if(n)return e("img",{className:`inline-block ${o} ${l} ${i} ${s}`,src:n,alt:r||n,title:r});if(r){const[n,a]=r.split(" "),c=a?`${n[0]}${a[0]}`:`${n[0]}${n[1]}`;return e("span",{className:`inline-flex ${o} items-center justify-center ${l} ${i} ${s}`,title:r,children:e("span",{className:("xs"!==t?"text-xs":"text-[0.6rem]")+" font-medium leading-none text-white",children:c})})}return e("span",{className:`inline-block ${o} overflow-hidden ${l} ${i}`,children:e("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e("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 _e({size:t,shape:n="circle",color:r="bg-gray-500",className:a,children:i}){const s="circle"===n?"rounded-full":"rounded-md",l=ke(t||"md");return e("span",{className:`inline-block ${l} overflow-hidden ${s} ${r} ${a}`,children:i})}function ze({className:t,children:n}){return e("div",{className:r("flex items-center justify-center",t),children:n})}class Ie{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":"x"===this.alignAxis?this.left=t.left:this.top=t.top;break;case"end":"x"===this.alignAxis?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case"center":"x"===this.alignAxis?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case"fill":"x"===this.alignAxis?(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 new Error("Invalid position. Cannot compute x,y coordinates");const r=null!=this.width,a=null!=this.height,i=r?this.width:t.width,s=a?this.height:t.height;return{rect:new DOMRect(this.left,this.top,i,s),constrainWidth:r,constrainHeight:a,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){const t=function(e){switch(e){case"start":return"end";case"end":return"start";default:return e}}(e.align);if(t!==e.align)return{...e,align:t}}}else{const t=function(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}}(e.position);if(t!==e.position)return{...e,position:t}}return null}}function Te(e,t,n){return"x"===n?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n,r){const a=new Ie(e.gap);let i=a.computePosition(e,t,n);const s=Te(i.rect,r,"x"),l=Te(i.rect,r,"y");if(s&&l)return i;let o=null;return s||(o=a.flipAxis(e,"x")),l||(o=a.flipAxis(o||e,"y")),o?(i=new Ie(a.gap).computePosition(o,t,n),function(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}(i.rect,r)?i:null):null}function Me(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),i=Math.min(e.bottom,t.bottom);return a<=n||i<=r?null:new DOMRect(n,r,a-n,i-r)}function Oe(e){const t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){const r=getComputedStyle(e);if(t&&"visible"!==r.overflowY||n&&"visible"!==r.overflowX)return!0}return!1}class Se{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=function(e,t=document.documentElement){const n=[];let r=e.parentElement;for(;r&&r!==t;)Oe(r)&&n.push(r),r=r.parentElement;return n.push(t),n}(this.anchor,this.root),this.visibleClientRect=function(e){if(0===e.length)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Me(e[n].getBoundingClientRect(),t),!t)return null;return t}(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){const t=this.scrollableParents,n=()=>{this.update()};window.addEventListener("resize",n);for(const e of t)e.addEventListener("scroll",n);let r,a;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener("click",r)},0)),this.options.closeOnEsc&&(a=e=>{"Escape"===e.key&&this.tryClose()},window.setTimeout(()=>{a&&document.addEventListener("keydown",a)},0));const i=this.options.blockPageScroll;return i&&(document.body.style.overflow="hidden",document.body.style.height="100%"),()=>{window.removeEventListener("resize",n);for(const e of t)e.removeEventListener("scroll",n);r&&document.removeEventListener("click",r),a&&document.removeEventListener("keydown",a),i&&(document.body.style.overflow="",document.body.style.height="")}}open(e,t){if(this.context)throw new 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 new 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",this.context=void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;const e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),a=this.visibleClientRect;if(!a)return;const i=Re(t,n,r,a);this.context.position=i||void 0,i&&(i.constrainHeight&&(e.style.height=`${i.rect.height}px`),i.constrainWidth&&(e.style.width=`${i.rect.width}px`),e.style.left=`${i.rect.left}px`,e.style.top=`${i.rect.top}px`,e.style.visibility="visible")}createPopupElement(){const 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 Le=E(void 0);function $e(){const e=F(Le);if(!e)throw new Error("usePopupController must be used inside a Popup component");return e}function De({ctrlRef:t,id:n,constraints:r,isOpen:a,children:i,className:s,onClose:l,onOpen:o,zIndex:c,position:d,anchor:u,root:m,closeOnClick:p,closeOnEsc:h,blockPageScroll:f}){const g=A(null),[v,x]=P(),b=A(l),y=A(o);return b.current=l,y.current=o,j(()=>{if(!u)throw new Error("Anchor element is required");const e=new Se({anchor:u,root:m,closeOnClick:p,closeOnEsc:h,blockPageScroll:f,onClose:()=>b.current?.(),onOpen:()=>y.current?.()});return x(e),()=>{e.tryClose()}},[u,f,p,h,m]),j(()=>{t&&(t.current=v)},[v,t]),j(()=>{v&&g.current?v.isOpen!==a&&(a?v.open(g.current,r):v.close()):v?.isOpen&&!a&&v.close()},[r,a,v]),e(Le.Provider,{value:v,children:a&&J(e("div",{id:n,style:{visibility:"hidden",position:d||"absolute",zIndex:c||100},ref:g,className:s,children:i}),document.body)})}function Ee({anchor:t,root:n,children:r,...a}){return!t.current||n&&!n.current?null:e(De,{anchor:t.current,root:n?.current||void 0,...a,children:r})}class Ae{filter(e,t){const 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}}class Pe extends Ae{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new Pe}class je extends Pe{createItem(e){return e}static instance=new je}function Fe(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:Ye,Menu:He,Toggle:Be}}function Ve({menuAlign:r="fill",menuGap:a,focusOnMount:i,onSelect:s,value:l,zIndex:o,unstyledInput:c,fullWidth:d,api:u,layout:m,adapter:p,items:h,placeholder:f,clearable:g,noMatchMessage:v,openOnFocus:x}){const[b]=P(`combobox-popup-${Math.floor(1e6*Math.random())}`),y=A(void 0),w=A(null),N=m?Object.assign(Fe(d,c),m):Fe(d,c),k=D.useRef(null),C=We({adapter:p,items:h,value:l,popupId:b});j(()=>{w.current&&i&&w.current.focus()},[i]),j(()=>{C.onSelect=s,C.popupCtrl=y.current},[C,s]),j(()=>{if(u&&C&&w.current)return u.current={open:()=>C.openMenu(),close:()=>C.closeMenu(),toggle:()=>C.toggleMenu(),setInputValue:e=>C.inputText=e,inputValue:C.inputText||"",selectedItem:C.selectedItem,focus:()=>w.current?.focus()},()=>{u.current=null}},[u,C]);const _=C.isMenuOpen&&(C.filteredItems.length>0||!!v);return t(n,{children:[e(N.Input,{boxRef:k,inputRef:w,ctrl:C,layout:N,placeholder:f,clearable:g,openOnFocus:x}),e(Ee,{id:b,ctrlRef:y,className:"combobox-popup",closeOnClick:!0,closeOnEsc:!0,onClose:()=>C.closeMenu(),isOpen:_,anchor:k,zIndex:o,constraints:{position:"bottom",align:r,gap:null!=a?a:4},children:e(N.Menu,{fillWidth:"fill"===r,items:C.filteredItems,ctrl:C,layout:N,adapter:p,noMatchMessage:v})})]})}function Ye({inputRef:n,placeholder:r,boxRef:a,ctrl:i,layout:s,clearable:o,openOnFocus:c}){const d=s.Toggle,u=o&&null!=i.selectedItem,m=(d?1:0)+(u?1:0),p=m>0?{paddingRight:`${s.buttonWidth*m+s.buttonRight}px`}:void 0;return t("div",{className:"relative",ref:a,children:[e("input",{ref:n,placeholder:r,...i.getInputProps(),onFocus:c?()=>i.openMenu():void 0,style:p,className:s.inputClass}),t("div",{style:{position:"absolute",right:`${s.buttonRight}px`,top:0,bottom:0,display:"flex",alignItems:"center",gap:"2px"},children:[u&&e("button",{type:"button",style:{border:"none",padding:0,margin:0,backgroundColor:"transparent",cursor:"pointer",display:"flex",alignItems:"center",width:`${s.buttonWidth}px`},onClick:()=>{i.selectedItem=null},children:e(l,{className:"w-4 h-4"})}),d&&e("button",{type:"button",style:{width:`${s.buttonWidth}px`,border:"none",padding:0,margin:0,backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},...i.getToggleButtonProps(),children:e(d,{ctrl:i,layout:s})})]})]})}function Be({ctrl:t}){return t.isMenuOpen?e(i,{className:"w-4 h-4"}):e(s,{className:"w-4 h-4"})}function He({fillWidth:t,items:n,layout:a,ctrl:i,adapter:s,noMatchMessage:l}){const{highlightedIndex:o,selectedItem:c}=i;return 0===n.length?l?e("div",{style:{width:t?"100%":void 0},className:a.menuClass,children:l}):null:e("ul",{style:{width:t?"100%":void 0,maxHeight:a.maxMenuHeight?`${a.maxMenuHeight}px`:"240px"},className:a.menuClass,...i.getMenuProps(),children:n.map((t,n)=>e("li",{"data-index":n,className:r(a.optionClass,o===n&&"option-highlighted",c===t&&"option-selected"),...i.getItemProps(t,n),children:s.renderOption(t)},s.idOf(t)))})}function We(e){const[t,n]=P(new Ue(e));return j(()=>{t?.withState(n)},[t]),t}class Ue{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,"string"==typeof n?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(){const e=new Ue({adapter:this.adapter,items:this.items,popupId:this.popupId});return e.setState=this.setState,e.onSelect=this.onSelect,e._inputText=this._inputText,e._highlightedIndex=this._highlightedIndex,e._selectedItem=this._selectedItem,e._isMenuOpen=this._isMenuOpen,e._filteredItems=this._filteredItems,e.popupCtrl=this.popupCtrl,e}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){const e=this.popupCtrl,t=e.context?.position?.position;t&&"top"===t&&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;const 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(){const e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{const t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{const n=t.key;if("Enter"===n){if(null!=this.highlightedIndex)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){const e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else"ArrowDown"===n?this.isMenuOpen?this.highlightIndex(null===this.highlightedIndex?0:(r=this.highlightedIndex,a=e.length,(r+1)%a),!1):this.openMenu():"ArrowUp"===n&&this.isMenuOpen&&this.highlightIndex(null===this.highlightedIndex?0:function(e,t){return(e-1+t)%t}(this.highlightedIndex,e.length),!0);var r,a}}}}function Ge({options:t,creatable:n,...r}){return e(Ve,{adapter:n?je.instance:Pe.instance,items:t,...r})}function Ke({className:t}){return e("hr",{className:r("w-full h-0.5 border-t-0 bg-border",t)})}function qe(...e){return ne(a(e))}const Je=D.createContext(void 0);function Xe({children:t,id:n="plugin-portal-container"}){const r=D.useContext(Je),a=D.useRef(null),[i,s]=D.useState(r||void 0);return D.useEffect(()=>{if(r)s(r);else if(a.current){const e=a.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){const t=function(e,t="plugin-portal-container"){const n=e instanceof Document?e.body:e;for(const e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;const r=document.createElement("div");return r.id=t,n.appendChild(r),r}(e,n);s(t)}else s(null)}},[n,r]),void 0===i?e("div",{ref:a,style:{display:"none"}}):e(Je.Provider,{value:i||void 0,children:t})}function Qe(){return D.useContext(Je)}const Ze=re.Provider,et=re.Root,tt=re.Trigger,nt=$.forwardRef(({className:t,sideOffset:n=4,side:r="top",...a},i)=>{const s=Qe();return e(re.Portal,{container:s,children:e(re.Content,{ref:i,sideOffset:n,side:r,style:{zIndex:100},className:qe("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",t),...a})})});function rt({description:n,children:r,size:a="sm",placement:i="top",className:s,asChild:l}){const[o,c]=$.useState(!1),d=$.useRef(!1);return $.useEffect(()=>{const e=()=>{c(!1),d.current=!0,requestAnimationFrame(()=>{d.current=!1})};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e)}},[]),e(Ze,{delayDuration:0,children:t(et,{open:o,onOpenChange:e=>{d.current||c(e)},children:[e(tt,{className:"cursor-pointer",asChild:l,children:r}),e(nt,{side:i,className:`px-3 py-1.5 max-w-${a} text-${a} px-3 ${s}`,children:n})]})})}nt.displayName=re.Content.displayName;const at=new Set;function it(e,t,n){j(()=>{t&&!at.has(e)&&(at.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}const st=te("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"}}),lt=$.forwardRef(({className:a,variant:i,size:s,asChild:l=!1,alt:c,isDisabled:d,isLoading:u,title:m,onClick:p,type:h,...f},g)=>{it("Button.alt",void 0!==c,"use aria-label for the accessible name and wrap in <VTooltip> for a visual tooltip. `alt` is forwarded to both for one release.");const v=l?X:"button",x=l?h:h??"button",b=f["aria-label"]??c,y=l?f.children:t(n,{children:[u&&e(o,{className:"animate-spin"}),f.children]}),w=e(v,{className:r(qe(st({variant:i,size:s})),a),disabled:d||u||f.disabled,ref:g,onClick:p,type:x,autoFocus:!1,...f,"aria-label":b,children:y});return c||m?e(rt,{description:c||m,asChild:!0,className:"cursor-pointer",size:"xs",placement:"top",children:w}):w});lt.displayName="Button";const ot=$.forwardRef(({size:t,content:n,toast:r,className:a,alt:i,"aria-label":s,...l},o)=>{const[u,m]=P(!1),{t:p}=Q();it("CopyButton.alt",void 0!==i,"use aria-label for the accessible name. `alt` is forwarded for one release.");const h=s??i??p("misc.copy");return e(lt,{ref:o,className:qe(a),variant:"unstyled",size:t||"sm",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{m(!0),setTimeout(()=>m(!1),2e3),r?.toast&&r.toast({status:"success",title:r.message||p("misc.copiedToClipboard"),duration:2e3})}).catch(e=>{console.error("Failed to copy text: ",e),r?.toast&&r.toast({status:"error",title:p("misc.failedToCopy"),duration:2e3})})},...l,"aria-label":h,title:h,children:u?e(c,{className:"text-success"}):e(d,{className:"size-4"})})});function ct({buttonLabel:n,title:r,children:a,onClick:i}){return e("div",{className:"flex items-center justify-center h-full text-center",children:t("div",{className:"py-12",children:[e("svg",{className:"mx-auto size-12",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:e("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"})}),e("h3",{className:"mt-2 text-sm font-semibold",children:r}),e("p",{className:"mt-1 text-sm text-muted",children:a}),e("div",{className:"mt-6",children:t(lt,{onClick:i,children:[e(u,{className:"-ms-0.5 me-1.5 size-5","aria-hidden":"true"}),n]})})]})})}function dt({children:n,onUpload:r}){const a=A(null);return t("label",{style:{cursor:"pointer"},children:[n,e("input",{ref:a,type:"file",style:{display:"none"},onChange:()=>{a.current?.files&&r(function(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}(a.current.files))}})]})}function ut({onUpload:n}){const r=mt({onUpload:n});return e("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:t("label",{htmlFor:"dropzone-file",className:"flex flex-col items-center justify-center w-full h-full",children:[t("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[e("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:e("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"})}),t("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:[e("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),e("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),e("input",{id:"dropzone-file",type:"file",className:"hidden"})]})})}function mt({onUpload:e,dragOverClass:t="is-drag-over-on",dropEffect:n="copy"}){const r=A(null);return{onDrop:n=>{var a;n.preventDefault(),(a=r.current)&&delete a.__dragOver_cnt__,r.current?.classList.remove(t);const i=n.dataTransfer.items;if(i){const t=[],n=(e,t="")=>new Promise(r=>{if(e.isFile)e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(function(e){return e.isDirectory}(e)){const a=e.createReader(),i=[],s=()=>{a.readEntries(a=>{if(a.length){for(const r of a)i.push(n(r,`${t+e.name}/`));s()}else Promise.all(i).then(e=>r(e.flat()))})};s()}});for(let e=0;e<i.length;e++){const r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{const n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{(function(e){if(!e)return!1;const t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t})(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{(function(e){if(!e)return!1;const t=e.__dragOver_cnt__;return!!t&&(e.__dragOver_cnt__=t-1,1===t)})(r.current)&&r.current?.classList.remove(t)},ref:r}}function pt({description:n,helpText:a,error:i,required:s,label:l,className:o,direction:c="column",children:d,disabled:u=!1,fullWidthLabel:p=!1,childrenId:h}){const f=V(),g=V(),v=V(),x=h??f,b=A(!1),y=Y.toArray(d).filter(B),w=1===y.length?y[0]:void 0;let N=!1,k=d;if(!!w&&!(w?.type===H)&&w){const e=w,t=e.props??{},n=function(...e){const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length>0?t.join(" "):void 0}(t["aria-describedby"],a?g:void 0,i?v:void 0),r=t["aria-invalid"]??(!!i||void 0);k=W(e,{id:t.id??x,"aria-describedby":n,"aria-invalid":r}),N=!0}else(function(){try{return ae.isDev}catch{return!1}})()&&!b.current&&(a||i||void 0===h)&&(b.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."));const C=N||h?x:void 0;return t("div",{className:r("flex w-full space-y-1",o,"row"===c?"flex-row justify-between items-center gap-2":"row-reverse"===c?"flex-row-reverse justify-between items-center gap-2":"flex-col"),children:[t("div",{className:r("flex items-center gap-1 mb-0",p&&"w-full"),children:[t("label",{htmlFor:C,className:`text-sm font-medium mb-1 ${u?"text-muted":""} ${p&&"flex-1"}`,children:[l,s?e("span",{className:"text-destructive -mt-4 ms-1",children:"*"}):""]}),n&&e("div",{className:"mx-2 flex w-4 items-center",children:e(rt,{description:n,children:e(m,{className:"size-3 text-muted"})})})]}),k,a&&e("p",{id:g,className:"text-xs text-muted",children:a}),i&&e("p",{id:v,className:"text-xs text-destructive",children:i})]})}function ht(e){return t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e(t))}}ot.displayName="CopyButton";const ft=te("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"}},defaultVariants:{variant:"default"}});function gt({className:t,variant:n,children:r,onClick:a,...i}){const s=a?{role:"button",tabIndex:0,onClick:a,onKeyDown:ht(a)}:{};return e("span",{className:qe(ft({variant:n}),t),...s,...i,children:r})}const vt=te("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:""}},defaultVariants:{variant:"default"}}),xt=te("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"}},defaultVariants:{variant:"default"}});function bt({variant:n,className:r,dotClassName:a,children:i,...s}){return t("span",{className:qe(vt({variant:n}),r),...s,children:[e("div",{className:"flex-shrink-0",children:e("svg",{className:qe(xt({variant:n}),a),viewBox:"0 0 6 6","aria-hidden":"true",children:e("circle",{cx:3,cy:3,r:3})})}),e("span",{className:"truncate",children:i})]})}const yt=te("",{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"}}),wt=$.forwardRef(({className:n,type:r,size:a="md",variant:i="default",clearable:s=!0,onChange:l,value:o,invalid:c,...d},u)=>{const m=d["aria-invalid"]??(!!c||void 0);return t("div",{className:"w-full relative inline-block [&:hover_.clear-button]:opacity-100",children:[e("input",{type:r,className:qe(yt({size:a,variant:i}),n,s&&o?"pe-8":""),ref:u,value:null==o?"":o,onChange:e=>{l?.(e.target.value)},...d,"aria-invalid":m}),s&&o&&!d.readOnly&&!d.disabled&&e(lt,{variant:"link",size:"icon",type:"button",onClick:()=>{l?.("")},className:"clear-button opacity-0 transition-opacity duration-200\n absolute top-1/2 -translate-y-1/2 text-muted !hover:text-destructive cursor-pointer\n flex items-center justify-center size-6 rounded end-2","aria-label":"Clear input",children:e(p,{size:16})})]})});function Nt({value:n=[],onChange:a,className:i,delimiters:s=", ",placeholder:l,autoFocus:o,disabled:c=!1}){const[d,u]=P("");return t("div",{className:r(i,"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",c&&"opacity-50 cursor-not-allowed"),children:[n&&n.length>0&&n.map((t,i)=>e(rt,{description:"click to remove",children:e(gt,{variant:"secondary",onClick:()=>(e=>{c||n&&n.length>0&&(n.splice(e,1),a([...n]))})(i),className:r("flex-shrink-0 transition-colors",c?"cursor-not-allowed":"cursor-pointer hover:bg-destructive hover:text-destructive"),title:t,children:e("span",{className:"break-all",children:t})},i)},i)),e(wt,{clearable:!1,className:"placeholder:text-muted px-1 flex-1 min-w-[120px]",variant:"unstyled",type:"text",value:d,onBlur:e=>{if(c)return;const t=e.currentTarget.value;t?.trim()&&(a([...n,t.trim()]),u(""))},onKeyDown:e=>{if(c)return;const t=e.currentTarget.value,r=!t.trim(),i=e.key;"Enter"===i||s.indexOf(i)>-1?(e.preventDefault(),n&&!r&&(a([...n,t.trim()]),u(""))):"Backspace"===i&&r&&n&&n.length>0&&(n.pop(),a([...n]))},onPaste:e=>{if(c)return;const t=e.clipboardData.getData("text");if(t){e.preventDefault();const r=s.split("").map(e=>" "===e?"\\s":e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),i=new RegExp(`[${r}]+`),l=t.split(i).map(e=>e.trim()).filter(e=>e.length>0);l.length>0&&a([...n,...l]),u("")}},onChange:u,placeholder:n&&0!==n.length?"":l,autoFocus:o,disabled:c})]})}function kt({underline:t="always",className:n,children:a,...i}){let s;return"always"===t?s="underline":"hover"===t&&(s="hover:underline"),e("a",{className:r("text-indigo-800 dark:text-indigo-300",n,s),...i,children:a})}function Ct({className:t,children:n}){return e("ul",{className:`${t} space-y-1 flex flex-col items-start`,children:n})}wt.displayName="Input";const _t=U(function(t,n){const{current:a,children:i,className:s,href:l="#",onClick:o,...c}=t;return e("li",{className:r(s,a?"bg-muted":"","w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted"),children:e("a",{ref:n,href:l,onClick:e=>{o?(e.preventDefault(),o(e)):"#"===l&&e.preventDefault()},className:"w-full flex items-center gap-x-3",...c,children:i})})});Ct.Item=_t;const zt="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",It={INPUT_UNSTYLED:"block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent",INPUT_NO_PADDING:zt,INPUT:`${zt} py-1.5`};function Tt(e){return null==e||Number.isNaN(e)?"":e.toString()}const Rt=D.forwardRef(({value:t,onChange:n,className:a,noScroll:i=!1,noSpinners:s=!1,...l},o)=>{const[c,d]=D.useState(Tt(t));return j(()=>{if(null==t||!Number.isNaN(t)){const e=Tt(t);d(e)}},[t]),e("input",{onWheel:i?e=>{e.currentTarget.blur()}:l.onWheel,type:"number",value:c,onChange:e=>{const t=e.target.value;if(d(t),""===t)n?.(void 0,t);else{const e=parseFloat(t);n?.(e,t)}},className:r(a,It.INPUT,{"no-spinners":s},s&&"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"),ref:o,...l})});function Mt({children:n,overlayContent:r,className:a="",overlayClassName:i="",position:s="right",width:l,height:o,showCloseButton:c=!0,onOpen:d,onClose:u,triggerClassName:m="",backdropClassName:h="",animationConfig:f={type:"spring",stiffness:300,damping:30}}){const[g,v]=P(!1),x=function(e){switch(e){case"left":return{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"}};case"right":default: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}}}}(s),b=function(e,t,n){const 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":default: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"}`}}(s,l,o);return t("div",{className:`flex items-center justify-center w-full ${a}`,children:[e(lt,{variant:"unstyled",size:"none",onClick:()=>{v(!0),d?.()},className:`w-full align-left cursor-pointer ${m}`,children:n}),g&&e("div",{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${h}`,children:t(ie.div,{...x,transition:f,className:`${b} ${i}`,children:[c&&e("div",{className:"absolute top-2 end-2 z-10",children:e(lt,{onClick:()=>{v(!1),u?.()},variant:"primary",children:e(p,{})})}),e("div",{className:c?"mt-8":"",children:r})]})})]})}const Ot="--tailwind-portal";function St({children:t}){const n=A(null),[r,a]=P(null);return j(()=>{if(n.current){const e=n.current.ownerDocument;let t=e.getElementById(Ot);t||(t=e.createElement("DIV"),t.id=Ot,e.body.appendChild(t)),a(t)}},[]),r?J(t,r):e("span",{ref:n})}function Lt({path:n,maxItems:r=3,className:a,separator:i}){const s=n||[],l=t=>{const n="string"==typeof t.label&&t.label.length>20?`${t.label.slice(0,17)}...`:t.label;return t.onClick?e(At,{onClick:t.onClick,href:t.href,title:"string"==typeof t.label?t.label:void 0,children:n}):t.href?e(At,{href:t.href,title:"string"==typeof t.label?t.label:void 0,children:n}):e(Pt,{children:n})};if(s.length<=r)return e($t,{className:qe("w-full flex items-center",a),children:e(Dt,{children:s.map((n,r)=>t($.Fragment,{children:[e(Et,{children:l(n)}),r<s.length-1&&e(jt,{children:i??e(h,{className:"cn-rtl-flip"})})]},r))})});const o=s.slice(-(r-1));return e($t,{className:qe("w-full flex items-center",a),children:t(Dt,{children:[e(Et,{children:e(Ft,{})}),e(jt,{children:i??e(h,{className:"cn-rtl-flip"})}),o.map((n,r)=>t($.Fragment,{children:[e(Et,{children:l(n)}),r<o.length-1&&e(jt,{children:i??e(h,{className:"cn-rtl-flip"})})]},r))]})})}const $t=$.forwardRef(({...t},n)=>e("nav",{ref:n,"aria-label":"breadcrumb",...t}));$t.displayName="Breadcrumb";const Dt=$.forwardRef(({className:t,...n},r)=>e("ol",{ref:r,className:qe("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5",t),...n}));Dt.displayName="BreadcrumbList";const Et=$.forwardRef(({className:t,...n},r)=>e("li",{ref:r,className:qe("inline-flex items-center gap-1.5 text-muted",t),...n}));Et.displayName="BreadcrumbItem";$.forwardRef(({asChild:t,className:n,...r},a)=>e("a",{ref:a,className:qe("transition-colors hover:text-muted",n),...r})).displayName="BreadcrumbLink";const At=$.forwardRef(({className:t,href:n,onClick:r,...a},i)=>e(lt,{variant:"ghost",size:"md",ref:i,className:qe("p-0! hover:underline! hover:bg-background!",t),onClick:e=>{e.preventDefault(),r&&r(e)},...a}));At.displayName="BreadcrumbButton";const Pt=$.forwardRef(({className:t,...n},r)=>e("span",{ref:r,"aria-current":"page",className:qe("font-normal text-foreground",t),...n}));Pt.displayName="BreadcrumbPage";const jt=({children:t,className:n,...r})=>e("li",{role:"presentation","aria-hidden":"true",className:qe("[&>svg]:w-3.5 [&>svg]:h-3.5",n),...r,children:t??e(h,{className:"cn-rtl-flip"})});jt.displayName="BreadcrumbSeparator";const Ft=({className:n,...r})=>t("span",{role:"presentation","aria-hidden":"true",className:qe("flex h-9 w-9 items-center justify-center",n),...r,children:[e(f,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"More"})]});Ft.displayName="BreadcrumbEllipsis";const Vt=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("rounded-xl border bg-card text-card-foreground shadow",t),...n}));Vt.displayName="Card";const Yt=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("flex flex-col p-6",t),...n}));Yt.displayName="CardHeader";const Bt=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("font-semibold leading-none tracking-tight",t),...n}));Bt.displayName="CardTitle";const Ht=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("text-sm text-muted-foreground",t),...n}));Ht.displayName="CardDescription";const Wt=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("p-6 pt-0",t),...n}));Wt.displayName="CardContent";const Ut=$.forwardRef(({className:t,...n},r)=>e("div",{ref:r,className:qe("flex items-center p-6 pt-0",t),...n}));Ut.displayName="CardFooter";const Gt=$.forwardRef(({className:t,...n},r)=>e(le.Root,{ref:r,className:qe("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",t),...n,children:e(le.Indicator,{className:qe("flex items-center justify-center text-current"),children:e(c,{className:"size-4"})})}));function Kt({...t}){return e(oe.Root,{"data-slot":"collapsible",...t})}function qt({...t}){return e(oe.Trigger,{"data-slot":"collapsible-trigger",...t})}function Jt({...t}){return e(oe.Content,{"data-slot":"collapsible-content",...t})}function Xt({children:t}){return e("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:t})}Gt.displayName=le.Root.displayName;const Qt=E(!1);function Zt(){return!!F(Qt)}function en({children:t}){return e(Qt.Provider,{value:!0,children:t})}function tn({className:n,children:r,isOpen:a,onClose:i,description:s="Modal Description",noCloseButton:l=!1,allowOverflow:o=!1,disableCloseOnClickOutside:c=!1,size:d="md",action:u}){const m=e=>{e||i()};return t(sn,{open:a,onOpenChange:e=>{c&&!e||m(e)},children:[o&&e(dn,{className:"z-50 fixed inset-0 bg-black/80"}),e(Xt,{children:e(mn,{children:s})}),t(un,{className:qe("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",function(){switch(d){case"sm":return"max-w-[20vw]";case"md":default: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]"}}(),n),children:[e("div",{className:"top-4 end-4 absolute",children:t("div",{className:"flex gap-2",children:[u&&u,!l&&e(cn,{onClick:()=>m(!1),asChild:!0,autoFocus:!1,children:e(lt,{variant:"outline",alt:"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:e(p,{className:"size-4"})})})]})}),e(en,{children:r})]})]})}const nn=({children:n,show:r=!0,className:a,description:i,showDivider:s=!1,...l})=>r?t(pn,{className:qe(s?"border-b-solid border-b border-b-1 pb-2 mb-4":"","text-lg font-semibold leading-6 tracking-tight",{"py-2":!i},a),...l,children:[n,i&&e(mn,{className:"text-sm !font-normal text-muted-foreground pb-2",children:i})]}):t(Xt,{children:[e(pn,{children:n}),i&&e(mn,{children:i})]}),rn=({children:t,className:n,...r})=>e("div",{className:qe("text-sm max-h-[80vh] overflow-y-auto",n),...r,children:t}),an=({align:t="right",children:n,className:r,...a})=>e("div",{className:qe("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"}[t],r),...a,children:n}),sn=de.Root,ln=de.Trigger,on=de.Portal,cn=de.Close,dn=$.forwardRef(({className:t,...n},r)=>e(de.Overlay,{ref:r,className:qe("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",t),...n}));dn.displayName=de.Overlay.displayName;const un=$.forwardRef(({className:n,children:r,...a},i)=>{const s=Qe();return t(on,{container:s,children:[e(dn,{}),e(de.Content,{ref:i,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:qe("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",n),...a,children:r})]})});un.displayName=de.Content.displayName;const mn=$.forwardRef(({className:t,...n},r)=>e(de.Description,{ref:r,className:qe("text-sm text-muted",t),...n}));mn.displayName=de.Description.displayName;const pn=$.forwardRef(({className:t,...n},r)=>e(de.Title,{ref:r,className:qe("text-lg font-semibold leading-none tracking-tight",t),...n}));pn.displayName=de.Title.displayName;const hn=$.forwardRef(({className:t,...n},r)=>e(ce,{ref:r,className:qe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n}));hn.displayName=ce.displayName;const fn=({children:t,...n})=>e(sn,{...n,children:e(un,{className:"shadow-lg p-0 overflow-hidden",children:e(hn,{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:t})})}),gn=$.forwardRef(({className:n,...r},a)=>t("div",{className:"flex items-center px-3 border-b","cmdk-input-wrapper":"",children:[e(g,{className:"opacity-50 size-4 shrink-0"}),e(ce.Input,{ref:a,className:qe("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",n),...r})]}));gn.displayName=ce.Input.displayName;const vn=$.forwardRef(({className:t,...n},r)=>e(ce.List,{ref:r,className:qe("overflow-y-auto overflow-x-hidden",t),...n}));vn.displayName=ce.List.displayName;const xn=$.forwardRef((t,n)=>e(ce.Empty,{ref:n,className:"py-2 text-sm text-center",...t}));xn.displayName=ce.Empty.displayName;const bn=$.forwardRef(({className:t,...n},r)=>e(ce.Group,{ref:r,className:qe("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",t),...n}));bn.displayName=ce.Group.displayName;const yn=$.forwardRef(({className:t,...n},r)=>e(ce.Separator,{ref:r,className:qe("-mx-1 h-px bg-border",t),...n}));yn.displayName=ce.Separator.displayName;const wn=$.forwardRef(({className:t,...n},r)=>e(ce.Item,{ref:r,className:qe("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",t),...n}));wn.displayName=ce.Item.displayName;const Nn=({className:t,...n})=>e("span",{className:qe("ms-auto text-xs tracking-widest text-muted-foreground",t),...n});Nn.displayName="CommandShortcut";const kn=$.createContext(!1);function Cn({...t}){return e(ue.Root,{"data-slot":"dropdown-menu",...t})}function _n({...t}){return e(ue.Portal,{"data-slot":"dropdown-menu-portal",...t})}function zn({...t}){return e(ue.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function In({className:t,align:n="start",sideOffset:r=4,...a}){return e(ue.Portal,{children:e(ue.Content,{"data-slot":"dropdown-menu-content",sideOffset:r,align:n,className:qe("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",t),...a})})}function Tn({...t}){return e(ue.Group,{"data-slot":"dropdown-menu-group",...t})}function Rn({className:t,inset:n,variant:r="default",...a}){return e(ue.Item,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:qe("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",t),...a})}function Mn({className:n,children:r,checked:a,inset:i,...s}){return t(ue.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":i,className:qe("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",n),checked:a,...s,children:[e("span",{className:"absolute end-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-checkbox-item-indicator",children:e(ue.ItemIndicator,{children:e(v,{})})}),r]})}function On({...t}){return e(ue.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function Sn({className:n,children:r,inset:a,...i}){return t(ue.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:qe("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",n),...i,children:[e("span",{className:"absolute end-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:e(ue.ItemIndicator,{children:e(v,{})})}),r]})}function Ln({className:t,inset:n,...r}){return e(ue.Label,{"data-slot":"dropdown-menu-label","data-inset":n,className:qe("text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7",t),...r})}function $n({className:t,...n}){return e(ue.Separator,{"data-slot":"dropdown-menu-separator",className:qe("bg-border -mx-1 my-1 h-px",t),...n})}function Dn({className:t,...n}){return e("span",{"data-slot":"dropdown-menu-shortcut",className:qe("text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest",t),...n})}function En({...t}){return e(ue.Sub,{"data-slot":"dropdown-menu-sub",...t})}function An({className:n,inset:r,children:a,...i}){return t(ue.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":r,className:qe("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",n),...i,children:[a,e(x,{className:"cn-rtl-flip ms-auto"})]})}function Pn({className:t,...n}){return e(ue.SubContent,{"data-slot":"dropdown-menu-sub-content",className:qe("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",t),...n})}const jn={left:"start",center:"center",right:"end"};function Fn({trigger:n,children:r,align:a="right",hover:i}){const[s,l]=$.useState(!1),o=$.useRef(null);if(i){return t("div",{className:"relative inline-flex",onMouseEnter:()=>{o.current&&clearTimeout(o.current),l(!0)},onMouseLeave:()=>{o.current=setTimeout(()=>l(!1),80)},children:[n,s&&e("div",{className:qe("absolute top-full pt-1 z-50","right"===a?"end-0":"center"===a?"left-1/2 -translate-x-1/2":"start-0"),children:e("div",{className:"min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground",children:e(kn.Provider,{value:!0,children:r})})})]})}return t(Cn,{children:[e(zn,{asChild:!0,children:e("span",{className:"-m-1.5 flex items-center p-1.5",children:n})}),e(In,{align:jn[a],className:"w-max",children:r})]})}function Vn({children:n,label:r}){return t(Tn,{children:[r&&e(Ln,{children:r}),n]})}function Yn({children:t,href:n,onClick:r,isDisabled:a=!1,variant:i="default",className:s}){const l=$.useContext(kn),o=qe("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","destructive"===i?"text-destructive":"",a?"pointer-events-none opacity-50":"hover:bg-muted focus:bg-muted",s);if(l){const i=e=>{e.stopPropagation(),r?.(e)};return n?e("a",{href:n,className:o,children:t}):e("button",{type:"button",className:o,disabled:a,onClick:i,children:t})}return e(Rn,{className:qe("data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap",s),disabled:a,variant:i,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?e("a",{href:n,children:t}):t})}const Bn=({children:t,className:n})=>{const r=A(null),[a,i]=P("auto");return j(()=>{if(r.current){const e=new ResizeObserver(e=>{const t=e[0].contentRect.height;i(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),e("div",{className:qe(n,"overflow-hidden transition-all duration-100 ease-in"),style:{height:a},children:e("div",{ref:r,children:t})})},Hn=$.createContext(null),Wn=({hover:t=!1,click:n=!1,modal:r,children:a,_open:i,onOpenChange:s})=>{const[l,o]=$.useState(i||!1);return e(Hn.Provider,{value:{open:l,setOpen:o,hover:t,click:n},children:e(he.Root,{open:l,onOpenChange:e=>{o(e),s&&s(e)},modal:r,children:a})})};function Un(e=!1,t=()=>{},n){e&&t("enter"===n)}const Gn=$.forwardRef(({children:t,...n},r)=>{const a=$.useContext(Hn);if(!a)throw new Error("PopoverTrigger must be used within a Popover");const{setOpen:i,hover:s,click:l}=a;return e(he.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>Un(s,i,"enter"),onMouseLeave:()=>Un(s,i,"leave"),onClick:()=>{l&&i(e=>!e)},...n,children:t})});Gn.displayName=he.Trigger.displayName;const Kn=he.Anchor,qn=$.forwardRef(({className:t,align:n="center",side:r="bottom",...a},i)=>{const s=$.useContext(Hn);if(!s)throw new Error("PopoverContent must be used within a Popover");const{setOpen:l,hover:o}=s,c=Qe();return e(he.Portal,{container:c,children:e(he.Content,{ref:i,align:n,side:r,onMouseEnter:()=>Un(o,l,"enter"),onMouseLeave:()=>Un(o,l,"leave"),className:qe("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",t),...a})})});qn.displayName=he.Content.displayName;const Jn=he.Close;function Xn(){const e=$.useContext(Hn);if(!e)throw new Error("usePopoverContext must be used within a Popover");return{...e,close:()=>e.setOpen(!1)}}Jn.displayName=he.Close.displayName;const Qn="\n.calendar-wrapper .react-calendar__navigation {\n display: flex !important;\n justify-content: space-between !important;\n align-items: center !important;\n gap: 8px !important;\n padding: 8px !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__label {\n flex: 1 !important;\n text-align: center !important;\n font-weight: 500 !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__arrow {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n min-width: 32px !important;\n height: 32px !important;\n border-radius: 4px !important;\n border: 1px solid hsl(var(--border)) !important;\n background: hsl(var(--background)) !important;\n color: hsl(var(--foreground)) !important;\n}\n\n.calendar-wrapper .react-calendar__navigation__arrow:hover {\n background: oklch(var(--muted)) !important;\n}\n\n.calendar-wrapper .react-calendar__tile {\n cursor: pointer !important;\n width: 0.5rem !important;\n font-size: 0.875rem !important;\n}\n\n.calendar-wrapper .react-calendar__tile:hover,\n.calendar-wrapper .react-calendar__month-view__days__day:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year:hover,\n.calendar-wrapper .react-calendar__year-view__months__month:hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile:not(.react-calendar__tile--active):hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile--hover {\n background: #b5b5b580 !important;\n}\n\n.calendar-wrapper .react-calendar__tile--disabled,\n.calendar-wrapper .react-calendar__tile:disabled,\n.calendar-wrapper .react-calendar__month-view__days__day--disabled,\n.calendar-wrapper .react-calendar__month-view__days__day:disabled,\n.calendar-wrapper .react-calendar__year-view__months__month--disabled,\n.calendar-wrapper .react-calendar__year-view__months__month:disabled,\n.calendar-wrapper .react-calendar__decade-view__years__year--disabled,\n.calendar-wrapper .react-calendar__decade-view__years__year:disabled {\n cursor: not-allowed !important;\n color: #9ca3af !important;\n}\n\n.calendar-wrapper .react-calendar__tile--disabled:hover,\n.calendar-wrapper .react-calendar__tile:disabled:hover,\n.calendar-wrapper .react-calendar__month-view__days__day--disabled:hover,\n.calendar-wrapper .react-calendar__month-view__days__day:disabled:hover,\n.calendar-wrapper .react-calendar__year-view__months__month--disabled:hover,\n.calendar-wrapper .react-calendar__year-view__months__month:disabled:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year--disabled:hover,\n.calendar-wrapper .react-calendar__decade-view__years__year:disabled:hover {\n background: transparent !important;\n}\n\n\n.calendar-wrapper .react-calendar__month-view__weekdays {\n font-size: 0.75rem !important;\n}\n\n.calendar-wrapper .react-calendar__month-view__weekdays__weekday {\n width: 0.75rem !important;\n font-size: 0.75rem !important;\n text-align: center !important;\n}\n \n",Zn=({filterValues:r,setFilterValues:a,isRange:i=!1})=>{const[s,l]=P(!1),[o,c]=P([null,null]),{t:d}=Q(),u=r[0]?me(r[0]).toDate():void 0,m=i?[o[0]||(r[0]?me(r[0]).toDate():null),o[1]||(r[1]?me(r[1]).toDate():null)]:[null,null];j(()=>{i&&c([r[0]?me(r[0]).toDate():null,r[1]?me(r[1]).toDate():null])},[r,i]);const p=e=>{if(i)Array.isArray(e)&&(c([e[0],e[1]]),e[0]&&e[1]?a([me(e[0]).format("YYYY-MM-DD"),me(e[1]).format("YYYY-MM-DD")]):e[0]&&a([me(e[0]).format("YYYY-MM-DD")]));else if(e){const t=Array.isArray(e)?e[0]:e;t&&(a([me(t).format("YYYY-MM-DD")]),l(!1))}};return t(Wn,{_open:s,onOpenChange:l,children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center min-h-[20px]",children:i?m[0]&&m[1]?t("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium",children:me(m[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted-foreground",children:"-"}),e("span",{className:"font-medium",children:me(m[1]).format("MMMM DD, YYYY")})]}):m[0]?t("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium",children:me(m[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted-foreground",children:"- Select end"})]}):e("span",{className:"text-muted-foreground",children:d("filter.selectRange")}):u?me(u).format("MMMM DD, YYYY"):"Pick a date"})}),e(qn,{className:"w-auto p-0",align:"start",side:"bottom",alignOffset:-4,sideOffset:6,children:e("div",{className:"p-2",children:i?t(n,{children:[t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:m,onChange:p,selectRange:!0,returnValue:"range",maxDate:(()=>{const e=new Date;return e.setHours(23,59,59,999),e})(),className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(m[0]){const e=m[0].getTime();if(m[1]){const n=m[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""}})]}),m[0]&&m[1]&&e("div",{className:"border-t pt-2",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:()=>l(!1),children:"Cancel"}),e(lt,{size:"sm",onClick:()=>l(!1),children:"Apply"})]})})]}):t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:u,onChange:p,selectRange:!1,maxDate:(()=>{const e=new Date;return e.setHours(23,59,59,999),e})(),className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(u&&t===u.getTime())return"bg-primary text-primary-foreground rounded-md font-semibold"}return""}})]})})})]})};function er({value:t,labelRenderer:r,fallbackLabel:a}){const[i,s]=P(a||t),[l,o]=P(!1);return j(()=>{if(!r)return void s(a||t);(async()=>{o(!0);try{const e=r(t);if(e instanceof Promise){const t=await e;s(t)}else s(e)}catch(e){console.error("Error rendering label:",e),s(a||t)}finally{o(!1)}})()},[t,r,a]),l?e("span",{className:"text-muted-foreground",children:"Loading..."}):e(n,{children:i})}const tr=({filterType:r,filterValues:a,setFilterValues:i,options:s,labelRenderer:l,multiple:o=!0})=>{const[c,d]=P(!1),[u,m]=P(""),p=A(null),{t:h}=Q(),f=s?.filter(e=>!a.some(t=>t.value===e.value));return t(Wn,{_open:c,onOpenChange:e=>{d(e),e||setTimeout(()=>{m("")},200)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0",children:e("div",{className:"flex gap-1.5 items-center",children:1===a?.length?(()=>{const t=a[0];return e(er,{value:t.value||"",labelRenderer:l,fallbackLabel:t.label})})():`${a?.length} selected`})}),e(qn,{className:"w-[300px] p-0",children:e(Bn,{children:t(hn,{children:[e(gn,{placeholder:r,className:"h-9",value:u,onInputCapture:e=>{m(e.currentTarget.value)},ref:p}),t(vn,{children:[e(xn,{children:h("filter.noResultsFound")}),e(bn,{children:a.map(n=>t(wn,{className:"group flex gap-2 items-center",onSelect:()=>{i(a.filter(e=>e.value!==n.value)),setTimeout(()=>{m("")},200),d(!1)},children:[o&&e("input",{type:"checkbox",checked:!0,onChange:()=>{}}),e(er,{value:n.value||"",labelRenderer:l,fallbackLabel:n.label})]},n.value))}),f?.length>0&&t(n,{children:[e(yn,{}),e(bn,{children:f.filter(e=>String(e.label||e.value).toLowerCase().includes(u.toLowerCase())).map(n=>t(wn,{className:"group flex gap-2 items-center",value:String(n.label||n.value),onSelect:()=>{const e={value:n.value,label:n.label};i(o?[...a,e]:[e]),setTimeout(()=>{m("")},200),d(!1)},children:[o&&e(Gt,{checked:!1,className:"opacity-0 group-data-[selected=true]:opacity-100"}),e("span",{className:"text-muted",children:e(er,{value:n.value||"",labelRenderer:n.labelRenderer||l,fallbackLabel:n.label})})]},n.value))})]})]})]})})})]})},nr=({filterType:n,filterValues:r,setFilterValues:a})=>{const[i,s]=P(!1),[l,o]=P(r);return t(Wn,{_open:i,onOpenChange:e=>{s(e),e||JSON.stringify(l)===JSON.stringify(r)||o(r)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r.length>0?1===r.length?r[0]:`${r.length} tags`:"Add tags..."})}),e(qn,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-3",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(Nt,{value:l,onChange:o,placeholder:`Add ${n.toLowerCase()}...`}),t("div",{className:"flex gap-2 justify-end",children:[e(lt,{size:"sm",variant:"ghost",onClick:()=>{o(r),s(!1)},children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{a(l),s(!1)},children:"Apply"})]})]})})]})},rr=({filterType:n,filterValue:r,setFilterValue:a})=>{const[i,s]=P(!1),[l,o]=P(r);return t(Wn,{_open:i,onOpenChange:e=>{s(e),e||l===r||o(r)},children:[e(Gn,{className:"rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition",children:e("div",{className:"flex gap-1.5 items-center",children:r||"Enter text..."})}),e(qn,{className:"w-[300px] p-3",children:t("div",{className:"flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:n})}),e(wt,{autoFocus:!0,type:"text",size:"sm",value:l,onChange:o,onKeyDown:e=>{"Enter"===e.key&&(a(l),s(!1))},placeholder:"Enter text..."}),e("div",{className:"mt-2 p-2 border-t",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:()=>{o(r),s(!1)},children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{a(l),s(!1)},children:"Apply"})]})})]})})]})};function ar({selectedView:r,selectedDate:a,setSelectedDate:i,setFilters:s,filters:l,handleClose:o,filterGroups:c}){const{t:d}=Q(),[u,m]=P([null,null]),[p,h]=P([null,null]),f=c.find(e=>e.name===r),g=f?.multiple,v=new Date;v.setHours(23,59,59,999);const x=[p[0]||u[0],p[1]||u[1]],b=e=>{if(g)Array.isArray(e)?(h([e[0],e[1]]),m([e[0],e[1]])):(h([e,null]),m([e,null]));else{const t=Array.isArray(e)?e[0]:e;if(i(t||void 0),t){const e=new Date(t);e.setHours(0,0,0,0),s([...l,{name:r||"",placeholder:f?.placeholder,value:[{value:e.toISOString(),label:me(e).format("LLL dd, y")}],type:f?.type||"date",multiple:f?.multiple||!1}]),o()}}};return e("div",{className:"p-2",children:g?t(n,{children:[e("div",{children:g?x[0]&&x[1]?t("span",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs text-muted",children:d("filter.from")}),e("span",{className:"text-xs font-medium",children:me(x[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted",children:d("filter.to")}),e("span",{className:"text-xs font-medium",children:me(x[1]).format("MMMM DD, YYYY")})]}):x[0]?t("span",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs text-muted",children:d("filter.from")}),e("span",{className:"text-xs font-medium",children:me(x[0]).format("MMMM DD, YYYY")}),e("span",{className:"text-xs text-muted",children:"→ Select end date"})]}):e("span",{className:"text-muted text-xs",children:f?.placeholder||f?.name||r||"Select date range"}):a?me(a).format("MMMM DD, YYYY"):"Pick a date"}),t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:x,onChange:b,selectRange:!0,returnValue:"range",maxDate:v,className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(x[0]){const e=x[0].getTime();if(x[1]){const n=x[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""}},`${x[0]?.getTime()}-${x[1]?.getTime()}`)]}),e("div",{className:"border-t pt-2",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{if(u[0]){const e=new Date(u[0]),t=u[1]?new Date(u[1]):new Date(u[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);const n=[];n.push({value:e.toISOString(),label:me(e).format("LLL dd, y")}),u[1]&&u[0].getTime()!==u[1].getTime()&&n.push({value:t.toISOString(),label:me(t).format("LLL dd, y")}),s([...l,{name:r||"",placeholder:f?.placeholder,value:n,type:f?.type||"date",multiple:f?.multiple||!1}]),o()}},disabled:!x[0],children:"Apply"})]})})]}):t("div",{className:"calendar-wrapper",children:[e("style",{children:Qn}),e(pe,{value:a,onChange:b,selectRange:!1,maxDate:v,className:"mb-2 border-0",tileClassName:({date:e,view:t})=>{if("month"===t){const t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return"text-muted/20 cursor-not-allowed";if(a&&t===a.getTime())return"bg-primary text-primary-foreground rounded-md font-semibold"}return""}})]})})}function ir({selectedView:n,commandInput:r,setFilters:a,handleClose:i,filterGroups:s}){const[l,o]=P([]);if(!n)return null;const c=(e=>{const t=s.find(t=>t.name===e);if(!t)return[];const n=t.options||[];if(!r.trim())return n;if(t.filterBy){const e=r.toLowerCase();return n.filter(n=>void 0!==n.value&&t.filterBy?.(n.value,e))}const a=r.toLowerCase();return n.filter(e=>String(e.value||"").toLowerCase().includes(a))})(n),d=s.find(e=>e.name===n);return t("div",{className:"flex flex-col h-full",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted shrink-0",children:e("span",{children:d?.placeholder||d?.name})}),e("div",{className:"flex-1 overflow-hidden min-h-0",children:e("div",{className:"max-h-[200px] overflow-y-auto",children:c.length>0&&c.map(r=>{const s=l.some(e=>e.value===r.value);return t(wn,{className:"group flex gap-2 items-center w-full hover:bg-muted "+(d?.multiple&&s?"bg-muted":""),onSelect:()=>(e=>{const t={value:e.value,label:e.label};if(d?.multiple){const n=l.some(t=>t.value===e.value);o(n?t=>t.filter(t=>t.value!==e.value):e=>[...e,t])}else a(e=>{const r=e.findIndex(e=>e.name===n);if(r>=0){const n=[...e];return n[r]={...n[r],value:[t]},n}return[...e,{name:n||"",placeholder:d?.placeholder||"",value:[t],type:d?.type||"select",multiple:d?.multiple||!1}]}),i()})(r),children:[e(er,{value:r.value||"",labelRenderer:r.labelRenderer||d?.labelRenderer,fallbackLabel:r.label}),d?.multiple&&s&&e("span",{className:"ms-auto text-xs text-success",children:"✓"})]},r.value||`option-${Math.random()}`)})})}),d?.multiple&&e("div",{className:"p-2 border-t shrink-0",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{l.length>0&&a(e=>[...e.filter(e=>e.name!==n),{name:n||"",placeholder:d?.placeholder||"",value:l,type:d?.type||"select",multiple:d?.multiple||!1}]),i()},disabled:0===l.length,children:"Apply"})]})})]})}function sr({selectedView:n,setFilters:r,handleClose:a,filterGroups:i}){const[s,l]=P([]),o=i.find(e=>e.name===n);return t("div",{className:"p-2 space-y-3",children:[e("div",{className:"space-y-2",children:e(Nt,{value:s,onChange:l,placeholder:o?.placeholder||`Add ${n}...`,autoFocus:!0})}),t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e(lt,{size:"sm",onClick:()=>{s.length>0&&r(e=>[...e.filter(e=>e.name!==n),{name:n,placeholder:o?.placeholder,value:s,type:"stringList"}]),a()},disabled:0===s.length,children:"Apply"})]})]})}function lr({selectedView:n,textValue:r,setTextValue:a,setFilters:i,handleClose:s,filterGroups:l}){const o=()=>{i(e=>[...e,{name:n||"",placeholder:l.find(e=>e.name===n)?.placeholder,value:[{value:r,label:r}],type:"text"}]),s()};return t("div",{className:"p-2 flex flex-col gap-1",children:[e("div",{className:"flex items-center p-1.5 text-xs text-muted",children:e("span",{children:l.find(e=>e.name===n)?.placeholder})}),e(wt,{autoFocus:!0,type:"text",size:"sm",value:r,onChange:a,onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Enter text..."}),e("div",{className:"mt-2 p-2 border-t",children:t("div",{className:"flex gap-2 justify-end",children:[e(lt,{variant:"ghost",size:"sm",onClick:s,children:"Cancel"}),e(lt,{size:"sm",onClick:o,disabled:!r.trim(),children:"Apply"})]})})]})}function or(t,n,r){switch(t.type){case"date":return e(Zn,{filterValues:Array.isArray(t.value)&&"object"==typeof t.value[0]?t.value.map(e=>e.value||""):[],isRange:t.multiple,setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e.length>0?e.map(e=>({value:e,label:me(e).format("LLL dd, y")})):[]}:n))}});case"text":return e(rr,{filterType:t.placeholder||t.name,filterValue:Array.isArray(t.value)&&t.value[0]&&"object"==typeof t.value[0]&&t.value[0].value||"",setFilterValue:e=>{n(n=>n.map(n=>n===t?{...n,value:[{value:e,label:e}]}:n))}});case"stringList":return e(nr,{filterType:t.placeholder||t.name,filterValues:Array.isArray(t.value)&&"string"==typeof t.value[0]?t.value:[],setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e}:n))}});default:{const a=r.find(e=>e.name===t.name);return e(tr,{filterType:t.placeholder||t.name,filterValues:Array.isArray(t.value)&&"object"==typeof t.value[0]?t.value:[],setFilterValues:e=>{n(n=>n.map(n=>n===t?{...n,value:e}:n))},options:a?.options||[],labelRenderer:a?.labelRenderer,multiple:t.multiple??a?.multiple})}}}function cr({filters:n,setFilters:r,filterGroups:a}){return e("div",{className:"flex gap-2 flex-wrap justify-start",children:n.filter(e=>e.value?.length>0).map(n=>t("div",{className:"flex gap-[1px] items-center text-sm",children:[e("div",{className:"flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center",children:n.placeholder||n.name}),or(n,r,a),e(lt,{variant:"ghost",size:"icon",onClick:()=>{r(e=>e.filter(e=>e!==n))},className:"bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0",children:e(p,{className:"size-6"})})]},`${n.name}-${"date"===n.type?"date":"stringList"===n.type&&"string"==typeof n.value[0]?n.value.join(","):Array.isArray(n.value)?n.value.map(e=>e.value).join(","):""}`))})}const dr=D.createContext({filters:[],setFilters:()=>{},filterGroups:[]}),ur=({filters:t,setFilters:n,filterGroups:r,children:a,inModal:i})=>{const s=new URL(window.location.href).searchParams.toString(),[l]=D.useState(()=>new URLSearchParams(window.location.search).get("filters")),o=D.useRef(new Set),c=D.useRef(i||!l);return j(()=>{if(!i&&c.current)try{const e=new URLSearchParams(s);if(t.length>0){const n=t.map(e=>{let t;if("stringList"===e.type&&Array.isArray(e.value)&&"string"==typeof e.value[0])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{const n=e.value[0];t="string"==typeof n?encodeURIComponent(n):"object"==typeof n&&void 0!==n?.value?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||""))}else t=encodeURIComponent(e.value||"");return`${encodeURIComponent(e.name)}:${t}`}).join(";");e.set("filters",n)}else e.delete("filters");const n=`${window.location.pathname}?${e.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},"",n)}catch(e){console.error("Failed to update URL with filters:",e)}},[t,i,s]),j(()=>{if(!i&&l&&0!==r.length)try{const e=l.split(";"),t=[];for(const n of e){const e=n.indexOf(":");if(-1===e)continue;const a=n.slice(0,e),i=n.slice(e+1),s=decodeURIComponent(a);if(o.current.has(s))continue;const l=r.find(e=>e.name===s);if(!l)continue;let c,d;if(o.current.add(s),i.startsWith("[")&&i.endsWith("]")){const e=i.slice(1,-1);c=e?e.split(",").map(e=>decodeURIComponent(e)):[]}else c=[decodeURIComponent(i)];d="stringList"===l.type?c:"text"===l.type?1===c.length?[{value:c[0],label:c[0]}]:c.map(e=>({value:e,label:e})):c.map(e=>{const t=l.options?.find(t=>t.value===e);let n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):l.labelRenderer&&(n=String(l.labelRenderer(e))),{value:e,label:n}}),!l.multiple||i.startsWith("[")||i.endsWith("]")||("stringList"===l.type?d=c:Array.isArray(d)||(d=[d])),t.push({name:s,type:l.type,placeholder:l.placeholder,value:d,multiple:l.multiple})}t.length>0&&n(e=>{const n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),c.current=!0}catch(e){}},[r,i,l,n]),e(dr.Provider,{value:{filters:t,setFilters:n,filterGroups:r},children:a})},mr=({className:n})=>{const{filters:r,setFilters:a,filterGroups:i}=D.useContext(dr),{t:s}=Q(),[l,o]=D.useState(!1),[c,d]=D.useState(null),[u,m]=D.useState(""),p=D.useRef(null),[h,f]=D.useState(),[g,v]=D.useState(""),x=()=>{o(!1),setTimeout(()=>{d(null),m(""),f(void 0)},200)};return t(Wn,{_open:l,onOpenChange:e=>{o(e),e||setTimeout(()=>{d(null),m(""),v("")},200)},children:[e(Gn,{asChild:!0,children:t(lt,{variant:"outline",role:"combobox","aria-expanded":l,size:"md",className:qe("transition group flex gap-1.5",n),children:[e(b,{className:"size-4 shrink-0 transition-all text-muted"}),s("filter.filter")]})}),e(qn,{className:"w-[300px] p-0",align:"start",sideOffset:4,children:t(hn,{children:["select"===i.find(e=>e.name===c)?.type&&e(gn,{placeholder:c?s("filter.filterBy",{view:c}):s("filter.filterPlaceholder"),className:"h-9 ring-0",value:u,onValueChange:e=>{m(e)},ref:p,autoFocus:!0}),e(vn,{children:e(bn,{children:c?(()=>{if(!c)return null;const t=i.find(e=>e.name===c)?.type;switch(t){case"date":return e(ar,{selectedView:c,selectedDate:h,setSelectedDate:f,setFilters:a,filters:r,handleClose:x,filterGroups:i});case"text":return e(lr,{selectedView:c,textValue:g,setTextValue:v,setFilters:a,handleClose:x,filterGroups:i});case"stringList":return e(sr,{selectedView:c,setFilters:a,handleClose:x,filterGroups:i});default:return e(ir,{selectedView:c,commandInput:u,setFilters:a,handleClose:x,filterGroups:i})}})():(()=>{const t=i.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>"date"===n.type?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&"string"==typeof n.value[0]?n.value.some(e=>e===t.value):n.value.some(e=>fr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||"date"===e.type&&!r.some(t=>t.name===e.name)||"text"===e.type&&!r.some(t=>t.name===e.name)||"stringList"===e.type&&!r.some(t=>t.name===e.name));return 0===t.length?e(xn,{children:s("filter.noAvailableFilters")}):t.map((t,n)=>e(wn,{onSelect:()=>{return e=t.name,d(e),m(""),void p.current?.focus();var e},className:"group flex gap-2 items-center hover:bg-muted",children:e("span",{children:t.placeholder??t.name})},n))})()})})]})})]})},pr=({className:t})=>{const{filters:n,setFilters:r,filterGroups:a}=D.useContext(dr);return e("div",{className:qe(t),children:e(cr,{filters:n,setFilters:r,filterGroups:a})})},hr=({className:t})=>{const{filters:n,setFilters:r}=D.useContext(dr),{t:a}=Q();return n.filter(e=>e.value?.length>0).length>0?e(lt,{variant:"outline",size:"md",className:qe("transition group",t),onClick:()=>r([]),children:a("filter.clearAll")}):null};function fr(e){return"string"==typeof e?e:e.value||""}var gr;!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"}(gr||(gr={}));const vr=U(({className:t,level:n=3,...r},a)=>e(`h${n}`,{ref:a,className:qe({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",t),...r}));function xr({options:a,optionLabel:i,value:s,onChange:l,addNew:o,addNewLabel:d,disabled:u,filterBy:m,label:h,placeholder:f,className:g,popupClass:v,isClearable:x,border:b=!0,multiple:_=!1,by:z,inline:I=!1,isLoading:T=!1,warnOnMissingValue:R=!0,missingValueWarning:M="Value not in options list, may not be valid",clearIcon:O,clearTitle:S,"aria-label":L,"aria-labelledby":$,id:D,"aria-describedby":E,"aria-invalid":F}){const Y=A(null),[B,H]=P(!1),[W,U]=P(0),[K,q]=P(""),J=V(),X=V(),Q=G(()=>!(!R||_||null==s||!a)&&!a.some(e=>"string"==typeof z?br(e,z)===br(s,z):"function"==typeof z?z(e,s):fe(e,s)),[R,_,s,a,z]);j(()=>{const e=Y.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;U(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);const Z=(e,t)=>!(!t||0===t.length)&&t.some(t=>ee(t,e)),ee=(e,t)=>null==e||null==t?e===t:"string"==typeof z?br(e,z)===br(t,z):"function"==typeof z?z(e,t):fe(e,t);let te=a||[];const ne=K.toLowerCase(),re=function(e){return e?"string"==typeof e?t=>String(br(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}(m);te=te.filter(e=>re(e).includes(ne));const ae=()=>t(n,{children:[m&&t("div",{className:"flex justify-start items-center mb-1",children:[e("div",{className:"mx-2",children:e(k,{className:"size-4"})}),e(wt,{variant:"unstyled",value:K,onChange:q,className:"w-full p-1 rounded-md",placeholder:"Search..."})]}),e(hn,{className:"overflow-hidden",children:t(vn,{className:I?"max-h-full overflow-y-auto":"max-h-[200px] overflow-y-auto",onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[e(xn,{children:"No result found."}),e(bn,{children:te?.map((n,r)=>{const a=_?Z(n,Array.isArray(s)?s:[]):null!=s&&ee(s,n);return e(wn,{onSelect:()=>(e=>{if(_){const t=Array.isArray(s)?s:[];if(Z(e,t)){const n=t.filter(t=>!ee(t,e));l(n)}else l([...t,e])}else l(e)})(n),className:"w-full",children:_||I?t("div",{className:"w-full flex justify-between items-center cursor-pointer",children:[e("div",{className:"w-full truncate text-start",children:i?i(n):n}),a&&e(c,{className:"size-4"})]}):t(Jn,{className:"w-full flex justify-between items-center",children:[e("div",{className:"w-full truncate text-start",children:i?i(n):n}),a&&e(c,{className:"size-4"})]})},r)})})]})}),o&&e("div",{className:"p-1",children:t("button",{type:"button",onClick:o,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:[e(C,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),d]})})]});if(I)return e("div",{className:r(g,b&&"border border-border rounded-md","bg-popover p-1",v),children:T?e("div",{className:"flex justify-center items-center p-2 text-muted text-sm",children:e(y,{className:"size-4 animate-spin"})}):ae()});const ie=!!h,se=L??(ie?void 0:"string"==typeof f?f:void 0),le=$??(ie?X:void 0),oe=!!x&&!!s&&(!Array.isArray(s)||s.length>0),ce=!(!0!==F&&"true"!==F&&!Q)||!1!==F&&"false"!==F&&void 0;return t(Wn,{onOpenChange:H,children:[t("div",{ref:Y,className:r("relative",g),children:[e(Gn,{asChild:!0,children:e("button",{type:"button",id:D,disabled:u||T,"aria-haspopup":"dialog","aria-expanded":B,"aria-controls":J,"aria-label":se,"aria-labelledby":le,"aria-describedby":E,"aria-invalid":ce,className:r(T?"flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent":r(b&&(Q||ce?"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",u?"cursor-not-allowed text-muted":"cursor-pointer hover:bg-muted",oe&&"pe-10")),children:T?e(y,{className:"size-4 animate-spin"}):t(n,{children:[t("div",{className:r("flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate"),children:[h&&e("div",{id:X,className:"w-full text-start text-xs font-semibold",children:h}),t("div",{className:r("w-full text-start ",Q&&"text-destructive"),children:[Q&&e(rt,{description:M,placement:"top",asChild:!0,children:e(w,{className:"inline-block size-4 me-1 -mt-0.5 cursor-help"})}),_?(()=>{const n=Array.isArray(s)?s:s?[s]:[];return 0===n.length?e("span",{className:"text-muted",children:f}):1===n.length?i?i(n[0]):n[0]:t("div",{className:"flex flex-wrap gap-1",children:[n.slice(0,1).map((t,n)=>e("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded",children:i?i(t):t},n)),n.length>1&&t("span",{className:"inline-flex items-center px-2 py-1 text-xs bg-muted rounded",children:["+",n.length-1," more"]})]})})():(()=>{if(!s||Array.isArray(s)&&0===s.length)return e("span",{className:"text-muted",children:f});const t=Array.isArray(s)?s[0]:s;return i?i(t):t})()]})]}),!u&&e(N,{className:"size-4 opacity-50 shrink-0","aria-hidden":"true"})]})})}),oe&&!T&&e(lt,{variant:"link",size:"icon",disabled:u,"aria-label":S||"Clear selection",onClick:e=>{e.stopPropagation(),l(_?[]:void 0)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.stopPropagation()},className:"absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1",children:O||e(p,{className:"size-4"})})]}),e(qn,{id:J,style:{width:`${W}px`,zIndex:1e6},className:r("min-w-[8rem] w-64 bg-popover p-1 border shadow","divide-y divide-border",v),children:ae()})]})}function br(e,t){return"object"==typeof e&&null!==e?e[t]:void 0}vr.displayName="Heading";const yr={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:n,className:r}={}){const{language:a,setLanguage:i}=Z(),{t:s}=Q(),l=!1!==n&&(n??s("language.label"));return t("div",{className:r??(l?"flex justify-between px-2 items-center gap-3":"flex items-center"),children:[l&&e("p",{className:"text-sm font-semibold",children:l}),e(xr,{options:ee,value:a,onChange:e=>i(e),optionLabel:e=>yr[e],placeholder:s("language.placeholder"),isClearable:!1,warnOnMissingValue:!1,className:"min-w-40"})]})}const Nr=te("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),kr=$.forwardRef(({className:n,required:r,...a},i)=>t(ge.Root,{ref:i,className:qe(Nr(),n),...a,children:[a.children,r&&e("span",{className:"text-destructive-foreground ms-1",children:"*"})]}));function Cr({icon:n,status:r,title:a,children:i,className:s}){let l,o,c,d;switch(r){case"error":l=e(z,{className:"size-5 text-destructive","aria-hidden":"true"}),o="text-destructive",c="text-foreground",d="bg-destructive border border-destructive";break;case"warning":l=e(w,{className:"size-5 text-attention","aria-hidden":"true"}),o="",c="text-foreground",d="bg-attention border border-attention";break;case"success":l=e(_,{className:"size-5 text-success","aria-hidden":"true"}),o="",c="text-foreground",d="bg-success border border-success";break;case"info":l=e(m,{className:"size-5 text-info","aria-hidden":"true"}),o="",c="text-foreground",d="bg-info border border-info";break;case"default":l=e(m,{className:"size-5 text-muted","aria-hidden":"true"}),o="",c="text-foreground",d="bg-muted border border-muted";break;case"done":l=e(m,{className:"size-5 text-done","aria-hidden":"true"}),o="",c="text-foreground",d="bg-done border border-done"}return e("div",{className:`rounded-md p-4 ${d} ${s}`,children:t("div",{className:"flex",children:[e("div",{className:"shrink-0",children:n??l}),t("div",{className:"w-full ms-2 px-1",children:[a&&e("h3",{className:`text-md font-medium mb-2 ${o}`,children:a}),e("div",{className:`text-sm ${c} break-words`,children:i})]})]})})}function _r({title:n,className:r,children:a,action:i,actionLabel:s}){return t(Cr,{status:"error",title:n,className:`${r} flex flex-col items-center justify-center text-center`,children:[e("pre",{className:"whitespace-pre-wrap break-words",children:a}),i&&s&&e(lt,{onClick:i,variant:"ghost",size:"sm",className:"mt-4",children:s})]})}function zr({title:t,className:n,children:r}){return e(Cr,{status:"info",title:t,className:n,children:r})}function Ir({title:t,className:n,children:r}){return e(Cr,{status:"warning",title:t,className:n,children:r})}function Tr({title:t,className:n,children:r}){return e(Cr,{status:"success",title:t,className:n,children:r})}function Rr({title:t,className:n,children:r}){return e(Cr,{status:"default",title:t,className:n,children:r})}function Mr({title:n,content:r,onConfirm:a,onCancel:i,isOpen:s,isLoading:l,confirmationValue:o,confirmationLabel:c,confirmationPlaceholder:d}){const{t:u}=Q(),m=A(null),[p,h]=P("");j(()=>{s||h("")},[s]);const f=!!o,g=!o||p.trim()===o.trim(),v=()=>{g&&!l&&a()};return t(tn,{isOpen:s,onClose:i,description:"Confirm Modal",children:[t("div",{className:"sm:flex sm:items-start p-2",children:[e("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:e(I,{className:"size-6 text-red-600","aria-hidden":"true"})}),t("div",{className:"mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start",children:[e(nn,{className:"leading-6",show:!0,children:n}),e("div",{className:"mt-2",children:e("div",{className:"prose text-sm text-gray-500",children:r})})]})]}),f&&e("div",{className:"px-2 pb-2 text-start",children:e(pt,{label:c??d,children:e(wt,{autoFocus:!0,value:p,onChange:h,placeholder:d,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v())}})})}),t(an,{align:"right",children:[e(lt,{variant:"destructive",onClick:v,isLoading:l,disabled:!g,children:u("modal.confirm")}),e(lt,{variant:"outline",onClick:i,ref:m,children:u("modal.cancel")})]})]})}function Or(){return F(Sr)}kr.displayName=ge.Root.displayName;const Sr=E(()=>{}),Lr={success:_,error:z,warning:w,info:m},$r={success:"text-success",error:"text-destructive",warning:"text-attention",info:"text-info"};function Dr({data:n,onClose:r}){const[a,i]=P(!0),s=A(null),l=K(()=>{s.current&&(globalThis.clearTimeout(s.current),s.current=null)},[]),o=K(()=>{l(),n.duration&&(s.current=setTimeout(()=>i(!1),n.duration))},[l,n.duration]);j(()=>(o(),l),[l,o]);const c=Lr[n.status]||m,d=$r[n.status]||"text-info";return e("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:e("div",{className:"flex w-full flex-col items-center space-y-4 sm:items-end",children:e(se,{onExitComplete:r,children:a&&e(ie.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:l,onMouseLeave:o,children:e("div",{className:"p-5",children:t("div",{className:"flex items-start",children:[e("div",{className:"shrink-0",children:e(c,{className:`size-6 ${d}`,"aria-hidden":"true"})}),t("div",{className:"ms-3 flex-1 pt-0.5 min-w-0",children:[e("p",{className:"text-sm font-semibold text-foreground break-words",children:n.title}),n.description&&e("p",{className:"mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed",children:n.description})]}),e("div",{className:"ms-4 flex shrink-0",children:t("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:()=>i(!1),children:[e("span",{className:"sr-only",children:"Close"}),e(p,{className:"size-5","aria-hidden":"true"})]})})]})})})})})})}function Er({children:r}){const[a,i]=P(null),s=K(e=>{i(e)},[]);return t(n,{children:[e(Sr.Provider,{value:s,children:r}),a&&e(St,{children:e(Dr,{data:a,onClose:()=>s(null)})})]})}function Ar({idToDelete:t,title:n,content:r,setIdToDelete:a,deleteApi:i}){const{t:s}=Q(),l=Or();return e(Mr,{title:n,content:r,isOpen:!!t,onConfirm:async()=>{if(t)return i(t).then(()=>{l({title:s("modal.delete.succeeded"),status:"success"})}).catch(e=>{l({title:s("modal.delete.failed"),description:e instanceof Error?e.message:s("modal.delete.error"),status:"error"})}).finally(()=>{a(void 0)})},onCancel:()=>{a(void 0)}})}function Pr({children:r,action:a,title:i,description:s,footer:l,className:o,collapsible:c,defaultCollapsed:d=!1,size:u="md",clickableHeader:p=!1}){const[h,f]=P(d),g=c&&p,v="sm"===u,x=v||g,b=e(h?T:R,{className:"size-4 text-muted"}),y=t(n,{children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"font-semibold "+(v?"text-sm":"text-lg"),children:i}),s&&e(rt,{description:s,children:e(m,{className:"size-4 text-muted"})})]}),t("div",{className:"flex gap-2 items-center",children:[a,c&&(g?b:e(lt,{variant:"ghost",size:"icon",onClick:()=>f(!h),children:b}))]})]}),w=v?"px-4 py-2":"px-4 py-3",N=v?"px-4 pt-3 pb-3":"p-4",k=v?"px-4 pb-3":"px-4 pb-4";return t("div",{className:`flex flex-col ${x?"":"p-4 gap-2"} rounded-sm border bg-card ${g?"overflow-hidden":""} ${o??""}`,children:[g?e("button",{type:"button",className:`w-full flex items-center justify-between ${w} hover:bg-muted/50 transition-colors`,onClick:()=>f(!h),children:y}):e("div",{className:`flex items-center justify-between ${x?w:""}`,children:y}),!h&&(x?e("div",{className:N,children:r}):r),l&&e("div",{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${x?k:""}`,children:l})]})}function jr({className:t,...n}){return e(ve.Item,{"data-slot":"radio-group-item",className:qe("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",t),...n,children:e(ve.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}class Fr{descriptionOf(e){}selectedClassName(e){return"border-accent-foreground"}}function Vr({onSelect:n,selected:r,options:a,adapter:i}){const s=e=>i?i.idOf(e):e.id,l=e=>i?i.labelOf(e):e.label,o=e=>i?i.descriptionOf(e):e.description;return e(ve.Root,{"data-slot":"radio-group",value:r?s(r):void 0,onValueChange:e=>{const t=a.find(t=>s(t)===e);t&&n(t)},className:"space-y-4",children:a.map(n=>{const a=!!r&&s(r)===s(n);return e(ve.Item,{value:s(n),className:qe("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",a&&(c=n,i?i.selectedClassName(c):"border-primary")),children:e("span",{className:"flex items-center",children:t("span",{className:"flex flex-col text-sm",children:[e("span",{className:"font-medium text-text",children:l(n)}),o(n)&&e("span",{className:"text-muted-foreground",children:o(n)})]})})},s(n));var c})})}function Yr({className:t,direction:n="horizontal",orientation:r,...a}){const i=r??n;return e(xe.Group,{"data-slot":"resizable-panel-group","data-panel-group-direction":i,orientation:i,className:qe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a})}function Br({...t}){return e(xe.Panel,{"data-slot":"resizable-panel",...t})}function Hr({withHandle:t,className:n,...r}){return e(xe.Separator,{"data-slot":"resizable-handle",className:qe("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:t&&e("div",{className:"z-10 flex size-4 items-center justify-center rounded-xs font-semibold",children:e(M,{className:"size-4 rotate-90"})})})}const Wr=$.forwardRef(({className:t,orientation:n="horizontal",decorative:r=!0,...a},i)=>e(be.Root,{ref:i,decorative:r,orientation:n,className:qe("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Wr.displayName=be.Root.displayName;const Ur=$.forwardRef(({className:n,trackClassName:r,rangeClassName:a,thumbClassName:i,value:s,defaultValue:l,min:o=0,max:c=100,"aria-label":d,...u},m)=>{const p=$.useId(),h=Array.isArray(s)?s.length:Array.isArray(l)?l.length:1,f=$.useMemo(()=>Array.from({length:Math.max(1,h)},(e,t)=>`${p}-thumb-${t}`),[p,h]);return t(ye.Root,{ref:m,"data-slot":"slider",value:s,defaultValue:l,min:o,max:c,...u,className:qe("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",n),children:[e(ye.Track,{"data-slot":"slider-track",className:qe("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:e(ye.Range,{"data-slot":"slider-range",className:qe("absolute h-full bg-primary data-[orientation=vertical]:w-full",a)})}),f.map(t=>e(ye.Thumb,{"data-slot":"slider-thumb","aria-label":d,className:qe("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",i)},t))]})});Ur.displayName=ye.Root.displayName;const Gr={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 Kr({className:n,size:r="md",value:a,onChange:i,children:s,disabled:l,...o}){const[c,d,u]=Gr[r],m=e(we.Root,{"data-slot":"switch",checked:a,onCheckedChange:i,disabled:l,...o,className:qe("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",c,!s&&n),children:e(we.Thumb,{"data-slot":"switch-thumb",className:qe("bg-white rounded-full pointer-events-none block ring-0 transition-transform",d,a?u:"translate-x-1 rtl:-translate-x-1")})});return s?t("div",{className:qe("flex items-center",n),children:[m,e("span",{className:"px-2",children:s})]}):m}const qr=$.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:"tabs",updateHash:!0}),Jr=({tabs:t,defaultValue:n,current:r,className:a,fullWidth:i,fullHeight:s,children:l,onTabChange:o,responsive:c=!1,variant:d="tabs",updateHash:u=!0})=>{const m=$.useMemo(()=>t.filter(e=>void 0===e.is_allowed||!0===e.is_allowed),[t]),[p,h]=$.useState(()=>{const e="function"==typeof r?r():r;if(e)return e;const t=window.location.hash,a=t?t.substring(1):void 0;return a&&m.some(e=>e.name===a)?a:n||m[0]?.name});$.useEffect(()=>{const e="function"==typeof r?r():r;e&&e!==p&&h(e)},[r,p]),$.useEffect(()=>{if(r)return;const e=()=>{const e=window.location.hash,t=e?e.substring(1):void 0;t&&m.some(e=>e.name===t)?h(t):!e&&n&&h(n)};return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[r,m,n]);const f=$.useCallback(e=>{if(h(e),u&&!r){const t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,"",n)}o&&o(e)},[r,o,u]),g=$.useCallback(e=>{f(e)},[f]);return e(qr.Provider,{value:{tabs:m,size:i?m.length:0,current:p,setTab:g,responsive:c,variant:d,updateHash:u},children:e(Ne.Root,{defaultValue:p||m[0]?.name,value:p,onValueChange:f,className:qe("flex-1 flex flex-col min-h-0 px-2",s&&"h-full",a),children:l})})},Xr=({className:r,sticky:a,direction:i})=>{const{tabs:s,size:l,current:o,setTab:c,responsive:d,variant:u,updateHash:m}=$.useContext(qr),p=0!==l,h=$.useCallback(e=>{if(!s||!c)return;const t=s.find(t=>t.name===e);if(t?.href&&m){const e=window.history.state;window.history.pushState(e,"",t.href)}c(e)},[s,c,m]);return s&&c?t(n,{children:[d&&e("div",{className:"px-2 block lg:hidden",children:e(xr,{label:"Tab",className:qe(a&&"sticky top-0 bg-background z-10",r),options:s,optionLabel:e=>"string"==typeof e.label?e.label:String(e.label),value:s.find(e=>e.name===o),onChange:e=>{h(e.name)}})}),e(Zr,{size:l,variant:u,className:qe(p?"w-full":"",a&&"sticky top-0 bg-background z-10","vertical"===i?"flex-col items-start":"flex-row",d?"hidden lg:flex":"",r),children:s.map(t=>e(ea,{className:qe("vertical"===i?"w-full text-start":""),value:t.name,disabled:t.disabled,href:t.href,variant:u,onClick:()=>h(t.name),children:t.label},t.name))})]}):(console.warn("TabsBar: No tabs provided or setTab not available"),null)},Qr=({className:t})=>{const{tabs:r}=$.useContext(qr);return r?e(n,{children:r.map(n=>e(ta,{value:n.name,className:t,children:n.content},n.name))}):null},Zr=$.forwardRef(({className:t,size:n,variant:r="tabs",...a},i)=>e(qr.Provider,{value:{size:n,variant:r},children:e(Ne.List,{ref:i,className:qe("tabs"===r?"border-b -mb-px flex gap-4":"flex gap-2 p-1 rounded-md",t),...a})}));Zr.displayName=Ne.List.displayName;const ea=$.forwardRef(({className:t,href:n,variant:r="tabs",...a},i)=>{const{size:s}=$.useContext(qr),l=$.useCallback(e=>{if(n){e.preventDefault();const t=window.history.state;window.history.pushState(t,"",n)}a.onClick&&a.onClick(e)},[n,a.onClick]);return e(Ne.Trigger,{ref:i,className:qe("tabs"===r?qe("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"):qe("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"),t,s?`w-1/${s}`:""),onClick:l,...a})});ea.displayName=Ne.Trigger.displayName;const ta=$.forwardRef(({className:t,...n},r)=>e(Ne.Content,{ref:r,className:qe("focus-visible:outline-none","flex-1 overflow-y-auto min-h-0 pt-2 pb-4",t),...n}));ta.displayName=Ne.Content.displayName;const na=te("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"}}),ra=U(({className:t,size:n,weight:r,...a},i)=>e("p",{ref:i,className:qe(na({size:n,weight:r,className:t})),...a}));function aa({className:t,minLines:n,maxLines:r,value:a,...i}){const s=A(null),l=void 0!==n||void 0!==r,o=K(()=>{const e=s.current;if(!e)return;const t=getComputedStyle(e),a=parseFloat(t.lineHeight)||1.5*parseFloat(t.fontSize),i=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),l=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),o=r??1/0,c=(n??1)*a+i+l,d=o===1/0?1/0:o*a+i+l;e.style.height="auto";const u=Math.min(Math.max(e.scrollHeight,c),d);e.style.height=`${u}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?"auto":"hidden"},[n,r]);return q(()=>{l&&o()}),e("textarea",{ref:s,"data-slot":"textarea",value:a,className:qe("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",l&&"resize-none",t),...i})}ra.displayName="Text";const ia=E({theme:"system",setTheme:()=>null});function sa({children:t,defaultTheme:n="system",storageKey:r="vite-ui-theme",...a}){const[i,s]=P(()=>localStorage.getItem(r)||n);j(()=>{const e=window.document.documentElement;if(e.classList.remove("light","dark"),"system"===i){const t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return void e.classList.add(t)}e.classList.add(i)},[i]);const l={theme:i,setTheme:e=>{localStorage.setItem(r,e),s(e)}};return e(ia.Provider,{...a,value:l,children:t})}const la=()=>{const e=F(ia);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e};function oa({option:t,current:n,setTheme:r,icon:a,alt:i}){return e(lt,{variant:n===t?"secondary":"outline",size:"sm",onClick:()=>r(t),alt:i,children:a})}function ca({label:n,className:r}={}){const{setTheme:a,theme:i}=la(),{t:s}=Q(),l=!1!==n&&(n??s("theme.label"));return t("div",{className:r??(l?"flex justify-between px-2 items-center":"flex items-center gap-1"),children:[l&&e("p",{className:"text-sm font-semibold",children:l}),t("div",{className:"flex gap-2",children:[e(oa,{current:i,option:"system",setTheme:a,icon:e(O,{}),alt:s("theme.system")}),e(oa,{current:i,option:"light",setTheme:a,icon:e(S,{}),alt:s("theme.light")}),e(oa,{current:i,option:"dark",setTheme:a,icon:e(L,{}),alt:s("theme.dark")})]})]})}function da(t,n){return{label:String(t),check:e(n?c:"div",{className:"size-4"}),reverse:!1,className:"flex-1 px-2 py-2 hover:bg-accent nowrap"}}function ua({value:n,options:a,onChange:i,className:s,optionLayout:l,by:o,noCheck:c,filterBy:d}){const{t:u}=Q(),[m,p]=P(n),[h,f]=P(""),g=e=>{p(e),i(e)},v=G(()=>"string"==typeof o?(e,t)=>e[o]===t[o]:o||((e,t)=>e===t),[o]);return t("div",{className:r("",s),children:[d&&e(wt,{type:"text",placeholder:u("form.filter"),value:h,onChange:e=>f(e)}),a.map((t,n)=>{if(d&&!d(h)(t))return null;const r=!!m&&v(m,t);let a;return l?(a=l(t,r),a=Object.assign(da(t,r),a)):a=da(t,r),e(ma,{option:t,onSelect:g,layout:a,noCheck:c},n)})]})}function ma({option:n,onSelect:a,layout:i,noCheck:s}){return t(lt,{variant:"unstyled",size:"none",className:r("group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted",i.reverse&&"flex-row-reverse",i.className),onClick:()=>a(n),children:[s?null:e("div",{className:"",children:i.check}),e("div",{className:"flex-1",children:i.label})]})}function pa({isOpen:n,title:r,onClose:a,children:i,panelWidth:s=768,backdrop:l=!1,side:o="right",resizable:c=!0,className:d,contentClassName:u}){const[m,p]=P(s),h="left"===o,f=h?"left-0":"right-0",g=h?"pr-10 sm:pr-16":"pl-10 sm:pl-16",v=h?"border-r":"border-l",x=h?"-right-1":"-left-1",b=h?"-100%":"100%";return e(se,{children:n&&t("div",{className:"relative z-20",children:[l&&e(ie.div,{className:"fixed inset-0 bg-black/70",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a}),e("div",{className:`fixed inset-y-0 ${f} overflow-hidden`,children:e("div",{className:"absolute inset-0 overflow-hidden",children:e("div",{className:`pointer-events-none fixed inset-y-0 ${f} flex max-w-full ${g}`,children:e(ie.div,{className:`pointer-events-auto ${v}`,style:{width:`${m}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:"spring",stiffness:300,damping:30},children:t("div",{className:"relative flex h-full",children:[c&&e("div",{"aria-label":"Resize panel",className:`absolute ${x} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:e=>{e.preventDefault();let t=!0;const n=e.pageX,r=m,a=e=>{if(t){const t=n-e.pageX,a=Math.max(r+t,480);p(a)}},i=()=>{t=!1,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",i)},children:e(M,{className:"rotate-90 font-semibold",strokeWidth:4})}),t("div",{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${d}`,children:[r&&e("div",{className:"sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b",children:t("div",{className:"flex items-start justify-between",children:[e("h2",{className:"w-full text-base font-semibold leading-6",children:e("div",{className:"text-2xl",children:r??""})}),e("div",{className:"ms-3 flex h-7 items-center",children:e(ha,{onClose:a})})]})}),e("div",{className:u??"flex-1 overflow-auto px-2 sm:px-4 py-4",children:e("div",{className:"w-full h-full flex-1 flex flex-col",children:i})})]})]})})})})})]})})}function ha({onClose:t}){return e(lt,{alt:"Close panel",variant:"ghost",onClick:t,children:e(p,{className:"size-6","aria-hidden":"true"})})}function fa({size:n,className:a}){const i=function(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 new Error(`Unexpected size: ${e}`)}}(n||"md");return t("svg",{className:r("animate-[spin_0.8s_linear_infinite] text-indigo-500",i,a),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",role:"img","aria-label":"Loading",children:[e("title",{children:"Loading"}),e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e("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 ga({options:a,value:i,onChange:s,onOptionsChange:l,placeholder:o,className:c,disabled:d,layout:u="horizontal",creatable:m=!1,createText:h='Create "%value%"',maxDropdownHeight:f=200}){const g=F(Hn),[v,x]=P(""),[b,y]=P(0),[w,N]=P(0),[k,C]=P(null),_=A(null),z=A(null),I=A(null),T=A(null),R=g?.open??!1,M=g?.setOpen??(()=>{});j(()=>{const e=z.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect().width;N(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);const O=a.filter(e=>!i.includes(e)&&e.toLowerCase().includes(v.toLowerCase())),S=m&&v&&!i.includes(v)&&!a.includes(v),L=O.length+(S?1:0);j(()=>{""!==v&&C(null)},[v]),j(()=>{R&&b>=0&&T.current&&I.current&&T.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[b,R]),j(()=>{R?_.current?.focus():x("")},[R]);const $=e=>{s([...i,e]),x(""),M(!1),y(0),C(null)},D=e=>{s([...i,e]),l&&!a.includes(e)&&l([...a,e]),x(""),M(!1),y(0),C(null)},E=(e,t)=>{t.stopPropagation(),s(i.filter(t=>t!==e)),C(null)};return t("div",{className:r("relative",c),children:[e(Gn,{asChild:!0,children:t("div",{ref:z,className:r("min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2","flex items-center gap-1","horizontal"===u?"flex-wrap":"flex-col items-stretch","cursor-text","ring-offset-background",d&&"opacity-50 cursor-not-allowed",R?"ring-1 ring-inset ring-ring":""),onClick:()=>{d||_.current?.focus()},children:["vertical"===u&&i.length>0&&e("div",{className:"flex flex-col gap-1 w-full",children:i.map((n,a)=>t("span",{className:r("inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/10 text-primary rounded-md w-full transition-all",k===a&&"ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]"),children:[e("span",{className:"truncate",children:n}),e("button",{type:"button",onClick:e=>E(n,e),disabled:d,className:"hover:bg-primary/20 rounded-sm transition-colors flex-shrink-0",children:e(p,{className:"h-3 w-3"})})]},n))}),"horizontal"===u&&i.map((n,a)=>t("span",{className:r("inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/10 text-primary rounded-md transition-all",k===a&&"ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]"),children:[n,e("button",{type:"button",onClick:e=>E(n,e),disabled:d,className:"hover:bg-primary/20 rounded-sm transition-colors",children:e(p,{className:"h-3 w-3"})})]},n)),e("input",{ref:_,type:"text",value:v,onChange:e=>{x(e.target.value),y(0)},onKeyDown:e=>{if("Enter"===e.key&&R&&L>0)return e.preventDefault(),e.stopPropagation(),void(b===O.length&&S?D(v):b<O.length&&$(O[b]));if("ArrowDown"===e.key)return e.preventDefault(),e.stopPropagation(),void(R?y(e=>e<L-1?e+1:e):M(!0));if("ArrowUp"===e.key)return e.preventDefault(),e.stopPropagation(),void(R?y(e=>e>0?e-1:0):M(!0));if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),void M(!1);if("Backspace"===e.key&&""===v&&i.length>0){e.stopPropagation();const t=i.length-1;return void(k===t?(s(i.slice(0,-1)),C(null)):C(t))}R||1!==e.key.length||M(!0)},onClick:e=>{e.stopPropagation(),d||M(!0)},onFocus:()=>{d||M(!0)},disabled:d,placeholder:0===i.length?o:"",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","vertical"===u&&"w-full")})]})}),e(qn,{style:{width:`${w}px`},className:"p-0 bg-popover border border-border shadow-lg",align:"start",side:"bottom",onOpenAutoFocus:e=>{e.preventDefault()},children:e("div",{ref:I,className:"overflow-y-auto",style:{maxHeight:`${f}px`},children:0!==O.length||S?t(n,{children:[O.length>0&&e("ul",{className:"py-1",children:O.map((t,n)=>e("li",{ref:e=>{n===b&&(T.current=e)},role:"option","aria-selected":n===b,tabIndex:0,onClick:()=>$(t),onKeyDown:ht(()=>$(t)),onMouseEnter:()=>y(n),className:r("px-3 py-2 text-sm cursor-pointer transition-colors",n===b?"bg-blue-500/20 text-foreground":"hover:bg-accent/50"),children:t},t))}),S&&t(n,{children:[O.length>0&&e("div",{className:"border-t border-border"}),e(lt,{ref:e=>{b===O.length&&(T.current=e)},variant:"unstyled",size:"none",onClick:()=>D(v),onMouseEnter:()=>y(O.length),className:r("!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary",b===O.length?"bg-blue-500/20":"hover:bg-accent/50"),children:h.replace("%value%",v)})]})]}):e("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:v?"No options found":"No more options available"})})})]})}function va(t){return e(Wn,{click:!0,children:e(ga,{...t})})}function xa({className:t,children:n,...a}){return e("table",{className:r("\ndivide-y divide-border\n[&>tbody]:divide-y [&>tbody]:divide-border\n[&_th]:text-start [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground\n[&_td]:px-3 [&_td]:py-4 [&_td]:text-sm\n",t),...a,children:n})}function ba({children:t}){return e("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:t})}function ya({columns:t}){return e("tr",{className:"hover:bg-muted",children:Array(t).fill(0).map((t,n)=>e("td",{children:e("div",{className:"animate-pulse rounded-xs h-5 bg-muted"})},n))})}function wa({isLoading:t=!1,columns:n,rows:r=3,children:a}){const i=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return e("tbody",{children:t?i.map(t=>e(ya,{columns:n},t)):a})}function Na({className:t,children:n,...a}){return e("tr",{className:r("hover:bg-muted hover:cursor-pointer",t),...a,children:n})}function ka({scope:t="col",children:n,...r}){return e("th",{scope:t,...r,children:n})}function Ca({sortDirection:n="none",onSort:r,sortIndicator:a,disabled:i=!1,children:s,className:l,scope:o="col",...c}){return e("th",{scope:o,"aria-sort":n,className:l,...c,children:i?t("span",{className:"inline-flex items-center gap-1",children:[s,a?.(n)]}):t("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:[s,a?.(n)]})})}class _a{_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(const t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}}function za(e){const t=D.createContext(void 0);return e.Context=t,t.Provider}class Ia{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 Ta(e){const t=e.Context;if(!t)throw new Error(`Context not defined for ${e.name}`);return F(t)}function Ra(e){const[t,n]=P(e.value);return j(()=>e.watch(e=>{n("function"==typeof e?()=>e:e)}),[e]),t}function Ma(e,t){return j(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function Oa(e,t){j(()=>e.watch(t),[e,t])}function Sa(e){const[t,n]=P(e.current);return j(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function La(e,t){j(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function $a(e,t){j(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}class Da{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(const e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){const e=this.compute();if(e!==this._value){this._value=e;for(const 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(const e of this.unsubscribers)e();this.watchers=[]}}class Ea{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(const t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}}function Aa(e){const[t,n]=P(e.value);return j(()=>e.addWatcher(e=>{n("function"==typeof e?()=>e:e)}),[e]),t}function Pa(e,t){const n=A(null);return j(()=>{const r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},a=window.setTimeout(()=>{document.addEventListener("click",r)},0);return()=>{window.clearTimeout(a),document.removeEventListener("click",r)}},[e,t]),n}function ja(){const[e,t]=P(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 Fa(e){j(()=>{const 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 Va(e,t){const[n,r]=P(e);return j(()=>{const n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function Ya(e,t,n){const r=[],a=new EventSource(e);return a.addEventListener("message",e=>{const n=JSON.parse(e.data);n&&(r.push(n),t(r.join("")))}),a.addEventListener("close",e=>{a.close();const t=JSON.parse(e.data);n(t)}),()=>{a.close()}}function Ba(e,t,n){const r=A(t),a=A(n);r.current=t,a.current=n,j(()=>{let t,n=!1;const i=e=>r.current(e),s=e=>a.current(e);return"function"==typeof e?e().then(e=>{n||(t=Ya(e,i,s))}):t=Ya(e,i,s),()=>{n=!0,t?.()}},[e])}function Ha(e,t){Array.isArray(t)&&(t={deps:t});const n=t||{},[r,a]=P(void 0),[i,s]=P(!1),[l,o]=P(n.defaultValue),c=A(e);c.current=e;const d=A(n);d.current=n;const u=K(()=>{const e=d.current;return e.start?.(),s(!0),c.current().then(t=>{o(t),e.onSuccess?.(t)}).catch(t=>{const n=function(e){return e instanceof Error?e:new Error(String(e))}(t);a(n),e.onError?.(n)}).finally(()=>{s(!1),e.end?.()})},[]);return j(()=>{const e=d.current;e.condition&&!e.condition()||u()},[u,...n.deps??[]]),{data:l,isLoading:i,error:r,setData:o,refetch:u}}function Wa(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),Ha(e,t)}function Ua(e=!1){const[t,n]=P(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function Ga(e,t,n={}){const r=A(t);r.current=t;const a=A(n);a.current=n;const i=n.threshold||1;j(()=>{const t=e.current,n=new IntersectionObserver(e=>{const t=e[0].isIntersecting;a.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:i});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,i])}function Ka(){const e=A(!0);return j(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const qa="undefined"!=typeof window?q:j;function Ja(e,t=[]){const n=e.pageSize||50,[r,a]=P(null),[i,s]=P(e.payload),[l,o]=P(null),[c,d]=P([]),[u,m]=P(null),[p,h]=P(!1),f=A(0),g=e=>{a(null),d([]),m(null),s(e)},v=()=>{null!==u&&a(u)};return j(()=>{f.current+=1;const t=f.current;h(!0),e.search(i,r,n).then(e=>{t===f.current&&(d(null===r?e.result:t=>[...t,...e.result]),m(e.nextPage),o(null))}).catch(e=>{t===f.current&&o(e)}).finally(()=>{t===f.current&&h(!1)})},[...t,i,e.search,r,n]),Ga(e.nextPageTrigger,()=>{!p&&u&&v()},{threshold:.1,deps:[u,p]}),{search:g,refresh:()=>g(i),searchMore:v,result:c,page:r,hasMore:null!==u,error:l,isSearching:p}}function Xa(e,t=[]){return Ja({...e,async search(t,n,r){const a=n??0,i=a*r,s=await e.search(t,i,r);return{result:s,nextPage:0===s.length?null:a+1}}},t)}class Qa{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}}function Za(e){const t=P(e);return new Qa(t)}function ei(...e){return ne(a(e))}function ti(e,t="An error occurred"){return e instanceof Error?e.message:"string"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:t}function ni(e,t){const n=e.selectionStart,r=e.selectionEnd,a=e.value,i=`${a.slice(0,n)}\n${a.slice(r)}`;t?.(i),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{Bn as AnimateChangeInHeight,Ce as Avatar,gt as Badge,Lt as Breadcrumbs,lt as Button,Vt as Card,Wt as CardContent,Ht as CardDescription,Ut as CardFooter,Yt as CardHeader,Bt as CardTitle,ze as Center,Gt as Checkbox,Kt as Collapsible,Jt as CollapsibleContent,qt as CollapsibleTrigger,Ve as ComboBox,hn as Command,fn as CommandDialog,xn as CommandEmpty,bn as CommandGroup,gn as CommandInput,wn as CommandItem,vn as CommandList,yn as CommandSeparator,Nn as CommandShortcut,Da as ComputedProperty,Mr as ConfirmModal,ot as CopyButton,De as DOMPopup,Zn as DateCombobox,Rr as DefaultBox,Ar as DeleteModal,sn as Dialog,cn as DialogClose,un as DialogContent,mn as DialogDescription,dn as DialogOverlay,on as DialogPortal,pn as DialogTitle,ln as DialogTrigger,Ke as Divider,bt as DotBadge,ut as DropZone,Fn as Dropdown,Cn as DropdownMenu,Mn as DropdownMenuCheckboxItem,In as DropdownMenuContent,Tn as DropdownMenuGroup,Rn as DropdownMenuItem,Ln as DropdownMenuLabel,_n as DropdownMenuPortal,On as DropdownMenuRadioGroup,Sn as DropdownMenuRadioItem,$n as DropdownMenuSeparator,Dn as DropdownMenuShortcut,En as DropdownMenuSub,Pn as DropdownMenuSubContent,An as DropdownMenuSubTrigger,zn as DropdownMenuTrigger,ct as EmptyCollection,_r as ErrorBox,dt as FileUploadInput,pr as FilterBar,mr as FilterBtn,hr as FilterClear,gr as FilterOperator,ur as FilterProvider,pt as FormItem,vr as Heading,zr as InfoBox,wt as Input,Nt as InputList,kr as Label,wr as LanguageSwitcher,kt as Link,Vn as MenuGroup,Yn as MenuItem,Ct as MenuList,Cr as MessageBox,tn as Modal,rn as ModalBody,en as ModalContextProvider,an as ModalFooter,nn as ModalTitle,oa as ModeOption,ca as ModeToggle,Rt as NumberInput,Ae as OptionAdapter,Mt as Overlay,Pr as Panel,Wn as Popover,Kn as PopoverAnchor,Jn as PopoverClose,qn as PopoverContent,Hn as PopoverContext,Gn as PopoverTrigger,Ee as Popup,Se as PopupController,St as Portal,Je as PortalContainerContext,Xe as PortalContainerProvider,_a as Property,Vr as RadioGroup,Fr as RadioGroupAdapter,jr as RadioGroupItem,Hr as ResizableHandle,Br as ResizablePanel,Yr as ResizablePanelGroup,ya as RowSkeleton,xr as SelectBox,ua as SelectList,tr as SelectionCombobox,Wr as Separator,Ea as SharedState,Qa as SharedValue,pa as SidePanel,Ge as SimpleCombobox,Ur as Slider,Ia as Slot,Ca as SortableTableHeaderCell,fa as Spinner,nr as StringListCombobox,Pe as StringOptionAdapter,je as StringOptionAdapterWithCreate,It as Styles,Tr as SuccessBox,_e as SvgAvatar,Kr as Switch,wa as TBody,ba as THead,Na as TR,xa as Table,ka as TableHeaderCell,Jr as Tabs,Xr as TabsBar,ta as TabsContent,Zr as TabsList,Qr as TabsPanel,ea as TabsTrigger,va as TagsInput,ra as Text,rr as TextCombobox,aa as Textarea,sa as ThemeProvider,ia as ThemeProviderContext,Sr as ToastContext,Er as ToastProvider,et as Tooltip,nt as TooltipContent,Ze as TooltipProvider,tt as TooltipTrigger,rt as VTooltip,Ir as WarningBox,st as buttonVariants,ei as cn,Re as computePosition,za as createCompositeStateProvider,ti as errorMessage,Fe as getDefaultComboBoxLayout,ni as insertNewlineAtCursor,ht as onActivateKey,Pa as useClickOutside,We as useComboboxCtrl,Ta as useCompositeState,ja as useCopyToClipboard,Fa as useDarkMode,Va as useDebounce,Xa as useDefaultScrollableSearch,$a as useDefineSlot,mt as useDropZone,Ba as useEventSource,Ha as useFetch,Wa as useFetchOnce,Ua as useFlag,Ra as useGetCompositeStateProperty,Ga as useIntersectionObserver,Ka as useIsFirstRendering,Zt as useIsInModal,Xn as usePopoverContext,$e as usePopupController,Qe as usePortalContainer,qa as useSafeLayoutEffect,Ja as useScrollableSearch,Ma as useSetCompositeStateProperty,Za as useSharedValue,Sa as useSlot,la as useTheme,Or as useToast,Oa as useWatchCompositeStateProperty,Aa as useWatchSharedState,La as useWatchSlot};
2
2
  //# sourceMappingURL=vertesia-ui-core.js.map