@atlashub/smartstack 3.11.0 → 3.15.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
@@ -0,0 +1,48 @@
1
+ "use strict";const e=require("react/jsx-runtime"),n=require("react"),os=require("axios"),ne=require("react-i18next"),jt=require("i18next"),Ma=require("i18next-browser-languagedetector"),N=require("react-router-dom"),Fa=require("@microsoft/signalr"),l=require("lucide-react"),ir=require("react-error-boundary"),$t=require("react-dom"),ws=require("modern-screenshot"),gt=require("react-resizable-panels"),Oa=require("dompurify");function lr(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=lr(Fa),xt=lr(l),Je={none:"0px",small:"4px",medium:"8px",large:"12px",xlarge:"16px",xxlarge:"24px"},Ua={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"}}},_a={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"}}}},is="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(${Ns(s[500])}, 0.15)`,text:s[300],border:`rgba(${Ns(s[500])}, 0.3)`}}};function Ns(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:_a,colors:{light:ut("indigo"),dark:mt("indigo")},accentColorKey:"indigo",itemPaletteKey:is},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"}}],cr="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 ls extends Error{constructor(s="Network error occurred"){super(s),this.name="NetworkError"}}class dr extends Error{code;constructor(s="Authentication required",r){super(s),this.name="AuthenticationError",this.code=r}}class qa extends Error{constructor(s="Access denied"){super(s),this.name="ForbiddenError"}}const za=10;class Ga{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 u=String(a.url),d=a.status?` [${a.status}]`:"";c=`${o}${d} - ${u}`}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 d=String(a.url),x=a.status?` [${a.status}]`:"";c=`${o}${x} - ${d}`}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>za&&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 Te=new Ga;window.onerror=(t,s,r,a,o)=>{Te.logError(o||String(t),"window.onerror",{source:s,lineno:r,colno:a})};window.onunhandledrejection=t=>{Te.logError(t.reason instanceof Error?t.reason:String(t.reason),"unhandledrejection")};const ke=os.create({timeout:3e4,headers:{"Content-Type":"application/json"}});ke.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=>(Te.logError(t,"apiClient.request"),Promise.reject(t)));ke.interceptors.response.use(t=>t,async t=>{const s=t.config?.headers?.["X-Correlation-ID"];if(os.isCancel(t)||t.code==="ERR_CANCELED")return Promise.reject(t);if(!t.response){const i=new ls("Impossible de se connecter au serveur. Vérifiez votre connexion internet.");return Te.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 dr(o,c);Te.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,code:c});const u=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=>u.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 qa(o),u=["/api/administration/tenants/tenant-analytics/track/","/api/support/notifications"],d=t.config?.url||"";return u.some(m=>d.startsWith(m))||Te.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 Te.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 Te.logError(i,"apiClient.response",{correlationId:s,status:r}),Promise.reject(i)}}});const D={get:(t,s)=>ke.get(t,s).then(r=>r.data),post:(t,s,r)=>ke.post(t,s,r).then(a=>a.data),put:(t,s,r)=>ke.put(t,s,r).then(a=>a.data),patch:(t,s,r)=>ke.patch(t,s,r).then(a=>a.data),delete:(t,s)=>ke.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}`)}},Ka=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)}}),Ha=Ka,Va=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}`)}),Wa=Va,Xa=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}`)}),Ya=Xa,Ja=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)}),Qa=Ja,Za=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})}),en=Za,tn=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")}),sn=tn,rn=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")}),an=rn,nn=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`)}),on=nn,ln=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}`)}),cn=ln,dn=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 ke.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}})}),un=dn,mn=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}`)}),xn=mn,pn=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}`)}),hn=pn,gn=t=>({getNavigationLookup:()=>t.get("/api/apis/navigation-lookup")}),fn=gn,bn=t=>{const s=D;return{users:Ha(s),roles:Wa(s),permissions:Ya(s),applications:Qa(s),dashboard:en(s),settings:sn(s),tenants:on(s),templates:cn(s),organisations:un(s),myTenants:xn(s),preferences:an(s),externalApps:hn(s),apiCatalog:fn(s)}},je=bn(),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.":""))))})},ur=async t=>{if(!t)return null;try{const[s,r,a,o,c,i,u,d,x,m,f,p,v,g,y,h,b,j,S,w,E,$,A,k,P,L,I,C,F,W,R,q,V,z]=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:u.default,communications:d.default,entra:x.default,structure:m.default||{},preferences:f.default||{},groups:p.default||{},ba:v.default||{},docsAdministrationUsers:g.default||{},docsAdministrationPermissions:y.default||{},docsAdministrationTenants:h.default||{},docsAdministrationAi:b.default||{},docsAdministrationWorkflows:j.default||{},docsAdministrationEntra:S.default||{},docsAdministrationApplications:w.default||{},docsAdministrationConfiguration:E.default||{},docsAdministrationConfigurationLicense:$.default||{},docsAdministrationTenantsTemplate:A.default||{},docsAdministrationTenantsBusiness:k.default||{},docsAdministrationTenantsPersonal:P.default||{},docsAdministrationTenantsOther:L.default||{},docsAdministrationPermissionsAssignments:I.default||{},docsAdministrationTenantsApplications:C.default||{},docsAdministrationTenantsAccessRequests:F.default||{},docsAdministrationTenantsOrganisations:W.default||{},docsPlatformSupportTickets:R.default||{},docsAdministrationUsersDashboard:q.default||{},docsAdministrationUsersReferences:V.default||{},docsAdministrationUsersGroups:z.default||{}}}catch(s){return console.warn(`Failed to load language: ${t}`,s),null}},vn={},yn=()=>{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"},Qt=yn();jt.use(Ma).use(ne.initReactI18next).init({resources:vn,lng:Qt,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"]}});ur(Qt).then(t=>{t&&Object.entries(t).forEach(([s,r])=>{jt.addResourceBundle(Qt,s,r,!0,!0)})});const cs=async t=>{if(!jt.hasResourceBundle(t,"common")){const s=await ur(t);s&&Object.entries(s).forEach(([r,a])=>{jt.addResourceBundle(t,r,a,!0,!0)})}await jt.changeLanguage(t)},mr=n.createContext(void 0);function jn(){if(typeof window>"u")return yt;try{const s=localStorage.getItem(cr);if(s){const r=JSON.parse(s);return{...yt,...r,borderRadius:{...yt.borderRadius,...r.borderRadius},itemPaletteKey:r.itemPaletteKey||is,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||is,colors:{light:ut(s),dark:mt(s)}}}function wn(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,u])=>{s.style.setProperty(`--color-accent-${i}`,u)}),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 xr({children:t}){const[s,r]=n.useState(jn),[a,o]=n.useState(!1),[c,i]=n.useState(null),[u,d]=n.useState(void 0),[x,m]=n.useState([]),{i18n:f}=ne.useTranslation(),p=n.useRef(null),v=n.useRef(!0),g=n.useRef(!1),y=n.useRef(!1),h=n.useCallback(async(R,q=void 0)=>{if(!localStorage.getItem("token")||y.current)return;let z=null;const J=localStorage.getItem("currentTenantId");if(q===void 0)J?z=J:z=null;else{if(q!==null&&J&&q!==J)return;z=q}try{o(!0),await It.preferences.updateTheme({mode:R.mode,accentColorKey:R.accentColorKey,borderRadius:{card:R.borderRadius.card,button:R.borderRadius.button,badge:R.borderRadius.badge,input:R.borderRadius.input,modal:R.borderRadius.modal,menuItem:R.borderRadius.menuItem},itemPaletteKey:R.itemPaletteKey,targetTenantId:z}),z&&!x.includes(z)&&m(he=>[...he,z])}catch(he){console.error("[ThemeContext] ❌ Failed to save theme to server:",{error:he,targetTenantId:z,mode:R.mode,accentColorKey:R.accentColorKey,localStorage_currentTenantId:localStorage.getItem("currentTenantId"),localStorage_currentTenantSlug:localStorage.getItem("currentTenantSlug")})}finally{o(!1)}},[x]),b=n.useCallback((R,q=void 0)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{h(R,q)},1e3)},[h]);n.useLayoutEffect(()=>{wn(s)},[s]),n.useEffect(()=>{const R={mode:s.mode,borderRadius:s.borderRadius,accentColorKey:s.accentColorKey,itemPaletteKey:s.itemPaletteKey};localStorage.setItem(cr,JSON.stringify(R)),!y.current&&!v.current&&b(s,u),v.current=!1},[s,b,u]),n.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const j=n.useCallback(async R=>{const q=localStorage.getItem("token"),V=localStorage.getItem("currentTenantSlug");if(!q)return;const z=R==="global";if(!(!z&&!V))try{o(!0);const J=z?await je.preferences.getGlobal():await je.preferences.get();i(J.scope);const he=At(J);v.current=!0,r(he),g.current=!0,J.language&&J.language!==f.language&&(cs(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 R=localStorage.getItem("token"),q=localStorage.getItem("currentTenantSlug");if(!(!R||!q))try{o(!0);const V=await je.preferences.applyToTenant();i(V.scope)}catch(V){throw console.error("[ThemeContext] Failed to create tenant-specific preferences:",V),V}finally{o(!1)}},[]),w=n.useCallback(async()=>{const R=localStorage.getItem("token"),q=localStorage.getItem("currentTenantSlug");if(!(!R||!q))try{o(!0);const V=await je.preferences.deleteTenantOverride();i(V.scope);const z=At(V);v.current=!0,r(z)}catch(V){throw console.error("[ThemeContext] Failed to delete tenant-specific preferences:",V),V}finally{o(!1)}},[]),E=n.useCallback(async()=>{if(localStorage.getItem("token"))try{const q=await je.preferences.getThemeOverrides();m(q)}catch(q){console.error("[ThemeContext] Failed to load tenant overrides:",q)}},[]),$=n.useCallback(async(R,q=!1)=>{if(p.current&&(clearTimeout(p.current),p.current=null),y.current=!0,g.current=!0,v.current=!0,d(R),q){y.current=!1;return}if(!localStorage.getItem("token")){y.current=!1;return}try{if(o(!0),R===null){const z=await je.preferences.getGlobal();i(z.scope);const J=At(z);v.current=!0,r(J)}else{const z=await je.preferences.getForTenant(R);i(z.scope);const J=At(z);v.current=!0,r(J)}}catch(z){console.error("[ThemeContext] Failed to load preferences for tenant:",z)}finally{o(!1),y.current=!1}},[]),A=n.useCallback(()=>{r(R=>({...R,mode:R.mode==="light"?"dark":"light",colors:{light:ut(R.accentColorKey),dark:mt(R.accentColorKey)}}))},[]),k=n.useCallback(R=>{r(q=>({...q,mode:R}))},[]),P=n.useCallback((R,q)=>{r(V=>({...V,borderRadius:{...V.borderRadius,[R]:q}}))},[]),L=n.useCallback(R=>{Ue[R]&&r(q=>({...q,accentColorKey:R,colors:{light:ut(R),dark:mt(R)}}))},[]),I=n.useCallback(R=>{dt[R]&&r(q=>({...q,itemPaletteKey:R}))},[]),C=n.useCallback(R=>{r(q=>{const V=R.accentColorKey||q.accentColorKey;return{...q,...R,borderRadius:{...q.borderRadius,...R.borderRadius},accentColorKey:V,itemPaletteKey:R.itemPaletteKey||q.itemPaletteKey,colors:{light:ut(V),dark:mt(V)}}})},[]),F=n.useCallback(()=>{r(yt)},[]),W=n.useCallback(R=>Je[s.borderRadius[R]],[s.borderRadius]);return e.jsx(mr.Provider,{value:{config:s,mode:s.mode,toggleMode:A,setMode:k,setBorderRadius:P,setAccentColor:L,setItemPalette:I,applyPreset:C,resetToDefault:F,getBorderRadius:W,loadFromServer:j,isSyncing:a,scopeInfo:c,applyToTenant:S,resetToGlobal:w,selectedThemeTenant:u,setSelectedThemeTenant:$,tenantOverrides:x,loadTenantOverrides:E},children:t})}function St(){const t=n.useContext(mr);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}let ft=null,st=null;const Nn={async getFeatureConfig(t){return ft||st||(st=(async()=>{try{return ft=(await os.get("/api/config/features",{timeout:1e4,signal:t,headers:{"Content-Type":"application/json"}})).data,ft}finally{st=null}})(),st)},clearCache(){ft=null,st=null}},pr=n.createContext(void 0);function Sn({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(!0);n.useEffect(()=>{const i=new AbortController;return Nn.getFeatureConfig(i.signal).then(u=>{i.signal.aborted||r(u)}).catch(u=>{u.name==="CanceledError"||i.signal.aborted||(console.error("Failed to load feature config:",u),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(pr.Provider,{value:c,children:t})}function ds(){const t=n.useContext(pr);if(!t)throw new Error("useFeatureConfig must be used within FeatureConfigProvider");return t}function us(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 Cn(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 u=i.slice(0,-1);if(a.startsWith(u)||o.startsWith(u))return!0}}return!1}const ms=n.createContext(void 0),rt="token",at="user";function hr({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"},[]),u=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(us(m,x))return!0;return!1},[s]),d=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(ms.Provider,{value:{user:s,isAuthenticated:!!s,isLoading:a,login:c,logout:i,hasPermission:u,refreshPermissions:d},children:t})}function Re(){const t=n.useContext(ms);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function kn(){return n.useContext(ms)??null}const gr=n.createContext(void 0);function fr({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(null),[c,i]=n.useState(!0),[u,d]=n.useState(null),x=n.useRef(null),m=n.useCallback(async g=>{try{i(!0),d(null);const[y,h]=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(h))}catch(y){if(y instanceof Error&&y.name==="CanceledError"||g?.aborted)return;d(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]),p=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 h=await D.post("/api/administration/license/activate",{licenseKey:g,apiKey:y||null});return h.success?(await p(),{success:!0}):{success:!1,error:h.errorMessage||"Activation failed"}}catch(h){return{success:!1,error:h instanceof Error?h.message:"Activation failed"}}},[p]);return e.jsx(gr.Provider,{value:{license:s,usage:a,isLoading:c,error:u,isFeatureEnabled:f,isReadOnlyMode:s?.isReadOnlyMode??!1,refreshLicense:p,activateLicense:v},children:t})}function Ge(){const t=n.useContext(gr);if(t===void 0)throw new Error("useLicense must be used within a LicenseProvider");return t}const br=n.createContext(void 0),Ve="currentTenantId",We="currentTenantSlug",Be="isGlobalView";function An({children:t}){const{isAuthenticated:s,user:r,refreshPermissions:a}=Re(),{isLoading:o}=ds(),[c,i]=n.useState(null),[u,d]=n.useState([]),[x,m]=n.useState(!0),[f,p]=n.useState(null),[v,g]=n.useState(()=>localStorage.getItem(Be)==="true"),y=n.useRef(!1),h=n.useRef(""),b=u.filter(C=>C.type==="Business"),j=u.find(C=>C.type==="Personal")||null,S=n.useCallback((C,F)=>{if(d(C),C.length===0){i(null),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(Be),m(!1);return}const W=localStorage.getItem(Ve),R=W?C.find(J=>J.id===W):null;if(R?.status==="Active"){i(R),g(!1),localStorage.setItem(Ve,R.id),localStorage.setItem(We,R.slug),localStorage.removeItem(Be),m(!1);return}if(localStorage.getItem(Be)==="true"){g(!0),i(null),m(!1);return}const V=C.find(J=>J.isDefault&&J.status==="Active");if(V){i(V),g(!1),localStorage.setItem(Ve,V.id),localStorage.setItem(We,V.slug),localStorage.removeItem(Be),m(!1);return}if(F){g(!0),i(null),localStorage.setItem(Be,"true"),m(!1);return}const z=C.find(J=>J.status==="Active");i(z||null),z&&(localStorage.setItem(Ve,z.id),localStorage.setItem(We,z.slug)),m(!1)},[]),w=n.useCallback(async C=>{const F=u.find(W=>W.id===C);if(!F)throw new Error("Tenant not found");if(F.status!=="Active")throw new Error("Cannot switch to inactive tenant");g(!1),localStorage.removeItem(Be),i(F),localStorage.setItem(Ve,C),localStorage.setItem(We,F.slug),await a()},[u,a]),E=n.useCallback(async()=>{g(!0),localStorage.setItem(Be,"true"),i(null),localStorage.removeItem(Ve),localStorage.removeItem(We),await a()},[a]),$=n.useCallback(async()=>{g(!1),localStorage.removeItem(Be);const C=u.find(R=>R.isDefault&&R.status==="Active"),F=u.find(R=>R.status==="Active"),W=C||F||null;W&&(i(W),localStorage.setItem(Ve,W.id),localStorage.setItem(We,W.slug)),await a()},[u,a]),A=n.useCallback(async C=>{try{await je.myTenants.setDefault(C),d(F=>F.map(R=>({...R,isDefault:R.id===C}))),await w(C)}catch(F){throw console.error("[TenantContext] Failed to set default tenant:",F),F}},[w]),k=n.useCallback(async()=>{try{await je.myTenants.clearDefault(),d(C=>C.map(F=>({...F,isDefault:!1}))),await E()}catch(C){throw console.error("[TenantContext] Failed to clear default tenant:",C),C}},[E]),P=n.useCallback(async()=>{m(!0),p(null);try{await a()}catch(C){console.error("Failed to refresh tenants:",C),p("Failed to refresh tenants")}finally{m(!1)}},[a]);n.useEffect(()=>{if(!s||!r){y.current&&(d([]),i(null),m(!1),y.current=!1,h.current="");return}const C=r.tenants||[],F=C.map(W=>`${W.id}:${W.status}:${W.isDefault}`).sort((W,R)=>W.localeCompare(R)).join(",");if(!y.current||F!==h.current){y.current=!0,h.current=F;const W=Tt(r.permissions||[],r.roles||[]);S(C,W),localStorage.getItem(We)&&a().catch(q=>console.error("[TenantContext] Failed to refresh permissions after tenant init:",q))}},[s,r,S,a]),n.useEffect(()=>{s||(i(null),d([]),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(Be))},[s]);const L=r?Tt(r.permissions||[],r.roles||[]):!1,I={currentTenant:c,userTenants:u,b2bTenants:b,personalTenant:j,isLoading:x||o,error:f,switchTenant:w,setDefaultTenant:A,clearDefaultTenant:k,refreshTenants:P,hasMultipleTenants:u.filter(C=>C.status==="Active").length>1,isCurrentTenantOwner:c?.isOwner??!1,hasGlobalRoles:L,isGlobalView:v,enterGlobalView:E,exitGlobalView:$};return e.jsx(br.Provider,{value:I,children:t})}function $e(){const t=n.useContext(br);if(t===void 0)throw new Error("useTenant must be used within a TenantProvider");return t}const Rt=5,vr=n.createContext(null);function yr({children:t}){const{i18n:s}=ne.useTranslation(),{isAuthenticated:r}=Re(),{currentTenant:a,isLoading:o}=$e(),[c,i]=n.useState([]),[u,d]=n.useState(!1),[x,m]=n.useState(null),[f,p]=n.useState(!1),v=n.useCallback(()=>{p(!0)},[]),g=n.useCallback(()=>{p(!1)},[]),y=n.useCallback(async()=>{try{d(!0),m(null);const k=(await D.get("/api/navigation/module-favorites")).map(P=>({id:P.id,code:P.code,label:P.label,icon:P.icon||"Star",route:P.route||"",applicationId:P.applicationId,applicationCode:P.applicationCode,applicationLabel:P.applicationLabel,displayOrder:P.displayOrder}));i(k)}catch(A){console.error("Failed to load favorite modules:",A),m("Erreur lors du chargement des favoris"),i([])}finally{d(!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 h=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(P=>P.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 h(A),[j,b,h]),w=n.useCallback(async A=>{const k=A.slice(0,Rt),P=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",P),!0}catch(I){return console.error("Failed to reorder favorite modules:",I),i(L),!1}},[c]),E=c.length<Rt;return e.jsx(vr.Provider,{value:{favorites:c,loading:u,error:x,addFavorite:h,removeFavorite:b,toggleFavorite:S,isFavorite:j,reorderFavorites:w,canAddMore:E,maxFavorites:Rt,reload:y,expandFavorites:f,triggerExpand:v,clearExpand:g,requiresTenant:!1},children:t})}function ze(){const t=n.useContext(vr);if(!t)throw new Error("useFavorites must be used within a FavoritesProvider");return t}const jr="smartstack-sidebar-collapsed",wr=n.createContext(void 0);function Rn(){if(typeof window>"u")return!1;try{return localStorage.getItem(jr)==="true"}catch{return!1}}function Nr({children:t}){const[s,r]=n.useState(Rn);n.useEffect(()=>{localStorage.setItem(jr,String(s))},[s]);const a=n.useCallback(()=>{r(i=>!i)},[]),o=n.useCallback(i=>{r(i)},[]),c=s?64:256;return e.jsx(wr.Provider,{value:{isCollapsed:s,toggleCollapsed:a,setCollapsed:o,sidebarWidth:c},children:t})}function Lt(){const t=n.useContext(wr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t}const Pn=["login","callback","logout","onboarding","system","applications"],Sr=n.createContext(void 0);function Tn(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}:Pn.includes(s[0])?{app:null,module:null}:{app:s[0]||null,module:s[1]||null}}function xs({children:t}){const s=N.useLocation(),{i18n:r}=ne.useTranslation(),{currentTenant:a,isLoading:o,isGlobalView:c}=$e(),[i,u]=n.useState(null),[d,x]=n.useState([]),[m,f]=n.useState(!0),p=n.useRef(!1),v=n.useRef(void 0),g=n.useRef(0),{app:y,module:h}=Tn(s.pathname),b=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/menu");u(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(!p.current){p.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,[]),E=n.useCallback((I,C)=>I&&I.split("/").filter(Boolean)[C]||null,[]),$=n.useCallback(()=>i?.applications.find(I=>E(I.route,0)===y||w(I.code)===y),[i,y,E,w]),A=n.useCallback(()=>$()?.modules.find(C=>E(C.route,1)===h||w(C.code)===h),[$,h,E,w]),k=n.useCallback(I=>i?.applications.filter(C=>C.zone===I)||[],[i]),P=n.useCallback(I=>d.some(C=>C.id===I),[d]),L=n.useCallback(async I=>{if(a)try{P(I)?(await D.delete(`/api/navigation/favorites/${I}`),x(C=>C.filter(F=>F.id!==I))):(await D.post(`/api/navigation/favorites/${I}`,{}),await j())}catch(C){console.error("Failed to toggle favorite:",C)}},[a,P,j]);return e.jsx(Sr.Provider,{value:{menu:i,favorites:d,currentAppCode:y,currentModuleCode:h,isLoading:m,getCurrentApplication:$,getCurrentModule:A,getApplicationsByZone:k,getApplicationsForContext:k,toggleFavorite:L,isFavorite:P,refreshMenu:S},children:t})}function Pe(){const t=n.useContext(Sr);if(t===void 0)throw new Error("useNavigation must be used within a NavigationProvider");return t}const Cr=n.createContext(null);function kr({children:t}){const{isAuthenticated:s,refreshPermissions:r}=Re(),{refreshMenu:a}=Pe(),o=n.useRef(null),[c,i]=n.useState(ie.HubConnectionState.Disconnected),u=n.useRef(new Set),d=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(h){console.error("[SignalR] Failed to refresh permissions:",h)}finally{x.current=!1}}},[r,a]),f=n.useCallback(async()=>{const h=localStorage.getItem("token");if(h&&!(o.current?.state===ie.HubConnectionState.Connected||o.current?.state===ie.HubConnectionState.Connecting))try{const b=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>h}).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=>{u.current.forEach(S=>S(j))}),b.on("UnreadCountUpdate",j=>{d.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]),p=n.useCallback(async()=>{if(o.current)try{await o.current.stop(),o.current=null,i(ie.HubConnectionState.Disconnected)}catch(h){console.error("[SignalR] Failed to disconnect:",h)}},[]);n.useEffect(()=>(s?f():p(),()=>{p()}),[s,f,p]);const v=n.useCallback(h=>(u.current.add(h),()=>{u.current.delete(h)}),[]),g=n.useCallback(h=>(d.current.add(h),()=>{d.current.delete(h)}),[]),y={isConnected:c===ie.HubConnectionState.Connected,connectionState:c,onNotification:v,onUnreadCountUpdate:g};return e.jsx(Cr.Provider,{value:y,children:t})}function Ar(){const t=n.useContext(Cr);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 Rr(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}),[u,d]=n.useState(!1),x=n.useRef(!1),m=n.useRef(null),f=n.useRef(null),p=n.useCallback(async g=>{if(!o)return;if(!localStorage.getItem("token")){i(h=>({...h,isActive:!1}));return}try{const h=await Et.getSessionInfo({signal:g});if(g?.aborted)return;const b=Math.min(h.timeUntilIdleExpirySeconds,h.timeUntilAbsoluteExpirySeconds);i({isActive:!0,timeRemainingSeconds:b,isWarning:h.isWarningThreshold,sessionInfo:h}),h.isWarningThreshold&&!x.current&&(x.current=!0,a?.()),h.isWarningThreshold||(x.current=!1)}catch(h){if(h instanceof Error&&h.name==="CanceledError"||g?.aborted)return;i(b=>({...b,isActive:!1})),r?.()}},[o,r,a]),v=n.useCallback(async()=>{if(u)return!1;d(!0);try{return await Et.refreshSession(),x.current=!1,await p(),!0}catch{return i(g=>({...g,isActive:!1})),!1}finally{d(!1)}},[u,p]);return n.useEffect(()=>{if(!o)return;f.current?.abort();const g=new AbortController;return f.current=g,p(g.signal),m.current=setInterval(()=>p(),s),()=>{g.abort(),m.current&&clearInterval(m.current)}},[o,s,p]),n.useEffect(()=>{if(!o)return;const g=()=>{c.isWarning&&p()},y=["mousedown","keydown","touchstart","scroll"];return y.forEach(h=>{window.addEventListener(h,g,{passive:!0})}),()=>{y.forEach(h=>{window.removeEventListener(h,g)})}},[o,c.isWarning,p]),{...c,isRefreshing:u,refreshSession:v,checkSession:p}}function En(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 Pr({isOpen:t,timeRemainingSeconds:s,onExtendSession:r,onLogout:a}){const{t:o}=ne.useTranslation("common"),[c,i]=n.useState(!1),[u,d]=n.useState(s);n.useEffect(()=>{d(s)},[s]),n.useEffect(()=>{if(!t||u<=0)return;const f=setInterval(()=>{d(p=>p<=1?(a(),0):p-1)},1e3);return()=>clearInterval(f)},[t,u,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,u/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:En(u)}),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 $n=n.createContext(void 0);function Tr({children:t}){const{isAuthenticated:s,logout:r}=Re(),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:u}=Rr({enabled:s,checkIntervalMs:3e4,onSessionExpired:a}),d=n.useCallback(async()=>{try{await Et.logout()}finally{r()}},[r]),x=n.useCallback(async()=>await u(),[u]);return e.jsxs($n.Provider,{value:{isSessionActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:u},children:[t,e.jsx(Pr,{isOpen:i&&s,timeRemainingSeconds:c,onExtendSession:x,onLogout:d})]})}const In=150;function Ln({children:t}){const s=kn(),r=s?.isAuthenticated??!1,a=s?.isLoading??!0,{currentTenant:o,isLoading:c,isGlobalView:i}=$e(),{setSelectedThemeTenant:u,loadFromServer:d}=St(),x=n.useRef(null),m=n.useRef(!1),f=n.useRef(null),p=n.useRef(null),v=n.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),g=n.useCallback(()=>x.current==="global"?!1:(v(),p.current=null,x.current="global",m.current=!0,d("global"),u(null,!0),!0),[v,d,u]),y=n.useCallback((j,S)=>{p.current=j,f.current=setTimeout(()=>{p.current===j&&(x.current=j,m.current=!0,p.current=null,u(j,!1)),f.current=null},In)},[u]),h=n.useCallback(()=>{if(!o)return;const j=o.id!==x.current,S=p.current!==null&&p.current!==o.id;!j&&!S||(v(),j?y(o.id,o.slug):p.current=null)},[o,v,y]),b=n.useCallback(()=>{v(),x.current=null,p.current=null,m.current=!1},[v]);return n.useEffect(()=>{if(!r){b();return}if(!(a||c)){if(i&&!o){g();return}o&&h()}},[r,a,c,o,i,g,h,b]),n.useEffect(()=>()=>{v()},[v]),e.jsx(e.Fragment,{children:t})}function Dn(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 Mn(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const Fn={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 Er({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>Mn()),i=Dn(t),u=Fn[i],d=u.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 ${u.bgColor} flex items-center justify-center mb-6`,children:e.jsx(d,{className:`w-8 h-8 ${u.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 On(t,s){Te.logCritical(t,"GlobalErrorBoundary",{componentStack:s.componentStack})}function Un(){window.location.reload()}function $r({children:t}){return e.jsx(ir.ErrorBoundary,{FallbackComponent:Er,onError:On,onReset:Un,children:t})}const ps="/api/myspace/application-tracking",_n="00000000-0000-0000-0000-000000000000",Ss=t=>!!t&&t!==_n,Ir=t=>{const s=/^\/t\/[^/]+(\/.*)$/.exec(t);return s?s[1]:t},Bn=t=>{const s=Ir(t);return s.startsWith("/administration/")||s.startsWith("/support/")||s.startsWith("/myspace/")},Lr=(t,s)=>{if(!t||typeof t!="object"||!("status"in t))return!0;const r=t.status;return!s.includes(r??-1)},qn=async(t,s)=>{const r=new Date,a=Math.floor((r.getTime()-s.getTime())/1e3);try{await D.post(`${ps}/end`,{accessId:t,endedAt:r.toISOString(),durationSeconds:a})}catch(o){Lr(o,[401,408])&&console.error("Failed to end page tracking:",o)}},zn=async t=>{const s=new Date;try{return(await D.post(`${ps}/start`,{route:t,accessedAt:s.toISOString()})).accessId}catch(r){return Lr(r,[401])&&console.error("Failed to track page access:",r),null}},Gn=(t,s)=>{const r=localStorage.getItem("token");if(!r)return;const a=new Date,o=Math.floor((a.getTime()-s.getTime())/1e3);fetch(`${ps}/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 Dr(){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=Ir(t.pathname);Bn(c)&&(a.current=!0,Ss(r.current)&&await qn(r.current,s.current),s.current=new Date,r.current=await zn(c),a.current=!1)})(),()=>{Ss(r.current)&&Gn(r.current,s.current)}),[t.pathname])}function Kn(){return Dr(),null}function Mr(){return N.useInRouterContext()?e.jsx(Kn,{}):null}const bt="/api/administration/tenants/tenant-analytics",Cs={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})}},Hn="/api/administration/tenants/tenant-analytics";function Vn(){const{currentTenant:t}=$e(),{isAuthenticated:s}=Re(),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 Cs.trackEnd(r.current)}catch{}r.current=null}if(a.current=i,i)try{const d=await Cs.trackStart(i);r.current=d.accessId}catch{r.current=null}o.current=!1})(),()=>{if(r.current){const d=localStorage.getItem("token");if(!d)return;fetch(`${Hn}/track/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify({accessId:r.current}),keepalive:!0}).catch(()=>{}),r.current=null,a.current=null}})},[t?.id,s])}function Fr(){return Vn(),null}const Dt=n.createContext(null);function Or(){const t=n.useContext(Dt);if(!t)throw new Error("useSlotFill must be used within a SlotFillProvider");return t}function Ur({children:t,initialFills:s}){const r=n.useMemo(()=>{const o=new Map;return s&&Object.entries(s).forEach(([c,i])=>{const u=o.get(c)||[];Array.isArray(i)?o.set(c,[...u,...i]):o.set(c,[...u,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(u=>u!==c))},getSlotContent:o=>r.get(o)||[]}),[r]);return e.jsx(Dt.Provider,{value:a,children:t})}function _r({name:t,context:s={},children:r,fallback:a,wrapper:o}){const i=n.useContext(Dt)?.getSlotContent(t)||[],u=n.useMemo(()=>({slotName:t,context:s}),[t,s]),d=n.useMemo(()=>i.length===0?a||null:i.map((m,f)=>{const p=`${t}-${f}`;return e.jsx(n.Fragment,{children:qr(m,u)},p)}),[i,t,u,a]),x=e.jsxs(e.Fragment,{children:[d,r]});return o?e.jsx(o,{children:x}):e.jsx(e.Fragment,{children:x})}function Br({slot:t,children:s}){const{registerFill:r,unregisterFill:a}=Or();return n.useMemo(()=>(r(t,s),()=>a(t,s)),[t,s,r,a]),null}function qr(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:qr(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 Wn(t){return(n.useContext(Dt)?.getSlotContent(t)?.length||0)>0}function Xn(t){function s(a){return e.jsx(_r,{...a,name:t})}s.displayName=`Slot(${t})`;function r({children:a}){return e.jsx(Br,{slot:t,children:a})}return r.displayName=`Fill(${t})`,{Slot:s,Fill:r,slotName:t}}const zr=n.createContext(null);function Ct(){const t=n.useContext(zr);return t||{config:{},getPage:()=>{},getSlotContent:()=>{},getTableColumns:()=>[],getFormFields:()=>[],hasExtension:()=>!1}}function Mt(t){const{getPage:s}=Ct();return s(t)}function Yn(t){const{getTableColumns:s}=Ct();return s(t)}function Jn(t){const{getFormFields:s}=Ct();return s(t)}function Qn(t){const{hasExtension:s}=Ct();return s(t)}function Gr({config:t={},children:s}){const r=n.useMemo(()=>{const{pages:a={},slots:o={},tableColumns:c={},formFields:i={}}=t;return{config:t,getPage:u=>a[u],getSlotContent:u=>o[u],getTableColumns:u=>c[u]||[],getFormFields:u=>i[u]||[],hasExtension:u=>u in a||u in o||u in c||u in i}},[t]);return e.jsx(zr.Provider,{value:r,children:e.jsx(Ur,{initialFills:t.slots,children:s})})}const Zn=n.createContext(null);function eo({config:t,children:s}){typeof window<"u"&&(window.__SMARTSTACK_CONFIG__=t);const r=n.useMemo(()=>({config:t}),[t]);return e.jsx(Zn.Provider,{value:r,children:e.jsx($r,{children:e.jsx(Gr,{config:t.extensions,children:e.jsx(xr,{children:e.jsx(Sn,{children:e.jsx(hr,{children:e.jsx(fr,{children:e.jsx(An,{children:e.jsx(xs,{children:e.jsx(kr,{children:e.jsx(yr,{children:e.jsx(Nr,{children:e.jsx(Tr,{children:e.jsxs(Ln,{children:[e.jsx(Mr,{}),e.jsx(Fr,{}),s]})})})})})})})})})})})})})})}class to{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 Ee=new to;function so(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 ro(t){const s=Mt(t),r=Ee.get(t);return s||r?.defaultComponent}function ao({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 no={ADMIN_INDEX:"administration",ADMIN_DASHBOARD:"administration.dashboard",USERS_LIST:"administration.users.list",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"},Kr="smartstack-doc-panel-size",Hr=n.createContext(void 0);function oo(){if(typeof window>"u")return 33;try{const t=localStorage.getItem(Kr);if(t){const s=parseFloat(t);if(s>=20&&s<=60)return s}}catch{}return 33}const ks={"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"},As={administration:"/docs/business/administration/users",support:"/system/docs/user/support-dashboard",myspace:"/system/docs/user/modules"};function Rs(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 u=i.length;u>0;u--){const d=`${c}/${i.slice(0,u).join("/")}`;if(ks[d])return ks[d]}return c&&As[c]?As[c]:"/system/docs/user"}function Vr({children:t}){const[s,r]=n.useState(!1),[a,o]=n.useState(oo),[c,i]=n.useState(null),u=N.useLocation(),d=n.useRef(u.pathname);n.useEffect(()=>{d.current!==u.pathname&&(d.current=u.pathname,r(!1))},[u.pathname]),n.useEffect(()=>{a>=20&&a<=60&&localStorage.setItem(Kr,String(a))},[a]);const x=n.useCallback(v=>{const g=v||Rs(u.pathname);i(g),r(!0)},[u.pathname]),m=n.useCallback(()=>{r(!1)},[]),f=n.useCallback(()=>{if(s)r(!1);else{const v=Rs(u.pathname);i(v),r(!0)}},[s,u.pathname]),p=n.useCallback(v=>{v>=20&&v<=60&&o(v)},[]);return e.jsx(Hr.Provider,{value:{isOpen:s,panelSize:a,docUrl:c,openDocPanel:x,closeDocPanel:m,toggleDocPanel:f,setPanelSize:p},children:t})}function Ft(){const t=n.useContext(Hr);if(t===void 0)throw new Error("useDocPanel must be used within a DocPanelProvider");return t}class io{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=/Firefox\/(\d+(?:\.\d+)*)/.exec(s):s.includes("Edg/")?r=/Edg\/(\d+(?:\.\d+)*)/.exec(s):s.includes("Chrome")&&!s.includes("Edg/")?r=/Chrome\/(\d+(?:\.\d+)*)/.exec(s):s.includes("Safari")&&!s.includes("Chrome")?r=/Version\/(\d+(?:\.\d+)*)/.exec(s):s.includes("OPR/")&&(r=/OPR\/(\d+(?:\.\d+)*)/.exec(s)),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=/Windows NT (\d+\.\d+)/.exec(s);if(r)return this.getWindowsVersion(r[1])}if(s.includes("Mac OS X")){const r=/Mac OS X (\d+[._]\d+(?:[._]\d+)?)/.exec(s);if(r)return r[1].replace(/_/g,".")}if(s.includes("Android")){const r=/Android (\d+(?:\.\d+)*)/.exec(s);if(r)return r[1]}if(s.includes("iPhone OS")||s.includes("iPad")){const r=/(?:iPhone|iPad|CPU) OS (\d+[._]\d+(?:[._]\d+)?)/.exec(s);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 lo=new io;function co(){return{captureContext:n.useCallback(()=>{const s=lo.captureBrowserInfo(),r=Te.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 uo(){const[t,s]=n.useState(new Set),[r,a]=n.useState(new Set),o=n.useCallback(m=>{s(f=>{const p=new Set(f);return p.has(m)?p.delete(m):p.add(m),p})},[]),c=n.useCallback(m=>{a(f=>{const p=new Set(f);return p.has(m)?p.delete(m):p.add(m),p})},[]),i=n.useCallback(()=>{s(new Set),a(new Set)},[]),u=n.useCallback((m,f)=>{s(new Set(m)),a(new Set(f))},[]),d=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:u,isContextCollapsed:d,isAppCollapsed:x}}function mo(t={}){const{canEditSystemRoles:s=!1}=t,{t:r,i18n:a}=ne.useTranslation("admin"),[o,c]=n.useState(!0),[i,u]=n.useState(null),[d,x]=n.useState(null),[m,f]=n.useState(!1),[p,v]=n.useState(!1),[g,y]=n.useState([]),[h,b]=n.useState([]),[j,S]=n.useState(new Map),[w,E]=n.useState({}),[$,A]=n.useState({}),[k,P]=n.useState({}),[L,I]=n.useState({selectedRoleIds:[],resourceSearch:"",applicationFilter:"all",moduleFilter:"all",categoryFilter:"all"}),C=n.useRef(null),F=n.useRef(new Map),W=n.useCallback((_,K,X)=>{const se=_.has(X),ee=K.get(X);if(!ee)return{isDirect:se,isInherited:!1};const ue=ee.path.toLowerCase();let ae,ve,be=1/0;for(const De of Array.from(_)){const Le=K.get(De);if(!Le||De===X)continue;const Fe=Le.path.toLowerCase();if((Le.isWildcard||Fe.endsWith(".*"))&&us(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}},[]),R=n.useCallback((_,K)=>{const X={};return Object.entries(_).forEach(([se,ee])=>{const ue=new Map;K.forEach((ae,ve)=>{const be=W(ee,K,ve);ue.set(ve,be)}),X[se]=ue}),X},[W]),q=(_,K,X,se)=>{const ee=[],ue=[];return _.resources.forEach(ae=>{const ve=ae.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),be=se.get(ve)||[],Ie={id:ae.id,path:ae.permissionPath,label:ae.label,applicationLabel:X.label,moduleLabel:ae.label,parentModuleLabel:K.label,parentModuleId:K.id,parentSectionLabel:_.label,parentSectionId:_.id,level:"resource",permissions:be,totalPermissions:be.length};ee.push(Ie),ue.push(Ie)}),{childResources:ee,nodes:ue}},V=(_,K,X)=>{const se=[],ee=[];return _.sections.forEach(ue=>{const ae=ue.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ve=X.get(ae)||[],{childResources:be,nodes:Ie}=q(ue,_,K,X),De=be.reduce((Qe,He)=>Qe+He.totalPermissions,0),Le=ve.length+De,Fe={id:ue.id,path:ue.permissionPath,label:ue.label,applicationLabel:K.label,moduleLabel:ue.label,parentModuleLabel:_.label,parentModuleId:_.id,level:"section",permissions:ve,totalPermissions:Le,childResources:be.length>0?be:void 0};se.push(Fe),ee.push(Fe),ee.push(...Ie)}),{childSections:se,nodes:ee}},z=(_,K,X,se)=>{const ee=_.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ue=X.get(ee)||[],{childSections:ae,nodes:ve}=V(_,K,X),be=ae.reduce((De,Le)=>De+Le.totalPermissions,0),Ie=ue.length+be;se.push({id:_.id,path:_.permissionPath,label:_.label,applicationLabel:K.label,moduleLabel:_.label,level:"module",permissions:ue,totalPermissions:Ie,childSections:ae.length>0?ae:void 0}),se.push(...ve)},J=(_,K,X)=>{_.modules.forEach(se=>{z(se,_,K,X)})},he=n.useCallback((_,K)=>{const X=[];if(!_||!_.applications||!K||!Array.isArray(K))return X;const se=new Map;return K.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.at(-1),path:ee.path}),se.set(ve,be)}}),_.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)})},[]),B=n.useCallback(async()=>{try{c(!0),u(null);const _=await je.permissions.getMatrix(),K={};_.roles.forEach(ae=>{K[ae.id]=new Set(ae.permissionIds)});const X=new Map(_.permissions.map(ae=>[ae.id,ae])),se=he(_.tree,_.permissions),ee=R(K,X);y(_.roles),b(se),S(X),E(K),P(ee);const ue=Object.entries(K).reduce((ae,[ve,be])=>(ae[ve]=new Set(Array.from(be)),ae),{});A(ue),F.current.clear()}catch(_){u(_ instanceof Error?_.message:"Failed to load permission matrix data")}finally{c(!1)}},[he,R]);n.useEffect(()=>{B()},[B,a.language]),n.useEffect(()=>{if(j.size>0){const _=R(w,j);P(_)}},[w,j,R]);const Y=n.useCallback(async()=>{if(F.current.size===0)return;const _=new Map(F.current);F.current.clear(),f(!0),x(null);try{const K=Array.from(_.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(K);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(K){console.error("Failed to save permission changes:",K);let X="Failed to save changes";if(K&&typeof K=="object"&&"response"in K){const se=K.response;se?.status===403?X=r("assignments.noPermissionToEditRole"):se?.data?.message&&(X=se.data.message)}else K instanceof Error&&(X=K.message);x(X),await B()}finally{f(!1)}},[g,w,B]),M=n.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{Y()},500)},[Y]),te=n.useCallback((_,K)=>{g.find(se=>se.id===_)?.isSystem&&!s||E(se=>{const ee=new Set(se[_]||[]);return ee.has(K)?ee.delete(K):ee.add(K),F.current.set(_,ee),M(),{...se,[_]:ee}})},[g,s,M]),oe=_=>{h.forEach(K=>{K.permissions.forEach(X=>{_.add(X.id)})})},le=n.useCallback((_,K)=>{g.find(se=>se.id===_)?.isSystem&&!s||E(se=>{const ee=new Set;return K&&oe(ee),F.current.set(_,ee),M(),{...se,[_]:ee}})},[g,s,h,M]),O=(_,K,X)=>{K.permissions.forEach(se=>{X?_.add(se.id):_.delete(se.id)})},G=n.useCallback((_,K)=>{E(X=>{const se={...X};return g.forEach(ee=>{if(ee.isSystem&&!s)return;const ue=new Set(se[ee.id]||[]);O(ue,_,K),se[ee.id]=ue,F.current.set(ee.id,ue)}),M(),se})},[g,s,M]),Q=n.useCallback(_=>{I(K=>({...K,..._}))},[]),U=n.useCallback(()=>{const _=Object.entries($).reduce((K,[X,se])=>(K[X]=new Set(Array.from(se)),K),{});E(_),F.current.clear(),C.current&&clearTimeout(C.current)},[$]),Z=n.useMemo(()=>g.filter(_=>L.selectedRoleIds.length===0?!0:L.selectedRoleIds.includes(_.id)),[g,L.selectedRoleIds]),re=n.useMemo(()=>h.filter(_=>!(L.resourceSearch&&!_.moduleLabel.toLowerCase().includes(L.resourceSearch.toLowerCase())||L.applicationFilter!=="all"&&_.applicationLabel!==L.applicationFilter||L.moduleFilter!=="all"&&_.moduleLabel!==L.moduleFilter)),[h,L]),de=n.useMemo(()=>Array.from(Object.entries(w)).some(([_,K])=>{const X=$[_];return X?K.size!==X.size?!0:Array.from(K).some(se=>!X.has(se)):K.size>0}),[w,$]),pe=n.useMemo(()=>{const _=new Map;return h.forEach(K=>{_.has(K.applicationLabel)||_.set(K.applicationLabel,{app:K.applicationLabel,label:K.applicationLabel})}),Array.from(_.values()).sort((K,X)=>K.label.localeCompare(X.label))},[h]),fe=n.useMemo(()=>h.filter(_=>_.level==="module").map(_=>({app:_.applicationLabel,module:_.label,label:_.label})).sort((_,K)=>_.label.localeCompare(K.label)),[h]),Ne=n.useMemo(()=>{const _=new Set(g.map(X=>X.category));return["Global","Admin","Manager","Contributor","Viewer","Custom"].filter(X=>_.has(X))},[g]),_e=n.useCallback((_,K)=>{const X=k[_];return X?X.get(K)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[k]),Ke=n.useCallback(()=>{x(null)},[]);return{loading:o,error:i,saveError:d,saving:m,saveSuccess:p,roles:g,resources:h,permissions:j,assignments:w,inheritanceMap:k,filters:L,filteredRoles:Z,filteredResources:re,hasChanges:de,canEditSystemRoles:s,applications:pe,modules:fe,categories:Ne,togglePermission:te,toggleAllForRole:le,toggleAllForResource:G,updateFilters:Q,reloadData:B,resetChanges:U,saveChanges:Y,clearSaveError:Ke,getPermissionInheritance:_e}}function Wr(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 d=c();if(d&&s.current?.state!==ie.HubConnectionState.Connected)try{const x=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>d}).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]),u=n.useCallback(async()=>{if(s.current)try{await s.current.stop(),s.current=null,a(ie.HubConnectionState.Disconnected)}catch(d){console.error("SignalR: Failed to disconnect",d)}},[]);return n.useEffect(()=>(i(),()=>{u()}),[i,u]),n.useEffect(()=>{const d=x=>{x.key==="token"&&(x.newValue?i():u())};return window.addEventListener("storage",d),()=>window.removeEventListener("storage",d)},[i,u]),{connectionState:r,isConnected:r===ie.HubConnectionState.Connected,connect:i,disconnect:u}}function xo(){const{refreshPermissions:t,user:s}=Re(),{refreshMenu:r}=Pe(),a=n.useRef(!1),o=n.useCallback(async()=>{if(!a.current){a.current=!0;try{await Promise.all([t(),r()])}catch(u){console.error("[PermissionSync] Failed to refresh permissions:",u)}finally{a.current=!1}}},[t,r]),{isConnected:c,connectionState:i}=Wr({onPermissionsChanged:o});return{isConnected:c,connectionState:i,isAuthenticated:!!s}}function Xr(t){const{ticketId:s,onCommentAdded:r,onTicketUpdated:a,onConnectionStateChange:o}=t,c=n.useRef(null),i=n.useRef(null),[u,d]=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},[]),p=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:h=>h.previousRetryCount===0?0:h.previousRetryCount===1?2e3:h.previousRetryCount===2?1e4:h.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();return y.on("TicketCommentAdded",h=>{r?.(h)}),y.on("TicketUpdated",h=>{a?.(h)}),y.onreconnecting(()=>{d(ie.HubConnectionState.Reconnecting),o?.(ie.HubConnectionState.Reconnecting)}),y.onreconnected(async()=>{d(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),i.current&&await m(i.current)}),y.onclose(()=>{d(ie.HubConnectionState.Disconnected),o?.(ie.HubConnectionState.Disconnected)}),await y.start(),c.current=y,d(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),y}catch(y){return console.error("SignalR: Failed to connect",y),d(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,d(ie.HubConnectionState.Disconnected)}catch(g){console.error("SignalR: Failed to disconnect",g)}},[f]);return n.useEffect(()=>{let g=!0;return(async()=>(await p(),g&&s&&await m(s)))(),()=>{g=!1,v()}},[p,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:u,isConnected:u===ie.HubConnectionState.Connected,joinTicket:m,leaveTicket:f}}function po(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:Ee.has(c.componentKey),requiredFeature:r,isOpen:s,level:"resource",applicationCode:t});return o}function ho(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:Ee.has(c.componentKey),requiredFeature:r,isOpen:s,level:"section",applicationCode:t}),o.push(...po(t,s,r,c));return o}function go(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:Ee.has(o.componentKey),requiredFeature:o.requiredFeature,isOpen:s,level:"module",applicationCode:t}),a.push(...ho(t,s,o.requiredFeature,o));return a}function fo(t){const s=[];for(const r of t)r.route&&s.push({componentKey:r.componentKey,permissionPath:r.permissionPath,route:r.route,hasComponent:Ee.has(r.componentKey),requiredFeature:r.requiredFeature,isOpen:r.isOpen,level:"application",applicationCode:r.code}),s.push(...go(r.code,r.isOpen,r));return s}function bo(){const{menu:t,isLoading:s}=Pe();return n.useMemo(()=>{if(!t||s)return{entries:[],byKey:new Map,isLoading:!0,byApplication:new Map};const r=fo(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 vo=(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,u,d=1/0;for(const m of Array.from(t)){const f=s.get(m);if(!(!f||!f.isWildcard||m===r)&&us(f.path,c)){const p=f.path.split(".").length;p<d&&(d=p,i=f.path,u=f.id)}}return{isDirect:a,isInherited:i!==void 0,inheritedFromPath:i,inheritedFromId:u}},Ps=(t,s)=>{const r={};return Object.entries(t).forEach(([a,o])=>{const c=new Map;s.forEach((i,u)=>{const d=vo(o,s,u);c.set(u,d)}),r[a]=c}),r},yo=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.at(-1),path:r.path}),s.set(c,i)}}),s},_t=(t,s)=>{const r=s.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,"");return t.get(r)||[]};function jo(t){const{entityId:s,tenantId:r,loadEntity:a,loadRoles:o}=t,{i18n:c}=ne.useTranslation(),[i,u]=n.useState(!0),[d,x]=n.useState(null),[m,f]=n.useState(null),[p,v]=n.useState([]),[g,y]=n.useState([]),[h,b]=n.useState(new Map),[j,S]=n.useState({}),[w,E]=n.useState({}),[$,A]=n.useState({selectedRoleIds:[],resourceSearch:"",contextFilter:"all",applicationFilter:"all",moduleFilter:"all"}),k=!!r,P=n.useCallback((O,G,Q,U)=>{const Z=_t(U,G.permissionPath);O.push({id:G.id,path:G.permissionPath,label:G.label,contextLabel:Q.label,applicationLabel:Q.label,moduleLabel:G.label,level:"module",permissions:Z,totalPermissions:Z.length})},[]),L=n.useCallback((O,G,Q,U,Z)=>{const re=_t(Z,G.permissionPath);G.resources.forEach(de=>{const pe=_t(Z,de.permissionPath);O.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:G.label,parentSectionId:G.id,level:"resource",permissions:pe,totalPermissions:pe.length})}),O.push({id:G.id,path:G.permissionPath,label:G.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((O,G,Q,U)=>{P(U,O,G,Q),O.sections.forEach(Z=>{L(U,Z,O,G,Q)})},[P,L]),C=n.useCallback((O,G,Q)=>{O.modules.forEach(U=>{I(U,O,G,Q)})},[I]),F=n.useCallback((O,G)=>{if(!O?.applications||!Array.isArray(G))return[];const Q=yo(G),U=[];return O.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]),W=n.useCallback(async()=>{try{u(!0),x(null);const[O,G,Q]=await Promise.all([a(s),o(s,r),je.permissions.getMatrix()]);f(O),v(G);const U=new Set(G.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])),pe=F(Q.tree,Q.permissions),fe=Ps(re,de);y(pe),b(de),S(re),E(fe)}catch(O){x(O instanceof Error?O.message:"Failed to load permissions data")}finally{u(!1)}},[s,r,a,o,F]);n.useEffect(()=>{W()},[W,c.language]),n.useEffect(()=>{if(h.size>0){const O=Ps(j,h);E(O)}},[j,h]);const R=n.useMemo(()=>{const O=new Set;return Object.entries(w).forEach(([G,Q])=>{Q.forEach((U,Z)=>{(U.isDirect||U.isInherited)&&O.add(Z)})}),O},[w]),q=O=>$.resourceSearch?O.label.toLowerCase().includes($.resourceSearch.toLowerCase()):!0,V=O=>$.contextFilter==="all"?!0:O.contextLabel===$.contextFilter,z=O=>$.applicationFilter==="all"?!0:O.applicationLabel===$.applicationFilter,J=O=>$.moduleFilter==="all"?!0:O.level==="module"?O.label===$.moduleFilter:O.parentModuleLabel===$.moduleFilter,he=n.useMemo(()=>g.filter(O=>q(O)&&V(O)&&z(O)&&J(O)),[g,$]),B=n.useMemo(()=>{const O=new Set(g.map(G=>G.contextLabel??G.applicationLabel));return Array.from(O).sort((G,Q)=>G.localeCompare(Q))},[g]),Y=n.useMemo(()=>{const O=new Map;return g.forEach(G=>{const Q=G.contextLabel??G.applicationLabel,U=`${Q}:${G.applicationLabel}`;O.has(U)||O.set(U,{context:Q,app:G.applicationLabel,label:G.applicationLabel})}),Array.from(O.values()).sort((G,Q)=>G.label.localeCompare(Q.label))},[g]),M=n.useMemo(()=>g.filter(O=>O.level==="module").map(O=>({context:O.contextLabel??O.applicationLabel,app:O.applicationLabel,module:O.label,label:O.label})).sort((O,G)=>O.label.localeCompare(G.label)),[g]),te=n.useCallback(O=>{A(G=>({...G,...O}))},[]),oe=n.useCallback((O,G)=>{const Q=w[O];return Q?Q.get(G)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[w]),le=n.useCallback(O=>{const G=[];return p.forEach(Q=>{const U=w[Q.id];if(U){const Z=U.get(O);Z&&(Z.isDirect||Z.isInherited)&&G.push(Q)}}),G},[p,w]);return{loading:i,error:d,entity:m,roles:p,resources:g,assignments:j,inheritanceMap:w,effectivePermissions:R,filters:$,filteredResources:he,contexts:B,applications:Y,modules:M,updateFilters:te,getPermissionInheritance:oe,getPermissionSources:le,reloadData:W,isTenantMode:k}}function wo(t){const{userId:s,tenantId:r}=t,[a,o]=n.useState(null),[c,i]=n.useState([]),u=!!r,d=n.useCallback(async y=>je.users.getById(y),[]),x=n.useCallback(async(y,h)=>{const b=await je.users.getById(y);let j=[];try{const w=await je.users.getConsolidatedRoles(y,h);if(i(w),j=w.map(E=>({id:E.roleId,name:E.roleName,shortName:E.roleShortName||E.roleName,category:"Custom",description:null})),h)try{const $=(await je.tenants.getMembers(h)).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=jo({entityId:s,tenantId:r,loadEntity:d,loadRoles:x}),f=m.entity,p=m.roles,v=n.useCallback(y=>{const h=[];return p.forEach(b=>{const j=m.inheritanceMap[b.id];if(j){const S=j.get(y);S&&(S.isDirect||S.isInherited)&&h.push(b)}}),h},[p,m.inheritanceMap]),g=n.useCallback(async y=>{if(!u||!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()},[u,r,a,m]);return{loading:m.loading,error:m.error,user:f,userRoles:p,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:u,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 hs(){const{i18n:t}=ne.useTranslation(),{isAuthenticated:s}=Re(),[r,a]=n.useState(!1),o=n.useRef(null),c=t.language?.split("-")[0]||"en",i=Bt.find(d=>d.code===c)||Bt[0],u=async d=>{if(await cs(d),document.documentElement.lang=d,a(!1),s)try{await It.preferences.updateLanguage({language:d})}catch{}};return n.useEffect(()=>{const d=x=>{o.current&&!o.current.contains(x.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]),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(d=>{const x=d.code===c;return e.jsxs("button",{onClick:()=>u(d.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:d.short}),e.jsx("span",{className:"text-sm font-medium",children:d.label}),x&&e.jsx(l.Check,{className:"w-4 h-4 ml-auto text-primary-500"})]},d.code)})})]})}function No(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 Ts(t){const s=/^\/t\/([^/]+)/.exec(t);return s?s[1]:null}function ct(t){return t.replace(/^\/t\/[^/]+/,"")||"/"}function et(){const{currentTenant:t}=$e(),{useUrlRouting:s}=ds();return n.useCallback(r=>No(r,{slug:t?.slug,useUrlRouting:s}),[t?.slug,s])}const Es={background:"linear-gradient(to bottom right, var(--color-accent-500), var(--color-accent-600))"};function Yr(){const{t}=ne.useTranslation("navigation"),{user:s,logout:r}=Re(),{refreshMenu:a}=Pe(),{refreshTenants:o}=$e(),c=N.useLocation(),i=N.useNavigate(),u=et(),[d,x]=n.useState(!1),[m,f]=n.useState(!1),p=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=u(b);c.pathname!==j&&i(j),x(!1)};n.useEffect(()=>{function b(j){p.current&&!p.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.at(0)?.toUpperCase()||"?"},h=()=>s?s.firstName||s.lastName?`${s.firstName||""} ${s.lastName||""}`.trim():s.email.split("@")[0]:"";return e.jsxs("div",{ref:p,className:"relative",children:[e.jsxs("button",{onClick:()=>x(!d),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":d,"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:Es,children:y()}),e.jsx(l.ChevronDown,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform duration-200 ${d?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute right-0 mt-2 w-72 origin-top-right transition-all duration-200 ease-out ${d?"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:Es,children:y()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-[var(--text-primary)] truncate",children:h()}),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 So={settings:l.Settings,users:l.Users,key:l.Key,briefcase:l.Briefcase,folder:l.FolderOpen,file:l.FileText,box:l.Box};function Co(t){return t&&So[t.toLowerCase()]||l.Box}function $s({app:t,isFavorite:s,showFavorite:r,onToggleFavorite:a,onSelect:o}){const c=Co(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 Jr(){const{t}=ne.useTranslation("navigation"),{favorites:s,menu:r,toggleFavorite:a,isFavorite:o}=Pe(),{currentTenant:c}=$e(),[i,u]=n.useState(!1),d=n.useRef(null),x=N.useNavigate(),m=et(),f=!!c,p=r?.applications||[];n.useEffect(()=>{function g(y){d.current&&!d.current.contains(y.target)&&u(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),n.useEffect(()=>{function g(y){y.key==="Escape"&&u(!1)}return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[]);const v=g=>{u(!1),g.route&&x(m(g.route))};return e.jsxs("div",{ref:d,className:"relative",children:[e.jsx("button",{onClick:()=>u(!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($s,{app:g,isFavorite:!0,showFavorite:f,onToggleFavorite:()=>a(g.id),onSelect:()=>{u(!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")}),p.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-2 max-h-64 overflow-y-auto",children:p.map(g=>e.jsx($s,{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 ko(){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 u=await je.myTenants.removeFavorite(c);s(u)}else{const u=await je.myTenants.addFavorite(c);s(u)}}catch(u){console.error("Failed to toggle favorite:",u)}},[t]),o=n.useCallback(c=>{je.myTenants.recordRecent(c).catch(console.error)},[]);return{favorites:t,loadFavorites:r,toggleFavorite:a,recordRecent:o}}const Ao={Pending:"bg-blue-500",Active:"bg-emerald-500",Suspended:"bg-amber-500",Archived:"bg-gray-400"},Ro={Pending:"En attente",Active:"Actif",Suspended:"Suspendu",Archived:"Archivé"};function qt({tenant:t,isSelected:s,isFavorite:r,hasThemeOverride:a,onSelect:o,onToggleFavorite:c,showStatus:i=!0}){const u=t.type==="Business",d=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:!d,className:`flex-1 flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 ${x(s,d)}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center ${u?"bg-blue-500/10":"bg-violet-500/10"}`,style:{borderRadius:"var(--radius-card)"},children:u?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 ${Ao[t.status]}`}),t.status!=="Active"&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:Ro[t.status]})]})]})]}),s&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)] flex-shrink-0"})]}),c&&d&&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 Qr="tenant_recents",Zt=5;function Zr(){try{return JSON.parse(localStorage.getItem(Qr)||"[]")}catch{return[]}}function Po(t){const s=Zr().filter(r=>r!==t);s.unshift(t),localStorage.setItem(Qr,JSON.stringify(s.slice(0,Zt)))}const To=(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)},Eo=(t,s)=>{const r=a=>{a.key==="Escape"&&(t(!1),s(""))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},$o=(t,s,r,a,o)=>{const c=n.useMemo(()=>t.filter(d=>s.includes(d.id)&&d.status==="Active"),[t,s]),i=n.useMemo(()=>{if(o.trim())return[];const d=new Set(s);return r.map(x=>a.find(m=>m.id===x)).filter(x=>!!x&&x.status==="Active"&&!d.has(x.id)).slice(0,Zt)},[r,a,s,o]),u=n.useMemo(()=>{const d=new Set([...s,...r.slice(0,Zt)]);return t.filter(x=>!d.has(x.id))},[t,s,r]);return{favoriteTenants:c,recentTenants:i,otherTenants:u}};function Io(){const{t}=ne.useTranslation("navigation"),{refreshMenu:s}=Pe(),{currentTenant:r,userTenants:a,switchTenant:o,isLoading:c,hasMultipleTenants:i,hasGlobalRoles:u,isGlobalView:d,enterGlobalView:x}=$e(),{tenantOverrides:m,loadTenantOverrides:f}=St(),[p,v]=n.useState(!1),[g,y]=n.useState(""),[h]=n.useState(()=>Zr()),b=n.useRef(null),j=n.useRef(null),{favorites:S,loadFavorites:w,toggleFavorite:E,recordRecent:$}=ko();n.useEffect(()=>{p&&(w(),f())},[p,w,f]),n.useEffect(()=>{p&&j.current&&setTimeout(()=>j.current?.focus(),100)},[p]),n.useEffect(()=>To(b,v,y),[]),n.useEffect(()=>Eo(v,y),[]);const A=n.useCallback(async R=>{if(R===r?.id&&!d){v(!1);return}try{Po(R),$(R),await o(R),v(!1),y(""),await s()}catch(q){console.error("Failed to switch tenant:",q)}},[r?.id,d,o,s,$]),k=n.useCallback(async()=>{await x(),v(!1),y(""),await s()},[x,s]),P=n.useCallback(async R=>{await E(R)},[E]),L=n.useMemo(()=>{if(!g.trim())return a;const R=g.toLowerCase();return a.filter(q=>q.name.toLowerCase().includes(R)||q.slug.toLowerCase().includes(R)||q.organisationName?.toLowerCase().includes(R))},[a,g]),{favoriteTenants:I,recentTenants:C,otherTenants:F}=$o(L,S,h,a,g);if(c)return null;if(!(i||u)&&r){const R=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:[R?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(!p),className:`flex items-center gap-2 px-3 py-1.5 border transition-colors ${d?"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":p,"aria-haspopup":"true",children:[d&&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")})]}),!d&&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})]}),!d&&!r&&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 ${p?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute left-0 mt-2 w-80 origin-top-left transition-all duration-200 ease-out z-50 ${p?"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:R=>y(R.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:[u&&!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 ${d?"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")})]}),d&&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(R=>e.jsx(qt,{tenant:R,isSelected:!d&&r?.id===R.id,isFavorite:!0,hasThemeOverride:m.includes(R.id),onSelect:()=>A(R.id),onToggleFavorite:()=>P(R.id)},R.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(R=>e.jsx(qt,{tenant:R,isSelected:!d&&r?.id===R.id,isFavorite:S.includes(R.id),hasThemeOverride:m.includes(R.id),onSelect:()=>A(R.id),onToggleFavorite:()=>P(R.id)},R.id))})]}),F.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:F.map(R=>e.jsx(qt,{tenant:R,isSelected:!d&&r?.id===R.id,isFavorite:S.includes(R.id),hasThemeOverride:m.includes(R.id),onSelect:()=>A(R.id),onToggleFavorite:()=>P(R.id)},R.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 ea(t,s){return t?s===t?"current":"other":"global"}const Lo={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)},zt={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})},es={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function Do(t,s,r){if(r){const o=s.relatedEntityId,c=t.filter(i=>!(i.type===es.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 Mo(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 Fo(){const[t,s]=n.useState(0),[r,a]=n.useState([]),[o,c]=n.useState(!1),{isConnected:i,onNotification:u,onUnreadCountUpdate:d}=Ar(),{isFeatureEnabled:x}=Ge(),m=x("support");n.useEffect(()=>{const h=u(j=>{const S=Mo(j),w=j.type===es.COMPLETED||j.type===es.FAILED;a(E=>Do(E,S,w))}),b=d(j=>{s(j)});return()=>{h(),b()}},[u,d]),n.useEffect(()=>{if(!m)return;let h=!1;async function b(){try{const j=await nt.getUnreadCount();h||s(j.count)}catch(j){h||console.error("Failed to load unread count:",j)}}return b(),()=>{h=!0}},[m]);const f=n.useCallback(async()=>{if(m)try{c(!0);const h=await nt.getUnread(10);a(h)}catch(h){console.error("Failed to load notifications:",h)}finally{c(!1)}},[m]),p=n.useCallback(async h=>{try{await nt.markAsRead(h),a(b=>b.map(j=>j.id===h?{...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(h=>h.map(b=>({...b,isRead:!0}))),s(0)}catch(h){console.error("Failed to mark all as read:",h)}},[]),g=n.useCallback(async h=>{try{await nt.delete(h);const b=r.find(j=>j.id===h);a(j=>j.filter(S=>S.id!==h)),b&&!b.isRead&&s(j=>Math.max(0,j-1))}catch(b){console.error("Failed to delete notification:",b)}},[r]),y=n.useCallback(h=>{nt.markAsRead(h),s(b=>Math.max(0,b-1))},[]);return{notifications:r,unreadCount:t,loading:o,isConnected:i,loadNotifications:f,markAsRead:p,markAllAsRead:v,deleteNotification:g,markAsReadSilent:y}}const vt={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function ta(){const t=N.useNavigate(),{currentTenant:s,hasMultipleTenants:r}=$e(),[a,o]=n.useState(!1),c=n.useRef(null),{notifications:i,unreadCount:u,loading:d,isConnected:x,loadNotifications:m,markAsRead:f,markAllAsRead:p,deleteNotification:v,markAsReadSilent:g}=Fo(),[,y]=n.useState(0);n.useEffect(()=>{if(!i.some(P=>P.type===vt.STARTED&&!P.isRead))return;const k=setInterval(()=>{y(P=>P+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 h=(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(),P=Date.now(),L=Math.floor((P-k)/1e3),I=Math.floor(L/60),C=L%60;return`${I.toString().padStart(2,"0")}:${C.toString().padStart(2,"0")}`},E=A=>{const k=new Date(A),L=new Date().getTime()-k.getTime(),I=Math.floor(L/6e4),C=Math.floor(I/60),F=Math.floor(C/24);return I<1?"Just now":I<60?`${I}m ago`:C<24?`${C}h ago`:F<7?`${F}d ago`:k.toLocaleDateString()},$=A=>{if(!r)return null;const k=ea(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"}),u>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:u>9?"9+":u})]}),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:[u>0&&e.jsxs("button",{onClick:p,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.jsxs("div",{className:"max-h-96 overflow-y-auto",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)]"})}),!d&&i.length>0&&i.map(A=>{const k=A.type===vt.STARTED&&!A.isRead,P=S(A.type);return e.jsx("button",{type:"button",onClick:()=>j(A),className:`w-full text-left 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"}):P}),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:E(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=>h(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)}),!d&&i.length===0&&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 Oo={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 sa({content:t,children:s,position:r="top",variant:a="default",delay:o=200,disabled:c=!1,className:i=""}){const u=Oo[a],[d,x]=n.useState(!1),[m,f]=n.useState({top:0,left:0}),p=n.useRef(null),v=n.useRef(null),g=n.useRef(null),y=()=>{if(!p.current||!v.current)return;const S=p.current.getBoundingClientRect(),w=v.current.getBoundingClientRect(),E=window.scrollX,$=window.scrollY,A=8;let k=0,P=0;switch(r){case"top":k=S.top+$-w.height-A,P=S.left+E+(S.width-w.width)/2;break;case"bottom":k=S.bottom+$+A,P=S.left+E+(S.width-w.width)/2;break;case"left":k=S.top+$+(S.height-w.height)/2,P=S.left+E-w.width-A;break;case"right":k=S.top+$+(S.height-w.height)/2,P=S.right+E+A;break}const L=window.innerWidth,I=window.innerHeight,C=8;P<C?P=C:P+w.width>L-C&&(P=L-w.width-C),k<C+$?k=C+$:k+w.height>I+$-C&&(k=I+$-w.height-C),f({top:k,left:P})};n.useEffect(()=>(d&&(y(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y)),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}),[d,r]);const h=()=>{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 ${u.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:p,onMouseEnter:h,onMouseLeave:b,onFocus:h,onBlur:b,className:"inline-flex",children:s}),d&&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
+ ${u.bg} ${u.text}
5
+ border ${u.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 Uo{async captureContext(){const s={url:window.location.href,timestamp:new Date,recentErrors:Te.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{Te.logError(new Error("Failed to capture screenshot"),"ErrorContextService")}return s}async captureScreenshot(){try{const r=await ws.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 ws.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 u=c.toDataURL("image/jpeg",r);a(u)}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 Gt=new Uo,Kt="ticket_drafts",Is=5,Ls=7;class _o{getDrafts(){try{const s=localStorage.getItem(Kt);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(Kt,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(Kt,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=Ls*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>=Is){const c=s.at(-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,Is-1)];return this.saveDrafts(o),a}updateDraft(s,r){const a=this.getDrafts(),o=a.findIndex(u=>u.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=Ls*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 _o;function ra({variant:t="icon",className:s=""}){const{t:r}=ne.useTranslation(["common","support"]),a=N.useNavigate(),{hasPermission:o}=Re(),[c,i]=n.useState(!1),[u,d]=n.useState(!1),[x,m]=n.useState([]),f=n.useRef(null),p=o("support.my-tickets.create");n.useEffect(()=>{u&&m(Xe.getAllDrafts())},[u]),n.useEffect(()=>{const S=w=>{f.current&&!f.current.contains(w.target)&&d(!1)};return u&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u]);const v=async S=>{i(!0),d(!1);const E=(S?Xe.getDraft(S):null)?.screenshot;let $=null;if(E)Gt.clearContext();else try{$=await Gt.captureContext(),Gt.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),d(!0)):await v()},y=(S,w)=>{S.stopPropagation(),Xe.deleteDraft(w);const E=Xe.getAllDrafts();m(E),E.length===0&&d(!1)},h=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 E=new Date().getTime()-S.getTime(),$=Math.floor(E/6e4),A=Math.floor(E/36e5),k=Math.floor(E/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(!p)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("button",{type:"button",onClick:()=>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:h(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:E=>y(E,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(sa,{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"})})}),u&&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")]}),u&&j()]})}function wt({onMenuToggle:t}){const{t:s}=ne.useTranslation("navigation"),[r,a]=n.useState(!1),o=et(),{menu:c}=Pe(),{logout:i}=Re(),u=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(Io,{}),e.jsx("div",{className:"h-6 w-px bg-[var(--border-color)]"}),e.jsx(Jr,{}),e.jsx("div",{className:"h-6 w-px bg-[var(--border-color)]"}),e.jsx(hs,{}),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(ra,{}),e.jsx(ta,{}),e.jsx(Yr,{})]}),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:[u.map(d=>e.jsx(N.Link,{to:o(d.route||"#"),className:"px-3 py-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},onClick:()=>a(!1),children:d.label},d.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 ts({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function ss(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 Bo({module:t,isActive:s,isCollapsed:r,onClose:a,buildUrl:o}){const[c,i]=n.useState(!1),[u,d]=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();d({top:v.top,left:v.right+8})}i(!0)}},p=()=>{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:p,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(ts,{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:u.top,left:u.left},onMouseEnter:f,onMouseLeave:p,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 qo({module:t,isExpanded:s,onToggle:r,onNavigate:a,currentPath:o,isCollapsed:c}){const[i,u]=n.useState(!1),[d,x]=n.useState({top:0,left:0}),[m,f]=n.useState(new Set),p=n.useRef(null),v=n.useRef(null),g=ss(t.icon),y=t.route?o===t.route:o.includes(`/${t.code}`),h=(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(p.current&&(clearTimeout(p.current),p.current=null),v.current){const $=v.current.getBoundingClientRect();x({top:$.top,left:$.right+8})}u(!0)}},w=()=>{c&&(p.current=setTimeout(()=>{u(!1)},150))};n.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const E=()=>{h&&!c?r():t.route&&a(t.route)};return e.jsxs("div",{ref:v,className:"relative",onMouseEnter:S,onMouseLeave:w,children:[e.jsxs("button",{onClick:E,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&&!h?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}),h&&(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:d.top,left:d.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:h?t.sections.map($=>{const A=ss($.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&&h&&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(zo,{section:$,currentPath:o,onNavigate:a,isCollapsed:c,isExpanded:m.has($.id),onToggle:()=>j($.id)},$.id))})]})}function zo({section:t,currentPath:s,onNavigate:r,isCollapsed:a,isExpanded:o,onToggle:c}){const i=ss(t.icon),u=t.route&&(s===t.route||s.startsWith(t.route+"/")),d=(t.resources?.length??0)>0,x=t.label,m=f=>{f.preventDefault(),t.route&&r(t.route),d&&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 ${u?"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}),d&&(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&&d&&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(Go,{resource:f,currentPath:s,onNavigate:r},f.id))})]})}function Go({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 Ko=(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)},Ho=(t,s)=>!!t.route&&s.startsWith(t.route)&&(t.sections?.length??0)>0,Vo=(t,s)=>{if(!t)return;const r=Ko(t,s);return r||t.modules.find(a=>Ho(a,s))};function aa({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),o=N.useNavigate(),{getCurrentApplication:c,isLoading:i,currentAppCode:u,menu:d}=Pe(),{favorites:x,loading:m}=ze(),{expandFavorites:f,clearExpand:p}=ze(),{isCollapsed:v,toggleCollapsed:g}=Lt(),y=et(),[h,b]=n.useState(new Set),[j,S]=n.useState(!1);n.useEffect(()=>{f&&(queueMicrotask(()=>{S(!1)}),p())},[f,p]);const w=c(),E=n.useCallback(P=>{if(d)for(const L of d.applications){const I=L.modules.find(C=>C.id===P.id);if(I?.sections?.length){const C=[...I.sections].sort((F,W)=>F.displayOrder-W.displayOrder)[0];if(C.route)return C.route}}return P.route},[d]);n.useEffect(()=>{if(!w)return;const P=Vo(w,a.pathname);P&&!h.has(P.id)&&queueMicrotask(()=>{b(L=>new Set([...L,P.id]))})},[a.pathname,w,h]);const $=P=>{b(L=>{const I=new Set(L);return I.has(P)?I.delete(P):I.add(P),I})},A=P=>{o(y(P)),s()},k=w?.label??"";return w?e.jsxs(e.Fragment,{children:[t&&e.jsx("button",{type:"button",className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:s,"aria-label":"Close sidebar"}),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(ts,{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(ts,{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(P=>{const L=E(P);return e.jsx(Bo,{module:{...P,route:L},isActive:a.pathname.startsWith(L),isCollapsed:v,onClose:s,buildUrl:y},P.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"})}),!i&&w.modules.length>0&&w.modules.map(P=>e.jsx(qo,{module:P,isExpanded:h.has(P.id),onToggle:()=>$(P.id),onNavigate:A,currentPath:a.pathname,isCollapsed:v},P.id)),!i&&w.modules.length===0&&!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(`/${u||"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 Ds=60,Wo=33;function Xo(){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,u=i.includes("?")?"&":"?",d=`${i}${u}embedded=true`,x=o>=Ds-1,m=()=>{c(x?Wo:Ds)};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:d,title:t("docPanel.title"),className:"w-full h-full border-0"})})]})}function Yo({children:t}){const{isOpen:s,panelSize:r,setPanelSize:a}=Ft(),[o,c]=gt.useGroupCallbackRef(),i=n.useRef(r),[u,d]=n.useState(!1);if(n.useEffect(()=>{d(!!o)},[o]),n.useEffect(()=>{o&&u&&i.current!==r&&(o.setLayout({"main-content":100-r,"doc-panel":r}),i.current=r)},[r,o,u]),!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(Xo,{})})]})}function Jo(){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 Qo(){const{t}=ne.useTranslation("admin"),{license:s,isLoading:r,isReadOnlyMode:a}=Ge(),{user:o}=Re(),c=et(),[i,u]=n.useState(!1);if(r||!s||i)return null;const d=o?.roles?.includes("SuperAdmin")??!1,x=o?.permissions?.some(b=>b.startsWith("administration.configuration.license")||b==="administration.configuration.*"||b==="administration.*")??!1;if(!d&&!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 h;return a?h=t("license.alert.readOnly","Your license has expired. The platform is in read-only mode."):m?h=t("license.alert.trialExpiring","Your trial expires in {{days}} days. Activate a license to continue using the platform.",{days:s.trialDaysRemaining}):h=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:h})]}),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:()=>u(!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 na(){const{t}=ne.useTranslation("admin"),{license:s,isLoading:r,isReadOnlyMode:a}=Ge(),{user:o}=Re(),c=et();if(r)return null;const i=o?.roles?.includes("SuperAdmin")??!1,u=o?.permissions?.some(v=>v.startsWith("administration.configuration.license")||v==="administration.configuration.*"||v==="administration.*")??!1;if(!i&&!u)return null;let d,x,m;if(a)d="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")d="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")d="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)d="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)d="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)d="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)]"},p={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[d]}`,"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 ${p[d]}`,children:t("license.contentBanner.activate","Activate license")})]})})}function Zo(){const[t,s]=n.useState(!1),{currentAppCode:r}=Pe(),{isCollapsed:a}=Lt(),o=!!r,c=()=>o?a?"lg:pl-16":"lg:pl-64":"";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>s(!t)}),o&&e.jsx(aa,{isOpen:t,onClose:()=>s(!1)}),e.jsxs("main",{className:`pt-16 transition-all duration-300 h-[calc(100vh-4rem)] ${c()}`,children:[e.jsx(Qo,{}),e.jsx(Yo,{children:e.jsxs("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:[e.jsx(na,{}),e.jsx(N.Outlet,{})]})})]}),e.jsx(Jo,{})]})}function oa(){return e.jsx(Vr,{children:e.jsx(Zo,{})})}const ei=Object.freeze(Object.defineProperty({__proto__:null,AppLayout:oa},Symbol.toStringTag,{value:"Module"}));function ti(){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 gs(){const{t}=ne.useTranslation("navigation"),{isAuthenticated:s}=Re(),[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(hs,{}),e.jsx(Ot,{}),s?e.jsx(Yr,{}):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 fs(){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 si=[{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 ri({className:t="",placeholder:s="Rechercher...",onResultClick:r}){const[a,o]=n.useState(""),[c,i]=n.useState(!1),[u,d]=n.useState(0),x=n.useRef(null),m=n.useRef(null),f=N.useNavigate(),p=n.useMemo(()=>{if(!a.trim())return[];const b=a.toLowerCase().split(" ").filter(Boolean);return si.filter(j=>{const S=[j.title,j.description,...j.tags,j.category].join(" ").toLowerCase();return b.every(w=>S.includes(w))})},[a]);n.useEffect(()=>{d(0)},[p]);const v=b=>{if(!(!c||p.length===0))switch(b.key){case"ArrowDown":b.preventDefault(),d(j=>(j+1)%p.length);break;case"ArrowUp":b.preventDefault(),d(j=>(j-1+p.length)%p.length);break;case"Enter":b.preventDefault(),p[u]&&g(p[u]);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",h=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:[p.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:p.map((b,j)=>{const S=b.icon;return e.jsxs("button",{onClick:()=>g(b),onMouseEnter:()=>d(j),className:`w-full flex items-start gap-3 px-3 py-2 text-left transition-colors ${j===u?"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===u?"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 ${h(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===u?"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 ai=[{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 Ht({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 ia(){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(p=>r.pathname===p.href):!1):!1,i=m=>r.pathname===m.href?!0:m.children?m.children.some(f=>r.pathname===f.href):!1,u=m=>m.children&&i(m)?e.jsx("div",{className:"mt-1 space-y-1",children:m.children.map(f=>e.jsx(Ht,{item:f,isChild:!0,depth:2},f.href))}):null,d=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(Ht,{item:f,isChild:!0}),u(f)]},f.href))}):null,x=()=>e.jsx("nav",{className:"space-y-1",children:ai.map(m=>e.jsxs("div",{children:[e.jsx(Ht,{item:m}),d(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(xs,{children:e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)] flex flex-col",children:[e.jsx(gs,{}),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("button",{type:"button",className:"lg:hidden fixed inset-0 z-40 bg-black/50",onClick:()=>s(!1),"aria-label":"Close sidebar"}),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(ri,{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(fs,{})]})})}const ni=Object.freeze(Object.defineProperty({__proto__:null,DocsLayout:ia},Symbol.toStringTag,{value:"Module"}));function la(){return e.jsx(xs,{children:e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)] flex flex-col",children:[e.jsx(gs,{}),e.jsx("main",{className:"flex-1 pt-16",children:e.jsx(N.Outlet,{})}),e.jsx(fs,{})]})})}const oi=Object.freeze(Object.defineProperty({__proto__:null,PublicLayout:la},Symbol.toStringTag,{value:"Module"}));function ii({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]}),!o&&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]}),!o&&!r.href&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[var(--text-secondary)]",children:[r.icon,r.label]})]},`${a}-${r.label}`)})})}function Vt(t,s){return s.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},t)}function li(t){return t==="right"?"justify-end":t==="center"?"justify-center":""}function ci(t,s){const r=s.toLowerCase();return Object.values(t).some(a=>a==null?!1:String(a).toLowerCase().includes(r))}function di({data:t,columns:s,loading:r=!1,searchable:a=!1,searchPlaceholder:o="Rechercher...",pagination:c,onRowClick:i,getRowKey:u=(w,E)=>String(E),emptyMessage:d="Aucune donnée",emptyIcon:x,headerActions:m,striped:f=!0,compact:p=!1,className:v="",selectable:g=!1,selectedKeys:y=new Set,onSelectionChange:h,searchFilter:b=ci,defaultSortKey:j,defaultSortDirection:S="asc"}){const[w,E]=n.useState(""),[$,A]=n.useState(j||null),[k,P]=n.useState(S),[L,I]=n.useState(1),[C,F]=n.useState(c?.pageSize||10),W=Array.isArray(t)?t:[],R=n.useMemo(()=>w?W.filter(U=>b(U,w)):W,[W,w,b]),q=n.useMemo(()=>$?[...R].sort((U,Z)=>{const re=Vt(U,$),de=Vt(Z,$);if(re===de)return 0;if(re==null)return 1;if(de==null)return-1;const pe=String(re).localeCompare(String(de),void 0,{numeric:!0});return k==="asc"?pe:-pe}):R,[R,$,k]),V=n.useMemo(()=>{if(!c)return q;const U=(L-1)*C;return q.slice(U,U+C)},[q,c,L,C]),z=c?Math.ceil(q.length/C):1,J=q.length,he=c?(L-1)*C+1:1,B=c?Math.min(L*C,J):J,Y=U=>{$===U?P(Z=>Z==="asc"?"desc":"asc"):(A(U),P("asc"))},M=U=>{I(Math.max(1,Math.min(U,z)))},te=()=>{if(!h)return;const U=V.map((re,de)=>u(re,de));if(U.every(re=>y.has(re))){const re=new Set(y);U.forEach(de=>re.delete(de)),h(re)}else{const re=new Set(y);U.forEach(de=>re.add(de)),h(re)}},oe=U=>{if(!h)return;const Z=new Set(y);Z.has(U)?Z.delete(U):Z.add(U),h(Z)},le=U=>{E(U),I(1)},O=p?"px-3 py-2":"px-4 py-3",G=p?"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:`${G} w-12`,children:e.jsx("input",{type:"checkbox",checked:V.length>0&&V.every((U,Z)=>y.has(u(U,Z))),onChange:te,className:"rounded border-[var(--border-color)]"})}),s.map(U=>e.jsx("th",{className:`${G} 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 ${li(U.align)}`,children:[e.jsx("span",{children:U.label}),Q(U)]})},U.key))]})}),e.jsxs("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)]"})})}),!r&&V.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:d})]})}),!r&&V.length>0&&V.map((U,Z)=>{const re=u(U,Z),de=y.has(re),pe=(L-1)*C+Z;return e.jsxs("tr",{onClick:()=>i?.(U,pe),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:`${O} 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:`${O} text-${fe.align||"left"} ${fe.hideOnMobile?"hidden md:table-cell":""}`,children:fe.render?fe.render(U,pe):String(Vt(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:[he,"-",B," sur ",J]}),c.showSizeSelector&&e.jsx("select",{value:C,onChange:U=>{F(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," / ",z]}),e.jsx("button",{onClick:()=>M(L+1),disabled:L===z,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(z),disabled:L===z,className:"btn btn-ghost p-2 disabled:opacity-30",title:"Dernière page",children:e.jsx(l.ChevronsRight,{className:"w-4 h-4"})})]})]})]})}function ui({data:t,viewMode:s,onViewModeChange:r,renderTable:a,renderCards:o,renderKanban:c,showTableView:i=!0,showCardsView:u=!0,showKanbanView:d=!0,tableLabel:x="Table",cardsLabel:m="Cards",kanbanLabel:f="Kanban"}){const[p,v]=n.useState("table"),g=s??p,y=r??v,b=[{mode:"table",label:x,icon:l.LayoutList,show:i},{mode:"cards",label:m,icon:l.LayoutGrid,show:u},{mode:"kanban",label:f,icon:l.Columns3,show:d}].filter(j=>j.show);return e.jsxs("div",{className:"space-y-4",children:[b.length>1&&e.jsx("div",{className:"flex items-center gap-1 p-1 rounded-[var(--radius-button)] bg-[var(--bg-secondary)] w-fit",children:b.map(({mode:j,label:S,icon:w})=>e.jsxs("button",{onClick:()=>y(j),className:`px-3 py-1.5 rounded-[var(--radius-button)] text-sm font-medium flex items-center gap-2 transition-all ${g===j?"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(w,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:S})]},j))}),e.jsxs("div",{children:[g==="table"&&a&&a(t),g==="cards"&&o&&o(t),g==="kanban"&&c&&c(t)]})]})}function mi({viewMode:t,onChange:s,showTable:r=!0,showCards:a=!0,showKanban:o=!0,tableLabel:c="Table",cardsLabel:i="Cards",kanbanLabel:u="Kanban"}){const x=[{mode:"table",label:c,icon:l.LayoutList,show:r},{mode:"cards",label:i,icon:l.LayoutGrid,show:a},{mode:"kanban",label:u,icon:l.Columns3,show:o}].filter(m=>m.show);return x.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:x.map(({mode:m,label:f,icon:p})=>e.jsxs("button",{onClick:()=>s(m),className:`px-3 py-1.5 rounded-[var(--radius-button)] text-sm font-medium flex items-center gap-2 transition-all ${t===m?"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(p,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:f})]},m))})}function rs({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 xi({title:t,count:s,color:r,children:a,isDragOver:o,isDropDisabled:c,onDragOver:i,onDragLeave:u,onDrop:d}){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:u,onDrop:c?void 0:d,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 pi({children:t,onClick:s,draggable:r=!0,isDragging:a,onDragStart:o,onDragEnd:c}){return e.jsx("div",{draggable:r,onClick:s,onKeyDown:s?i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s())}:void 0,role:s?"button":void 0,tabIndex:s?0:void 0,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 hi({page:t,totalPages:s,totalCount:r,pageSize:a=20,onPageChange:o,itemLabel:c="éléments",showInfo:i=!0,showFirstLast:u=!0}){const d=(t-1)*a+1,x=Math.min(t*a,r),m=()=>{const f=[];if(s<=7)for(let p=1;p<=s;p++)f.push(p);else{f.push(1),t>3&&f.push("ellipsis");const p=Math.max(2,t-1),v=Math.min(s-1,t+1);for(let g=p;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:d})," ","à"," ",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:[u&&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,p)=>f==="ellipsis"?e.jsx("span",{className:"px-2 text-[var(--text-muted)]",children:"..."},`ellipsis-${p}`):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"})}),u&&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 Ms={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 gi({avatar:t,title:s,subtitle:r,description:a,stats:o,badge:c,links:i,actions:u,tags:d,onClick:x,className:m="",customHeader:f,customBody:p,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,h=()=>{if(!c)return null;const w=c.icon,E=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:E}),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})]})]}),h()]})}),j=()=>p||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}),(d?.length??0)>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:d?.map(w=>w.onClick?e.jsx("button",{type:"button",className:`text-xs px-2 py-1 rounded-full cursor-pointer hover:opacity-80 ${Ms[w.variant||"default"]}`,onClick:w.onClick,children:w.label},w.label):e.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${Ms[w.variant||"default"]}`,children:w.label},w.label))}),(i?.length??0)>0&&e.jsx("div",{className:"space-y-1.5 pt-2 mt-3 border-t border-[var(--border-color)]",children:i?.map(w=>{const E=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(E,{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(E,{className:"w-3.5 h-3.5"}),w.label]},w.label)})}),e.jsx("div",{className:"flex-1 min-h-4"}),S()]}),S=()=>v||(!u||u.length===0?null:e.jsx("div",{className:"space-y-2 mt-3",children:u.map(w=>{const E=w.icon,$=w.variant||"primary",P=`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&&E&&e.jsx(E,{className:"w-4 h-4"});return w.href?e.jsxs("a",{href:w.href,target:"_blank",rel:"noopener noreferrer",className:P,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:P,children:[L,I,w.label]},w.label)})}));return x?e.jsxs("button",{type:"button",className:`${g} text-left w-full`,onClick:x,children:[b(),j()]}):e.jsxs("div",{className:g,children:[b(),j()]})}function fi({columns:t,items:s,getItemId:r,getItemColumn:a,onMoveItem:o,renderCard:c,loading:i=!1,onAddItem:u,onCardClick:d,cardActions:x,emptyColumnMessage:m="Aucun élément",className:f="",columnMinWidth:p="280px",disabled:v=!1}){const[g,y]=n.useState(null),[h,b]=n.useState(null),[j,S]=n.useState(null),w=n.useCallback(C=>{C.onClick(),S(null)},[]),E=n.useCallback((C,F)=>e.jsxs("button",{onClick:W=>{W.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]},F),[w]),$=n.useCallback(C=>s.filter(F=>a(F)===C),[s,a]),A=(C,F)=>{v||(y(F),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",F))},k=(C,F)=>{v||!g||(C.preventDefault(),C.dataTransfer.dropEffect="move",b(F))},P=()=>{b(null)},L=(C,F)=>{if(v)return;C.preventDefault();const W=C.dataTransfer.getData("text/plain");W&&o(W,F),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 F=$(C.id),W=h===C.id,R=C.maxItems!==void 0&&F.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)] ${W?"ring-2 ring-[var(--color-primary-500)]":""}`,style:{minWidth:p,maxWidth:p},onDragOver:q=>k(q,C.id),onDragLeave:P,onDrop:q=>L(q,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:[F.length,C.maxItems!==void 0&&` / ${C.maxItems}`]})]}),u&&C.canAddItem!==!1&&!R&&e.jsx("button",{onClick:()=>u(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:[F.length===0?e.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)] text-sm",children:m}):F.map((q,V)=>{const z=r(q),J=g===z,he=x?.(q);return e.jsxs("div",{draggable:!v,onDragStart:B=>A(B,z),onDragEnd:I,onClick:()=>d?.(q),onKeyDown:d?B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),d(q))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,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
+ ${d?"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(q,V)}),(he?.length??0)>0&&e.jsxs("div",{className:"absolute top-2 right-2",children:[e.jsx("button",{onClick:B=>{B.stopPropagation(),S(j===z?null:z)},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===z&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"fixed inset-0 z-40",onClick:()=>S(null),"aria-label":"Close menu"}),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:he?.map((B,Y)=>E(B,Y))})]})]})]},z)}),W&&F.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 bi({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 Wt={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 vi({rows:t,columns:s,getRowId:r,getRowLabel:a,getRowGroup:o,getRowSubGroup:c,getRowIcon:i,isRowLocked:u,getRowChildCount:d,getColumnId:x,getColumnLabel:m,getColumnShortLabel:f,isColumnLocked:p,getColumnColor:v,getCellState:g,onCellClick:y,loading:h=!1,showLegend:b=!0,searchable:j=!1,rowColumnWidth:S="250px",cellWidth:w="44px",className:E="",emptyMessage:$="Aucune donnée",canEditLocked:A=!1}){const[k,P]=n.useState(new Set),[L,I]=n.useState(""),C=n.useMemo(()=>{const B=new Map;return t.forEach(Y=>{const M=o?.(Y)||"_default",te=c?.(Y);B.has(M)||B.set(M,{rows:[],subGroups:new Map});const oe=B.get(M);te?(oe.subGroups.has(te)||oe.subGroups.set(te,[]),oe.subGroups.get(te).push(Y)):oe.rows.push(Y)}),B},[t,o,c]),F=n.useCallback((B,Y)=>{const M=new Map;return B.forEach((te,oe)=>{const le=te.filter(O=>a(O).toLowerCase().includes(Y));le.length>0&&M.set(oe,le)}),M},[a]),W=n.useMemo(()=>{if(!L)return C;const B=L.toLowerCase(),Y=new Map;return C.forEach((M,te)=>{const oe=M.rows.filter(O=>a(O).toLowerCase().includes(B)),le=F(M.subGroups,B);(oe.length>0||le.size>0)&&Y.set(te,{rows:oe,subGroups:le})}),Y},[C,L,a,F]),R=B=>{P(Y=>{const M=new Set(Y);return M.has(B)?M.delete(B):M.add(B),M})},q=n.useCallback((B,Y,M,te)=>{y&&(M&&!A||te&&!A||y(B,Y))},[y,A]),V=n.useCallback((B,Y)=>!(!y||B&&!A||Y&&!A),[y,A]),z=(B,Y)=>`w-full h-full min-h-[32px] flex items-center justify-center rounded transition-colors ${B?"hover:opacity-80 cursor-pointer":"cursor-default"} ${Y!=="none"?"":"opacity-30"}`,J=n.useCallback((B,Y,M,te,oe,le,O,G)=>{const Q=te.icon,U=V(oe,le);return e.jsx("td",{className:"px-0 py-1 text-center",style:{width:w},children:e.jsx("button",{type:"button",onClick:()=>q(B,Y,oe,le),disabled:!U,className:z(U,M),style:{backgroundColor:te.bg},title:`${a(O)} × ${m(G)}: ${te.label}`,children:M!=="none"&&e.jsx(Q,{className:"w-4 h-4",style:{color:te.color}})})},`${B}-${Y}`)},[y,A,q,w,a,m,V,z]),he=n.useCallback((B,Y,M,te,oe)=>{const le=r(B),O=u?.(B)||!1,G=i?.(B),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:[G,O&&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(B)})]})}),M.map(Z=>{const re=x(Z),de=p?.(Z)||!1,pe=oe(le,re),fe=Wt[pe];return J(le,re,pe,fe,O,de,B,Z)})]},le)},[r,u,i,a,x,p,J]);return h?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 ${E}`,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:B=>I(B.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(Wt).map(([B,Y])=>{if(B==="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})]},B)})})]}),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(B=>{const Y=x(B),M=f?.(B)||m(B),te=p?.(B),oe=v?.(B);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(B),children:M})]})})},Y)})]})}),e.jsx("tbody",{children:Array.from(W.entries()).map(([B,Y])=>{const M=k.has(B),te=B==="_default",oe=Y.rows.length+Array.from(Y.subGroups.values()).reduce((le,O)=>le+O.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:()=>R(B),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:B}),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,O)=>{const G=r(le),Q=u?.(le)||!1,U=i?.(le),Z=d?.(le),re=O%2===0?"bg-[var(--bg-primary)]":"bg-[var(--bg-secondary)]/50",de=O%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(pe=>{const fe=x(pe),Ne=p?.(pe)||!1,_e=g(G,fe),Ke=Wt[_e];return J(G,fe,_e,Ke,Q,Ne,le,pe)})]},G)}),Array.from(Y.subGroups.entries()).map(([le,O])=>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," (",O.length,")"]})}),e.jsx("td",{colSpan:s.length})]}),O.map((G,Q)=>he(G,Q,s,S,g))]},le))]})]},B)})})]})})]})}const yi=[{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:yi.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:Ua[o]},o))})]})}const ji=({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 wi({onSync:t,isSyncing:s=!1,syncSuccess:r=!1}){const{t:a}=ne.useTranslation("preferences"),{config:o,mode:c,setMode:i,setBorderRadius:u,setAccentColor:d,setItemPalette:x,applyPreset:m,resetToDefault:f,selectedThemeTenant:p,setSelectedThemeTenant:v}=St(),{currentTenant:g,hasMultipleTenants:y}=$e(),h=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.jsxs("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..."]}),!s&&r&&e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{className:"w-4 h-4"}),"Synchronisé"]}),!s&&!r&&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"]})]})]}),h&&e.jsx(ji,{selectedThemeTenant:p,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:()=>d(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:u}),e.jsx(ot,{label:"Boutons",element:"button",value:o.borderRadius.button,onChange:u}),e.jsx(ot,{label:"Badges",element:"badge",value:o.borderRadius.badge,onChange:u}),e.jsx(ot,{label:"Champs de saisie",element:"input",value:o.borderRadius.input,onChange:u}),e.jsx(ot,{label:"Modales",element:"modal",value:o.borderRadius.modal,onChange:u}),e.jsx(ot,{label:"Éléments de menu",element:"menuItem",value:o.borderRadius.menuItem,onChange:u})]})]}),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 Ni({title:t,description:s,icon:r,showBackButton:a=!0,backUrl:o,children:c}){const{t:i}=ne.useTranslation("common"),u=N.useNavigate(),d=()=>{u(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:d,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 Si({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}const Ci=[{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 ki({isOpen:t=!0,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),{favorites:o,loading:c}=ze(),{expandFavorites:i,clearExpand:u}=ze(),[d,x]=n.useState(!1);n.useEffect(()=>{i&&(queueMicrotask(()=>{x(!1)}),u())},[i,u]);const m=(p,v)=>v?a.pathname===p:a.pathname.startsWith(p),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(!d),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:[d?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"})})]}),!d&&e.jsx("div",{className:"space-y-0.5",children:o.map(p=>{const v=a.pathname===p.route;return e.jsxs(N.Link,{to:p.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:`${p.label} (${p.applicationLabel})`,children:[e.jsx(Si,{name:p.icon,className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium truncate",children:p.label})]},p.id)})}),e.jsx("div",{className:"my-3 border-b border-[var(--border-color)]"})]}),Ci.map(p=>{const v=p.icon,g=m(p.path,p.exact);return e.jsxs(N.Link,{to:p.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(p.labelKey)})]},p.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("button",{type:"button",className:"lg:hidden fixed inset-0 bg-black/50 z-40",onClick:s,"aria-label":"Close sidebar"}),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 Fs({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function Ai({isOpen:t=!0,onClose:s}){const{t:r}=ne.useTranslation(["navigation","common"]),a=N.useLocation(),{favorites:o,loading:c}=ze(),{expandFavorites:i,clearExpand:u}=ze(),{isCollapsed:d,toggleCollapsed:x}=Lt(),{getApplicationsByZone:m}=Pe(),[f,p]=n.useState(!1),y=m("personal").find(j=>j.code==="myspace"||j.code==="core_myspace")?.modules||[];n.useEffect(()=>{i&&(queueMicrotask(()=>{p(!1)}),u())},[i,u]);const h=(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 ${d?"p-2":"p-4"}`,children:[!c&&o.length>0&&e.jsxs("div",{className:"mb-4",children:[!d&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsxs("button",{onClick:()=>p(!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"})})]}),(d||!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 ${d?"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:d?`${j.label} (${j.applicationLabel})`:void 0,children:[e.jsx(Fs,{name:j.icon,className:"w-4 h-4 flex-shrink-0"}),!d&&e.jsx("span",{className:"text-sm font-medium truncate",children:j.label}),d&&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)})}),!d&&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 ${d?"justify-center px-2 py-2.5":"gap-3 px-3 py-2.5"} ${h("/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:d?r("sidebar.dashboard"):void 0,children:[e.jsx(l.LayoutDashboard,{className:"w-5 h-5 flex-shrink-0"}),!d&&e.jsx("span",{className:"font-medium",children:r("sidebar.dashboard")}),d&&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=h(S);return e.jsxs(N.Link,{to:S,onClick:s,className:`relative group flex items-center transition-colors ${d?"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:d?j.label:void 0,children:[e.jsx(Fs,{name:j.icon||"Star",className:"w-5 h-5 flex-shrink-0"}),!d&&e.jsx("span",{className:"font-medium",children:j.label}),d&&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)] ${d?"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)] ${d?"justify-center px-2 py-2":"gap-2 px-3 py-2"}`,style:{borderRadius:"var(--radius-menu-item)"},title:d?r("sidebar.expand","Agrandir le menu"):r("sidebar.collapse","Réduire le menu"),children:d?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 ${d?"w-16":"w-64"}`,children:b}),t&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"lg:hidden fixed inset-0 bg-black/50 z-40",onClick:s,"aria-label":"Close sidebar"}),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 Ri(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 Pi(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const Ti={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 Ei({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>Pi()),i=Ri(t),u=Ti[i],d=u.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 ${u.bgColor} flex items-center justify-center mb-4`,children:e.jsx(d,{className:`w-7 h-7 ${u.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 $i(t,s){Te.logError(t,"RouteErrorBoundary",{componentStack:s.componentStack})}function Ii({children:t}){return e.jsx(ir.ErrorBoundary,{FallbackComponent:Ei,onError:$i,onReset:()=>{window.location.reload()},children:t})}function Li({feature:t,children:s,fallback:r,minimal:a=!1}){const{t:o}=ne.useTranslation("admin"),{isFeatureEnabled:c,license:i,isLoading:u}=Ge();return u?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 ca({open:t,onOpenChange:s}){const{t:r}=ne.useTranslation("admin"),{activateLicense:a,license:o}=Ge(),{refreshMenu:c}=Pe(),[i,u]=n.useState(""),[d,x]=n.useState(""),[m,f]=n.useState(!1),[p,v]=n.useState(!1),[g,y]=n.useState(null),[h,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 E=await a(i.trim(),d.trim()||void 0);v(!1),E.success?(b(!0),await c(),setTimeout(()=>{u(""),x(""),f(!1),b(!1),s(!1)},1500)):y(E.error||r("license.errors.activationFailed","Activation failed"))},w=()=>{p||(u(""),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("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:w,"aria-label":"Close dialog"}),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:p,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:E=>{u(E.target.value),y(null)},placeholder:r("license.keyPlaceholder","eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."),rows:6,disabled:p||h,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:d,onChange:E=>{x(E.target.value),y(null)},placeholder:r("license.apiKeyPlaceholder","sslk_..."),disabled:p||h,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})]}),h&&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:p,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:p||h||!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:[p&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),h&&e.jsx(l.CheckCircle,{className:"w-4 h-4"}),p?r("license.activating","Activating..."):h?r("license.activated","Activated!"):r("license.activate","Activate")]})]})]})]}):null}function Di({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:u,isReadOnlyMode:d,daysUntilExpiration:x}=r;if(d)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=u<=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:u})})]})}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 as({reason:t,tenantName:s,permissionPath:r,applicationsUrl:a,userRoles:o,userPermissions:c}){const{t:i}=ne.useTranslation("common"),{menu:u}=Pe(),d=N.useLocation(),x=()=>{window.history.length>2?window.history.back():window.location.href="/"},m=r?.split(".")[0],f=n.useMemo(()=>c?.filter(j=>{const S=j.toLowerCase();return m&&(S.startsWith(m.toLowerCase()+".")||S===m.toLowerCase())})??[],[c,m]),p=r&&(o?.length||c),v=n.useMemo(()=>{const j=d.pathname.split("/").filter(Boolean),S=j[0]==="t"?j.slice(2):j,w=S[0],E=S[1],$=S[2],A=S[3],k=R=>/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(R),P=R=>R.replace(/^(core_|ext_)/,""),L=R=>R.charAt(0).toUpperCase()+R.slice(1).replace(/-/g," "),I=u?.applications.find(R=>R.route?.split("/").filter(Boolean)[0]===w||P(R.code)===w),C=E?I?.modules.find(R=>R.route?.split("/").filter(Boolean)[1]===E||P(R.code)===E):void 0,F=$&&!k($)?C?.sections.find(R=>R.route?.split("/").filter(Boolean)[2]===$||P(R.code)===$):void 0,W=A&&!k(A)?F?.resources.find(R=>R.route?.split("/").filter(Boolean)[3]===A||P(R.code)===A):void 0;return{application:I?.label||(w?L(w):void 0),module:C?.label||(E&&!k(E)?L(E):void 0),section:F?.label||($&&!k($)?L($):void 0),resource:W?.label||(A&&!k(A)?L(A):void 0)}},[u,d.pathname]),g=n.useMemo(()=>{const j=[];return v.application&&j.push(`- ${i("errors.accessDenied.ticket.applicationLabel")}: ${v.application}`),v.module&&j.push(`- ${i("errors.accessDenied.ticket.moduleLabel")}: ${v.module}`),v.section&&j.push(`- ${i("errors.accessDenied.ticket.sectionLabel")}: ${v.section}`),v.resource&&j.push(`- ${i("errors.accessDenied.ticket.resourceLabel")}: ${v.resource}`),j.length===0?"":`
26
+
27
+ ${i("errors.accessDenied.ticket.navigationContext")}:
28
+ ${j.join(`
29
+ `)}`},[v,i]),y=n.useMemo(()=>{if(!t||!r||!s||!a)return null;const S=`${a.replace(/\/applications$/,"")}/support/my-tickets/create`,w=t==="tenant"?"ApplicationRequest":"Support",E=r.split(".")[0],$=t==="tenant"?i("errors.accessDenied.ticket.accessSubject",{permissionPath:r,tenantName:s}):i("errors.accessDenied.ticket.permissionSubject",{permissionPath:r,tenantName:s}),k=(t==="tenant"?i("errors.accessDenied.ticket.accessBody",{appCode:E,tenantName:s,permissionPath:r}):i("errors.accessDenied.ticket.permissionBody",{permissionPath:r,tenantName:s}))+g,P=new URLSearchParams({type:w,subject:$,body:k});return`${S}?${P.toString()}`},[t,r,s,a,i,g]),b=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:b}),p&&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?.length??0)>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(j=>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:j},j))})]}),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(j=>e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:j},j))}):e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] italic",children:i("errors.accessDenied.noPermissions")})]})]}),!p&&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})]}),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 Mi(){const{t}=ne.useTranslation("common"),{logout:s}=Re();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 da(){const{user:t,isLoading:s}=Re(),r=N.useLocation(),{currentAppCode:a,currentModuleCode:o,isLoading:c,menu:i}=Pe(),{currentTenant:u,userTenants:d,isLoading:x,isGlobalView:m}=$e(),f=u?.id||"global",p=n.useRef(u?.id);let v=!1;if(u?.id!==p.current&&(p.current=u?.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(!u&&!m&&!d.some(j=>j.status==="Active"))return e.jsx(Mi,{});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=u?.slug?`/t/${u.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(as,{reason:"tenant",tenantName:u?.name,permissionPath:b,applicationsUrl:j,userRoles:t.roles,userPermissions:t.permissions})})})]})}const h=[a,o].filter(Boolean).join(".");if(!Cn(t.permissions,t.roles,h)&&y.accessLevel!=="RequestAccess"){const b=u?.slug?`/t/${u.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(as,{reason:"permission",tenantName:u?.name,permissionPath:h,applicationsUrl:b,userRoles:t.roles,userPermissions:t.permissions})})})]})}return e.jsx(N.Outlet,{},f)}function Os(){const{slug:t}=N.useParams(),s=N.useNavigate(),r=N.useLocation(),{currentTenant:a,userTenants:o,switchTenant:c,isLoading:i,isGlobalView:u}=$e(),{useUrlRouting:d,isLoading:x}=ds(),m=n.useRef(!1),f=n.useRef(null),p=n.useRef(null);return n.useEffect(()=>{if(i||x||!d||u)return;const v=t||Ts(r.pathname),g=v!==p.current;if(p.current=v,!!g&&v&&v!==a?.slug){const y=o.find(h=>h.slug===v&&h.status==="Active");if(y)f.current=v,c(y.id).then(()=>{f.current=null}).catch(h=>{f.current=null,console.error("[TenantRouteWrapper] Failed to switch tenant:",h)});else if(a){const h=ct(r.pathname);s(`/t/${a.slug}${h}`,{replace:!0})}else s("/",{replace:!0})}},[t,r.pathname,a?.slug,o,d,i,x,u,c,s]),n.useEffect(()=>{if(i||x||m.current)return;const v=r.pathname,g=Ts(v);if(u&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(!d&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(d&&a&&!g&&!u&&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(d&&a&&g&&!u&&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,d,i,x,u,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 Fi(){const{t}=ne.useTranslation("admin"),{license:s}=Ge(),r=et();return!s||s.status==="NoLicense"?e.jsx(ca,{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 Oi=["/myspace","/administration/configuration"];function Ui(t){const s=/^\/t\/[^/]+\/(.*)/.exec(t);return s?`/${s[1]}`:t}function ua(){const{license:t,isLoading:s,isReadOnlyMode:r}=Ge(),a=N.useLocation();if(s)return e.jsx(N.Outlet,{});const o=Ui(a.pathname);return Oi.some(i=>o.startsWith(i))?e.jsx(N.Outlet,{}):!t?.isValid||r?e.jsxs(e.Fragment,{children:[e.jsx(N.Outlet,{}),e.jsx(Fi,{})]}):e.jsx(N.Outlet,{})}function bs({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 Us=n.lazy(()=>Promise.resolve().then(()=>ni).then(t=>({default:t.DocsLayout}))),_i=n.lazy(()=>Promise.resolve().then(()=>require("./DocsIndexPage-BPfi0FQD.cjs")).then(t=>({default:t.DocsIndexPage}))),Bi=n.lazy(()=>Promise.resolve().then(()=>require("./SmartStackPresentationPage-52Nb7F0X.cjs")).then(t=>({default:t.SmartStackPresentationPage}))),qi=n.lazy(()=>Promise.resolve().then(()=>require("./DeveloperIndexPage-CtBfD2JI.cjs")).then(t=>({default:t.DeveloperIndexPage}))),zi=n.lazy(()=>Promise.resolve().then(()=>require("./InfrastructurePage-D4ZjLzI_.cjs")).then(t=>({default:t.InfrastructurePage}))),Gi=n.lazy(()=>Promise.resolve().then(()=>require("./InstallationPage-BJ-GBVPp.cjs")).then(t=>({default:t.InstallationPage}))),Ki=n.lazy(()=>Promise.resolve().then(()=>require("./DatabasePage-DAzb3FnS.cjs")).then(t=>({default:t.DatabasePage}))),Hi=n.lazy(()=>Promise.resolve().then(()=>require("./DualDbContextPage-Dz8NAewk.cjs")).then(t=>({default:t.DualDbContextPage}))),Vi=n.lazy(()=>Promise.resolve().then(()=>require("./CrossSchemaFkPage-DqFNORYd.cjs")).then(t=>({default:t.CrossSchemaFkPage}))),Wi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantIndexPage}))),Xi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.MultiTenantModePage}))),Yi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantB2CPage}))),Ji=n.lazy(()=>Promise.resolve().then(()=>require("./TeamsIntegrationPage-DXj5MDRS.cjs")).then(t=>({default:t.TeamsIntegrationPage}))),Qi=n.lazy(()=>Promise.resolve().then(()=>require("./index-CdORB0b4.cjs")).then(t=>({default:t.SecurityTestingPage}))),Zi=n.lazy(()=>Promise.resolve().then(()=>require("./UserIndexPage-DahU6wzK.cjs")).then(t=>({default:t.UserIndexPage}))),el=n.lazy(()=>Promise.resolve().then(()=>require("./ArchitecturePage-Cn_XCDAo.cjs")).then(t=>({default:t.ArchitecturePage}))),tl=n.lazy(()=>Promise.resolve().then(()=>require("./ModulesPage-lz8DUm3X.cjs")).then(t=>({default:t.ModulesPage}))),sl=n.lazy(()=>Promise.resolve().then(()=>require("./SlaDocPage-D44QWNY8.cjs")).then(t=>({default:t.SlaDocPage}))),rl=n.lazy(()=>Promise.resolve().then(()=>require("./SupportIndexPage-CsDQ35Cu.cjs")).then(t=>({default:t.SupportIndexPage}))),al=n.lazy(()=>Promise.resolve().then(()=>require("./SupportDashboardDocPage-DfV-9_8r.cjs")).then(t=>({default:t.SupportDashboardDocPage}))),nl=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTicketsDocPage-B_603CpY.cjs")).then(t=>({default:t.SupportTicketsDocPage}))),ol=n.lazy(()=>Promise.resolve().then(()=>require("./SupportMyTicketsDocPage-Dbp6XBnH.cjs")).then(t=>({default:t.SupportMyTicketsDocPage}))),il=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTemplatesDocPage-BkeDpR-8.cjs")).then(t=>({default:t.SupportTemplatesDocPage}))),ll=n.lazy(()=>Promise.resolve().then(()=>require("./SupportEscalationDocPage-C65oCDZL.cjs")).then(t=>({default:t.SupportEscalationDocPage}))),cl=n.lazy(()=>Promise.resolve().then(()=>require("./AiDocPage-CM7j_50_.cjs")).then(t=>({default:t.AiDocPage}))),dl=n.lazy(()=>Promise.resolve().then(()=>require("./SettingsDocPage-Dqj8KzOa.cjs")).then(t=>({default:t.SettingsDocPage}))),ul=n.lazy(()=>Promise.resolve().then(()=>require("./ThemeDocPage-B6x55uSE.cjs")).then(t=>({default:t.ThemeDocPage}))),ml=n.lazy(()=>Promise.resolve().then(()=>require("./BaIndexPage-C3osYS_6.cjs")).then(t=>({default:t.BaIndexPage}))),_s=n.lazy(()=>Promise.resolve().then(()=>require("./BaViewerPage-BPucPOSy.cjs")).then(t=>({default:t.BaViewerPage}))),xl=n.lazy(()=>Promise.resolve().then(()=>require("./index-CO5QP9C1.cjs"))),pl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BASU1QDx.cjs"))),hl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DYJbiXHU.cjs"))),gl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BBQMnq4P.cjs"))),fl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DLSMVKFE.cjs"))),bl=n.lazy(()=>Promise.resolve().then(()=>require("./index-D1WPBG1_.cjs"))),vl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DIuoVYFu.cjs"))),yl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Cdu0fSs8.cjs"))),jl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BVUCDL0k.cjs"))),wl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DRT2wvEs.cjs"))),Nl=n.lazy(()=>Promise.resolve().then(()=>require("./index-xCGnOlox.cjs"))),Sl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DQBVnnd6.cjs"))),Cl=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0rFTzxZ.cjs"))),kl=n.lazy(()=>Promise.resolve().then(()=>require("./index-HWG-CG1i.cjs"))),Al=n.lazy(()=>Promise.resolve().then(()=>require("./index-CaLDUVLs.cjs"))),Rl=n.lazy(()=>Promise.resolve().then(()=>require("./index-CtcTcQqt.cjs"))),Pl=n.lazy(()=>Promise.resolve().then(()=>require("./index-OhzFdH9N.cjs"))),Tl=n.lazy(()=>Promise.resolve().then(()=>require("./index-AM9K908G.cjs"))),El=n.lazy(()=>Promise.resolve().then(()=>require("./index-CiAIT31Y.cjs"))),$l=n.lazy(()=>Promise.resolve().then(()=>require("./index-BEpBEF5G.cjs"))),Il=n.lazy(()=>Promise.resolve().then(()=>require("./index-p2jNjCTo.cjs")));function Ll(){return e.jsxs(e.Fragment,{children:[e.jsxs(N.Route,{path:"/system/docs",element:e.jsx(Us,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(_i,{})}),e.jsx(N.Route,{path:"developer",element:e.jsx(qi,{})}),e.jsx(N.Route,{path:"developer/infrastructure",element:e.jsx(zi,{})}),e.jsx(N.Route,{path:"developer/installation",element:e.jsx(Gi,{})}),e.jsx(N.Route,{path:"developer/database",element:e.jsx(Ki,{})}),e.jsx(N.Route,{path:"developer/dual-dbcontext",element:e.jsx(Hi,{})}),e.jsx(N.Route,{path:"developer/cross-schema-fk",element:e.jsx(Vi,{})}),e.jsx(N.Route,{path:"developer/tenants",element:e.jsx(Wi,{})}),e.jsx(N.Route,{path:"developer/tenants/multi-tenant-mode",element:e.jsx(Xi,{})}),e.jsx(N.Route,{path:"developer/tenants/b2c",element:e.jsx(Yi,{})}),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(Ji,{})}),e.jsx(N.Route,{path:"developer/testing/security",element:e.jsx(Qi,{})}),e.jsx(N.Route,{path:"user",element:e.jsx(Zi,{})}),e.jsx(N.Route,{path:"user/architecture",element:e.jsx(el,{})}),e.jsx(N.Route,{path:"user/modules",element:e.jsx(tl,{})}),e.jsx(N.Route,{path:"user/support",element:e.jsx(rl,{})}),e.jsx(N.Route,{path:"user/support-dashboard",element:e.jsx(al,{})}),e.jsx(N.Route,{path:"user/support-tickets",element:e.jsx(nl,{})}),e.jsx(N.Route,{path:"user/support-my-tickets",element:e.jsx(ol,{})}),e.jsx(N.Route,{path:"user/support-sla",element:e.jsx(sl,{})}),e.jsx(N.Route,{path:"user/support-templates",element:e.jsx(il,{})}),e.jsx(N.Route,{path:"user/support-escalation",element:e.jsx(ll,{})}),e.jsx(N.Route,{path:"user/ai",element:e.jsx(cl,{})}),e.jsx(N.Route,{path:"user/settings",element:e.jsx(dl,{})}),e.jsx(N.Route,{path:"user/theme",element:e.jsx(ul,{})}),e.jsx(N.Route,{path:"ba",element:e.jsx(ml,{})}),e.jsx(N.Route,{path:"ba/:appCode",element:e.jsx(_s,{})}),e.jsx(N.Route,{path:"ba/:appCode/:moduleCode",element:e.jsx(_s,{})})]}),e.jsxs(N.Route,{path:"/docs/business",element:e.jsx(Us,{}),children:[e.jsx(N.Route,{path:"administration/users",element:e.jsx(xl,{})}),e.jsx(N.Route,{path:"administration/users/dashboard",element:e.jsx(pl,{})}),e.jsx(N.Route,{path:"administration/users/references",element:e.jsx(hl,{})}),e.jsx(N.Route,{path:"administration/users/groups",element:e.jsx(gl,{})}),e.jsx(N.Route,{path:"administration/permissions",element:e.jsx(fl,{})}),e.jsx(N.Route,{path:"administration/permissions/assignments",element:e.jsx(bl,{})}),e.jsx(N.Route,{path:"administration/tenants",element:e.jsx(vl,{})}),e.jsx(N.Route,{path:"administration/tenants/template",element:e.jsx(yl,{})}),e.jsx(N.Route,{path:"administration/tenants/business",element:e.jsx(jl,{})}),e.jsx(N.Route,{path:"administration/tenants/personal",element:e.jsx(wl,{})}),e.jsx(N.Route,{path:"administration/tenants/other",element:e.jsx(Nl,{})}),e.jsx(N.Route,{path:"administration/tenants/applications",element:e.jsx(Sl,{})}),e.jsx(N.Route,{path:"administration/tenants/access-requests",element:e.jsx(Cl,{})}),e.jsx(N.Route,{path:"administration/tenants/organisations",element:e.jsx(kl,{})}),e.jsx(N.Route,{path:"administration/ai",element:e.jsx(Al,{})}),e.jsx(N.Route,{path:"administration/workflows",element:e.jsx(Rl,{})}),e.jsx(N.Route,{path:"administration/entra",element:e.jsx(Pl,{})}),e.jsx(N.Route,{path:"administration/applications",element:e.jsx(Tl,{})}),e.jsx(N.Route,{path:"administration/configuration",element:e.jsx(El,{})}),e.jsx(N.Route,{path:"administration/configuration/license",element:e.jsx($l,{})}),e.jsx(N.Route,{path:"platform/support/tickets",element:e.jsx(Il,{})})]}),e.jsx(N.Route,{path:"/system/docs/presentation",element:e.jsx(Bi,{})}),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 Dl=[{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"}],Ml=[{icon:l.Zap,text:"Démarrage rapide"},{icon:l.Lock,text:"Sécurité intégrée"},{icon:l.Rocket,text:"Performance optimale"}],Fl=[".NET 10","React 19","TypeScript","EF Core","SQL Server","Tailwind CSS"];function Ol(){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:Ml.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"}),Fl.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:Dl.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 ma(){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 xa(){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 Ul(){const[t,s]=n.useState(""),[r,a]=n.useState(""),[o,c]=n.useState(!1),[i,u]=n.useState(!1),[d,x]=n.useState("auth"),[m,f]=n.useState(null),[p]=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"),u(!0);try{Te.logEvent("login_attempt","auth",{email:t});const y=ma(),h=await xa(),b=await D.post("/api/auth/login",{email:t,password:r,deviceType:y,clientIp:h});localStorage.setItem("token",b.token),localStorage.setItem("refreshToken",b.refreshToken),localStorage.setItem("user",JSON.stringify(b.user)),Te.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"),p){sessionStorage.removeItem("sso_redirect_uri");const j=p.includes("?")?"&":"?";window.location.href=`${p}${j}token=${encodeURIComponent(b.token)}&refreshToken=${encodeURIComponent(b.refreshToken)}`;return}window.location.href="/myspace"}catch(y){if(y instanceof ls)f({message:y.message,code:"NETWORK_ERROR"});else if(y instanceof dr)f({message:y.message,code:y.code});else{const h=y instanceof Error?y.message:"Une erreur inattendue est survenue";f({message:h})}Te.logError(y instanceof Error?y:new Error(String(y)),"LoginPage.handleSubmit",{email:t})}finally{u(!1)}},[t,r,p]);return{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:d,error:m,handleSubmit:v}}const _l=[{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"}],Bl=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"})}},ql=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 zl(){const{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:u,error:d,handleSubmit:x}=Ul();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:_l.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("p",{className:"text-sm text-white/60",children:["© ",new Date().getFullYear()," SmartStack — Plateforme de gestion unifiée"]})]})]}),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"})]}),d&&e.jsxs("div",{className:`mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 ${ql(d.code)}`,children:[Bl(d.code),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:d.message}),d.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."}),d.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"}),u==="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 Gl(){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 Kl=n.lazy(()=>Promise.resolve().then(()=>oi).then(t=>({default:t.PublicLayout}))),Xt=n.lazy(()=>Promise.resolve().then(()=>ei).then(t=>({default:t.AppLayout}))),Hl=n.lazy(()=>Promise.resolve().then(()=>require("./RegisterPage-BejbbAl9.cjs")).then(t=>({default:t.RegisterPage}))),Vl=n.lazy(()=>Promise.resolve().then(()=>require("./ConfirmEmailPage-B3mrPUvg.cjs")).then(t=>({default:t.ConfirmEmailPage}))),Wl=n.lazy(()=>Promise.resolve().then(()=>require("./ForgotPasswordPage-C7mySa8O.cjs")).then(t=>({default:t.ForgotPasswordPage}))),Xl=n.lazy(()=>Promise.resolve().then(()=>require("./ResetPasswordPage-7brP8dT7.cjs")).then(t=>({default:t.ResetPasswordPage}))),Yl=n.lazy(()=>Promise.resolve().then(()=>require("./ForceChangePasswordPage-BqNyswSy.cjs")).then(t=>({default:t.ForceChangePasswordPage}))),Jl=n.lazy(()=>Promise.resolve().then(()=>require("./AuthCallbackPage-D_g2VCjj.cjs")).then(t=>({default:t.AuthCallbackPage}))),Ql=n.lazy(()=>Promise.resolve().then(()=>require("./OnboardingWizardPage-CgEpUx9X.cjs")).then(t=>({default:t.OnboardingWizardPage}))),Zl={".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"},ec={"administration.configuration.settings":{defaultTab:"general",tabs:["general","file-upload","legal-file"]},"administration.configuration.appsettings":{defaultTab:"infrastructure",tabs:["infrastructure","authentication","logging","email","entra"]}};function vs(t,s){const r=[];for(const[a,o]of Object.entries(Zl)){const c=`${t}${a}`,i=Ee.resolve(c);if(i){const u=s.replace(/^\//,"")+o;r.push({path:u,Component:i})}}return r}function tc(t,s,r,a){const o=[],c=r.route?.replace(`/${a}/`,"")||`${t.code}/${s.code}/${r.code}`,i=Ee.resolve(r.componentKey);if(i){const u=i;o.push(e.jsx(N.Route,{path:c,element:e.jsx(u,{})},r.componentKey))}if(r.route)for(const u of vs(r.componentKey,c)){const d=u.Component;o.push(e.jsx(N.Route,{path:u.path,element:e.jsx(d,{})},`${r.componentKey}-implicit-${u.path}`))}return o}function sc(t,s,r){const a=[],o=s.route?.replace(`/${r}/`,"")||`${t.code}/${s.code}`,c=ec[s.componentKey];if(c){const u=Ee.resolve(s.componentKey);if(u){const d=c.tabs.map(x=>{const m=`${s.componentKey}.${x}`,f=Ee.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(u,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(N.Navigate,{to:c.defaultTab,replace:!0})}),d]},s.componentKey)),a}}const i=Ee.resolve(s.componentKey);if(i){const u=i;a.push(e.jsx(N.Route,{path:o,element:e.jsx(u,{})},s.componentKey))}if(!i&&s.resources.length>0){const u=s.resources[0];a.push(e.jsx(N.Route,{path:o,element:e.jsx(N.Navigate,{to:u.code,replace:!0})},`${s.componentKey}-redirect`))}if(s.route)for(const u of vs(s.componentKey,o)){const d=u.Component;a.push(e.jsx(N.Route,{path:u.path,element:e.jsx(d,{})},`${s.componentKey}-implicit-${u.path}`))}for(const u of s.resources){const d=tc(t,s,u,r);a.push(...d)}return a}function rc(t,s){const r=[],a=t.route?.replace(`/${s}/`,"")||t.code,o=Ee.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 vs(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=sc(t,c,s);r.push(...i)}return r}function ac(t){const s=[],r=Ee.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=rc(a,t.code);a.requiredFeature?s.push(e.jsx(N.Route,{element:e.jsx(bs,{feature:a.requiredFeature}),children:o},`feature-${a.componentKey}`)):s.push(...o)}return s}function nc(t,s){return t.requiredFeature?[e.jsx(N.Route,{element:e.jsx(bs,{feature:t.requiredFeature}),children:s},`feature-${t.code}`)]:s}function Bs({pageKey:t}){const s=Ee.resolve(t);return s?e.jsx(s,{}):null}function oc(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 ic(){const{isLoading:t}=Pe(),{currentTenant:s}=$e(),{user:r}=Re(),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("."),u=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(as,{reason:"tenant",tenantName:s?.name,permissionPath:i||void 0,applicationsUrl:u,userRoles:r?.roles,userPermissions:r?.permissions})})})]})}function lc(){const{isLoading:t}=Pe();return!!localStorage.getItem("token")&&t?e.jsx(Nt,{}):e.jsx(Gl,{})}function cc(){const{menu:t,isLoading:s}=Pe(),r=n.useMemo(()=>!t||s?[]:t.applications.map(o=>{const c=o.route?.replace(/^\//,"")||o.code,i=ac(o),u=nc(o,i),d=oc(o.code);return e.jsxs(N.Route,{path:c,element:e.jsx(Xt,{}),children:[u,d]},o.code)}),[t,s]),a=e.jsx(e.Fragment,{children:e.jsx(N.Route,{element:e.jsx(da,{}),children:e.jsxs(N.Route,{element:e.jsx(ua,{}),children:[r,Ee.has("applications")&&e.jsx(N.Route,{path:"applications",element:e.jsx(Xt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Bs,{pageKey:"applications"})})}),Ee.has("notifications")&&e.jsx(N.Route,{path:"notifications",element:e.jsx(Xt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Bs,{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(ic,{})})]})})});return e.jsxs(n.Suspense,{fallback:e.jsx(Nt,{}),children:[e.jsx(Mr,{}),e.jsx(Fr,{}),e.jsxs(N.Routes,{children:[e.jsx(N.Route,{path:"/",element:e.jsx(Kl,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Ol,{})})}),Ll(),e.jsx(N.Route,{path:"/login",element:e.jsx(zl,{})}),e.jsx(N.Route,{path:"/register",element:e.jsx(Hl,{})}),e.jsx(N.Route,{path:"/confirm-email",element:e.jsx(Vl,{})}),e.jsx(N.Route,{path:"/forgot-password",element:e.jsx(Wl,{})}),e.jsx(N.Route,{path:"/reset-password",element:e.jsx(Xl,{})}),e.jsx(N.Route,{path:"/force-change-password",element:e.jsx(Yl,{})}),e.jsx(N.Route,{path:"/auth/callback",element:e.jsx(Jl,{})}),e.jsx(N.Route,{path:"/auth/onboarding",element:e.jsx(Ql,{})}),e.jsx(N.Route,{path:"/t/:slug",element:e.jsx(Os,{}),children:a}),e.jsx(N.Route,{element:e.jsx(Os,{}),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(lc,{})})]})]})}function qs({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function dc(t,s){return t?"bg-[var(--color-accent-100)] border border-[var(--color-accent-500)]":s?"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)]"}function pa({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["common","navigation"]),{menu:a}=Pe(),{favorites:o,toggleFavorite:c,isFavorite:i,canAddMore:u,maxFavorites:d}=ze();if(!t)return null;const x=[];a?.applications.forEach(f=>{(f.modules?.length??0)>0&&x.push({app:f,modules:f.modules})});const m=(f,p)=>{const v=[...f.sections||[]].sort((h,b)=>h.displayOrder-b.displayOrder),g=v.length>0&&v[0].route?v[0].route:`/${p.code}/${f.code}`,y={id:f.id,code:f.code,label:f.label,icon:f.icon||"Star",route:g,applicationCode:p.code,applicationLabel:p.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:d})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{const f={component:"FavoritesModal",url:window.location.href},p=`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(p,"_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:p})=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(qs,{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:p.map(v=>{const g=i(v.id),y=!g&&!u;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 ${dc(g,y)}`,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(qs,{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 uc({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function mc({className:t=""}){const{t:s}=ne.useTranslation(["common"]),r=N.useNavigate(),{favorites:a,maxFavorites:o}=ze(),{triggerExpand:c}=ze(),{menu:i}=Pe(),[u,d]=n.useState(!1),x=o-a.length,m=p=>{if(i)for(const v of i.applications){const g=v.modules.find(y=>y.id===p.id);if(g?.sections?.length){const y=[...g.sections].sort((h,b)=>h.displayOrder-b.displayOrder)[0];if(y.route)return y.route}}return p.route},f=p=>{const v=m(p);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:()=>d(!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(p=>e.jsxs("button",{onClick:()=>f(p),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:`${p.applicationLabel} - ${p.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(uc,{name:p.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:p.label})]},p.id)),Array.from({length:x}).map((p,v)=>e.jsxs("button",{onClick:()=>d(!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(pa,{isOpen:u,onClose:()=>d(!1)})]})}function xc({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"})]})]},`skeleton-${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(pc,{activity:r,isLast:a===t.length-1},r.id))})]})}function pc({activity:t,isLast:s}){const{icon:r,color:a,bgColor:o}=fc(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:Ac(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:Rc(t.createdAt)})]})})]})}const hc={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)]"}},gc={icon:l.RefreshCcw,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"};function fc(t){return hc[t]||gc}const bc=t=>t.oldValue&&t.newValue?`changed status from ${t.oldValue} to ${t.newValue}`:"changed the status",vc=t=>t.oldValue&&t.newValue?`changed priority from ${t.oldValue} to ${t.newValue}`:"changed the priority",yc=t=>t.newValue?`assigned to ${t.newValue}`:"unassigned the ticket",jc=t=>t.newValue==="internal"?"added an internal note":"added a comment",wc=t=>t.newValue?`added attachment: ${t.newValue}`:"added an attachment",Nc=t=>t.newValue==="response"?"Response SLA was breached":"Resolution SLA was breached",Sc=t=>t.newValue?`escalated to ${t.newValue}`:"escalated this ticket",Cc=t=>t.fieldChanged?`updated ${t.fieldChanged}`:"updated the ticket",kc={Created:()=>"created this ticket",StatusChanged:bc,PriorityChanged:vc,Assigned:yc,Commented:jc,AttachmentAdded:wc,Resolved:()=>"resolved this ticket",Closed:()=>"closed this ticket",Reopened:()=>"reopened this ticket",SlaBreached:Nc,Escalated:Sc,Updated:Cc,OnHold:()=>"put this ticket on hold",InProgress:()=>"started working on this ticket"};function Ac(t){const s=kc[t.action];return s?s(t):t.action.toLowerCase()}function Rc(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:u=0,showDetails:d=!1}){const x=new Date,m=new Date(t),f=new Date(s),p=m.getTime()-x.getTime(),v=f.getTime()-x.getTime(),g=!!o;let y="ok",h="green",b=l.CheckCircle;c?(y="paused",h="gray",b=l.Pause):r||a?(y="breached",h="red",b=l.XCircle):(!g&&p<1800*1e3||v<3600*1e3)&&(y="warning",h="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 d?e.jsxs("div",{className:`p-3 rounded-lg border ${j[h]}`,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"}),!r&&g&&e.jsx("span",{className:"text-[var(--success-text)] font-medium",children:"Completed"}),!r&&!g&&e.jsx("span",{children:Gs(p)})]}),!g&&!r&&e.jsx(zs,{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:Gs(v)})]}),!a&&e.jsx(zs,{percentage:u})]})]})]}):e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium border ${j[h]}`,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 zs({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 Gs(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 Ks={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)]"},Tc=[{code:"fr",label:"Français"},{code:"en",label:"English"},{code:"de",label:"Deutsch"},{code:"it",label:"Italiano"}];function Ec({isOpen:t,onClose:s,onSelect:r,ticketVariables:a}){const{t:o,i18n:c}=ne.useTranslation("support"),[i,u]=n.useState([]),[d,x]=n.useState(!1),[m,f]=n.useState(null),[p,v]=n.useState(""),[g,y]=n.useState(""),[h,b]=n.useState(c.language?.substring(0,2)||"fr"),[j,S]=n.useState([]),w=n.useCallback(k=>{x(!0),Promise.all([zt.getAll(void 0,!0,k),zt.getCategories()]).then(([P,L])=>{u(P),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 E=k=>{b(k),w(k)};if(!t)return null;const $=i.filter(k=>{const P=!p||k.title.toLowerCase().includes(p.toLowerCase())||k.content.toLowerCase().includes(p.toLowerCase()),L=!g||k.category===g;return P&&L}),A=async k=>{try{f(k.id);const P=await zt.render(k.id,a);r(P.content),s()}catch(P){console.error("Failed to render template:",P)}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,onKeyDown:k=>k.key==="Escape"&&s(),role:"presentation",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(),role:"presentation",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:Tc.map(k=>e.jsx("button",{onClick:()=>E(k.code),className:`px-2 py-1 text-xs rounded transition-colors ${h===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:p,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":`${Ks[k]||"bg-[var(--bg-secondary)] text-[var(--text-secondary)]"} hover:opacity-80`}`,children:o(`templates.categories.${k}`,{defaultValue:k})},k))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",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(--text-tertiary)]"})}),!d&&$.length===0&&e.jsx("p",{className:"text-center py-8 text-sm text-[var(--text-tertiary)]",children:o("templatePicker.noResults")}),!d&&$.length>0&&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 ${Ks[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 Hs={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"}},ha=(t,s,r)=>{const a=new Date(t),c=new Date().getTime()-a.getTime(),i=Math.floor(c/6e4),u=Math.floor(c/36e5),d=Math.floor(c/864e5);return i<1?s("history.timeAgo.now"):i<60?s("history.timeAgo.minutes",{count:i}):u<24?s("history.timeAgo.hours",{count:u}):d<7?s("history.timeAgo.days",{count:d}):a.toLocaleDateString(r,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},$c=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Vs=t=>t?.startsWith("image/")||!1,Ic=(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 Lc(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,u)=>i.timestamp.getTime()-u.timestamp.getTime()),a}function Dc({activity:t,t:s,locale:r}){const a=Hs[t.action]||Hs.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:ha(t.createdAt,s,r)})]})})}const Mc=t=>{const s=t.trim().split(/\s+/);return s.length>=2?((s[0]?.at(0)??"")+(s.at(-1)?.at(0)??"")).toUpperCase():t.slice(0,2).toUpperCase()},Fc=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 Ws({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,u]=n.useState(!0),[d,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return ke.get(t,{responseType:"blob",signal:f.signal}).then(p=>{if(m){const v=URL.createObjectURL(p.data);c(v),u(!1)}}).catch(()=>{m&&(x(!0),u(!1))}),()=>{m=!1,f.abort(),o&&URL.revokeObjectURL(o)}},[t]),i?e.jsx("button",{type:"button",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)]"})}):d||!o?e.jsx("button",{type:"button",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 Oc({comment:t,isOwn:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:i,locale:u}){const[d,x]=n.useState(null),m=new Date(t.createdAt).getTime(),f=a.filter(h=>{const b=new Date(h.createdAt).getTime();return Math.abs(b-m)<6e4}),p=f.filter(h=>Vs(h.contentType)),v=f.filter(h=>!Vs(h.contentType)),g=Mc(t.userName),y=Fc(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:Ic(t.isInternal||!1,s),children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:t.content}),p.length>0&&e.jsx("div",{className:`mt-3 grid gap-2 ${p.length>1?"grid-cols-2":"grid-cols-1"}`,children:p.map(h=>e.jsxs("button",{className:"relative cursor-pointer rounded-lg overflow-hidden group",onClick:()=>x(h),type:"button",children:[e.jsx(Ws,{src:o(h),alt:h.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"})})]},h.id))}),v.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:v.map(h=>e.jsxs("button",{onClick:()=>c(h),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:h.fileName}),e.jsx("span",{className:"text-xs opacity-70",children:$c(h.fileSize)}),e.jsx(l.Download,{className:"w-3.5 h-3.5"})]},h.id))})]}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 px-1",children:ha(t.createdAt,i,u)})]})]}),d&&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),onKeyDown:h=>h.key==="Escape"&&x(null),role:"presentation",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(Ws,{src:o(d),alt:d?.fileName,className:"max-w-full max-h-[80vh] mx-auto object-contain rounded-lg",onClick:h=>h.stopPropagation()}),e.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[e.jsx("p",{className:"text-white text-sm",children:d.fileName}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c(d)},className:"btn btn-secondary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),i("conversation.download")]})]})]})})]})}const Uc=(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..."),_c=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`,Bc=(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 qc({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 zc({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 Gc({timeline:t,currentUserName:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,messagesEndRef:i,t:u,locale:d}){return e.jsxs(e.Fragment,{children:[t.map(x=>{if(x.type==="activity")return e.jsx(Dc,{activity:x.data,t:u,locale:d},x.id);const m=x.data,f=m.userName===s;return e.jsx(Oc,{comment:m,isOwn:f,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:u,locale:d},x.id)}),e.jsx("div",{ref:i})]})}function Kc({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 Hc({newComment:t,onCommentChange:s,onKeyDown:r,onSend:a,isInternalComment:o,onInternalToggle:c,sending:i,isSupport:u,textareaRef:d,ticketVariables:x,onOpenTemplatePicker:m,t:f}){const p=t.trim();return e.jsxs("div",{className:"border-t border-[var(--border-color)] bg-[var(--bg-card)] p-3",children:[u&&e.jsx(Kc,{isInternalComment:o,onToggle:c,t:f}),e.jsxs("div",{className:_c(o),children:[e.jsx("textarea",{ref:d,value:t,onChange:v=>s(v.target.value),onKeyDown:r,placeholder:Uc(o,u,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:[u&&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:!p||i,className:Bc(!!p),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 Vc({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 ga({comments:t,activities:s,attachments:r,isSupport:a,isClosed:o,isConnected:c,currentUserName:i,ticketVariables:u,onAddComment:d,onDownloadAttachment:x,getAttachmentUrl:m}){const{t:f,i18n:p}=ne.useTranslation("support"),[v,g]=n.useState(""),[y,h]=n.useState(!1),[b,j]=n.useState(!1),[S,w]=n.useState(!1),E=n.useRef(null),$=n.useRef(null),A=Lc(t,s,a),k=t.filter(C=>a||!C.isInternal).length;n.useEffect(()=>{E.current?.scrollIntoView({behavior:"smooth"})},[A.length]),n.useEffect(()=>{$.current&&($.current.style.height="auto",$.current.style.height=`${Math.min($.current.scrollHeight,150)}px`)},[v]);const P=async()=>{if(!(!v.trim()||b))try{j(!0),await d(v,y),g(""),h(!1)}finally{j(!1)}},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),P())},I=C=>{g(F=>F?F+`
47
+ `+C:C)};return e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsx(qc,{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(zc,{t:f}):e.jsx(Gc,{timeline:A,currentUserName:i,isSupport:a,attachments:r,getAttachmentUrl:m,onDownloadAttachment:x,messagesEndRef:E,t:f,locale:p.language})}),o?e.jsx(Vc,{t:f}):e.jsx(Hc,{newComment:v,onCommentChange:g,onKeyDown:L,onSend:P,isInternalComment:y,onInternalToggle:h,sending:b,isSupport:a,textareaRef:$,ticketVariables:u,onOpenTemplatePicker:a&&u?()=>w(!0):void 0,t:f}),u&&e.jsx(Ec,{isOpen:S,onClose:()=>w(!1),onSelect:I,ticketVariables:u})]})}const Xs=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"],u=["mp3","wav","ogg","aac","m4a"];return o.includes(a)?"image":a==="pdf"?"pdf":c.includes(a)?"text":i.includes(a)?"video":u.includes(a)?"audio":"unknown"},Ys=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`;function Wc({attachment:t,getUrl:s,onClose:r,onDownload:a}){const{t:o}=ne.useTranslation("support"),[c,i]=n.useState(1),[u,d]=n.useState(0),[x,m]=n.useState(!0),[f,p]=n.useState(null),[v,g]=n.useState(null),[y,h]=n.useState(!1),[b,j]=n.useState(null),S=n.useRef(null),w=t?Xs(t):"unknown";n.useEffect(()=>{if(S.current?.id===t?.id||(S.current=t,b&&URL.revokeObjectURL(b),i(1),d(0),m(!0),p(null),g(null),j(null),h(!1),!t))return;const L=Xs(t),I=s(t),C=new AbortController;return L==="text"?ke.get(I,{signal:C.signal,responseType:"text"}).then(F=>{g(F.data),m(!1)}).catch(F=>{F.name==="CanceledError"||F.code==="ERR_CANCELED"||(p(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="image"||L==="video"||L==="audio"?ke.get(I,{signal:C.signal,responseType:"blob"}).then(F=>{const W=URL.createObjectURL(F.data);j(W),m(!1)}).catch(F=>{F.name==="CanceledError"||F.code==="ERR_CANCELED"||(p(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="pdf"?ke.get(I,{signal:C.signal,responseType:"blob"}).then(F=>{const W=URL.createObjectURL(F.data);j(W),m(!1)}).catch(F=>{F.name==="CanceledError"||F.code==="ERR_CANCELED"||(p(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?h(!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(),d(C=>(C+90)%360)),I.key==="f"&&(I.preventDefault(),h(C=>!C))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,y,r]);const E=n.useCallback(()=>i(L=>Math.min(L+.25,3)),[]),$=n.useCallback(()=>i(L=>Math.max(L-.25,.25)),[]),A=n.useCallback(()=>d(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(${u}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:Ys(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")]})]})}},P=e.jsxs("div",{className:"fixed inset-0 bg-black/90 backdrop-blur-sm flex flex-col z-[100]",onClick:r,onKeyDown:L=>{L.key==="Escape"&&r()},role:"dialog","aria-modal":"true","aria-label":t.fileName,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:Ys(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:E,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:()=>h(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(P,document.body)}const Js={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"}},Xc=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Qs=t=>t?.startsWith("image/")||!1;function Yc({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,u]=n.useState(!0),[d,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return ke.get(t,{responseType:"blob",signal:f.signal}).then(p=>{if(m){const v=URL.createObjectURL(p.data);c(v),u(!1)}}).catch(()=>{m&&(x(!0),u(!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)]"})}):d||!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 Jc={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)"}},Qc=(t,s)=>{const r=new Date(t),o=new Date().getTime()-r.getTime(),c=Math.floor(o/6e4),i=Math.floor(o/36e5),u=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}):u<7?s("sidebar.timeAgo.days",{count:u}):r.toLocaleDateString(void 0,{day:"numeric",month:"short"})},Zc=10*1024*1024,Zs=[".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 fa({ticket:t,attachments:s,activities:r,isSupport:a,saving:o,uploading:c,layout:i="compact",onAssign:u,onStatusChange:d,onResolve:x,onCloseTicket:m,onReopen:f,onEscalate:p,onDownloadAttachment:v,onUploadAttachment:g,getAttachmentUrl:y}){const{t:h}=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),[E,$]=n.useState(!1),[A,k]=n.useState(null),P=n.useRef(null),L=n.useCallback(M=>{if(M.type.startsWith("image/"))return!0;const te="."+M.name.split(".").pop()?.toLowerCase();return Zs.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>Zc){k(h("sidebar.fileTooLarge","File too large (max 10 MB)"));continue}if(!L(oe)){k(h("sidebar.fileTypeNotAllowed","File type not allowed"));continue}try{await g(oe)}catch{k(h("sidebar.uploadError","Upload failed"))}}}},[g,L,h]),C=n.useCallback(M=>{M.preventDefault(),M.stopPropagation()},[]),F=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!0)},[]),W=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1)},[]),R=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1),I(M.dataTransfer.files)},[I]),q=s.filter(M=>Qs(M.contentType)),V=s.filter(M=>!Qs(M.contentType)),z=t.clientContext,J=n.useCallback(M=>{j(te=>{const oe=new Set(te);return oe.has(M)?oe.delete(M):oe.add(M),oe})},[]),he=t.status==="Closed"||t.status==="Rejected",B=i==="grid",Y=B?"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:B?"":"h-full flex flex-col bg-[var(--bg-card)] overflow-hidden",children:[e.jsxs("div",{className:B?"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:h("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:h("sidebar.type","Type")}),e.jsx("dd",{className:"font-medium",children:h(`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:h("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:Js[t.priority]?.bg,color:Js[t.priority]?.text},children:h(`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:h("sidebar.createdBy","Created by")}),e.jsx("dd",{children:t.createdByName||h("sidebar.unknown","Unknown")})]}),e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:h("sidebar.assignedTo","Assigned to")}),e.jsxs("dd",{className:"flex flex-col items-end gap-1",children:[(t?.assignees?.length??0)>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:h("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:["(",h("sidebar.viaGroup",{groupName:M.assignedViaGroupName}),")"]})]},M.userId))}):e.jsx("span",{className:"text-sm",children:h("sidebar.unassigned","Unassigned")}),u&&e.jsx("button",{onClick:u,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:h("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:h("sidebar.updatedAt","Updated")}),e.jsx("dd",{className:"text-xs",children:new Date(t.updatedAt).toLocaleString()})]})]})})]}),a&&z&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"system",icon:l.Monitor,title:h("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:[z?.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"}),h("sidebar.url","URL")]}),e.jsx("p",{className:"text-xs font-mono break-all",children:z.sourceUrl})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[z.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"}),h("sidebar.browser","Browser")]}),e.jsx("p",{className:"text-xs font-medium",children:z.browser.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:z.browser.version})]}),z.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"}),h("sidebar.os","OS")]}),e.jsx("p",{className:"text-xs font-medium",children:z.os.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:z.os.version})]})]}),z.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"}),h("sidebar.device","Device")]}),e.jsxs("p",{className:"text-xs font-medium",children:[z.device.type||h("sidebar.defaultDeviceType","Desktop"),z.device.screenResolution&&` • ${z.device.screenResolution}`]})]})]})]}),a&&z&&(z?.recentErrors?.length??0)>0&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"errors",icon:l.Bug,title:h("details.errors","Erreurs"),count:z?.recentErrors?.length??0,isExpanded:b.has("errors"),onToggle:J}),b.has("errors")&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:z?.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:h("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:[q.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"}),h("sidebar.images","Images")," (",q.length,")"]}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:q.map(M=>e.jsxs("button",{type:"button",className:"relative cursor-pointer rounded overflow-hidden border border-[var(--border-color)] aspect-square group",onClick:()=>w(M),children:[e.jsx(Yc,{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))})]}),V.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"}),h("sidebar.documents","Documents")," (",V.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:V.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:Xc(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:h("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:h("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&&!he&&g&&e.jsxs("div",{children:[e.jsx("input",{ref:P,type:"file",multiple:!0,onChange:M=>I(M.target.files),accept:Zs.join(","),className:"hidden"}),e.jsx("div",{className:`border-2 border-dashed rounded-lg p-3 text-center transition-colors cursor-pointer ${E?"border-[var(--color-accent-500)] bg-[var(--color-accent-500)]/10":"border-[var(--border-color)] hover:border-[var(--color-accent-500)]"}`,onClick:()=>P.current?.click(),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),P.current?.click())},role:"button",tabIndex:0,onDragOver:C,onDragEnter:F,onDragLeave:W,onDrop:R,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:h("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:E?h("sidebar.dropHere","Drop here"):h("sidebar.addFile","Add a file")})]})}),A&&e.jsx("p",{className:"mt-2 text-xs text-[var(--error-text)]",children:A})]}),s.length===0&&(!a||he||!g)&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center py-2",children:h("sidebar.noAttachments","No attachments")})]})]}),a&&!B&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"actions",icon:l.User,title:h("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"&&d&&e.jsx("button",{onClick:()=>d("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:h("sidebar.startProcessing","Start processing")}),t.status==="InProgress"&&e.jsxs(e.Fragment,{children:[d&&e.jsx("button",{onClick:()=>d("OnHold"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:h("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"}),h("sidebar.resolve","Resolve")]})]}),t.status==="OnHold"&&d&&e.jsx("button",{onClick:()=>d("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:h("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"}),h("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"}),h("sidebar.reopen","Reopen")]}),!he&&p&&e.jsxs("button",{onClick:p,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"}),h("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:B?Y:"px-2 py-1",children:[e.jsx(it,{section:"history",icon:l.History,title:h("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=Jc[M.action]||{icon:l.Edit,color:"var(--text-secondary)"},le=oe.icon,O=h(`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:[O,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:Qc(M.createdAt,h)})]})]},`activity-${M.action}-${te}`)})}),r.length>10&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center mt-3",children:h("sidebar.moreActivities",{count:r.length-10})})]})})]})]}),e.jsx(Wc,{attachment:S,getUrl:y,onClose:()=>w(null),onDownload:v})]})}const Yt=["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)"}},ed=t=>new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),td=t=>t.isActive?"ring-4 ring-opacity-30":t.isPast?"bg-[var(--success-bg)]":"bg-[var(--bg-secondary)] border-2 border-[var(--border-color)]",sd=(t,s)=>{if(t.isActive)return s.color;if(t.isPast)return"var(--success-bg)"},rd=(t,s)=>({backgroundColor:sd(t,s),boxShadow:t.isActive?`0 0 0 4px ${s.color}30`:void 0}),ad=t=>t.isActive?"white":t.isPast?"var(--success-text)":"var(--text-tertiary)",nd=t=>t.isActive?"text-[var(--text-primary)]":t.isPast?"text-[var(--success-text)]":"text-[var(--text-tertiary)]",od=(t,s)=>t.isPast?"var(--success-text)":t.isActive?s.color:"var(--border-color)";function id({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 ${td(t)}`,style:rd(t,s),children:e.jsx(r,{className:"w-5 h-5",style:{color:ad(t)}})})}function ld({step:t}){return e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("p",{className:`text-xs font-medium ${nd(t)}`,children:t.label}),t.date&&(t.isActive||t.isPast)&&e.jsx("p",{className:"text-[10px] text-[var(--text-secondary)] mt-0.5",children:ed(t.date)})]})}function cd({step:t,config:s,isLast:r}){return r?null:e.jsx("div",{className:"flex-1 h-0.5 mx-2 mt-[-20px]",style:{backgroundColor:od(t,s)}})}function dd({currentStatus:t,createdAt:s,resolvedAt:r,closedAt:a,activities:o=[],isSupport:c,saving:i,assignees:u,onAssign:d,onStatusChange:x,onResolve:m,onCloseTicket:f,onReopen:p,onEscalate:v}){const{t:g}=ne.useTranslation("support"),y=t==="Rejected",h=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=Yt.indexOf(t),w=[],E={Open:s};o.filter(A=>A.action==="StatusChanged"&&A.newValue).forEach(A=>{A.newValue&&(E[A.newValue]=A.createdAt)}),r&&(E.Resolved=r),a&&(E.Closed=a);const $=o.some(A=>A.action==="StatusChanged"&&A.newValue==="OnHold");if(Yt.forEach(A=>{const k=Ye[A],P=A===t?S:Yt.indexOf(A),L=A===t,I=P<S,C=P>S;w.push({status:A,label:g(`tickets.statuses.${A}`,{defaultValue:k.label}),icon:k.icon,date:E[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:E.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 E=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(id,{step:S,config:E}),e.jsx(ld,{step:S})]}),e.jsx(cd,{step:S,config:E,isLast:$})]},S.status)}),h&&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:[(u?.length??0)>0?e.jsxs("div",{className:"flex items-center -space-x-1.5",title:u?.map(S=>S.fullName).join(", "),children:[u?.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)),(u?.length??0)>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:["+",(u?.length??0)-3]})]}):e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)] italic",children:g("workflow.notAssigned","Non assigné")}),d&&e.jsx("button",{onClick:d,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")&&p&&e.jsxs("button",{onClick:p,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"}},er={Proposed:l.Clock,Approved:l.CheckCircle,Rejected:l.XCircle,Superseded:l.AlertCircle};function ud({ticketId:t,solutions:s,activeSolution:r,mode:a,onProposeSolution:o,onApproveSolution:c,onRejectSolution:i,isLoading:u}){const{t:d}=ne.useTranslation("support"),[x,m]=n.useState(!1),[f,p]=n.useState(""),[v,g]=n.useState(!1),[y,h]=n.useState(""),[b,j]=n.useState(!1),[S,w]=n.useState(!1),E=n.useCallback(async()=>{if(!(!f.trim()||!o)){m(!0);try{await o(f),p("")}finally{m(!1)}}},[f,o]),$=n.useCallback(()=>{j(!0)},[]),A=n.useCallback(async()=>{if(!(!y.trim()||!i)){g(!0);try{await i(y),h(""),j(!1)}finally{g(!1)}}},[y,i]),k=P=>{if(!P.autoCloseAt)return null;const L=new Date(P.autoCloseAt),I=new Date,C=L.getTime()-I.getTime(),F=Math.ceil(C/(1e3*60*60*24));return F>0?F: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:d("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:P=>p(P.target.value),placeholder:d("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||u}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:E,disabled:!f.trim()||x||u,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"}),d("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),d("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 P=er[r.status];return e.jsx(P,{className:`w-5 h-5 ${lt[r.status].text}`})})(),e.jsxs("div",{children:[e.jsx("h4",{className:`font-semibold ${lt[r.status].text}`,children:d(`solution.status.${r.status.toLowerCase()}`,r.status)}),e.jsxs("p",{className:"text-sm opacity-75",children:[d("solution.solutionNumber","Solution #"),r.solutionNumber," - ",d("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:[d("solution.autoCloseWarning","Will be auto-approved in")," ",e.jsxs("strong",{children:[k(r)," ",d("solution.autoCloseCountdown","days")]}),r.autoCloseWarningSent&&e.jsxs(e.Fragment,{children:[" (",d("solution.warningEmailSent","warning email sent"),")"]})]})}),r.status==="Approved"&&e.jsxs("p",{className:"text-sm",children:[d("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:[d("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:[d("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||u,className:"btn btn-secondary text-sm py-1.5",children:d("solution.rejectSolution","Reject")}),e.jsx("button",{onClick:c,disabled:v||u||!c,className:"btn btn-primary text-sm py-1.5 flex items-center gap-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}),d("solution.acceptSolution","Approve")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.CheckCircle,{className:"w-3 h-3"}),d("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:d("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:P=>p(P.target.value),placeholder:d("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||u}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:E,disabled:!f.trim()||x||u,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"}),d("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),d("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:[d("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(P=>e.jsxs("div",{className:`rounded-lg border p-3 ${lt[P.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=er[P.status];return e.jsx(L,{className:`w-4 h-4 ${lt[P.status].text}`})})(),e.jsx("span",{className:"text-sm font-medium",children:d(`solution.status.${P.status.toLowerCase()}`,P.status)}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:["#",P.solutionNumber]})]}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(P.proposedAt).toLocaleDateString()})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 line-clamp-2",children:P.content}),e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)]",children:[d("solution.proposedBy","Proposed by")," ",P.proposedByUserName||"Unknown"]})]},P.id))})]}),s.length===0&&a==="client"&&e.jsx("div",{className:"text-center py-6 text-[var(--text-tertiary)]",children:e.jsx("p",{children:d("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:d("solution.rejectSolution","Reject Solution")}),e.jsx("textarea",{value:y,onChange:P=>h(P.target.value),placeholder:d("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:d("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"}),d("solution.rejectSolution","Reject")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.XCircle,{className:"w-4 h-4"}),d("solution.rejectSolution","Reject")]})})]})]})})]})}const md={getCached:t=>D.get(`/api/support/ai-routing/cached/${t}`)},ba={analyze:t=>D.get(`/api/support/ai-routing/analyze/${t}`)},va={summarize:t=>D.post(`/api/support/ai-routing/summarize/${t}`)},ya={applyRouting:(t,s)=>D.post(`/api/support/ai-routing/apply/${t}`,s)},tr=Object.freeze(Object.defineProperty({__proto__:null,analyzeApi:ba,cachedAiApi:md,routingApi:ya,summarizeApi:va},Symbol.toStringTag,{value:"Module"}));function ja({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 wa(t){const[s,r]=n.useState(t?.initialData??null),[a,o]=n.useState(!1),[c,i]=n.useState(null),u=n.useRef(null),d=n.useRef(!1);n.useEffect(()=>(d.current=!1,()=>{d.current=!0,u.current?.abort()}),[]);const x=n.useCallback(async p=>{u.current?.abort();const v=new AbortController;u.current=v,o(!0),i(null);try{const g=await p(v.signal);!d.current&&!v.signal.aborted&&r(g)}catch(g){!d.current&&!v.signal.aborted&&i(g instanceof Error?g.message:"Unknown error")}finally{!d.current&&!v.signal.aborted&&o(!1)}},[]),m=n.useCallback(()=>{u.current?.abort(),d.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 xd({ticketId:t,cachedClassification:s,cachedRouting:r,cachedGeneratedAt:a,processing:o,onProcessingStart:c,onProcessingEnd:i}){const{t:u}=ne.useTranslation("support"),d=s||r?{classification:s??null,routingSuggestion:r??null,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:x,loading:m,error:f,execute:p,reset:v}=wa({initialData:d}),[g,y]=n.useState(!1),h=n.useCallback(async()=>{c?.(),await p(async()=>{const w=await ba.analyze(t);return i?.(),w})},[t,p,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 ya.applyRouting(t,w),v()}catch{}finally{y(!1)}},[x,v,u]);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:u("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:f}),e.jsxs("button",{onClick:h,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"}),u("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:u("aiRouting.processing")})]})}):e.jsxs("button",{onClick:h,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"}),u("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,E=w&&u(w)!==w?u(w):x.errorMessage??u("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:E})]})})}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:u("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:x.errorMessage??u("aiRouting.notAvailable")}),e.jsxs("button",{onClick:h,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"}),u("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:u("aiRouting.suggestedRouting")}),e.jsxs("button",{onClick:h,disabled:m,className:"btn btn-secondary btn-sm flex items-center gap-1",title:u("aiRouting.refresh"),children:[m?e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}):e.jsx(l.RefreshCw,{className:"w-3 h-3"}),u("aiRouting.refresh")]})]}),S&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-3",children:u("aiRouting.generatedAt",{date:S.toLocaleString()})}),e.jsxs("div",{className:"space-y-3",children:[x?.classification&&e.jsx(ja,{classification:x.classification}),(j?.suggestedAgents?.length??0)>0&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-2",children:u("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:u("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:u("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"}),u("aiRouting.apply")]})})]})]})]})]})})}function pd({ticketId:t,cachedSummary:s,cachedGeneratedAt:r,processing:a,onProcessingStart:o,onProcessingEnd:c}){const{t:i}=ne.useTranslation("support"),u=s?{summary:s,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:d,loading:x,error:m,execute:f}=wa({initialData:u}),p=n.useCallback(async()=>{o?.(),await f(async()=>{const y=await va.summarize(t);return c?.(),y})},[t,f,o,c]);if(m&&!d)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:p,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(!d)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:p,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&&!d)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(!d.isAiAvailable){const y=d.errorCode?`aiRouting.errors.${d.errorCode}`:null,h=y&&i(y)!==y?i(y):d.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:h})]})})}if(!d.summary){const y=d.errorCode?`aiSummary.errors.${d.errorCode}`:null,h=y&&i(y)!==y?i(y):d.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:h}),e.jsxs("button",{onClick:p,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=d.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:p,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,h)=>e.jsx("li",{className:"text-sm",children:y},`point-${h}`))})]}),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?.length??0)>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,h)=>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:h+1}),e.jsx("span",{className:"text-sm",children:y})]},`blocker-${h}`))})]})]})]})}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})},hd={getByTicket:(t,s=1,r=50)=>D.get("/api/support/assignment/logs",{params:{ticketId:t,page:s,pageSize:r}})},gd=t=>({get:(s,r)=>ke.get(s,{...r,headers:t?{...r?.headers,"X-Tenant-Slug":t}:r?.headers}).then(a=>a.data),post:(s,r,a)=>ke.post(s,r,{...a,headers:t?{...a?.headers,"X-Tenant-Slug":t}:a?.headers}).then(o=>o.data),put:(s,r,a)=>ke.put(s,r,{...a,headers:t?{...a?.headers,"X-Tenant-Slug":t}:a?.headers}).then(o=>o.data),patch:(s,r,a)=>ke.patch(s,r,{...a,headers:t?{...a?.headers,"X-Tenant-Slug":t}:a?.headers}).then(o=>o.data),delete:(s,r)=>ke.delete(s,{...r,headers:t?{...r?.headers,"X-Tenant-Slug":t}:r?.headers}).then(a=>a.data)}),ge="/api/administration/users/groups",fd=t=>{const s=t?gd(t):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(),u=i?`${ge}?${i}`:ge;return await s.get(u)},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`)}}},bd=fd,vd=bd();function Na(){const{currentTenant:t}=$e(),[s,r]=n.useState(null),[a,o]=n.useState(!!t),[c,i]=n.useState(null),u=n.useCallback(async()=>{if(!t){r(null);return}o(!0),i(null);try{const d=await ye.tickets.getTicketingProvider();r(d)}catch{i("Failed to load ticketing provider configuration"),r(null)}finally{o(!1)}},[t]);return n.useEffect(()=>{u()},[u]),{provider:s?.provider??"SmartStack",isGlpi:s?.provider==="Glpi",isConfigured:s?.isConfigured??!1,glpiBaseUrl:s?.glpiBaseUrl??void 0,loading:a,error:c,refresh:u}}const ns={Open:"pending",InProgress:"active",OnHold:"warning",Resolved:"active",Closed:"inactive",Rejected:"error"},sr={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"}},yd=["conversation","description","information","assignment","ai"],jd={Open:"statusDescriptions.Open",InProgress:"statusDescriptions.InProgress",OnHold:"statusDescriptions.OnHold",Resolved:"statusDescriptions.Resolved",Closed:"statusDescriptions.Closed",Rejected:"statusDescriptions.Rejected"};function wd({satisfaction:t,showRatingForm:s,ratingValue:r,ratingComment:a,submittingRating:o,onShowForm:c,onRatingChange:i,onCommentChange:u,onCancel:d,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=>u(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:d,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 Nd({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:u=>a(u.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 Sd({show:t,filteredUsers:s,selectedUserIds:r,selectedGroupIds:a,groups:o,userSearchQuery:c,groupSearchQuery:i,loadingUsers:u,loadingGroups:d,saving:x,activeTab:m,onUserSearchChange:f,onGroupSearchChange:p,onSelectUser:v,onSelectGroup:g,onTabChange:y,onClose:h,onAssign:b,t:j}){const S=n.useMemo(()=>{if(!i.trim())return o;const w=i.toLowerCase();return o.filter(E=>E.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):p(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: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.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: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.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:()=>{h(),f(""),p("")},className:"btn btn-secondary",children:j("common.cancel","Annuler")}),e.jsxs("button",{onClick:b,disabled:x||u||d,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 Cd=["Supervisor","Manager","Director"];function kd({show:t,escalationLevel:s,escalationReason:r,saving:a,onLevelChange:o,onReasonChange:c,onClose:i,onEscalate:u,t:d}){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:d("escalate.title")})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:d("escalate.description")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:d("escalate.level")}),e.jsx("div",{className:"space-y-2",children:Cd.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:d(`escalate.levels.${x}`)}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:d(`escalate.levels.${x}Desc`)})]})]},x))})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:d("escalate.reason")}),e.jsx("textarea",{value:r,onChange:x=>c(x.target.value),placeholder:d("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:d("common.cancel")}),e.jsxs("button",{onClick:u,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"}),d("escalate.confirm")]})]})]})}):null}function Ad(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 Rd(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 rr(t,s){return s==="support"?Ad(t):Rd(t)}const Pd=()=>{const[t,s]=n.useState(null),[r,a]=n.useState(!0),[o,c]=n.useState(!1),[i,u]=n.useState(!1),[d,x]=n.useState(null),[m,f]=n.useState([]),[p,v]=n.useState(!1),[g,y]=n.useState({title:"",priority:"Medium"}),[h,b]=n.useState(!1),[j,S]=n.useState(!1),[w,E]=n.useState(!1),[$,A]=n.useState(""),[k,P]=n.useState("Supervisor"),[L,I]=n.useState(""),[C,F]=n.useState([]),[W,R]=n.useState([]),[q,V]=n.useState([]),[z,J]=n.useState(!1),[he,B]=n.useState(""),[Y,M]=n.useState(""),[te,oe]=n.useState([]),[le,O]=n.useState(!1),[G,Q]=n.useState("users"),[U,Z]=n.useState(null),[re,de]=n.useState(!1),[pe,fe]=n.useState(0),[Ne,_e]=n.useState(""),[Ke,_]=n.useState(!1);return{ticket:t,setTicket:s,loading:r,setLoading:a,saving:o,setSaving:c,uploading:i,setUploading:u,error:d,setError:x,activities:m,setActivities:f,isEditing:p,setIsEditing:v,editForm:g,setEditForm:y,showAssignModal:h,setShowAssignModal:b,showResolveModal:j,setShowResolveModal:S,showEscalateModal:w,setShowEscalateModal:E,resolution:$,setResolution:A,escalationLevel:k,setEscalationLevel:P,escalationReason:L,setEscalationReason:I,users:C,setUsers:F,selectedUserIds:W,setSelectedUserIds:R,selectedGroupIds:q,setSelectedGroupIds:V,loadingUsers:z,setLoadingUsers:J,userSearchQuery:he,setUserSearchQuery:B,groupSearchQuery:Y,setGroupSearchQuery:M,groups:te,setGroups:oe,loadingGroups:le,setLoadingGroups:O,assignModalTab:G,setAssignModalTab:Q,satisfaction:U,setSatisfaction:Z,showRatingForm:re,setShowRatingForm:de,ratingValue:pe,setRatingValue:fe,ratingComment:Ne,setRatingComment:_e,submittingRating:Ke,setSubmittingRating:_}},Td=(t,s)=>t?s?.email||"":(s?.firstName&&s?.lastName?`${s.firstName} ${s.lastName}`:s?.email)||"",Ed=(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})},$d=(t,s)=>{const r=t.get("tab");return r&&s.includes(r)?r:"conversation"};function Id({ticket:t,isSupport:s,isEditing:r,saving:a,editForm:o,error:c,onEditToggle:i,onSave:u,onEditFormChange:d,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(rs,{status:ns[t.status]||"pending",label:t.status}),e.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:sr[t.priority]?.bg,color:sr[t.priority]?.text},children:t.priority})]}),s&&r?e.jsx("input",{type:"text",value:o.title,onChange:f=>d({...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:u,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 Ld({ticket:t,isSupport:s,satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowRatingForm:u,onRatingChange:d,onCommentChange:x,onCancelRating:m,onSubmitRating:f,t:p}){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:p(jd[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"}),p("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(wd,{satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowForm:u,onRatingChange:d,onCommentChange:x,onCancel:m,onSubmit:f,t:p})})]})}function Dd({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:u,icon:d,label:x,badge:m})=>e.jsxs("button",{onClick:()=>o(u),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${t===u?"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(d,{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})]},u))})}function Md({activeTab:t,ticket:s,activities:r,isSupport:a,isClosed:o,isReadOnly:c,isConnected:i,currentUserName:u,saving:d,uploading:x,onAddComment:m,onDownloadAttachment:f,onUploadAttachment:p,onStatusChange:v,onAssign:g,onResolve:y,onClose:h,onReopen:b,onEscalate:j,getAttachmentUrl:S,onProposeSolution:w,onApproveSolution:E,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:Oa.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(ud,{ticketId:s.id,solutions:s.solutions??[],activeSolution:s.activeSolution,mode:a?"support":"client",onProposeSolution:!c&&a?w:void 0,onApproveSolution:c?void 0:E,onRejectSolution:c?void 0:$,isLoading:d})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(ga,{ticketId:s.id,comments:s.comments,activities:r.map(P=>({id:P.id,action:P.action,oldValue:P.oldValue??null,newValue:P.newValue??null,changedByUserName:"changedByUserName"in P?P.changedByUserName:null,createdAt:P.createdAt})),attachments:s.attachments,isSupport:a,isClosed:o||c,isConnected:i,currentUserName:u,ticketVariables:k,onAddComment:m,onDownloadAttachment:f,getAttachmentUrl:S})})]})}return t==="assignment"?e.jsx(Fd,{ticket:s,isReadOnly:c,onAssign:g,t:A}):t==="ai"?e.jsx(Ud,{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(fa,{ticket:s,attachments:s.attachments,activities:r.map(k=>({action:k.action,newValue:k.newValue,createdAt:k.createdAt})),isSupport:a,saving:d,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:h,onReopen:c?void 0:b,onEscalate:c?void 0:j,onDownloadAttachment:f,onUploadAttachment:c?void 0:p,getAttachmentUrl:S})})})}function Fd({ticket:t,isReadOnly:s,onAssign:r,t:a}){const[o,c]=n.useState([]),[i,u]=n.useState(!1);n.useEffect(()=>{t?.id&&(u(!0),hd.getByTicket(t.id).then(x=>c(x)).catch(()=>c([])).finally(()=>u(!1)))},[t?.id]);const d=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")})]}),d.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:d.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)]"})}),!i&&o.length===0&&e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] italic",children:a("tabs.assignmentNoLogs")}),!i&&o.length>0&&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 Od=12e4;function ar(t){const s=sessionStorage.getItem(t);return s?Date.now()-Number(s)>Od?(sessionStorage.removeItem(t),!1):!0:!1}function Ud({ticket:t,t:s}){const[r,a]=n.useState(null),[o,c]=n.useState(!0),i=`ai_routing_${t.id}`,u=`ai_summary_${t.id}`,[d,x]=n.useState(()=>ar(i)),[m,f]=n.useState(()=>ar(u));n.useEffect(()=>{let h=!1;return(async()=>{try{const{cachedAiApi:j}=await Promise.resolve().then(()=>tr),S=await j.getCached(t.id);h||(a(S),S.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),S.summary&&(sessionStorage.removeItem(u),f(!1)))}catch{}finally{h||c(!1)}})(),()=>{h=!0}},[t.id,i,u]),n.useEffect(()=>{if(!d&&!m)return;let h=!1;const j=setInterval(async()=>{try{const{cachedAiApi:S}=await Promise.resolve().then(()=>tr),w=await S.getCached(t.id);if(h)return;a(w),d&&w.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),m&&w.summary&&(sessionStorage.removeItem(u),f(!1))}catch{}},3e3);return()=>{h=!0,clearInterval(j)}},[d,m,t.id,i,u]);const p=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(u,Date.now().toString()),f(!0)},[u]),y=n.useCallback(()=>{sessionStorage.removeItem(u),f(!1)},[u]);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(ja,{classification:t.aiClassification||r?.classification})]}),e.jsx(xd,{ticketId:t.id,cachedClassification:r?.classification,cachedRouting:r?.routingSuggestion,cachedGeneratedAt:r?.routingSuggestionGeneratedAt,processing:d,onProcessingStart:p,onProcessingEnd:v}),e.jsx(pd,{ticketId:t.id,cachedSummary:r?.summary,cachedGeneratedAt:r?.summaryGeneratedAt,processing:m,onProcessingStart:g,onProcessingEnd:y})]})})}function _d({mode:t}){const{id:s}=N.useParams(),r=N.useNavigate(),{t:a}=ne.useTranslation("support"),{user:o}=Re(),[c,i]=N.useSearchParams(),{isGlpi:u}=Na(),d=t==="support",x=Td(d,o),[m,f]=n.useState(()=>$d(c,yd));n.useEffect(()=>{Ed(m,c,i)},[m,c,i]);const{ticket:p,setTicket:v,loading:g,setLoading:y,saving:h,setSaving:b,uploading:j,setUploading:S,error:w,setError:E,activities:$,setActivities:A,isEditing:k,setIsEditing:P,editForm:L,setEditForm:I,showAssignModal:C,setShowAssignModal:F,showResolveModal:W,setShowResolveModal:R,showEscalateModal:q,setShowEscalateModal:V,resolution:z,setResolution:J,escalationLevel:he,setEscalationLevel:B,escalationReason:Y,setEscalationReason:M,users:te,setUsers:oe,selectedUserIds:le,setSelectedUserIds:O,selectedGroupIds:G,setSelectedGroupIds:Q,loadingUsers:U,setLoadingUsers:Z,userSearchQuery:re,setUserSearchQuery:de,groupSearchQuery:pe,setGroupSearchQuery:fe,groups:Ne,setGroups:_e,loadingGroups:Ke,setLoadingGroups:_,assignModalTab:K,setAssignModalTab:X,satisfaction:se,setSatisfaction:ee,showRatingForm:ue,setShowRatingForm:ae,ratingValue:ve,setRatingValue:be,ratingComment:Ie,setRatingComment:De,submittingRating:Le,setSubmittingRating:Fe}=Pd(),Qe=n.useCallback(async()=>{if(s)try{const H=d?await ye.tickets.getActivities(s,50):await qe.getActivities(s,50);A(H)}catch(H){console.error("Failed to load activities",H)}},[s,d]),He=n.useCallback(async()=>{if(!(!s||d))try{const H=await qe.getSatisfaction(s);ee(H)}catch(H){console.error("Failed to load satisfaction",H)}},[s,d]),Ae=n.useCallback(async()=>{if(s)try{if(y(!0),E(null),d){const H=await ye.tickets.getById(s);if(!H){v(null);return}v(rr(H,t)),I({title:H.title,priority:H.priority})}else{const H=await qe.getById(s);if(!H){v(null);return}v(rr(H,t)),He()}Qe()}catch(H){E(a("error.loadFailed","Impossible de charger le ticket")),console.error(H)}finally{y(!1)}},[s,d,t,Qe,He,a]),Ut=n.useCallback(H=>{if(H.ticketId===s){if(!d&&H.isInternal)return;v(me=>!me||me.comments.some(Ce=>Ce.id===H.id)?me:{...me,comments:[...me.comments,{id:H.id,userName:H.userName,content:H.content,isInternal:H.isInternal,isEdited:H.isEdited,createdAt:H.createdAt}]})}},[s,d]),T=n.useCallback(H=>{H.ticketId===s&&Ae()},[s,Ae]),{isConnected:ce}=Xr({ticketId:s,onCommentAdded:Ut,onTicketUpdated:T});n.useEffect(()=>{Ae()},[Ae]),n.useEffect(()=>{(async()=>{if(!(!C||te.length>0||!d))try{Z(!0);const me=await D.get("/api/administration/users");oe(me.items.map(Ce=>({id:Ce.id,email:Ce.email,fullName:`${Ce.firstName} ${Ce.lastName}`}))),(p?.assignees?.length??0)>0&&p?.assignees&&O(p.assignees.map(Ce=>Ce.userId))}catch(me){console.error("Failed to load users",me)}finally{Z(!1)}})()},[C,te.length,d,p?.assignees]),n.useEffect(()=>{(async()=>{if(!(!C||!d))try{_(!0);const me=await vd.getAll();_e(me.map(Ce=>({id:Ce.id,name:Ce.name,memberCount:Ce.memberCount})))}catch(me){console.error("Failed to load groups",me)}finally{_(!1)}})()},[C,d]);const we=async()=>{if(!(!s||!d))try{b(!0),await ye.tickets.update(s,{title:L.title,priority:L.priority,description:p?.description||""}),await Ae(),P(!1)}catch{E(a("error.updateFailed","Impossible de mettre à jour le ticket"))}finally{b(!1)}},Se=async H=>{if(!(!s||!d))try{b(!0),await ye.tickets.updateStatus(s,H),await Ae()}catch{E(a("error.statusFailed","Impossible de changer le statut"))}finally{b(!1)}},Me=async()=>{if(!(!s||!d))try{b(!0),await ye.tickets.assign(s,le.length>0?le[0]:null,le.length>0?le:void 0,G.length>0?G:void 0),await Ae(),F(!1),O([]),Q([]),X("users")}catch{E(a("error.assignFailed","Impossible d'assigner le ticket"))}finally{b(!1)}},pt=async()=>{if(!(!s||!z.trim()||!d))try{b(!0),await ye.tickets.proposeSolution(s,z),await Ae(),R(!1),J("")}catch{E(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},tt=async H=>{if(s)try{b(!0),d&&await ye.tickets.proposeSolution(s,H),await Ae()}catch{E(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},Sa=async()=>{if(s)try{b(!0),d?await ye.tickets.approveSolution(s):await qe.approveSolution(s),await Ae()}catch{E(a("error.approveFailed","Impossible d'approuver la solution"))}finally{b(!1)}},Ca=async H=>{if(s)try{b(!0),d?await ye.tickets.rejectSolution(s,H):await qe.rejectSolution(s,H),await Ae()}catch{E(a("error.rejectFailed","Impossible de rejeter la solution"))}finally{b(!1)}},ys=async()=>{if(!(!s||!d))try{b(!0),await ye.tickets.close(s),await Ae()}catch{E(a("error.closeFailed","Impossible de fermer le ticket"))}finally{b(!1)}},js=async()=>{if(!(!s||!d))try{b(!0),await ye.tickets.reopen(s),await Ae()}catch{E(a("error.reopenFailed","Impossible de réouvrir le ticket"))}finally{b(!1)}},ka=async()=>{if(!(!s||!d||!he))try{b(!0),await Lo.escalateTicket(s,he,Y||void 0),await Ae(),V(!1),B("Supervisor"),M("")}catch{E(a("error.escalateFailed","Failed to escalate ticket"))}finally{b(!1)}},Aa=async(H,me)=>{!s||!H.trim()||(d?await ye.tickets.addComment(s,{content:H,isInternal:me}):await qe.addComment(s,H),await Ae())},Ra=async()=>{if(!(!s||ve===0||d))try{Fe(!0);const H=await qe.submitSatisfaction(s,{rating:ve,comment:Ie.trim()||void 0});ee(H),ae(!1),be(0),De("")}catch(H){const me=H instanceof Error?H.message:a("error.ratingFailed","Failed to submit rating");E(me)}finally{Fe(!1)}},Pa=async H=>{if(s)try{const me=d?await ye.tickets.downloadAttachment(s,H.id):await qe.downloadAttachment(s,H.id),Ce=window.URL.createObjectURL(me),ht=document.createElement("a");ht.href=Ce,ht.setAttribute("download",H.fileName),document.body.appendChild(ht),ht.click(),ht.remove(),window.URL.revokeObjectURL(Ce)}catch{E(a("error.downloadFailed","Impossible de télécharger le fichier"))}},Ta=async H=>{if(!(!s||!d))try{S(!0),await ye.tickets.uploadAttachment(s,H),await Ae()}catch(me){throw E(a("error.uploadFailed","Failed to upload file")),me}finally{S(!1)}},Ea=H=>s?d?ye.tickets.getAttachmentUrl(s,H.id):`/api/support/my-tickets/${s}/attachments/${H.id}`:"",$a=n.useMemo(()=>{if(!re.trim())return te;const H=re.toLowerCase();return te.filter(me=>me.fullName.toLowerCase().includes(H)||me.email.toLowerCase().includes(H))},[te,re]),Ia=n.useCallback(H=>{O(me=>me.includes(H)?me.filter(Ce=>Ce!==H):[...me,H])},[]),La=n.useCallback(H=>{Q(me=>me.includes(H)?me.filter(Ce=>Ce!==H):[...me,H])},[]);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(!p)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 Da=p.status==="Closed"||p.status==="Rejected",Ze=u||!!p.isExternallyManaged;return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Id,{ticket:p,isSupport:d,isEditing:k,saving:h,editForm:L,error:w,onEditToggle:P,onSave:we,onEditFormChange:I,onErrorClear:()=>E(null),t:a}),e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx(Ld,{ticket:p,isSupport:d,satisfaction:se,showRatingForm:ue,ratingValue:ve,ratingComment:Ie,submittingRating:Le,onShowRatingForm:()=>ae(!0),onRatingChange:be,onCommentChange:De,onCancelRating:()=>{ae(!1),be(0),De("")},onSubmitRating:Ra,t:a}),e.jsx(dd,{currentStatus:p.status,createdAt:p.createdAt,resolvedAt:p.resolvedAt,closedAt:p.closedAt,activities:$.map(H=>({action:H.action,newValue:H.newValue,createdAt:H.createdAt})),isSupport:d,saving:h,assignees:p.assignees,onAssign:Ze?void 0:()=>F(!0),onStatusChange:Ze?void 0:Se,onResolve:Ze?void 0:()=>R(!0),onCloseTicket:Ze?void 0:ys,onReopen:Ze?void 0:js,onEscalate:Ze?void 0:()=>V(!0)})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsx(Dd,{activeTab:m,commentCount:p.comments.length,isSupport:d,assigneeCount:p.assignees?.length??0,onTabChange:f,t:a}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Md,{activeTab:m,ticket:p,activities:$,isSupport:d,isClosed:Da,isReadOnly:Ze,isConnected:ce,currentUserName:x,saving:h,uploading:j,onAddComment:Aa,onDownloadAttachment:Pa,onUploadAttachment:Ta,onStatusChange:Se,onAssign:()=>F(!0),onResolve:()=>R(!0),onClose:ys,onReopen:js,onEscalate:()=>V(!0),getAttachmentUrl:Ea,onProposeSolution:tt,onApproveSolution:Sa,onRejectSolution:Ca,t:a})})]}),e.jsx(Nd,{show:d&&W,resolution:z,saving:h,onResolutionChange:J,onClose:()=>R(!1),onResolve:pt,t:a}),e.jsx(Sd,{show:d&&C,filteredUsers:$a,selectedUserIds:le,selectedGroupIds:G,groups:Ne,userSearchQuery:re,groupSearchQuery:pe,loadingUsers:U,loadingGroups:Ke,saving:h,activeTab:K,onUserSearchChange:de,onGroupSearchChange:fe,onSelectUser:Ia,onSelectGroup:La,onTabChange:X,onClose:()=>{F(!1),O([]),Q([]),X("users"),de(""),fe("")},onAssign:Me,t:a}),e.jsx(kd,{show:d&&q,escalationLevel:he,escalationReason:Y,saving:h,onLevelChange:B,onReasonChange:M,onClose:()=>V(!1),onEscalate:ka,t:a})]})}const nr="support_tickets_view_mode",Bd={Open:["InProgress","OnHold","Rejected"],InProgress:["OnHold","Resolved","Rejected"],OnHold:["InProgress","Resolved","Open"],Resolved:["Closed","Open"],Closed:["Open"],Rejected:["Open"]};function or(t,s){return t===s?!1:Bd[t]?.includes(s)??!1}const Jt={Low:"var(--info-bg)",Medium:"var(--warning-bg)",High:"var(--error-bg)",Critical:"var(--error-text)"};function qd({mode:t,showDrafts:s=!1,basePath:r,title:a,subtitle:o,createPath:c}){const{t:i}=ne.useTranslation(["support","admin","common"]),u=N.useNavigate(),{currentTenant:d,userTenants:x,hasMultipleTenants:m,isGlobalView:f}=$e(),{isGlpi:p}=Na(),[v,g]=n.useState([]),[y,h]=n.useState(null),[b,j]=n.useState(!0),[S,w]=n.useState(1),[E,$]=n.useState(1),[A,k]=n.useState(0),[P,L]=n.useState(""),[I,C]=n.useState(""),[F,W]=n.useState(""),[R,q]=n.useState(""),[V,z]=n.useState(""),[J,he]=n.useState(()=>localStorage.getItem(nr)||"table"),[B,Y]=n.useState(!1),[M,te]=n.useState([]),[oe,le]=n.useState(!0),[O,G]=n.useState(null),[Q,U]=n.useState(null),[Z,re]=n.useState(null),de=(t==="admin"||t==="assigned")&&(m||f),pe=n.useCallback(async()=>{try{j(!0);const T={page:S,pageSize:20,search:P||void 0,status:I||void 0,type:F||void 0,priority:R||void 0,tenantId:V||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,P,I,F,R,V]),fe=n.useCallback(async()=>{try{let T;t==="admin"?T=await ye.tickets.getStats(V||void 0):t==="assigned"?T=await ye.tickets.getMyAssignedStats():T=await qe.getStats(),h(T)}catch(T){console.error("Failed to load stats:",T)}},[t,V]);n.useEffect(()=>{pe()},[pe]),n.useEffect(()=>{fe()},[fe]),n.useEffect(()=>{if(s){const T=Xe.getAllDrafts();te(T)}},[s]),n.useEffect(()=>{localStorage.setItem(nr,J)},[J]);const Ne=T=>{Xe.deleteDraft(T),te(Xe.getAllDrafts())},_e=T=>{u(`${c}?draft=${T.id}`)},Ke=T=>{const we=new Date().getTime()-T.getTime(),Se=Math.floor(we/6e4),Me=Math.floor(we/36e5),pt=Math.floor(we/864e5);return Se<1?i("common:time.justNow","Just now"):Se<60?i("common:time.minutesAgo",{count:Se}):Me<24?i("common:time.hoursAgo",{count:Me}):i("common:time.daysAgo",{count:pt})},_=T=>{T.preventDefault(),w(1),pe()},K=T=>{p||G(T)},X=()=>{G(null),U(null)},se=(T,ce)=>{T.preventDefault(),U(ce)},ee=()=>{U(null)},ue=T=>O?or(O.status,T):!1,ae=async(T,ce)=>{if(T.preventDefault(),re(null),!O||O.status===ce){G(null),U(null);return}if(!or(O.status,ce)){re(i("list.invalidTransition",{from:i(`tickets.statuses.${O.status}`),to:i(`tickets.statuses.${ce}`)})),G(null),U(null),setTimeout(()=>re(null),4e3);return}try{g(we=>we.map(Se=>Se.id===O.id?{...Se,status:ce}:Se)),(t==="admin"||t==="assigned")&&await ye.tickets.updateStatus(O.id,ce),fe(),pe()}catch(we){console.error("Failed to update ticket status:",we);const Se=we?.response?.data?.message||we?.response?.data?.detail||"";re(Se||i("list.statusUpdateFailed")),setTimeout(()=>re(null),4e3),pe()}finally{G(null),U(null)}},ve=async T=>{if(confirm(i("list.confirmDelete",{number:T.ticketNumber})))try{await ye.tickets.delete(T.id),pe(),fe()}catch(ce){console.error("Failed to delete ticket:",ce)}},be=T=>`${r}/${T}`,Ie=T=>{if(!de)return null;const ce="tenantId"in T?T.tenantId??null:null,we="tenantName"in T?T.tenantName??null:null,Se=ea(ce,d?.id??null);return Se==="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"}):Se==="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})},De=()=>{if(!y)return null;const T=y,ce=y,we=t==="admin"||t==="assigned",Se=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"}],Me={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:Se.map(tt=>e.jsxs("div",{className:`card p-4 text-center border ${Me[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:()=>u(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:Ie(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(rs,{status:ns[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:Jt[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:()=>u(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"&&!p&&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"&&!p&&e.jsxs("button",{onClick:()=>u(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("button",{type:"button",className:"card p-4 hover:shadow-lg cursor-pointer transition-shadow text-left w-full",onClick:()=>u(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}),Ie(T)]}),e.jsx(rs,{status:ns[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:Jt[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"&&!p&&e.jsxs("button",{onClick:()=>u(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(pi,{onClick:()=>u(be(T.id)),isDragging:O?.id===T.id,onDragStart:()=>K(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}),Ie(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:Jt[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(Me=>Me.status===ce.status),Se=O!=null&&!ue(ce.status)&&O.status!==ce.status;return e.jsx(xi,{title:ce.label,count:we.length,color:ce.color,isDragOver:Q===ce.status,isDropDisabled:Se,onDragOver:Me=>se(Me,ce.status),onDragLeave:ee,onDrop:Me=>ae(Me,ce.status),children:we.map(Qe)},ce.status)})})]})},Ae=()=>!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("button",{type:"button",className:"p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--warning-border)] hover:border-[var(--warning-text)] transition-colors cursor-pointer text-left w-full",onClick:()=>_e(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))})]}),Ut=()=>t==="admin"||t==="assigned"?de?"md:grid-cols-4":"md:grid-cols-3":"md:grid-cols-2";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})]}),!p&&e.jsxs("button",{onClick:()=>u(c),className:"btn btn-primary flex items-center gap-2",children:[e.jsx(l.Plus,{className:"w-4 h-4"}),i("list.newTicket")]})]}),De(),Ae(),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("form",{onSubmit:_,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:P,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(!B),className:`btn ${B?"btn-primary":"btn-secondary"} flex items-center gap-2`,children:[e.jsx(l.Filter,{className:"w-4 h-4"}),i("list.filters")]}),e.jsx(mi,{viewMode:J,onChange:he})]})]}),B&&e.jsxs("div",{className:`card p-4 grid grid-cols-1 ${Ut()} 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:V,onChange:T=>{z(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:F,onChange:T=>{W(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:R,onChange:T=>{q(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&&E>1&&e.jsx(hi,{page:S,totalPages:E,totalCount:A,onPageChange:w})]})}exports.ActivityTimeline=xc;exports.AdminSidebar=ki;exports.AppHeader=wt;exports.AppLayout=oa;exports.AppSwitcher=Jr;exports.AuthLayout=ti;exports.AuthProvider=hr;exports.Breadcrumb=ii;exports.CreateTicketButton=ra;exports.DataTable=di;exports.DataView=ui;exports.DocPanelProvider=Vr;exports.DocsLayout=ia;exports.DynamicRouter=cc;exports.EntityCard=gi;exports.ErrorFallback=Er;exports.ExtendablePage=ao;exports.ExtensionProvider=Gr;exports.FavoritesBar=mc;exports.FavoritesModal=pa;exports.FavoritesProvider=yr;exports.FeatureGate=Li;exports.FeatureRouteGuard=bs;exports.Fill=Br;exports.Footer=fs;exports.GlobalErrorBoundary=$r;exports.Header=gs;exports.KanbanBoard=fi;exports.LanguageSwitcher=hs;exports.LicenseActivationDialog=ca;exports.LicenseContentBanner=na;exports.LicenseGuard=ua;exports.LicenseProvider=fr;exports.LicenseStatusBadge=Di;exports.ModuleSidebar=aa;exports.NetworkError=ls;exports.NotificationBell=ta;exports.PAGE_KEYS=no;exports.PageHeader=bi;exports.PageRegistry=Ee;exports.PermissionMatrix=vi;exports.ProtectedRoute=da;exports.PublicLayout=la;exports.RouteErrorBoundary=Ii;exports.SessionProvider=Tr;exports.SessionWarningModal=Pr;exports.SidebarProvider=Nr;exports.SignalRProvider=kr;exports.SlaBadge=Pc;exports.Slot=_r;exports.SlotFillProvider=Ur;exports.SmartStackProvider=eo;exports.ThemeCustomizer=wi;exports.ThemeProvider=xr;exports.ThemeSwitcher=Ot;exports.TicketConversation=ga;exports.TicketDetailView=_d;exports.TicketSidebar=fa;exports.TicketsListView=qd;exports.Tooltip=sa;exports.UnderDevelopment=Ni;exports.UserSidebar=Ai;exports.api=D;exports.apiClient=ke;exports.authApi=Et;exports.changeLanguage=cs;exports.createSlotFill=Xn;exports.detectDeviceType=ma;exports.getClientIpAddress=xa;exports.logService=Te;exports.useActivePage=ro;exports.useAuth=Re;exports.useClientContext=co;exports.useCollapsibleState=uo;exports.useDocPanel=Ft;exports.useExtensions=Ct;exports.useFavorites=ze;exports.useFormFieldExtensions=Jn;exports.useHasExtension=Qn;exports.useLicense=Ge;exports.usePageOverride=Mt;exports.usePageTracking=Dr;exports.usePermissionMatrix=mo;exports.usePermissionSync=xo;exports.useRouteConfig=bo;exports.useSessionMonitor=Rr;exports.useSidebar=Lt;exports.useSignalR=Wr;exports.useSignalRContext=Ar;exports.useSlotFill=Or;exports.useSlotHasContent=Wn;exports.useTableColumnExtensions=Yn;exports.useTheme=St;exports.useTicketSignalR=Xr;exports.useUserPermissions=wo;exports.userApi=It;exports.withPageOverride=so;
48
+ //# sourceMappingURL=index-BfMaHuWh.cjs.map