@atlashub/smartstack 3.10.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1016) hide show
  1. package/dist/AiDocPage-CM7j_50_.cjs.map +1 -1
  2. package/dist/AiDocPage-rnKBvVof.js.map +1 -1
  3. package/dist/ArchitecturePage-Cn_XCDAo.cjs.map +1 -1
  4. package/dist/ArchitecturePage-DNwzHKk0.js.map +1 -1
  5. package/dist/{AuthCallbackPage-Cu74zAX1.js → AuthCallbackPage-CoJi12d0.js} +2 -2
  6. package/dist/AuthCallbackPage-CoJi12d0.js.map +1 -0
  7. package/dist/{AuthCallbackPage-Bv2Cyn80.cjs → AuthCallbackPage-D_g2VCjj.cjs} +2 -2
  8. package/dist/AuthCallbackPage-D_g2VCjj.cjs.map +1 -0
  9. package/dist/{BaIndexPage-Dkp_Eixx.js → BaIndexPage-B5scAEin.js} +2 -2
  10. package/dist/BaIndexPage-B5scAEin.js.map +1 -0
  11. package/dist/BaIndexPage-C3osYS_6.cjs +2 -0
  12. package/dist/BaIndexPage-C3osYS_6.cjs.map +1 -0
  13. package/dist/BaViewerPage-BPucPOSy.cjs +2 -0
  14. package/dist/BaViewerPage-BPucPOSy.cjs.map +1 -0
  15. package/dist/{BaViewerPage-DxD0eZm-.js → BaViewerPage-TL6IHeQx.js} +26 -26
  16. package/dist/BaViewerPage-TL6IHeQx.js.map +1 -0
  17. package/dist/{ConfirmEmailPage-su3Fvl0e.cjs → ConfirmEmailPage-B3mrPUvg.cjs} +2 -2
  18. package/dist/ConfirmEmailPage-B3mrPUvg.cjs.map +1 -0
  19. package/dist/{ConfirmEmailPage-BTp8J0pw.js → ConfirmEmailPage-DDp2IPE_.js} +2 -2
  20. package/dist/ConfirmEmailPage-DDp2IPE_.js.map +1 -0
  21. package/dist/CrossSchemaFkPage-BchJFOmH.js.map +1 -1
  22. package/dist/CrossSchemaFkPage-DqFNORYd.cjs.map +1 -1
  23. package/dist/{DatabasePage-DFIK8cSM.js → DatabasePage-BnaX9sis.js} +44 -48
  24. package/dist/DatabasePage-BnaX9sis.js.map +1 -0
  25. package/dist/DatabasePage-DAzb3FnS.cjs +2 -0
  26. package/dist/DatabasePage-DAzb3FnS.cjs.map +1 -0
  27. package/dist/DeveloperIndexPage-CtBfD2JI.cjs.map +1 -1
  28. package/dist/DeveloperIndexPage-D4zD_pop.js.map +1 -1
  29. package/dist/{DocRenderer-CcEn1iaa.js → DocRenderer-C5pM9SWP.js} +99 -94
  30. package/dist/DocRenderer-C5pM9SWP.js.map +1 -0
  31. package/dist/DocRenderer-D7hi9Oa-.cjs +2 -0
  32. package/dist/DocRenderer-D7hi9Oa-.cjs.map +1 -0
  33. package/dist/DocsIndexPage-BD6OOCak.js.map +1 -1
  34. package/dist/DocsIndexPage-BPfi0FQD.cjs.map +1 -1
  35. package/dist/{DualDbContextPage-BujD_coN.js → DualDbContextPage-CVBjCvGp.js} +2 -2
  36. package/dist/DualDbContextPage-CVBjCvGp.js.map +1 -0
  37. package/dist/{DualDbContextPage--Qk-qEgD.cjs → DualDbContextPage-Dz8NAewk.cjs} +2 -2
  38. package/dist/DualDbContextPage-Dz8NAewk.cjs.map +1 -0
  39. package/dist/{ForceChangePasswordPage-kEFsb5Aq.cjs → ForceChangePasswordPage-BqNyswSy.cjs} +2 -2
  40. package/dist/ForceChangePasswordPage-BqNyswSy.cjs.map +1 -0
  41. package/dist/{ForceChangePasswordPage-ClENqzCH.js → ForceChangePasswordPage-DkpGGEn7.js} +2 -2
  42. package/dist/ForceChangePasswordPage-DkpGGEn7.js.map +1 -0
  43. package/dist/{ForgotPasswordPage--Wl0Vxbv.cjs → ForgotPasswordPage-C7mySa8O.cjs} +2 -2
  44. package/dist/ForgotPasswordPage-C7mySa8O.cjs.map +1 -0
  45. package/dist/{ForgotPasswordPage-BEgvV5f-.js → ForgotPasswordPage-Dmi6wpMM.js} +2 -2
  46. package/dist/ForgotPasswordPage-Dmi6wpMM.js.map +1 -0
  47. package/dist/InfrastructurePage-D4ZjLzI_.cjs.map +1 -1
  48. package/dist/InfrastructurePage-q_y1z8T_.js.map +1 -1
  49. package/dist/InstallationPage-BJ-GBVPp.cjs.map +1 -1
  50. package/dist/InstallationPage-CXKmzZuN.js.map +1 -1
  51. package/dist/ModulesPage-B3p8e07v.js.map +1 -1
  52. package/dist/ModulesPage-lz8DUm3X.cjs.map +1 -1
  53. package/dist/{OnboardingWizardPage-Bx1UlTbr.js → OnboardingWizardPage-BeCNpdPL.js} +2 -2
  54. package/dist/OnboardingWizardPage-BeCNpdPL.js.map +1 -0
  55. package/dist/{OnboardingWizardPage-C7vendrq.cjs → OnboardingWizardPage-CgEpUx9X.cjs} +2 -2
  56. package/dist/OnboardingWizardPage-CgEpUx9X.cjs.map +1 -0
  57. package/dist/{RegisterPage-DKr8quRk.cjs → RegisterPage-BejbbAl9.cjs} +2 -2
  58. package/dist/RegisterPage-BejbbAl9.cjs.map +1 -0
  59. package/dist/{RegisterPage-BzV0sCTe.js → RegisterPage-CcuYYRBS.js} +2 -2
  60. package/dist/RegisterPage-CcuYYRBS.js.map +1 -0
  61. package/dist/{ResetPasswordPage-x4do1o-j.cjs → ResetPasswordPage-7brP8dT7.cjs} +2 -2
  62. package/dist/ResetPasswordPage-7brP8dT7.cjs.map +1 -0
  63. package/dist/{ResetPasswordPage-DphmJrcJ.js → ResetPasswordPage-BX3wnSSM.js} +2 -2
  64. package/dist/ResetPasswordPage-BX3wnSSM.js.map +1 -0
  65. package/dist/SettingsDocPage-DYXvb3M-.js.map +1 -1
  66. package/dist/SettingsDocPage-Dqj8KzOa.cjs.map +1 -1
  67. package/dist/SlaDocPage-D44QWNY8.cjs.map +1 -1
  68. package/dist/SlaDocPage-hLFLqLVa.js.map +1 -1
  69. package/dist/SmartStackPresentationPage-52Nb7F0X.cjs.map +1 -1
  70. package/dist/SmartStackPresentationPage-D3ku9GtQ.js.map +1 -1
  71. package/dist/{SupportDashboardDocPage-CLotzEwA.js → SupportDashboardDocPage-CG_Ahacx.js} +2 -2
  72. package/dist/SupportDashboardDocPage-CG_Ahacx.js.map +1 -0
  73. package/dist/{SupportDashboardDocPage-DpgGq5Mm.cjs → SupportDashboardDocPage-DfV-9_8r.cjs} +2 -2
  74. package/dist/SupportDashboardDocPage-DfV-9_8r.cjs.map +1 -0
  75. package/dist/{SupportEscalationDocPage-B-_ChfdN.js → SupportEscalationDocPage-C481D7pF.js} +2 -2
  76. package/dist/SupportEscalationDocPage-C481D7pF.js.map +1 -0
  77. package/dist/{SupportEscalationDocPage-WXkAQr8k.cjs → SupportEscalationDocPage-C65oCDZL.cjs} +2 -2
  78. package/dist/SupportEscalationDocPage-C65oCDZL.cjs.map +1 -0
  79. package/dist/SupportIndexPage-Bb0giRKn.js.map +1 -1
  80. package/dist/SupportIndexPage-CsDQ35Cu.cjs.map +1 -1
  81. package/dist/{SupportMyTicketsDocPage-DeRUdAIi.js → SupportMyTicketsDocPage-D2f6DaKb.js} +2 -2
  82. package/dist/SupportMyTicketsDocPage-D2f6DaKb.js.map +1 -0
  83. package/dist/{SupportMyTicketsDocPage-jE1UMaIY.cjs → SupportMyTicketsDocPage-Dbp6XBnH.cjs} +2 -2
  84. package/dist/SupportMyTicketsDocPage-Dbp6XBnH.cjs.map +1 -0
  85. package/dist/{SupportTemplatesDocPage-ajO-cHmK.cjs → SupportTemplatesDocPage-BkeDpR-8.cjs} +2 -2
  86. package/dist/SupportTemplatesDocPage-BkeDpR-8.cjs.map +1 -0
  87. package/dist/{SupportTemplatesDocPage-C8ZLzFJc.js → SupportTemplatesDocPage-sCKQlZFJ.js} +2 -2
  88. package/dist/SupportTemplatesDocPage-sCKQlZFJ.js.map +1 -0
  89. package/dist/{SupportTicketsDocPage-C_ybDTjC.cjs → SupportTicketsDocPage-B_603CpY.cjs} +2 -2
  90. package/dist/SupportTicketsDocPage-B_603CpY.cjs.map +1 -0
  91. package/dist/{SupportTicketsDocPage-DQhHfa6J.js → SupportTicketsDocPage-ClBa3qeY.js} +2 -2
  92. package/dist/SupportTicketsDocPage-ClBa3qeY.js.map +1 -0
  93. package/dist/TeamsIntegrationPage-BwhBcPAK.js.map +1 -1
  94. package/dist/TeamsIntegrationPage-DXj5MDRS.cjs.map +1 -1
  95. package/dist/ThemeDocPage-B6x55uSE.cjs.map +1 -1
  96. package/dist/ThemeDocPage-xkMbvMJG.js.map +1 -1
  97. package/dist/UserIndexPage-DSDfRWFx.js.map +1 -1
  98. package/dist/UserIndexPage-DahU6wzK.cjs.map +1 -1
  99. package/dist/components/ThemeSync.d.ts +2 -1
  100. package/dist/components/ThemeSync.d.ts.map +1 -1
  101. package/dist/components/auth/PermissionSyncHandler.d.ts +2 -1
  102. package/dist/components/auth/PermissionSyncHandler.d.ts.map +1 -1
  103. package/dist/components/dashboard/ApplicationActivityPieChart.d.ts +1 -1
  104. package/dist/components/dashboard/ApplicationActivityPieChart.d.ts.map +1 -1
  105. package/dist/components/dashboard/ApplicationUsageChart.d.ts +3 -2
  106. package/dist/components/dashboard/ApplicationUsageChart.d.ts.map +1 -1
  107. package/dist/components/dashboard/CurrentSessionCard.d.ts +3 -2
  108. package/dist/components/dashboard/CurrentSessionCard.d.ts.map +1 -1
  109. package/dist/components/dashboard/DeviceBreakdownChart.d.ts +1 -1
  110. package/dist/components/dashboard/DeviceBreakdownChart.d.ts.map +1 -1
  111. package/dist/components/dashboard/DeviceStatsCard.d.ts +3 -2
  112. package/dist/components/dashboard/DeviceStatsCard.d.ts.map +1 -1
  113. package/dist/components/dashboard/EngagementMetricsCard.d.ts +1 -1
  114. package/dist/components/dashboard/EngagementMetricsCard.d.ts.map +1 -1
  115. package/dist/components/dashboard/HierarchyDrillDownChart.d.ts +2 -2
  116. package/dist/components/dashboard/HierarchyDrillDownChart.d.ts.map +1 -1
  117. package/dist/components/dashboard/HourlyUsageChart.d.ts +3 -2
  118. package/dist/components/dashboard/HourlyUsageChart.d.ts.map +1 -1
  119. package/dist/components/dashboard/LoginErrorsTable.d.ts +3 -2
  120. package/dist/components/dashboard/LoginErrorsTable.d.ts.map +1 -1
  121. package/dist/components/dashboard/ModulePopularityChart.d.ts +2 -2
  122. package/dist/components/dashboard/ModulePopularityChart.d.ts.map +1 -1
  123. package/dist/components/dashboard/SessionAnalyticsChart.d.ts +3 -2
  124. package/dist/components/dashboard/SessionAnalyticsChart.d.ts.map +1 -1
  125. package/dist/components/dashboard/TenantActivityPieChart.d.ts +2 -2
  126. package/dist/components/dashboard/TenantActivityPieChart.d.ts.map +1 -1
  127. package/dist/components/dashboard/TenantPopularityChart.d.ts +2 -2
  128. package/dist/components/dashboard/TenantPopularityChart.d.ts.map +1 -1
  129. package/dist/components/dashboard/TenantUsageTrendChart.d.ts +2 -2
  130. package/dist/components/dashboard/TenantUsageTrendChart.d.ts.map +1 -1
  131. package/dist/components/dashboard/UsageTrendChart.d.ts +2 -2
  132. package/dist/components/dashboard/UsageTrendChart.d.ts.map +1 -1
  133. package/dist/components/dashboard/WeeklyUsageChart.d.ts +3 -2
  134. package/dist/components/dashboard/WeeklyUsageChart.d.ts.map +1 -1
  135. package/dist/components/docs/DocRenderer.d.ts +6 -5
  136. package/dist/components/docs/DocRenderer.d.ts.map +1 -1
  137. package/dist/components/docs/DocsSearch.d.ts +5 -4
  138. package/dist/components/docs/DocsSearch.d.ts.map +1 -1
  139. package/dist/components/email/EmailEditor.d.ts +7 -6
  140. package/dist/components/email/EmailEditor.d.ts.map +1 -1
  141. package/dist/components/errors/AccessDenied.d.ts +8 -7
  142. package/dist/components/errors/AccessDenied.d.ts.map +1 -1
  143. package/dist/components/errors/ErrorFallback.d.ts +4 -3
  144. package/dist/components/errors/ErrorFallback.d.ts.map +1 -1
  145. package/dist/components/errors/GlobalErrorBoundary.d.ts +3 -2
  146. package/dist/components/errors/GlobalErrorBoundary.d.ts.map +1 -1
  147. package/dist/components/errors/NoActiveWorkspace.d.ts +2 -1
  148. package/dist/components/errors/NoActiveWorkspace.d.ts.map +1 -1
  149. package/dist/components/errors/RouteErrorBoundary.d.ts +3 -2
  150. package/dist/components/errors/RouteErrorBoundary.d.ts.map +1 -1
  151. package/dist/components/favorites/FavoritesBar.d.ts +3 -2
  152. package/dist/components/favorites/FavoritesBar.d.ts.map +1 -1
  153. package/dist/components/favorites/FavoritesModal.d.ts +4 -3
  154. package/dist/components/favorites/FavoritesModal.d.ts.map +1 -1
  155. package/dist/components/layout/AdminHeader.d.ts +3 -2
  156. package/dist/components/layout/AdminHeader.d.ts.map +1 -1
  157. package/dist/components/layout/AdminSidebar.d.ts +4 -3
  158. package/dist/components/layout/AdminSidebar.d.ts.map +1 -1
  159. package/dist/components/layout/AppHeader.d.ts +3 -2
  160. package/dist/components/layout/AppHeader.d.ts.map +1 -1
  161. package/dist/components/layout/BusinessHeader.d.ts +3 -2
  162. package/dist/components/layout/BusinessHeader.d.ts.map +1 -1
  163. package/dist/components/layout/Footer.d.ts +2 -1
  164. package/dist/components/layout/Footer.d.ts.map +1 -1
  165. package/dist/components/layout/Header.d.ts +2 -1
  166. package/dist/components/layout/Header.d.ts.map +1 -1
  167. package/dist/components/layout/ModuleSidebar.d.ts +4 -3
  168. package/dist/components/layout/ModuleSidebar.d.ts.map +1 -1
  169. package/dist/components/layout/ResizableMainContent.d.ts +3 -2
  170. package/dist/components/layout/ResizableMainContent.d.ts.map +1 -1
  171. package/dist/components/layout/UserHeader.d.ts +3 -2
  172. package/dist/components/layout/UserHeader.d.ts.map +1 -1
  173. package/dist/components/layout/UserSidebar.d.ts +4 -3
  174. package/dist/components/layout/UserSidebar.d.ts.map +1 -1
  175. package/dist/components/license/FeatureGate.d.ts +6 -6
  176. package/dist/components/license/FeatureGate.d.ts.map +1 -1
  177. package/dist/components/license/FeatureRouteGuard.d.ts +3 -2
  178. package/dist/components/license/FeatureRouteGuard.d.ts.map +1 -1
  179. package/dist/components/license/LicenseActivationDialog.d.ts +4 -3
  180. package/dist/components/license/LicenseActivationDialog.d.ts.map +1 -1
  181. package/dist/components/license/LicenseAlertBanner.d.ts +2 -1
  182. package/dist/components/license/LicenseAlertBanner.d.ts.map +1 -1
  183. package/dist/components/license/LicenseBlockOverlay.d.ts +2 -1
  184. package/dist/components/license/LicenseBlockOverlay.d.ts.map +1 -1
  185. package/dist/components/license/LicenseContentBanner.d.ts +2 -1
  186. package/dist/components/license/LicenseContentBanner.d.ts.map +1 -1
  187. package/dist/components/license/LicenseGuard.d.ts +2 -1
  188. package/dist/components/license/LicenseGuard.d.ts.map +1 -1
  189. package/dist/components/license/LicenseStatusBadge.d.ts +3 -2
  190. package/dist/components/license/LicenseStatusBadge.d.ts.map +1 -1
  191. package/dist/components/notifications/NotificationBell.d.ts +2 -1
  192. package/dist/components/notifications/NotificationBell.d.ts.map +1 -1
  193. package/dist/components/platform/administration/ApplicationAccessCustomizeDrawer.d.ts +9 -8
  194. package/dist/components/platform/administration/ApplicationAccessCustomizeDrawer.d.ts.map +1 -1
  195. package/dist/components/platform/administration/ApplicationCard.d.ts +8 -8
  196. package/dist/components/platform/administration/ApplicationCard.d.ts.map +1 -1
  197. package/dist/components/platform/administration/ConflictDiffView.d.ts +4 -3
  198. package/dist/components/platform/administration/ConflictDiffView.d.ts.map +1 -1
  199. package/dist/components/platform/administration/EntraGroupRoleAssignment.d.ts +8 -7
  200. package/dist/components/platform/administration/EntraGroupRoleAssignment.d.ts.map +1 -1
  201. package/dist/components/platform/administration/GroupApplicationsTab.d.ts +4 -3
  202. package/dist/components/platform/administration/GroupApplicationsTab.d.ts.map +1 -1
  203. package/dist/components/platform/administration/GroupMembersTab.d.ts +5 -4
  204. package/dist/components/platform/administration/GroupMembersTab.d.ts.map +1 -1
  205. package/dist/components/platform/administration/GroupPermissionsView.d.ts +3 -2
  206. package/dist/components/platform/administration/GroupPermissionsView.d.ts.map +1 -1
  207. package/dist/components/platform/administration/GroupRoleAssignment.d.ts +10 -9
  208. package/dist/components/platform/administration/GroupRoleAssignment.d.ts.map +1 -1
  209. package/dist/components/platform/administration/GroupTenantsTab.d.ts +4 -3
  210. package/dist/components/platform/administration/GroupTenantsTab.d.ts.map +1 -1
  211. package/dist/components/platform/administration/PermissionDrillDownBar.d.ts +8 -7
  212. package/dist/components/platform/administration/PermissionDrillDownBar.d.ts.map +1 -1
  213. package/dist/components/platform/administration/PermissionMatrixFilters.d.ts +10 -9
  214. package/dist/components/platform/administration/PermissionMatrixFilters.d.ts.map +1 -1
  215. package/dist/components/platform/administration/PermissionMatrixTable.d.ts +15 -14
  216. package/dist/components/platform/administration/PermissionMatrixTable.d.ts.map +1 -1
  217. package/dist/components/platform/administration/PermissionPopover.d.ts +12 -11
  218. package/dist/components/platform/administration/PermissionPopover.d.ts.map +1 -1
  219. package/dist/components/platform/administration/TenantAccessCustomizeDrawer.d.ts +8 -7
  220. package/dist/components/platform/administration/TenantAccessCustomizeDrawer.d.ts.map +1 -1
  221. package/dist/components/platform/administration/TenantEntraTab.d.ts +5 -4
  222. package/dist/components/platform/administration/TenantEntraTab.d.ts.map +1 -1
  223. package/dist/components/platform/administration/UserGroupsTab.d.ts +4 -3
  224. package/dist/components/platform/administration/UserGroupsTab.d.ts.map +1 -1
  225. package/dist/components/platform/administration/UserRoleAssignment.d.ts +13 -12
  226. package/dist/components/platform/administration/UserRoleAssignment.d.ts.map +1 -1
  227. package/dist/components/platform/administration/access-requests/AccessRequestApprovalModal.d.ts +8 -7
  228. package/dist/components/platform/administration/access-requests/AccessRequestApprovalModal.d.ts.map +1 -1
  229. package/dist/components/platform/administration/access-requests/AccessRequestStatusBadge.d.ts +3 -2
  230. package/dist/components/platform/administration/access-requests/AccessRequestStatusBadge.d.ts.map +1 -1
  231. package/dist/components/platform/administration/access-requests/AccessRequestsListTab.d.ts +6 -5
  232. package/dist/components/platform/administration/access-requests/AccessRequestsListTab.d.ts.map +1 -1
  233. package/dist/components/platform/administration/access-requests/RequestAccessButton.d.ts +6 -5
  234. package/dist/components/platform/administration/access-requests/RequestAccessButton.d.ts.map +1 -1
  235. package/dist/components/platform/administration/ai/AiModelsTab.d.ts +6 -5
  236. package/dist/components/platform/administration/ai/AiModelsTab.d.ts.map +1 -1
  237. package/dist/components/platform/administration/ai/AiProfilesTab.d.ts +18 -17
  238. package/dist/components/platform/administration/ai/AiProfilesTab.d.ts.map +1 -1
  239. package/dist/components/platform/administration/ai/AiProvidersTab.d.ts +3 -2
  240. package/dist/components/platform/administration/ai/AiProvidersTab.d.ts.map +1 -1
  241. package/dist/components/platform/administration/ai/PromptTestPanel.d.ts +4 -3
  242. package/dist/components/platform/administration/ai/PromptTestPanel.d.ts.map +1 -1
  243. package/dist/components/platform/administration/applications/ApplicationAccessTab.d.ts +4 -3
  244. package/dist/components/platform/administration/applications/ApplicationAccessTab.d.ts.map +1 -1
  245. package/dist/components/platform/administration/applications/ApplicationInfoTab.d.ts +16 -16
  246. package/dist/components/platform/administration/applications/ApplicationInfoTab.d.ts.map +1 -1
  247. package/dist/components/platform/administration/applications/ApplicationModulesTab.d.ts +30 -29
  248. package/dist/components/platform/administration/applications/ApplicationModulesTab.d.ts.map +1 -1
  249. package/dist/components/platform/administration/applications/ApplicationPermissionsTab.d.ts +5 -4
  250. package/dist/components/platform/administration/applications/ApplicationPermissionsTab.d.ts.map +1 -1
  251. package/dist/components/platform/administration/applications/ApplicationPublicationTab.d.ts +49 -49
  252. package/dist/components/platform/administration/applications/ApplicationPublicationTab.d.ts.map +1 -1
  253. package/dist/components/platform/administration/entra/ConflictCard.d.ts +5 -4
  254. package/dist/components/platform/administration/entra/ConflictCard.d.ts.map +1 -1
  255. package/dist/components/platform/administration/entra/ResolutionModal.d.ts +6 -5
  256. package/dist/components/platform/administration/entra/ResolutionModal.d.ts.map +1 -1
  257. package/dist/components/platform/administration/organisations/CreateOrganisationForm.d.ts +8 -7
  258. package/dist/components/platform/administration/organisations/CreateOrganisationForm.d.ts.map +1 -1
  259. package/dist/components/platform/administration/permissions/GroupPermissionMatrix.d.ts +6 -5
  260. package/dist/components/platform/administration/permissions/GroupPermissionMatrix.d.ts.map +1 -1
  261. package/dist/components/platform/administration/permissions/PermissionStatusIndicator.d.ts +6 -5
  262. package/dist/components/platform/administration/permissions/PermissionStatusIndicator.d.ts.map +1 -1
  263. package/dist/components/platform/administration/permissions/RolePermissionMatrix.d.ts +3 -2
  264. package/dist/components/platform/administration/permissions/RolePermissionMatrix.d.ts.map +1 -1
  265. package/dist/components/platform/administration/permissions/UserPermissionMatrix.d.ts +5 -4
  266. package/dist/components/platform/administration/permissions/UserPermissionMatrix.d.ts.map +1 -1
  267. package/dist/components/platform/administration/settings/SettingsHistoryModal.d.ts +2 -1
  268. package/dist/components/platform/administration/settings/SettingsHistoryModal.d.ts.map +1 -1
  269. package/dist/components/platform/administration/tenants/TenantApplicationsTab.d.ts +55 -54
  270. package/dist/components/platform/administration/tenants/TenantApplicationsTab.d.ts.map +1 -1
  271. package/dist/components/platform/administration/tenants/TenantGroupsTab.d.ts +8 -7
  272. package/dist/components/platform/administration/tenants/TenantGroupsTab.d.ts.map +1 -1
  273. package/dist/components/platform/administration/tenants/TenantMembersTab.d.ts +8 -7
  274. package/dist/components/platform/administration/tenants/TenantMembersTab.d.ts.map +1 -1
  275. package/dist/components/platform/administration/tenants/TenantOverviewTab.d.ts +12 -11
  276. package/dist/components/platform/administration/tenants/TenantOverviewTab.d.ts.map +1 -1
  277. package/dist/components/platform/administration/tenants/TenantRolesTab.d.ts +2 -1
  278. package/dist/components/platform/administration/tenants/TenantRolesTab.d.ts.map +1 -1
  279. package/dist/components/platform/administration/tenants/TenantSupportSettingsTab.d.ts +4 -3
  280. package/dist/components/platform/administration/tenants/TenantSupportSettingsTab.d.ts.map +1 -1
  281. package/dist/components/platform/administration/users/UserActivitySessionsTab.d.ts +8 -7
  282. package/dist/components/platform/administration/users/UserActivitySessionsTab.d.ts.map +1 -1
  283. package/dist/components/platform/administration/users/UserApplicationsTab.d.ts +4 -3
  284. package/dist/components/platform/administration/users/UserApplicationsTab.d.ts.map +1 -1
  285. package/dist/components/platform/administration/users/UserHistoryTab.d.ts +7 -6
  286. package/dist/components/platform/administration/users/UserHistoryTab.d.ts.map +1 -1
  287. package/dist/components/platform/administration/users/UserInfoTab.d.ts +15 -14
  288. package/dist/components/platform/administration/users/UserInfoTab.d.ts.map +1 -1
  289. package/dist/components/platform/administration/users/UserSecurityTab.d.ts +23 -22
  290. package/dist/components/platform/administration/users/UserSecurityTab.d.ts.map +1 -1
  291. package/dist/components/platform/administration/users/UserTenantsTab.d.ts +22 -21
  292. package/dist/components/platform/administration/users/UserTenantsTab.d.ts.map +1 -1
  293. package/dist/components/platform/administration/workflows/WorkflowStepsEditor.d.ts +6 -5
  294. package/dist/components/platform/administration/workflows/WorkflowStepsEditor.d.ts.map +1 -1
  295. package/dist/components/platform/api/external-apps/ExternalAppAuditTab.d.ts +1 -1
  296. package/dist/components/platform/api/external-apps/ExternalAppAuditTab.d.ts.map +1 -1
  297. package/dist/components/platform/api/external-apps/ExternalAppExportsTab.d.ts +6 -5
  298. package/dist/components/platform/api/external-apps/ExternalAppExportsTab.d.ts.map +1 -1
  299. package/dist/components/platform/api/external-apps/ExternalAppInfoTab.d.ts +6 -5
  300. package/dist/components/platform/api/external-apps/ExternalAppInfoTab.d.ts.map +1 -1
  301. package/dist/components/platform/api/external-apps/ExternalAppKeysTab.d.ts +6 -5
  302. package/dist/components/platform/api/external-apps/ExternalAppKeysTab.d.ts.map +1 -1
  303. package/dist/components/platform/api/external-apps/ExternalAppPromptTab.d.ts +3 -2
  304. package/dist/components/platform/api/external-apps/ExternalAppPromptTab.d.ts.map +1 -1
  305. package/dist/components/platform/api/external-apps/ExternalAppRolesTab.d.ts +6 -5
  306. package/dist/components/platform/api/external-apps/ExternalAppRolesTab.d.ts.map +1 -1
  307. package/dist/components/platform/support/ActivityTimeline.d.ts +5 -4
  308. package/dist/components/platform/support/ActivityTimeline.d.ts.map +1 -1
  309. package/dist/components/platform/support/AiClassificationBadge.d.ts +7 -6
  310. package/dist/components/platform/support/AiClassificationBadge.d.ts.map +1 -1
  311. package/dist/components/platform/support/AiRoutingSuggestionPanel.d.ts +9 -8
  312. package/dist/components/platform/support/AiRoutingSuggestionPanel.d.ts.map +1 -1
  313. package/dist/components/platform/support/AiTicketSummary.d.ts +8 -7
  314. package/dist/components/platform/support/AiTicketSummary.d.ts.map +1 -1
  315. package/dist/components/platform/support/FilePreviewModal.d.ts +6 -5
  316. package/dist/components/platform/support/FilePreviewModal.d.ts.map +1 -1
  317. package/dist/components/platform/support/ScreenshotAnnotator.d.ts +6 -5
  318. package/dist/components/platform/support/ScreenshotAnnotator.d.ts.map +1 -1
  319. package/dist/components/platform/support/SlaBadge.d.ts +12 -11
  320. package/dist/components/platform/support/SlaBadge.d.ts.map +1 -1
  321. package/dist/components/platform/support/TemplatePicker.d.ts +6 -5
  322. package/dist/components/platform/support/TemplatePicker.d.ts.map +1 -1
  323. package/dist/components/platform/support/TicketConversation.d.ts +31 -30
  324. package/dist/components/platform/support/TicketConversation.d.ts.map +1 -1
  325. package/dist/components/platform/support/TicketDetailView.d.ts +3 -2
  326. package/dist/components/platform/support/TicketDetailView.d.ts.map +1 -1
  327. package/dist/components/platform/support/TicketSidebar.d.ts +19 -18
  328. package/dist/components/platform/support/TicketSidebar.d.ts.map +1 -1
  329. package/dist/components/platform/support/TicketSolutionPanel.d.ts +10 -9
  330. package/dist/components/platform/support/TicketSolutionPanel.d.ts.map +1 -1
  331. package/dist/components/platform/support/TicketWorkflow.d.ts +10 -9
  332. package/dist/components/platform/support/TicketWorkflow.d.ts.map +1 -1
  333. package/dist/components/platform/support/TicketWorkflowHorizontal.d.ts +19 -18
  334. package/dist/components/platform/support/TicketWorkflowHorizontal.d.ts.map +1 -1
  335. package/dist/components/platform/support/TicketsListView.d.ts +8 -7
  336. package/dist/components/platform/support/TicketsListView.d.ts.map +1 -1
  337. package/dist/components/routing/DocRoutes.d.ts +1 -1
  338. package/dist/components/routing/DocRoutes.d.ts.map +1 -1
  339. package/dist/components/routing/DynamicRouter.d.ts +2 -1
  340. package/dist/components/routing/DynamicRouter.d.ts.map +1 -1
  341. package/dist/components/routing/ProtectedRoute.d.ts +2 -1
  342. package/dist/components/routing/ProtectedRoute.d.ts.map +1 -1
  343. package/dist/components/routing/TenantNavigate.d.ts +4 -3
  344. package/dist/components/routing/TenantNavigate.d.ts.map +1 -1
  345. package/dist/components/routing/TenantRouteWrapper.d.ts +2 -1
  346. package/dist/components/routing/TenantRouteWrapper.d.ts.map +1 -1
  347. package/dist/components/session/SessionProvider.d.ts +2 -1
  348. package/dist/components/session/SessionProvider.d.ts.map +1 -1
  349. package/dist/components/session/SessionWarningModal.d.ts +6 -5
  350. package/dist/components/session/SessionWarningModal.d.ts.map +1 -1
  351. package/dist/components/tenants/TenantCard.d.ts +13 -12
  352. package/dist/components/tenants/TenantCard.d.ts.map +1 -1
  353. package/dist/components/tickets/CreateTicketButton.d.ts +4 -3
  354. package/dist/components/tickets/CreateTicketButton.d.ts.map +1 -1
  355. package/dist/components/tracking/PageTracker.d.ts +2 -1
  356. package/dist/components/tracking/PageTracker.d.ts.map +1 -1
  357. package/dist/components/tracking/TenantTracker.d.ts +2 -1
  358. package/dist/components/tracking/TenantTracker.d.ts.map +1 -1
  359. package/dist/components/ui/AppSwitcher.d.ts +2 -1
  360. package/dist/components/ui/AppSwitcher.d.ts.map +1 -1
  361. package/dist/components/ui/AvatarMenu.d.ts +2 -1
  362. package/dist/components/ui/AvatarMenu.d.ts.map +1 -1
  363. package/dist/components/ui/Breadcrumb.d.ts +7 -6
  364. package/dist/components/ui/Breadcrumb.d.ts.map +1 -1
  365. package/dist/components/ui/ConfirmModal.d.ts +11 -11
  366. package/dist/components/ui/ConfirmModal.d.ts.map +1 -1
  367. package/dist/components/ui/DataTable.d.ts +2 -1
  368. package/dist/components/ui/DataTable.d.ts.map +1 -1
  369. package/dist/components/ui/DataView.d.ts +54 -53
  370. package/dist/components/ui/DataView.d.ts.map +1 -1
  371. package/dist/components/ui/DocEdgeButton.d.ts +2 -1
  372. package/dist/components/ui/DocEdgeButton.d.ts.map +1 -1
  373. package/dist/components/ui/DocPanel.d.ts +2 -1
  374. package/dist/components/ui/DocPanel.d.ts.map +1 -1
  375. package/dist/components/ui/DocToggleButton.d.ts +4 -3
  376. package/dist/components/ui/DocToggleButton.d.ts.map +1 -1
  377. package/dist/components/ui/Drawer.d.ts +9 -8
  378. package/dist/components/ui/Drawer.d.ts.map +1 -1
  379. package/dist/components/ui/EntityCard.d.ts +75 -74
  380. package/dist/components/ui/EntityCard.d.ts.map +1 -1
  381. package/dist/components/ui/KanbanBoard.d.ts +23 -22
  382. package/dist/components/ui/KanbanBoard.d.ts.map +1 -1
  383. package/dist/components/ui/LanguageSwitcher.d.ts +2 -1
  384. package/dist/components/ui/LanguageSwitcher.d.ts.map +1 -1
  385. package/dist/components/ui/PageHeader.d.ts +6 -6
  386. package/dist/components/ui/PageHeader.d.ts.map +1 -1
  387. package/dist/components/ui/PageLoader.d.ts +2 -1
  388. package/dist/components/ui/PageLoader.d.ts.map +1 -1
  389. package/dist/components/ui/PermissionMatrix.d.ts +2 -1
  390. package/dist/components/ui/PermissionMatrix.d.ts.map +1 -1
  391. package/dist/components/ui/ProtectedButton.d.ts +9 -8
  392. package/dist/components/ui/ProtectedButton.d.ts.map +1 -1
  393. package/dist/components/ui/RestrictedModuleBanner.d.ts +2 -1
  394. package/dist/components/ui/RestrictedModuleBanner.d.ts.map +1 -1
  395. package/dist/components/ui/ScopeBanner.d.ts +5 -4
  396. package/dist/components/ui/ScopeBanner.d.ts.map +1 -1
  397. package/dist/components/ui/SelectWithOther.d.ts +10 -9
  398. package/dist/components/ui/SelectWithOther.d.ts.map +1 -1
  399. package/dist/components/ui/SortableList.d.ts +6 -5
  400. package/dist/components/ui/SortableList.d.ts.map +1 -1
  401. package/dist/components/ui/TenantScopeFilter.d.ts +8 -7
  402. package/dist/components/ui/TenantScopeFilter.d.ts.map +1 -1
  403. package/dist/components/ui/TenantScopeSelector.d.ts +8 -7
  404. package/dist/components/ui/TenantScopeSelector.d.ts.map +1 -1
  405. package/dist/components/ui/TenantSelector.d.ts +2 -1
  406. package/dist/components/ui/TenantSelector.d.ts.map +1 -1
  407. package/dist/components/ui/ThemeCustomizer.d.ts +5 -4
  408. package/dist/components/ui/ThemeCustomizer.d.ts.map +1 -1
  409. package/dist/components/ui/ThemeScopeSelector.d.ts +3 -2
  410. package/dist/components/ui/ThemeScopeSelector.d.ts.map +1 -1
  411. package/dist/components/ui/ThemeSwitcher.d.ts +2 -1
  412. package/dist/components/ui/ThemeSwitcher.d.ts.map +1 -1
  413. package/dist/components/ui/Tooltip.d.ts +14 -13
  414. package/dist/components/ui/Tooltip.d.ts.map +1 -1
  415. package/dist/components/ui/UnderDevelopment.d.ts +8 -7
  416. package/dist/components/ui/UnderDevelopment.d.ts.map +1 -1
  417. package/dist/components/ui/UnlockAccountModal.d.ts +6 -5
  418. package/dist/components/ui/UnlockAccountModal.d.ts.map +1 -1
  419. package/dist/components/ui/ViewModeToggle.d.ts +4 -3
  420. package/dist/components/ui/ViewModeToggle.d.ts.map +1 -1
  421. package/dist/contexts/AuthContext.d.ts +2 -1
  422. package/dist/contexts/AuthContext.d.ts.map +1 -1
  423. package/dist/contexts/DocPanelContext.d.ts +2 -1
  424. package/dist/contexts/DocPanelContext.d.ts.map +1 -1
  425. package/dist/contexts/FavoritesContext.d.ts +2 -1
  426. package/dist/contexts/FavoritesContext.d.ts.map +1 -1
  427. package/dist/contexts/FeatureConfigContext.d.ts +3 -2
  428. package/dist/contexts/FeatureConfigContext.d.ts.map +1 -1
  429. package/dist/contexts/LicenseContext.d.ts +2 -1
  430. package/dist/contexts/LicenseContext.d.ts.map +1 -1
  431. package/dist/contexts/NavigationContext.d.ts +2 -1
  432. package/dist/contexts/NavigationContext.d.ts.map +1 -1
  433. package/dist/contexts/SidebarContext.d.ts +2 -1
  434. package/dist/contexts/SidebarContext.d.ts.map +1 -1
  435. package/dist/contexts/SignalRContext.d.ts +2 -1
  436. package/dist/contexts/SignalRContext.d.ts.map +1 -1
  437. package/dist/contexts/TenantContext.d.ts +2 -1
  438. package/dist/contexts/TenantContext.d.ts.map +1 -1
  439. package/dist/contexts/ThemeContext.d.ts +2 -1
  440. package/dist/contexts/ThemeContext.d.ts.map +1 -1
  441. package/dist/extensions/ExtensionContext.d.ts +4 -3
  442. package/dist/extensions/ExtensionContext.d.ts.map +1 -1
  443. package/dist/extensions/PageRegistry.d.ts +6 -5
  444. package/dist/extensions/PageRegistry.d.ts.map +1 -1
  445. package/dist/extensions/SlotFill.d.ts +13 -13
  446. package/dist/extensions/SlotFill.d.ts.map +1 -1
  447. package/dist/extensions/types.d.ts +10 -10
  448. package/dist/extensions/types.d.ts.map +1 -1
  449. package/dist/hooks/useAccessRequestActions.d.ts.map +1 -1
  450. package/dist/hooks/useAccessRequests.d.ts.map +1 -1
  451. package/dist/hooks/useAdminTenants.d.ts.map +1 -1
  452. package/dist/hooks/useClientContext.d.ts.map +1 -1
  453. package/dist/hooks/useCollapsibleState.d.ts.map +1 -1
  454. package/dist/hooks/useCreateSupportTicket.d.ts +23 -21
  455. package/dist/hooks/useCreateSupportTicket.d.ts.map +1 -1
  456. package/dist/hooks/useLocale.d.ts.map +1 -1
  457. package/dist/hooks/useLoginForm.d.ts +5 -4
  458. package/dist/hooks/useLoginForm.d.ts.map +1 -1
  459. package/dist/hooks/useNotifications.d.ts.map +1 -1
  460. package/dist/hooks/usePageTracking.d.ts.map +1 -1
  461. package/dist/hooks/usePagination.d.ts +1 -1
  462. package/dist/hooks/usePagination.d.ts.map +1 -1
  463. package/dist/hooks/usePermissionSync.d.ts +2 -1
  464. package/dist/hooks/usePermissionSync.d.ts.map +1 -1
  465. package/dist/hooks/useRestrictedModuleCheck.d.ts.map +1 -1
  466. package/dist/hooks/useSessionMonitor.d.ts +7 -5
  467. package/dist/hooks/useSessionMonitor.d.ts.map +1 -1
  468. package/dist/hooks/useSettingsSection.d.ts.map +1 -1
  469. package/dist/hooks/useSignalR.d.ts.map +1 -1
  470. package/dist/hooks/useTenantCreateForm.d.ts +24 -22
  471. package/dist/hooks/useTenantCreateForm.d.ts.map +1 -1
  472. package/dist/hooks/useTenantFavorites.d.ts.map +1 -1
  473. package/dist/hooks/useTenantFilters.d.ts.map +1 -1
  474. package/dist/hooks/useTenantTracking.d.ts.map +1 -1
  475. package/dist/hooks/useTicketSignalR.d.ts.map +1 -1
  476. package/dist/hooks/useUserAccessRequests.d.ts.map +1 -1
  477. package/dist/i18n/config.d.ts +1 -1
  478. package/dist/i18n/config.d.ts.map +1 -1
  479. package/dist/{index-DGeNdATi.js → index-3lcyR754.js} +2 -2
  480. package/dist/{index-DGeNdATi.js.map → index-3lcyR754.js.map} +1 -1
  481. package/dist/{index-DJXny6rD.cjs → index-AM9K908G.cjs} +2 -2
  482. package/dist/{index-DJXny6rD.cjs.map → index-AM9K908G.cjs.map} +1 -1
  483. package/dist/{index-ASxPhrgZ.cjs → index-BASU1QDx.cjs} +2 -2
  484. package/dist/index-BASU1QDx.cjs.map +1 -0
  485. package/dist/{index-ChVCBF4t.js → index-BBFFDXgT.js} +2 -2
  486. package/dist/{index-ChVCBF4t.js.map → index-BBFFDXgT.js.map} +1 -1
  487. package/dist/{index-C54HbULX.cjs → index-BBQMnq4P.cjs} +2 -2
  488. package/dist/index-BBQMnq4P.cjs.map +1 -0
  489. package/dist/{index-CUISVUMx.js → index-BEOtfRxa.js} +16 -16
  490. package/dist/index-BEOtfRxa.js.map +1 -0
  491. package/dist/{index-D4u23zHI.js → index-BEeLN5ui.js} +24 -24
  492. package/dist/index-BEeLN5ui.js.map +1 -0
  493. package/dist/{index-Du4fQfix.cjs → index-BEpBEF5G.cjs} +2 -2
  494. package/dist/index-BEpBEF5G.cjs.map +1 -0
  495. package/dist/{index-BlHDI4zj.js → index-BIB3FxMF.js} +14 -14
  496. package/dist/index-BIB3FxMF.js.map +1 -0
  497. package/dist/{index-Txfokhn3.cjs → index-BVUCDL0k.cjs} +2 -2
  498. package/dist/index-BVUCDL0k.cjs.map +1 -0
  499. package/dist/{index-jpSTOjXU.js → index-BYYgvEcO.js} +17 -17
  500. package/dist/index-BYYgvEcO.js.map +1 -0
  501. package/dist/{index-CU66n-zU.js → index-B_lFRwmY.js} +13 -13
  502. package/dist/index-B_lFRwmY.js.map +1 -0
  503. package/dist/{index-Blfc9wKG.js → index-Bbd3D6A4.js} +8 -8
  504. package/dist/index-Bbd3D6A4.js.map +1 -0
  505. package/dist/index-BfMaHuWh.cjs +48 -0
  506. package/dist/index-BfMaHuWh.cjs.map +1 -0
  507. package/dist/index-C0AgM8YN.cjs.map +1 -1
  508. package/dist/index-C0rFTzxZ.cjs +2 -0
  509. package/dist/index-C0rFTzxZ.cjs.map +1 -0
  510. package/dist/{index-By0u9UFY.js → index-CCS0saZk.js} +10 -10
  511. package/dist/index-CCS0saZk.js.map +1 -0
  512. package/dist/{index-C40Dlolq.js → index-CID51vRa.js} +28 -28
  513. package/dist/index-CID51vRa.js.map +1 -0
  514. package/dist/index-CO5QP9C1.cjs +2 -0
  515. package/dist/index-CO5QP9C1.cjs.map +1 -0
  516. package/dist/{index-CI1DJrFE.js → index-CaI6ZbEo.js} +12 -12
  517. package/dist/index-CaI6ZbEo.js.map +1 -0
  518. package/dist/{index-DKRiN1hJ.cjs → index-CaLDUVLs.cjs} +2 -2
  519. package/dist/{index-DKRiN1hJ.cjs.map → index-CaLDUVLs.cjs.map} +1 -1
  520. package/dist/index-CdORB0b4.cjs.map +1 -1
  521. package/dist/{index-Dxau-XnQ.cjs → index-Cdu0fSs8.cjs} +2 -2
  522. package/dist/index-Cdu0fSs8.cjs.map +1 -0
  523. package/dist/{index-Bup-dL1l.cjs → index-CiAIT31Y.cjs} +2 -2
  524. package/dist/{index-Bup-dL1l.cjs.map → index-CiAIT31Y.cjs.map} +1 -1
  525. package/dist/{index-ClIOix1g.js → index-ClrwWu9J.js} +2 -2
  526. package/dist/{index-ClIOix1g.js.map → index-ClrwWu9J.js.map} +1 -1
  527. package/dist/{index-DdsLBKHV.cjs → index-CtcTcQqt.cjs} +2 -2
  528. package/dist/{index-DdsLBKHV.cjs.map → index-CtcTcQqt.cjs.map} +1 -1
  529. package/dist/{index-DM5ogbum.js → index-CzCt3Aan.js} +2 -2
  530. package/dist/{index-DM5ogbum.js.map → index-CzCt3Aan.js.map} +1 -1
  531. package/dist/index-D1WPBG1_.cjs +2 -0
  532. package/dist/index-D1WPBG1_.cjs.map +1 -0
  533. package/dist/{index-Dsbkiw3B.js → index-DA3kbmS5.js} +2 -2
  534. package/dist/{index-Dsbkiw3B.js.map → index-DA3kbmS5.js.map} +1 -1
  535. package/dist/{index-D6zlXbv_.js → index-DE40yc39.js} +2 -2
  536. package/dist/{index-D6zlXbv_.js.map → index-DE40yc39.js.map} +1 -1
  537. package/dist/{index-DmuVa7Ye.cjs → index-DIuoVYFu.cjs} +2 -2
  538. package/dist/index-DIuoVYFu.cjs.map +1 -0
  539. package/dist/{index-DDJTWztK.cjs → index-DLSMVKFE.cjs} +2 -2
  540. package/dist/{index-DDJTWztK.cjs.map → index-DLSMVKFE.cjs.map} +1 -1
  541. package/dist/index-DQBVnnd6.cjs +2 -0
  542. package/dist/index-DQBVnnd6.cjs.map +1 -0
  543. package/dist/{index-BYhFG50Z.cjs → index-DRT2wvEs.cjs} +2 -2
  544. package/dist/index-DRT2wvEs.cjs.map +1 -0
  545. package/dist/{index-Cv7iWoG8.js → index-DRc5qb2I.js} +15 -15
  546. package/dist/index-DRc5qb2I.js.map +1 -0
  547. package/dist/index-DTAZtzQ6.js.map +1 -1
  548. package/dist/{index-BnWMDCRU.cjs → index-DYJbiXHU.cjs} +2 -2
  549. package/dist/index-DYJbiXHU.cjs.map +1 -0
  550. package/dist/{index-D8xuGyjU.js → index-DhVauF9E.js} +16 -16
  551. package/dist/index-DhVauF9E.js.map +1 -0
  552. package/dist/index-DiQ2SDvl.js.map +1 -1
  553. package/dist/{index-BcO3pBlL.js → index-Dm5ZLB9x.js} +14 -14
  554. package/dist/index-Dm5ZLB9x.js.map +1 -0
  555. package/dist/{index-CBOLnJkG.cjs → index-HWG-CG1i.cjs} +2 -2
  556. package/dist/index-HWG-CG1i.cjs.map +1 -0
  557. package/dist/{index-0Jhdcj59.js → index-Kn_ynW2m.js} +3298 -3200
  558. package/dist/index-Kn_ynW2m.js.map +1 -0
  559. package/dist/{index-B2rKKVDN.js → index-L994YeGJ.js} +7 -7
  560. package/dist/index-L994YeGJ.js.map +1 -0
  561. package/dist/{index-1tvWzIw0.cjs → index-OhzFdH9N.cjs} +2 -2
  562. package/dist/{index-1tvWzIw0.cjs.map → index-OhzFdH9N.cjs.map} +1 -1
  563. package/dist/{index-CnmIX2MY.js → index-Z6aHkjiA.js} +23 -20
  564. package/dist/index-Z6aHkjiA.js.map +1 -0
  565. package/dist/index-p2jNjCTo.cjs +2 -0
  566. package/dist/index-p2jNjCTo.cjs.map +1 -0
  567. package/dist/{index-DwATtWun.js → index-vUb_gIjC.js} +11 -11
  568. package/dist/index-vUb_gIjC.js.map +1 -0
  569. package/dist/{index-eAHjmtzn.cjs → index-xCGnOlox.cjs} +2 -2
  570. package/dist/index-xCGnOlox.cjs.map +1 -0
  571. package/dist/layouts/AdminLayout.d.ts +2 -1
  572. package/dist/layouts/AdminLayout.d.ts.map +1 -1
  573. package/dist/layouts/AppLayout.d.ts +2 -1
  574. package/dist/layouts/AppLayout.d.ts.map +1 -1
  575. package/dist/layouts/AuthLayout.d.ts +2 -1
  576. package/dist/layouts/AuthLayout.d.ts.map +1 -1
  577. package/dist/layouts/BusinessLayout.d.ts +2 -1
  578. package/dist/layouts/BusinessLayout.d.ts.map +1 -1
  579. package/dist/layouts/DocsLayout.d.ts +2 -1
  580. package/dist/layouts/DocsLayout.d.ts.map +1 -1
  581. package/dist/layouts/PublicLayout.d.ts +2 -1
  582. package/dist/layouts/PublicLayout.d.ts.map +1 -1
  583. package/dist/layouts/UserLayout.d.ts +2 -1
  584. package/dist/layouts/UserLayout.d.ts.map +1 -1
  585. package/dist/pages/ApplicationsPage.d.ts +2 -1
  586. package/dist/pages/ApplicationsPage.d.ts.map +1 -1
  587. package/dist/pages/HomePage.d.ts +2 -1
  588. package/dist/pages/HomePage.d.ts.map +1 -1
  589. package/dist/pages/LoginPage.d.ts +2 -1
  590. package/dist/pages/LoginPage.d.ts.map +1 -1
  591. package/dist/pages/NotFoundPage.d.ts +2 -1
  592. package/dist/pages/NotFoundPage.d.ts.map +1 -1
  593. package/dist/pages/auth/AuthCallbackPage.d.ts +2 -1
  594. package/dist/pages/auth/AuthCallbackPage.d.ts.map +1 -1
  595. package/dist/pages/auth/ConfirmEmailPage.d.ts +2 -1
  596. package/dist/pages/auth/ConfirmEmailPage.d.ts.map +1 -1
  597. package/dist/pages/auth/ForceChangePasswordPage.d.ts +2 -1
  598. package/dist/pages/auth/ForceChangePasswordPage.d.ts.map +1 -1
  599. package/dist/pages/auth/ForgotPasswordPage.d.ts +2 -1
  600. package/dist/pages/auth/ForgotPasswordPage.d.ts.map +1 -1
  601. package/dist/pages/auth/OnboardingWizardPage.d.ts +2 -1
  602. package/dist/pages/auth/OnboardingWizardPage.d.ts.map +1 -1
  603. package/dist/pages/auth/RegisterPage.d.ts +2 -1
  604. package/dist/pages/auth/RegisterPage.d.ts.map +1 -1
  605. package/dist/pages/auth/ResetPasswordPage.d.ts +2 -1
  606. package/dist/pages/auth/ResetPasswordPage.d.ts.map +1 -1
  607. package/dist/pages/business/BusinessApplicationsGridPage.d.ts +2 -1
  608. package/dist/pages/business/BusinessApplicationsGridPage.d.ts.map +1 -1
  609. package/dist/pages/docs/business/platform/administration/ai/index.d.ts +2 -1
  610. package/dist/pages/docs/business/platform/administration/ai/index.d.ts.map +1 -1
  611. package/dist/pages/docs/business/platform/administration/applications/index.d.ts +2 -1
  612. package/dist/pages/docs/business/platform/administration/applications/index.d.ts.map +1 -1
  613. package/dist/pages/docs/business/platform/administration/configuration/index.d.ts +2 -1
  614. package/dist/pages/docs/business/platform/administration/configuration/index.d.ts.map +1 -1
  615. package/dist/pages/docs/business/platform/administration/configuration/license/index.d.ts +2 -1
  616. package/dist/pages/docs/business/platform/administration/configuration/license/index.d.ts.map +1 -1
  617. package/dist/pages/docs/business/platform/administration/entra/index.d.ts +2 -1
  618. package/dist/pages/docs/business/platform/administration/entra/index.d.ts.map +1 -1
  619. package/dist/pages/docs/business/platform/administration/permissions/assignments/index.d.ts +2 -1
  620. package/dist/pages/docs/business/platform/administration/permissions/assignments/index.d.ts.map +1 -1
  621. package/dist/pages/docs/business/platform/administration/permissions/index.d.ts +2 -1
  622. package/dist/pages/docs/business/platform/administration/permissions/index.d.ts.map +1 -1
  623. package/dist/pages/docs/business/platform/administration/tenants/access-requests/index.d.ts +2 -1
  624. package/dist/pages/docs/business/platform/administration/tenants/access-requests/index.d.ts.map +1 -1
  625. package/dist/pages/docs/business/platform/administration/tenants/applications/index.d.ts +2 -1
  626. package/dist/pages/docs/business/platform/administration/tenants/applications/index.d.ts.map +1 -1
  627. package/dist/pages/docs/business/platform/administration/tenants/business/index.d.ts +2 -1
  628. package/dist/pages/docs/business/platform/administration/tenants/business/index.d.ts.map +1 -1
  629. package/dist/pages/docs/business/platform/administration/tenants/index.d.ts +2 -1
  630. package/dist/pages/docs/business/platform/administration/tenants/index.d.ts.map +1 -1
  631. package/dist/pages/docs/business/platform/administration/tenants/organisations/index.d.ts +2 -1
  632. package/dist/pages/docs/business/platform/administration/tenants/organisations/index.d.ts.map +1 -1
  633. package/dist/pages/docs/business/platform/administration/tenants/other/index.d.ts +2 -1
  634. package/dist/pages/docs/business/platform/administration/tenants/other/index.d.ts.map +1 -1
  635. package/dist/pages/docs/business/platform/administration/tenants/personal/index.d.ts +2 -1
  636. package/dist/pages/docs/business/platform/administration/tenants/personal/index.d.ts.map +1 -1
  637. package/dist/pages/docs/business/platform/administration/tenants/template/index.d.ts +2 -1
  638. package/dist/pages/docs/business/platform/administration/tenants/template/index.d.ts.map +1 -1
  639. package/dist/pages/docs/business/platform/administration/users/dashboard/index.d.ts +2 -1
  640. package/dist/pages/docs/business/platform/administration/users/dashboard/index.d.ts.map +1 -1
  641. package/dist/pages/docs/business/platform/administration/users/groups/index.d.ts +2 -1
  642. package/dist/pages/docs/business/platform/administration/users/groups/index.d.ts.map +1 -1
  643. package/dist/pages/docs/business/platform/administration/users/index.d.ts +2 -1
  644. package/dist/pages/docs/business/platform/administration/users/index.d.ts.map +1 -1
  645. package/dist/pages/docs/business/platform/administration/users/references/index.d.ts +2 -1
  646. package/dist/pages/docs/business/platform/administration/users/references/index.d.ts.map +1 -1
  647. package/dist/pages/docs/business/platform/administration/workflows/index.d.ts +2 -1
  648. package/dist/pages/docs/business/platform/administration/workflows/index.d.ts.map +1 -1
  649. package/dist/pages/docs/business/platform/support/tickets/index.d.ts +2 -1
  650. package/dist/pages/docs/business/platform/support/tickets/index.d.ts.map +1 -1
  651. package/dist/pages/notifications/NotificationsPage.d.ts +2 -1
  652. package/dist/pages/notifications/NotificationsPage.d.ts.map +1 -1
  653. package/dist/pages/personal/myspace/MyAccessRequestsPage.d.ts +2 -1
  654. package/dist/pages/personal/myspace/MyAccessRequestsPage.d.ts.map +1 -1
  655. package/dist/pages/personal/myspace/MyTenantsPage.d.ts +2 -1
  656. package/dist/pages/personal/myspace/MyTenantsPage.d.ts.map +1 -1
  657. package/dist/pages/personal/myspace/PortalDashboardPage.d.ts +2 -1
  658. package/dist/pages/personal/myspace/PortalDashboardPage.d.ts.map +1 -1
  659. package/dist/pages/personal/myspace/PreferencesPage.d.ts +2 -1
  660. package/dist/pages/personal/myspace/PreferencesPage.d.ts.map +1 -1
  661. package/dist/pages/personal/myspace/ProfilePage.d.ts +2 -1
  662. package/dist/pages/personal/myspace/ProfilePage.d.ts.map +1 -1
  663. package/dist/pages/personal/myspace/UserDashboardPage.d.ts +2 -1
  664. package/dist/pages/personal/myspace/UserDashboardPage.d.ts.map +1 -1
  665. package/dist/pages/platform/administration/DashboardPage.d.ts +2 -1
  666. package/dist/pages/platform/administration/DashboardPage.d.ts.map +1 -1
  667. package/dist/pages/platform/administration/ai/AiAgentDetailPage.d.ts +2 -1
  668. package/dist/pages/platform/administration/ai/AiAgentDetailPage.d.ts.map +1 -1
  669. package/dist/pages/platform/administration/ai/AiAgentEditPage.d.ts +2 -1
  670. package/dist/pages/platform/administration/ai/AiAgentEditPage.d.ts.map +1 -1
  671. package/dist/pages/platform/administration/ai/AiAgentsPage.d.ts +2 -1
  672. package/dist/pages/platform/administration/ai/AiAgentsPage.d.ts.map +1 -1
  673. package/dist/pages/platform/administration/ai/AiBlockDefinitionDetailPage.d.ts +2 -1
  674. package/dist/pages/platform/administration/ai/AiBlockDefinitionDetailPage.d.ts.map +1 -1
  675. package/dist/pages/platform/administration/ai/AiBlockDefinitionEditPage.d.ts +2 -1
  676. package/dist/pages/platform/administration/ai/AiBlockDefinitionEditPage.d.ts.map +1 -1
  677. package/dist/pages/platform/administration/ai/AiBlockDefinitionsListPage.d.ts +2 -1
  678. package/dist/pages/platform/administration/ai/AiBlockDefinitionsListPage.d.ts.map +1 -1
  679. package/dist/pages/platform/administration/ai/AiDashboardPage.d.ts +2 -1
  680. package/dist/pages/platform/administration/ai/AiDashboardPage.d.ts.map +1 -1
  681. package/dist/pages/platform/administration/ai/AiMonitoringPage.d.ts +2 -1
  682. package/dist/pages/platform/administration/ai/AiMonitoringPage.d.ts.map +1 -1
  683. package/dist/pages/platform/administration/ai/AiPromptsListPage.d.ts +2 -1
  684. package/dist/pages/platform/administration/ai/AiPromptsListPage.d.ts.map +1 -1
  685. package/dist/pages/platform/administration/ai/AiPromptsPage.d.ts +2 -1
  686. package/dist/pages/platform/administration/ai/AiPromptsPage.d.ts.map +1 -1
  687. package/dist/pages/platform/administration/ai/AiSettingsPage.d.ts +2 -1
  688. package/dist/pages/platform/administration/ai/AiSettingsPage.d.ts.map +1 -1
  689. package/dist/pages/platform/administration/ai/AiSkillsDetailPage.d.ts +2 -1
  690. package/dist/pages/platform/administration/ai/AiSkillsDetailPage.d.ts.map +1 -1
  691. package/dist/pages/platform/administration/ai/AiSkillsEditPage.d.ts +2 -1
  692. package/dist/pages/platform/administration/ai/AiSkillsEditPage.d.ts.map +1 -1
  693. package/dist/pages/platform/administration/applications/ApplicationDetailPage.d.ts +2 -1
  694. package/dist/pages/platform/administration/applications/ApplicationDetailPage.d.ts.map +1 -1
  695. package/dist/pages/platform/administration/applications/ApplicationsGridPage.d.ts +2 -1
  696. package/dist/pages/platform/administration/applications/ApplicationsGridPage.d.ts.map +1 -1
  697. package/dist/pages/platform/administration/applications/ApplicationsListPage.d.ts.map +1 -1
  698. package/dist/pages/platform/administration/applications/NavigationAppsPage.d.ts +2 -1
  699. package/dist/pages/platform/administration/applications/NavigationAppsPage.d.ts.map +1 -1
  700. package/dist/pages/platform/administration/configuration/appsettings/AppSettingsPage.d.ts +2 -1
  701. package/dist/pages/platform/administration/configuration/appsettings/AppSettingsPage.d.ts.map +1 -1
  702. package/dist/pages/platform/administration/configuration/appsettings/AuthenticationSection.d.ts +2 -1
  703. package/dist/pages/platform/administration/configuration/appsettings/AuthenticationSection.d.ts.map +1 -1
  704. package/dist/pages/platform/administration/configuration/appsettings/EmailSection.d.ts +2 -1
  705. package/dist/pages/platform/administration/configuration/appsettings/EmailSection.d.ts.map +1 -1
  706. package/dist/pages/platform/administration/configuration/appsettings/EntraSection.d.ts +2 -1
  707. package/dist/pages/platform/administration/configuration/appsettings/EntraSection.d.ts.map +1 -1
  708. package/dist/pages/platform/administration/configuration/appsettings/InfrastructureSection.d.ts +2 -1
  709. package/dist/pages/platform/administration/configuration/appsettings/InfrastructureSection.d.ts.map +1 -1
  710. package/dist/pages/platform/administration/configuration/appsettings/LoggingSection.d.ts +2 -1
  711. package/dist/pages/platform/administration/configuration/appsettings/LoggingSection.d.ts.map +1 -1
  712. package/dist/pages/platform/administration/configuration/license/LicenseManagementPage.d.ts +2 -1
  713. package/dist/pages/platform/administration/configuration/license/LicenseManagementPage.d.ts.map +1 -1
  714. package/dist/pages/platform/administration/configuration/settings/FileUploadSettingsSection.d.ts +2 -1
  715. package/dist/pages/platform/administration/configuration/settings/FileUploadSettingsSection.d.ts.map +1 -1
  716. package/dist/pages/platform/administration/configuration/settings/GeneralSettingsSection.d.ts +2 -1
  717. package/dist/pages/platform/administration/configuration/settings/GeneralSettingsSection.d.ts.map +1 -1
  718. package/dist/pages/platform/administration/configuration/settings/LegalFileSettingsSection.d.ts +2 -1
  719. package/dist/pages/platform/administration/configuration/settings/LegalFileSettingsSection.d.ts.map +1 -1
  720. package/dist/pages/platform/administration/configuration/settings/SettingsPage.d.ts +2 -1
  721. package/dist/pages/platform/administration/configuration/settings/SettingsPage.d.ts.map +1 -1
  722. package/dist/pages/platform/administration/configuration/settings/StorageInfoSection.d.ts +2 -1
  723. package/dist/pages/platform/administration/configuration/settings/StorageInfoSection.d.ts.map +1 -1
  724. package/dist/pages/platform/administration/entra/EntraConflictsPage.d.ts +2 -1
  725. package/dist/pages/platform/administration/entra/EntraConflictsPage.d.ts.map +1 -1
  726. package/dist/pages/platform/administration/entra/EntraDashboardPage.d.ts +2 -1
  727. package/dist/pages/platform/administration/entra/EntraDashboardPage.d.ts.map +1 -1
  728. package/dist/pages/platform/administration/entra/EntraGroupsPage.d.ts +2 -1
  729. package/dist/pages/platform/administration/entra/EntraGroupsPage.d.ts.map +1 -1
  730. package/dist/pages/platform/administration/entra/EntraSettingsPage.d.ts +2 -1
  731. package/dist/pages/platform/administration/entra/EntraSettingsPage.d.ts.map +1 -1
  732. package/dist/pages/platform/administration/entra/EntraUsersPage.d.ts +2 -1
  733. package/dist/pages/platform/administration/entra/EntraUsersPage.d.ts.map +1 -1
  734. package/dist/pages/platform/administration/permissions/AssignmentsPage.d.ts +2 -1
  735. package/dist/pages/platform/administration/permissions/AssignmentsPage.d.ts.map +1 -1
  736. package/dist/pages/platform/administration/permissions/PermissionDetailPage.d.ts +2 -1
  737. package/dist/pages/platform/administration/permissions/PermissionDetailPage.d.ts.map +1 -1
  738. package/dist/pages/platform/administration/permissions/PermissionsPage.d.ts +2 -1
  739. package/dist/pages/platform/administration/permissions/PermissionsPage.d.ts.map +1 -1
  740. package/dist/pages/platform/administration/permissions/RoleDetailPage.d.ts +2 -1
  741. package/dist/pages/platform/administration/permissions/RoleDetailPage.d.ts.map +1 -1
  742. package/dist/pages/platform/administration/permissions/RolesPage.d.ts +2 -1
  743. package/dist/pages/platform/administration/permissions/RolesPage.d.ts.map +1 -1
  744. package/dist/pages/platform/administration/tenants/OrganisationCreatePage.d.ts +2 -1
  745. package/dist/pages/platform/administration/tenants/OrganisationCreatePage.d.ts.map +1 -1
  746. package/dist/pages/platform/administration/tenants/OrganisationDetailPage.d.ts +2 -1
  747. package/dist/pages/platform/administration/tenants/OrganisationDetailPage.d.ts.map +1 -1
  748. package/dist/pages/platform/administration/tenants/OrganisationsListPage.d.ts +2 -1
  749. package/dist/pages/platform/administration/tenants/OrganisationsListPage.d.ts.map +1 -1
  750. package/dist/pages/platform/administration/tenants/TenantAccessRequestsPage.d.ts +2 -1
  751. package/dist/pages/platform/administration/tenants/TenantAccessRequestsPage.d.ts.map +1 -1
  752. package/dist/pages/platform/administration/tenants/TenantCreatePage.d.ts +2 -1
  753. package/dist/pages/platform/administration/tenants/TenantCreatePage.d.ts.map +1 -1
  754. package/dist/pages/platform/administration/tenants/TenantDetailPage.d.ts +2 -1
  755. package/dist/pages/platform/administration/tenants/TenantDetailPage.d.ts.map +1 -1
  756. package/dist/pages/platform/administration/tenants/TenantSettingsPage.d.ts +2 -1
  757. package/dist/pages/platform/administration/tenants/TenantSettingsPage.d.ts.map +1 -1
  758. package/dist/pages/platform/administration/tenants/TenantTemplateCreatePage.d.ts +2 -1
  759. package/dist/pages/platform/administration/tenants/TenantTemplateCreatePage.d.ts.map +1 -1
  760. package/dist/pages/platform/administration/tenants/TenantTemplateDetailPage.d.ts +2 -1
  761. package/dist/pages/platform/administration/tenants/TenantTemplateDetailPage.d.ts.map +1 -1
  762. package/dist/pages/platform/administration/tenants/TenantsBusinessPage.d.ts +2 -1
  763. package/dist/pages/platform/administration/tenants/TenantsBusinessPage.d.ts.map +1 -1
  764. package/dist/pages/platform/administration/tenants/TenantsDashboardPage.d.ts +2 -1
  765. package/dist/pages/platform/administration/tenants/TenantsDashboardPage.d.ts.map +1 -1
  766. package/dist/pages/platform/administration/tenants/TenantsOtherPage.d.ts +2 -1
  767. package/dist/pages/platform/administration/tenants/TenantsOtherPage.d.ts.map +1 -1
  768. package/dist/pages/platform/administration/tenants/TenantsPage.d.ts +4 -3
  769. package/dist/pages/platform/administration/tenants/TenantsPage.d.ts.map +1 -1
  770. package/dist/pages/platform/administration/tenants/TenantsPersonalPage.d.ts +2 -1
  771. package/dist/pages/platform/administration/tenants/TenantsPersonalPage.d.ts.map +1 -1
  772. package/dist/pages/platform/administration/tenants/TenantsSystemPage.d.ts +2 -1
  773. package/dist/pages/platform/administration/tenants/TenantsSystemPage.d.ts.map +1 -1
  774. package/dist/pages/platform/administration/tenants/TenantsTemplatePage.d.ts +2 -1
  775. package/dist/pages/platform/administration/tenants/TenantsTemplatePage.d.ts.map +1 -1
  776. package/dist/pages/platform/administration/users/GroupDetailPage.d.ts +2 -1
  777. package/dist/pages/platform/administration/users/GroupDetailPage.d.ts.map +1 -1
  778. package/dist/pages/platform/administration/users/ReferencesManagementPage.d.ts +2 -1
  779. package/dist/pages/platform/administration/users/ReferencesManagementPage.d.ts.map +1 -1
  780. package/dist/pages/platform/administration/users/ReferencesPage.d.ts +2 -1
  781. package/dist/pages/platform/administration/users/ReferencesPage.d.ts.map +1 -1
  782. package/dist/pages/platform/administration/users/UserDetailPage.d.ts +2 -1
  783. package/dist/pages/platform/administration/users/UserDetailPage.d.ts.map +1 -1
  784. package/dist/pages/platform/administration/users/UsersGroupsPage.d.ts +2 -1
  785. package/dist/pages/platform/administration/users/UsersGroupsPage.d.ts.map +1 -1
  786. package/dist/pages/platform/administration/users/UsersPage.d.ts +2 -1
  787. package/dist/pages/platform/administration/users/UsersPage.d.ts.map +1 -1
  788. package/dist/pages/platform/administration/workflows/EmailTemplateCreatePage.d.ts +2 -1
  789. package/dist/pages/platform/administration/workflows/EmailTemplateCreatePage.d.ts.map +1 -1
  790. package/dist/pages/platform/administration/workflows/EmailTemplateDetailPage.d.ts +2 -1
  791. package/dist/pages/platform/administration/workflows/EmailTemplateDetailPage.d.ts.map +1 -1
  792. package/dist/pages/platform/administration/workflows/EmailTemplateEditPage.d.ts +2 -1
  793. package/dist/pages/platform/administration/workflows/EmailTemplateEditPage.d.ts.map +1 -1
  794. package/dist/pages/platform/administration/workflows/EmailTemplatesListPage.d.ts +2 -1
  795. package/dist/pages/platform/administration/workflows/EmailTemplatesListPage.d.ts.map +1 -1
  796. package/dist/pages/platform/administration/workflows/SmsTemplatesListPage.d.ts +2 -1
  797. package/dist/pages/platform/administration/workflows/SmsTemplatesListPage.d.ts.map +1 -1
  798. package/dist/pages/platform/administration/workflows/WorkflowCreatePage.d.ts +2 -1
  799. package/dist/pages/platform/administration/workflows/WorkflowCreatePage.d.ts.map +1 -1
  800. package/dist/pages/platform/administration/workflows/WorkflowDetailPage.d.ts +2 -1
  801. package/dist/pages/platform/administration/workflows/WorkflowDetailPage.d.ts.map +1 -1
  802. package/dist/pages/platform/administration/workflows/WorkflowEditPage.d.ts +2 -1
  803. package/dist/pages/platform/administration/workflows/WorkflowEditPage.d.ts.map +1 -1
  804. package/dist/pages/platform/administration/workflows/WorkflowHistoryPage.d.ts +2 -1
  805. package/dist/pages/platform/administration/workflows/WorkflowHistoryPage.d.ts.map +1 -1
  806. package/dist/pages/platform/administration/workflows/WorkflowsListPage.d.ts +2 -1
  807. package/dist/pages/platform/administration/workflows/WorkflowsListPage.d.ts.map +1 -1
  808. package/dist/pages/platform/administration/workflows/WorkflowsTriggersPage.d.ts +2 -1
  809. package/dist/pages/platform/administration/workflows/WorkflowsTriggersPage.d.ts.map +1 -1
  810. package/dist/pages/platform/api/apis/ApiCatalogDetailPage.d.ts +2 -1
  811. package/dist/pages/platform/api/apis/ApiCatalogDetailPage.d.ts.map +1 -1
  812. package/dist/pages/platform/api/apis/ApiCatalogPage.d.ts +2 -1
  813. package/dist/pages/platform/api/apis/ApiCatalogPage.d.ts.map +1 -1
  814. package/dist/pages/platform/api/external-apps/ExternalAppDetailPage.d.ts +2 -1
  815. package/dist/pages/platform/api/external-apps/ExternalAppDetailPage.d.ts.map +1 -1
  816. package/dist/pages/platform/api/external-apps/ExternalAppsListPage.d.ts.map +1 -1
  817. package/dist/pages/platform/support/AgentSkillsPage.d.ts +2 -1
  818. package/dist/pages/platform/support/AgentSkillsPage.d.ts.map +1 -1
  819. package/dist/pages/platform/support/AgentWorkloadPage.d.ts +2 -1
  820. package/dist/pages/platform/support/AgentWorkloadPage.d.ts.map +1 -1
  821. package/dist/pages/platform/support/AssignmentRulesPage.d.ts +2 -1
  822. package/dist/pages/platform/support/AssignmentRulesPage.d.ts.map +1 -1
  823. package/dist/pages/platform/support/CreateSupportTicketPage.d.ts +2 -1
  824. package/dist/pages/platform/support/CreateSupportTicketPage.d.ts.map +1 -1
  825. package/dist/pages/platform/support/DashboardPage.d.ts +2 -1
  826. package/dist/pages/platform/support/DashboardPage.d.ts.map +1 -1
  827. package/dist/pages/platform/support/EscalationConfigPage.d.ts +2 -1
  828. package/dist/pages/platform/support/EscalationConfigPage.d.ts.map +1 -1
  829. package/dist/pages/platform/support/MyAgentTicketsPage.d.ts +2 -1
  830. package/dist/pages/platform/support/MyAgentTicketsPage.d.ts.map +1 -1
  831. package/dist/pages/platform/support/MyTicketsPage.d.ts +2 -1
  832. package/dist/pages/platform/support/MyTicketsPage.d.ts.map +1 -1
  833. package/dist/pages/platform/support/SlaConfigPage.d.ts +2 -1
  834. package/dist/pages/platform/support/SlaConfigPage.d.ts.map +1 -1
  835. package/dist/pages/platform/support/SupportPermissionsPage.d.ts +2 -1
  836. package/dist/pages/platform/support/SupportPermissionsPage.d.ts.map +1 -1
  837. package/dist/pages/platform/support/TemplatesPage.d.ts +2 -1
  838. package/dist/pages/platform/support/TemplatesPage.d.ts.map +1 -1
  839. package/dist/pages/platform/support/TestBugPage.d.ts +2 -1
  840. package/dist/pages/platform/support/TestBugPage.d.ts.map +1 -1
  841. package/dist/pages/platform/support/TicketDetailPage.d.ts +2 -1
  842. package/dist/pages/platform/support/TicketDetailPage.d.ts.map +1 -1
  843. package/dist/pages/platform/support/TicketsPage.d.ts +2 -1
  844. package/dist/pages/platform/support/TicketsPage.d.ts.map +1 -1
  845. package/dist/pages/platform/support/UserCreateTicketPage.d.ts +2 -1
  846. package/dist/pages/platform/support/UserCreateTicketPage.d.ts.map +1 -1
  847. package/dist/pages/platform/support/UserTicketDetailPage.d.ts +2 -1
  848. package/dist/pages/platform/support/UserTicketDetailPage.d.ts.map +1 -1
  849. package/dist/pages/system/docs/DocsIndexPage.d.ts +2 -1
  850. package/dist/pages/system/docs/DocsIndexPage.d.ts.map +1 -1
  851. package/dist/pages/system/docs/SmartStackPresentationPage.d.ts +2 -1
  852. package/dist/pages/system/docs/SmartStackPresentationPage.d.ts.map +1 -1
  853. package/dist/pages/system/docs/ba/BaIndexPage.d.ts +2 -1
  854. package/dist/pages/system/docs/ba/BaIndexPage.d.ts.map +1 -1
  855. package/dist/pages/system/docs/ba/BaViewerPage.d.ts +2 -1
  856. package/dist/pages/system/docs/ba/BaViewerPage.d.ts.map +1 -1
  857. package/dist/pages/system/docs/ba/components/CadrageTab.d.ts +3 -2
  858. package/dist/pages/system/docs/ba/components/CadrageTab.d.ts.map +1 -1
  859. package/dist/pages/system/docs/ba/components/SpecificationTab.d.ts +4 -3
  860. package/dist/pages/system/docs/ba/components/SpecificationTab.d.ts.map +1 -1
  861. package/dist/pages/system/docs/ba/components/SyntheseTab.d.ts +3 -2
  862. package/dist/pages/system/docs/ba/components/SyntheseTab.d.ts.map +1 -1
  863. package/dist/pages/system/docs/developer/CrossSchemaFkPage.d.ts +2 -1
  864. package/dist/pages/system/docs/developer/CrossSchemaFkPage.d.ts.map +1 -1
  865. package/dist/pages/system/docs/developer/DatabasePage.d.ts +2 -1
  866. package/dist/pages/system/docs/developer/DatabasePage.d.ts.map +1 -1
  867. package/dist/pages/system/docs/developer/DeveloperIndexPage.d.ts +2 -1
  868. package/dist/pages/system/docs/developer/DeveloperIndexPage.d.ts.map +1 -1
  869. package/dist/pages/system/docs/developer/DualDbContextPage.d.ts +2 -1
  870. package/dist/pages/system/docs/developer/DualDbContextPage.d.ts.map +1 -1
  871. package/dist/pages/system/docs/developer/InfrastructurePage.d.ts +2 -1
  872. package/dist/pages/system/docs/developer/InfrastructurePage.d.ts.map +1 -1
  873. package/dist/pages/system/docs/developer/InstallationPage.d.ts +2 -1
  874. package/dist/pages/system/docs/developer/InstallationPage.d.ts.map +1 -1
  875. package/dist/pages/system/docs/developer/TeamsIntegrationPage.d.ts +2 -1
  876. package/dist/pages/system/docs/developer/TeamsIntegrationPage.d.ts.map +1 -1
  877. package/dist/pages/system/docs/developer/tenants/MultiTenantModePage.d.ts +2 -1
  878. package/dist/pages/system/docs/developer/tenants/MultiTenantModePage.d.ts.map +1 -1
  879. package/dist/pages/system/docs/developer/tenants/TenantB2CPage.d.ts +2 -1
  880. package/dist/pages/system/docs/developer/tenants/TenantB2CPage.d.ts.map +1 -1
  881. package/dist/pages/system/docs/developer/tenants/TenantIndexPage.d.ts +2 -1
  882. package/dist/pages/system/docs/developer/tenants/TenantIndexPage.d.ts.map +1 -1
  883. package/dist/pages/system/docs/developer/testing/SecurityTestingPage.d.ts +2 -1
  884. package/dist/pages/system/docs/developer/testing/SecurityTestingPage.d.ts.map +1 -1
  885. package/dist/pages/system/docs/user/AiDocPage.d.ts +2 -1
  886. package/dist/pages/system/docs/user/AiDocPage.d.ts.map +1 -1
  887. package/dist/pages/system/docs/user/ArchitecturePage.d.ts +2 -1
  888. package/dist/pages/system/docs/user/ArchitecturePage.d.ts.map +1 -1
  889. package/dist/pages/system/docs/user/ModulesPage.d.ts +2 -1
  890. package/dist/pages/system/docs/user/ModulesPage.d.ts.map +1 -1
  891. package/dist/pages/system/docs/user/SettingsDocPage.d.ts +2 -1
  892. package/dist/pages/system/docs/user/SettingsDocPage.d.ts.map +1 -1
  893. package/dist/pages/system/docs/user/SlaDocPage.d.ts +2 -1
  894. package/dist/pages/system/docs/user/SlaDocPage.d.ts.map +1 -1
  895. package/dist/pages/system/docs/user/SupportDashboardDocPage.d.ts +2 -1
  896. package/dist/pages/system/docs/user/SupportDashboardDocPage.d.ts.map +1 -1
  897. package/dist/pages/system/docs/user/SupportEscalationDocPage.d.ts +2 -1
  898. package/dist/pages/system/docs/user/SupportEscalationDocPage.d.ts.map +1 -1
  899. package/dist/pages/system/docs/user/SupportIndexPage.d.ts +2 -1
  900. package/dist/pages/system/docs/user/SupportIndexPage.d.ts.map +1 -1
  901. package/dist/pages/system/docs/user/SupportMyTicketsDocPage.d.ts +2 -1
  902. package/dist/pages/system/docs/user/SupportMyTicketsDocPage.d.ts.map +1 -1
  903. package/dist/pages/system/docs/user/SupportTemplatesDocPage.d.ts +2 -1
  904. package/dist/pages/system/docs/user/SupportTemplatesDocPage.d.ts.map +1 -1
  905. package/dist/pages/system/docs/user/SupportTicketsDocPage.d.ts +2 -1
  906. package/dist/pages/system/docs/user/SupportTicketsDocPage.d.ts.map +1 -1
  907. package/dist/pages/system/docs/user/ThemeDocPage.d.ts +2 -1
  908. package/dist/pages/system/docs/user/ThemeDocPage.d.ts.map +1 -1
  909. package/dist/pages/system/docs/user/UserIndexPage.d.ts +2 -1
  910. package/dist/pages/system/docs/user/UserIndexPage.d.ts.map +1 -1
  911. package/dist/provider/SmartStackProvider.d.ts +4 -3
  912. package/dist/provider/SmartStackProvider.d.ts.map +1 -1
  913. package/dist/services/api/adminApi/applications.d.ts +4 -1
  914. package/dist/services/api/adminApi/applications.d.ts.map +1 -1
  915. package/dist/services/api/adminApi/dashboard.d.ts +4 -1
  916. package/dist/services/api/adminApi/dashboard.d.ts.map +1 -1
  917. package/dist/services/api/adminApi/externalApps.d.ts +7 -2
  918. package/dist/services/api/adminApi/externalApps.d.ts.map +1 -1
  919. package/dist/services/api/adminApi/index.d.ts.map +1 -1
  920. package/dist/services/api/adminApi/roles.d.ts +7 -2
  921. package/dist/services/api/adminApi/roles.d.ts.map +1 -1
  922. package/dist/services/api/adminApi/settings.d.ts +7 -2
  923. package/dist/services/api/adminApi/settings.d.ts.map +1 -1
  924. package/dist/services/api/adminApi/tenants.d.ts +13 -4
  925. package/dist/services/api/adminApi/tenants.d.ts.map +1 -1
  926. package/dist/services/api/adminApi/users.d.ts +3 -1
  927. package/dist/services/api/adminApi/users.d.ts.map +1 -1
  928. package/dist/services/api/groupsApi.d.ts +4 -1
  929. package/dist/services/api/groupsApi.d.ts.map +1 -1
  930. package/dist/services/api/referencesApi.d.ts +4 -1
  931. package/dist/services/api/referencesApi.d.ts.map +1 -1
  932. package/dist/services/logging/logService.d.ts.map +1 -1
  933. package/dist/smartstack.cjs +1 -1
  934. package/dist/smartstack.js +1 -1
  935. package/dist/styles.css +1 -1
  936. package/dist/utils/deviceDetection.d.ts.map +1 -1
  937. package/dist/utils/renderLucideIcon.d.ts +2 -1
  938. package/dist/utils/renderLucideIcon.d.ts.map +1 -1
  939. package/dist/utils/tenantUrl.d.ts.map +1 -1
  940. package/package.json +1 -1
  941. package/dist/AuthCallbackPage-Bv2Cyn80.cjs.map +0 -1
  942. package/dist/AuthCallbackPage-Cu74zAX1.js.map +0 -1
  943. package/dist/BaIndexPage-BhdOX87v.cjs +0 -2
  944. package/dist/BaIndexPage-BhdOX87v.cjs.map +0 -1
  945. package/dist/BaIndexPage-Dkp_Eixx.js.map +0 -1
  946. package/dist/BaViewerPage-DxD0eZm-.js.map +0 -1
  947. package/dist/BaViewerPage-SYgjCF7x.cjs +0 -2
  948. package/dist/BaViewerPage-SYgjCF7x.cjs.map +0 -1
  949. package/dist/ConfirmEmailPage-BTp8J0pw.js.map +0 -1
  950. package/dist/ConfirmEmailPage-su3Fvl0e.cjs.map +0 -1
  951. package/dist/DatabasePage-CRq_-Yo2.cjs +0 -2
  952. package/dist/DatabasePage-CRq_-Yo2.cjs.map +0 -1
  953. package/dist/DatabasePage-DFIK8cSM.js.map +0 -1
  954. package/dist/DocRenderer-B-1NdDfC.cjs +0 -2
  955. package/dist/DocRenderer-B-1NdDfC.cjs.map +0 -1
  956. package/dist/DocRenderer-CcEn1iaa.js.map +0 -1
  957. package/dist/DualDbContextPage--Qk-qEgD.cjs.map +0 -1
  958. package/dist/DualDbContextPage-BujD_coN.js.map +0 -1
  959. package/dist/ForceChangePasswordPage-ClENqzCH.js.map +0 -1
  960. package/dist/ForceChangePasswordPage-kEFsb5Aq.cjs.map +0 -1
  961. package/dist/ForgotPasswordPage--Wl0Vxbv.cjs.map +0 -1
  962. package/dist/ForgotPasswordPage-BEgvV5f-.js.map +0 -1
  963. package/dist/OnboardingWizardPage-Bx1UlTbr.js.map +0 -1
  964. package/dist/OnboardingWizardPage-C7vendrq.cjs.map +0 -1
  965. package/dist/RegisterPage-BzV0sCTe.js.map +0 -1
  966. package/dist/RegisterPage-DKr8quRk.cjs.map +0 -1
  967. package/dist/ResetPasswordPage-DphmJrcJ.js.map +0 -1
  968. package/dist/ResetPasswordPage-x4do1o-j.cjs.map +0 -1
  969. package/dist/SupportDashboardDocPage-CLotzEwA.js.map +0 -1
  970. package/dist/SupportDashboardDocPage-DpgGq5Mm.cjs.map +0 -1
  971. package/dist/SupportEscalationDocPage-B-_ChfdN.js.map +0 -1
  972. package/dist/SupportEscalationDocPage-WXkAQr8k.cjs.map +0 -1
  973. package/dist/SupportMyTicketsDocPage-DeRUdAIi.js.map +0 -1
  974. package/dist/SupportMyTicketsDocPage-jE1UMaIY.cjs.map +0 -1
  975. package/dist/SupportTemplatesDocPage-C8ZLzFJc.js.map +0 -1
  976. package/dist/SupportTemplatesDocPage-ajO-cHmK.cjs.map +0 -1
  977. package/dist/SupportTicketsDocPage-C_ybDTjC.cjs.map +0 -1
  978. package/dist/SupportTicketsDocPage-DQhHfa6J.js.map +0 -1
  979. package/dist/index-0Jhdcj59.js.map +0 -1
  980. package/dist/index-ASxPhrgZ.cjs.map +0 -1
  981. package/dist/index-B2rKKVDN.js.map +0 -1
  982. package/dist/index-BP5i2CQo.cjs +0 -2
  983. package/dist/index-BP5i2CQo.cjs.map +0 -1
  984. package/dist/index-BYhFG50Z.cjs.map +0 -1
  985. package/dist/index-BcO3pBlL.js.map +0 -1
  986. package/dist/index-BlHDI4zj.js.map +0 -1
  987. package/dist/index-Blfc9wKG.js.map +0 -1
  988. package/dist/index-BnWMDCRU.cjs.map +0 -1
  989. package/dist/index-By0u9UFY.js.map +0 -1
  990. package/dist/index-C40Dlolq.js.map +0 -1
  991. package/dist/index-C54HbULX.cjs.map +0 -1
  992. package/dist/index-C6C5XmVj.cjs +0 -48
  993. package/dist/index-C6C5XmVj.cjs.map +0 -1
  994. package/dist/index-C9BaizLE.cjs +0 -2
  995. package/dist/index-C9BaizLE.cjs.map +0 -1
  996. package/dist/index-CBOLnJkG.cjs.map +0 -1
  997. package/dist/index-CI1DJrFE.js.map +0 -1
  998. package/dist/index-CU66n-zU.js.map +0 -1
  999. package/dist/index-CUISVUMx.js.map +0 -1
  1000. package/dist/index-CnmIX2MY.js.map +0 -1
  1001. package/dist/index-CtcdHE_9.cjs +0 -2
  1002. package/dist/index-CtcdHE_9.cjs.map +0 -1
  1003. package/dist/index-Cv7iWoG8.js.map +0 -1
  1004. package/dist/index-D4u23zHI.js.map +0 -1
  1005. package/dist/index-D8xuGyjU.js.map +0 -1
  1006. package/dist/index-DKK07NF1.cjs +0 -2
  1007. package/dist/index-DKK07NF1.cjs.map +0 -1
  1008. package/dist/index-DmuVa7Ye.cjs.map +0 -1
  1009. package/dist/index-Du4fQfix.cjs.map +0 -1
  1010. package/dist/index-DwATtWun.js.map +0 -1
  1011. package/dist/index-Dxau-XnQ.cjs.map +0 -1
  1012. package/dist/index-Txfokhn3.cjs.map +0 -1
  1013. package/dist/index-ZVUUUZmv.cjs +0 -2
  1014. package/dist/index-ZVUUUZmv.cjs.map +0 -1
  1015. package/dist/index-eAHjmtzn.cjs.map +0 -1
  1016. package/dist/index-jpSTOjXU.js.map +0 -1
@@ -1,48 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),n=require("react"),ns=require("axios"),ne=require("react-i18next"),jt=require("i18next"),Da=require("i18next-browser-languagedetector"),N=require("react-router-dom"),Ma=require("@microsoft/signalr"),l=require("lucide-react"),nr=require("react-error-boundary"),$t=require("react-dom"),js=require("modern-screenshot"),gt=require("react-resizable-panels"),Fa=require("dompurify");function or(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const ie=or(Ma),xt=or(l),Je={none:"0px",small:"4px",medium:"8px",large:"12px",xlarge:"16px",xxlarge:"24px"},Oa={none:"Carré",small:"Léger",medium:"Moyen",large:"Arrondi",xlarge:"Très arrondi",xxlarge:"Pill"},Ue={slate:{name:"Ardoise",shades:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"}},gray:{name:"Gris",shades:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"}},zinc:{name:"Zinc",shades:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"}},stone:{name:"Pierre",shades:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"}},indigo:{name:"Indigo",shades:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"}},violet:{name:"Violet",shades:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"}},blue:{name:"Bleu",shades:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"}},cyan:{name:"Cyan",shades:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"}},teal:{name:"Teal",shades:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"}},emerald:{name:"Émeraude",shades:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"}},amber:{name:"Ambre",shades:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"}},orange:{name:"Orange",shades:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"}},rose:{name:"Rose",shades:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},pink:{name:"Pink",shades:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"}}},Ua={card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},dt={neutral:{name:"Neutre",icon:"⚪",colors:{light:{light:"#ffffff",medium:"#f4f4f5",dark:"#e4e4e7",border:"#d4d4d8"},dark:{light:"#1c1c1f",medium:"#27272a",dark:"#3f3f46",border:"#52525b"}}},ocean:{name:"Océan",icon:"🌊",colors:{light:{light:"#e0f2fe",medium:"#bae6fd",dark:"#7dd3fc",border:"#93c5fd"},dark:{light:"#141c24",medium:"#1a2836",dark:"#2a4a5e",border:"#3a5a70"}}},forest:{name:"Forêt",icon:"🌲",colors:{light:{light:"#d1fae5",medium:"#a7f3d0",dark:"#6ee7b7",border:"#86efac"},dark:{light:"#121d18",medium:"#182a22",dark:"#2a4a3a",border:"#3a5a4a"}}},sunset:{name:"Coucher de soleil",icon:"🌅",colors:{light:{light:"#fef3c7",medium:"#fde68a",dark:"#fbbf24",border:"#fcd34d"},dark:{light:"#1c1810",medium:"#2a2418",dark:"#4a3a24",border:"#5a4a34"}}},lavender:{name:"Lavande",icon:"💜",colors:{light:{light:"#ede9fe",medium:"#ddd6fe",dark:"#c4b5fd",border:"#c4b5fd"},dark:{light:"#1a1820",medium:"#24222e",dark:"#3a3650",border:"#4a4660"}}},rose:{name:"Rose",icon:"🌸",colors:{light:{light:"#fce7f3",medium:"#fbcfe8",dark:"#f9a8d4",border:"#f9a8d4"},dark:{light:"#1c1418",medium:"#2a1e24",dark:"#4a3040",border:"#5a4050"}}}},os="neutral",ut=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Clair",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#fafafa",primary:"#ffffff",secondary:"#f4f4f5",tertiary:"#e4e4e7",card:"#ffffff",hover:"#f4f4f5",active:"#e4e4e7"},text:{primary:"#18181b",secondary:"#52525b",tertiary:"#71717a",muted:"#a1a1aa",inverse:"#fafafa"},border:{default:"#e4e4e7",subtle:"#f4f4f5",strong:"#d4d4d8"},status:{success:{bg:"#f0fdfa",text:"#0f766e",border:"#99f6e4",dot:"#14b8a6"},warning:{bg:"#fffbeb",text:"#b45309",border:"#fde68a",dot:"#f59e0b"},error:{bg:"#fff1f2",text:"#be123c",border:"#fecdd3",dot:"#f43f5e"},info:{bg:"#f0f9ff",text:"#0369a1",border:"#bae6fd",dot:"#0ea5e9"}},accentTransparent:{bg:`${s[50]}`,text:s[700],border:s[200]}}},mt=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Sombre",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#161618",primary:"#1c1c1f",secondary:"#232326",tertiary:"#2a2a2e",card:"#1c1c1f",hover:"#27272a",active:"#3f3f46"},text:{primary:"#fafafa",secondary:"#d4d4d8",tertiary:"#a1a1aa",muted:"#71717a",inverse:"#18181b"},border:{default:"#3f3f46",subtle:"#27272a",strong:"#52525b"},status:{success:{bg:"rgba(20, 184, 166, 0.15)",text:"#5eead4",border:"rgba(20, 184, 166, 0.3)",dot:"#14b8a6"},warning:{bg:"rgba(245, 158, 11, 0.15)",text:"#fbbf24",border:"rgba(245, 158, 11, 0.3)",dot:"#f59e0b"},error:{bg:"rgba(244, 63, 94, 0.15)",text:"#fb7185",border:"rgba(244, 63, 94, 0.3)",dot:"#f43f5e"},info:{bg:"rgba(14, 165, 233, 0.15)",text:"#7dd3fc",border:"rgba(14, 165, 233, 0.3)",dot:"#0ea5e9"}},accentTransparent:{bg:`rgba(${ws(s[500])}, 0.15)`,text:s[300],border:`rgba(${ws(s[500])}, 0.3)`}}};function ws(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?`${parseInt(s[1],16)}, ${parseInt(s[2],16)}, ${parseInt(s[3],16)}`:"99, 102, 241"}const yt={mode:"dark",borderRadius:Ua,colors:{light:ut("indigo"),dark:mt("indigo")},accentColorKey:"indigo",itemPaletteKey:os},Ba=[{id:"default",name:"Par défaut",description:"Style SmartStack classique avec coins arrondis",icon:"✨",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"indigo",itemPaletteKey:"neutral"}},{id:"minimal",name:"Minimal",description:"Style épuré et professionnel",icon:"⚪",config:{borderRadius:{card:"medium",button:"small",badge:"small",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"slate",itemPaletteKey:"neutral"}},{id:"corporate",name:"Corporate",description:"Style sobre pour environnement professionnel",icon:"🏢",config:{borderRadius:{card:"small",button:"small",badge:"medium",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"gray",itemPaletteKey:"neutral"}},{id:"ocean",name:"Océan",description:"Teintes bleues apaisantes",icon:"🌊",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"cyan",itemPaletteKey:"ocean"}},{id:"forest",name:"Forêt",description:"Tons verts naturels",icon:"🌲",config:{borderRadius:{card:"medium",button:"medium",badge:"medium",input:"medium",modal:"large",menuItem:"medium"},accentColorKey:"emerald",itemPaletteKey:"forest"}},{id:"sunset",name:"Coucher de soleil",description:"Couleurs chaudes et accueillantes",icon:"🌅",config:{borderRadius:{card:"large",button:"large",badge:"xxlarge",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"orange",itemPaletteKey:"sunset"}},{id:"lavender",name:"Lavande",description:"Tons violets élégants",icon:"💜",config:{borderRadius:{card:"xlarge",button:"large",badge:"xlarge",input:"large",modal:"xlarge",menuItem:"large"},accentColorKey:"violet",itemPaletteKey:"lavender"}},{id:"rose",name:"Rose",description:"Teintes roses douces",icon:"🌸",config:{borderRadius:{card:"xxlarge",button:"xlarge",badge:"xxlarge",input:"large",modal:"xxlarge",menuItem:"large"},accentColorKey:"pink",itemPaletteKey:"rose"}}],ir="smartstack-theme-config";class kt extends Error{statusCode;details;constructor(s,r,a){super(s),this.name="AppError",this.statusCode=r,this.details=a}}class is extends Error{constructor(s="Network error occurred"){super(s),this.name="NetworkError"}}class lr extends Error{code;constructor(s="Authentication required",r){super(s),this.name="AuthenticationError",this.code=r}}class _a extends Error{constructor(s="Access denied"){super(s),this.name="ForbiddenError"}}const qa=10;class za{queue=[];recentErrors=[];isProcessing=!1;batchSize=10;batchDelay=2e3;async logError(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const d=String(a.url),u=a.status?` [${a.status}]`:"";c=`${o}${u} - ${d}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Error",metadata:a};this.storeRecentError(i),this.queue.push({type:"error",data:i}),this.processQueue()}async logCritical(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const u=String(a.url),x=a.status?` [${a.status}]`:"";c=`${o}${x} - ${u}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Critical",metadata:a};return this.storeRecentError(i),await this.sendErrorWithResponse(i)}getRecentErrors(){return[...this.recentErrors]}clearRecentErrors(){this.recentErrors=[]}storeRecentError(s){this.recentErrors.unshift({...s,timestamp:new Date}),this.recentErrors.length>qa&&this.recentErrors.pop()}async logEvent(s,r,a){const o={event:s,category:r,data:a};this.queue.push({type:"event",data:o}),this.processQueue()}async processQueue(){if(this.isProcessing||this.queue.length===0)return;this.isProcessing=!0,await new Promise(r=>setTimeout(r,this.batchDelay));const s=this.queue.splice(0,this.batchSize);for(const r of s)try{r.type==="error"?await this.sendError(r.data):await this.sendEvent(r.data)}catch{}this.isProcessing=!1,this.queue.length>0&&this.processQueue()}async sendError(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}async sendErrorWithResponse(s){const r=localStorage.getItem("token");try{const a=await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)});return a.ok&&a.status===200&&(await a.json()).ticketNumber||null}catch{return null}}async sendEvent(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-event",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}}const Pe=new za;window.onerror=(t,s,r,a,o)=>{Pe.logError(o||String(t),"window.onerror",{source:s,lineno:r,colno:a})};window.onunhandledrejection=t=>{Pe.logError(t.reason instanceof Error?t.reason:String(t.reason),"unhandledrejection")};const Ie=ns.create({timeout:3e4,headers:{"Content-Type":"application/json"}});Ie.interceptors.request.use(t=>{const s=localStorage.getItem("token");s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`);const r=crypto.randomUUID();t.headers&&(t.headers["X-Correlation-ID"]=r);const a=localStorage.getItem("i18nextLng")||navigator.language||"fr";t.headers&&(t.headers["Accept-Language"]=a);const o=localStorage.getItem("currentTenantSlug");return o&&t.headers&&!t.headers["X-Tenant-Slug"]&&(t.headers["X-Tenant-Slug"]=o),t},t=>(Pe.logError(t,"apiClient.request"),Promise.reject(t)));Ie.interceptors.response.use(t=>t,async t=>{const s=t.config?.headers?.["X-Correlation-ID"];if(ns.isCancel(t)||t.code==="ERR_CANCELED")return Promise.reject(t);if(!t.response){const i=new is("Impossible de se connecter au serveur. Vérifiez votre connexion internet.");return Pe.logError(i,"apiClient.response",{correlationId:s}),Promise.reject(i)}const{status:r,data:a}=t.response,o=a?.message||a?.detail||a?.title||t.message,c=a?.code;switch(r){case 401:{const i=new lr(o,c);Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,code:c});const d=t.config?.url||"",x=["/api/user/preferences","/api/auth/session-info","/api/auth/refresh","/api/navigation/menu","/api/navigation/favorites","/api/navigation/contexts","/api/onboarding/status","/api/administration/tenants/tenant-analytics/track/"].some(m=>d.startsWith(m));if(!window.location.pathname.includes("/login")&&!x){localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user");const f=c==="SESSION_EXPIRED"?"/login?reason=session_expired":"/login";window.location.href=f}return Promise.reject(i)}case 403:{const i=new _a(o),d=["/api/administration/tenants/tenant-analytics/track/","/api/support/notifications"],u=t.config?.url||"";return d.some(m=>u.startsWith(m))||Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,method:t.config?.method}),Promise.reject(i)}case 404:return Promise.reject(new kt(o||"Resource not found",r));case 400:return Promise.reject(new kt(o||"Invalid request",r,a?.details||a?.errors));case 500:case 502:case 503:case 504:{const i=new kt(o||"Server error",r);return Pe.logCritical(i,"apiClient.response",{correlationId:s,url:t.config?.url,status:r}),Promise.reject(i)}default:{const i=new kt(o,r,a?.details);return Pe.logError(i,"apiClient.response",{correlationId:s,status:r}),Promise.reject(i)}}});const D={get:(t,s)=>Ie.get(t,s).then(r=>r.data),post:(t,s,r)=>Ie.post(t,s,r).then(a=>a.data),put:(t,s,r)=>Ie.put(t,s,r).then(a=>a.data),patch:(t,s,r)=>Ie.patch(t,s,r).then(a=>a.data),delete:(t,s)=>Ie.delete(t,s).then(r=>r.data)},It={preferences:{get:()=>D.get("/api/user/preferences"),updateTheme:t=>D.put("/api/user/preferences/theme",t),updateLanguage:t=>D.put("/api/user/preferences/language",t),updateNotifications:t=>D.put("/api/user/preferences/notifications",t)},dashboard:{getAll:(t=30,s=10)=>D.get(`/api/user/dashboard/all?period=${t}&errorLimit=${s}`),getSessionAnalytics:(t=30)=>D.get(`/api/user/dashboard/session-analytics?period=${t}`),getLoginErrors:(t=10)=>D.get(`/api/user/dashboard/login-errors?limit=${t}`),getCurrentSession:()=>D.get("/api/user/dashboard/current-session"),getDeviceStats:()=>D.get("/api/user/dashboard/device-stats"),getWeeklyStats:(t=30)=>D.get(`/api/user/dashboard/weekly-stats?period=${t}`),getHourlyStats:(t=30)=>D.get(`/api/user/dashboard/hourly-stats?period=${t}`),getApplicationUsage:(t=30)=>D.get(`/api/user/dashboard/application-usage?period=${t}`)}},Ga=t=>({getAll:s=>t.get("/api/administration/users",{params:s}),getById:s=>t.get(`/api/administration/users/${s}`),create:s=>t.post("/api/administration/users",s),update:(s,r)=>t.put(`/api/administration/users/${s}`,r),sendPasswordResetLink:s=>t.post(`/api/administration/users/${s}/send-password-reset`),resetPasswordDirect:(s,r)=>t.post(`/api/administration/users/${s}/reset-password-direct`,r?{temporaryPassword:r}:{}),activate:s=>t.patch(`/api/administration/users/${s}/activate`),deactivate:s=>t.patch(`/api/administration/users/${s}/deactivate`),unlock:(s,r)=>t.post(`/api/administration/users/${s}/unlock`,r),clearFailedAttempts:s=>t.post(`/api/administration/users/${s}/clear-failed-attempts`),delete:s=>t.delete(`/api/administration/users/${s}`),getSessions:s=>t.get(`/api/administration/users/${s}/sessions`),endAllSessions:s=>t.post(`/api/administration/users/${s}/sessions/end-all`),endSession:(s,r)=>t.delete(`/api/administration/users/${s}/sessions/${r}`),getActivity:s=>t.get(`/api/administration/users/${s}/activity`),getCustomRole:s=>t.get(`/api/administration/users/${s}/custom-role`),createCustomRole:s=>t.post(`/api/administration/users/${s}/custom-role`),deleteCustomRole:s=>t.delete(`/api/administration/users/${s}/custom-role`),getHistory:(s,r=50)=>t.get(`/api/administration/users/${s}/history`,{params:{limit:r}}),restoreFromHistory:(s,r)=>t.post(`/api/administration/users/${s}/history/${r}/restore`),getOrganizationReferences:()=>t.get("/api/administration/users/organization-references"),references:{getCompanies:s=>t.get("/api/administration/users/references/companies",{params:s}),getDepartments:s=>t.get("/api/administration/users/references/departments",{params:s}),getJobTitles:s=>t.get("/api/administration/users/references/job-titles",{params:s}),getOffices:s=>t.get("/api/administration/users/references/offices",{params:s}),createCompany:(s,r)=>t.post(`/api/administration/users/references/companies${r?`?tenantId=${r}`:""}`,s),createDepartment:(s,r)=>t.post(`/api/administration/users/references/departments${r?`?tenantId=${r}`:""}`,s),createJobTitle:(s,r)=>t.post(`/api/administration/users/references/job-titles${r?`?tenantId=${r}`:""}`,s),createOffice:(s,r)=>t.post(`/api/administration/users/references/offices${r?`?tenantId=${r}`:""}`,s),updateCompany:(s,r)=>t.put(`/api/administration/users/references/companies/${s}`,r),updateDepartment:(s,r)=>t.put(`/api/administration/users/references/departments/${s}`,r),updateJobTitle:(s,r)=>t.put(`/api/administration/users/references/job-titles/${s}`,r),updateOffice:(s,r)=>t.put(`/api/administration/users/references/offices/${s}`,r),activateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/activate`),activateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/activate`),activateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/activate`),activateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/activate`),deactivateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/deactivate`),deactivateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/deactivate`),deactivateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/deactivate`),deactivateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/deactivate`),deleteCompany:s=>t.delete(`/api/administration/users/references/companies/${s}`),deleteDepartment:s=>t.delete(`/api/administration/users/references/departments/${s}`),deleteJobTitle:s=>t.delete(`/api/administration/users/references/job-titles/${s}`),deleteOffice:s=>t.delete(`/api/administration/users/references/offices/${s}`)},updateProfile:(s,r)=>t.put(`/api/administration/users/${s}/profile`,r),updateOrganization:(s,r)=>t.put(`/api/administration/users/${s}/organization`,r),updateJobInfo:(s,r)=>t.put(`/api/administration/users/${s}/job-info`,r),updatePhones:(s,r)=>t.put(`/api/administration/users/${s}/phones`,r),updateAddress:(s,r)=>t.put(`/api/administration/users/${s}/address`,r),updateContact:(s,r)=>t.put(`/api/administration/users/${s}/contact`,r),getTenants:s=>t.get(`/api/administration/users/${s}/tenants`),getGroups:s=>t.get(`/api/administration/users/${s}/groups`),getConsolidatedRoles:(s,r)=>{const a=r?`/api/administration/users/${s}/consolidated-roles?tenantId=${r}`:`/api/administration/users/${s}/consolidated-roles`;return t.get(a)},getApplicationAccess:(s,r)=>{const a=r?`/api/administration/users/${s}/application-access?tenantId=${r}`:`/api/administration/users/${s}/application-access`;return t.get(a)}}),Ka=t=>({getAll:s=>t.get("/api/administration/permissions/roles",{params:s}),getAssignable:()=>t.get("/api/administration/permissions/roles",{params:{excludeCategories:"Custom",minPermissionsCount:1}}),getServiceAssignable:()=>t.get("/api/administration/permissions/roles",{params:{forExternalApps:!0,minPermissionsCount:1}}),getByApplication:s=>t.get("/api/administration/permissions/roles",{params:{applicationId:s,excludeCategories:"Custom",minPermissionsCount:1}}),getById:s=>t.get(`/api/administration/permissions/roles/${s}`),create:s=>t.post("/api/administration/permissions/roles",s),update:(s,r)=>t.put(`/api/administration/permissions/roles/${s}`,r),delete:s=>t.delete(`/api/administration/permissions/roles/${s}`),assignUser:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/users/${r}`),removeUser:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/users/${r}`),getGroups:s=>t.get(`/api/administration/permissions/roles/${s}/groups`),assignGroup:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/groups/${r}`),removeGroup:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/groups/${r}`),getTranslations:s=>t.get(`/api/administration/permissions/roles/${s}/translations`),upsertTranslation:(s,r,a)=>t.put(`/api/administration/permissions/roles/${s}/translations/${r}`,a),deleteTranslation:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/translations/${r}`)}),Ha=t=>({getAll:s=>t.get("/api/administration/permissions",{params:s}),getById:s=>t.get(`/api/administration/permissions/${s}`),getTree:()=>t.get("/api/administration/permissions/tree"),getMatrix:()=>t.get("/api/administration/permissions/matrix"),delete:s=>t.delete(`/api/administration/permissions/${s}`)}),Va=t=>({getAll:s=>t.get("/api/administration/applications",{params:s}),getById:s=>t.get(`/api/administration/applications/${s}`),update:(s,r)=>t.put(`/api/administration/applications/${s}`,r),activate:s=>t.patch(`/api/administration/applications/${s}/activate`),deactivate:s=>t.patch(`/api/administration/applications/${s}/deactivate`),getModules:s=>t.get(`/api/administration/applications/${s}/modules`),updateModule:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}`,a),getModuleSections:(s,r)=>t.get(`/api/administration/applications/${s}/modules/${r}/sections`),reorderModules:(s,r)=>t.put(`/api/administration/applications/${s}/modules/reorder`,{items:r}),reorderSections:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}/sections/reorder`,{items:a}),getTenants:s=>t.get(`/api/administration/applications/${s}/tenants`),getAvailableTenants:s=>t.get(`/api/administration/applications/${s}/tenants/available`),assignToTenant:(s,r,a)=>t.post(`/api/administration/applications/${s}/tenants/${r}`,a?{accessLevel:a}:{}),removeFromTenant:(s,r)=>t.delete(`/api/administration/applications/${s}/tenants/${r}`),updateTenantAccessLevel:(s,r,a)=>t.patch(`/api/administration/applications/${s}/tenants/${r}/access-level`,{accessLevel:a}),bulkAssignTenants:(s,r)=>t.post(`/api/administration/applications/${s}/tenants/bulk`,r)}),Wa=t=>({getOverview:(s=30,r)=>t.get("/api/administration/users/dashboard/overview",{params:{days:s},signal:r?.signal}),getByStatus:s=>t.get("/api/administration/users/dashboard/by-status",{signal:s?.signal}),getByRole:s=>t.get("/api/administration/users/dashboard/by-role",{signal:s?.signal}),getByType:s=>t.get("/api/administration/users/dashboard/by-type",{signal:s?.signal}),getLoginActivity:(s=30,r)=>t.get("/api/administration/users/dashboard/login-activity",{params:{days:s},signal:r?.signal}),getTrends:(s=30,r)=>t.get("/api/administration/users/dashboard/trends",{params:{days:s},signal:r?.signal}),getRecentUsers:(s=10,r)=>t.get("/api/administration/users/dashboard/recent-users",{params:{limit:s},signal:r?.signal}),getSecurityAlerts:(s=3,r=24,a)=>t.get("/api/administration/users/dashboard/security-alerts",{params:{threshold:s,hours:r},signal:a?.signal}),getActiveSessions:s=>t.get("/api/administration/users/dashboard/active-sessions",{signal:s?.signal}),getLatestActiveSessions:(s=5,r)=>t.get("/api/administration/users/dashboard/latest-active-sessions",{params:{limit:s},signal:r?.signal})}),Xa=t=>({getAll:()=>t.get("/api/administration/configuration/settings"),getByCategory:s=>t.get(`/api/administration/configuration/settings/${s}`),get:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}`),update:(s,r,a)=>t.put(`/api/administration/configuration/settings/${s}/${r}`,{value:a}),reset:(s,r)=>t.post(`/api/administration/configuration/settings/${s}/${r}/reset`),getHistory:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}/history`),getCategories:()=>t.get("/api/administration/configuration/settings/categories")}),Ya=t=>({get:()=>t.get("/api/user/preferences"),getGlobal:()=>t.get("/api/user/preferences/global"),getForTenant:s=>t.get(`/api/user/preferences/for-tenant/${s}`),getThemeOverrides:()=>t.get("/api/user/preferences/theme-overrides"),deleteTenantOverride:()=>t.delete("/api/user/preferences/tenant-override"),applyToTenant:()=>t.post("/api/user/preferences/apply-to-tenant")}),Ja=t=>({getConfig:()=>t.get("/api/administration/tenants/config"),getAll:s=>{const{excludeTypes:r,...a}=s||{},o=new URLSearchParams;a.page&&o.set("page",String(a.page)),a.pageSize&&o.set("pageSize",String(a.pageSize)),a.search&&o.set("search",a.search),a.status&&o.set("status",a.status),a.type&&o.set("type",a.type),a.sortBy&&o.set("sortBy",a.sortBy),a.sortDesc&&o.set("sortDesc","true"),r?.length&&r.forEach(i=>o.append("excludeTypes",i));const c=o.toString();return t.get(`/api/administration/tenants${c?`?${c}`:""}`)},getById:s=>t.get(`/api/administration/tenants/${s}`),createB2C:s=>t.post("/api/administration/tenants/b2c",s),createB2B:s=>t.post("/api/administration/tenants/b2b",s),update:(s,r)=>t.put(`/api/administration/tenants/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/${s}`),activate:s=>t.post(`/api/administration/tenants/${s}/activate`),suspend:s=>t.post(`/api/administration/tenants/${s}/suspend`),archive:s=>t.delete(`/api/administration/tenants/${s}`),checkSlugAvailable:s=>t.get(`/api/administration/tenants/check-slug/${s}`),assignTemplate:(s,r)=>t.post(`/api/administration/tenants/${s}/template`,{templateId:r}),removeTemplate:s=>t.delete(`/api/administration/tenants/${s}/template`),getMembers:s=>t.get(`/api/administration/tenants/${s}/members`),getMember:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}`),addMember:(s,r)=>t.post(`/api/administration/tenants/${s}/members`,r),removeMember:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}`),setMemberDefault:(s,r)=>t.patch(`/api/administration/tenants/${s}/members/${r}/set-default`),transferOwnership:(s,r)=>t.post(`/api/administration/tenants/${s}/members/transfer-ownership`,{toUserId:r}),assignRole:(s,r,a)=>t.post(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),removeRole:(s,r,a)=>t.delete(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),assignMemberRoles:(s,r,a)=>t.put(`/api/administration/tenants/${s}/members/${r}/roles`,{roleIds:a}),getMemberCustomRole:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}/custom-role`),createMemberCustomRole:(s,r)=>t.post(`/api/administration/tenants/${s}/members/${r}/custom-role`),deleteMemberCustomRole:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}/custom-role`),getTenantRoles:s=>t.get(`/api/administration/tenants/${s}/roles`),getGroups:s=>t.get(`/api/administration/tenants/${s}/groups`),getAvailableGroups:s=>t.get(`/api/administration/tenants/${s}/groups/available`),addGroupToTenant:(s,r)=>t.post(`/api/administration/tenants/${s}/groups`,{groupId:r}),removeGroupFromTenant:(s,r)=>t.delete(`/api/administration/tenants/${s}/groups/${r}`),getApplications:s=>t.get(`/api/administration/tenants/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/${s}/applications/available`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/bulk`,r),toggleApplication:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/toggle`,{isActive:a}),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/access-level`,{accessLevel:a}),getEffectiveTree:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/effective-tree`),saveOverrides:(s,r,a)=>t.put(`/api/administration/tenants/${s}/applications/${r}/overrides`,a),getModules:s=>t.get(`/api/administration/tenants/${s}/modules`),getAvailableModules:s=>t.get(`/api/administration/tenants/${s}/modules/available`),assignModule:(s,r)=>t.post(`/api/administration/tenants/${s}/modules/${r}`),removeModule:(s,r)=>t.delete(`/api/administration/tenants/${s}/modules/${r}`),toggleModule:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/modules/${r}/toggle`,{isActive:a}),getSections:s=>t.get(`/api/administration/tenants/${s}/sections`),getAvailableSections:s=>t.get(`/api/administration/tenants/${s}/sections/available`),assignSection:(s,r)=>t.post(`/api/administration/tenants/${s}/sections/${r}`),removeSection:(s,r)=>t.delete(`/api/administration/tenants/${s}/sections/${r}`),toggleSection:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/sections/${r}/toggle`,{isActive:a}),getModulesWithSections:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/modules-tree`),linkOrganisation:(s,r)=>t.post(`/api/administration/tenants/${s}/organisation`,{organisationId:r}),unlinkOrganisation:s=>t.delete(`/api/administration/tenants/${s}/organisation`)}),Qa=t=>({getAll:()=>t.get("/api/administration/tenants/templates"),getById:s=>t.get(`/api/administration/tenants/templates/${s}`),create:s=>t.post("/api/administration/tenants/templates",s),update:(s,r)=>t.put(`/api/administration/tenants/templates/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/templates/${s}`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/bulk`,r),getTenants:s=>t.get(`/api/administration/tenants/templates/${s}/tenants`),getApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications/available`),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/templates/${s}/applications/${r}/access-level`,{accessLevel:a}),getApplicationModules:(s,r)=>t.get(`/api/administration/tenants/templates/${s}/applications/${r}/modules`),updateApplicationModules:(s,r,a)=>t.put(`/api/administration/tenants/templates/${s}/applications/${r}/modules`,a),getAiInstances:s=>t.get(`/api/administration/tenants/templates/${s}/ai-instances`),assignAiInstance:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/ai-instances/${r}`),removeAiInstance:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/ai-instances/${r}`)}),Za=t=>({getAll:s=>t.get("/api/administration/tenants/organisations",{params:s}),getAvailable:s=>t.get("/api/administration/tenants/organisations/available",{params:s?{search:s}:void 0}),getPendingVerification:()=>t.get("/api/administration/tenants/organisations/pending-verification"),getById:s=>t.get(`/api/administration/tenants/organisations/${s}`),findById:async s=>{const r=await Ie.get(`/api/administration/tenants/organisations/${s}`,{validateStatus:a=>a===200||a===404});return r.status===200?r.data:null},create:s=>t.post("/api/administration/tenants/organisations",s),updateContact:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/contact`,r),updateAddress:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/address`,r),verify:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/verify`,{notes:r}),reject:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/reject`,{reason:r}),lookup:(s,r)=>t.get("/api/administration/tenants/organisations/lookup",{params:{countryCode:s,identifier:r}})}),en=t=>({getAll:s=>t.get("/api/administration/tenants/my",{params:s?{search:s}:void 0}),getDefault:()=>t.get("/api/administration/tenants/my/default"),setDefault:s=>t.post(`/api/administration/tenants/${s}/set-default`),clearDefault:()=>t.delete("/api/administration/tenants/clear-default"),getFavorites:()=>t.get("/api/user/preferences/tenant-favorites"),addFavorite:s=>t.post(`/api/user/preferences/tenant-favorites/${s}`),removeFavorite:s=>t.delete(`/api/user/preferences/tenant-favorites/${s}`),recordRecent:s=>t.post(`/api/user/preferences/tenant-recent/${s}`)}),tn=t=>({getAll:s=>t.get("/api/accounts",{params:s}),getById:s=>t.get(`/api/accounts/${s}`),create:s=>t.post("/api/accounts",s),update:(s,r)=>t.put(`/api/accounts/${s}`,r),delete:s=>t.delete(`/api/accounts/${s}`),activate:s=>t.patch(`/api/accounts/${s}/activate`),deactivate:s=>t.patch(`/api/accounts/${s}/deactivate`),rotateSecret:(s,r="Primary")=>t.post(`/api/accounts/${s}/rotate-secret?keySlot=${r}`),revokeSecondarySecret:s=>t.delete(`/api/accounts/${s}/secondary-secret`),assignRole:(s,r)=>t.post(`/api/accounts/${s}/roles`,r),removeRole:(s,r,a)=>t.delete(`/api/accounts/${s}/roles/${r}`,{params:a?{tenantId:a}:void 0}),generateSecret:()=>t.post("/api/accounts/generate-secret"),getAuditLogs:(s,r=1,a=20)=>t.get(`/api/accounts/${s}/audit-logs`,{params:{page:r,pageSize:a}}),getUsageStats:(s,r=30)=>t.get(`/api/accounts/${s}/usage-stats`,{params:{days:r}}),getKeyUsage:s=>t.get(`/api/accounts/${s}/key-usage`),getApiEndpoints:()=>t.get("/api/accounts/api-endpoints"),getAppApiAccess:s=>t.get(`/api/accounts/${s}/api-access`),updateApiAccess:(s,r,a)=>t.put(`/api/accounts/${s}/api-access/${r}`,a),removeApiAccess:(s,r)=>t.delete(`/api/accounts/${s}/api-access/${r}`)}),sn=t=>({getNavigationLookup:()=>t.get("/api/apis/navigation-lookup")}),rn=t=>{const s=D;return{users:Ga(s),roles:Ka(s),permissions:Ha(s),applications:Va(s),dashboard:Wa(s),settings:Xa(s),tenants:Ja(s),templates:Qa(s),organisations:Za(s),myTenants:en(s),preferences:Ya(s),externalApps:tn(s),apiCatalog:sn(s)}},je=rn(),xe=(t,s,r)=>{const a=t[s];return a?typeof a=="function"?a():Promise.resolve(a):new Promise((o,c)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(c.bind(null,new Error("Unknown variable dynamic import: "+s+(s.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},cr=async t=>{if(!t)return null;try{const[s,r,a,o,c,i,d,u,x,m,f,h,v,g,y,p,b,j,S,w,P,$,A,k,R,L,I,C,O,_,E,z,W,G]=await Promise.all([xe(Object.assign({"./locales/de/common.json":()=>Promise.resolve().then(()=>require("./common-BcZGi8mP.cjs")),"./locales/en/common.json":()=>Promise.resolve().then(()=>require("./common-w-cABALd.cjs")),"./locales/fr/common.json":()=>Promise.resolve().then(()=>require("./common-BemjTKsn.cjs")),"./locales/it/common.json":()=>Promise.resolve().then(()=>require("./common-CUprL8ig.cjs"))}),`./locales/${t}/common.json`,4),xe(Object.assign({"./locales/de/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-D8yOGHza.cjs")),"./locales/en/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-rEtU7BPw.cjs")),"./locales/fr/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BI8iMTJl.cjs")),"./locales/it/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BTkWh95c.cjs"))}),`./locales/${t}/navigation.json`,4),xe(Object.assign({"./locales/de/auth.json":()=>Promise.resolve().then(()=>require("./auth-C5zpZ9k7.cjs")),"./locales/en/auth.json":()=>Promise.resolve().then(()=>require("./auth-DL47kvnl.cjs")),"./locales/fr/auth.json":()=>Promise.resolve().then(()=>require("./auth-B-hELPDB.cjs")),"./locales/it/auth.json":()=>Promise.resolve().then(()=>require("./auth-CyPkCta2.cjs"))}),`./locales/${t}/auth.json`,4),xe(Object.assign({"./locales/de/admin.json":()=>Promise.resolve().then(()=>require("./admin-xzsr0_qA.cjs")),"./locales/en/admin.json":()=>Promise.resolve().then(()=>require("./admin-Cc6DZlcU.cjs")),"./locales/fr/admin.json":()=>Promise.resolve().then(()=>require("./admin-BTW2xEuA.cjs")),"./locales/it/admin.json":()=>Promise.resolve().then(()=>require("./admin-C0suc2Qj.cjs"))}),`./locales/${t}/admin.json`,4),xe(Object.assign({"./locales/de/support.json":()=>Promise.resolve().then(()=>require("./support-CXovIlzp.cjs")),"./locales/en/support.json":()=>Promise.resolve().then(()=>require("./support-Bt_0KUwJ.cjs")),"./locales/fr/support.json":()=>Promise.resolve().then(()=>require("./support-DsU3adXz.cjs")),"./locales/it/support.json":()=>Promise.resolve().then(()=>require("./support-D_BPwt4n.cjs"))}),`./locales/${t}/support.json`,4),xe(Object.assign({"./locales/de/docs.json":()=>Promise.resolve().then(()=>require("./docs-sqOeJ3Lg.cjs")),"./locales/en/docs.json":()=>Promise.resolve().then(()=>require("./docs-BR4q7sou.cjs")),"./locales/fr/docs.json":()=>Promise.resolve().then(()=>require("./docs-CDz8QplV.cjs")),"./locales/it/docs.json":()=>Promise.resolve().then(()=>require("./docs-DCOsvfv7.cjs"))}),`./locales/${t}/docs.json`,4),xe(Object.assign({"./locales/de/ai.json":()=>Promise.resolve().then(()=>require("./ai-BGdFYXWS.cjs")),"./locales/en/ai.json":()=>Promise.resolve().then(()=>require("./ai-D_SXDYCZ.cjs")),"./locales/fr/ai.json":()=>Promise.resolve().then(()=>require("./ai-9gEEAcjc.cjs")),"./locales/it/ai.json":()=>Promise.resolve().then(()=>require("./ai-CVDdg8-U.cjs"))}),`./locales/${t}/ai.json`,4),xe(Object.assign({"./locales/de/communications.json":()=>Promise.resolve().then(()=>require("./communications-DBbKXpf1.cjs")),"./locales/en/communications.json":()=>Promise.resolve().then(()=>require("./communications-BPsS3Vfm.cjs")),"./locales/fr/communications.json":()=>Promise.resolve().then(()=>require("./communications-DElJaoVw.cjs")),"./locales/it/communications.json":()=>Promise.resolve().then(()=>require("./communications-BKaku0MU.cjs"))}),`./locales/${t}/communications.json`,4),xe(Object.assign({"./locales/de/entra.json":()=>Promise.resolve().then(()=>require("./entra-BadKCc7Y.cjs")),"./locales/en/entra.json":()=>Promise.resolve().then(()=>require("./entra-CfLYpxKq.cjs")),"./locales/fr/entra.json":()=>Promise.resolve().then(()=>require("./entra-Bc0Dwf7d.cjs")),"./locales/it/entra.json":()=>Promise.resolve().then(()=>require("./entra-DDgx1JoT.cjs"))}),`./locales/${t}/entra.json`,4),xe(Object.assign({"./locales/en/structure.json":()=>Promise.resolve().then(()=>require("./structure-BL5cd83u.cjs")),"./locales/fr/structure.json":()=>Promise.resolve().then(()=>require("./structure-BblXL_QG.cjs"))}),`./locales/${t}/structure.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-DLJ9mTYQ.cjs")),"./locales/en/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-pkUX3R0G.cjs")),"./locales/fr/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-Di_IL1wh.cjs")),"./locales/it/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-B65OLntJ.cjs"))}),`./locales/${t}/preferences.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/groups.json":()=>Promise.resolve().then(()=>require("./groups-aYHQCkbY.cjs")),"./locales/en/groups.json":()=>Promise.resolve().then(()=>require("./groups-C92n_AjP.cjs")),"./locales/fr/groups.json":()=>Promise.resolve().then(()=>require("./groups-8opu86IJ.cjs")),"./locales/it/groups.json":()=>Promise.resolve().then(()=>require("./groups-DwDEmB18.cjs"))}),`./locales/${t}/groups.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/en/ba.json":()=>Promise.resolve().then(()=>require("./ba-9HglDm-t.cjs")),"./locales/fr/ba.json":()=>Promise.resolve().then(()=>require("./ba-CXlHUyjN.cjs"))}),`./locales/${t}/ba.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-CsRMxznf.cjs")),"./locales/en/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-BUnDEWjL.cjs")),"./locales/fr/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-DRITa5fK.cjs")),"./locales/it/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-qLwE7c_z.cjs"))}),`./locales/${t}/docs-administration-users.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BHJfnRA-.cjs")),"./locales/en/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-CXsWrgCA.cjs")),"./locales/fr/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BLmrJB-I.cjs")),"./locales/it/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BmiGStz4.cjs"))}),`./locales/${t}/docs-administration-permissions.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-Cmjpaxwy.cjs")),"./locales/en/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CvYnhoo5.cjs")),"./locales/fr/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-xhQOAORE.cjs")),"./locales/it/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CuHqwklv.cjs"))}),`./locales/${t}/docs-administration-tenants.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-CPqGrO8q.cjs")),"./locales/en/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-EVzVu3kS.cjs")),"./locales/fr/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-B0zkD6zQ.cjs")),"./locales/it/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-DngqfS6k.cjs"))}),`./locales/${t}/docs-administration-ai.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DRw16ooP.cjs")),"./locales/en/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-Da6XQxlv.cjs")),"./locales/fr/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-CofvuK9f.cjs")),"./locales/it/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DW4kFs3z.cjs"))}),`./locales/${t}/docs-administration-workflows.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D3hQEI3V.cjs")),"./locales/en/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-griadux5.cjs")),"./locales/fr/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-BbS4ZUu7.cjs")),"./locales/it/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D0KuJ7Ps.cjs"))}),`./locales/${t}/docs-administration-entra.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-C6VsiHxH.cjs")),"./locales/en/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-DRYyRp3S.cjs")),"./locales/fr/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BEepPuXf.cjs")),"./locales/it/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BiZBTxgS.cjs"))}),`./locales/${t}/docs-administration-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-BdZl4hL4.cjs")),"./locales/en/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-DvZxFmnH.cjs")),"./locales/fr/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-CXro3iiT.cjs")),"./locales/it/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-B1YtxR_A.cjs"))}),`./locales/${t}/docs-administration-configuration.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-DSMqi4PQ.cjs")),"./locales/en/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-C3rm7u1h.cjs")),"./locales/fr/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-CJsMRPaR.cjs")),"./locales/it/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-_LdQyRjT.cjs"))}),`./locales/${t}/docs-administration-configuration-license.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-HRqVNkqP.cjs")),"./locales/en/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-XQ-IiS31.cjs")),"./locales/fr/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-B3IDsztG.cjs")),"./locales/it/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-DKbpQgBH.cjs"))}),`./locales/${t}/docs-administration-tenants-template.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-BtAQiVRM.cjs")),"./locales/en/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-Cs4N4jrq.cjs")),"./locales/fr/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-XRmC4aRE.cjs")),"./locales/it/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-D1T8STQX.cjs"))}),`./locales/${t}/docs-administration-tenants-business.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DHGVmv0D.cjs")),"./locales/en/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-Bk0D7emY.cjs")),"./locales/fr/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DSnrN4MO.cjs")),"./locales/it/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-KFjQQGdW.cjs"))}),`./locales/${t}/docs-administration-tenants-personal.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-B5w2xFPJ.cjs")),"./locales/en/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-Dh2ohplZ.cjs")),"./locales/fr/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-WV4RsrVj.cjs")),"./locales/it/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-DeZKiNkH.cjs"))}),`./locales/${t}/docs-administration-tenants-other.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-BbAfGAzk.cjs")),"./locales/en/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-cv88prRo.cjs")),"./locales/fr/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Clm4Yhy7.cjs")),"./locales/it/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Xtrdol6a.cjs"))}),`./locales/${t}/docs-administration-permissions-assignments.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-BXTwlVt_.cjs")),"./locales/en/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DxKx9YEc.cjs")),"./locales/fr/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DehK43TA.cjs")),"./locales/it/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-D2SCJxWE.cjs"))}),`./locales/${t}/docs-administration-tenants-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-CMJEiBDZ.cjs")),"./locales/en/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-BDCjPv_a.cjs")),"./locales/fr/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-DXBq6rZX.cjs")),"./locales/it/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-7mBPVsvv.cjs"))}),`./locales/${t}/docs-administration-tenants-access-requests.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DV-_MnD2.cjs")),"./locales/en/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BJS2qchs.cjs")),"./locales/fr/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DDPYmh_7.cjs")),"./locales/it/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BWchU3XZ.cjs"))}),`./locales/${t}/docs-administration-tenants-organisations.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-nvIWiI_l.cjs")),"./locales/en/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-yc0oKKrD.cjs")),"./locales/fr/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-jObWdig-.cjs")),"./locales/it/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-BtPIdbRr.cjs"))}),`./locales/${t}/docs-platform-support-tickets.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-D6Oy2YkN.cjs")),"./locales/en/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-sPBt_1c4.cjs")),"./locales/fr/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-BVpRmDsI.cjs")),"./locales/it/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-lQ9K3m9K.cjs"))}),`./locales/${t}/docs-administration-users-dashboard.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Du_ykq8Q.cjs")),"./locales/en/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-CNWOU2Wq.cjs")),"./locales/fr/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Dc8nUoSy.cjs")),"./locales/it/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-C5YUKBpW.cjs"))}),`./locales/${t}/docs-administration-users-references.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-WmOKFuUm.cjs")),"./locales/en/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-C6xh7MWi.cjs")),"./locales/fr/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-DgWpE7cP.cjs")),"./locales/it/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-7NuH5xFT.cjs"))}),`./locales/${t}/docs-administration-users-groups.json`,4).catch(()=>({default:{}}))]);return{common:s.default,navigation:r.default,auth:a.default,admin:o.default,support:c.default,docs:i.default,ai:d.default,communications:u.default,entra:x.default,structure:m.default||{},preferences:f.default||{},groups:h.default||{},ba:v.default||{},docsAdministrationUsers:g.default||{},docsAdministrationPermissions:y.default||{},docsAdministrationTenants:p.default||{},docsAdministrationAi:b.default||{},docsAdministrationWorkflows:j.default||{},docsAdministrationEntra:S.default||{},docsAdministrationApplications:w.default||{},docsAdministrationConfiguration:P.default||{},docsAdministrationConfigurationLicense:$.default||{},docsAdministrationTenantsTemplate:A.default||{},docsAdministrationTenantsBusiness:k.default||{},docsAdministrationTenantsPersonal:R.default||{},docsAdministrationTenantsOther:L.default||{},docsAdministrationPermissionsAssignments:I.default||{},docsAdministrationTenantsApplications:C.default||{},docsAdministrationTenantsAccessRequests:O.default||{},docsAdministrationTenantsOrganisations:_.default||{},docsPlatformSupportTickets:E.default||{},docsAdministrationUsersDashboard:z.default||{},docsAdministrationUsersReferences:W.default||{},docsAdministrationUsersGroups:G.default||{}}}catch(s){return console.warn(`Failed to load language: ${t}`,s),null}},an={},nn=()=>{const t=localStorage.getItem("i18nextLng");if(t&&["en","fr","de","it"].includes(t))return t;const s=navigator.language.split("-")[0];return["en","fr","de","it"].includes(s)?s:"en"},Jt=nn();jt.use(Da).use(ne.initReactI18next).init({resources:an,lng:Jt,fallbackLng:"en",defaultNS:"common",ns:["common","navigation","auth","admin","support","docs","ai","communications","entra","structure","preferences","groups","ba","docsAdministrationUsers","docsAdministrationPermissions","docsAdministrationTenants","docsAdministrationAi","docsAdministrationWorkflows","docsAdministrationEntra","docsAdministrationApplications","docsAdministrationConfiguration","docsAdministrationConfigurationLicense","docsAdministrationTenantsTemplate","docsAdministrationTenantsBusiness","docsAdministrationTenantsPersonal","docsAdministrationTenantsOther","docsAdministrationPermissionsAssignments","docsAdministrationTenantsApplications","docsAdministrationTenantsAccessRequests","docsAdministrationTenantsOrganisations","docsPlatformSupportTickets","docsAdministrationUsersReferences","docsAdministrationUsersGroups"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]}});cr(Jt).then(t=>{t&&Object.entries(t).forEach(([s,r])=>{jt.addResourceBundle(Jt,s,r,!0,!0)})});const ls=async t=>{if(!jt.hasResourceBundle(t,"common")){const s=await cr(t);s&&Object.entries(s).forEach(([r,a])=>{jt.addResourceBundle(t,r,a,!0,!0)})}return jt.changeLanguage(t)},dr=n.createContext(void 0);function on(){if(typeof window>"u")return yt;try{const s=localStorage.getItem(ir);if(s){const r=JSON.parse(s);return{...yt,...r,borderRadius:{...yt.borderRadius,...r.borderRadius},itemPaletteKey:r.itemPaletteKey||os,colors:{light:ut(r.accentColorKey||"indigo"),dark:mt(r.accentColorKey||"indigo")}}}}catch{}const t=window.matchMedia("(prefers-color-scheme: dark)").matches;return{...yt,mode:t?"dark":"light"}}function At(t){const s=t.accentColorKey||"indigo",r=t.borderRadius;return{mode:t.theme||"dark",accentColorKey:s,borderRadius:{card:r?.card||"large",button:r?.button||"medium",badge:r?.badge||"medium",input:r?.input||"medium",modal:r?.modal||"xlarge",menuItem:r?.menuItem||"medium"},itemPaletteKey:t.itemPaletteKey||os,colors:{light:ut(s),dark:mt(s)}}}function ln(t){const s=document.documentElement,r=t.mode==="dark"?t.colors.dark:t.colors.light,a=Ue[t.accentColorKey]?.shades||Ue.indigo.shades,o=dt[t.itemPaletteKey]||dt.neutral,c=t.mode==="dark"?o.colors.dark:o.colors.light;t.mode==="dark"?s.classList.add("dark"):s.classList.remove("dark"),s.style.setProperty("--radius-card",Je[t.borderRadius.card]),s.style.setProperty("--radius-button",Je[t.borderRadius.button]),s.style.setProperty("--radius-badge",Je[t.borderRadius.badge]),s.style.setProperty("--radius-input",Je[t.borderRadius.input]),s.style.setProperty("--radius-modal",Je[t.borderRadius.modal]),s.style.setProperty("--radius-menu-item",Je[t.borderRadius.menuItem]),Object.entries(a).forEach(([i,d])=>{s.style.setProperty(`--color-accent-${i}`,d)}),s.style.setProperty("--item-color-light",c.light),s.style.setProperty("--item-color-medium",c.medium),s.style.setProperty("--item-color-dark",c.dark),s.style.setProperty("--item-color-border",c.border),s.style.setProperty("--bg-app",r.backgrounds.app),s.style.setProperty("--bg-primary",r.backgrounds.primary),s.style.setProperty("--bg-secondary",r.backgrounds.secondary),s.style.setProperty("--bg-tertiary",r.backgrounds.tertiary),s.style.setProperty("--bg-card",r.backgrounds.card),s.style.setProperty("--bg-hover",r.backgrounds.hover),s.style.setProperty("--bg-active",r.backgrounds.active),s.style.setProperty("--text-primary",r.text.primary),s.style.setProperty("--text-secondary",r.text.secondary),s.style.setProperty("--text-tertiary",r.text.tertiary),s.style.setProperty("--text-muted",r.text.muted),s.style.setProperty("--text-inverse",r.text.inverse),s.style.setProperty("--border-color",r.border.default),s.style.setProperty("--border-subtle",r.border.subtle),s.style.setProperty("--border-strong",r.border.strong),s.style.setProperty("--success-bg",r.status.success.bg),s.style.setProperty("--success-text",r.status.success.text),s.style.setProperty("--success-border",r.status.success.border),s.style.setProperty("--success-dot",r.status.success.dot),s.style.setProperty("--warning-bg",r.status.warning.bg),s.style.setProperty("--warning-text",r.status.warning.text),s.style.setProperty("--warning-border",r.status.warning.border),s.style.setProperty("--warning-dot",r.status.warning.dot),s.style.setProperty("--error-bg",r.status.error.bg),s.style.setProperty("--error-text",r.status.error.text),s.style.setProperty("--error-border",r.status.error.border),s.style.setProperty("--error-dot",r.status.error.dot),s.style.setProperty("--info-bg",r.status.info.bg),s.style.setProperty("--info-text",r.status.info.text),s.style.setProperty("--info-border",r.status.info.border),s.style.setProperty("--info-dot",r.status.info.dot),s.style.setProperty("--accent-bg",r.accentTransparent.bg),s.style.setProperty("--accent-text",r.accentTransparent.text),s.style.setProperty("--accent-border",r.accentTransparent.border)}function ur({children:t}){const[s,r]=n.useState(on),[a,o]=n.useState(!1),[c,i]=n.useState(null),[d,u]=n.useState(void 0),[x,m]=n.useState([]),{i18n:f}=ne.useTranslation(),h=n.useRef(null),v=n.useRef(!0),g=n.useRef(!1),y=n.useRef(!1),p=n.useCallback(async(E,z=void 0)=>{if(!localStorage.getItem("token")||y.current)return;let G=null;const J=localStorage.getItem("currentTenantId");if(z===void 0)J?G=J:G=null;else{if(z!==null&&J&&z!==J)return;G=z}try{o(!0),await It.preferences.updateTheme({mode:E.mode,accentColorKey:E.accentColorKey,borderRadius:{card:E.borderRadius.card,button:E.borderRadius.button,badge:E.borderRadius.badge,input:E.borderRadius.input,modal:E.borderRadius.modal,menuItem:E.borderRadius.menuItem},itemPaletteKey:E.itemPaletteKey,targetTenantId:G}),G&&!x.includes(G)&&m(pe=>[...pe,G])}catch(pe){console.error("[ThemeContext] ❌ Failed to save theme to server:",{error:pe,targetTenantId:G,mode:E.mode,accentColorKey:E.accentColorKey,localStorage_currentTenantId:localStorage.getItem("currentTenantId"),localStorage_currentTenantSlug:localStorage.getItem("currentTenantSlug")})}finally{o(!1)}},[x]),b=n.useCallback((E,z=void 0)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{p(E,z)},1e3)},[p]);n.useLayoutEffect(()=>{ln(s)},[s]),n.useEffect(()=>{const E={mode:s.mode,borderRadius:s.borderRadius,accentColorKey:s.accentColorKey,itemPaletteKey:s.itemPaletteKey};localStorage.setItem(ir,JSON.stringify(E)),!y.current&&!v.current&&b(s,d),v.current=!1},[s,b,d]),n.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const j=n.useCallback(async E=>{const z=localStorage.getItem("token"),W=localStorage.getItem("currentTenantSlug");if(!z)return;const G=E==="global";if(!(!G&&!W))try{o(!0);const J=G?await je.preferences.getGlobal():await je.preferences.get();i(J.scope);const pe=At(J);v.current=!0,r(pe),g.current=!0,J.language&&J.language!==f.language&&(ls(J.language),document.documentElement.lang=J.language)}catch(J){console.error("[ThemeContext] Failed to load theme from server:",J)}finally{o(!1)}},[f]),S=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.applyToTenant();i(W.scope)}catch(W){throw console.error("[ThemeContext] Failed to create tenant-specific preferences:",W),W}finally{o(!1)}},[]),w=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.deleteTenantOverride();i(W.scope);const G=At(W);v.current=!0,r(G)}catch(W){throw console.error("[ThemeContext] Failed to delete tenant-specific preferences:",W),W}finally{o(!1)}},[]),P=n.useCallback(async()=>{if(localStorage.getItem("token"))try{const z=await je.preferences.getThemeOverrides();m(z)}catch(z){console.error("[ThemeContext] Failed to load tenant overrides:",z)}},[]),$=n.useCallback(async(E,z=!1)=>{if(h.current&&(clearTimeout(h.current),h.current=null),y.current=!0,g.current=!0,v.current=!0,u(E),z){y.current=!1;return}if(!localStorage.getItem("token")){y.current=!1;return}try{if(o(!0),E===null){const G=await je.preferences.getGlobal();i(G.scope);const J=At(G);v.current=!0,r(J)}else{const G=await je.preferences.getForTenant(E);i(G.scope);const J=At(G);v.current=!0,r(J)}}catch(G){console.error("[ThemeContext] Failed to load preferences for tenant:",G)}finally{o(!1),y.current=!1}},[]),A=n.useCallback(()=>{r(E=>({...E,mode:E.mode==="light"?"dark":"light",colors:{light:ut(E.accentColorKey),dark:mt(E.accentColorKey)}}))},[]),k=n.useCallback(E=>{r(z=>({...z,mode:E}))},[]),R=n.useCallback((E,z)=>{r(W=>({...W,borderRadius:{...W.borderRadius,[E]:z}}))},[]),L=n.useCallback(E=>{Ue[E]&&r(z=>({...z,accentColorKey:E,colors:{light:ut(E),dark:mt(E)}}))},[]),I=n.useCallback(E=>{dt[E]&&r(z=>({...z,itemPaletteKey:E}))},[]),C=n.useCallback(E=>{r(z=>{const W=E.accentColorKey||z.accentColorKey;return{...z,...E,borderRadius:{...z.borderRadius,...E.borderRadius},accentColorKey:W,itemPaletteKey:E.itemPaletteKey||z.itemPaletteKey,colors:{light:ut(W),dark:mt(W)}}})},[]),O=n.useCallback(()=>{r(yt)},[]),_=n.useCallback(E=>Je[s.borderRadius[E]],[s.borderRadius]);return e.jsx(dr.Provider,{value:{config:s,mode:s.mode,toggleMode:A,setMode:k,setBorderRadius:R,setAccentColor:L,setItemPalette:I,applyPreset:C,resetToDefault:O,getBorderRadius:_,loadFromServer:j,isSyncing:a,scopeInfo:c,applyToTenant:S,resetToGlobal:w,selectedThemeTenant:d,setSelectedThemeTenant:$,tenantOverrides:x,loadTenantOverrides:P},children:t})}function St(){const t=n.useContext(dr);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}let ft=null,st=null;const cn={async getFeatureConfig(t){return ft||st||(st=(async()=>{try{return ft=(await ns.get("/api/config/features",{timeout:1e4,signal:t,headers:{"Content-Type":"application/json"}})).data,ft}finally{st=null}})(),st)},clearCache(){ft=null,st=null}},mr=n.createContext(void 0);function dn({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(!0);n.useEffect(()=>{const i=new AbortController;return cn.getFeatureConfig(i.signal).then(d=>{i.signal.aborted||r(d)}).catch(d=>{d.name==="CanceledError"||i.signal.aborted||(console.error("Failed to load feature config:",d),r({multiTenantEnabled:!0,enableB2B:!0,enableB2C:!0,useUrlRouting:!0}))}).finally(()=>{i.signal.aborted||o(!1)}),()=>i.abort()},[]);const c={config:s,isLoading:a,isMultiTenant:!0,isHybridMode:s?.multiTenantEnabled===!0&&s?.enableB2B===!1&&s?.enableB2C===!0,enableB2B:s?.enableB2B??!0,enableB2C:s?.enableB2C??!0,useUrlRouting:s?.useUrlRouting??!0};return e.jsx(mr.Provider,{value:c,children:t})}function cs(){const t=n.useContext(mr);if(!t)throw new Error("useFeatureConfig must be used within FeatureConfigProvider");return t}function ds(t,s){const r=t.toLowerCase(),a=s.toLowerCase();if(r==="*"||r===a)return!0;if(r.endsWith(".*")){const o=r.slice(0,-2);return a.startsWith(o+".")||a===o}return!1}function Tt(t,s){return t.includes("*")||s.includes("Super Administrator")||s.includes("Platform Administrator")}function un(t,s,r){if(!r||Tt(t,s))return!0;const a=r.toLowerCase(),o=a+".";for(const c of t){const i=c.toLowerCase();if(i===a||i.startsWith(o))return!0;if(i.endsWith(".*")){const d=i.slice(0,-1);if(a.startsWith(d)||o.startsWith(d))return!0}}return!1}const us=n.createContext(void 0),rt="token",at="user";function xr({children:t}){const[s,r]=n.useState(()=>{if(typeof window<"u"){const x=localStorage.getItem(at);if(x)try{return JSON.parse(x)}catch{return null}}return null}),[a,o]=n.useState(!0),c=n.useCallback((x,m)=>{localStorage.setItem(rt,x),localStorage.setItem(at,JSON.stringify(m)),r(m)},[]),i=n.useCallback(async()=>{try{localStorage.getItem(rt)&&await D.post("/api/auth/logout")}catch{}localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at),r(null),window.location.href="/login"},[]),d=n.useCallback(x=>{if(!s)return!1;if(Tt(s.permissions,s.roles)||s.permissions.includes(x))return!0;for(const m of s.permissions)if(ds(m,x))return!0;return!1},[s]),u=n.useCallback(async()=>{if(localStorage.getItem(rt))try{const m=await D.get("/api/auth/me");r(m),localStorage.setItem(at,JSON.stringify(m))}catch(m){console.error("Failed to refresh permissions:",m)}},[]);return n.useEffect(()=>{localStorage.getItem(rt)&&!s?D.get("/api/auth/me").then(m=>{r(m),localStorage.setItem(at,JSON.stringify(m))}).catch(()=>{localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at)}).finally(()=>o(!1)):o(!1)},[s]),e.jsx(us.Provider,{value:{user:s,isAuthenticated:!!s,isLoading:a,login:c,logout:i,hasPermission:d,refreshPermissions:u},children:t})}function Ae(){const t=n.useContext(us);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function mn(){return n.useContext(us)??null}const pr=n.createContext(void 0);function hr({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(null),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useRef(null),m=n.useCallback(async g=>{try{i(!0),u(null);const[y,p]=await Promise.all([D.get("/api/administration/license",{signal:g}),D.get("/api/administration/license/usage",{signal:g}).catch(()=>null)]);g?.aborted||(r(y),o(p))}catch(y){if(y instanceof Error&&y.name==="CanceledError"||g?.aborted)return;u(y instanceof Error?y.message:"Failed to load license info"),console.error("Failed to fetch license:",y)}finally{g?.aborted||i(!1)}},[]);n.useEffect(()=>{x.current?.abort();const g=new AbortController;return x.current=g,m(g.signal),()=>g.abort()},[m]);const f=n.useCallback(g=>s?s.enabledFeatures.includes("*")?!0:s.enabledFeatures.some(y=>y.toLowerCase()===g.toLowerCase()):!1,[s]),h=n.useCallback(async()=>{x.current?.abort();const g=new AbortController;x.current=g,await m(g.signal)},[m]),v=n.useCallback(async(g,y)=>{try{const p=await D.post("/api/administration/license/activate",{licenseKey:g,apiKey:y||null});return p.success?(await h(),{success:!0}):{success:!1,error:p.errorMessage||"Activation failed"}}catch(p){return{success:!1,error:p instanceof Error?p.message:"Activation failed"}}},[h]);return e.jsx(pr.Provider,{value:{license:s,usage:a,isLoading:c,error:d,isFeatureEnabled:f,isReadOnlyMode:s?.isReadOnlyMode??!1,refreshLicense:h,activateLicense:v},children:t})}function Ge(){const t=n.useContext(pr);if(t===void 0)throw new Error("useLicense must be used within a LicenseProvider");return t}const gr=n.createContext(void 0),Ve="currentTenantId",We="currentTenantSlug",_e="isGlobalView";function xn({children:t}){const{isAuthenticated:s,user:r,refreshPermissions:a}=Ae(),{isLoading:o}=cs(),[c,i]=n.useState(null),[d,u]=n.useState([]),[x,m]=n.useState(!0),[f,h]=n.useState(null),[v,g]=n.useState(()=>localStorage.getItem(_e)==="true"),y=n.useRef(!1),p=n.useRef(""),b=d.filter(C=>C.type==="Business"),j=d.find(C=>C.type==="Personal")||null,S=n.useCallback((C,O)=>{if(u(C),C.length===0){i(null),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e),m(!1);return}const _=localStorage.getItem(Ve),E=_?C.find(J=>J.id===_):null;if(E&&E.status==="Active"){i(E),g(!1),localStorage.setItem(Ve,E.id),localStorage.setItem(We,E.slug),localStorage.removeItem(_e),m(!1);return}if(localStorage.getItem(_e)==="true"){g(!0),i(null),m(!1);return}const W=C.find(J=>J.isDefault&&J.status==="Active");if(W){i(W),g(!1),localStorage.setItem(Ve,W.id),localStorage.setItem(We,W.slug),localStorage.removeItem(_e),m(!1);return}if(O){g(!0),i(null),localStorage.setItem(_e,"true"),m(!1);return}const G=C.find(J=>J.status==="Active");i(G||null),G&&(localStorage.setItem(Ve,G.id),localStorage.setItem(We,G.slug)),m(!1)},[]),w=n.useCallback(async C=>{const O=d.find(_=>_.id===C);if(!O)throw new Error("Tenant not found");if(O.status!=="Active")throw new Error("Cannot switch to inactive tenant");g(!1),localStorage.removeItem(_e),i(O),localStorage.setItem(Ve,C),localStorage.setItem(We,O.slug),await a()},[d,a]),P=n.useCallback(async()=>{g(!0),localStorage.setItem(_e,"true"),i(null),localStorage.removeItem(Ve),localStorage.removeItem(We),await a()},[a]),$=n.useCallback(async()=>{g(!1),localStorage.removeItem(_e);const C=d.find(E=>E.isDefault&&E.status==="Active"),O=d.find(E=>E.status==="Active"),_=C||O||null;_&&(i(_),localStorage.setItem(Ve,_.id),localStorage.setItem(We,_.slug)),await a()},[d,a]),A=n.useCallback(async C=>{try{await je.myTenants.setDefault(C),u(O=>O.map(E=>({...E,isDefault:E.id===C}))),await w(C)}catch(O){throw console.error("[TenantContext] Failed to set default tenant:",O),O}},[w]),k=n.useCallback(async()=>{try{await je.myTenants.clearDefault(),u(C=>C.map(O=>({...O,isDefault:!1}))),await P()}catch(C){throw console.error("[TenantContext] Failed to clear default tenant:",C),C}},[P]),R=n.useCallback(async()=>{m(!0),h(null);try{await a()}catch(C){console.error("Failed to refresh tenants:",C),h("Failed to refresh tenants")}finally{m(!1)}},[a]);n.useEffect(()=>{if(!s||!r){y.current&&(u([]),i(null),m(!1),y.current=!1,p.current="");return}const C=r.tenants||[],O=C.map(_=>`${_.id}:${_.status}:${_.isDefault}`).sort((_,E)=>_.localeCompare(E)).join(",");if(!y.current||O!==p.current){y.current=!0,p.current=O;const _=Tt(r.permissions||[],r.roles||[]);S(C,_),localStorage.getItem(We)&&a().catch(z=>console.error("[TenantContext] Failed to refresh permissions after tenant init:",z))}},[s,r,S,a]),n.useEffect(()=>{s||(i(null),u([]),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e))},[s]);const L=r?Tt(r.permissions||[],r.roles||[]):!1,I={currentTenant:c,userTenants:d,b2bTenants:b,personalTenant:j,isLoading:x||o,error:f,switchTenant:w,setDefaultTenant:A,clearDefaultTenant:k,refreshTenants:R,hasMultipleTenants:d.filter(C=>C.status==="Active").length>1,isCurrentTenantOwner:c?.isOwner??!1,hasGlobalRoles:L,isGlobalView:v,enterGlobalView:P,exitGlobalView:$};return e.jsx(gr.Provider,{value:I,children:t})}function Ee(){const t=n.useContext(gr);if(t===void 0)throw new Error("useTenant must be used within a TenantProvider");return t}const Rt=5,fr=n.createContext(null);function br({children:t}){const{i18n:s}=ne.useTranslation(),{isAuthenticated:r}=Ae(),{currentTenant:a,isLoading:o}=Ee(),[c,i]=n.useState([]),[d,u]=n.useState(!1),[x,m]=n.useState(null),[f,h]=n.useState(!1),v=n.useCallback(()=>{h(!0)},[]),g=n.useCallback(()=>{h(!1)},[]),y=n.useCallback(async()=>{try{u(!0),m(null);const k=(await D.get("/api/navigation/module-favorites")).map(R=>({id:R.id,code:R.code,label:R.label,icon:R.icon||"Star",route:R.route||"",applicationId:R.applicationId,applicationCode:R.applicationCode,applicationLabel:R.applicationLabel,displayOrder:R.displayOrder}));i(k)}catch(A){console.error("Failed to load favorite modules:",A),m("Erreur lors du chargement des favoris"),i([])}finally{u(!1)}},[]);n.useEffect(()=>{r&&!o?y():r||(i([]),m(null))},[r,o,a,y]),n.useEffect(()=>{const A=()=>{r&&!o&&y()};return s.on("languageChanged",A),()=>{s.off("languageChanged",A)}},[s,r,o,y]);const p=n.useCallback(async A=>{if(c.length>=Rt||c.some(k=>k.id===A.id))return!1;try{return m(null),await D.post(`/api/navigation/module-favorites/${A.id}`),i(k=>[...k,{...A,displayOrder:k.length+1}]),!0}catch(k){return console.error("Failed to add favorite module:",k),await y(),!1}},[c,y]),b=n.useCallback(async A=>{try{return m(null),await D.delete(`/api/navigation/module-favorites/${A}`),i(k=>k.filter(R=>R.id!==A)),!0}catch(k){return console.error("Failed to remove favorite module:",k),await y(),!1}},[y]),j=n.useCallback(A=>c.some(k=>k.id===A),[c]),S=n.useCallback(async A=>j(A.id)?await b(A.id):await p(A),[j,b,p]),w=n.useCallback(async A=>{const k=A.slice(0,Rt),R=k.map(I=>I.id),L=[...c];i(k.map((I,C)=>({...I,displayOrder:C+1})));try{return m(null),await D.put("/api/navigation/module-favorites/reorder",R),!0}catch(I){return console.error("Failed to reorder favorite modules:",I),i(L),!1}},[c]),P=c.length<Rt;return e.jsx(fr.Provider,{value:{favorites:c,loading:d,error:x,addFavorite:p,removeFavorite:b,toggleFavorite:S,isFavorite:j,reorderFavorites:w,canAddMore:P,maxFavorites:Rt,reload:y,expandFavorites:f,triggerExpand:v,clearExpand:g,requiresTenant:!1},children:t})}function ze(){const t=n.useContext(fr);if(!t)throw new Error("useFavorites must be used within a FavoritesProvider");return t}const vr="smartstack-sidebar-collapsed",yr=n.createContext(void 0);function pn(){if(typeof window>"u")return!1;try{return localStorage.getItem(vr)==="true"}catch{return!1}}function jr({children:t}){const[s,r]=n.useState(pn);n.useEffect(()=>{localStorage.setItem(vr,String(s))},[s]);const a=n.useCallback(()=>{r(i=>!i)},[]),o=n.useCallback(i=>{r(i)},[]),c=s?64:256;return e.jsx(yr.Provider,{value:{isCollapsed:s,toggleCollapsed:a,setCollapsed:o,sidebarWidth:c},children:t})}function Lt(){const t=n.useContext(yr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t}const hn=["login","callback","logout","onboarding","system","applications"],wr=n.createContext(void 0);function gn(t){let s=t.split("/").filter(Boolean);return s.length>=2&&s[0]==="t"&&(s=s.slice(2)),s.length===0?{app:null,module:null}:hn.includes(s[0])?{app:null,module:null}:{app:s[0]||null,module:s[1]||null}}function ms({children:t}){const s=N.useLocation(),{i18n:r}=ne.useTranslation(),{currentTenant:a,isLoading:o,isGlobalView:c}=Ee(),[i,d]=n.useState(null),[u,x]=n.useState([]),[m,f]=n.useState(!0),h=n.useRef(!1),v=n.useRef(void 0),g=n.useRef(0),{app:y,module:p}=gn(s.pathname),b=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/menu");d(I)}catch(I){console.error("Failed to fetch menu:",I)}},[]),j=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/favorites");x(I)}catch(I){console.error("Failed to fetch favorites:",I)}},[]),S=n.useCallback(async()=>{const I=++g.current;if(f(!0),await b(),I===g.current){if(a){if(await j(),I!==g.current)return}else x([]);f(!1)}},[b,j,a]);n.useEffect(()=>{const I=localStorage.getItem("token"),C=c?"global":a?.id??"none";if(!(!I||o)){if(!h.current){h.current=!0,v.current=C,S();return}C!==v.current&&(v.current=C,S())}},[a?.id,c,o]),n.useEffect(()=>{const I=()=>{localStorage.getItem("token")&&S()};return r.on("languageChanged",I),()=>{r.off("languageChanged",I)}},[r,S]);const w=n.useCallback(I=>I.startsWith("core_")?I.slice(5):I.startsWith("ext_")?I.slice(4):I,[]),P=n.useCallback((I,C)=>I&&I.split("/").filter(Boolean)[C]||null,[]),$=n.useCallback(()=>i?.applications.find(I=>P(I.route,0)===y||w(I.code)===y),[i,y,P,w]),A=n.useCallback(()=>$()?.modules.find(C=>P(C.route,1)===p||w(C.code)===p),[$,p,P,w]),k=n.useCallback(I=>i?.applications.filter(C=>C.zone===I)||[],[i]),R=n.useCallback(I=>u.some(C=>C.id===I),[u]),L=n.useCallback(async I=>{if(a)try{R(I)?(await D.delete(`/api/navigation/favorites/${I}`),x(C=>C.filter(O=>O.id!==I))):(await D.post(`/api/navigation/favorites/${I}`,{}),await j())}catch(C){console.error("Failed to toggle favorite:",C)}},[a,R,j]);return e.jsx(wr.Provider,{value:{menu:i,favorites:u,currentAppCode:y,currentModuleCode:p,isLoading:m,getCurrentApplication:$,getCurrentModule:A,getApplicationsByZone:k,getApplicationsForContext:k,toggleFavorite:L,isFavorite:R,refreshMenu:S},children:t})}function Re(){const t=n.useContext(wr);if(t===void 0)throw new Error("useNavigation must be used within a NavigationProvider");return t}const Nr=n.createContext(null);function Sr({children:t}){const{isAuthenticated:s,refreshPermissions:r}=Ae(),{refreshMenu:a}=Re(),o=n.useRef(null),[c,i]=n.useState(ie.HubConnectionState.Disconnected),d=n.useRef(new Set),u=n.useRef(new Set),x=n.useRef(!1),m=n.useCallback(async()=>{if(!x.current){x.current=!0;try{await Promise.all([r(),a()])}catch(p){console.error("[SignalR] Failed to refresh permissions:",p)}finally{x.current=!1}}},[r,a]),f=n.useCallback(async()=>{const p=localStorage.getItem("token");if(p&&!(o.current?.state===ie.HubConnectionState.Connected||o.current?.state===ie.HubConnectionState.Connecting))try{const b=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>p}).withAutomaticReconnect({nextRetryDelayInMilliseconds:j=>j.previousRetryCount===0?0:j.previousRetryCount===1?2e3:j.previousRetryCount===2?1e4:j.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();b.on("ReceiveNotification",j=>{d.current.forEach(S=>S(j))}),b.on("UnreadCountUpdate",j=>{u.current.forEach(S=>S(j))}),b.on("PermissionsChanged",m),b.onreconnecting(()=>{i(ie.HubConnectionState.Reconnecting)}),b.onreconnected(()=>{i(ie.HubConnectionState.Connected)}),b.onclose(()=>{i(ie.HubConnectionState.Disconnected)}),await b.start(),o.current=b,i(ie.HubConnectionState.Connected)}catch(b){console.error("[SignalR] Failed to connect:",b),i(ie.HubConnectionState.Disconnected)}},[m]),h=n.useCallback(async()=>{if(o.current)try{await o.current.stop(),o.current=null,i(ie.HubConnectionState.Disconnected)}catch(p){console.error("[SignalR] Failed to disconnect:",p)}},[]);n.useEffect(()=>(s?f():h(),()=>{h()}),[s,f,h]);const v=n.useCallback(p=>(d.current.add(p),()=>{d.current.delete(p)}),[]),g=n.useCallback(p=>(u.current.add(p),()=>{u.current.delete(p)}),[]),y={isConnected:c===ie.HubConnectionState.Connected,connectionState:c,onNotification:v,onUnreadCountUpdate:g};return e.jsx(Nr.Provider,{value:y,children:t})}function Cr(){const t=n.useContext(Nr);if(!t)throw new Error("useSignalRContext must be used within a SignalRProvider");return t}const Et={register:async t=>D.post("/api/auth/register",t),confirmEmail:async t=>D.post("/api/auth/confirm-email",{token:t}),resendConfirmation:async t=>D.post("/api/auth/resend-confirmation",{email:t}),forgotPassword:async t=>D.post("/api/auth/forgot-password",{email:t}),resetPassword:async(t,s)=>D.post("/api/auth/reset-password",{token:t,newPassword:s}),login:async(t,s)=>{const r=await D.post("/api/auth/login",{email:t,password:s});return r.token&&(localStorage.setItem("token",r.token),localStorage.setItem("refreshToken",r.refreshToken)),r},logout:async()=>{try{await D.post("/api/auth/logout")}finally{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user")}},changePassword:async(t,s)=>D.post("/api/auth/change-password",{currentPassword:t,newPassword:s}),refreshSession:async()=>{const t=await D.post("/api/auth/refresh");return t.token&&(localStorage.setItem("token",t.token),localStorage.setItem("refreshToken",t.refreshToken)),t},getSessionInfo:async t=>D.get("/api/auth/session-info",{signal:t?.signal})};function kr(t={}){const{checkIntervalMs:s=6e4,onSessionExpired:r,onWarningThreshold:a,enabled:o=!0}=t,[c,i]=n.useState({isActive:!0,timeRemainingSeconds:0,isWarning:!1,sessionInfo:null}),[d,u]=n.useState(!1),x=n.useRef(!1),m=n.useRef(null),f=n.useRef(null),h=n.useCallback(async g=>{if(!o)return;if(!localStorage.getItem("token")){i(p=>({...p,isActive:!1}));return}try{const p=await Et.getSessionInfo({signal:g});if(g?.aborted)return;const b=Math.min(p.timeUntilIdleExpirySeconds,p.timeUntilAbsoluteExpirySeconds);i({isActive:!0,timeRemainingSeconds:b,isWarning:p.isWarningThreshold,sessionInfo:p}),p.isWarningThreshold&&!x.current&&(x.current=!0,a?.()),p.isWarningThreshold||(x.current=!1)}catch(p){if(p instanceof Error&&p.name==="CanceledError"||g?.aborted)return;i(b=>({...b,isActive:!1})),r?.()}},[o,r,a]),v=n.useCallback(async()=>{if(d)return!1;u(!0);try{return await Et.refreshSession(),x.current=!1,await h(),!0}catch{return i(g=>({...g,isActive:!1})),!1}finally{u(!1)}},[d,h]);return n.useEffect(()=>{if(!o)return;f.current?.abort();const g=new AbortController;return f.current=g,h(g.signal),m.current=setInterval(()=>h(),s),()=>{g.abort(),m.current&&clearInterval(m.current)}},[o,s,h]),n.useEffect(()=>{if(!o)return;const g=()=>{c.isWarning&&h()},y=["mousedown","keydown","touchstart","scroll"];return y.forEach(p=>{window.addEventListener(p,g,{passive:!0})}),()=>{y.forEach(p=>{window.removeEventListener(p,g)})}},[o,c.isWarning,h]),{...c,isRefreshing:d,refreshSession:v,checkSession:h}}function fn(t){if(t<=0)return"0:00";const s=Math.floor(t/60),r=t%60;if(s>=60){const a=Math.floor(s/60),o=s%60;return`${a}h ${o}min`}return`${s}:${r.toString().padStart(2,"0")}`}function Ar({isOpen:t,timeRemainingSeconds:s,onExtendSession:r,onLogout:a}){const{t:o}=ne.useTranslation("common"),[c,i]=n.useState(!1),[d,u]=n.useState(s);n.useEffect(()=>{u(s)},[s]),n.useEffect(()=>{if(!t||d<=0)return;const f=setInterval(()=>{u(h=>h<=1?(a(),0):h-1)},1e3);return()=>clearInterval(f)},[t,d,a]);const x=async()=>{i(!0);try{await r()||a()}finally{i(!1)}};if(!t)return null;const m=Math.max(0,Math.min(100,d/300*100));return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"relative w-full max-w-md bg-[var(--bg-card)] rounded-2xl shadow-2xl border border-amber-500/30 overflow-hidden animate-in fade-in zoom-in duration-200",children:[e.jsx("div",{className:"absolute top-0 left-0 h-1 bg-amber-500/30 w-full",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-orange-500 transition-all duration-1000 ease-linear",style:{width:`${m}%`}})}),e.jsxs("div",{className:"p-6 pt-8",children:[e.jsxs("div",{className:"flex flex-col items-center text-center mb-6",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-amber-500/20 flex items-center justify-center mb-4",children:e.jsx(l.Clock,{className:"w-8 h-8 text-amber-500"})}),e.jsx("h2",{className:"text-xl font-semibold text-[var(--text-primary)] mb-2",children:o("session.warningTitle","Session Expiring")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:o("session.warningMessage","Your session will expire due to inactivity.")}),e.jsx("div",{className:"text-4xl font-mono font-bold text-amber-500 tabular-nums",children:fn(d)}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-2",children:o("session.remainingTime","remaining")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("button",{onClick:a,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl border border-[var(--border-color)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)] transition-all font-medium",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),o("session.logout","Logout")]}),e.jsxs("button",{onClick:x,disabled:c,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl font-medium transition-all bg-gradient-to-r from-amber-500 to-orange-500 text-white hover:from-amber-600 hover:to-orange-600 shadow-lg shadow-amber-500/30 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(l.RefreshCw,{className:`w-4 h-4 ${c?"animate-spin":""}`}),c?o("session.extending","Extending..."):o("session.extend","Continue Session")]})]})]})]})})}const bn=n.createContext(void 0);function Rr({children:t}){const{isAuthenticated:s,logout:r}=Ae(),a=n.useCallback(()=>{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user"),window.location.href="/login?reason=session_expired"},[]),{isActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d}=kr({enabled:s,checkIntervalMs:3e4,onSessionExpired:a}),u=n.useCallback(async()=>{try{await Et.logout()}finally{r()}},[r]),x=n.useCallback(async()=>await d(),[d]);return e.jsxs(bn.Provider,{value:{isSessionActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d},children:[t,e.jsx(Ar,{isOpen:i&&s,timeRemainingSeconds:c,onExtendSession:x,onLogout:u})]})}const vn=150;function yn({children:t}){const s=mn(),r=s?.isAuthenticated??!1,a=s?.isLoading??!0,{currentTenant:o,isLoading:c,isGlobalView:i}=Ee(),{setSelectedThemeTenant:d,loadFromServer:u}=St(),x=n.useRef(null),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null),v=n.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),g=n.useCallback(()=>x.current==="global"?!1:(v(),h.current=null,x.current="global",m.current=!0,u("global"),d(null,!0),!0),[v,u,d]),y=n.useCallback((j,S)=>{h.current=j,f.current=setTimeout(()=>{h.current===j&&(x.current=j,m.current=!0,h.current=null,d(j,!1)),f.current=null},vn)},[d]),p=n.useCallback(()=>{if(!o)return;const j=o.id!==x.current,S=h.current!==null&&h.current!==o.id;!j&&!S||(v(),j?y(o.id,o.slug):h.current=null)},[o,v,y]),b=n.useCallback(()=>{v(),x.current=null,h.current=null,m.current=!1},[v]);return n.useEffect(()=>{if(!r){b();return}if(!(a||c)){if(i&&!o){g();return}o&&p()}},[r,a,c,o,i,g,p,b]),n.useEffect(()=>()=>{v()},[v]),e.jsx(e.Fragment,{children:t})}function jn(t){const s=t.message.toLowerCase(),r=t.name.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("failed to fetch")||s.includes("econnrefused")||s.includes("timeout")?"network":s.includes("401")||s.includes("403")||s.includes("unauthorized")||s.includes("forbidden")||s.includes("permission")?"permission":s.includes("404")||s.includes("not found")?"notFound":r.includes("validation")||s.includes("validation")||s.includes("invalid")?"validation":"technical"}function wn(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const Nn={network:{icon:l.WifiOff,color:"text-orange-500",bgColor:"bg-orange-500/10"},permission:{icon:l.ShieldX,color:"text-red-500",bgColor:"bg-red-500/10"},notFound:{icon:l.FileWarning,color:"text-yellow-500",bgColor:"bg-yellow-500/10"},validation:{icon:l.AlertTriangle,color:"text-amber-500",bgColor:"bg-amber-500/10"},technical:{icon:l.Bug,color:"text-red-500",bgColor:"bg-red-500/10"}};function Pr({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>wn()),i=jn(t),d=Nn[i],u=d.icon,x=()=>{window.history.length>2&&document.referrer?window.location.href=document.referrer:window.history.length>2?(window.history.back(),setTimeout(()=>window.location.reload(),50)):window.location.href="/"};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:`w-16 h-16 rounded-full ${d.bgColor} flex items-center justify-center mb-6`,children:e.jsx(u,{className:`w-8 h-8 ${d.color}`})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:r(`errors.${i}.title`,{defaultValue:r("errors.technical.title")})}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:r(`errors.${i}.description`,{defaultValue:r("errors.technical.description")})}),e.jsxs("div",{className:"mb-6 px-3 py-1.5 bg-[var(--bg-tertiary)] rounded-lg border border-[var(--border-color)]",children:[e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[r("errors.errorId"),": "]}),e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:c})]}),!1,e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:s,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.RefreshCw,{className:"w-4 h-4"}),r("errors.retry")]}),e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),r("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),r("errors.home")]})]}),e.jsxs("p",{className:"mt-6 text-sm text-[var(--text-tertiary)]",children:[r("errors.persistsHelp")," ",e.jsx("a",{href:"mailto:support@atlashub.ch",className:"text-[var(--color-accent-500)] hover:underline",children:r("errors.contactSupport")})]})]})})})}function Sn(t,s){Pe.logCritical(t,"GlobalErrorBoundary",{componentStack:s.componentStack})}function Cn(){window.location.reload()}function Tr({children:t}){return e.jsx(nr.ErrorBoundary,{FallbackComponent:Pr,onError:Sn,onReset:Cn,children:t})}const xs="/api/myspace/application-tracking",kn="00000000-0000-0000-0000-000000000000",Ns=t=>!!t&&t!==kn,Er=t=>{const s=t.match(/^\/t\/[^/]+(\/.*)$/);return s?s[1]:t},An=t=>{const s=Er(t);return s.startsWith("/administration/")||s.startsWith("/support/")||s.startsWith("/myspace/")},$r=(t,s)=>{if(!t||typeof t!="object"||!("status"in t))return!0;const r=t.status;return!s.includes(r??-1)},Rn=async(t,s)=>{const r=new Date,a=Math.floor((r.getTime()-s.getTime())/1e3);try{await D.post(`${xs}/end`,{accessId:t,endedAt:r.toISOString(),durationSeconds:a})}catch(o){$r(o,[401,408])&&console.error("Failed to end page tracking:",o)}},Pn=async t=>{const s=new Date;try{return(await D.post(`${xs}/start`,{route:t,accessedAt:s.toISOString()})).accessId}catch(r){return $r(r,[401])&&console.error("Failed to track page access:",r),null}},Tn=(t,s)=>{const r=localStorage.getItem("token");if(!r)return;const a=new Date,o=Math.floor((a.getTime()-s.getTime())/1e3);fetch(`${xs}/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({accessId:t,endedAt:a.toISOString(),durationSeconds:o}),keepalive:!0}).catch(()=>{})};function Ir(){const t=N.useLocation(),s=n.useRef(new Date),r=n.useRef(null),a=n.useRef(!1);n.useEffect(()=>a.current?void 0:((async()=>{const c=Er(t.pathname);An(c)&&(a.current=!0,Ns(r.current)&&await Rn(r.current,s.current),s.current=new Date,r.current=await Pn(c),a.current=!1)})(),()=>{Ns(r.current)&&Tn(r.current,s.current)}),[t.pathname])}function En(){return Ir(),null}function Lr(){return N.useInRouterContext()?e.jsx(En,{}):null}const bt="/api/administration/tenants/tenant-analytics",Ss={getDashboardStats:async(t=30)=>await D.get(`${bt}/dashboard`,{params:{period:t}}),getTopTenants:async(t=10,s=30,r="access")=>await D.get(`${bt}/top-tenants`,{params:{limit:t,period:s,sortBy:r}}),getTrends:async(t=30)=>await D.get(`${bt}/trends`,{params:{period:t}}),trackStart:async t=>await D.post(`${bt}/track/start`,{tenantId:t}),trackEnd:async t=>{await D.post(`${bt}/track/end`,{accessId:t})}},$n="/api/administration/tenants/tenant-analytics";function In(){const{currentTenant:t}=Ee(),{isAuthenticated:s}=Ae(),r=n.useRef(null),a=n.useRef(null),o=n.useRef(!1);n.useEffect(()=>{if(!s)return;const c=window.location.pathname;if(c.startsWith("/auth/")||c.startsWith("/login"))return;const i=t?.id??null;return i===a.current||o.current?void 0:(o.current=!0,(async()=>{if(r.current){try{await Ss.trackEnd(r.current)}catch{}r.current=null}if(a.current=i,i)try{const u=await Ss.trackStart(i);r.current=u.accessId}catch{r.current=null}o.current=!1})(),()=>{if(r.current){const u=localStorage.getItem("token");if(!u)return;fetch(`${$n}/track/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify({accessId:r.current}),keepalive:!0}).catch(()=>{}),r.current=null,a.current=null}})},[t?.id,s])}function Dr(){return In(),null}const Dt=n.createContext(null);function Mr(){const t=n.useContext(Dt);if(!t)throw new Error("useSlotFill must be used within a SlotFillProvider");return t}function Fr({children:t,initialFills:s}){const r=n.useMemo(()=>{const o=new Map;return s&&Object.entries(s).forEach(([c,i])=>{const d=o.get(c)||[];Array.isArray(i)?o.set(c,[...d,...i]):o.set(c,[...d,i])}),o},[s]),a=n.useMemo(()=>({fills:r,registerFill:(o,c)=>{const i=r.get(o)||[];r.set(o,[...i,c])},unregisterFill:(o,c)=>{const i=r.get(o)||[];r.set(o,i.filter(d=>d!==c))},getSlotContent:o=>r.get(o)||[]}),[r]);return e.jsx(Dt.Provider,{value:a,children:t})}function Or({name:t,context:s={},children:r,fallback:a,wrapper:o}){const i=n.useContext(Dt)?.getSlotContent(t)||[],d=n.useMemo(()=>({slotName:t,context:s}),[t,s]),u=n.useMemo(()=>i.length===0?a||null:i.map((m,f)=>{const h=`${t}-${f}`;return e.jsx(n.Fragment,{children:Br(m,d)},h)}),[i,t,d,a]),x=e.jsxs(e.Fragment,{children:[u,r]});return o?e.jsx(o,{children:x}):e.jsx(e.Fragment,{children:x})}function Ur({slot:t,children:s}){const{registerFill:r,unregisterFill:a}=Mr();return n.useMemo(()=>(r(t,s),()=>a(t,s)),[t,s,r,a]),null}function Br(t,s){if(t==null)return null;if(Array.isArray(t))return e.jsx(e.Fragment,{children:t.map((r,a)=>e.jsx(n.Fragment,{children:Br(r,s)},`slot-item-${a}`))});if(n.isValidElement(t))return t;if(typeof t=="function"){const r=t;return e.jsx(r,{...s})}return t}function Ln(t){return(n.useContext(Dt)?.getSlotContent(t)?.length||0)>0}function Dn(t){function s(a){return e.jsx(Or,{...a,name:t})}s.displayName=`Slot(${t})`;function r({children:a}){return e.jsx(Ur,{slot:t,children:a})}return r.displayName=`Fill(${t})`,{Slot:s,Fill:r,slotName:t}}const _r=n.createContext(null);function Ct(){const t=n.useContext(_r);return t||{config:{},getPage:()=>{},getSlotContent:()=>{},getTableColumns:()=>[],getFormFields:()=>[],hasExtension:()=>!1}}function Mt(t){const{getPage:s}=Ct();return s(t)}function Mn(t){const{getTableColumns:s}=Ct();return s(t)}function Fn(t){const{getFormFields:s}=Ct();return s(t)}function On(t){const{hasExtension:s}=Ct();return s(t)}function qr({config:t={},children:s}){const r=n.useMemo(()=>{const{pages:a={},slots:o={},tableColumns:c={},formFields:i={}}=t;return{config:t,getPage:d=>a[d],getSlotContent:d=>o[d],getTableColumns:d=>c[d]||[],getFormFields:d=>i[d]||[],hasExtension:d=>d in a||d in o||d in c||d in i}},[t]);return e.jsx(_r.Provider,{value:r,children:e.jsx(Fr,{initialFills:t.slots,children:s})})}const Un=n.createContext(null);function Bn({config:t,children:s}){typeof window<"u"&&(window.__SMARTSTACK_CONFIG__=t);const r=n.useMemo(()=>({config:t}),[t]);return e.jsx(Un.Provider,{value:r,children:e.jsx(Tr,{children:e.jsx(qr,{config:t.extensions,children:e.jsx(ur,{children:e.jsx(dn,{children:e.jsx(xr,{children:e.jsx(hr,{children:e.jsx(xn,{children:e.jsx(ms,{children:e.jsx(Sr,{children:e.jsx(br,{children:e.jsx(jr,{children:e.jsx(Rr,{children:e.jsxs(yn,{children:[e.jsx(Lr,{}),e.jsx(Dr,{}),s]})})})})})})})})})})})})})})}class _n{pages=new Map;register(s,r,a=[]){this.pages.set(s,{key:s,defaultComponent:r,slots:a})}get(s){return this.pages.get(s)}resolve(s){return this.pages.get(s)?.defaultComponent}getAll(){return Array.from(this.pages.values())}has(s){return this.pages.has(s)}getSlots(s){return this.pages.get(s)?.slots||[]}keys(){return Array.from(this.pages.keys())}}const Te=new _n;function qn(t,s){function r(a){const o=Mt(t);return o?e.jsx(o,{...a}):e.jsx(s,{...a})}return r.displayName=`Overridable(${t})`,r}function zn(t){const s=Mt(t),r=Te.get(t);return s||r?.defaultComponent}function Gn({pageKey:t,defaultComponent:s,params:r}){const a=Mt(t),o={pageKey:t,params:r};return a?e.jsx(a,{...o}):e.jsx(s,{...o})}const Kn={ADMIN_INDEX:"administration",ADMIN_DASHBOARD:"administration.dashboard",USERS_LIST:"administration.users",USERS_DETAIL:"administration.users.detail",USERS_DASHBOARD:"administration.users.dashboard",USERS_GROUPS:"administration.users.groups",USERS_GROUPS_DETAIL:"administration.users.groups.detail",USERS_REFERENCES:"administration.users.references",ROLES_LIST:"administration.permissions.roles",ROLES_DETAIL:"administration.permissions.roles.detail",PERMISSIONS_LIST:"administration.permissions.permissions",PERMISSIONS_DETAIL:"administration.permissions.permissions.detail",ASSIGNMENTS:"administration.permissions.assignments",APPLICATIONS_INDEX:"administration.applications",APPLICATIONS_DASHBOARD:"administration.applications.dashboard",APPLICATIONS_LIST:"administration.applications.list",APPLICATIONS_DETAIL:"administration.applications.detail",AI_DASHBOARD:"administration.ai.dashboard",AI_SETTINGS:"administration.ai.settings",AI_SKILLS_LIST:"administration.ai.skills",AI_SKILLS_DETAIL:"administration.ai.skills.detail",AI_SKILLS_CREATE:"administration.ai.skills.create",AI_SKILLS_EDIT:"administration.ai.skills.edit",AI_BLOCKS_LIST:"administration.ai.skills.blocks",AI_BLOCKS_DETAIL:"administration.ai.skills.blocks.detail",AI_BLOCKS_CREATE:"administration.ai.skills.blocks.create",AI_BLOCKS_EDIT:"administration.ai.skills.blocks.edit",AI_MONITORING:"administration.ai.monitoring",AI_AGENTS:"administration.ai.agents",AI_AGENTS_DETAIL:"administration.ai.agents.detail",AI_AGENTS_EDIT:"administration.ai.agents.edit",WORKFLOWS_LIST:"administration.workflows.list",WORKFLOWS_DETAIL:"administration.workflows.detail",WORKFLOWS_CREATE:"administration.workflows.create",WORKFLOWS_EDIT:"administration.workflows.edit",WORKFLOWS_TRIGGERS:"administration.workflows.triggers",WORKFLOWS_HISTORY:"administration.workflows.history",EMAIL_TEMPLATES_LIST:"administration.workflows.email-templates",EMAIL_TEMPLATES_DETAIL:"administration.workflows.email-templates.detail",EMAIL_TEMPLATES_CREATE:"administration.workflows.email-templates.create",EMAIL_TEMPLATES_EDIT:"administration.workflows.email-templates.edit",SMS_TEMPLATES_LIST:"administration.workflows.email-templates.sms",ENTRA_DASHBOARD:"administration.entra.dashboard",ENTRA_GROUPS:"administration.entra.groups",ENTRA_USERS:"administration.entra.users",ENTRA_CONFLICTS:"administration.entra.conflicts",ENTRA_SETTINGS:"administration.entra.settings",TENANTS_DASHBOARD:"administration.tenants.dashboard",TENANTS_LIST:"administration.tenants.list",TENANTS_DETAIL:"administration.tenants.detail",TENANTS_CREATE:"administration.tenants.create",TENANTS_SETTINGS:"administration.tenants.settings",TENANTS_TEMPLATE:"administration.tenants.template",TENANTS_TEMPLATE_CREATE:"administration.tenants.template.create",TENANTS_TEMPLATE_DETAIL:"administration.tenants.template.detail",TENANTS_BUSINESS:"administration.tenants.list.enterprise",TENANTS_PERSONAL:"administration.tenants.list.personal",TENANTS_OTHER:"administration.tenants.list.other",TENANTS_ACCESS_REQUESTS:"administration.tenants.access-requests",ORGANISATIONS_LIST:"administration.tenants.organisations",ORGANISATIONS_CREATE:"administration.tenants.organisations.create",ORGANISATIONS_DETAIL:"administration.tenants.organisations.detail",SETTINGS:"administration.configuration.settings",SETTINGS_GENERAL:"administration.configuration.settings.general",SETTINGS_FILE_UPLOAD:"administration.configuration.settings.file-upload",SETTINGS_LEGAL_FILE:"administration.configuration.settings.legal-file",APPSETTINGS:"administration.configuration.appsettings",APPSETTINGS_INFRASTRUCTURE:"administration.configuration.appsettings.infrastructure",APPSETTINGS_AUTHENTICATION:"administration.configuration.appsettings.authentication",APPSETTINGS_LOGGING:"administration.configuration.appsettings.logging",APPSETTINGS_EMAIL:"administration.configuration.appsettings.email",APPSETTINGS_ENTRA:"administration.configuration.appsettings.entra",LICENSE:"administration.configuration.license",API_ACCOUNTS_LIST:"api.accounts.list",API_ACCOUNTS_CREATE:"api.accounts.create",API_ACCOUNTS_DETAIL:"api.accounts.detail",API_CATALOG:"api.apis.catalog",API_CATALOG_DETAIL:"api.apis.catalog.detail",SUPPORT_DASHBOARD:"support.tickets",TICKETS_LIST:"support.tickets.list",TICKETS_DETAIL:"support.tickets.detail",TICKETS_ESCALATION:"support.tickets.escalation",TICKETS_NEW:"support.tickets.new",MY_TICKETS_LIST:"support.my-tickets",MY_TICKETS_DETAIL:"support.my-tickets.detail",MY_TICKETS_CREATE:"support.my-tickets.create",SUPPORT_SLA:"support.admin.sla",SUPPORT_TEMPLATES:"support.admin.templates",SUPPORT_PERMISSIONS:"support.admin.permissions",SUPPORT_ASSIGNMENT:"support.assignment",SUPPORT_ASSIGNMENT_SKILLS:"support.assignment.skills",SUPPORT_ASSIGNMENT_WORKLOAD:"support.assignment.workload",MYSPACE_DASHBOARD:"myspace.dashboard",USER_PROFILE:"myspace.profile",USER_PREFERENCES:"myspace.preferences",MYSPACE_TENANTS:"myspace.tenants.workspaces",MYSPACE_ACCESS_REQUESTS:"myspace.tenants.access-requests",MYSPACE_PORTAL:"myspace.portal",NOTIFICATIONS:"notifications",APPLICATIONS_HUB:"applications"},zr="smartstack-doc-panel-size",Gr=n.createContext(void 0);function Hn(){if(typeof window>"u")return 33;try{const t=localStorage.getItem(zr);if(t){const s=parseFloat(t);if(s>=20&&s<=60)return s}}catch{}return 33}const Cs={"administration/users":"/docs/business/administration/users","administration/users/dashboard":"/docs/business/administration/users","administration/users/list":"/docs/business/administration/users","administration/users/create":"/docs/business/administration/users","administration/users/groups":"/docs/business/administration/users/groups","administration/users/references":"/docs/business/administration/users/references","administration/permissions":"/docs/business/administration/permissions","administration/permissions/roles":"/docs/business/administration/permissions","administration/permissions/permissions":"/docs/business/administration/permissions","administration/permissions/assignments":"/docs/business/administration/permissions/assignments","administration/applications":"/docs/business/administration/applications","administration/applications/list":"/docs/business/administration/applications","administration/applications/grid":"/docs/business/administration/applications","administration/applications/dashboard":"/docs/business/administration/applications","administration/tenants":"/docs/business/administration/tenants","administration/tenants/dashboard":"/docs/business/administration/tenants","administration/tenants/create":"/docs/business/administration/tenants","administration/tenants/list":"/docs/business/administration/tenants/business","administration/tenants/list/enterprise":"/docs/business/administration/tenants/business","administration/tenants/list/personal":"/docs/business/administration/tenants/personal","administration/tenants/list/other":"/docs/business/administration/tenants/other","administration/tenants/template":"/docs/business/administration/tenants/template","administration/tenants/business":"/docs/business/administration/tenants/business","administration/tenants/personal":"/docs/business/administration/tenants","administration/tenants/organisations":"/docs/business/administration/tenants/organisations","administration/tenants/organisations/create":"/docs/business/administration/tenants/organisations","administration/tenants/access-requests":"/docs/business/administration/tenants/access-requests","administration/tenants/applications":"/docs/business/administration/tenants/applications","administration/workflows":"/docs/business/administration/workflows","administration/workflows/list":"/docs/business/administration/workflows","administration/workflows/create":"/docs/business/administration/workflows","administration/workflows/triggers":"/docs/business/administration/workflows","administration/workflows/history":"/docs/business/administration/workflows","administration/workflows/email-templates":"/docs/business/administration/workflows","administration/workflows/email-templates/email":"/docs/business/administration/workflows","administration/workflows/email-templates/sms":"/docs/business/administration/workflows","administration/workflows/email-templates/create":"/docs/business/administration/workflows","administration/ai":"/docs/business/administration/ai","administration/ai/dashboard":"/docs/business/administration/ai","administration/ai/settings":"/docs/business/administration/ai","administration/ai/providers":"/docs/business/administration/ai","administration/ai/models":"/docs/business/administration/ai","administration/ai/prompts":"/docs/business/administration/ai","administration/ai/blocks":"/docs/business/administration/ai","administration/entra":"/docs/business/administration/entra","administration/entra/dashboard":"/docs/business/administration/entra","administration/entra/groups":"/docs/business/administration/entra","administration/entra/users":"/docs/business/administration/entra","administration/entra/conflicts":"/docs/business/administration/entra","administration/entra/settings":"/docs/business/administration/entra","administration/configuration":"/docs/business/administration/configuration","administration/configuration/settings":"/docs/business/administration/configuration","administration/configuration/appsettings":"/docs/business/administration/configuration","administration/configuration/license":"/docs/business/administration/configuration/license","support/tickets":"/system/docs/user/support-dashboard","support/tickets/list":"/docs/business/platform/support/tickets","support/tickets/escalation":"/system/docs/user/support-escalation","support/my-tickets":"/docs/business/platform/support/tickets","support/my-tickets/list":"/docs/business/platform/support/tickets","support/my-tickets/create":"/docs/business/platform/support/tickets","support/admin/sla":"/system/docs/user/support-sla","support/admin/templates":"/system/docs/user/support-templates","myspace/profile":"/system/docs/user/modules","myspace/preferences":"/system/docs/user/modules","myspace/tenants":"/system/docs/user/modules","myspace/portal":"/system/docs/user/modules"},ks={administration:"/docs/business/administration/users",support:"/system/docs/user/support-dashboard",myspace:"/system/docs/user/modules"};function As(t){const s=t.split("/").filter(Boolean),a=s[0]==="t"&&s.length>=3?2:0,o=s.slice(a),c=o[0],i=o.slice(1);if(i.length>0)for(let d=i.length;d>0;d--){const u=`${c}/${i.slice(0,d).join("/")}`;if(Cs[u])return Cs[u]}return c&&ks[c]?ks[c]:"/system/docs/user"}function Kr({children:t}){const[s,r]=n.useState(!1),[a,o]=n.useState(Hn),[c,i]=n.useState(null),d=N.useLocation(),u=n.useRef(d.pathname);n.useEffect(()=>{u.current!==d.pathname&&(u.current=d.pathname,r(!1))},[d.pathname]),n.useEffect(()=>{a>=20&&a<=60&&localStorage.setItem(zr,String(a))},[a]);const x=n.useCallback(v=>{const g=v||As(d.pathname);i(g),r(!0)},[d.pathname]),m=n.useCallback(()=>{r(!1)},[]),f=n.useCallback(()=>{if(s)r(!1);else{const v=As(d.pathname);i(v),r(!0)}},[s,d.pathname]),h=n.useCallback(v=>{v>=20&&v<=60&&o(v)},[]);return e.jsx(Gr.Provider,{value:{isOpen:s,panelSize:a,docUrl:c,openDocPanel:x,closeDocPanel:m,toggleDocPanel:f,setPanelSize:h},children:t})}function Ft(){const t=n.useContext(Gr);if(t===void 0)throw new Error("useDocPanel must be used within a DocPanelProvider");return t}class Vn{captureBrowserInfo(){const s=navigator.userAgent;return{browser:this.getBrowserName(s),browserVersion:this.getBrowserVersion(s),os:this.getOSName(s),osVersion:this.getOSVersion(s),language:navigator.language,screenResolution:`${window.screen.width}x${window.screen.height}`,deviceType:this.getDeviceType(s)}}getBrowserName(s){return s.includes("Firefox")?"Firefox":s.includes("Edg/")?"Microsoft Edge":s.includes("Chrome")&&!s.includes("Edg/")?"Google Chrome":s.includes("Safari")&&!s.includes("Chrome")?"Safari":s.includes("Opera")||s.includes("OPR/")?"Opera":s.includes("MSIE")||s.includes("Trident/")?"Internet Explorer":"Unknown Browser"}getBrowserVersion(s){let r=null;return s.includes("Firefox")?r=s.match(/Firefox\/(\d+(?:\.\d+)*)/):s.includes("Edg/")?r=s.match(/Edg\/(\d+(?:\.\d+)*)/):s.includes("Chrome")&&!s.includes("Edg/")?r=s.match(/Chrome\/(\d+(?:\.\d+)*)/):s.includes("Safari")&&!s.includes("Chrome")?r=s.match(/Version\/(\d+(?:\.\d+)*)/):s.includes("OPR/")&&(r=s.match(/OPR\/(\d+(?:\.\d+)*)/)),r?r[1]:"Unknown"}getOSName(s){return s.includes("Windows NT 10")?"Windows 10/11":s.includes("Windows NT 6.3")?"Windows 8.1":s.includes("Windows NT 6.2")?"Windows 8":s.includes("Windows NT 6.1")?"Windows 7":s.includes("Windows")?"Windows":s.includes("Mac OS X")?"macOS":s.includes("Linux")&&s.includes("Android")?"Android":s.includes("Linux")?"Linux":s.includes("iPhone")||s.includes("iPad")?"iOS":s.includes("CrOS")?"Chrome OS":"Unknown OS"}getWindowsVersion(s){return s==="10.0"?"10/11":s==="6.3"?"8.1":s==="6.2"?"8":s==="6.1"?"7":s}getOSVersion(s){if(s.includes("Windows NT")){const r=s.match(/Windows NT (\d+\.\d+)/);if(r)return this.getWindowsVersion(r[1])}if(s.includes("Mac OS X")){const r=s.match(/Mac OS X (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}if(s.includes("Android")){const r=s.match(/Android (\d+(?:\.\d+)*)/);if(r)return r[1]}if(s.includes("iPhone OS")||s.includes("iPad")){const r=s.match(/(?:iPhone|iPad|CPU) OS (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}return"Unknown"}getDeviceType(s){return/Tablet|iPad/i.test(s)?"Tablet":/Mobile|iPhone|Android.*Mobile/i.test(s)?"Mobile":"Desktop"}formatForDescription(s){return[`Browser: ${s.browser} ${s.browserVersion}`,`OS: ${s.os} ${s.osVersion}`,`Device: ${s.deviceType}`,`Screen: ${s.screenResolution}`,`Language: ${s.language}`].join(`
2
- `)}}const Wn=new Vn;function Xn(){return{captureContext:n.useCallback(()=>{const s=Wn.captureBrowserInfo(),r=Pe.getRecentErrors().slice(0,5);return{sourceUrl:window.location.href,browser:{name:s.browser,version:s.browserVersion,language:s.language},os:{name:s.os,version:s.osVersion},device:{type:s.deviceType,screenResolution:s.screenResolution},recentErrors:r.map(a=>({message:a.message,stack:a.stack,component:a.component,timestamp:a.timestamp.toISOString()}))}},[])}}function Yn(){const[t,s]=n.useState(new Set),[r,a]=n.useState(new Set),o=n.useCallback(m=>{s(f=>{const h=new Set(f);return h.has(m)?h.delete(m):h.add(m),h})},[]),c=n.useCallback(m=>{a(f=>{const h=new Set(f);return h.has(m)?h.delete(m):h.add(m),h})},[]),i=n.useCallback(()=>{s(new Set),a(new Set)},[]),d=n.useCallback((m,f)=>{s(new Set(m)),a(new Set(f))},[]),u=n.useCallback(m=>t.has(m),[t]),x=n.useCallback(m=>r.has(m),[r]);return{collapsedContexts:t,collapsedApps:r,toggleContext:o,toggleApp:c,expandAll:i,collapseAll:d,isContextCollapsed:u,isAppCollapsed:x}}function Jn(t={}){const{canEditSystemRoles:s=!1}=t,{t:r,i18n:a}=ne.useTranslation("admin"),[o,c]=n.useState(!0),[i,d]=n.useState(null),[u,x]=n.useState(null),[m,f]=n.useState(!1),[h,v]=n.useState(!1),[g,y]=n.useState([]),[p,b]=n.useState([]),[j,S]=n.useState(new Map),[w,P]=n.useState({}),[$,A]=n.useState({}),[k,R]=n.useState({}),[L,I]=n.useState({selectedRoleIds:[],resourceSearch:"",applicationFilter:"all",moduleFilter:"all",categoryFilter:"all"}),C=n.useRef(null),O=n.useRef(new Map),_=n.useCallback((B,H,X)=>{const se=B.has(X),ee=H.get(X);if(!ee)return{isDirect:se,isInherited:!1};const ue=ee.path.toLowerCase();let ae,ve,be=1/0;for(const Me of Array.from(B)){const Le=H.get(Me);if(!Le||Me===X)continue;const Fe=Le.path.toLowerCase();if((Le.isWildcard||Fe.endsWith(".*"))&&ds(Fe,ue)){const He=Fe.split(".").length;He<be&&(be=He,ae=Le.path,ve=Le.id)}}return{isDirect:se,isInherited:ae!==void 0,inheritedFromPath:ae,inheritedFromId:ve}},[]),E=n.useCallback((B,H)=>{const X={};return Object.entries(B).forEach(([se,ee])=>{const ue=new Map;H.forEach((ae,ve)=>{const be=_(ee,H,ve);ue.set(ve,be)}),X[se]=ue}),X},[_]),z=(B,H,X,se)=>{const ee=[],ue=[];return B.resources.forEach(ae=>{const ve=ae.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),be=se.get(ve)||[],$e={id:ae.id,path:ae.permissionPath,label:ae.label,applicationLabel:X.label,moduleLabel:ae.label,parentModuleLabel:H.label,parentModuleId:H.id,parentSectionLabel:B.label,parentSectionId:B.id,level:"resource",permissions:be,totalPermissions:be.length};ee.push($e),ue.push($e)}),{childResources:ee,nodes:ue}},W=(B,H,X)=>{const se=[],ee=[];return B.sections.forEach(ue=>{const ae=ue.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ve=X.get(ae)||[],{childResources:be,nodes:$e}=z(ue,B,H,X),Me=be.reduce((Qe,He)=>Qe+He.totalPermissions,0),Le=ve.length+Me,Fe={id:ue.id,path:ue.permissionPath,label:ue.label,applicationLabel:H.label,moduleLabel:ue.label,parentModuleLabel:B.label,parentModuleId:B.id,level:"section",permissions:ve,totalPermissions:Le,childResources:be.length>0?be:void 0};se.push(Fe),ee.push(Fe),ee.push(...$e)}),{childSections:se,nodes:ee}},G=(B,H,X,se)=>{const ee=B.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ue=X.get(ee)||[],{childSections:ae,nodes:ve}=W(B,H,X),be=ae.reduce((Me,Le)=>Me+Le.totalPermissions,0),$e=ue.length+be;se.push({id:B.id,path:B.permissionPath,label:B.label,applicationLabel:H.label,moduleLabel:B.label,level:"module",permissions:ue,totalPermissions:$e,childSections:ae.length>0?ae:void 0}),se.push(...ve)},J=(B,H,X)=>{B.modules.forEach(se=>{G(se,B,H,X)})},pe=n.useCallback((B,H)=>{const X=[];if(!B||!B.applications||!H||!Array.isArray(H))return X;const se=new Map;return H.forEach(ee=>{const ae=ee.path.toLowerCase().split(".");if(ae.length>=2){const ve=ae.slice(0,-1).join("."),be=se.get(ve)||[];be.push({id:ee.id,action:ae[ae.length-1],path:ee.path}),se.set(ve,be)}}),B.applications.forEach(ee=>{J(ee,se,X)}),X.sort((ee,ue)=>{const ae=ee.applicationLabel.localeCompare(ue.applicationLabel);return ae!==0?ae:ee.moduleLabel.localeCompare(ue.moduleLabel)})},[]),q=n.useCallback(async()=>{try{c(!0),d(null);const B=await je.permissions.getMatrix(),H={};B.roles.forEach(ae=>{H[ae.id]=new Set(ae.permissionIds)});const X=new Map(B.permissions.map(ae=>[ae.id,ae])),se=pe(B.tree,B.permissions),ee=E(H,X);y(B.roles),b(se),S(X),P(H),R(ee);const ue=Object.entries(H).reduce((ae,[ve,be])=>(ae[ve]=new Set(Array.from(be)),ae),{});A(ue),O.current.clear()}catch(B){d(B instanceof Error?B.message:"Failed to load permission matrix data")}finally{c(!1)}},[pe,E]);n.useEffect(()=>{q()},[q,a.language]),n.useEffect(()=>{if(j.size>0){const B=E(w,j);R(B)}},[w,j,E]);const Y=n.useCallback(async()=>{if(O.current.size===0)return;const B=new Map(O.current);O.current.clear(),f(!0),x(null);try{const H=Array.from(B.entries()).map(async([ee,ue])=>{const ae=g.find(ve=>ve.id===ee);ae&&await je.roles.update(ee,{name:ae.name,shortName:ae.shortName,category:ae.category,description:ae.description||void 0,permissionIds:Array.from(ue)})});await Promise.all(H);const X=JSON.parse(JSON.stringify(Object.fromEntries(Object.entries(w).map(([ee,ue])=>[ee,Array.from(ue)])))),se=Object.entries(X).reduce((ee,[ue,ae])=>(ee[ue]=new Set(ae),ee),{});A(se),v(!0),setTimeout(()=>{v(!1)},3e3)}catch(H){console.error("Failed to save permission changes:",H);let X="Failed to save changes";if(H&&typeof H=="object"&&"response"in H){const se=H.response;se?.status===403?X=r("assignments.noPermissionToEditRole"):se?.data?.message&&(X=se.data.message)}else H instanceof Error&&(X=H.message);x(X),await q()}finally{f(!1)}},[g,w,q]),M=n.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{Y()},500)},[Y]),te=n.useCallback((B,H)=>{g.find(se=>se.id===B)?.isSystem&&!s||P(se=>{const ee=new Set(se[B]||[]);return ee.has(H)?ee.delete(H):ee.add(H),O.current.set(B,ee),M(),{...se,[B]:ee}})},[g,s,M]),oe=B=>{p.forEach(H=>{H.permissions.forEach(X=>{B.add(X.id)})})},le=n.useCallback((B,H)=>{g.find(se=>se.id===B)?.isSystem&&!s||P(se=>{const ee=new Set;return H&&oe(ee),O.current.set(B,ee),M(),{...se,[B]:ee}})},[g,s,p,M]),F=(B,H,X)=>{H.permissions.forEach(se=>{X?B.add(se.id):B.delete(se.id)})},K=n.useCallback((B,H)=>{P(X=>{const se={...X};return g.forEach(ee=>{if(ee.isSystem&&!s)return;const ue=new Set(se[ee.id]||[]);F(ue,B,H),se[ee.id]=ue,O.current.set(ee.id,ue)}),M(),se})},[g,s,M]),Q=n.useCallback(B=>{I(H=>({...H,...B}))},[]),U=n.useCallback(()=>{const B=Object.entries($).reduce((H,[X,se])=>(H[X]=new Set(Array.from(se)),H),{});P(B),O.current.clear(),C.current&&clearTimeout(C.current)},[$]),Z=n.useMemo(()=>g.filter(B=>L.selectedRoleIds.length===0?!0:L.selectedRoleIds.includes(B.id)),[g,L.selectedRoleIds]),re=n.useMemo(()=>p.filter(B=>!(L.resourceSearch&&!B.moduleLabel.toLowerCase().includes(L.resourceSearch.toLowerCase())||L.applicationFilter!=="all"&&B.applicationLabel!==L.applicationFilter||L.moduleFilter!=="all"&&B.moduleLabel!==L.moduleFilter)),[p,L]),de=n.useMemo(()=>Array.from(Object.entries(w)).some(([B,H])=>{const X=$[B];return X?H.size!==X.size?!0:Array.from(H).some(se=>!X.has(se)):H.size>0}),[w,$]),he=n.useMemo(()=>{const B=new Map;return p.forEach(H=>{B.has(H.applicationLabel)||B.set(H.applicationLabel,{app:H.applicationLabel,label:H.applicationLabel})}),Array.from(B.values()).sort((H,X)=>H.label.localeCompare(X.label))},[p]),fe=n.useMemo(()=>p.filter(B=>B.level==="module").map(B=>({app:B.applicationLabel,module:B.label,label:B.label})).sort((B,H)=>B.label.localeCompare(H.label)),[p]),Ne=n.useMemo(()=>{const B=new Set(g.map(X=>X.category));return["Global","Admin","Manager","Contributor","Viewer","Custom"].filter(X=>B.has(X))},[g]),Be=n.useCallback((B,H)=>{const X=k[B];return X?X.get(H)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[k]),Ke=n.useCallback(()=>{x(null)},[]);return{loading:o,error:i,saveError:u,saving:m,saveSuccess:h,roles:g,resources:p,permissions:j,assignments:w,inheritanceMap:k,filters:L,filteredRoles:Z,filteredResources:re,hasChanges:de,canEditSystemRoles:s,applications:he,modules:fe,categories:Ne,togglePermission:te,toggleAllForRole:le,toggleAllForResource:K,updateFilters:Q,reloadData:q,resetChanges:U,saveChanges:Y,clearSaveError:Ke,getPermissionInheritance:Be}}function Hr(t={}){const s=n.useRef(null),[r,a]=n.useState(ie.HubConnectionState.Disconnected),o=n.useRef(t);o.current=t;const c=n.useCallback(()=>localStorage.getItem("token"),[]),i=n.useCallback(async()=>{const u=c();if(u&&s.current?.state!==ie.HubConnectionState.Connected)try{const x=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>u}).withAutomaticReconnect({nextRetryDelayInMilliseconds:m=>m.previousRetryCount===0?0:m.previousRetryCount===1?2e3:m.previousRetryCount===2?1e4:m.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();x.on("ReceiveNotification",m=>{o.current.onNotification?.(m)}),x.on("UnreadCountUpdate",m=>{o.current.onUnreadCountUpdate?.(m)}),x.on("PermissionsChanged",()=>{o.current.onPermissionsChanged?.()}),x.onreconnecting(()=>{a(ie.HubConnectionState.Reconnecting),o.current.onConnectionStateChange?.(ie.HubConnectionState.Reconnecting)}),x.onreconnected(()=>{a(ie.HubConnectionState.Connected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Connected)}),x.onclose(()=>{a(ie.HubConnectionState.Disconnected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Disconnected)}),await x.start(),s.current=x,a(ie.HubConnectionState.Connected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Connected)}catch(x){console.error("SignalR: Failed to connect",x),a(ie.HubConnectionState.Disconnected)}},[c]),d=n.useCallback(async()=>{if(s.current)try{await s.current.stop(),s.current=null,a(ie.HubConnectionState.Disconnected)}catch(u){console.error("SignalR: Failed to disconnect",u)}},[]);return n.useEffect(()=>(i(),()=>{d()}),[i,d]),n.useEffect(()=>{const u=x=>{x.key==="token"&&(x.newValue?i():d())};return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[i,d]),{connectionState:r,isConnected:r===ie.HubConnectionState.Connected,connect:i,disconnect:d}}function Qn(){const{refreshPermissions:t,user:s}=Ae(),{refreshMenu:r}=Re(),a=n.useRef(!1),o=n.useCallback(async()=>{if(!a.current){a.current=!0;try{await Promise.all([t(),r()])}catch(d){console.error("[PermissionSync] Failed to refresh permissions:",d)}finally{a.current=!1}}},[t,r]),{isConnected:c,connectionState:i}=Hr({onPermissionsChanged:o});return{isConnected:c,connectionState:i,isAuthenticated:!!s}}function Vr(t){const{ticketId:s,onCommentAdded:r,onTicketUpdated:a,onConnectionStateChange:o}=t,c=n.useRef(null),i=n.useRef(null),[d,u]=n.useState(ie.HubConnectionState.Disconnected),x=n.useCallback(()=>localStorage.getItem("token"),[]),m=n.useCallback(async g=>{if(c.current?.state===ie.HubConnectionState.Connected)try{await c.current.invoke("JoinTicket",g),i.current=g}catch(y){console.error("SignalR: Failed to join ticket group",y)}},[]),f=n.useCallback(async g=>{if(c.current?.state===ie.HubConnectionState.Connected)try{await c.current.invoke("LeaveTicket",g)}catch(y){console.error("SignalR: Failed to leave ticket group",y)}i.current=null},[]),h=n.useCallback(async()=>{const g=x();if(g){if(c.current?.state===ie.HubConnectionState.Connected)return c.current;try{const y=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>g}).withAutomaticReconnect({nextRetryDelayInMilliseconds:p=>p.previousRetryCount===0?0:p.previousRetryCount===1?2e3:p.previousRetryCount===2?1e4:p.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();return y.on("TicketCommentAdded",p=>{r?.(p)}),y.on("TicketUpdated",p=>{a?.(p)}),y.onreconnecting(()=>{u(ie.HubConnectionState.Reconnecting),o?.(ie.HubConnectionState.Reconnecting)}),y.onreconnected(async()=>{u(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),i.current&&await m(i.current)}),y.onclose(()=>{u(ie.HubConnectionState.Disconnected),o?.(ie.HubConnectionState.Disconnected)}),await y.start(),c.current=y,u(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),y}catch(y){return console.error("SignalR: Failed to connect",y),u(ie.HubConnectionState.Disconnected),null}}},[x,m,r,a,o]),v=n.useCallback(async()=>{if(i.current&&await f(i.current),c.current)try{await c.current.stop(),c.current=null,u(ie.HubConnectionState.Disconnected)}catch(g){console.error("SignalR: Failed to disconnect",g)}},[f]);return n.useEffect(()=>{let g=!0;return(async()=>(await h(),g&&s&&await m(s)))(),()=>{g=!1,v()}},[h,v,s,m]),n.useEffect(()=>{const g=async()=>{i.current&&i.current!==s&&await f(i.current),s&&s!==i.current&&await m(s)};c.current?.state===ie.HubConnectionState.Connected&&g()},[s,m,f]),{connectionState:d,isConnected:d===ie.HubConnectionState.Connected,joinTicket:m,leaveTicket:f}}function Zn(t,s,r,a){const o=[];for(const c of a.resources)c.route&&o.push({componentKey:c.componentKey,permissionPath:c.permissionPath,route:c.route,hasComponent:Te.has(c.componentKey),requiredFeature:r,isOpen:s,level:"resource",applicationCode:t});return o}function eo(t,s,r,a){const o=[];for(const c of a.sections)c.route&&o.push({componentKey:c.componentKey,permissionPath:c.permissionPath,route:c.route,hasComponent:Te.has(c.componentKey),requiredFeature:r,isOpen:s,level:"section",applicationCode:t}),o.push(...Zn(t,s,r,c));return o}function to(t,s,r){const a=[];for(const o of r.modules)o.route&&a.push({componentKey:o.componentKey,permissionPath:o.permissionPath,route:o.route,hasComponent:Te.has(o.componentKey),requiredFeature:o.requiredFeature,isOpen:s,level:"module",applicationCode:t}),a.push(...eo(t,s,o.requiredFeature,o));return a}function so(t){const s=[];for(const r of t)r.route&&s.push({componentKey:r.componentKey,permissionPath:r.permissionPath,route:r.route,hasComponent:Te.has(r.componentKey),requiredFeature:r.requiredFeature,isOpen:r.isOpen,level:"application",applicationCode:r.code}),s.push(...to(r.code,r.isOpen,r));return s}function ro(){const{menu:t,isLoading:s}=Re();return n.useMemo(()=>{if(!t||s)return{entries:[],byKey:new Map,isLoading:!0,byApplication:new Map};const r=so(t.applications),a=new Map(r.map(c=>[c.componentKey,c])),o=new Map;for(const c of r){const i=o.get(c.applicationCode)||[];i.push(c),o.set(c.applicationCode,i)}return{entries:r,byKey:a,isLoading:!1,byApplication:o}},[t,s])}const ao=(t,s,r)=>{const a=t.has(r),o=s.get(r);if(!o)return{isDirect:a,isInherited:!1};const c=o.path;let i,d,u=1/0;for(const m of Array.from(t)){const f=s.get(m);if(!(!f||!f.isWildcard||m===r)&&ds(f.path,c)){const h=f.path.split(".").length;h<u&&(u=h,i=f.path,d=f.id)}}return{isDirect:a,isInherited:i!==void 0,inheritedFromPath:i,inheritedFromId:d}},Rs=(t,s)=>{const r={};return Object.entries(t).forEach(([a,o])=>{const c=new Map;s.forEach((i,d)=>{const u=ao(o,s,d);c.set(d,u)}),r[a]=c}),r},no=t=>{const s=new Map;return t.forEach(r=>{const o=r.path.toLowerCase().split(".");if(o.length>=2){const c=o.slice(0,-1).join("."),i=s.get(c)||[];i.push({id:r.id,action:o[o.length-1],path:r.path}),s.set(c,i)}}),s},Ut=(t,s)=>{const r=s.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,"");return t.get(r)||[]};function oo(t){const{entityId:s,tenantId:r,loadEntity:a,loadRoles:o}=t,{i18n:c}=ne.useTranslation(),[i,d]=n.useState(!0),[u,x]=n.useState(null),[m,f]=n.useState(null),[h,v]=n.useState([]),[g,y]=n.useState([]),[p,b]=n.useState(new Map),[j,S]=n.useState({}),[w,P]=n.useState({}),[$,A]=n.useState({selectedRoleIds:[],resourceSearch:"",contextFilter:"all",applicationFilter:"all",moduleFilter:"all"}),k=!!r,R=n.useCallback((F,K,Q,U)=>{const Z=Ut(U,K.permissionPath);F.push({id:K.id,path:K.permissionPath,label:K.label,contextLabel:Q.label,applicationLabel:Q.label,moduleLabel:K.label,level:"module",permissions:Z,totalPermissions:Z.length})},[]),L=n.useCallback((F,K,Q,U,Z)=>{const re=Ut(Z,K.permissionPath);K.resources.forEach(de=>{const he=Ut(Z,de.permissionPath);F.push({id:de.id,path:de.permissionPath,label:de.label,contextLabel:U.label,applicationLabel:U.label,moduleLabel:Q.label,parentModuleLabel:Q.label,parentModuleId:Q.id,parentSectionLabel:K.label,parentSectionId:K.id,level:"resource",permissions:he,totalPermissions:he.length})}),F.push({id:K.id,path:K.permissionPath,label:K.label,contextLabel:U.label,applicationLabel:U.label,moduleLabel:Q.label,parentModuleLabel:Q.label,parentModuleId:Q.id,level:"section",permissions:re,totalPermissions:re.length})},[]),I=n.useCallback((F,K,Q,U)=>{R(U,F,K,Q),F.sections.forEach(Z=>{L(U,Z,F,K,Q)})},[R,L]),C=n.useCallback((F,K,Q)=>{F.modules.forEach(U=>{I(U,F,K,Q)})},[I]),O=n.useCallback((F,K)=>{if(!F?.applications||!Array.isArray(K))return[];const Q=no(K),U=[];return F.applications.forEach(Z=>{C(Z,Q,U)}),U.sort((Z,re)=>{const de=Z.applicationLabel.localeCompare(re.applicationLabel);return de!==0?de:Z.moduleLabel.localeCompare(re.moduleLabel)})},[C]),_=n.useCallback(async()=>{try{d(!0),x(null);const[F,K,Q]=await Promise.all([a(s),o(s,r),je.permissions.getMatrix()]);f(F),v(K);const U=new Set(K.map(Ne=>Ne.id)),Z=Q.roles.filter(Ne=>U.has(Ne.id)),re={};Z.forEach(Ne=>{re[Ne.id]=new Set(Ne.permissionIds)});const de=new Map(Q.permissions.map(Ne=>[Ne.id,Ne])),he=O(Q.tree,Q.permissions),fe=Rs(re,de);y(he),b(de),S(re),P(fe)}catch(F){x(F instanceof Error?F.message:"Failed to load permissions data")}finally{d(!1)}},[s,r,a,o,O]);n.useEffect(()=>{_()},[_,c.language]),n.useEffect(()=>{if(p.size>0){const F=Rs(j,p);P(F)}},[j,p]);const E=n.useMemo(()=>{const F=new Set;return Object.entries(w).forEach(([K,Q])=>{Q.forEach((U,Z)=>{(U.isDirect||U.isInherited)&&F.add(Z)})}),F},[w]),z=F=>$.resourceSearch?F.label.toLowerCase().includes($.resourceSearch.toLowerCase()):!0,W=F=>$.contextFilter==="all"?!0:F.contextLabel===$.contextFilter,G=F=>$.applicationFilter==="all"?!0:F.applicationLabel===$.applicationFilter,J=F=>$.moduleFilter==="all"?!0:F.level==="module"?F.label===$.moduleFilter:F.parentModuleLabel===$.moduleFilter,pe=n.useMemo(()=>g.filter(F=>z(F)&&W(F)&&G(F)&&J(F)),[g,$]),q=n.useMemo(()=>{const F=new Set(g.map(K=>K.contextLabel??K.applicationLabel));return Array.from(F).sort((K,Q)=>K.localeCompare(Q))},[g]),Y=n.useMemo(()=>{const F=new Map;return g.forEach(K=>{const Q=K.contextLabel??K.applicationLabel,U=`${Q}:${K.applicationLabel}`;F.has(U)||F.set(U,{context:Q,app:K.applicationLabel,label:K.applicationLabel})}),Array.from(F.values()).sort((K,Q)=>K.label.localeCompare(Q.label))},[g]),M=n.useMemo(()=>g.filter(F=>F.level==="module").map(F=>({context:F.contextLabel??F.applicationLabel,app:F.applicationLabel,module:F.label,label:F.label})).sort((F,K)=>F.label.localeCompare(K.label)),[g]),te=n.useCallback(F=>{A(K=>({...K,...F}))},[]),oe=n.useCallback((F,K)=>{const Q=w[F];return Q?Q.get(K)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[w]),le=n.useCallback(F=>{const K=[];return h.forEach(Q=>{const U=w[Q.id];if(U){const Z=U.get(F);Z&&(Z.isDirect||Z.isInherited)&&K.push(Q)}}),K},[h,w]);return{loading:i,error:u,entity:m,roles:h,resources:g,assignments:j,inheritanceMap:w,effectivePermissions:E,filters:$,filteredResources:pe,contexts:q,applications:Y,modules:M,updateFilters:te,getPermissionInheritance:oe,getPermissionSources:le,reloadData:_,isTenantMode:k}}function io(t){const{userId:s,tenantId:r}=t,[a,o]=n.useState(null),[c,i]=n.useState([]),d=!!r,u=n.useCallback(async y=>je.users.getById(y),[]),x=n.useCallback(async(y,p)=>{const b=await je.users.getById(y);let j=[];try{const w=await je.users.getConsolidatedRoles(y,p);if(i(w),j=w.map(P=>({id:P.roleId,name:P.roleName,shortName:P.roleShortName||P.roleName,category:"Custom",description:null})),p)try{const $=(await je.tenants.getMembers(p)).find(A=>A.userId===y);o($||null)}catch{o(null)}else o(null)}catch{i([]),o(null),j=b.roles}return Array.from(new Map(j.map(w=>[w.id,w])).values())},[]),m=oo({entityId:s,tenantId:r,loadEntity:u,loadRoles:x}),f=m.entity,h=m.roles,v=n.useCallback(y=>{const p=[];return h.forEach(b=>{const j=m.inheritanceMap[b.id];if(j){const S=j.get(y);S&&(S.isDirect||S.isInherited)&&p.push(b)}}),p},[h,m.inheritanceMap]),g=n.useCallback(async y=>{if(!d||!r||!a)throw new Error("Cannot assign tenant roles: not in tenant mode or no tenant member found");await je.tenants.assignMemberRoles(r,a.userId,y),await m.reloadData()},[d,r,a,m]);return{loading:m.loading,error:m.error,user:f,userRoles:h,resources:m.resources,assignments:m.assignments,inheritanceMap:m.inheritanceMap,effectivePermissions:m.effectivePermissions,filters:m.filters,filteredResources:m.filteredResources,contexts:m.contexts,applications:m.applications,modules:m.modules,updateFilters:m.updateFilters,getPermissionInheritance:m.getPermissionInheritance,getPermissionSources:v,reloadData:m.reloadData,isTenantMode:d,tenantMember:a,assignTenantRoles:g,consolidatedRoles:c}}function Ot(){const{mode:t,toggleMode:s}=St(),a=(t==="dark"?"dark":"light")==="light";return e.jsx("button",{onClick:s,className:"relative p-2 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-300 group",style:{borderRadius:"var(--radius-button)"},"aria-label":`Basculer vers le mode ${a?"sombre":"clair"}`,children:e.jsxs("div",{className:"relative w-6 h-6",children:[e.jsx(l.Sun,{className:`absolute inset-0 w-6 h-6 text-amber-500 transition-all duration-300 ${a?"opacity-100 rotate-0 scale-100":"opacity-0 rotate-90 scale-0"}`}),e.jsx(l.Moon,{className:`absolute inset-0 w-6 h-6 text-[var(--color-accent-400)] transition-all duration-300 ${a?"opacity-0 -rotate-90 scale-0":"opacity-100 rotate-0 scale-100"}`})]})})}const Bt=[{code:"en",label:"English",short:"EN"},{code:"fr",label:"Français",short:"FR"},{code:"de",label:"Deutsch",short:"DE"},{code:"it",label:"Italiano",short:"IT"}];function ps(){const{i18n:t}=ne.useTranslation(),{isAuthenticated:s}=Ae(),[r,a]=n.useState(!1),o=n.useRef(null),c=t.language?.split("-")[0]||"en",i=Bt.find(u=>u.code===c)||Bt[0],d=async u=>{if(await ls(u),document.documentElement.lang=u,a(!1),s)try{await It.preferences.updateLanguage({language:u})}catch{}};return n.useEffect(()=>{const u=x=>{o.current&&!o.current.contains(x.target)&&a(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]),e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("button",{onClick:()=>a(!r),className:"relative p-2 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-300",style:{borderRadius:"var(--radius-button)"},"aria-label":"Change language",children:e.jsx("span",{className:"flex items-center justify-center w-6 h-6 text-xs font-bold text-[var(--text-secondary)]",children:i.short})}),r&&e.jsx("div",{className:"absolute right-0 mt-2 py-1 bg-[var(--bg-tertiary)] border border-[var(--border-color)] shadow-lg shadow-[var(--shadow-color)] z-50 overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:Bt.map(u=>{const x=u.code===c;return e.jsxs("button",{onClick:()=>d(u.code),className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors whitespace-nowrap ${x?"bg-primary-600/10 text-primary-500":"text-[var(--text-secondary)] hover:bg-[var(--bg-secondary)] hover:text-[var(--text-primary)]"}`,children:[e.jsx("span",{className:"text-xs font-bold w-6",children:u.short}),e.jsx("span",{className:"text-sm font-medium",children:u.label}),x&&e.jsx(l.Check,{className:"w-4 h-4 ml-auto text-primary-500"})]},u.code)})})]})}function lo(t,s){if(!s.useUrlRouting||!s.slug)return ct(t);if(t.startsWith(`/t/${s.slug}`))return t;const r=ct(t);return`/t/${s.slug}${r}`}function Ps(t){const s=t.match(/^\/t\/([^/]+)/);return s?s[1]:null}function ct(t){return t.replace(/^\/t\/[^/]+/,"")||"/"}function et(){const{currentTenant:t}=Ee(),{useUrlRouting:s}=cs();return n.useCallback(r=>lo(r,{slug:t?.slug,useUrlRouting:s}),[t?.slug,s])}const Ts={background:"linear-gradient(to bottom right, var(--color-accent-500), var(--color-accent-600))"};function Wr(){const{t}=ne.useTranslation("navigation"),{user:s,logout:r}=Ae(),{refreshMenu:a}=Re(),{refreshTenants:o}=Ee(),c=N.useLocation(),i=N.useNavigate(),d=et(),[u,x]=n.useState(!1),[m,f]=n.useState(!1),h=n.useRef(null),v=async()=>{f(!0);try{await D.post("/api/navigation/invalidate-cache").catch(()=>{}),await Promise.all([a(),o()])}catch(b){console.error("Failed to refresh cache:",b)}finally{f(!1),x(!1)}},g=b=>{const j=d(b);c.pathname!==j&&i(j),x(!1)};n.useEffect(()=>{function b(j){h.current&&!h.current.contains(j.target)&&x(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),n.useEffect(()=>{function b(j){j.key==="Escape"&&x(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]);const y=()=>{if(!s)return"?";const b=s.firstName?.[0]||"",j=s.lastName?.[0]||"";return(b+j).toUpperCase()||s.email[0].toUpperCase()},p=()=>s?s.firstName||s.lastName?`${s.firstName||""} ${s.lastName||""}`.trim():s.email.split("@")[0]:"";return e.jsxs("div",{ref:h,className:"relative",children:[e.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 p-1.5 pr-3 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-200 group",style:{borderRadius:"var(--radius-button)"},"aria-expanded":u,"aria-haspopup":"true",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-medium shadow-sm",style:Ts,children:y()}),e.jsx(l.ChevronDown,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform duration-200 ${u?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute right-0 mt-2 w-72 origin-top-right transition-all duration-200 ease-out ${u?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[e.jsx("div",{className:"p-4 bg-gradient-to-br from-[var(--bg-secondary)] to-[var(--bg-tertiary)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center text-white text-lg font-semibold shadow-lg",style:Ts,children:y()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-[var(--text-primary)] truncate",children:p()}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] truncate",children:s?.email})]})]})}),e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("button",{onClick:()=>g("/applications"),className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.LayoutGrid,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.applications")})]}),e.jsxs("button",{onClick:()=>g("/myspace"),className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.User,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.mySpace")})]})]})}),e.jsx("div",{className:"p-2",children:e.jsxs("button",{onClick:v,disabled:m,className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-50",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.RefreshCw,{className:`w-4 h-4 ${m?"animate-spin":""}`})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.refreshCache")})]})}),e.jsx("div",{className:"p-2 border-t border-[var(--border-color)]",children:e.jsxs("button",{onClick:()=>{x(!1),r()},className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-red-500/10 transition-colors group",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] group-hover:bg-red-500/20 flex items-center justify-center text-[var(--text-secondary)] group-hover:text-red-500 transition-colors",children:e.jsx(l.LogOut,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)] group-hover:text-red-500 transition-colors",children:t("avatarMenu.logout")})]})})]})})]})}const co={settings:l.Settings,users:l.Users,key:l.Key,briefcase:l.Briefcase,folder:l.FolderOpen,file:l.FileText,box:l.Box};function uo(t){return t&&co[t.toLowerCase()]||l.Box}function Es({app:t,isFavorite:s,showFavorite:r,onToggleFavorite:a,onSelect:o}){const c=uo(t.icon);return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{onClick:o,className:"w-full flex flex-col items-center gap-2 p-3 hover:bg-[var(--bg-tertiary)] transition-all duration-200",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[var(--color-accent-500)]/20 to-[var(--color-accent-600)]/20 flex items-center justify-center group-hover:from-[var(--color-accent-500)]/30 group-hover:to-[var(--color-accent-600)]/30 transition-all",style:{borderRadius:"var(--radius-card)"},children:e.jsx(c,{className:"w-6 h-6 text-[var(--color-accent-500)]"})}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)] text-center line-clamp-2",children:t.label})]}),r&&e.jsx("button",{onClick:i=>{i.stopPropagation(),a()},className:`absolute top-1 right-1 p-1.5 transition-all duration-200 ${s?"text-amber-500 bg-amber-500/10":"text-[var(--text-tertiary)] opacity-0 group-hover:opacity-100 hover:bg-[var(--bg-secondary)]"}`,style:{borderRadius:"var(--radius-button)"},title:s?"Retirer des favoris":"Ajouter aux favoris",children:e.jsx(l.Star,{className:`w-4 h-4 ${s?"fill-current":""}`})})]})}function Xr(){const{t}=ne.useTranslation("navigation"),{favorites:s,menu:r,toggleFavorite:a,isFavorite:o}=Re(),{currentTenant:c}=Ee(),[i,d]=n.useState(!1),u=n.useRef(null),x=N.useNavigate(),m=et(),f=!!c,h=r?.applications||[];n.useEffect(()=>{function g(y){u.current&&!u.current.contains(y.target)&&d(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),n.useEffect(()=>{function g(y){y.key==="Escape"&&d(!1)}return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[]);const v=g=>{d(!1),g.route&&x(m(g.route))};return e.jsxs("div",{ref:u,className:"relative",children:[e.jsx("button",{onClick:()=>d(!i),className:"p-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},"aria-expanded":i,"aria-haspopup":"true",title:t("appSwitcher.title","Applications"),children:e.jsx(l.LayoutGrid,{className:"w-5 h-5 text-[var(--text-secondary)]"})}),e.jsx("div",{className:`absolute right-0 mt-2 w-80 origin-top-right transition-all duration-200 ease-out ${i?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[s.length>0&&e.jsxs("div",{className:"p-3 border-b border-[var(--border-color)]",children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-3 h-3 text-amber-500 fill-amber-500"}),t("appSwitcher.favorites","Favoris")]}),e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-2",children:s.slice(0,6).map(g=>e.jsx(Es,{app:g,isFavorite:!0,showFavorite:f,onToggleFavorite:()=>a(g.id),onSelect:()=>{d(!1),g.route&&x(m(g.route))}},g.id))})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider",children:t("appSwitcher.allApps","Toutes les applications")}),h.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-2 max-h-64 overflow-y-auto",children:h.map(g=>e.jsx(Es,{app:g,isFavorite:o(g.id),showFavorite:f,onToggleFavorite:()=>a(g.id),onSelect:()=>v(g)},g.id))}):e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] text-center py-6",children:t("appSwitcher.noApps","Aucune application disponible")})]})]})})]})}function mo(){const[t,s]=n.useState([]),r=n.useCallback(async()=>{try{const c=await je.myTenants.getFavorites();s(c)}catch{}},[]),a=n.useCallback(async c=>{const i=t.includes(c);try{if(i){const d=await je.myTenants.removeFavorite(c);s(d)}else{const d=await je.myTenants.addFavorite(c);s(d)}}catch(d){console.error("Failed to toggle favorite:",d)}},[t]),o=n.useCallback(c=>{je.myTenants.recordRecent(c).catch(console.error)},[]);return{favorites:t,loadFavorites:r,toggleFavorite:a,recordRecent:o}}const xo={Pending:"bg-blue-500",Active:"bg-emerald-500",Suspended:"bg-amber-500",Archived:"bg-gray-400"},po={Pending:"En attente",Active:"Actif",Suspended:"Suspendu",Archived:"Archivé"};function _t({tenant:t,isSelected:s,isFavorite:r,hasThemeOverride:a,onSelect:o,onToggleFavorite:c,showStatus:i=!0}){const d=t.type==="Business",u=t.status==="Active",x=(m,f)=>m?"bg-[var(--color-accent-500)]/10 text-[var(--color-accent-600)]":f?"hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]":"opacity-50 cursor-not-allowed text-[var(--text-tertiary)]";return e.jsxs("div",{className:"flex items-center group",children:[e.jsxs("button",{onClick:o,disabled:!u,className:`flex-1 flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 ${x(s,u)}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center ${d?"bg-blue-500/10":"bg-violet-500/10"}`,style:{borderRadius:"var(--radius-card)"},children:d?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:t.name}),a&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-[var(--color-accent-500)]",title:"Thème personnalisé"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] truncate",children:t.organisationName||t.slug}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${xo[t.status]}`}),t.status!=="Active"&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:po[t.status]})]})]})]}),s&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)] flex-shrink-0"})]}),c&&u&&e.jsx("button",{onClick:m=>{m.stopPropagation(),c()},className:`p-2 transition-colors ${r?"text-amber-500":"text-[var(--text-tertiary)] opacity-0 group-hover:opacity-100 hover:text-amber-500"}`,title:r?"Retirer des favoris":"Ajouter aux favoris",children:e.jsx(l.Star,{className:`w-4 h-4 ${r?"fill-amber-500":""}`})})]})}const Yr="tenant_recents",Qt=5;function Jr(){try{return JSON.parse(localStorage.getItem(Yr)||"[]")}catch{return[]}}function ho(t){const s=Jr().filter(r=>r!==t);s.unshift(t),localStorage.setItem(Yr,JSON.stringify(s.slice(0,Qt)))}const go=(t,s,r)=>{const a=o=>{t.current&&!t.current.contains(o.target)&&(s(!1),r(""))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},fo=(t,s)=>{const r=a=>{a.key==="Escape"&&(t(!1),s(""))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},bo=(t,s,r,a,o)=>{const c=n.useMemo(()=>t.filter(u=>s.includes(u.id)&&u.status==="Active"),[t,s]),i=n.useMemo(()=>{if(o.trim())return[];const u=new Set(s);return r.map(x=>a.find(m=>m.id===x)).filter(x=>!!x&&x.status==="Active"&&!u.has(x.id)).slice(0,Qt)},[r,a,s,o]),d=n.useMemo(()=>{const u=new Set([...s,...r.slice(0,Qt)]);return t.filter(x=>!u.has(x.id))},[t,s,r]);return{favoriteTenants:c,recentTenants:i,otherTenants:d}};function vo(){const{t}=ne.useTranslation("navigation"),{refreshMenu:s}=Re(),{currentTenant:r,userTenants:a,switchTenant:o,isLoading:c,hasMultipleTenants:i,hasGlobalRoles:d,isGlobalView:u,enterGlobalView:x}=Ee(),{tenantOverrides:m,loadTenantOverrides:f}=St(),[h,v]=n.useState(!1),[g,y]=n.useState(""),[p]=n.useState(()=>Jr()),b=n.useRef(null),j=n.useRef(null),{favorites:S,loadFavorites:w,toggleFavorite:P,recordRecent:$}=mo();n.useEffect(()=>{h&&(w(),f())},[h,w,f]),n.useEffect(()=>{h&&j.current&&setTimeout(()=>j.current?.focus(),100)},[h]),n.useEffect(()=>go(b,v,y),[]),n.useEffect(()=>fo(v,y),[]);const A=n.useCallback(async E=>{if(E===r?.id&&!u){v(!1);return}try{ho(E),$(E),await o(E),v(!1),y(""),await s()}catch(z){console.error("Failed to switch tenant:",z)}},[r?.id,u,o,s,$]),k=n.useCallback(async()=>{await x(),v(!1),y(""),await s()},[x,s]),R=n.useCallback(async E=>{await P(E)},[P]),L=n.useMemo(()=>{if(!g.trim())return a;const E=g.toLowerCase();return a.filter(z=>z.name.toLowerCase().includes(E)||z.slug.toLowerCase().includes(E)||z.organisationName&&z.organisationName.toLowerCase().includes(E))},[a,g]),{favoriteTenants:I,recentTenants:C,otherTenants:O}=bo(L,S,p,a,g);if(c)return null;if(!(i||d)&&r){const E=r.type==="Business";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-[var(--bg-secondary)] border border-[var(--border-color)]",style:{borderRadius:"var(--radius-button)"},children:[E?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r.name})]})}return e.jsxs("div",{ref:b,className:"relative",children:[e.jsxs("button",{onClick:()=>v(!h),className:`flex items-center gap-2 px-3 py-1.5 border transition-colors ${u?"bg-emerald-500/10 border-emerald-500/30 hover:bg-emerald-500/20":"bg-[var(--bg-secondary)] border-[var(--border-color)] hover:bg-[var(--bg-tertiary)]"}`,style:{borderRadius:"var(--radius-button)"},"aria-expanded":h,"aria-haspopup":"true",children:[u?e.jsxs(e.Fragment,{children:[e.jsx(l.Globe,{className:"w-4 h-4 text-emerald-600"}),e.jsx("span",{className:"text-sm font-medium text-emerald-700",children:t("tenants.selector.global","Global")})]}):r?e.jsxs(e.Fragment,{children:[r.type==="Business"?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)] max-w-[120px] truncate",children:r.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Building2,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)]",children:t("tenants.selector.select","Select")})]}),e.jsx(l.ChevronDown,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform ${h?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute left-0 mt-2 w-80 origin-top-left transition-all duration-200 ease-out z-50 ${h?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"relative",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{ref:j,type:"text",value:g,onChange:E=>y(E.target.value),placeholder:t("tenants.selector.search","Rechercher..."),className:"w-full pl-9 pr-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] focus:border-[var(--color-accent-500)] focus:outline-none",style:{borderRadius:"var(--radius-input)"}})]})}),e.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[d&&!g&&e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("button",{onClick:k,className:`w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 ${u?"bg-emerald-500/10 text-emerald-700":"hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-emerald-500/10 flex items-center justify-center",style:{borderRadius:"var(--radius-card)"},children:e.jsx(l.Globe,{className:"w-4 h-4 text-emerald-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:t("tenants.selector.global","Global")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:t("tenants.selector.globalDesc","Voir tous les tenants")})]}),u&&e.jsx(l.Check,{className:"w-4 h-4 text-emerald-600 flex-shrink-0"})]})}),I.length>0&&e.jsxs("div",{className:"p-2",children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Star,{className:"w-3 h-3 text-amber-500"}),t("tenants.selector.favorites","Favoris")]}),e.jsx("div",{className:"mt-1",children:I.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:!0,hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),C.length>0&&e.jsxs("div",{className:`p-2 ${I.length>0?"border-t border-[var(--border-color)]":""}`,children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Clock,{className:"w-3 h-3"}),t("tenants.selector.recent","Récents")]}),e.jsx("div",{className:"mt-1",children:C.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:S.includes(E.id),hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),O.length>0&&e.jsxs("div",{className:`p-2 ${I.length>0||C.length>0?"border-t border-[var(--border-color)]":""}`,children:[!g&&e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Building2,{className:"w-3 h-3"}),t("tenants.selector.all","Tous")]}),e.jsx("div",{className:"mt-1 max-h-40 overflow-y-auto",children:O.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:S.includes(E.id),hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),g&&L.length===0&&e.jsx("div",{className:"p-4 text-center text-sm text-[var(--text-tertiary)]",children:t("tenants.selector.noResults","Aucun résultat")})]}),e.jsx("div",{className:"p-2 border-t border-[var(--border-color)]",children:e.jsxs(N.Link,{to:"/myspace/tenants",className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},onClick:()=>v(!1),children:[e.jsx(l.Eye,{className:"w-4 h-4"}),t("tenants.selector.viewAll","Voir tous mes espaces")," (",a.length,")"]})})]})})]})}function Qr(t,s){return t?s===t?"current":"other":"global"}const yo={getConfigurations:()=>D.get("/api/support/sla/configurations"),updateConfiguration:(t,s)=>D.put(`/api/support/sla/configurations/${t}`,s),getEscalationRules:()=>D.get("/api/support/sla/escalation-rules"),getBreachedTickets:(t=!0,s=!0)=>D.get("/api/support/sla/breached",{params:{responseBreached:t,resolutionBreached:s}}),getTicketsApproachingBreach:(t=60)=>D.get("/api/support/sla/approaching-breach",{params:{warningMinutes:t}}),getMetrics:(t,s)=>D.get("/api/support/sla/metrics",{params:{fromDate:t,toDate:s}}),escalateTicket:(t,s,r)=>D.post(`/api/support/sla/tickets/${t}/escalate`,{level:s,reason:r})},nt={getAll:(t=1,s=20,r,a)=>D.get("/api/support/notifications",{params:{page:t,pageSize:s,isRead:r,tenantId:a}}),getUnread:(t=10)=>D.get("/api/support/notifications/unread",{params:{limit:t}}),getUnreadCount:()=>D.get("/api/support/notifications/unread/count"),markAsRead:t=>D.patch(`/api/support/notifications/${t}/read`),markAllAsRead:()=>D.patch("/api/support/notifications/read-all"),delete:t=>D.delete(`/api/support/notifications/${t}`),deleteAll:()=>D.delete("/api/support/notifications/all"),getPreferences:()=>D.get("/api/support/notifications/preferences"),updatePreferences:t=>D.put("/api/support/notifications/preferences",t)},qt={getAll:(t,s=!0,r)=>D.get("/api/support/templates",{params:{category:t,activeOnly:s,language:r}}),getById:t=>D.get(`/api/support/templates/${t}`),getCategories:()=>D.get("/api/support/templates/categories"),getByCategory:t=>D.get(`/api/support/templates/by-category/${t}`),create:t=>D.post("/api/support/templates",t),update:(t,s)=>D.put(`/api/support/templates/${t}`,s),activate:t=>D.patch(`/api/support/templates/${t}/activate`),deactivate:t=>D.patch(`/api/support/templates/${t}/deactivate`),delete:t=>D.delete(`/api/support/templates/${t}`),render:(t,s)=>D.post(`/api/support/templates/${t}/render`,{variables:s})},Zt={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function jo(t,s,r){if(r){const o=s.relatedEntityId,c=t.filter(i=>!(i.type===Zt.STARTED&&i.relatedEntityId===o));return[s,...c].slice(0,10)}return t.some(o=>o.id===s.id)?t:[s,...t].slice(0,10)}function wo(t){return{id:t.id,type:t.type,title:t.title,message:t.message,relatedEntityType:t.relatedEntityType,relatedEntityId:t.relatedEntityId,actionUrl:t.actionUrl,isRead:t.isRead,readAt:t.readAt,createdAt:t.createdAt,tenantId:t.tenantId,tenantName:t.tenantName,tenantSlug:t.tenantSlug}}function No(){const[t,s]=n.useState(0),[r,a]=n.useState([]),[o,c]=n.useState(!1),{isConnected:i,onNotification:d,onUnreadCountUpdate:u}=Cr(),{isFeatureEnabled:x}=Ge(),m=x("support");n.useEffect(()=>{const p=d(j=>{const S=wo(j),w=j.type===Zt.COMPLETED||j.type===Zt.FAILED;a(P=>jo(P,S,w))}),b=u(j=>{s(j)});return()=>{p(),b()}},[d,u]),n.useEffect(()=>{if(!m)return;let p=!1;async function b(){try{const j=await nt.getUnreadCount();p||s(j.count)}catch(j){p||console.error("Failed to load unread count:",j)}}return b(),()=>{p=!0}},[m]);const f=n.useCallback(async()=>{if(m)try{c(!0);const p=await nt.getUnread(10);a(p)}catch(p){console.error("Failed to load notifications:",p)}finally{c(!1)}},[m]),h=n.useCallback(async p=>{try{await nt.markAsRead(p),a(b=>b.map(j=>j.id===p?{...j,isRead:!0}:j)),s(b=>Math.max(0,b-1))}catch(b){console.error("Failed to mark as read:",b)}},[]),v=n.useCallback(async()=>{try{await nt.markAllAsRead(),a(p=>p.map(b=>({...b,isRead:!0}))),s(0)}catch(p){console.error("Failed to mark all as read:",p)}},[]),g=n.useCallback(async p=>{try{await nt.delete(p);const b=r.find(j=>j.id===p);a(j=>j.filter(S=>S.id!==p)),b&&!b.isRead&&s(j=>Math.max(0,j-1))}catch(b){console.error("Failed to delete notification:",b)}},[r]),y=n.useCallback(p=>{nt.markAsRead(p),s(b=>Math.max(0,b-1))},[]);return{notifications:r,unreadCount:t,loading:o,isConnected:i,loadNotifications:f,markAsRead:h,markAllAsRead:v,deleteNotification:g,markAsReadSilent:y}}const vt={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function Zr(){const t=N.useNavigate(),{currentTenant:s,hasMultipleTenants:r}=Ee(),[a,o]=n.useState(!1),c=n.useRef(null),{notifications:i,unreadCount:d,loading:u,isConnected:x,loadNotifications:m,markAsRead:f,markAllAsRead:h,deleteNotification:v,markAsReadSilent:g}=No(),[,y]=n.useState(0);n.useEffect(()=>{if(!i.some(R=>R.type===vt.STARTED&&!R.isRead))return;const k=setInterval(()=>{y(R=>R+1)},1e3);return()=>clearInterval(k)},[i]),n.useEffect(()=>{a&&m()},[a,m]),n.useEffect(()=>{const A=k=>{c.current&&!c.current.contains(k.target)&&o(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const p=(A,k)=>{k.stopPropagation(),f(A)},b=(A,k)=>{k.stopPropagation(),v(A)},j=A=>{A.isRead||g(A.id),o(!1),A.actionUrl&&t(A.actionUrl)},S=A=>{switch(A){case"TicketCreated":return"🎫";case"TicketAssigned":return"👤";case"TicketStatusChanged":case"StatusChanged":return"🔄";case"TicketCommented":case"CommentAdded":return"💬";case"TicketResolved":return"✅";case"TicketClosed":return"🔒";case"TicketUpdated":return"📝";case"SlaResponseBreached":case"SlaResolutionBreached":return"⚠️";case"SlaWarning":return"⏰";case"TicketEscalated":return"📈";case"SatisfactionRequested":return"⭐";case"GroupMemberAdded":return"👥";case"GroupMemberRemoved":return"🚪";case"RoleAssigned":return"🎭";case"RoleRemoved":return"🚫";case"RolePermissionsChanged":return"🔑";case"AccountUpdated":return"👤";case"SystemAnnouncement":return"📢";case vt.STARTED:return null;case vt.COMPLETED:return"✅";case vt.FAILED:return"❌";default:return"📌"}},w=A=>{const k=new Date(A).getTime(),R=Date.now(),L=Math.floor((R-k)/1e3),I=Math.floor(L/60),C=L%60;return`${I.toString().padStart(2,"0")}:${C.toString().padStart(2,"0")}`},P=A=>{const k=new Date(A),L=new Date().getTime()-k.getTime(),I=Math.floor(L/6e4),C=Math.floor(I/60),O=Math.floor(C/24);return I<1?"Just now":I<60?`${I}m ago`:C<24?`${C}h ago`:O<7?`${O}d ago`:k.toLocaleDateString()},$=A=>{if(!r)return null;const k=Qr(A.tenantId,s?.id??null);return k==="global"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-700",children:"System"}):k==="current"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)] truncate max-w-[120px]",children:A.tenantName}):e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-700 font-medium truncate max-w-[120px]",children:A.tenantName})};return e.jsxs("div",{className:"relative",ref:c,children:[e.jsxs("button",{onClick:()=>o(!a),className:"relative p-2 rounded-lg hover:bg-[var(--bg-hover)] transition-colors","aria-label":"Notifications",children:[e.jsx(l.Bell,{className:"w-5 h-5"}),d>0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white text-xs font-bold rounded-full flex items-center justify-center",children:d>9?"9+":d})]}),a&&e.jsxs("div",{className:"absolute right-0 mt-2 w-96 bg-[var(--bg-primary)] rounded-lg shadow-xl border border-[var(--border-color)] z-50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:"Notifications"}),x?e.jsx("span",{title:"Real-time connected",children:e.jsx(l.Wifi,{className:"w-3 h-3 text-green-500"})}):e.jsx("span",{title:"Offline mode",children:e.jsx(l.WifiOff,{className:"w-3 h-3 text-gray-400"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d>0&&e.jsxs("button",{onClick:h,className:"text-sm text-[var(--color-primary-600)] hover:underline flex items-center gap-1",children:[e.jsx(l.CheckCheck,{className:"w-4 h-4"}),"Mark all read"]}),e.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-[var(--bg-hover)]",children:e.jsx(l.X,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):i.length>0?i.map(A=>{const k=A.type===vt.STARTED&&!A.isRead,R=S(A.type);return e.jsx("div",{onClick:()=>j(A),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&j(A)},role:"button",tabIndex:0,className:`p-4 border-b border-[var(--border-color)] cursor-pointer hover:bg-[var(--bg-hover)] transition-colors ${A.isRead?"":"bg-blue-50/50 dark:bg-blue-900/10"} ${k?"bg-[var(--color-accent-50)] dark:bg-[var(--color-accent-900)]/20":""}`,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"text-xl flex-shrink-0",children:k?e.jsx(l.RefreshCw,{className:"w-5 h-5 text-[var(--color-accent-600)] animate-spin"}):R}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:`text-sm ${A.isRead?"":"font-semibold"}`,children:A.title}),$(A)]}),k?e.jsxs("span",{className:"text-xs font-mono font-bold text-[var(--color-accent-600)] flex-shrink-0 bg-[var(--color-accent-100)] px-2 py-0.5 rounded",children:["⏱ ",w(A.createdAt)]}):e.jsx("span",{className:"text-xs text-[var(--text-secondary)] flex-shrink-0",children:P(A.createdAt)})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] line-clamp-2 mt-1",children:A.message})]}),e.jsxs("div",{className:"flex flex-col gap-1 flex-shrink-0",children:[!A.isRead&&!k&&e.jsx("button",{onClick:L=>p(A.id,L),className:"p-1 rounded hover:bg-[var(--bg-secondary)]",title:"Mark as read",children:e.jsx(l.Check,{className:"w-4 h-4 text-green-600"})}),!k&&e.jsx("button",{onClick:L=>b(A.id,L),className:"p-1 rounded hover:bg-[var(--bg-secondary)]",title:"Delete",children:e.jsx(l.Trash2,{className:"w-4 h-4 text-red-500"})})]})]})},A.id)}):e.jsxs("div",{className:"py-8 text-center text-[var(--text-secondary)]",children:[e.jsx(l.Bell,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No notifications"})]})}),e.jsx("div",{className:"p-3 border-t border-[var(--border-color)] text-center",children:e.jsx("button",{onClick:()=>{o(!1),t("/notifications")},className:"text-sm text-[var(--color-primary-600)] hover:underline",children:"View all notifications"})})]})]})}const So={default:{bg:"bg-[var(--bg-tertiary)]",text:"text-[var(--text-primary)]",border:"border-[var(--border-color)]",arrow:"bg-[var(--bg-tertiary)] border-[var(--border-color)]"},error:{bg:"bg-[var(--tooltip-error-bg)]",text:"text-[var(--error-text)]",border:"border-[var(--error-border)]",arrow:"bg-[var(--tooltip-error-bg)] border-[var(--error-border)]"},warning:{bg:"bg-[var(--tooltip-warning-bg)]",text:"text-[var(--warning-text)]",border:"border-[var(--warning-border)]",arrow:"bg-[var(--tooltip-warning-bg)] border-[var(--warning-border)]"},success:{bg:"bg-[var(--tooltip-success-bg)]",text:"text-[var(--success-text)]",border:"border-[var(--success-border)]",arrow:"bg-[var(--tooltip-success-bg)] border-[var(--success-border)]"},info:{bg:"bg-[var(--tooltip-info-bg)]",text:"text-[var(--info-text)]",border:"border-[var(--info-border)]",arrow:"bg-[var(--tooltip-info-bg)] border-[var(--info-border)]"}};function ea({content:t,children:s,position:r="top",variant:a="default",delay:o=200,disabled:c=!1,className:i=""}){const d=So[a],[u,x]=n.useState(!1),[m,f]=n.useState({top:0,left:0}),h=n.useRef(null),v=n.useRef(null),g=n.useRef(null),y=()=>{if(!h.current||!v.current)return;const S=h.current.getBoundingClientRect(),w=v.current.getBoundingClientRect(),P=window.scrollX,$=window.scrollY,A=8;let k=0,R=0;switch(r){case"top":k=S.top+$-w.height-A,R=S.left+P+(S.width-w.width)/2;break;case"bottom":k=S.bottom+$+A,R=S.left+P+(S.width-w.width)/2;break;case"left":k=S.top+$+(S.height-w.height)/2,R=S.left+P-w.width-A;break;case"right":k=S.top+$+(S.height-w.height)/2,R=S.right+P+A;break}const L=window.innerWidth,I=window.innerHeight,C=8;R<C?R=C:R+w.width>L-C&&(R=L-w.width-C),k<C+$?k=C+$:k+w.height>I+$-C&&(k=I+$-w.height-C),f({top:k,left:R})};n.useEffect(()=>(u&&(y(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y)),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}),[u,r]);const p=()=>{c||!t||(g.current=setTimeout(()=>{x(!0)},o))},b=()=>{g.current&&(clearTimeout(g.current),g.current=null),x(!1)};n.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const j=()=>{const S=`absolute w-2 h-2 ${d.arrow} transform rotate-45`;switch(r){case"top":return`${S} -bottom-1 left-1/2 -translate-x-1/2 border-r border-b`;case"bottom":return`${S} -top-1 left-1/2 -translate-x-1/2 border-l border-t`;case"left":return`${S} -right-1 top-1/2 -translate-y-1/2 border-t border-r`;case"right":return`${S} -left-1 top-1/2 -translate-y-1/2 border-b border-l`}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:h,onMouseEnter:p,onMouseLeave:b,onFocus:p,onBlur:b,className:"inline-flex",children:s}),u&&t&&$t.createPortal(e.jsxs("div",{ref:v,role:"tooltip",style:{position:"absolute",top:m.top,left:m.left,zIndex:9999},className:`
3
- px-3 py-2 text-sm font-medium
4
- ${d.bg} ${d.text}
5
- border ${d.border}
6
- rounded-[var(--radius-button)]
7
- shadow-lg shadow-black/20
8
- max-w-xs
9
- tooltip-animation
10
- ${i}
11
- `,children:[t,e.jsx("div",{className:j()})]}),document.body)]})}const Pt="support_error_context";class Co{async captureContext(){const s={url:window.location.href,timestamp:new Date,recentErrors:Pe.getRecentErrors(),browserInfo:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,screenWidth:window.screen.width,screenHeight:window.screen.height}};try{const r=await this.captureScreenshot();s.screenshot=r}catch{Pe.logError(new Error("Failed to capture screenshot"),"ErrorContextService")}return s}async captureScreenshot(){try{const r=await js.domToJpeg(document.body,{scale:1,quality:.85,backgroundColor:"#1a1a2e",style:{transform:"none"},filter:a=>{if(a instanceof HTMLElement){const o=a.tagName?.toUpperCase();return o!=="IFRAME"&&o!=="VIDEO"}return!0}});return r.length>4*1024*1024?await this.recompressScreenshot(r,.7):r}catch(s){console.error("[ErrorContextService] Screenshot capture failed:",s);try{return await js.domToJpeg(document.body,{scale:.75,quality:.8,backgroundColor:"#1a1a2e"})}catch(r){console.error("[ErrorContextService] Fallback also failed:",r);return}}}async recompressScreenshot(s,r){return new Promise(a=>{const o=new Image;o.onload=()=>{const c=document.createElement("canvas");c.width=o.width,c.height=o.height;const i=c.getContext("2d");if(i){i.drawImage(o,0,0);const d=c.toDataURL("image/jpeg",r);a(d)}else a(s)},o.onerror=()=>a(s),o.src=s})}saveContext(s){try{const r=JSON.stringify(s);try{sessionStorage.setItem(Pt,r)}catch{const o={...s,screenshot:void 0};sessionStorage.setItem(Pt,JSON.stringify(o))}}catch(r){console.error("[ErrorContextService] Failed to save context:",r)}}loadContext(){try{const s=sessionStorage.getItem(Pt);if(s){const r=JSON.parse(s);return r.timestamp=new Date(r.timestamp),r.recentErrors=r.recentErrors.map(a=>({...a,timestamp:new Date(a.timestamp)})),r.screenshot&&!r.screenshot.startsWith("data:image/")&&(r.screenshot=void 0),r}}catch(s){console.warn("[ErrorContextService] Failed to load context:",s)}return null}clearContext(){sessionStorage.removeItem(Pt)}formatErrorsForDescription(s){return s.length===0?"":s.slice(0,5).map((a,o)=>{const c=a.timestamp.toLocaleTimeString();return`${o+1}. [${c}] ${a.message}${a.component?` (${a.component})`:""}`}).join(`
12
- `)}}const zt=new Co,Gt="ticket_drafts",$s=5,Is=7;class ko{getDrafts(){try{const s=localStorage.getItem(Gt);return s?JSON.parse(s).map(a=>({...a,createdAt:new Date(a.createdAt),updatedAt:new Date(a.updatedAt)})):[]}catch{return[]}}saveDrafts(s){try{const r=s.map(o=>({...o,createdAt:o.createdAt.toISOString(),updatedAt:o.updatedAt.toISOString()})),a=JSON.stringify(r);return localStorage.setItem(Gt,a),!0}catch(r){if(console.error("[TicketDraftService] Failed to save drafts:",r),r instanceof DOMException&&r.name==="QuotaExceededError")try{const a=s.map(o=>({...o,screenshot:void 0,attachments:void 0,createdAt:o.createdAt.toISOString(),updatedAt:o.updatedAt.toISOString()}));return localStorage.setItem(Gt,JSON.stringify(a)),!0}catch(a){console.error("[TicketDraftService] Still failed without large data:",a)}return!1}}cleanupExpiredDrafts(){const s=this.getDrafts(),r=new Date,a=Is*24*60*60*1e3,o=s.filter(c=>r.getTime()-c.updatedAt.getTime()<a);o.length!==s.length&&this.saveDrafts(o)}getAllDrafts(){return this.cleanupExpiredDrafts(),this.getDrafts().sort((s,r)=>r.updatedAt.getTime()-s.updatedAt.getTime())}getDraft(s){return this.getAllDrafts().find(a=>a.id===s)||null}createDraft(){const s=this.getAllDrafts();if(s.length>=$s){const c=s[s.length-1];this.deleteDraft(c.id)}const r=new Date,a={id:crypto.randomUUID(),type:null,title:"",description:"",priority:"Medium",includeScreenshot:!0,includeErrorLogs:!0,createdAt:r,updatedAt:r},o=[a,...this.getDrafts().slice(0,$s-1)];return this.saveDrafts(o),a}updateDraft(s,r){const a=this.getDrafts(),o=a.findIndex(d=>d.id===s);if(o===-1)return{success:!1,draft:null};const c={...a[o],...r,updatedAt:new Date};a[o]=c;const i=this.saveDrafts(a);return{success:i,draft:i?c:null}}deleteDraft(s){const r=this.getDrafts(),a=r.filter(o=>o.id!==s);return a.length===r.length?!1:(this.saveDrafts(a),!0)}getDraftCount(){return this.getAllDrafts().length}hasDrafts(){return this.getDraftCount()>0}getTimeUntilExpiration(s){const r=Is*24*60*60*1e3,a=s.updatedAt.getTime()+r,o=Math.max(0,a-Date.now()),c=Math.floor(o/(1440*60*1e3)),i=Math.floor(o%(1440*60*1e3)/(3600*1e3));return{days:c,hours:i}}}const Xe=new ko;function ta({variant:t="icon",className:s=""}){const{t:r}=ne.useTranslation(["common","support"]),a=N.useNavigate(),{hasPermission:o}=Ae(),[c,i]=n.useState(!1),[d,u]=n.useState(!1),[x,m]=n.useState([]),f=n.useRef(null),h=o("support.my-tickets.create");n.useEffect(()=>{d&&m(Xe.getAllDrafts())},[d]),n.useEffect(()=>{const S=w=>{f.current&&!f.current.contains(w.target)&&u(!1)};return d&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[d]);const v=async S=>{i(!0),u(!1);const P=(S?Xe.getDraft(S):null)?.screenshot;let $=null;if(P)zt.clearContext();else try{$=await zt.captureContext(),zt.saveContext($)}catch{}i(!1);const A=S?`/support/my-tickets/create?draft=${S}`:"/support/my-tickets/create";a(A)},g=async()=>{const S=Xe.getAllDrafts();S.length>0?(m(S),u(!0)):await v()},y=(S,w)=>{S.stopPropagation(),Xe.deleteDraft(w);const P=Xe.getAllDrafts();m(P),P.length===0&&u(!1)},p=S=>S.title?S.title.length>30?S.title.substring(0,30)+"...":S.title:S.type?r(`support:tickets.types.${S.type}`):r("common:drafts.untitled"),b=S=>{const P=new Date().getTime()-S.getTime(),$=Math.floor(P/6e4),A=Math.floor(P/36e5),k=Math.floor(P/864e5);return $<1?r("common:drafts.justNow"):$<60?r("common:drafts.minutesAgo",{count:$}):A<24?r("common:drafts.hoursAgo",{count:A}):r("common:drafts.daysAgo",{count:k})};if(!h)return null;const j=()=>e.jsxs("div",{ref:f,className:"absolute right-0 top-full mt-2 w-80 bg-[var(--bg-primary)] border border-[var(--border-color)] rounded-lg shadow-xl z-50",children:[e.jsxs("div",{className:"p-3 border-b border-[var(--border-color)]",children:[e.jsx("h3",{className:"font-medium text-sm",children:r("common:drafts.existingDrafts")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:r("common:drafts.selectOrCreate")})]}),e.jsx("div",{className:"max-h-64 overflow-y-auto",children:x.map(S=>{const w=Xe.getTimeUntilExpiration(S);return e.jsxs("div",{onClick:()=>v(S.id),role:"button",tabIndex:0,onKeyDown:P=>P.key==="Enter"&&v(S.id),className:"w-full p-3 flex items-start gap-3 hover:bg-[var(--bg-hover)] transition-colors text-left border-b border-[var(--border-color)] last:border-b-0 cursor-pointer",children:[e.jsx(l.FileEdit,{className:"w-4 h-4 text-[var(--text-secondary)] mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:p(S)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)] mt-1 flex-wrap",children:[S.tenantName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-[var(--bg-tertiary)] text-[var(--text-secondary)] truncate max-w-[120px]",children:S.tenantName}),e.jsx("span",{className:"text-[var(--text-tertiary)]",children:"•"})]}),e.jsx(l.Clock,{className:"w-3 h-3"}),e.jsx("span",{children:b(S.updatedAt)}),e.jsx("span",{className:"text-[var(--text-tertiary)]",children:"•"}),e.jsx("span",{className:"text-[var(--warning-text)]",children:w.days>0?r("common:drafts.expiresInDays",{count:w.days}):r("common:drafts.expiresInHours",{count:w.hours})})]})]}),e.jsx("button",{onClick:P=>y(P,S.id),className:"p-1.5 rounded hover:bg-[var(--error-bg)] text-[var(--text-secondary)] hover:text-[var(--error-text)] transition-colors",title:r("common:actions.delete"),children:e.jsx(l.Trash2,{className:"w-4 h-4"})})]},S.id)})}),e.jsx("div",{className:"p-2 border-t border-[var(--border-color)]",children:e.jsxs("button",{onClick:()=>v(),className:"w-full flex items-center justify-center gap-2 px-4 py-2 bg-[var(--color-primary-600)] text-white rounded-lg hover:bg-[var(--color-primary-700)] transition-colors text-sm",children:[e.jsx(l.Plus,{className:"w-4 h-4"}),r("common:drafts.createNew")]})})]});return t==="icon"?e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(ea,{content:r("common:actions.createTicket"),position:"bottom",children:e.jsx("button",{onClick:g,disabled:c,className:`p-2 rounded-lg hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-50 ${s}`,children:c?e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}):e.jsx(l.Headset,{className:"w-5 h-5"})})}),d&&j()]}):e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:g,disabled:c,className:`flex items-center gap-2 px-4 py-2 bg-[var(--color-primary-600)] text-white rounded-lg hover:bg-[var(--color-primary-700)] transition-colors disabled:opacity-50 ${s}`,children:[c?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Headset,{className:"w-4 h-4"}),r("common:actions.createTicket")]}),d&&j()]})}function wt({onMenuToggle:t}){const{t:s}=ne.useTranslation("navigation"),[r,a]=n.useState(!1),o=et(),{menu:c}=Re(),{logout:i}=Ae(),d=c?.applications||[];return e.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 bg-[var(--bg-primary)]/80 backdrop-blur-lg border-b border-[var(--border-color)]",children:e.jsxs("nav",{className:"px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[t&&e.jsx("button",{onClick:t,className:"lg:hidden p-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},children:e.jsx(l.Menu,{className:"w-5 h-5"})}),e.jsxs(N.Link,{to:o("/applications"),className:"flex items-center gap-3 group",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"w-10 h-10 animated-gradient flex items-center justify-center",style:{borderRadius:"var(--radius-card)"},children:e.jsx(l.Layers,{className:"w-5 h-5 text-white"})})}),e.jsx("span",{className:"text-xl font-bold gradient-text",children:"SmartStack"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(vo,{}),e.jsx("div",{className:"h-6 w-px bg-[var(--border-color)]"}),e.jsx(Xr,{}),e.jsx("div",{className:"h-6 w-px bg-[var(--border-color)]"}),e.jsx(ps,{}),e.jsx(Ot,{}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 pl-3 border-l border-[var(--border-color)]",children:[!1,e.jsx(ta,{}),e.jsx(Zr,{}),e.jsx(Wr,{})]}),e.jsx("button",{onClick:()=>a(!r),className:"sm:hidden p-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},children:r?e.jsx(l.X,{className:"w-6 h-6"}):e.jsx(l.Menu,{className:"w-6 h-6"})})]})]}),r&&e.jsx("div",{className:"sm:hidden py-4 border-t border-[var(--border-color)]",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[d.map(u=>e.jsx(N.Link,{to:o(u.route||"#"),className:"px-3 py-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},onClick:()=>a(!1),children:u.label},u.id)),e.jsx("hr",{className:"my-2 border-[var(--border-color)]"}),e.jsxs("button",{onClick:()=>{a(!1),i()},className:"flex items-center gap-2 px-3 py-2 hover:bg-[var(--bg-tertiary)] transition-colors text-red-500",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),s("header.logout")]})]})})]})})}function es({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function ts(t){if(!t)return l.Box;const s=xt;if(s[t])return s[t];const r=t.toLowerCase(),a=Object.keys(s).find(o=>o.toLowerCase()===r);return a?s[a]:l.Box}function Ao({module:t,isActive:s,isCollapsed:r,onClose:a,buildUrl:o}){const[c,i]=n.useState(!1),[d,u]=n.useState({top:0,left:0}),x=n.useRef(null),m=n.useRef(null),f=()=>{if(r){if(x.current&&(clearTimeout(x.current),x.current=null),m.current){const v=m.current.getBoundingClientRect();u({top:v.top,left:v.right+8})}i(!0)}},h=()=>{r&&(x.current=setTimeout(()=>{i(!1)},150))};return n.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]),e.jsxs("div",{ref:m,className:"relative",onMouseEnter:f,onMouseLeave:h,children:[e.jsxs(N.Link,{to:o(t.route),onClick:a,className:`flex items-center transition-colors ${r?"justify-center px-2 py-2":"gap-3 px-3 py-2"} ${s?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:r?`${t.label} (${t.applicationLabel})`:void 0,children:[e.jsx(es,{name:t.icon,className:"w-4 h-4 flex-shrink-0"}),!r&&e.jsx("span",{className:"text-sm font-medium truncate",children:t.label})]}),r&&c&&$t.createPortal(e.jsx("div",{className:"fixed z-[9999] pointer-events-auto",style:{top:d.top,left:d.left},onMouseEnter:f,onMouseLeave:h,children:e.jsx("div",{className:"px-3 py-2 bg-[var(--bg-secondary)] border border-[var(--border-color)] shadow-lg whitespace-nowrap",style:{borderRadius:"var(--radius-menu-item)"},children:e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.label})})}),document.body)]})}function Ro({module:t,isExpanded:s,onToggle:r,onNavigate:a,currentPath:o,isCollapsed:c}){const[i,d]=n.useState(!1),[u,x]=n.useState({top:0,left:0}),[m,f]=n.useState(new Set),h=n.useRef(null),v=n.useRef(null),g=ts(t.icon),y=t.route?o===t.route:o.includes(`/${t.code}`),p=(t.sections?.length??0)>0,b=t.label;n.useEffect(()=>{if(!t.sections)return;const $=t.sections.find(A=>A.resources?.some(k=>k.route&&o.startsWith(k.route)));$&&!m.has($.id)&&f(A=>new Set([...A,$.id]))},[o,t.sections,m]);const j=$=>{f(A=>{const k=new Set(A);return k.has($)?k.delete($):k.add($),k})},S=()=>{if(c){if(h.current&&(clearTimeout(h.current),h.current=null),v.current){const $=v.current.getBoundingClientRect();x({top:$.top,left:$.right+8})}d(!0)}},w=()=>{c&&(h.current=setTimeout(()=>{d(!1)},150))};n.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const P=()=>{p&&!c?r():t.route&&a(t.route)};return e.jsxs("div",{ref:v,className:"relative",onMouseEnter:S,onMouseLeave:w,children:[e.jsxs("button",{onClick:P,className:`w-full flex items-center transition-all duration-200 ${c?"justify-center px-2 py-2.5":"gap-3 px-3 py-2.5"} ${y?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:c&&!p?b:void 0,children:[e.jsx(g,{className:"w-5 h-5 flex-shrink-0"}),!c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-left font-medium text-sm truncate",children:b}),p&&(s?e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--text-tertiary)] flex-shrink-0"}):e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)] flex-shrink-0"}))]})]}),c&&i&&$t.createPortal(e.jsx("div",{className:"fixed z-[9999] pointer-events-auto",style:{top:u.top,left:u.left},onMouseEnter:S,onMouseLeave:w,children:e.jsxs("div",{className:"min-w-[200px] bg-[var(--bg-secondary)] border border-[var(--border-color)] shadow-lg",style:{borderRadius:"var(--radius-card)"},children:[e.jsx("div",{className:"px-3 py-2 border-b border-[var(--border-color)]",children:e.jsx("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:b})}),e.jsx("div",{className:"p-1.5",children:p?t.sections.map($=>{const A=ts($.icon),k=$.route&&o===$.route;return e.jsxs("button",{onClick:()=>$.route&&a($.route),className:`w-full flex items-center gap-2.5 px-2.5 py-2 transition-colors ${k?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"hover:bg-[var(--bg-tertiary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(A,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:$.label})]},$.id)}):t.route&&e.jsxs("button",{onClick:()=>a(t.route),className:"w-full flex items-center gap-2.5 px-2.5 py-2 hover:bg-[var(--bg-tertiary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(g,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:"Ouvrir"})]})})]})}),document.body),!c&&s&&p&&e.jsx("div",{className:"ml-4 pl-4 border-l border-[var(--border-color)] mt-1 space-y-1",children:t.sections.map($=>e.jsx(Po,{section:$,currentPath:o,onNavigate:a,isCollapsed:c,isExpanded:m.has($.id),onToggle:()=>j($.id)},$.id))})]})}function Po({section:t,currentPath:s,onNavigate:r,isCollapsed:a,isExpanded:o,onToggle:c}){const i=ts(t.icon),d=t.route&&(s===t.route||s.startsWith(t.route+"/")),u=(t.resources?.length??0)>0,x=t.label,m=f=>{f.preventDefault(),t.route&&r(t.route),u&&c()};return a?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:m,className:`w-full flex items-center gap-3 px-3 py-2 transition-all duration-200 ${d?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"hover:bg-[var(--bg-tertiary)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(i,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"flex-1 text-sm text-left",children:x}),u&&(o?e.jsx(l.ChevronDown,{className:"w-3.5 h-3.5 text-[var(--text-tertiary)] flex-shrink-0"}):e.jsx(l.ChevronRight,{className:"w-3.5 h-3.5 text-[var(--text-tertiary)] flex-shrink-0"}))]}),o&&u&&e.jsx("div",{className:"ml-4 pl-3 border-l border-[var(--border-color)] mt-1 space-y-0.5",children:t.resources.map(f=>e.jsx(To,{resource:f,currentPath:s,onNavigate:r},f.id))})]})}function To({resource:t,currentPath:s,onNavigate:r}){const a=t.route&&s.startsWith(t.route),o=c=>{c.preventDefault(),t.route&&r(t.route)};return e.jsxs("button",{onClick:o,className:`w-full flex items-center gap-2.5 px-2.5 py-1.5 transition-all duration-200 ${a?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"hover:bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-current flex-shrink-0"}),e.jsx("span",{className:"text-xs text-left",children:t.label})]})}const Eo=(t,s)=>{if(t?.modules)return t.modules.find(r=>r.sections?.length?r.sections.some(a=>a.route&&(s===a.route||s.startsWith(a.route+"/"))):!1)},$o=(t,s)=>!!t.route&&s.startsWith(t.route)&&(t.sections?.length??0)>0,Io=(t,s)=>{if(!t)return;const r=Eo(t,s);return r||t.modules.find(a=>$o(a,s))};function sa({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),o=N.useNavigate(),{getCurrentApplication:c,isLoading:i,currentAppCode:d,menu:u}=Re(),{favorites:x,loading:m}=ze(),{expandFavorites:f,clearExpand:h}=ze(),{isCollapsed:v,toggleCollapsed:g}=Lt(),y=et(),[p,b]=n.useState(new Set),[j,S]=n.useState(!1);n.useEffect(()=>{f&&(queueMicrotask(()=>{S(!1)}),h())},[f,h]);const w=c(),P=n.useCallback(R=>{if(u)for(const L of u.applications){const I=L.modules.find(C=>C.id===R.id);if(I?.sections?.length){const C=[...I.sections].sort((O,_)=>O.displayOrder-_.displayOrder)[0];if(C.route)return C.route}}return R.route},[u]);n.useEffect(()=>{if(!w)return;const R=Io(w,a.pathname);R&&!p.has(R.id)&&queueMicrotask(()=>{b(L=>new Set([...L,R.id]))})},[a.pathname,w,p]);const $=R=>{b(L=>{const I=new Set(L);return I.has(R)?I.delete(R):I.add(R),I})},A=R=>{o(y(R)),s()},k=w?.label??"";return w?e.jsxs(e.Fragment,{children:[t&&e.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:s}),e.jsxs("aside",{className:`group/sidebar fixed top-16 bottom-0 left-0 bg-[var(--bg-primary)] border-r border-[var(--border-color)] transform transition-all duration-300 z-50 overflow-visible ${v?"w-16":"w-64"} ${t?"translate-x-0":"-translate-x-full lg:translate-x-0"}`,children:[e.jsxs("button",{onClick:g,className:"hidden lg:flex absolute top-1/2 -translate-y-1/2 w-3 h-16 items-center justify-center group/toggle transition-all duration-200 z-[9999]",style:{right:"-12px"},title:v?r("sidebar.expand","Agrandir le menu"):r("sidebar.collapse","Réduire le menu"),children:[e.jsx("div",{className:"absolute left-0 w-[3px] h-full bg-[var(--border-color)] group-hover/toggle:bg-[var(--color-accent-500)] transition-colors duration-200 rounded-full"}),e.jsx("div",{className:"absolute right-0 w-4 h-4 flex items-center justify-center bg-[var(--bg-secondary)] border border-[var(--border-color)] group-hover/toggle:border-[var(--color-accent-500)] group-hover/toggle:text-[var(--color-accent-500)] text-[var(--text-muted)] rounded-full shadow-sm transition-all duration-200",children:v?e.jsx(l.ChevronRight,{className:"w-3 h-3"}):e.jsx(l.ChevronLeft,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:`${v?"p-2":"p-4"}`,children:[e.jsxs("div",{className:"flex items-center justify-between group/header",children:[v?e.jsx("div",{className:"w-full flex justify-center",children:e.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-gradient-to-br from-[var(--color-accent-500)] to-[var(--color-accent-700)] text-white shadow-sm",style:{borderRadius:"var(--radius-button)"},title:k,children:e.jsx(es,{name:w.icon||"LayoutGrid",className:"w-5 h-5"})})}):e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 flex-shrink-0 flex items-center justify-center bg-gradient-to-br from-[var(--color-accent-500)] to-[var(--color-accent-700)] text-white shadow-sm",style:{borderRadius:"var(--radius-button)"},children:e.jsx(es,{name:w.icon||"LayoutGrid",className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"font-semibold text-[var(--text-primary)] truncate",children:k}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[10px] font-medium bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",style:{borderRadius:"4px"},children:[w.modules.length," ",w.modules.length===1?"module":"modules"]})})]})]}),e.jsx("button",{onClick:s,className:"lg:hidden p-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},children:e.jsx(l.X,{className:"w-5 h-5"})})]}),e.jsx("div",{className:`mt-3 h-px bg-gradient-to-r from-transparent via-[var(--border-color)] to-transparent ${v?"mx-1":""}`})]}),e.jsxs("nav",{className:`flex-1 overflow-y-auto overflow-x-hidden space-y-1 ${v?"p-2 pt-3":"p-3"}`,children:[!m&&x.length>0&&e.jsxs("div",{className:"mb-4",children:[!v&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 mb-1",children:[e.jsxs("button",{onClick:()=>S(!j),className:"flex items-center gap-2 text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider hover:text-[var(--text-primary)] transition-colors",children:[e.jsx("div",{className:`transition-transform duration-200 ${j?"":"rotate-90"}`,children:e.jsx(l.ChevronRight,{className:"w-3.5 h-3.5"})}),e.jsx(l.Star,{className:"w-3.5 h-3.5 text-amber-500"}),r("common:favorites.quickAccess")]}),e.jsx(N.Link,{to:y("/myspace/preferences?tab=favorites"),onClick:s,className:"p-1.5 text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},title:r("common:favorites.manage"),children:e.jsx(l.Settings,{className:"w-3.5 h-3.5"})})]}),(v||!j)&&e.jsx("div",{className:"space-y-0.5",children:x.map(R=>{const L=P(R);return e.jsx(Ao,{module:{...R,route:L},isActive:a.pathname.startsWith(L),isCollapsed:v,onClose:s,buildUrl:y},R.id)})}),!v&&e.jsxs("div",{className:"mt-4 pt-4",children:[e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-[var(--border-color)] to-transparent mb-3"}),e.jsxs("div",{className:"flex items-center gap-2 px-3",children:[e.jsx("div",{className:"w-1 h-3.5 bg-gradient-to-b from-[var(--color-accent-500)] to-[var(--color-accent-300)] rounded-full"}),e.jsx("span",{className:"text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider",children:r("sidebar.navigation","Navigation")})]})]}),v&&e.jsx("div",{className:"my-3 mx-1",children:e.jsx("div",{className:"h-px bg-gradient-to-r from-transparent via-[var(--border-color)] to-transparent"})})]}),i?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"w-6 h-6 border-2 border-[var(--color-accent-500)] border-t-transparent rounded-full animate-spin"})}):w.modules.length>0?w.modules.map(R=>e.jsx(Ro,{module:R,isExpanded:p.has(R.id),onToggle:()=>$(R.id),onNavigate:A,currentPath:a.pathname,isCollapsed:v},R.id)):!v&&e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] text-center py-8",children:r("sidebar.noModules","Aucun module disponible")})]}),!v&&e.jsxs("div",{className:"p-3",children:[e.jsx("div",{className:"mb-3 h-px bg-gradient-to-r from-transparent via-[var(--border-color)] to-transparent"}),e.jsxs("button",{onClick:()=>A(`/${d||"administration"}`),className:"w-full flex items-center gap-2 px-3 py-2 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-all",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(l.ChevronLeft,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:r("sidebar.backToApps","Retour aux applications")})]})]})]})]})]}):null}const Ls=60,Lo=33;function Do(){const{t}=ne.useTranslation("common"),{isOpen:s,docUrl:r,closeDocPanel:a,panelSize:o,setPanelSize:c}=Ft();if(!s||!r)return null;const i=r.startsWith("http")?r:window.location.origin+r,d=i.includes("?")?"&":"?",u=`${i}${d}embedded=true`,x=o>=Ls-1,m=()=>{c(x?Lo:Ls)};return e.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg-primary)] border-l border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border-color)] bg-[var(--bg-secondary)]",children:[e.jsx("h3",{className:"font-semibold text-sm flex items-center gap-2",children:t("docPanel.title")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:m,className:"p-1.5 rounded hover:bg-[var(--bg-hover)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",title:t(x?"docPanel.minimize":"docPanel.maximize"),children:x?e.jsx(l.Minimize2,{className:"w-4 h-4"}):e.jsx(l.Maximize2,{className:"w-4 h-4"})}),e.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded hover:bg-[var(--bg-hover)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",title:t("docPanel.openInNewTab"),children:e.jsx(l.ExternalLink,{className:"w-4 h-4"})}),e.jsx("button",{onClick:a,className:"p-1.5 rounded hover:bg-[var(--bg-hover)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",title:t("docPanel.close"),children:e.jsx(l.X,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("iframe",{src:u,title:t("docPanel.title"),className:"w-full h-full border-0"})})]})}function Mo({children:t}){const{isOpen:s,panelSize:r,setPanelSize:a}=Ft(),[o,c]=gt.useGroupCallbackRef(),i=n.useRef(r),[d,u]=n.useState(!1);if(n.useEffect(()=>{u(!!o)},[o]),n.useEffect(()=>{o&&d&&i.current!==r&&(o.setLayout({"main-content":100-r,"doc-panel":r}),i.current=r)},[r,o,d]),!s)return e.jsx(e.Fragment,{children:t});const x=f=>{i.current=f.asPercentage,a(f.asPercentage)},m={"main-content":100-r,"doc-panel":r};return e.jsxs(gt.Group,{orientation:"horizontal",className:"h-full",defaultLayout:m,groupRef:c,children:[e.jsx(gt.Panel,{id:"main-content",minSize:40,maxSize:80,children:e.jsx("div",{className:"w-full h-full overflow-auto",children:t})}),e.jsx(gt.Separator,{className:"w-1 bg-[var(--border-color)] hover:bg-[var(--color-primary-400)] transition-colors cursor-col-resize group/separator relative",children:e.jsx("div",{className:"absolute inset-y-0 -left-1 -right-1 group-hover/separator:bg-[var(--color-primary-100)]/20"})}),e.jsx(gt.Panel,{id:"doc-panel",minSize:20,maxSize:60,onResize:x,children:e.jsx(Do,{})})]})}function Fo(){const{t}=ne.useTranslation("common"),{isOpen:s,openDocPanel:r}=Ft();return s?null:e.jsxs("button",{onClick:()=>r(),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 w-3 h-16 items-center justify-center group/toggle transition-all duration-200 z-[100]",title:t("docPanel.open"),"aria-label":t("docPanel.open"),children:[e.jsx("div",{className:"absolute right-0 w-[3px] h-full bg-[var(--border-color)] group-hover/toggle:bg-[var(--color-primary-500)] transition-colors duration-200 rounded-full"}),e.jsx("div",{className:"absolute left-0 -translate-x-full w-6 h-6 flex items-center justify-center bg-[var(--bg-secondary)] border border-[var(--border-color)] group-hover/toggle:border-[var(--color-primary-500)] group-hover/toggle:text-[var(--color-primary-500)] text-[var(--text-muted)] rounded-full shadow-sm transition-all duration-200",children:e.jsx(l.BookOpen,{className:"w-3 h-3"})}),e.jsx("div",{className:"absolute right-6 top-1/2 -translate-y-1/2 px-2 py-1 bg-[var(--bg-primary)] border border-[var(--border-color)] rounded-md shadow-lg opacity-0 group-hover/toggle:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap text-xs font-medium text-[var(--text-primary)]",children:t("docPanel.title")})]})}function Oo(){const{t}=ne.useTranslation("admin"),{license:s,isLoading:r,isReadOnlyMode:a}=Ge(),{user:o}=Ae(),c=et(),[i,d]=n.useState(!1);if(r||!s||i)return null;const u=o?.roles?.includes("SuperAdmin")??!1,x=o?.permissions?.some(b=>b.startsWith("administration.configuration.license")||b==="administration.configuration.*"||b==="administration.*")??!1;if(!u&&!x)return null;const m=s.isInTrial&&s.trialDaysRemaining<=7,f=!s.isInTrial&&s.daysUntilExpiration<=30&&s.status==="Active";if(!(a||m||f))return null;const v=a,g=v?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 text-red-800 dark:text-red-200":"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-200",y=v?l.Shield:l.AlertTriangle;let p;return a?p=t("license.alert.readOnly","Your license has expired. The platform is in read-only mode."):m?p=t("license.alert.trialExpiring","Your trial expires in {{days}} days. Activate a license to continue using the platform.",{days:s.trialDaysRemaining}):p=t("license.alert.expiringSoon","Your license expires in {{days}} days. Renew to avoid service interruption.",{days:s.daysUntilExpiration}),e.jsx("div",{className:`border-b ${g}`,children:e.jsxs("div",{className:"px-4 sm:px-6 lg:px-8 py-2 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(y,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium truncate",children:p})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(N.Link,{to:c("/administration/configuration/license"),className:`text-xs font-medium px-3 py-1 rounded-md transition-colors ${v?"bg-red-100 dark:bg-red-900/40 hover:bg-red-200 dark:hover:bg-red-800/40":"bg-amber-100 dark:bg-amber-900/40 hover:bg-amber-200 dark:hover:bg-amber-800/40"}`,children:t("license.alert.manage","Manage")}),e.jsx("button",{onClick:()=>d(!0),className:"p-1 rounded-md hover:bg-black/10 dark:hover:bg-white/10 transition-colors","aria-label":t("common:dismiss","Dismiss"),children:e.jsx(l.X,{className:"w-3.5 h-3.5"})})]})]})})}function ra(){const{t}=ne.useTranslation("admin"),{license:s,isLoading:r,isReadOnlyMode:a}=Ge(),{user:o}=Ae(),c=et();if(r)return null;const i=o?.roles?.includes("SuperAdmin")??!1,d=o?.permissions?.some(v=>v.startsWith("administration.configuration.license")||v==="administration.configuration.*"||v==="administration.*")??!1;if(!i&&!d)return null;let u,x,m;if(a)u="error",x=l.Shield,m=t("license.contentBanner.expired","Your license has expired. The platform is in restricted mode. Please renew or activate a new license.");else if(s?.status==="Revoked")u="error",x=l.Shield,m=t("license.contentBanner.revoked","Your license has been revoked. Please contact support or activate a new license.");else if(s?.status==="Expired")u="error",x=l.AlertTriangle,m=t("license.contentBanner.expired","Your license has expired. The platform is in restricted mode. Please renew or activate a new license.");else if(s?.status==="NoLicense"||!s)u="warning",x=l.Key,m=t("license.contentBanner.noLicense","No license is activated. Activate a license to use the platform without restrictions.");else if(s.isInTrial&&s.trialDaysRemaining<=7)u="warning",x=l.Clock,m=t("license.contentBanner.trialUrgent","Your trial expires in {{days}} days. Activate a license now to avoid losing access.",{days:s.trialDaysRemaining});else if(s.isInTrial&&s.trialDaysRemaining>7)u="info",x=l.Clock,m=t("license.contentBanner.trial","You are using a trial license. {{days}} days remaining. Activate a license to unlock the full platform.",{days:s.trialDaysRemaining});else return null;const f={error:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",warning:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",info:"bg-[var(--info-bg)] text-[var(--info-text)] border-[var(--info-border)]"},h={error:"bg-[var(--error-border)] hover:opacity-80 text-white",warning:"bg-[var(--warning-border)] hover:opacity-80 text-white",info:"bg-[var(--info-border)] hover:opacity-80 text-white"};return e.jsx("div",{className:`mb-4 rounded-lg border p-4 ${f[u]}`,"data-testid":"license-content-banner",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(x,{className:"w-5 h-5 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:m})]}),e.jsx(N.Link,{to:c("/administration/configuration/license"),className:`text-xs font-medium px-4 py-1.5 rounded-md transition-opacity flex-shrink-0 ${h[u]}`,children:t("license.contentBanner.activate","Activate license")})]})})}function Uo(){const[t,s]=n.useState(!1),{currentAppCode:r}=Re(),{isCollapsed:a}=Lt(),o=!!r;return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>s(!t)}),o&&e.jsx(sa,{isOpen:t,onClose:()=>s(!1)}),e.jsxs("main",{className:`pt-16 transition-all duration-300 h-[calc(100vh-4rem)] ${o?a?"lg:pl-16":"lg:pl-64":""}`,children:[e.jsx(Oo,{}),e.jsx(Mo,{children:e.jsxs("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:[e.jsx(ra,{}),e.jsx(N.Outlet,{})]})})]}),e.jsx(Fo,{})]})}function aa(){return e.jsx(Kr,{children:e.jsx(Uo,{})})}const Bo=Object.freeze(Object.defineProperty({__proto__:null,AppLayout:aa},Symbol.toStringTag,{value:"Module"}));function _o(){return e.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsxs("a",{href:"/",className:"inline-flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl animated-gradient flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-6 h-6 text-white"})}),e.jsx("span",{className:"text-2xl font-bold gradient-text",children:"SmartStack"})]})}),e.jsx("div",{className:"bg-[var(--bg-secondary)] rounded-2xl border border-[var(--border-color)] p-8",children:e.jsx(N.Outlet,{})})]})})}function hs(){const{t}=ne.useTranslation("navigation"),{isAuthenticated:s}=Ae(),[r,a]=n.useState(!1);return e.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 bg-[var(--bg-primary)]/80 backdrop-blur-lg border-b border-[var(--border-color)]",children:e.jsxs("nav",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-3 group",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"w-10 h-10 rounded-xl animated-gradient flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-5 h-5 text-white"})})}),e.jsx("span",{className:"text-xl font-bold gradient-text",children:"SmartStack"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[!1,e.jsx(ps,{}),e.jsx(Ot,{}),s?e.jsx(Wr,{}):e.jsx("a",{href:"/login",className:"hidden md:inline-flex px-4 py-2 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors",children:t("header.login")}),e.jsx("button",{onClick:()=>a(!r),className:"md:hidden p-2 rounded-lg hover:bg-[var(--bg-tertiary)] transition-colors",children:r?e.jsx(l.X,{className:"w-6 h-6"}):e.jsx(l.Menu,{className:"w-6 h-6"})})]})]}),r&&e.jsx("div",{className:"md:hidden py-4 border-t border-[var(--border-color)]",children:e.jsx("div",{className:"flex flex-col gap-4",children:!s&&e.jsx("a",{href:"/login",className:"px-4 py-2 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors text-center",children:t("header.login")})})})]})})}function gs(){const t=new Date().getFullYear();return e.jsx("footer",{className:"bg-[var(--bg-secondary)] border-t border-[var(--border-color)]",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl animated-gradient flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"text-xl font-bold gradient-text",children:"SmartStack"})]}),e.jsx("p",{className:"text-[var(--text-tertiary)] text-sm",children:"Le socle moderne pour vos applications d'entreprise."})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-[var(--text-primary)] mb-4",children:"Produit"}),e.jsxs("ul",{className:"space-y-2",children:[e.jsx("li",{children:e.jsx("a",{href:"#features",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Fonctionnalités"})}),e.jsx("li",{children:e.jsx("a",{href:"#modules",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Modules"})}),e.jsx("li",{children:e.jsx("a",{href:"#pricing",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Tarifs"})})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-[var(--text-primary)] mb-4",children:"Entreprise"}),e.jsxs("ul",{className:"space-y-2",children:[e.jsx("li",{children:e.jsx("a",{href:"#about",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"À propos"})}),e.jsx("li",{children:e.jsx("a",{href:"#contact",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Contact"})}),e.jsx("li",{children:e.jsx("a",{href:"#careers",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Carrières"})})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-[var(--text-primary)] mb-4",children:"Légal"}),e.jsxs("ul",{className:"space-y-2",children:[e.jsx("li",{children:e.jsx("a",{href:"#privacy",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Confidentialité"})}),e.jsx("li",{children:e.jsx("a",{href:"#terms",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Conditions"})}),e.jsx("li",{children:e.jsx("a",{href:"#security",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] text-sm transition-colors",children:"Sécurité"})})]})]})]}),e.jsxs("div",{className:"mt-12 pt-8 border-t border-[var(--border-color)] flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("p",{className:"text-[var(--text-tertiary)] text-sm",children:["© ",t," SmartStack. Tous droits réservés."]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("a",{href:"https://github.com",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(l.Github,{className:"w-5 h-5"})}),e.jsx("a",{href:"https://twitter.com",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(l.Twitter,{className:"w-5 h-5"})}),e.jsx("a",{href:"https://linkedin.com",target:"_blank",rel:"noopener noreferrer",className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(l.Linkedin,{className:"w-5 h-5"})})]})]})]})})}const qo=[{title:"Infrastructure",description:"Architecture technique, structure du projet et technologies utilisees",href:"/system/docs/developer/infrastructure",category:"developer",tags:[".NET 10","React 19","EF Core","SQL Server","architecture"],icon:l.Server},{title:"Installation",description:"Guide complet pour installer et configurer l'environnement de developpement",href:"/system/docs/developer/installation",category:"developer",tags:["setup","configuration","prerequisites","npm","dotnet","CLI","MCP"],icon:l.Download},{title:"Base de donnees",description:"Modele conceptuel de donnees avec schemas, tables et relations",href:"/system/docs/developer/database",category:"developer",tags:["MCD","Schemas","Relations","SQL","EF Core","migrations","ERD","diagramme","nav","auth","usr","support","ten","ai","wkf","cfg","entra","ref","loc","lic","Contexts","Applications","Modules","Sections","Resources","ContextMaintenance","Users","Roles","UserRoles","Permissions","RolePermissions","RefreshTokens","Sessions","Profiles","Preferences","Tickets","TicketComments","TicketAttachments","TicketTemplates","Notifications","Tenants","TenantApplications","TenantUsers","Providers","Models","Prompts","PromptVersions","PromptExecutions","Workflows","WorkflowSteps","WorkflowExecutions","EmailTemplates","Settings","SettingCategories","Groups","GroupMembers","SyncStates","Companies","Departments","Positions","Languages","Translations","Licenses","LicenseFeatures","Status","Type","Priority","TenantId","UserId","RoleId","PermissionId","CreatedAt","UpdatedAt","CreatedBy","UpdatedBy","IsDeleted","DeletedAt","TenantStatus","TicketStatus","TicketPriority","TicketType","UserType","Theme","Pending","Active","Suspended","Archived","Open","InProgress","Resolved","Closed","Low","Medium","High","Critical","Bug","FeatureRequest","Support","Question"],icon:l.Database},{title:"Architecture Dual-DbContext",description:"Separation Core/Extensions pour la distribution NuGet et les projets client",href:"/system/docs/developer/dual-dbcontext",category:"developer",tags:["CoreDbContext","ExtensionsDbContext","NuGet","Migrations","schema"],icon:l.Layers},{title:"FK Cross-Schema",description:"Comment referencer les entites Core depuis vos entites Extensions",href:"/system/docs/developer/cross-schema-fk",category:"developer",tags:["ICoreDataService","GUID FK","No Navigation","foreign key"],icon:l.Link2},{title:"Mode Multi-Tenant",description:"Configuration Single-Tenant vs Multi-Tenant et migration entre les modes",href:"/system/docs/developer/multi-tenant-mode",category:"developer",tags:["Single-Tenant","Multi-Tenant","Configuration","tenant","workspace"],icon:l.Building2},{title:"Integration Microsoft Teams",description:"Embarquer SmartStack dans Teams via Website Tab sans developpement",href:"/system/docs/developer/teams-integration",category:"developer",tags:["Microsoft Teams","Teams","Website Tab","iframe","SSO","embedding"],icon:l.Monitor},{title:"Architecture",description:"Vue d'ensemble de l'architecture fonctionnelle de SmartStack",href:"/system/docs/user/architecture",category:"user",tags:["architecture","modules","navigation","contextes"],icon:l.Layers},{title:"Modules",description:"Liste des modules disponibles et leur configuration",href:"/system/docs/user/modules",category:"user",tags:["modules","fonctionnalites","features"],icon:l.FileText},{title:"Module Support",description:"Documentation complete du module de ticketing et support client",href:"/system/docs/user/support",category:"user",tags:["tickets","support","SLA","escalation","templates"],icon:l.Headphones},{title:"Intelligence Artificielle",description:"Configuration des providers IA, prompts et integrations",href:"/system/docs/user/ai",category:"user",tags:["IA","AI","prompts","OpenAI","Claude","providers"],icon:l.Bot},{title:"Parametres Systeme",description:"Configuration globale et parametres de la plateforme",href:"/system/docs/user/settings",category:"user",tags:["settings","configuration","parametres","systeme"],icon:l.Settings},{title:"Presentation SmartStack",description:"Presentation interactive de la plateforme SmartStack",href:"/system/docs/presentation",category:"user",tags:["presentation","slides","demo","overview"],icon:l.Presentation}];function zo({className:t="",placeholder:s="Rechercher...",onResultClick:r}){const[a,o]=n.useState(""),[c,i]=n.useState(!1),[d,u]=n.useState(0),x=n.useRef(null),m=n.useRef(null),f=N.useNavigate(),h=n.useMemo(()=>{if(!a.trim())return[];const b=a.toLowerCase().split(" ").filter(Boolean);return qo.filter(j=>{const S=[j.title,j.description,...j.tags,j.category].join(" ").toLowerCase();return b.every(w=>S.includes(w))})},[a]);n.useEffect(()=>{u(0)},[h]);const v=b=>{if(!(!c||h.length===0))switch(b.key){case"ArrowDown":b.preventDefault(),u(j=>(j+1)%h.length);break;case"ArrowUp":b.preventDefault(),u(j=>(j-1+h.length)%h.length);break;case"Enter":b.preventDefault(),h[d]&&g(h[d]);break;case"Escape":i(!1),o(""),x.current?.blur();break}},g=b=>{f(b.href),o(""),i(!1),r?.()};n.useEffect(()=>{const b=j=>{m.current&&!m.current.contains(j.target)&&x.current&&!x.current.contains(j.target)&&i(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);const y=b=>b==="developer"?"Developpeur":"Utilisateur",p=b=>b==="developer"?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400";return e.jsxs("div",{className:`relative ${t}`,children:[e.jsxs("div",{className:"relative",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{ref:x,type:"text",value:a,onChange:b=>{o(b.target.value),i(!0)},onFocus:()=>i(!0),onKeyDown:v,placeholder:s,className:"w-full pl-9 pr-8 py-2 text-sm bg-[var(--bg-primary)] border border-[var(--border-color)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary-400)] focus:border-transparent"}),a&&e.jsx("button",{onClick:()=>{o(""),x.current?.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-[var(--bg-hover)]",children:e.jsx(l.X,{className:"w-3 h-3 text-[var(--text-tertiary)]"})})]}),c&&a.trim()&&e.jsxs("div",{ref:m,className:"absolute top-full left-0 right-0 mt-1 bg-[var(--bg-primary)] border border-[var(--border-color)] rounded-lg shadow-lg overflow-hidden z-50 max-h-80 overflow-y-auto",children:[h.length===0?e.jsxs("div",{className:"p-4 text-center text-[var(--text-secondary)] text-sm",children:['Aucun resultat pour "',a,'"']}):e.jsx("div",{className:"py-1",children:h.map((b,j)=>{const S=b.icon;return e.jsxs("button",{onClick:()=>g(b),onMouseEnter:()=>u(j),className:`w-full flex items-start gap-3 px-3 py-2 text-left transition-colors ${j===d?"bg-[var(--color-primary-600)]/10":"hover:bg-[var(--bg-hover)]"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0 ${j===d?"bg-[var(--color-primary-600)] text-white":"bg-[var(--bg-secondary)]"}`,children:e.jsx(S,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:b.title}),e.jsx("span",{className:`px-1.5 py-0.5 text-xs rounded ${p(b.category)}`,children:y(b.category)})]}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)] truncate mt-0.5",children:b.description})]}),e.jsx(l.ArrowRight,{className:`w-4 h-4 flex-shrink-0 mt-2 ${j===d?"text-[var(--color-primary-600)]":"text-[var(--text-tertiary)]"}`})]},b.href)})}),e.jsxs("div",{className:"px-3 py-2 border-t border-[var(--border-color)] bg-[var(--bg-secondary)] text-xs text-[var(--text-tertiary)] flex items-center gap-4",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded bg-[var(--bg-primary)] border border-[var(--border-color)]",children:"↑↓"})," naviguer"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded bg-[var(--bg-primary)] border border-[var(--border-color)]",children:"↵"})," ouvrir"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded bg-[var(--bg-primary)] border border-[var(--border-color)]",children:"esc"})," fermer"]})]})]})]})}const Go=[{title:"Accueil",href:"/system/docs",icon:l.Book},{title:"Developpeur",href:"/system/docs/developer",icon:l.Code,children:[{title:"Infrastructure",href:"/system/docs/developer/infrastructure"},{title:"Installation",href:"/system/docs/developer/installation"},{title:"Base de donnees",href:"/system/docs/developer/database"},{title:"Dual-DbContext",href:"/system/docs/developer/dual-dbcontext"},{title:"FK Cross-Schema",href:"/system/docs/developer/cross-schema-fk"},{title:"Tenant",href:"/system/docs/developer/tenants",children:[{title:"Mode Multi-Tenant",href:"/system/docs/developer/tenants/multi-tenant-mode"},{title:"Tenant B2C",href:"/system/docs/developer/tenants/b2c"}]},{title:"Integration Teams",href:"/system/docs/developer/teams-integration"},{title:"Tests de Securite",href:"/system/docs/developer/testing/security"}]},{title:"Utilisateur",href:"/system/docs/user",icon:l.Users,children:[{title:"Architecture",href:"/system/docs/user/architecture"},{title:"Modules",href:"/system/docs/user/modules"}]},{title:"Analyse metier",href:"/system/docs/ba",icon:l.BarChart3}];function Kt({item:t,isChild:s=!1,depth:r=0}){const o=N.useLocation().pathname===t.href,c="icon"in t?t.icon:null;return e.jsxs(N.NavLink,{to:t.href,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${o?"bg-[var(--color-primary-600)] text-white":"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-primary)]"} ${s?"ml-6":""} ${r>1?"ml-12":""}`,children:[c&&e.jsx(c,{className:"w-4 h-4"}),!c&&s&&e.jsx(l.ChevronRight,{className:"w-3 h-3"}),t.title]})}function na(){const[t,s]=n.useState(!1),r=N.useLocation(),[a]=N.useSearchParams(),o=a.get("embedded")==="true",c=m=>r.pathname===m.href?!0:"children"in m&&Array.isArray(m.children)?m.children.some(f=>r.pathname===f.href?!0:"children"in f&&Array.isArray(f.children)?f.children.some(h=>r.pathname===h.href):!1):!1,i=m=>r.pathname===m.href?!0:m.children?m.children.some(f=>r.pathname===f.href):!1,d=m=>m.children&&i(m)?e.jsx("div",{className:"mt-1 space-y-1",children:m.children.map(f=>e.jsx(Kt,{item:f,isChild:!0,depth:2},f.href))}):null,u=m=>m.children&&c(m)?e.jsx("div",{className:"mt-1 space-y-1",children:m.children.map(f=>e.jsxs("div",{children:[e.jsx(Kt,{item:f,isChild:!0}),d(f)]},f.href))}):null,x=()=>e.jsx("nav",{className:"space-y-1",children:Go.map(m=>e.jsxs("div",{children:[e.jsx(Kt,{item:m}),u(m)]},m.href))});return o?e.jsx("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:e.jsx("main",{className:"p-4 lg:p-6",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(N.Outlet,{})})})}):e.jsx(ms,{children:e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)] flex flex-col",children:[e.jsx(hs,{}),e.jsxs("div",{className:"flex-1 flex pt-16",children:[e.jsx("button",{className:"lg:hidden fixed bottom-4 right-4 z-50 p-3 rounded-full bg-[var(--color-primary-600)] text-white shadow-lg",onClick:()=>s(!t),children:t?e.jsx(l.X,{className:"w-6 h-6"}):e.jsx(l.Menu,{className:"w-6 h-6"})}),t&&e.jsx("div",{className:"lg:hidden fixed inset-0 z-40 bg-black/50",onClick:()=>s(!1)}),e.jsx("aside",{className:`fixed lg:sticky top-16 z-40 lg:z-0 h-[calc(100vh-4rem)] w-64 bg-[var(--bg-secondary)] border-r border-[var(--border-color)] overflow-y-auto transition-transform lg:translate-x-0 ${t?"translate-x-0":"-translate-x-full"}`,children:e.jsxs("div",{className:"p-4",children:[e.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[e.jsx(l.Book,{className:"w-5 h-5 text-[var(--color-primary-600)]"}),"Documentation"]}),e.jsx(zo,{className:"mb-4",placeholder:"Rechercher dans la doc...",onResultClick:()=>s(!1)}),e.jsx(x,{})]})}),e.jsx("main",{className:"flex-1 min-w-0 p-6 lg:p-8",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(N.Outlet,{})})})]}),e.jsx(gs,{})]})})}const Ko=Object.freeze(Object.defineProperty({__proto__:null,DocsLayout:na},Symbol.toStringTag,{value:"Module"}));function oa(){return e.jsx(ms,{children:e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)] flex flex-col",children:[e.jsx(hs,{}),e.jsx("main",{className:"flex-1 pt-16",children:e.jsx(N.Outlet,{})}),e.jsx(gs,{})]})})}const Ho=Object.freeze(Object.defineProperty({__proto__:null,PublicLayout:oa},Symbol.toStringTag,{value:"Module"}));function Vo({items:t,className:s=""}){return e.jsx("nav",{"aria-label":"Breadcrumb",className:`flex items-center gap-1 text-sm ${s}`,children:t.map((r,a)=>{const o=a===t.length-1,c=a===0;return e.jsxs("div",{className:"flex items-center gap-1",children:[a>0&&e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),o?e.jsxs("span",{className:"flex items-center gap-1.5 text-[var(--text-primary)] font-medium",children:[r.icon,r.label]}):r.href?e.jsxs(N.Link,{to:r.href,className:"flex items-center gap-1.5 text-[var(--text-secondary)] hover:text-[var(--color-accent-600)] transition-colors",children:[c&&!r.icon&&e.jsx(l.Home,{className:"w-4 h-4"}),r.icon,r.label]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-[var(--text-secondary)]",children:[r.icon,r.label]})]},`${a}-${r.label}`)})})}function Ht(t,s){return s.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},t)}function Wo(t,s){const r=s.toLowerCase();return Object.values(t).some(a=>a==null?!1:String(a).toLowerCase().includes(r))}function Xo({data:t,columns:s,loading:r=!1,searchable:a=!1,searchPlaceholder:o="Rechercher...",pagination:c,onRowClick:i,getRowKey:d=(w,P)=>String(P),emptyMessage:u="Aucune donnée",emptyIcon:x,headerActions:m,striped:f=!0,compact:h=!1,className:v="",selectable:g=!1,selectedKeys:y=new Set,onSelectionChange:p,searchFilter:b=Wo,defaultSortKey:j,defaultSortDirection:S="asc"}){const[w,P]=n.useState(""),[$,A]=n.useState(j||null),[k,R]=n.useState(S),[L,I]=n.useState(1),[C,O]=n.useState(c?.pageSize||10),_=Array.isArray(t)?t:[],E=n.useMemo(()=>w?_.filter(U=>b(U,w)):_,[_,w,b]),z=n.useMemo(()=>$?[...E].sort((U,Z)=>{const re=Ht(U,$),de=Ht(Z,$);if(re===de)return 0;if(re==null)return 1;if(de==null)return-1;const he=String(re).localeCompare(String(de),void 0,{numeric:!0});return k==="asc"?he:-he}):E,[E,$,k]),W=n.useMemo(()=>{if(!c)return z;const U=(L-1)*C;return z.slice(U,U+C)},[z,c,L,C]),G=c?Math.ceil(z.length/C):1,J=z.length,pe=c?(L-1)*C+1:1,q=c?Math.min(L*C,J):J,Y=U=>{$===U?R(Z=>Z==="asc"?"desc":"asc"):(A(U),R("asc"))},M=U=>{I(Math.max(1,Math.min(U,G)))},te=()=>{if(!p)return;const U=W.map((re,de)=>d(re,de));if(U.every(re=>y.has(re))){const re=new Set(y);U.forEach(de=>re.delete(de)),p(re)}else{const re=new Set(y);U.forEach(de=>re.add(de)),p(re)}},oe=U=>{if(!p)return;const Z=new Set(y);Z.has(U)?Z.delete(U):Z.add(U),p(Z)},le=U=>{P(U),I(1)},F=h?"px-3 py-2":"px-4 py-3",K=h?"px-3 py-2":"px-4 py-3",Q=U=>U.sortable?$===U.key?k==="asc"?e.jsx(l.ChevronUp,{className:"w-4 h-4"}):e.jsx(l.ChevronDown,{className:"w-4 h-4"}):e.jsx(l.ChevronsUpDown,{className:"w-4 h-4 opacity-30"}):null;return e.jsxs("div",{className:`${v}`,children:[(a||m)&&e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-secondary)] pointer-events-none"}),e.jsx("input",{type:"text",value:w,onChange:U=>le(U.target.value),placeholder:o,className:"input w-full pl-10 pr-10"}),w&&e.jsx("button",{onClick:()=>le(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:e.jsx(l.X,{className:"w-4 h-4"})})]}),m&&e.jsx("div",{className:"flex items-center gap-2",children:m})]}),e.jsx("div",{className:"overflow-x-auto border border-[var(--border-color)] rounded-lg",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[var(--bg-secondary)] border-b border-[var(--border-color)]",children:e.jsxs("tr",{children:[g&&e.jsx("th",{className:`${K} w-12`,children:e.jsx("input",{type:"checkbox",checked:W.length>0&&W.every((U,Z)=>y.has(d(U,Z))),onChange:te,className:"rounded border-[var(--border-color)]"})}),s.map(U=>e.jsx("th",{className:`${K} text-${U.align||"left"} text-sm font-medium text-[var(--text-secondary)] ${U.hideOnMobile?"hidden md:table-cell":""} ${U.sortable?"cursor-pointer hover:bg-[var(--bg-tertiary)] select-none":""}`,style:{width:U.width},onClick:()=>U.sortable&&Y(U.key),children:e.jsxs("div",{className:`flex items-center gap-1 ${U.align==="right"?"justify-end":U.align==="center"?"justify-center":""}`,children:[e.jsx("span",{children:U.label}),Q(U)]})},U.key))]})}),e.jsx("tbody",{children:r?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(g?1:0),className:"py-12 text-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 mx-auto animate-spin text-[var(--color-primary-500)]"})})}):W.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:s.length+(g?1:0),className:"py-12 text-center",children:[x&&e.jsx("div",{className:"mb-3",children:x}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:u})]})}):W.map((U,Z)=>{const re=d(U,Z),de=y.has(re),he=(L-1)*C+Z;return e.jsxs("tr",{onClick:()=>i?.(U,he),className:`
13
- border-b border-[var(--border-color)] last:border-b-0
14
- ${f&&Z%2===1?"bg-[var(--bg-secondary)]/50":""}
15
- ${i?"cursor-pointer hover:bg-[var(--bg-tertiary)]":""}
16
- ${de?"bg-[var(--accent-bg)]":""}
17
- transition-colors
18
- `,children:[g&&e.jsx("td",{className:`${F} w-12`,onClick:fe=>fe.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:de,onChange:()=>oe(re),className:"rounded border-[var(--border-color)]"})}),s.map(fe=>e.jsx("td",{className:`${F} text-${fe.align||"left"} ${fe.hideOnMobile?"hidden md:table-cell":""}`,children:fe.render?fe.render(U,he):String(Ht(U,fe.key)??"")},fe.key))]},re)})})]})}),c&&J>0&&e.jsxs("div",{className:"flex items-center justify-between mt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:[pe,"-",q," sur ",J]}),c.showSizeSelector&&e.jsx("select",{value:C,onChange:U=>{O(Number(U.target.value)),I(1)},className:"input py-1 text-sm",children:(c.pageSizeOptions||[10,25,50,100]).map(U=>e.jsxs("option",{value:U,children:[U," / page"]},U))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>M(1),disabled:L===1,className:"btn btn-ghost p-2 disabled:opacity-30",title:"Première page",children:e.jsx(l.ChevronsLeft,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>M(L-1),disabled:L===1,className:"btn btn-ghost p-2 disabled:opacity-30",title:"Page précédente",children:e.jsx(l.ChevronLeft,{className:"w-4 h-4"})}),e.jsxs("span",{className:"px-3 text-sm",children:["Page ",L," / ",G]}),e.jsx("button",{onClick:()=>M(L+1),disabled:L===G,className:"btn btn-ghost p-2 disabled:opacity-30",title:"Page suivante",children:e.jsx(l.ChevronRight,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>M(G),disabled:L===G,className:"btn btn-ghost p-2 disabled:opacity-30",title:"Dernière page",children:e.jsx(l.ChevronsRight,{className:"w-4 h-4"})})]})]})]})}function Yo({data:t,viewMode:s,onViewModeChange:r,renderTable:a,renderCards:o,renderKanban:c,showTableView:i=!0,showCardsView:d=!0,showKanbanView:u=!0,tableLabel:x="Table",cardsLabel:m="Cards",kanbanLabel:f="Kanban"}){const[h,v]=n.useState("table"),g=s??h,y=r??v,p=[{mode:"table",label:x,icon:l.LayoutList,show:i},{mode:"cards",label:m,icon:l.LayoutGrid,show:d},{mode:"kanban",label:f,icon:l.Columns3,show:u}].filter(b=>b.show);return e.jsxs("div",{className:"space-y-4",children:[p.length>1&&e.jsx("div",{className:"flex items-center gap-1 p-1 rounded-[var(--radius-button)] bg-[var(--bg-secondary)] w-fit",children:p.map(({mode:b,label:j,icon:S})=>e.jsxs("button",{onClick:()=>y(b),className:`px-3 py-1.5 rounded-[var(--radius-button)] text-sm font-medium flex items-center gap-2 transition-all ${g===b?"bg-[var(--color-accent-600)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-hover)]"}`,children:[e.jsx(S,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:j})]},b))}),e.jsxs("div",{children:[g==="table"&&a&&a(t),g==="cards"&&o&&o(t),g==="kanban"&&c&&c(t)]})]})}function Jo({viewMode:t,onChange:s,showTable:r=!0,showCards:a=!0,showKanban:o=!0,tableLabel:c="Table",cardsLabel:i="Cards",kanbanLabel:d="Kanban"}){const u=[{mode:"table",label:c,icon:l.LayoutList,show:r},{mode:"cards",label:i,icon:l.LayoutGrid,show:a},{mode:"kanban",label:d,icon:l.Columns3,show:o}].filter(x=>x.show);return u.length<=1?null:e.jsx("div",{className:"flex items-center gap-1 p-1 rounded-[var(--radius-button)] bg-[var(--bg-secondary)] border border-[var(--border-color)]",children:u.map(({mode:x,label:m,icon:f})=>e.jsxs("button",{onClick:()=>s(x),className:`px-3 py-1.5 rounded-[var(--radius-button)] text-sm font-medium flex items-center gap-2 transition-all ${t===x?"bg-[var(--color-accent-600)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-hover)]"}`,children:[e.jsx(f,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:m})]},x))})}function ss({status:t,label:s,showDot:r=!0,size:a="md"}){const o={active:"bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",inactive:"bg-[var(--bg-tertiary)] text-[var(--text-tertiary)] border-[var(--border-color)]",pending:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",warning:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",error:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]"},c={active:"bg-[var(--success-dot)]",inactive:"bg-[var(--text-muted)]",pending:"bg-[var(--warning-dot)]",warning:"bg-[var(--warning-dot)]",error:"bg-[var(--error-dot)]"},i={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-xs"};return e.jsxs("span",{className:`inline-flex items-center gap-1.5 ${i[a]} rounded-[var(--radius-badge)] font-medium border ${o[t]}`,children:[r&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c[t]}`}),s]})}function Qo({title:t,count:s,color:r,children:a,isDragOver:o,isDropDisabled:c,onDragOver:i,onDragLeave:d,onDrop:u}){const x={success:"bg-[var(--success-dot)]",warning:"bg-[var(--warning-dot)]",error:"bg-[var(--error-dot)]",default:"bg-[var(--text-muted)]"};return e.jsxs("div",{className:`min-w-[280px] flex-1 rounded-lg p-2 transition-colors ${o&&!c?"bg-[var(--color-accent-500)]/10 ring-2 ring-[var(--color-accent-500)]/50":""} ${c?"opacity-40":""}`,onDragOver:c?void 0:i,onDragLeave:d,onDrop:c?void 0:u,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${x[r]}`}),e.jsx("h3",{className:"font-semibold text-[var(--text-primary)]",children:t}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-[var(--bg-secondary)] text-[var(--text-secondary)]",children:s})]}),e.jsx("div",{className:"space-y-3 min-h-[100px]",children:a})]})}function Zo({children:t,onClick:s,draggable:r=!0,isDragging:a,onDragStart:o,onDragEnd:c}){return e.jsx("div",{draggable:r,onClick:s,onDragStart:o,onDragEnd:c,className:`bg-[var(--bg-card)] border border-[var(--border-color)] rounded-[var(--radius-card)] p-4 transition-all hover:shadow-md hover:border-[var(--color-accent-500)]/30 cursor-grab active:cursor-grabbing ${a?"opacity-50 scale-95":""}`,children:t})}function ei({page:t,totalPages:s,totalCount:r,pageSize:a=20,onPageChange:o,itemLabel:c="éléments",showInfo:i=!0,showFirstLast:d=!0}){const u=(t-1)*a+1,x=Math.min(t*a,r),m=()=>{const f=[];if(s<=7)for(let h=1;h<=s;h++)f.push(h);else{f.push(1),t>3&&f.push("ellipsis");const h=Math.max(2,t-1),v=Math.min(s-1,t+1);for(let g=h;g<=v;g++)f.includes(g)||f.push(g);t<s-2&&f.push("ellipsis"),f.includes(s)||f.push(s)}return f};return e.jsx("div",{className:"card p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[i&&e.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Affichage de"," ",e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:u})," ","à"," ",e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:x})," ","sur"," ",e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:r})," ",c]}),s>1&&e.jsxs("div",{className:"flex items-center gap-1",children:[d&&e.jsx("button",{onClick:()=>o(1),disabled:t===1,className:"hidden sm:flex btn btn-secondary p-2 disabled:opacity-40 disabled:cursor-not-allowed",title:"Première page",children:e.jsx(l.ChevronsLeft,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>o(Math.max(1,t-1)),disabled:t===1,className:"btn btn-secondary p-2 disabled:opacity-40 disabled:cursor-not-allowed",title:"Page précédente",children:e.jsx(l.ChevronLeft,{className:"w-5 h-5"})}),e.jsx("div",{className:"flex items-center gap-1",children:m().map((f,h)=>f==="ellipsis"?e.jsx("span",{className:"px-2 text-[var(--text-muted)]",children:"..."},`ellipsis-${h}`):e.jsx("button",{onClick:()=>o(f),className:`w-10 h-10 rounded-[var(--radius-button)] text-sm font-medium transition-all ${t===f?"bg-[var(--color-accent-600)] text-white shadow-lg shadow-[var(--color-accent-500)]/30":"btn btn-secondary hover:bg-[var(--bg-hover)]"}`,children:f},`page-${f}`))}),e.jsx("button",{onClick:()=>o(Math.min(s,t+1)),disabled:t===s,className:"btn btn-secondary p-2 disabled:opacity-40 disabled:cursor-not-allowed",title:"Page suivante",children:e.jsx(l.ChevronRight,{className:"w-5 h-5"})}),d&&e.jsx("button",{onClick:()=>o(s),disabled:t===s,className:"hidden sm:flex btn btn-secondary p-2 disabled:opacity-40 disabled:cursor-not-allowed",title:"Dernière page",children:e.jsx(l.ChevronsRight,{className:"w-4 h-4"})})]})]})})}const ti={default:"bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",primary:"bg-[var(--accent-bg)] text-[var(--color-primary-600)]",success:"bg-[var(--success-bg)] text-[var(--success-text)]",warning:"bg-[var(--warning-bg)] text-[var(--warning-text)]",error:"bg-[var(--error-bg)] text-[var(--error-text)]",info:"bg-[var(--info-bg)] text-[var(--info-text)]"};function si({avatar:t,title:s,subtitle:r,description:a,stats:o,badge:c,links:i,actions:d,tags:u,onClick:x,className:m="",customHeader:f,customBody:h,customFooter:v}){const g=["bg-[var(--bg-card)]","border-2 border-[var(--color-accent-200)] dark:border-[var(--color-accent-800)]","rounded-[var(--radius-card)]","overflow-hidden","transition-all","hover:shadow-lg hover:border-[var(--color-accent-400)]","flex flex-col",x?"cursor-pointer":"",m].filter(Boolean).join(" "),y=()=>t?t.imageUrl?e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden flex-shrink-0 shadow-lg",children:e.jsx("img",{src:t.imageUrl,alt:s,className:"w-full h-full object-cover"})}):e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold shadow-lg flex-shrink-0",style:{backgroundColor:t.color},children:t.letter}):null,p=()=>{if(!c)return null;const w=c.icon,P=c.color?{color:c.color}:{};return e.jsxs("div",{className:"group relative",children:[w&&e.jsx(w,{className:"w-5 h-5 text-[var(--color-accent-700)] dark:text-[var(--color-accent-400)]",style:P}),c.tooltip&&e.jsx("div",{className:"absolute top-full right-0 mt-1 px-2 py-1 bg-[var(--bg-primary)] border border-[var(--border-color)] rounded text-xs text-[var(--text-secondary)] whitespace-nowrap opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-10",children:c.tooltip})]})},b=()=>f||e.jsx("div",{className:"bg-[var(--color-accent-50)] dark:bg-[var(--color-accent-900)]/20 p-4 border-b border-[var(--color-accent-200)] dark:border-[var(--color-accent-800)]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y(),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-[var(--text-primary)]",children:s}),r&&e.jsx("code",{className:"text-xs text-[var(--text-secondary)]",children:r})]})]}),p()]})}),j=()=>h||e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[a&&e.jsx("div",{className:"text-sm text-[var(--text-secondary)] line-clamp-2",children:typeof a=="string"?e.jsx("p",{children:a}):a}),o&&e.jsx("div",{className:"text-sm text-[var(--text-secondary)] mt-3",children:typeof o=="string"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:o.split(" ")[0]})," ",o.split(" ").slice(1).join(" ")]}):o}),u&&u.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:u.map(w=>e.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${ti[w.variant||"default"]} ${w.onClick?"cursor-pointer hover:opacity-80":""}`,onClick:w.onClick,children:w.label},w.label))}),i&&i.length>0&&e.jsx("div",{className:"space-y-1.5 pt-2 mt-3 border-t border-[var(--border-color)]",children:i.map(w=>{const P=w.icon;return w.href?e.jsxs("a",{href:w.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] hover:text-[var(--color-accent-600)] transition-colors",onClick:$=>$.stopPropagation(),children:[e.jsx(P,{className:"w-3.5 h-3.5"}),w.label]},w.label):e.jsxs("button",{onClick:$=>{$.stopPropagation(),w.onClick?.()},className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] hover:text-[var(--color-accent-600)] transition-colors",children:[e.jsx(P,{className:"w-3.5 h-3.5"}),w.label]},w.label)})}),e.jsx("div",{className:"flex-1 min-h-4"}),S()]}),S=()=>v||(!d||d.length===0?null:e.jsx("div",{className:"space-y-2 mt-3",children:d.map(w=>{const P=w.icon,$=w.variant||"primary",R=`btn btn-sm flex items-center justify-center gap-1 w-full ${{primary:"bg-[var(--color-accent-500)] hover:bg-[var(--color-accent-600)] text-white",secondary:"bg-[var(--color-accent-700)] hover:bg-[var(--color-accent-800)] text-white",ghost:"bg-transparent border border-[var(--border-color)] text-[var(--text-primary)] hover:bg-[var(--bg-secondary)]"}[$]} ${w.disabled?"opacity-50 cursor-not-allowed":""}`,L=w.loading&&e.jsx("span",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),I=!w.loading&&P&&e.jsx(P,{className:"w-4 h-4"});return w.href?e.jsxs("a",{href:w.href,target:"_blank",rel:"noopener noreferrer",className:R,onClick:C=>C.stopPropagation(),children:[L,I,w.label]},w.label):e.jsxs("button",{onClick:C=>{C.stopPropagation(),w.onClick?.()},disabled:w.disabled||w.loading,className:R,children:[L,I,w.label]},w.label)})}));return e.jsxs("div",{className:g,onClick:x,children:[b(),j()]})}function ri({columns:t,items:s,getItemId:r,getItemColumn:a,onMoveItem:o,renderCard:c,loading:i=!1,onAddItem:d,onCardClick:u,cardActions:x,emptyColumnMessage:m="Aucun élément",className:f="",columnMinWidth:h="280px",disabled:v=!1}){const[g,y]=n.useState(null),[p,b]=n.useState(null),[j,S]=n.useState(null),w=n.useCallback(C=>{C.onClick(),S(null)},[]),P=n.useCallback((C,O)=>e.jsxs("button",{onClick:_=>{_.stopPropagation(),w(C)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-[var(--bg-tertiary)]",children:[C.icon,C.label]},O),[w]),$=n.useCallback(C=>s.filter(O=>a(O)===C),[s,a]),A=(C,O)=>{v||(y(O),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",O))},k=(C,O)=>{v||!g||(C.preventDefault(),C.dataTransfer.dropEffect="move",b(O))},R=()=>{b(null)},L=(C,O)=>{if(v)return;C.preventDefault();const _=C.dataTransfer.getData("text/plain");_&&o(_,O),y(null),b(null)},I=()=>{y(null),b(null)};return i?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-500)]"})}):e.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${f}`,children:t.map(C=>{const O=$(C.id),_=p===C.id,E=C.maxItems!==void 0&&O.length>=C.maxItems;return e.jsxs("div",{className:`flex-shrink-0 flex flex-col rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-color)] ${_?"ring-2 ring-[var(--color-primary-500)]":""}`,style:{minWidth:h,maxWidth:h},onDragOver:z=>k(z,C.id),onDragLeave:R,onDrop:z=>L(z,C.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[C.color&&e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),e.jsx("h3",{className:"font-semibold text-sm text-[var(--text-primary)]",children:C.title}),e.jsxs("span",{className:"text-xs text-[var(--text-secondary)] px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)]",children:[O.length,C.maxItems!==void 0&&` / ${C.maxItems}`]})]}),d&&C.canAddItem!==!1&&!E&&e.jsx("button",{onClick:()=>d(C.id),className:"btn btn-ghost p-1 hover:bg-[var(--bg-tertiary)]",title:"Ajouter","aria-label":`Ajouter à ${C.title}`,children:e.jsx(l.Plus,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 overflow-y-auto max-h-[calc(100vh-300px)]",children:[O.length===0?e.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)] text-sm",children:m}):O.map((z,W)=>{const G=r(z),J=g===G,pe=x?.(z);return e.jsxs("div",{draggable:!v,onDragStart:q=>A(q,G),onDragEnd:I,onClick:()=>u?.(z),className:`
19
- relative group
20
- bg-[var(--bg-card)] border border-[var(--border-color)] rounded-lg
21
- ${v?"":"cursor-grab active:cursor-grabbing"}
22
- ${J?"opacity-50 ring-2 ring-[var(--color-primary-500)]":""}
23
- ${u?"hover:border-[var(--color-primary-500)]":""}
24
- transition-all
25
- `,children:[!v&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(l.GripVertical,{className:"w-4 h-4 text-[var(--text-secondary)]"})}),e.jsx("div",{className:`p-3 ${v?"":"pl-6"}`,children:c(z,W)}),pe&&pe.length>0&&e.jsxs("div",{className:"absolute top-2 right-2",children:[e.jsx("button",{onClick:q=>{q.stopPropagation(),S(j===G?null:G)},className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100 hover:bg-[var(--bg-tertiary)]","aria-label":"Actions",children:e.jsx(l.MoreHorizontal,{className:"w-4 h-4"})}),j===G&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>S(null)}),e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-lg shadow-lg py-1 min-w-[150px]",children:pe.map((q,Y)=>P(q,Y))})]})]})]},G)}),_&&O.length>0&&e.jsx("div",{className:"h-16 border-2 border-dashed border-[var(--color-primary-500)] rounded-lg bg-[var(--accent-bg)] flex items-center justify-center",children:e.jsx("span",{className:"text-sm text-[var(--color-primary-500)]",children:"Déposer ici"})})]})]},C.id)})})}function ai({title:t,subtitle:s,icon:r,actions:a}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r,t]}),s&&e.jsx("p",{className:"text-[var(--text-secondary)]",children:s})]}),a&&e.jsx("div",{className:"flex items-center gap-3",children:a})]})}const Vt={granted:{icon:l.Check,color:"var(--success-text)",bg:"var(--success-bg)",label:"Accordé"},denied:{icon:l.X,color:"var(--error-text)",bg:"var(--error-bg)",label:"Refusé"},partial:{icon:l.Minus,color:"var(--warning-text)",bg:"var(--warning-bg)",label:"Partiel"},inherited:{icon:l.Check,color:"var(--info-text)",bg:"var(--info-bg)",label:"Hérité"},none:{icon:l.Minus,color:"var(--text-tertiary)",bg:"transparent",label:"Non défini"}};function ni({rows:t,columns:s,getRowId:r,getRowLabel:a,getRowGroup:o,getRowSubGroup:c,getRowIcon:i,isRowLocked:d,getRowChildCount:u,getColumnId:x,getColumnLabel:m,getColumnShortLabel:f,isColumnLocked:h,getColumnColor:v,getCellState:g,onCellClick:y,loading:p=!1,showLegend:b=!0,searchable:j=!1,rowColumnWidth:S="250px",cellWidth:w="44px",className:P="",emptyMessage:$="Aucune donnée",canEditLocked:A=!1}){const[k,R]=n.useState(new Set),[L,I]=n.useState(""),C=n.useMemo(()=>{const q=new Map;return t.forEach(Y=>{const M=o?.(Y)||"_default",te=c?.(Y);q.has(M)||q.set(M,{rows:[],subGroups:new Map});const oe=q.get(M);te?(oe.subGroups.has(te)||oe.subGroups.set(te,[]),oe.subGroups.get(te).push(Y)):oe.rows.push(Y)}),q},[t,o,c]),O=n.useCallback((q,Y)=>{const M=new Map;return q.forEach((te,oe)=>{const le=te.filter(F=>a(F).toLowerCase().includes(Y));le.length>0&&M.set(oe,le)}),M},[a]),_=n.useMemo(()=>{if(!L)return C;const q=L.toLowerCase(),Y=new Map;return C.forEach((M,te)=>{const oe=M.rows.filter(F=>a(F).toLowerCase().includes(q)),le=O(M.subGroups,q);(oe.length>0||le.size>0)&&Y.set(te,{rows:oe,subGroups:le})}),Y},[C,L,a,O]),E=q=>{R(Y=>{const M=new Set(Y);return M.has(q)?M.delete(q):M.add(q),M})},z=n.useCallback((q,Y,M,te)=>{y&&(M&&!A||te&&!A||y(q,Y))},[y,A]),W=n.useCallback((q,Y)=>!(!y||q&&!A||Y&&!A),[y,A]),G=(q,Y)=>`w-full h-full min-h-[32px] flex items-center justify-center rounded transition-colors ${q?"hover:opacity-80 cursor-pointer":"cursor-default"} ${Y!=="none"?"":"opacity-30"}`,J=n.useCallback((q,Y,M,te,oe,le,F,K)=>{const Q=te.icon,U=W(oe,le);return e.jsx("td",{className:"px-0 py-1 text-center",style:{width:w},children:e.jsx("button",{type:"button",onClick:()=>z(q,Y,oe,le),disabled:!U,className:G(U,M),style:{backgroundColor:te.bg},title:`${a(F)} × ${m(K)}: ${te.label}`,children:M!=="none"&&e.jsx(Q,{className:"w-4 h-4",style:{color:te.color}})})},`${q}-${Y}`)},[y,A,z,w,a,m,W,G]),pe=n.useCallback((q,Y,M,te,oe)=>{const le=r(q),F=d?.(q)||!1,K=i?.(q),Q=Y%2===0?"bg-[var(--bg-primary)]":"bg-[var(--bg-secondary)]/50",U=Y%2===0?"":"bg-[var(--bg-secondary)]/50";return e.jsxs("tr",{className:`hover:bg-[var(--bg-tertiary)] ${U}`,children:[e.jsx("td",{className:`sticky left-0 z-10 px-3 py-2 pl-12 ${Q}`,style:{width:te},children:e.jsxs("div",{className:"flex items-center gap-2",children:[K,F&&e.jsx(l.Lock,{className:"w-3 h-3 text-[var(--warning-text)]"}),e.jsx("span",{className:"text-sm text-[var(--text-primary)]",children:a(q)})]})}),M.map(Z=>{const re=x(Z),de=h?.(Z)||!1,he=oe(le,re),fe=Vt[he];return J(le,re,he,fe,F,de,q,Z)})]},le)},[r,d,i,a,x,h,J]);return p?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-500)]"})}):t.length===0||s.length===0?e.jsx("div",{className:"text-center py-12 text-[var(--text-secondary)]",children:$}):e.jsxs("div",{className:`space-y-4 ${P}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[j&&e.jsxs("div",{className:"relative max-w-xs",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("input",{type:"text",value:L,onChange:q=>I(q.target.value),placeholder:"Rechercher...",className:"input pl-10 w-full"})]}),b&&e.jsx("div",{className:"flex items-center gap-4 text-xs",children:Object.entries(Vt).map(([q,Y])=>{if(q==="none")return null;const M=Y.icon;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center",style:{backgroundColor:Y.bg},children:e.jsx(M,{className:"w-3 h-3",style:{color:Y.color}})}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:Y.label})]},q)})})]}),e.jsx("div",{className:"overflow-x-auto border border-[var(--border-color)] rounded-lg",children:e.jsxs("table",{className:"border-collapse",style:{width:"auto"},children:[e.jsx("thead",{className:"bg-[var(--bg-secondary)]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky left-0 z-20 bg-[var(--bg-secondary)] px-3 text-left text-xs font-medium text-[var(--text-secondary)] uppercase tracking-wider border-b border-[var(--border-color)]",style:{width:S,minWidth:S,height:"120px",verticalAlign:"bottom",paddingBottom:"12px"},children:"Ressource"}),s.map(q=>{const Y=x(q),M=f?.(q)||m(q),te=h?.(q),oe=v?.(q);return e.jsx("th",{className:"relative overflow-visible border-b border-[var(--border-color)]",style:{width:w,minWidth:w,maxWidth:w,height:"120px",padding:0,verticalAlign:"bottom"},children:e.jsx("div",{className:"absolute bottom-2 left-1/2",style:{transform:"translateX(-6px) rotate(-55deg)",transformOrigin:"bottom left",width:"100px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[te&&e.jsx(l.Lock,{className:"w-3 h-3 flex-shrink-0 text-[var(--warning-text)]"}),e.jsx("span",{className:"text-[10px] font-medium text-[var(--text-primary)] whitespace-nowrap",style:{color:oe},title:m(q),children:M})]})})},Y)})]})}),e.jsx("tbody",{children:Array.from(_.entries()).map(([q,Y])=>{const M=k.has(q),te=q==="_default",oe=Y.rows.length+Array.from(Y.subGroups.values()).reduce((le,F)=>le+F.length,0);return e.jsxs("tbody",{children:[!te&&e.jsxs("tr",{className:"bg-[var(--color-accent-900)]/30",children:[e.jsx("td",{className:"sticky left-0 z-10 px-3 py-2 bg-[var(--color-accent-900)]/30",style:{width:S},children:e.jsxs("button",{onClick:()=>E(q),className:"flex items-center gap-2 w-full text-left hover:opacity-80",children:[M?e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--color-accent-400)]"}):e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--color-accent-400)]"}),e.jsx("span",{className:"text-sm font-bold text-[var(--color-accent-300)] uppercase",children:q}),e.jsxs("span",{className:"text-xs text-[var(--color-accent-400)]",children:["(",oe,")"]})]})}),e.jsx("td",{colSpan:s.length})]}),!M&&e.jsxs(e.Fragment,{children:[Y.rows.map((le,F)=>{const K=r(le),Q=d?.(le)||!1,U=i?.(le),Z=u?.(le),re=F%2===0?"bg-[var(--bg-primary)]":"bg-[var(--bg-secondary)]/50",de=F%2===0?"":"bg-[var(--bg-secondary)]/50";return e.jsxs("tr",{className:`hover:bg-[var(--bg-tertiary)] ${de}`,children:[e.jsx("td",{className:`sticky left-0 z-10 px-3 py-2 ${re}`,style:{width:S},children:e.jsxs("div",{className:"flex items-center gap-2",children:[U,Q&&e.jsx(l.Lock,{className:"w-3 h-3 text-[var(--warning-text)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:a(le)}),Z!==void 0&&e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["(",Z,")"]})]})}),s.map(he=>{const fe=x(he),Ne=h?.(he)||!1,Be=g(K,fe),Ke=Vt[Be];return J(K,fe,Be,Ke,Q,Ne,le,he)})]},K)}),Array.from(Y.subGroups.entries()).map(([le,F])=>e.jsxs("tbody",{children:[e.jsxs("tr",{className:"bg-[var(--bg-tertiary)]",children:[e.jsx("td",{className:"sticky left-0 z-10 px-3 py-1 pl-8 bg-[var(--bg-tertiary)]",style:{width:S},children:e.jsxs("span",{className:"text-xs font-semibold text-[var(--text-secondary)] uppercase",children:[le," (",F.length,")"]})}),e.jsx("td",{colSpan:s.length})]}),F.map((K,Q)=>pe(K,Q,s,S,g))]},le))]})]},q)})})]})})]})}const oi=[{size:"none",icon:"square"},{size:"small",icon:"rounded"},{size:"medium",icon:"rounded"},{size:"large",icon:"rounded"},{size:"xlarge",icon:"rounded"},{size:"xxlarge",icon:"rounded"}];function ot({label:t,element:s,value:r,onChange:a}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-[var(--text-secondary)]",children:t}),e.jsx("div",{className:"flex flex-wrap gap-2",children:oi.map(({size:o})=>e.jsx("button",{onClick:()=>a(s,o),className:`px-3 py-2 text-xs font-medium transition-all ${r===o?"bg-[var(--color-accent-500)] text-white":"bg-[var(--bg-tertiary)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"}`,style:{borderRadius:Je[o]},children:Oa[o]},o))})]})}const ii=({selectedThemeTenant:t,setSelectedThemeTenant:s,currentTenant:r,t:a})=>e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Globe,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:a("theme.scope.title","Portée du thème")})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:a("theme.scope.description","Choisissez si ce thème s'applique à tous vos espaces ou uniquement à l'espace actuel")}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>s(null),className:`flex-1 flex items-center gap-3 p-4 transition-all border ${t===null?"border-[var(--color-accent-500)] bg-[var(--accent-bg)]":"border-[var(--border-color)] bg-[var(--bg-secondary)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsx(l.Globe,{className:`w-5 h-5 ${t===null?"text-[var(--color-accent-500)]":"text-[var(--text-muted)]"}`}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:`font-medium ${t===null?"text-[var(--text-primary)]":"text-[var(--text-secondary)]"}`,children:a("theme.scope.global","Global")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:a("theme.scope.globalDesc","Tous les espaces")})]}),t===null&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)] ml-auto"})]}),e.jsxs("button",{type:"button",onClick:()=>s(r.id),className:`flex-1 flex items-center gap-3 p-4 transition-all border ${t===r.id?"border-[var(--color-accent-500)] bg-[var(--accent-bg)]":"border-[var(--border-color)] bg-[var(--bg-secondary)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsx(l.Building2,{className:`w-5 h-5 ${t===r.id?"text-[var(--color-accent-500)]":"text-[var(--text-muted)]"}`}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:`font-medium ${t===r.id?"text-[var(--text-primary)]":"text-[var(--text-secondary)]"}`,children:r.name}),e.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:a("theme.scope.tenantDesc","Espace actuel uniquement")})]}),t===r.id&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)] ml-auto"})]})]})]});function li({onSync:t,isSyncing:s=!1,syncSuccess:r=!1}){const{t:a}=ne.useTranslation("preferences"),{config:o,mode:c,setMode:i,setBorderRadius:d,setAccentColor:u,setItemPalette:x,applyPreset:m,resetToDefault:f,selectedThemeTenant:h,setSelectedThemeTenant:v}=St(),{currentTenant:g,hasMultipleTenants:y}=Ee(),p=y&&g;return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)]",children:"Personnalisation"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Personnalisez l'apparence de l'interface"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx("button",{type:"button",onClick:t,disabled:s,className:"flex items-center gap-2 px-3 py-2 text-sm font-medium text-white bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",style:{borderRadius:"var(--radius-button)"},children:s?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),"Sync..."]}):r?e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{className:"w-4 h-4"}),"Synchronisé"]}):e.jsxs(e.Fragment,{children:[e.jsx(l.RefreshCw,{className:"w-4 h-4"}),"Synchroniser"]})}),e.jsxs("button",{onClick:f,className:"flex items-center gap-2 px-3 py-2 text-sm text-[var(--text-secondary)] bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",style:{borderRadius:"var(--radius-button)"},children:[e.jsx(l.RotateCcw,{className:"w-4 h-4"}),"Réinitialiser"]})]})]}),p&&e.jsx(ii,{selectedThemeTenant:h,setSelectedThemeTenant:v,currentTenant:g,t:a}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Thèmes prédéfinis"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:Ba.map(b=>{const j=o.accentColorKey===b.config.accentColorKey&&JSON.stringify(o.borderRadius)===JSON.stringify(b.config.borderRadius);return e.jsxs("button",{onClick:()=>m(b.config),className:`p-4 text-left transition-all border ${j?"border-[var(--color-accent-500)] bg-[var(--accent-bg)]":"border-[var(--border-color)] bg-[var(--bg-secondary)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-2xl",children:b.icon}),j&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)]"})]}),e.jsx("div",{className:"font-semibold text-[var(--text-primary)]",children:b.name}),e.jsx("div",{className:"text-xs text-[var(--text-muted)] mt-1",children:b.description})]},b.id)})})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Mode d'affichage"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:()=>i("light"),className:`flex-1 flex items-center justify-center gap-3 p-4 transition-all border ${c==="light"?"border-[var(--color-accent-500)] bg-[var(--accent-bg)]":"border-[var(--border-color)] bg-[var(--bg-secondary)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsx(l.Sun,{className:`w-5 h-5 ${c==="light"?"text-amber-500":"text-[var(--text-muted)]"}`}),e.jsx("span",{className:`font-medium ${c==="light"?"text-[var(--text-primary)]":"text-[var(--text-secondary)]"}`,children:"Clair"})]}),e.jsxs("button",{onClick:()=>i("dark"),className:`flex-1 flex items-center justify-center gap-3 p-4 transition-all border ${c==="dark"?"border-[var(--color-accent-500)] bg-[var(--accent-bg)]":"border-[var(--border-color)] bg-[var(--bg-secondary)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsx(l.Moon,{className:`w-5 h-5 ${c==="dark"?"text-[var(--color-accent-400)]":"text-[var(--text-muted)]"}`}),e.jsx("span",{className:`font-medium ${c==="dark"?"text-[var(--text-primary)]":"text-[var(--text-secondary)]"}`,children:"Sombre"})]})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Palette,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Couleur d'accent"})]}),e.jsx("div",{className:"flex flex-wrap gap-3",children:Object.entries(Ue).map(([b,{name:j,shades:S}])=>e.jsx("button",{onClick:()=>u(b),className:`relative w-10 h-10 transition-all ${o.accentColorKey===b?"ring-2 ring-offset-2 ring-[var(--border-strong)]":""}`,style:{backgroundColor:S[500],borderRadius:"var(--radius-button)"},title:j,children:o.accentColorKey===b&&e.jsx(l.Check,{className:"absolute inset-0 m-auto w-5 h-5 text-white"})},b))}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Couleur actuelle: ",e.jsx("span",{className:"font-medium text-[var(--color-accent-500)]",children:Ue[o.accentColorKey]?.name})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Layers,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Palette des éléments"})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Choisissez une palette de couleurs pour les cards et éléments de l'interface"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:Object.entries(dt).map(([b,j])=>{const S=c==="dark"?j.colors.dark:j.colors.light,w=o.itemPaletteKey===b;return e.jsxs("button",{onClick:()=>x(b),className:`p-4 text-left transition-all border ${w?"border-[var(--color-accent-500)] ring-2 ring-[var(--color-accent-500)] ring-opacity-30":"border-[var(--border-color)] hover:border-[var(--border-strong)]"}`,style:{borderRadius:"var(--radius-card)"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-xl",children:j.icon}),w&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)]"})]}),e.jsxs("div",{className:"flex h-8 mb-3 rounded overflow-hidden border",style:{borderColor:S.dark},children:[e.jsx("div",{className:"flex-1",style:{backgroundColor:S.light}}),e.jsx("div",{className:"flex-1",style:{backgroundColor:S.medium}}),e.jsx("div",{className:"flex-1",style:{backgroundColor:S.dark}})]}),e.jsx("div",{className:"font-semibold text-[var(--text-primary)] text-sm",children:j.name})]},b)})}),e.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Palette actuelle: ",e.jsx("span",{className:"font-medium text-[var(--color-accent-500)]",children:dt[o.itemPaletteKey]?.name})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Square,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Style des coins"})]}),e.jsxs("div",{className:"space-y-4 p-4 bg-[var(--bg-secondary)] border border-[var(--border-color)]",style:{borderRadius:"var(--radius-card)"},children:[e.jsx(ot,{label:"Cards & Containers",element:"card",value:o.borderRadius.card,onChange:d}),e.jsx(ot,{label:"Boutons",element:"button",value:o.borderRadius.button,onChange:d}),e.jsx(ot,{label:"Badges",element:"badge",value:o.borderRadius.badge,onChange:d}),e.jsx(ot,{label:"Champs de saisie",element:"input",value:o.borderRadius.input,onChange:d}),e.jsx(ot,{label:"Modales",element:"modal",value:o.borderRadius.modal,onChange:d}),e.jsx(ot,{label:"Éléments de menu",element:"menuItem",value:o.borderRadius.menuItem,onChange:d})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Circle,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] uppercase tracking-wider",children:"Aperçu"})]}),e.jsx("div",{className:"p-6 bg-[var(--bg-secondary)] border border-[var(--border-color)]",style:{borderRadius:"var(--radius-card)"},children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"badge-success px-3 py-1 text-xs font-medium",children:"Succès"}),e.jsx("span",{className:"badge-warning px-3 py-1 text-xs font-medium",children:"Attention"}),e.jsx("span",{className:"badge-error px-3 py-1 text-xs font-medium",children:"Erreur"}),e.jsx("span",{className:"badge-info px-3 py-1 text-xs font-medium",children:"Info"}),e.jsx("span",{className:"badge-accent px-3 py-1 text-xs font-medium",children:"Accent"})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx("button",{className:"btn btn-primary",children:"Bouton primaire"}),e.jsx("button",{className:"btn btn-secondary",children:"Bouton secondaire"}),e.jsx("button",{className:"btn btn-ghost",children:"Bouton ghost"})]}),e.jsx("div",{children:e.jsx("input",{type:"text",placeholder:"Champ de saisie exemple...",className:"input w-full"})}),e.jsx("div",{className:"card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-[var(--color-accent-500)] to-[var(--color-accent-600)] flex items-center justify-center text-white font-bold",style:{borderRadius:"var(--radius-button)"},children:"A"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold text-[var(--text-primary)]",children:["Exemple de card (",dt[o.itemPaletteKey]?.name,")"]}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)]",children:"Cette card utilise la palette sélectionnée"})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card p-3",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Card 1"}),e.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Aperçu du style"})]}),e.jsxs("div",{className:"card p-3",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Card 2"}),e.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Aperçu du style"})]})]})]})})]})]})}function ci({title:t,description:s,icon:r,showBackButton:a=!0,backUrl:o,children:c}){const{t:i}=ne.useTranslation("common"),d=N.useNavigate(),u=()=>{d(o||-1)};return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:e.jsxs("div",{className:"max-w-md w-full text-center",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-gradient-to-br from-amber-100 to-orange-100 dark:from-amber-900/30 dark:to-orange-900/30 flex items-center justify-center",children:r||e.jsx(l.Construction,{className:"w-10 h-10 text-amber-600 dark:text-amber-400"})}),e.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)] mb-3",children:t||i("underDevelopment.title","En cours de développement")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:s||i("underDevelopment.description","Cette fonctionnalité est actuellement en cours de développement et sera disponible prochainement.")}),e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-8",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-sm text-[var(--text-muted)]",children:i("underDevelopment.workInProgress","Travail en cours")})]}),c,a&&e.jsxs("button",{onClick:u,className:"btn btn-secondary inline-flex items-center gap-2",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),i("common.back","Retour")]})]})})}function di({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}const ui=[{path:"/administration",icon:l.LayoutDashboard,labelKey:"sidebar.dashboard",exact:!0},{path:"/administration/users",icon:l.Users,labelKey:"sidebar.users"},{path:"/administration/roles",icon:l.Key,labelKey:"sidebar.roles"}];function mi({isOpen:t=!0,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),{favorites:o,loading:c}=ze(),{expandFavorites:i,clearExpand:d}=ze(),[u,x]=n.useState(!1);n.useEffect(()=>{i&&(queueMicrotask(()=>{x(!1)}),d())},[i,d]);const m=(h,v)=>v?a.pathname===h:a.pathname.startsWith(h),f=e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"lg:hidden flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsx("span",{className:"font-semibold",children:"Menu"}),e.jsx("button",{onClick:s,className:"p-2 hover:bg-[var(--bg-tertiary)]",style:{borderRadius:"var(--radius-button)"},children:e.jsx(l.X,{className:"w-5 h-5"})})]}),e.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[!c&&o.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider hover:text-[var(--text-primary)] transition-colors",children:[u?e.jsx(l.ChevronRight,{className:"w-3.5 h-3.5"}):e.jsx(l.ChevronDown,{className:"w-3.5 h-3.5"}),e.jsx(l.Star,{className:"w-3.5 h-3.5"}),r("common:favorites.quickAccess")]}),e.jsx(N.Link,{to:"/myspace/preferences?tab=favorites",onClick:s,className:"p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},title:r("common:favorites.manage"),children:e.jsx(l.Settings,{className:"w-3.5 h-3.5"})})]}),!u&&e.jsx("div",{className:"space-y-0.5",children:o.map(h=>{const v=a.pathname===h.route;return e.jsxs(N.Link,{to:h.route,onClick:s,className:`flex items-center gap-3 px-3 py-2 transition-colors ${v?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:`${h.label} (${h.applicationLabel})`,children:[e.jsx(di,{name:h.icon,className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium truncate",children:h.label})]},h.id)})}),e.jsx("div",{className:"my-3 border-b border-[var(--border-color)]"})]}),ui.map(h=>{const v=h.icon,g=m(h.path,h.exact);return e.jsxs(N.Link,{to:h.path,onClick:s,className:`flex items-center gap-3 px-3 py-2.5 transition-colors ${g?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx(v,{className:"w-5 h-5"}),e.jsx("span",{className:"font-medium",children:r(h.labelKey)})]},h.path)})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("aside",{className:"hidden lg:block w-64 h-[calc(100vh-4rem)] fixed top-16 left-0 bg-[var(--bg-secondary)] border-r border-[var(--border-color)]",children:f}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"lg:hidden fixed inset-0 bg-black/50 z-40",onClick:s}),e.jsx("aside",{className:"lg:hidden fixed top-0 left-0 h-full w-64 bg-[var(--bg-secondary)] border-r border-[var(--border-color)] z-50",children:f})]})]})}function Ds({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function xi({isOpen:t=!0,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),{favorites:o,loading:c}=ze(),{expandFavorites:i,clearExpand:d}=ze(),{isCollapsed:u,toggleCollapsed:x}=Lt(),{getApplicationsByZone:m}=Re(),[f,h]=n.useState(!1),y=m("personal").find(j=>j.code==="myspace"||j.code==="core_myspace")?.modules||[];n.useEffect(()=>{i&&(queueMicrotask(()=>{h(!1)}),d())},[i,d]);const p=(j,S)=>S?a.pathname===j:a.pathname.startsWith(j),b=e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"lg:hidden flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsx("span",{className:"font-semibold",children:"Menu"}),e.jsx("button",{onClick:s,className:"p-2 hover:bg-[var(--bg-tertiary)]",style:{borderRadius:"var(--radius-button)"},children:e.jsx(l.X,{className:"w-5 h-5"})})]}),e.jsxs("nav",{className:`flex-1 overflow-y-auto space-y-1 ${u?"p-2":"p-4"}`,children:[!c&&o.length>0&&e.jsxs("div",{className:"mb-4",children:[!u&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsxs("button",{onClick:()=>h(!f),className:"flex items-center gap-2 text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wider hover:text-[var(--text-primary)] transition-colors",children:[f?e.jsx(l.ChevronRight,{className:"w-3.5 h-3.5"}):e.jsx(l.ChevronDown,{className:"w-3.5 h-3.5"}),e.jsx(l.Star,{className:"w-3.5 h-3.5"}),r("common:favorites.quickAccess")]}),e.jsx(N.Link,{to:"/myspace/preferences?tab=favorites",onClick:s,className:"p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},title:r("common:favorites.manage"),children:e.jsx(l.Settings,{className:"w-3.5 h-3.5"})})]}),(u||!f)&&e.jsx("div",{className:"space-y-0.5",children:o.map(j=>{const S=a.pathname===j.route;return e.jsxs(N.Link,{to:j.route,onClick:s,className:`relative group flex items-center transition-colors ${u?"justify-center px-2 py-2":"gap-3 px-3 py-2"} ${S?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:u?`${j.label} (${j.applicationLabel})`:void 0,children:[e.jsx(Ds,{name:j.icon,className:"w-4 h-4 flex-shrink-0"}),!u&&e.jsx("span",{className:"text-sm font-medium truncate",children:j.label}),u&&e.jsx("div",{className:"absolute left-full top-0 ml-2 px-3 py-2 bg-[var(--bg-secondary)] border border-[var(--border-color)] shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50",style:{borderRadius:"var(--radius-menu-item)"},children:e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:j.label})})]},j.id)})}),!u&&e.jsx("div",{className:"my-3 border-b border-[var(--border-color)]"})]}),e.jsxs(N.Link,{to:"/myspace",onClick:s,className:`relative group flex items-center transition-colors ${u?"justify-center px-2 py-2.5":"gap-3 px-3 py-2.5"} ${p("/myspace",!0)?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:u?r("sidebar.dashboard"):void 0,children:[e.jsx(l.LayoutDashboard,{className:"w-5 h-5 flex-shrink-0"}),!u&&e.jsx("span",{className:"font-medium",children:r("sidebar.dashboard")}),u&&e.jsx("div",{className:"absolute left-full top-0 ml-2 px-3 py-2 bg-[var(--bg-secondary)] border border-[var(--border-color)] shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50",style:{borderRadius:"var(--radius-menu-item)"},children:e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r("sidebar.dashboard")})})]}),y.map(j=>{const S=j.route||`/myspace/${j.code}`,w=p(S);return e.jsxs(N.Link,{to:S,onClick:s,className:`relative group flex items-center transition-colors ${u?"justify-center px-2 py-2.5":"gap-3 px-3 py-2.5"} ${w?"bg-[var(--accent-bg)] text-[var(--color-accent-500)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] hover:text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},title:u?j.label:void 0,children:[e.jsx(Ds,{name:j.icon||"Star",className:"w-5 h-5 flex-shrink-0"}),!u&&e.jsx("span",{className:"font-medium",children:j.label}),u&&e.jsx("div",{className:"absolute left-full top-0 ml-2 px-3 py-2 bg-[var(--bg-secondary)] border border-[var(--border-color)] shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 whitespace-nowrap z-50",style:{borderRadius:"var(--radius-menu-item)"},children:e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:j.label})})]},j.id)})]}),e.jsx("div",{className:`border-t border-[var(--border-color)] ${u?"p-2":"p-3"}`,children:e.jsx("button",{onClick:x,className:`hidden lg:flex w-full items-center transition-all text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] ${u?"justify-center px-2 py-2":"gap-2 px-3 py-2"}`,style:{borderRadius:"var(--radius-menu-item)"},title:u?r("sidebar.expand","Agrandir le menu"):r("sidebar.collapse","Réduire le menu"),children:u?e.jsx(l.PanelLeft,{className:"w-5 h-5"}):e.jsxs(e.Fragment,{children:[e.jsx(l.PanelLeftClose,{className:"w-5 h-5"}),e.jsx("span",{className:"text-sm",children:r("sidebar.collapse","Réduire")})]})})})]});return e.jsxs(e.Fragment,{children:[e.jsx("aside",{className:`hidden lg:block h-[calc(100vh-4rem)] fixed top-16 left-0 bg-[var(--bg-secondary)] border-r border-[var(--border-color)] transition-all duration-300 ${u?"w-16":"w-64"}`,children:b}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"lg:hidden fixed inset-0 bg-black/50 z-40",onClick:s}),e.jsx("aside",{className:"lg:hidden fixed top-0 left-0 h-full w-64 bg-[var(--bg-secondary)] border-r border-[var(--border-color)] z-50",children:b})]})]})}function pi(t){const s=t.message.toLowerCase(),r=t.name.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("failed to fetch")||s.includes("econnrefused")||s.includes("timeout")?"network":s.includes("401")||s.includes("403")||s.includes("unauthorized")||s.includes("forbidden")||s.includes("permission")?"permission":s.includes("404")||s.includes("not found")?"notFound":r.includes("validation")||s.includes("validation")||s.includes("invalid")?"validation":"technical"}function hi(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const gi={network:{icon:l.WifiOff,color:"text-orange-500",bgColor:"bg-orange-500/10"},permission:{icon:l.ShieldX,color:"text-red-500",bgColor:"bg-red-500/10"},notFound:{icon:l.FileWarning,color:"text-yellow-500",bgColor:"bg-yellow-500/10"},validation:{icon:l.AlertTriangle,color:"text-amber-500",bgColor:"bg-amber-500/10"},technical:{icon:l.Bug,color:"text-red-500",bgColor:"bg-red-500/10"}};function fi({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>hi()),i=pi(t),d=gi[i],u=d.icon,x=()=>{window.history.length>2&&document.referrer?window.location.href=document.referrer:window.history.length>2?(window.history.back(),setTimeout(()=>window.location.reload(),50)):window.location.href="/"};return e.jsx("div",{className:"flex items-center justify-center min-h-[400px] p-6",children:e.jsx("div",{className:"max-w-md w-full p-6 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-xl shadow-lg",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:`w-14 h-14 rounded-full ${d.bgColor} flex items-center justify-center mb-4`,children:e.jsx(u,{className:`w-7 h-7 ${d.color}`})}),e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] mb-2",children:r(`errors.${i}.title`,{defaultValue:r("errors.technical.title")})}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-3",children:r(`errors.${i}.description`,{defaultValue:r("errors.technical.description")})}),e.jsxs("div",{className:"mb-4 px-2 py-1 bg-[var(--bg-tertiary)] rounded border border-[var(--border-color)]",children:[e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[r("errors.errorId"),": "]}),e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:c})]}),!1,e.jsxs("div",{className:"flex gap-2 w-full",children:[e.jsxs("button",{onClick:s,className:"flex-1 flex items-center justify-center gap-2 py-2.5 px-3 rounded-lg bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white text-sm font-medium transition-all",children:[e.jsx(l.RefreshCw,{className:"w-4 h-4"}),r("errors.retry")]}),e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-2.5 px-3 rounded-lg bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] text-sm font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),r("errors.goBack")]})]})]})})})}function bi(t,s){Pe.logError(t,"RouteErrorBoundary",{componentStack:s.componentStack})}function vi({children:t}){return e.jsx(nr.ErrorBoundary,{FallbackComponent:fi,onError:bi,onReset:()=>{window.location.reload()},children:t})}function yi({feature:t,children:s,fallback:r,minimal:a=!1}){const{t:o}=ne.useTranslation("admin"),{isFeatureEnabled:c,license:i,isLoading:d}=Ge();return d?e.jsx(e.Fragment,{children:s}):c(t)?e.jsx(e.Fragment,{children:s}):r?e.jsx(e.Fragment,{children:r}):a?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded text-sm",children:[e.jsx(l.Lock,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:o("license.featureLocked","Locked")})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-800/50 rounded-xl border-2 border-dashed border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:e.jsx(l.Lock,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:o("license.featureNotAvailable","Feature Not Available")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center max-w-sm mb-4",children:o("license.upgradeToAccess","Upgrade your license to access the {{feature}} feature.",{feature:t})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.jsx(l.Sparkles,{className:"w-4 h-4"}),e.jsx("span",{children:o("license.currentEdition","Current: {{edition}}",{edition:i?.edition||"Unknown"})})]})]})}function ia({open:t,onOpenChange:s}){const{t:r}=ne.useTranslation("admin"),{activateLicense:a,license:o}=Ge(),{refreshMenu:c}=Re(),[i,d]=n.useState(""),[u,x]=n.useState(""),[m,f]=n.useState(!1),[h,v]=n.useState(!1),[g,y]=n.useState(null),[p,b]=n.useState(!1),j=o?.hasApiKey??!1,S=async()=>{if(!i.trim()){y(r("license.errors.keyRequired","License key is required"));return}v(!0),y(null),b(!1);const P=await a(i.trim(),u.trim()||void 0);v(!1),P.success?(b(!0),await c(),setTimeout(()=>{d(""),x(""),f(!1),b(!1),s(!1)},1500)):y(P.error||r("license.errors.activationFailed","Activation failed"))},w=()=>{h||(d(""),x(""),f(!1),y(null),b(!1),s(!1))};return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:w}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-lg mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(l.Key,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("license.activateTitle","Activate License")})]}),e.jsx("button",{onClick:w,disabled:h,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50",children:e.jsx(l.X,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"px-6 py-4 space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r("license.activateDescription","Enter your license key to activate the product. The key is a JWT token provided by AtlasHub.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("license.keyLabel","License Key")}),e.jsx("textarea",{value:i,onChange:P=>{d(P.target.value),y(null)},placeholder:r("license.keyPlaceholder","eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."),rows:6,disabled:h||p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg font-mono text-xs bg-white dark:bg-gray-900 text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed resize-none"})]}),j&&!m?e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4 text-green-600 dark:text-green-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-green-700 dark:text-green-300 flex-1",children:r("license.apiKeyConfigured","API key is already configured")}),e.jsx("button",{type:"button",onClick:()=>f(!0),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:r("license.apiKeyChange","Change")})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("license.apiKeyLabel","API Key")}),e.jsx("input",{type:"text",value:u,onChange:P=>{x(P.target.value),y(null)},placeholder:r("license.apiKeyPlaceholder","sslk_..."),disabled:h||p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg font-mono text-sm bg-white dark:bg-gray-900 text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r("license.apiKeyDescription","API key provided by AtlasHub for server authentication (sslk_...).")})]}),g&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:g})]}),p&&e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg",children:[e.jsx(l.CheckCircle,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-green-700 dark:text-green-300",children:r("license.activationSuccess","License activated successfully!")})]}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r("license.activationHelp","Need a license key? Contact us at")," ",e.jsx("a",{href:"mailto:support@atlashub.ch",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"support@atlashub.ch"})," ",r("license.activationHelpOr","or visit")," ",e.jsx("a",{href:"https://www.atlashub.ch",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"www.atlashub.ch"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[e.jsx("button",{onClick:w,disabled:h,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("common:cancel","Cancel")}),e.jsxs("button",{onClick:S,disabled:h||p||!i.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2",children:[h&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),p&&e.jsx(l.CheckCircle,{className:"w-4 h-4"}),h?r("license.activating","Activating..."):p?r("license.activated","Activated!"):r("license.activate","Activate")]})]})]})]}):null}function ji({showDetails:t=!1}){const{t:s}=ne.useTranslation("admin"),{license:r,isLoading:a}=Ge();if(a||!r)return null;const{status:o,edition:c,isInTrial:i,trialDaysRemaining:d,isReadOnlyMode:u,daysUntilExpiration:x}=r;if(u)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-200 rounded-full text-sm font-medium",children:[e.jsx(l.XCircle,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.readOnlyMode","Read-only mode")})]});if(i){const m=d<=7?"text-amber-800 dark:text-amber-200 bg-amber-100 dark:bg-amber-900/30":"text-blue-800 dark:text-blue-200 bg-blue-100 dark:bg-blue-900/30";return e.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium ${m}`,children:[e.jsx(l.Clock,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.trialDaysRemaining","{{days}} trial days left",{days:d})})]})}return x<=30&&o==="Active"?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-200 rounded-full text-sm font-medium",children:[e.jsx(l.AlertTriangle,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.expiresIn","Expires in {{days}} days",{days:x})})]}):o==="Active"?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 rounded-full text-sm font-medium",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4"}),e.jsx("span",{children:s(`license.edition.${c.toLowerCase()}`,{defaultValue:c})}),t&&e.jsxs("span",{className:"text-xs opacity-75",children:["(",x," ",s("license.daysLeft","days left"),")"]})]}):e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-200 rounded-full text-sm font-medium",children:[e.jsx(l.Shield,{className:"w-4 h-4"}),e.jsx("span",{children:s(`license.status.${o.toLowerCase()}`,{defaultValue:o})})]})}function rs({reason:t,tenantName:s,permissionPath:r,applicationsUrl:a,userRoles:o,userPermissions:c}){const{t:i}=ne.useTranslation("common"),{menu:d}=Re(),u=N.useLocation(),x=()=>{window.history.length>2?window.history.back():window.location.href="/"},m=r?.split(".")[0],f=n.useMemo(()=>c?.filter(b=>{const j=b.toLowerCase();return m&&(j.startsWith(m.toLowerCase()+".")||j===m.toLowerCase())})??[],[c,m]),h=r&&(o?.length||c),v=n.useMemo(()=>{const b=u.pathname.split("/").filter(Boolean),j=b[0]==="t"?b.slice(2):b,S=j[0],w=j[1],P=j[2],$=j[3],A=_=>/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(_),k=_=>_.replace(/^(core_|ext_)/,""),R=_=>_.charAt(0).toUpperCase()+_.slice(1).replace(/-/g," "),L=d?.applications.find(_=>_.route?.split("/").filter(Boolean)[0]===S||k(_.code)===S),I=w?L?.modules.find(_=>_.route?.split("/").filter(Boolean)[1]===w||k(_.code)===w):void 0,C=P&&!A(P)?I?.sections.find(_=>_.route?.split("/").filter(Boolean)[2]===P||k(_.code)===P):void 0,O=$&&!A($)?C?.resources.find(_=>_.route?.split("/").filter(Boolean)[3]===$||k(_.code)===$):void 0;return{application:L?.label||(S?R(S):void 0),module:I?.label||(w&&!A(w)?R(w):void 0),section:C?.label||(P&&!A(P)?R(P):void 0),resource:O?.label||($&&!A($)?R($):void 0)}},[d,u.pathname]),g=n.useMemo(()=>{const b=[];return v.application&&b.push(`- ${i("errors.accessDenied.ticket.applicationLabel")}: ${v.application}`),v.module&&b.push(`- ${i("errors.accessDenied.ticket.moduleLabel")}: ${v.module}`),v.section&&b.push(`- ${i("errors.accessDenied.ticket.sectionLabel")}: ${v.section}`),v.resource&&b.push(`- ${i("errors.accessDenied.ticket.resourceLabel")}: ${v.resource}`),b.length===0?"":`
26
-
27
- ${i("errors.accessDenied.ticket.navigationContext")}:
28
- ${b.join(`
29
- `)}`},[v,i]),y=n.useMemo(()=>{if(!t||!r||!s||!a)return null;const j=`${a.replace(/\/applications$/,"")}/support/my-tickets/create`,S=t==="tenant"?"ApplicationRequest":"Support",w=r.split(".")[0],P=t==="tenant"?i("errors.accessDenied.ticket.accessSubject",{permissionPath:r,tenantName:s}):i("errors.accessDenied.ticket.permissionSubject",{permissionPath:r,tenantName:s}),A=(t==="tenant"?i("errors.accessDenied.ticket.accessBody",{appCode:w,tenantName:s,permissionPath:r}):i("errors.accessDenied.ticket.permissionBody",{permissionPath:r,tenantName:s}))+g,k=new URLSearchParams({type:S,subject:P,body:A});return`${j}?${k.toString()}`},[t,r,s,a,i,g]),p=t==="tenant"&&s?i("errors.accessDenied.tenantNotAvailable",{tenantName:s}):t==="permission"&&s?i("errors.accessDenied.permissionMissing",{tenantName:s}):s?i("errors.accessDenied.tenantDescription",{tenantName:s}):i("errors.accessDenied.description");return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/10 flex items-center justify-center mb-6",children:e.jsx(l.ShieldX,{className:"w-8 h-8 text-red-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:i("errors.accessDenied.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:p}),h?e.jsxs("div",{className:"w-full mb-6 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)] divide-y divide-[var(--border-color)]",children:[e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono font-medium text-red-500",children:r})]}),o&&o.length>0&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourRoles")}),e.jsx("div",{className:"flex flex-wrap gap-1.5 justify-center",children:o.map(b=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-[var(--bg-tertiary)] text-[var(--text-secondary)] border border-[var(--border-color)]",children:b},b))})]}),c&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourPermissionsFor",{appCode:m??""})}),f.length>0?e.jsx("div",{className:"flex flex-col gap-1 items-start",children:f.map(b=>e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:b},b))}):e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] italic",children:i("errors.accessDenied.noPermissions")})]})]}):r?e.jsxs("div",{className:"w-full mb-6 p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)]",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono text-[var(--text-primary)]",children:r})]}):null,e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[y&&e.jsxs("a",{href:y,className:"flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.TicketPlus,{className:"w-4 h-4"}),i(t==="tenant"?"errors.accessDenied.requestAccess":"errors.accessDenied.requestPermission")]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[a?e.jsxs("a",{href:a,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LayoutGrid,{className:"w-4 h-4"}),i("errors.accessDenied.goToApplications")]}):e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),i("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),i("errors.home")]})]})]})]})})})}function wi(){const{t}=ne.useTranslation("common"),{logout:s}=Ae();return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-orange-500/10 flex items-center justify-center mb-6",children:e.jsx(l.Building2,{className:"w-8 h-8 text-orange-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.noActiveWorkspace.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.noActiveWorkspace.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("a",{href:"mailto:support@atlashub.ch",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.Mail,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.contactAdmin")]}),e.jsxs("button",{onClick:()=>{s()},className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.logout")]})]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mt-6",children:t("errors.noActiveWorkspace.hint")})]})})})}function Nt(){return e.jsx("div",{className:"flex items-center justify-center min-h-[400px] w-full",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(l.Loader2,{className:"w-10 h-10 animate-spin text-[var(--color-primary-500)]"}),e.jsx("span",{className:"text-sm text-[var(--color-text-secondary)]",children:"Chargement..."})]})})}function la(){const{user:t,isLoading:s}=Ae(),r=N.useLocation(),{currentAppCode:a,currentModuleCode:o,isLoading:c,menu:i}=Re(),{currentTenant:d,userTenants:u,isLoading:x,isGlobalView:m}=Ee(),f=d?.id||"global",h=n.useRef(d?.id);let v=!1;if(d?.id!==h.current&&(h.current=d?.id,v=!0),s)return e.jsx(Nt,{});if(!t)return e.jsx(N.Navigate,{to:"/login",state:{from:r},replace:!0});if(v||c||x)return e.jsx(Nt,{});if(!d&&!m&&!u.some(j=>j.status==="Active"))return e.jsx(wi,{});if(!a)return e.jsx(N.Outlet,{},f);const y=(i?.applications||[]).find(b=>b.route?.split("/").filter(Boolean)[0]===a||b.code===a);if(y?.isOpen)return e.jsx(N.Outlet,{},f);if(!y){const b=[a,o].filter(Boolean).join("."),j=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:d?.name,permissionPath:b,applicationsUrl:j,userRoles:t.roles,userPermissions:t.permissions})})})]})}const p=[a,o].filter(Boolean).join(".");if(!un(t.permissions,t.roles,p)&&y.accessLevel!=="RequestAccess"){const b=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"permission",tenantName:d?.name,permissionPath:p,applicationsUrl:b,userRoles:t.roles,userPermissions:t.permissions})})})]})}return e.jsx(N.Outlet,{},f)}function Ms(){const{slug:t}=N.useParams(),s=N.useNavigate(),r=N.useLocation(),{currentTenant:a,userTenants:o,switchTenant:c,isLoading:i,isGlobalView:d}=Ee(),{useUrlRouting:u,isLoading:x}=cs(),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null);return n.useEffect(()=>{if(i||x||!u||d)return;const v=t||Ps(r.pathname),g=v!==h.current;if(h.current=v,!!g&&v&&v!==a?.slug){const y=o.find(p=>p.slug===v&&p.status==="Active");if(y)f.current=v,c(y.id).then(()=>{f.current=null}).catch(p=>{f.current=null,console.error("[TenantRouteWrapper] Failed to switch tenant:",p)});else if(a){const p=ct(r.pathname);s(`/t/${a.slug}${p}`,{replace:!0})}else s("/",{replace:!0})}},[t,r.pathname,a?.slug,o,u,i,x,d,c,s]),n.useEffect(()=>{if(i||x||m.current)return;const v=r.pathname,g=Ps(v);if(d&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(!u&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&!g&&!d&&v!=="/"&&!v.startsWith("/login")&&!v.startsWith("/auth")&&!v.startsWith("/public")){m.current=!0,s(`/t/${a.slug}${v}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&g&&!d&&g!==a.slug&&g!==f.current){m.current=!0;const y=ct(v);s(`/t/${a.slug}${y}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}},[r.pathname,a?.slug,u,i,x,d,s]),e.jsx(N.Outlet,{})}function Oe({to:t,replace:s=!0}){const{slug:r}=N.useParams(),a=r?`/t/${r}${t}`:t;return e.jsx(N.Navigate,{to:a,replace:s})}function Ni(){const{t}=ne.useTranslation("admin"),{license:s}=Ge(),r=et();return!s||s.status==="NoLicense"?e.jsx(ia,{open:!0,onOpenChange:()=>{}}):e.jsxs("div",{className:"fixed inset-0 z-40 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-2xl w-full max-w-md mx-4 overflow-hidden",children:[e.jsx("div",{className:"flex justify-center pt-8 pb-4",children:e.jsx("div",{className:"p-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:e.jsx(l.Lock,{className:"w-10 h-10 text-red-600 dark:text-red-400"})})}),e.jsxs("div",{className:"px-6 pb-6 text-center",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:t("license.guard.title","License Required")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:t("license.guard.description","Your license has expired or is invalid. Access to this area is restricted. Please activate a valid license to continue using the platform.")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(N.Link,{to:r("/administration/configuration/license"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(l.Settings,{className:"w-4 h-4"}),t("license.guard.manageLicense","Manage License")]}),e.jsxs(N.Link,{to:r("/myspace/profile"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:[e.jsx(l.User,{className:"w-4 h-4"}),t("license.guard.myProfile","My Profile")]})]})]})]})]})}const Si=["/myspace","/administration/configuration"];function Ci(t){const s=t.match(/^\/t\/[^/]+\/(.*)/);return s?`/${s[1]}`:t}function ca(){const{license:t,isLoading:s,isReadOnlyMode:r}=Ge(),a=N.useLocation();if(s)return e.jsx(N.Outlet,{});const o=Ci(a.pathname);return Si.some(i=>o.startsWith(i))?e.jsx(N.Outlet,{}):!t?.isValid||r?e.jsxs(e.Fragment,{children:[e.jsx(N.Outlet,{}),e.jsx(Ni,{})]}):e.jsx(N.Outlet,{})}function fs({feature:t}){const{t:s}=ne.useTranslation("admin"),{isFeatureEnabled:r,license:a,isLoading:o}=Ge();return o?e.jsx(N.Outlet,{}):r(t)?e.jsx(N.Outlet,{}):e.jsx("div",{className:"flex items-center justify-center min-h-[60vh] p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-800/50 rounded-xl border-2 border-dashed border-gray-200 dark:border-gray-700 max-w-md",children:[e.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:e.jsx(l.Lock,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:s("license.featureNotAvailable","Feature Not Available")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center max-w-sm mb-4",children:s("license.upgradeToAccess","Upgrade your license to access the {{feature}} feature.",{feature:t})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.jsx(l.Sparkles,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.currentEdition","Current: {{edition}}",{edition:a?.edition||"Unknown"})})]})]})})}const Fs=n.lazy(()=>Promise.resolve().then(()=>Ko).then(t=>({default:t.DocsLayout}))),ki=n.lazy(()=>Promise.resolve().then(()=>require("./DocsIndexPage-BPfi0FQD.cjs")).then(t=>({default:t.DocsIndexPage}))),Ai=n.lazy(()=>Promise.resolve().then(()=>require("./SmartStackPresentationPage-52Nb7F0X.cjs")).then(t=>({default:t.SmartStackPresentationPage}))),Ri=n.lazy(()=>Promise.resolve().then(()=>require("./DeveloperIndexPage-CtBfD2JI.cjs")).then(t=>({default:t.DeveloperIndexPage}))),Pi=n.lazy(()=>Promise.resolve().then(()=>require("./InfrastructurePage-D4ZjLzI_.cjs")).then(t=>({default:t.InfrastructurePage}))),Ti=n.lazy(()=>Promise.resolve().then(()=>require("./InstallationPage-BJ-GBVPp.cjs")).then(t=>({default:t.InstallationPage}))),Ei=n.lazy(()=>Promise.resolve().then(()=>require("./DatabasePage-CRq_-Yo2.cjs")).then(t=>({default:t.DatabasePage}))),$i=n.lazy(()=>Promise.resolve().then(()=>require("./DualDbContextPage--Qk-qEgD.cjs")).then(t=>({default:t.DualDbContextPage}))),Ii=n.lazy(()=>Promise.resolve().then(()=>require("./CrossSchemaFkPage-DqFNORYd.cjs")).then(t=>({default:t.CrossSchemaFkPage}))),Li=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantIndexPage}))),Di=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.MultiTenantModePage}))),Mi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantB2CPage}))),Fi=n.lazy(()=>Promise.resolve().then(()=>require("./TeamsIntegrationPage-DXj5MDRS.cjs")).then(t=>({default:t.TeamsIntegrationPage}))),Oi=n.lazy(()=>Promise.resolve().then(()=>require("./index-CdORB0b4.cjs")).then(t=>({default:t.SecurityTestingPage}))),Ui=n.lazy(()=>Promise.resolve().then(()=>require("./UserIndexPage-DahU6wzK.cjs")).then(t=>({default:t.UserIndexPage}))),Bi=n.lazy(()=>Promise.resolve().then(()=>require("./ArchitecturePage-Cn_XCDAo.cjs")).then(t=>({default:t.ArchitecturePage}))),_i=n.lazy(()=>Promise.resolve().then(()=>require("./ModulesPage-lz8DUm3X.cjs")).then(t=>({default:t.ModulesPage}))),qi=n.lazy(()=>Promise.resolve().then(()=>require("./SlaDocPage-D44QWNY8.cjs")).then(t=>({default:t.SlaDocPage}))),zi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportIndexPage-CsDQ35Cu.cjs")).then(t=>({default:t.SupportIndexPage}))),Gi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportDashboardDocPage-DpgGq5Mm.cjs")).then(t=>({default:t.SupportDashboardDocPage}))),Ki=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTicketsDocPage-C_ybDTjC.cjs")).then(t=>({default:t.SupportTicketsDocPage}))),Hi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportMyTicketsDocPage-jE1UMaIY.cjs")).then(t=>({default:t.SupportMyTicketsDocPage}))),Vi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTemplatesDocPage-ajO-cHmK.cjs")).then(t=>({default:t.SupportTemplatesDocPage}))),Wi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportEscalationDocPage-WXkAQr8k.cjs")).then(t=>({default:t.SupportEscalationDocPage}))),Xi=n.lazy(()=>Promise.resolve().then(()=>require("./AiDocPage-CM7j_50_.cjs")).then(t=>({default:t.AiDocPage}))),Yi=n.lazy(()=>Promise.resolve().then(()=>require("./SettingsDocPage-Dqj8KzOa.cjs")).then(t=>({default:t.SettingsDocPage}))),Ji=n.lazy(()=>Promise.resolve().then(()=>require("./ThemeDocPage-B6x55uSE.cjs")).then(t=>({default:t.ThemeDocPage}))),Qi=n.lazy(()=>Promise.resolve().then(()=>require("./BaIndexPage-BhdOX87v.cjs")).then(t=>({default:t.BaIndexPage}))),Os=n.lazy(()=>Promise.resolve().then(()=>require("./BaViewerPage-SYgjCF7x.cjs")).then(t=>({default:t.BaViewerPage}))),Zi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C9BaizLE.cjs"))),el=n.lazy(()=>Promise.resolve().then(()=>require("./index-ASxPhrgZ.cjs"))),tl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BnWMDCRU.cjs"))),sl=n.lazy(()=>Promise.resolve().then(()=>require("./index-C54HbULX.cjs"))),rl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DDJTWztK.cjs"))),al=n.lazy(()=>Promise.resolve().then(()=>require("./index-ZVUUUZmv.cjs"))),nl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DmuVa7Ye.cjs"))),ol=n.lazy(()=>Promise.resolve().then(()=>require("./index-Dxau-XnQ.cjs"))),il=n.lazy(()=>Promise.resolve().then(()=>require("./index-Txfokhn3.cjs"))),ll=n.lazy(()=>Promise.resolve().then(()=>require("./index-BYhFG50Z.cjs"))),cl=n.lazy(()=>Promise.resolve().then(()=>require("./index-eAHjmtzn.cjs"))),dl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKK07NF1.cjs"))),ul=n.lazy(()=>Promise.resolve().then(()=>require("./index-CtcdHE_9.cjs"))),ml=n.lazy(()=>Promise.resolve().then(()=>require("./index-CBOLnJkG.cjs"))),xl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKRiN1hJ.cjs"))),pl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DdsLBKHV.cjs"))),hl=n.lazy(()=>Promise.resolve().then(()=>require("./index-1tvWzIw0.cjs"))),gl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DJXny6rD.cjs"))),fl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Bup-dL1l.cjs"))),bl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Du4fQfix.cjs"))),vl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BP5i2CQo.cjs")));function yl(){return e.jsxs(e.Fragment,{children:[e.jsxs(N.Route,{path:"/system/docs",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(ki,{})}),e.jsx(N.Route,{path:"developer",element:e.jsx(Ri,{})}),e.jsx(N.Route,{path:"developer/infrastructure",element:e.jsx(Pi,{})}),e.jsx(N.Route,{path:"developer/installation",element:e.jsx(Ti,{})}),e.jsx(N.Route,{path:"developer/database",element:e.jsx(Ei,{})}),e.jsx(N.Route,{path:"developer/dual-dbcontext",element:e.jsx($i,{})}),e.jsx(N.Route,{path:"developer/cross-schema-fk",element:e.jsx(Ii,{})}),e.jsx(N.Route,{path:"developer/tenants",element:e.jsx(Li,{})}),e.jsx(N.Route,{path:"developer/tenants/multi-tenant-mode",element:e.jsx(Di,{})}),e.jsx(N.Route,{path:"developer/tenants/b2c",element:e.jsx(Mi,{})}),e.jsx(N.Route,{path:"developer/multi-tenant-mode",element:e.jsx(N.Navigate,{to:"/system/docs/developer/tenants/multi-tenant-mode",replace:!0})}),e.jsx(N.Route,{path:"developer/teams-integration",element:e.jsx(Fi,{})}),e.jsx(N.Route,{path:"developer/testing/security",element:e.jsx(Oi,{})}),e.jsx(N.Route,{path:"user",element:e.jsx(Ui,{})}),e.jsx(N.Route,{path:"user/architecture",element:e.jsx(Bi,{})}),e.jsx(N.Route,{path:"user/modules",element:e.jsx(_i,{})}),e.jsx(N.Route,{path:"user/support",element:e.jsx(zi,{})}),e.jsx(N.Route,{path:"user/support-dashboard",element:e.jsx(Gi,{})}),e.jsx(N.Route,{path:"user/support-tickets",element:e.jsx(Ki,{})}),e.jsx(N.Route,{path:"user/support-my-tickets",element:e.jsx(Hi,{})}),e.jsx(N.Route,{path:"user/support-sla",element:e.jsx(qi,{})}),e.jsx(N.Route,{path:"user/support-templates",element:e.jsx(Vi,{})}),e.jsx(N.Route,{path:"user/support-escalation",element:e.jsx(Wi,{})}),e.jsx(N.Route,{path:"user/ai",element:e.jsx(Xi,{})}),e.jsx(N.Route,{path:"user/settings",element:e.jsx(Yi,{})}),e.jsx(N.Route,{path:"user/theme",element:e.jsx(Ji,{})}),e.jsx(N.Route,{path:"ba",element:e.jsx(Qi,{})}),e.jsx(N.Route,{path:"ba/:appCode",element:e.jsx(Os,{})}),e.jsx(N.Route,{path:"ba/:appCode/:moduleCode",element:e.jsx(Os,{})})]}),e.jsxs(N.Route,{path:"/docs/business",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{path:"administration/users",element:e.jsx(Zi,{})}),e.jsx(N.Route,{path:"administration/users/dashboard",element:e.jsx(el,{})}),e.jsx(N.Route,{path:"administration/users/references",element:e.jsx(tl,{})}),e.jsx(N.Route,{path:"administration/users/groups",element:e.jsx(sl,{})}),e.jsx(N.Route,{path:"administration/permissions",element:e.jsx(rl,{})}),e.jsx(N.Route,{path:"administration/permissions/assignments",element:e.jsx(al,{})}),e.jsx(N.Route,{path:"administration/tenants",element:e.jsx(nl,{})}),e.jsx(N.Route,{path:"administration/tenants/template",element:e.jsx(ol,{})}),e.jsx(N.Route,{path:"administration/tenants/business",element:e.jsx(il,{})}),e.jsx(N.Route,{path:"administration/tenants/personal",element:e.jsx(ll,{})}),e.jsx(N.Route,{path:"administration/tenants/other",element:e.jsx(cl,{})}),e.jsx(N.Route,{path:"administration/tenants/applications",element:e.jsx(dl,{})}),e.jsx(N.Route,{path:"administration/tenants/access-requests",element:e.jsx(ul,{})}),e.jsx(N.Route,{path:"administration/tenants/organisations",element:e.jsx(ml,{})}),e.jsx(N.Route,{path:"administration/ai",element:e.jsx(xl,{})}),e.jsx(N.Route,{path:"administration/workflows",element:e.jsx(pl,{})}),e.jsx(N.Route,{path:"administration/entra",element:e.jsx(hl,{})}),e.jsx(N.Route,{path:"administration/applications",element:e.jsx(gl,{})}),e.jsx(N.Route,{path:"administration/configuration",element:e.jsx(fl,{})}),e.jsx(N.Route,{path:"administration/configuration/license",element:e.jsx(bl,{})}),e.jsx(N.Route,{path:"platform/support/tickets",element:e.jsx(vl,{})})]}),e.jsx(N.Route,{path:"/system/docs/presentation",element:e.jsx(Ai,{})}),e.jsx(N.Route,{path:"/docs/*",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})}),e.jsx(N.Route,{path:"/docs",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})})]})}const jl=[{icon:l.Users,title:"Gestion des Utilisateurs",description:"Créez, modifiez et gérez vos utilisateurs avec une interface intuitive. Profils complets, avatars et informations personnalisables.",color:"from-blue-500 to-cyan-500"},{icon:l.Bell,title:"Gestion des Notifications",description:"Système de notifications en temps réel. Email, push, in-app. Templates personnalisables et historique complet.",color:"from-amber-500 to-orange-500"},{icon:l.HeadphonesIcon,title:"Gestion du Support",description:"Système de tickets intégré pour le support client. Suivi, priorités, assignation et statistiques.",color:"from-emerald-500 to-teal-500"},{icon:l.Shield,title:"Panneau Administrateur",description:"Dashboard complet pour administrer votre plateforme. Métriques, logs, configuration et monitoring.",color:"from-purple-500 to-pink-500"},{icon:l.Key,title:"Gestion des Rôles",description:"RBAC avancé avec permissions granulaires. Hiérarchie de rôles, wildcards et héritage des droits.",color:"from-red-500 to-rose-500"},{icon:l.Layers,title:"Architecture Modulaire",description:"Structure en 5 niveaux : Contexte, Application, Module, Section, Resource. Extensible et maintenable.",color:"from-indigo-500 to-violet-500"}],wl=[{icon:l.Zap,text:"Démarrage rapide"},{icon:l.Lock,text:"Sécurité intégrée"},{icon:l.Rocket,text:"Performance optimale"}],Nl=[".NET 10","React 19","TypeScript","EF Core","SQL Server","Tailwind CSS"];function Sl(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("section",{className:"relative pt-32 pb-20 md:pt-40 md:pb-32 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 rounded-full bg-primary-500/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 rounded-full bg-accent-500/10 blur-3xl"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full bg-gradient-to-r from-primary-500/5 to-accent-500/5 blur-3xl"})]}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary-500/10 border border-primary-500/20 mb-8",children:[e.jsx(l.Zap,{className:"w-4 h-4 text-primary-500"}),e.jsx("span",{className:"text-sm font-medium text-primary-500",children:"Version 1.0 disponible"})]}),e.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-bold tracking-tight mb-6",children:["Le socle moderne pour",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"vos applications"})]}),e.jsx("p",{className:"max-w-2xl mx-auto text-lg md:text-xl text-[var(--text-secondary)] mb-10",children:"SmartStack est une plateforme complète pour créer des applications d'entreprise. Authentification, rôles, notifications et support intégrés."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4 mb-16",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Commencer gratuitement",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"#features",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Découvrir les fonctionnalités"})]}),e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-6",children:wl.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[e.jsx(t.icon,{className:"w-5 h-5 text-primary-500"}),e.jsx("span",{children:t.text})]},t.text))})]})})]}),e.jsx("section",{className:"py-8 bg-[var(--bg-secondary)] border-y border-[var(--border-color)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-8 md:gap-12",children:[e.jsx("span",{className:"text-[var(--text-tertiary)] text-sm uppercase tracking-wider",children:"Construit avec"}),Nl.map(t=>e.jsx("span",{className:"text-[var(--text-secondary)] font-medium",children:t},t))]})})}),e.jsx("section",{id:"features",className:"py-20 md:py-32",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Tout ce dont vous avez besoin"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)]",children:"SmartStack inclut toutes les fonctionnalités essentielles pour démarrer votre projet d'entreprise."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:jl.map(t=>e.jsxs("div",{className:"group p-6 rounded-2xl bg-[var(--bg-card)] border border-[var(--border-color)] hover-card",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${t.color} flex items-center justify-center mb-4`,children:e.jsx(t.icon,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:t.title}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:t.description})]},t.title))})]})}),e.jsx("section",{id:"modules",className:"py-20 md:py-32 bg-[var(--bg-secondary)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-6",children:["Architecture modulaire",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"prête pour la production"})]}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-8",children:"SmartStack utilise une architecture en 5 niveaux qui permet une organisation claire et une extensibilité maximale. Chaque niveau correspond à un scope de permissions."}),e.jsx("ul",{className:"space-y-4 mb-8",children:["Contexte - Environnements séparés (Platform, Business, Personal)","Application - Apps au sein d'un contexte (Admin, MySpace)","Module - Fonctionnalités (Users, Roles, Profile)","Section - Sous-divisions des modules","Resource - Éléments individuels"].map(t=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-500/10 flex items-center justify-center mt-0.5",children:e.jsx(l.Check,{className:"w-4 h-4 text-primary-500"})}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:t})]},t))})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary-500/20 to-accent-500/20 rounded-3xl blur-2xl"}),e.jsx("div",{className:"relative p-8 rounded-3xl bg-[var(--bg-card)] border border-[var(--border-color)]",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-primary-500/10 to-primary-500/5 border border-primary-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary-500"}),e.jsx("span",{className:"font-semibold text-primary-500",children:"Contexte: Platform"})]}),e.jsxs("div",{className:"ml-4 mt-3 p-3 rounded-lg bg-accent-500/10 border border-accent-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-500"}),e.jsx("span",{className:"font-medium text-accent-500",children:"Application: Admin"})]}),e.jsxs("div",{className:"ml-4 mt-2 space-y-2",children:[e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Users,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Users"})]})}),e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Key,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Roles"})]})})]})]})]})})})]})]})})}),e.jsx("section",{id:"contact",className:"py-20 md:py-32",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"relative overflow-hidden rounded-3xl animated-gradient p-px",children:e.jsxs("div",{className:"relative rounded-3xl bg-[var(--bg-primary)] p-8 md:p-16 text-center",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Prêt à commencer ?"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)] mb-8",children:"Lancez votre projet d'entreprise avec SmartStack. Tout est déjà configuré pour vous permettre de vous concentrer sur votre métier."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Créer un compte",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"/contact",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Nous contacter"})]})]})})})})]})}function da(){const t=navigator.userAgent.toLowerCase();return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(t)?"tablet":/(android|webos|iphone|ipod|blackberry|iemobile|opera mini|mobile|phone)/.test(t)?"mobile":/(windows|macintosh|linux|x11)/.test(t)?"desktop":"unknown"}async function ua(){try{const t=await fetch("https://api.ipify.org?format=json",{method:"GET",signal:AbortSignal.timeout(5e3)});return t.ok&&(await t.json()).ip||null}catch{return null}}function Cl(){const[t,s]=n.useState(""),[r,a]=n.useState(""),[o,c]=n.useState(!1),[i,d]=n.useState(!1),[u,x]=n.useState("auth"),[m,f]=n.useState(null),[h]=n.useState(()=>{const g=new URLSearchParams(window.location.search).get("redirect_uri");return g?(sessionStorage.setItem("sso_redirect_uri",g),g):sessionStorage.getItem("sso_redirect_uri")}),v=n.useCallback(async g=>{g.preventDefault(),f(null),x("auth"),d(!0);try{Pe.logEvent("login_attempt","auth",{email:t});const y=da(),p=await ua(),b=await D.post("/api/auth/login",{email:t,password:r,deviceType:y,clientIp:p});localStorage.setItem("token",b.token),localStorage.setItem("refreshToken",b.refreshToken),localStorage.setItem("user",JSON.stringify(b.user)),Pe.logEvent("login_success","auth",{email:t}),x("prefs");try{if(!(await D.get("/api/onboarding/status")).hasCompletedOnboarding){window.location.href="/auth/onboarding";return}}catch{}try{const j=await It.preferences.get(),S={mode:j.theme||"dark",accentColorKey:j.accentColorKey||"indigo",borderRadius:j.borderRadius||{},itemPaletteKey:j.itemPaletteKey||"neutral"};localStorage.setItem("smartstack-theme-config",JSON.stringify(S)),j.language&&localStorage.setItem("i18nextLng",j.language)}catch{}if(localStorage.removeItem("currentTenantId"),localStorage.removeItem("currentTenantSlug"),localStorage.removeItem("isGlobalView"),h){sessionStorage.removeItem("sso_redirect_uri");const j=h.includes("?")?"&":"?";window.location.href=`${h}${j}token=${encodeURIComponent(b.token)}&refreshToken=${encodeURIComponent(b.refreshToken)}`;return}window.location.href="/myspace"}catch(y){if(y instanceof is)f({message:y.message,code:"NETWORK_ERROR"});else if(y instanceof lr)f({message:y.message,code:y.code});else{const p=y instanceof Error?y.message:"Une erreur inattendue est survenue";f({message:p})}Pe.logError(y instanceof Error?y:new Error(String(y)),"LoginPage.handleSubmit",{email:t})}finally{d(!1)}},[t,r,h]);return{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:u,error:m,handleSubmit:v}}const kl=[{icon:l.Shield,title:"Sécurité avancée",description:"Authentification multi-facteurs et contrôle d'accès granulaire"},{icon:l.Zap,title:"Performance optimale",description:"Interface rapide et réactive pour une productivité maximale"},{icon:l.Users,title:"Collaboration",description:"Gestion des équipes et permissions centralisée"},{icon:l.BarChart3,title:"Analytics",description:"Tableaux de bord et rapports en temps réel"}],Al=t=>{switch(t){case"ACCOUNT_DISABLED":return e.jsx(l.UserX,{className:"w-5 h-5 flex-shrink-0"});case"ACCOUNT_LOCKED":return e.jsx(l.Clock,{className:"w-5 h-5 flex-shrink-0"});case"EXTERNAL_AUTH_REQUIRED":return e.jsx(l.KeyRound,{className:"w-5 h-5 flex-shrink-0"});case"NETWORK_ERROR":return e.jsx(l.WifiOff,{className:"w-5 h-5 flex-shrink-0"});default:return e.jsx(l.AlertCircle,{className:"w-5 h-5 flex-shrink-0"})}},Rl=t=>{switch(t){case"ACCOUNT_DISABLED":return"bg-orange-500/10 border-orange-500/20 text-orange-600 dark:text-orange-400";case"ACCOUNT_LOCKED":return"bg-amber-500/10 border-amber-500/20 text-amber-600 dark:text-amber-400";case"EXTERNAL_AUTH_REQUIRED":return"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400";case"NETWORK_ERROR":return"bg-gray-500/10 border-gray-500/20 text-gray-600 dark:text-gray-400";default:return"bg-red-500/10 border-red-500/20 text-red-500"}};function Pl(){const{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:d,error:u,handleSubmit:x}=Cl();return e.jsxs("div",{className:"min-h-screen flex",children:[e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 xl:w-[55%] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 animated-gradient"}),e.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 1px 1px, white 1px, transparent 0)",backgroundSize:"40px 40px"}}),e.jsx("div",{className:"absolute top-20 left-20 w-72 h-72 bg-white/10 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-20 right-20 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.jsx("div",{className:"absolute top-1/2 left-1/3 w-64 h-64 bg-white/5 rounded-full blur-2xl animate-pulse",style:{animationDelay:"2s"}}),e.jsxs("div",{className:"relative z-10 flex flex-col justify-between p-12 xl:p-16 text-white w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-7 h-7 text-white"})}),e.jsx("span",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"max-w-lg",children:[e.jsx("h1",{className:"text-4xl xl:text-5xl font-bold leading-tight mb-6",children:"Votre plateforme de gestion unifiée"}),e.jsx("p",{className:"text-xl text-white/80 mb-12",children:"Simplifiez vos processus, centralisez vos données et boostez la productivité de votre équipe."}),e.jsx("div",{className:"grid grid-cols-2 gap-6",children:kl.map(m=>e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm rounded-2xl p-5 hover:bg-white/15 transition-colors",children:[e.jsx(m.icon,{className:"w-8 h-8 mb-3 text-white/90"}),e.jsx("h3",{className:"font-semibold mb-1",children:m.title}),e.jsx("p",{className:"text-sm text-white/70",children:m.description})]},m.title))})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex -space-x-3",children:[1,2,3,4].map(m=>e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/20 border-2 border-white/30 flex items-center justify-center text-sm font-medium",children:String.fromCharCode(64+m)},m))}),e.jsxs("p",{className:"text-white/80",children:[e.jsx("span",{className:"font-semibold text-white",children:"+500"})," entreprises nous font confiance"]})]})]})]}),e.jsxs("div",{className:"w-full lg:w-1/2 xl:w-[45%] flex flex-col relative bg-[var(--bg-primary)]",children:[e.jsx("div",{className:"lg:hidden absolute inset-0",children:e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 rounded-full bg-primary-500/20 blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 rounded-full bg-accent-500/20 blur-3xl animate-pulse",style:{animationDelay:"1s"}})]})}),e.jsxs("div",{className:"absolute top-6 right-6 z-10 flex items-center gap-2",children:[e.jsx("a",{href:"/",className:"p-2 rounded-lg bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-colors",title:"Retour à l'accueil",children:e.jsx(l.Home,{className:"w-5 h-5 text-[var(--text-secondary)]"})}),e.jsx(Ot,{})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-6 sm:p-8 lg:p-12",children:e.jsxs("div",{className:"w-full max-w-md relative",children:[e.jsxs("div",{className:"lg:hidden flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl animated-gradient flex items-center justify-center mb-4 shadow-lg",children:e.jsx(l.Layers,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"hidden lg:block mb-8",children:[e.jsx("h2",{className:"text-3xl font-bold mb-2",children:"Bienvenue"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:"Connectez-vous à votre compte pour continuer"})]}),u&&e.jsxs("div",{className:`mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 ${Rl(u.code)}`,children:[Al(u.code),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:u.message}),u.code==="ACCOUNT_DISABLED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Contactez le support si vous pensez qu'il s'agit d'une erreur."}),u.code==="EXTERNAL_AUTH_REQUIRED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Utilisez les boutons Microsoft ou Google ci-dessous."})]})]}),e.jsxs("form",{onSubmit:x,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-2",children:"Adresse email"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Mail,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"email",type:"email",value:t,onChange:m=>s(m.target.value),placeholder:"vous@exemple.com",required:!0,className:"w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-2",children:"Mot de passe"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Lock,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"password",type:o?"text":"password",value:r,onChange:m=>a(m.target.value),placeholder:"••••••••",required:!0,className:"w-full pl-12 pr-12 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"}),e.jsx("button",{type:"button",onClick:()=>c(!o),className:"absolute right-4 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:o?e.jsx(l.EyeOff,{className:"w-5 h-5"}):e.jsx(l.Eye,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 rounded border-[var(--border-color)] bg-[var(--bg-tertiary)] text-primary-600 focus:ring-primary-500/20"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:"Se souvenir de moi"})]}),e.jsx("a",{href:"/forgot-password",className:"text-primary-500 hover:text-primary-600 font-medium transition-colors",children:"Mot de passe oublié ?"})]}),e.jsx("button",{type:"submit",disabled:i,className:"w-full py-3.5 px-4 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:bg-primary-600/50 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40 disabled:shadow-none flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}),d==="auth"?"Connexion en cours...":"Chargement des préférences..."]}):"Se connecter"})]}),e.jsxs("div",{className:"relative my-8",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[var(--border-color)]"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"px-4 bg-[var(--bg-primary)] text-[var(--text-tertiary)]",children:"Ou continuer avec"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/microsoft",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#F25022"}),e.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7FBA00"}),e.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00A4EF"}),e.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#FFB900"})]}),"Microsoft"]}),e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/google",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Google"]})]}),e.jsxs("p",{className:"text-center text-[var(--text-secondary)] mt-8",children:["Nouveau sur SmartStack ?"," ",e.jsx("a",{href:"/register",className:"text-primary-500 hover:text-primary-600 font-semibold transition-colors",children:"Créer un compte"})]})]})}),e.jsx("div",{className:"p-6 text-center",children:e.jsxs("p",{className:"text-sm text-[var(--text-tertiary)]",children:["© ",new Date().getFullYear()," SmartStack. Tous droits réservés."]})})]})]})}function Tl(){const{t}=ne.useTranslation("common"),s=N.useNavigate(),r=()=>{window.history.length>2?s(-1):s("/")};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-md w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-yellow-500/10 flex items-center justify-center mb-6",children:e.jsx(l.FileWarning,{className:"w-8 h-8 text-yellow-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.notFound.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.notFound.description")}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-6 font-mono",children:window.location.pathname}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:r,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),t("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),t("errors.home")]})]})]})})})}const El=n.lazy(()=>Promise.resolve().then(()=>Ho).then(t=>({default:t.PublicLayout}))),Wt=n.lazy(()=>Promise.resolve().then(()=>Bo).then(t=>({default:t.AppLayout}))),$l=n.lazy(()=>Promise.resolve().then(()=>require("./RegisterPage-DKr8quRk.cjs")).then(t=>({default:t.RegisterPage}))),Il=n.lazy(()=>Promise.resolve().then(()=>require("./ConfirmEmailPage-su3Fvl0e.cjs")).then(t=>({default:t.ConfirmEmailPage}))),Ll=n.lazy(()=>Promise.resolve().then(()=>require("./ForgotPasswordPage--Wl0Vxbv.cjs")).then(t=>({default:t.ForgotPasswordPage}))),Dl=n.lazy(()=>Promise.resolve().then(()=>require("./ResetPasswordPage-x4do1o-j.cjs")).then(t=>({default:t.ResetPasswordPage}))),Ml=n.lazy(()=>Promise.resolve().then(()=>require("./ForceChangePasswordPage-kEFsb5Aq.cjs")).then(t=>({default:t.ForceChangePasswordPage}))),Fl=n.lazy(()=>Promise.resolve().then(()=>require("./AuthCallbackPage-Bv2Cyn80.cjs")).then(t=>({default:t.AuthCallbackPage}))),Ol=n.lazy(()=>Promise.resolve().then(()=>require("./OnboardingWizardPage-C7vendrq.cjs")).then(t=>({default:t.OnboardingWizardPage}))),Ul={".detail":"/:id",".edit":"/:id/edit",".create":"/create",".new":"/new",".duplicate":"/:id/duplicate",".settings":"/:id/settings",".configure":"/:id/configure",".permissions":"/:id/permissions",".members":"/:id/members",".history":"/:id/history",".logs":"/:id/logs",".analytics":"/:id/analytics",".preview":"/:id/preview",".versions":"/:id/versions",".comments":"/:id/comments",".attachments":"/:id/attachments",".audit":"/:id/audit",".export":"/:id/export",".notifications":"/:id/notifications",".schedule":"/:id/schedule",".workflow":"/:id/workflow",".summary":"/:id/summary",".test":"/:id/test",".runs":"/:id/runs",".import":"/import"},Bl={"administration.configuration.settings":{defaultTab:"general",tabs:["general","file-upload","legal-file"]},"administration.configuration.appsettings":{defaultTab:"infrastructure",tabs:["infrastructure","authentication","logging","email","entra"]}};function bs(t,s){const r=[];for(const[a,o]of Object.entries(Ul)){const c=`${t}${a}`,i=Te.resolve(c);if(i){const d=s.replace(/^\//,"")+o;r.push({path:d,Component:i})}}return r}function _l(t,s,r,a){const o=[],c=r.route?.replace(`/${a}/`,"")||`${t.code}/${s.code}/${r.code}`,i=Te.resolve(r.componentKey);if(i){const d=i;o.push(e.jsx(N.Route,{path:c,element:e.jsx(d,{})},r.componentKey))}if(r.route)for(const d of bs(r.componentKey,c)){const u=d.Component;o.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${r.componentKey}-implicit-${d.path}`))}return o}function ql(t,s,r){const a=[],o=s.route?.replace(`/${r}/`,"")||`${t.code}/${s.code}`,c=Bl[s.componentKey];if(c){const d=Te.resolve(s.componentKey);if(d){const u=c.tabs.map(x=>{const m=`${s.componentKey}.${x}`,f=Te.resolve(m);return f?e.jsx(N.Route,{path:x,element:e.jsx(f,{})},m):null}).filter(Boolean);return a.push(e.jsxs(N.Route,{path:o,element:e.jsx(d,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(N.Navigate,{to:c.defaultTab,replace:!0})}),u]},s.componentKey)),a}}const i=Te.resolve(s.componentKey);if(i){const d=i;a.push(e.jsx(N.Route,{path:o,element:e.jsx(d,{})},s.componentKey))}if(!i&&s.resources.length>0){const d=s.resources[0];a.push(e.jsx(N.Route,{path:o,element:e.jsx(N.Navigate,{to:d.code,replace:!0})},`${s.componentKey}-redirect`))}if(s.route)for(const d of bs(s.componentKey,o)){const u=d.Component;a.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${s.componentKey}-implicit-${d.path}`))}for(const d of s.resources){const u=_l(t,s,d,r);a.push(...u)}return a}function zl(t,s){const r=[],a=t.route?.replace(`/${s}/`,"")||t.code,o=Te.resolve(t.componentKey);if(o){const c=o;r.push(e.jsx(N.Route,{path:a,element:e.jsx(c,{})},t.componentKey))}if(!o&&t.sections.length>0){const c=t.sections[0];r.push(e.jsx(N.Route,{path:a,element:e.jsx(N.Navigate,{to:c.code,replace:!0})},`${t.componentKey}-redirect`))}if(t.route)for(const c of bs(t.componentKey,a)){const i=c.Component;r.push(e.jsx(N.Route,{path:c.path,element:e.jsx(i,{})},`${t.componentKey}-implicit-${c.path}`))}for(const c of t.sections){const i=ql(t,c,s);r.push(...i)}return r}function Gl(t){const s=[],r=Te.resolve(t.componentKey);if(r){const a=r;s.push(e.jsx(N.Route,{index:!0,element:e.jsx(a,{})},`${t.code}-index`))}for(const a of t.modules){const o=zl(a,t.code);a.requiredFeature?s.push(e.jsx(N.Route,{element:e.jsx(fs,{feature:a.requiredFeature}),children:o},`feature-${a.componentKey}`)):s.push(...o)}return s}function Kl(t,s){return t.requiredFeature?[e.jsx(N.Route,{element:e.jsx(fs,{feature:t.requiredFeature}),children:s},`feature-${t.code}`)]:s}function Us({pageKey:t}){const s=Te.resolve(t);return s?e.jsx(s,{}):null}function Hl(t){switch(t){case"administration":return[e.jsx(N.Route,{path:"settings",element:e.jsx(N.Navigate,{to:"../configuration/settings",relative:"path",replace:!0})},"legacy-settings"),e.jsx(N.Route,{path:"settings/*",element:e.jsx(Oe,{to:"/administration/configuration/settings"})},"legacy-settings-wc"),e.jsx(N.Route,{path:"appsettings",element:e.jsx(N.Navigate,{to:"../configuration/appsettings",relative:"path",replace:!0})},"legacy-appsettings"),e.jsx(N.Route,{path:"appsettings/*",element:e.jsx(Oe,{to:"/administration/configuration/appsettings"})},"legacy-appsettings-wc"),e.jsx(N.Route,{path:"email-templates",element:e.jsx(N.Navigate,{to:"../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates"),e.jsx(N.Route,{path:"email-templates/list",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates-list"),e.jsx(N.Route,{path:"email-templates/create",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates/create",relative:"path",replace:!0})},"legacy-email-templates-create"),e.jsx(N.Route,{path:"workflows/templates",element:e.jsx(N.Navigate,{to:"../email-templates",relative:"path",replace:!0})},"legacy-wf-templates"),e.jsx(N.Route,{path:"workflows/templates/*",element:e.jsx(Oe,{to:"/administration/workflows/email-templates"})},"legacy-wf-templates-wc"),e.jsx(N.Route,{path:"tenants/business",element:e.jsx(N.Navigate,{to:"../tenants/list/enterprise",replace:!0})},"legacy-tenants-biz"),e.jsx(N.Route,{path:"tenants/personal",element:e.jsx(N.Navigate,{to:"../tenants/list/personal",replace:!0})},"legacy-tenants-perso")];case"support":return[e.jsx(N.Route,{path:"dashboard",element:e.jsx(N.Navigate,{to:"tickets",replace:!0})},"legacy-dashboard"),e.jsx(N.Route,{path:"sla",element:e.jsx(N.Navigate,{to:"admin/sla",replace:!0})},"legacy-sla"),e.jsx(N.Route,{path:"templates",element:e.jsx(N.Navigate,{to:"admin/templates",replace:!0})},"legacy-templates"),e.jsx(N.Route,{path:"admin/escalation",element:e.jsx(N.Navigate,{to:"tickets/escalation",replace:!0})},"legacy-admin-esc")];default:return[]}}function Vl(){const{isLoading:t}=Re(),{currentTenant:s}=Ee(),{user:r}=Ae(),a=N.useLocation();if(t)return e.jsx(Nt,{});const o=a.pathname.split("/").filter(Boolean),i=(o[0]==="t"?o.slice(2):o).slice(0,2).join("."),d=s?.slug?`/t/${s.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:s?.name,permissionPath:i||void 0,applicationsUrl:d,userRoles:r?.roles,userPermissions:r?.permissions})})})]})}function Wl(){const{isLoading:t}=Re();return!!localStorage.getItem("token")&&t?e.jsx(Nt,{}):e.jsx(Tl,{})}function Xl(){const{menu:t,isLoading:s}=Re(),r=n.useMemo(()=>!t||s?[]:t.applications.map(o=>{const c=o.route?.replace(/^\//,"")||o.code,i=Gl(o),d=Kl(o,i),u=Hl(o.code);return e.jsxs(N.Route,{path:c,element:e.jsx(Wt,{}),children:[d,u]},o.code)}),[t,s]),a=e.jsx(e.Fragment,{children:e.jsx(N.Route,{element:e.jsx(la,{}),children:e.jsxs(N.Route,{element:e.jsx(ca,{}),children:[r,Te.has("applications")&&e.jsx(N.Route,{path:"applications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"applications"})})}),Te.has("notifications")&&e.jsx(N.Route,{path:"notifications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"notifications"})})}),e.jsx(N.Route,{path:"administration/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"administration/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"support-client",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"support-client/*",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"user",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"user/*",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"*",element:e.jsx(Vl,{})})]})})});return e.jsxs(n.Suspense,{fallback:e.jsx(Nt,{}),children:[e.jsx(Lr,{}),e.jsx(Dr,{}),e.jsxs(N.Routes,{children:[e.jsx(N.Route,{path:"/",element:e.jsx(El,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Sl,{})})}),yl(),e.jsx(N.Route,{path:"/login",element:e.jsx(Pl,{})}),e.jsx(N.Route,{path:"/register",element:e.jsx($l,{})}),e.jsx(N.Route,{path:"/confirm-email",element:e.jsx(Il,{})}),e.jsx(N.Route,{path:"/forgot-password",element:e.jsx(Ll,{})}),e.jsx(N.Route,{path:"/reset-password",element:e.jsx(Dl,{})}),e.jsx(N.Route,{path:"/force-change-password",element:e.jsx(Ml,{})}),e.jsx(N.Route,{path:"/auth/callback",element:e.jsx(Fl,{})}),e.jsx(N.Route,{path:"/auth/onboarding",element:e.jsx(Ol,{})}),e.jsx(N.Route,{path:"/t/:slug",element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{path:"/admin",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/admin/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/administration/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/support/*",element:e.jsx(N.Navigate,{to:"/support",replace:!0})}),e.jsx(N.Route,{path:"/dashboard",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/business",element:e.jsx(N.Navigate,{to:"/applications",replace:!0})}),e.jsx(N.Route,{path:"/business/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"*",element:e.jsx(Wl,{})})]})]})}function Bs({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function ma({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["common","navigation"]),{menu:a}=Re(),{favorites:o,toggleFavorite:c,isFavorite:i,canAddMore:d,maxFavorites:u}=ze();if(!t)return null;const x=[];a?.applications.forEach(f=>{f.modules&&f.modules.length>0&&x.push({app:f,modules:f.modules})});const m=(f,h)=>{const v=[...f.sections||[]].sort((p,b)=>p.displayOrder-b.displayOrder),g=v.length>0&&v[0].route?v[0].route:`/${h.code}/${f.code}`,y={id:f.id,code:f.code,label:f.label,icon:f.icon||"Star",route:g,applicationCode:h.code,applicationLabel:h.label};c(y)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-[var(--bg-primary)] rounded-[var(--radius-modal)] shadow-xl w-full max-w-lg max-h-[80vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-5 h-5 text-[var(--color-accent-500)]"}),r("common:favorites.manageTitle")]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:r("common:favorites.selectModules",{count:o.length,max:u})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{const f={component:"FavoritesModal",url:window.location.href},h=`https://github.com/anthropics/claude-code/issues/new?title=${encodeURIComponent("[Bug] Favorites Modal")}&body=${encodeURIComponent(`## Context
30
- - Component: ${f.component}
31
- - URL: ${f.url}
32
-
33
- ## Description
34
-
35
- <!-- Describe the bug here -->
36
-
37
- ## Steps to Reproduce
38
-
39
- 1.
40
- 2.
41
- 3.
42
-
43
- ## Expected Behavior
44
-
45
- ## Actual Behavior
46
- `)}`;window.open(h,"_blank")},className:"p-2 rounded-[var(--radius-button)] hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-secondary)]",title:r("common:buttons.reportBug"),children:e.jsx(l.Bug,{className:"w-5 h-5"})}),e.jsx("button",{onClick:s,className:"p-2 rounded-[var(--radius-button)] hover:bg-[var(--bg-hover)] transition-colors",children:e.jsx(l.X,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[x.map(({app:f,modules:h})=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Bs,{name:f.icon||"Folder",className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)]",children:f.label})]}),e.jsx("div",{className:"space-y-1 ml-6",children:h.map(v=>{const g=i(v.id),y=!g&&!d;return e.jsxs("button",{onClick:()=>m(v,f),disabled:y,className:`w-full flex items-center gap-3 p-2.5 rounded-[var(--radius-button)] transition-all ${g?"bg-[var(--color-accent-100)] border border-[var(--color-accent-500)]":y?"opacity-50 cursor-not-allowed bg-[var(--bg-secondary)]":"bg-[var(--bg-secondary)] hover:bg-[var(--bg-hover)] border border-transparent hover:border-[var(--border-color)]"}`,children:[e.jsx("div",{className:`w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] ${g?"bg-[var(--color-accent-600)] text-white":"bg-[var(--bg-tertiary)] text-[var(--text-secondary)]"}`,children:e.jsx(Bs,{name:v.icon||"Star",className:"w-4 h-4"})}),e.jsx("span",{className:`flex-1 text-left text-sm ${g?"font-medium text-[var(--color-accent-700)]":"text-[var(--text-primary)]"}`,children:v.label}),g&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-600)]"})]},v.id)})})]},f.id)),x.length===0&&e.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:r("common:favorites.noModules")})]}),e.jsx("div",{className:"p-4 border-t border-[var(--border-color)]",children:e.jsx("button",{onClick:s,className:"w-full px-4 py-2 bg-[var(--color-accent-600)] text-white rounded-[var(--radius-button)] hover:bg-[var(--color-accent-700)] transition-colors font-medium",children:r("common:actions.done")})})]})})}function Yl({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function Jl({className:t=""}){const{t:s}=ne.useTranslation(["common"]),r=N.useNavigate(),{favorites:a,maxFavorites:o}=ze(),{triggerExpand:c}=ze(),{menu:i}=Re(),[d,u]=n.useState(!1),x=o-a.length,m=h=>{if(i)for(const v of i.applications){const g=v.modules.find(y=>y.id===h.id);if(g?.sections?.length){const y=[...g.sections].sort((p,b)=>p.displayOrder-b.displayOrder)[0];if(y.route)return y.route}}return h.route},f=h=>{const v=m(h);v&&(c(),r(v))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`bg-[var(--bg-card)] border border-[var(--border-color)] rounded-[var(--radius-card)] p-4 ${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-[var(--color-accent-500)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("common:favorites.quickAccess")})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-hover)] rounded-[var(--radius-button)] transition-colors",children:[e.jsx(l.Settings2,{className:"w-3.5 h-3.5"}),s("common:favorites.manage")]})]}),e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1",children:[a.map(h=>e.jsxs("button",{onClick:()=>f(h),className:"flex flex-col items-center gap-1.5 min-w-[80px] p-3 bg-[var(--bg-secondary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] hover:border-[var(--color-accent-500)] rounded-[var(--radius-card)] transition-all group",title:`${h.applicationLabel} - ${h.label}`,children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] bg-[var(--color-accent-100)] text-[var(--color-accent-600)] group-hover:bg-[var(--color-accent-600)] group-hover:text-white transition-colors",children:e.jsx(Yl,{name:h.icon||"Star",className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)] group-hover:text-[var(--text-primary)] truncate max-w-[70px]",children:h.label})]},h.id)),Array.from({length:x}).map((h,v)=>e.jsxs("button",{onClick:()=>u(!0),className:"flex flex-col items-center justify-center gap-1.5 min-w-[80px] p-3 border-2 border-dashed border-[var(--border-color)] hover:border-[var(--color-accent-500)] rounded-[var(--radius-card)] transition-colors group",children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] bg-[var(--bg-tertiary)] text-[var(--text-muted)] group-hover:bg-[var(--color-accent-100)] group-hover:text-[var(--color-accent-600)] transition-colors",children:e.jsx(l.Plus,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs text-[var(--text-muted)] group-hover:text-[var(--text-secondary)]",children:s("common:favorites.add")})]},`empty-slot-${v}`))]})]}),e.jsx(ma,{isOpen:d,onClose:()=>u(!1)})]})}function Ql({activities:t,loading:s=!1}){return s?e.jsx("div",{className:"animate-pulse space-y-4",children:[1,2,3].map(r=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-[var(--bg-secondary)] rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-[var(--bg-secondary)] rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-[var(--bg-secondary)] rounded w-1/4"})]})]},r))}):t.length===0?e.jsxs("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:[e.jsx(l.RefreshCcw,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:"No activity recorded yet"})]}):e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 bottom-0 w-0.5 bg-[var(--border-color)]"}),e.jsx("div",{className:"space-y-4",children:t.map((r,a)=>e.jsx(Zl,{activity:r,isLast:a===t.length-1},r.id))})]})}function Zl({activity:t,isLast:s}){const{icon:r,color:a,bgColor:o}=sc(t.action),c=r;return e.jsxs("div",{className:"relative flex gap-4 pl-0",children:[e.jsx("div",{className:`relative z-10 w-8 h-8 rounded-full flex items-center justify-center ${o}`,children:e.jsx(c,{className:`w-4 h-4 ${a}`})}),e.jsx("div",{className:"flex-1 pb-4 ",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm",children:[t.changedByUserName?e.jsx("span",{className:"font-medium",children:t.changedByUserName}):e.jsx("span",{className:"font-medium text-[var(--text-secondary)]",children:"System"})," ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:mc(t)})]}),t.fieldChanged&&t.oldValue&&t.newValue&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"px-2 py-0.5 bg-[var(--error-bg)] text-[var(--error-text)] rounded line-through",children:t.oldValue}),e.jsx(l.ArrowRight,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"px-2 py-0.5 bg-[var(--success-bg)] text-[var(--success-text)] rounded",children:t.newValue})]})]}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)] whitespace-nowrap",children:xc(t.createdAt)})]})})]})}const ec={Created:{icon:l.PlusCircle,color:"text-[var(--success-text)]",bgColor:"bg-[var(--success-bg)]"},StatusChanged:{icon:l.RefreshCcw,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},PriorityChanged:{icon:l.AlertTriangle,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},Assigned:{icon:l.UserPlus,color:"text-[var(--accent-text)]",bgColor:"bg-[var(--accent-bg)]"},Commented:{icon:l.MessageSquare,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},AttachmentAdded:{icon:l.Paperclip,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"},Resolved:{icon:l.CheckCircle,color:"text-[var(--success-text)]",bgColor:"bg-[var(--success-bg)]"},Closed:{icon:l.XCircle,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"},Reopened:{icon:l.RefreshCcw,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},SlaBreached:{icon:l.AlertTriangle,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},Escalated:{icon:l.TrendingUp,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},Updated:{icon:l.Edit,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},Deleted:{icon:l.Trash2,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},OnHold:{icon:l.Pause,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},InProgress:{icon:l.Play,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"}},tc={icon:l.RefreshCcw,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"};function sc(t){return ec[t]||tc}const rc=t=>t.oldValue&&t.newValue?`changed status from ${t.oldValue} to ${t.newValue}`:"changed the status",ac=t=>t.oldValue&&t.newValue?`changed priority from ${t.oldValue} to ${t.newValue}`:"changed the priority",nc=t=>t.newValue?`assigned to ${t.newValue}`:"unassigned the ticket",oc=t=>t.newValue==="internal"?"added an internal note":"added a comment",ic=t=>t.newValue?`added attachment: ${t.newValue}`:"added an attachment",lc=t=>t.newValue==="response"?"Response SLA was breached":"Resolution SLA was breached",cc=t=>t.newValue?`escalated to ${t.newValue}`:"escalated this ticket",dc=t=>t.fieldChanged?`updated ${t.fieldChanged}`:"updated the ticket",uc={Created:()=>"created this ticket",StatusChanged:rc,PriorityChanged:ac,Assigned:nc,Commented:oc,AttachmentAdded:ic,Resolved:()=>"resolved this ticket",Closed:()=>"closed this ticket",Reopened:()=>"reopened this ticket",SlaBreached:lc,Escalated:cc,Updated:dc,OnHold:()=>"put this ticket on hold",InProgress:()=>"started working on this ticket"};function mc(t){const s=uc[t.action];return s?s(t):t.action.toLowerCase()}function xc(t){const s=new Date(t),a=new Date().getTime()-s.getTime(),o=Math.floor(a/6e4),c=Math.floor(o/60),i=Math.floor(c/24);return o<1?"Just now":o<60?`${o}m ago`:c<24?`${c}h ago`:i<7?`${i}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function pc({responseDueAt:t,resolutionDueAt:s,responseBreached:r,resolutionBreached:a,firstResponseAt:o,isPaused:c,responseSlaPercentage:i=0,resolutionSlaPercentage:d=0,showDetails:u=!1}){const x=new Date,m=new Date(t),f=new Date(s),h=m.getTime()-x.getTime(),v=f.getTime()-x.getTime(),g=!!o;let y="ok",p="green",b=l.CheckCircle;c?(y="paused",p="gray",b=l.Pause):r||a?(y="breached",p="red",b=l.XCircle):(!g&&h<1800*1e3||v<3600*1e3)&&(y="warning",p="yellow",b=l.AlertTriangle);const j={green:"bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",yellow:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",red:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",gray:"bg-[var(--bg-secondary)] text-[var(--text-secondary)] border-[var(--border-color)]"};return u?e.jsxs("div",{className:`p-3 rounded-lg border ${j[p]}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(b,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[y==="paused"&&"SLA Paused",y==="breached"&&"SLA Breached",y==="warning"&&"SLA Warning",y==="ok"&&"Within SLA"]})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"opacity-80",children:"Response"}),r?e.jsx("span",{className:"text-[var(--error-text)] font-medium",children:"Breached"}):g?e.jsx("span",{className:"text-[var(--success-text)] font-medium",children:"Completed"}):e.jsx("span",{children:qs(h)})]}),!g&&!r&&e.jsx(_s,{percentage:i})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"opacity-80",children:"Resolution"}),a?e.jsx("span",{className:"text-[var(--error-text)] font-medium",children:"Breached"}):e.jsx("span",{children:qs(v)})]}),!a&&e.jsx(_s,{percentage:d})]})]})]}):e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium border ${j[p]}`,children:[e.jsx(b,{className:"w-3 h-3"}),y==="paused"&&"SLA Paused",y==="breached"&&"SLA Breached",y==="warning"&&"SLA Warning",y==="ok"&&"Within SLA"]})}function _s({percentage:t}){const s=()=>t>=90?"bg-[var(--error-text)]":t>=75?"bg-[var(--warning-text)]":"bg-[var(--success-text)]";return e.jsx("div",{className:"h-1.5 bg-white/50 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${s()}`,style:{width:`${Math.min(t,100)}%`}})})}function qs(t){if(t<=0)return"Overdue";const s=Math.floor(t/(1e3*60)),r=Math.floor(s/60),a=Math.floor(r/24);if(a>0){const o=r%24;return o>0?`${a}d ${o}h`:`${a}d`}if(r>0){const o=s%60;return o>0?`${r}h ${o}m`:`${r}h`}return`${s}m`}const zs={Greeting:"bg-[var(--info-bg)] text-[var(--info-text)]",Acknowledgment:"bg-[var(--success-bg)] text-[var(--success-text)]",RequestInfo:"bg-[var(--warning-bg)] text-[var(--warning-text)]",InProgress:"bg-[var(--info-bg)] text-[var(--info-text)]",Resolution:"bg-[var(--accent-bg)] text-[var(--accent-text)]",Escalation:"bg-[var(--warning-bg)] text-[var(--warning-text)]",OnHold:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]",Closure:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]",Rejection:"bg-[var(--error-bg)] text-[var(--error-text)]",General:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]"},hc=[{code:"fr",label:"Français"},{code:"en",label:"English"},{code:"de",label:"Deutsch"},{code:"it",label:"Italiano"}];function gc({isOpen:t,onClose:s,onSelect:r,ticketVariables:a}){const{t:o,i18n:c}=ne.useTranslation("support"),[i,d]=n.useState([]),[u,x]=n.useState(!1),[m,f]=n.useState(null),[h,v]=n.useState(""),[g,y]=n.useState(""),[p,b]=n.useState(c.language?.substring(0,2)||"fr"),[j,S]=n.useState([]),w=n.useCallback(k=>{x(!0),Promise.all([qt.getAll(void 0,!0,k),qt.getCategories()]).then(([R,L])=>{d(R),S(L)}).catch(console.error).finally(()=>x(!1))},[]);n.useEffect(()=>{t&&(b(c.language?.substring(0,2)||"fr"),w(c.language?.substring(0,2)||"fr"))},[t,c.language,w]);const P=k=>{b(k),w(k)};if(!t)return null;const $=i.filter(k=>{const R=!h||k.title.toLowerCase().includes(h.toLowerCase())||k.content.toLowerCase().includes(h.toLowerCase()),L=!g||k.category===g;return R&&L}),A=async k=>{try{f(k.id);const R=await qt.render(k.id,a);r(R.content),s()}catch(R){console.error("Failed to render template:",R)}finally{f(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:s,children:e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-xl shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.FileText,{className:"w-5 h-5 text-[var(--color-primary-500)]"}),e.jsx("h3",{className:"font-semibold text-[var(--text-primary)]",children:o("templatePicker.title")})]}),e.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-[var(--bg-secondary)]",children:e.jsx(l.X,{className:"w-5 h-5 text-[var(--text-secondary)]"})})]}),e.jsxs("div",{className:"p-3 space-y-2 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Globe,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"flex gap-1",children:hc.map(k=>e.jsx("button",{onClick:()=>P(k.code),className:`px-2 py-1 text-xs rounded transition-colors ${p===k.code?"bg-[var(--color-primary-500)] text-white":"bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:k.label},k.code))})]}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{type:"text",value:h,onChange:k=>v(k.target.value),placeholder:o("templatePicker.searchPlaceholder"),className:"w-full pl-9 pr-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] rounded-lg outline-none focus:ring-1 focus:ring-[var(--color-primary-500)]",autoFocus:!0})]}),e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("button",{onClick:()=>y(""),className:`px-2 py-1 text-xs rounded-full transition-colors ${g?"bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]":"bg-[var(--color-primary-500)] text-white"}`,children:o("templatePicker.allCategories")}),j.map(k=>e.jsx("button",{onClick:()=>y(k===g?"":k),className:`px-2 py-1 text-xs rounded-full transition-colors ${k===g?"bg-[var(--color-primary-500)] text-white":`${zs[k]||"bg-[var(--bg-secondary)] text-[var(--text-secondary)]"} hover:opacity-80`}`,children:o(`templates.categories.${k}`,{defaultValue:k})},k))]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--text-tertiary)]"})}):$.length===0?e.jsx("p",{className:"text-center py-8 text-sm text-[var(--text-tertiary)]",children:o("templatePicker.noResults")}):e.jsx("div",{className:"space-y-1",children:$.map(k=>e.jsxs("button",{onClick:()=>A(k),disabled:m!==null,className:"w-full text-left p-3 rounded-lg hover:bg-[var(--bg-secondary)] transition-colors group disabled:opacity-50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full ${zs[k.category]||"bg-[var(--bg-secondary)]"}`,children:o(`templates.categories.${k.category}`,{defaultValue:k.category})}),e.jsx("span",{className:"font-medium text-sm text-[var(--text-primary)]",children:k.title}),m===k.id&&e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin ml-auto"})]}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] line-clamp-2",children:k.content})]},k.id))})}),e.jsx("div",{className:"p-3 border-t border-[var(--border-color)]",children:e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center",children:o("templatePicker.selectTemplate")})})]})})}const Gs={Created:{icon:l.Clock,color:"var(--color-primary-500)",labelKey:"history.actions.Created"},StatusChanged:{icon:l.ArrowRightLeft,color:"var(--info-text)",labelKey:"history.actions.StatusChanged"},PriorityChanged:{icon:l.AlertTriangle,color:"var(--warning-text)",labelKey:"history.actions.PriorityChanged"},Assigned:{icon:l.UserPlus,color:"var(--success-text)",labelKey:"history.actions.Assigned"},Unassigned:{icon:l.UserPlus,color:"var(--text-secondary)",labelKey:"history.actions.Unassigned"},Commented:{icon:l.MessageSquare,color:"var(--color-primary-500)",labelKey:"history.actions.Commented"},InternalCommented:{icon:l.MessageSquare,color:"var(--warning-text)",labelKey:"history.actions.InternalCommented"},AttachmentAdded:{icon:l.Paperclip,color:"var(--success-text)",labelKey:"history.actions.AttachmentAdded"},AttachmentRemoved:{icon:l.Paperclip,color:"var(--error-text)",labelKey:"history.actions.AttachmentRemoved"},Resolved:{icon:l.CheckCircle,color:"var(--success-text)",labelKey:"history.actions.Resolved"},Closed:{icon:l.XCircle,color:"var(--text-secondary)",labelKey:"history.actions.Closed"},Reopened:{icon:l.RotateCcw,color:"var(--warning-text)",labelKey:"history.actions.Reopened"},Rejected:{icon:l.XCircle,color:"var(--error-text)",labelKey:"history.actions.Rejected"},SlaResponseBreached:{icon:l.AlertTriangle,color:"var(--error-text)",labelKey:"history.actions.SlaResponseBreached"},SlaResolutionBreached:{icon:l.AlertTriangle,color:"var(--error-text)",labelKey:"history.actions.SlaResolutionBreached"},Escalated:{icon:l.ArrowRightLeft,color:"var(--warning-text)",labelKey:"history.actions.Escalated"},TitleChanged:{icon:l.MessageSquare,color:"var(--text-secondary)",labelKey:"history.actions.TitleChanged"},DescriptionChanged:{icon:l.MessageSquare,color:"var(--text-secondary)",labelKey:"history.actions.DescriptionChanged"},TypeChanged:{icon:l.ArrowRightLeft,color:"var(--text-secondary)",labelKey:"history.actions.TypeChanged"},SatisfactionSubmitted:{icon:l.CheckCircle,color:"var(--success-text)",labelKey:"history.actions.SatisfactionSubmitted"}},xa=(t,s,r)=>{const a=new Date(t),c=new Date().getTime()-a.getTime(),i=Math.floor(c/6e4),d=Math.floor(c/36e5),u=Math.floor(c/864e5);return i<1?s("history.timeAgo.now"):i<60?s("history.timeAgo.minutes",{count:i}):d<24?s("history.timeAgo.hours",{count:d}):u<7?s("history.timeAgo.days",{count:u}):a.toLocaleDateString(r,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},fc=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Ks=t=>t?.startsWith("image/")||!1,bc=(t,s)=>t?"px-4 py-2.5 shadow-sm rounded-2xl bg-[var(--warning-bg)] border border-[var(--warning-border)]":s?"px-4 py-2.5 shadow-sm rounded-2xl rounded-tr-md bg-[var(--color-accent-600)] text-white":"px-4 py-2.5 shadow-sm rounded-2xl rounded-tl-md bg-[var(--bg-card)] border border-[var(--border-color)]";function vc(t,s,r){const a=[];(r?t:t.filter(i=>!i.isInternal)).forEach(i=>{a.push({type:"comment",id:`comment-${i.id}`,timestamp:new Date(i.createdAt),data:i})});const c=["Commented","InternalCommented"];return s.filter(i=>!c.includes(i.action)).forEach(i=>{a.push({type:"activity",id:`activity-${i.id}`,timestamp:new Date(i.createdAt),data:i})}),a.sort((i,d)=>i.timestamp.getTime()-d.timestamp.getTime()),a}function yc({activity:t,t:s,locale:r}){const a=Gs[t.action]||Gs.Created,o=a.icon;return e.jsx("div",{className:"flex justify-center my-4",children:e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[var(--bg-secondary)] border border-[var(--border-color)] text-sm",children:[e.jsx(o,{className:"w-4 h-4",style:{color:a.color}}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s(a.labelKey)}),t.newValue&&t.action==="StatusChanged"&&e.jsxs("span",{className:"font-medium text-[var(--text-primary)]",children:["→ ",t.newValue]}),t.newValue&&t.action==="Assigned"&&e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t.newValue}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:xa(t.createdAt,s,r)})]})})}const jc=t=>{const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[s.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()},wc=t=>{const s=["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"];let r=0;for(let a=0;a<t.length;a++)r=t.charCodeAt(a)+((r<<5)-r);return s[Math.abs(r)%s.length]};function Hs({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,d]=n.useState(!0),[u,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return Ie.get(t,{responseType:"blob",signal:f.signal}).then(h=>{if(m){const v=URL.createObjectURL(h.data);c(v),d(!1)}}).catch(()=>{m&&(x(!0),d(!1))}),()=>{m=!1,f.abort(),o&&URL.revokeObjectURL(o)}},[t]),i?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,onClick:a,children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--text-tertiary)]"})}):u||!o?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,onClick:a,children:e.jsx(l.Image,{className:"w-6 h-6 text-[var(--text-tertiary)]"})}):e.jsx("img",{src:o,alt:s,className:r,onClick:a})}function Nc({comment:t,isOwn:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:i,locale:d}){const[u,x]=n.useState(null),m=new Date(t.createdAt).getTime(),f=a.filter(p=>{const b=new Date(p.createdAt).getTime();return Math.abs(b-m)<6e4}),h=f.filter(p=>Ks(p.contentType)),v=f.filter(p=>!Ks(p.contentType)),g=jc(t.userName),y=wc(t.userName);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex gap-3 mb-4 ${s?"flex-row-reverse":"flex-row"}`,children:[e.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center flex-shrink-0 text-white text-sm font-semibold shadow-sm",style:{backgroundColor:y},title:t.userName,children:g}),e.jsxs("div",{className:`flex flex-col max-w-[70%] ${s?"items-end":"items-start"}`,children:[e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${s?"flex-row-reverse":"flex-row"}`,children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:t.userName}),r&&t.isInternal&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--warning-bg)] text-[var(--warning-text)] border border-[var(--warning-border)]",children:i("conversation.internalNoteLabel")}),t.isEdited&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:i("conversation.edited")})]}),e.jsxs("div",{className:bc(t.isInternal||!1,s),children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:t.content}),h.length>0&&e.jsx("div",{className:`mt-3 grid gap-2 ${h.length>1?"grid-cols-2":"grid-cols-1"}`,children:h.map(p=>e.jsxs("button",{className:"relative cursor-pointer rounded-lg overflow-hidden group",onClick:()=>x(p),type:"button",children:[e.jsx(Hs,{src:o(p),alt:p.fileName,className:"w-full h-32 object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:e.jsx(l.Eye,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity"})})]},p.id))}),v.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:v.map(p=>e.jsxs("button",{onClick:()=>c(p),className:`flex items-center gap-2 w-full p-2 rounded-lg transition-colors ${s&&!t.isInternal?"bg-white/10 hover:bg-white/20":"bg-[var(--bg-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:[e.jsx(l.FileText,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-xs truncate flex-1 text-left",children:p.fileName}),e.jsx("span",{className:"text-xs opacity-70",children:fc(p.fileSize)}),e.jsx(l.Download,{className:"w-3.5 h-3.5"})]},p.id))})]}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 px-1",children:xa(t.createdAt,i,d)})]})]}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>x(null),children:e.jsxs("div",{className:"relative max-w-4xl max-h-[90vh] w-full",children:[e.jsx("button",{onClick:()=>x(null),className:"absolute -top-10 right-0 text-white hover:text-gray-300",children:e.jsx(l.X,{className:"w-6 h-6"})}),e.jsx(Hs,{src:o(u),alt:u.fileName,className:"max-w-full max-h-[80vh] mx-auto object-contain rounded-lg",onClick:p=>p.stopPropagation()}),e.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[e.jsx("p",{className:"text-white text-sm",children:u.fileName}),e.jsxs("button",{onClick:p=>{p.stopPropagation(),c(u)},className:"btn btn-secondary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),i("conversation.download")]})]})]})})]})}const Sc=(t,s,r)=>t?r("conversation.internalPlaceholder","Ajouter une note interne..."):s?r("conversation.supportPlaceholder","Répondre au client..."):r("conversation.clientPlaceholder","Écrire un message..."),Cc=t=>`flex items-end gap-2 rounded-xl border ${t?"border-[var(--warning-border)] bg-[var(--warning-bg)]/30":"border-[var(--border-color)] bg-[var(--bg-secondary)]"} p-2`,kc=(t,s)=>`p-2.5 rounded-lg transition-colors ${t?"bg-[var(--color-primary-600)] text-white hover:bg-[var(--color-primary-700)]":"bg-[var(--bg-tertiary)] text-[var(--text-tertiary)]"} disabled:opacity-50`;function Ac({isConnected:t,commentCount:s,t:r}){return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border-color)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.MessageSquare,{className:"w-5 h-5 text-[var(--color-accent-600)]"}),e.jsx("h2",{className:"font-semibold",children:r("conversation.title","Conversation")}),e.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:["(",s,")"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:r(t?"conversation.realtimeActive":"conversation.realtimeInactive"),children:[t?e.jsx(l.Wifi,{className:"w-4 h-4 text-[var(--success-text)]"}):e.jsx(l.WifiOff,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:`text-xs ${t?"text-[var(--success-text)]":"text-[var(--text-tertiary)]"}`,children:r(t?"conversation.live":"conversation.offline")})]})]})}function Rc({t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-[var(--text-secondary)]",children:[e.jsx(l.MessageSquare,{className:"w-12 h-12 mb-3 opacity-50"}),e.jsx("p",{children:t("conversation.empty","Aucun message pour le moment")}),e.jsx("p",{className:"text-sm mt-1",children:t("conversation.startHint","Commencez la conversation ci-dessous")})]})}function Pc({timeline:t,currentUserName:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,messagesEndRef:i,t:d,locale:u}){return e.jsxs(e.Fragment,{children:[t.map(x=>{if(x.type==="activity")return e.jsx(yc,{activity:x.data,t:d,locale:u},x.id);const m=x.data,f=m.userName===s;return e.jsx(Nc,{comment:m,isOwn:f,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:d,locale:u},x.id)}),e.jsx("div",{ref:i})]})}function Tc({isInternalComment:t,onToggle:s,t:r}){return e.jsx("div",{className:"mb-2",children:e.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a=>s(a.target.checked),className:"rounded border-[var(--border-color)]"}),e.jsx("span",{className:`text-sm ${t?"text-[var(--warning-text)] font-medium":"text-[var(--text-secondary)]"}`,children:r("conversation.internalNote","Note interne (invisible pour le client)")})]})})}function Ec({newComment:t,onCommentChange:s,onKeyDown:r,onSend:a,isInternalComment:o,onInternalToggle:c,sending:i,isSupport:d,textareaRef:u,ticketVariables:x,onOpenTemplatePicker:m,t:f}){const h=t.trim();return e.jsxs("div",{className:"border-t border-[var(--border-color)] bg-[var(--bg-card)] p-3",children:[d&&e.jsx(Tc,{isInternalComment:o,onToggle:c,t:f}),e.jsxs("div",{className:Cc(o),children:[e.jsx("textarea",{ref:u,value:t,onChange:v=>s(v.target.value),onKeyDown:r,placeholder:Sc(o,d,f),className:"flex-1 bg-transparent border-none outline-none resize-none text-sm min-h-[24px] max-h-[150px] py-1 px-2",rows:1}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[d&&x&&m&&e.jsx("button",{onClick:m,className:"p-2 rounded-lg text-[var(--text-tertiary)] hover:text-[var(--color-primary-500)] hover:bg-[var(--bg-tertiary)] transition-colors",title:f("templatePicker.buttonTitle"),children:e.jsx(l.FileText,{className:"w-4 h-4"})}),e.jsx("button",{onClick:a,disabled:!h||i,className:kc(!!h),children:i?e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}):e.jsx(l.Send,{className:"w-5 h-5"})})]})]}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-2 text-center",children:f("conversation.hint","Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne")})]})}function $c({t}){return e.jsx("div",{className:"border-t border-[var(--border-color)] bg-[var(--bg-secondary)] p-4 text-center",children:e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:t("conversation.closed","Ce ticket est fermé. Aucun nouveau message ne peut être ajouté.")})})}function pa({comments:t,activities:s,attachments:r,isSupport:a,isClosed:o,isConnected:c,currentUserName:i,ticketVariables:d,onAddComment:u,onDownloadAttachment:x,getAttachmentUrl:m}){const{t:f,i18n:h}=ne.useTranslation("support"),[v,g]=n.useState(""),[y,p]=n.useState(!1),[b,j]=n.useState(!1),[S,w]=n.useState(!1),P=n.useRef(null),$=n.useRef(null),A=vc(t,s,a),k=t.filter(C=>a||!C.isInternal).length;n.useEffect(()=>{P.current?.scrollIntoView({behavior:"smooth"})},[A.length]),n.useEffect(()=>{$.current&&($.current.style.height="auto",$.current.style.height=`${Math.min($.current.scrollHeight,150)}px`)},[v]);const R=async()=>{if(!(!v.trim()||b))try{j(!0),await u(v,y),g(""),p(!1)}finally{j(!1)}},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),R())},I=C=>{g(O=>O?O+`
47
- `+C:C)};return e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsx(Ac,{isConnected:c,commentCount:k,t:f}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-[var(--bg-primary)]",children:A.length===0?e.jsx(Rc,{t:f}):e.jsx(Pc,{timeline:A,currentUserName:i,isSupport:a,attachments:r,getAttachmentUrl:m,onDownloadAttachment:x,messagesEndRef:P,t:f,locale:h.language})}),o?e.jsx($c,{t:f}):e.jsx(Ec,{newComment:v,onCommentChange:g,onKeyDown:L,onSend:R,isInternalComment:y,onInternalToggle:p,sending:b,isSupport:a,textareaRef:$,ticketVariables:d,onOpenTemplatePicker:a&&d?()=>w(!0):void 0,t:f}),d&&e.jsx(gc,{isOpen:S,onClose:()=>w(!1),onSelect:I,ticketVariables:d})]})}const Vs=t=>{const s=t.contentType?.toLowerCase()||"",a=t.fileName.toLowerCase().split(".").pop()||"";if(s.startsWith("image/"))return"image";if(s==="application/pdf")return"pdf";if(s.startsWith("text/")||s==="application/json")return"text";if(s.startsWith("video/"))return"video";if(s.startsWith("audio/"))return"audio";const o=["png","jpg","jpeg","gif","webp","svg","bmp","ico"],c=["txt","csv","json","md","xml","log","html","css","js","ts"],i=["mp4","webm","ogg","mov","avi"],d=["mp3","wav","ogg","aac","m4a"];return o.includes(a)?"image":a==="pdf"?"pdf":c.includes(a)?"text":i.includes(a)?"video":d.includes(a)?"audio":"unknown"},Ws=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`;function Ic({attachment:t,getUrl:s,onClose:r,onDownload:a}){const{t:o}=ne.useTranslation("support"),[c,i]=n.useState(1),[d,u]=n.useState(0),[x,m]=n.useState(!0),[f,h]=n.useState(null),[v,g]=n.useState(null),[y,p]=n.useState(!1),[b,j]=n.useState(null),S=n.useRef(null),w=t?Vs(t):"unknown";n.useEffect(()=>{if(S.current?.id===t?.id||(S.current=t,b&&URL.revokeObjectURL(b),i(1),u(0),m(!0),h(null),g(null),j(null),p(!1),!t))return;const L=Vs(t),I=s(t),C=new AbortController;return L==="text"?Ie.get(I,{signal:C.signal,responseType:"text"}).then(O=>{g(O.data),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="image"||L==="video"||L==="audio"?Ie.get(I,{signal:C.signal,responseType:"blob"}).then(O=>{const _=URL.createObjectURL(O.data);j(_),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="pdf"?Ie.get(I,{signal:C.signal,responseType:"blob"}).then(O=>{const _=URL.createObjectURL(O.data);j(_),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):m(!1),()=>{C.abort()}},[t,s,o]),n.useEffect(()=>()=>{b&&URL.revokeObjectURL(b)},[b]),n.useEffect(()=>{if(!t)return;const L=I=>{I.key==="Escape"&&(y?p(!1):r()),(I.key==="+"||I.key==="=")&&(I.preventDefault(),i(C=>Math.min(C+.25,3))),I.key==="-"&&(I.preventDefault(),i(C=>Math.max(C-.25,.25))),I.key==="r"&&!I.ctrlKey&&!I.metaKey&&(I.preventDefault(),u(C=>(C+90)%360)),I.key==="f"&&(I.preventDefault(),p(C=>!C))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,y,r]);const P=n.useCallback(()=>i(L=>Math.min(L+.25,3)),[]),$=n.useCallback(()=>i(L=>Math.max(L-.25,.25)),[]),A=n.useCallback(()=>u(L=>(L+90)%360),[]);if(!t)return null;const k=()=>{if(x&&w!=="pdf"&&w!=="image"&&w!=="video"&&w!=="audio")return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-accent-500)]"})});if(f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center px-8",children:[e.jsx(l.AlertTriangle,{className:"w-12 h-12 text-[var(--warning-text)]"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:f}),e.jsxs("button",{onClick:()=>a(t),className:"btn btn-primary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),o("filePreview.download","Télécharger le fichier")]})]});switch(w){case"image":return e.jsx("div",{className:"relative flex items-center justify-center h-full overflow-auto p-4",children:b?e.jsx("img",{src:b,alt:t.fileName,className:"max-w-none transition-transform duration-200",style:{transform:`scale(${c}) rotate(${d}deg)`,maxHeight:y?"90vh":"70vh"},onClick:L=>L.stopPropagation()}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"pdf":return e.jsx("div",{className:"h-full w-full",children:b?e.jsx("iframe",{src:`${b}#toolbar=1&navpanes=0`,className:"w-full h-full border-0 rounded",title:t.fileName}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"text":return e.jsx("div",{className:"h-full overflow-auto p-4",children:e.jsx("pre",{className:"text-sm text-[var(--text-primary)] font-mono whitespace-pre-wrap break-words bg-[var(--bg-secondary)] p-4 rounded-lg",children:v})});case"video":return e.jsx("div",{className:"flex items-center justify-center h-full p-4",children:b?e.jsx("video",{src:b,controls:!0,className:"max-w-full max-h-[70vh] rounded-lg",children:o("filePreview.videoNotSupported","Votre navigateur ne supporte pas la lecture vidéo.")}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"audio":return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-6 p-4",children:[e.jsx("div",{className:"w-24 h-24 rounded-full bg-[var(--color-accent-500)]/20 flex items-center justify-center",children:e.jsx(l.File,{className:"w-12 h-12 text-[var(--color-accent-500)]"})}),e.jsx("p",{className:"text-lg font-medium text-[var(--text-primary)]",children:t.fileName}),b?e.jsx("audio",{src:b,controls:!0,className:"w-full max-w-md",children:o("filePreview.audioNotSupported","Votre navigateur ne supporte pas la lecture audio.")}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-accent-500)]"})})]});default:return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center px-8",children:[e.jsx("div",{className:"w-20 h-20 rounded-xl bg-[var(--bg-secondary)] flex items-center justify-center",children:e.jsx(l.FileText,{className:"w-10 h-10 text-[var(--text-tertiary)]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-[var(--text-primary)] mb-1",children:t.fileName}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)]",children:Ws(t.fileSize)})]}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:o("filePreview.noPreview","Aperçu non disponible pour ce type de fichier")}),e.jsxs("button",{onClick:()=>a(t),className:"btn btn-primary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),o("filePreview.download","Télécharger le fichier")]})]})}},R=e.jsxs("div",{className:"fixed inset-0 bg-black/90 backdrop-blur-sm flex flex-col z-[100]",onClick:r,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-black/50",onClick:L=>L.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(l.FileText,{className:"w-5 h-5 text-white/70 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-white font-medium truncate",children:t.fileName}),e.jsx("p",{className:"text-xs text-white/50",children:Ws(t.fileSize)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[w==="image"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:$,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.zoomOut","Zoom arrière (-)")||"Zoom out",children:e.jsx(l.ZoomOut,{className:"w-5 h-5"})}),e.jsxs("span",{className:"text-white/70 text-sm min-w-[3rem] text-center",children:[Math.round(c*100),"%"]}),e.jsx("button",{onClick:P,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.zoomIn","Zoom avant (+)")||"Zoom in",children:e.jsx(l.ZoomIn,{className:"w-5 h-5"})}),e.jsx("button",{onClick:A,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.rotate","Rotation (R)")||"Rotate",children:e.jsx(l.RotateCw,{className:"w-5 h-5"})}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-1"})]}),e.jsx("button",{onClick:()=>p(L=>!L),className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.fullscreen","Plein écran (F)")||"Fullscreen",children:y?e.jsx(l.Minimize2,{className:"w-5 h-5"}):e.jsx(l.Maximize2,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>a(t),className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.download","Télécharger")||"Download",children:e.jsx(l.Download,{className:"w-5 h-5"})}),e.jsx("button",{onClick:r,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("common.close","Fermer (Échap)")||"Close",children:e.jsx(l.X,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",onClick:L=>L.stopPropagation(),children:k()}),e.jsx("div",{className:"px-4 py-2 bg-black/50 text-center",onClick:L=>L.stopPropagation(),children:e.jsx("p",{className:"text-xs text-white/40",children:o("filePreview.shortcuts","Raccourcis: Échap pour fermer • +/- pour zoomer • R pour rotation • F pour plein écran")})})]});return $t.createPortal(R,document.body)}const Xs={Low:{bg:"var(--info-bg)",text:"var(--info-text)"},Medium:{bg:"var(--warning-bg)",text:"var(--warning-text)"},High:{bg:"var(--error-bg)",text:"var(--error-text)"},Critical:{bg:"var(--error-text)",text:"white"}},Lc=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Ys=t=>t?.startsWith("image/")||!1;function Dc({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,d]=n.useState(!0),[u,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return Ie.get(t,{responseType:"blob",signal:f.signal}).then(h=>{if(m){const v=URL.createObjectURL(h.data);c(v),d(!1)}}).catch(()=>{m&&(x(!0),d(!1))}),()=>{m=!1,f.abort(),o&&URL.revokeObjectURL(o)}},[t]),i?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,children:e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--text-tertiary)]"})}):u||!o?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,children:e.jsx(l.Image,{className:"w-4 h-4 text-[var(--text-tertiary)]"})}):e.jsx("img",{src:o,alt:s,className:r,onClick:a})}const Mc={Created:{icon:l.Plus,color:"var(--success-text)"},StatusChanged:{icon:l.Edit,color:"var(--info-text)"},Assigned:{icon:l.UserCheck,color:"var(--color-accent-600)"},Unassigned:{icon:l.User,color:"var(--warning-text)"},Commented:{icon:l.MessageSquare,color:"var(--text-secondary)"},PriorityChanged:{icon:l.AlertTriangle,color:"var(--warning-text)"},Resolved:{icon:l.CheckCircle,color:"var(--success-text)"},Closed:{icon:l.XCircle,color:"var(--text-tertiary)"},Reopened:{icon:l.RotateCcw,color:"var(--warning-text)"},Escalated:{icon:l.ArrowUpCircle,color:"var(--error-text)"},Started:{icon:l.Play,color:"var(--info-text)"},Paused:{icon:l.Pause,color:"var(--warning-text)"}},Fc=(t,s)=>{const r=new Date(t),o=new Date().getTime()-r.getTime(),c=Math.floor(o/6e4),i=Math.floor(o/36e5),d=Math.floor(o/864e5);return c<1?s("sidebar.timeAgo.justNow",{defaultValue:"Just now"}):c<60?s("sidebar.timeAgo.minutes",{count:c}):i<24?s("sidebar.timeAgo.hours",{count:i}):d<7?s("sidebar.timeAgo.days",{count:d}):r.toLocaleDateString(void 0,{day:"numeric",month:"short"})},Oc=10*1024*1024,Js=[".pdf",".doc",".docx",".xls",".xlsx",".txt",".csv",".zip",".png",".jpg",".jpeg",".gif",".webp"];function it({section:t,icon:s,title:r,count:a,isExpanded:o,onToggle:c}){return e.jsxs("button",{onClick:()=>c(t),className:"w-full flex items-center gap-2 py-2 px-3 hover:bg-[var(--bg-secondary)] transition-colors rounded-lg",children:[o?e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx(s,{className:"w-4 h-4 text-[var(--color-accent-600)]"}),e.jsx("span",{className:"font-medium text-sm flex-1 text-left",children:r}),a!==void 0&&a>0&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:a})]})}function ha({ticket:t,attachments:s,activities:r,isSupport:a,saving:o,uploading:c,layout:i="compact",onAssign:d,onStatusChange:u,onResolve:x,onCloseTicket:m,onReopen:f,onEscalate:h,onDownloadAttachment:v,onUploadAttachment:g,getAttachmentUrl:y}){const{t:p}=ne.useTranslation("support"),[b,j]=n.useState(new Set(i==="grid"?["info","system","errors","attachments","actions","history"]:["info","attachments","actions"])),[S,w]=n.useState(null),[P,$]=n.useState(!1),[A,k]=n.useState(null),R=n.useRef(null),L=n.useCallback(M=>{if(M.type.startsWith("image/"))return!0;const te="."+M.name.split(".").pop()?.toLowerCase();return Js.includes(te)},[]),I=n.useCallback(async M=>{if(!(!M||!g)){k(null);for(let te=0;te<M.length;te++){const oe=M[te];if(oe.size>Oc){k(p("sidebar.fileTooLarge","File too large (max 10 MB)"));continue}if(!L(oe)){k(p("sidebar.fileTypeNotAllowed","File type not allowed"));continue}try{await g(oe)}catch{k(p("sidebar.uploadError","Upload failed"))}}}},[g,L,p]),C=n.useCallback(M=>{M.preventDefault(),M.stopPropagation()},[]),O=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!0)},[]),_=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1)},[]),E=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1),I(M.dataTransfer.files)},[I]),z=s.filter(M=>Ys(M.contentType)),W=s.filter(M=>!Ys(M.contentType)),G=t.clientContext,J=n.useCallback(M=>{j(te=>{const oe=new Set(te);return oe.has(M)?oe.delete(M):oe.add(M),oe})},[]),pe=t.status==="Closed"||t.status==="Rejected",q=i==="grid",Y=q?"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] overflow-hidden":"px-2 py-1 border-b border-[var(--border-color)]";return e.jsxs("div",{className:q?"":"h-full flex flex-col bg-[var(--bg-card)] overflow-hidden",children:[e.jsxs("div",{className:q?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4":"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"info",icon:l.FileText,title:p("details.info","Informations"),isExpanded:b.has("info"),onToggle:J}),b.has("info")&&e.jsx("div",{className:"px-3 pb-3",children:e.jsxs("dl",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.type","Type")}),e.jsx("dd",{className:"font-medium",children:p(`tickets.types.${t.type}`,{defaultValue:t.type})})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.priority","Priority")}),e.jsx("dd",{children:e.jsx("span",{className:"inline-block px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Xs[t.priority]?.bg,color:Xs[t.priority]?.text},children:p(`tickets.priorities.${t.priority}`,{defaultValue:t.priority})})})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.createdBy","Created by")}),e.jsx("dd",{children:t.createdByName||p("sidebar.unknown","Unknown")})]}),e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.assignedTo","Assigned to")}),e.jsxs("dd",{className:"flex flex-col items-end gap-1",children:[t.assignees&&t.assignees.length>0?e.jsx("div",{className:"space-y-1",children:t.assignees.map(M=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sm",children:M.fullName}),M.isPrimary&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-[var(--color-accent-600)] text-white rounded-md",children:p("sidebar.primary","primary")}),M.assignedViaGroupName&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-secondary)] rounded-md",children:["(",p("sidebar.viaGroup",{groupName:M.assignedViaGroupName}),")"]})]},M.userId))}):e.jsx("span",{className:"text-sm",children:p("sidebar.unassigned","Unassigned")}),d&&e.jsx("button",{onClick:d,className:"p-1 hover:bg-[var(--bg-secondary)] rounded mt-1",children:e.jsx(l.UserPlus,{className:"w-3.5 h-3.5 text-[var(--color-accent-600)]"})})]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.createdAt","Created")}),e.jsx("dd",{className:"text-xs",children:new Date(t.createdAt).toLocaleString()})]}),t.updatedAt&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.updatedAt","Updated")}),e.jsx("dd",{className:"text-xs",children:new Date(t.updatedAt).toLocaleString()})]})]})})]}),a&&G&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"system",icon:l.Monitor,title:p("details.systemInfo","Infos système"),isExpanded:b.has("system"),onToggle:J}),b.has("system")&&e.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[G.sourceUrl&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Globe,{className:"w-3 h-3"}),p("sidebar.url","URL")]}),e.jsx("p",{className:"text-xs font-mono break-all",children:G.sourceUrl})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[G.browser&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Globe,{className:"w-3 h-3"}),p("sidebar.browser","Browser")]}),e.jsx("p",{className:"text-xs font-medium",children:G.browser.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:G.browser.version})]}),G.os&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Laptop,{className:"w-3 h-3"}),p("sidebar.os","OS")]}),e.jsx("p",{className:"text-xs font-medium",children:G.os.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:G.os.version})]})]}),G.device&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Smartphone,{className:"w-3 h-3"}),p("sidebar.device","Device")]}),e.jsxs("p",{className:"text-xs font-medium",children:[G.device.type||p("sidebar.defaultDeviceType","Desktop"),G.device.screenResolution&&` • ${G.device.screenResolution}`]})]})]})]}),a&&G?.recentErrors&&G.recentErrors.length>0&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"errors",icon:l.Bug,title:p("details.errors","Erreurs"),count:G.recentErrors.length,isExpanded:b.has("errors"),onToggle:J}),b.has("errors")&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:G.recentErrors.slice(0,3).map((M,te)=>e.jsxs("div",{className:"p-2 bg-[var(--error-bg)]/30 border border-[var(--error-border)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(l.AlertTriangle,{className:"w-3 h-3 text-[var(--error-text)]"}),M.component&&e.jsx("span",{className:"text-xs px-1 py-0.5 bg-[var(--bg-secondary)] rounded",children:M.component})]}),e.jsx("p",{className:"text-xs font-medium text-[var(--error-text)] line-clamp-2",children:M.message})]},`error-${te}`))})]}),e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"attachments",icon:l.File,title:p("details.attachments","Pièces jointes"),count:s.length,isExpanded:b.has("attachments"),onToggle:J}),b.has("attachments")&&e.jsxs("div",{className:"px-3 pb-3",children:[z.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)] mb-2 flex items-center gap-1",children:[e.jsx(l.Image,{className:"w-3 h-3"}),p("sidebar.images","Images")," (",z.length,")"]}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:z.map(M=>e.jsxs("div",{className:"relative cursor-pointer rounded overflow-hidden border border-[var(--border-color)] aspect-square group",onClick:()=>w(M),children:[e.jsx(Dc,{src:y(M),alt:M.fileName,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:e.jsx(l.Eye,{className:"w-5 h-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"})})]},M.id))})]}),W.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)] mb-2 flex items-center gap-1",children:[e.jsx(l.FileText,{className:"w-3 h-3"}),p("sidebar.documents","Documents")," (",W.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:W.map(M=>e.jsxs("div",{className:"flex items-center gap-2 w-full p-2 bg-[var(--bg-secondary)] rounded-lg hover:bg-[var(--bg-tertiary)] transition-colors group",children:[e.jsxs("button",{onClick:()=>w(M),className:"flex items-center gap-2 flex-1 min-w-0 text-left",children:[e.jsx(l.FileText,{className:"w-4 h-4 text-[var(--text-secondary)] flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-xs block truncate",children:M.fileName}),e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)]",children:Lc(M.fileSize)})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>w(M),className:"p-1 rounded hover:bg-[var(--bg-primary)] transition-colors opacity-0 group-hover:opacity-100",title:p("filePreview.view","Aperçu")||"View",children:e.jsx(l.Eye,{className:"w-3.5 h-3.5 text-[var(--color-accent-500)]"})}),e.jsx("button",{onClick:()=>v(M),className:"p-1 rounded hover:bg-[var(--bg-primary)] transition-colors",title:p("filePreview.download","Télécharger")||"Download",children:e.jsx(l.Download,{className:"w-3.5 h-3.5 text-[var(--text-tertiary)]"})})]})]},M.id))})]}),a&&!pe&&g&&e.jsxs("div",{children:[e.jsx("input",{ref:R,type:"file",multiple:!0,onChange:M=>I(M.target.files),accept:Js.join(","),className:"hidden"}),e.jsx("div",{className:`border-2 border-dashed rounded-lg p-3 text-center transition-colors cursor-pointer ${P?"border-[var(--color-accent-500)] bg-[var(--color-accent-500)]/10":"border-[var(--border-color)] hover:border-[var(--color-accent-500)]"}`,onClick:()=>R.current?.click(),onDragOver:C,onDragEnter:O,onDragLeave:_,onDrop:E,children:c?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-1",children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--color-accent-500)]"}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:p("sidebar.uploading","Uploading...")})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Plus,{className:"w-5 h-5 mx-auto mb-1 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:P?p("sidebar.dropHere","Drop here"):p("sidebar.addFile","Add a file")})]})}),A&&e.jsx("p",{className:"mt-2 text-xs text-[var(--error-text)]",children:A})]}),s.length===0&&(!a||pe||!g)&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center py-2",children:p("sidebar.noAttachments","No attachments")})]})]}),a&&!q&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"actions",icon:l.User,title:p("details.actions","Actions"),isExpanded:b.has("actions"),onToggle:J}),b.has("actions")&&e.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[t.status==="Open"&&u&&e.jsx("button",{onClick:()=>u("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.startProcessing","Start processing")}),t.status==="InProgress"&&e.jsxs(e.Fragment,{children:[u&&e.jsx("button",{onClick:()=>u("OnHold"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.putOnHold","Put on hold")}),x&&e.jsxs("button",{onClick:x,disabled:o,className:"btn btn-primary w-full text-sm py-2",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.resolve","Resolve")]})]}),t.status==="OnHold"&&u&&e.jsx("button",{onClick:()=>u("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.resume","Resume")}),t.status==="Resolved"&&m&&e.jsxs("button",{onClick:m,disabled:o,className:"btn btn-primary w-full text-sm py-2",children:[e.jsx(l.XCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.closeTicket","Close ticket")]}),(t.status==="Closed"||t.status==="Resolved")&&f&&e.jsxs("button",{onClick:f,disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:[e.jsx(l.RotateCcw,{className:"w-4 h-4 mr-2"}),p("sidebar.reopen","Reopen")]}),!pe&&h&&e.jsxs("button",{onClick:h,disabled:o,className:"btn w-full text-sm py-2 border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[e.jsx(l.ArrowUpCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.escalate","Escalate")]}),o&&e.jsx("div",{className:"flex items-center justify-center py-2",children:e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--color-primary-600)]"})})]})]}),a&&r.length>0&&e.jsxs("div",{className:q?Y:"px-2 py-1",children:[e.jsx(it,{section:"history",icon:l.History,title:p("details.history","History"),count:r.length,isExpanded:b.has("history"),onToggle:J}),b.has("history")&&e.jsx("div",{className:"px-3 pb-3",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-3 top-2 bottom-2 w-0.5 bg-[var(--border-color)]"}),e.jsx("div",{className:"space-y-3",children:r.slice(0,10).map((M,te)=>{const oe=Mc[M.action]||{icon:l.Edit,color:"var(--text-secondary)"},le=oe.icon,F=p(`history.actions.${M.action}`,{defaultValue:M.action});return e.jsxs("div",{className:"relative flex gap-3 pl-1",children:[e.jsx("div",{className:"relative z-10 w-5 h-5 rounded-full flex items-center justify-center bg-[var(--bg-card)] border border-[var(--border-color)]",style:{color:oe.color},children:e.jsx(le,{className:"w-3 h-3"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-medium text-[var(--text-primary)]",children:[F,M.newValue&&e.jsxs("span",{className:"text-[var(--text-secondary)] font-normal",children:[" → ",M.newValue]})]}),e.jsx("p",{className:"text-[10px] text-[var(--text-tertiary)]",children:Fc(M.createdAt,p)})]})]},te)})}),r.length>10&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center mt-3",children:p("sidebar.moreActivities",{count:r.length-10})})]})})]})]}),e.jsx(Ic,{attachment:S,getUrl:y,onClose:()=>w(null),onDownload:v})]})}const Xt=["Open","InProgress","Resolved","Closed"],Ye={Open:{label:"Ouvert",icon:l.Clock,color:"var(--warning-text)"},InProgress:{label:"En cours",icon:l.Play,color:"var(--info-text)"},OnHold:{label:"En attente",icon:l.Pause,color:"var(--warning-text)"},Resolved:{label:"Résolu",icon:l.CheckCircle,color:"var(--success-text)"},Closed:{label:"Fermé",icon:l.XCircle,color:"var(--text-secondary)"},Rejected:{label:"Rejeté",icon:l.AlertTriangle,color:"var(--error-text)"}},Uc=t=>new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),Bc=t=>t.isActive?"ring-4 ring-opacity-30":t.isPast?"bg-[var(--success-bg)]":"bg-[var(--bg-secondary)] border-2 border-[var(--border-color)]",_c=(t,s)=>{if(t.isActive)return s.color;if(t.isPast)return"var(--success-bg)"},qc=(t,s)=>({backgroundColor:_c(t,s),boxShadow:t.isActive?`0 0 0 4px ${s.color}30`:void 0}),zc=t=>t.isActive?"white":t.isPast?"var(--success-text)":"var(--text-tertiary)",Gc=t=>t.isActive?"text-[var(--text-primary)]":t.isPast?"text-[var(--success-text)]":"text-[var(--text-tertiary)]",Kc=(t,s)=>t.isPast?"var(--success-text)":t.isActive?s.color:"var(--border-color)";function Hc({step:t,config:s}){const r=t.icon;return e.jsx("div",{className:`relative w-10 h-10 rounded-full flex items-center justify-center shrink-0 transition-all ${Bc(t)}`,style:qc(t,s),children:e.jsx(r,{className:"w-5 h-5",style:{color:zc(t)}})})}function Vc({step:t}){return e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("p",{className:`text-xs font-medium ${Gc(t)}`,children:t.label}),t.date&&(t.isActive||t.isPast)&&e.jsx("p",{className:"text-[10px] text-[var(--text-secondary)] mt-0.5",children:Uc(t.date)})]})}function Wc({step:t,config:s,isLast:r}){return r?null:e.jsx("div",{className:"flex-1 h-0.5 mx-2 mt-[-20px]",style:{backgroundColor:Kc(t,s)}})}function Xc({currentStatus:t,createdAt:s,resolvedAt:r,closedAt:a,activities:o=[],isSupport:c,saving:i,assignees:d,onAssign:u,onStatusChange:x,onResolve:m,onCloseTicket:f,onReopen:h,onEscalate:v}){const{t:g}=ne.useTranslation("support"),y=t==="Rejected",p=o.some(S=>S.action==="Reopened"),j=(()=>{if(y)return[{status:"Open",label:g("tickets.statuses.Open",Ye.Open.label),icon:Ye.Open.icon,date:s,isActive:!1,isPast:!0,isFuture:!1},{status:"Rejected",label:g("tickets.statuses.Rejected",Ye.Rejected.label),icon:Ye.Rejected.icon,date:a,isActive:!0,isPast:!1,isFuture:!1}];const S=Xt.indexOf(t),w=[],P={Open:s};o.filter(A=>A.action==="StatusChanged"&&A.newValue).forEach(A=>{A.newValue&&(P[A.newValue]=A.createdAt)}),r&&(P.Resolved=r),a&&(P.Closed=a);const $=o.some(A=>A.action==="StatusChanged"&&A.newValue==="OnHold");if(Xt.forEach(A=>{const k=Ye[A],R=A===t?S:Xt.indexOf(A),L=A===t,I=R<S,C=R>S;w.push({status:A,label:g(`tickets.statuses.${A}`,{defaultValue:k.label}),icon:k.icon,date:P[A],isActive:L,isPast:I,isFuture:C})}),$){const A=w.findIndex(k=>k.status==="Resolved");w.splice(A,0,{status:"OnHold",label:g("tickets.statuses.OnHold",Ye.OnHold.label),icon:Ye.OnHold.icon,date:P.OnHold,isActive:t==="OnHold",isPast:t!=="OnHold"&&t!=="Open"&&t!=="InProgress",isFuture:!1})}return w})();return e.jsx("div",{className:"w-full px-4 py-2 bg-[var(--bg-card)] border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[j.map((S,w)=>{const P=Ye[S.status],$=w===j.length-1;return e.jsxs("div",{className:"flex items-center flex-1",children:[e.jsxs("div",{className:`flex flex-col items-center ${S.isFuture?"opacity-40":""}`,children:[e.jsx(Hc,{step:S,config:P}),e.jsx(Vc,{step:S})]}),e.jsx(Wc,{step:S,config:P,isLast:$})]},S.status)}),p&&e.jsxs("div",{className:"ml-2 flex items-center gap-1 text-[10px] text-[var(--warning-text)] shrink-0",children:[e.jsx(l.RotateCcw,{className:"w-3 h-3"}),e.jsx("span",{children:g("workflow.reopened","Réouvert")})]})]}),c&&e.jsx("div",{className:"w-px h-12 bg-[var(--border-color)] shrink-0"}),c&&e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[d&&d.length>0?e.jsxs("div",{className:"flex items-center -space-x-1.5",title:d.map(S=>S.fullName).join(", "),children:[d.slice(0,3).map(S=>e.jsx("div",{className:"w-7 h-7 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white text-[10px] font-medium border-2 border-[var(--bg-card)]",title:`${S.fullName}${S.isPrimary?` (${g("workflow.primary","principal")})`:""}${S.assignedViaGroupName?` (${g("workflow.viaGroup","via")} ${S.assignedViaGroupName})`:""}`,children:S.fullName.charAt(0).toUpperCase()},S.userId)),d.length>3&&e.jsxs("div",{className:"w-7 h-7 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[10px] font-medium text-[var(--text-secondary)] border-2 border-[var(--bg-card)]",children:["+",d.length-3]})]}):e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)] italic",children:g("workflow.notAssigned","Non assigné")}),u&&e.jsx("button",{onClick:u,className:"w-7 h-7 rounded-full border border-dashed border-[var(--border-color)] flex items-center justify-center hover:border-[var(--color-accent-500)] hover:bg-[var(--bg-secondary)] transition-colors",title:g("workflow.assign","Assigner"),children:e.jsx(l.UserPlus,{className:"w-3.5 h-3.5 text-[var(--color-accent-600)]"})})]}),i&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--color-primary-600)]"}),t==="Open"&&x&&e.jsxs("button",{onClick:()=>x("InProgress"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Play,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.start","Commencer")]}),t==="InProgress"&&x&&e.jsxs("button",{onClick:()=>x("OnHold"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Pause,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.hold","En attente")]}),t==="InProgress"&&m&&e.jsxs("button",{onClick:m,disabled:i,className:"btn btn-primary btn-sm text-xs",children:[e.jsx(l.CheckCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.resolve","Résoudre")]}),t==="OnHold"&&x&&e.jsxs("button",{onClick:()=>x("InProgress"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Play,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.resume","Reprendre")]}),t==="Resolved"&&f&&e.jsxs("button",{onClick:f,disabled:i,className:"btn btn-primary btn-sm text-xs",children:[e.jsx(l.XCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.close","Fermer")]}),(t==="Closed"||t==="Resolved")&&h&&e.jsxs("button",{onClick:h,disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.RotateCcw,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.reopen","Réouvrir")]}),t!=="Closed"&&t!=="Rejected"&&v&&e.jsxs("button",{onClick:v,disabled:i,className:"btn btn-sm text-xs border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[e.jsx(l.ArrowUpCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.escalate","Escalader")]})]})]})})}const lt={Proposed:{border:"border-blue-500",bg:"bg-blue-50",text:"text-blue-900"},Approved:{border:"border-green-500",bg:"bg-green-50",text:"text-green-900"},Rejected:{border:"border-red-500",bg:"bg-red-50",text:"text-red-900"},Superseded:{border:"border-gray-400",bg:"bg-gray-50",text:"text-gray-700"}},Qs={Proposed:l.Clock,Approved:l.CheckCircle,Rejected:l.XCircle,Superseded:l.AlertCircle};function Yc({ticketId:t,solutions:s,activeSolution:r,mode:a,onProposeSolution:o,onApproveSolution:c,onRejectSolution:i,isLoading:d}){const{t:u}=ne.useTranslation("support"),[x,m]=n.useState(!1),[f,h]=n.useState(""),[v,g]=n.useState(!1),[y,p]=n.useState(""),[b,j]=n.useState(!1),[S,w]=n.useState(!1),P=n.useCallback(async()=>{if(!(!f.trim()||!o)){m(!0);try{await o(f),h("")}finally{m(!1)}}},[f,o]),$=n.useCallback(()=>{j(!0)},[]),A=n.useCallback(async()=>{if(!(!y.trim()||!i)){g(!0);try{await i(y),p(""),j(!1)}finally{g(!1)}}},[y,i]),k=R=>{if(!R.autoCloseAt)return null;const L=new Date(R.autoCloseAt),I=new Date,C=L.getTime()-I.getTime(),O=Math.ceil(C/(1e3*60*60*24));return O>0?O:0};return s.length===0&&a==="support"&&o?e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] p-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:u("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:R=>h(R.target.value),placeholder:u("solution.enterSolution","Enter solution..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:x||d}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:P,disabled:!f.trim()||x||d,className:"btn btn-primary flex items-center gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),u("solution.proposeSolution","Propose Solution")]})})})]}):e.jsxs("div",{className:"space-y-4",children:[r&&e.jsxs("div",{className:`rounded-lg border-2 p-4 ${lt[r.status].border} ${lt[r.status].bg}`,children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const R=Qs[r.status];return e.jsx(R,{className:`w-5 h-5 ${lt[r.status].text}`})})(),e.jsxs("div",{children:[e.jsx("h4",{className:`font-semibold ${lt[r.status].text}`,children:u(`solution.status.${r.status.toLowerCase()}`,r.status)}),e.jsxs("p",{className:"text-sm opacity-75",children:[u("solution.solutionNumber","Solution #"),r.solutionNumber," - ",u("solution.proposedBy","Proposed by")," ",r.proposedByUserName||"Unknown"]})]})]})}),e.jsx("div",{className:"bg-white/50 rounded p-3 mb-3 max-h-32 overflow-y-auto",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:r.content})}),r.status==="Proposed"&&r.autoCloseAt&&e.jsx("div",{className:"mb-3 p-2 bg-yellow-100/50 border-l-2 border-yellow-500 rounded",children:e.jsxs("p",{className:"text-sm",children:[u("solution.autoCloseWarning","Will be auto-approved in")," ",e.jsxs("strong",{children:[k(r)," ",u("solution.autoCloseCountdown","days")]}),r.autoCloseWarningSent&&e.jsxs(e.Fragment,{children:[" (",u("solution.warningEmailSent","warning email sent"),")"]})]})}),r.status==="Approved"&&e.jsxs("p",{className:"text-sm",children:[u("solution.approvedBy","Approved by")," ",r.approvedByUserName||"Unknown"," on ",r.approvedAt&&new Date(r.approvedAt).toLocaleDateString()]}),r.status==="Rejected"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm mb-2",children:[u("solution.rejectedBy","Rejected by")," ",r.rejectedByUserName||"Unknown"," on ",r.rejectedAt&&new Date(r.rejectedAt).toLocaleDateString()]}),r.rejectionReason&&e.jsxs("p",{className:"text-sm bg-white/30 p-2 rounded italic",children:[u("solution.rejectionReason","Reason"),": ",r.rejectionReason]})]}),a==="client"&&r.status==="Proposed"&&e.jsxs("div",{className:"mt-3 flex gap-2 justify-end",children:[e.jsx("button",{onClick:$,disabled:v||d,className:"btn btn-secondary text-sm py-1.5",children:u("solution.rejectSolution","Reject")}),e.jsx("button",{onClick:c,disabled:v||d||!c,className:"btn btn-primary text-sm py-1.5 flex items-center gap-2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}),u("solution.acceptSolution","Approve")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.CheckCircle,{className:"w-3 h-3"}),u("solution.acceptSolution","Approve")]})})]})]}),a==="support"&&o&&!r&&e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] p-4",children:[e.jsx("h4",{className:"font-semibold mb-3",children:u("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:R=>h(R.target.value),placeholder:u("solution.enterSolution","Enter solution..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:x||d}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:P,disabled:!f.trim()||x||d,className:"btn btn-primary flex items-center gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),u("solution.proposeSolution","Propose Solution")]})})})]}),s.length>1&&e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] overflow-hidden",children:[e.jsxs("button",{onClick:()=>w(!S),className:"w-full flex items-center gap-2 p-4 hover:bg-[var(--bg-secondary)] transition-colors",children:[S?e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsxs("h4",{className:"font-semibold",children:[u("solution.solutionHistory","Solution History")," (",s.length,")"]})]}),S&&e.jsx("div",{className:"border-t border-[var(--border-color)] p-4 space-y-3",children:s.map(R=>e.jsxs("div",{className:`rounded-lg border p-3 ${lt[R.status].border}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const L=Qs[R.status];return e.jsx(L,{className:`w-4 h-4 ${lt[R.status].text}`})})(),e.jsx("span",{className:"text-sm font-medium",children:u(`solution.status.${R.status.toLowerCase()}`,R.status)}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:["#",R.solutionNumber]})]}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(R.proposedAt).toLocaleDateString()})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 line-clamp-2",children:R.content}),e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)]",children:[u("solution.proposedBy","Proposed by")," ",R.proposedByUserName||"Unknown"]})]},R.id))})]}),s.length===0&&a==="client"&&e.jsx("div",{className:"text-center py-6 text-[var(--text-tertiary)]",children:e.jsx("p",{children:u("solution.noSolutions","No solutions proposed yet")})}),b&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg shadow-lg p-6 w-96 max-w-[90vw]",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:u("solution.rejectSolution","Reject Solution")}),e.jsx("textarea",{value:y,onChange:R=>p(R.target.value),placeholder:u("solution.enterRejectReason","Enter reason for rejection..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:v}),e.jsxs("div",{className:"mt-4 flex gap-2 justify-end",children:[e.jsx("button",{onClick:()=>j(!1),disabled:v,className:"btn btn-secondary",children:u("common:cancel","Cancel")}),e.jsx("button",{onClick:A,disabled:!y.trim()||v,className:"btn btn-primary flex items-center gap-2",children:v?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.rejectSolution","Reject")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.XCircle,{className:"w-4 h-4"}),u("solution.rejectSolution","Reject")]})})]})]})})]})}const Jc={getCached:t=>D.get(`/api/support/ai-routing/cached/${t}`)},ga={analyze:t=>D.get(`/api/support/ai-routing/analyze/${t}`)},fa={summarize:t=>D.post(`/api/support/ai-routing/summarize/${t}`)},ba={applyRouting:(t,s)=>D.post(`/api/support/ai-routing/apply/${t}`,s)},Zs=Object.freeze(Object.defineProperty({__proto__:null,analyzeApi:ga,cachedAiApi:Jc,routingApi:ba,summarizeApi:fa},Symbol.toStringTag,{value:"Module"}));function va({classification:t}){const{t:s}=ne.useTranslation("support");if(!t)return null;const r=o=>o>.8?"bg-[var(--success-bg)] text-[var(--success-text)]":o>.5?"bg-[var(--warning-bg)] text-[var(--warning-text)]":"bg-[var(--error-bg)] text-[var(--error-text)]",a=o=>o>.8?s("aiClassification.confidence.high"):o>.5?s("aiClassification.confidence.medium"):s("aiClassification.confidence.low");return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-[var(--info-bg)] text-[var(--info-text)]",children:s(`tickets.types.${t.suggestedType}`)}),e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-[var(--warning-bg)] text-[var(--warning-text)]",children:s(`tickets.priorities.${t.suggestedPriority}`)}),e.jsxs("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${r(t.confidenceScore)}`,children:[a(t.confidenceScore)," (",Math.round(t.confidenceScore*100),"%)"]})]})}function ya(t){const[s,r]=n.useState(t?.initialData??null),[a,o]=n.useState(!1),[c,i]=n.useState(null),d=n.useRef(null),u=n.useRef(!1);n.useEffect(()=>(u.current=!1,()=>{u.current=!0,d.current?.abort()}),[]);const x=n.useCallback(async h=>{d.current?.abort();const v=new AbortController;d.current=v,o(!0),i(null);try{const g=await h(v.signal);!u.current&&!v.signal.aborted&&r(g)}catch(g){!u.current&&!v.signal.aborted&&i(g instanceof Error?g.message:"Unknown error")}finally{!u.current&&!v.signal.aborted&&o(!1)}},[]),m=n.useCallback(()=>{d.current?.abort(),u.current||o(!1)},[]),f=n.useCallback(()=>{r(null),i(null),o(!1)},[]);return{data:s,loading:a,error:c,execute:x,cancel:m,reset:f}}function Qc({ticketId:t,cachedClassification:s,cachedRouting:r,cachedGeneratedAt:a,processing:o,onProcessingStart:c,onProcessingEnd:i}){const{t:d}=ne.useTranslation("support"),u=s||r?{classification:s??null,routingSuggestion:r??null,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:x,loading:m,error:f,execute:h,reset:v}=ya({initialData:u}),[g,y]=n.useState(!1),p=n.useCallback(async()=>{c?.(),await h(async()=>{const w=await ga.analyze(t);return i?.(),w})},[t,h,c,i]),b=n.useCallback(async()=>{if(x?.routingSuggestion)try{y(!0);const w={assignToUserId:x.routingSuggestion.suggestedAgents[0]?.userId,assignToGroupId:x.routingSuggestion.suggestedGroupId??void 0,applyPriorityAdjustment:x.routingSuggestion.priorityAdjustment!==null};await ba.applyRouting(t,w),v()}catch{}finally{y(!1)}},[x,v,d]);if(f&&!x)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:d("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:f}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("common:actions.retry")]})]})]})});if(!x)return o?e.jsx("div",{className:"card p-4 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--info-text)] flex-shrink-0"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:d("aiRouting.processing")})]})}):e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm flex items-center gap-2",children:[m?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Sparkles,{className:"w-4 h-4"}),d("aiRouting.analyze")]});if(m&&!x)return e.jsx("div",{className:"card p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})});if(!x.isAiAvailable){const w=x.errorCode?`aiRouting.errors.${x.errorCode}`:null,P=w&&d(w)!==w?d(w):x.errorMessage??d("aiRouting.notConfigured");return e.jsx("div",{className:"card p-4 bg-[var(--warning-bg)]/10 border border-[var(--warning-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--warning-text)] flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:P})]})})}if(!x.classification&&!x.routingSuggestion)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:d("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:x.errorMessage??d("aiRouting.notAvailable")}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("common:actions.retry")]})]})]})});const j=x.routingSuggestion,S=a&&!m?new Date(a):null;return e.jsx("div",{className:"card p-6 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"space-y-4",children:[x.errorMessage&&e.jsxs("div",{className:"flex items-start gap-2 text-xs text-[var(--warning-text)] bg-[var(--warning-bg)]/20 rounded p-2",children:[e.jsx(l.AlertCircle,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),e.jsx("p",{children:x.errorMessage})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.Sparkles,{className:"w-5 h-5 text-[var(--info-text)] flex-shrink-0 mt-1"}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-sm",children:d("aiRouting.suggestedRouting")}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm flex items-center gap-1",title:d("aiRouting.refresh"),children:[m?e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}):e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("aiRouting.refresh")]})]}),S&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-3",children:d("aiRouting.generatedAt",{date:S.toLocaleString()})}),e.jsxs("div",{className:"space-y-3",children:[x.classification&&e.jsx(va,{classification:x.classification}),j&&j.suggestedAgents.length>0&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-2",children:d("aiRouting.suggestedAgents")}),e.jsx("div",{className:"space-y-1",children:j.suggestedAgents.map(w=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-medium",children:w.userName||w.userId}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[Math.round(w.matchScore*100),"%"]})]},w.userId))})]}),j?.suggestedGroupName&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:d("aiRouting.suggestedGroup")}),e.jsx("p",{className:"font-medium",children:j.suggestedGroupName})]}),j?.reasoning&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:d("aiRouting.reasoning")}),e.jsx("p",{className:"italic",children:j.reasoning})]}),e.jsx("div",{className:"pt-3 border-t border-[var(--border-color)] flex gap-2",children:j&&e.jsxs("button",{onClick:b,disabled:g,className:"btn btn-primary btn-sm flex items-center gap-2 flex-1 justify-center",children:[g?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Check,{className:"w-4 h-4"}),d("aiRouting.apply")]})})]})]})]})]})})}function Zc({ticketId:t,cachedSummary:s,cachedGeneratedAt:r,processing:a,onProcessingStart:o,onProcessingEnd:c}){const{t:i}=ne.useTranslation("support"),d=s?{summary:s,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:u,loading:x,error:m,execute:f}=ya({initialData:d}),h=n.useCallback(async()=>{o?.(),await f(async()=>{const y=await fa.summarize(t);return c?.(),y})},[t,f,o,c]);if(m&&!u)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:i("aiSummary.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:m}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("common:actions.retry")]})]})]})});if(!u)return a?e.jsx("div",{className:"card p-4 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--info-text)] flex-shrink-0"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:i("aiSummary.processing")})]})}):e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm flex items-center gap-2",children:[x?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Zap,{className:"w-4 h-4"}),i("aiSummary.generate")]});if(x&&!u)return e.jsx("div",{className:"card p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})});if(!u.isAiAvailable){const y=u.errorCode?`aiRouting.errors.${u.errorCode}`:null,p=y&&i(y)!==y?i(y):u.errorMessage??i("aiRouting.notConfigured");return e.jsx("div",{className:"card p-4 bg-[var(--warning-bg)]/10 border border-[var(--warning-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--warning-text)] flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:p})]})})}if(!u.summary){const y=u.errorCode?`aiSummary.errors.${u.errorCode}`:null,p=y&&i(y)!==y?i(y):u.errorMessage??i("aiSummary.error");return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:i("aiSummary.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:p}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("common:actions.retry")]})]})]})})}const v=u.summary,g=r&&!x?new Date(r):null;return e.jsxs("div",{className:"card p-6 bg-[var(--bg-secondary)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[e.jsx(l.Zap,{className:"w-5 h-5"}),i("aiSummary.title")]}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm flex items-center gap-1",title:i("aiSummary.refresh"),children:[x?e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}):e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("aiSummary.refresh")]})]}),g&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-3",children:i("aiSummary.generatedAt",{date:g.toLocaleString()})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.summary")}),e.jsx("p",{className:"text-sm",children:v.summary})]}),v.keyPoints.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.keyPoints")}),e.jsx("ul",{className:"list-disc list-inside space-y-1",children:v.keyPoints.map((y,p)=>e.jsx("li",{className:"text-sm",children:y},p))})]}),v.sentiment&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.sentiment")}),e.jsx("p",{className:"text-sm",children:v.sentiment})]}),v.blockers&&v.blockers.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.blockers")}),e.jsx("ul",{className:"space-y-2",children:v.blockers.map((y,p)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-xs px-2 py-1 rounded bg-[var(--warning-bg)] text-[var(--warning-text)] flex-shrink-0 mt-0.5",children:p+1}),e.jsx("span",{className:"text-sm",children:y})]},p))})]})]})]})}const ye={tickets:{getAll:t=>D.get("/api/support/tickets",{params:t}),getMyTickets:t=>D.get("/api/support/tickets/my-assigned",{params:t}),getById:t=>D.get(`/api/support/tickets/${t}`),create:t=>D.post("/api/support/tickets",t),update:(t,s)=>D.put(`/api/support/tickets/${t}`,s),updateStatus:(t,s)=>D.patch(`/api/support/tickets/${t}/status`,{status:s}),assign:(t,s,r,a)=>D.patch(`/api/support/tickets/${t}/assign`,{assignedToUserId:s,userIds:r,groupIds:a}),resolve:(t,s)=>D.patch(`/api/support/tickets/${t}/resolve`,{resolution:s}),close:t=>D.patch(`/api/support/tickets/${t}/close`),reopen:t=>D.patch(`/api/support/tickets/${t}/reopen`),addComment:(t,s)=>D.post(`/api/support/tickets/${t}/comments`,s),delete:t=>D.delete(`/api/support/tickets/${t}`),getStats:t=>D.get("/api/support/tickets/stats",{params:{tenantId:t}}),getMyAssignedStats:()=>D.get("/api/support/tickets/my-assigned/stats"),getAttachmentUrl:(t,s)=>`/api/support/tickets/${t}/attachments/${s}`,downloadAttachment:(t,s)=>D.get(`/api/support/tickets/${t}/attachments/${s}`,{responseType:"blob"}),uploadAttachment:(t,s)=>{const r=new FormData;return r.append("file",s),D.post(`/api/support/tickets/${t}/attachments`,r,{headers:{"Content-Type":"multipart/form-data"}})},getActivities:(t,s=10)=>D.get(`/api/support/tickets/${t}/activities`,{params:{limit:s}}),getTicketingProvider:()=>D.get("/api/support/tickets/provider"),getGlpiSyncStats:()=>D.get("/api/support/tickets/glpi-sync-stats"),proposeSolution:(t,s)=>D.post(`/api/support/tickets/${t}/solutions`,{content:s}),getSolutions:t=>D.get(`/api/support/tickets/${t}/solutions`),approveSolution:t=>D.patch(`/api/support/tickets/${t}/solutions/approve`),rejectSolution:(t,s)=>D.patch(`/api/support/tickets/${t}/solutions/reject`,{reason:s})}},qe={getAll:t=>D.get("/api/support/my-tickets",{params:t}),getById:t=>D.get(`/api/support/my-tickets/${t}`),create:t=>D.post("/api/support/my-tickets",t),update:(t,s)=>D.put(`/api/support/my-tickets/${t}`,s),addComment:(t,s)=>D.post(`/api/support/my-tickets/${t}/comments`,{content:s}),getStats:()=>D.get("/api/support/my-tickets/stats"),uploadAttachment:(t,s)=>{const r=new FormData;return r.append("file",s),D.post(`/api/support/my-tickets/${t}/attachments`,r,{headers:{"Content-Type":"multipart/form-data"}})},downloadAttachment:(t,s)=>D.get(`/api/support/my-tickets/${t}/attachments/${s}`,{responseType:"blob"}),deleteAttachment:(t,s)=>D.delete(`/api/support/my-tickets/${t}/attachments/${s}`),getActivities:(t,s=10)=>D.get(`/api/support/my-tickets/${t}/activities`,{params:{limit:s}}),getAttachmentUrl:(t,s)=>`/api/support/my-tickets/${t}/attachments/${s}`,submitSatisfaction:(t,s)=>D.post(`/api/support/my-tickets/${t}/satisfaction`,s),getSatisfaction:t=>D.get(`/api/support/my-tickets/${t}/satisfaction`),getSolutions:t=>D.get(`/api/support/my-tickets/${t}/solutions`),approveSolution:t=>D.patch(`/api/support/my-tickets/${t}/solutions/approve`),rejectSolution:(t,s)=>D.patch(`/api/support/my-tickets/${t}/solutions/reject`,{reason:s})},ed={getByTicket:(t,s=1,r=50)=>D.get("/api/support/assignment/logs",{params:{ticketId:t,page:s,pageSize:r}})},ge="/api/administration/users/groups",td=t=>{const s=D;return{getAll:async(r,a,o)=>{const c=new URLSearchParams;r&&c.append("search",r),a!==void 0&&c.append("isActive",String(a)),o!==void 0&&c.append("syncedFromEntra",String(o));const i=c.toString(),d=i?`${ge}?${i}`:ge;return await s.get(d)},getById:async r=>await s.get(`${ge}/${r}`),create:async r=>await s.post(ge,r),update:async(r,a)=>await s.put(`${ge}/${r}`,a),delete:async r=>{await s.delete(`${ge}/${r}`)},activate:async r=>{await s.patch(`${ge}/${r}/activate`)},deactivate:async r=>{await s.patch(`${ge}/${r}/deactivate`)},linkToEntra:async(r,a)=>{await s.post(`${ge}/${r}/link-entra`,a)},unlinkFromEntra:async r=>{await s.post(`${ge}/${r}/unlink-entra`)},getMembers:async r=>await s.get(`${ge}/${r}/members`),addMember:async(r,a)=>{await s.post(`${ge}/${r}/members`,a)},removeMember:async(r,a)=>{await s.delete(`${ge}/${r}/members/${a}`)},getRoles:async r=>await s.get(`${ge}/${r}/roles`),assignRole:async(r,a)=>{await s.post(`${ge}/${r}/roles`,a)},removeRole:async(r,a,o)=>{const c=o?`?tenantId=${o}`:"";await s.delete(`${ge}/${r}/roles/${a}${c}`)},setRoleInheritable:async(r,a,o)=>{await s.patch(`${ge}/${r}/roles/${a}/inheritable`,o)},getChildGroups:async r=>await s.get(`${ge}/${r}/children`),setParentGroup:async(r,a)=>{await s.patch(`${ge}/${r}/parent`,a)},getTenants:async r=>await s.get(`${ge}/${r}/tenants`),getInheritedTenants:async r=>await s.get(`${ge}/${r}/inherited-tenants`),addToTenant:async(r,a)=>{await s.post(`${ge}/${r}/tenants`,a)},removeFromTenant:async(r,a)=>{await s.delete(`${ge}/${r}/tenants/${a}`)},getApplicationAccess:async(r,a)=>{const o=a?`${ge}/${r}/application-access?tenantId=${a}`:`${ge}/${r}/application-access`;return await s.get(o)},getCustomRole:async r=>await s.get(`${ge}/${r}/custom-role`),createCustomRole:async r=>await s.post(`${ge}/${r}/custom-role`),deleteCustomRole:async r=>{await s.delete(`${ge}/${r}/custom-role`)}}},sd=td();function ja(){const{currentTenant:t}=Ee(),[s,r]=n.useState(null),[a,o]=n.useState(!!t),[c,i]=n.useState(null),d=n.useCallback(async()=>{if(!t){r(null);return}o(!0),i(null);try{const u=await ye.tickets.getTicketingProvider();r(u)}catch{i("Failed to load ticketing provider configuration"),r(null)}finally{o(!1)}},[t]);return n.useEffect(()=>{d()},[d]),{provider:s?.provider??"SmartStack",isGlpi:s?.provider==="Glpi",isConfigured:s?.isConfigured??!1,glpiBaseUrl:s?.glpiBaseUrl??void 0,loading:a,error:c,refresh:d}}const as={Open:"pending",InProgress:"active",OnHold:"warning",Resolved:"active",Closed:"inactive",Rejected:"error"},er={Low:{bg:"var(--info-bg)",text:"var(--info-text)"},Medium:{bg:"var(--warning-bg)",text:"var(--warning-text)"},High:{bg:"var(--error-bg)",text:"var(--error-text)"},Critical:{bg:"var(--error-text)",text:"white"}},rd=["conversation","description","information","assignment","ai"],ad={Open:"statusDescriptions.Open",InProgress:"statusDescriptions.InProgress",OnHold:"statusDescriptions.OnHold",Resolved:"statusDescriptions.Resolved",Closed:"statusDescriptions.Closed",Rejected:"statusDescriptions.Rejected"};function nd({satisfaction:t,showRatingForm:s,ratingValue:r,ratingComment:a,submittingRating:o,onShowForm:c,onRatingChange:i,onCommentChange:d,onCancel:u,onSubmit:x,t:m}){return t?e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 mb-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500 fill-amber-500"}),m("satisfaction.yourRating","Votre évaluation")]}),e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[[1,2,3,4,5].map(f=>e.jsx(l.Star,{className:`w-5 h-5 ${f<=t.rating?"text-amber-500 fill-amber-500":"text-[var(--text-tertiary)]"}`},f)),e.jsxs("span",{className:"ml-2 text-sm text-[var(--text-secondary)]",children:[t.rating,"/5"]})]}),t.comment&&e.jsxs("p",{className:"text-sm text-[var(--text-secondary)] italic",children:['"',t.comment,'"']})]}):s?e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500"}),m("satisfaction.rateTitle","Évaluez cette résolution")]}),e.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(f=>e.jsx("button",{type:"button",onClick:()=>i(f),className:"p-1 hover:scale-110 transition-transform",children:e.jsx(l.Star,{className:`w-7 h-7 transition-colors ${f<=r?"text-amber-500 fill-amber-500":"text-[var(--text-tertiary)] hover:text-amber-300"}`})},f))}),e.jsx("textarea",{value:a,onChange:f=>d(f.target.value),placeholder:m("satisfaction.commentPlaceholder","Commentaire (optionnel)..."),className:"input w-full h-20 mb-3 text-sm"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:u,className:"btn btn-secondary btn-sm",children:m("common.cancel","Annuler")}),e.jsxs("button",{onClick:x,disabled:r===0||o,className:"btn btn-primary btn-sm",children:[o?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-1"}):e.jsx(l.Star,{className:"w-4 h-4 mr-1"}),m("satisfaction.submit","Envoyer")]})]})]}):e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500"}),m("satisfaction.askTitle","Comment évaluez-vous cette résolution ?")]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:m("satisfaction.askDescription","Votre avis nous aide à améliorer notre service.")})]}),e.jsxs("button",{onClick:c,className:"btn btn-primary btn-sm",children:[e.jsx(l.Star,{className:"w-4 h-4 mr-1"}),m("satisfaction.rateButton","Évaluer")]})]})}function od({show:t,resolution:s,saving:r,onResolutionChange:a,onClose:o,onResolve:c,t:i}){return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:i("resolve.title","Proposer une solution")}),e.jsx("textarea",{value:s,onChange:d=>a(d.target.value),placeholder:i("resolve.placeholder","Décrivez la résolution..."),className:"input w-full h-32 mb-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:o,className:"btn btn-secondary",children:i("common.cancel","Annuler")}),e.jsxs("button",{onClick:c,disabled:!s.trim()||r,className:"btn btn-primary",children:[r&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),i("resolve.confirm","Proposer")]})]})]})}):null}function id({show:t,filteredUsers:s,selectedUserIds:r,selectedGroupIds:a,groups:o,userSearchQuery:c,groupSearchQuery:i,loadingUsers:d,loadingGroups:u,saving:x,activeTab:m,onUserSearchChange:f,onGroupSearchChange:h,onSelectUser:v,onSelectGroup:g,onTabChange:y,onClose:p,onAssign:b,t:j}){const S=n.useMemo(()=>{if(!i.trim())return o;const w=i.toLowerCase();return o.filter(P=>P.name.toLowerCase().includes(w))},[o,i]);return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4 max-h-[80vh] flex flex-col",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:j("assign.title","Assigner le ticket")}),e.jsxs("div",{className:"flex gap-2 mb-4 border-b border-[var(--border-color)]",children:[e.jsx("button",{onClick:()=>y("users"),className:`pb-2 px-3 font-medium transition-colors border-b-2 ${m==="users"?"border-[var(--color-accent-500)] text-[var(--color-accent-500)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:j("assign.tabUsers","Utilisateurs")}),e.jsx("button",{onClick:()=>y("groups"),className:`pb-2 px-3 font-medium transition-colors border-b-2 ${m==="groups"?"border-[var(--color-accent-500)] text-[var(--color-accent-500)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:j("assign.tabGroups","Groupes")})]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{type:"text",value:m==="users"?c:i,onChange:w=>m==="users"?f(w.target.value):h(w.target.value),placeholder:m==="users"?j("assign.searchUserPlaceholder","Rechercher un utilisateur..."):j("assign.searchGroupPlaceholder","Rechercher un groupe..."),className:"input w-full pl-10",autoFocus:!0})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto mb-4",children:[m==="users"&&e.jsx(e.Fragment,{children:d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"border border-[var(--border-color)] rounded-lg overflow-hidden",children:s.length===0?e.jsx("div",{className:"px-4 py-6 text-center text-sm text-[var(--text-tertiary)]",children:j("assign.noUsersFound","Aucun utilisateur trouvé")}):s.map(w=>e.jsxs("button",{onClick:()=>v(w.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--bg-secondary)] transition-colors border-t border-[var(--border-color)] first:border-t-0 ${r.includes(w.id)?"bg-[var(--color-accent-500)]/10":""}`,children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--border-color)] rounded flex items-center justify-center flex-shrink-0",children:r.includes(w.id)&&e.jsx("div",{className:"w-3 h-3 bg-[var(--color-accent-500)] rounded-sm"})}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white font-medium text-sm flex-shrink-0",children:w.fullName.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:w.fullName}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] truncate",children:w.email})]})]},w.id))})}),m==="groups"&&e.jsx(e.Fragment,{children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"border border-[var(--border-color)] rounded-lg overflow-hidden",children:S.length===0?e.jsx("div",{className:"px-4 py-6 text-center text-sm text-[var(--text-tertiary)]",children:j("assign.noGroupsFound","Aucun groupe trouvé")}):S.map(w=>e.jsxs("button",{onClick:()=>g(w.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--bg-secondary)] transition-colors border-t border-[var(--border-color)] first:border-t-0 ${a.includes(w.id)?"bg-[var(--color-accent-500)]/10":""}`,children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--border-color)] rounded flex items-center justify-center flex-shrink-0",children:a.includes(w.id)&&e.jsx("div",{className:"w-3 h-3 bg-[var(--color-accent-500)] rounded-sm"})}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white font-medium text-sm flex-shrink-0",children:w.name.charAt(0).toUpperCase()}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"font-medium truncate",children:w.name})}),e.jsx("span",{className:"text-xs px-2 py-1 rounded bg-[var(--bg-tertiary)] text-[var(--text-secondary)] flex-shrink-0",children:w.memberCount})]},w.id))})})]}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)] mb-4 px-3 py-2 bg-[var(--bg-secondary)] rounded",children:j("assign.selectedSummary","{{userCount}} utilisateur(s), {{groupCount}} groupe(s) sélectionné(s)",{userCount:r.length,groupCount:a.length})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{p(),f(""),h("")},className:"btn btn-secondary",children:j("common.cancel","Annuler")}),e.jsxs("button",{onClick:b,disabled:x||d||u,className:"btn btn-primary",children:[x&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),j("assign.confirm","Assigner")]})]})]})}):null}const ld=["Supervisor","Manager","Director"];function cd({show:t,escalationLevel:s,escalationReason:r,saving:a,onLevelChange:o,onReasonChange:c,onClose:i,onEscalate:d,t:u}){return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--warning-bg)] flex items-center justify-center",children:e.jsx(l.ArrowUpCircle,{className:"w-5 h-5 text-[var(--warning-text)]"})}),e.jsx("h2",{className:"text-xl font-bold",children:u("escalate.title")})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:u("escalate.description")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:u("escalate.level")}),e.jsx("div",{className:"space-y-2",children:ld.map(x=>e.jsxs("button",{onClick:()=>o(x),className:`w-full flex items-center gap-3 px-4 py-3 text-left rounded-lg border transition-colors ${s===x?"border-[var(--warning-border)] bg-[var(--warning-bg)]":"border-[var(--border-color)] hover:bg-[var(--bg-secondary)]"}`,children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center ${s===x?"border-[var(--warning-text)]":"border-[var(--border-color)]"}`,children:s===x&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-[var(--warning-text)]"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:u(`escalate.levels.${x}`)}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:u(`escalate.levels.${x}Desc`)})]})]},x))})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:u("escalate.reason")}),e.jsx("textarea",{value:r,onChange:x=>c(x.target.value),placeholder:u("escalate.reasonPlaceholder"),className:"input w-full h-24"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{i(),o("Supervisor"),c("")},className:"btn btn-secondary",children:u("common.cancel")}),e.jsxs("button",{onClick:d,disabled:a,className:"btn border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[a&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),e.jsx(l.ArrowUpCircle,{className:"w-4 h-4 mr-2"}),u("escalate.confirm")]})]})]})}):null}function dd(t){return{id:t.id,ticketNumber:t.ticketNumber,title:t.title,description:t.description,type:t.type,status:t.status,priority:t.priority,createdByName:t.createdBy?.fullName,assignedToName:t.assignedTo?.fullName,resolution:t.resolution,resolvedAt:t.resolvedAt,closedAt:t.closedAt,assignees:t.assignees,comments:t.comments.map(s=>({id:s.id,userName:s.userName,content:s.content,isInternal:s.isInternal,isEdited:s.isEdited,createdAt:s.createdAt})),attachments:t.attachments.map(s=>({id:s.id,fileName:s.fileName,contentType:s.contentType,fileSize:s.fileSize,createdAt:s.createdAt})),createdAt:t.createdAt,updatedAt:t.updatedAt,clientContext:t.clientContext,externalProvider:t.externalProvider,externalId:t.externalId,externalUrl:t.externalUrl,isExternallyManaged:t.isExternallyManaged,solutions:t.solutions,activeSolution:t.activeSolution,hasPendingSolution:t.hasPendingSolution}}function ud(t){return{id:t.id,ticketNumber:t.ticketNumber,title:t.title,description:t.description,type:t.type,status:t.status,priority:t.priority,resolution:t.resolution,resolvedAt:t.resolvedAt,closedAt:t.closedAt,comments:t.comments.map(s=>({id:s.id,userName:s.userName,content:s.content,isInternal:!1,isEdited:s.isEdited,createdAt:s.createdAt})),attachments:t.attachments.map(s=>({id:s.id,fileName:s.fileName,fileSize:s.fileSize,createdAt:s.createdAt})),createdAt:t.createdAt,updatedAt:t.updatedAt,solutions:t.solutions,activeSolution:t.activeSolution,hasPendingSolution:t.hasPendingSolution}}function tr(t,s){return s==="support"?dd(t):ud(t)}const md=()=>{const[t,s]=n.useState(null),[r,a]=n.useState(!0),[o,c]=n.useState(!1),[i,d]=n.useState(!1),[u,x]=n.useState(null),[m,f]=n.useState([]),[h,v]=n.useState(!1),[g,y]=n.useState({title:"",priority:"Medium"}),[p,b]=n.useState(!1),[j,S]=n.useState(!1),[w,P]=n.useState(!1),[$,A]=n.useState(""),[k,R]=n.useState("Supervisor"),[L,I]=n.useState(""),[C,O]=n.useState([]),[_,E]=n.useState([]),[z,W]=n.useState([]),[G,J]=n.useState(!1),[pe,q]=n.useState(""),[Y,M]=n.useState(""),[te,oe]=n.useState([]),[le,F]=n.useState(!1),[K,Q]=n.useState("users"),[U,Z]=n.useState(null),[re,de]=n.useState(!1),[he,fe]=n.useState(0),[Ne,Be]=n.useState(""),[Ke,B]=n.useState(!1);return{ticket:t,setTicket:s,loading:r,setLoading:a,saving:o,setSaving:c,uploading:i,setUploading:d,error:u,setError:x,activities:m,setActivities:f,isEditing:h,setIsEditing:v,editForm:g,setEditForm:y,showAssignModal:p,setShowAssignModal:b,showResolveModal:j,setShowResolveModal:S,showEscalateModal:w,setShowEscalateModal:P,resolution:$,setResolution:A,escalationLevel:k,setEscalationLevel:R,escalationReason:L,setEscalationReason:I,users:C,setUsers:O,selectedUserIds:_,setSelectedUserIds:E,selectedGroupIds:z,setSelectedGroupIds:W,loadingUsers:G,setLoadingUsers:J,userSearchQuery:pe,setUserSearchQuery:q,groupSearchQuery:Y,setGroupSearchQuery:M,groups:te,setGroups:oe,loadingGroups:le,setLoadingGroups:F,assignModalTab:K,setAssignModalTab:Q,satisfaction:U,setSatisfaction:Z,showRatingForm:re,setShowRatingForm:de,ratingValue:he,setRatingValue:fe,ratingComment:Ne,setRatingComment:Be,submittingRating:Ke,setSubmittingRating:B}},xd=(t,s)=>t?s?.email||"":(s?.firstName&&s?.lastName?`${s.firstName} ${s.lastName}`:s?.email)||"",pd=(t,s,r)=>{const a=s.get("tab");t==="conversation"?a&&(s.delete("tab"),r(s,{replace:!0})):a!==t&&r({tab:t},{replace:!0})},hd=(t,s)=>{const r=t.get("tab");return r&&s.includes(r)?r:"conversation"};function gd({ticket:t,isSupport:s,isEditing:r,saving:a,editForm:o,error:c,onEditToggle:i,onSave:d,onEditFormChange:u,onErrorClear:x,t:m}){return e.jsxs("div",{className:"flex-shrink-0 border-b border-[var(--border-color)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>window.history.back(),className:"btn btn-ghost p-2",children:e.jsx(l.ArrowLeft,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono text-sm text-[var(--text-secondary)]",children:t.ticketNumber}),t.externalId&&t.externalUrl&&e.jsxs("a",{href:t.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] hover:opacity-80",children:[e.jsx(l.ExternalLink,{className:"w-3 h-3"}),"GLPI #",t.externalId]}),e.jsx(ss,{status:as[t.status]||"pending",label:t.status}),e.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:er[t.priority]?.bg,color:er[t.priority]?.text},children:t.priority})]}),s&&r?e.jsx("input",{type:"text",value:o.title,onChange:f=>u({...o,title:f.target.value}),className:"input w-full text-lg font-bold"}):e.jsx("h1",{className:"text-lg font-bold truncate",children:t.title})]}),e.jsx("div",{className:"flex items-center gap-2",children:s&&r?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>i(!1),className:"btn btn-ghost p-2",children:e.jsx(l.X,{className:"w-5 h-5"})}),e.jsx("button",{onClick:d,disabled:a,className:"btn btn-primary",children:a?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Save,{className:"w-4 h-4"})})]}):e.jsx(e.Fragment,{children:s&&!t.isExternallyManaged&&e.jsx("button",{onClick:()=>i(!0),className:"btn btn-ghost p-2",title:"Modifier",children:e.jsx(l.Edit2,{className:"w-5 h-5"})})})})]}),c&&e.jsxs("div",{className:"mt-3 p-3 rounded-lg bg-[var(--error-bg)] text-[var(--error-text)] flex items-center gap-2",children:[e.jsx(l.AlertTriangle,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm flex-1",children:c}),e.jsx("button",{onClick:x,className:"p-1 hover:bg-[var(--error-border)] rounded",children:e.jsx(l.X,{className:"w-4 h-4"})})]}),t.isExternallyManaged&&e.jsxs("div",{className:"mt-3 p-3 rounded-lg bg-[var(--info-bg)] border border-[var(--info-border)] flex items-center gap-3",children:[e.jsx(l.ShieldAlert,{className:"w-5 h-5 text-[var(--info-text)] flex-shrink-0"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm font-medium text-[var(--info-text)]",children:m("glpi.readOnlyBanner","This ticket is managed by GLPI and is read-only.")})}),t.externalUrl&&e.jsxs("a",{href:t.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] hover:opacity-80 flex items-center gap-1.5",children:[e.jsx(l.ExternalLink,{className:"w-4 h-4"}),m("glpi.viewInGlpi","View in GLPI")]})]})]})}function fd({ticket:t,isSupport:s,satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowRatingForm:d,onRatingChange:u,onCommentChange:x,onCancelRating:m,onSubmitRating:f,t:h}){return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{className:"mt-3 p-3 rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-color)]",children:e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:h(ad[t.status]||"statusDescriptions.InProgress")})}),t.resolution&&e.jsxs("div",{className:"mt-3 p-4 rounded-lg bg-[var(--success-bg)] border border-[var(--success-border)]",children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 text-[var(--success-text)] mb-1",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4"}),h("resolution.title","Résolution")]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.resolution})]}),!s&&(t.status==="Resolved"||t.status==="Closed")&&e.jsx("div",{className:"mt-3 p-4 rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-color)]",children:e.jsx(nd,{satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowForm:d,onRatingChange:u,onCommentChange:x,onCancel:m,onSubmit:f,t:h})})]})}function bd({activeTab:t,commentCount:s,isSupport:r,assigneeCount:a,onTabChange:o,t:c}){const i=[{id:"conversation",icon:l.MessageSquare,label:c("tabs.conversation"),badge:s},{id:"description",icon:l.FileText,label:c("tabs.description"),badge:0},{id:"information",icon:l.Info,label:c("tabs.information"),badge:0},...r?[{id:"assignment",icon:l.Users,label:c("tabs.assignment"),badge:a},{id:"ai",icon:l.Sparkles,label:c("tabs.ai"),badge:0}]:[]];return e.jsx("div",{className:"flex-shrink-0 flex border-b border-[var(--border-color)] bg-[var(--bg-card)]",children:i.map(({id:d,icon:u,label:x,badge:m})=>e.jsxs("button",{onClick:()=>o(d),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${t===d?"border-[var(--color-accent-600)] text-[var(--color-accent-600)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--border-color)]"}`,children:[e.jsx(u,{className:"w-4 h-4"}),x,m>0&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:m})]},d))})}function vd({activeTab:t,ticket:s,activities:r,isSupport:a,isClosed:o,isReadOnly:c,isConnected:i,currentUserName:d,saving:u,uploading:x,onAddComment:m,onDownloadAttachment:f,onUploadAttachment:h,onStatusChange:v,onAssign:g,onResolve:y,onClose:p,onReopen:b,onEscalate:j,getAttachmentUrl:S,onProposeSolution:w,onApproveSolution:P,onRejectSolution:$,t:A}){if(t==="description")return e.jsx("div",{className:"h-full overflow-y-auto p-6 bg-[var(--bg-primary)]",children:s.description?e.jsx("div",{className:"prose prose-sm max-w-none text-[var(--text-primary)] leading-relaxed [&_a]:text-[var(--color-accent-600)] [&_a]:underline",dangerouslySetInnerHTML:{__html:Fa.sanitize(s.description)}}):e.jsx("p",{className:"text-[var(--text-tertiary)] italic",children:A("tabs.noDescription")})});if(t==="conversation"){const k=n.useMemo(()=>{if(s)return{ticketNumber:s.ticketNumber??"",ticketTitle:s.title??"",userName:s.createdBy?.fullName??"",userFirstName:s.createdBy?.fullName?.split(" ")[0]??"",userLastName:s.createdBy?.fullName?.split(" ").slice(1).join(" ")??"",userEmail:s.createdBy?.email??"",priority:s.priority??"",type:s.type??"",status:s.status??"",agentName:s.assignedTo?.fullName??"",agentFirstName:s.assignedTo?.fullName?.split(" ")[0]??"",createdAt:s.createdAt?new Date(s.createdAt).toLocaleDateString():"",resolvedAt:s.resolvedAt?new Date(s.resolvedAt).toLocaleDateString():"",resolution:s.resolution??""}},[s]);return e.jsxs("div",{className:"h-full flex flex-col",children:[(s.activeSolution||s.hasPendingSolution||a&&!o&&s.status!=="Closed")&&e.jsx("div",{className:"p-4 border-b border-[var(--border-color)]",children:e.jsx(Yc,{ticketId:s.id,solutions:s.solutions??[],activeSolution:s.activeSolution,mode:a?"support":"client",onProposeSolution:!c&&a?w:void 0,onApproveSolution:c?void 0:P,onRejectSolution:c?void 0:$,isLoading:u})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(pa,{ticketId:s.id,comments:s.comments,activities:r.map(R=>({id:R.id,action:R.action,oldValue:R.oldValue??null,newValue:R.newValue??null,changedByUserName:"changedByUserName"in R?R.changedByUserName:null,createdAt:R.createdAt})),attachments:s.attachments,isSupport:a,isClosed:o||c,isConnected:i,currentUserName:d,ticketVariables:k,onAddComment:m,onDownloadAttachment:f,getAttachmentUrl:S})})]})}return t==="assignment"?e.jsx(yd,{ticket:s,isReadOnly:c,onAssign:g,t:A}):t==="ai"?e.jsx(wd,{ticket:s,t:A}):e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(ha,{ticket:s,attachments:s.attachments,activities:r.map(k=>({action:k.action,newValue:k.newValue,createdAt:k.createdAt})),isSupport:a,saving:u,uploading:x,isReadOnly:c,layout:"grid",onAssign:c?void 0:g,onStatusChange:c?void 0:v,onResolve:c?void 0:y,onCloseTicket:c?void 0:p,onReopen:c?void 0:b,onEscalate:c?void 0:j,onDownloadAttachment:f,onUploadAttachment:c?void 0:h,getAttachmentUrl:S})})})}function yd({ticket:t,isReadOnly:s,onAssign:r,t:a}){const[o,c]=n.useState([]),[i,d]=n.useState(!1);n.useEffect(()=>{t?.id&&(d(!0),ed.getByTicket(t.id).then(x=>c(x)).catch(()=>c([])).finally(()=>d(!1)))},[t?.id]);const u=t.assignees??[];return e.jsx("div",{className:"h-full overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-[var(--text-primary)]",children:a("tabs.assignmentCurrentAssignees")}),!s&&e.jsx("button",{onClick:r,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--color-accent-600)] text-white hover:bg-[var(--color-accent-700)] transition-colors",children:a("tabs.assignmentAssign")})]}),u.length===0?e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] italic",children:a("tabs.assignmentNoAssignees")}):e.jsx("div",{className:"space-y-2",children:u.map(x=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md bg-[var(--bg-secondary)]",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-100)] text-[var(--color-accent-700)] flex items-center justify-center text-xs font-medium",children:(x.fullName||x.email||"?").charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:x.fullName||x.email}),x.assignedViaGroupName&&e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:a("tabs.assignmentViaGroup",{group:x.assignedViaGroupName})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[x.isPrimary&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[var(--info-bg)] text-[var(--info-text)]",children:a("tabs.assignmentPrimary")}),x.assignedAt&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(x.assignedAt).toLocaleDateString()})]})]},x.userId))})]}),e.jsxs("div",{className:"card p-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-[var(--text-primary)] mb-4",children:a("tabs.assignmentLogs")}),i?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--text-tertiary)]"})}):o.length===0?e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] italic",children:a("tabs.assignmentNoLogs")}):e.jsx("div",{className:"space-y-2",children:o.map(x=>e.jsxs("div",{className:"flex items-start gap-3 p-2 rounded-md border border-[var(--border-color)] bg-[var(--bg-primary)]",children:[e.jsx("div",{className:`mt-0.5 w-2 h-2 rounded-full flex-shrink-0 ${x.success?"bg-[var(--success-text)]":"bg-[var(--error-text)]"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm text-[var(--text-primary)]",children:[e.jsx("span",{className:"font-medium",children:x.strategyUsed}),x.reason&&e.jsxs("span",{className:"text-[var(--text-secondary)]",children:[" — ",x.reason]})]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:new Date(x.createdAt).toLocaleString()})]}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${x.success?"bg-[var(--success-bg)] text-[var(--success-text)]":"bg-[var(--error-bg)] text-[var(--error-text)]"}`,children:x.success?a("tabs.assignmentSuccess"):a("tabs.assignmentFailed")})]},x.id))})]})]})})}const jd=12e4;function sr(t){const s=sessionStorage.getItem(t);return s?Date.now()-Number(s)>jd?(sessionStorage.removeItem(t),!1):!0:!1}function wd({ticket:t,t:s}){const[r,a]=n.useState(null),[o,c]=n.useState(!0),i=`ai_routing_${t.id}`,d=`ai_summary_${t.id}`,[u,x]=n.useState(()=>sr(i)),[m,f]=n.useState(()=>sr(d));n.useEffect(()=>{let p=!1;return(async()=>{try{const{cachedAiApi:j}=await Promise.resolve().then(()=>Zs),S=await j.getCached(t.id);p||(a(S),S.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),S.summary&&(sessionStorage.removeItem(d),f(!1)))}catch{}finally{p||c(!1)}})(),()=>{p=!0}},[t.id,i,d]),n.useEffect(()=>{if(!u&&!m)return;let p=!1;const j=setInterval(async()=>{try{const{cachedAiApi:S}=await Promise.resolve().then(()=>Zs),w=await S.getCached(t.id);if(p)return;a(w),u&&w.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),m&&w.summary&&(sessionStorage.removeItem(d),f(!1))}catch{}},3e3);return()=>{p=!0,clearInterval(j)}},[u,m,t.id,i,d]);const h=n.useCallback(()=>{sessionStorage.setItem(i,Date.now().toString()),x(!0)},[i]),v=n.useCallback(()=>{sessionStorage.removeItem(i),x(!1)},[i]),g=n.useCallback(()=>{sessionStorage.setItem(d,Date.now().toString()),f(!0)},[d]),y=n.useCallback(()=>{sessionStorage.removeItem(d),f(!1)},[d]);return o?e.jsx("div",{className:"h-full overflow-y-auto p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"h-full overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-4",children:[(t.aiClassification||r?.classification)&&e.jsxs("div",{className:"card p-4",children:[e.jsx("h3",{className:"font-semibold text-sm mb-3 text-[var(--text-primary)]",children:s("aiClassification.title")}),e.jsx(va,{classification:t.aiClassification||r?.classification})]}),e.jsx(Qc,{ticketId:t.id,cachedClassification:r?.classification,cachedRouting:r?.routingSuggestion,cachedGeneratedAt:r?.routingSuggestionGeneratedAt,processing:u,onProcessingStart:h,onProcessingEnd:v}),e.jsx(Zc,{ticketId:t.id,cachedSummary:r?.summary,cachedGeneratedAt:r?.summaryGeneratedAt,processing:m,onProcessingStart:g,onProcessingEnd:y})]})})}function Nd({mode:t}){const{id:s}=N.useParams(),r=N.useNavigate(),{t:a}=ne.useTranslation("support"),{user:o}=Ae(),[c,i]=N.useSearchParams(),{isGlpi:d}=ja(),u=t==="support",x=xd(u,o),[m,f]=n.useState(()=>hd(c,rd));n.useEffect(()=>{pd(m,c,i)},[m,c,i]);const{ticket:h,setTicket:v,loading:g,setLoading:y,saving:p,setSaving:b,uploading:j,setUploading:S,error:w,setError:P,activities:$,setActivities:A,isEditing:k,setIsEditing:R,editForm:L,setEditForm:I,showAssignModal:C,setShowAssignModal:O,showResolveModal:_,setShowResolveModal:E,showEscalateModal:z,setShowEscalateModal:W,resolution:G,setResolution:J,escalationLevel:pe,setEscalationLevel:q,escalationReason:Y,setEscalationReason:M,users:te,setUsers:oe,selectedUserIds:le,setSelectedUserIds:F,selectedGroupIds:K,setSelectedGroupIds:Q,loadingUsers:U,setLoadingUsers:Z,userSearchQuery:re,setUserSearchQuery:de,groupSearchQuery:he,setGroupSearchQuery:fe,groups:Ne,setGroups:Be,loadingGroups:Ke,setLoadingGroups:B,assignModalTab:H,setAssignModalTab:X,satisfaction:se,setSatisfaction:ee,showRatingForm:ue,setShowRatingForm:ae,ratingValue:ve,setRatingValue:be,ratingComment:$e,setRatingComment:Me,submittingRating:Le,setSubmittingRating:Fe}=md(),Qe=n.useCallback(async()=>{if(s)try{const V=u?await ye.tickets.getActivities(s,50):await qe.getActivities(s,50);A(V)}catch(V){console.error("Failed to load activities",V)}},[s,u]),He=n.useCallback(async()=>{if(!(!s||u))try{const V=await qe.getSatisfaction(s);ee(V)}catch(V){console.error("Failed to load satisfaction",V)}},[s,u]),Ce=n.useCallback(async()=>{if(s)try{if(y(!0),P(null),u){const V=await ye.tickets.getById(s);if(!V){v(null);return}v(tr(V,t)),I({title:V.title,priority:V.priority})}else{const V=await qe.getById(s);if(!V){v(null);return}v(tr(V,t)),He()}Qe()}catch(V){P(a("error.loadFailed","Impossible de charger le ticket")),console.error(V)}finally{y(!1)}},[s,u,t,Qe,He,a]),T=n.useCallback(V=>{if(V.ticketId===s){if(!u&&V.isInternal)return;v(me=>!me||me.comments.some(Se=>Se.id===V.id)?me:{...me,comments:[...me.comments,{id:V.id,userName:V.userName,content:V.content,isInternal:V.isInternal,isEdited:V.isEdited,createdAt:V.createdAt}]})}},[s,u]),ce=n.useCallback(V=>{V.ticketId===s&&Ce()},[s,Ce]),{isConnected:we}=Vr({ticketId:s,onCommentAdded:T,onTicketUpdated:ce});n.useEffect(()=>{Ce()},[Ce]),n.useEffect(()=>{(async()=>{if(!(!C||te.length>0||!u))try{Z(!0);const me=await D.get("/api/administration/users");oe(me.items.map(Se=>({id:Se.id,email:Se.email,fullName:`${Se.firstName} ${Se.lastName}`}))),h?.assignees&&h.assignees.length>0&&F(h.assignees.map(Se=>Se.userId))}catch(me){console.error("Failed to load users",me)}finally{Z(!1)}})()},[C,te.length,u,h?.assignees]),n.useEffect(()=>{(async()=>{if(!(!C||!u))try{B(!0);const me=await sd.getAll();Be(me.map(Se=>({id:Se.id,name:Se.name,memberCount:Se.memberCount})))}catch(me){console.error("Failed to load groups",me)}finally{B(!1)}})()},[C,u]);const ke=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.update(s,{title:L.title,priority:L.priority,description:h?.description||""}),await Ce(),R(!1)}catch{P(a("error.updateFailed","Impossible de mettre à jour le ticket"))}finally{b(!1)}},De=async V=>{if(!(!s||!u))try{b(!0),await ye.tickets.updateStatus(s,V),await Ce()}catch{P(a("error.statusFailed","Impossible de changer le statut"))}finally{b(!1)}},pt=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.assign(s,le.length>0?le[0]:null,le.length>0?le:void 0,K.length>0?K:void 0),await Ce(),O(!1),F([]),Q([]),X("users")}catch{P(a("error.assignFailed","Impossible d'assigner le ticket"))}finally{b(!1)}},tt=async()=>{if(!(!s||!G.trim()||!u))try{b(!0),await ye.tickets.proposeSolution(s,G),await Ce(),E(!1),J("")}catch{P(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},wa=async V=>{if(s)try{b(!0),u&&await ye.tickets.proposeSolution(s,V),await Ce()}catch{P(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},Na=async()=>{if(s)try{b(!0),u?await ye.tickets.approveSolution(s):await qe.approveSolution(s),await Ce()}catch{P(a("error.approveFailed","Impossible d'approuver la solution"))}finally{b(!1)}},Sa=async V=>{if(s)try{b(!0),u?await ye.tickets.rejectSolution(s,V):await qe.rejectSolution(s,V),await Ce()}catch{P(a("error.rejectFailed","Impossible de rejeter la solution"))}finally{b(!1)}},vs=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.close(s),await Ce()}catch{P(a("error.closeFailed","Impossible de fermer le ticket"))}finally{b(!1)}},ys=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.reopen(s),await Ce()}catch{P(a("error.reopenFailed","Impossible de réouvrir le ticket"))}finally{b(!1)}},Ca=async()=>{if(!(!s||!u||!pe))try{b(!0),await yo.escalateTicket(s,pe,Y||void 0),await Ce(),W(!1),q("Supervisor"),M("")}catch{P(a("error.escalateFailed","Failed to escalate ticket"))}finally{b(!1)}},ka=async(V,me)=>{!s||!V.trim()||(u?await ye.tickets.addComment(s,{content:V,isInternal:me}):await qe.addComment(s,V),await Ce())},Aa=async()=>{if(!(!s||ve===0||u))try{Fe(!0);const V=await qe.submitSatisfaction(s,{rating:ve,comment:$e.trim()||void 0});ee(V),ae(!1),be(0),Me("")}catch(V){const me=V instanceof Error?V.message:a("error.ratingFailed","Failed to submit rating");P(me)}finally{Fe(!1)}},Ra=async V=>{if(s)try{const me=u?await ye.tickets.downloadAttachment(s,V.id):await qe.downloadAttachment(s,V.id),Se=window.URL.createObjectURL(me),ht=document.createElement("a");ht.href=Se,ht.setAttribute("download",V.fileName),document.body.appendChild(ht),ht.click(),ht.remove(),window.URL.revokeObjectURL(Se)}catch{P(a("error.downloadFailed","Impossible de télécharger le fichier"))}},Pa=async V=>{if(!(!s||!u))try{S(!0),await ye.tickets.uploadAttachment(s,V),await Ce()}catch(me){throw P(a("error.uploadFailed","Failed to upload file")),me}finally{S(!1)}},Ta=V=>s?u?ye.tickets.getAttachmentUrl(s,V.id):`/api/support/my-tickets/${s}/attachments/${V.id}`:"",Ea=n.useMemo(()=>{if(!re.trim())return te;const V=re.toLowerCase();return te.filter(me=>me.fullName.toLowerCase().includes(V)||me.email.toLowerCase().includes(V))},[te,re]),$a=n.useCallback(V=>{F(me=>me.includes(V)?me.filter(Se=>Se!==V):[...me,V])},[]),Ia=n.useCallback(V=>{Q(me=>me.includes(V)?me.filter(Se=>Se!==V):[...me,V])},[]);if(g)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-600)]"})});if(!h)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[e.jsx(l.AlertTriangle,{className:"w-12 h-12 mb-4 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:a("error.notFound","Ticket non trouvé")}),e.jsx("button",{onClick:()=>r(-1),className:"btn btn-secondary",children:a("common.goBack","Retour")})]});const La=h.status==="Closed"||h.status==="Rejected",Ze=d||!!h.isExternallyManaged;return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(gd,{ticket:h,isSupport:u,isEditing:k,saving:p,editForm:L,error:w,onEditToggle:R,onSave:ke,onEditFormChange:I,onErrorClear:()=>P(null),t:a}),e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx(fd,{ticket:h,isSupport:u,satisfaction:se,showRatingForm:ue,ratingValue:ve,ratingComment:$e,submittingRating:Le,onShowRatingForm:()=>ae(!0),onRatingChange:be,onCommentChange:Me,onCancelRating:()=>{ae(!1),be(0),Me("")},onSubmitRating:Aa,t:a}),e.jsx(Xc,{currentStatus:h.status,createdAt:h.createdAt,resolvedAt:h.resolvedAt,closedAt:h.closedAt,activities:$.map(V=>({action:V.action,newValue:V.newValue,createdAt:V.createdAt})),isSupport:u,saving:p,assignees:h.assignees,onAssign:Ze?void 0:()=>O(!0),onStatusChange:Ze?void 0:De,onResolve:Ze?void 0:()=>E(!0),onCloseTicket:Ze?void 0:vs,onReopen:Ze?void 0:ys,onEscalate:Ze?void 0:()=>W(!0)})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsx(bd,{activeTab:m,commentCount:h.comments.length,isSupport:u,assigneeCount:h.assignees?.length??0,onTabChange:f,t:a}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(vd,{activeTab:m,ticket:h,activities:$,isSupport:u,isClosed:La,isReadOnly:Ze,isConnected:we,currentUserName:x,saving:p,uploading:j,onAddComment:ka,onDownloadAttachment:Ra,onUploadAttachment:Pa,onStatusChange:De,onAssign:()=>O(!0),onResolve:()=>E(!0),onClose:vs,onReopen:ys,onEscalate:()=>W(!0),getAttachmentUrl:Ta,onProposeSolution:wa,onApproveSolution:Na,onRejectSolution:Sa,t:a})})]}),e.jsx(od,{show:u&&_,resolution:G,saving:p,onResolutionChange:J,onClose:()=>E(!1),onResolve:tt,t:a}),e.jsx(id,{show:u&&C,filteredUsers:Ea,selectedUserIds:le,selectedGroupIds:K,groups:Ne,userSearchQuery:re,groupSearchQuery:he,loadingUsers:U,loadingGroups:Ke,saving:p,activeTab:H,onUserSearchChange:de,onGroupSearchChange:fe,onSelectUser:$a,onSelectGroup:Ia,onTabChange:X,onClose:()=>{O(!1),F([]),Q([]),X("users"),de(""),fe("")},onAssign:pt,t:a}),e.jsx(cd,{show:u&&z,escalationLevel:pe,escalationReason:Y,saving:p,onLevelChange:q,onReasonChange:M,onClose:()=>W(!1),onEscalate:Ca,t:a})]})}const rr="support_tickets_view_mode",Sd={Open:["InProgress","OnHold","Rejected"],InProgress:["OnHold","Resolved","Rejected"],OnHold:["InProgress","Resolved","Open"],Resolved:["Closed","Open"],Closed:["Open"],Rejected:["Open"]};function ar(t,s){return t===s?!1:Sd[t]?.includes(s)??!1}const Yt={Low:"var(--info-bg)",Medium:"var(--warning-bg)",High:"var(--error-bg)",Critical:"var(--error-text)"};function Cd({mode:t,showDrafts:s=!1,basePath:r,title:a,subtitle:o,createPath:c}){const{t:i}=ne.useTranslation(["support","admin","common"]),d=N.useNavigate(),{currentTenant:u,userTenants:x,hasMultipleTenants:m,isGlobalView:f}=Ee(),{isGlpi:h}=ja(),[v,g]=n.useState([]),[y,p]=n.useState(null),[b,j]=n.useState(!0),[S,w]=n.useState(1),[P,$]=n.useState(1),[A,k]=n.useState(0),[R,L]=n.useState(""),[I,C]=n.useState(""),[O,_]=n.useState(""),[E,z]=n.useState(""),[W,G]=n.useState(""),[J,pe]=n.useState(()=>localStorage.getItem(rr)||"table"),[q,Y]=n.useState(!1),[M,te]=n.useState([]),[oe,le]=n.useState(!0),[F,K]=n.useState(null),[Q,U]=n.useState(null),[Z,re]=n.useState(null),de=(t==="admin"||t==="assigned")&&(m||f),he=n.useCallback(async()=>{try{j(!0);const T={page:S,pageSize:20,search:R||void 0,status:I||void 0,type:O||void 0,priority:E||void 0,tenantId:W||void 0};let ce;t==="admin"?ce=await ye.tickets.getAll(T):t==="assigned"?ce=await ye.tickets.getMyTickets(T):ce=await qe.getAll(T),g(ce?.items??[]),$(ce?.totalPages??1),k(ce?.totalCount??0)}catch(T){console.error("Failed to load tickets:",T),g([]),$(1),k(0)}finally{j(!1)}},[t,S,R,I,O,E,W]),fe=n.useCallback(async()=>{try{let T;t==="admin"?T=await ye.tickets.getStats(W||void 0):t==="assigned"?T=await ye.tickets.getMyAssignedStats():T=await qe.getStats(),p(T)}catch(T){console.error("Failed to load stats:",T)}},[t,W]);n.useEffect(()=>{he()},[he]),n.useEffect(()=>{fe()},[fe]),n.useEffect(()=>{if(s){const T=Xe.getAllDrafts();te(T)}},[s]),n.useEffect(()=>{localStorage.setItem(rr,J)},[J]);const Ne=T=>{Xe.deleteDraft(T),te(Xe.getAllDrafts())},Be=T=>{d(`${c}?draft=${T.id}`)},Ke=T=>{const we=new Date().getTime()-T.getTime(),ke=Math.floor(we/6e4),De=Math.floor(we/36e5),pt=Math.floor(we/864e5);return ke<1?i("common:time.justNow","Just now"):ke<60?i("common:time.minutesAgo",{count:ke}):De<24?i("common:time.hoursAgo",{count:De}):i("common:time.daysAgo",{count:pt})},B=T=>{T.preventDefault(),w(1),he()},H=T=>{h||K(T)},X=()=>{K(null),U(null)},se=(T,ce)=>{T.preventDefault(),U(ce)},ee=()=>{U(null)},ue=T=>F?ar(F.status,T):!1,ae=async(T,ce)=>{if(T.preventDefault(),re(null),!F||F.status===ce){K(null),U(null);return}if(!ar(F.status,ce)){re(i("list.invalidTransition",{from:i(`tickets.statuses.${F.status}`),to:i(`tickets.statuses.${ce}`)})),K(null),U(null),setTimeout(()=>re(null),4e3);return}try{g(we=>we.map(ke=>ke.id===F.id?{...ke,status:ce}:ke)),(t==="admin"||t==="assigned")&&await ye.tickets.updateStatus(F.id,ce),fe(),he()}catch(we){console.error("Failed to update ticket status:",we);const ke=we?.response?.data?.message||we?.response?.data?.detail||"";re(ke||i("list.statusUpdateFailed")),setTimeout(()=>re(null),4e3),he()}finally{K(null),U(null)}},ve=async T=>{if(confirm(i("list.confirmDelete",{number:T.ticketNumber})))try{await ye.tickets.delete(T.id),he(),fe()}catch(ce){console.error("Failed to delete ticket:",ce)}},be=T=>`${r}/${T}`,$e=T=>{if(!de)return null;const ce="tenantId"in T?T.tenantId??null:null,we="tenantName"in T?T.tenantName??null:null,ke=Qr(ce,u?.id??null);return ke==="global"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-700",children:"System"}):ke==="current"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)] truncate max-w-[120px]",children:we}):e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-700 font-medium truncate max-w-[120px]",children:we})},Me=()=>{if(!y)return null;const T=y,ce=y,we=t==="admin"||t==="assigned",ke=we?[{label:i("list.stats.total"),value:T.total,color:"blue"},{label:i("list.stats.open"),value:T.open,color:"yellow"},{label:i("list.stats.inProgress"),value:T.inProgress,color:"blue"},{label:i("list.stats.onHold"),value:T.onHold,color:"yellow"},{label:i("list.stats.resolved"),value:T.resolved,color:"green"},{label:i("list.stats.closed"),value:T.closed,color:"neutral"},{label:i("list.stats.critical"),value:T.critical,color:"red"},{label:i("list.stats.highPriority"),value:T.highPriority,color:"yellow"}]:[{label:i("list.stats.total"),value:ce.total,color:"blue"},{label:i("list.stats.open"),value:ce.open,color:"yellow"},{label:i("list.stats.inProgress"),value:ce.inProgress,color:"blue"},{label:i("list.stats.resolved"),value:ce.resolved,color:"green"},{label:i("list.stats.closed"),value:ce.closed,color:"neutral"}],De={blue:"bg-[var(--info-bg)] text-[var(--info-text)] border-[var(--info-border)]",green:"bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",yellow:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",red:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",neutral:"bg-[var(--bg-secondary)] text-[var(--text-primary)] border-[var(--border-color)]"},pt=we?"lg:grid-cols-8":"lg:grid-cols-5";return e.jsx("div",{className:`grid grid-cols-2 md:grid-cols-4 ${pt} gap-4 mb-6`,children:ke.map(tt=>e.jsxs("div",{className:`card p-4 text-center border ${De[tt.color]}`,children:[e.jsx("div",{className:"text-2xl font-bold",children:tt.value}),e.jsx("div",{className:"text-sm opacity-80",children:tt.label})]},tt.label))})},Le=()=>e.jsxs("div",{className:"card overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-color)]",children:[e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.number")}),de&&e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.tenant","Workspace")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.title")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.type")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.status")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.priority")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.assignee")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.comments")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.created")}),e.jsx("th",{className:"text-right p-4 font-medium",children:i("list.table.actions")})]})}),e.jsx("tbody",{children:v.map(T=>e.jsxs("tr",{className:"border-b border-[var(--border-color)] hover:bg-[var(--bg-hover)] cursor-pointer",onClick:()=>d(be(T.id)),children:[e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"font-mono text-sm",children:T.ticketNumber})}),de&&e.jsx("td",{className:"p-4",children:$e(T)}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-medium",children:T.title}),T.isExternallyManaged&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)]",children:"GLPI"})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})})}),e.jsx("td",{className:"p-4",children:e.jsx(ss,{status:as[T.status]||"pending",label:i(`tickets.statuses.${T.status}`,{defaultValue:T.status})})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"px-2 py-1 rounded-[var(--radius-badge)] text-xs font-medium",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:"assignedToName"in T&&T.assignedToName||"-"}),"assigneeCount"in T&&T.assigneeCount>1&&e.jsxs("span",{className:"ml-1 text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:["+",T.assigneeCount-1]})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm",children:T.commentCount})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:new Date(T.createdAt).toLocaleDateString()})}),e.jsx("td",{className:"p-4 text-right",onClick:ce=>ce.stopPropagation(),children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>d(be(T.id)),className:"btn btn-ghost p-2",title:i("list.actions.view"),children:e.jsx(l.Eye,{className:"w-4 h-4"})}),T.externalUrl&&e.jsx("a",{href:T.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-ghost p-2 text-[var(--info-text)]",title:"Open in GLPI",onClick:ce=>ce.stopPropagation(),children:e.jsx(l.ExternalLink,{className:"w-4 h-4"})}),t==="admin"&&!h&&e.jsx("button",{onClick:()=>ve(T),disabled:T.isExternallyManaged,className:"btn btn-ghost p-2 text-[var(--error-text)] disabled:opacity-50 disabled:cursor-not-allowed",title:T.isExternallyManaged?"Cannot delete externally managed tickets":i("list.actions.delete"),children:e.jsx(l.Trash2,{className:"w-4 h-4"})})]})})]},T.id))})]}),v.length===0&&!b&&e.jsxs("div",{className:"p-8 text-center text-[var(--text-secondary)]",children:[e.jsx(l.Headphones,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsxs("p",{children:[t==="admin"&&i("list.empty.admin"),t==="assigned"&&i("list.empty.assigned"),t==="user"&&i("list.empty.user")]}),t==="user"&&!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary mt-4",children:[e.jsx(l.Plus,{className:"w-4 h-4 mr-2"}),i("list.empty.createFirst")]})]})]}),Fe=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[v.map(T=>e.jsxs("div",{className:"card p-4 hover:shadow-lg cursor-pointer transition-shadow",onClick:()=>d(be(T.id)),children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm text-[var(--text-secondary)]",children:T.ticketNumber}),$e(T)]}),e.jsx(ss,{status:as[T.status]||"pending",label:i(`tickets.statuses.${T.status}`,{defaultValue:T.status})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-medium line-clamp-2 flex-1",children:T.title}),T.isExternallyManaged&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] whitespace-nowrap",children:"GLPI"})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-xs px-2 py-1 rounded-[var(--radius-badge)] bg-[var(--bg-secondary)]",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})}),e.jsx("span",{className:"text-xs px-2 py-1 rounded-[var(--radius-badge)]",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{children:new Date(T.createdAt).toLocaleDateString()}),e.jsx("span",{children:i("list.comments_other",{count:T.commentCount})})]})]},T.id)),v.length===0&&!b&&e.jsxs("div",{className:"col-span-full card p-12 text-center",children:[e.jsx(l.Headphones,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[t==="admin"&&i("list.empty.admin"),t==="assigned"&&i("list.empty.assigned"),t==="user"&&i("list.empty.user")]}),t==="user"&&!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary mt-4",children:[e.jsx(l.Plus,{className:"w-4 h-4 mr-2"}),i("list.empty.createFirst")]})]})]}),Qe=T=>e.jsxs(Zo,{onClick:()=>d(be(T.id)),isDragging:F?.id===T.id,onDragStart:()=>H(T),onDragEnd:X,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)] mb-1",children:[e.jsx("span",{children:T.ticketNumber}),$e(T)]}),e.jsx("div",{className:"font-medium mb-2 line-clamp-2",children:T.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-[var(--radius-badge)]",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:i("list.comments_other",{count:T.commentCount})})]})]},T.id),He=()=>{const T=[{status:"Open",label:i("tickets.statuses.Open"),color:"warning"},{status:"InProgress",label:i("tickets.statuses.InProgress"),color:"default"},{status:"OnHold",label:i("tickets.statuses.OnHold"),color:"warning"},{status:"Resolved",label:i("tickets.statuses.Resolved"),color:"success"},{status:"Closed",label:i("tickets.statuses.Closed"),color:"default"}];return e.jsxs("div",{className:"space-y-3",children:[Z&&e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-card)] bg-[var(--error-bg)] border border-[var(--error-border)]",children:[e.jsx("span",{className:"text-sm text-[var(--error-text)]",children:Z}),e.jsx("button",{onClick:()=>re(null),className:"ml-auto text-[var(--error-text)] hover:opacity-70",children:"×"})]}),e.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:T.map(ce=>{const we=v.filter(De=>De.status===ce.status),ke=F!=null&&!ue(ce.status)&&F.status!==ce.status;return e.jsx(Qo,{title:ce.label,count:we.length,color:ce.color,isDragOver:Q===ce.status,isDropDisabled:ke,onDragOver:De=>se(De,ce.status),onDragLeave:ee,onDrop:De=>ae(De,ce.status),children:we.map(Qe)},ce.status)})})]})},Ce=()=>!s||M.length===0?null:e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.FileEdit,{className:"w-5 h-5 text-[var(--warning-text)]"}),e.jsx("h2",{className:"font-semibold",children:i("common:drafts.title","Drafts")}),e.jsx("span",{className:"px-2 py-0.5 text-xs bg-[var(--warning-bg)] text-[var(--warning-text)] rounded-full",children:M.length})]}),e.jsx("button",{onClick:()=>le(!oe),className:"btn btn-ghost text-sm",children:oe?i("common:actions.hide","Hide"):i("common:actions.show","Show")})]}),oe&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:M.map(T=>e.jsx("div",{className:"p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--warning-border)] hover:border-[var(--warning-text)] transition-colors cursor-pointer",onClick:()=>Be(T),children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:T.title||i("common:drafts.untitled","Untitled draft")}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-xs text-[var(--text-secondary)] flex-wrap",children:[T.tenantName&&e.jsx("span",{className:"px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded truncate max-w-[120px]",children:T.tenantName}),T.type&&e.jsx("span",{className:"px-1.5 py-0.5 bg-[var(--bg-tertiary)] rounded",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l.Clock,{className:"w-3 h-3"}),Ke(T.updatedAt)]})]})]}),e.jsx("button",{onClick:ce=>{ce.stopPropagation(),Ne(T.id)},className:"p-1 hover:bg-[var(--error-bg)] rounded text-[var(--text-secondary)] hover:text-[var(--error-text)]",title:i("common:actions.delete","Delete"),children:e.jsx(l.X,{className:"w-4 h-4"})})]})},T.id))})]});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(l.Headphones,{className:"w-6 h-6"}),a]}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:o})]}),!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary flex items-center gap-2",children:[e.jsx(l.Plus,{className:"w-4 h-4"}),i("list.newTicket")]})]}),Me(),Ce(),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("form",{onSubmit:B,className:"flex-1 flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("input",{type:"text",placeholder:i("list.searchPlaceholder"),value:R,onChange:T=>L(T.target.value),className:"input w-full pl-10"})]}),e.jsx("button",{type:"submit",className:"btn btn-secondary",children:i("list.search")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Y(!q),className:`btn ${q?"btn-primary":"btn-secondary"} flex items-center gap-2`,children:[e.jsx(l.Filter,{className:"w-4 h-4"}),i("list.filters")]}),e.jsx(Jo,{viewMode:J,onChange:pe})]})]}),q&&e.jsxs("div",{className:`card p-4 grid grid-cols-1 ${t==="admin"||t==="assigned"?de?"md:grid-cols-4":"md:grid-cols-3":"md:grid-cols-2"} gap-4`,children:[de&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.tenant","Workspace")}),e.jsxs("select",{value:W,onChange:T=>{G(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allTenants","All Workspaces")}),x.filter(T=>T.status==="Active").map(T=>e.jsx("option",{value:T.id,children:T.name},T.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.status")}),e.jsxs("select",{value:I,onChange:T=>{C(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allStatuses")}),e.jsx("option",{value:"Open",children:i("tickets.statuses.Open")}),e.jsx("option",{value:"InProgress",children:i("tickets.statuses.InProgress")}),e.jsx("option",{value:"OnHold",children:i("tickets.statuses.OnHold")}),e.jsx("option",{value:"Resolved",children:i("tickets.statuses.Resolved")}),e.jsx("option",{value:"Closed",children:i("tickets.statuses.Closed")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.type")}),e.jsxs("select",{value:O,onChange:T=>{_(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allTypes")}),e.jsx("option",{value:"Bug",children:i("tickets.types.Bug")}),e.jsx("option",{value:"FeatureRequest",children:i("tickets.types.FeatureRequest")}),e.jsx("option",{value:"ApplicationRequest",children:i("tickets.types.ApplicationRequest")}),e.jsx("option",{value:"Support",children:i("tickets.types.Support")}),e.jsx("option",{value:"Question",children:i("tickets.types.Question")})]})]}),(t==="admin"||t==="assigned")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.priority")}),e.jsxs("select",{value:E,onChange:T=>{z(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allPriorities")}),e.jsx("option",{value:"Low",children:i("tickets.priorities.Low")}),e.jsx("option",{value:"Medium",children:i("tickets.priorities.Medium")}),e.jsx("option",{value:"High",children:i("tickets.priorities.High")}),e.jsx("option",{value:"Critical",children:i("tickets.priorities.Critical")})]})]})]}),b?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-600)]"})}):e.jsxs(e.Fragment,{children:[J==="table"&&Le(),J==="cards"&&Fe(),J==="kanban"&&He()]}),!b&&P>1&&e.jsx(ei,{page:S,totalPages:P,totalCount:A,onPageChange:w})]})}exports.ActivityTimeline=Ql;exports.AdminSidebar=mi;exports.AppHeader=wt;exports.AppLayout=aa;exports.AppSwitcher=Xr;exports.AuthLayout=_o;exports.AuthProvider=xr;exports.Breadcrumb=Vo;exports.CreateTicketButton=ta;exports.DataTable=Xo;exports.DataView=Yo;exports.DocPanelProvider=Kr;exports.DocsLayout=na;exports.DynamicRouter=Xl;exports.EntityCard=si;exports.ErrorFallback=Pr;exports.ExtendablePage=Gn;exports.ExtensionProvider=qr;exports.FavoritesBar=Jl;exports.FavoritesModal=ma;exports.FavoritesProvider=br;exports.FeatureGate=yi;exports.FeatureRouteGuard=fs;exports.Fill=Ur;exports.Footer=gs;exports.GlobalErrorBoundary=Tr;exports.Header=hs;exports.KanbanBoard=ri;exports.LanguageSwitcher=ps;exports.LicenseActivationDialog=ia;exports.LicenseContentBanner=ra;exports.LicenseGuard=ca;exports.LicenseProvider=hr;exports.LicenseStatusBadge=ji;exports.ModuleSidebar=sa;exports.NetworkError=is;exports.NotificationBell=Zr;exports.PAGE_KEYS=Kn;exports.PageHeader=ai;exports.PageRegistry=Te;exports.PermissionMatrix=ni;exports.ProtectedRoute=la;exports.PublicLayout=oa;exports.RouteErrorBoundary=vi;exports.SessionProvider=Rr;exports.SessionWarningModal=Ar;exports.SidebarProvider=jr;exports.SignalRProvider=Sr;exports.SlaBadge=pc;exports.Slot=Or;exports.SlotFillProvider=Fr;exports.SmartStackProvider=Bn;exports.ThemeCustomizer=li;exports.ThemeProvider=ur;exports.ThemeSwitcher=Ot;exports.TicketConversation=pa;exports.TicketDetailView=Nd;exports.TicketSidebar=ha;exports.TicketsListView=Cd;exports.Tooltip=ea;exports.UnderDevelopment=ci;exports.UserSidebar=xi;exports.api=D;exports.apiClient=Ie;exports.authApi=Et;exports.changeLanguage=ls;exports.createSlotFill=Dn;exports.detectDeviceType=da;exports.getClientIpAddress=ua;exports.logService=Pe;exports.useActivePage=zn;exports.useAuth=Ae;exports.useClientContext=Xn;exports.useCollapsibleState=Yn;exports.useDocPanel=Ft;exports.useExtensions=Ct;exports.useFavorites=ze;exports.useFormFieldExtensions=Fn;exports.useHasExtension=On;exports.useLicense=Ge;exports.usePageOverride=Mt;exports.usePageTracking=Ir;exports.usePermissionMatrix=Jn;exports.usePermissionSync=Qn;exports.useRouteConfig=ro;exports.useSessionMonitor=kr;exports.useSidebar=Lt;exports.useSignalR=Hr;exports.useSignalRContext=Cr;exports.useSlotFill=Mr;exports.useSlotHasContent=Ln;exports.useTableColumnExtensions=Mn;exports.useTheme=St;exports.useTicketSignalR=Vr;exports.useUserPermissions=io;exports.userApi=It;exports.withPageOverride=qn;
48
- //# sourceMappingURL=index-C6C5XmVj.cjs.map