forlogic-core 2.5.2 → 2.5.3

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 (1657) hide show
  1. package/dist/config/environments.d.ts +5 -0
  2. package/dist/config/index.d.ts +2 -0
  3. package/dist/documents/components/DocumentFileUpload.d.ts +44 -0
  4. package/dist/documents/documentsApi.d.ts +69 -0
  5. package/dist/documents/index.d.ts +12 -0
  6. package/dist/edge/index.esm.js +4 -1
  7. package/dist/edge/index.js +4 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.esm.js +1 -1
  10. package/dist/index.js +1 -1
  11. package/docs/sql/import/validate_occurrences.sql +77 -83
  12. package/package.json +1 -2
  13. package/dist/action-plans/action-plans/components/ActionPlanAttachmentsTab.d.ts +0 -21
  14. package/dist/action-plans/action-plans/components/ActionPlanCommentsTab.d.ts +0 -21
  15. package/dist/action-plans/action-plans/components/ActionPlanCostTab.d.ts +0 -15
  16. package/dist/action-plans/action-plans/components/ActionPlanGeneralTab.d.ts +0 -21
  17. package/dist/action-plans/action-plans/components/ActionPlanHistoryTab.d.ts +0 -16
  18. package/dist/action-plans/action-plans/components/ActionPlanPage.d.ts +0 -25
  19. package/dist/action-plans/action-plans/components/ActionPlanPredecessorsTab.d.ts +0 -15
  20. package/dist/action-plans/action-plans/components/ActionPlanProgressDialog.d.ts +0 -16
  21. package/dist/action-plans/action-plans/components/ActionPlanProgressTab.d.ts +0 -10
  22. package/dist/action-plans/action-plans/components/ActionPlanStatusBadge.d.ts +0 -18
  23. package/dist/action-plans/action-plans/constants.d.ts +0 -86
  24. package/dist/action-plans/action-plans/hooks/useActionPlan.d.ts +0 -19
  25. package/dist/action-plans/action-plans/hooks/useActionPlanProgress.d.ts +0 -20
  26. package/dist/action-plans/action-plans/index.d.ts +0 -15
  27. package/dist/action-plans/action-plans/types.d.ts +0 -413
  28. package/dist/action-plans/action-plans/utils/formatTime.d.ts +0 -24
  29. package/dist/action-plans/approval-flow/components/ApprovalSidenav.d.ts +0 -16
  30. package/dist/action-plans/approval-flow/components/ApproveDialog.d.ts +0 -13
  31. package/dist/action-plans/approval-flow/components/SelectApproverDialog.d.ts +0 -11
  32. package/dist/action-plans/approval-flow/index.d.ts +0 -4
  33. package/dist/action-plans/approval-flow/types.d.ts +0 -76
  34. package/dist/action-plans/assets/index.d.ts +0 -7
  35. package/dist/action-plans/audit-trail/components/AuditTrailDetails.d.ts +0 -27
  36. package/dist/action-plans/audit-trail/components/AuditTrailFilter.d.ts +0 -29
  37. package/dist/action-plans/audit-trail/components/AuditTrailPage.d.ts +0 -40
  38. package/dist/action-plans/audit-trail/index.d.ts +0 -9
  39. package/dist/action-plans/audit-trail/types.d.ts +0 -209
  40. package/dist/action-plans/audit-trail/utils.d.ts +0 -54
  41. package/dist/action-plans/auth/components/AliasRedirect.d.ts +0 -13
  42. package/dist/action-plans/auth/components/AliasRouteGuard.d.ts +0 -20
  43. package/dist/action-plans/auth/components/EditProfileDialog.d.ts +0 -13
  44. package/dist/action-plans/auth/components/ProtectedRoute.d.ts +0 -11
  45. package/dist/action-plans/auth/components/UserInfo.d.ts +0 -10
  46. package/dist/action-plans/auth/contexts/AuthContext.d.ts +0 -89
  47. package/dist/action-plans/auth/pages/CallbackPage.d.ts +0 -6
  48. package/dist/action-plans/auth/pages/LoginPage.d.ts +0 -2
  49. package/dist/action-plans/auth/services/AuthService.d.ts +0 -64
  50. package/dist/action-plans/auth/services/SupabaseTokenService.d.ts +0 -3
  51. package/dist/action-plans/auth/services/TokenManager.d.ts +0 -66
  52. package/dist/action-plans/auth/services/TokenRegenerationService.d.ts +0 -14
  53. package/dist/action-plans/auth/services/TokenService.d.ts +0 -48
  54. package/dist/action-plans/auth/utils/ErrorInterceptor.d.ts +0 -20
  55. package/dist/action-plans/components/ErrorBoundary.d.ts +0 -19
  56. package/dist/action-plans/components/dashboards/dashboard-form.d.ts +0 -65
  57. package/dist/action-plans/components/dashboards/dashboard-general-view.d.ts +0 -124
  58. package/dist/action-plans/components/dashboards/dashboard-grid.d.ts +0 -66
  59. package/dist/action-plans/components/dashboards/dashboard-list.d.ts +0 -41
  60. package/dist/action-plans/components/dashboards/dashboard-panel-renderer.d.ts +0 -31
  61. package/dist/action-plans/components/dashboards/dashboard-view.d.ts +0 -48
  62. package/dist/action-plans/components/dashboards/helpers.d.ts +0 -86
  63. package/dist/action-plans/components/dashboards/index.d.ts +0 -9
  64. package/dist/action-plans/components/dashboards/panels/burndown-panel.d.ts +0 -41
  65. package/dist/action-plans/components/dashboards/panels/cartesian-panel.d.ts +0 -66
  66. package/dist/action-plans/components/dashboards/panels/index.d.ts +0 -14
  67. package/dist/action-plans/components/dashboards/panels/list-panel.d.ts +0 -45
  68. package/dist/action-plans/components/dashboards/panels/matrix-risk-panel.d.ts +0 -74
  69. package/dist/action-plans/components/dashboards/panels/numeric-panel.d.ts +0 -32
  70. package/dist/action-plans/components/dashboards/panels/panel-error.d.ts +0 -18
  71. package/dist/action-plans/components/dashboards/panels/panel-header.d.ts +0 -27
  72. package/dist/action-plans/components/dashboards/panels/panel-loader.d.ts +0 -17
  73. package/dist/action-plans/components/dashboards/panels/panel-no-data.d.ts +0 -16
  74. package/dist/action-plans/components/dashboards/panels/panel-unavailable.d.ts +0 -16
  75. package/dist/action-plans/components/dashboards/panels/pareto-panel.d.ts +0 -30
  76. package/dist/action-plans/components/dashboards/panels/performance-panel.d.ts +0 -39
  77. package/dist/action-plans/components/dashboards/panels/pie-panel.d.ts +0 -29
  78. package/dist/action-plans/components/dashboards/panels/text-panel.d.ts +0 -28
  79. package/dist/action-plans/components/dashboards/types.d.ts +0 -755
  80. package/dist/action-plans/components/layout/AppHeader.d.ts +0 -6
  81. package/dist/action-plans/components/layout/AppLayout.d.ts +0 -10
  82. package/dist/action-plans/components/layout/AppSidebar.d.ts +0 -10
  83. package/dist/action-plans/components/layout/BodyContent.d.ts +0 -60
  84. package/dist/action-plans/components/layout/SidebarActionTrigger.d.ts +0 -46
  85. package/dist/action-plans/components/layout/SidebarHeader.d.ts +0 -5
  86. package/dist/action-plans/components/layout/SidebarLogo.d.ts +0 -5
  87. package/dist/action-plans/components/layout/sidebar-utils.d.ts +0 -12
  88. package/dist/action-plans/components/modules/AccessDeniedDialog.d.ts +0 -43
  89. package/dist/action-plans/components/modules/ModuleAccessGuard.d.ts +0 -42
  90. package/dist/action-plans/components/modules/ModuleGrid.d.ts +0 -9
  91. package/dist/action-plans/components/modules/ModuleOfferContent.d.ts +0 -20
  92. package/dist/action-plans/components/modules/ModulesContent.d.ts +0 -21
  93. package/dist/action-plans/components/modules/ModulesDialog.d.ts +0 -3
  94. package/dist/action-plans/components/modules/ModulesFooterCards.d.ts +0 -10
  95. package/dist/action-plans/components/modules/icons/ModulesCardIcons.d.ts +0 -19
  96. package/dist/action-plans/components/modules/index.d.ts +0 -14
  97. package/dist/action-plans/components/modules/modulesData.d.ts +0 -6
  98. package/dist/action-plans/components/modules/types.d.ts +0 -41
  99. package/dist/action-plans/components/ui/accordion.d.ts +0 -42
  100. package/dist/action-plans/components/ui/action-button.d.ts +0 -48
  101. package/dist/action-plans/components/ui/alert-dialog.d.ts +0 -102
  102. package/dist/action-plans/components/ui/alert.d.ts +0 -44
  103. package/dist/action-plans/components/ui/avatar.d.ts +0 -36
  104. package/dist/action-plans/components/ui/badge.d.ts +0 -41
  105. package/dist/action-plans/components/ui/breadcrumb.d.ts +0 -73
  106. package/dist/action-plans/components/ui/button-group.d.ts +0 -24
  107. package/dist/action-plans/components/ui/button.d.ts +0 -66
  108. package/dist/action-plans/components/ui/calendar.d.ts +0 -24
  109. package/dist/action-plans/components/ui/card.d.ts +0 -57
  110. package/dist/action-plans/components/ui/chart.d.ts +0 -97
  111. package/dist/action-plans/components/ui/checkbox.d.ts +0 -15
  112. package/dist/action-plans/components/ui/collapsible.d.ts +0 -20
  113. package/dist/action-plans/components/ui/color-picker.d.ts +0 -19
  114. package/dist/action-plans/components/ui/combo-tree.d.ts +0 -103
  115. package/dist/action-plans/components/ui/combobox.d.ts +0 -64
  116. package/dist/action-plans/components/ui/command.d.ts +0 -89
  117. package/dist/action-plans/components/ui/context-menu.d.ts +0 -122
  118. package/dist/action-plans/components/ui/data-list.d.ts +0 -86
  119. package/dist/action-plans/components/ui/date-picker.d.ts +0 -19
  120. package/dist/action-plans/components/ui/dialog-wizard.d.ts +0 -100
  121. package/dist/action-plans/components/ui/dialog.d.ts +0 -229
  122. package/dist/action-plans/components/ui/disabled-menu-item.d.ts +0 -25
  123. package/dist/action-plans/components/ui/drawer.d.ts +0 -94
  124. package/dist/action-plans/components/ui/dropdown-menu.d.ts +0 -180
  125. package/dist/action-plans/components/ui/electronic-signature-dialog.d.ts +0 -31
  126. package/dist/action-plans/components/ui/empty-state.d.ts +0 -79
  127. package/dist/action-plans/components/ui/export-dialog.d.ts +0 -48
  128. package/dist/action-plans/components/ui/form.d.ts +0 -119
  129. package/dist/action-plans/components/ui/grid.d.ts +0 -53
  130. package/dist/action-plans/components/ui/hover-card.d.ts +0 -21
  131. package/dist/action-plans/components/ui/icon-picker.d.ts +0 -17
  132. package/dist/action-plans/components/ui/iframe-dialog.d.ts +0 -24
  133. package/dist/action-plans/components/ui/input-group.d.ts +0 -113
  134. package/dist/action-plans/components/ui/input.d.ts +0 -24
  135. package/dist/action-plans/components/ui/label.d.ts +0 -23
  136. package/dist/action-plans/components/ui/loading-state.d.ts +0 -52
  137. package/dist/action-plans/components/ui/menubar.d.ts +0 -113
  138. package/dist/action-plans/components/ui/multiselect-permissions.d.ts +0 -84
  139. package/dist/action-plans/components/ui/navigation-menu.d.ts +0 -57
  140. package/dist/action-plans/components/ui/onboarding-dialog.d.ts +0 -58
  141. package/dist/action-plans/components/ui/online-editor-dialog.d.ts +0 -28
  142. package/dist/action-plans/components/ui/page-breadcrumb.d.ts +0 -77
  143. package/dist/action-plans/components/ui/pagination.d.ts +0 -81
  144. package/dist/action-plans/components/ui/popover.d.ts +0 -57
  145. package/dist/action-plans/components/ui/progress.d.ts +0 -22
  146. package/dist/action-plans/components/ui/radio-group.d.ts +0 -66
  147. package/dist/action-plans/components/ui/report-request-list.d.ts +0 -64
  148. package/dist/action-plans/components/ui/resizable.d.ts +0 -38
  149. package/dist/action-plans/components/ui/rich-text-editor.d.ts +0 -58
  150. package/dist/action-plans/components/ui/scroll-area.d.ts +0 -40
  151. package/dist/action-plans/components/ui/select.d.ts +0 -94
  152. package/dist/action-plans/components/ui/separator.d.ts +0 -17
  153. package/dist/action-plans/components/ui/sheet.d.ts +0 -108
  154. package/dist/action-plans/components/ui/sidebar.d.ts +0 -269
  155. package/dist/action-plans/components/ui/skeleton-variants.d.ts +0 -41
  156. package/dist/action-plans/components/ui/skeleton.d.ts +0 -14
  157. package/dist/action-plans/components/ui/slider.d.ts +0 -9
  158. package/dist/action-plans/components/ui/sonner.d.ts +0 -8
  159. package/dist/action-plans/components/ui/spinner.d.ts +0 -11
  160. package/dist/action-plans/components/ui/split-button.d.ts +0 -76
  161. package/dist/action-plans/components/ui/stack.d.ts +0 -17
  162. package/dist/action-plans/components/ui/status-badge.d.ts +0 -52
  163. package/dist/action-plans/components/ui/step-selector.d.ts +0 -46
  164. package/dist/action-plans/components/ui/stimulsoft-viewer.d.ts +0 -28
  165. package/dist/action-plans/components/ui/switch.d.ts +0 -25
  166. package/dist/action-plans/components/ui/tab-page-layout.d.ts +0 -52
  167. package/dist/action-plans/components/ui/table-resize-handle.d.ts +0 -22
  168. package/dist/action-plans/components/ui/table.d.ts +0 -112
  169. package/dist/action-plans/components/ui/tabs.d.ts +0 -66
  170. package/dist/action-plans/components/ui/terms-of-use-dialog.d.ts +0 -102
  171. package/dist/action-plans/components/ui/textarea.d.ts +0 -33
  172. package/dist/action-plans/components/ui/timepicker.d.ts +0 -34
  173. package/dist/action-plans/components/ui/toggle-group.d.ts +0 -37
  174. package/dist/action-plans/components/ui/toggle.d.ts +0 -33
  175. package/dist/action-plans/components/ui/tooltip.d.ts +0 -61
  176. package/dist/action-plans/components/ui/truncated-cell.d.ts +0 -20
  177. package/dist/action-plans/components/ui/typography.d.ts +0 -135
  178. package/dist/action-plans/components/ui/updates-notification.d.ts +0 -47
  179. package/dist/action-plans/components/ui/users-groups-selector.d.ts +0 -87
  180. package/dist/action-plans/components/ui/viewer-dialog.d.ts +0 -184
  181. package/dist/action-plans/config/backend.d.ts +0 -10
  182. package/dist/action-plans/config/environments.d.ts +0 -27
  183. package/dist/action-plans/config/index.d.ts +0 -75
  184. package/dist/action-plans/contexts/LocaleContext.d.ts +0 -15
  185. package/dist/action-plans/contexts/ModalStateContext.d.ts +0 -57
  186. package/dist/action-plans/contexts/ModuleContext.d.ts +0 -34
  187. package/dist/action-plans/contexts/NavigationContext.d.ts +0 -13
  188. package/dist/action-plans/contexts/PageMetadataContext.d.ts +0 -48
  189. package/dist/action-plans/crud/components/ActionMenuItems.d.ts +0 -22
  190. package/dist/action-plans/crud/components/BaseForm.d.ts +0 -52
  191. package/dist/action-plans/crud/components/ColumnSettingsPopover.d.ts +0 -28
  192. package/dist/action-plans/crud/components/ContextMenu.d.ts +0 -21
  193. package/dist/action-plans/crud/components/CrudActionBar.d.ts +0 -59
  194. package/dist/action-plans/crud/components/CrudGrid.d.ts +0 -53
  195. package/dist/action-plans/crud/components/CrudPagination.d.ts +0 -17
  196. package/dist/action-plans/crud/components/CrudTable.d.ts +0 -66
  197. package/dist/action-plans/crud/components/FilterBar.d.ts +0 -136
  198. package/dist/action-plans/crud/components/GroupDropZone.d.ts +0 -16
  199. package/dist/action-plans/crud/components/InlineRowActions.d.ts +0 -15
  200. package/dist/action-plans/crud/components/SelectionCheckbox.d.ts +0 -9
  201. package/dist/action-plans/crud/components/TableFooter.d.ts +0 -14
  202. package/dist/action-plans/crud/components/TableRowActions.d.ts +0 -19
  203. package/dist/action-plans/crud/createCrudPage.d.ts +0 -134
  204. package/dist/action-plans/crud/createSimpleService.d.ts +0 -85
  205. package/dist/action-plans/crud/generateCrudConfig.d.ts +0 -78
  206. package/dist/action-plans/crud/hooks/useBaseForm.d.ts +0 -47
  207. package/dist/action-plans/crud/hooks/useColumnDragReorder.d.ts +0 -19
  208. package/dist/action-plans/crud/hooks/useColumnManager.d.ts +0 -85
  209. package/dist/action-plans/crud/hooks/useCrud.d.ts +0 -152
  210. package/dist/action-plans/crud/primitives/ActionMenu.d.ts +0 -69
  211. package/dist/action-plans/crud/primitives/FilterBar.d.ts +0 -69
  212. package/dist/action-plans/crud/primitives/Pagination.d.ts +0 -29
  213. package/dist/action-plans/crud/primitives/Table.d.ts +0 -31
  214. package/dist/action-plans/crud/primitives/TreeTable.d.ts +0 -7
  215. package/dist/action-plans/crud/primitives/index.d.ts +0 -12
  216. package/dist/action-plans/crud/primitives/types.d.ts +0 -199
  217. package/dist/action-plans/crud/utils/routingHelpers.d.ts +0 -41
  218. package/dist/action-plans/custom-form-fields/components/CustomFormFields.d.ts +0 -11
  219. package/dist/action-plans/custom-form-fields/fields/FormDateField.d.ts +0 -9
  220. package/dist/action-plans/custom-form-fields/fields/FormMultiSelectionField.d.ts +0 -9
  221. package/dist/action-plans/custom-form-fields/fields/FormNumericField.d.ts +0 -9
  222. package/dist/action-plans/custom-form-fields/fields/FormQuestionsField.d.ts +0 -9
  223. package/dist/action-plans/custom-form-fields/fields/FormSingleSelectionField.d.ts +0 -9
  224. package/dist/action-plans/custom-form-fields/fields/FormTextField.d.ts +0 -9
  225. package/dist/action-plans/custom-form-fields/fields/FormTimeField.d.ts +0 -9
  226. package/dist/action-plans/custom-form-fields/fields/FormUrlField.d.ts +0 -9
  227. package/dist/action-plans/custom-form-fields/fields/ReadOnlyTextField.d.ts +0 -9
  228. package/dist/action-plans/custom-form-fields/index.d.ts +0 -13
  229. package/dist/action-plans/custom-form-fields/types.d.ts +0 -206
  230. package/dist/action-plans/exports/action-plans.d.ts +0 -16
  231. package/dist/action-plans/exports/audit-trail.d.ts +0 -1
  232. package/dist/action-plans/exports/crud.d.ts +0 -31
  233. package/dist/action-plans/exports/custom-form-fields.d.ts +0 -1
  234. package/dist/action-plans/exports/file-upload.d.ts +0 -1
  235. package/dist/action-plans/exports/integrations.d.ts +0 -15
  236. package/dist/action-plans/exports/ui.d.ts +0 -100
  237. package/dist/action-plans/file-upload/components/SingleFileUpload.d.ts +0 -102
  238. package/dist/action-plans/file-upload/index.d.ts +0 -6
  239. package/dist/action-plans/file-upload/types.d.ts +0 -26
  240. package/dist/action-plans/file-upload/utils/formatBytes.d.ts +0 -6
  241. package/dist/action-plans/file-upload/utils/getFileExtension.d.ts +0 -6
  242. package/dist/action-plans/hooks/useActiveModules.d.ts +0 -45
  243. package/dist/action-plans/hooks/useAliasFromUrl.d.ts +0 -33
  244. package/dist/action-plans/hooks/useColumnResize.d.ts +0 -45
  245. package/dist/action-plans/hooks/useDebounce.d.ts +0 -56
  246. package/dist/action-plans/hooks/useDerivedContractedModules.d.ts +0 -8
  247. package/dist/action-plans/hooks/useI18nFormatters.d.ts +0 -40
  248. package/dist/action-plans/hooks/useMediaQuery.d.ts +0 -14
  249. package/dist/action-plans/hooks/useModuleAccess.d.ts +0 -59
  250. package/dist/action-plans/hooks/usePageTitle.d.ts +0 -10
  251. package/dist/action-plans/hooks/usePermissionQuery.d.ts +0 -49
  252. package/dist/action-plans/hooks/useRowResize.d.ts +0 -37
  253. package/dist/action-plans/hooks/useSidebarResize.d.ts +0 -37
  254. package/dist/action-plans/hooks/useUpdatesNotification.d.ts +0 -27
  255. package/dist/action-plans/hooks/useWizard.d.ts +0 -40
  256. package/dist/action-plans/i18n/LanguageBootstrap.d.ts +0 -14
  257. package/dist/action-plans/i18n/config.d.ts +0 -13
  258. package/dist/action-plans/i18n/constants.d.ts +0 -126
  259. package/dist/action-plans/i18n/index.d.ts +0 -12
  260. package/dist/action-plans/i18n/utils.d.ts +0 -14
  261. package/dist/action-plans/integrations/clarity/clarityTracking.d.ts +0 -31
  262. package/dist/action-plans/integrations/clarity/index.d.ts +0 -3
  263. package/dist/action-plans/integrations/clarity/types.d.ts +0 -46
  264. package/dist/action-plans/integrations/clarity/useClarity.d.ts +0 -34
  265. package/dist/action-plans/integrations/index.d.ts +0 -5
  266. package/dist/action-plans/leadership/components/LeadershipDialog.d.ts +0 -10
  267. package/dist/action-plans/leadership/components/LeadershipForm.d.ts +0 -8
  268. package/dist/action-plans/leadership/components/LeadershipPage.d.ts +0 -19
  269. package/dist/action-plans/leadership/hooks/useLeadershipApi.d.ts +0 -4
  270. package/dist/action-plans/leadership/hooks/useLeadershipMutations.d.ts +0 -29
  271. package/dist/action-plans/leadership/index.d.ts +0 -13
  272. package/dist/action-plans/leadership/types.d.ts +0 -23
  273. package/dist/action-plans/leadership/utils/leadershipUtils.d.ts +0 -8
  274. package/dist/action-plans/media/components/ImageEditor.d.ts +0 -22
  275. package/dist/action-plans/media/components/ImageRenderer.d.ts +0 -23
  276. package/dist/action-plans/media/components/VideoEditor.d.ts +0 -2
  277. package/dist/action-plans/media/components/VideoRenderer.d.ts +0 -2
  278. package/dist/action-plans/media/hooks/useMediaUpload.d.ts +0 -19
  279. package/dist/action-plans/media/index.d.ts +0 -49
  280. package/dist/action-plans/media/types.d.ts +0 -66
  281. package/dist/action-plans/media/utils/imageHelpers.d.ts +0 -28
  282. package/dist/action-plans/media/utils/videoHelpers.d.ts +0 -35
  283. package/dist/action-plans/mind-map/components/MindMap.d.ts +0 -23
  284. package/dist/action-plans/mind-map/components/MindMapConnection.d.ts +0 -12
  285. package/dist/action-plans/mind-map/components/MindMapNodeView.d.ts +0 -24
  286. package/dist/action-plans/mind-map/components/MindMapToolbar.d.ts +0 -26
  287. package/dist/action-plans/mind-map/hooks/useMindMapKeyboard.d.ts +0 -15
  288. package/dist/action-plans/mind-map/hooks/useMindMapLayout.d.ts +0 -5
  289. package/dist/action-plans/mind-map/hooks/useMindMapPanZoom.d.ts +0 -21
  290. package/dist/action-plans/mind-map/hooks/useMindMapState.d.ts +0 -32
  291. package/dist/action-plans/mind-map/index.d.ts +0 -4
  292. package/dist/action-plans/mind-map/types.d.ts +0 -91
  293. package/dist/action-plans/mind-map/utils/export-image.d.ts +0 -9
  294. package/dist/action-plans/mind-map/utils/layout.d.ts +0 -15
  295. package/dist/action-plans/mind-map/utils/nodeOps.d.ts +0 -66
  296. package/dist/action-plans/mind-map/utils/serialize.d.ts +0 -10
  297. package/dist/action-plans/modules/softwaresMap.d.ts +0 -4
  298. package/dist/action-plans/places/components/ManageAccessModal.d.ts +0 -11
  299. package/dist/action-plans/places/components/PlaceCard.d.ts +0 -12
  300. package/dist/action-plans/places/components/PlacesList.d.ts +0 -12
  301. package/dist/action-plans/places/index.d.ts +0 -8
  302. package/dist/action-plans/places/services/PlaceService.d.ts +0 -9
  303. package/dist/action-plans/places/types.d.ts +0 -10
  304. package/dist/action-plans/providers/CoreProviders.d.ts +0 -107
  305. package/dist/action-plans/providers/index.d.ts +0 -2
  306. package/dist/action-plans/qualiex/components/QualiexUserField.d.ts +0 -133
  307. package/dist/action-plans/qualiex/hooks/useQualiexUsers.d.ts +0 -41
  308. package/dist/action-plans/qualiex/services/qualiexApi.d.ts +0 -75
  309. package/dist/action-plans/qualiex/utils/QualiexErrorInterceptor.d.ts +0 -20
  310. package/dist/action-plans/qualiex/utils/userPlaceUtils.d.ts +0 -16
  311. package/dist/action-plans/services/BaseService.d.ts +0 -51
  312. package/dist/action-plans/services/EmailService.d.ts +0 -110
  313. package/dist/action-plans/services/ErrorService.d.ts +0 -19
  314. package/dist/action-plans/services/QualiexEnrichmentService.d.ts +0 -53
  315. package/dist/action-plans/services/QualiexFieldHelpers.d.ts +0 -17
  316. package/dist/action-plans/setup/favicon.d.ts +0 -1
  317. package/dist/action-plans/setup.d.ts +0 -16
  318. package/dist/action-plans/sign/components/D4SignWidget.d.ts +0 -2
  319. package/dist/action-plans/sign/components/DocumentSigner.d.ts +0 -2
  320. package/dist/action-plans/sign/components/SignConfigForm.d.ts +0 -2
  321. package/dist/action-plans/sign/components/SignWidget.d.ts +0 -9
  322. package/dist/action-plans/sign/hooks/useSignConfig.d.ts +0 -6
  323. package/dist/action-plans/sign/index.d.ts +0 -8
  324. package/dist/action-plans/sign/services/signService.d.ts +0 -17
  325. package/dist/action-plans/sign/types.d.ts +0 -53
  326. package/dist/action-plans/sign/utils/loadClicksignScript.d.ts +0 -13
  327. package/dist/action-plans/supabase/SupabaseSingleton.d.ts +0 -34
  328. package/dist/action-plans/supabase/client.d.ts +0 -2
  329. package/dist/action-plans/supabase/legacyKeyGuard.d.ts +0 -19
  330. package/dist/action-plans/supabase/publicClient.d.ts +0 -2
  331. package/dist/action-plans/supabase/types.d.ts +0 -377
  332. package/dist/action-plans/team-selector/components/TeamSelector.d.ts +0 -24
  333. package/dist/action-plans/team-selector/index.d.ts +0 -2
  334. package/dist/action-plans/team-selector/types.d.ts +0 -10
  335. package/dist/action-plans/types/sidebar.d.ts +0 -52
  336. package/dist/action-plans/utils/color.d.ts +0 -26
  337. package/dist/action-plans/utils/formatters/currencyFormatters.d.ts +0 -1
  338. package/dist/action-plans/utils/formatters/dateFormatters.d.ts +0 -52
  339. package/dist/action-plans/utils/index.d.ts +0 -9
  340. package/dist/action-plans/utils/linkHelpers.d.ts +0 -9
  341. package/dist/action-plans/utils/load-fonts.d.ts +0 -1
  342. package/dist/audit-trail/action-plans/components/ActionPlanAttachmentsTab.d.ts +0 -21
  343. package/dist/audit-trail/action-plans/components/ActionPlanCommentsTab.d.ts +0 -21
  344. package/dist/audit-trail/action-plans/components/ActionPlanCostTab.d.ts +0 -15
  345. package/dist/audit-trail/action-plans/components/ActionPlanGeneralTab.d.ts +0 -21
  346. package/dist/audit-trail/action-plans/components/ActionPlanHistoryTab.d.ts +0 -16
  347. package/dist/audit-trail/action-plans/components/ActionPlanPage.d.ts +0 -25
  348. package/dist/audit-trail/action-plans/components/ActionPlanPredecessorsTab.d.ts +0 -15
  349. package/dist/audit-trail/action-plans/components/ActionPlanProgressDialog.d.ts +0 -16
  350. package/dist/audit-trail/action-plans/components/ActionPlanProgressTab.d.ts +0 -10
  351. package/dist/audit-trail/action-plans/components/ActionPlanStatusBadge.d.ts +0 -18
  352. package/dist/audit-trail/action-plans/constants.d.ts +0 -86
  353. package/dist/audit-trail/action-plans/hooks/useActionPlan.d.ts +0 -19
  354. package/dist/audit-trail/action-plans/hooks/useActionPlanProgress.d.ts +0 -20
  355. package/dist/audit-trail/action-plans/index.d.ts +0 -15
  356. package/dist/audit-trail/action-plans/types.d.ts +0 -413
  357. package/dist/audit-trail/action-plans/utils/formatTime.d.ts +0 -24
  358. package/dist/audit-trail/approval-flow/components/ApprovalSidenav.d.ts +0 -16
  359. package/dist/audit-trail/approval-flow/components/ApproveDialog.d.ts +0 -13
  360. package/dist/audit-trail/approval-flow/components/SelectApproverDialog.d.ts +0 -11
  361. package/dist/audit-trail/approval-flow/index.d.ts +0 -4
  362. package/dist/audit-trail/approval-flow/types.d.ts +0 -76
  363. package/dist/audit-trail/assets/index.d.ts +0 -7
  364. package/dist/audit-trail/audit-trail/components/AuditTrailDetails.d.ts +0 -27
  365. package/dist/audit-trail/audit-trail/components/AuditTrailFilter.d.ts +0 -29
  366. package/dist/audit-trail/audit-trail/components/AuditTrailPage.d.ts +0 -40
  367. package/dist/audit-trail/audit-trail/index.d.ts +0 -9
  368. package/dist/audit-trail/audit-trail/types.d.ts +0 -209
  369. package/dist/audit-trail/audit-trail/utils.d.ts +0 -54
  370. package/dist/audit-trail/auth/components/AliasRedirect.d.ts +0 -13
  371. package/dist/audit-trail/auth/components/AliasRouteGuard.d.ts +0 -20
  372. package/dist/audit-trail/auth/components/EditProfileDialog.d.ts +0 -13
  373. package/dist/audit-trail/auth/components/ProtectedRoute.d.ts +0 -11
  374. package/dist/audit-trail/auth/components/UserInfo.d.ts +0 -10
  375. package/dist/audit-trail/auth/contexts/AuthContext.d.ts +0 -89
  376. package/dist/audit-trail/auth/pages/CallbackPage.d.ts +0 -6
  377. package/dist/audit-trail/auth/pages/LoginPage.d.ts +0 -2
  378. package/dist/audit-trail/auth/services/AuthService.d.ts +0 -64
  379. package/dist/audit-trail/auth/services/SupabaseTokenService.d.ts +0 -3
  380. package/dist/audit-trail/auth/services/TokenManager.d.ts +0 -66
  381. package/dist/audit-trail/auth/services/TokenRegenerationService.d.ts +0 -14
  382. package/dist/audit-trail/auth/services/TokenService.d.ts +0 -48
  383. package/dist/audit-trail/auth/utils/ErrorInterceptor.d.ts +0 -20
  384. package/dist/audit-trail/components/ErrorBoundary.d.ts +0 -19
  385. package/dist/audit-trail/components/dashboards/dashboard-form.d.ts +0 -65
  386. package/dist/audit-trail/components/dashboards/dashboard-general-view.d.ts +0 -124
  387. package/dist/audit-trail/components/dashboards/dashboard-grid.d.ts +0 -66
  388. package/dist/audit-trail/components/dashboards/dashboard-list.d.ts +0 -41
  389. package/dist/audit-trail/components/dashboards/dashboard-panel-renderer.d.ts +0 -31
  390. package/dist/audit-trail/components/dashboards/dashboard-view.d.ts +0 -48
  391. package/dist/audit-trail/components/dashboards/helpers.d.ts +0 -86
  392. package/dist/audit-trail/components/dashboards/index.d.ts +0 -9
  393. package/dist/audit-trail/components/dashboards/panels/burndown-panel.d.ts +0 -41
  394. package/dist/audit-trail/components/dashboards/panels/cartesian-panel.d.ts +0 -66
  395. package/dist/audit-trail/components/dashboards/panels/index.d.ts +0 -14
  396. package/dist/audit-trail/components/dashboards/panels/list-panel.d.ts +0 -45
  397. package/dist/audit-trail/components/dashboards/panels/matrix-risk-panel.d.ts +0 -74
  398. package/dist/audit-trail/components/dashboards/panels/numeric-panel.d.ts +0 -32
  399. package/dist/audit-trail/components/dashboards/panels/panel-error.d.ts +0 -18
  400. package/dist/audit-trail/components/dashboards/panels/panel-header.d.ts +0 -27
  401. package/dist/audit-trail/components/dashboards/panels/panel-loader.d.ts +0 -17
  402. package/dist/audit-trail/components/dashboards/panels/panel-no-data.d.ts +0 -16
  403. package/dist/audit-trail/components/dashboards/panels/panel-unavailable.d.ts +0 -16
  404. package/dist/audit-trail/components/dashboards/panels/pareto-panel.d.ts +0 -30
  405. package/dist/audit-trail/components/dashboards/panels/performance-panel.d.ts +0 -39
  406. package/dist/audit-trail/components/dashboards/panels/pie-panel.d.ts +0 -29
  407. package/dist/audit-trail/components/dashboards/panels/text-panel.d.ts +0 -28
  408. package/dist/audit-trail/components/dashboards/types.d.ts +0 -755
  409. package/dist/audit-trail/components/layout/AppHeader.d.ts +0 -6
  410. package/dist/audit-trail/components/layout/AppLayout.d.ts +0 -10
  411. package/dist/audit-trail/components/layout/AppSidebar.d.ts +0 -10
  412. package/dist/audit-trail/components/layout/BodyContent.d.ts +0 -60
  413. package/dist/audit-trail/components/layout/SidebarActionTrigger.d.ts +0 -46
  414. package/dist/audit-trail/components/layout/SidebarHeader.d.ts +0 -5
  415. package/dist/audit-trail/components/layout/SidebarLogo.d.ts +0 -5
  416. package/dist/audit-trail/components/layout/sidebar-utils.d.ts +0 -12
  417. package/dist/audit-trail/components/modules/AccessDeniedDialog.d.ts +0 -43
  418. package/dist/audit-trail/components/modules/ModuleAccessGuard.d.ts +0 -42
  419. package/dist/audit-trail/components/modules/ModuleGrid.d.ts +0 -9
  420. package/dist/audit-trail/components/modules/ModuleOfferContent.d.ts +0 -20
  421. package/dist/audit-trail/components/modules/ModulesContent.d.ts +0 -21
  422. package/dist/audit-trail/components/modules/ModulesDialog.d.ts +0 -3
  423. package/dist/audit-trail/components/modules/ModulesFooterCards.d.ts +0 -10
  424. package/dist/audit-trail/components/modules/icons/ModulesCardIcons.d.ts +0 -19
  425. package/dist/audit-trail/components/modules/index.d.ts +0 -14
  426. package/dist/audit-trail/components/modules/modulesData.d.ts +0 -6
  427. package/dist/audit-trail/components/modules/types.d.ts +0 -41
  428. package/dist/audit-trail/components/ui/accordion.d.ts +0 -42
  429. package/dist/audit-trail/components/ui/action-button.d.ts +0 -48
  430. package/dist/audit-trail/components/ui/alert-dialog.d.ts +0 -102
  431. package/dist/audit-trail/components/ui/alert.d.ts +0 -44
  432. package/dist/audit-trail/components/ui/avatar.d.ts +0 -36
  433. package/dist/audit-trail/components/ui/badge.d.ts +0 -41
  434. package/dist/audit-trail/components/ui/breadcrumb.d.ts +0 -73
  435. package/dist/audit-trail/components/ui/button-group.d.ts +0 -24
  436. package/dist/audit-trail/components/ui/button.d.ts +0 -66
  437. package/dist/audit-trail/components/ui/calendar.d.ts +0 -24
  438. package/dist/audit-trail/components/ui/card.d.ts +0 -57
  439. package/dist/audit-trail/components/ui/chart.d.ts +0 -97
  440. package/dist/audit-trail/components/ui/checkbox.d.ts +0 -15
  441. package/dist/audit-trail/components/ui/collapsible.d.ts +0 -20
  442. package/dist/audit-trail/components/ui/color-picker.d.ts +0 -19
  443. package/dist/audit-trail/components/ui/combo-tree.d.ts +0 -103
  444. package/dist/audit-trail/components/ui/combobox.d.ts +0 -64
  445. package/dist/audit-trail/components/ui/command.d.ts +0 -89
  446. package/dist/audit-trail/components/ui/context-menu.d.ts +0 -122
  447. package/dist/audit-trail/components/ui/data-list.d.ts +0 -86
  448. package/dist/audit-trail/components/ui/date-picker.d.ts +0 -19
  449. package/dist/audit-trail/components/ui/dialog-wizard.d.ts +0 -100
  450. package/dist/audit-trail/components/ui/dialog.d.ts +0 -229
  451. package/dist/audit-trail/components/ui/disabled-menu-item.d.ts +0 -25
  452. package/dist/audit-trail/components/ui/drawer.d.ts +0 -94
  453. package/dist/audit-trail/components/ui/dropdown-menu.d.ts +0 -180
  454. package/dist/audit-trail/components/ui/electronic-signature-dialog.d.ts +0 -31
  455. package/dist/audit-trail/components/ui/empty-state.d.ts +0 -79
  456. package/dist/audit-trail/components/ui/export-dialog.d.ts +0 -48
  457. package/dist/audit-trail/components/ui/form.d.ts +0 -119
  458. package/dist/audit-trail/components/ui/grid.d.ts +0 -53
  459. package/dist/audit-trail/components/ui/hover-card.d.ts +0 -21
  460. package/dist/audit-trail/components/ui/icon-picker.d.ts +0 -17
  461. package/dist/audit-trail/components/ui/iframe-dialog.d.ts +0 -24
  462. package/dist/audit-trail/components/ui/input-group.d.ts +0 -113
  463. package/dist/audit-trail/components/ui/input.d.ts +0 -24
  464. package/dist/audit-trail/components/ui/label.d.ts +0 -23
  465. package/dist/audit-trail/components/ui/loading-state.d.ts +0 -52
  466. package/dist/audit-trail/components/ui/menubar.d.ts +0 -113
  467. package/dist/audit-trail/components/ui/multiselect-permissions.d.ts +0 -84
  468. package/dist/audit-trail/components/ui/navigation-menu.d.ts +0 -57
  469. package/dist/audit-trail/components/ui/onboarding-dialog.d.ts +0 -58
  470. package/dist/audit-trail/components/ui/online-editor-dialog.d.ts +0 -28
  471. package/dist/audit-trail/components/ui/page-breadcrumb.d.ts +0 -77
  472. package/dist/audit-trail/components/ui/pagination.d.ts +0 -81
  473. package/dist/audit-trail/components/ui/popover.d.ts +0 -57
  474. package/dist/audit-trail/components/ui/progress.d.ts +0 -22
  475. package/dist/audit-trail/components/ui/radio-group.d.ts +0 -66
  476. package/dist/audit-trail/components/ui/report-request-list.d.ts +0 -64
  477. package/dist/audit-trail/components/ui/resizable.d.ts +0 -38
  478. package/dist/audit-trail/components/ui/rich-text-editor.d.ts +0 -58
  479. package/dist/audit-trail/components/ui/scroll-area.d.ts +0 -40
  480. package/dist/audit-trail/components/ui/select.d.ts +0 -94
  481. package/dist/audit-trail/components/ui/separator.d.ts +0 -17
  482. package/dist/audit-trail/components/ui/sheet.d.ts +0 -108
  483. package/dist/audit-trail/components/ui/sidebar.d.ts +0 -269
  484. package/dist/audit-trail/components/ui/skeleton-variants.d.ts +0 -41
  485. package/dist/audit-trail/components/ui/skeleton.d.ts +0 -14
  486. package/dist/audit-trail/components/ui/slider.d.ts +0 -9
  487. package/dist/audit-trail/components/ui/sonner.d.ts +0 -8
  488. package/dist/audit-trail/components/ui/spinner.d.ts +0 -11
  489. package/dist/audit-trail/components/ui/split-button.d.ts +0 -76
  490. package/dist/audit-trail/components/ui/stack.d.ts +0 -17
  491. package/dist/audit-trail/components/ui/status-badge.d.ts +0 -52
  492. package/dist/audit-trail/components/ui/step-selector.d.ts +0 -46
  493. package/dist/audit-trail/components/ui/stimulsoft-viewer.d.ts +0 -28
  494. package/dist/audit-trail/components/ui/switch.d.ts +0 -25
  495. package/dist/audit-trail/components/ui/tab-page-layout.d.ts +0 -52
  496. package/dist/audit-trail/components/ui/table-resize-handle.d.ts +0 -22
  497. package/dist/audit-trail/components/ui/table.d.ts +0 -112
  498. package/dist/audit-trail/components/ui/tabs.d.ts +0 -66
  499. package/dist/audit-trail/components/ui/terms-of-use-dialog.d.ts +0 -102
  500. package/dist/audit-trail/components/ui/textarea.d.ts +0 -33
  501. package/dist/audit-trail/components/ui/timepicker.d.ts +0 -34
  502. package/dist/audit-trail/components/ui/toggle-group.d.ts +0 -37
  503. package/dist/audit-trail/components/ui/toggle.d.ts +0 -33
  504. package/dist/audit-trail/components/ui/tooltip.d.ts +0 -61
  505. package/dist/audit-trail/components/ui/truncated-cell.d.ts +0 -20
  506. package/dist/audit-trail/components/ui/typography.d.ts +0 -135
  507. package/dist/audit-trail/components/ui/updates-notification.d.ts +0 -47
  508. package/dist/audit-trail/components/ui/users-groups-selector.d.ts +0 -87
  509. package/dist/audit-trail/components/ui/viewer-dialog.d.ts +0 -184
  510. package/dist/audit-trail/config/backend.d.ts +0 -10
  511. package/dist/audit-trail/config/environments.d.ts +0 -27
  512. package/dist/audit-trail/config/index.d.ts +0 -75
  513. package/dist/audit-trail/contexts/LocaleContext.d.ts +0 -15
  514. package/dist/audit-trail/contexts/ModalStateContext.d.ts +0 -57
  515. package/dist/audit-trail/contexts/ModuleContext.d.ts +0 -34
  516. package/dist/audit-trail/contexts/NavigationContext.d.ts +0 -13
  517. package/dist/audit-trail/contexts/PageMetadataContext.d.ts +0 -48
  518. package/dist/audit-trail/crud/components/ActionMenuItems.d.ts +0 -22
  519. package/dist/audit-trail/crud/components/BaseForm.d.ts +0 -52
  520. package/dist/audit-trail/crud/components/ColumnSettingsPopover.d.ts +0 -28
  521. package/dist/audit-trail/crud/components/ContextMenu.d.ts +0 -21
  522. package/dist/audit-trail/crud/components/CrudActionBar.d.ts +0 -59
  523. package/dist/audit-trail/crud/components/CrudGrid.d.ts +0 -53
  524. package/dist/audit-trail/crud/components/CrudPagination.d.ts +0 -17
  525. package/dist/audit-trail/crud/components/CrudTable.d.ts +0 -66
  526. package/dist/audit-trail/crud/components/FilterBar.d.ts +0 -136
  527. package/dist/audit-trail/crud/components/GroupDropZone.d.ts +0 -16
  528. package/dist/audit-trail/crud/components/InlineRowActions.d.ts +0 -15
  529. package/dist/audit-trail/crud/components/SelectionCheckbox.d.ts +0 -9
  530. package/dist/audit-trail/crud/components/TableFooter.d.ts +0 -14
  531. package/dist/audit-trail/crud/components/TableRowActions.d.ts +0 -19
  532. package/dist/audit-trail/crud/createCrudPage.d.ts +0 -134
  533. package/dist/audit-trail/crud/createSimpleService.d.ts +0 -85
  534. package/dist/audit-trail/crud/generateCrudConfig.d.ts +0 -78
  535. package/dist/audit-trail/crud/hooks/useBaseForm.d.ts +0 -47
  536. package/dist/audit-trail/crud/hooks/useColumnDragReorder.d.ts +0 -19
  537. package/dist/audit-trail/crud/hooks/useColumnManager.d.ts +0 -85
  538. package/dist/audit-trail/crud/hooks/useCrud.d.ts +0 -152
  539. package/dist/audit-trail/crud/primitives/ActionMenu.d.ts +0 -69
  540. package/dist/audit-trail/crud/primitives/FilterBar.d.ts +0 -69
  541. package/dist/audit-trail/crud/primitives/Pagination.d.ts +0 -29
  542. package/dist/audit-trail/crud/primitives/Table.d.ts +0 -31
  543. package/dist/audit-trail/crud/primitives/TreeTable.d.ts +0 -7
  544. package/dist/audit-trail/crud/primitives/index.d.ts +0 -12
  545. package/dist/audit-trail/crud/primitives/types.d.ts +0 -199
  546. package/dist/audit-trail/crud/utils/routingHelpers.d.ts +0 -41
  547. package/dist/audit-trail/custom-form-fields/components/CustomFormFields.d.ts +0 -11
  548. package/dist/audit-trail/custom-form-fields/fields/FormDateField.d.ts +0 -9
  549. package/dist/audit-trail/custom-form-fields/fields/FormMultiSelectionField.d.ts +0 -9
  550. package/dist/audit-trail/custom-form-fields/fields/FormNumericField.d.ts +0 -9
  551. package/dist/audit-trail/custom-form-fields/fields/FormQuestionsField.d.ts +0 -9
  552. package/dist/audit-trail/custom-form-fields/fields/FormSingleSelectionField.d.ts +0 -9
  553. package/dist/audit-trail/custom-form-fields/fields/FormTextField.d.ts +0 -9
  554. package/dist/audit-trail/custom-form-fields/fields/FormTimeField.d.ts +0 -9
  555. package/dist/audit-trail/custom-form-fields/fields/FormUrlField.d.ts +0 -9
  556. package/dist/audit-trail/custom-form-fields/fields/ReadOnlyTextField.d.ts +0 -9
  557. package/dist/audit-trail/custom-form-fields/index.d.ts +0 -13
  558. package/dist/audit-trail/custom-form-fields/types.d.ts +0 -206
  559. package/dist/audit-trail/exports/action-plans.d.ts +0 -16
  560. package/dist/audit-trail/exports/audit-trail.d.ts +0 -1
  561. package/dist/audit-trail/exports/crud.d.ts +0 -31
  562. package/dist/audit-trail/exports/custom-form-fields.d.ts +0 -1
  563. package/dist/audit-trail/exports/file-upload.d.ts +0 -1
  564. package/dist/audit-trail/exports/integrations.d.ts +0 -15
  565. package/dist/audit-trail/exports/ui.d.ts +0 -100
  566. package/dist/audit-trail/file-upload/components/SingleFileUpload.d.ts +0 -102
  567. package/dist/audit-trail/file-upload/index.d.ts +0 -6
  568. package/dist/audit-trail/file-upload/types.d.ts +0 -26
  569. package/dist/audit-trail/file-upload/utils/formatBytes.d.ts +0 -6
  570. package/dist/audit-trail/file-upload/utils/getFileExtension.d.ts +0 -6
  571. package/dist/audit-trail/hooks/useActiveModules.d.ts +0 -45
  572. package/dist/audit-trail/hooks/useAliasFromUrl.d.ts +0 -33
  573. package/dist/audit-trail/hooks/useColumnResize.d.ts +0 -45
  574. package/dist/audit-trail/hooks/useDebounce.d.ts +0 -56
  575. package/dist/audit-trail/hooks/useDerivedContractedModules.d.ts +0 -8
  576. package/dist/audit-trail/hooks/useI18nFormatters.d.ts +0 -40
  577. package/dist/audit-trail/hooks/useMediaQuery.d.ts +0 -14
  578. package/dist/audit-trail/hooks/useModuleAccess.d.ts +0 -59
  579. package/dist/audit-trail/hooks/usePageTitle.d.ts +0 -10
  580. package/dist/audit-trail/hooks/usePermissionQuery.d.ts +0 -49
  581. package/dist/audit-trail/hooks/useRowResize.d.ts +0 -37
  582. package/dist/audit-trail/hooks/useSidebarResize.d.ts +0 -37
  583. package/dist/audit-trail/hooks/useUpdatesNotification.d.ts +0 -27
  584. package/dist/audit-trail/hooks/useWizard.d.ts +0 -40
  585. package/dist/audit-trail/i18n/LanguageBootstrap.d.ts +0 -14
  586. package/dist/audit-trail/i18n/config.d.ts +0 -13
  587. package/dist/audit-trail/i18n/constants.d.ts +0 -126
  588. package/dist/audit-trail/i18n/index.d.ts +0 -12
  589. package/dist/audit-trail/i18n/utils.d.ts +0 -14
  590. package/dist/audit-trail/integrations/clarity/clarityTracking.d.ts +0 -31
  591. package/dist/audit-trail/integrations/clarity/index.d.ts +0 -3
  592. package/dist/audit-trail/integrations/clarity/types.d.ts +0 -46
  593. package/dist/audit-trail/integrations/clarity/useClarity.d.ts +0 -34
  594. package/dist/audit-trail/integrations/index.d.ts +0 -5
  595. package/dist/audit-trail/leadership/components/LeadershipDialog.d.ts +0 -10
  596. package/dist/audit-trail/leadership/components/LeadershipForm.d.ts +0 -8
  597. package/dist/audit-trail/leadership/components/LeadershipPage.d.ts +0 -19
  598. package/dist/audit-trail/leadership/hooks/useLeadershipApi.d.ts +0 -4
  599. package/dist/audit-trail/leadership/hooks/useLeadershipMutations.d.ts +0 -29
  600. package/dist/audit-trail/leadership/index.d.ts +0 -13
  601. package/dist/audit-trail/leadership/types.d.ts +0 -23
  602. package/dist/audit-trail/leadership/utils/leadershipUtils.d.ts +0 -8
  603. package/dist/audit-trail/media/components/ImageEditor.d.ts +0 -22
  604. package/dist/audit-trail/media/components/ImageRenderer.d.ts +0 -23
  605. package/dist/audit-trail/media/components/VideoEditor.d.ts +0 -2
  606. package/dist/audit-trail/media/components/VideoRenderer.d.ts +0 -2
  607. package/dist/audit-trail/media/hooks/useMediaUpload.d.ts +0 -19
  608. package/dist/audit-trail/media/index.d.ts +0 -49
  609. package/dist/audit-trail/media/types.d.ts +0 -66
  610. package/dist/audit-trail/media/utils/imageHelpers.d.ts +0 -28
  611. package/dist/audit-trail/media/utils/videoHelpers.d.ts +0 -35
  612. package/dist/audit-trail/mind-map/components/MindMap.d.ts +0 -23
  613. package/dist/audit-trail/mind-map/components/MindMapConnection.d.ts +0 -12
  614. package/dist/audit-trail/mind-map/components/MindMapNodeView.d.ts +0 -24
  615. package/dist/audit-trail/mind-map/components/MindMapToolbar.d.ts +0 -26
  616. package/dist/audit-trail/mind-map/hooks/useMindMapKeyboard.d.ts +0 -15
  617. package/dist/audit-trail/mind-map/hooks/useMindMapLayout.d.ts +0 -5
  618. package/dist/audit-trail/mind-map/hooks/useMindMapPanZoom.d.ts +0 -21
  619. package/dist/audit-trail/mind-map/hooks/useMindMapState.d.ts +0 -32
  620. package/dist/audit-trail/mind-map/index.d.ts +0 -4
  621. package/dist/audit-trail/mind-map/types.d.ts +0 -91
  622. package/dist/audit-trail/mind-map/utils/export-image.d.ts +0 -9
  623. package/dist/audit-trail/mind-map/utils/layout.d.ts +0 -15
  624. package/dist/audit-trail/mind-map/utils/nodeOps.d.ts +0 -66
  625. package/dist/audit-trail/mind-map/utils/serialize.d.ts +0 -10
  626. package/dist/audit-trail/modules/softwaresMap.d.ts +0 -4
  627. package/dist/audit-trail/places/components/ManageAccessModal.d.ts +0 -11
  628. package/dist/audit-trail/places/components/PlaceCard.d.ts +0 -12
  629. package/dist/audit-trail/places/components/PlacesList.d.ts +0 -12
  630. package/dist/audit-trail/places/index.d.ts +0 -8
  631. package/dist/audit-trail/places/services/PlaceService.d.ts +0 -9
  632. package/dist/audit-trail/places/types.d.ts +0 -10
  633. package/dist/audit-trail/providers/CoreProviders.d.ts +0 -107
  634. package/dist/audit-trail/providers/index.d.ts +0 -2
  635. package/dist/audit-trail/qualiex/components/QualiexUserField.d.ts +0 -133
  636. package/dist/audit-trail/qualiex/hooks/useQualiexUsers.d.ts +0 -41
  637. package/dist/audit-trail/qualiex/services/qualiexApi.d.ts +0 -75
  638. package/dist/audit-trail/qualiex/utils/QualiexErrorInterceptor.d.ts +0 -20
  639. package/dist/audit-trail/qualiex/utils/userPlaceUtils.d.ts +0 -16
  640. package/dist/audit-trail/services/BaseService.d.ts +0 -51
  641. package/dist/audit-trail/services/EmailService.d.ts +0 -110
  642. package/dist/audit-trail/services/ErrorService.d.ts +0 -19
  643. package/dist/audit-trail/services/QualiexEnrichmentService.d.ts +0 -53
  644. package/dist/audit-trail/services/QualiexFieldHelpers.d.ts +0 -17
  645. package/dist/audit-trail/setup/favicon.d.ts +0 -1
  646. package/dist/audit-trail/setup.d.ts +0 -16
  647. package/dist/audit-trail/sign/components/D4SignWidget.d.ts +0 -2
  648. package/dist/audit-trail/sign/components/DocumentSigner.d.ts +0 -2
  649. package/dist/audit-trail/sign/components/SignConfigForm.d.ts +0 -2
  650. package/dist/audit-trail/sign/components/SignWidget.d.ts +0 -9
  651. package/dist/audit-trail/sign/hooks/useSignConfig.d.ts +0 -6
  652. package/dist/audit-trail/sign/index.d.ts +0 -8
  653. package/dist/audit-trail/sign/services/signService.d.ts +0 -17
  654. package/dist/audit-trail/sign/types.d.ts +0 -53
  655. package/dist/audit-trail/sign/utils/loadClicksignScript.d.ts +0 -13
  656. package/dist/audit-trail/supabase/SupabaseSingleton.d.ts +0 -34
  657. package/dist/audit-trail/supabase/client.d.ts +0 -2
  658. package/dist/audit-trail/supabase/legacyKeyGuard.d.ts +0 -19
  659. package/dist/audit-trail/supabase/publicClient.d.ts +0 -2
  660. package/dist/audit-trail/supabase/types.d.ts +0 -377
  661. package/dist/audit-trail/team-selector/components/TeamSelector.d.ts +0 -24
  662. package/dist/audit-trail/team-selector/index.d.ts +0 -2
  663. package/dist/audit-trail/team-selector/types.d.ts +0 -10
  664. package/dist/audit-trail/types/sidebar.d.ts +0 -52
  665. package/dist/audit-trail/utils/color.d.ts +0 -26
  666. package/dist/audit-trail/utils/formatters/currencyFormatters.d.ts +0 -1
  667. package/dist/audit-trail/utils/formatters/dateFormatters.d.ts +0 -52
  668. package/dist/audit-trail/utils/index.d.ts +0 -9
  669. package/dist/audit-trail/utils/linkHelpers.d.ts +0 -9
  670. package/dist/audit-trail/utils/load-fonts.d.ts +0 -1
  671. package/dist/leadership/action-plans/components/ActionPlanAttachmentsTab.d.ts +0 -21
  672. package/dist/leadership/action-plans/components/ActionPlanCommentsTab.d.ts +0 -21
  673. package/dist/leadership/action-plans/components/ActionPlanCostTab.d.ts +0 -15
  674. package/dist/leadership/action-plans/components/ActionPlanGeneralTab.d.ts +0 -21
  675. package/dist/leadership/action-plans/components/ActionPlanHistoryTab.d.ts +0 -16
  676. package/dist/leadership/action-plans/components/ActionPlanPage.d.ts +0 -25
  677. package/dist/leadership/action-plans/components/ActionPlanPredecessorsTab.d.ts +0 -15
  678. package/dist/leadership/action-plans/components/ActionPlanProgressDialog.d.ts +0 -16
  679. package/dist/leadership/action-plans/components/ActionPlanProgressTab.d.ts +0 -10
  680. package/dist/leadership/action-plans/components/ActionPlanStatusBadge.d.ts +0 -18
  681. package/dist/leadership/action-plans/constants.d.ts +0 -86
  682. package/dist/leadership/action-plans/hooks/useActionPlan.d.ts +0 -19
  683. package/dist/leadership/action-plans/hooks/useActionPlanProgress.d.ts +0 -20
  684. package/dist/leadership/action-plans/index.d.ts +0 -15
  685. package/dist/leadership/action-plans/types.d.ts +0 -413
  686. package/dist/leadership/action-plans/utils/formatTime.d.ts +0 -24
  687. package/dist/leadership/approval-flow/components/ApprovalSidenav.d.ts +0 -16
  688. package/dist/leadership/approval-flow/components/ApproveDialog.d.ts +0 -13
  689. package/dist/leadership/approval-flow/components/SelectApproverDialog.d.ts +0 -11
  690. package/dist/leadership/approval-flow/index.d.ts +0 -4
  691. package/dist/leadership/approval-flow/types.d.ts +0 -76
  692. package/dist/leadership/assets/index.d.ts +0 -7
  693. package/dist/leadership/audit-trail/components/AuditTrailDetails.d.ts +0 -27
  694. package/dist/leadership/audit-trail/components/AuditTrailFilter.d.ts +0 -29
  695. package/dist/leadership/audit-trail/components/AuditTrailPage.d.ts +0 -40
  696. package/dist/leadership/audit-trail/index.d.ts +0 -9
  697. package/dist/leadership/audit-trail/types.d.ts +0 -209
  698. package/dist/leadership/audit-trail/utils.d.ts +0 -54
  699. package/dist/leadership/auth/components/AliasRedirect.d.ts +0 -13
  700. package/dist/leadership/auth/components/AliasRouteGuard.d.ts +0 -20
  701. package/dist/leadership/auth/components/EditProfileDialog.d.ts +0 -13
  702. package/dist/leadership/auth/components/ProtectedRoute.d.ts +0 -11
  703. package/dist/leadership/auth/components/UserInfo.d.ts +0 -10
  704. package/dist/leadership/auth/contexts/AuthContext.d.ts +0 -89
  705. package/dist/leadership/auth/pages/CallbackPage.d.ts +0 -6
  706. package/dist/leadership/auth/pages/LoginPage.d.ts +0 -2
  707. package/dist/leadership/auth/services/AuthService.d.ts +0 -64
  708. package/dist/leadership/auth/services/SupabaseTokenService.d.ts +0 -3
  709. package/dist/leadership/auth/services/TokenManager.d.ts +0 -66
  710. package/dist/leadership/auth/services/TokenRegenerationService.d.ts +0 -14
  711. package/dist/leadership/auth/services/TokenService.d.ts +0 -48
  712. package/dist/leadership/auth/utils/ErrorInterceptor.d.ts +0 -20
  713. package/dist/leadership/components/ErrorBoundary.d.ts +0 -19
  714. package/dist/leadership/components/dashboards/dashboard-form.d.ts +0 -65
  715. package/dist/leadership/components/dashboards/dashboard-general-view.d.ts +0 -124
  716. package/dist/leadership/components/dashboards/dashboard-grid.d.ts +0 -66
  717. package/dist/leadership/components/dashboards/dashboard-list.d.ts +0 -41
  718. package/dist/leadership/components/dashboards/dashboard-panel-renderer.d.ts +0 -31
  719. package/dist/leadership/components/dashboards/dashboard-view.d.ts +0 -48
  720. package/dist/leadership/components/dashboards/helpers.d.ts +0 -86
  721. package/dist/leadership/components/dashboards/index.d.ts +0 -9
  722. package/dist/leadership/components/dashboards/panels/burndown-panel.d.ts +0 -41
  723. package/dist/leadership/components/dashboards/panels/cartesian-panel.d.ts +0 -66
  724. package/dist/leadership/components/dashboards/panels/index.d.ts +0 -14
  725. package/dist/leadership/components/dashboards/panels/list-panel.d.ts +0 -45
  726. package/dist/leadership/components/dashboards/panels/matrix-risk-panel.d.ts +0 -74
  727. package/dist/leadership/components/dashboards/panels/numeric-panel.d.ts +0 -32
  728. package/dist/leadership/components/dashboards/panels/panel-error.d.ts +0 -18
  729. package/dist/leadership/components/dashboards/panels/panel-header.d.ts +0 -27
  730. package/dist/leadership/components/dashboards/panels/panel-loader.d.ts +0 -17
  731. package/dist/leadership/components/dashboards/panels/panel-no-data.d.ts +0 -16
  732. package/dist/leadership/components/dashboards/panels/panel-unavailable.d.ts +0 -16
  733. package/dist/leadership/components/dashboards/panels/pareto-panel.d.ts +0 -30
  734. package/dist/leadership/components/dashboards/panels/performance-panel.d.ts +0 -39
  735. package/dist/leadership/components/dashboards/panels/pie-panel.d.ts +0 -29
  736. package/dist/leadership/components/dashboards/panels/text-panel.d.ts +0 -28
  737. package/dist/leadership/components/dashboards/types.d.ts +0 -755
  738. package/dist/leadership/components/layout/AppHeader.d.ts +0 -6
  739. package/dist/leadership/components/layout/AppLayout.d.ts +0 -10
  740. package/dist/leadership/components/layout/AppSidebar.d.ts +0 -10
  741. package/dist/leadership/components/layout/BodyContent.d.ts +0 -60
  742. package/dist/leadership/components/layout/SidebarActionTrigger.d.ts +0 -46
  743. package/dist/leadership/components/layout/SidebarHeader.d.ts +0 -5
  744. package/dist/leadership/components/layout/SidebarLogo.d.ts +0 -5
  745. package/dist/leadership/components/layout/sidebar-utils.d.ts +0 -12
  746. package/dist/leadership/components/modules/AccessDeniedDialog.d.ts +0 -43
  747. package/dist/leadership/components/modules/ModuleAccessGuard.d.ts +0 -42
  748. package/dist/leadership/components/modules/ModuleGrid.d.ts +0 -9
  749. package/dist/leadership/components/modules/ModuleOfferContent.d.ts +0 -20
  750. package/dist/leadership/components/modules/ModulesContent.d.ts +0 -21
  751. package/dist/leadership/components/modules/ModulesDialog.d.ts +0 -3
  752. package/dist/leadership/components/modules/ModulesFooterCards.d.ts +0 -10
  753. package/dist/leadership/components/modules/icons/ModulesCardIcons.d.ts +0 -19
  754. package/dist/leadership/components/modules/index.d.ts +0 -14
  755. package/dist/leadership/components/modules/modulesData.d.ts +0 -6
  756. package/dist/leadership/components/modules/types.d.ts +0 -41
  757. package/dist/leadership/components/ui/accordion.d.ts +0 -42
  758. package/dist/leadership/components/ui/action-button.d.ts +0 -48
  759. package/dist/leadership/components/ui/alert-dialog.d.ts +0 -102
  760. package/dist/leadership/components/ui/alert.d.ts +0 -44
  761. package/dist/leadership/components/ui/avatar.d.ts +0 -36
  762. package/dist/leadership/components/ui/badge.d.ts +0 -41
  763. package/dist/leadership/components/ui/breadcrumb.d.ts +0 -73
  764. package/dist/leadership/components/ui/button-group.d.ts +0 -24
  765. package/dist/leadership/components/ui/button.d.ts +0 -66
  766. package/dist/leadership/components/ui/calendar.d.ts +0 -24
  767. package/dist/leadership/components/ui/card.d.ts +0 -57
  768. package/dist/leadership/components/ui/chart.d.ts +0 -97
  769. package/dist/leadership/components/ui/checkbox.d.ts +0 -15
  770. package/dist/leadership/components/ui/collapsible.d.ts +0 -20
  771. package/dist/leadership/components/ui/color-picker.d.ts +0 -19
  772. package/dist/leadership/components/ui/combo-tree.d.ts +0 -103
  773. package/dist/leadership/components/ui/combobox.d.ts +0 -64
  774. package/dist/leadership/components/ui/command.d.ts +0 -89
  775. package/dist/leadership/components/ui/context-menu.d.ts +0 -122
  776. package/dist/leadership/components/ui/data-list.d.ts +0 -86
  777. package/dist/leadership/components/ui/date-picker.d.ts +0 -19
  778. package/dist/leadership/components/ui/dialog-wizard.d.ts +0 -100
  779. package/dist/leadership/components/ui/dialog.d.ts +0 -229
  780. package/dist/leadership/components/ui/disabled-menu-item.d.ts +0 -25
  781. package/dist/leadership/components/ui/drawer.d.ts +0 -94
  782. package/dist/leadership/components/ui/dropdown-menu.d.ts +0 -180
  783. package/dist/leadership/components/ui/electronic-signature-dialog.d.ts +0 -31
  784. package/dist/leadership/components/ui/empty-state.d.ts +0 -79
  785. package/dist/leadership/components/ui/export-dialog.d.ts +0 -48
  786. package/dist/leadership/components/ui/form.d.ts +0 -119
  787. package/dist/leadership/components/ui/grid.d.ts +0 -53
  788. package/dist/leadership/components/ui/hover-card.d.ts +0 -21
  789. package/dist/leadership/components/ui/icon-picker.d.ts +0 -17
  790. package/dist/leadership/components/ui/iframe-dialog.d.ts +0 -24
  791. package/dist/leadership/components/ui/input-group.d.ts +0 -113
  792. package/dist/leadership/components/ui/input.d.ts +0 -24
  793. package/dist/leadership/components/ui/label.d.ts +0 -23
  794. package/dist/leadership/components/ui/loading-state.d.ts +0 -52
  795. package/dist/leadership/components/ui/menubar.d.ts +0 -113
  796. package/dist/leadership/components/ui/multiselect-permissions.d.ts +0 -84
  797. package/dist/leadership/components/ui/navigation-menu.d.ts +0 -57
  798. package/dist/leadership/components/ui/onboarding-dialog.d.ts +0 -58
  799. package/dist/leadership/components/ui/online-editor-dialog.d.ts +0 -28
  800. package/dist/leadership/components/ui/page-breadcrumb.d.ts +0 -77
  801. package/dist/leadership/components/ui/pagination.d.ts +0 -81
  802. package/dist/leadership/components/ui/popover.d.ts +0 -57
  803. package/dist/leadership/components/ui/progress.d.ts +0 -22
  804. package/dist/leadership/components/ui/radio-group.d.ts +0 -66
  805. package/dist/leadership/components/ui/report-request-list.d.ts +0 -64
  806. package/dist/leadership/components/ui/resizable.d.ts +0 -38
  807. package/dist/leadership/components/ui/rich-text-editor.d.ts +0 -58
  808. package/dist/leadership/components/ui/scroll-area.d.ts +0 -40
  809. package/dist/leadership/components/ui/select.d.ts +0 -94
  810. package/dist/leadership/components/ui/separator.d.ts +0 -17
  811. package/dist/leadership/components/ui/sheet.d.ts +0 -108
  812. package/dist/leadership/components/ui/sidebar.d.ts +0 -269
  813. package/dist/leadership/components/ui/skeleton-variants.d.ts +0 -41
  814. package/dist/leadership/components/ui/skeleton.d.ts +0 -14
  815. package/dist/leadership/components/ui/slider.d.ts +0 -9
  816. package/dist/leadership/components/ui/sonner.d.ts +0 -8
  817. package/dist/leadership/components/ui/spinner.d.ts +0 -11
  818. package/dist/leadership/components/ui/split-button.d.ts +0 -76
  819. package/dist/leadership/components/ui/stack.d.ts +0 -17
  820. package/dist/leadership/components/ui/status-badge.d.ts +0 -52
  821. package/dist/leadership/components/ui/step-selector.d.ts +0 -46
  822. package/dist/leadership/components/ui/stimulsoft-viewer.d.ts +0 -28
  823. package/dist/leadership/components/ui/switch.d.ts +0 -25
  824. package/dist/leadership/components/ui/tab-page-layout.d.ts +0 -52
  825. package/dist/leadership/components/ui/table-resize-handle.d.ts +0 -22
  826. package/dist/leadership/components/ui/table.d.ts +0 -112
  827. package/dist/leadership/components/ui/tabs.d.ts +0 -66
  828. package/dist/leadership/components/ui/terms-of-use-dialog.d.ts +0 -102
  829. package/dist/leadership/components/ui/textarea.d.ts +0 -33
  830. package/dist/leadership/components/ui/timepicker.d.ts +0 -34
  831. package/dist/leadership/components/ui/toggle-group.d.ts +0 -37
  832. package/dist/leadership/components/ui/toggle.d.ts +0 -33
  833. package/dist/leadership/components/ui/tooltip.d.ts +0 -61
  834. package/dist/leadership/components/ui/truncated-cell.d.ts +0 -20
  835. package/dist/leadership/components/ui/typography.d.ts +0 -135
  836. package/dist/leadership/components/ui/updates-notification.d.ts +0 -47
  837. package/dist/leadership/components/ui/users-groups-selector.d.ts +0 -87
  838. package/dist/leadership/components/ui/viewer-dialog.d.ts +0 -184
  839. package/dist/leadership/config/backend.d.ts +0 -10
  840. package/dist/leadership/config/environments.d.ts +0 -27
  841. package/dist/leadership/config/index.d.ts +0 -75
  842. package/dist/leadership/contexts/LocaleContext.d.ts +0 -15
  843. package/dist/leadership/contexts/ModalStateContext.d.ts +0 -57
  844. package/dist/leadership/contexts/ModuleContext.d.ts +0 -34
  845. package/dist/leadership/contexts/NavigationContext.d.ts +0 -13
  846. package/dist/leadership/contexts/PageMetadataContext.d.ts +0 -48
  847. package/dist/leadership/crud/components/ActionMenuItems.d.ts +0 -22
  848. package/dist/leadership/crud/components/BaseForm.d.ts +0 -52
  849. package/dist/leadership/crud/components/ColumnSettingsPopover.d.ts +0 -28
  850. package/dist/leadership/crud/components/ContextMenu.d.ts +0 -21
  851. package/dist/leadership/crud/components/CrudActionBar.d.ts +0 -59
  852. package/dist/leadership/crud/components/CrudGrid.d.ts +0 -53
  853. package/dist/leadership/crud/components/CrudPagination.d.ts +0 -17
  854. package/dist/leadership/crud/components/CrudTable.d.ts +0 -66
  855. package/dist/leadership/crud/components/FilterBar.d.ts +0 -136
  856. package/dist/leadership/crud/components/GroupDropZone.d.ts +0 -16
  857. package/dist/leadership/crud/components/InlineRowActions.d.ts +0 -15
  858. package/dist/leadership/crud/components/SelectionCheckbox.d.ts +0 -9
  859. package/dist/leadership/crud/components/TableFooter.d.ts +0 -14
  860. package/dist/leadership/crud/components/TableRowActions.d.ts +0 -19
  861. package/dist/leadership/crud/createCrudPage.d.ts +0 -134
  862. package/dist/leadership/crud/createSimpleService.d.ts +0 -85
  863. package/dist/leadership/crud/generateCrudConfig.d.ts +0 -78
  864. package/dist/leadership/crud/hooks/useBaseForm.d.ts +0 -47
  865. package/dist/leadership/crud/hooks/useColumnDragReorder.d.ts +0 -19
  866. package/dist/leadership/crud/hooks/useColumnManager.d.ts +0 -85
  867. package/dist/leadership/crud/hooks/useCrud.d.ts +0 -152
  868. package/dist/leadership/crud/primitives/ActionMenu.d.ts +0 -69
  869. package/dist/leadership/crud/primitives/FilterBar.d.ts +0 -69
  870. package/dist/leadership/crud/primitives/Pagination.d.ts +0 -29
  871. package/dist/leadership/crud/primitives/Table.d.ts +0 -31
  872. package/dist/leadership/crud/primitives/TreeTable.d.ts +0 -7
  873. package/dist/leadership/crud/primitives/index.d.ts +0 -12
  874. package/dist/leadership/crud/primitives/types.d.ts +0 -199
  875. package/dist/leadership/crud/utils/routingHelpers.d.ts +0 -41
  876. package/dist/leadership/custom-form-fields/components/CustomFormFields.d.ts +0 -11
  877. package/dist/leadership/custom-form-fields/fields/FormDateField.d.ts +0 -9
  878. package/dist/leadership/custom-form-fields/fields/FormMultiSelectionField.d.ts +0 -9
  879. package/dist/leadership/custom-form-fields/fields/FormNumericField.d.ts +0 -9
  880. package/dist/leadership/custom-form-fields/fields/FormQuestionsField.d.ts +0 -9
  881. package/dist/leadership/custom-form-fields/fields/FormSingleSelectionField.d.ts +0 -9
  882. package/dist/leadership/custom-form-fields/fields/FormTextField.d.ts +0 -9
  883. package/dist/leadership/custom-form-fields/fields/FormTimeField.d.ts +0 -9
  884. package/dist/leadership/custom-form-fields/fields/FormUrlField.d.ts +0 -9
  885. package/dist/leadership/custom-form-fields/fields/ReadOnlyTextField.d.ts +0 -9
  886. package/dist/leadership/custom-form-fields/index.d.ts +0 -13
  887. package/dist/leadership/custom-form-fields/types.d.ts +0 -206
  888. package/dist/leadership/exports/action-plans.d.ts +0 -16
  889. package/dist/leadership/exports/audit-trail.d.ts +0 -1
  890. package/dist/leadership/exports/crud.d.ts +0 -31
  891. package/dist/leadership/exports/custom-form-fields.d.ts +0 -1
  892. package/dist/leadership/exports/file-upload.d.ts +0 -1
  893. package/dist/leadership/exports/integrations.d.ts +0 -15
  894. package/dist/leadership/exports/ui.d.ts +0 -100
  895. package/dist/leadership/file-upload/components/SingleFileUpload.d.ts +0 -102
  896. package/dist/leadership/file-upload/index.d.ts +0 -6
  897. package/dist/leadership/file-upload/types.d.ts +0 -26
  898. package/dist/leadership/file-upload/utils/formatBytes.d.ts +0 -6
  899. package/dist/leadership/file-upload/utils/getFileExtension.d.ts +0 -6
  900. package/dist/leadership/hooks/useActiveModules.d.ts +0 -45
  901. package/dist/leadership/hooks/useAliasFromUrl.d.ts +0 -33
  902. package/dist/leadership/hooks/useColumnResize.d.ts +0 -45
  903. package/dist/leadership/hooks/useDebounce.d.ts +0 -56
  904. package/dist/leadership/hooks/useDerivedContractedModules.d.ts +0 -8
  905. package/dist/leadership/hooks/useI18nFormatters.d.ts +0 -40
  906. package/dist/leadership/hooks/useMediaQuery.d.ts +0 -14
  907. package/dist/leadership/hooks/useModuleAccess.d.ts +0 -59
  908. package/dist/leadership/hooks/usePageTitle.d.ts +0 -10
  909. package/dist/leadership/hooks/usePermissionQuery.d.ts +0 -49
  910. package/dist/leadership/hooks/useRowResize.d.ts +0 -37
  911. package/dist/leadership/hooks/useSidebarResize.d.ts +0 -37
  912. package/dist/leadership/hooks/useUpdatesNotification.d.ts +0 -27
  913. package/dist/leadership/hooks/useWizard.d.ts +0 -40
  914. package/dist/leadership/i18n/LanguageBootstrap.d.ts +0 -14
  915. package/dist/leadership/i18n/config.d.ts +0 -13
  916. package/dist/leadership/i18n/constants.d.ts +0 -126
  917. package/dist/leadership/i18n/index.d.ts +0 -12
  918. package/dist/leadership/i18n/utils.d.ts +0 -14
  919. package/dist/leadership/integrations/clarity/clarityTracking.d.ts +0 -31
  920. package/dist/leadership/integrations/clarity/index.d.ts +0 -3
  921. package/dist/leadership/integrations/clarity/types.d.ts +0 -46
  922. package/dist/leadership/integrations/clarity/useClarity.d.ts +0 -34
  923. package/dist/leadership/integrations/index.d.ts +0 -5
  924. package/dist/leadership/leadership/components/LeadershipDialog.d.ts +0 -10
  925. package/dist/leadership/leadership/components/LeadershipForm.d.ts +0 -8
  926. package/dist/leadership/leadership/components/LeadershipPage.d.ts +0 -19
  927. package/dist/leadership/leadership/hooks/useLeadershipApi.d.ts +0 -4
  928. package/dist/leadership/leadership/hooks/useLeadershipMutations.d.ts +0 -29
  929. package/dist/leadership/leadership/index.d.ts +0 -13
  930. package/dist/leadership/leadership/types.d.ts +0 -23
  931. package/dist/leadership/leadership/utils/leadershipUtils.d.ts +0 -8
  932. package/dist/leadership/media/components/ImageEditor.d.ts +0 -22
  933. package/dist/leadership/media/components/ImageRenderer.d.ts +0 -23
  934. package/dist/leadership/media/components/VideoEditor.d.ts +0 -2
  935. package/dist/leadership/media/components/VideoRenderer.d.ts +0 -2
  936. package/dist/leadership/media/hooks/useMediaUpload.d.ts +0 -19
  937. package/dist/leadership/media/index.d.ts +0 -49
  938. package/dist/leadership/media/types.d.ts +0 -66
  939. package/dist/leadership/media/utils/imageHelpers.d.ts +0 -28
  940. package/dist/leadership/media/utils/videoHelpers.d.ts +0 -35
  941. package/dist/leadership/mind-map/components/MindMap.d.ts +0 -23
  942. package/dist/leadership/mind-map/components/MindMapConnection.d.ts +0 -12
  943. package/dist/leadership/mind-map/components/MindMapNodeView.d.ts +0 -24
  944. package/dist/leadership/mind-map/components/MindMapToolbar.d.ts +0 -26
  945. package/dist/leadership/mind-map/hooks/useMindMapKeyboard.d.ts +0 -15
  946. package/dist/leadership/mind-map/hooks/useMindMapLayout.d.ts +0 -5
  947. package/dist/leadership/mind-map/hooks/useMindMapPanZoom.d.ts +0 -21
  948. package/dist/leadership/mind-map/hooks/useMindMapState.d.ts +0 -32
  949. package/dist/leadership/mind-map/index.d.ts +0 -4
  950. package/dist/leadership/mind-map/types.d.ts +0 -91
  951. package/dist/leadership/mind-map/utils/export-image.d.ts +0 -9
  952. package/dist/leadership/mind-map/utils/layout.d.ts +0 -15
  953. package/dist/leadership/mind-map/utils/nodeOps.d.ts +0 -66
  954. package/dist/leadership/mind-map/utils/serialize.d.ts +0 -10
  955. package/dist/leadership/modules/softwaresMap.d.ts +0 -4
  956. package/dist/leadership/places/components/ManageAccessModal.d.ts +0 -11
  957. package/dist/leadership/places/components/PlaceCard.d.ts +0 -12
  958. package/dist/leadership/places/components/PlacesList.d.ts +0 -12
  959. package/dist/leadership/places/index.d.ts +0 -8
  960. package/dist/leadership/places/services/PlaceService.d.ts +0 -9
  961. package/dist/leadership/places/types.d.ts +0 -10
  962. package/dist/leadership/providers/CoreProviders.d.ts +0 -107
  963. package/dist/leadership/providers/index.d.ts +0 -2
  964. package/dist/leadership/qualiex/components/QualiexUserField.d.ts +0 -133
  965. package/dist/leadership/qualiex/hooks/useQualiexUsers.d.ts +0 -41
  966. package/dist/leadership/qualiex/services/qualiexApi.d.ts +0 -75
  967. package/dist/leadership/qualiex/utils/QualiexErrorInterceptor.d.ts +0 -20
  968. package/dist/leadership/qualiex/utils/userPlaceUtils.d.ts +0 -16
  969. package/dist/leadership/services/BaseService.d.ts +0 -51
  970. package/dist/leadership/services/EmailService.d.ts +0 -110
  971. package/dist/leadership/services/ErrorService.d.ts +0 -19
  972. package/dist/leadership/services/QualiexEnrichmentService.d.ts +0 -53
  973. package/dist/leadership/services/QualiexFieldHelpers.d.ts +0 -17
  974. package/dist/leadership/setup/favicon.d.ts +0 -1
  975. package/dist/leadership/setup.d.ts +0 -16
  976. package/dist/leadership/sign/components/D4SignWidget.d.ts +0 -2
  977. package/dist/leadership/sign/components/DocumentSigner.d.ts +0 -2
  978. package/dist/leadership/sign/components/SignConfigForm.d.ts +0 -2
  979. package/dist/leadership/sign/components/SignWidget.d.ts +0 -9
  980. package/dist/leadership/sign/hooks/useSignConfig.d.ts +0 -6
  981. package/dist/leadership/sign/index.d.ts +0 -8
  982. package/dist/leadership/sign/services/signService.d.ts +0 -17
  983. package/dist/leadership/sign/types.d.ts +0 -53
  984. package/dist/leadership/sign/utils/loadClicksignScript.d.ts +0 -13
  985. package/dist/leadership/supabase/SupabaseSingleton.d.ts +0 -34
  986. package/dist/leadership/supabase/client.d.ts +0 -2
  987. package/dist/leadership/supabase/legacyKeyGuard.d.ts +0 -19
  988. package/dist/leadership/supabase/publicClient.d.ts +0 -2
  989. package/dist/leadership/supabase/types.d.ts +0 -377
  990. package/dist/leadership/team-selector/components/TeamSelector.d.ts +0 -24
  991. package/dist/leadership/team-selector/index.d.ts +0 -2
  992. package/dist/leadership/team-selector/types.d.ts +0 -10
  993. package/dist/leadership/types/sidebar.d.ts +0 -52
  994. package/dist/leadership/utils/color.d.ts +0 -26
  995. package/dist/leadership/utils/formatters/currencyFormatters.d.ts +0 -1
  996. package/dist/leadership/utils/formatters/dateFormatters.d.ts +0 -52
  997. package/dist/leadership/utils/index.d.ts +0 -9
  998. package/dist/leadership/utils/linkHelpers.d.ts +0 -9
  999. package/dist/leadership/utils/load-fonts.d.ts +0 -1
  1000. package/dist/places/action-plans/components/ActionPlanAttachmentsTab.d.ts +0 -21
  1001. package/dist/places/action-plans/components/ActionPlanCommentsTab.d.ts +0 -21
  1002. package/dist/places/action-plans/components/ActionPlanCostTab.d.ts +0 -15
  1003. package/dist/places/action-plans/components/ActionPlanGeneralTab.d.ts +0 -21
  1004. package/dist/places/action-plans/components/ActionPlanHistoryTab.d.ts +0 -16
  1005. package/dist/places/action-plans/components/ActionPlanPage.d.ts +0 -25
  1006. package/dist/places/action-plans/components/ActionPlanPredecessorsTab.d.ts +0 -15
  1007. package/dist/places/action-plans/components/ActionPlanProgressDialog.d.ts +0 -16
  1008. package/dist/places/action-plans/components/ActionPlanProgressTab.d.ts +0 -10
  1009. package/dist/places/action-plans/components/ActionPlanStatusBadge.d.ts +0 -18
  1010. package/dist/places/action-plans/constants.d.ts +0 -86
  1011. package/dist/places/action-plans/hooks/useActionPlan.d.ts +0 -19
  1012. package/dist/places/action-plans/hooks/useActionPlanProgress.d.ts +0 -20
  1013. package/dist/places/action-plans/index.d.ts +0 -15
  1014. package/dist/places/action-plans/types.d.ts +0 -413
  1015. package/dist/places/action-plans/utils/formatTime.d.ts +0 -24
  1016. package/dist/places/approval-flow/components/ApprovalSidenav.d.ts +0 -16
  1017. package/dist/places/approval-flow/components/ApproveDialog.d.ts +0 -13
  1018. package/dist/places/approval-flow/components/SelectApproverDialog.d.ts +0 -11
  1019. package/dist/places/approval-flow/index.d.ts +0 -4
  1020. package/dist/places/approval-flow/types.d.ts +0 -76
  1021. package/dist/places/assets/index.d.ts +0 -7
  1022. package/dist/places/audit-trail/components/AuditTrailDetails.d.ts +0 -27
  1023. package/dist/places/audit-trail/components/AuditTrailFilter.d.ts +0 -29
  1024. package/dist/places/audit-trail/components/AuditTrailPage.d.ts +0 -40
  1025. package/dist/places/audit-trail/index.d.ts +0 -9
  1026. package/dist/places/audit-trail/types.d.ts +0 -209
  1027. package/dist/places/audit-trail/utils.d.ts +0 -54
  1028. package/dist/places/auth/components/AliasRedirect.d.ts +0 -13
  1029. package/dist/places/auth/components/AliasRouteGuard.d.ts +0 -20
  1030. package/dist/places/auth/components/EditProfileDialog.d.ts +0 -13
  1031. package/dist/places/auth/components/ProtectedRoute.d.ts +0 -11
  1032. package/dist/places/auth/components/UserInfo.d.ts +0 -10
  1033. package/dist/places/auth/contexts/AuthContext.d.ts +0 -89
  1034. package/dist/places/auth/pages/CallbackPage.d.ts +0 -6
  1035. package/dist/places/auth/pages/LoginPage.d.ts +0 -2
  1036. package/dist/places/auth/services/AuthService.d.ts +0 -64
  1037. package/dist/places/auth/services/SupabaseTokenService.d.ts +0 -3
  1038. package/dist/places/auth/services/TokenManager.d.ts +0 -66
  1039. package/dist/places/auth/services/TokenRegenerationService.d.ts +0 -14
  1040. package/dist/places/auth/services/TokenService.d.ts +0 -48
  1041. package/dist/places/auth/utils/ErrorInterceptor.d.ts +0 -20
  1042. package/dist/places/components/ErrorBoundary.d.ts +0 -19
  1043. package/dist/places/components/dashboards/dashboard-form.d.ts +0 -65
  1044. package/dist/places/components/dashboards/dashboard-general-view.d.ts +0 -124
  1045. package/dist/places/components/dashboards/dashboard-grid.d.ts +0 -66
  1046. package/dist/places/components/dashboards/dashboard-list.d.ts +0 -41
  1047. package/dist/places/components/dashboards/dashboard-panel-renderer.d.ts +0 -31
  1048. package/dist/places/components/dashboards/dashboard-view.d.ts +0 -48
  1049. package/dist/places/components/dashboards/helpers.d.ts +0 -86
  1050. package/dist/places/components/dashboards/index.d.ts +0 -9
  1051. package/dist/places/components/dashboards/panels/burndown-panel.d.ts +0 -41
  1052. package/dist/places/components/dashboards/panels/cartesian-panel.d.ts +0 -66
  1053. package/dist/places/components/dashboards/panels/index.d.ts +0 -14
  1054. package/dist/places/components/dashboards/panels/list-panel.d.ts +0 -45
  1055. package/dist/places/components/dashboards/panels/matrix-risk-panel.d.ts +0 -74
  1056. package/dist/places/components/dashboards/panels/numeric-panel.d.ts +0 -32
  1057. package/dist/places/components/dashboards/panels/panel-error.d.ts +0 -18
  1058. package/dist/places/components/dashboards/panels/panel-header.d.ts +0 -27
  1059. package/dist/places/components/dashboards/panels/panel-loader.d.ts +0 -17
  1060. package/dist/places/components/dashboards/panels/panel-no-data.d.ts +0 -16
  1061. package/dist/places/components/dashboards/panels/panel-unavailable.d.ts +0 -16
  1062. package/dist/places/components/dashboards/panels/pareto-panel.d.ts +0 -30
  1063. package/dist/places/components/dashboards/panels/performance-panel.d.ts +0 -39
  1064. package/dist/places/components/dashboards/panels/pie-panel.d.ts +0 -29
  1065. package/dist/places/components/dashboards/panels/text-panel.d.ts +0 -28
  1066. package/dist/places/components/dashboards/types.d.ts +0 -755
  1067. package/dist/places/components/layout/AppHeader.d.ts +0 -6
  1068. package/dist/places/components/layout/AppLayout.d.ts +0 -10
  1069. package/dist/places/components/layout/AppSidebar.d.ts +0 -10
  1070. package/dist/places/components/layout/BodyContent.d.ts +0 -60
  1071. package/dist/places/components/layout/SidebarActionTrigger.d.ts +0 -46
  1072. package/dist/places/components/layout/SidebarHeader.d.ts +0 -5
  1073. package/dist/places/components/layout/SidebarLogo.d.ts +0 -5
  1074. package/dist/places/components/layout/sidebar-utils.d.ts +0 -12
  1075. package/dist/places/components/modules/AccessDeniedDialog.d.ts +0 -43
  1076. package/dist/places/components/modules/ModuleAccessGuard.d.ts +0 -42
  1077. package/dist/places/components/modules/ModuleGrid.d.ts +0 -9
  1078. package/dist/places/components/modules/ModuleOfferContent.d.ts +0 -20
  1079. package/dist/places/components/modules/ModulesContent.d.ts +0 -21
  1080. package/dist/places/components/modules/ModulesDialog.d.ts +0 -3
  1081. package/dist/places/components/modules/ModulesFooterCards.d.ts +0 -10
  1082. package/dist/places/components/modules/icons/ModulesCardIcons.d.ts +0 -19
  1083. package/dist/places/components/modules/index.d.ts +0 -14
  1084. package/dist/places/components/modules/modulesData.d.ts +0 -6
  1085. package/dist/places/components/modules/types.d.ts +0 -41
  1086. package/dist/places/components/ui/accordion.d.ts +0 -42
  1087. package/dist/places/components/ui/action-button.d.ts +0 -48
  1088. package/dist/places/components/ui/alert-dialog.d.ts +0 -102
  1089. package/dist/places/components/ui/alert.d.ts +0 -44
  1090. package/dist/places/components/ui/avatar.d.ts +0 -36
  1091. package/dist/places/components/ui/badge.d.ts +0 -41
  1092. package/dist/places/components/ui/breadcrumb.d.ts +0 -73
  1093. package/dist/places/components/ui/button-group.d.ts +0 -24
  1094. package/dist/places/components/ui/button.d.ts +0 -66
  1095. package/dist/places/components/ui/calendar.d.ts +0 -24
  1096. package/dist/places/components/ui/card.d.ts +0 -57
  1097. package/dist/places/components/ui/chart.d.ts +0 -97
  1098. package/dist/places/components/ui/checkbox.d.ts +0 -15
  1099. package/dist/places/components/ui/collapsible.d.ts +0 -20
  1100. package/dist/places/components/ui/color-picker.d.ts +0 -19
  1101. package/dist/places/components/ui/combo-tree.d.ts +0 -103
  1102. package/dist/places/components/ui/combobox.d.ts +0 -64
  1103. package/dist/places/components/ui/command.d.ts +0 -89
  1104. package/dist/places/components/ui/context-menu.d.ts +0 -122
  1105. package/dist/places/components/ui/data-list.d.ts +0 -86
  1106. package/dist/places/components/ui/date-picker.d.ts +0 -19
  1107. package/dist/places/components/ui/dialog-wizard.d.ts +0 -100
  1108. package/dist/places/components/ui/dialog.d.ts +0 -229
  1109. package/dist/places/components/ui/disabled-menu-item.d.ts +0 -25
  1110. package/dist/places/components/ui/drawer.d.ts +0 -94
  1111. package/dist/places/components/ui/dropdown-menu.d.ts +0 -180
  1112. package/dist/places/components/ui/electronic-signature-dialog.d.ts +0 -31
  1113. package/dist/places/components/ui/empty-state.d.ts +0 -79
  1114. package/dist/places/components/ui/export-dialog.d.ts +0 -48
  1115. package/dist/places/components/ui/form.d.ts +0 -119
  1116. package/dist/places/components/ui/grid.d.ts +0 -53
  1117. package/dist/places/components/ui/hover-card.d.ts +0 -21
  1118. package/dist/places/components/ui/icon-picker.d.ts +0 -17
  1119. package/dist/places/components/ui/iframe-dialog.d.ts +0 -24
  1120. package/dist/places/components/ui/input-group.d.ts +0 -113
  1121. package/dist/places/components/ui/input.d.ts +0 -24
  1122. package/dist/places/components/ui/label.d.ts +0 -23
  1123. package/dist/places/components/ui/loading-state.d.ts +0 -52
  1124. package/dist/places/components/ui/menubar.d.ts +0 -113
  1125. package/dist/places/components/ui/multiselect-permissions.d.ts +0 -84
  1126. package/dist/places/components/ui/navigation-menu.d.ts +0 -57
  1127. package/dist/places/components/ui/onboarding-dialog.d.ts +0 -58
  1128. package/dist/places/components/ui/online-editor-dialog.d.ts +0 -28
  1129. package/dist/places/components/ui/page-breadcrumb.d.ts +0 -77
  1130. package/dist/places/components/ui/pagination.d.ts +0 -81
  1131. package/dist/places/components/ui/popover.d.ts +0 -57
  1132. package/dist/places/components/ui/progress.d.ts +0 -22
  1133. package/dist/places/components/ui/radio-group.d.ts +0 -66
  1134. package/dist/places/components/ui/report-request-list.d.ts +0 -64
  1135. package/dist/places/components/ui/resizable.d.ts +0 -38
  1136. package/dist/places/components/ui/rich-text-editor.d.ts +0 -58
  1137. package/dist/places/components/ui/scroll-area.d.ts +0 -40
  1138. package/dist/places/components/ui/select.d.ts +0 -94
  1139. package/dist/places/components/ui/separator.d.ts +0 -17
  1140. package/dist/places/components/ui/sheet.d.ts +0 -108
  1141. package/dist/places/components/ui/sidebar.d.ts +0 -269
  1142. package/dist/places/components/ui/skeleton-variants.d.ts +0 -41
  1143. package/dist/places/components/ui/skeleton.d.ts +0 -14
  1144. package/dist/places/components/ui/slider.d.ts +0 -9
  1145. package/dist/places/components/ui/sonner.d.ts +0 -8
  1146. package/dist/places/components/ui/spinner.d.ts +0 -11
  1147. package/dist/places/components/ui/split-button.d.ts +0 -76
  1148. package/dist/places/components/ui/stack.d.ts +0 -17
  1149. package/dist/places/components/ui/status-badge.d.ts +0 -52
  1150. package/dist/places/components/ui/step-selector.d.ts +0 -46
  1151. package/dist/places/components/ui/stimulsoft-viewer.d.ts +0 -28
  1152. package/dist/places/components/ui/switch.d.ts +0 -25
  1153. package/dist/places/components/ui/tab-page-layout.d.ts +0 -52
  1154. package/dist/places/components/ui/table-resize-handle.d.ts +0 -22
  1155. package/dist/places/components/ui/table.d.ts +0 -112
  1156. package/dist/places/components/ui/tabs.d.ts +0 -66
  1157. package/dist/places/components/ui/terms-of-use-dialog.d.ts +0 -102
  1158. package/dist/places/components/ui/textarea.d.ts +0 -33
  1159. package/dist/places/components/ui/timepicker.d.ts +0 -34
  1160. package/dist/places/components/ui/toggle-group.d.ts +0 -37
  1161. package/dist/places/components/ui/toggle.d.ts +0 -33
  1162. package/dist/places/components/ui/tooltip.d.ts +0 -61
  1163. package/dist/places/components/ui/truncated-cell.d.ts +0 -20
  1164. package/dist/places/components/ui/typography.d.ts +0 -135
  1165. package/dist/places/components/ui/updates-notification.d.ts +0 -47
  1166. package/dist/places/components/ui/users-groups-selector.d.ts +0 -87
  1167. package/dist/places/components/ui/viewer-dialog.d.ts +0 -184
  1168. package/dist/places/config/backend.d.ts +0 -10
  1169. package/dist/places/config/environments.d.ts +0 -27
  1170. package/dist/places/config/index.d.ts +0 -75
  1171. package/dist/places/contexts/LocaleContext.d.ts +0 -15
  1172. package/dist/places/contexts/ModalStateContext.d.ts +0 -57
  1173. package/dist/places/contexts/ModuleContext.d.ts +0 -34
  1174. package/dist/places/contexts/NavigationContext.d.ts +0 -13
  1175. package/dist/places/contexts/PageMetadataContext.d.ts +0 -48
  1176. package/dist/places/crud/components/ActionMenuItems.d.ts +0 -22
  1177. package/dist/places/crud/components/BaseForm.d.ts +0 -52
  1178. package/dist/places/crud/components/ColumnSettingsPopover.d.ts +0 -28
  1179. package/dist/places/crud/components/ContextMenu.d.ts +0 -21
  1180. package/dist/places/crud/components/CrudActionBar.d.ts +0 -59
  1181. package/dist/places/crud/components/CrudGrid.d.ts +0 -53
  1182. package/dist/places/crud/components/CrudPagination.d.ts +0 -17
  1183. package/dist/places/crud/components/CrudTable.d.ts +0 -66
  1184. package/dist/places/crud/components/FilterBar.d.ts +0 -136
  1185. package/dist/places/crud/components/GroupDropZone.d.ts +0 -16
  1186. package/dist/places/crud/components/InlineRowActions.d.ts +0 -15
  1187. package/dist/places/crud/components/SelectionCheckbox.d.ts +0 -9
  1188. package/dist/places/crud/components/TableFooter.d.ts +0 -14
  1189. package/dist/places/crud/components/TableRowActions.d.ts +0 -19
  1190. package/dist/places/crud/createCrudPage.d.ts +0 -134
  1191. package/dist/places/crud/createSimpleService.d.ts +0 -85
  1192. package/dist/places/crud/generateCrudConfig.d.ts +0 -78
  1193. package/dist/places/crud/hooks/useBaseForm.d.ts +0 -47
  1194. package/dist/places/crud/hooks/useColumnDragReorder.d.ts +0 -19
  1195. package/dist/places/crud/hooks/useColumnManager.d.ts +0 -85
  1196. package/dist/places/crud/hooks/useCrud.d.ts +0 -152
  1197. package/dist/places/crud/primitives/ActionMenu.d.ts +0 -69
  1198. package/dist/places/crud/primitives/FilterBar.d.ts +0 -69
  1199. package/dist/places/crud/primitives/Pagination.d.ts +0 -29
  1200. package/dist/places/crud/primitives/Table.d.ts +0 -31
  1201. package/dist/places/crud/primitives/TreeTable.d.ts +0 -7
  1202. package/dist/places/crud/primitives/index.d.ts +0 -12
  1203. package/dist/places/crud/primitives/types.d.ts +0 -199
  1204. package/dist/places/crud/utils/routingHelpers.d.ts +0 -41
  1205. package/dist/places/custom-form-fields/components/CustomFormFields.d.ts +0 -11
  1206. package/dist/places/custom-form-fields/fields/FormDateField.d.ts +0 -9
  1207. package/dist/places/custom-form-fields/fields/FormMultiSelectionField.d.ts +0 -9
  1208. package/dist/places/custom-form-fields/fields/FormNumericField.d.ts +0 -9
  1209. package/dist/places/custom-form-fields/fields/FormQuestionsField.d.ts +0 -9
  1210. package/dist/places/custom-form-fields/fields/FormSingleSelectionField.d.ts +0 -9
  1211. package/dist/places/custom-form-fields/fields/FormTextField.d.ts +0 -9
  1212. package/dist/places/custom-form-fields/fields/FormTimeField.d.ts +0 -9
  1213. package/dist/places/custom-form-fields/fields/FormUrlField.d.ts +0 -9
  1214. package/dist/places/custom-form-fields/fields/ReadOnlyTextField.d.ts +0 -9
  1215. package/dist/places/custom-form-fields/index.d.ts +0 -13
  1216. package/dist/places/custom-form-fields/types.d.ts +0 -206
  1217. package/dist/places/exports/action-plans.d.ts +0 -16
  1218. package/dist/places/exports/audit-trail.d.ts +0 -1
  1219. package/dist/places/exports/crud.d.ts +0 -31
  1220. package/dist/places/exports/custom-form-fields.d.ts +0 -1
  1221. package/dist/places/exports/file-upload.d.ts +0 -1
  1222. package/dist/places/exports/integrations.d.ts +0 -15
  1223. package/dist/places/exports/ui.d.ts +0 -100
  1224. package/dist/places/file-upload/components/SingleFileUpload.d.ts +0 -102
  1225. package/dist/places/file-upload/index.d.ts +0 -6
  1226. package/dist/places/file-upload/types.d.ts +0 -26
  1227. package/dist/places/file-upload/utils/formatBytes.d.ts +0 -6
  1228. package/dist/places/file-upload/utils/getFileExtension.d.ts +0 -6
  1229. package/dist/places/hooks/useActiveModules.d.ts +0 -45
  1230. package/dist/places/hooks/useAliasFromUrl.d.ts +0 -33
  1231. package/dist/places/hooks/useColumnResize.d.ts +0 -45
  1232. package/dist/places/hooks/useDebounce.d.ts +0 -56
  1233. package/dist/places/hooks/useDerivedContractedModules.d.ts +0 -8
  1234. package/dist/places/hooks/useI18nFormatters.d.ts +0 -40
  1235. package/dist/places/hooks/useMediaQuery.d.ts +0 -14
  1236. package/dist/places/hooks/useModuleAccess.d.ts +0 -59
  1237. package/dist/places/hooks/usePageTitle.d.ts +0 -10
  1238. package/dist/places/hooks/usePermissionQuery.d.ts +0 -49
  1239. package/dist/places/hooks/useRowResize.d.ts +0 -37
  1240. package/dist/places/hooks/useSidebarResize.d.ts +0 -37
  1241. package/dist/places/hooks/useUpdatesNotification.d.ts +0 -27
  1242. package/dist/places/hooks/useWizard.d.ts +0 -40
  1243. package/dist/places/i18n/LanguageBootstrap.d.ts +0 -14
  1244. package/dist/places/i18n/config.d.ts +0 -13
  1245. package/dist/places/i18n/constants.d.ts +0 -126
  1246. package/dist/places/i18n/index.d.ts +0 -12
  1247. package/dist/places/i18n/utils.d.ts +0 -14
  1248. package/dist/places/integrations/clarity/clarityTracking.d.ts +0 -31
  1249. package/dist/places/integrations/clarity/index.d.ts +0 -3
  1250. package/dist/places/integrations/clarity/types.d.ts +0 -46
  1251. package/dist/places/integrations/clarity/useClarity.d.ts +0 -34
  1252. package/dist/places/integrations/index.d.ts +0 -5
  1253. package/dist/places/leadership/components/LeadershipDialog.d.ts +0 -10
  1254. package/dist/places/leadership/components/LeadershipForm.d.ts +0 -8
  1255. package/dist/places/leadership/components/LeadershipPage.d.ts +0 -19
  1256. package/dist/places/leadership/hooks/useLeadershipApi.d.ts +0 -4
  1257. package/dist/places/leadership/hooks/useLeadershipMutations.d.ts +0 -29
  1258. package/dist/places/leadership/index.d.ts +0 -13
  1259. package/dist/places/leadership/types.d.ts +0 -23
  1260. package/dist/places/leadership/utils/leadershipUtils.d.ts +0 -8
  1261. package/dist/places/media/components/ImageEditor.d.ts +0 -22
  1262. package/dist/places/media/components/ImageRenderer.d.ts +0 -23
  1263. package/dist/places/media/components/VideoEditor.d.ts +0 -2
  1264. package/dist/places/media/components/VideoRenderer.d.ts +0 -2
  1265. package/dist/places/media/hooks/useMediaUpload.d.ts +0 -19
  1266. package/dist/places/media/index.d.ts +0 -49
  1267. package/dist/places/media/types.d.ts +0 -66
  1268. package/dist/places/media/utils/imageHelpers.d.ts +0 -28
  1269. package/dist/places/media/utils/videoHelpers.d.ts +0 -35
  1270. package/dist/places/mind-map/components/MindMap.d.ts +0 -23
  1271. package/dist/places/mind-map/components/MindMapConnection.d.ts +0 -12
  1272. package/dist/places/mind-map/components/MindMapNodeView.d.ts +0 -24
  1273. package/dist/places/mind-map/components/MindMapToolbar.d.ts +0 -26
  1274. package/dist/places/mind-map/hooks/useMindMapKeyboard.d.ts +0 -15
  1275. package/dist/places/mind-map/hooks/useMindMapLayout.d.ts +0 -5
  1276. package/dist/places/mind-map/hooks/useMindMapPanZoom.d.ts +0 -21
  1277. package/dist/places/mind-map/hooks/useMindMapState.d.ts +0 -32
  1278. package/dist/places/mind-map/index.d.ts +0 -4
  1279. package/dist/places/mind-map/types.d.ts +0 -91
  1280. package/dist/places/mind-map/utils/export-image.d.ts +0 -9
  1281. package/dist/places/mind-map/utils/layout.d.ts +0 -15
  1282. package/dist/places/mind-map/utils/nodeOps.d.ts +0 -66
  1283. package/dist/places/mind-map/utils/serialize.d.ts +0 -10
  1284. package/dist/places/modules/softwaresMap.d.ts +0 -4
  1285. package/dist/places/places/components/ManageAccessModal.d.ts +0 -11
  1286. package/dist/places/places/components/PlaceCard.d.ts +0 -12
  1287. package/dist/places/places/components/PlacesList.d.ts +0 -12
  1288. package/dist/places/places/index.d.ts +0 -8
  1289. package/dist/places/places/services/PlaceService.d.ts +0 -9
  1290. package/dist/places/places/types.d.ts +0 -10
  1291. package/dist/places/providers/CoreProviders.d.ts +0 -107
  1292. package/dist/places/providers/index.d.ts +0 -2
  1293. package/dist/places/qualiex/components/QualiexUserField.d.ts +0 -133
  1294. package/dist/places/qualiex/hooks/useQualiexUsers.d.ts +0 -41
  1295. package/dist/places/qualiex/services/qualiexApi.d.ts +0 -75
  1296. package/dist/places/qualiex/utils/QualiexErrorInterceptor.d.ts +0 -20
  1297. package/dist/places/qualiex/utils/userPlaceUtils.d.ts +0 -16
  1298. package/dist/places/services/BaseService.d.ts +0 -51
  1299. package/dist/places/services/EmailService.d.ts +0 -110
  1300. package/dist/places/services/ErrorService.d.ts +0 -19
  1301. package/dist/places/services/QualiexEnrichmentService.d.ts +0 -53
  1302. package/dist/places/services/QualiexFieldHelpers.d.ts +0 -17
  1303. package/dist/places/setup/favicon.d.ts +0 -1
  1304. package/dist/places/setup.d.ts +0 -16
  1305. package/dist/places/sign/components/D4SignWidget.d.ts +0 -2
  1306. package/dist/places/sign/components/DocumentSigner.d.ts +0 -2
  1307. package/dist/places/sign/components/SignConfigForm.d.ts +0 -2
  1308. package/dist/places/sign/components/SignWidget.d.ts +0 -9
  1309. package/dist/places/sign/hooks/useSignConfig.d.ts +0 -6
  1310. package/dist/places/sign/index.d.ts +0 -8
  1311. package/dist/places/sign/services/signService.d.ts +0 -17
  1312. package/dist/places/sign/types.d.ts +0 -53
  1313. package/dist/places/sign/utils/loadClicksignScript.d.ts +0 -13
  1314. package/dist/places/supabase/SupabaseSingleton.d.ts +0 -34
  1315. package/dist/places/supabase/client.d.ts +0 -2
  1316. package/dist/places/supabase/legacyKeyGuard.d.ts +0 -19
  1317. package/dist/places/supabase/publicClient.d.ts +0 -2
  1318. package/dist/places/supabase/types.d.ts +0 -377
  1319. package/dist/places/team-selector/components/TeamSelector.d.ts +0 -24
  1320. package/dist/places/team-selector/index.d.ts +0 -2
  1321. package/dist/places/team-selector/types.d.ts +0 -10
  1322. package/dist/places/types/sidebar.d.ts +0 -52
  1323. package/dist/places/utils/color.d.ts +0 -26
  1324. package/dist/places/utils/formatters/currencyFormatters.d.ts +0 -1
  1325. package/dist/places/utils/formatters/dateFormatters.d.ts +0 -52
  1326. package/dist/places/utils/index.d.ts +0 -9
  1327. package/dist/places/utils/linkHelpers.d.ts +0 -9
  1328. package/dist/places/utils/load-fonts.d.ts +0 -1
  1329. package/dist/sign/action-plans/components/ActionPlanAttachmentsTab.d.ts +0 -21
  1330. package/dist/sign/action-plans/components/ActionPlanCommentsTab.d.ts +0 -21
  1331. package/dist/sign/action-plans/components/ActionPlanCostTab.d.ts +0 -15
  1332. package/dist/sign/action-plans/components/ActionPlanGeneralTab.d.ts +0 -21
  1333. package/dist/sign/action-plans/components/ActionPlanHistoryTab.d.ts +0 -16
  1334. package/dist/sign/action-plans/components/ActionPlanPage.d.ts +0 -25
  1335. package/dist/sign/action-plans/components/ActionPlanPredecessorsTab.d.ts +0 -15
  1336. package/dist/sign/action-plans/components/ActionPlanProgressDialog.d.ts +0 -16
  1337. package/dist/sign/action-plans/components/ActionPlanProgressTab.d.ts +0 -10
  1338. package/dist/sign/action-plans/components/ActionPlanStatusBadge.d.ts +0 -18
  1339. package/dist/sign/action-plans/constants.d.ts +0 -86
  1340. package/dist/sign/action-plans/hooks/useActionPlan.d.ts +0 -19
  1341. package/dist/sign/action-plans/hooks/useActionPlanProgress.d.ts +0 -20
  1342. package/dist/sign/action-plans/index.d.ts +0 -15
  1343. package/dist/sign/action-plans/types.d.ts +0 -413
  1344. package/dist/sign/action-plans/utils/formatTime.d.ts +0 -24
  1345. package/dist/sign/approval-flow/components/ApprovalSidenav.d.ts +0 -16
  1346. package/dist/sign/approval-flow/components/ApproveDialog.d.ts +0 -13
  1347. package/dist/sign/approval-flow/components/SelectApproverDialog.d.ts +0 -11
  1348. package/dist/sign/approval-flow/index.d.ts +0 -4
  1349. package/dist/sign/approval-flow/types.d.ts +0 -76
  1350. package/dist/sign/assets/index.d.ts +0 -7
  1351. package/dist/sign/audit-trail/components/AuditTrailDetails.d.ts +0 -27
  1352. package/dist/sign/audit-trail/components/AuditTrailFilter.d.ts +0 -29
  1353. package/dist/sign/audit-trail/components/AuditTrailPage.d.ts +0 -40
  1354. package/dist/sign/audit-trail/index.d.ts +0 -9
  1355. package/dist/sign/audit-trail/types.d.ts +0 -209
  1356. package/dist/sign/audit-trail/utils.d.ts +0 -54
  1357. package/dist/sign/auth/components/AliasRedirect.d.ts +0 -13
  1358. package/dist/sign/auth/components/AliasRouteGuard.d.ts +0 -20
  1359. package/dist/sign/auth/components/EditProfileDialog.d.ts +0 -13
  1360. package/dist/sign/auth/components/ProtectedRoute.d.ts +0 -11
  1361. package/dist/sign/auth/components/UserInfo.d.ts +0 -10
  1362. package/dist/sign/auth/contexts/AuthContext.d.ts +0 -89
  1363. package/dist/sign/auth/pages/CallbackPage.d.ts +0 -6
  1364. package/dist/sign/auth/pages/LoginPage.d.ts +0 -2
  1365. package/dist/sign/auth/services/AuthService.d.ts +0 -64
  1366. package/dist/sign/auth/services/SupabaseTokenService.d.ts +0 -3
  1367. package/dist/sign/auth/services/TokenManager.d.ts +0 -66
  1368. package/dist/sign/auth/services/TokenRegenerationService.d.ts +0 -14
  1369. package/dist/sign/auth/services/TokenService.d.ts +0 -48
  1370. package/dist/sign/auth/utils/ErrorInterceptor.d.ts +0 -20
  1371. package/dist/sign/components/ErrorBoundary.d.ts +0 -19
  1372. package/dist/sign/components/dashboards/dashboard-form.d.ts +0 -65
  1373. package/dist/sign/components/dashboards/dashboard-general-view.d.ts +0 -124
  1374. package/dist/sign/components/dashboards/dashboard-grid.d.ts +0 -66
  1375. package/dist/sign/components/dashboards/dashboard-list.d.ts +0 -41
  1376. package/dist/sign/components/dashboards/dashboard-panel-renderer.d.ts +0 -31
  1377. package/dist/sign/components/dashboards/dashboard-view.d.ts +0 -48
  1378. package/dist/sign/components/dashboards/helpers.d.ts +0 -86
  1379. package/dist/sign/components/dashboards/index.d.ts +0 -9
  1380. package/dist/sign/components/dashboards/panels/burndown-panel.d.ts +0 -41
  1381. package/dist/sign/components/dashboards/panels/cartesian-panel.d.ts +0 -66
  1382. package/dist/sign/components/dashboards/panels/index.d.ts +0 -14
  1383. package/dist/sign/components/dashboards/panels/list-panel.d.ts +0 -45
  1384. package/dist/sign/components/dashboards/panels/matrix-risk-panel.d.ts +0 -74
  1385. package/dist/sign/components/dashboards/panels/numeric-panel.d.ts +0 -32
  1386. package/dist/sign/components/dashboards/panels/panel-error.d.ts +0 -18
  1387. package/dist/sign/components/dashboards/panels/panel-header.d.ts +0 -27
  1388. package/dist/sign/components/dashboards/panels/panel-loader.d.ts +0 -17
  1389. package/dist/sign/components/dashboards/panels/panel-no-data.d.ts +0 -16
  1390. package/dist/sign/components/dashboards/panels/panel-unavailable.d.ts +0 -16
  1391. package/dist/sign/components/dashboards/panels/pareto-panel.d.ts +0 -30
  1392. package/dist/sign/components/dashboards/panels/performance-panel.d.ts +0 -39
  1393. package/dist/sign/components/dashboards/panels/pie-panel.d.ts +0 -29
  1394. package/dist/sign/components/dashboards/panels/text-panel.d.ts +0 -28
  1395. package/dist/sign/components/dashboards/types.d.ts +0 -755
  1396. package/dist/sign/components/layout/AppHeader.d.ts +0 -6
  1397. package/dist/sign/components/layout/AppLayout.d.ts +0 -10
  1398. package/dist/sign/components/layout/AppSidebar.d.ts +0 -10
  1399. package/dist/sign/components/layout/BodyContent.d.ts +0 -60
  1400. package/dist/sign/components/layout/SidebarActionTrigger.d.ts +0 -46
  1401. package/dist/sign/components/layout/SidebarHeader.d.ts +0 -5
  1402. package/dist/sign/components/layout/SidebarLogo.d.ts +0 -5
  1403. package/dist/sign/components/layout/sidebar-utils.d.ts +0 -12
  1404. package/dist/sign/components/modules/AccessDeniedDialog.d.ts +0 -43
  1405. package/dist/sign/components/modules/ModuleAccessGuard.d.ts +0 -42
  1406. package/dist/sign/components/modules/ModuleGrid.d.ts +0 -9
  1407. package/dist/sign/components/modules/ModuleOfferContent.d.ts +0 -20
  1408. package/dist/sign/components/modules/ModulesContent.d.ts +0 -21
  1409. package/dist/sign/components/modules/ModulesDialog.d.ts +0 -3
  1410. package/dist/sign/components/modules/ModulesFooterCards.d.ts +0 -10
  1411. package/dist/sign/components/modules/icons/ModulesCardIcons.d.ts +0 -19
  1412. package/dist/sign/components/modules/index.d.ts +0 -14
  1413. package/dist/sign/components/modules/modulesData.d.ts +0 -6
  1414. package/dist/sign/components/modules/types.d.ts +0 -41
  1415. package/dist/sign/components/ui/accordion.d.ts +0 -42
  1416. package/dist/sign/components/ui/action-button.d.ts +0 -48
  1417. package/dist/sign/components/ui/alert-dialog.d.ts +0 -102
  1418. package/dist/sign/components/ui/alert.d.ts +0 -44
  1419. package/dist/sign/components/ui/avatar.d.ts +0 -36
  1420. package/dist/sign/components/ui/badge.d.ts +0 -41
  1421. package/dist/sign/components/ui/breadcrumb.d.ts +0 -73
  1422. package/dist/sign/components/ui/button-group.d.ts +0 -24
  1423. package/dist/sign/components/ui/button.d.ts +0 -66
  1424. package/dist/sign/components/ui/calendar.d.ts +0 -24
  1425. package/dist/sign/components/ui/card.d.ts +0 -57
  1426. package/dist/sign/components/ui/chart.d.ts +0 -97
  1427. package/dist/sign/components/ui/checkbox.d.ts +0 -15
  1428. package/dist/sign/components/ui/collapsible.d.ts +0 -20
  1429. package/dist/sign/components/ui/color-picker.d.ts +0 -19
  1430. package/dist/sign/components/ui/combo-tree.d.ts +0 -103
  1431. package/dist/sign/components/ui/combobox.d.ts +0 -64
  1432. package/dist/sign/components/ui/command.d.ts +0 -89
  1433. package/dist/sign/components/ui/context-menu.d.ts +0 -122
  1434. package/dist/sign/components/ui/data-list.d.ts +0 -86
  1435. package/dist/sign/components/ui/date-picker.d.ts +0 -19
  1436. package/dist/sign/components/ui/dialog-wizard.d.ts +0 -100
  1437. package/dist/sign/components/ui/dialog.d.ts +0 -229
  1438. package/dist/sign/components/ui/disabled-menu-item.d.ts +0 -25
  1439. package/dist/sign/components/ui/drawer.d.ts +0 -94
  1440. package/dist/sign/components/ui/dropdown-menu.d.ts +0 -180
  1441. package/dist/sign/components/ui/electronic-signature-dialog.d.ts +0 -31
  1442. package/dist/sign/components/ui/empty-state.d.ts +0 -79
  1443. package/dist/sign/components/ui/export-dialog.d.ts +0 -48
  1444. package/dist/sign/components/ui/form.d.ts +0 -119
  1445. package/dist/sign/components/ui/grid.d.ts +0 -53
  1446. package/dist/sign/components/ui/hover-card.d.ts +0 -21
  1447. package/dist/sign/components/ui/icon-picker.d.ts +0 -17
  1448. package/dist/sign/components/ui/iframe-dialog.d.ts +0 -24
  1449. package/dist/sign/components/ui/input-group.d.ts +0 -113
  1450. package/dist/sign/components/ui/input.d.ts +0 -24
  1451. package/dist/sign/components/ui/label.d.ts +0 -23
  1452. package/dist/sign/components/ui/loading-state.d.ts +0 -52
  1453. package/dist/sign/components/ui/menubar.d.ts +0 -113
  1454. package/dist/sign/components/ui/multiselect-permissions.d.ts +0 -84
  1455. package/dist/sign/components/ui/navigation-menu.d.ts +0 -57
  1456. package/dist/sign/components/ui/onboarding-dialog.d.ts +0 -58
  1457. package/dist/sign/components/ui/online-editor-dialog.d.ts +0 -28
  1458. package/dist/sign/components/ui/page-breadcrumb.d.ts +0 -77
  1459. package/dist/sign/components/ui/pagination.d.ts +0 -81
  1460. package/dist/sign/components/ui/popover.d.ts +0 -57
  1461. package/dist/sign/components/ui/progress.d.ts +0 -22
  1462. package/dist/sign/components/ui/radio-group.d.ts +0 -66
  1463. package/dist/sign/components/ui/report-request-list.d.ts +0 -64
  1464. package/dist/sign/components/ui/resizable.d.ts +0 -38
  1465. package/dist/sign/components/ui/rich-text-editor.d.ts +0 -58
  1466. package/dist/sign/components/ui/scroll-area.d.ts +0 -40
  1467. package/dist/sign/components/ui/select.d.ts +0 -94
  1468. package/dist/sign/components/ui/separator.d.ts +0 -17
  1469. package/dist/sign/components/ui/sheet.d.ts +0 -108
  1470. package/dist/sign/components/ui/sidebar.d.ts +0 -269
  1471. package/dist/sign/components/ui/skeleton-variants.d.ts +0 -41
  1472. package/dist/sign/components/ui/skeleton.d.ts +0 -14
  1473. package/dist/sign/components/ui/slider.d.ts +0 -9
  1474. package/dist/sign/components/ui/sonner.d.ts +0 -8
  1475. package/dist/sign/components/ui/spinner.d.ts +0 -11
  1476. package/dist/sign/components/ui/split-button.d.ts +0 -76
  1477. package/dist/sign/components/ui/stack.d.ts +0 -17
  1478. package/dist/sign/components/ui/status-badge.d.ts +0 -52
  1479. package/dist/sign/components/ui/step-selector.d.ts +0 -46
  1480. package/dist/sign/components/ui/stimulsoft-viewer.d.ts +0 -28
  1481. package/dist/sign/components/ui/switch.d.ts +0 -25
  1482. package/dist/sign/components/ui/tab-page-layout.d.ts +0 -52
  1483. package/dist/sign/components/ui/table-resize-handle.d.ts +0 -22
  1484. package/dist/sign/components/ui/table.d.ts +0 -112
  1485. package/dist/sign/components/ui/tabs.d.ts +0 -66
  1486. package/dist/sign/components/ui/terms-of-use-dialog.d.ts +0 -102
  1487. package/dist/sign/components/ui/textarea.d.ts +0 -33
  1488. package/dist/sign/components/ui/timepicker.d.ts +0 -34
  1489. package/dist/sign/components/ui/toggle-group.d.ts +0 -37
  1490. package/dist/sign/components/ui/toggle.d.ts +0 -33
  1491. package/dist/sign/components/ui/tooltip.d.ts +0 -61
  1492. package/dist/sign/components/ui/truncated-cell.d.ts +0 -20
  1493. package/dist/sign/components/ui/typography.d.ts +0 -135
  1494. package/dist/sign/components/ui/updates-notification.d.ts +0 -47
  1495. package/dist/sign/components/ui/users-groups-selector.d.ts +0 -87
  1496. package/dist/sign/components/ui/viewer-dialog.d.ts +0 -184
  1497. package/dist/sign/config/backend.d.ts +0 -10
  1498. package/dist/sign/config/environments.d.ts +0 -27
  1499. package/dist/sign/config/index.d.ts +0 -75
  1500. package/dist/sign/contexts/LocaleContext.d.ts +0 -15
  1501. package/dist/sign/contexts/ModalStateContext.d.ts +0 -57
  1502. package/dist/sign/contexts/ModuleContext.d.ts +0 -34
  1503. package/dist/sign/contexts/NavigationContext.d.ts +0 -13
  1504. package/dist/sign/contexts/PageMetadataContext.d.ts +0 -48
  1505. package/dist/sign/crud/components/ActionMenuItems.d.ts +0 -22
  1506. package/dist/sign/crud/components/BaseForm.d.ts +0 -52
  1507. package/dist/sign/crud/components/ColumnSettingsPopover.d.ts +0 -28
  1508. package/dist/sign/crud/components/ContextMenu.d.ts +0 -21
  1509. package/dist/sign/crud/components/CrudActionBar.d.ts +0 -59
  1510. package/dist/sign/crud/components/CrudGrid.d.ts +0 -53
  1511. package/dist/sign/crud/components/CrudPagination.d.ts +0 -17
  1512. package/dist/sign/crud/components/CrudTable.d.ts +0 -66
  1513. package/dist/sign/crud/components/FilterBar.d.ts +0 -136
  1514. package/dist/sign/crud/components/GroupDropZone.d.ts +0 -16
  1515. package/dist/sign/crud/components/InlineRowActions.d.ts +0 -15
  1516. package/dist/sign/crud/components/SelectionCheckbox.d.ts +0 -9
  1517. package/dist/sign/crud/components/TableFooter.d.ts +0 -14
  1518. package/dist/sign/crud/components/TableRowActions.d.ts +0 -19
  1519. package/dist/sign/crud/createCrudPage.d.ts +0 -134
  1520. package/dist/sign/crud/createSimpleService.d.ts +0 -85
  1521. package/dist/sign/crud/generateCrudConfig.d.ts +0 -78
  1522. package/dist/sign/crud/hooks/useBaseForm.d.ts +0 -47
  1523. package/dist/sign/crud/hooks/useColumnDragReorder.d.ts +0 -19
  1524. package/dist/sign/crud/hooks/useColumnManager.d.ts +0 -85
  1525. package/dist/sign/crud/hooks/useCrud.d.ts +0 -152
  1526. package/dist/sign/crud/primitives/ActionMenu.d.ts +0 -69
  1527. package/dist/sign/crud/primitives/FilterBar.d.ts +0 -69
  1528. package/dist/sign/crud/primitives/Pagination.d.ts +0 -29
  1529. package/dist/sign/crud/primitives/Table.d.ts +0 -31
  1530. package/dist/sign/crud/primitives/TreeTable.d.ts +0 -7
  1531. package/dist/sign/crud/primitives/index.d.ts +0 -12
  1532. package/dist/sign/crud/primitives/types.d.ts +0 -199
  1533. package/dist/sign/crud/utils/routingHelpers.d.ts +0 -41
  1534. package/dist/sign/custom-form-fields/components/CustomFormFields.d.ts +0 -11
  1535. package/dist/sign/custom-form-fields/fields/FormDateField.d.ts +0 -9
  1536. package/dist/sign/custom-form-fields/fields/FormMultiSelectionField.d.ts +0 -9
  1537. package/dist/sign/custom-form-fields/fields/FormNumericField.d.ts +0 -9
  1538. package/dist/sign/custom-form-fields/fields/FormQuestionsField.d.ts +0 -9
  1539. package/dist/sign/custom-form-fields/fields/FormSingleSelectionField.d.ts +0 -9
  1540. package/dist/sign/custom-form-fields/fields/FormTextField.d.ts +0 -9
  1541. package/dist/sign/custom-form-fields/fields/FormTimeField.d.ts +0 -9
  1542. package/dist/sign/custom-form-fields/fields/FormUrlField.d.ts +0 -9
  1543. package/dist/sign/custom-form-fields/fields/ReadOnlyTextField.d.ts +0 -9
  1544. package/dist/sign/custom-form-fields/index.d.ts +0 -13
  1545. package/dist/sign/custom-form-fields/types.d.ts +0 -206
  1546. package/dist/sign/exports/action-plans.d.ts +0 -16
  1547. package/dist/sign/exports/audit-trail.d.ts +0 -1
  1548. package/dist/sign/exports/crud.d.ts +0 -31
  1549. package/dist/sign/exports/custom-form-fields.d.ts +0 -1
  1550. package/dist/sign/exports/file-upload.d.ts +0 -1
  1551. package/dist/sign/exports/integrations.d.ts +0 -15
  1552. package/dist/sign/exports/ui.d.ts +0 -100
  1553. package/dist/sign/file-upload/components/SingleFileUpload.d.ts +0 -102
  1554. package/dist/sign/file-upload/index.d.ts +0 -6
  1555. package/dist/sign/file-upload/types.d.ts +0 -26
  1556. package/dist/sign/file-upload/utils/formatBytes.d.ts +0 -6
  1557. package/dist/sign/file-upload/utils/getFileExtension.d.ts +0 -6
  1558. package/dist/sign/hooks/useActiveModules.d.ts +0 -45
  1559. package/dist/sign/hooks/useAliasFromUrl.d.ts +0 -33
  1560. package/dist/sign/hooks/useColumnResize.d.ts +0 -45
  1561. package/dist/sign/hooks/useDebounce.d.ts +0 -56
  1562. package/dist/sign/hooks/useDerivedContractedModules.d.ts +0 -8
  1563. package/dist/sign/hooks/useI18nFormatters.d.ts +0 -40
  1564. package/dist/sign/hooks/useMediaQuery.d.ts +0 -14
  1565. package/dist/sign/hooks/useModuleAccess.d.ts +0 -59
  1566. package/dist/sign/hooks/usePageTitle.d.ts +0 -10
  1567. package/dist/sign/hooks/usePermissionQuery.d.ts +0 -49
  1568. package/dist/sign/hooks/useRowResize.d.ts +0 -37
  1569. package/dist/sign/hooks/useSidebarResize.d.ts +0 -37
  1570. package/dist/sign/hooks/useUpdatesNotification.d.ts +0 -27
  1571. package/dist/sign/hooks/useWizard.d.ts +0 -40
  1572. package/dist/sign/i18n/LanguageBootstrap.d.ts +0 -14
  1573. package/dist/sign/i18n/config.d.ts +0 -13
  1574. package/dist/sign/i18n/constants.d.ts +0 -126
  1575. package/dist/sign/i18n/index.d.ts +0 -12
  1576. package/dist/sign/i18n/utils.d.ts +0 -14
  1577. package/dist/sign/integrations/clarity/clarityTracking.d.ts +0 -31
  1578. package/dist/sign/integrations/clarity/index.d.ts +0 -3
  1579. package/dist/sign/integrations/clarity/types.d.ts +0 -46
  1580. package/dist/sign/integrations/clarity/useClarity.d.ts +0 -34
  1581. package/dist/sign/integrations/index.d.ts +0 -5
  1582. package/dist/sign/leadership/components/LeadershipDialog.d.ts +0 -10
  1583. package/dist/sign/leadership/components/LeadershipForm.d.ts +0 -8
  1584. package/dist/sign/leadership/components/LeadershipPage.d.ts +0 -19
  1585. package/dist/sign/leadership/hooks/useLeadershipApi.d.ts +0 -4
  1586. package/dist/sign/leadership/hooks/useLeadershipMutations.d.ts +0 -29
  1587. package/dist/sign/leadership/index.d.ts +0 -13
  1588. package/dist/sign/leadership/types.d.ts +0 -23
  1589. package/dist/sign/leadership/utils/leadershipUtils.d.ts +0 -8
  1590. package/dist/sign/media/components/ImageEditor.d.ts +0 -22
  1591. package/dist/sign/media/components/ImageRenderer.d.ts +0 -23
  1592. package/dist/sign/media/components/VideoEditor.d.ts +0 -2
  1593. package/dist/sign/media/components/VideoRenderer.d.ts +0 -2
  1594. package/dist/sign/media/hooks/useMediaUpload.d.ts +0 -19
  1595. package/dist/sign/media/index.d.ts +0 -49
  1596. package/dist/sign/media/types.d.ts +0 -66
  1597. package/dist/sign/media/utils/imageHelpers.d.ts +0 -28
  1598. package/dist/sign/media/utils/videoHelpers.d.ts +0 -35
  1599. package/dist/sign/mind-map/components/MindMap.d.ts +0 -23
  1600. package/dist/sign/mind-map/components/MindMapConnection.d.ts +0 -12
  1601. package/dist/sign/mind-map/components/MindMapNodeView.d.ts +0 -24
  1602. package/dist/sign/mind-map/components/MindMapToolbar.d.ts +0 -26
  1603. package/dist/sign/mind-map/hooks/useMindMapKeyboard.d.ts +0 -15
  1604. package/dist/sign/mind-map/hooks/useMindMapLayout.d.ts +0 -5
  1605. package/dist/sign/mind-map/hooks/useMindMapPanZoom.d.ts +0 -21
  1606. package/dist/sign/mind-map/hooks/useMindMapState.d.ts +0 -32
  1607. package/dist/sign/mind-map/index.d.ts +0 -4
  1608. package/dist/sign/mind-map/types.d.ts +0 -91
  1609. package/dist/sign/mind-map/utils/export-image.d.ts +0 -9
  1610. package/dist/sign/mind-map/utils/layout.d.ts +0 -15
  1611. package/dist/sign/mind-map/utils/nodeOps.d.ts +0 -66
  1612. package/dist/sign/mind-map/utils/serialize.d.ts +0 -10
  1613. package/dist/sign/modules/softwaresMap.d.ts +0 -4
  1614. package/dist/sign/places/components/ManageAccessModal.d.ts +0 -11
  1615. package/dist/sign/places/components/PlaceCard.d.ts +0 -12
  1616. package/dist/sign/places/components/PlacesList.d.ts +0 -12
  1617. package/dist/sign/places/index.d.ts +0 -8
  1618. package/dist/sign/places/services/PlaceService.d.ts +0 -9
  1619. package/dist/sign/places/types.d.ts +0 -10
  1620. package/dist/sign/providers/CoreProviders.d.ts +0 -107
  1621. package/dist/sign/providers/index.d.ts +0 -2
  1622. package/dist/sign/qualiex/components/QualiexUserField.d.ts +0 -133
  1623. package/dist/sign/qualiex/hooks/useQualiexUsers.d.ts +0 -41
  1624. package/dist/sign/qualiex/services/qualiexApi.d.ts +0 -75
  1625. package/dist/sign/qualiex/utils/QualiexErrorInterceptor.d.ts +0 -20
  1626. package/dist/sign/qualiex/utils/userPlaceUtils.d.ts +0 -16
  1627. package/dist/sign/services/BaseService.d.ts +0 -51
  1628. package/dist/sign/services/EmailService.d.ts +0 -110
  1629. package/dist/sign/services/ErrorService.d.ts +0 -19
  1630. package/dist/sign/services/QualiexEnrichmentService.d.ts +0 -53
  1631. package/dist/sign/services/QualiexFieldHelpers.d.ts +0 -17
  1632. package/dist/sign/setup/favicon.d.ts +0 -1
  1633. package/dist/sign/setup.d.ts +0 -16
  1634. package/dist/sign/sign/components/D4SignWidget.d.ts +0 -2
  1635. package/dist/sign/sign/components/DocumentSigner.d.ts +0 -2
  1636. package/dist/sign/sign/components/SignConfigForm.d.ts +0 -2
  1637. package/dist/sign/sign/components/SignWidget.d.ts +0 -9
  1638. package/dist/sign/sign/hooks/useSignConfig.d.ts +0 -6
  1639. package/dist/sign/sign/index.d.ts +0 -8
  1640. package/dist/sign/sign/services/signService.d.ts +0 -17
  1641. package/dist/sign/sign/types.d.ts +0 -53
  1642. package/dist/sign/sign/utils/loadClicksignScript.d.ts +0 -13
  1643. package/dist/sign/supabase/SupabaseSingleton.d.ts +0 -34
  1644. package/dist/sign/supabase/client.d.ts +0 -2
  1645. package/dist/sign/supabase/legacyKeyGuard.d.ts +0 -19
  1646. package/dist/sign/supabase/publicClient.d.ts +0 -2
  1647. package/dist/sign/supabase/types.d.ts +0 -377
  1648. package/dist/sign/team-selector/components/TeamSelector.d.ts +0 -24
  1649. package/dist/sign/team-selector/index.d.ts +0 -2
  1650. package/dist/sign/team-selector/types.d.ts +0 -10
  1651. package/dist/sign/types/sidebar.d.ts +0 -52
  1652. package/dist/sign/utils/color.d.ts +0 -26
  1653. package/dist/sign/utils/formatters/currencyFormatters.d.ts +0 -1
  1654. package/dist/sign/utils/formatters/dateFormatters.d.ts +0 -52
  1655. package/dist/sign/utils/index.d.ts +0 -9
  1656. package/dist/sign/utils/linkHelpers.d.ts +0 -9
  1657. package/dist/sign/utils/load-fonts.d.ts +0 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("i18next"),t=require("react/jsx-runtime"),a=require("react"),r=require("@radix-ui/react-slot"),s=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),c=require("lucide-react"),d=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),b=require("@radix-ui/react-tooltip"),v=require("@radix-ui/react-popover"),y=require("react-i18next"),w=require("@supabase/supabase-js"),j=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),A=require("@radix-ui/react-switch"),T=require("@radix-ui/react-avatar"),D=require("@radix-ui/react-collapsible"),E=require("@radix-ui/react-tabs"),P=require("@radix-ui/react-accordion"),M=require("react-day-picker"),I=require("vaul"),R=require("@radix-ui/react-hover-card"),L=require("@radix-ui/react-navigation-menu"),F=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),U=require("react-resizable-panels"),O=require("@radix-ui/react-slider"),B=require("@radix-ui/react-menubar"),q=require("recharts"),V=require("@tiptap/react"),$=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable"),J=require("zod"),Z="undefined"!=typeof document?document.currentScript:null;function ee(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,Object.freeze(t)}var te=ee(a),ae=ee(c),re=ee(d),se=ee(u),ne=ee(m),oe=ee(p),ie=ee(x),le=ee(f),ce=ee(g),de=ee(b),ue=ee(v),me=ee(_),pe=ee(C),he=ee(k),xe=ee(S),fe=ee(A),ge=ee(T),be=ee(D),ve=ee(E),ye=ee(P),we=ee(R),je=ee(L),Ne=ee(F),_e=ee(z),Ce=ee(U),ke=ee(O),Se=ee(B),Ae=ee(q);const Te={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:"",commonV4AppUrl:"https://apps4.qualiex.com/common/"},De={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:"",commonV4AppUrl:"https://apps4-dev.qualiex.com/common/"};function Ee(){return"DEV"===(void 0).VITE_APP_ENV?"DEV":"PROD"}let Pe={};function Me(){const e="DEV"===Ee()?De:Te;return{...e,...Pe,oauth:{...e.oauth,...Pe.oauth}}}function Ie(){return"DEV"===Ee()}let Re="supabase";function Le(e){Re=e}function Fe(){return"supabase"===Re}const ze={get oauth(){const e=Me();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:e.oauth.responseType,scope:e.oauth.scope}}};function Ue(e){const t=Me().appBasePath||"";return`${window.location.origin}${t}${e}`}function Oe(){return Me().appBasePath||""}function Be(e){const t=Oe();return t&&e.startsWith(t)?e.slice(t.length)||"/":e}const qe={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Ve={debounceDelay:500},$e=()=>{const e=window.location.origin,t=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&t||(void 0).DEV},We=()=>$e()&&Fe(),He=$e,Ge=()=>Me().qualiexApiUrl,Ke=()=>Me().identApiUrl,Ye=()=>Me().loginApiUrl,Qe=()=>Me().commonV4AppUrl,Xe={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},Je={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},Ze={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},et="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",tt={qualiex:`${et}/logo-qualiex-white.svg`,qualitfy:`${et}/logo-qualitfy-white.svg`,metroex:`${et}/logo-metroex-white.svg`,qualiexSmall:`${et}/logo-forlogic-white.svg`,saber:`${et}/saber-gestao-white.png`,saberSmall:`${et}/small.svg`},at=`${et}/favicon.png`;let rt={};function st(e){return rt.logos?.[e]??tt[e]}const nt={get qualiex(){return st("qualiex")},get qualitfy(){return st("qualitfy")},get metroex(){return st("metroex")},get saber(){return st("saber")},get qualiexSmall(){return st("qualiexSmall")},get saberSmall(){return st("saberSmall")}};function ot(e){return st(Je.isQualiex?e?.isMetroex?"metroex":e?.isQualitfy?"qualitfy":"qualiex":"saber")}const it={get logo(){return ot()},get smallLogo(){return st(Je.isQualiex?"qualiexSmall":"saberSmall")},get favicon(){return rt.favicon??at}},lt=it.logo,ct=it.smallLogo;function dt(){if("undefined"==typeof document)return;document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=it.favicon,document.head.appendChild(e)}"function"==typeof queueMicrotask?queueMicrotask(dt):Promise.resolve().then(dt);const ut={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function mt(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const pt={date:mt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:mt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:mt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ht={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function xt(e){return(t,a)=>{let r;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,s=a?.width?String(a.width):t;r=e.formattingValues[s]||e.formattingValues[t]}else{const t=e.defaultWidth,s=a?.width?String(a.width):e.defaultWidth;r=e.values[s]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const ft={ordinalNumber:(e,t)=>{const a=Number(e),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:xt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:xt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:xt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:xt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:xt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function gt(e){return(t,a={})=>{const r=a.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],n=t.match(s);if(!n)return null;const o=n[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a;return}(i,e=>e.test(o)):function(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=a.valueCallback?a.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}function bt(e){return(t,a={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],n=t.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=a.valueCallback?a.valueCallback(o):o;return{value:o,rest:t.slice(s.length)}}}const vt={ordinalNumber:bt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:gt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:gt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:gt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:gt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:gt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},yt={code:"en-US",formatDistance:(e,t,a)=>{let r;const s=ut[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},formatLong:pt,formatRelative:(e,t,a,r)=>ht[e],localize:ft,match:vt,options:{weekStartsOn:0,firstWeekContainsDate:1}};let wt={};function jt(){return wt}const Nt=6048e5;function _t(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Ct(e){const t=_t(e);return t.setHours(0,0,0,0),t}function kt(e){const t=_t(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function St(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function At(e){const t=_t(e),a=function(e,t){const a=Ct(e),r=Ct(t),s=+a-kt(a),n=+r-kt(r);return Math.round((s-n)/864e5)}(t,function(e){const t=_t(e),a=St(e,0);return a.setFullYear(t.getFullYear(),0,1),a.setHours(0,0,0,0),a}(t));return a+1}function Tt(e,t){const a=jt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=_t(e),n=s.getDay(),o=(n<r?7:0)+n-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Dt(e){return Tt(e,{weekStartsOn:1})}function Et(e){const t=_t(e),a=t.getFullYear(),r=St(e,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const s=Dt(r),n=St(e,0);n.setFullYear(a,0,4),n.setHours(0,0,0,0);const o=Dt(n);return t.getTime()>=s.getTime()?a+1:t.getTime()>=o.getTime()?a:a-1}function Pt(e){const t=_t(e),a=+Dt(t)-+function(e){const t=Et(e),a=St(e,0);return a.setFullYear(t,0,4),a.setHours(0,0,0,0),Dt(a)}(t);return Math.round(a/Nt)+1}function Mt(e,t){const a=_t(e),r=a.getFullYear(),s=jt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=St(e,0);o.setFullYear(r+1,0,n),o.setHours(0,0,0,0);const i=Tt(o,t),l=St(e,0);l.setFullYear(r,0,n),l.setHours(0,0,0,0);const c=Tt(l,t);return a.getTime()>=i.getTime()?r+1:a.getTime()>=c.getTime()?r:r-1}function It(e,t){const a=_t(e),r=+Tt(a,t)-+function(e,t){const a=jt(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Mt(e,t),n=St(e,0);return n.setFullYear(s,0,r),n.setHours(0,0,0,0),Tt(n,t)}(a,t);return Math.round(r/Nt)+1}function Rt(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const Lt={y(e,t){const a=e.getFullYear(),r=a>0?a:1-a;return Rt("yy"===t?r%100:r,t.length)},M(e,t){const a=e.getMonth();return"M"===t?String(a+1):Rt(a+1,2)},d:(e,t)=>Rt(e.getDate(),t.length),a(e,t){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];default:return"am"===a?"a.m.":"p.m."}},h:(e,t)=>Rt(e.getHours()%12||12,t.length),H:(e,t)=>Rt(e.getHours(),t.length),m:(e,t)=>Rt(e.getMinutes(),t.length),s:(e,t)=>Rt(e.getSeconds(),t.length),S(e,t){const a=t.length,r=e.getMilliseconds();return Rt(Math.trunc(r*Math.pow(10,a-3)),t.length)}},Ft="midnight",zt="noon",Ut="morning",Ot="afternoon",Bt="evening",qt="night",Vt={G:function(e,t,a){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return a.era(r,{width:"abbreviated"});case"GGGGG":return a.era(r,{width:"narrow"});default:return a.era(r,{width:"wide"})}},y:function(e,t,a){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return a.ordinalNumber(r,{unit:"year"})}return Lt.y(e,t)},Y:function(e,t,a,r){const s=Mt(e,r),n=s>0?s:1-s;if("YY"===t){return Rt(n%100,2)}return"Yo"===t?a.ordinalNumber(n,{unit:"year"}):Rt(n,t.length)},R:function(e,t){return Rt(Et(e),t.length)},u:function(e,t){return Rt(e.getFullYear(),t.length)},Q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Rt(r,2);case"Qo":return a.ordinalNumber(r,{unit:"quarter"});case"QQQ":return a.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(r,{width:"narrow",context:"formatting"});default:return a.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Rt(r,2);case"qo":return a.ordinalNumber(r,{unit:"quarter"});case"qqq":return a.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(r,{width:"narrow",context:"standalone"});default:return a.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,a){const r=e.getMonth();switch(t){case"M":case"MM":return Lt.M(e,t);case"Mo":return a.ordinalNumber(r+1,{unit:"month"});case"MMM":return a.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(r,{width:"narrow",context:"formatting"});default:return a.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,a){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Rt(r+1,2);case"Lo":return a.ordinalNumber(r+1,{unit:"month"});case"LLL":return a.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(r,{width:"narrow",context:"standalone"});default:return a.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,a,r){const s=It(e,r);return"wo"===t?a.ordinalNumber(s,{unit:"week"}):Rt(s,t.length)},I:function(e,t,a){const r=Pt(e);return"Io"===t?a.ordinalNumber(r,{unit:"week"}):Rt(r,t.length)},d:function(e,t,a){return"do"===t?a.ordinalNumber(e.getDate(),{unit:"date"}):Lt.d(e,t)},D:function(e,t,a){const r=At(e);return"Do"===t?a.ordinalNumber(r,{unit:"dayOfYear"}):Rt(r,t.length)},E:function(e,t,a){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return a.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return Rt(n,2);case"eo":return a.ordinalNumber(n,{unit:"day"});case"eee":return a.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"});default:return a.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return Rt(n,t.length);case"co":return a.ordinalNumber(n,{unit:"day"});case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"});default:return a.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,a){const r=e.getDay(),s=0===r?7:r;switch(t){case"i":return String(s);case"ii":return Rt(s,t.length);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return a.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,a){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(r,{width:"narrow",context:"formatting"});default:return a.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,a){const r=e.getHours();let s;switch(s=12===r?zt:0===r?Ft:r/12>=1?"pm":"am",t){case"b":case"bb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,a){const r=e.getHours();let s;switch(s=r>=17?Bt:r>=12?Ot:r>=4?Ut:qt,t){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,a){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),a.ordinalNumber(t,{unit:"hour"})}return Lt.h(e,t)},H:function(e,t,a){return"Ho"===t?a.ordinalNumber(e.getHours(),{unit:"hour"}):Lt.H(e,t)},K:function(e,t,a){const r=e.getHours()%12;return"Ko"===t?a.ordinalNumber(r,{unit:"hour"}):Rt(r,t.length)},k:function(e,t,a){let r=e.getHours();return 0===r&&(r=24),"ko"===t?a.ordinalNumber(r,{unit:"hour"}):Rt(r,t.length)},m:function(e,t,a){return"mo"===t?a.ordinalNumber(e.getMinutes(),{unit:"minute"}):Lt.m(e,t)},s:function(e,t,a){return"so"===t?a.ordinalNumber(e.getSeconds(),{unit:"second"}):Lt.s(e,t)},S:function(e,t){return Lt.S(e,t)},X:function(e,t,a){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Wt(r);case"XXXX":case"XX":return Ht(r);default:return Ht(r,":")}},x:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"x":return Wt(r);case"xxxx":case"xx":return Ht(r);default:return Ht(r,":")}},O:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+$t(r,":");default:return"GMT"+Ht(r,":")}},z:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+$t(r,":");default:return"GMT"+Ht(r,":")}},t:function(e,t,a){return Rt(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,a){return Rt(e.getTime(),t.length)}};function $t(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),n=r%60;return 0===n?a+String(s):a+String(s)+t+Rt(n,2)}function Wt(e,t){if(e%60==0){return(e>0?"-":"+")+Rt(Math.abs(e)/60,2)}return Ht(e,t)}function Ht(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+Rt(Math.trunc(r/60),2)+t+Rt(r%60,2)}const Gt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Kt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Yt={p:Kt,P:(e,t)=>{const a=e.match(/(P+)(p+)?/)||[],r=a[1],s=a[2];if(!s)return Gt(e,t);let n;switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Gt(r,t)).replace("{{time}}",Kt(s,t))}},Qt=/^D+$/,Xt=/^Y+$/,Jt=["D","DD","YY","YYYY"];function Zt(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const a=_t(e);return!isNaN(Number(a))}const ea=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ta=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,aa=/^'([^]*?)'?$/,ra=/''/g,sa=/[a-zA-Z]/;function na(e,t,a){const r=jt(),s=a?.locale??r.locale??yt,n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=_t(e);if(!Zt(i))throw new RangeError("Invalid time value");let l=t.match(ta).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,Yt[t])(e,s.formatLong)}return e}).join("").match(ea).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:oa(e)};if(Vt[t])return{isToken:!0,value:e};if(t.match(sa))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});s.localize.preprocessor&&(l=s.localize.preprocessor(i,l));const c={firstWeekContainsDate:n,weekStartsOn:o,locale:s};return l.map(r=>{if(!r.isToken)return r.value;const n=r.value;(!a?.useAdditionalWeekYearTokens&&function(e){return Xt.test(e)}(n)||!a?.useAdditionalDayOfYearTokens&&function(e){return Qt.test(e)}(n))&&function(e,t,a){const r=function(e,t,a){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,a);if(Jt.includes(e))throw new RangeError(r)}(n,t,String(e));return(0,Vt[n[0]])(i,n,s.localize,c)}).join("")}function oa(e){const t=e.match(aa);return t?t[1].replace(ra,"'"):e}function ia(e,t,a){const r=i.getDefaultOptions(),s=function(e,t,a){return new Intl.DateTimeFormat(a?[a.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,a.timeZone,a.locale??r.locale);return"formatToParts"in s?function(e,t){const a=e.formatToParts(t);for(let r=a.length-1;r>=0;--r)if("timeZoneName"===a[r].type)return a[r].value;return}(s,t):function(e,t){const a=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(a);return r?r[0].substr(1):""}(s,t)}function la(e,t){const a=function(e){da[e]||(da[e]=ma?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return da[e]}(t);return"formatToParts"in a?function(e,t){try{const a=e.formatToParts(t),r=[];for(let e=0;e<a.length;e++){const t=ca[a[e].type];void 0!==t&&(r[t]=parseInt(a[e].value,10))}return r}catch(a){if(a instanceof RangeError)return[NaN];throw a}}(a,e):function(e,t){const a=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}(a,e)}const ca={year:0,month:1,day:2,hour:3,minute:4,second:5};const da={},ua=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),ma="06/25/2014, 00:00:00"===ua||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===ua;function pa(e,t,a,r,s,n,o){const i=new Date(0);return i.setUTCFullYear(e,t,a),i.setUTCHours(r,s,n,o),i}const ha=36e5,xa={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function fa(e,t,a){if(!e)return 0;let r,s,n=xa.timezoneZ.exec(e);if(n)return 0;if(n=xa.timezoneHH.exec(e),n)return r=parseInt(n[1],10),ba(r)?-r*ha:NaN;if(n=xa.timezoneHHMM.exec(e),n){r=parseInt(n[2],10);const e=parseInt(n[3],10);return ba(r,e)?(s=Math.abs(r)*ha+6e4*e,"+"===n[1]?-s:s):NaN}if(function(e){if(va[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),va[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());const r=a?t:function(e){return pa(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),s=ga(r,e),n=a?s:function(e,t,a){const r=e.getTime();let s=r-t;const n=ga(new Date(s),a);if(t===n)return t;s-=n-t;const o=ga(new Date(s),a);if(n===o)return n;return Math.max(n,o)}(t,s,e);return-n}return NaN}function ga(e,t){const a=la(e,t),r=pa(a[0],a[1]-1,a[2],a[3]%24,a[4],a[5],0).getTime();let s=e.getTime();const n=s%1e3;return s-=n>=0?n:1e3+n,r-s}function ba(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const va={};const ya={X:function(e,t,a){const r=wa(a.timeZone,e);if(0===r)return"Z";switch(t){case"X":return _a(r);case"XXXX":case"XX":return Na(r);default:return Na(r,":")}},x:function(e,t,a){const r=wa(a.timeZone,e);switch(t){case"x":return _a(r);case"xxxx":case"xx":return Na(r);default:return Na(r,":")}},O:function(e,t,a){const r=wa(a.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),n=r%60;if(0===n)return a+String(s);return a+String(s)+t+ja(n,2)}(r,":");default:return"GMT"+Na(r,":")}},z:function(e,t,a){switch(t){case"z":case"zz":case"zzz":return ia("short",e,a);default:return ia("long",e,a)}}};function wa(e,t){const a=e?fa(e,t,!0)/6e4:t?.getTimezoneOffset()??0;if(Number.isNaN(a))throw new RangeError("Invalid time zone specified: "+e);return a}function ja(e,t){const a=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return a+r}function Na(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+ja(Math.floor(r/60),2)+t+ja(Math.floor(r%60),2)}function _a(e,t){if(e%60==0){return(e>0?"-":"+")+ja(Math.abs(e)/60,2)}return Na(e,t)}function Ca(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ka=36e5,Sa=6e4,Aa={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Ta(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const a=null==t.additionalDigits?2:Number(t.additionalDigits);if(2!==a&&1!==a&&0!==a)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const r=function(e){const t={};let a,r=Aa.dateTimePattern.exec(e);r?(t.date=r[1],a=r[3]):(r=Aa.datePattern.exec(e),r?(t.date=r[1],a=r[2]):(t.date=null,a=e));if(a){const e=Aa.timeZone.exec(a);e?(t.time=a.replace(e[1],""),t.timeZone=e[1].trim()):t.time=a}return t}(e),{year:s,restDateString:n}=function(e,t){if(e){const a=Aa.YYY[t],r=Aa.YYYYY[t];let s=Aa.YYYY.exec(e)||r.exec(e);if(s){const t=s[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(s=Aa.YY.exec(e)||a.exec(e),s){const t=s[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(r.date,a),o=function(e,t){if(null===t)return null;let a,r,s;if(!e||!e.length)return a=new Date(0),a.setUTCFullYear(t),a;let n=Aa.MM.exec(e);if(n)return a=new Date(0),r=parseInt(n[1],10)-1,Ia(t,r)?(a.setUTCFullYear(t,r),a):new Date(NaN);if(n=Aa.DDD.exec(e),n){a=new Date(0);const e=parseInt(n[1],10);return function(e,t){if(t<1)return!1;const a=Ma(e);if(a&&t>366)return!1;if(!a&&t>365)return!1;return!0}(t,e)?(a.setUTCFullYear(t,0,e),a):new Date(NaN)}if(n=Aa.MMDD.exec(e),n){a=new Date(0),r=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return Ia(t,r,e)?(a.setUTCFullYear(t,r,e),a):new Date(NaN)}if(n=Aa.Www.exec(e),n)return s=parseInt(n[1],10)-1,Ra(s)?Da(t,s):new Date(NaN);if(n=Aa.WwwD.exec(e),n){s=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return Ra(s,e)?Da(t,s,e):new Date(NaN)}return null}(n,s);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let a,s=0;if(r.time&&(s=function(e){let t,a,r=Aa.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),La(t)?t%24*ka:NaN;if(r=Aa.HHMM.exec(e),r)return t=parseInt(r[1],10),a=parseFloat(r[2].replace(",",".")),La(t,a)?t%24*ka+a*Sa:NaN;if(r=Aa.HHMMSS.exec(e),r){t=parseInt(r[1],10),a=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return La(t,a,e)?t%24*ka+a*Sa+1e3*e:NaN}return null}(r.time),null===s||isNaN(s)))return new Date(NaN);if(r.timeZone||t.timeZone){if(a=fa(r.timeZone||t.timeZone,new Date(e+s)),isNaN(a))return new Date(NaN)}else a=Ca(new Date(e+s)),a=Ca(new Date(e+s+a));return new Date(e+s+a)}return new Date(NaN)}function Da(e,t,a){t=t||0,a=a||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const s=7*t+a+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}const Ea=[31,28,31,30,31,30,31,31,30,31,30,31],Pa=[31,29,31,30,31,30,31,31,30,31,30,31];function Ma(e){return e%400==0||e%4==0&&e%100!=0}function Ia(e,t,a){if(t<0||t>11)return!1;if(null!=a){if(a<1)return!1;const r=Ma(e);if(r&&a>Pa[t])return!1;if(!r&&a>Ea[t])return!1}return!0}function Ra(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function La(e,t,a){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==a||!(a<0||a>=60)))}const Fa=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function za(e,t,a,r){return function(e,t,a={}){const r=(t=String(t)).match(Fa);if(r){const s=Ta(a.originalDate||e,a);t=r.reduce(function(e,t){if("'"===t[0])return e;const r=e.indexOf(t),n="'"===e[r-1],o=e.replace(t,"'"+ya[t[0]](s,t,a)+"'");return n?o.substring(0,r-1)+o.substring(r+1):o},t)}return na(e,t,a)}(function(e,t,a){const r=fa(t,e=Ta(e,a),!0),s=new Date(e.getTime()-r),n=new Date(0);return n.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),n.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),n}(e,t,{timeZone:(r={...r,timeZone:t,originalDate:e}).timeZone}),a,r)}const Ua={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Oa={date:mt({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:mt({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:mt({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ba={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},qa={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Va={ordinalNumber:(e,t)=>Number(e)+"º",era:xt({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:xt({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:xt({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:xt({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:xt({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},$a={ordinalNumber:bt({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:gt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:gt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:gt({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:gt({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:gt({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},Wa={code:"es",formatDistance:(e,t,a)=>{let r;const s=Ua[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},formatLong:Oa,formatRelative:(e,t,a,r)=>1!==t.getHours()?qa[e]:Ba[e],localize:Va,match:$a,options:{weekStartsOn:1,firstWeekContainsDate:1}},Ha={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ga={date:mt({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:mt({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:mt({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ka={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Ya={ordinalNumber:(e,t)=>{const a=Number(e);return"week"===t?.unit?a+"ª":a+"º"},era:xt({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:xt({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:xt({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:xt({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:xt({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},Qa={ordinalNumber:bt({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:gt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:gt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:gt({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:gt({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:gt({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},Xa={code:"pt-BR",formatDistance:(e,t,a)=>{let r;const s=Ha[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",String(t)),a?.addSuffix?a.comparison&&a.comparison>0?"em "+r:"há "+r:r},formatLong:Ga,formatRelative:(e,t,a,r)=>{const s=Ka[e];return"function"==typeof s?s(t):s},localize:Ya,match:Qa,options:{weekStartsOn:0,firstWeekContainsDate:1}},Ja=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],Za=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],er=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],tr="pt-BR",ar="dd/MM/yyyy HH:mm",rr="America/Sao_Paulo",sr=e=>Ja.some(t=>t.value===e),nr=e=>er.some(t=>t.value===e),or=()=>{if("undefined"==typeof navigator)return tr;const e=navigator.language;if(sr(e))return e;const t=e.split("-")[0],a=Ja.find(e=>e.value.startsWith(t));return a?.value||tr},ir=()=>{if("undefined"==typeof Intl)return rr;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return nr(e)?e:rr}catch{return rr}},lr=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||ar),cr={"pt-BR":Xa,"en-US":yt,"es-ES":Wa},dr=(e,t=ar,a=rr,r=tr)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const n=cr[r]||Xa;try{return za(s,a,t,{locale:n})}catch(o){return za(s,rr,t,{locale:n})}},ur=(e,t=tr,a=rr)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const s=cr[t]||Xa;try{return za(r,a,"PP",{locale:s})}catch(n){return za(r,rr,"PP",{locale:s})}};function mr(e){const t=e.replace("#",""),a=3===t.length?t.split("").map(e=>e+e).join(""):t;return{r:parseInt(a.substring(0,2),16),g:parseInt(a.substring(2,4),16),b:parseInt(a.substring(4,6),16)}}function pr(e,t=.1){const{r:a,g:r,b:s}=mr(e);return`rgba(${a}, ${r}, ${s}, ${t})`}function hr(e){const{r:t,g:a,b:r}=mr(e),[s,n,o]=[t,a,r].map(e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)});return.2126*s+.7152*n+.0722*o}function xr(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function fr(e,t){return t?e.replace(/\{alias\}/g,t):e}function gr(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const a=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}const br=["hint","details","code","where","schema","table","column"],vr="Ocorreu um erro ao processar sua solicitação.",yr=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function wr(e){const t=function(e){if(!e)return vr;if("string"==typeof e)return e;if(e instanceof Error)return e.message||vr;if("object"==typeof e&&"message"in e)return String(e.message);return vr}(e);return Ie()?t:yr.some(e=>e.test(t))?vr:t}function jr(...e){return o.twMerge(n.clsx(e))}const Nr=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Nr);if("object"==typeof e&&e.constructor===Object){const t={};for(const[a,r]of Object.entries(e))t[a]=Nr(r);return t}return e},_r=s.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),Cr=te.forwardRef(({className:e,variant:a,size:s,asChild:n=!1,...o},i)=>{const l=n?r.Slot:"button";return t.jsx(l,{className:jr(_r({variant:a,size:s,className:e})),ref:i,...o})});Cr.displayName="Button";const kr=a.forwardRef(({className:e,children:a,variant:r="action",...s},n)=>t.jsx(Cr,{ref:n,variant:r,size:"icon",className:jr("h-8 w-8",e),...s,children:a||t.jsx(c.EllipsisVertical,{size:16})}));kr.displayName="ActionButton";const Sr=te.forwardRef(({className:e,type:a,showCharCount:r,maxLength:s,onChange:n,...o},i)=>{const[l,c]=te.useState(0);te.useEffect(()=>{"string"==typeof o.value?c(o.value.length):"string"==typeof o.defaultValue&&c(o.defaultValue.length)},[o.value,o.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("input",{type:a,className:jr("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:s,onChange:e=>{c(e.target.value.length),n?.(e)},...o}),r&&s&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",s]})]})});Sr.displayName="Input";const Ar=s.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Tr=te.forwardRef(({className:e,...a},r)=>t.jsx(re.Root,{ref:r,className:jr(Ar(),e),...a}));Tr.displayName=re.Root.displayName;const Dr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("rounded-lg border bg-card text-card-foreground shadow-sm",e),...a}));Dr.displayName="Card";const Er=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("flex flex-col space-y-1.5 p-6",e),...a}));Er.displayName="CardHeader";const Pr=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:jr("text-2xl font-semibold leading-none tracking-tight",e),...a}));Pr.displayName="CardTitle";const Mr=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));Mr.displayName="CardDescription";const Ir=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("p-6 pt-0",e),...a}));Ir.displayName="CardContent";const Rr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("flex items-center p-6 pt-0",e),...a}));Rr.displayName="CardFooter";const Lr=te.forwardRef(({className:e,orientation:a="horizontal",decorative:r=!0,...s},n)=>t.jsx(ne.Root,{ref:n,decorative:r,orientation:a,className:jr("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Lr.displayName=ne.Root.displayName;const Fr=oe.Root,zr=oe.Trigger,Ur=oe.Portal,Or=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Overlay,{className:jr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));Or.displayName=oe.Overlay.displayName;const Br=te.forwardRef(({className:e,...a},r)=>t.jsxs(Ur,{children:[t.jsx(Or,{}),t.jsx(oe.Content,{ref:r,className:jr("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a})]}));Br.displayName=oe.Content.displayName;const qr=({className:e,...a})=>t.jsx("div",{className:jr("flex flex-col space-y-2 text-center sm:text-left",e),...a});qr.displayName="AlertDialogHeader";const Vr=({className:e,...a})=>t.jsx("div",{className:jr("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});Vr.displayName="AlertDialogFooter";const $r=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Title,{ref:r,className:jr("text-lg font-semibold",e),...a}));$r.displayName=oe.Title.displayName;const Wr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Description,{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));Wr.displayName=oe.Description.displayName;const Hr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Action,{ref:r,className:jr(_r(),e),...a}));Hr.displayName=oe.Action.displayName;const Gr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Cancel,{ref:r,className:jr(_r({variant:"outline"}),"mt-2 sm:mt-0",e),...a}));Gr.displayName=oe.Cancel.displayName;const Kr=se.Root,Yr=se.Trigger,Qr=se.Portal,Xr=se.Close,Jr=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{ref:r,className:jr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));Jr.displayName=se.Overlay.displayName;const Zr={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},es=te.forwardRef(({className:a,children:r,size:s,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:d,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:b,onInteractOutside:v,onEscapeKeyDown:y,...w},j)=>{const[N,_]=te.useState(!1),C=te.useRef(null),k=te.useRef(!1),S=s??(i||l||d||u||m||p?void 0:"md"),A=S?Zr[S]:{},T={...i??A.width?{width:i??A.width}:{},...l??A.minWidth?{minWidth:l??A.minWidth}:{},...d??A.maxWidth?{maxWidth:d??A.maxWidth}:{},...u??A.height?{height:u??A.height}:{},...m??A.minHeight?{minHeight:m??A.minHeight}:{},...p??A.maxHeight?{maxHeight:p??A.maxHeight}:{},...b},D=te.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),E=te.useRef(null),P="destructive"!==n;if("development"===process.env.NODE_ENV&&r){const e=te.Children.toArray(r);e.some(e=>te.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>te.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t.jsxs(Qr,{children:[t.jsx(Jr,{}),t.jsxs(se.Content,{ref:j,className:jr("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",a),style:T,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?v?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void D(()=>{k.current=!0,E.current?.click()})):void y?.(e);e.preventDefault()},...w,children:[r,P&&t.jsxs(se.Close,{ref:E,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),D(()=>{k.current=!0,E.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]}),t.jsx(Fr,{open:N,onOpenChange:_,children:t.jsxs(Br,{children:[t.jsxs(qr,{children:[t.jsx($r,{children:h}),t.jsx(Wr,{children:x})]}),t.jsxs(Vr,{children:[t.jsx(Gr,{onClick:()=>{_(!1),C.current=null},children:f}),t.jsx(Hr,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});es.displayName=se.Content.displayName;const ts=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:jr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Lr,{className:"mt-2"})]});ts.displayName="DialogHeader";const as=({className:e,...a})=>t.jsx("div",{className:jr("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...a});as.displayName="DialogBody";const rs=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Lr,{className:"mb-4"}),t.jsx("div",{className:jr("flex flex-row justify-end gap-2",e),...r,children:a})]});rs.displayName="DialogFooter";const ss=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:jr("text-xl font-semibold leading-none tracking-tight",e),...a}));ss.displayName=se.Title.displayName;const ns=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));ns.displayName=se.Description.displayName;const os=h.FormProvider,is=te.createContext({}),ls=()=>{const e=te.useContext(is),t=te.useContext(cs),{getFieldState:a,formState:r}=h.useFormContext(),s=a(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=t;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...s}},cs=te.createContext({}),ds=te.forwardRef(({className:e,...a},r)=>{const s=te.useId();return t.jsx(cs.Provider,{value:{id:s},children:t.jsx("div",{ref:r,className:jr("space-y-1.5",e),...a})})});ds.displayName="FormItem";const us=te.forwardRef(({className:e,...a},r)=>{const{error:s,formItemId:n}=ls();return t.jsx(Tr,{ref:r,className:jr(s&&"text-destructive",e),htmlFor:n,...a})});us.displayName="FormLabel";const ms=te.forwardRef(({...e},a)=>{const{error:s,formItemId:n,formDescriptionId:o,formMessageId:i}=ls();return t.jsx(r.Slot,{ref:a,id:n,"aria-describedby":s?`${o} ${i}`:`${o}`,"aria-invalid":!!s,...e})});ms.displayName="FormControl";const ps=te.forwardRef(({className:e,...a},r)=>{const{formDescriptionId:s}=ls();return t.jsx("p",{ref:r,id:s,className:jr("text-sm text-muted-foreground",e),...a})});ps.displayName="FormDescription";const hs=te.forwardRef(({className:e,children:a,...r},s)=>{const{error:n,formMessageId:o}=ls(),i=n?String(n?.message):a;return i?t.jsx("p",{ref:s,id:o,className:jr("text-sm font-medium text-destructive",e),...r,children:i}):null});hs.displayName="FormMessage";const xs=te.createContext({showCheck:!1}),fs=({showCheck:e=!1,...a})=>t.jsx(xs.Provider,{value:{showCheck:e},children:t.jsx(ie.Root,{...a})}),gs=ie.Group,bs=ie.Value,vs=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ie.Trigger,{ref:s,className:jr("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...r,children:[a,t.jsx(ie.Icon,{asChild:!0,children:t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));vs.displayName=ie.Trigger.displayName;const ys=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollUpButton,{ref:r,className:jr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronUp,{className:"h-4 w-4"})}));ys.displayName=ie.ScrollUpButton.displayName;const ws=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollDownButton,{ref:r,className:jr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronDown,{className:"h-4 w-4"})}));ws.displayName=ie.ScrollDownButton.displayName;const js=te.forwardRef(({className:e,children:a,position:r="popper",container:s,collisionBoundary:n,...o},i)=>t.jsx(ie.Portal,{container:s,children:t.jsxs(ie.Content,{ref:i,className:jr("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,collisionBoundary:n,...o,children:[t.jsx(ys,{}),t.jsx(ie.Viewport,{className:jr("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),t.jsx(ws,{})]})}));js.displayName=ie.Content.displayName;const Ns=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Label,{ref:r,className:jr("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...a}));Ns.displayName=ie.Label.displayName;const _s=te.forwardRef(({className:e,children:a,...r},s)=>{const{showCheck:n}=te.useContext(xs);return t.jsxs(ie.Item,{ref:s,className:jr("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...r,children:[n&&t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ie.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),t.jsx(ie.ItemText,{children:a})]})});_s.displayName=ie.Item.displayName;const Cs=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Separator,{ref:r,className:jr("-mx-1 my-1 h-px bg-muted",e),...a}));Cs.displayName=ie.Separator.displayName;const ks=te.forwardRef(({className:e,...a},r)=>t.jsx(le.Root,{ref:r,className:jr("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:t.jsx(le.Indicator,{className:jr("flex items-center justify-center text-current"),children:t.jsx(c.Check,{className:"h-4 w-4"})})}));ks.displayName=le.Root.displayName;const Ss=te.forwardRef(({className:e,showCharCount:a,maxLength:r,onChange:s,...n},o)=>{const[i,l]=te.useState(0);te.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("textarea",{className:jr("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:r,onChange:e=>{l(e.target.value.length),s?.(e)},...n}),a&&r&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",r]})]})});Ss.displayName="Textarea";const As=s.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),Ts=te.forwardRef(({className:e,variant:a,...r},s)=>t.jsx("div",{ref:s,className:jr(As({variant:a}),e),...r}));Ts.displayName="Badge";const Ds={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Es({size:e="md",className:a}){return t.jsx(c.Loader2,{className:jr("animate-spin text-muted-foreground",Ds[e],a)})}function Ps({isLoading:e,children:a,className:r,type:s="spinner",size:n="md"}){return e?"overlay"===s?t.jsxs("div",{className:jr("relative",r),children:[a,t.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:t.jsx(Es,{size:n})})]}):"skeleton"===s?t.jsx("div",{className:jr("animate-pulse",r),children:t.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):t.jsx("div",{className:jr("flex items-center justify-center py-8",r),children:t.jsx(Es,{size:n})}):t.jsx(t.Fragment,{children:a})}const Ms=({...e})=>t.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:t.jsx(c.CircleCheckIcon,{className:"h-4 w-4"}),info:t.jsx(c.InfoIcon,{className:"h-4 w-4"}),warning:t.jsx(c.TriangleAlertIcon,{className:"h-4 w-4"}),error:t.jsx(c.OctagonXIcon,{className:"h-4 w-4"}),loading:t.jsx(c.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),Is=ce.Root,Rs=ce.Trigger,Ls=ce.Group,Fs=ce.Portal,zs=ce.Sub,Us=ce.RadioGroup,Os=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(ce.SubTrigger,{ref:n,className:jr("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Os.displayName=ce.SubTrigger.displayName;const Bs=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.SubContent,{ref:r,className:jr("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Bs.displayName=ce.SubContent.displayName;const qs=te.forwardRef(({className:e,sideOffset:a=4,...r},s)=>t.jsx(ce.Portal,{children:t.jsx(ce.Content,{ref:s,sideOffset:a,className:jr("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));qs.displayName=ce.Content.displayName;const Vs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Item,{ref:s,className:jr("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Vs.displayName=ce.Item.displayName;const $s=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(ce.CheckboxItem,{ref:n,className:jr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));$s.displayName=ce.CheckboxItem.displayName;const Ws=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ce.RadioItem,{ref:s,className:jr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Ws.displayName=ce.RadioItem.displayName;const Hs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Label,{ref:s,className:jr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Hs.displayName=ce.Label.displayName;const Gs=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.Separator,{ref:r,className:jr("-mx-1 my-1 h-px bg-muted",e),...a}));Gs.displayName=ce.Separator.displayName;const Ks=({className:e,...a})=>t.jsx("span",{className:jr("ml-auto text-xs tracking-widest opacity-60",e),...a});Ks.displayName="DropdownMenuShortcut";const Ys=({delayDuration:e=300,...a})=>t.jsx(de.Provider,{delayDuration:e,...a}),Qs=de.Root,Xs=de.Trigger,Js=te.forwardRef(({className:e,sideOffset:a=4,container:r,...s},n)=>t.jsx(de.Portal,{container:r,children:t.jsx(de.Content,{ref:n,sideOffset:a,className:jr("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Js.displayName=de.Content.displayName;const Zs=te.forwardRef(({children:e,disabledReason:a,className:r},s)=>{const n=t.jsx(Vs,{ref:s,className:jr("opacity-50 cursor-not-allowed pointer-events-auto",r),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return a?t.jsx(Ys,{delayDuration:100,children:t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("div",{className:"w-full",children:n})}),t.jsx(Js,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:a})]})}):n});Zs.displayName="DisabledMenuItem";const en=ue.Root,tn=ue.Trigger,an=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,container:s,...n},o)=>t.jsx(ue.Portal,{container:s,children:t.jsx(ue.Content,{ref:o,align:a,sideOffset:r,className:jr("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));an.displayName=ue.Content.displayName;const rn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a}));rn.displayName="Command";const sn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:t.jsx("input",{ref:r,className:jr("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...a})}));sn.displayName="CommandInput";const nn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a}));nn.displayName="CommandList";const on=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("py-6 text-center text-sm text-muted-foreground",e),...a}));on.displayName="CommandEmpty";const ln=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a}));ln.displayName="CommandGroup";const cn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("-mx-1 h-px bg-border",e),...a}));cn.displayName="CommandSeparator";const dn=te.forwardRef(({className:e,disabled:a,onSelect:r,value:s,...n},o)=>t.jsx("div",{ref:o,className:jr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":a,onClick:()=>!a&&r?.(s||""),...n}));dn.displayName="CommandItem";const un=({className:e,...a})=>t.jsx("span",{className:jr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});function mn({className:e,...a}){return t.jsx("div",{className:jr("animate-pulse rounded-md bg-muted",e),...a})}un.displayName="CommandShortcut";const pn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function hn({multiple:r,options:s,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f,required:g,className:b,sortOptions:v,maxDisplayedBadges:y,popoverContainer:w,onOpen:j,onClose:N,clearable:_,showCheck:C}){const[k,S]=a.useState(!1),[A,T]=a.useState(""),D=a.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),E=a.useMemo(()=>{if(!w)return;let e=w,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[w]),P=a.useMemo(()=>{const e=s.map(e=>({original:e,value:i(e),label:l(e)}));return v?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[s,i,l,v]),M=a.useMemo(()=>{if(!A)return P;const e=pn(A);return P.filter(t=>pn(t.label).includes(e))},[P,A]),I=a.useMemo(()=>P.filter(e=>D.includes(e.value)),[P,D]),R=e=>{S(e),e?j?.():(T(""),N?.())},L=(e,t)=>{t.preventDefault(),t.stopPropagation(),o&&o(r?D.filter(t=>t!==e):"")},F=y?I.slice(0,y):I,z=y&&I.length>y?I.length-y:0;return t.jsxs("div",{className:jr("space-y-2",b),children:[m&&t.jsxs(Tr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(en,{open:k,onOpenChange:R,modal:!1,children:[r?t.jsx(tn,{asChild:!0,children:t.jsxs("div",{role:"combobox","aria-expanded":k,"aria-disabled":f,tabIndex:f?-1:0,onKeyDown:e=>{f||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R(!k))},className:jr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",f&&"pointer-events-none opacity-50 cursor-not-allowed",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex items-center gap-2",children:[p&&t.jsx(p,{className:"h-4 w-4"}),u]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[F.map(e=>t.jsxs(Ts,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&L(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>L(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),z>0&&t.jsxs(Ts,{variant:"outline",className:"gap-1",children:["+",z]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t.jsxs("div",{className:"relative",children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",role:"combobox","aria-expanded":k,disabled:f,className:jr("relative w-full justify-start min-h-10 h-auto pr-10",_&&I.length>0&&"pr-16",0===I.length&&"text-muted-foreground"),children:[0===I.length?t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:u})]}):t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:I[0]?.label})]}),t.jsx(c.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),_&&I.length>0&&t.jsx("button",{type:"button",disabled:f,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>L("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(an,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:E,collisionBoundary:E,children:t.jsxs(rn,{children:[t.jsxs("div",{className:"relative",children:[t.jsx(sn,{placeholder:x,value:A,onChange:e=>T(e.target.value)}),A&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(nn,{children:0===s.length?t.jsx(on,{children:h}):0===M.length?t.jsx(on,{children:e.t("no_results")}):t.jsx(ln,{children:M.map(e=>{const a=D.includes(e.value);return t.jsxs(dn,{value:e.value,onSelect:()=>(e=>{if(o)if(r){const t=D.includes(e)?D.filter(t=>t!==e):[...D,e];o(t)}else o(e),S(!1)})(e.value),className:jr("cursor-pointer",a&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[C&&t.jsx(c.Check,{className:jr("mr-2 h-4 w-4",a?"opacity-100":"opacity-0")}),d?d(e.original):e.label]},e.value)})})})]})})]})]})}function xn({multiple:e=!1,options:a,items:r,value:s,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f=!1,required:g=!1,isLoading:b=!1,error:v,className:w,sortOptions:j=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:T}=y.useTranslation(),D=a||r||[],E=o||n,P=u||T("select_placeholder","Selecione..."),M=h||T("no_results",T("no_results")),I=x||T("search_placeholder","Pesquisar...");if(b)return t.jsxs("div",{className:jr("space-y-2",w),children:[m&&t.jsxs(Tr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(mn,{className:"h-10 w-full"})]});const R="string"==typeof v?v:v instanceof Error?v.message:v?T("error_loading",T("error_loading")):void 0;return R?t.jsxs("div",{className:jr("space-y-2",w),children:[m&&t.jsxs(Tr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:R})]})]}):t.jsx(hn,{multiple:e,options:D,value:s||(e?[]:""),onChange:E,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:P,label:m,icon:p,emptyMessage:M,searchPlaceholder:I,disabled:f,required:g,className:w,sortOptions:j,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const fn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function gn(e,t){if(!t)return null;const a=fn(t),r=[];for(const s of e){const e=fn(s.label).includes(a),n=s.children?gn(s.children,t):null,o=n&&n.length>0;(e||o)&&r.push({...s,children:e?s.children:o?n:s.children})}return r}function bn(e,t){for(const a of e){if(a.value===t)return a.label;if(a.children){const e=bn(a.children,t);if(e)return e}}}function vn({node:e,level:a,expanded:r,onToggleExpand:s,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,d=n.includes(e.value),u=8+20*a;return t.jsxs("div",{role:"treeitem","aria-expanded":l?r:void 0,"aria-selected":d,className:jr("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(d?2:0)+"px"},children:[t.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:t=>{t.stopPropagation(),o(e.value)},children:[i&&t.jsx(c.Check,{className:jr("h-4 w-4 shrink-0",d?"opacity-100":"opacity-0")}),(()=>{const a=d?e.iconSelected??(r?e.iconOpen:null)??e.icon:r?e.iconOpen??e.icon:e.icon;return a?t.jsx(a,{className:jr("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),t.jsx("span",{className:"truncate",children:e.label})]}),l&&t.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:t=>{t.stopPropagation(),s(e.value)},tabIndex:-1,"aria-label":r?"Recolher":"Expandir",children:r?t.jsx(c.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function yn({nodes:e,level:r,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return t.jsx(t.Fragment,{children:e.map(e=>{const c=s.has(e.value);return t.jsxs(a.Fragment,{children:[t.jsx(vn,{node:e,level:r,expanded:c,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),c&&e.children&&e.children.length>0&&t.jsx(yn,{nodes:e.children,level:r+1,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function wn({multiple:e=!1,options:r,value:s,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:d,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:b,onOpen:v,onClose:w,defaultExpanded:j=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),[S,A]=a.useState(""),[T,D]=a.useState(()=>j?function(e){const t=new Set;return function e(a){for(const r of a)r.children&&r.children.length>0&&(t.add(r.value),e(r.children))}(e),t}(r):new Set),E=o||_("select_placeholder","Selecione..."),P=d||_("no_results",_("no_results")),M=u||_("search_placeholder","Pesquisar..."),I=a.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),R=a.useMemo(()=>{if(!b)return;let e=b,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[b]),L=a.useMemo(()=>gn(r,S),[r,S])??r,F=a.useMemo(()=>S?function(e,t){const a=new Set,r=fn(t);function s(e){if(!e.children||0===e.children.length)return fn(e.label).includes(r);let t=!1;for(const a of e.children)s(a)&&(t=!0);return t&&a.add(e.value),t||fn(e.label).includes(r)}for(const n of e)s(n);return a}(r,S):new Set,[r,S]),z=S?F:T,U=a.useCallback(e=>{S||D(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[S]),O=a.useMemo(()=>I.map(e=>({value:e,label:bn(r,e)||e})),[I,r]),B=e=>{k(e),e?v?.():(A(""),w?.())},q=a.useCallback(t=>{if(n)if(e){const e=I.includes(t)?I.filter(e=>e!==t):[...I,t];n(e)}else n(t),k(!1)},[n,e,I]),V=(t,a)=>{a.preventDefault(),a.stopPropagation(),n&&n(e?I.filter(e=>e!==t):"")},$=g?O.slice(0,g):O,W=g&&O.length>g?O.length-g:0;if(h)return t.jsxs("div",{className:jr("space-y-2",f),children:[i&&t.jsxs(Tr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(mn,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?t.jsxs("div",{className:jr("space-y-2",f),children:[i&&t.jsxs(Tr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:H})]})]}):t.jsxs("div",{className:jr("space-y-2",f),children:[i&&t.jsxs(Tr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(en,{open:C,onOpenChange:B,modal:!1,children:[t.jsx(tn,{asChild:!0,children:e?t.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(!C))},className:jr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),E]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[$.map(e=>t.jsxs(Ts,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&V(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>V(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&t.jsxs(Ts,{variant:"outline",className:"gap-1",children:["+",W]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t.jsxs(Cr,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:jr("w-full justify-between min-h-10 h-auto font-normal",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),E]}):t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),O[0]?.label]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(an,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(c.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:M,value:S,onChange:e=>A(e.target.value)}),S&&t.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>A(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:t.jsx("div",{role:"tree",className:"p-1",children:0===L.length?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?P:_("no_search_results",_("no_results"))}):t.jsx(yn,{nodes:L,level:0,expandedIds:z,onToggleExpand:U,selectedValues:I,onSelect:q,showCheck:N})})})]})]})]})}const jn=void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:Z&&"SCRIPT"===Z.tagName.toUpperCase()&&Z.src||new URL("index.js",document.baseURI).href}&&!1,Nn=new Map;function _n(e,t=1/0){if(!jn)return 0;const a=(Nn.get(e)??0)+1;return Nn.set(e,a),a}function Cn(e){if(jn)try{performance.mark(`auth:${e}`)}catch{}}async function kn(e,t){if(!jn)return t();const a=performance.now();try{return await t()}finally{performance.now()}}function Sn(e){if(!jn)return;if(0===Nn.size)return;const t={};for(const[a,r]of Nn.entries())t[a]=r}let An=null;function Tn(e,t,a){if(!jn||!t)return;if(a&&"object"==typeof a)for(const r in a)/^co\d+$/.test(r)&&0}const Dn=()=>jn;var En=Object.defineProperty;const Pn=class e{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const a=(4-t.length%4)%4;return t+="=".repeat(a),t}static parseJwtPayload(t){if(Dn()){return _n(`parseJwtPayload:${t.length}:${t.slice(-8)}`,4),_n("parseJwtPayload:total"),function(e,t){if(!jn)return t();performance.now();try{return t()}finally{performance.now()}}(t.length,()=>e._parseJwtPayloadImpl(t))}return e._parseJwtPayloadImpl(t)}static _parseJwtPayloadImpl(e){try{const s=e.split(".");if(3!==s.length)return null;const n=s[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),t=atob(e),a=new Uint8Array(t.length);for(let s=0;s<t.length;s++)a[s]=t.charCodeAt(s);const r=new TextDecoder("utf-8").decode(a);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(n),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(a){try{const e=this.normalizeBase64Url(n),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(s){return null}}static validateTokens(e,t){const a=[],r=[];try{t.split(".")[1],e.split(".")[1];const s=this.parseJwtPayload(t),n=this.parseJwtPayload(e);if(!s){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";a.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";a.push(e),o=!1}if(s.exp&&s.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:a,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:a,errors:r}}catch(s){const e=`Erro na validação de tokens: ${s}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}};((e,t,a)=>{t in e?En(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(Pn,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let Mn=Pn;const In="qualiex_access_token",Rn="qualiex_id_token",Ln="supabase_token",Fn="oauth_state",zn="oauth_nonce",Un="selected_alias",On="manual_logout",Bn="supabase_project_id",qn={setAccessToken:e=>localStorage.setItem(In,e),getAccessToken:()=>localStorage.getItem(In),setIdToken:e=>localStorage.setItem(Rn,e),getIdToken:()=>localStorage.getItem(Rn),getSupabaseToken:()=>localStorage.getItem(Ln),setOAuthState:e=>sessionStorage.setItem(Fn,e),getOAuthState:()=>sessionStorage.getItem(Fn),clearOAuthState:()=>sessionStorage.removeItem(Fn),setOAuthNonce:e=>sessionStorage.setItem(zn,e),getOAuthNonce:()=>sessionStorage.getItem(zn),clearOAuthNonce:()=>sessionStorage.removeItem(zn),setSelectedAlias:e=>localStorage.setItem(Un,e),getSelectedAlias:()=>localStorage.getItem(Un),clearSelectedAlias:()=>localStorage.removeItem(Un),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!qn.getAccessToken()||!qn.getIdToken()),checkProjectMismatch:()=>{const e=Me().supabaseProjectId;if(!e)return!1;const t=localStorage.getItem(Bn);return t&&t!==e?(qn.clearAll(),localStorage.setItem(Bn,e),!0):(t||localStorage.setItem(Bn,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Ln,e),qn._clearValidationCache()},areAllTokensValid:()=>{const e=qn.getAccessToken(),t=qn.getIdToken();if(!e||!t)return!1;try{const a=Mn.validateTokens(e,t);return!!a.idTokenValid&&a.idTokenValid}catch(a){return!1}},clearExpiredTokens:()=>{let e=!1;const t=qn.getAccessToken(),a=qn.getIdToken(),r=qn.getSupabaseToken();return t&&qn.isTokenExpired(t)&&(localStorage.removeItem(In),e=!0),a&&qn.isTokenExpired(a)&&(localStorage.removeItem(Rn),e=!0),r&&qn.isTokenExpired(r)&&(localStorage.removeItem(Ln),e=!0),e},clearAll:()=>{localStorage.removeItem(In),localStorage.removeItem(Rn),localStorage.removeItem(Ln),localStorage.removeItem(Un),sessionStorage.removeItem(Fn),sessionStorage.removeItem(zn),qn._clearValidationCache()},setManualLogout:()=>localStorage.setItem(On,"true"),isManualLogout:()=>"true"===localStorage.getItem(On),clearManualLogout:()=>localStorage.removeItem(On),isTokenExpired:e=>{try{return Mn.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{qn._validationCache.isValid=!1,qn._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=qn.getSupabaseToken();if(!e)return!1;if(qn.isTokenExpired(e))return qn._clearValidationCache(),qn._handleExpiredToken(),!1;const t=Date.now();return t-qn._validationCache.timestamp<qn._validationCache.cacheValidityMs?qn._validationCache.isValid:(qn._validationCache.isValid=!0,qn._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>qn.isSupabaseTokenValid()?qn.getSupabaseToken():null,_handleExpiredToken:()=>{qn.clearAll()},extractTokenData:()=>{if(_n("TokenManager.extractTokenData"),!qn.isSupabaseTokenValid())return null;const e=qn.getSupabaseToken();if(!e)return null;try{const t=Mn.parseJwtPayload(e);if(!t)return null;const a=t.alias||t.default||t.user_alias,r=t.place_id||null,s=t.place_name||null;let n=t.company_id;if(!n&&a)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===a){n=e[7];break}}}return{alias:a,companyId:n,placeId:r,placeName:s,payload:t}}catch(t){return qn._handleExpiredToken(),null}},getCompanyId:e=>{_n("TokenManager.getCompanyId");const t=qn.getAccessToken();if(t)try{const a=Mn.parseJwtPayload(t);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}const a=qn.extractTokenData();if(a?.companyId)return a.companyId;const r=qn.getIdToken();if(r)try{const t=Mn.parseJwtPayload(r);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}return null},getAppGroupId:(e,t)=>{_n("TokenManager.getAppGroupId");const a=qn.getAccessToken();if(!a)return null;try{const r=Mn.parseJwtPayload(a);if(!r)return null;for(const a in r)if(a.startsWith("co")&&/^co\d+$/.test(a)){const s=r[a];if(s&&"string"==typeof s){const a=s.split(";");if(e&&a.length>5&&a[0]===e){if(t?.includes(a[5]))continue;const e=Number(a[5]);return Number.isNaN(e)?null:e}if(!e&&a.length>5){if(t?.includes(a[5]))continue;const e=Number(a[5]);return Number.isNaN(e)?null:e}}}}catch{}return null},getCompanyIdInt:e=>{_n("TokenManager.getCompanyIdInt");const t=[qn.getAccessToken(),qn.getIdToken()];for(const a of t)if(a)try{const t=Mn.parseJwtPayload(a);if(!t)continue;for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>1&&t[0]===e)return t[1];if(!e&&t.length>1)return t[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=qn.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{_n("TokenManager.getAllCompaniesData");const e=qn.getIdToken();if(!e)return[];try{const t=Mn.parseJwtPayload(e);if(!t)return[];const a=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&a.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return a}catch{return[]}}};var Vn=Object.defineProperty,$n=(e,t,a)=>((e,t,a)=>t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);const Wn=new class{constructor(){$n(this,"errors",[]),$n(this,"toastCount",0),$n(this,"lastToastTime",0)}handleError(e,t=!0){const a="string"==typeof e?e:e.message,r=wr(a);if(this.errors.push({id:gr("short"),message:a,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),t&&this.shouldShowToast()){const e=this.getErrorTitle(r);l.toast.error(e,{description:r})}}getErrorTitle(t){const a=t.toLowerCase();return a.includes("401")||a.includes("unauthorized")||a.includes("expirou")?e.t("error_session_expired"):a.includes("token")||a.includes("autenticação")?e.t("error_authentication"):a.includes("api")||a.includes("network")?e.t("error_connection"):"Erro"}success(e,t){l.toast.success(e,{description:t})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function Hn(e){return!!e&&e.startsWith("eyJ")}let Gn=!1;var Kn=Object.defineProperty,Yn=(e,t,a)=>((e,t,a)=>t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);function Qn(){if(Ie()){const e=Me();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}const e=(void 0).VITE_SUPABASE_URL,t=(void 0).VITE_SUPABASE_PK_OVERRIDE||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&t?{url:e,key:t}:null}const Xn=class e{constructor(e){Yn(this,"client"),Yn(this,"currentToken",null),Yn(this,"config"),this.config=e,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,t=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;Gn?Hn(t):e&&Hn(t)?Gn=!0:Hn(t)?Gn=!0:Gn=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:this.config.key};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return w.createClient(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>{const a="string"==typeof e?e:e.url;if(a.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(a.includes("apikey="))try{const e=new URL(a,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=a.startsWith("http")?e.toString():e.pathname+e.search+e.hash,s={...t,headers:{...t?.headers,apikey:this.config.key}};return fetch(r,s)}}catch{}return fetch(e,t)}}})}static getInstance(){if(!e.instance){const t=Qn();if(!t)throw new Error("[forlogic-core] Supabase não configurado. Defina VITE_SUPABASE_URL e VITE_SUPABASE_PUBLISHABLE_KEY no .env, ou não invoque getSupabaseClient() (use isSupabaseConfigured() para checar antes).");e.instance=new e(t)}return e.instance}getClient(){const e=qn.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Mn.isTokenExpired(e)}catch(t){return Wn.handleError(t instanceof Error?t:"Supabase - Error validating token",!1),!1}}};Yn(Xn,"instance");let Jn=Xn;function Zn(){return Jn.getInstance().getClient()}class eo{static async generateToken(e,t,a,r=!1){try{if(!r){const e=qn.getSupabaseToken();if(e&&qn.isSupabaseTokenValid())return e}const s=Zn();_n("SupabaseTokenService.generateToken:invoke");const{data:n,error:o}=await kn(0,()=>s.functions.invoke("validate-token",{body:{access_token:e,alias:t}}));return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(a?.(),null):n?.access_token?(qn.setSupabaseToken(n.access_token),n.access_token):null}catch(s){return s instanceof Error&&(s.message.includes("401")||s.message.includes("Unauthorized"))&&a?.(),null}}}var to=Object.defineProperty,ao=(e,t,a)=>((e,t,a)=>t in e?to(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);class ro{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const t=qn.getAccessToken(),a=qn.getSelectedAlias();if(!t||!a)return null;const r=await eo.generateToken(t,a,this.onLogoutCallback||void 0,e);return r||null}catch(t){return null}}}ao(ro,"regenerationPromise",null),ao(ro,"onLogoutCallback",null);class so{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(qn.clearAll(),window.location.href=Ue("/login"),!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const a=t.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>a.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var no=Object.defineProperty;class oo{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,a=e.message||e.toString();if(401===t||a.includes("401")||a.includes("Unauthorized")){this.isRetrying=!0;try{return await ro.attemptRegeneration()?(this.isRetrying=!1,!0):(so.handleError(e),this.isRetrying=!1,!1)}catch(r){return so.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=qn.getAccessToken();return e?qn.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,a)=>{((e,t,a)=>{t in e?no(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,t+"",a)})(oo,"isRetrying",!1);const io=new class{get baseUrl(){return Ge()}async makeApiCall(e,t,a,r){const s=oo.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const n=qn.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!a||""===a.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":a}});if(!i.ok){const e=new Error(`API call failed: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}return await i.json()}async fetchHasCommonV5(e,t){const a=await this.makeApiCall(`/api/common/v1/companies/hasCommonV5/${encodeURIComponent(t)}`,{},e),r=a?.data??a,s=Array.isArray(r)?r[0]:r;return Boolean(s?.hasCommonV5)}mapToQualiexUser(e){let t;return t="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:t}}parseUsersResponse(e,t=""){let a=e;if(e.data)a=e.data;else{if(!Array.isArray(e))return Wn.handleError(`[QualiexApi] Formato de resposta inesperado${t}`,!1),null;a=e}return Array.isArray(a)?a.map(e=>this.mapToQualiexUser(e)):(Wn.handleError(`[QualiexApi] Resposta não é um array${t}`,!1),null)}async fetchUsers(e,t,a="active"){const r={companyId:t,search:"",filterStatus:a};try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t)??[]}catch(s){if(await oo.handleApiError(s))try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t," após retry")??[]}catch(n){return Wn.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return Wn.handleError(s instanceof Error?s.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,t,a){try{return(await this.fetchUsers(t,a)).find(t=>t.userId===e)||null}catch(r){return Wn.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const a=await this.fetchUsers(e,t,"active"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async fetchAllUsersMap(e,t){const a=await this.fetchUsers(e,t,"all"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async getUsers(e,t="active"){const a=qn.extractTokenData();return a&&a.companyId?this.fetchUsers(e,a.companyId,t):[]}async fetchSoftwares(e){try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):(Wn.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(t){if(await oo.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(a){return Wn.handleError(a instanceof Error?a:"Erro ao buscar softwares após renovação de token",!0),[]}return Wn.handleError(t instanceof Error?t.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,t,a){const r=!!a?.baseUrl,s=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,n=r?a.baseUrl:void 0,o=e=>e.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1}));try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):(Wn.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(i){if(await oo.handleApiError(i))try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):[]}catch(l){return Wn.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return Wn.handleError(i instanceof Error?i.message:"Erro ao buscar associações do usuário",!0),[]}}};function lo(e,t){const a=t||Xe.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function co(e,t){const a=t||Xe.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function uo(e,t){const a=t||Xe.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function mo(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||lo(e.idField),emailField:e.emailField||co(e.idField),usernameField:e.usernameField||uo(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:lo(e),emailField:co(e),usernameField:uo(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const po=new Map;class ho{static async fetchQualiexUsers(e,t){const a=`${t}_${e}_all`,r=po.get(a);if(r&&Date.now()-r.timestamp<3e5)return r.users;let s=await io.fetchUsers(e,t,"all");return 0===s.length&&(s=await io.fetchUsers(e,t,"active")),po.set(a,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const a=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&a.add(t)}return a}static indexUsers(e){const t=new Map;for(const a of e)a.id&&t.set(a.id,a),a.userId&&t.set(a.userId,a);return t}static enrichEntity(e,t,a){const r={...e};for(const s of t){const t=e[s.idField];if(!t)continue;const n=a.get(t);if(n){if(s.nameField){r[s.nameField]||(r[s.nameField]=n.userName||null)}if(s.emailField){r[s.emailField]||(r[s.emailField]=n.userEmail||null)}if(s.usernameField){r[s.usernameField]||(r[s.usernameField]=n.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{if(!qn.areAllTokensValid())return e;const a=qn.extractTokenData();if(!a)return e;const{alias:r,companyId:s}=a;if(!r||!s)return e;const n=mo(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(r,s),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(a){return Wn.handleError(a instanceof Error?a:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}}const xo=["responsible_name"],fo=e=>xo.includes(e);function go(e,t,a){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:a||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:s,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,d=()=>{if(!qn.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return Zn().schema(i).from(s)},u=(e,t,a,r)=>{let s=d().select(o||"*",{count:"exact"});s=s.eq("is_removed",!1),Object.entries(r).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?s=s.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?s=s.not(e,"is",null):"is_null"===t.operator&&(s=s.is(e,null)):null!==t&&(s=s.eq(e,t)))}),s=((e,t)=>{if(t&&n.length>0){const a=n.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(a)}return e})(s,e);const i=t.includes(".");return i||fo(t)||(s=s.order(t,{ascending:"asc"===a})),{query:s,isForeignKey:i}},m=async(e,t,a,s,n)=>{const o=mo(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===t||e.emailField===t||e.usernameField===t),i=t.includes(".");if(fo(t)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const c=await ho.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let d;d=i?c.sort((e,r)=>{const s=t.split(".").reduce((e,t)=>e?.[t],e)||"",n=t.split(".").reduce((e,t)=>e?.[t],r)||"",o=String(s).localeCompare(String(n),"pt-BR");return"asc"===a?o:-o}):((e,t,a)=>[...e].sort((e,r)=>{const s=e[t]||"",n=r[t]||"",o=s.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===a?o:-o}))(c,t,a);const u=((e,t=1,a=25)=>{const r=(t-1)*a,s=r+a;return{data:e.slice(r,s),pagination:{currentPage:t,totalPages:Math.ceil(e.length/a),totalItems:e.length,itemsPerPage:a,hasNextPage:s<e.length,hasPreviousPage:t>1}}})(d,s,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await ho.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:t,sortField:a,sortDirection:n,page:o,limit:i,additionalFilters:d}=(e=>{const{search:t="",sortField:a="updated_at",sortDirection:r="desc",page:s=1,limit:n=25,...o}=e;return{search:t,sortField:a,sortDirection:r,page:s,limit:n,additionalFilters:o}})(e),{query:p}=u(t,a,n,d),h=((e,t,a)=>{const r=(t-1)*a,s=r+a-1;return e.range(r,s)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${s}: ${f.message}`);let b=((e,t,a,r)=>{const s=Math.ceil((t||0)/r);return{data:e,currentPage:a,totalPages:s,totalItems:t||0,itemsPerPage:r,hasNextPage:a<s,hasPreviousPage:a>1}})(x||[],g,o,i);if((e=>{if(!c||!l||0===e.length)return!1;const t=mo(r.userIdFields,r.userFieldsMapping);return e.some(e=>t.some(t=>e[t.idField]))})(b.data)){const e=await m(b.data,a,n,o,i);if(!Array.isArray(e))return e;b={...b,data:e}}return b},async getById(e){const{data:t,error:a}=await d().select(o||"*").eq("id",e).maybeSingle();if(a)throw new Error(`Error fetching ${s}: ${a.message}`);return t},async create(e){const t=Nr(e),a=Object.entries(t).reduce((e,[t,a])=>(void 0!==a&&(e[t]=a),e),{}),{data:r,error:n}=await d().insert(a).select().single();if(n)throw new Error(`Error creating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from create ${s} operation`);return r},async update(e,t){const a={...Nr(t),updated_at:(new Date).toISOString()},{data:r,error:n}=await d().update(a).eq("id",e).select().single();if(n)throw new Error(`Error updating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from update ${s} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:a}=await d().update(t).eq("id",e);if(a)throw new Error(`Error soft deleting ${s}: ${a.message}`)}};return p}const bo={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},vo=class{static async initialize(){try{const e=Fe();if(e){if(qn.checkProjectMismatch())return{...bo}}if(!qn.hasAllTokens()||!qn.areAllTokensValid())return qn.clearExpiredTokens(),{...bo};const t=qn.getAccessToken(),a=qn.getIdToken();qn.clearManualLogout();const r=this.extractUserFromIdToken(a,t),s=this.extractCompaniesFromIdToken(a),n=e?qn.extractTokenData():null,o=this.resolveAliasFromContext(s,t,n?.alias??null);if(e&&(!qn.isSupabaseTokenValid()&&o&&await ro.attemptRegeneration(),!qn.isSupabaseTokenValid()))return{...bo};let i=null;if(o){const e=qn.getCompanyId(o),t=s.find(e=>e.alias===o);t&&(i={id:e||t.id,name:t.name,alias:t.alias,appGroupId:qn.getAppGroupId(t.alias)})}const l=n?.placeId??null,c=n?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:o,companies:s,selectedUnit:i,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:c,activePlaceId:l,activePlaceName:c}}catch(e){return{...bo}}}static async loginDev(){if(!Fe())return this.loginProd(),!0;try{const e=Zn(),{data:t,error:a}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(a)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL(Ue("/callback"));return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";qn.setOAuthState(e);const t=qn.generateOAuthNonce();qn.setOAuthNonce(t);const a=Ue("/callback"),r=new URL(ze.oauth.authUrl);r.searchParams.set("client_id",ze.oauth.clientId),r.searchParams.set("response_type",ze.oauth.responseType),r.searchParams.set("scope",ze.oauth.scope),r.searchParams.set("redirect_uri",a),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),window.location.href=r.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),a=a=>e.get(a)||t.get(a),r=a("access_token"),s=a("id_token"),n=a("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(r&&s){const e=qn.getAccessToken();e!==r&&qn.clearAll()}const o=Fe();if(qn.hasAllTokens()){if(o){qn.getValidSupabaseToken()||await ro.attemptRegeneration(!0)}return!0}const i=r,l=s;if(!i||!l)throw new Error("Tokens não encontrados na URL de callback");qn.setAccessToken(i),qn.setIdToken(l),qn.clearManualLogout();const c=this.extractCompaniesFromIdToken(l),d=this.resolveAliasFromContext(c,i,null);if(!d)throw new Error("Nenhuma empresa encontrada nos tokens");if(qn.setSelectedAlias(d),o){if(!await ro.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return qn.clearOAuthState(),qn.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){qn.clearAll(),qn.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}try{const e=Ue("/callback"),t=new URL(ze.oauth.logoutUrl);return t.searchParams.set("client_id",ze.oauth.clientId),t.searchParams.set("redirect_uri",e),t.searchParams.set("response_type",ze.oauth.responseType),t.searchParams.set("scope",ze.oauth.scope),t.searchParams.set("state","Lw=="),void(window.location.href=t.toString())}catch{}window.location.href=Ue("/login")}static decodeToken(e){return Mn.parseJwtPayload(e)}static extractUserFromIdToken(e,t){const a=this.decodeToken(e);if(!a)return null;const r=t?this.decodeToken(t):null;return{id:a.subNewId,email:a.email,name:a.name,identifier:a.identifier,isSysAdmin:"1"===r?.admin}}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const a=[];Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)a.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,s]=t[e].split("|");r&&s&&a.push({id:"",alias:r.trim(),name:s.trim()})}}});const r=new Map;for(const n of a){if(!n.alias)continue;const e=r.get(n.alias);(!e||!e.id&&n.id)&&r.set(n.alias,n)}const s=Array.from(r.values());a.length,s.length;return s.length,s}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const t=e.split(".");if(t.length<3)return null;const a=t[0];return"www"===a||"admin"===a?null:t.length>=4?t[1]:a}static resolveAliasFromContext(e,t,a){const r=t=>!!t&&e.some(e=>e.alias===t),s=this.getSubdomainAlias();if(r(s))return s;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(a))return a;const n=qn.getSelectedAlias();if(r(n))return n;const o=this.extractAliasFromAccessToken(t);return r(o)?o:e[0]?.alias||null}};ro.setLogoutCallback(()=>{vo.logout()});let yo=vo;const wo=e=>e?.placeId||null,jo=e=>e?.placeName||null,No=a.createContext(void 0),_o=({children:e})=>{const[r,s]=a.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=j.useQueryClient()}catch{}const[o,i]=a.useState(!1),l=a.useRef(0),c=a.useCallback(e=>{s(t=>({...t,...e}))},[]),d=a.useCallback(e=>{s(t=>({...t,isLoading:e}))},[]),u=a.useCallback(()=>{s({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=a.useCallback(async e=>{if(e.alias===r.alias)return;const t=++l.current;try{const s=qn.getAccessToken();if(!s)return;const o=qn.getSupabaseToken(),i=r.alias,d=Fe();let u=null;if(d){const a=await eo.generateToken(s,e.alias,void 0,!0);if(l.current!==t)return;if(!a)return;qn.setSupabaseToken(a),u=qn.extractTokenData()}qn.setSelectedAlias(e.alias);const m=u?.alias||e.alias,p=u?.companyId||qn.getCompanyId(e.alias);if(p)try{const e=await io.fetchHasCommonV5(m,p);if(l.current!==t)return;if(!e){const e=Qe();if(e){o&&qn.setSupabaseToken(o),i&&qn.setSelectedAlias(i);const t=e.endsWith("/")?e:`${e}/`;return void(window.location.href=`${t}${m}`)}}}catch(a){}const h={id:p||e.id,name:e.name,alias:m,appGroupId:qn.getAppGroupId(m)};let x=null,f=null;if(r.user?.id&&m&&p)try{const e=await io.fetchActiveUsersMap(m,p);if(l.current!==t)return;const a=e.get(r.user.id);if(a){const e=(e=>({placeId:wo(e),placeName:jo(e)}))(a);x=e.placeId,f=e.placeName}}catch(a){}if(l.current!==t)return;c({alias:m,selectedUnit:h,placeId:x,placeName:f,activePlaceId:x,activePlaceName:f}),n&&await n.clear()}catch(a){}},[c,n,r.user,r.alias]),p=a.useCallback(async()=>{_n("AuthContext.processCallback");const e=await kn(0,()=>yo.processCallback());if(e){const e=await kn(0,()=>yo.initialize());e&&e.isAuthenticated&&(c({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[c,n]),h=a.useCallback(async()=>{await yo.logout(),u(),n&&await n.clear()},[u,n]),x=a.useCallback(e=>{i(e)},[]),f=a.useCallback(()=>{},[]),g=a.useCallback(()=>{n&&n.invalidateQueries()},[n]);a.useEffect(()=>{if(!r.isAuthenticated)return;let e=!0;const t=setInterval(async()=>{if(e)if(qn.areAllTokensValid()){if(Fe()&&!qn.isSupabaseTokenValid())try{await ro.attemptRegeneration()||e&&h()}catch(t){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(t)}},[r.isAuthenticated,h]),a.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await yo.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&d(!1)}catch(t){e&&(so.handleError(t),d(!1))}})(),()=>{e=!1}},[c,d,h]);const b=a.useMemo(()=>({...r,logout:h,processCallback:p,switchUnit:m,availableUnits:r.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[r.user,r.companies,r.alias,r.isAuthenticated,r.isLoading,r.selectedUnit,r.userId,r.userAlias,r.placeId,r.placeName,r.activePlaceId,r.activePlaceName,h,p,m,o,x,f,g]);return t.jsx(No.Provider,{value:b,children:e})},Co=()=>{const e=a.useContext(No);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function ko({queryKey:e,service:t,entityName:r,searchFields:s,additionalFilters:n={},onSuccess:o}){const[i,c]=N.useSearchParams(),d=j.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=Co(),{t:h}=y.useTranslation(),x=a.useCallback(t=>{const a=`${e}_${t}`,r=i.get(a);return r||(i.get(t)||"")},[i,e]),f=x("search"),g=x("sortField")||qe.sorting.defaultField,b=x("sortDirection")||qe.sorting.defaultDirection,v=parseInt(x("page")||"1"),w=parseInt(x("limit")||String(qe.pagination.defaultPageSize)),_=f,C=a.useMemo(()=>({search:_,sortField:g,sortDirection:b,page:v,limit:w,...n}),[_,g,b,v,w,n]),k=a.useCallback(()=>t.getAll(C),[t,C]),S=j.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const A=j.useMutation({mutationFn:t.create,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Ze.success.created(r)),o?.()},onError:e=>{l.toast.error(`${Ze.error.create(r)}: ${e.message}`)}}),T=j.useMutation({mutationFn:({id:e,data:a})=>t.update(e,a),onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Ze.success.updated(r)),o?.()},onError:e=>{l.toast.error(`${Ze.error.update(r)}: ${e.message}`)}}),D=j.useMutation({mutationFn:t.delete,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(Ze.success.deleted(r))},onError:e=>{l.toast.error(`${Ze.error.delete(r)}: ${e.message}`)}}),E=a.useCallback(t=>{const a={...Object.fromEntries(i)};Object.entries(t).forEach(([t,r])=>{const s=`${e}_${t}`;""===r||0===r?delete a[s]:a[s]=String(r)}),delete a.sortField,delete a.sortDirection,c(a)},[i,c,e]),P=a.useCallback(e=>{E({search:e,page:1})},[E]),M=a.useCallback(e=>{E({sortField:e,sortDirection:g===e&&"asc"===b?"desc":"asc",page:1})},[g,b,E]),I=a.useCallback(e=>{E({page:e})},[E]),R=a.useCallback(e=>{E({limit:e,page:1})},[E]),L=a.useCallback(()=>{const t=Object.fromEntries(i),a=`${e}_`,r=Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith(a)));c(r)},[c,i,e]),[F,z]=a.useState([]),U=a.useCallback(e=>{z(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),O=a.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(t=>t.length===e.length?[]:e)},[S?.data?.data]),B=a.useCallback(()=>{z([])},[]),q=a.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,S?.data?.data]),V=j.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>t.delete(e)))},onSuccess:(t,a)=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${a.length} ${r}(s) deletado(s) com sucesso`)),B()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),$=a.useCallback((e,t)=>{const a=t?t(e):e;e.id?T.mutate({id:e.id,data:a}):A.mutate({...a,alias:u})},[u,A,T]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||qe.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:T?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:b,currentPage:v,itemsPerPage:w,queryKey:e,createEntity:A.mutate,updateEntity:(e,t)=>T.mutate({id:e,data:t}),deleteEntity:D.mutate,save:$,handleSearch:P,handleSort:M,handlePageChange:I,handleItemsPerPageChange:R,clearFilters:L,refetch:S.refetch,selectedIds:F,selectItem:U,selectAll:O,clearSelection:B,isAllSelected:q,bulkDelete:e=>V.mutateAsync(e),isBulkDeleting:V.isPending}}function So(e){const[t,r]=a.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return a.useEffect(()=>{const t=window.matchMedia(e);r(t.matches);const a=e=>{r(e.matches)};return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),t}function Ao(e=768){return So(`(max-width: ${e-1}px)`)}const To=te.forwardRef(({className:e,...a},r)=>t.jsx("table",{ref:r,className:jr("w-full caption-bottom text-[13px] table-fixed",e),...a}));To.displayName="Table";const Do=te.forwardRef(({className:e,...a},r)=>t.jsx("thead",{ref:r,className:jr("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...a}));Do.displayName="TableHeader";const Eo=te.forwardRef(({className:e,...a},r)=>t.jsx("tbody",{ref:r,className:jr("[&_tr:last-child]:border-0",e),...a}));Eo.displayName="TableBody";const Po=te.forwardRef(({className:e,...a},r)=>t.jsx("tfoot",{ref:r,className:jr("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));Po.displayName="TableFooter";const Mo=te.forwardRef(({className:e,...a},r)=>t.jsx("tr",{ref:r,className:jr("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...a}));Mo.displayName="TableRow";const Io=te.forwardRef(({className:e,...a},r)=>t.jsx("th",{ref:r,className:jr("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...a}));Io.displayName="TableHead";const Ro=te.forwardRef(({className:e,...a},r)=>t.jsx("td",{ref:r,className:jr("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...a}));Ro.displayName="TableCell";const Lo=te.forwardRef(({className:e,...a},r)=>t.jsx("caption",{ref:r,className:jr("mt-4 text-sm text-muted-foreground",e),...a}));function Fo({rows:e=5,columns:a=4}){return t.jsx("div",{className:"w-full",children:t.jsxs("div",{className:"rounded-md border",children:[t.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(mn,{className:"h-4 w-24"},a))})}),t.jsx("div",{children:Array.from({length:e}).map((e,r)=>t.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(mn,{className:"h-4 w-20"},a))})},r))})]})})}function zo({count:e=3}){return t.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,a)=>t.jsxs(Dr,{children:[t.jsxs(Er,{children:[t.jsx(mn,{className:"h-4 w-3/4"}),t.jsx(mn,{className:"h-3 w-1/2"})]}),t.jsx(Ir,{children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(mn,{className:"h-3 w-full"}),t.jsx(mn,{className:"h-3 w-2/3"})]})})]},a))})}Lo.displayName="TableCaption";const Uo={default:c.FileX,search:c.Search,error:c.AlertCircle};function Oo({icon:e,title:a,description:r,action:s,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,c=Uo[o];return t.jsxs("div",{className:jr("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[t.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:t.jsx(c,{className:"h-8 w-8 text-muted-foreground"})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:a}),r&&t.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),s&&t.jsx(Cr,{onClick:s.onClick,variant:"outline",children:s.label})]})}function Bo({children:e,className:a}){const r=te.useRef(null),[s,n]=te.useState(!1);te.useEffect(()=>{const e=()=>{const e=r.current;e&&n(e.scrollWidth>e.clientWidth)};e();const t=new ResizeObserver(e);return r.current&&t.observe(r.current),()=>t.disconnect()},[e]);const o=t.jsx("div",{ref:r,className:`truncate w-full max-w-full ${a||""}`,children:e});return s?t.jsx(Ys,{delayDuration:300,children:t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:o}),t.jsx(Js,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const qo=te.forwardRef(({direction:e,onMouseDown:a,isDragging:r,className:s},n)=>{const o="horizontal"===e;return t.jsx("div",{ref:n,onMouseDown:a,className:jr("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],r&&"bg-primary/30",s),children:t.jsx("div",{className:jr("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});qo.displayName="TableResizeHandle";const Vo=me.Root,$o=me.Trigger,Wo=me.Group,Ho=me.Portal,Go=me.Sub,Ko=me.RadioGroup,Yo=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(me.SubTrigger,{ref:n,className:jr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Yo.displayName=me.SubTrigger.displayName;const Qo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.SubContent,{ref:r,className:jr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Qo.displayName=me.SubContent.displayName;const Xo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Portal,{children:t.jsx(me.Content,{ref:r,className:jr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Xo.displayName=me.Content.displayName;const Jo=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Item,{ref:s,className:jr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Jo.displayName=me.Item.displayName;const Zo=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(me.CheckboxItem,{ref:n,className:jr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Zo.displayName=me.CheckboxItem.displayName;const ei=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(me.RadioItem,{ref:s,className:jr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));ei.displayName=me.RadioItem.displayName;const ti=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Label,{ref:s,className:jr("px-2 py-1.5 text-sm font-semibold text-foreground",a&&"pl-8",e),...r}));ti.displayName=me.Label.displayName;const ai=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Separator,{ref:r,className:jr("-mx-1 my-1 h-px bg-border",e),...a}));ai.displayName=me.Separator.displayName;const ri=({className:e,...a})=>t.jsx("span",{className:jr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});ri.displayName="ContextMenuShortcut";const si=({onEdit:e,onDelete:a,onToggleStatus:r,isActive:s=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),d=[];if(e){const t={icon:c.Edit,label:l("edit"),onClick:e};d.push(t)}if(o.forEach(e=>{d.push(e)}),r){const e={icon:s?c.PowerOff:c.Power,label:s?"Inativar":"Ativar",onClick:r};d.push(e)}if(n&&a){const e={icon:c.Trash2,label:l("ap_delete"),onClick:a,destructive:!0};d.push(e)}const u="dropdown"===i?Vs:Jo;return t.jsx(t.Fragment,{children:d.map((e,a)=>t.jsxs(u,{onClick:e.onClick,className:jr("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[t.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},a))})},ni=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsx(Cr,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:t.jsx(c.EllipsisVertical,{size:12})})}),t.jsx(qs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:t.jsx(si,{onEdit:e?t=>{t?.stopPropagation(),e?.()}:void 0,onDelete:a?e=>{e?.stopPropagation(),a?.()}:void 0,onToggleStatus:s?e=>{e?.stopPropagation(),s?.()}:void 0,isActive:n,canDelete:r&&!!a,customActions:o,renderAs:"dropdown"})})]}),oi=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return t.jsx(Ys,{delayDuration:200,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e()},children:t.jsx(c.Pencil,{size:14})})}),t.jsx(Js,{children:i("edit")})]}),o.map((e,a)=>{const r=e.icon;return t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e.onClick()},children:t.jsx(r,{size:14})})}),t.jsx(Js,{children:e.label})]},a)}),s&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),s()},children:n?t.jsx(c.ToggleRight,{size:14}):t.jsx(c.ToggleLeft,{size:14})})}),t.jsx(Js,{children:n?"Inativar":"Ativar"})]}),a&&r&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:jr("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),a()},children:t.jsx(c.Trash2,{size:14})})}),t.jsx(Js,{children:i("ap_delete")})]})]})})},ii=150;function li({columns:e,storageKey:t,onResize:r,enabled:s=!0}){const[n,o]=a.useState(()=>{if(!s||"undefined"==typeof window)return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??ii,e),{});if(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??ii,e),{})}),[i,l]=a.useState(!1),[c,d]=a.useState(null),u=a.useRef(0),m=a.useRef(0),p=a.useCallback((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),l(!0),d(e),u.current=t.clientX,m.current=n[e]??ii)},[s,n]);a.useEffect(()=>{if(!i||!c)return;const a=e.find(e=>e.key===c),s=a?.minWidth??60,n=a?.maxWidth??500,p=e=>{const t=e.clientX-u.current,a=Math.max(s,Math.min(n,m.current+t));o(e=>{const t={...e,[c]:a};return r?.(t),t})},h=()=>{l(!1),d(null),t&&o(e=>(localStorage.setItem(t,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,c,e,t,r]),a.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=a.useCallback(()=>{const a=e.reduce((e,t)=>(e[t.key]=t.defaultWidth??ii,e),{});o(a),t&&localStorage.removeItem(t),r?.(a)},[e,t,r]);return{columnWidths:n,isDragging:i,activeColumn:c,handleMouseDown:p,resetWidths:h}}const ci=s.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),di=te.forwardRef(({className:e,variant:a,size:r,...s},n)=>t.jsx(he.Root,{ref:n,className:jr(ci({variant:a,size:r,className:e})),...s}));di.displayName=he.Root.displayName;const ui=te.createContext({size:"default",variant:"default"}),mi=te.forwardRef(({className:e,variant:a,size:r,children:s,...n},o)=>t.jsx(pe.Root,{ref:o,className:jr("flex items-center justify-center gap-1",e),...n,children:t.jsx(ui.Provider,{value:{variant:a,size:r},children:s})}));mi.displayName=pe.Root.displayName;const pi=te.forwardRef(({className:e,children:a,variant:r,size:s,...n},o)=>{const i=te.useContext(ui);return t.jsx(pe.Item,{ref:o,className:jr(ci({variant:i.variant||r,size:i.size||s}),e),...n,children:a})});pi.displayName=pe.Item.displayName;const hi=a.memo(function({onNew:e,newButtonLabel:a,showNewButton:r=!0,showSearch:s=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:d=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:b=!1,availableViewModes:v=["table","list","grid"],rightSlot:w,className:j}){const{t:N}=y.useTranslation(),_=d>0,C=e&&r||h.length>0,k=x||b||w,S=s&&o;return C||S||k||l&&_?t.jsxs("div",{className:jr("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",j),children:[t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&r&&t.jsxs(Cr,{onClick:e,children:[t.jsx(c.Plus,{size:16,className:"mr-2"}),a||"Novo"]}),h.map((e,a)=>{const r=e.icon;return t.jsxs(Cr,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[r&&t.jsx(r,{size:16,className:"mr-2"}),e.label]},a)})]}),l&&_&&t.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[t.jsx(Ts,{variant:"secondary",className:"mr-1 tabular-nums",children:d}),t.jsxs(Ys,{delayDuration:200,children:[u.length>0?u.map((e,a)=>{const r=e.icon,s=e.disabled;return t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:jr("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:s,onClick:()=>e.action([]),children:r?t.jsx(r,{size:16}):t.jsx("span",{className:"text-xs",children:e.label[0]})})}),t.jsx(Js,{children:e.label})]},a)}):t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:t.jsx(c.Trash2,{size:16})})}),t.jsx(Js,{children:N("ap_delete")})]}),t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:t.jsx(c.X,{size:16})})}),t.jsx(Js,{children:N("clear_selection")})]})]})]}),S&&t.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t.jsxs("div",{className:"relative w-full",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Sr,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,b&&f&&g&&t.jsx(mi,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:v.map(e=>{const a=(e=>{switch(e){case"table":return c.Table2;case"list":return c.List;case"grid":return c.LayoutGrid}})(e);return t.jsx(pi,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:t.jsx(a,{className:"h-4 w-4"})},e)})}),w]})]}):null}),xi=a.memo(({checked:e,onCheckedChange:a})=>t.jsx(ks,{checked:e,onCheckedChange:a}),(e,t)=>e.checked===t.checked);function fi(e){try{const t=localStorage.getItem(e);if(!t)return null;const a=JSON.parse(t);let r=a.groupByColumns||[];return 0===r.length&&a.groupByColumn&&(r=[a.groupByColumn]),{hiddenColumns:new Set(a.hiddenColumns||[]),columnOrder:a.columnOrder||[],groupByColumns:r}}catch{return null}}function gi({columns:e,storageKey:t,enabled:r=!0,defaultHiddenColumns:s}){const n=a.useMemo(()=>e.map(e=>String(e.key)),[e]),o=a.useMemo(()=>new Set(s??[]),[s]),[i,l]=a.useState(()=>{if(!r)return o;if(!t)return o;const e=fi(t);return e?.hiddenColumns??o}),[c,d]=a.useState(()=>{if(!r||!t)return n;const e=fi(t)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=a.useState(()=>r&&t?fi(t)?.groupByColumns??[]:[]),[p,h]=a.useState(new Set);a.useEffect(()=>{r&&t&&function(e,t){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(t.hiddenColumns),columnOrder:t.columnOrder,groupByColumns:t.groupByColumns}))}catch{}}(t,{hiddenColumns:i,columnOrder:c,groupByColumns:u})},[i,c,u,t,r]),a.useEffect(()=>{const t=new Set(e.map(e=>String(e.key))),a=new Set(c),r=[...t].filter(e=>!a.has(e));r.length>0&&d(e=>[...e.filter(e=>t.has(e)),...r])},[e]);const x=a.useCallback(e=>i.has(e),[i]),f=a.useCallback(e=>{l(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),g=a.useCallback(()=>{l(new Set)},[]),b=a.useCallback(()=>{if(l(o),d(n),m([]),h(new Set),t)try{localStorage.removeItem(t)}catch{}},[n,o,t]),v=a.useCallback((e,t)=>{d(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r})},[]),y=a.useCallback(e=>{h(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),w=a.useCallback(e=>{m(e),h(new Set)},[]),j=a.useCallback(e=>{m(t=>t.includes(e)?t:[...t,e])},[]),N=a.useCallback(e=>{m(t=>t.filter(t=>t!==e)),h(t=>{const a=new Set;for(const r of t)r.includes(`${e}:`)||a.add(r);return a})},[]),_=a.useCallback((e,t)=>{m(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r}),h(new Set)},[]),C=u[0]??null,k=a.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=a.useMemo(()=>{if(!r)return e;const t=new Map(e.map(e=>[String(e.key),e]));return c.filter(e=>!i.has(e)&&t.has(e)).map(e=>t.get(e))},[e,c,i,r]),A=a.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(t,a,r,s){if(0===a.length)return[{groupKey:s||"__leaf__",groupValue:"",items:t,count:t.length,level:r}];const[n,...o]=a,i=new Map;for(const l of t){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([t,a])=>{const i=s?`${s}|${n}:${t}`:`${n}:${t}`,l=o.length>0?e(a,o,r+1,i):void 0;return{groupKey:i,groupValue:t,items:a,count:a.length,level:r,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:b,columnOrder:c,reorderColumns:v,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:w,addGroupByColumn:j,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:A,collapsedGroups:p,toggleGroupCollapse:y}}function bi({enabled:e=!1,onReorder:t}){const[r,s]=a.useState(null),[n,o]=a.useState(null),i=a.useCallback(()=>{s(null),o(null)},[]),l=a.useCallback((a,n)=>({draggable:e,onDragStart:t=>{e&&(s(a),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",String(a)),n&&t.dataTransfer.setData("application/column-key",n))},onDragOver:t=>{e&&null!==r&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},onDragEnter:t=>{e&&null!==r&&(t.preventDefault(),o(a))},onDrop:s=>{s.preventDefault(),e&&null!==r&&r!==a?(t(r,a),i()):i()},onDragEnd:()=>{i()}}),[e,r,t,i]);return a.useMemo(()=>({dragFromIndex:r,dragOverIndex:n,isDragging:null!==r,getDragProps:l}),[r,n,l])}function vi({columns:e,columnOrder:r,isColumnHidden:s,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:d,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=a.useState(null),[b,v]=a.useState(null),w=a.useRef(null),j=new Map(e.map(e=>[String(e.key),e])),N=r.filter(e=>j.has(e)).map(e=>j.get(e)),_=()=>{w.current=null,g(null),v(null)};N.some(e=>s(String(e.key)));const C=N.every(e=>!s(String(e.key)));return t.jsxs(en,{children:[t.jsx(tn,{asChild:!0,children:t.jsx(Cr,{variant:"outline",size:"icon",className:"h-8 w-8",children:t.jsx(c.Columns3,{size:16})})}),t.jsxs(an,{className:"w-[260px] p-0",align:"end",children:[t.jsx("div",{className:"px-3 py-2 border-b",children:t.jsx("span",{className:"text-sm font-medium",children:x("columns")})}),t.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:t.jsx(Ys,{delayDuration:300,children:N.map((e,a)=>{const r=String(e.key),o=s(r),h=!1!==e.hideable,y=!0===e.groupable,j=u.includes(r)||l===r;return t.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,g(e)})(a),onDragOver:e=>((e,t)=>{e.preventDefault(),v(t)})(e,a),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&i(w.current,e),w.current=null,g(null),v(null)})(a),onDragEnd:_,className:jr("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===a&&"opacity-50",b===a&&"border-t-2 border-primary"),children:[t.jsx(c.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx(ks,{checked:!o,onCheckedChange:()=>h&&n(r),disabled:!h,className:"shrink-0"}),t.jsx("span",{className:jr("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:jr("h-6 w-6 shrink-0",j&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),j?p?p(r):d?.(null):m?m(r):d?.(r)},children:t.jsx(c.Group,{size:14})})}),t.jsx(Js,{children:x(j?"remove_grouping":"group_by_column")})]})]},r)})})}),t.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[t.jsx(Cr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&t.jsx(Cr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:x("reset_default")})]})]})]})}function yi({columns:e,groupByColumns:r,addGroupByColumn:s,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=a.useState(!1),[d,u]=a.useState(null),[m,p]=a.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=r.length>0;return t.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const t=e.dataTransfer.getData("application/column-key");if(t&&!r.includes(t)){const e=h.get(t);e&&e.groupable&&s(t)}},className:jr("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[t.jsx(c.Group,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?r.map((e,r)=>{const s=h.get(e);if(!s)return null;const i=d===r,l=m===r&&d!==r;return t.jsxs(a.Fragment,{children:[r>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),t.jsxs(Ts,{variant:"secondary",className:jr("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,t)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(t)),e.dataTransfer.effectAllowed="move",u(t)})(e,r),onDragOver:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),p(t)})(e,r),onDrop:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const a=e.dataTransfer.getData("application/group-chip-index");if(""!==a){const e=parseInt(a,10);isNaN(e)||e===t||o(e,t)}u(null),p(null)})(e,r),onDragEnd:x,children:[s.header,t.jsx("button",{onClick:t=>{t.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:t.jsx(c.X,{size:12})})]})]},e)}):t.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const wi=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:b,showActionBar:v=!0,showSearch:w=!1,searchValue:j,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D=!1,enableColumnResize:E=!0,resizeStorageKey:P,enableColumnManager:M=!0,columnManagerStorageKey:I,defaultHiddenColumns:R,enableGrouping:L=!1,enableExpandableRows:F=!1,renderExpandedContent:z,expandedRowIds:U,onToggleExpand:O,defaultExpandAll:B=!1,hideActionsColumn:q=!1,readOnly:V=!1})=>{const{t:$}=y.useTranslation(),{setSearchVisible:W}=Co(),H=Ao(),[G,K]=a.useState(()=>B&&F?new Set(r.entities.map(e=>e.id)):new Set),Y=void 0!==U,Q=Y?new Set(U):G,X=a.useCallback(e=>{Y&&O?O(e):K(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[Y,O]),J=void 0!==b?!b:v;a.useEffect(()=>{if(!w)return W(!0),()=>W(!1)},[W,w]);const Z=gi({columns:s,storageKey:I,enabled:M,defaultHiddenColumns:R}),ee=bi({enabled:M,onReorder:Z.reorderColumns}),te=M?Z.visibleColumns:s,{columnWidths:ae,isDragging:re,activeColumn:se,handleMouseDown:ne}=li({columns:te.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:P?`${P}-columns`:void 0,enabled:E}),oe=a.useMemo(()=>(()=>{if(E){const e=te.map(e=>ae[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return te.map((a,r)=>({...a,calculatedWidth:e[r],style:{width:e[r]/t*100+"%"}}))}let e=0;const t=te.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const a=t.minWidth||120,r=t.weight||1;return e+=a,{...t,calculatedWidth:a,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[te,E,ae]),ie=h||g.length>0||w||m||S||D||M,le=J&&ie,ce=q||V,de=k||(()=>{r.bulkDelete?.(r.selectedIds)}),ue=e=>t.jsx(Ro,{className:"text-center",children:d?d(e):"inline"===p?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:t.jsx(oi,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),me=e=>t.jsx(Xo,{className:"w-[160px]",children:t.jsx(si,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),pe=M?t.jsx(vi,{columns:s,columnOrder:Z.columnOrder,isColumnHidden:Z.isColumnHidden,toggleColumn:Z.toggleColumn,showAllColumns:Z.showAllColumns,resetColumns:Z.resetColumns,reorderColumns:Z.reorderColumns,groupByColumn:L?Z.groupByColumn:void 0,setGroupByColumn:L?Z.setGroupByColumn:void 0,groupByColumns:L?Z.groupByColumns:void 0,addGroupByColumn:L?Z.addGroupByColumn:void 0,removeGroupByColumn:L?Z.removeGroupByColumn:void 0}):void 0;if(H)return r.isLoading?t.jsx(zo,{count:3}):0===r.entities.length?t.jsx(Oo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t.jsxs("div",{className:"flex flex-col h-full",children:[le&&t.jsx(hi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:de,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),t.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>{const a=t.jsx(Dr,{className:jr("overflow-hidden cursor-pointer hover:bg-muted/50",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:t.jsx(Ir,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[m&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(xi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1",children:[te.map(a=>t.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||d)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):t.jsx(ni,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})},e.id);return V?a:t.jsxs(Vo,{children:[t.jsx($o,{asChild:!0,children:a}),me(e)]},e.id)})})]});const he=L&&Z.groupByColumns.length>0?Z.getGroupedData(r.entities):null,xe=null!==he,fe=(F?1:0)+(m?1:0)+te.length+(ce?0:1),ge=e=>{const s=F&&Q.has(e.id),o=t.jsxs(Mo,{className:jr("cursor-pointer hover:bg-muted/50 relative",("inline"===p||ce)&&"group",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:[F&&t.jsx(Ro,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),X(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":$(s?"collapse_row":"expand_row"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&t.jsx(Ro,{onClick:e=>e.stopPropagation(),children:t.jsx(xi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),te.map(a=>t.jsx(Ro,{className:a.className,children:t.jsx(Bo,{children:a.render?a.render(e):String(e[a.key]??"")})},String(a.key))),!ce&&ue(e)]});return t.jsxs(a.Fragment,{children:[V?o:t.jsxs(Vo,{children:[t.jsx($o,{asChild:!0,children:o}),me(e)]}),s&&z&&t.jsx(Mo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Ro,{colSpan:fe,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},be=(e,r)=>e.map(e=>{const s=Z.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return t.jsxs(a.Fragment,{children:[t.jsx(Mo,{className:jr("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>Z.toggleGroupCollapse(e.groupKey),children:t.jsx(Ro,{colSpan:r,className:"py-2 px-4",children:t.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[s?t.jsx(c.ChevronRight,{size:16}):t.jsx(c.ChevronDown,{size:16}),t.jsx("span",{children:e.groupValue}),t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!s&&(e.children?be(e.children,r):e.items.map(ge))]},e.groupKey)});return t.jsxs("div",{className:"flex flex-col h-full",children:[le&&t.jsx(hi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:de,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),r.isLoading?t.jsx(Fo,{rows:5,columns:te.length}):t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L&&t.jsx(yi,{columns:s,groupByColumns:Z.groupByColumns,addGroupByColumn:Z.addGroupByColumn,removeGroupByColumn:Z.removeGroupByColumn,reorderGroupByColumns:Z.reorderGroupByColumns}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(To,{className:"table-fixed w-full",children:[t.jsxs("colgroup",{children:[F&&t.jsx("col",{style:{width:"40px"}}),m&&t.jsx("col",{style:{width:"50px"}}),oe.map((e,a)=>t.jsx("col",{style:e.style},a)),!ce&&t.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),t.jsx(Do,{children:t.jsxs(Mo,{children:[F&&t.jsx(Io,{className:"w-[40px]"}),m&&t.jsx(Io,{className:"w-[50px]",children:t.jsx(xi,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),te.map((e,a)=>{const s=E&&!1!==e.resizable,n=se===String(e.key),o=M?ee.getDragProps(a,String(e.key)):{},i=ee.dragFromIndex===a,l=ee.dragOverIndex===a&&ee.dragFromIndex!==a;return t.jsxs(Io,{className:jr(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",M&&ee.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...o,children:[t.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(d=String(e.key),r.sortField!==d?null:"asc"===r.sortDirection?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}),s&&t.jsx(qo,{direction:"horizontal",onMouseDown:t=>ne(String(e.key),t),isDragging:n})]},String(e.key));var d}),!ce&&t.jsx(Io,{className:"w-[50px] text-center",children:pe||e.t("actions")})]})}),t.jsx(Eo,{children:0===r.entities.length?t.jsx(Mo,{children:t.jsx(Ro,{colSpan:fe,className:"h-32",children:t.jsx(Oo,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):xe?be(he,fe):r.entities.map(ge)})]})})]})]})};function ji(e,t,r,s){const[n,o]=a.useState({}),[i,l]=a.useState({}),c=a.useMemo(()=>e,[e]),d=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(a){return u(e)}},p=(e,t,a)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let s;if("function"==typeof e.validation?s=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(s=e.validation.custom),s)try{const e=s(t,a);if(e)return e}catch(r){}}};a.useEffect(()=>{if(!s)return;const e=t=>{const a=[];return t.forEach(t=>{a.push(t),t.fields&&a.push(...e(t.fields))}),a},a=e(c),n={};a.forEach(e=>{let a;if(t&&void 0!==t[e.name]){if(a=t[e.name],null==a&&(a=""),"date"===e.type&&a)if("string"==typeof a){const e=new Date(a);d(e)&&(a=e.toISOString().split("T")[0])}else d(a)&&(a=a.toISOString().split("T")[0])}else a=u(e);n[e.name]=a}),a.forEach(e=>{const t=m(e,n);void 0!==t&&(n[e.name]=t)}),t&&Object.keys(t).forEach(e=>{a.find(t=>t.name===e)||void 0===t[e]||(n[e]=t[e])}),o(n),l({}),r&&r(n)},[c,t,r,s]);const h=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...h(e.fields))}),t},x=()=>{const e=h(c),t={};return e.forEach(e=>{const a=p(e,n[e.name],n);a&&(t[e.name]=a)}),l(t),0===Object.keys(t).length};return{formData:n,errors:i,updateField:(e,t)=>{o(a=>{const s={...a,[e]:t},n=((e,t)=>{let a={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=m(e,a);void 0!==t&&(a={...a,[e.name]:t})}),a})(e,s);return r&&r(n),n}),i[e]&&l(t=>{const a={...t};return delete a[e],a});const a=h(c).find(t=>t.name===e);if(a){const r=p(a,t,n);r&&l(t=>({...t,[e]:r}))}},validateForm:x,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),x()&&e(n)}}}const Ni=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],_i=[10,22,35,45,55,68,78,87,94].flatMap(e=>Ni.map(({hue:t,saturation:a})=>((e,t,a)=>{a/=100;const r=t=>(t+e/30)%12,s=(t/=100)*Math.min(a,1-a),n=e=>{const t=a-s*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return Math.round(255*t).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(t,a,e))),Ci=({value:e="#3b82f6",onChange:r,label:s,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),d=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=a.useState(!1),h=a.useRef([]),x=Ni.length,f=a.useMemo(()=>{const t=_i.findIndex(t=>t.toLowerCase()===e.toLowerCase());return t>=0?t:0},[e]),[g,b]=a.useState(f);a.useEffect(()=>{m&&(b(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const v=e=>{const t=Math.max(0,Math.min(_i.length-1,e));b(t),h.current[t]?.focus()},w=e=>{r?.(e),p(!1)};return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Tr,{children:s}),t.jsxs(en,{open:m,onOpenChange:p,children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[t.jsxs("span",{className:"flex items-center min-w-0",children:[t.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&t.jsx("span",{className:"truncate",children:e})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),t.jsx(an,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(Tr,{children:u}),t.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${Ni.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),v(g+1);break;case"ArrowLeft":e.preventDefault(),v(g-1);break;case"ArrowDown":e.preventDefault(),v(g+x);break;case"ArrowUp":e.preventDefault(),v(g-x);break;case"Home":e.preventDefault(),v(0);break;case"End":e.preventDefault(),v(_i.length-1);break;case"Enter":e.preventDefault(),w(_i[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:_i.map((a,r)=>{const s=a.toLowerCase()===e.toLowerCase();return t.jsx("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(s?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:a},onClick:()=>w(a),"aria-label":`Selecionar cor ${a}`},`${a}-${r}`)})})]}),t.jsxs("div",{children:[t.jsx(Tr,{htmlFor:"color-input",children:d}),t.jsx(Sr,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},ki=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(xe.Root,{ref:s,className:jr("relative overflow-hidden",e),...r,children:[t.jsx(xe.Viewport,{className:"h-full w-full rounded-[inherit]",children:a}),t.jsx(Si,{}),t.jsx(xe.Corner,{})]}));ki.displayName=xe.Root.displayName;const Si=te.forwardRef(({className:e,orientation:a="vertical",...r},s)=>t.jsx(xe.ScrollAreaScrollbar,{ref:s,orientation:a,className:jr("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:t.jsx(xe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Si.displayName=xe.ScrollAreaScrollbar.displayName;const Ai=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function Ti({name:e,filled:a,className:r}){return t.jsx("span",{className:`material-symbols-outlined ${r??""}`,style:a?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Di=({value:e=null,onChange:r,label:s,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=a.useState(!1),d=a.useRef([]),u=e?(m=e,Ai.find(e=>e.name===m)):null;var m;const p=a.useMemo(()=>{if(!e)return 0;const t=Ai.findIndex(t=>t.name===e);return t>=0?t:0},[e]),[h,x]=a.useState(p);a.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{d.current[p]?.focus()}))},[i,p]);const f=a.useCallback(e=>{const t=Math.max(0,Math.min(Ai.length-1,e));x(t),d.current[t]?.focus()},[]),g=a.useCallback(e=>{r?.(e),l(!1)},[r]),b=a.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),v=a.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Ai.length-1);break;case"Enter":e.preventDefault(),g(Ai[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Tr,{children:s}),t.jsxs(en,{open:i,onOpenChange:l,children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:b,children:[u?t.jsx(Ti,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):t.jsx("span",{className:"text-muted-foreground text-sm",children:n}),t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),t.jsx(an,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{d.current[p]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(ki,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:t.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:v,role:"grid",children:Ai.map((a,r)=>t.jsx("button",{ref:e=>{d.current[r]=e},type:"button",tabIndex:r===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===a.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(a.name),title:a.name,children:t.jsx(Ti,{name:a.name,filled:a.filled,className:"text-2xl"})},a.name))})}),t.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Ei=te.forwardRef(({className:e,...a},r)=>t.jsx(fe.Root,{className:jr("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...a,ref:r,children:t.jsx(fe.Thumb,{className:jr("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ei.displayName=fe.Root.displayName;const Pi=(e={})=>{const{user:t,alias:a}=Co(),{enabled:r=!0,status:s="active"}=e;return j.useQuery({queryKey:["qualiex-users",a,s],queryFn:()=>io.getUsers(a,s),enabled:r&&!!a&&!!t,staleTime:3e5,retry:2,retryDelay:1e3})},Mi=({value:r,onChange:s,multiple:n=!1,label:o,required:i,placeholder:l,icon:c,maxDisplayedBadges:d,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:b,onOpen:v,onClose:w})=>{const{t:j}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Pi({enabled:p}),[k,S]=a.useState(new Map),A=a.useMemo(()=>r?Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean):[],[r]),T=a.useMemo(()=>{if(0===A.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return A.filter(t=>t&&!e.has(t)&&!k.has(t)).sort().join(",")},[A,N,k]);a.useEffect(()=>{if(!T)return;const e=T.split(",");let t=!1;const a=qn.extractTokenData();return a?.alias&&a?.companyId?(io.fetchUsers(a.alias,a.companyId,"all").then(a=>{t||S(t=>{const r=new Map(t);for(const s of e){const e=a.find(e=>e.userId===s||e.id===s);e&&r.set(s,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{t=!0}):void 0},[T]);const D=a.useMemo(()=>f?N.filter(f):N,[N,f]),E=a.useMemo(()=>{if(0===A.length)return D;const t=new Set(D.map(e=>e.userId||e.id||"")),a=A.filter(e=>e&&!t.has(e));if(0===a.length)return D;const r=a.map(t=>{const a=k.get(t);return a||{userId:t,id:t,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...D,...r]},[D,A,k]),P=a.useCallback(t=>{let a;if("custom"===h&&x)a=x(t);else{const e=t.userName||"";switch(h){case"name-email":a=t.userEmail?`${e} (${t.userEmail})`:e;break;case"name-role":a=t.roleName?`${e} - ${t.roleName}`:e;break;default:a=e}}return!1===t.isActive?`${a} (${e.t("inactive")})`:a},[h,x]);return t.jsx(xn,{multiple:n,value:r??(n?[]:""),onChange:s,options:E,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:P,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:j("no_results"),label:o,required:i,icon:c,maxDisplayedBadges:d,disabled:m,className:u,sortOptions:g,popoverContainer:b,onOpen:v,onClose:w})};function Ii({title:e,sections:r,initialData:s,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:c=!1,usersData:d}){const[u,m]=a.useState(r?.[0]?.id||""),p=a.useRef(null),[h,x]=a.useState(null),f=a.useCallback(e=>{p.current=e,x(e)},[]),g=a.useMemo(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:b,errors:v,updateField:y,handleSubmit:w}=ji(g,s,void 0,i),j=a.useMemo(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(b):e.disabled||!1})):[],[r,b]),N=a.useMemo(()=>{const e=j.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=j.find(e=>!e.disabled);return t?.id||u},[j,u]);a.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=j.find(e=>e.id===N),C=e=>{const a=(e.computedValue,b[e.name]),r=void 0!==a?a:"",s=v[e.name];switch(e.type){case"group":const a="horizontal"===e.layout,n=a?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=a?jr("space-y-2 w-full",e.wrapperClassName):jr("space-y-2",e.className,e.wrapperClassName);return t.jsxs("div",{className:o,children:[e.label,t.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Mi,{value:r||"",onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:s?"border-destructive":""}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"textarea":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ss,{id:e.name,value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(fs,{value:String(r),onValueChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[t.jsx(vs,{className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:t.jsx(bs,{placeholder:e.placeholder})}),t.jsx(js,{children:e.options?.map(e=>t.jsx(_s,{value:e.value,children:e.label},e.value))})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"multiselect":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(xn,{options:e.options||[],value:Array.isArray(r)?r:[],onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,error:s,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"date":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Sr,{id:e.name,type:"date",value:String(r),onChange:t=>y(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:jr("w-full",s?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"color":return t.jsxs("div",{children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Sr,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>y(e.name,t.target.value),className:"h-10"}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"color-picker":return t.jsxs("div",{children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ci,{value:r||e.defaultValue||"#3b82f6",onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"icon-picker":return t.jsxs("div",{children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Di,{value:r||e.defaultValue||null,onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(b):e.componentProps||{};return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(i,{value:r,onChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:s,popoverContainer:h,...l}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"number":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Sr,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const a=t.target.value,r=""===a?null:Number(a);y(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"checkbox":return t.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[t.jsx(ks,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),t.jsxs(Tr,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"switch":return t.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ei,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive mt-2",children:s})]},e.name);default:return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Tr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Sr,{id:e.name,type:"text",value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name)}},k=a.useCallback(()=>{if(!_)return null;if(_.disabled)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:t.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return t.jsx(e,{formData:b,updateField:y,errors:v,users:d,disabled:_.disabled})}return t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,b,y,v,d,C]),S=t.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[j.length>1&&t.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:t.jsx("div",{className:"flex space-x-2",children:j.map(e=>t.jsx(Cr,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=j.find(t=>t.id===e);t&&!t.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:c?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):t.jsxs("form",{onSubmit:w(n),className:"space-y-3 md:space-y-4",children:[k(),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(Cr,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(Cr,{type:"submit",disabled:c,children:l||"Salvar"})]})]})})]});return t.jsx(Kr,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:t.jsxs(es,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t.jsxs(ts,{showSeparator:!0,children:[t.jsx(ss,{children:e}),t.jsx(ns,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function Ri({currentPage:e,totalPages:a,totalItems:r,itemsPerPage:s,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===r)return null;const d=(e-1)*s+1,u=Math.min(e*s,r);return t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[t.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),t.jsxs(fs,{value:String(s),onValueChange:e=>o(Number(e)),children:[t.jsx(vs,{className:"h-8 w-[70px]",children:t.jsx(bs,{})}),t.jsxs(js,{children:[t.jsx(_s,{value:"10",children:"10"}),t.jsx(_s,{value:"25",children:"25"}),t.jsx(_s,{value:"50",children:"50"}),t.jsx(_s,{value:"100",children:"100"})]})]})]})}),t.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[d,"-",u," ",l("of","de")," ",r," ",l("items","itens")]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(Cr,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsLeft,{size:16})}),t.jsx(Cr,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronLeft,{size:16})}),t.jsxs("div",{className:"flex items-center gap-1 px-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e}),t.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),t.jsx("span",{className:"text-sm font-medium",children:a})]}),t.jsx(Cr,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronRight,{size:16})}),t.jsx(Cr,{variant:"outline",size:"sm",onClick:()=>n(a),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsRight,{size:16})})]})]})}function Li({manager:e}){return t.jsx(Ri,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const Fi={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},zi={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Ui={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Oi({children:e,direction:a="column",gap:r="md",align:s="stretch",justify:n="start",wrap:o=!1,className:i}){return t.jsx("div",{className:jr("flex","column"===a?"flex-col":"flex-row",Fi[r],zi[s],Ui[n],o&&"flex-wrap",i),children:e})}function Bi({manager:e,filters:a,inline:r=!1}){const{t:s}=y.useTranslation(),{isSearchVisible:n}=Co(),o=e.searchTerm,i=t.jsxs(t.Fragment,{children:[a.some(e=>"search"===e.type)&&!n&&t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(Sr,{placeholder:"Pesquisar",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),a.filter(e=>"select"===e.type&&e.options).map((e,a)=>t.jsxs(fs,{value:e.value||"",onValueChange:t=>e.onChange?.(t),children:[t.jsx(vs,{className:"w-[180px]",children:t.jsx(bs,{placeholder:e.placeholder})}),t.jsx(js,{children:e.options.map(e=>t.jsx(_s,{value:e.value,children:e.label},e.value))})]},`select-${a}`)),a.filter(e=>"custom"===e.type&&e.component).map((e,a)=>{const s=e.component;return t.jsx("div",{className:r?"":"w-full sm:w-auto",children:t.jsx(s,{...e.props})},`custom-${a}`)}),o&&t.jsxs(Cr,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[t.jsx(c.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return r?t.jsx("div",{className:"flex items-center gap-2",children:i}):t.jsx(Oi,{direction:"column",gap:"md",className:"mb-6",children:t.jsx(Oi,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function qi({manager:e,config:r,formSections:s,onSave:n,onToggleStatus:o,defaultSort:i,readOnly:l=!1}){e&&e.queryKey;const{setSearchVisible:c}=Co(),[d,u]=N.useSearchParams(),[m,p]=a.useState(!1),[h,x]=a.useState(null),[f,g]=a.useState({isOpen:!1,entityId:null,entityName:""}),[b,v]=a.useState({isOpen:!1,count:0});a.useEffect(()=>(c(!0),()=>{c(!1)}),[c]),a.useEffect(()=>{if(i&&e){const t=`${e.queryKey}_sortField`,a=`${e.queryKey}_sortDirection`;if(!d.has(t)&&!d.has(a)){const e=Object.fromEntries(d);e[t]=i.column,e[a]=i.direction,u(e)}}},[]);const y=!l&&s.length>0?e=>{r.onEdit?r.onEdit(e):(x(e),p(!0))}:void 0,w=l||"function"!=typeof e?.deleteEntity?void 0:e=>{g({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})},j=()=>{g({isOpen:!1,entityId:null,entityName:""})},_=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,C=(r.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return t.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&t.jsx(hi,{onNew:()=>{r.onNew?r.onNew():(x(null),p(!0))},newButtonLabel:r.newButtonLabel,showNewButton:_,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{v({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:C,filters:r.filters&&r.filters.length>0?t.jsx(Bi,{manager:e,filters:r.filters,inline:!0}):void 0}),t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?t.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):t.jsx(wi,{manager:e,columns:r.columns,onEdit:y,onDelete:w,onToggleStatus:o,enableBulkActions:r.enableBulkActions,customRowActions:r.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:r.defaultHiddenColumns,readOnly:l})}),t.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:t.jsx(Li,{manager:e})}),!r.useCustomRouting&&!r.onNew&&s.length>0&&t.jsx(Ii,{open:m,title:h?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:s,initialData:h||void 0,onSubmit:e=>{n(e),p(!1),x(null)},onCancel:()=>{p(!1),x(null)},isLoading:e.isLoading,submitButtonText:h?"Atualizar":"Criar"}),t.jsx(Kr,{open:f.isOpen,onOpenChange:j,children:t.jsxs(es,{size:"sm",variant:"destructive",children:[t.jsx(ts,{showSeparator:!0,children:t.jsx(ss,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:f.entityName}),". Esta ação não pode ser desfeita."]})}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"outline",onClick:j,children:"Cancelar"}),t.jsx(Cr,{variant:"destructive",onClick:()=>{f.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(f.entityId),g({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),t.jsx(Kr,{open:b.isOpen,onOpenChange:()=>v({isOpen:!1,count:0}),children:t.jsxs(es,{size:"sm",variant:"destructive",children:[t.jsx(ts,{showSeparator:!0,children:t.jsx(ss,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:b.count})," ",1===b.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"outline",onClick:()=>v({isOpen:!1,count:0}),children:"Cancelar"}),t.jsx(Cr,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),v({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Vi(e,t){const a=e.toLowerCase();return a.includes("email")?{type:"email",required:!0}:a.includes("phone")||a.includes("tel")?{type:"tel"}:a.includes("description")||a.includes("content")||a.includes("notes")?{type:"textarea"}:a.includes("status")||a.includes("type")||a.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function $i(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function Wi(e={}){const{paramName:t="alias"}=e,r=N.useParams(),{alias:s,companies:n}=Co(),o=r[t]||null;return a.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,t=!!e;return{urlAlias:o,isAliasMismatch:t&&o!==s,isValidAlias:t,isMissing:!1,matchedCompany:e}},[o,s,n])}const Hi=s.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),Gi={info:c.Info,warning:c.Info,danger:c.AlertTriangle,success:c.CheckCircle},Ki=te.forwardRef(({className:e,variant:a="info",showIcon:r=!0,children:s,...n},o)=>{const i=Gi[a||"info"];return t.jsxs("div",{ref:o,role:"alert",className:jr(Hi({variant:a}),e),...n,children:[r&&t.jsx(i,{className:"h-4 w-4"}),s]})});Ki.displayName="Alert";const Yi=te.forwardRef(({className:e,...a},r)=>t.jsx("h5",{ref:r,className:jr("mb-1 font-medium leading-none tracking-tight",e),...a}));Yi.displayName="AlertTitle";const Qi=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("text-sm [&_p]:leading-relaxed",e),...a}));Qi.displayName="AlertDescription";const Xi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Root,{ref:r,className:jr("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...a}));Xi.displayName=ge.Root.displayName;const Ji=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Image,{ref:r,className:jr("aspect-square h-full w-full",e),...a}));Ji.displayName=ge.Image.displayName;const Zi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Fallback,{ref:r,className:jr("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...a}));function el(){return Ge()||"https://common-v4-api.qualiex.com"}function tl(){const e=Ye();if(e)return e;const t=el().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://login-api${t[1]||""}.${t[2]}`}return"https://login-api.qualiex.com"}function al(e){const t=qn.getAccessToken();if(!t)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function rl(e,t,a){const r=async()=>{const r=await fetch(e,{...a,headers:{...al(t),...a?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(s){if(await oo.handleApiError(s))return await r();throw s}}async function sl(e){const t=qn.getAccessToken(),a=qn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const t=Mn.parseJwtPayload(e),a="string"==typeof t?.subNewId?t.subNewId.trim():"";if(!a)throw new Error("NewId do usuário não encontrado no id-token.");return a}(a),s=qn.getSelectedAlias()?.trim()||qn.extractTokenData()?.alias||"",n=`${tl()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,o=async()=>{const r=qn.getAccessToken()||t,o=qn.getIdToken()||a,i=qn.getAppGroupId(s)?.toString()??"1",l=new FormData;l.append(e.name,e,e.name);const c=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":o,Accept:"application/json, text/plain, */*",...s?{"un-alias":s}:{},AppGroupId:i},body:l});if(!c.ok){const e=new Error(`Upload falhou: ${c.status} ${c.statusText}`);throw e.status=c.status,e.statusCode=c.status,e}};try{await o()}catch(i){if(await oo.handleApiError(i))try{return void await o()}catch(l){throw Wn.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw i}}Zi.displayName=ge.Fallback.displayName;const nl={"en-US":1,"pt-BR":2,"es-ES":3,"fr-FR":4};function ol(e,t){const a=e?.trim();if(a)return a;const r=Mn.parseJwtPayload(t),s="string"==typeof r?.subNewId?r.subNewId.trim():"";if(s)return s;throw new Error("Identificador do usuário não encontrado.")}function il(e){const t=qn.getSelectedAlias()?.trim();if(t)return t;const a=qn.getSupabaseToken(),r=a?Mn.parseJwtPayload(a):null,s="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(s)return s;const n=Mn.parseJwtPayload(e),o="string"==typeof n?.default?n.default.trim():"string"==typeof n?.alias?n.alias.trim():"string"==typeof n?.user_alias?n.user_alias.trim():"";if(o)return o;for(const i in n||{}){if(!/^co\d+$/.test(i))continue;const e=n?.[i];if("string"!=typeof e)continue;const[t]=e.split(";");if(t?.trim())return t.trim()}}async function ll(e){const t=qn.getAccessToken(),a=qn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=ol(e.newId,a),s=il(a),n={};e.name&&e.name.trim()&&(n.Name=e.name.trim()),e.email&&e.email.trim()&&(n.Email=e.email.trim());const o=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e||4===e?e:null:nl[e]??null}(e.language);void 0!==o&&(n.LanguageId=o);const i=`${tl()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=qn.getAccessToken()||t,r=qn.getIdToken()||a,o=qn.getAppGroupId(s)?.toString()??"1",l=await fetch(i,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...s?{"un-alias":s}:{},AppGroupId:o,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const e=new Error(`Falha ao atualizar perfil: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await l()}catch(c){if(await oo.handleApiError(c))return void await l();throw c}}const cl={1:"en-US",2:"pt-BR",3:"es-ES",4:"fr-FR"};function dl(e,...t){for(const a of t){const t=e[a];if("string"==typeof t&&t.trim())return t}return null}async function ul(e){const t=qn.getAccessToken(),a=qn.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=ol(e,a),s=il(a),n=`${tl()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,o=async()=>{const e=qn.getAccessToken()||t,o=qn.getIdToken()||a,i=qn.getAppGroupId(s)?.toString()??"1",l=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":o,...s?{"un-alias":s}:{},AppGroupId:i,Accept:"application/json, text/plain, */*"}});if(404===l.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!l.ok){const e=new Error(`Falha ao obter perfil: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}const c=await l.json(),d=function(e,...t){for(const a of t){const t=e[a];if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t&&t.trim()&&!Number.isNaN(Number(t)))return Number(t)}return null}(c,"languageId","LanguageId"),u=1===d||2===d||3===d||4===d?d:null,m=dl(c,"photoUrl","PhotoUrl");let p=null;if(m)if(/^https?:\/\//i.test(m))p=m;else{const e=m.replace(/^\/+/,""),t=e.includes("?")?"&":"?";p=`${tl()}/api/${e}${t}size=96`}return{newId:r,name:dl(c,"name","Name"),email:dl(c,"email","Email"),languageId:u,language:u?cl[u]:null,photoUrl:p}};try{return await o()}catch(i){if(await oo.handleApiError(i))return await o();throw i}}const ml=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],pl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,hl=({open:e,onOpenChange:r,user:s,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:d}=y.useTranslation(),u=a.useRef(null),[m,p]=a.useState(null),[h,x]=a.useState(null),[f,g]=a.useState(d.language||"pt-BR"),[b,v]=a.useState(s.name||""),[w,j]=a.useState(s.email||""),[N,_]=a.useState(!1),[C,k]=a.useState(null);a.useEffect(()=>{if(!e)return;v(s.name||""),j(s.email||""),g(d.language||"pt-BR"),k(null);let t=!1;return(async()=>{try{const e=await ul(s.id||void 0);if(t)return;e.name&&v(e.name),e.email&&j(e.email),e.language&&g(e.language),k(e.photoUrl)}catch{}})(),()=>{t=!0}},[e,s.id,s.name,s.email,d.language]);const S=m||C||n,A=e=>{N||(e||(p(null),x(null),g(d.language||"pt-BR"),v(s.name||""),j(s.email||"")),r(e))};return t.jsx(Kr,{open:e,onOpenChange:A,children:t.jsxs(es,{className:"sm:max-w-md",children:[t.jsx(ts,{children:t.jsx(ss,{children:i("edit_profile","Editar Perfil")})}),t.jsxs(as,{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(Xi,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[S&&t.jsx(Ji,{src:S,alt:s.name||""}),t.jsx(Zi,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]}),t.jsxs("div",{children:[t.jsxs(Cr,{variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[t.jsx(c.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),t.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target.files?.[0];if(!t)return;const a=URL.createObjectURL(t);p(a),x(t)}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"profile-name",children:i("name","Nome")}),t.jsx(Sr,{id:"profile-name",value:b,onChange:e=>v(e.target.value),maxLength:150,autoComplete:"name"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"profile-email",children:i("email","E-mail")}),t.jsx(Sr,{id:"profile-email",type:"email",value:w,onChange:e=>j(e.target.value),maxLength:200,autoComplete:"email"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:i("language","Idioma")}),t.jsxs(fs,{value:f,onValueChange:g,children:[t.jsx(vs,{children:t.jsx(bs,{})}),t.jsx(js,{children:ml.map(e=>t.jsx(_s,{value:e.value,children:e.label},e.value))})]})]})]}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"outline",onClick:()=>A(!1),disabled:N,children:i("cancel","Cancelar")}),t.jsxs(Cr,{onClick:async()=>{if(b.trim())if(pl.test(w.trim())){_(!0);try{if(h)try{await sl(h),window.dispatchEvent(new Event("user-photo-updated")),l.toast.success("Foto atualizada com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error("Falha ao atualizar foto"+(t?`: ${t}`:""))}if(b.trim()!==(s.name||"")||w.trim()!==(s.email||"")||f!==d.language)try{await ll({newId:s.id||void 0,name:b.trim(),email:w.trim(),language:f}),l.toast.success("Perfil atualizado com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error(t||"Falha ao atualizar perfil")}f!==d.language&&d.changeLanguage(f),x(null),p(null),r(!1)}finally{_(!1)}}else l.toast.error("Informe um e-mail válido.");else l.toast.error("Informe o nome.")},disabled:N,children:[N&&t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),N?i("saving","Salvando..."):i("save","Salvar")]})]})]})})},xl=a.createContext(void 0);function fl({children:e,actions:r}){const{t:s}=y.useTranslation(),[n,o]=a.useState({}),[i,l]=a.useState(r);a.useEffect(()=>{l(r)},[r]);const c=a.useCallback(()=>o({}),[]),d=a.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:c,headerActions:i,setHeaderActions:l}),[n,c,i]);return t.jsx(xl.Provider,{value:d,children:e})}function gl(){const e=a.useContext(xl);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var bl={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",change_photo:"Trocar foto",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse:"Colapsar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",create:"Criar",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_name:"Editar Nome",edit_profile:"Editar Perfil",electronic_signature:"Assinatura Eletrônica",email:"E-mail",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand:"Expandir",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_direct_subordinates:"Subordinados diretos:",leadership_drag_hint:"Arraste as linhas para reorganizar • Selecione múltiplos para mover em lote",leadership_drag_to_hierarchy:"Arraste para a hierarquia acima",leadership_immediate_superior:"Superior Imediato",leadership_load_error:"Erro ao carregar hierarquia de liderança",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_direct_subordinates:"Sem subordinados diretos",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_confirmation:"Tem certeza que deseja remover este líder? Esta ação não pode ser desfeita.",leadership_remove_team:"Remover da equipe",leadership_search_superior:"Buscar superior...",leadership_select_subordinates:"Selecione pelo menos um liderado",leadership_unassociated_users:"Usuários não associados",leadership_users_associated:"{{count}} usuário associado",leadership_users_associated_count:"Usuários associados: {{count}}",leadership_users_associated_plural:"{{count}} usuários associados",leadership_users_unassociated_count:"Usuários não associados: {{count}}",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",loading:"Carregando...",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",none_bracketed:"[Nenhum]",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",removing:"Removendo...",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",reset_default:"Redefinir padrão",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",selected_count:"{{count}} selecionado",selected_count_plural:"{{count}} selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates:"Subordinados",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",update:"Atualizar",updates:"Atualizações",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_do_not_show_again:"Não exibir novamente",updates_dialog_like:"Curtir",updating:"Atualizando...",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},vl={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",cannot_be_own_leader:"A leader cannot be their own superior",change_photo:"Change photo",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse:"Collapse",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",create:"Create",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_name:"Edit Name",edit_profile:"Edit Profile",electronic_signature:"Electronic Signature",email:"Email",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand:"Expand",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_direct_subordinates:"Direct subordinates:",leadership_drag_hint:"Drag rows to reorganize • Select multiple to move in bulk",leadership_drag_to_hierarchy:"Drag to the hierarchy above",leadership_immediate_superior:"Immediate Superior",leadership_load_error:"Failed to load leadership hierarchy",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_direct_subordinates:"No direct subordinates",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_confirmation:"Are you sure you want to remove this leader? This action cannot be undone.",leadership_remove_team:"Remove from team",leadership_search_superior:"Search superior...",leadership_select_subordinates:"Select at least one subordinate",leadership_unassociated_users:"Unassociated users",leadership_users_associated:"{{count}} user associated",leadership_users_associated_count:"Associated users: {{count}}",leadership_users_associated_plural:"{{count}} users associated",leadership_users_unassociated_count:"Unassociated users: {{count}}",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",loading:"Loading...",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",none_bracketed:"[None]",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",removing:"Removing...",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",reset_default:"Reset to default",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",selected_count:"{{count}} selected",selected_count_plural:"{{count}} selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates:"Subordinates",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",update:"Update",updates:"Updates",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_do_not_show_again:"Do not show again",updates_dialog_like:"Like",updating:"Updating...",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},yl={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",cannot_be_own_leader:"Un líder no puede ser su propio superior",change_photo:"Cambiar foto",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse:"Colapsar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",create:"Crear",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_name:"Editar Nombre",edit_profile:"Editar Perfil",electronic_signature:"Firma Electrónica",email:"Correo electrónico",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand:"Expandir",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_direct_subordinates:"Subordinados directos:",leadership_drag_hint:"Arrastre las filas para reorganizar • Seleccione múltiples para mover en lote",leadership_drag_to_hierarchy:"Arrastre a la jerarquía anterior",leadership_immediate_superior:"Superior Inmediato",leadership_load_error:"Error al cargar la jerarquía de liderazgo",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_direct_subordinates:"Sin subordinados directos",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_confirmation:"¿Está seguro de que desea eliminar este líder? Esta acción no se puede deshacer.",leadership_remove_team:"Quitar del equipo",leadership_search_superior:"Buscar superior...",leadership_select_subordinates:"Seleccione al menos un subordinado",leadership_unassociated_users:"Usuarios no asociados",leadership_users_associated:"{{count}} usuario asociado",leadership_users_associated_count:"Usuarios asociados: {{count}}",leadership_users_associated_plural:"{{count}} usuarios asociados",leadership_users_unassociated_count:"Usuarios no asociados: {{count}}",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",loading:"Cargando...",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",none_bracketed:"[Ninguno]",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",removing:"Eliminando...",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",reset_default:"Restablecer predeterminado",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",selected_count:"{{count}} seleccionado",selected_count_plural:"{{count}} seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates:"Subordinados",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",update:"Actualizar",updates:"Actualizaciones",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_do_not_show_again:"No mostrar de nuevo",updates_dialog_like:"Me gusta",updating:"Actualizando...",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const wl="true"===(void 0).VITE_I18N_DEBUG_MODE;function jl(t,a){e.addResourceBundle(t,"app",a,!0,!0)}wl&&e.use({type:"postProcessor",name:"debugKeys",process:(e,t)=>`🔑 ${Array.isArray(t)?t[0]:t}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:bl},"en-US":{core:vl},"es-ES":{core:yl}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:wl?["debugKeys"]:[]});const Nl=a.createContext({moduleAlias:null,associationsBaseUrl:null,signDocumentsSchema:"common",signDocumentsTable:"sign_documents"});function _l({moduleAlias:e=null,associationsBaseUrl:a=null,signDocumentsSchema:r="common",signDocumentsTable:s="sign_documents",children:n}){return t.jsx(Nl.Provider,{value:{moduleAlias:e,associationsBaseUrl:a,signDocumentsSchema:r,signDocumentsTable:s},children:n})}function Cl(){return a.useContext(Nl)}const kl={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},Sl=6e5;function Al(e){const{moduleAlias:t,associationsBaseUrl:r}=Cl(),{alias:s,user:n,isAuthenticated:o}=Co(),i=e??t,l=n?.id??null,c=o&&!!s&&!!l,{data:d=[],isLoading:u}=j.useQuery({queryKey:["qualiex-associations",l,s,r??null],queryFn:()=>io.fetchUserAssociations(l,s,r?{baseUrl:r}:void 0),enabled:c,staleTime:Sl,gcTime:12e5}),m=a.useMemo(()=>s&&0!==d.length?d.find(e=>e.companyAlias===s)??null:null,[d,s]),p=a.useCallback(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const t=kl[e];return void 0!==t&&m.softwares.includes(t)})},[m]);return{hasAccess:a.useMemo(()=>!i||p(i),[i,p]),isLoading:c&&u,role:a.useMemo(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}const Tl={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES",fr:"fr-FR","fr-FR":"fr-FR"};function Dl(){const{association:t}=Al(),r=t?.language;return a.useEffect(()=>{if(!r)return;const t=Tl[r];t&&e.language!==t&&e.changeLanguage(t)},[r]),null}const El=a.createContext(void 0),Pl={locale:tr,timezone:rr,datetimeFormat:ar},Ml=async()=>{},Il=({children:e})=>t.jsx(El.Provider,{value:{...Pl,setLocale:Ml,setTimezone:Ml,setDatetimeFormat:Ml,isLoading:!1},children:e}),Rl=()=>{const e=a.useContext(El);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Ll=be.Root,Fl=be.CollapsibleTrigger,zl=be.CollapsibleContent;var Ul=Object.defineProperty,Ol=(e,t,a)=>((e,t,a)=>t in e?Ul(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,t+"",a);class Bl extends a.Component{constructor(t){super(t),Ol(this,"copyErrorDetails",()=>{const t=Wn.getErrors().slice(0,2),a=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${t.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(a),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,t){if((void 0).DEV)throw e;Wn.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const a=Wn.getErrors().slice(0,2);return t.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:t.jsxs(Dr,{className:"w-full max-w-2xl",children:[t.jsxs(Er,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),t.jsx(Pr,{children:e.t("something_went_wrong")})]}),t.jsxs(Ir,{className:"space-y-4",children:[t.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t.jsxs(Ll,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[t.jsx(Fl,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t.jsxs(zl,{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t.jsxs("div",{className:"text-sm space-y-2",children:[t.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&t.jsx(ki,{className:"h-32 w-full rounded border bg-muted p-2",children:t.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),a.length>0&&t.jsxs("div",{className:"pt-3 border-t",children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),t.jsx("div",{className:"space-y-2",children:a.map((e,a)=>t.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[a+1,"."]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),t.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t.jsxs(Cr,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),t.jsx(Cr,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const ql=ve.Root,Vl=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.List,{ref:r,className:jr("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));Vl.displayName=ve.List.displayName;const $l=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.Trigger,{ref:r,className:jr("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));$l.displayName=ve.Trigger.displayName;const Wl=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.Content,{ref:r,className:jr("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));function Hl({className:e}){return t.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),t.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),t.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function Gl({className:e}){return t.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),t.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),t.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}Wl.displayName=ve.Content.displayName;const Kl={init(e){!function(e){try{return t=window,a=document,r="clarity",s="script",n=e,void(a.getElementById("clarity-script")||(t[r]=t[r]||function(){(t[r].q=t[r].q||[]).push(arguments)},(o=a.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+n+"?ref=npm",o.id="clarity-script",(i=a.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var t,a,r,s,n,o,i}(e)},setTag(e,t){window.clarity("set",e,t)},identify(e,t,a,r){window.clarity("identify",e,t,a,r)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Yl="forlogic_";function Ql(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Xl(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Jl(e){return Xl()?`${Yl}${e}`:e}function Zl(e){return Xl()?`${Yl}${e}`:e}function ec(e){try{e()}catch(t){(void 0).DEV}}function tc(e){for(const[t,a]of Object.entries(e))null!=a&&""!==a&&Kl.setTag(Zl(t),a)}function ac({module:e,isContracted:t,sourceModule:a,alias:r}){Ql()&&ec(()=>{tc({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(t),source_module:a,alias:r}),Kl.event(Jl("module_menu_click"))})}function rc({module:e,sourceModule:t,alias:a}){Ql()&&ec(()=>{tc({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:t,alias:a}),Kl.event(Jl("module_interest_click"))})}function sc({resource:e,sourceModule:t,alias:a}){Ql()&&ec(()=>{tc({footer_resource:e,source_module:t,alias:a}),Kl.event(Jl("module_footer_click"))})}function nc({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:a="https://sabergestao.com.br/",wikiUrl:r,alias:s,sourceModule:n}){const{t:o}=y.useTranslation(),i=fr(e||r||"https://educacao.sabergestao.com.br/{alias}/fe",s),l=e=>{sc({resource:e,sourceModule:n,alias:s})};return t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Lr,{className:"mb-4"}),t.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Hl,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),t.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Gl,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t.jsxs("a",{href:r||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(c.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const oc=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]},{id:"backoffice",label:"Backoffice",modules:[{name:"Backoffice",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function ic({module:e,onClick:a}){return t.jsxs("button",{type:"button",onClick:a,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[t.jsx("div",{className:jr("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function lc(e,t){if(0===e.length)return e;const a=Math.ceil(e.length/t),r=[];for(let s=0;s<a;s++)for(let n=0;n<t;n++){const t=n*a+s;t<e.length&&r.push(e[t])}return r}function cc({modules:e,onModuleClick:r,contractedModules:s,onModuleInterest:n}){const o=function(){const[e,t]=a.useState(4);return a.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?t(4):window.matchMedia("(min-width: 768px)").matches?t(3):window.matchMedia("(min-width: 640px)").matches?t(2):t(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,t)=>e.name.localeCompare(t.name)),l=void 0!==s,c=e=>!0===e.alwaysContracted||!l||s.includes(e.name),d=i.filter(c),u=l?i.filter(e=>!c(e)):[],m=lc(d,o),p=lc(u,o),h=(e,t)=>{t?r?.(e):n?.(e)};return t.jsxs("div",{className:"space-y-6",children:[m.length>0&&t.jsx("section",{children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>t.jsx(ic,{module:e,onClick:()=>h(e,!0)},e.name))})}),p.length>0&&t.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[t.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>t.jsx(ic,{module:e,onClick:()=>h(e,!1)},e.name))})]})]})}function dc({onModuleClick:e,contractedModules:r,onModuleInterest:s,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:c,sourceModule:d,showAdminGroup:u=!1}){const[m,p]=a.useState("qualiex"),h=u?oc.find(e=>"backoffice"===e.id)?.modules??[]:[],x=oc.filter(e=>"backoffice"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...h]}:e),f=e=>{rc({module:e,sourceModule:d,alias:c}),window.open(n,"_blank","noopener,noreferrer"),s?.(e)};return t.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t.jsxs(ql,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[t.jsx(Vl,{className:"w-fit shrink-0",children:x.map(e=>t.jsxs($l,{value:e.id,children:[e.label,t.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),x.map(a=>t.jsx(Wl,{value:a.id,className:"flex-1 mt-4 overflow-auto pr-2",children:t.jsx(cc,{modules:a.modules,onModuleClick:t=>{return s=t,n=a.id,ac({module:s,isContracted:!!s.alwaysContracted||"qualiex"!==n||!r||r.includes(s.name),sourceModule:d,alias:c}),void e?.(s);var s,n},contractedModules:"qualiex"===a.id?r:void 0,onModuleInterest:f})},a.id))]}),t.jsx(nc,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c,sourceModule:d})]})}function uc(e){const{association:t}=Al();return a.useMemo(()=>{if(e)return e;if(!t?.softwares)return;const a=t.softwares,r=oc.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const t=kl[e.softwareAlias];return void 0!==t&&a.includes(t)}).map(e=>e.name):void 0},[e,t])}function mc({open:e,onOpenChange:a,onModuleClick:r,contractedModules:s,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:c,showAdminGroup:d}){const{alias:u,user:m}=Co(),p=uc(s),h=d??!!m?.isSysAdmin;return t.jsx(Kr,{open:e,onOpenChange:a,children:t.jsxs(es,{size:"lg",className:"overflow-hidden flex flex-col",children:[t.jsx(ts,{className:"sr-only",children:t.jsx(ss,{children:"Módulos"})}),t.jsx(dc,{onModuleClick:e=>{r?r(e):e.url&&xr(fr(e.url,u||void 0))},contractedModules:p,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:u||void 0,sourceModule:c,showAdminGroup:h})]})})}function pc({open:r,onOpenChange:s,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:d,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:b=!0,size:v="lg",children:w,sourceModule:j}){const{t:N}=y.useTranslation(),_=a.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(t=>e.set(t.alias,t));const t=Array.from(e.values()),a=t.find(e=>e.alias===m),r=t.filter(e=>e.alias!==m).sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"}));return a?[a,...r]:r},[u,m]);return t.jsx(Kr,{open:r,onOpenChange:b?void 0:s,children:t.jsxs(es,{size:v,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:b?e=>e.preventDefault():void 0,onEscapeKeyDown:b?e=>e.preventDefault():void 0,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[t.jsx(ss,{children:N("no_access_page")}),t.jsx(ns,{children:"Selecione um módulo para continuar navegando!"})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[t.jsx(c.Building2,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate text-xs",children:d||"Unidade"}),t.jsx(c.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),t.jsx(qs,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t.jsxs(Vs,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&t.jsx(Ts,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsxs(Cr,{variant:"ghost",size:"sm",className:"gap-2",children:[t.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:t.jsx(c.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),t.jsx(c.ChevronDown,{className:"h-3 w-3"})]})}),t.jsxs(qs,{align:"end",children:[t.jsxs("div",{className:"px-2 py-1.5",children:[t.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:d})]}),t.jsx(Gs,{}),t.jsxs(Vs,{onClick:h,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),w?t.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[t.jsx("div",{className:"flex-1",children:w}),t.jsx(nc,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]}):t.jsx(dc,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]})})}function hc(e,t){return t.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t)}function xc({children:e,contractedModules:r,onModuleClick:s,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:c,noAccessRedirectPath:d,noAccessRedirectMode:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=y.useTranslation(),{hasAccess:x,isLoading:f,association:g}=Al(),{user:b,alias:v,companies:w,isAuthenticated:j,isLoading:N,logout:_,switchUnit:C}=Co(),k=uc(r),S=a.useMemo(()=>w?.length?v&&w.find(e=>e.alias===v)||w[0]:null,[w,v]),A=a.useMemo(()=>w?.length?w.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[w]),T=a.useCallback(e=>{const t=w?.find(t=>t.alias===e.alias);if(!t)return;const{pathname:a,search:r,hash:s}=window.location;if(v){const e=a.split("/"),n=e.indexOf(v);if(n>=0)return e[n]=t.alias,void(window.location.href=e.join("/")+r+s)}C(t)},[v,C,w]),D=a.useCallback(e=>{s?s(e):e.url&&xr(fr(e.url,v||void 0))},[s,v]),E=a.useMemo(()=>{if(!m)return;const e="undefined"!=typeof window?window.location.pathname:"",t=Object.keys(m).find(t=>hc(e,[t]));return t?m[t]:void 0},[m]),P="undefined"!=typeof window?window.location.pathname:"",M=!(!c?.length||!hc(P,c)),I=!N&&j&&!f&&!x&&!M&&!!d&&"always"===(u??"always")?function(e,t){return t&&e.startsWith("/")?e.split("/")[1]===t?e:`/${t}${e}`:e}(d,v):null;return a.useEffect(()=>{I&&I!==P&&window.location.replace(I)},[I,P]),N||!j||M?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Es,{size:"lg"})}):x?t.jsx(t.Fragment,{children:e}):I?I===P?t.jsx(t.Fragment,{children:e}):t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Es,{size:"lg"})}):t.jsx(pc,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:n,userName:b?.name,unitName:S?.name,units:A,currentAlias:v||void 0,onUnitChange:T,onLogout:_,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:p,blocking:!0,children:E})}let fc=!1;function gc(){if(fc||"undefined"==typeof document)return;fc=!0;for(const t of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=t,t.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const t of e)if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}}function bc({projectId:e,mode:t="auto"}){const{user:r,alias:s,isAuthenticated:n}=Co();a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&e&&!We()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Kl.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(a){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,t]),a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&n&&r&&"function"==typeof window.clarity)try{const e=r.email||r.identifier||"anonymous";Kl.identify(e,void 0,"modules-menu",r.name||void 0),s&&Kl.setTag("alias",s),"boolean"==typeof r.isSysAdmin&&Kl.setTag("isSysAdmin",String(r.isSysAdmin))}catch(e){(void 0).DEV}},[r,s,n,t])}let vc="legacy";function yc({projectId:e,mode:t}){return bc({projectId:e,mode:t}),null}function wc(){if(!Fe())return null;const e=Hn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),a=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||a||!(void 0).DEV)return null;const r={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[t.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",t.jsx("code",{style:r,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",t.jsx("code",{style:r,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const jc=ye.Root,Nc=te.forwardRef(({className:e,...a},r)=>t.jsx(ye.Item,{ref:r,className:jr("border-b",e),...a}));Nc.displayName="AccordionItem";const _c=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Header,{className:"flex",children:t.jsxs(ye.Trigger,{ref:s,className:jr("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[a,t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));_c.displayName=ye.Trigger.displayName;const Cc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:t.jsx("div",{className:jr("pb-4 pt-0",e),children:a})}));Cc.displayName=ye.Content.displayName;const kc=te.forwardRef(({...e},a)=>t.jsx("nav",{ref:a,"aria-label":"breadcrumb",...e}));kc.displayName="Breadcrumb";const Sc=te.forwardRef(({className:e,...a},r)=>t.jsx("ol",{ref:r,className:jr("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...a}));Sc.displayName="BreadcrumbList";const Ac=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:jr("inline-flex items-center gap-1.5",e),...a}));Ac.displayName="BreadcrumbItem";const Tc=te.forwardRef(({asChild:e,className:a,...s},n)=>{const o=e?r.Slot:"a";return t.jsx(o,{ref:n,className:jr("transition-colors hover:text-foreground",a),...s})});Tc.displayName="BreadcrumbLink";const Dc=te.forwardRef(({className:e,...a},r)=>t.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:jr("font-normal text-foreground",e),...a}));Dc.displayName="BreadcrumbPage";const Ec=({children:e,className:a,...r})=>t.jsx("li",{role:"presentation","aria-hidden":"true",className:jr("[&>svg]:h-3.5 [&>svg]:w-3.5",a),...r,children:e??t.jsx(c.ChevronRight,{})});Ec.displayName="BreadcrumbSeparator";const Pc=({className:e,...a})=>t.jsxs("span",{role:"presentation","aria-hidden":"true",className:jr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Mais"})]});Pc.displayName="BreadcrumbEllipsis";const Mc=s.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),Ic=te.forwardRef(({className:e,orientation:a,...r},s)=>t.jsx("div",{ref:s,className:jr(Mc({orientation:a}),e),...r}));Ic.displayName="ButtonGroup";const Rc={"pt-BR":Xa,"en-US":yt,"es-ES":Wa};function Lc({className:e,classNames:a,showOutsideDays:r=!0,captionLayout:s,fromYear:n,toYear:o,startMonth:i,endMonth:l,...d}){const{i18n:u}=y.useTranslation(),m=Rc[u.language]??Xa,p=te.useMemo(()=>i??(n?new Date(n,0,1):void 0),[i,n]),h=te.useMemo(()=>l??(o?new Date(o,11,31):void 0),[l,o]),x=s?.startsWith("dropdown");return t.jsx(M.DayPicker,{showOutsideDays:r,className:jr("p-3 pointer-events-auto",e),locale:m,captionLayout:s,startMonth:p,endMonth:h,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:jr("flex h-9 w-full items-center px-8",x?"justify-center gap-1.5":"justify-center"),nav:jr("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1","dropdown"===s&&"hidden"),button_previous:jr(_r({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:jr(_r({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:jr(_r({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",dropdowns:"flex items-center gap-1.5",dropdown_root:"relative inline-flex items-center",dropdown:jr("cursor-pointer appearance-none rounded-md border border-input bg-background","h-8 pl-2.5 pr-7 text-sm font-medium text-foreground","hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","transition-colors","bg-[right_0.5rem_center] bg-no-repeat","bg-[url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='hsl(215%2016%25%2047%25)'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E\")]"),caption_label:x?"sr-only":"text-sm font-medium",...a},components:{Chevron:({orientation:e})=>"left"===e?t.jsx(c.ChevronLeft,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})},...d})}Lc.displayName="Calendar";const Fc={Root:function({children:e,className:a}){return t.jsx("div",{className:jr("space-y-4",a),children:e})},Item:function({children:e,onClick:a,className:r}){return t.jsx(Dr,{className:jr("transition-colors",a&&"cursor-pointer hover:bg-muted/50",r),onClick:a,children:t.jsx(Ir,{className:"p-4",children:e})})},Field:function({label:e,value:a,className:r}){return t.jsxs("div",{className:jr("flex justify-between items-center text-sm",r),children:[t.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),t.jsx("span",{className:"text-foreground",children:a})]})}};const zc=({shouldScaleBackground:e=!0,...a})=>t.jsx(I.Drawer.Root,{shouldScaleBackground:e,...a});zc.displayName="Drawer";const Uc=I.Drawer.Trigger,Oc=I.Drawer.Portal,Bc=I.Drawer.Close,qc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Overlay,{ref:r,className:jr("fixed inset-0 z-50 bg-black/80",e),...a}));qc.displayName=I.Drawer.Overlay.displayName;const Vc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Oc,{children:[t.jsx(qc,{}),t.jsxs(I.Drawer.Content,{ref:s,className:jr("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[t.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),a]})]}));Vc.displayName="DrawerContent";const $c=({className:e,...a})=>t.jsx("div",{className:jr("grid gap-1.5 p-4 text-center sm:text-left",e),...a});$c.displayName="DrawerHeader";const Wc=({className:e,...a})=>t.jsx("div",{className:jr("mt-auto flex flex-col gap-2 p-4",e),...a});Wc.displayName="DrawerFooter";const Hc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Title,{ref:r,className:jr("text-lg font-semibold leading-none tracking-tight",e),...a}));Hc.displayName=I.Drawer.Title.displayName;const Gc=te.forwardRef(({className:e,...a},r)=>t.jsx(I.Drawer.Description,{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));Gc.displayName=I.Drawer.Description.displayName;const Kc={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},Yc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Qc=we.Root,Xc=we.Trigger,Jc=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,...s},n)=>t.jsx(we.Content,{ref:n,align:a,sideOffset:r,className:jr("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));Jc.displayName=we.Content.displayName;const Zc=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-slot":"input-group",className:jr("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...a}));Zc.displayName="InputGroup";const ed=s.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),td=te.forwardRef(({className:e,align:a,...r},s)=>t.jsx("div",{ref:s,"data-slot":"input-group-addon",className:jr(ed({align:a}),e),...r}));td.displayName="InputGroupAddon";const ad=s.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),rd=te.forwardRef(({className:e,size:a,variant:r="ghost",...s},n)=>t.jsx(Cr,{ref:n,"data-slot":"input-group-button",variant:r,className:jr(ad({size:a}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...s}));rd.displayName="InputGroupButton";const sd=te.forwardRef(({className:e,...a},r)=>t.jsx(Sr,{ref:r,"data-slot":"input-group-control",className:jr("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));sd.displayName="InputGroupInput";const nd=te.forwardRef(({className:e,...a},r)=>t.jsx(Ss,{ref:r,"data-slot":"input-group-control",className:jr("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));nd.displayName="InputGroupTextarea";const od=te.forwardRef(({className:e,...a},r)=>t.jsx("h1",{ref:r,className:jr("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...a}));od.displayName="H1";const id=te.forwardRef(({className:e,...a},r)=>t.jsx("h2",{ref:r,className:jr("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...a}));id.displayName="H2";const ld=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:jr("scroll-m-20 text-2xl font-semibold tracking-tight",e),...a}));ld.displayName="H3";const cd=te.forwardRef(({className:e,...a},r)=>t.jsx("h4",{ref:r,className:jr("scroll-m-20 text-xl font-semibold tracking-tight",e),...a}));cd.displayName="H4";const dd=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:jr("leading-7 [&:not(:first-child)]:mt-6",e),...a}));dd.displayName="P";const ud=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:jr("text-xl text-muted-foreground",e),...a}));ud.displayName="Lead";const md=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:jr("text-lg font-semibold",e),...a}));md.displayName="Large";const pd=te.forwardRef(({className:e,...a},r)=>t.jsx("small",{ref:r,className:jr("text-sm font-medium leading-none",e),...a}));pd.displayName="Small";const hd=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));hd.displayName="Muted";const xd=te.forwardRef(({className:e,...a},r)=>t.jsx("code",{ref:r,className:jr("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...a}));xd.displayName="InlineCode";const fd=te.forwardRef(({className:e,...a},r)=>t.jsx("blockquote",{ref:r,className:jr("mt-6 border-l-2 pl-6 italic",e),...a}));fd.displayName="Blockquote";const gd=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:jr("my-6 ml-6 list-disc [&>li]:mt-2",e),...a}));gd.displayName="List";const bd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Root,{ref:s,className:jr("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...r,children:[a,t.jsx(Cd,{})]}));bd.displayName=je.Root.displayName;const vd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.List,{ref:r,className:jr("group flex flex-1 list-none items-center justify-center space-x-1",e),...a}));vd.displayName=je.List.displayName;const yd=je.Item,wd=s.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),jd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Trigger,{ref:s,className:jr(wd(),"group",e),...r,children:[a," ",t.jsx(c.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));jd.displayName=je.Trigger.displayName;const Nd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Content,{ref:r,className:jr("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...a}));Nd.displayName=je.Content.displayName;const _d=je.Link,Cd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:jr("absolute left-0 top-full flex justify-center"),children:t.jsx(je.Viewport,{className:jr("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:r,...a})}));Cd.displayName=je.Viewport.displayName;const kd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Indicator,{ref:r,className:jr("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...a,children:t.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));kd.displayName=je.Indicator.displayName;const Sd=({className:e,...a})=>t.jsx("nav",{role:"navigation","aria-label":"pagination",className:jr("mx-auto flex w-full justify-center",e),...a});Sd.displayName="Pagination";const Ad=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:jr("flex flex-row items-center gap-1",e),...a}));Ad.displayName="PaginationContent";const Td=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:jr("",e),...a}));Td.displayName="PaginationItem";const Dd=({className:e,isActive:a,size:r="icon",...s})=>t.jsx("a",{"aria-current":a?"page":void 0,className:jr(_r({variant:a?"outline":"ghost",size:r}),e),...s});Dd.displayName="PaginationLink";const Ed=({className:a,...r})=>t.jsxs(Dd,{"aria-label":e.t("go_to_previous_page"),size:"default",className:jr("gap-1 pl-2.5",a),...r,children:[t.jsx(c.ChevronLeft,{className:"h-4 w-4"}),t.jsx("span",{children:"Previous"})]});Ed.displayName="PaginationPrevious";const Pd=({className:a,...r})=>t.jsxs(Dd,{"aria-label":e.t("go_to_next_page"),size:"default",className:jr("gap-1 pr-2.5",a),...r,children:[t.jsx("span",{children:"Next"}),t.jsx(c.ChevronRight,{className:"h-4 w-4"})]});Pd.displayName="PaginationNext";const Md=({className:e,...a})=>t.jsxs("span",{"aria-hidden":!0,className:jr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"More pages"})]});Md.displayName="PaginationEllipsis";const Id=te.forwardRef(({className:e,value:a,...r},s)=>t.jsx(Ne.Root,{ref:s,className:jr("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:t.jsx(Ne.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));Id.displayName=Ne.Root.displayName;const Rd=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Root,{className:jr("grid gap-2",e),...a,ref:r}));Rd.displayName=_e.Root.displayName;const Ld=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Item,{ref:r,className:jr("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:t.jsx(_e.Indicator,{className:"flex items-center justify-center",children:t.jsx(c.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ld.displayName=_e.Item.displayName;const Fd=Ce.Panel,zd=se.Root,Ud=se.Trigger,Od=se.Close,Bd=se.Portal,qd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{className:jr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));qd.displayName=se.Overlay.displayName;const Vd=s.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),$d=te.forwardRef(({side:e="right",className:a,children:r,...s},n)=>t.jsxs(Bd,{children:[t.jsx(qd,{}),t.jsxs(se.Content,{ref:n,className:jr(Vd({side:e}),a),...s,children:[r,t.jsxs(se.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$d.displayName=se.Content.displayName;const Wd=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:jr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Lr,{className:"mt-2"})]});Wd.displayName="SheetHeader";const Hd=({className:e,...a})=>t.jsx("div",{className:jr("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...a});Hd.displayName="SheetBody";const Gd=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Lr,{className:"mb-4"}),t.jsx("div",{className:jr("flex flex-row justify-end gap-2",e),...r,children:a})]});Gd.displayName="SheetFooter";const Kd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:jr("text-lg font-semibold text-foreground",e),...a}));Kd.displayName=se.Title.displayName;const Yd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:jr("text-sm text-muted-foreground",e),...a}));Yd.displayName=se.Description.displayName;const Qd="sidebar:state",Xd=te.createContext(null);function Jd(){const e=te.useContext(Xd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Zd=te.forwardRef(({defaultOpen:e=!0,open:a,onOpenChange:r,className:s,style:n,children:o,...i},l)=>{const c=Ao(),[d,u]=te.useState(!1),[m,p]=te.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(Qd);return null!==t?"true"===t:e}return e}),h=a??m,x=te.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):p(t),"undefined"!=typeof window&&localStorage.setItem(Qd,String(t))},[r,h]),f=te.useCallback(()=>c?u(e=>!e):x(e=>!e),[c,x,u]);te.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",b=te.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:f}),[g,h,x,c,d,u,f]);return t.jsx(Xd.Provider,{value:b,children:t.jsx(Ys,{delayDuration:0,children:t.jsx("div",{className:jr("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",s),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});Zd.displayName="SidebarProvider";const eu=te.forwardRef(({side:e="left",variant:a="sidebar",collapsible:r="offcanvas",className:s,children:n,...o},i)=>{const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Jd();return"none"===r?t.jsx("div",{className:jr("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:i,...o,children:n}):l?t.jsx(zd,{open:d,onOpenChange:u,...o,children:t.jsxs($d,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[t.jsx(Kd,{className:"sr-only",children:"Menu de Navegação"}),t.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):t.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?r:"","data-variant":a,"data-side":e,children:[t.jsx("div",{className:jr("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:jr("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});eu.displayName="Sidebar";const tu=te.forwardRef(({className:e,onClick:a,...r},s)=>{const{toggleSidebar:n}=Jd();return t.jsxs(Cr,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:jr("h-7 w-7",e),onClick:e=>{a?.(e),n()},...r,children:[t.jsx(c.PanelLeft,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});tu.displayName="SidebarTrigger";const au=te.forwardRef(({className:e,...a},r)=>{const{toggleSidebar:s}=Jd();return t.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:jr("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...a})});au.displayName="SidebarRail";const ru=te.forwardRef(({className:e,...a},r)=>t.jsx("main",{ref:r,className:jr("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...a}));ru.displayName="SidebarInset";const su=te.forwardRef(({className:e,...a},r)=>t.jsx(Sr,{ref:r,"data-sidebar":"input",className:jr("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...a}));su.displayName="SidebarInput";const nu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"header",className:jr("flex flex-col gap-2 p-2",e),...a}));nu.displayName="SidebarHeader";const ou=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"footer",className:jr("flex flex-col gap-2 p-2",e),...a}));ou.displayName="SidebarFooter";const iu=te.forwardRef(({className:e,...a},r)=>t.jsx(Lr,{ref:r,"data-sidebar":"separator",className:jr("mx-2 w-auto bg-sidebar-border",e),...a}));iu.displayName="SidebarSeparator";const lu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"content",className:jr("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...a}));lu.displayName="SidebarContent";const cu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group",className:jr("relative flex w-full min-w-0 flex-col p-2",e),...a}));cu.displayName="SidebarGroup";const du=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"div";return t.jsx(o,{ref:n,"data-sidebar":"group-label",className:jr("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})});du.displayName="SidebarGroupLabel";const uu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"button";return t.jsx(o,{ref:n,"data-sidebar":"group-action",className:jr("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...s})});uu.displayName="SidebarGroupAction";const mu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group-content",className:jr("w-full text-sm",e),...a}));mu.displayName="SidebarGroupContent";const pu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu",className:jr("flex w-full min-w-0 flex-col gap-1",e),...a}));pu.displayName="SidebarMenu";const hu=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,"data-sidebar":"menu-item",className:jr("group/menu-item relative",e),...a}));hu.displayName="SidebarMenuItem";const xu=s.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),fu=te.forwardRef(({asChild:e=!1,isActive:a=!1,variant:s="default",size:n="default",tooltip:o,className:i,...l},c)=>{const d=e?r.Slot:"button",{isMobile:u,state:m}=Jd(),p=t.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":n,"data-active":a,className:jr(xu({variant:s,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:p}),t.jsx(Js,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});fu.displayName="SidebarMenuButton";const gu=te.forwardRef(({className:e,asChild:a=!1,showOnHover:s=!1,...n},o)=>{const i=a?r.Slot:"button";return t.jsx(i,{ref:o,"data-sidebar":"menu-action",className:jr("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});gu.displayName="SidebarMenuAction";const bu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:jr("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...a}));bu.displayName="SidebarMenuBadge";const vu=te.forwardRef(({className:e,showIcon:a=!1,...r},s)=>{const n=te.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:jr("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[a&&t.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});vu.displayName="SidebarMenuSkeleton";const yu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:jr("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...a}));yu.displayName="SidebarMenuSub";const wu=te.forwardRef(({...e},a)=>t.jsx("li",{ref:a,...e}));wu.displayName="SidebarMenuSubItem";const ju=te.forwardRef(({asChild:e=!1,size:a="md",isActive:s,className:n,...o},i)=>{const l=e?r.Slot:"a";return t.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":a,"data-active":s,className:jr("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});ju.displayName="SidebarMenuSubButton";const Nu=te.forwardRef(({className:e,value:a,defaultValue:r,...s},n)=>{const o=a||r||[0];return t.jsxs(ke.Root,{ref:n,value:a,defaultValue:r,className:jr("relative flex w-full touch-none select-none items-center",e),...s,children:[t.jsx(ke.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:t.jsx(ke.Range,{className:"absolute h-full bg-primary"})}),o.map((e,a)=>t.jsx(ke.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},a))]})});Nu.displayName=ke.Root.displayName;const _u=Se.Menu,Cu=Se.Group,ku=Se.Portal,Su=Se.Sub,Au=Se.RadioGroup,Tu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Root,{ref:r,className:jr("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...a}));Tu.displayName=Se.Root.displayName;const Du=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Trigger,{ref:r,className:jr("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...a}));Du.displayName=Se.Trigger.displayName;const Eu=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(Se.SubTrigger,{ref:n,className:jr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Eu.displayName=Se.SubTrigger.displayName;const Pu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.SubContent,{ref:r,className:jr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Pu.displayName=Se.SubContent.displayName;const Mu=te.forwardRef(({className:e,align:a="start",alignOffset:r=-4,sideOffset:s=8,...n},o)=>t.jsx(Se.Portal,{children:t.jsx(Se.Content,{ref:o,align:a,alignOffset:r,sideOffset:s,className:jr("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Mu.displayName=Se.Content.displayName;const Iu=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Item,{ref:s,className:jr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Iu.displayName=Se.Item.displayName;const Ru=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(Se.CheckboxItem,{ref:n,className:jr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Ru.displayName=Se.CheckboxItem.displayName;const Lu=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Se.RadioItem,{ref:s,className:jr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Lu.displayName=Se.RadioItem.displayName;const Fu=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Label,{ref:s,className:jr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Fu.displayName=Se.Label.displayName;const zu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Separator,{ref:r,className:jr("-mx-1 my-1 h-px bg-muted",e),...a}));zu.displayName=Se.Separator.displayName;const Uu=({className:e,...a})=>t.jsx("span",{className:jr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});Uu.displayname="MenubarShortcut";const Ou={light:"",dark:".dark"},Bu=te.createContext(null);function qu(){const e=te.useContext(Bu);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Vu=te.forwardRef(({id:e,className:a,children:r,config:s,...n},o)=>{const i=te.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return t.jsx(Bu.Provider,{value:{config:s},children:t.jsxs("div",{"data-chart":l,ref:o,className:jr("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...n,children:[t.jsx($u,{id:l,config:s}),t.jsx(Ae.ResponsiveContainer,{children:r})]})})});Vu.displayName="Chart";const $u=({id:e,config:a})=>{const r=Object.entries(a).filter(([,e])=>e.theme||e.color);return r.length?t.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Ou).map(([t,a])=>`\n${a} [data-chart=${e}] {\n${r.map(([e,a])=>{const r=a.theme?.[t]||a.color;return r?` --color-${e}: ${r};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Wu=Ae.Tooltip,Hu=te.forwardRef(({active:e,payload:a,className:r,indicator:s="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:c,formatter:d,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=qu(),f=te.useMemo(()=>{if(n||!a?.length)return null;const[e]=a,r=Yu(x,e,`${p||e?.dataKey||e?.name||"value"}`),s=p||"string"!=typeof i?r?.label:x[i]?.label||i;return l?t.jsx("div",{className:jr("font-medium",c),children:l(s,a)}):s?t.jsx("div",{className:jr("font-medium",c),children:s}):null},[i,l,a,n,c,x,p]);if(!e||!a?.length)return null;const g=1===a.length&&"dot"!==s;return t.jsxs("div",{ref:h,className:jr("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:f,t.jsx("div",{className:"grid gap-1.5",children:a.map((e,a)=>{const r=`${m||e.name||e.dataKey||"value"}`,n=Yu(x,e,r),i=u||e.payload?.fill||e.color;return t.jsx("div",{className:jr("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===s&&"items-center"),children:d&&void 0!==e?.value&&e.name?d(e.value,e.name,e,a,e.payload):t.jsxs(t.Fragment,{children:[n?.icon?t.jsx(n.icon,{}):!o&&t.jsx("div",{className:jr("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===s,"w-1":"line"===s,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===s,"my-0.5":g&&"dashed"===s}),style:{"--color-bg":i,"--color-border":i}}),t.jsxs("div",{className:jr("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[t.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,t.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&t.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||a)})})]})});Hu.displayName="ChartTooltip";const Gu=Ae.Legend,Ku=te.forwardRef(({className:e,hideIcon:a=!1,payload:r,verticalAlign:s="bottom",nameKey:n},o)=>{const{config:i}=qu();return r?.length?t.jsx("div",{ref:o,className:jr("flex items-center justify-center gap-4","top"===s?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${n||e.dataKey||"value"}`,s=Yu(i,e,r);return t.jsxs("div",{className:jr("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[s?.icon&&!a?t.jsx(s.icon,{}):t.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),s?.label]},e.value)})}):null});function Yu(e,t,a){if("object"!=typeof t||null===t)return;const r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let s=a;return a in t&&"string"==typeof t[a]?s=t[a]:r&&a in r&&"string"==typeof r[a]&&(s=r[a]),s in e?e[s]:e[a]}Ku.displayName="ChartLegend";const Qu=({onClick:e,isActive:a,disabled:r,children:s,title:n})=>t.jsx("button",{type:"button",onClick:e,disabled:r,title:n,className:jr("p-1.5 rounded hover:bg-muted transition-colors",a?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:s}),Xu=()=>t.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Ju({image:e,title:a,className:r}){return t.jsx("div",{className:jr("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?t.jsx("img",{src:e,alt:a,className:"w-full h-full object-cover"}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(c.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function Zu({steps:e,currentStepIndex:a,onStepSelect:r,stepLabel:s,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(a+1)/i*100;return t.jsxs("div",{className:jr("flex items-center gap-3",n),children:[t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsxs(Cr,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[s," ",a+1,"/",i,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(qs,{align:"start",children:e.map((e,s)=>t.jsxs(Vs,{onClick:()=>r(s),className:jr(s===a&&"bg-accent"),children:[s+1,". ",e.title]},e.id))})]}),t.jsx(Id,{value:l,className:"w-32 h-2"})]})}function em({currentStepIndex:e,totalSteps:a,onBack:r,onNext:s,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:d}){const{t:u}=y.useTranslation(),m=0===e,p=e===a-1;return t.jsxs("div",{className:jr("flex items-center gap-2",d),children:[!m&&t.jsxs(Cr,{variant:"outline",onClick:r,size:"sm",children:[t.jsx(c.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),t.jsxs(Cr,{onClick:p?n:s,size:"sm",children:[p?l:i,!p&&t.jsx(c.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const tm=te.forwardRef(({open:a,onOpenChange:r,steps:s,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:d="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[b,v]=te.useState(0),y=void 0!==h,w=y?h:b,j=te.useCallback(e=>{y?x?.(e):v(e),o?.(e)},[y,x,o]);te.useEffect(()=>{a||y||v(0)},[a,y]);const N=s[w],_=s.length;return N?t.jsx(Kr,{open:a,onOpenChange:r,children:t.jsxs(es,{ref:g,size:m,variant:"informative",className:jr("p-0 gap-0 overflow-hidden",f),children:[t.jsxs(Xr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Fechar"})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(Ju,{image:N.image,title:N.title}),t.jsx(ss,{className:"text-xl font-semibold",children:N.title}),t.jsx(ns,{className:"text-muted-foreground",children:N.description})]})}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx(Lr,{}),t.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?t.jsx(Zu,{steps:s,currentStepIndex:w,onStepSelect:e=>{j(e)},stepLabel:u}):t.jsx("div",{}),t.jsx(em,{currentStepIndex:w,totalSteps:_,onBack:()=>{w>0&&j(w-1)},onNext:()=>{w<_-1&&j(w+1)},onComplete:()=>{n?.(),r(!1)},backButtonText:l,continueButtonText:i,finishButtonText:d})]})]})]})}):null});function am({label:e,onClick:a,icon:r,actions:s=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:d="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(s.length>0))return t.jsxs(Cr,{variant:n,size:o,disabled:p,onClick:a,className:u,children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]});return t.jsxs("div",{className:jr("inline-flex rounded-md shadow-sm",u),children:[t.jsxs(Cr,{variant:n,size:o,disabled:p,onClick:a,className:"rounded-r-none border-r-0 focus:z-10",children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]}),t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsx(Cr,{variant:n,size:o,disabled:p,className:jr("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:t.jsx(c.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),t.jsx(qs,{align:d,className:"min-w-[160px]",children:s.map(e=>{const a=e.icon;return t.jsxs(Vs,{onClick:e.onClick,disabled:e.disabled,className:jr("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}tm.displayName="OnboardingDialog";var rm=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(rm||{});const sm=[{value:"csv",label:"CSV",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:t.jsx(c.FileSpreadsheet,{className:"h-5 w-5"})}],nm=[{value:"png",label:"PNG",icon:t.jsx(c.Image,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})}];const om=a.forwardRef(({value:e,onChange:r,onTimeChange:s,label:n,error:o,format:i="24h",className:l,id:d,...u},m)=>{const p=d??te.useId(),h=a.useCallback(e=>{const t=e.target.value;r?.(t),s?.(t)},[r,s]),x=a.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t.jsxs("div",{className:jr("grid gap-1.5",l),children:[n&&t.jsx(Tr,{htmlFor:p,children:n}),t.jsxs("div",{className:"relative",children:[t.jsx(Sr,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:jr("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),t.jsx(c.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&t.jsx("p",{className:"text-sm text-destructive",children:o})]})});function im({currentStep:e,totalSteps:a,onStepChange:r,stepLabels:s,canGoToStep:n,className:o,progressWidth:i="w-32"}){te.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:a},(e,t)=>t+1),d=t=>!(t<=e)&&(!!n&&!n(t));return t.jsxs("div",{className:jr("flex items-center gap-3",o),children:[t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsxs(Cr,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",a,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx(qs,{align:"start",children:l.map(a=>t.jsxs(Vs,{onClick:()=>{var t;(t=a)<e?r(t):n&&!n(t)||r(t)},disabled:d(a),className:jr("cursor-pointer",a===e&&"bg-muted font-medium",d(a)&&"opacity-50 cursor-not-allowed"),children:[t.jsxs("span",{className:"mr-2 text-muted-foreground",children:[a,"."]}),s?.[a-1]||`Etapa ${a}`,a===e&&t.jsx(c.Check,{className:"h-4 w-4 ml-auto"})]},a))})]}),t.jsx(Id,{value:e/a*100,className:jr("h-2",i)})]})}function lm(e){const t=qn.getAccessToken(),a={"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},"un-alias":e};if(t)try{const e=JSON.parse(atob(t.split(".")[1]));e.sub&&(a["x-waf-rate"]=btoa(e.sub))}catch{}return a}async function cm(e,t,a){let r=await fetch(e,t);if(401===r.status){if(await oo.handleApiError({status:401})){const s={...t,headers:lm(a)};r=await fetch(e,s)}}return r}function dm(e){const[t,r]=a.useState([]),[s,n]=a.useState(0),[o,i]=a.useState(!1);a.useEffect(()=>{if(!e)return;let t=!1;const a=`${Ge().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const s=lm(e),o=await cm(a,{method:"GET",headers:s},e);if(!o.ok)return;const i=await o.json();!t&&i.data?.[0]&&(r(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(s){}finally{t||i(!1)}}(),()=>{t=!0}},[e]);const l=a.useCallback(async()=>{if(!e||s<=0||0===t.length)return;const a=t[0].id,r=`${Ge().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const t=lm(e),s=JSON.stringify({id:a,idUpdateType:3});await cm(r,{method:"POST",headers:t,body:s},e)}catch(o){}},[e,s,t]);return{updates:t,badgeCount:s,loading:o,markAsVisualized:l}}om.displayName="Timepicker";const um=a.forwardRef(({updates:a,badgeCount:r,onOpen:s,onViewAll:n},o)=>{const i=void 0===a,l=Co(),d=l?.alias??null,u=dm(i?d:null),m=i?u.updates??[]:a,p=i?u.badgeCount??0:r??0,h=s??(i?u.markAsVisualized:void 0),x=n??(i&&d?()=>{window.open(`${window.location.origin}/common/${d}/up/view`,"_blank","noopener,noreferrer")}:void 0);return t.jsxs(en,{children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:h,title:e.t("updates"),children:[t.jsx(c.Coffee,{className:"h-7 w-7"}),p>0&&t.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:p>99?"99+":p})]})}),t.jsxs(an,{align:"end",className:"w-80 p-0",children:[t.jsx("div",{className:"border-b border-border px-4 py-3",children:t.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),t.jsx("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?t.jsx("ul",{className:"divide-y divide-border",children:m.map(e=>t.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:x,children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[t.jsx(c.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.jsxs(Cr,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:x,children:["Ver todas as atualizações",t.jsx(c.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});um.displayName="UpdatesNotification";var mm=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(mm||{}),pm=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(pm||{});const hm={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function xm(e){const{t:t}=y.useTranslation();return e?hm[e.toLowerCase()]??0:0}const fm={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function gm(e){const{t:t}=y.useTranslation();return fm[e?.toLowerCase()]||""}function bm(e){const{t:t}=y.useTranslation(),a=e%60;return`${Math.floor(e/60)}min ${a<10?"0":""}${a}`}function vm({open:e,onOpenChange:r,url:s,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),d=a.useCallback(()=>{r(!1)},[r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&d()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,d]),t.jsx(Kr,{open:e,onOpenChange:r,children:t.jsxs(es,{className:jr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[t.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&t.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Js,{children:"Fechar"})]})]}),t.jsx("iframe",{src:s,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function ym({term:r,open:s,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:d=e.t("terms_read_agree")}){const u=a.useMemo(()=>r.file?function(e,t=""){const{t:a}=y.useTranslation(),r=atob(e),s=[];for(let o=0;o<r.length;o+=512){const e=r.slice(o,o+512),t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);s.push(new Uint8Array(t))}const n=new Blob(s,{type:t});return URL.createObjectURL(n)}(r.file,r.type):null,[r.file,r.type]),m=a.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=a.useCallback(()=>{r.hasUserSignature?m():o?.(r.id)},[r,o,m]),h=!i&&!r.hasUserSignature&&o;return t.jsx(Kr,{open:s,onOpenChange:e=>!e&&m(),children:t.jsxs(es,{className:jr("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[t.jsx(c.FileText,{className:"h-5 w-5 text-primary"}),l]}),t.jsxs("div",{className:"flex items-center gap-2",children:[h&&t.jsx(Cr,{size:"sm",onClick:p,children:d}),t.jsx(Cr,{variant:"ghost",size:"icon",onClick:m,children:t.jsx(c.X,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"flex-1 min-h-0",children:r.file&&u?t.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function wm(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function jm(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Nm(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.allowedIds?.forEach(e=>a.add(e)),r.inheritedIds?.forEach(e=>a.add(e));return a}var _m=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))(_m||{});const Cm={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function km(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Sm(e){const{t:t}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const Am={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};var Tm=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Tm||{}),Dm=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(Dm||{}),Em=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Em||{}),Pm=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(Pm||{}),Mm=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(Mm||{}),Im=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(Im||{}),Rm=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(Rm||{}),Lm=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(Lm||{}),Fm=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(Fm||{}),zm=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(zm||{}),Um=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(Um||{}),Om=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(Om||{}),Bm=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(Bm||{}),qm=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(qm||{}),Vm=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(Vm||{}),$m=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))($m||{}),Wm=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(Wm||{}),Hm=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))(Hm||{}),Gm=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(Gm||{}),Km=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))(Km||{}),Ym=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(Ym||{}),Qm=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(Qm||{}),Xm=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(Xm||{}),Jm=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(Jm||{}),Zm=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(Zm||{}),ep=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(ep||{});const tp={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},ap=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],rp=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function sp(e){if(!e)return 0;const[t,a]=e.split("/"),r=tp[t?.toLowerCase()]??0;return 12*(parseInt(a)||0)+r}function np(e){const t=e.split("/"),a=t[t.length-1];return`${t.slice(0,-1).join("/")}/${encodeURIComponent(a.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function op(e){for(const t of rp)if(e[t])return e[t];return null}function ip(e){const t=[];for(const a of Object.keys(e)){const r=e[a];null!=r&&(r instanceof Date?t.push(`${a}=${r.toISOString()}`):Array.isArray(r)?r.forEach(e=>{t.push(...ip({[a]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||t.push(`${a}=${r}`))}return t}const lp=/^-?\d+(,\d{3})*(\.\d+)?$/;const cp=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const dp=new Set([zm.Text]),up=new Set([zm.Text,zm.Numeric,zm.RiskMatrix,zm.Burndown,zm.PerformanceColumns]),mp=new Set([zm.Text,zm.RiskMatrix,zm.Burndown,zm.PerformanceColumns]);function pp({config:e,viewOnly:r=!1,complement:s,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:d,className:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(e.onlyMine??!1),x=dp.has(e.typeId),f=!up.has(e.typeId),g=!mp.has(e.typeId),b=a.useMemo(()=>{if(!e.jsonRules||e.typeId===zm.PerformanceColumns)return!1;try{const t=JSON.parse(e.jsonRules);return t?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),v=a.useMemo(()=>o?.(e)??"#",[o,e]),w=a.useCallback(()=>{const e=!p;h(e),d?.(e)},[p,d]),j=[];return p&&j.push(m("dashboard_only_mine")),e.onlyLate&&j.push(m("dashboard_only_overdue")),b&&j.push(m("dashboard_advanced_filter")),t.jsxs("div",{className:jr("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&s,t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("span",{className:"block truncate",children:e.title})}),t.jsx(Js,{children:e.title})]}),j.length>0&&t.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:j.join(" | ")})]}),"after-title"===n&&s]}),!r&&t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&s,t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-6 w-6",children:t.jsx(c.MoreVertical,{className:"h-3.5 w-3.5"})})}),t.jsxs(qs,{align:"end",className:"w-48",children:[e.canUpdate&&t.jsxs(Vs,{onClick:()=>e.onEdit?.(e.id),children:[t.jsx(c.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&t.jsxs(Vs,{onClick:i,children:[t.jsx(c.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&t.jsxs(Vs,{disabled:e.noData,onClick:l,children:[t.jsx(c.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&t.jsxs(Vs,{disabled:!e.openQueryEnabled,onClick:()=>window.open(v,"_blank"),children:[t.jsx(c.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&t.jsxs(t.Fragment,{children:[t.jsx(Gs,{}),t.jsxs(Vs,{onClick:w,children:[p&&t.jsx(c.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&t.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t.jsxs(t.Fragment,{children:[t.jsx(Gs,{}),t.jsxs(Vs,{onClick:()=>e.onDuplicate?.(e.id),children:[t.jsx(c.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t.jsxs(Vs,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[t.jsx(c.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&s]})]})}function hp({config:e,queryUrl:a,className:r}){return t.jsxs("div",{className:jr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t.jsxs("p",{className:"mt-2 text-xs",children:[a&&t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),a&&e.canUpdate&&t.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function xp({panelType:e,className:a}){const r=e===zm.Burndown;return t.jsxs("div",{className:jr("flex flex-1 flex-col items-center justify-center gap-2 p-4",a),children:[t.jsx(Es,{className:"h-10 w-10 text-muted-foreground/40"}),r&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function fp({hasRemovedColumn:a=!1,className:r}){return t.jsxs("div",{className:jr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),t.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function gp({onRemove:e,className:a}){return t.jsxs("div",{className:jr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",a),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&t.jsx("p",{className:"mt-2 text-xs",children:t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const bp={[Tm.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Tm.Sum]:"Sum",[Tm.Average]:e.t("dashboard_average"),[Tm.DistinctCount]:e.t("dashboard_distinct_count"),[Tm.Max]:e.t("dashboard_max_value"),[Tm.Min]:e.t("dashboard_min_value")};function vp({config:e,state:a,value:r,label:s,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:c,className:d}){const{t:u}=y.useTranslation(),m=s??bp[e.aggregationType??""]??"",p=function(e,t){if(null==e)return"—";const a=ap.includes(t.field),r=t.aggregationType===Tm.Count||t.aggregationType===Tm.DistinctCount;return a&&!r?cp.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(r,e);return t.jsxs("div",{className:jr("flex h-full flex-col",d),children:[t.jsx(pp,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:c}),a===Gm.Loading&&t.jsx(xp,{}),a===Gm.Loaded&&t.jsxs("div",{className:jr("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[t.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),a===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),a===Gm.Error&&t.jsx(hp,{config:e,queryUrl:l}),a===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function yp({config:e,state:a,htmlContent:r,viewOnly:s=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const c=r??e.textTypeString??"";return t.jsxs("div",{className:jr("flex h-full flex-col",l),children:[t.jsx(pp,{config:e,viewOnly:s,onRefresh:n,queryUrlBuilder:i}),a===Gm.Loading&&t.jsx(xp,{}),a===Gm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),a===Gm.Error&&t.jsx(hp,{config:e,queryUrl:o})]})}function wp({config:e,state:r,data:s=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=a.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=a.useCallback(e=>{if(i)i(e);else if(m){const t=op(e);t&&window.open(np(t),"_blank")}},[i,m]);return t.jsxs("div",{className:jr("flex h-full flex-col",p),children:[t.jsx(pp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Gm.Loading&&t.jsx(xp,{}),r===Gm.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:t.jsx("tr",{children:h.map(e=>t.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),t.jsx("tbody",{children:s.map((e,a)=>{const r=m&&!!op(e);return t.jsx("tr",{className:jr("border-b border-border/50 transition-colors hover:bg-muted/30",(r||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(a=>t.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:a.render?a.render(e[a.columnName],e):jp(e[a.columnName],a)},a.columnName))},a)})})]})}),r===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),r===Gm.Error&&t.jsx(hp,{config:e,queryUrl:d}),r===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function jp(e,t){return null==e?"":e instanceof Date?"datetime"===t.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const Np=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function _p({config:e,variant:r,state:s,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:c,viewOnly:d=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:Np,b=a.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),v="bar"===r,y="stacked-column"===r,w=a.useMemo(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t.jsxs("div",{className:jr("flex h-full flex-col",f),children:[t.jsx(pp,{config:e,viewOnly:d,onRefresh:m,onExport:p,queryUrlBuilder:x}),s===Gm.Loading&&t.jsx(xp,{}),s===Gm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:Cp({variant:r,data:n,series:b,colors:g,categoryKey:l,isHorizontalBar:v,isStacked:y,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),s===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),s===Gm.Error&&t.jsx(hp,{config:e,queryUrl:h}),s===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Cp({variant:e,data:a,series:r,colors:s,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:c,onPointClick:d}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=t.jsx(q.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=t.jsx(q.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=t.jsx(q.Tooltip,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=r.length>1?t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=d?(e,t)=>d(a[t],t):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t.jsxs(q.BarChart,{data:a,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||s[a%s.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:d?"pointer":void 0},e.dataKey))]}):"area"===e?t.jsxs(q.AreaChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>{const r=e.color||s[a%s.length];return t.jsx(q.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:d?"pointer":void 0}},e.dataKey)})]}):t.jsxs(q.LineChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||s[a%s.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:d?"pointer":void 0}},e.dataKey))]})}const kp=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function Sp({config:e,state:r,data:s=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:kp,h=a.useMemo(()=>s.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[s]),x=a.useMemo(()=>h.reduce((e,t)=>e+(t.value??0),0),[h]);return t.jsxs("div",{className:jr("flex h-full flex-col",m),children:[t.jsx(pp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Gm.Loading&&t.jsx(xp,{}),r===Gm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.PieChart,{children:[t.jsx(q.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:t})=>`${e??""}: ${(100*(t??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,t)=>i(s[t],t):void 0,cursor:i?"pointer":void 0,children:h.map((e,a)=>t.jsx(q.Cell,{fill:p[a%p.length]},a))}),t.jsx(q.Tooltip,{formatter:e=>{const t="number"==typeof e?e:0,a=x>0?(t/x*100).toFixed(1):"0";return`${t.toLocaleString("pt-BR")} (${a}%)`}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),r===Gm.Error&&t.jsx(hp,{config:e,queryUrl:d}),r===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Ap({config:e,state:r,data:s=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:c,onExport:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=a.useMemo(()=>{const e=[...s].sort((e,t)=>(t.value??0)-(e.value??0)),t=e.reduce((e,t)=>e+(t.value??0),0);let a=0;return e.map(e=>(a+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:t>0?Math.round(a/t*100):0}))},[s]);return t.jsxs("div",{className:jr("flex h-full flex-col",p),children:[t.jsx(pp,{config:e,viewOnly:i,onRefresh:c,onExport:d,queryUrlBuilder:m}),r===Gm.Loading&&t.jsx(xp,{}),r===Gm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),t.jsx(q.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:(e,t)=>"% Acumulado"===t?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,t)=>l(s[t],t):void 0,cursor:l?"pointer":void 0}),t.jsx(q.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),r===Gm.Error&&t.jsx(hp,{config:e,queryUrl:u}),r===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Tp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:c,queryUrl:d,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=s??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return t.jsxs("div",{className:jr("flex h-full flex-col",m),children:[t.jsx(pp,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:u}),a===Gm.Loading&&t.jsx(xp,{panelType:zm.Burndown}),a===Gm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.AreaChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),t.jsx(q.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),a===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),a===Gm.Error&&t.jsx(hp,{config:e,queryUrl:d}),a===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Dp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=s??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return t.jsxs("div",{className:jr("flex h-full flex-col",p),children:[t.jsx(pp,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:m}),a===Gm.Loading&&t.jsx(xp,{}),a===Gm.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.BarChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),t.jsx(q.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:c?(e,t)=>c(r[t],t):void 0,cursor:c?"pointer":void 0}),t.jsx(q.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),a===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),a===Gm.Error&&t.jsx(hp,{config:e,queryUrl:u}),a===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Ep({config:e,state:r,rule:s,risks:n=[],matrixViewType:o=$m.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=a.useMemo(()=>[...s?.parametersY??[]].sort((e,t)=>t.position-e.position),[s?.parametersY]),x=s?.parametersX??[],f=a.useMemo(()=>{const e={};return n.forEach(t=>{const a=`${t.parameterYPosition}-${t.parameterXPosition}`;e[a]||(e[a]=[]),e[a].push(t)}),e},[n]);return t.jsxs("div",{className:jr("flex h-full flex-col",p),children:[t.jsx(pp,{config:e,viewOnly:i,onRefresh:d,queryUrlBuilder:m}),r===Gm.Loading&&t.jsx(xp,{}),r===Gm.Loaded&&s&&t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:s.name_y})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex mb-1",children:[t.jsx("div",{className:"w-16 shrink-0"}),t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.threat_strategy_type_name}),!s.disable_opportunities&&t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.opportunity_strategy_type_name})]}),h.map((e,a)=>t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((r,n)=>{const i=((e,t)=>f[`${t.position}-${e.position}`]??[])(r,e),d=((e,t)=>s?.colorMatrix?.[t]?.[e]??"hsl(var(--muted))")(n,a);return t.jsxs("div",{className:jr("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||c)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:d},onClick:()=>i.length>0&&l?.(r,e,i),children:[o===$m.Quantity&&i.length>0&&t.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===$m.AllRisksList&&i.map(e=>t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:t=>{t.stopPropagation(),c?.(e)},children:e.code})}),t.jsxs(Js,{className:"max-w-[250px]",children:[t.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",t.jsx("strong",{children:e.analysisDate})]}),e.strategy&&t.jsxs("p",{className:"text-xs",children:["Estratégia: ",t.jsx("strong",{children:e.strategy})]}),e.resultName&&t.jsxs("p",{className:"text-xs",children:["Criticidade: ",t.jsx("strong",{style:{backgroundColor:d},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},r.position)})]},e.position)),t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>t.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),t.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:s.name_x})]})]})}),r===Gm.NoData&&t.jsx(fp,{hasRemovedColumn:e.hasRemovedColumn}),r===Gm.Error&&t.jsx(hp,{config:e,queryUrl:u}),r===Gm.Unavailable&&t.jsx(gp,{onRemove:()=>e.onRemove?.(e.id)})]})}const Pp=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Pp.Translate.toString(e),Pp.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function Mp(e){switch(Number(e)){case zm.Area:case zm.Bar:case zm.Column:case zm.Line:case zm.Numeric:case zm.Pie:case zm.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Ip({panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=a.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*s+(e.sizeY-1)*n+"px",transform:Pp.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,r,s,n,u,m,p]);return t.jsxs("div",{ref:d,style:h,className:jr("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[t.jsx("div",{className:jr("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?c:{}}),t.jsx("div",{className:"h-full",children:i})]})}function Rp({panels:e,columns:r=8,cellHeight:s=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:c,className:d}){const[u,m]=a.useState(e);a.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=a.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=a.useMemo(()=>u.map(e=>e.id),[u]),f=a.useCallback(e=>{const{active:t,over:a}=e;if(!a||t.id===a.id)return;const r=u.findIndex(e=>e.id===t.id),s=u.findIndex(e=>e.id===a.id);if(-1===r||-1===s)return;const n=[...u],o={...n[r]},i={...n[s]},l=o.col,d=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=d,n[r]=o,n[s]=i,m(n),c?.(n)},[u,c]),g=a.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${h}, ${s}px)`,gap:`${n}px`}),[r,h,s,n]);return 0===u.length?t.jsxs("div",{className:jr("flex flex-col items-center justify-center py-16 text-center",d),children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):t.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:t.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:t.jsx("div",{style:g,className:jr("relative w-full",i&&"bg-muted/30",d),children:u.map(e=>t.jsx(Ip,{panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const Lp={[zm.Bar]:"bar",[zm.Column]:"column",[zm.StackedColumn]:"stacked-column",[zm.Area]:"area",[zm.Line]:"line",[zm.EvolutionLine]:"evolution-line"};function Fp({config:e,state:a,data:r,numericValue:s,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:c,matrixRule:d,matrixRisks:u,onPanelClick:m}){const p=Lp[e.typeId];if(p)return t.jsx(_p,{config:e,variant:p,state:a,data:o,series:i});switch(e.typeId){case zm.Numeric:return t.jsx(vp,{config:e,state:a,value:s});case zm.Text:return t.jsx(yp,{config:e,state:a});case zm.List:return t.jsx(wp,{config:e,state:a,data:r,columns:n??[]});case zm.Pie:return t.jsx(Sp,{config:e,state:a,data:r});case zm.Pareto:return t.jsx(Ap,{config:e,state:a,data:r});case zm.Burndown:return t.jsx(Tp,{config:e,state:a,data:l});case zm.PerformanceColumns:return t.jsx(Dp,{config:e,state:a,data:c});case zm.RiskMatrix:return t.jsx(Ep,{config:e,state:a,rule:d,risks:u??[]});default:return t.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function zp({dashboard:e,panels:r,pages:s,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:c,onRefresh:d,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:b,onLayoutChange:v,onPageChange:w,toolbarActions:j,className:N}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),S=e.idViewType===Om.Carousel,A=a.useMemo(()=>r,[r,S,n]),T=a.useMemo(()=>A.map(e=>{const t=Mp(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:t.x,minSizeY:t.y}}),[A]),D=a.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:b}),[o,f,g,b]),E=a.useCallback(()=>{C||l||(k(!0),d?.(),setTimeout(()=>k(!1),3e4))},[C,l,d]),P=a.useCallback(e=>{const a=A.find(t=>t.id===e);if(!a)return null;const r=D(a),s=c?.(e)??{state:Gm.Loaded};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx(pp,{config:r,onRefresh:()=>{}}),t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(Fp,{config:r,...s})})]})},[A,D,c,o,f,g,b]);return t.jsxs("div",{className:jr("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[j,d&&t.jsx("button",{onClick:E,disabled:C||l,className:jr("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&t.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?t.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):t.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&t.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&t.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:t.jsx("svg",{className:jr("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&s&&s.length>1&&t.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:s.map(e=>t.jsx("button",{onClick:()=>w?.(e.id),className:jr("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&t.jsx("div",{className:"flex justify-center py-3",children:t.jsxs("button",{onClick:x,className:jr("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&t.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:t.jsx(Rp,{panels:T,allowDragging:o,showGridLines:o,renderPanel:P,onLayoutChange:v})})]})}function Up(e,t=Vm.PtBr){const{t:a}=y.useTranslation();switch(t){case Vm.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case Vm.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function Op(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const Bp=[{value:Jm.All,label:"Todos"},{value:Jm.OnlyMine,label:e.t("dashboard_my")},{value:Jm.Favorites,label:"Favoritos"}];function qp({dashboards:e,limit:r,isLoading:s=!1,language:n=Vm.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:c,onEdit:d,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:b,toolbarExtra:v,className:w}){const{t:j}=y.useTranslation(),[N,_]=a.useState(""),[C,k]=a.useState(Jm.All),[S,A]=a.useState(null),T=a.useCallback(e=>{_(e),g?.(e)},[g]),D=a.useCallback(e=>{k(e),b?.(e)},[b]),E=a.useMemo(()=>{let t=e;if(N){const e=N.toLowerCase();t=t.filter(t=>t.code?.toLowerCase().includes(e)||Up(t,n).toLowerCase().includes(e)||t.responsibleName?.toLowerCase().includes(e))}switch(C){case Jm.OnlyMine:break;case Jm.Favorites:t=t.filter(e=>e.isFavorite)}return t},[e,N,C,n]);return t.jsxs("div",{className:jr("flex flex-col h-full",w),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),r&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.countDashboards,"/",r.maxDashboards,")"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative",children:[t.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"m21 21-4.3-4.3"})]}),t.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>T(e.target.value),className:jr("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),v,o&&h&&t.jsxs("button",{onClick:h,className:jr("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),t.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:Bp.map(e=>t.jsx("button",{onClick:()=>D(e.value),disabled:s,className:jr("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),s&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!s&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t.jsxs("tr",{children:[t.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:t.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),t.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),t.jsx("th",{className:"w-12 px-3 py-2"})]})}),t.jsxs("tbody",{children:[0===E.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),E.map(e=>t.jsxs("tr",{onClick:()=>c?.(e),className:jr("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[t.jsx("td",{className:"px-3 py-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsx("svg",{className:jr("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),t.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),t.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Up(e,n)}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),t.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:Op(e.lastModified)}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:jr("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),t.jsx("td",{className:"px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(null)}),t.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-1 border-t border-border"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Vp=[{value:Um.NotUpdate,label:e.t("dashboard_no_refresh")},{value:Um.FiveMinutes,label:"5 minutos"},{value:Um.TenMinutes,label:"10 minutos"},{value:Um.FifteenMinutes,label:"15 minutos"},{value:Um.ThirtyMinutes,label:"30 minutos"},{value:Um.OneHour,label:"1 hora"}],$p=[{value:Om.NormalPage,label:e.t("dashboard_normal_page")},{value:Om.Carousel,label:"Carrossel"}],Wp=[{value:Mm.FiveSeconds,label:"5 segundos"},{value:Mm.TenSeconds,label:"10 segundos"},{value:Mm.FifteenSeconds,label:"15 segundos"},{value:Mm.ThirtySeconds,label:"30 segundos"},{value:Mm.OneMinute,label:"1 minuto"},{value:Mm.ThreeMinutes,label:"3 minutos"},{value:Mm.FiveMinutes,label:"5 minutos"},{value:Mm.TenMinutes,label:"10 minutos"}],Hp=[{value:qm.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:qm.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:qm.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Gp=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Kp({dashboard:e,initialTab:r=Bm.General,isSaving:s=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:c=[],onSave:d,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=a.useState(r),[g,b]=a.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[v,w]=a.useState(e?.titlePtBr??""),[j,N]=a.useState(e?.titleEnUs??""),[_,C]=a.useState(e?.titleEsEs??""),[k,S]=a.useState(e?.responsibleId??""),[A,T]=a.useState(e?.isActive??!0),[D,E]=a.useState(e?.idUpdateTime??Um.NotUpdate),[P,M]=a.useState(e?.idViewType??Om.NormalPage),[I,R]=a.useState(e?.idPageTime??Mm.FifteenSeconds),[L,F]=a.useState(e?.idShare??qm.NotShared),[z,U]=a.useState(e?.groups??[]),[O,B]=a.useState(e?.places??[]),[q,V]=a.useState(e?.collaborators??[]),$=P===Om.Carousel,W=g["pt-br"]||g.en||g.es,H=a.useMemo(()=>!!W&&(!(g["pt-br"]&&!v.trim())&&(!(g.en&&!j.trim())&&!(g.es&&!_.trim()))),[W,g,v,j,_]),G=a.useCallback(e=>{b(t=>({...t,[e]:!t[e]}))},[]),K=a.useCallback(()=>{H&&!s&&d?.({titlePtBr:g["pt-br"]?v:"",titleEnUs:g.en?j:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:A,idUpdateTime:D,idViewType:P,idPageTime:$?I:null,idShare:L,groups:L===qm.SharedWithUsersGroupsPlacesCollaborators?z:[],places:L===qm.SharedWithUsersGroupsPlacesCollaborators?O:[],collaborators:L===qm.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[H,s,d,g,v,j,_,k,A,D,P,I,$,L,z,O,q]);return t.jsxs("div",{className:jr("flex flex-col h-full bg-background",m),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&t.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t.jsxs("button",{onClick:K,disabled:!H||s,className:jr("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[s?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t.jsxs("div",{className:"flex border-b border-border bg-card",children:[t.jsx("button",{onClick:()=>f(Bm.General),className:jr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Bm.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),t.jsx("button",{onClick:()=>f(Bm.Share),className:jr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===Bm.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===Bm.General&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),t.jsx("div",{className:"flex gap-2",children:Gp.map(e=>t.jsx("button",{onClick:()=>G(e.key),className:jr("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&t.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),t.jsx("input",{value:v,onChange:e=>w(e.target.value),maxLength:200,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[v.length,"/200"]})]}),g.en&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),t.jsx("input",{value:j,onChange:e=>N(e.target.value),maxLength:200,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[j.length,"/200"]})]}),g.es&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),t.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[t.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),t.jsx("select",{value:D,onChange:e=>E(Number(e.target.value)),disabled:n,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Vp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t.jsxs("div",{className:"flex items-center gap-3 h-10",children:[t.jsx("button",{onClick:()=>T(!A),disabled:e?.isGeneralViewUse,className:jr("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",A?"bg-primary":"bg-muted","disabled:opacity-50"),children:t.jsx("span",{className:jr("inline-block h-4 w-4 rounded-full bg-white transition-transform",A?"translate-x-6":"translate-x-1")})}),t.jsx("span",{className:"text-sm text-foreground",children:A?"Ativo":"Inativo"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),t.jsx("select",{value:P,onChange:e=>M(Number(e.target.value)),disabled:n||$,className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:$p.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),$&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),t.jsx("select",{value:I??"",onChange:e=>R(Number(e.target.value)),className:jr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Wp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===Bm.Share&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M12 16v-4"}),t.jsx("path",{d:"M12 8h.01"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),t.jsx("div",{className:"space-y-3",children:Hp.map(a=>t.jsxs("label",{className:jr("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",L===a.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"shareType",value:a.value,checked:L===a.value,onChange:()=>F(a.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:a.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})]},a.value))}),L===qm.SharedWithUsersGroupsPlacesCollaborators&&t.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),t.jsx("select",{multiple:!0,value:z,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);U(t)},className:jr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",O.length,")"]}),t.jsx("select",{multiple:!0,value:O,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);B(t)},className:jr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),t.jsx("select",{multiple:!0,value:q,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);V(t)},className:jr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:c.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Yp(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Qp(e,t){return{id:t?.id??Yp(),text:e,children:t?.children,collapsed:t?.collapsed,color:t?.color,icon:t?.icon,note:t?.note,side:t?.side}}function Xp(e,t){if(e.id===t)return{node:e,parent:null};const a=[];for(const r of e.children??[])a.push({node:r,parent:e});for(;a.length;){const e=a.pop();if(e.node.id===t)return{node:e.node,parent:e.parent};for(const t of e.node.children??[])a.push({node:t,parent:e.node})}return null}function Jp(e,t){const a=t(e);return a.children?.length?{...a,children:a.children.map(e=>Jp(e,t))}:a}function Zp(e,t,a){return Jp(e,e=>e.id===t?a(e):e)}function eh(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function th(e,t,a){const r=Qp(a||"");let s=r.id;return{root:Jp(e,a=>{if(a.id!==t)return a;let n=r;if(a.id===e.id){const t=eh(e);n={...n,side:t.left<=t.right?"left":"right"}}else n={...n,side:a.side};return s=n.id,{...a,collapsed:!1,children:[...a.children??[],n]}}),newId:s}}function ah(e,t,a){if(e.id===t)return th(e,t,a);const r=Xp(e,t);if(!r||!r.parent)return{root:e,newId:t};const s=r.parent,n=Qp(a||"",{side:r.node.side}),o=n.id;return{root:Jp(e,e=>{if(e.id!==s.id)return e;const a=(e.children??[]).findIndex(e=>e.id===t),r=[...e.children??[]];return r.splice(a+1,0,n),{...e,children:r}}),newId:o}}function rh(e,t){if(e.id===t)return{root:e,nextSelectedId:t};const a=Xp(e,t);if(!a||!a.parent)return{root:e,nextSelectedId:null};const r=a.parent,s=r.children??[],n=s.findIndex(e=>e.id===t),o=s[n+1]?.id??s[n-1]?.id??r.id;return{root:Jp(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==t)}),nextSelectedId:o}}function sh(e,t,a){if(t===a)return e;if(t===e.id)return e;if(function(e,t,a){const r=Xp(e,t);return!!r&&!!Xp(r.node,a)}(e,t,a))return e;const r=Xp(e,t);if(!r)return e;const s=(()=>{if(a===e.id){const t=eh(e);return{...r.node,side:t.left<=t.right?"left":"right"}}const t=Xp(e,a)?.node;return{...r.node,side:t?.side}})(),n=Jp(e,e=>e.children?.length&&e.children.some(e=>e.id===t)?{...e,children:e.children.filter(e=>e.id!==t)}:e);return Jp(n,e=>e.id!==a?e:{...e,collapsed:!1,children:[...e.children??[],s]})}function nh(e,t){return Zp(e,t,e=>({...e,collapsed:!e.collapsed}))}function oh(e,t){return Jp(e,a=>a.children?.length?a.id===e.id&&t?a:{...a,collapsed:t}:a)}function ih(e){const{value:t,defaultValue:r,onChange:s,readOnly:n}=e,o=void 0!==t,[i,l]=a.useState(()=>r??t??Qp("Mapa Mental",{id:"root"})),c=o?t:i,[d,u]=a.useState(c.id),m=a.useRef([]),p=a.useRef([]),h=a.useCallback((e,t)=>{n||(m.current.push(t),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),s?.(e))},[o,s,n]),x=a.useCallback((e,t)=>{const a=Zp(c,e,e=>({...e,text:t}));h(a,c)},[c,h]),f=a.useCallback((e,t)=>{const a=Zp(c,e,e=>({...e,...t}));h(a,c)},[c,h]),g=a.useCallback((e,t="")=>{const{root:a,newId:r}=th(c,e,t);return h(a,c),u(r),r},[c,h]),b=a.useCallback((e,t="")=>{const{root:a,newId:r}=ah(c,e,t);return h(a,c),u(r),r},[c,h]),v=a.useCallback(e=>{const{root:t,nextSelectedId:a}=rh(c,e);t!==c&&(h(t,c),u(a))},[c,h]),y=a.useCallback((e,t)=>{const a=sh(c,e,t);a!==c&&h(a,c)},[c,h]),w=a.useCallback(e=>{const t=Xp(c,e);if(!t||!t.node.children?.length)return;const a=nh(c,e);h(a,c)},[c,h]),j=a.useCallback(()=>{h(oh(c,!1),c)},[c,h]),N=a.useCallback(()=>{h(oh(c,!0),c)},[c,h]),_=a.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(c),o||l(e),s?.(e))},[c,o,s]),C=a.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(c),o||l(e),s?.(e))},[c,o,s]),k=m.current.length>0,S=p.current.length>0,A=a.useMemo(()=>d?Xp(c,d)?.node??null:null,[c,d]),T=a.useCallback(e=>{h(e,c)},[c,h]);return{root:c,setRoot:T,selectedId:d,selectedNode:A,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:b,removeNode:v,moveNode:y,toggleNode:w,expandAll:j,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const lh=180,ch=80,dh=16,uh=60;function mh(e){const t=(e.collapsed?[]:e.children??[]).map(mh);if(!t.length)return{node:e,visibleChildren:t,height:44};const a=t.reduce((e,t)=>e+t.height,0)+dh*(t.length-1);return{node:e,visibleChildren:t,height:Math.max(44,a)}}function ph(e,t,a,r,s,n,o){const i=[],l={node:e.node,parent:t,x:a,y:r,width:180,height:44,side:s,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let c=r+22-(e.visibleChildren.reduce((e,t)=>e+t.height,0)+dh*(e.visibleChildren.length-1))/2;for(const d of e.visibleChildren){const t="right"===s?a+180+ch:a-ch-lh,r=c+d.height/2-22,l=ph(d,e.node,t,r,s,n+1,o);i.push(l),c+=d.height+dh}return l}function hh(e){return a.useMemo(()=>function(e){const t=e.collapsed?[]:e.children??[],a=t.filter(e=>"left"!==e.side).map(mh),r=t.filter(e=>"left"===e.side).map(mh),s=a.reduce((e,t)=>e+t.height,0)+dh*Math.max(0,a.length-1),n=r.reduce((e,t)=>e+t.height,0)+dh*Math.max(0,r.length-1),o=Math.max(s,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=a.length?Math.max(...a.map(i))+1:0,c=260*(r.length?Math.max(...r.map(i))+1:0),d=220+260*l+c+120,u=o+120,m=uh+c,p=[],h={node:e,parent:null,x:m,y:uh+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=uh+o/2-s/2;for(const b of a){const t=x+b.height/2-22,a=ph(b,e,m+220+ch,t,"right",1,p);h.visibleChildren.push(a),x+=b.height+dh}let f=uh+o/2-n/2;for(const b of r){const t=f+b.height/2-22,a=ph(b,e,m-ch-lh,t,"left",1,p);h.visibleChildren.push(a),f+=b.height+dh}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:d,height:u}}(e),[e])}function xh(e,t){const{layout:a,selectedId:r,setSelectedId:s}=t;if(!r)return void s(a.nodes[0]?.node.id??null);const n=a.byId.get(r);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const t=n.visibleChildren.find(t=>t.side===e);return void(t&&s(t.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&s(e.node.id)}else n.parent&&s(n.parent.id);return}if(!n.parent)return;const o=a.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===r),c="up"===e?i[l-1]:i[l+1];c&&s(c.node.id)}const fh=({layout:e,selected:a,editing:r,readOnly:s,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,b=(v=f.icon)?ae[v]??null:null;var v;const y=!!f.children?.length,w=te.useRef(null),[j,N]=te.useState(f.text);te.useEffect(()=>{if(r){N(f.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[r,f.text]);const _=()=>{i(j.trim()||f.text)},C=f.color;return t.jsxs("div",{role:"treeitem","aria-selected":a,"aria-expanded":y?!f.collapsed:void 0,tabIndex:a?0:-1,"data-node-id":f.id,draggable:!s&&!g&&!r,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),s||o()},className:jr("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",a&&!g&&"ring-2 ring-primary ring-offset-1",a&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[b&&t.jsx(b,{className:jr("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),t.jsx("div",{className:"flex-1 min-w-0",children:r?t.jsx("input",{ref:w,value:j,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:jr("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?t.jsx("div",{className:"text-sm truncate",children:x(f)}):t.jsx("div",{className:"text-sm truncate",children:f.text||t.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!r&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:jr("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:t.jsx(c.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),t.jsx(Js,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&t.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:jr("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?t.jsx(c.Plus,{className:"h-3 w-3"}):"left"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3"}):t.jsx(c.Minus,{className:"h-3 w-3"})})]})},gh=({parent:e,child:a})=>{const r=a.x+a.width/2<e.x+e.width/2,s=r?e.x:e.x+e.width,n=e.y+e.height/2,o=r?a.x+a.width:a.x,i=a.y+a.height/2,l=(s+o)/2,c=`M ${s} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return t.jsx("path",{d:c,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},bh=({label:e,icon:a,onClick:r,disabled:s})=>t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:s,"aria-label":e,className:"h-8 w-8",children:a})}),t.jsx(Js,{children:e})]}),vh=e=>{const{t:a}=y.useTranslation();return t.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[t.jsx(bh,{label:a("mind_map_add_child"),icon:t.jsx(c.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),t.jsx(bh,{label:a("mind_map_add_sibling"),icon:t.jsx(c.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),t.jsx(bh,{label:a("mind_map_delete_node"),icon:t.jsx(c.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),t.jsx(Lr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(bh,{label:a("mind_map_expand_all"),icon:t.jsx(c.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),t.jsx(bh,{label:a("mind_map_collapse_all"),icon:t.jsx(c.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),t.jsx(Lr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(bh,{label:a("mind_map_zoom_out"),icon:t.jsx(c.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),t.jsx(bh,{label:a("mind_map_zoom_in"),icon:t.jsx(c.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),t.jsx(bh,{label:a("mind_map_fit_to_screen"),icon:t.jsx(c.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),t.jsx(Lr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(bh,{label:a("mind_map_undo"),icon:t.jsx(c.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),t.jsx(bh,{label:a("mind_map_redo"),icon:t.jsx(c.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),t.jsx("div",{className:"flex-1"}),t.jsx(bh,{label:a("mind_map_export_json"),icon:t.jsx(c.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),t.jsx(bh,{label:a("mind_map_export_image"),icon:t.jsx(c.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function yh(e){return JSON.stringify(e,null,2)}function wh(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const t=e;if("string"!=typeof t.text)throw new Error('Invalid mind map node: missing "text"');const a=Array.isArray(t.children)?t.children.map(e=>wh(e)):void 0;return Qp(t.text,{id:"string"==typeof t.id?t.id:void 0,collapsed:"boolean"==typeof t.collapsed?t.collapsed:void 0,color:"string"==typeof t.color?t.color:void 0,icon:"string"==typeof t.icon?t.icon:void 0,note:"string"==typeof t.note?t.note:void 0,side:"left"===t.side||"right"===t.side?t.side:void 0,children:a})}function jh({data:e,columns:r,sortField:s,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:d=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:b=!0,onColumnResize:v,enableColumnReorder:w=!1,onReorderColumns:j,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:A=!1,rowActionsVariant:T="default",hideActionsColumn:D=!1,actionsHeaderContent:E}){const{t:P}=y.useTranslation(),M=u||P("no_items_found",P("no_items_found_empty")),[I,R]=a.useState(()=>A?new Set(e.map(e=>e.id)):new Set),L=void 0!==k,F=L?new Set(k):I,z=a.useCallback(e=>{L&&S?S(e):R(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[L,S]),{columnWidths:U,isDragging:O,activeColumn:B,handleMouseDown:q}=li({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:v,enabled:b}),V=bi({enabled:w&&!!j,onReorder:j??(()=>{})}),$=a.useMemo(()=>{if(b){const e=r.map(e=>U[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return e.map(e=>e/t*100+"%")}const e=r.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return r.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const a=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${a}%)`:`${a}%`})},[r,b,U]);if(d)return t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,a)=>t.jsx(mn,{className:"h-12 w-full"},a))})});if(0===e.length)return t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-center text-muted-foreground",children:t.jsx("p",{children:M})})});const W=l&&!D,H=(p?1:0)+(_?1:0)+r.length+(W?1:0);return t.jsx("div",{className:"flex-1 overflow-auto "+(O?"select-none":""),children:t.jsxs(To,{className:jr("table-fixed w-full",m),children:[t.jsx(Do,{className:"sticky top-0 bg-background z-10",children:t.jsxs(Mo,{children:[_&&t.jsx(Io,{className:"w-[40px]"}),p&&t.jsx(Io,{className:"w-[40px]",children:t.jsx(ks,{checked:g,onCheckedChange:f,"aria-label":P("select_all","Selecionar todos")})}),r.map((e,a)=>{const r=b&&!1!==e.resizable,i=B===String(e.key),l=w&&!!j,d=l?V.getDragProps(a):{},u=V.dragFromIndex===a,m=V.dragOverIndex===a&&V.dragFromIndex!==a;return t.jsxs(Io,{className:jr(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&V.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:$[a]},...d,children:[!1!==e.sortable&&o?t.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),s!==p?null:"asc"===n?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}):t.jsx("span",{className:"font-medium",children:e.header}),r&&t.jsx(qo,{direction:"horizontal",onMouseDown:t=>q(String(e.key),t),isDragging:i})]},String(e.key));var p}),W&&t.jsx(Io,{className:"w-[80px] text-right",children:E??P("actions","Ações")})]})}),t.jsx(Eo,{children:e.map(e=>{const s=_&&F.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(Mo,{onClick:()=>i?.(e),className:jr(i?"cursor-pointer":"","relative","inline"===T&&"group"),children:[_&&t.jsx(Ro,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":s?P("collapse_row","Recolher linha"):P("expand_row","Expandir linha"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&t.jsx(Ro,{children:t.jsx(ks,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${P("select_all","Selecionar todos")} ${e.id}`})}),r.map(a=>t.jsx(Ro,{className:a.className,children:t.jsx(Bo,{children:a.render?a.render(e):String(e[a.key]??"-")})},String(a.key))),W&&t.jsx(Ro,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===T?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),s&&C&&t.jsx(Mo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Ro,{colSpan:H,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function Nh({searchValue:e="",onSearchChange:a,customFilters:r=[],onClearFilters:s,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||r.length>0;return t.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[a&&t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Sr,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>a(e.target.value),className:"pl-9 h-9"})]}),r.map((e,a)=>t.jsx("div",{className:"vertical"===o?"w-full":"",children:e},a)),n&&l&&s&&t.jsxs(Cr,{variant:"ghost",size:"sm",onClick:s,className:"h-9 px-3 whitespace-nowrap",children:[t.jsx(c.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function _h(e,t){const a=new Set;function r(e){if(e)for(const t of e)a.add(t.id),r(t.children)}return function e(a){for(const s of a){if(s.id===t)return r(s.children),!0;if(s.children&&e(s.children))return!0}return!1}(e),a}function Ch({children:e,itemId:a,enableDrag:r,onDragStartCell:s,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return t.jsx(Ro,{draggable:r,onDragStart:r?e=>s(a,e):void 0,onDragEnd:r?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(a,e)},className:l,children:e})}function kh({item:e,level:a,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*a,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),A=g===e.id&&f!==e.id,T=p?.has(e.id)??!1,D={itemId:e.id,enableDrag:x,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w};return t.jsxs(t.Fragment,{children:[t.jsxs(Mo,{className:jr(l&&"cursor-pointer",k&&"group",S&&"opacity-40",A&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[t.jsx(Ch,{...D,children:t.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&t.jsx(ks,{checked:T,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&t.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?t.jsx(c.ChevronDown,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})}):t.jsx("div",{className:"w-6 shrink-0"}),n??t.jsx(c.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate",children:String(e[s]??e.id)}),f===e.id&&j&&j>1&&t.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:j})]})}),r.map(r=>{const s=e[r.key],n=r.render?r.render(e,a):null!=s?String(s):"—";return t.jsx(Ch,{...D,className:jr("text-center",r.className),children:r.hoverContent?t.jsxs(Qc,{openDelay:200,children:[t.jsx(Xc,{asChild:!0,children:t.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),t.jsx(Jc,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):n},String(r.key))}),d&&t.jsx(Ch,{...D,className:"text-right",children:t.jsx("div",{onClick:e=>e.stopPropagation(),className:jr("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:d(e)})})]}),_&&N&&e.children.map(e=>t.jsx(kh,{item:e,level:a+1,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j},e.id))]})}function Sh({onDrop:a,isDragOver:r,onDragOver:s,onDragLeave:n,label:o}){return t.jsxs("div",{className:jr("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:s,onDragEnter:s,onDragLeave:n,onDrop:a,children:[t.jsx(c.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function Ah(e){const t=N.useNavigate();return{onNew:()=>{const a=e.newPath||`${e.basePath}/new`;t(a)},onEdit:a=>{const r=e.editPath?e.editPath.replace(":id",a.id):`${e.basePath}/${a.id}/edit`;t(r)}}}const Th="true"===(void 0).VITE_SHOW_EDIT_PROFILE,Dh=a.memo(({variant:e="card",className:r="",selectedUnit:s,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:d,isAuthenticated:u,logout:m,switchUnit:p}=Co(),{role:h}=Al(),x=h?.name||null,f=l?.[0]||null,g=d?l?.find(e=>e.alias===d):f,b=l||[],v=s||g||f||f,[w,j]=a.useState(0);a.useEffect(()=>{const e=()=>j(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const N=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48&v=${w}`},[i?.id,w]),_=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=96&v=${w}`},[i?.id,w]),C=a.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),k=a.useCallback(e=>{n?n(e):p(e)},[n,p]),S=a.useMemo(()=>{if(!b?.length)return[];const e=new Map;b.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),a=t.find(e=>e.alias===v?.alias),r=t.filter(e=>e.alias!==v?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),a?[a,...r]:r},[b,v?.alias]),[A,T]=a.useState(!1);if(!u||!i)return null;const D=()=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsxs(Xi,{className:"w-10 h-10",children:[N&&t.jsx(Ji,{src:N,alt:i.name||o("user_photo")}),t.jsx(Zi,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||t.jsx(c.User,{className:"h-5 w-5"})})]})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",v?.name||"N/A"]})]})]}),v&&t.jsx("div",{className:"mt-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(c.Building2,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:v.name})]})}),S.length>1&&t.jsxs("div",{className:"mt-2",children:[t.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>t.jsx(Ts,{variant:e.alias===v?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t.jsxs(Ts,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]});return"dropdown"===e?t.jsxs(t.Fragment,{children:[t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${r}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"hidden md:block text-right",children:[t.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),t.jsx("p",{className:"text-xs text-primary-foreground/70",children:v?.name||"N/A"})]}),t.jsxs(Xi,{className:"w-8 h-8 border border-primary-foreground/30",children:[N&&t.jsx(Ji,{src:N,alt:i.name||o("user_photo")}),t.jsx(Zi,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||t.jsx(c.User,{className:"h-4 w-4"})})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4"})]})})}),t.jsxs(qs,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t.jsxs(zs,{children:[t.jsxs(Os,{children:[t.jsx(c.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),t.jsx(Bs,{children:S.map(e=>t.jsxs(Vs,{onClick:()=>k(e),className:e.alias===v?.alias?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===v?.alias&&t.jsx(Ts,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Th&&t.jsxs(t.Fragment,{children:[t.jsx(Gs,{}),t.jsxs(Vs,{onClick:()=>T(!0),children:[t.jsx(c.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),t.jsx(Gs,{}),t.jsxs(Vs,{onClick:m,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),Th&&t.jsx(hl,{open:A,onOpenChange:T,user:i,userPhotoUrl:_,userInitials:C})]}):t.jsxs(Dr,{className:r,children:[t.jsx(Er,{children:t.jsx(Pr,{className:"text-lg",children:o("user_info")})}),t.jsxs(Ir,{className:"space-y-4",children:[t.jsx(D,{}),t.jsx(Lr,{}),t.jsxs(Cr,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),Eh=a.createContext({});function Ph({children:e,config:r}){const s=a.useMemo(()=>({navigation:r?.navigation,appName:r?.appName??void 0}),[r?.navigation,r?.appName]);return t.jsx(Eh.Provider,{value:s,children:e})}function Mh(){return a.useContext(Eh)}function Ih(e,t){if(!e)return"";const a=e.find(e=>e.path===t);if(a)return a.label;const r=e.find(e=>t.startsWith(e.path+"/"));return r?.label||""}function Rh(e,t){const[r,s]=a.useState(e),n=a.useRef(),o=a.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return a.useEffect(()=>(o(),n.current=setTimeout(()=>{s(e)},t),o),[e,t,o]),[r,o]}function Lh({appName:e}){const[r,s]=a.useState(!1),{association:n}=Al(),o=ot({isQualitfy:n?.isQualitfy,isMetroex:n?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:t.jsx("img",{src:o,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":!0,className:"h-7 w-px shrink-0 bg-primary-foreground/30"}),t.jsx("button",{className:"min-w-0 text-sm font-medium text-left cursor-pointer text-primary-foreground/90 hover:text-primary-foreground/70 transition-colors leading-tight py-1",onClick:()=>s(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]})]}),t.jsx(mc,{open:r,onOpenChange:s})]})}const Fh=a.memo(function({actions:r}){const s=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=Mh(),l=Ih(o,s.pathname),{metadata:d,headerActions:u}=gl(),{setOpenMobile:m}=Jd(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:b}=Co(),v=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,w]=N.useSearchParams(),j=a.useCallback(e=>{const{pathname:t,search:a,hash:r}=s;if(h){const s=t.split("/"),o=s.indexOf(h);if(o>=0)return s[o]=e.alias,void n(s.join("/")+a+r)}b(e)},[h,s,n,b]),[_,C]=a.useState(()=>y.get("search")||""),[k,S]=Rh(_,Ve.debounceDelay);a.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),w(e)},[k,w,x]);const A=o?.find(e=>e.path===s.pathname)||o?.find(e=>s.pathname.startsWith(e.path+"/")),T=d.title||l,D=d.subtitle||A?.complementaryText||"";return t.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Cr,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:t.jsx(c.Menu,{size:20})}),t.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:t.jsx(Lh,{appName:i})}),t.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t.jsxs("div",{className:"flex-shrink-0",children:[d.breadcrumbs&&d.breadcrumbs.length>0&&t.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:d.breadcrumbs.map((e,a)=>t.jsxs("span",{className:"flex items-center gap-1",children:[a>0&&t.jsx(c.ChevronRight,{className:"h-3 w-3"}),e.href?t.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):t.jsx("span",{children:e.label})]},a))}),t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:T})}),D&&t.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:D})]}),x&&t.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(Sr,{placeholder:"Pesquisar",value:_,onChange:e=>(e=>{C(e)})(e.target.value),className:"w-full pl-10 pr-8"}),_&&t.jsx(Cr,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),w(e)},title:e.t("clear_search"),children:t.jsx(c.X,{size:14})})]}),t.jsx(Cr,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:t.jsx(c.RefreshCw,{size:14})})]}),t.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||r)&&t.jsx("div",{className:"flex items-center gap-2",children:u||r}),(void 0).VITE_WIKI_URL&&t.jsx(Cr,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>xr((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),t.jsx(um,{}),t.jsx("div",{className:"text-sm",children:t.jsx(Dh,{variant:"dropdown",selectedUnit:v,onUnitChange:j})})]})]})})}),zh=({key:e,enabled:t,checkFn:a,staleTime:r=3e5,gcTime:s=6e5})=>j.useQuery({queryKey:["permission",e],queryFn:a,enabled:t,staleTime:r,gcTime:s,retry:0,refetchOnWindowFocus:!1});function Uh({config:e,isCollapsed:a=!1,isDisabled:r=!1,className:s}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=c.Plus,variant:d="button"}=e;if(!o||0===o.length)return null;if("split-button"===d){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(a){const a=t.jsx(Cr,{onClick:e.onClick,disabled:r||e.disabled,className:jr("justify-center px-2 w-full",s),variant:"outline",size:"default",children:t.jsx(n,{className:"h-4 w-4 shrink-0"})});return t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:a}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:e.label})})]})}return t.jsx(am,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:r||e.disabled,className:jr("w-full",s),menuAlign:"start"})}const u=(e,r,s=!1)=>t.jsxs(t.Fragment,{children:[e,!a&&r&&t.jsx("span",{className:"truncate",children:r}),!a&&s&&t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=r||e.disabled,c=t.jsx(Cr,{onClick:e.onClick,disabled:i,className:jr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return a?t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:c}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:e.label})})]}):c}const m=t.jsx(Cr,{disabled:r,className:jr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:a?t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:m}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:i})})]}):m}),t.jsx(qs,{align:"start",side:a?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const a=e.icon;return t.jsxs(Vs,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Oh="forlogic-sidebar-pinned",Bh=()=>{try{const e=localStorage.getItem(Oh);return!!e&&JSON.parse(e)}catch{return!1}};function qh({direction:e="right",minWidth:t=224,maxWidth:r=384,defaultWidth:s=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,c]=a.useState(()=>{if("undefined"==typeof window)return s;const e=localStorage.getItem(n);return e?parseInt(e):s}),[d,u]=a.useState(!1),m=a.useRef(null);a.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=a.useCallback(e=>{e.preventDefault(),u(!0)},[]);return a.useEffect(()=>{if(!d)return;const a=a=>{let s;s="left"===e?window.innerWidth-a.clientX:a.clientX,s=Math.max(t,Math.min(r,s)),c(s),o?.(s)},s=()=>{u(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s)}},[d,e,t,r,l,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d,e]),{width:l,isDragging:d,dragRef:m,handleMouseDown:p}}const Vh=a.createContext(void 0);function $h(){const e=a.useContext(Vh);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Wh({config:e,customContent:r,resizable:s=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:d,setOpenMobile:u}=Jd(),m=N.useLocation(),{alias:p,user:h}=Co(),{appName:x}=Mh(),{hasOpenModal:f}=$h(),[g,b]=a.useState(Bh),v=Ao(),w=!!v||l,j=a.useCallback(()=>{v&&u(!1)},[v,u]),_=s?qh({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;a.useEffect(()=>{d(!!g)},[g,d]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return t.jsxs(eu,{collapsible:"icon",className:jr("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:_&&w?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&t.jsx("div",{className:"py-3",children:t.jsx(Ys,{children:t.jsx(Uh,{config:e.moduleActions,isCollapsed:!w,isDisabled:f})})}),t.jsx(lu,{className:jr(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||t.jsx(cu,{className:"p-0",children:t.jsx(mu,{children:t.jsx(pu,{className:"gap-1",children:t.jsx(Ys,{children:e?.navigation?.map((e,a)=>{if("separator"===e.type)return t.jsx(iu,{className:"my-2"},`sep-${a}`);const r=({item:e,index:a})=>{const s=`${e.path}-${a}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=zh({key:s,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,d=o?c.Loader2:l?c.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?t.jsx(Ll,{defaultOpen:!0,className:"group/collapsible",children:t.jsxs(hu,{children:[t.jsx(Fl,{asChild:!0,children:t.jsx(fu,{size:"default",children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label}),t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),t.jsx(zl,{children:t.jsx(yu,{children:e.children.map((e,a)=>t.jsx(r,{item:e,index:a},e.path))})})]})},e.path):t.jsx(hu,{children:t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("div",{className:jr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path):t.jsx(hu,{children:l||o?t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:w?t.jsx(fu,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):w?t.jsx(fu,{asChild:!0,isActive:C(e.path),size:"default",children:t.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:j,children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(N.Link,{to:e.path,onClick:j,className:jr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path)};return t.jsx(r,{item:e,index:a},e.path)})})})})})}),!v&&t.jsx("div",{className:jr("mt-auto pb-4 pt-2 flex items-center gap-2",w?"justify-end px-1":"justify-center flex-col"),children:t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;b(e),(e=>{try{localStorage.setItem(Oh,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?t.jsx(c.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),t.jsx(Js,{side:"right",children:t.jsx("p",{children:l?"Recolher":"Expandir"})})]})}),s&&_&&w&&t.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:jr("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}function Hh(e){if("string"!=typeof e)return;return e.trim()||void 0}function Gh(){const{alias:e,isAuthenticated:t,isLoading:r,selectedUnit:s}=Co(),n=s?.id??null,o=!!qn.getAccessToken(),i=function(e,t){const a=Hh(t);if(a)return a;const r=qn,s=Hh(r.getCurrentCompanyId?.());if(s)return s;const n=qn.extractTokenData(),o=Hh(n?.companyId)??Hh(n?.company_id);if(o)return o;if(e){const t=Hh(qn.getCompanyId(e));if(t)return t}}(e,n),l=!!e&&!!t&&o,c=l&&!!i,[,d]=a.useReducer(e=>e+1,0);a.useEffect(()=>{if(!t||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[t,o,i]);let u=null;return r?u="Carregando autenticação...":t?e?o?i||(u="Aguardando unidade ativa..."):u="Aguardando token de acesso Qualiex...":u="Aguardando alias...":u="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!r,isAuthenticated:!!t,isReadyForQualiex:l,isReadyForQualiexWithCompany:c,isWaitingCompanyId:!!t&&o&&!i,waitingReason:u}}async function Kh(e,t){const a=await rl(`${el()}/api/common/v1/updates/userView/${t}`,e),r=await a.json(),s=r?.data??r;return Array.isArray(s)?s:[]}async function Yh(e,t,a,r){const s=void 0===r?"undefined":String(r),n={id:t,idUpdateType:a};void 0!==r&&(n.liked=r),await rl(`${el()}/api/common/v1/Updates/userVisualized/${a}/${s}`,e,{method:"POST",body:JSON.stringify(n)})}const Qh=3e5;function Xh(){const{alias:e,isReadyForQualiex:t}=Gh();return j.useQuery({queryKey:["user-updates","bar",e],queryFn:()=>Kh(e,1),enabled:t,staleTime:Qh})}function Jh(){const{alias:e,isReadyForQualiex:t}=Gh();return j.useQuery({queryKey:["user-updates","dialog",e],queryFn:()=>Kh(e,2),enabled:t,staleTime:Qh})}function Zh({item:e,onDismiss:a}){const{t:r}=y.useTranslation(),s=e.text||e.title,n=e.color||"hsl(var(--primary))";return t.jsxs("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:n},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[s,t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]}):t.jsx("span",{children:s}),t.jsx("button",{type:"button",onClick:()=>a(e.id),"aria-label":r("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:t.jsx(c.X,{className:"h-4 w-4"})})]})}function ex(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const a of t){const t=e.match(a);if(t)return t[1]}return null}function tx(e,t){const a=ex(e);if(!a)return e;return`https://www.youtube.com/embed/${a}${t?"?autoplay=1&mute=1":""}`}function ax(e){const t=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return t?t[1]:null}function rx(e,t){const a=ax(e);if(!a)return e;return`https://player.vimeo.com/video/${a}${t?"?autoplay=1&muted=1":""}`}function sx(e){if(!e)return;const t=e.match(/src="([^"]+)"/);return t?t[1]:void 0}function nx(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function ox({item:e,open:r,onClose:s}){const{t:n}=y.useTranslation(),[o,i]=a.useState(!1),[l,d]=a.useState(!1);a.useEffect(()=>{i(!1),d(!1)},[e.id]);const u=e.countLiked+(o?1:0);return t.jsx(Kr,{open:r,onOpenChange:e=>{e||s({liked:o,doNotShowAgain:l})},children:t.jsxs(es,{size:"md",children:[t.jsx(ts,{showSeparator:!0,children:t.jsx(ss,{style:e.color?{color:e.color}:void 0,children:e.title})}),t.jsxs(as,{children:[(()=>{const a=e.urlVideo??e.videoUrl??e.url??"",r=a?ex(a):null;return r?t.jsx("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),t.jsx("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t.jsxs(rs,{className:"!justify-between items-center",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>i(e=>!e),"aria-pressed":o,"aria-label":n("updates_dialog_like","Curtir"),className:jr("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",o?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:t.jsx(c.Heart,{className:jr("h-4 w-4",o&&"fill-current")})}),t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[t.jsx(ks,{checked:l,onCheckedChange:e=>d(!0===e)}),n("updates_dialog_do_not_show_again","Não exibir novamente")]}),t.jsx(Cr,{variant:"ghost",onClick:()=>s({liked:o,doNotShowAgain:l}),children:n("updates_dialog_close","Fechar")})]})]})]})})}function ix(e){return e&&e.trim()?e.trim():"anon"}function lx(e){try{const t=localStorage.getItem(e);if(!t)return new Set;const a=JSON.parse(t);return new Set(Array.isArray(a)?a.map(String):[])}catch{return new Set}}function cx(e,t){try{localStorage.setItem(e,JSON.stringify(Array.from(t)))}catch{}}function dx(e,t){if(!e)return e;const a=(t||"").trim().split(" ")[0]||"Colaborador";return e.replace(/@nome_usuario|@nome_usuário/g,a)}function ux(){const{alias:e}=Gh(),{user:r}=Co(),s=a.useMemo(()=>(r?.name||"").trim().split(" ")[0]||"Colaborador",[r?.name]),{data:n=[]}=Xh(),{data:o=[]}=Jh(),i=a.useMemo(()=>function(e){return`updates.bar.dismissed.${ix(e)}`}(e),[e]),l=a.useMemo(()=>function(e){return`updates.dialog.seen.${ix(e)}`}(e),[e]),[c,d]=a.useState(()=>lx(i)),[u,m]=a.useState(()=>lx(l)),[p,h]=a.useState(new Set),[x,f]=a.useState(0);if(a.useEffect(()=>{d(lx(i)),m(lx(l)),h(new Set),f(0)},[i,l]),!e)return null;const g=n.find(e=>!c.has(e.id)),b=o.filter(e=>!u.has(e.id)&&!p.has(e.id))[x],v=g&&{...g,title:dx(g.title,s),text:dx(g.text,s),description:dx(g.description,s)},y=b&&{...b,title:dx(b.title,s),description:dx(b.description,s)};return t.jsxs(t.Fragment,{children:[v&&t.jsx(Zh,{item:v,onDismiss:async t=>{const a=new Set(c);a.add(t),d(a),cx(i,a);try{await Yh(e,t,1)}catch{}}}),y&&t.jsx(ox,{item:y,open:!0,onClose:async({liked:t,doNotShowAgain:a})=>{if(!b)return;const r=b.id;if(!a)return h(e=>{const t=new Set(e);return t.add(r),t}),void f(0);const s=new Set(u);s.add(r),m(s),cx(l,s),f(0);try{await Yh(e,r,2,t)}catch{}}})]})}const mx=a.memo(function({children:e,sidebar:r,sidebarConfig:s,showHeader:n=!0,showSidebar:o=!0}){const i=a.useMemo(()=>o?r||t.jsx(Wh,{config:s}):null,[r,s,o]),l=a.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=a.useRef(null),d=a.useRef(null),u=a.useCallback(()=>{if(c.current&&d.current){const e=c.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return a.useEffect(()=>{u();const e=new ResizeObserver(u);return c.current&&e.observe(c.current),()=>e.disconnect()},[u]),t.jsx(Ph,{config:s,children:t.jsx(fl,{children:t.jsx(Zd,{defaultOpen:!1,style:l,children:t.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&t.jsxs("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[t.jsx(Fh,{}),t.jsx(ux,{})]}),t.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[i,t.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class px{static async sendEmail(e){const t=Zn(),{data:a,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return a}}const hx=px,xx=J.z.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),fx=J.z.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),gx=J.z.string().uuid("UUID inválido"),bx=J.z.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),vx=J.z.object({page:J.z.coerce.number().int().min(1).default(1),pageSize:J.z.coerce.number().int().min(1).max(500).default(50)});function yx(e){const[t,r]=a.useState(!1),{uploadFunction:s,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:c}=e||{};return{upload:async(e,t)=>{if(!s){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}r(!0);try{const a={...o,...t};if(a.maxSize&&e.size>a.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(a.maxSize/1024/1024)}MB`);if(a.allowedTypes){if(!a.allowedTypes.some(t=>t.endsWith("/*")?e.type.startsWith(t.replace("/*","")):e.type===t))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${a.allowedTypes.join(", ")}`)}const r=await s(e,a);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(r),r}catch(a){const e=a instanceof Error?a:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),c?.(e),e}finally{r(!1)}},deleteMedia:async(e,t)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,t),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(a){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),a}},uploading:t}}function wx(e,t){return e/t}const jx=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function Nx(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const t=e/1024;if(t<1024)return`${Math.round(t)} KB`;const a=t/1024;if(a<1024)return`${Math.round(a)} MB`;const r=a/1024;return Math.round(100*r)/100+" GB"}function _x(e){const t=e.lastIndexOf(".");return-1===t?"":e.substring(t+1).toLowerCase()}var Cx=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(Cx||{}),kx=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(kx||{}),Sx=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Sx||{});function Ax(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function Tx(e,t){if(!t)return!0;const a=null!=Ax(e)&&""!==Ax(e)&&!(Array.isArray(Ax(e))&&0===Ax(e).length);return!1!==e.isActive||a}function Dx({field:e}){return t.jsxs("div",{className:"space-y-1",children:[e.name&&t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&t.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Ex({field:e,readOnly:a,onChange:r}){const s=e.config,n=s?.multiline??!1,o=a||e.readOnly,i=t=>{r?.({...e,textValue:t})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?t.jsx(Ss,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):t.jsx(Sr,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function Px({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Sr,{type:"date",value:n,onChange:t=>{return a=t.target.value,void r?.({...e,dateValue:a||void 0});var a},placeholder:e.placeholder,disabled:s})]})}function Mx({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e=>{if(!e)return;const[t,a]=e.split(":").map(Number);return 60*t+a};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Sr,{type:"time",value:(e=>{if(null==e)return"";const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`})(e.timeValue),onChange:t=>r?.({...e,timeValue:n(t.target.value)}),placeholder:e.placeholder,disabled:s})]})}function Ix({field:e,readOnly:r,onChange:s}){const n=e.config,o=n?.multiple??!1,i=r||e.readOnly,[l,d]=a.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const t={value:crypto.randomUUID(),text:l.trim()};s?.({...e,itemsValue:[...u,t]}),d("")};if(!o){const a=u[0]?.text||"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Sr,{type:"url",value:a,onChange:t=>(t=>{const a={value:t,text:t};s?.({...e,itemsValue:t?[a]:[]})})(t.target.value),placeholder:e.placeholder||"https://",disabled:i}),a&&t.jsx(Cr,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:t.jsx(c.ExternalLink,{className:"h-4 w-4"})})})]})]})}return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Sr,{type:"url",value:l,onChange:e=>d(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),t.jsx(Cr,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:t.jsx(c.Plus,{className:"h-4 w-4"})})]}),u.length>0&&t.jsx("div",{className:"space-y-1",children:u.map((a,r)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("a",{href:a.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:a.text}),!i&&t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(t=>{const a=u.filter((e,a)=>a!==t);s?.({...e,itemsValue:a})})(r),children:t.jsx(c.Trash2,{className:"h-3 w-3"})})]},a.value))})]})}function Rx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=null!=s?.decimals&&s.decimals>0?(1/Math.pow(10,s.decimals)).toString():"1";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Sr,{type:"number",value:e.numberValue??"",onChange:t=>(t=>{if(""===t)return void r?.({...e,numberValue:void 0});const a=parseFloat(t);isNaN(a)||r?.({...e,numberValue:a})})(t.target.value),placeholder:e.placeholder,disabled:n,min:s?.min,max:s?.max,step:o}),null!=s?.min&&null!=s?.max&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",s.min," | Max: ",s.max]})]})}function Lx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??kx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=e.itemsValue?.[0]?.value||"",c=t=>{const a=i.find(e=>e.value===t);if(!a)return;const s={value:a.value,text:a.text,isActive:a.isActive};r?.({...e,itemsValue:[s]})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===kx.dropdown&&t.jsxs(fs,{value:l,onValueChange:c,disabled:n,children:[t.jsx(vs,{children:t.jsx(bs,{placeholder:e.placeholder||"Selecione..."})}),t.jsx(js,{children:i.map(e=>t.jsxs(_s,{value:e.value,children:[e.text,!1===e.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===kx.radio||o===kx.buttons)&&t.jsx(Rd,{value:l,onValueChange:c,disabled:n,className:jr(o===kx.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ld,{value:a.value,id:`${e.id}-${a.value}`}),t.jsxs(Tr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))}),!n&&l&&!e.required&&t.jsx("button",{type:"button",onClick:()=>{r?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Fx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??kx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(a=>t.jsxs(Ts,{variant:"secondary",className:"gap-1 pr-1",children:[t.jsx("span",{className:"text-xs",children:a.text}),!n&&t.jsx("button",{type:"button",onClick:()=>(t=>{const a=(e.itemsValue||[]).filter(e=>e.value!==t);r?.({...e,itemsValue:a})})(a.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:t.jsx(c.X,{className:"h-3 w-3"})})]},a.value))}),!n&&t.jsx("div",{className:jr(o===kx.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ks,{id:`${e.id}-${a.value}`,checked:l.has(a.value),onCheckedChange:()=>(t=>{const a=e.itemsValue||[],s=a.some(e=>e.value===t.value)?a.filter(e=>e.value!==t.value):[...a,{value:t.value,text:t.text,isActive:t.isActive}];r?.({...e,itemsValue:s})})(a),disabled:n}),t.jsxs(Tr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))})]})}function zx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.questions||[],i=s?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{children:e.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{className:jr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx("div",{className:"border rounded-md overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b bg-muted/50",children:[t.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>t.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),t.jsx("tbody",{children:o.map((a,s)=>t.jsxs("tr",{className:jr(s<o.length-1&&"border-b"),children:[t.jsx("td",{className:"p-2 text-muted-foreground",children:a.text}),i.map(s=>{return t.jsx("td",{className:"text-center p-2",children:t.jsx(Rd,{value:(o=a.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:t=>((t,a,s,n)=>{const o={questionValue:t,questionText:a,optionValue:s,optionText:n},i=l.filter(e=>e.questionValue!==t);i.push(o),r?.({...e,questionsValue:i})})(a.value,a.text,t,s.text),disabled:n,className:"flex justify-center",children:t.jsx(Ld,{value:s.value,id:`${e.id}-${a.value}-${s.value}`})})},s.value);var o})]},a.value))})]})})]})}function Ux({field:e,readOnly:a,onChange:r}){const s={field:e,readOnly:a,onChange:r};switch(e.type){case Cx.readOnlyText:return t.jsx(Dx,{...s});case Cx.text:return t.jsx(Ex,{...s});case Cx.date:return t.jsx(Px,{...s});case Cx.time:return t.jsx(Mx,{...s});case Cx.url:return t.jsx(Ix,{...s});case Cx.number:return t.jsx(Rx,{...s});case Cx.singleSelection:return t.jsx(Lx,{...s});case Cx.multiSelection:return t.jsx(Fx,{...s});case Cx.questions:return t.jsx(zx,{...s});default:return null}}function Ox({open:r,onOpenChange:s,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:c=[],setDefaultApproverOnInit:d=!0,onSubmit:u}){const[m,p]=a.useState(!0),[h,x]=a.useState(d&&n.length>0?n[0].id:null),[f,g]=a.useState(o),b=e=>{p(e),e&&!d?x(null):!e&&!d&&n.length>0&&x(n[0].id)},v=f!==o||!m;return t.jsx(Kr,{open:r,onOpenChange:s,children:t.jsxs(es,{className:"sm:max-w-[480px]",variant:"form",isDirty:v,children:[t.jsx(ts,{children:t.jsx(ss,{children:i})}),t.jsxs("div",{className:"space-y-4",children:[c.length>0&&t.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:c.map((e,a)=>t.jsx("p",{dangerouslySetInnerHTML:{__html:e}},a))}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>b(!0),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>b(!1),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{children:"Etapa"}),t.jsxs(fs,{value:h??void 0,onValueChange:x,disabled:m,children:[t.jsx(vs,{children:t.jsx(bs,{placeholder:e.t("approval_select_step")})}),t.jsx(js,{children:n.map(e=>t.jsx(_s,{value:e.id,children:e.name},e.id))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Tr,{children:e.t("approval_opinion")}),t.jsx(Ss,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),t.jsx(Cr,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!v,children:"Concluir"})]})]})})}function Bx({open:e,onOpenChange:r,approvers:s,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[c,d]=a.useState(null),u=a.useMemo(()=>{const e=new Set(o);return s.filter(t=>!e.has(t.id))},[s,o]),m=a.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return t.jsx(Kr,{open:e,onOpenChange:r,children:t.jsxs(es,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!c,children:[t.jsx(ts,{children:t.jsx(ss,{children:l("approval_select_approver")})}),t.jsx(Ps,{isLoading:n,type:"spinner",children:t.jsx("div",{className:"space-y-4",children:t.jsx(xn,{options:m,value:c??void 0,onValueChange:e=>d("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),t.jsx(Cr,{onClick:()=>{if(!c)return;const e=u.find(e=>e.id===c);e&&i(e)},disabled:!c||n,children:"Concluir"})]})]})})}function qx(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Vx({text:e,maxLength:r=130}){const{t:s}=y.useTranslation(),[n,o]=a.useState(!1);return e.length<=r?t.jsx("span",{children:e}):t.jsxs("span",{children:[n?e:`${e.substring(0,r)}... `,t.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:s(n?"approval_read_less":"approval_read_more")})]})}function $x({approver:e}){if(1===e.type&&e.approverId)return t.jsxs(Xi,{className:"h-9 w-9 shrink-0",children:[t.jsx(Ji,{src:e.photoUrl,alt:e.name}),t.jsx(Zi,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const a=2===e.type?c.Users:3===e.type?c.MapPin:c.User;return t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:t.jsx(a,{className:"h-4 w-4 text-background"})})}function Wx({approver:e}){return e.date?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[t.jsx(c.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:qx(e.date)}),1!==e.type&&e.approvedUsername&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[t.jsx(c.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:qx(e.returnDate)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function Hx({approver:e}){const{t:a}=y.useTranslation(),r=1!==e.type||e.approverId?e.name:"A definir";return t.jsxs("div",{children:[2===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:a("approval_user_group")}),3===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),t.jsx("p",{className:"text-sm font-medium break-words",children:r}),t.jsx(Wx,{approver:e})]})}var Gx=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(Gx||{});exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),exports.DialogPrimitive=se,Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AccordionPrimitive=ye,exports.AUTH_CONFIG=ze,exports.AccessDeniedDialog=pc,exports.Accordion=jc,exports.AccordionContent=Cc,exports.AccordionItem=Nc,exports.AccordionTrigger=_c,exports.ActionButton=kr,exports.ActionMenu=kr,exports.ActionMenuItems=si,exports.AggregationType=Tm,exports.Alert=Ki,exports.AlertDescription=Qi,exports.AlertDialog=Fr,exports.AlertDialogAction=Hr,exports.AlertDialogCancel=Gr,exports.AlertDialogContent=Br,exports.AlertDialogDescription=Wr,exports.AlertDialogFooter=Vr,exports.AlertDialogHeader=qr,exports.AlertDialogOverlay=Or,exports.AlertDialogPortal=Ur,exports.AlertDialogTitle=$r,exports.AlertDialogTrigger=zr,exports.AlertTitle=Yi,exports.AliasRedirect=function(){const{alias:e}=Co(),{pathname:a,search:r,hash:s}=N.useLocation();return e?t.jsx(N.Navigate,{to:`/${e}${a}${r}${s}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:r="alias"}){const s=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:c,switchUnit:d,companies:u}=Co(),{urlAlias:m,isAliasMismatch:p,isValidAlias:h,isMissing:x,matchedCompany:f}=Wi({paramName:r}),[g,b]=a.useState(!1),v=a.useRef(!1),y=r in o,w=a.useCallback(e=>{const t=o[r],{pathname:a,search:s,hash:i}=n;if(t){const r=a.split("/"),n=r.findIndex(e=>e===t);if(n>=0)return r[n]=e,r.join("/")+s+i}return`/${e}${"/"===a?"":a}${s}${i}`},[o,r,n]);return a.useEffect(()=>{if(y&&!c&&l&&i&&!v.current)if(x)s(w(i),{replace:!0});else if(!m||h){if(p&&f&&!v.current){(async()=>{v.current=!0,b(!0);try{await d(f)}catch(e){i&&s(w(i),{replace:!0})}finally{v.current=!1,b(!1)}})()}}else{if(!u||0===u.length)return;s(w(i),{replace:!0})}},[y,c,l,i,x,m,h,p,f,d,w,s,u]),c||!l?t.jsx(t.Fragment,{children:e}):g?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(Es,{size:"lg"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):t.jsx(t.Fragment,{children:e})},exports.AnalysisFunctionality=Dm,exports.AppHeader=Fh,exports.AppLayout=mx,exports.AppSidebar=Wh,exports.ApprovalFlowReturnStep=Gx,exports.ApprovalSidenav=function({config:e,isLoading:r=!1,onClose:s,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:d=!1}){const{t:u}=y.useTranslation(),[m,p]=a.useState(!1),[h,x]=a.useState(!1),[f,g]=a.useState(""),[b,v]=a.useState(""),[w,j]=a.useState(!1),[N,_]=a.useState(""),C=r||m,k=a.useCallback((e,t)=>{g(e),v(t??""),x(!0)},[]),S=a.useCallback(async t=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...t}))return k(f,t.observation),void p(!1);s(),p(!1)},[e.associationId,f,n,s,k]),A=a.useCallback(e=>{_(e),j(!0)},[]),T=a.useCallback(async t=>{j(!1),p(!0),await o(e.associationId,N,t),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),D=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],E=(t,a)=>e.canApprove&&t.isCurrentStep&&a.approverId&&!a.date&&a.canApprove,P=(t,a)=>!e.flowReproved&&t.isCurrentStep&&1===a.type&&a.canApprove&&(!a.approverId||a.isToBeDefined);return t.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[t.jsx(Cr,{variant:"ghost",size:"icon",onClick:s,className:"shrink-0",children:t.jsx(c.X,{className:"h-5 w-5"})}),t.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?t.jsx(Ps,{isLoading:!0,type:"spinner",className:"flex-1",children:t.jsx("div",{})}):t.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&t.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,a)=>t.jsx("div",{className:jr("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},a))}),t.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(a=>t.jsxs("div",{className:jr("space-y-2",(!a.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t.jsxs("p",{className:"font-semibold text-sm",children:[a.index,". Etapa: ",a.name]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground break-words",children:t.jsx(Vx,{text:a.description})}),a.returnDate&&t.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.returnUserName," em ",qx(a.returnDate)]})]}),a.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:t.jsx(Vx,{text:a.returnObservation})})]}),a.approvers.map(e=>t.jsxs("div",{className:"p-2 space-y-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx($x,{approver:e}),t.jsx(Hx,{approver:e})]}),E(a,e)&&t.jsx(Cr,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),P(a,e)&&t.jsx(Cr,{size:"sm",variant:"outline",onClick:()=>A(e.id),children:"Selecionar"})]}),e.observation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Vx,{text:e.observation})}),e.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Vx,{text:e.returnObservation})})]},e.id))]},a.id))]}),t.jsx(Ox,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:b,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),t.jsx(Bx,{open:w,onOpenChange:j,approvers:l,isLoading:d,ignoreUserIds:D,onSubmit:T})]})},exports.ApproveDialog=Ox,exports.AuthErrorInterceptor=so,exports.AuthProvider=_o,exports.AuthService=yo,exports.AutoComplete=xn,exports.Avatar=Xi,exports.AvatarFallback=Zi,exports.AvatarImage=Ji,exports.Badge=Ts,exports.BaseForm=Ii,exports.Blockquote=fd,exports.BodyContent=function({breadcrumbs:e,children:a,className:r}){return t.jsxs("div",{className:jr("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",r),children:[e&&e.length>0&&t.jsx(kc,{className:"mb-4",children:t.jsx(Sc,{children:e.map((a,r)=>{const s=r===e.length-1;return t.jsxs(te.Fragment,{children:[r>0&&t.jsx(Ec,{}),t.jsx(Ac,{children:s||!a.href?t.jsx(Dc,{children:a.label}):a.asChild&&a.children?t.jsx(Tc,{asChild:!0,children:a.children}):t.jsx(Tc,{asChild:!0,children:t.jsx(N.Link,{to:a.href||"/",children:a.label})})})]},`${a.label}-${r}`)})})}),t.jsx("div",{className:"space-y-6",children:a})]})},exports.Breadcrumb=kc,exports.BreadcrumbEllipsis=Pc,exports.BreadcrumbItem=Ac,exports.BreadcrumbLink=Tc,exports.BreadcrumbList=Sc,exports.BreadcrumbPage=Dc,exports.BreadcrumbSeparator=Ec,exports.BurndownPanel=Tp,exports.Button=Cr,exports.ButtonGroup=Ic,exports.CRUD_CONFIG=qe,exports.CURRENCY_FIELDS=ap,exports.Calendar=Lc,exports.CallbackPage=()=>{const{processCallback:e}=Co(),r=N.useNavigate(),[s,n]=a.useState(null),[o,i]=a.useState(!1);a.useEffect(()=>{let t=!1;if(Dn()){Nn.clear(),function(){if(jn&&"undefined"!=typeof PerformanceObserver&&!An)try{An=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration}),An.observe({type:"longtask",buffered:!0})}catch{}}(),Cn("callback:start");try{const e=qn.getAccessToken(),t=qn.getIdToken();if(e){Tn(0,e,Mn.parseJwtPayload(e))}if(t){Tn(0,t,Mn.parseJwtPayload(t))}}catch{}}const a=Dn()?window.setTimeout(()=>{t||Sn()},15e3):0;return(async()=>{try{const a=await e();if(t=!0,Dn()&&(Cn("callback:processCallback:end"),function(e,t,a){if(!jn)return null;try{return performance.measure(`auth:${e}`,`auth:${t}`,`auth:${a}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),Sn()),a){window.history.replaceState({},document.title,Ue("/"));const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),r(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){t=!0,Dn()&&Sn(),localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{a&&window.clearTimeout(a),function(){if(An){try{An.disconnect()}catch{}An=null}}()}},[e,r]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(t){n(t?.message||"Erro ao tentar novamente.")}finally{i(!1)}},d=()=>{window.location.href=Ue("/")};return s?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsxs(Pr,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[t.jsx(c.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t.jsxs(Ir,{className:"space-y-4",children:[t.jsx(Ki,{variant:"danger",children:t.jsx(Qi,{children:s})}),t.jsx("div",{className:"text-sm text-muted-foreground",children:t.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Cr,{onClick:l,disabled:o,className:"flex-1",children:o?t.jsxs(t.Fragment,{children:[t.jsx(Es,{size:"sm",className:"mr-2"}),"Tentando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),t.jsx(Cr,{onClick:d,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t.jsxs(Ir,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(Es,{size:"lg"})}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=Dr,exports.CardContent=Ir,exports.CardDescription=Mr,exports.CardFooter=Rr,exports.CardHeader=Er,exports.CardSkeleton=zo,exports.CardTitle=Pr,exports.CartesianPanel=_p,exports.ChartContainer=Vu,exports.ChartLegend=Gu,exports.ChartLegendContent=Ku,exports.ChartStyle=$u,exports.ChartTooltip=Wu,exports.ChartTooltipContent=Hu,exports.Checkbox=ks,exports.Collapsible=Ll,exports.CollapsibleContent=zl,exports.CollapsibleTrigger=Fl,exports.ColorPicker=Ci,exports.ColumnSettingsPopover=vi,exports.ComboTree=wn,exports.Combobox=xn,exports.Command=rn,exports.CommandDialog=({children:e,...a})=>t.jsx("div",{...a,children:t.jsx(rn,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=on,exports.CommandGroup=ln,exports.CommandInput=sn,exports.CommandItem=dn,exports.CommandList=nn,exports.CommandSeparator=cn,exports.CommandShortcut=un,exports.ContentContainer=function({title:e,subtitle:a,children:r,className:s,hasHeader:n=!0}){const o=e||a;return t.jsxs("div",{className:jr("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",s),children:[n&&o&&t.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&t.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),a&&t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:a})]}),r&&t.jsx("div",{className:jr("p-6",!n&&o&&"pt-4"),children:r})]})},exports.ContextMenu=Vo,exports.ContextMenuCheckboxItem=Zo,exports.ContextMenuContent=Xo,exports.ContextMenuGroup=Wo,exports.ContextMenuItem=Jo,exports.ContextMenuLabel=ti,exports.ContextMenuPortal=Ho,exports.ContextMenuRadioGroup=Ko,exports.ContextMenuRadioItem=ei,exports.ContextMenuSeparator=ai,exports.ContextMenuShortcut=ri,exports.ContextMenuSub=Go,exports.ContextMenuSubContent=Qo,exports.ContextMenuSubTrigger=Yo,exports.ContextMenuTrigger=$o,exports.CoreProviders=function({children:r,queryClient:s,moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i="common",signDocumentsTable:l="sign_documents",moduleAccessGuardProps:c,appTranslations:d,clarityProjectId:u,clarityMode:m="auto",backend:p="supabase",securityMode:h="legacy"}){Le(p),vc=h,gc();const[x]=a.useState(()=>new j.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=s??x;a.useEffect(()=>{if(d)for(const[e,t]of Object.entries(d))jl(e,t)},[d]);const g={sourceModule:n,...c};return t.jsxs(Bl,{children:[t.jsx(wc,{}),t.jsx(y.I18nextProvider,{i18n:e,children:t.jsx(j.QueryClientProvider,{client:f,children:t.jsxs(_o,{children:[t.jsx(yc,{projectId:u,mode:m}),t.jsx(Il,{children:t.jsxs(_l,{moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i,signDocumentsTable:l,children:[t.jsx(Dl,{}),t.jsx(xc,{...g,children:r})]})})]})})})]})},exports.CrudActionBar=hi,exports.CrudActionMenu=function({onEdit:e,onDelete:r,onToggleStatus:s,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:d="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=a.useMemo(()=>{const t=[];return e&&o&&t.push({key:"edit",icon:c.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),s&&t.push({key:"toggle-status",icon:n?c.PowerOff:c.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:s,variant:"default"}),l.forEach(e=>{!1!==e.show&&t.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),r&&i&&t.push({key:"delete",icon:c.Trash2,label:m("remove","Remover"),onClick:r,variant:"destructive"}),t},[e,r,s,n,o,i,l,m]);return 0===p.length?null:"dropdown"===d?t.jsx(Ys,{delayDuration:200,children:t.jsxs(Is,{children:[t.jsx(Rs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:t.jsx(c.EllipsisVertical,{size:"compact"===u?14:16})})}),t.jsx(qs,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t.jsxs(Zs,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t.jsxs(Vs,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):t.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>t.jsxs(Cr,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&t.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&t.jsx("span",{className:"ml-1",children:e.label})]},e.key))})},exports.CrudGrid=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:d,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:b=!1,searchValue:v,onSearchChange:w,searchPlaceholder:j,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:A,onViewModeChange:T,listCardRenderer:D,gridCardRenderer:E,showViewToggle:P=!1})=>{const{setSearchVisible:M}=Co(),I=void 0!==f?!f:g;a.useEffect(()=>{if(!b)return M(!0),()=>M(!1)},[M,b]);const R=m||x.length>0||b||u||C||P,L=_||(()=>{r.bulkDelete?.(r.selectedIds)}),F=A||"grid",z="list"===F,U={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],O=I&&R?t.jsx(hi,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:b,searchValue:v,onSearchChange:w,searchPlaceholder:j,showBulkActions:u,selectedCount:r.selectedIds.length,bulkActions:N,onBulkDelete:L,onClearSelection:r.clearSelection,customActions:x,filters:C,viewMode:F,onViewModeChange:T,showViewToggle:P,availableViewModes:["list","grid"]}):null;return r.isLoading?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx(zo,{count:6})})]}):0===r.entities.length?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Oo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx("div",{className:jr("grid gap-4",U),children:r.entities.map(e=>{const a=(e=>{const{t:t}=y.useTranslation();return z&&D?D(e):!z&&E?E(e):S?S(e):null})(e);return t.jsxs(Vo,{children:[t.jsx($o,{asChild:!0,children:a?t.jsx("div",{className:"cursor-pointer",onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:a}):t.jsx(Dr,{className:jr("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&r.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:t.jsxs(Ir,{className:jr("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&t.jsx("div",{className:jr(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:t.jsx(xi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),z?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:s.map(a=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key)))}),(n||o||c)&&t.jsx("div",{onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]}):t.jsxs("div",{className:"flex items-start gap-3",children:[u&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(xi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[s.map((a,r)=>t.jsxs("div",{className:jr("flex justify-between items-start gap-2",r!==s.length-1&&"mb-2"),children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||c)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]})]})]})})}),t.jsx(Xo,{className:"w-[160px]",children:t.jsx(si,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:d?d(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=qi,exports.CrudPagination=Li,exports.CrudPrimitiveFilterBar=Nh,exports.CrudPrimitivePagination=Ri,exports.CrudPrimitiveTable=jh,exports.CrudTable=wi,exports.CustomFormFields=function({fields:e,readOnly:r=!1,hideInactiveWithoutValue:s=!1,onChange:n,onFieldChange:o}){const i=a.useCallback(t=>{if(o?.(t),n){const a=e.map(e=>e.id===t.id?t:e);n(a)}},[e,n,o]),l=e.filter(e=>Tx(e,s));return 0===l.length?null:t.jsx("div",{className:"space-y-4",children:l.map(e=>t.jsx(Ux,{field:e,readOnly:r,onChange:i},e.id))})},exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=Za,exports.DEFAULT_DATETIME_FORMAT=ar,exports.DEFAULT_LOCALE=tr,exports.DEFAULT_TIMEZONE=rr,exports.DashboardForm=Kp,exports.DashboardFormTab=Bm,exports.DashboardFunctionality=Em,exports.DashboardGeneralView=function({dashboards:e,limit:r,generalView:s,language:n=Vm.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:c=!1,canEditStandard:d=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:b=!1,onOpen:v,onBackToList:y,onRefresh:w,onRefreshList:j,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:A,onAddPanel:T,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:P,onLayoutChange:M,onSearch:I,onQuickFilterChange:R,onSetGeneralView:L,viewState:F,onViewStateChange:z,listToolbarExtra:U,viewToolbarActions:O,className:B}){const[q,V]=a.useState({mode:"list"}),$=F??q,W=a.useCallback(e=>{z?z(e):V(e)},[z]),H=a.useMemo(()=>"view"===$.mode||"edit"===$.mode||"share"===$.mode?e.find(e=>e.id===$.dashboardId)??null:null,[e,$]),[G,K]=a.useState(!1),[Y,Q]=a.useState(m[0]?.id);a.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),a.useEffect(()=>{if("view"!==$.mode||!H||H.idViewType!==Om.Carousel||m.length<=1)return;const e=function(e){switch(e){case Mm.FiveSeconds:return 5e3;case Mm.TenSeconds:return 1e4;case Mm.FifteenSeconds:return 15e3;case Mm.ThirtySeconds:return 3e4;case Mm.OneMinute:return 6e4;case Mm.ThreeMinutes:return 18e4;case Mm.FiveMinutes:return 3e5;case Mm.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),t=setInterval(()=>{Q(e=>{const t=(m.findIndex(t=>t.id===e)+1)%m.length;return m[t]?.id})},e);return()=>clearInterval(t)},[$,H,m]);const X=a.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),v?.(e)},[W,v]),J=a.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=a.useCallback(()=>{W({mode:"create"})},[W]),ee=a.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),te=a.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),ae=a.useCallback(e=>{"edit"===$.mode||"share"===$.mode?C?.($.dashboardId,e):_?.(e)},[$,_,C]),re=a.useCallback(()=>{"edit"===$.mode||"share"===$.mode?W({mode:"view",dashboardId:$.dashboardId}):W({mode:"list"})},[$,W]),se=a.useCallback(()=>{H&&N?.(H)},[H,N]),ne=a.useCallback(()=>{H&&ee(H)},[H,ee]),oe=a.useCallback(()=>{H&&te(H)},[H,te]);return t.jsxs("div",{className:jr("flex flex-col h-full",B),children:["list"===$.mode&&t.jsx(qp,{dashboards:e,limit:r,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:c,onOpen:X,onEdit:ee,onShare:te,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:j,onSearch:I,onQuickFilterChange:R,toolbarExtra:U,className:"flex-1"}),"view"===$.mode&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[!G&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),s?.dashboardId===H.id&&t.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[t.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&L&&s?.dashboardId!==H.id&&t.jsx("button",{onClick:()=>L(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),t.jsx(zp,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||d&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:w,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:se,onEdit:ne,onShare:oe,onAddPanel:T,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:P,onLayoutChange:M,onPageChange:Q,toolbarActions:O,className:"flex-1"})]}),"create"===$.mode&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),t.jsx(Kp,{users:h,groups:x,places:f,collaborators:g,isSaving:b,onSave:ae,onCancel:re,className:"flex-1"})]}),("edit"===$.mode||"share"===$.mode)&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:re,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),t.jsx(Kp,{dashboard:H,initialTab:"share"===$.mode?Bm.Share:Bm.General,users:h,groups:x,places:f,collaborators:g,isSaving:b,isQualitfy:!!H.isStandard&&!d,onSave:ae,onCancel:re,className:"flex-1"})]})]})},exports.DashboardGrid=Rp,exports.DashboardLanguage=Vm,exports.DashboardList=qp,exports.DashboardListType=Pm,exports.DashboardPageTime=Mm,exports.DashboardPanelDimension=Im,exports.DashboardPanelOrderBy=Lm,exports.DashboardPanelOrderByType=Rm,exports.DashboardPanelPeriod=Fm,exports.DashboardPanelRenderer=Fp,exports.DashboardPanelType=zm,exports.DashboardShareType=qm,exports.DashboardUpdateTime=Um,exports.DashboardView=zp,exports.DashboardViewType=Om,exports.DataFilterBar=Nh,exports.DataList=Fc,exports.DataPagination=Ri,exports.DataTable=jh,exports.DatePicker=function({date:e,onDateChange:a,placeholder:r,disabled:s=!1,className:n,disabledDates:o,captionLayout:l,fromYear:d,toYear:u}){const{t:m}=y.useTranslation(),p=r??m("select_date");return t.jsxs(en,{children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",disabled:s,className:jr("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[t.jsx(c.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Xa}):t.jsx("span",{children:p})]})}),t.jsx(an,{className:"w-auto p-0",align:"start",children:t.jsx(Lc,{mode:"single",selected:e,onSelect:a,disabled:o,captionLayout:l,fromYear:d,toYear:u,initialFocus:!0,className:"pointer-events-auto"})})]})},exports.Dialog=Kr,exports.DialogBody=as,exports.DialogClose=Xr,exports.DialogContent=es,exports.DialogDescription=ns,exports.DialogFooter=rs,exports.DialogHeader=ts,exports.DialogOverlay=Jr,exports.DialogPortal=Qr,exports.DialogTitle=ss,exports.DialogTrigger=Yr,exports.DialogWizard=function({open:a,onOpenChange:r,currentStep:s,onStepChange:n,steps:o,canGoToStep:i,children:l,title:d,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:b="lg",unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=y.useTranslation(),T=o.length,D=s>=T,E=s<=1;return t.jsx(Kr,{open:a,onOpenChange:r,children:t.jsxs(es,{size:b,variant:f,isDirty:g,unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:jr("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[t.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),t.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,a)=>{const r=a+1,o=r===s,l=(e=>e<s)(r),d=(u=r)<=s||!i||i(u);var u;return t.jsxs("button",{type:"button",onClick:()=>(e=>{e!==s&&(e<s?n(e):i&&!i(e)||n(e))})(r),disabled:!d,className:jr("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&d&&"hover:bg-primary-foreground/10 cursor-pointer",!d&&"opacity-40 cursor-not-allowed"),children:[t.jsx("span",{className:jr("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?t.jsx(c.Check,{className:"h-3.5 w-3.5"}):r}),t.jsx("span",{className:jr("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},r)})})]}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsxs(ts,{className:"p-6 pb-0",children:[t.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",s," de ",T]}),t.jsx(ss,{children:d}),u&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),t.jsx(as,{className:"px-6",children:l}),!k&&t.jsx(rs,{className:"px-6 pb-6",children:t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("div",{className:"flex items-center gap-2",children:S}),t.jsxs("div",{className:"flex items-center gap-2",children:[!E&&t.jsx(Cr,{variant:"outline",onClick:()=>n(s-1),children:x}),D?t.jsx(Cr,{onClick:m,disabled:C,children:p}):t.jsx(Cr,{onClick:()=>n(s+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=Zs,exports.Drawer=zc,exports.DrawerClose=Bc,exports.DrawerContent=Vc,exports.DrawerDescription=Gc,exports.DrawerFooter=Wc,exports.DrawerHeader=$c,exports.DrawerOverlay=qc,exports.DrawerPortal=Oc,exports.DrawerTitle=Hc,exports.DrawerTrigger=Uc,exports.DropdownMenu=Is,exports.DropdownMenuCheckboxItem=$s,exports.DropdownMenuContent=qs,exports.DropdownMenuGroup=Ls,exports.DropdownMenuItem=Vs,exports.DropdownMenuLabel=Hs,exports.DropdownMenuPortal=Fs,exports.DropdownMenuRadioGroup=Us,exports.DropdownMenuRadioItem=Ws,exports.DropdownMenuSeparator=Gs,exports.DropdownMenuShortcut=Ks,exports.DropdownMenuSub=zs,exports.DropdownMenuSubContent=Bs,exports.DropdownMenuSubTrigger=Os,exports.DropdownMenuTrigger=Rs,exports.ECustomFormFieldType=Cx,exports.EFieldViewMode=kx,exports.ESelectionFieldDataSource=Sx,exports.EditProfileDialog=hl,exports.ElectronicSignatureDialog=function({open:r,onOpenChange:s,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:d=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,b=g?e.t("esign_password_description"):e.t("esign_code_description"),v=m??b,[y,w]=a.useState(""),[j,N]=a.useState(!1),[_,C]=a.useState(!1),[k,S]=a.useState(null),A=a.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(w(""),s(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,s,f,g]),T=a.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),D=e=>{e||(w(""),S(null)),s(e)},E=g?c.Lock:c.ShieldCheck,P=g?"Senha":e.t("verification_code"),M=g?e.t("enter_password"):e.t("enter_code");return t.jsx(Kr,{open:r,onOpenChange:D,children:t.jsxs(es,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[t.jsx(ts,{children:t.jsxs(ss,{className:"flex items-center gap-2",children:[t.jsx(E,{className:"h-5 w-5 text-primary"}),u]})}),t.jsxs("div",{className:"py-4 space-y-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:v}),!g&&l&&t.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[t.jsx(c.Mail,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),t.jsx("span",{className:"font-medium",children:l})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"signature-input",children:P}),t.jsx(Sr,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),A())},maxLength:g?void 0:d,placeholder:M,autoFocus:!0,className:jr(k&&"border-destructive focus-visible:ring-destructive")}),k&&t.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&t.jsxs(Cr,{variant:"ghost",size:"sm",onClick:T,disabled:_,className:"text-primary",children:[t.jsx(c.RefreshCw,{className:jr("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"outline",onClick:()=>D(!1),disabled:j,children:h}),t.jsx(Cr,{onClick:A,disabled:!y.trim()||j,children:j?"Validando...":p})]})]})})},exports.EllipsisText=Bo,exports.EmailService=px,exports.EmptyState=Oo,exports.EntitySelect=xn,exports.ErrorBoundary=Bl,exports.ExportDialog=function({open:e,onOpenChange:r,onExport:s,mode:n="table",options:o,title:i,description:l,cancelLabel:c="Cancelar",exportLabel:d="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=a.useState(""),h=o??("chart"===n?nm:sm),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),r(e)};return t.jsx(Kr,{open:e,onOpenChange:g,children:t.jsxs(es,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[t.jsx(ts,{children:t.jsx(ss,{children:x})}),t.jsxs("div",{className:"py-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),t.jsx(Rd,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ld,{value:e.value,id:`export-${e.value}`}),t.jsxs(Tr,{htmlFor:`export-${e.value}`,className:jr("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"outline",onClick:()=>g(!1),children:c}),t.jsx(Cr,{onClick:()=>{m&&(s(m),r(!1),p(""))},disabled:!m,children:d})]})]})})},exports.ExportFormat=rm,exports.FORBIDDEN_FILE_TYPES=jx,exports.FilePrintType=pm,exports.FileViewerType=mm,exports.FilterBar=Bi,exports.Form=os,exports.FormControl=ms,exports.FormDateField=Px,exports.FormDescription=ps,exports.FormField=({...e})=>t.jsx(is.Provider,{value:{name:e.name},children:t.jsx(h.Controller,{...e})}),exports.FormItem=ds,exports.FormLabel=us,exports.FormMessage=hs,exports.FormMultiSelectionField=Fx,exports.FormNumericField=Rx,exports.FormQuestionsField=zx,exports.FormSingleSelectionField=Lx,exports.FormSkeleton=function({fields:e=4}){return t.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,a)=>t.jsxs("div",{className:"space-y-2",children:[t.jsx(mn,{className:"h-4 w-24"}),t.jsx(mn,{className:"h-10 w-full"})]},a)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(mn,{className:"h-10 w-20"}),t.jsx(mn,{className:"h-10 w-20"})]})]})},exports.FormTextField=Ex,exports.FormTimeField=Mx,exports.FormUrlField=Ix,exports.Grid=function({children:e,cols:a="auto-fit",gap:r="md",className:s}){return t.jsx("div",{className:jr("grid",Kc[a],Yc[r],s),children:e})},exports.H1=od,exports.H2=id,exports.H3=ld,exports.H4=cd,exports.HeaderSkeleton=function(){return t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(mn,{className:"h-8 w-8 rounded-full"}),t.jsx(mn,{className:"h-6 w-32"})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(mn,{className:"h-8 w-8"}),t.jsx(mn,{className:"h-8 w-24"})]})]})},exports.HoverCard=Qc,exports.HoverCardContent=Jc,exports.HoverCardTrigger=Xc,exports.IconPicker=Di,exports.IframeDialog=vm,exports.ImageEditor=function({value:e,onChange:r,onSubmit:s,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:d}){const{t:u}=y.useTranslation(),[m,p]=a.useState(e||{alignment:"center",allowDownload:!1}),h=a.useRef(null),{upload:x,uploading:f}=yx({uploadFunction:o,deleteFunction:i,defaultOptions:{...d,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,t)=>{const a={...m,[e]:t};p(a),r(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"URL"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Sr,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await x(t),a={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(a),r(a)}catch(a){}finally{h.current&&(h.current.value="")}},className:"hidden"}),t.jsx(Cr,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:t.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:t.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"caption",children:"Legenda"}),t.jsx(Ss,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"alt",children:u("alt_text")}),t.jsx(Sr,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"Alinhamento"}),t.jsxs(fs,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[t.jsx(vs,{children:t.jsx(bs,{})}),t.jsxs(js,{children:[t.jsx(_s,{value:"left",children:"Esquerda"}),t.jsx(_s,{value:"center",children:"Centro"}),t.jsx(_s,{value:"right",children:"Direita"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"width",children:"Largura"}),t.jsx(Sr,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"height",children:"Altura"}),t.jsx(Sr,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ks,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),t.jsx(Tr,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(Cr,{variant:"outline",onClick:n,children:"Cancelar"}),t.jsx(Cr,{onClick:()=>{m.imageUrl?s(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:a="",style:r}){const{t:s}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return t.jsx("div",{className:`flex ${n} my-4 ${a}`,style:r,children:t.jsxs("div",{className:"space-y-2 max-w-full",children:[t.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&t.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[t.jsx(c.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=xd,exports.Input=Sr,exports.InputGroup=Zc,exports.InputGroupAddon=td,exports.InputGroupButton=rd,exports.InputGroupInput=sd,exports.InputGroupTextarea=nd,exports.LINK_PROPERTIES=rp,exports.LOGO_CONFIG=Je,exports.Label=Tr,exports.LanguageBootstrap=Dl,exports.Large=md,exports.Lead=ud,exports.List=gd,exports.ListPanel=wp,exports.LoadingState=Ps,exports.LocaleProvider=Il,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsx(Pr,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t.jsxs(Ir,{className:"text-center space-y-4",children:[t.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),t.jsx(Cr,{onClick:async()=>{We()?await yo.loginDev():yo.loginProd()},className:"w-full",size:"lg",children:We()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=Ze,exports.MODULES_DATA=oc,exports.MONTHS_MAP=tp,exports.MatrixRiskPanel=Ep,exports.MatrixViewType=$m,exports.Menubar=Tu,exports.MenubarCheckboxItem=Ru,exports.MenubarContent=Mu,exports.MenubarGroup=Cu,exports.MenubarItem=Iu,exports.MenubarLabel=Fu,exports.MenubarMenu=_u,exports.MenubarPortal=ku,exports.MenubarRadioGroup=Au,exports.MenubarRadioItem=Lu,exports.MenubarSeparator=zu,exports.MenubarShortcut=Uu,exports.MenubarSub=Su,exports.MenubarSubContent=Pu,exports.MenubarSubTrigger=Eu,exports.MenubarTrigger=Du,exports.MindMap=({value:e,defaultValue:r,onChange:s,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:c,className:d,height:u=600})=>{const{t:m}=y.useTranslation(),p=ih({value:e,defaultValue:r,onChange:s,readOnly:o}),h=hh(p.root),x=function(){const[e,t]=a.useState({x:0,y:0,scale:1}),r=a.useRef(!1),s=a.useRef({x:0,y:0,tx:0,ty:0}),n=a.useCallback(t=>{0!==t.button&&1!==t.button||(r.current=!0,s.current={x:t.clientX,y:t.clientY,tx:e.x,ty:e.y},t.currentTarget.setPointerCapture(t.pointerId))},[e.x,e.y]),o=a.useCallback(e=>{r.current&&t(t=>({...t,x:s.current.tx+(e.clientX-s.current.x),y:s.current.ty+(e.clientY-s.current.y)}))},[]),i=a.useCallback(e=>{if(r.current){r.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=a.useCallback((e,a,r)=>{t(t=>{const s=Math.min(2.5,Math.max(.3,t.scale+e));if(s===t.scale)return t;if(void 0===a||void 0===r)return{...t,scale:s};const n=s/t.scale;return{scale:s,x:a-(a-t.x)*n,y:r-(r-t.y)*n}})},[]),c=a.useCallback(()=>l(.15),[l]),d=a.useCallback(()=>l(-.15),[l]),u=a.useCallback(()=>t({x:0,y:0,scale:1}),[]),m=a.useCallback((e,a,r,s)=>{const n=Math.min((r-64)/e,(s-64)/a,1.5),o=Math.max(.3,n);t({scale:o,x:(r-e*o)/2,y:(s-a*o)/2})},[]),p=a.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),a=e.clientX-t.left,r=e.clientY-t.top;l(e.deltaY>0?-.1:.1,a,r)},[l]);return a.useEffect(()=>{const e=()=>r.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:t,zoomIn:c,zoomOut:d,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=te.useRef(null),g=te.useRef(null),b=te.useRef(null),[v,w]=te.useState(null),[j,N]=te.useState(null);te.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:t,containerRef:r,onStartEditing:s,readOnly:n,extraShortcuts:o}){a.useEffect(()=>{const a=a=>{const i=r.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=a.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const c={layout:t,selectedId:e.selectedId,setSelectedId:e.setSelectedId},d=e.selectedId;for(const t of o??[])if(t.key.toLowerCase()===a.key.toLowerCase()&&!!t.ctrl===(a.ctrlKey||a.metaKey)&&!!t.shift===a.shiftKey&&!!t.alt===a.altKey)return a.preventDefault(),void t.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((a.ctrlKey||a.metaKey)&&"z"===a.key.toLowerCase())return a.preventDefault(),void(a.shiftKey?e.redo():e.undo());if("ArrowUp"===a.key)return a.preventDefault(),void xh("up",c);if("ArrowDown"===a.key)return a.preventDefault(),void xh("down",c);if("ArrowLeft"===a.key)return a.preventDefault(),void xh("left",c);if("ArrowRight"===a.key)return a.preventDefault(),void xh("right",c);if(d){if(" "===a.key)return a.preventDefault(),void e.toggleNode(d);if("F2"===a.key){if(n)return;return a.preventDefault(),void s(d)}if(!n){if("Enter"===a.key&&!a.shiftKey)return a.preventDefault(),d===e.root.id?e.addChild(d,""):e.addSibling(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Insert"===a.key||"Tab"===a.key)return a.preventDefault(),e.addChild(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Delete"===a.key||"Backspace"===a.key){if(d===e.root.id)return;return a.preventDefault(),void e.removeNode(d)}}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,r,s,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||w(e)},readOnly:o,extraShortcuts:l});const _=te.useRef(!1);te.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:t,clientHeight:a}=e;t>0&&a>0&&h.width>0&&(x.fitTo(h.width,h.height,t,a),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,A=te.useRef(null),T=e=>t=>{if(o)return;const a=A.current;if(!a||a===e)return;const r=Xp(p.root,a);r&&Xp(r.node,e)||(t.preventDefault(),t.dataTransfer.dropEffect="move",N(e))},D=()=>N(null),E=e=>t=>{t.preventDefault();const a=A.current;N(null),A.current=null,a&&a!==e&&p.moveNode(a,e)};return t.jsx(Ys,{children:t.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:jr("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",d),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&t.jsx(vh,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");w(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void w(e)}const e=p.addSibling(C,"");w(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,t,a="application/json"){const r=new Blob([e],{type:a}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(yh(p.root),"mind-map.json")},onExportImage:async()=>{if(b.current)try{await async function(e,t="mind-map.png"){const a=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(a),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,n=new Image;await new Promise((e,t)=>{n.onload=()=>e(),n.onerror=()=>t(new Error("Failed to load SVG snapshot")),n.src=s});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const c=l.getContext("2d");if(!c)throw new Error("Canvas 2D context unavailable");c.fillStyle="#ffffff",c.fillRect(0,0,l.width,l.height),c.drawImage(n,0,0,l.width,l.height);const d=await new Promise(e=>l.toBlob(e,"image/png"));if(!d)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(d),m=document.createElement("a");m.href=u,m.download=t,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(b.current,"mind-map.png")}catch(e){}}}),t.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:t.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[t.jsx("svg",{ref:b,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(a=>t.jsx(gh,{parent:e,child:a},`${e.node.id}-${a.node.id}`)))}),h.nodes.map(e=>{return t.jsx(fh,{layout:e,selected:C===e.node.id,editing:v===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>w(e.node.id),onFinishEditing:t=>{null!==t&&p.renameNode(e.node.id,t),w(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(a=e.node.id,e=>{o||a===p.root.id||(A.current=a,e.dataTransfer.setData("text/plain",a),e.dataTransfer.effectAllowed="move")}),onDragOver:T(e.node.id),onDragLeave:D,onDrop:E(e.node.id),isDropTarget:j===e.node.id,renderNodeContent:c},e.node.id);var a})]})})]})})},exports.ModalStateProvider=function({children:e}){const[r,s]=a.useState(new Set),[n,o]=a.useState(!1),i=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.add(e),a})},[]),l=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.delete(e),a})},[]),c=a.useCallback(e=>{o(e)},[]),d=a.useMemo(()=>r.size>0||n,[r,n]),u=a.useMemo(()=>({openModals:r,hasOpenModal:d,registerModal:i,unregisterModal:l,setHasOpenModal:c}),[r,d,i,l,c]);return t.jsx(Vh.Provider,{value:u,children:e})},exports.ModuleAccessGuard=xc,exports.ModuleGrid=cc,exports.ModuleOfferContent=function({title:e,description:a,image:r,icon:s,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),d=n??l("want_to_know_more");return t.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(r||s)&&t.jsx("div",{className:"flex items-center justify-center",children:r?t.jsx("img",{src:r,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):s?t.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:t.jsx(s,{className:"h-12 w-12 text-primary"})}):null}),t.jsxs("div",{className:"space-y-3 max-w-lg",children:[t.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a})]}),i?t.jsx("div",{className:"w-full",children:i}):o?t.jsxs(Cr,{onClick:o,size:"lg",className:"gap-2",children:[t.jsx(c.Sparkles,{className:"h-4 w-4"}),d]}):null]})},exports.ModuleProvider=_l,exports.ModulesContent=dc,exports.ModulesDialog=mc,exports.ModulesFooterCards=nc,exports.MultiSelect=xn,exports.MultiselectPermissions=function({items:r,categories:s,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:d=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:b,onDisclaimerClick:v,className:w}){const[j,N]=a.useState(s[0]?.id??""),[_,C]=a.useState(""),[k,S]=a.useState([]),[A,T]=a.useState(!1),D=a.useMemo(()=>Nm(n[j]),[n,j]),E=a.useMemo(()=>function(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.inheritedIds?.forEach(e=>a.add(e));return a}(n[j]),[n,j]),P=a.useMemo(()=>r.filter(e=>D.has(e.id)),[r,D]),M=a.useMemo(()=>{const e=jm(_);return r.filter(t=>!D.has(t.id)&&!(e&&!jm(t.name).includes(e)))},[r,D,_]),I=a.useMemo(()=>{const e={};for(const t of s)e[t.id]=Nm(n[t.id]).size;return e},[s,n]),R=a.useCallback(e=>{N(e),S([]),C("")},[]),L=a.useCallback(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),F=a.useCallback(()=>{if(0===k.length)return;const e=[...n[j]??[]];for(const t of k){const a=r.find(e=>e.id===t),s=a?.group??"default",n=e.find(e=>e.context===s);n?n.allowedIds.includes(t)||(n.allowedIds=[...n.allowedIds,t]):e.push({context:s,allowedIds:[t],inheritedIds:[]})}o({...n,[j]:e}),S([]),C(""),T(!1)},[k,n,j,r,o]),z=a.useCallback(e=>{if(E.has(e))return;const t=(n[j]??[]).map(t=>({...t,allowedIds:t.allowedIds.filter(t=>t!==e)}));o({...n,[j]:t})},[n,j,E,o]);return l?t.jsxs("div",{className:jr("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[t.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),t.jsx("div",{className:"h-9 w-full bg-muted rounded"}),t.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):t.jsx("div",{className:jr("rounded-md border bg-muted/30",w),children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:d}),t.jsxs(fs,{value:j,onValueChange:R,children:[t.jsx(vs,{className:"h-9 text-sm",children:t.jsx(bs,{})}),t.jsx(js,{children:s.map(e=>t.jsx(_s,{value:e.id,children:t.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,I[e.id]>0&&t.jsx(Ts,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:I[e.id]})]})},e.id))})]})]}),!i&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(en,{open:A,onOpenChange:T,children:[t.jsx(tn,{asChild:!0,children:t.jsxs(Cr,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,t.jsx(c.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(an,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[t.jsx("div",{className:"p-2 border-b",children:t.jsxs("div",{className:"relative",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Sr,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),t.jsx(ki,{className:"max-h-[220px]",children:0===M.length?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):t.jsx("div",{className:"p-1",children:M.map(e=>{const a=k.includes(e.id);return t.jsxs("div",{className:jr("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",a&&"bg-accent/50"),onClick:()=>L(e.id),children:[t.jsx("div",{className:jr("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",a&&"bg-primary text-primary-foreground"),children:a&&t.jsx(c.Check,{className:"h-3 w-3"})}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&t.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),t.jsxs(Cr,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:F,children:[t.jsx(c.Plus,{className:"h-4 w-4"}),u]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:m}),t.jsx("div",{className:jr("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===P.length?t.jsx("span",{className:"text-sm text-muted-foreground",children:p}):t.jsx("div",{className:"flex flex-wrap gap-1.5",children:P.map(e=>{const a=E.has(e.id);return t.jsxs(Ts,{variant:a?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!a&&t.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:t.jsx(c.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",b&&v&&t.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:v,children:b})]})]})]})})},exports.Muted=hd,exports.NavigationMenu=bd,exports.NavigationMenuContent=Nd,exports.NavigationMenuIndicator=kd,exports.NavigationMenuItem=yd,exports.NavigationMenuLink=_d,exports.NavigationMenuList=vd,exports.NavigationMenuTrigger=jd,exports.NavigationMenuViewport=Cd,exports.NavigationProvider=Ph,exports.NumericPanel=vp,exports.OnboardingDialog=tm,exports.OnlineEditorDialog=function({open:e,onOpenChange:r,identifier:s,fileName:n,mode:o="edit",type:i="document",onClose:l,className:d}){const[u,m]=a.useState(!0),p=function(e,t="edit",a="document"){return`https://docs.google.com/${a}/d/${e}/${t}?usp=drivesdk?embedded=true&rm=demo`}(s,o,i);a.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=a.useCallback(()=>{l?.(),r(!1)},[l,r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,h]),t.jsx(Kr,{open:e,onOpenChange:r,children:t.jsxs(es,{className:jr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",d),children:[t.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),t.jsx("div",{className:"flex items-center ml-4 z-20",children:t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Js,{children:"Fechar"})]})})]}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?t.jsx(Es,{className:"h-14 w-14"}):t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Es,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=dd,exports.PageBreadcrumb=function({items:e,maxItems:a=3,className:r}){const s=e.length>a?[e[0],...e.slice(-(a-1))]:e,n=e.length>a;return t.jsx(kc,{className:r,children:t.jsx(Sc,{children:s.map((e,a)=>{const r=0===a,s=n&&1===a;return t.jsxs(Ac,{children:[!r&&t.jsx(Ec,{}),s&&t.jsxs(t.Fragment,{children:[t.jsx(Pc,{}),t.jsx(Ec,{})]}),e.isCurrentPage?t.jsx(Dc,{children:e.label}):t.jsx(Tc,{asChild:!0,children:t.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=fl,exports.Pagination=Sd,exports.PaginationContent=Ad,exports.PaginationEllipsis=Md,exports.PaginationItem=Td,exports.PaginationLink=Dd,exports.PaginationNext=Pd,exports.PaginationPrevious=Ed,exports.PaletteType=ep,exports.PanelError=hp,exports.PanelHeader=pp,exports.PanelItemsPerPanel=Wm,exports.PanelLoader=xp,exports.PanelNoData=fp,exports.PanelSortType=Hm,exports.PanelState=Gm,exports.PanelUnavailable=gp,exports.ParetoPanel=Ap,exports.PerformancePanel=Dp,exports.PiePanel=Sp,exports.PlanType=Ym,exports.Popover=en,exports.PopoverContent=an,exports.PopoverTrigger=tn,exports.Progress=Id,exports.ProtectedRoute=({children:r})=>{const{isAuthenticated:s,isLoading:n}=Co();if(a.useEffect(()=>{if(n)return;if(s)return;if(qn.isManualLogout())return void(window.location.pathname.endsWith("/login")||(window.location.href=Ue("/login")));const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const r=We(),o=Be(window.location.pathname),i=o+window.location.search+window.location.hash;["/","/login","/callback"].includes(o)||localStorage.setItem("auth_return_url",i);(async()=>{r?await yo.loginDev():yo.loginProd()})()},[s,n]),n&&!s)return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Carregando..."})}),t.jsxs(Ir,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!s){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Processando..."})}),t.jsxs(Ir,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Dr,{className:"w-full max-w-md",children:[t.jsx(Er,{className:"text-center",children:t.jsx(Pr,{className:"text-xl font-semibold",children:"Iniciando..."})}),t.jsxs(Ir,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:We()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return t.jsx(t.Fragment,{children:r})},exports.QUALIEX_CONFIG=Xe,exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=ho,exports.QualiexErrorInterceptor=oo,exports.QualiexUserField=Mi,exports.QueriesContextType=Qm,exports.QueriesShareType=Xm,exports.QuickFilterDashboard=Jm,exports.RadioGroup=Rd,exports.RadioGroupItem=Ld,exports.ReadOnlyTextField=Dx,exports.ReportRequestList=function({requests:e,isLoading:r=!1,onGetReportUrl:s,formatDate:n=Sm,labels:o,className:i}){const{t:l}=y.useTranslation(),d={...Cm,...o},[u,m]=a.useState(""),[p,h]=a.useState(!1),[x,f]=a.useState(""),[g,b]=a.useState(""),[v,w]=a.useState(null),j=a.useMemo(()=>{if(!u)return e;const t=km(u);return e.filter(e=>km(e.reportName).includes(t))},[e,u]),N=a.useCallback(async e=>{if(!v){w(e.id);try{const t=await s(e.id);t&&(f(t),b(e.reportName),h(!0))}finally{w(null)}}},[s,v]);return r?t.jsx("div",{className:jr("space-y-3",i),children:Array.from({length:5}).map((e,a)=>t.jsx(mn,{className:"h-12 w-full"},a))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:jr("space-y-3",i),children:[t.jsxs("div",{className:"relative max-w-sm",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Sr,{className:"pl-8 h-9 text-sm",placeholder:d.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),t.jsx(ki,{className:"rounded-md border",children:t.jsxs(To,{children:[t.jsx(Do,{children:t.jsxs(Mo,{children:[t.jsx(Io,{className:"min-w-[140px]",children:d.report}),t.jsx(Io,{className:"min-w-[150px]",children:d.status}),t.jsx(Io,{className:"min-w-[160px]",children:d.requestDate}),t.jsx(Io,{className:"min-w-[160px]",children:d.lastUpdate}),t.jsx(Io,{className:"min-w-[160px]",children:d.expirationDate}),t.jsx(Io,{className:"min-w-[140px]"})]})}),t.jsx(Eo,{children:0===j.length?t.jsx(Mo,{children:t.jsx(Ro,{colSpan:6,className:"text-center text-muted-foreground py-8",children:d.noResults})}):j.map(e=>{const a=function(e){const{t:t}=y.useTranslation();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),r=function(e,a){const{t:r}=y.useTranslation();switch(e){case 1:return{label:a.statusWaiting,icon:t.jsx(c.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:a.statusProcessing,icon:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:a.statusCompleted,icon:t.jsx(c.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:a.statusError,icon:t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:a.statusExpired,icon:t.jsx(c.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(a,d),s=3===a,o=5===a;return t.jsxs(Mo,{children:[t.jsx(Ro,{className:"font-medium",children:e.reportName}),t.jsx(Ro,{children:t.jsxs(Ts,{variant:r.variant,className:jr("gap-1",r.className),children:[r.icon,r.label]})}),t.jsx(Ro,{className:"text-sm",children:n(new Date(e.requestDate))}),t.jsx(Ro,{className:"text-sm",children:n(new Date(e.lastUpdate))}),t.jsx(Ro,{className:jr("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),t.jsx(Ro,{children:t.jsxs(Cr,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!s||v===e.id,onClick:()=>N(e),children:[v===e.id?t.jsx(c.Loader2,{className:"h-4 w-4 animate-spin"}):t.jsx(c.Eye,{className:"h-4 w-4"}),d.viewReport]})})]},e.id)})})]})})]}),t.jsx(vm,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ReportRequestStatus=_m,exports.ResizableHandle=({withHandle:e,className:a,...r})=>t.jsx(Ce.PanelResizeHandle,{className:jr("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(c.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=Fd,exports.ResizablePanelGroup=({className:e,...a})=>t.jsx(Ce.PanelGroup,{className:jr("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),exports.RichTextEditor=({value:r,onChange:s,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:d=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=a.useState("visual"),x=V.useEditor({extensions:[$.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:r||"",editable:!n,onUpdate:({editor:e})=>{s(e.getHTML())}});te.useEffect(()=>{x&&r!==x.getHTML()&&x.commands.setContent(r||"")},[r,x]);const f=a.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""!==t?x.chain().focus().extendMarkRange("link").setLink({href:t}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?t.jsxs("div",{className:jr("space-y-2",u),children:[l&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1",children:[t.jsxs(Cr,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[t.jsx(c.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t.jsxs(Cr,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[t.jsx(c.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t.jsxs(Cr,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[t.jsx(c.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),d&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",t.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&t.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[t.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[t.jsx(Qu,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:t.jsx(c.Heading1,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:t.jsx(c.Heading2,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:t.jsx(c.Heading3,{className:"h-4 w-4"})}),t.jsx(Xu,{}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:t.jsx(c.Bold,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:t.jsx(c.Italic,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:t.jsx(c.Underline,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:t.jsx(c.Strikethrough,{className:"h-4 w-4"})}),t.jsx(Xu,{}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:t.jsx(c.List,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:t.jsx(c.ListOrdered,{className:"h-4 w-4"})}),t.jsx(Xu,{}),t.jsx(Qu,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:t.jsx(c.Highlighter,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:t.jsx(c.Link,{className:"h-4 w-4"})}),t.jsx(Xu,{}),t.jsx(Qu,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:t.jsx(c.RemoveFormatting,{className:"h-4 w-4"})}),t.jsx(Xu,{}),t.jsx(Qu,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:t.jsx(c.Undo,{className:"h-4 w-4"})}),t.jsx(Qu,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:t.jsx(c.Redo,{className:"h-4 w-4"})})]}),t.jsx(V.EditorContent,{editor:x,className:jr("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&t.jsx("textarea",{value:r||"",onChange:e=>s(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&t.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:t.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:t.jsx("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.RiskCriticality=Zm,exports.SEARCH_CONFIG=Ve,exports.SUPPORTED_LOCALES=Ja,exports.ScrollArea=ki,exports.ScrollBar=Si,exports.Select=fs,exports.SelectApproverDialog=Bx,exports.SelectContent=js,exports.SelectGroup=gs,exports.SelectItem=_s,exports.SelectLabel=Ns,exports.SelectScrollDownButton=ws,exports.SelectScrollUpButton=ys,exports.SelectSearch=xn,exports.SelectSeparator=Cs,exports.SelectTrigger=vs,exports.SelectValue=bs,exports.Separator=Lr,exports.Sheet=zd,exports.SheetBody=Hd,exports.SheetClose=Od,exports.SheetContent=$d,exports.SheetDescription=Yd,exports.SheetFooter=Gd,exports.SheetHeader=Wd,exports.SheetOverlay=qd,exports.SheetPortal=Bd,exports.SheetTitle=Kd,exports.SheetTrigger=Ud,exports.Sidebar=eu,exports.SidebarActionTrigger=Uh,exports.SidebarContent=lu,exports.SidebarFooter=ou,exports.SidebarGroup=cu,exports.SidebarGroupAction=uu,exports.SidebarGroupContent=mu,exports.SidebarGroupLabel=du,exports.SidebarHeader=function({open:e,appName:r}){const[s,n]=a.useState(!1),{association:o}=Al(),i=ot({isQualitfy:o?.isQualitfy,isMetroex:o?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsx(nu,{className:"p-0 gap-0",children:e?t.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:i,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),r&&t.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(r)})})]}):t.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:t.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:it.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),t.jsx(mc,{open:s,onOpenChange:n})]})},exports.SidebarInput=su,exports.SidebarInset=ru,exports.SidebarLogo=Lh,exports.SidebarMenu=pu,exports.SidebarMenuAction=gu,exports.SidebarMenuBadge=bu,exports.SidebarMenuButton=fu,exports.SidebarMenuItem=hu,exports.SidebarMenuSkeleton=vu,exports.SidebarMenuSub=yu,exports.SidebarMenuSubButton=ju,exports.SidebarMenuSubItem=wu,exports.SidebarProvider=Zd,exports.SidebarRail=au,exports.SidebarSeparator=iu,exports.SidebarSkeleton=function(){return t.jsx("div",{className:"w-64 border-r bg-muted/10",children:t.jsxs("div",{className:"p-4",children:[t.jsx(mn,{className:"h-8 w-32 mb-6"}),t.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,a)=>t.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[t.jsx(mn,{className:"h-4 w-4"}),t.jsx(mn,{className:"h-4 w-20"})]},a))})]})})},exports.SidebarTrigger=tu,exports.SingleFileUpload=function({storedFile:e,customFileName:r,allowedExtensions:s,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:d=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:b,onFileReplace:v,onDownload:w,onView:j,className:N}){const{t:_}=y.useTranslation(),C=a.useRef(null),[k,S]=a.useState(null),[A,T]=a.useState(null),[D,E]=a.useState(!1),P=k||e,M=k?.name||e?.name||"",I=k?.size||e?.size;M&&_x(M);const R=r||M,L=l&&!k&&!!e,F=d&&!k&&!!e,z=!!A||!!f||p&&h&&!P,U=!!P,O=a.useCallback(e=>{if(jx.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(s?.length){const t=_x(e.name);if(!s.includes(t))return{type:"extension",message:n}}return null},[o,i,s,n]),B=a.useCallback(e=>{const t=e.target.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),S(null),void(C.current&&(C.current.value=""));T(null),S(t),g?.(t),C.current&&(C.current.value="")},[O,g]),q=a.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const t=e.dataTransfer.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),void S(null);T(null),S(t),g?.(t)},[x,O,g]),V=a.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),$=a.useCallback(()=>{v?.(),C.current?.click()},[v]),W=a.useCallback(()=>{S(null),T(null),b?.(),C.current&&(C.current.value="")},[b]),H=a.useCallback(async()=>{if(!D&&e&&w){E(!0);try{await w(e)}finally{E(!1)}}},[D,e,w]),G=a.useCallback(()=>{e&&j&&j(e)},[e,j]),K=a.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!A)return p&&h&&!P?_("required_field"):null;switch(A.type){case"extension":return A.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${Nx(o)}`;case"max-size":return`Tamanho máximo: ${Nx(i)}`;default:return _("file_error")}})();return t.jsxs("div",{className:jr("space-y-1",N),children:[t.jsx("div",{className:jr("rounded-md border border-dashed transition-colors",U&&"border-solid border-border",!U&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:U?t.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(c.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("p",{className:"text-xs truncate",children:R})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=I&&t.jsx("span",{className:"text-xs text-muted-foreground",children:Nx(I)}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[L&&w&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:D,onClick:H,children:t.jsx(c.Download,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Js,{children:"Download"})]}),F&&j&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:t.jsx(c.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Js,{children:"Visualizar"})]}),u&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:$,children:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Js,{children:"Substituir"})]}),m&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground"})})}),t.jsx(Js,{children:_("remove")})]})]})]})]}):t.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:q,onDragOver:V,children:[t.jsx(c.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),t.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",t.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&t.jsx("p",{className:"text-xs text-destructive",children:Y}),t.jsx("input",{ref:C,type:"file",className:"hidden",accept:s?.map(e=>`.${e}`).join(","),onChange:B,disabled:x})]})},exports.Skeleton=mn,exports.Slider=Nu,exports.Small=pd,exports.SonnerToaster=Ms,exports.Spinner=Es,exports.SplitButton=am,exports.Stack=Oi,exports.StatusBadge=function({label:e,color:a,icon:r,showIcon:s,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const c=Am[n],d=s??!!r;return t.jsxs("span",{className:jr("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",c.badge,l),style:(()=>{switch(o){case"outline":return{color:a,borderColor:pr(a,.3),backgroundColor:"transparent"};case"ghost":return{color:a,backgroundColor:"transparent"};default:return{color:a,backgroundColor:i||pr(a,.1)}}})(),children:[d&&r&&t.jsx(r,{size:c.icon,strokeWidth:2}),e]})},exports.StepSelector=im,exports.Stepper=im,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:r={},minHeight:s="80vh",...n}){const o=a.useMemo(()=>{const t=`${e}/api/reports/v1/Viewer/InitViewer`,a=new URLSearchParams(r).toString();return a?`${t}?${a}`:t},[e,r]);return t.jsx(vm,{...n,url:o,minHeight:s})},exports.Switch=Ei,exports.TIMEZONES=er,exports.TabPageContent=function({children:e,className:a}){return t.jsx("div",{className:jr("space-y-6",a),children:e})},exports.TabPageHeader=function({title:e,description:a,actions:r,className:s}){return t.jsxs("div",{className:jr("space-y-4",s),children:[t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),a&&t.jsx("p",{className:"text-muted-foreground text-sm",children:a})]}),r&&t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),t.jsx(Lr,{})]})},exports.TabPageLayout=function({children:e,className:a}){return t.jsx("div",{className:jr("flex flex-col h-full",a),children:t.jsx(ki,{className:"flex-1",children:t.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=To,exports.TableBody=Eo,exports.TableCaption=Lo,exports.TableCell=Ro,exports.TableFooter=Po,exports.TableHead=Io,exports.TableHeader=Do,exports.TableResizeHandle=qo,exports.TableRow=Mo,exports.TableRowActions=ni,exports.TableSkeleton=Fo,exports.Tabs=ql,exports.TabsContent=Wl,exports.TabsList=Vl,exports.TabsTrigger=$l,exports.TeamSelector=function({users:e,value:r,onChange:s,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:d="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=a.useState(""),[b,v]=a.useState(!1),[w,j]=a.useState(null),N=a.useMemo(()=>new Set(r),[r]),_=a.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=a.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=a.useCallback(e=>{e&&!N.has(e)&&(s([...r,e]),g(""))},[r,s,N]),S=a.useCallback(e=>{i?(j(e),v(!0)):s(r.filter(t=>t!==e))},[r,s,i]),A=a.useCallback(()=>{w&&s(r.filter(e=>e!==w)),v(!1),j(null)},[w,r,s]);return t.jsxs("div",{className:jr("space-y-3",m),children:[t.jsx("div",{className:"flex items-start gap-3",children:t.jsx("div",{className:"flex-1",children:t.jsx(xn,{options:C,value:f,onValueChange:e=>{const t="string"==typeof e?e:e?.[0]??"";g(t),t&&k(t)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),t.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?t.jsx("div",{className:"space-y-2",children:_.map(e=>t.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t.jsxs(Xi,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Ji,{src:e.avatar,alt:e.name}),t.jsx(Zi,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.Shield,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.MapPin,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),t.jsx("button",{type:"button",className:jr("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:t.jsx(c.X,{className:"h-4 w-4"})})]})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[t.jsx(c.User,{className:"h-12 w-12 mb-2 opacity-30"}),t.jsx("p",{className:"text-sm",children:x})]}),t.jsx(Kr,{open:b,onOpenChange:v,children:t.jsxs(es,{className:"sm:max-w-[400px]",children:[t.jsx(ts,{children:t.jsx(ss,{children:h})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:d}),t.jsxs(rs,{children:[t.jsx(Cr,{variant:"ghost",onClick:()=>v(!1),children:"Cancelar"}),t.jsx(Cr,{variant:"destructive",onClick:A,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:r,open:s,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:d=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=a.useState(!1),h=a.useCallback(()=>{o(r.id)},[o,r.id]);return t.jsxs(t.Fragment,{children:[t.jsx(Kr,{open:s&&!m,onOpenChange:e=>!e&&n(),children:t.jsxs(es,{className:"sm:max-w-md",children:[t.jsx(ts,{children:t.jsxs(ss,{className:"flex items-center gap-2",children:[t.jsx(c.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),t.jsxs("div",{className:"space-y-4",children:[r.description&&t.jsx(ki,{className:"max-h-48",children:t.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r.description}})}),r.file&&t.jsxs(Cr,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[t.jsx(c.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),t.jsxs(rs,{className:"gap-2 sm:gap-0",children:[t.jsx(Cr,{variant:"ghost",onClick:n,children:l}),t.jsx(Cr,{onClick:h,children:d})]})]})}),m&&t.jsx(ym,{term:r,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=ym,exports.TextPanel=yp,exports.Textarea=Ss,exports.Timepicker=om,exports.Toaster=Ms,exports.Toggle=di,exports.ToggleGroup=mi,exports.ToggleGroupItem=pi,exports.TokenManager=qn,exports.TokenService=Mn,exports.Tooltip=Qs,exports.TooltipContent=Js,exports.TooltipProvider=Ys,exports.TooltipTrigger=Xs,exports.TreeSelect=wn,exports.TreeTable=function({data:r,columns:s,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:b,selectedIds:v,onSelectItem:y,onSelectAll:w,isAllSelected:j,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:A=200}){const[T,D]=a.useState(null),[E,P]=a.useState(null),[M,I]=a.useState(!1),[R,L]=a.useState(1),F=a.useRef(null),z=a.useRef([]),U=a.useRef(null),O=a.useMemo(()=>new Set(v??[]),[v]),B=a.useMemo(()=>{if(!T||!r)return new Set;const e=z.current.length>0?z.current:[T],t=function(e,t){const a=new Set;for(const r of t)_h(e,r).forEach(e=>a.add(e));return a}(r,e);return e.forEach(e=>t.add(e)),t},[T,r]),q=a.useRef(B);q.current=B;const V=a.useCallback(()=>{F.current=null,z.current=[],U.current=null,D(null),P(null),I(!1),L(1)},[]),$=a.useCallback((e,t)=>{e.length>1&&C?C(e,t):1===e.length&&_?.(e[0],t)},[_,C]),W=a.useCallback((e,t)=>{const a=O.has(e)&&O.size>1?Array.from(O):[e];F.current=e,z.current=a,U.current=null,D(e),L(a.length),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e),t.dataTransfer.setData("application/x-tree-ids",JSON.stringify(a))},[O]),H=a.useCallback((e,t)=>{t.preventDefault(),t.dataTransfer.dropEffect="move",q.current.has(e)?P(null):(U.current=e,P(e))},[]),G=a.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const a=q.current.has(e)?U.current:e;if(!a)return void V();let r=z.current;if(0===r.length){try{const e=t.dataTransfer.getData("application/x-tree-ids");if(e){const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(r=t)}}catch{}if(0===r.length){const e=t.dataTransfer.getData("text/plain");e&&(r=[e])}}0===r.length||r.includes(a)||$(r,a),V()},[$,V]),K=a.useCallback(e=>{e.preventDefault(),e.stopPropagation();let t=z.current;if(0===t.length){try{const a=e.dataTransfer.getData("application/x-tree-ids");if(a){const e=JSON.parse(a);Array.isArray(e)&&e.length>0&&(t=e)}}catch{}if(0===t.length){const a=e.dataTransfer.getData("text/plain");a&&(t=[a])}}0!==t.length?($(t,null),V()):V()},[$,V]),Y=a.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",I(!0)},[]),Q=a.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=a.useCallback(e=>{if(!N)return;const t=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),a=t?.dataset?.treeRowId??U.current;a&&G(a,e)},[N,G]);if(x)return t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[t.jsx(c.User,{className:"h-10 w-10 text-muted-foreground/50"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==T;return t.jsxs("div",{className:jr("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(P(null),I(!1))}:void 0,children:[N&&J&&t.jsx(Sh,{onDrop:K,isDragOver:M,onDragOver:Y,onDragLeave:()=>I(!1),label:k}),t.jsxs(To,{children:[t.jsx(Do,{children:t.jsxs(Mo,{children:[t.jsx(Io,{className:"text-left",style:{minWidth:A},children:t.jsxs("div",{className:"flex items-center gap-2",children:[b&&t.jsx(ks,{checked:j??!1,onCheckedChange:()=>w?.()}),o]})}),s.map(e=>t.jsx(Io,{className:jr("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&t.jsx(Io,{className:"text-right",style:{width:S},children:p})]})}),t.jsx(Eo,{children:r.map(e=>t.jsx(kh,{item:e,level:0,columns:s,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:b,selectedIds:O,onSelectItem:y,enableRowDrag:N,draggedId:T,dragOverId:E,onDragStartCell:W,onDragEndCell:V,onDragOverCell:H,onDropCell:G,dragCount:R},e.id))})]})]})},exports.TruncatedCell=Bo,exports.UpdatesBar=Zh,exports.UpdatesDialog=ox,exports.UpdatesNotification=um,exports.UserUpdatesViewer=ux,exports.UsersGroupsSelector=function({users:r,groups:s=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:d=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:b}){const[v,y]=a.useState(!1),[w,j]=a.useState(""),[N,_]=a.useState(void 0),C=a.useMemo(()=>new Set(n),[n]),k=a.useMemo(()=>{let e=r;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),w){const t=wm(w);e=e.filter(e=>wm(e.name).includes(t)||wm(e.email??"").includes(t))}return e},[r,N,w]),S=a.useMemo(()=>v?k:r.filter(e=>C.has(e.id)),[v,k,r,C]),A=n.length,T=a.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),D=a.useCallback(e=>{if(i)return;const t=C.has(e)?n.filter(t=>t!==e):[...n,e];o(t)},[n,C,o,i]),E=a.useCallback(e=>{if(i)return;const t=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...t]);o(Array.from(e))}else o(n.filter(e=>!t.has(e)))},[n,k,o,i]),P=a.useCallback(()=>{y(e=>!e),j(""),_(void 0)},[]);return t.jsxs("div",{className:jr("rounded-md border bg-muted/30",b),children:[(!i||A>0)&&t.jsxs("div",{className:jr("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:P,children:[t.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(v?p:m)}),t.jsx("span",{className:"text-xs text-muted-foreground",children:A>0&&`${A} ${1===A?f:g}`})]}),t.jsxs("div",{className:"px-4 pb-3",children:[v&&t.jsxs("div",{className:"flex gap-3 mb-3",children:[!d&&s.length>0&&t.jsxs(fs,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[t.jsx(vs,{className:"w-[200px] h-9 text-sm",children:t.jsx(bs,{placeholder:e.t("approval_user_group")})}),t.jsxs(js,{children:[t.jsx(_s,{value:"__all__",children:e.t("team_all_groups")}),s.map(e=>t.jsx(_s,{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Sr,{className:"pl-8 h-9 text-sm",placeholder:u,value:w,onChange:e=>j(e.target.value)})]})]}),!v&&0===A&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[t.jsx(c.Users,{className:"h-4 w-4 mr-2"}),x]}),v&&k.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(ks,{checked:T,onCheckedChange:e=>E(!!e)}),t.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&t.jsx(ki,{style:{maxHeight:l},className:"pr-2",children:t.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return t.jsxs("div",{className:jr("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",v&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:v?()=>D(e.id):void 0,children:[v&&t.jsx(ks,{checked:C.has(e.id),onCheckedChange:()=>D(e.id),onClick:e=>e.stopPropagation()}),t.jsxs(Xi,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Ji,{src:e.avatar,alt:e.name}),t.jsx(Zi,{className:"text-xs",children:(a=e.name,a.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var a})})}),v&&0===k.length&&t.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:r,onChange:s,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:d,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(r||{inputType:"url",controls:!0}),x=a.useRef(null),f=a.useRef(null),{upload:g,uploading:b}=yx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:v,uploading:w}=yx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),j=a.useMemo(()=>nx(p.videoUrl||sx(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,t)=>{const a={...p,[e]:t};h(a),s(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:m("input_type")}),t.jsxs(fs,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[t.jsx(vs,{children:t.jsx(bs,{})}),t.jsxs(js,{children:[t.jsx(_s,{value:"url",children:"URL"}),t.jsx(_s,{value:"upload",children:m("file_upload")}),t.jsx(_s,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"Arquivo"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await g(t),a={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||t.name.replace(/\.[^/.]+$/,"")};h(a),s(a)}catch(a){}finally{x.current&&(x.current.value="")}},className:"hidden"}),t.jsx(Cr,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:b,children:b?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:m("embed_code")}),t.jsx(Ss,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"Thumbnail"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Sr,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),t.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await v(t),a={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(a),s(a)}catch(a){}finally{f.current&&(f.current.value="")}},className:"hidden"}),t.jsx(Cr,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:w,children:w?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{htmlFor:"title",children:"Título"}),t.jsx(Sr,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),t.jsxs("div",{className:"flex gap-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ks,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),t.jsx(Tr,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ks,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),t.jsx(Tr,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Tr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const a=p.videoUrl||sx(p.embedCode)||"";if(!a)return t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===j)return t.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[t.jsx("source",{src:a}),"Seu navegador não suporta este vídeo."]});const r="youtube"===j?tx(a,p.autoplay):rx(a,p.autoplay);return t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:p.title||e.t("video"),src:r,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(Cr,{variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(Cr,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:a,className:r="",style:s}){const n=a.videoUrl||sx(a.embedCode)||"";if(!n)return null;const o=nx(n);return t.jsx(Dr,{className:`overflow-hidden my-4 ${r}`,style:s,children:t.jsxs(Ir,{className:"p-0",children:["file"===o?t.jsxs("video",{controls:!1!==a.controls,autoPlay:a.autoplay,poster:a.thumbnail,className:"w-full h-auto",playsInline:!0,muted:a.autoplay,children:[t.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:a.title||e.t("video"),src:"youtube"===o?tx(n,a.autoplay):rx(n,a.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),a.title&&t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm font-medium",children:a.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:r,template:s,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:d=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:b=!1,readingConfirmationTimeRemaining:v,onIframeLoad:w,className:j}){const{t:N}=y.useTranslation(),_=a.useRef(null),C=n??xm(s.extension),k=d||b||h,S=s.code?`${s.code} – ${s.name}`:s.name,A=a.useCallback(()=>{_.current&&w&&w(_.current)},[w]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,r]),t.jsx(Kr,{open:e,onOpenChange:r,children:t.jsxs(es,{className:jr("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===C||6===C)&&"w-[90vw]",j),children:[t.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),t.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&t.jsxs(t.Fragment,{children:[(x||f)&&t.jsx(t.Fragment,{children:f?t.jsxs("div",{className:"flex flex-col mr-2.5",children:[t.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[t.jsx(c.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),t.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=v&&v>0?t.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[t.jsx("span",{children:N("terms_confirmation_available")}),t.jsx("span",{className:"font-medium min-w-[72px]",children:bm(v)}),t.jsx("span",{children:"segundos"})]}):t.jsxs(Cr,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[t.jsx(c.ShieldCheck,{className:"h-4 w-4 mr-1"}),b?"Confirmando...":N("terms_confirm_reading")]})}),0!==C&&u&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:t.jsx(c.Star,{className:jr("h-4 w-4",m&&"fill-accent text-accent")})})}),t.jsx(Js,{children:m?"Desfavoritar":"Favoritar"})]}),0!==C&&i&&t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:t.jsx(c.Download,{className:"h-4 w-4"})})}),t.jsx(Js,{children:"Download"})]})]}),t.jsxs(Qs,{children:[t.jsx(Xs,{asChild:!0,children:t.jsx(Cr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>r(!1),children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Js,{children:"Fechar"})]})]})]}),t.jsx("div",{className:jr("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",0===C&&"min-h-[124px]",1===C&&"max-h-[85vh]",(4===C||6===C)&&"min-w-[77vw] min-h-[80vh]"),children:o?t.jsx(Es,{className:"h-14 w-14"}):t.jsxs(t.Fragment,{children:[(0===C||!s.url)&&t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),t.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),1===C&&t.jsx("img",{loading:"eager",src:s.url,alt:s.name,className:"max-w-full max-h-[85vh] object-contain"}),2===C&&t.jsx("video",{controls:!0,autoPlay:!0,src:s.url,className:"w-full h-full"}),3===C&&t.jsx("audio",{controls:!0,autoPlay:!0,src:s.url}),(4===C||6===C)&&t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Es,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{ref:_,src:s.url,onLoad:A,className:"border-none w-full h-full z-[1] relative",title:s.name})]})]})}),!o&&0===C&&t.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[t.jsx(Cr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),i&&t.jsx(Cr,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.VisualizationType=Km,exports.addAppTranslations=jl,exports.addChild=th,exports.addSibling=ah,exports.aliasSchema=fx,exports.appRedirectUrl=Ue,exports.applyFavicon=dt,exports.assets=it,exports.badgeVariants=As,exports.brandLogos=nt,exports.buildModuleUrl=fr,exports.buildPlacesTree=function(e){e.forEach(t=>{t.children=e.filter(e=>e.parentId===t.id)});const t=e.filter(e=>!e.parentId);return function e(t,a){t?.forEach(t=>{a(t),t.children&&e(t.children,a)})}(t,t=>{t.children=e.filter(e=>e.parentId===t.id)}),t},exports.buildQualiexHeaders=al,exports.buildWopiUrl=function(e){const{t:t}=y.useTranslation(),{viewerUrl:a,wopiUrl:r,fileId:s,token:n,extension:o,language:i="pt-br"}=e,l=gm(o);return l?`${a}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${r}${s}`)}`:null},exports.buttonGroupVariants=Mc,exports.buttonVariants=_r,exports.calculateAspectRatio=wx,exports.cn=jr,exports.configureBrandAssets=function(e){rt={...rt,...e,logos:{...rt.logos,...e.logos}}},exports.configureEnvironment=function(e){Pe={...Pe,...e,oauth:{...Pe.oauth,...e.oauth}}},exports.createCrudPage=function(e){return({manager:a})=>{const{manager:r,config:s,onSave:n,onEdit:o,onToggleStatus:i}=e,l=a??r,c={entityName:s.entityName,entityNamePlural:s.entityNamePlural,filters:s.filters||[],columns:s.columns,cardFields:s.cardFields||[],enableBulkActions:s.enableBulkActions??!1,bulkActions:s.bulkActions||[],customActions:s.customActions,customRowActions:s.customRowActions,customListView:s.customListView,onEdit:o||s.onEdit,onNew:s.onNew,useCustomRouting:s.useCustomRouting,hideNewButton:s.hideNewButton,showNewButton:s.showNewButton,newButtonLabel:s.newButtonLabel,showSearch:s.showSearch,searchPlaceholder:s.searchPlaceholder,showActionBar:s.showActionBar};return t.jsx(qi,{manager:l,config:c,formSections:s.formSections,onSave:n,onToggleStatus:i,defaultSort:s.defaultSort,readOnly:s.readOnly})}},exports.createCrudRoutingConfig=function(e,t){const a=Ah({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:a.onNew,onEdit:a.onEdit}},exports.createMindMapNode=Qp,exports.createRoutingHandlers=Ah,exports.createService=go,exports.createSimpleSaveHandler=function(e,t,a){return r=>{if(r.id){const t=a(r);e.updateEntity(r.id,t)}else{const a=t(r);e.createEntity(a)}}},exports.createSimpleService=function(e){const t=go({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(a,r)=>ko({queryKey:e.tableName,service:t,entityName:e.entityName,additionalFilters:a,onSuccess:r})}},exports.createStatusConfig=function(e){return t=>e[t]},exports.createTranslatedMessages=t=>({success:{created:t=>e.t("msg_created_success",`${t} criado com sucesso`).replace("{{entity}}",t),updated:t=>e.t("msg_updated_success",`${t} atualizado com sucesso`).replace("{{entity}}",t),deleted:t=>e.t("msg_deleted_success",`${t} removido com sucesso`).replace("{{entity}}",t)},error:{create:t=>e.t("msg_create_error",`Erro ao criar ${t}`).replace("{{entity}}",t),update:t=>e.t("msg_update_error",`Erro ao atualizar ${t}`).replace("{{entity}}",t),delete:t=>e.t("msg_delete_error",`Erro ao remover ${t}`).replace("{{entity}}",t),load:t=>e.t("msg_load_error",`Erro ao carregar ${t}`).replace("{{entity}}",t)}}),exports.currencyFormatter=cp,exports.debounce=(e,t)=>{let a;return(...r)=>{clearTimeout(a),a=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=co,exports.deriveNameField=lo,exports.deriveUsernameField=uo,exports.detectBrowserLocale=or,exports.detectBrowserPreferences=()=>{const e=or();return{locale:e,timezone:ir(),datetimeFormat:lr(e)}},exports.detectBrowserTimezone=ir,exports.detectVideoProvider=nx,exports.emailSchema=xx,exports.emailService=hx,exports.errorService=Wn,exports.exportMindMap=yh,exports.extractImageFileName=function(e){try{const t=new URL(e),a=t.pathname.split("/");return a[a.length-1]||"image"}catch{const t=e.split("/");return t[t.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const t=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(t)},exports.extractVimeoId=ax,exports.extractYouTubeId=ex,exports.findDatetimeFormat=e=>Za.find(t=>t.value===e),exports.findLocale=e=>Ja.find(t=>t.value===e),exports.findNode=Xp,exports.findTimezone=e=>er.find(t=>t.value===e),exports.formatBytes=Nx,exports.formatCurrency=(e,t="BRL",a="pt-BR")=>null==e?"":new Intl.NumberFormat(a,{style:"currency",currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=ur,exports.formatDatetime=dr,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.generateCrudConfig=function(e,t,a={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const a=t[e],s={key:e,header:$i(e),label:$i(e),...Vi(e,a),sortable:!0,searchable:"string"==typeof a};r.push(s)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...a}},exports.generateId=gr,exports.generateNodeId=Yp,exports.generatePastelBg=pr,exports.getAppBasePath=Oe,exports.getAppEnv=Ee,exports.getBackendMode=function(){return Re},exports.getCommonBaseUrl=el,exports.getCommonV4AppUrl=Qe,exports.getContrastRatio=function(e,t){const a=hr(e),r=hr(t);return(Math.max(a,r)+.05)/(Math.min(a,r)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case zm.Bar:case zm.Column:case zm.Pie:case zm.List:case zm.Line:case zm.Area:case zm.Text:case zm.StackedColumn:return{x:4,y:2};case zm.Pareto:case zm.RiskMatrix:case zm.Burndown:case zm.PerformanceColumns:return{x:8,y:2};case zm.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getEnvironmentConfig=Me,exports.getFieldValue=Ax,exports.getFileExtension=_x,exports.getFormFieldValues=function(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))},exports.getIdentApiUrlOverride=Ke,exports.getIdentBaseUrl=function(){const e=Ke();if(e)return e;const t=el().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://ident-api${t[1]||""}.${t[2]}`}return"https://ident-api.qualiex.com"},exports.getLinkFromRow=op,exports.getLoginApiUrlOverride=Ye,exports.getLuminance=hr,exports.getMinPanelSize=Mp,exports.getOnlineViewerType=function(e){const{t:t}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getQualiexApiUrl=Ge,exports.getSecurityMode=function(){return vc},exports.getSupabaseClient=Zn,exports.getUserProfile=ul,exports.getViewerType=xm,exports.getWopiViewer=gm,exports.handleExternalLink=xr,exports.importMindMap=function(e){return wh(JSON.parse(e))},exports.inferDatetimeFormat=lr,exports.inputGroupAddonVariants=ed,exports.inputGroupButtonVariants=ad,exports.isCurrency=function(e){return!!lp.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnv=Ie,exports.isDevEnvironment=He,exports.isImageUrl=function(e){const t=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const a=new URL(e);return t.some(e=>a.pathname.toLowerCase().endsWith(e))}catch{const a=e.toLowerCase();return t.some(e=>a.endsWith(e))}},exports.isLovablePreview=$e,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isSupabaseBackend=Fe,exports.isSupabaseConfigured=function(){return null!==Qn()},exports.isValidDatetimeFormat=e=>Za.some(t=>t.value===e),exports.isValidLocale=sr,exports.isValidTimezone=nr,exports.loadForlogicFonts=gc,exports.logoSrc=lt,exports.markUpdateVisualized=Yh,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=sh,exports.navigationMenuTriggerStyle=wd,exports.normalizeVideoUrl=function(e,t,a){switch(t||nx(e)){case"youtube":return tx(e,a);case"vimeo":return rx(e,a);default:return e}},exports.normalizeVimeoUrl=rx,exports.normalizeYouTubeUrl=tx,exports.paginationSchema=vx,exports.parseIframeSrc=sx,exports.processUrl=np,exports.qualiexApi=io,exports.qualiexFetch=rl,exports.removeNode=rh,exports.resizeKeepingAspect=function(e,t,a,r){const s=wx(e,t);return a&&!r?{width:a,height:Math.round(a/s)}:r&&!a?{width:Math.round(r*s),height:r}:{width:e,height:t}},exports.resolveBrandLogo=ot,exports.resolveFieldMappings=mo,exports.resolvePageTitle=Ih,exports.safeStringSchema=(e=1e3)=>J.z.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),exports.sanitizeErrorMessage=wr,exports.setBackendMode=Le,exports.setCollapsedAll=oh,exports.setFormFieldValues=function(e,t){return t?.length?e.map(e=>{const a=t.find(t=>t.formFieldAssociationId===e.id);if(!a)return e;const r={...e};switch(e.type){case 2:r.textValue=a.textValue;break;case 6:r.numberValue=a.numberValue;break;case 3:r.dateValue=a.dateValue;break;case 4:r.timeValue=a.timeValue;break;case 5:case 7:case 8:r.itemsValue=a.itemsValue||[];break;case 9:r.questionsValue=a.questionsValue||[]}return r}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new j.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=Tx,exports.shouldUseDevTokens=We,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=ct,exports.sortByMonthYear=function(e){return e?.sort((e,t)=>{if(!e?.items?.length||!t?.items?.length)return 0;return sp(e.items[0]?.keyDate)-sp(t.items[0]?.keyDate)})},exports.stripTechHeaders=function(e){if(!e||"object"!=typeof e)return e;const t={...e};for(const a of br)delete t[a];return t},exports.timestampId=()=>Date.now().toString(),exports.toQueryString=function(e){return e?ip(e).join("&"):null},exports.toRouterPath=Be,exports.toggleCollapsed=nh,exports.toggleVariants=ci,exports.trackFooterClick=sc,exports.trackInterestClick=rc,exports.trackModuleClick=ac,exports.trimTextFields=Nr,exports.updateUserProfile=ll,exports.uploadUserPhoto=sl,exports.useActiveModules=(e={})=>{const{enabled:t=!0}=e,{alias:a}=Co();return j.useQuery({queryKey:["active-modules",a],queryFn:async()=>{if(!a)return[];const e=Zn(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",a).eq("status","active").order("name");if(r){if(!so.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!a})},exports.useAliasFromUrl=Wi,exports.useAuth=Co,exports.useBaseForm=ji,exports.useClarity=bc,exports.useColumnManager=gi,exports.useColumnResize=li,exports.useCrud=ko,exports.useDebounce=Rh,exports.useDerivedContractedModules=uc,exports.useFormField=ls,exports.useHasOpenModal=function(){const{hasOpenModal:e}=$h();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:t}=Rl(),a=ar;return{formatDatetime:r=>dr(r,a,t,e),formatDate:a=>ur(a,e,t),locale:e,timezone:t,datetimeFormat:a}},exports.useIsMobile=Ao,exports.useLocale=Rl,exports.useMediaQuery=So,exports.useMediaUpload=yx,exports.useModalState=$h,exports.useModuleAccess=Al,exports.useModuleConfig=Cl,exports.useNavigation=Mh,exports.usePageMetadata=function(e){const{setMetadata:t,clearMetadata:r}=gl(),s=a.useRef({});a.useEffect(()=>{const a=JSON.stringify(s.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(s.current.title!==e.title||s.current.subtitle!==e.subtitle||a)&&(s.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},t(e)),()=>r()},[e.title,e.subtitle,e.breadcrumbs,t,r])},exports.usePageMetadataContext=gl,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:t}=Mh();return Ih(t,e.pathname)},exports.usePermissionQuery=zh,exports.useQualiexReady=Gh,exports.useQualiexUsers=Pi,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),a=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,s)=>{r+=`/${e}`;const n=s===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");a.push({label:o,href:n?void 0:r,isCurrentPage:n})}),a})()},exports.useRowResize=function({rowIds:e,defaultHeight:t=48,minHeight:r=32,maxHeight:s=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,c]=a.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[d,u]=a.useState(!1),[m,p]=a.useState(null),h=a.useRef(0),x=a.useRef(0),f=a.useCallback(e=>l[e]??t,[l,t]),g=a.useCallback((e,a)=>{i&&(a.preventDefault(),a.stopPropagation(),u(!0),p(e),h.current=a.clientY,x.current=l[e]??t)},[i,l,t]);a.useEffect(()=>{if(!d||!m)return;const e=e=>{const t=e.clientY-h.current,a=Math.max(r,Math.min(s,x.current+t));c(e=>{const t={...e,[m]:a};return o?.(t),t})},t=()=>{u(!1),p(null),n&&c(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[d,m,r,s,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d]);const b=a.useCallback(()=>{c({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:d,activeRow:m,handleMouseDown:g,resetHeights:b,getRowHeight:f}},exports.useSidebar=Jd,exports.useSidebarResize=qh,exports.useUpdatesNotification=dm,exports.useUserUpdatesBar=Xh,exports.useUserUpdatesDialog=Jh,exports.useWizard=function(e){const{steps:t,initialStep:r=0,initialData:s={},onComplete:n,onCancel:o}=e,[i,l]=a.useState(r),[c,d]=a.useState(s),[u,m]=a.useState(!1),[p,h]=a.useState(!1),x=t.length,f=0===i,g=i===x-1,b=t[i],v=x>1?(i+1)/x*100:100,y=a.useCallback(()=>!b?.canProceed||b.canProceed(),[b]),w=a.useMemo(()=>y(),[y,c]),j=a.useMemo(()=>!f&&!b?.disableBack,[f,b]),N=a.useCallback(e=>{d(t=>({...t,...e}))},[]),_=a.useCallback((e,t)=>{d(a=>({...a,[e]:t}))},[]),C=a.useCallback(()=>{l(r),d(s),m(!1),h(!1),o?.()},[r,s,o]),k=a.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(c))}finally{h(!1)}}},[y,p,c,n]),S=a.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),A=a.useCallback(()=>{j&&!u&&l(e=>Math.max(e-1,0))},[j,u]),T=a.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),D=a.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:b,data:c,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:A,goTo:T,canProceed:w,canGoBack:j,setData:N,updateField:_,reset:C,complete:k,setLoading:D,progress:v,stepIndex:i,totalSteps:x}},exports.userIdSchema=bx,exports.uuidSchema=gx,exports.validateFields=function(e){const t=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const a=Ax(e);if((null==a||""===a||Array.isArray(a)&&0===a.length)&&t.push(e.id),6===e.type&&null!=a){const r=e.config;null!=r?.min&&a<r.min&&t.push(e.id),null!=r?.max&&a>r.max&&t.push(e.id)}}),{valid:0===t.length,invalidFields:[...new Set(t)]}};
1
+ "use strict";var e=require("i18next"),t=require("react/jsx-runtime"),a=require("react"),r=require("@radix-ui/react-slot"),s=require("class-variance-authority"),n=require("clsx"),o=require("tailwind-merge"),i=require("date-fns"),l=require("sonner"),c=require("lucide-react"),d=require("@radix-ui/react-label"),u=require("@radix-ui/react-dialog"),m=require("@radix-ui/react-separator"),p=require("@radix-ui/react-alert-dialog"),h=require("react-hook-form"),x=require("@radix-ui/react-select"),f=require("@radix-ui/react-checkbox"),g=require("@radix-ui/react-dropdown-menu"),b=require("@radix-ui/react-tooltip"),v=require("@radix-ui/react-popover"),y=require("react-i18next"),w=require("@supabase/supabase-js"),j=require("@tanstack/react-query"),N=require("react-router-dom"),_=require("@radix-ui/react-context-menu"),C=require("@radix-ui/react-toggle-group"),k=require("@radix-ui/react-toggle"),S=require("@radix-ui/react-scroll-area"),A=require("@radix-ui/react-switch"),T=require("@radix-ui/react-avatar"),D=require("@radix-ui/react-collapsible"),E=require("@radix-ui/react-tabs"),P=require("@radix-ui/react-accordion"),I=require("react-day-picker"),M=require("vaul"),R=require("@radix-ui/react-hover-card"),L=require("@radix-ui/react-navigation-menu"),F=require("@radix-ui/react-progress"),z=require("@radix-ui/react-radio-group"),U=require("react-resizable-panels"),O=require("@radix-ui/react-slider"),B=require("@radix-ui/react-menubar"),q=require("recharts"),$=require("@tiptap/react"),V=require("@tiptap/starter-kit"),W=require("@tiptap/extension-underline"),H=require("@tiptap/extension-link"),G=require("@tiptap/extension-text-style"),K=require("@tiptap/extension-color"),Y=require("@tiptap/extension-highlight"),Q=require("@dnd-kit/core"),X=require("@dnd-kit/sortable"),J=require("zod"),Z="undefined"!=typeof document?document.currentScript:null;function ee(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,Object.freeze(t)}var te=ee(a),ae=ee(c),re=ee(d),se=ee(u),ne=ee(m),oe=ee(p),ie=ee(x),le=ee(f),ce=ee(g),de=ee(b),ue=ee(v),me=ee(_),pe=ee(C),he=ee(k),xe=ee(S),fe=ee(A),ge=ee(T),be=ee(D),ve=ee(E),ye=ee(P),we=ee(R),je=ee(L),Ne=ee(F),_e=ee(z),Ce=ee(U),ke=ee(O),Se=ee(B),Ae=ee(q);const Te={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"ccjfvpnndclajkleyqkc",supabaseUrl:"https://ccjfvpnndclajkleyqkc.supabase.co",supabasePublishableKey:"sb_publishable_w-TKU0hE4bjM_uOgt3fK1g_ewrXKJ8J",oauth:{authUrl:"https://login.qualiex.com/oauth2/authorize",logoutUrl:"https://login.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api.qualiex.com",documentsApiUrl:"https://documents-v4-api.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:"",commonV4AppUrl:"https://apps4.qualiex.com/common/"},De={storageProjectId:"ccjfvpnndclajkleyqkc",supabaseProjectId:"tskpcuganynhsppzoqgj",supabaseUrl:"https://tskpcuganynhsppzoqgj.supabase.co",supabasePublishableKey:"sb_publishable_2EIWdYocxgrN4t_f64Ms3g_pKRcbHfL",oauth:{authUrl:"https://login-dev.qualiex.com/oauth2/authorize",logoutUrl:"https://login-dev.qualiex.com/oauth2/logout",clientId:"ae6021a0-e874-4aab-9716-b478e59cec20",responseType:"id_token token",scope:"openid profile email"},qualiexApiUrl:"https://common-v4-api-dev.qualiex.com",documentsApiUrl:"https://documents-v4-api-dev.qualiex.com",identApiUrl:"",loginApiUrl:"",appBasePath:"",commonV4AppUrl:"https://apps4-dev.qualiex.com/common/"};function Ee(){return"DEV"===(void 0).VITE_APP_ENV?"DEV":"PROD"}let Pe={};function Ie(){const e="DEV"===Ee()?De:Te;return{...e,...Pe,oauth:{...e.oauth,...Pe.oauth}}}function Me(){return"DEV"===Ee()}let Re="supabase";function Le(e){Re=e}function Fe(){return"supabase"===Re}const ze={get oauth(){const e=Ie();return{authUrl:e.oauth.authUrl,logoutUrl:e.oauth.logoutUrl,clientId:e.oauth.clientId,responseType:e.oauth.responseType,scope:e.oauth.scope}}};function Ue(e){const t=Ie().appBasePath||"";return`${window.location.origin}${t}${e}`}function Oe(){return Ie().appBasePath||""}function Be(e){const t=Oe();return t&&e.startsWith(t)?e.slice(t.length)||"/":e}const qe={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},$e={debounceDelay:500},Ve=()=>{const e=window.location.origin,t=(()=>{try{return window.self!==window.top}catch{return!0}})();return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("lovable.dev")||e.includes("lovable.app")&&t||(void 0).DEV},We=()=>Ve()&&Fe(),He=Ve,Ge=()=>Ie().qualiexApiUrl,Ke=()=>Ie().documentsApiUrl,Ye=()=>Ie().identApiUrl,Qe=()=>Ie().loginApiUrl,Xe=()=>Ie().commonV4AppUrl,Je={userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"},Ze={isQualiex:"true"===(void 0).VITE_IS_QUALIEX},et={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},tt="https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets",at={qualiex:`${tt}/logo-qualiex-white.svg`,qualitfy:`${tt}/logo-qualitfy-white.svg`,metroex:`${tt}/logo-metroex-white.svg`,qualiexSmall:`${tt}/logo-forlogic-white.svg`,saber:`${tt}/saber-gestao-white.png`,saberSmall:`${tt}/small.svg`},rt=`${tt}/favicon.png`;let st={};function nt(e){return st.logos?.[e]??at[e]}const ot={get qualiex(){return nt("qualiex")},get qualitfy(){return nt("qualitfy")},get metroex(){return nt("metroex")},get saber(){return nt("saber")},get qualiexSmall(){return nt("qualiexSmall")},get saberSmall(){return nt("saberSmall")}};function it(e){return nt(Ze.isQualiex?e?.isMetroex?"metroex":e?.isQualitfy?"qualitfy":"qualiex":"saber")}const lt={get logo(){return it()},get smallLogo(){return nt(Ze.isQualiex?"qualiexSmall":"saberSmall")},get favicon(){return st.favicon??rt}},ct=lt.logo,dt=lt.smallLogo;function ut(){if("undefined"==typeof document)return;document.querySelectorAll("link[rel='icon'], link[rel='shortcut icon']").forEach(e=>e.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=lt.favicon,document.head.appendChild(e)}"function"==typeof queueMicrotask?queueMicrotask(ut):Promise.resolve().then(ut);const mt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function pt(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const ht={date:pt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:pt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:pt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},xt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ft(e){return(t,a)=>{let r;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,s=a?.width?String(a.width):t;r=e.formattingValues[s]||e.formattingValues[t]}else{const t=e.defaultWidth,s=a?.width?String(a.width):e.defaultWidth;r=e.values[s]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const gt={ordinalNumber:(e,t)=>{const a=Number(e),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:ft({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ft({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ft({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:ft({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:ft({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function bt(e){return(t,a={})=>{const r=a.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],n=t.match(s);if(!n)return null;const o=n[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a;return}(i,e=>e.test(o)):function(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=a.valueCallback?a.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}function vt(e){return(t,a={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],n=t.match(e.parsePattern);if(!n)return null;let o=e.valueCallback?e.valueCallback(n[0]):n[0];o=a.valueCallback?a.valueCallback(o):o;return{value:o,rest:t.slice(s.length)}}}const yt={ordinalNumber:vt({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:bt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:bt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:bt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:bt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:bt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},wt={code:"en-US",formatDistance:(e,t,a)=>{let r;const s=mt[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},formatLong:ht,formatRelative:(e,t,a,r)=>xt[e],localize:gt,match:yt,options:{weekStartsOn:0,firstWeekContainsDate:1}};let jt={};function Nt(){return jt}const _t=6048e5;function Ct(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function kt(e){const t=Ct(e);return t.setHours(0,0,0,0),t}function St(e){const t=Ct(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function At(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Tt(e){const t=Ct(e),a=function(e,t){const a=kt(e),r=kt(t),s=+a-St(a),n=+r-St(r);return Math.round((s-n)/864e5)}(t,function(e){const t=Ct(e),a=At(e,0);return a.setFullYear(t.getFullYear(),0,1),a.setHours(0,0,0,0),a}(t));return a+1}function Dt(e,t){const a=Nt(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Ct(e),n=s.getDay(),o=(n<r?7:0)+n-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Et(e){return Dt(e,{weekStartsOn:1})}function Pt(e){const t=Ct(e),a=t.getFullYear(),r=At(e,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const s=Et(r),n=At(e,0);n.setFullYear(a,0,4),n.setHours(0,0,0,0);const o=Et(n);return t.getTime()>=s.getTime()?a+1:t.getTime()>=o.getTime()?a:a-1}function It(e){const t=Ct(e),a=+Et(t)-+function(e){const t=Pt(e),a=At(e,0);return a.setFullYear(t,0,4),a.setHours(0,0,0,0),Et(a)}(t);return Math.round(a/_t)+1}function Mt(e,t){const a=Ct(e),r=a.getFullYear(),s=Nt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=At(e,0);o.setFullYear(r+1,0,n),o.setHours(0,0,0,0);const i=Dt(o,t),l=At(e,0);l.setFullYear(r,0,n),l.setHours(0,0,0,0);const c=Dt(l,t);return a.getTime()>=i.getTime()?r+1:a.getTime()>=c.getTime()?r:r-1}function Rt(e,t){const a=Ct(e),r=+Dt(a,t)-+function(e,t){const a=Nt(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Mt(e,t),n=At(e,0);return n.setFullYear(s,0,r),n.setHours(0,0,0,0),Dt(n,t)}(a,t);return Math.round(r/_t)+1}function Lt(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const Ft={y(e,t){const a=e.getFullYear(),r=a>0?a:1-a;return Lt("yy"===t?r%100:r,t.length)},M(e,t){const a=e.getMonth();return"M"===t?String(a+1):Lt(a+1,2)},d:(e,t)=>Lt(e.getDate(),t.length),a(e,t){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];default:return"am"===a?"a.m.":"p.m."}},h:(e,t)=>Lt(e.getHours()%12||12,t.length),H:(e,t)=>Lt(e.getHours(),t.length),m:(e,t)=>Lt(e.getMinutes(),t.length),s:(e,t)=>Lt(e.getSeconds(),t.length),S(e,t){const a=t.length,r=e.getMilliseconds();return Lt(Math.trunc(r*Math.pow(10,a-3)),t.length)}},zt="midnight",Ut="noon",Ot="morning",Bt="afternoon",qt="evening",$t="night",Vt={G:function(e,t,a){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return a.era(r,{width:"abbreviated"});case"GGGGG":return a.era(r,{width:"narrow"});default:return a.era(r,{width:"wide"})}},y:function(e,t,a){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return a.ordinalNumber(r,{unit:"year"})}return Ft.y(e,t)},Y:function(e,t,a,r){const s=Mt(e,r),n=s>0?s:1-s;if("YY"===t){return Lt(n%100,2)}return"Yo"===t?a.ordinalNumber(n,{unit:"year"}):Lt(n,t.length)},R:function(e,t){return Lt(Pt(e),t.length)},u:function(e,t){return Lt(e.getFullYear(),t.length)},Q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Lt(r,2);case"Qo":return a.ordinalNumber(r,{unit:"quarter"});case"QQQ":return a.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(r,{width:"narrow",context:"formatting"});default:return a.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,a){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Lt(r,2);case"qo":return a.ordinalNumber(r,{unit:"quarter"});case"qqq":return a.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(r,{width:"narrow",context:"standalone"});default:return a.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,a){const r=e.getMonth();switch(t){case"M":case"MM":return Ft.M(e,t);case"Mo":return a.ordinalNumber(r+1,{unit:"month"});case"MMM":return a.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(r,{width:"narrow",context:"formatting"});default:return a.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,a){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Lt(r+1,2);case"Lo":return a.ordinalNumber(r+1,{unit:"month"});case"LLL":return a.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(r,{width:"narrow",context:"standalone"});default:return a.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,a,r){const s=Rt(e,r);return"wo"===t?a.ordinalNumber(s,{unit:"week"}):Lt(s,t.length)},I:function(e,t,a){const r=It(e);return"Io"===t?a.ordinalNumber(r,{unit:"week"}):Lt(r,t.length)},d:function(e,t,a){return"do"===t?a.ordinalNumber(e.getDate(),{unit:"date"}):Ft.d(e,t)},D:function(e,t,a){const r=Tt(e);return"Do"===t?a.ordinalNumber(r,{unit:"dayOfYear"}):Lt(r,t.length)},E:function(e,t,a){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return a.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(n);case"ee":return Lt(n,2);case"eo":return a.ordinalNumber(n,{unit:"day"});case"eee":return a.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"});default:return a.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,a,r){const s=e.getDay(),n=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(n);case"cc":return Lt(n,t.length);case"co":return a.ordinalNumber(n,{unit:"day"});case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"});default:return a.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,a){const r=e.getDay(),s=0===r?7:r;switch(t){case"i":return String(s);case"ii":return Lt(s,t.length);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return a.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(r,{width:"short",context:"formatting"});default:return a.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,a){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(r,{width:"narrow",context:"formatting"});default:return a.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,a){const r=e.getHours();let s;switch(s=12===r?Ut:0===r?zt:r/12>=1?"pm":"am",t){case"b":case"bb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,a){const r=e.getHours();let s;switch(s=r>=17?qt:r>=12?Bt:r>=4?Ot:$t,t){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,a){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),a.ordinalNumber(t,{unit:"hour"})}return Ft.h(e,t)},H:function(e,t,a){return"Ho"===t?a.ordinalNumber(e.getHours(),{unit:"hour"}):Ft.H(e,t)},K:function(e,t,a){const r=e.getHours()%12;return"Ko"===t?a.ordinalNumber(r,{unit:"hour"}):Lt(r,t.length)},k:function(e,t,a){let r=e.getHours();return 0===r&&(r=24),"ko"===t?a.ordinalNumber(r,{unit:"hour"}):Lt(r,t.length)},m:function(e,t,a){return"mo"===t?a.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ft.m(e,t)},s:function(e,t,a){return"so"===t?a.ordinalNumber(e.getSeconds(),{unit:"second"}):Ft.s(e,t)},S:function(e,t){return Ft.S(e,t)},X:function(e,t,a){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Ht(r);case"XXXX":case"XX":return Gt(r);default:return Gt(r,":")}},x:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"x":return Ht(r);case"xxxx":case"xx":return Gt(r);default:return Gt(r,":")}},O:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Wt(r,":");default:return"GMT"+Gt(r,":")}},z:function(e,t,a){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Wt(r,":");default:return"GMT"+Gt(r,":")}},t:function(e,t,a){return Lt(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,a){return Lt(e.getTime(),t.length)}};function Wt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),n=r%60;return 0===n?a+String(s):a+String(s)+t+Lt(n,2)}function Ht(e,t){if(e%60==0){return(e>0?"-":"+")+Lt(Math.abs(e)/60,2)}return Gt(e,t)}function Gt(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+Lt(Math.trunc(r/60),2)+t+Lt(r%60,2)}const Kt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Yt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Qt={p:Yt,P:(e,t)=>{const a=e.match(/(P+)(p+)?/)||[],r=a[1],s=a[2];if(!s)return Kt(e,t);let n;switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Kt(r,t)).replace("{{time}}",Yt(s,t))}},Xt=/^D+$/,Jt=/^Y+$/,Zt=["D","DD","YY","YYYY"];function ea(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const a=Ct(e);return!isNaN(Number(a))}const ta=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aa=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ra=/^'([^]*?)'?$/,sa=/''/g,na=/[a-zA-Z]/;function oa(e,t,a){const r=Nt(),s=a?.locale??r.locale??wt,n=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=Ct(e);if(!ea(i))throw new RangeError("Invalid time value");let l=t.match(aa).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,Qt[t])(e,s.formatLong)}return e}).join("").match(ta).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:ia(e)};if(Vt[t])return{isToken:!0,value:e};if(t.match(na))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});s.localize.preprocessor&&(l=s.localize.preprocessor(i,l));const c={firstWeekContainsDate:n,weekStartsOn:o,locale:s};return l.map(r=>{if(!r.isToken)return r.value;const n=r.value;(!a?.useAdditionalWeekYearTokens&&function(e){return Jt.test(e)}(n)||!a?.useAdditionalDayOfYearTokens&&function(e){return Xt.test(e)}(n))&&function(e,t,a){const r=function(e,t,a){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,a);if(Zt.includes(e))throw new RangeError(r)}(n,t,String(e));return(0,Vt[n[0]])(i,n,s.localize,c)}).join("")}function ia(e){const t=e.match(ra);return t?t[1].replace(sa,"'"):e}function la(e,t,a){const r=i.getDefaultOptions(),s=function(e,t,a){return new Intl.DateTimeFormat(a?[a.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,a.timeZone,a.locale??r.locale);return"formatToParts"in s?function(e,t){const a=e.formatToParts(t);for(let r=a.length-1;r>=0;--r)if("timeZoneName"===a[r].type)return a[r].value;return}(s,t):function(e,t){const a=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(a);return r?r[0].substr(1):""}(s,t)}function ca(e,t){const a=function(e){ua[e]||(ua[e]=pa?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}));return ua[e]}(t);return"formatToParts"in a?function(e,t){try{const a=e.formatToParts(t),r=[];for(let e=0;e<a.length;e++){const t=da[a[e].type];void 0!==t&&(r[t]=parseInt(a[e].value,10))}return r}catch(a){if(a instanceof RangeError)return[NaN];throw a}}(a,e):function(e,t){const a=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}(a,e)}const da={year:0,month:1,day:2,hour:3,minute:4,second:5};const ua={},ma=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),pa="06/25/2014, 00:00:00"===ma||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===ma;function ha(e,t,a,r,s,n,o){const i=new Date(0);return i.setUTCFullYear(e,t,a),i.setUTCHours(r,s,n,o),i}const xa=36e5,fa={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ga(e,t,a){if(!e)return 0;let r,s,n=fa.timezoneZ.exec(e);if(n)return 0;if(n=fa.timezoneHH.exec(e),n)return r=parseInt(n[1],10),va(r)?-r*xa:NaN;if(n=fa.timezoneHHMM.exec(e),n){r=parseInt(n[2],10);const e=parseInt(n[3],10);return va(r,e)?(s=Math.abs(r)*xa+6e4*e,"+"===n[1]?-s:s):NaN}if(function(e){if(ya[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),ya[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());const r=a?t:function(e){return ha(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),s=ba(r,e),n=a?s:function(e,t,a){const r=e.getTime();let s=r-t;const n=ba(new Date(s),a);if(t===n)return t;s-=n-t;const o=ba(new Date(s),a);if(n===o)return n;return Math.max(n,o)}(t,s,e);return-n}return NaN}function ba(e,t){const a=ca(e,t),r=ha(a[0],a[1]-1,a[2],a[3]%24,a[4],a[5],0).getTime();let s=e.getTime();const n=s%1e3;return s-=n>=0?n:1e3+n,r-s}function va(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const ya={};const wa={X:function(e,t,a){const r=ja(a.timeZone,e);if(0===r)return"Z";switch(t){case"X":return Ca(r);case"XXXX":case"XX":return _a(r);default:return _a(r,":")}},x:function(e,t,a){const r=ja(a.timeZone,e);switch(t){case"x":return Ca(r);case"xxxx":case"xx":return _a(r);default:return _a(r,":")}},O:function(e,t,a){const r=ja(a.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t=""){const a=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),n=r%60;if(0===n)return a+String(s);return a+String(s)+t+Na(n,2)}(r,":");default:return"GMT"+_a(r,":")}},z:function(e,t,a){switch(t){case"z":case"zz":case"zzz":return la("short",e,a);default:return la("long",e,a)}}};function ja(e,t){const a=e?ga(e,t,!0)/6e4:t?.getTimezoneOffset()??0;if(Number.isNaN(a))throw new RangeError("Invalid time zone specified: "+e);return a}function Na(e,t){const a=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return a+r}function _a(e,t=""){const a=e>0?"-":"+",r=Math.abs(e);return a+Na(Math.floor(r/60),2)+t+Na(Math.floor(r%60),2)}function Ca(e,t){if(e%60==0){return(e>0?"-":"+")+Na(Math.abs(e)/60,2)}return _a(e,t)}function ka(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Sa=36e5,Aa=6e4,Ta={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Da(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const a=null==t.additionalDigits?2:Number(t.additionalDigits);if(2!==a&&1!==a&&0!==a)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const r=function(e){const t={};let a,r=Ta.dateTimePattern.exec(e);r?(t.date=r[1],a=r[3]):(r=Ta.datePattern.exec(e),r?(t.date=r[1],a=r[2]):(t.date=null,a=e));if(a){const e=Ta.timeZone.exec(a);e?(t.time=a.replace(e[1],""),t.timeZone=e[1].trim()):t.time=a}return t}(e),{year:s,restDateString:n}=function(e,t){if(e){const a=Ta.YYY[t],r=Ta.YYYYY[t];let s=Ta.YYYY.exec(e)||r.exec(e);if(s){const t=s[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(s=Ta.YY.exec(e)||a.exec(e),s){const t=s[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(r.date,a),o=function(e,t){if(null===t)return null;let a,r,s;if(!e||!e.length)return a=new Date(0),a.setUTCFullYear(t),a;let n=Ta.MM.exec(e);if(n)return a=new Date(0),r=parseInt(n[1],10)-1,Ra(t,r)?(a.setUTCFullYear(t,r),a):new Date(NaN);if(n=Ta.DDD.exec(e),n){a=new Date(0);const e=parseInt(n[1],10);return function(e,t){if(t<1)return!1;const a=Ma(e);if(a&&t>366)return!1;if(!a&&t>365)return!1;return!0}(t,e)?(a.setUTCFullYear(t,0,e),a):new Date(NaN)}if(n=Ta.MMDD.exec(e),n){a=new Date(0),r=parseInt(n[1],10)-1;const e=parseInt(n[2],10);return Ra(t,r,e)?(a.setUTCFullYear(t,r,e),a):new Date(NaN)}if(n=Ta.Www.exec(e),n)return s=parseInt(n[1],10)-1,La(s)?Ea(t,s):new Date(NaN);if(n=Ta.WwwD.exec(e),n){s=parseInt(n[1],10)-1;const e=parseInt(n[2],10)-1;return La(s,e)?Ea(t,s,e):new Date(NaN)}return null}(n,s);if(null===o||isNaN(o.getTime()))return new Date(NaN);if(o){const e=o.getTime();let a,s=0;if(r.time&&(s=function(e){let t,a,r=Ta.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),Fa(t)?t%24*Sa:NaN;if(r=Ta.HHMM.exec(e),r)return t=parseInt(r[1],10),a=parseFloat(r[2].replace(",",".")),Fa(t,a)?t%24*Sa+a*Aa:NaN;if(r=Ta.HHMMSS.exec(e),r){t=parseInt(r[1],10),a=parseInt(r[2],10);const e=parseFloat(r[3].replace(",","."));return Fa(t,a,e)?t%24*Sa+a*Aa+1e3*e:NaN}return null}(r.time),null===s||isNaN(s)))return new Date(NaN);if(r.timeZone||t.timeZone){if(a=ga(r.timeZone||t.timeZone,new Date(e+s)),isNaN(a))return new Date(NaN)}else a=ka(new Date(e+s)),a=ka(new Date(e+s+a));return new Date(e+s+a)}return new Date(NaN)}function Ea(e,t,a){t=t||0,a=a||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const s=7*t+a+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}const Pa=[31,28,31,30,31,30,31,31,30,31,30,31],Ia=[31,29,31,30,31,30,31,31,30,31,30,31];function Ma(e){return e%400==0||e%4==0&&e%100!=0}function Ra(e,t,a){if(t<0||t>11)return!1;if(null!=a){if(a<1)return!1;const r=Ma(e);if(r&&a>Ia[t])return!1;if(!r&&a>Pa[t])return!1}return!0}function La(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function Fa(e,t,a){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==a||!(a<0||a>=60)))}const za=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Ua(e,t,a,r){return function(e,t,a={}){const r=(t=String(t)).match(za);if(r){const s=Da(a.originalDate||e,a);t=r.reduce(function(e,t){if("'"===t[0])return e;const r=e.indexOf(t),n="'"===e[r-1],o=e.replace(t,"'"+wa[t[0]](s,t,a)+"'");return n?o.substring(0,r-1)+o.substring(r+1):o},t)}return oa(e,t,a)}(function(e,t,a){const r=ga(t,e=Da(e,a),!0),s=new Date(e.getTime()-r),n=new Date(0);return n.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),n.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),n}(e,t,{timeZone:(r={...r,timeZone:t,originalDate:e}).timeZone}),a,r)}const Oa={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Ba={date:pt({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:pt({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:pt({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},qa={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},$a={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Va={ordinalNumber:(e,t)=>Number(e)+"º",era:ft({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:ft({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ft({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:ft({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:ft({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},Wa={ordinalNumber:vt({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:bt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:bt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:bt({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:bt({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:bt({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},Ha={code:"es",formatDistance:(e,t,a)=>{let r;const s=Oa[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},formatLong:Ba,formatRelative:(e,t,a,r)=>1!==t.getHours()?$a[e]:qa[e],localize:Va,match:Wa,options:{weekStartsOn:1,firstWeekContainsDate:1}},Ga={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ka={date:pt({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:pt({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:pt({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ya={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Qa={ordinalNumber:(e,t)=>{const a=Number(e);return"week"===t?.unit?a+"ª":a+"º"},era:ft({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:ft({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ft({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:ft({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:ft({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},Xa={ordinalNumber:vt({matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:bt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:bt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:bt({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:bt({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:bt({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},Ja={code:"pt-BR",formatDistance:(e,t,a)=>{let r;const s=Ga[e];return r="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",String(t)),a?.addSuffix?a.comparison&&a.comparison>0?"em "+r:"há "+r:r},formatLong:Ka,formatRelative:(e,t,a,r)=>{const s=Ya[e];return"function"==typeof s?s(t):s},localize:Qa,match:Xa,options:{weekStartsOn:0,firstWeekContainsDate:1}},Za=[{value:"pt-BR",label:"Português (BR)",flag:"🇧🇷"},{value:"en-US",label:"English (US)",flag:"🇺🇸"},{value:"es-ES",label:"Español",flag:"🇪🇸"}],er=[{value:"dd/MM/yyyy HH:mm",label:"dd/MM/yyyy HH:mm",example:"28/11/2024 14:30",description:"Padrão Brasileiro"},{value:"MM/dd/yyyy hh:mm a",label:"MM/dd/yyyy hh:mm a",example:"11/28/2024 02:30 PM",description:"Padrão Americano (12h)"},{value:"MM/dd/yyyy HH:mm",label:"MM/dd/yyyy HH:mm",example:"11/28/2024 14:30",description:"Padrão Americano (24h)"},{value:"yyyy-MM-dd HH:mm",label:"yyyy-MM-dd HH:mm",example:"2024-11-28 14:30",description:"ISO 8601"},{value:"dd.MM.yyyy HH:mm",label:"dd.MM.yyyy HH:mm",example:"28.11.2024 14:30",description:"Padrão Europeu"},{value:"d MMM yyyy, HH:mm",label:"d MMM yyyy, HH:mm",example:"28 Nov 2024, 14:30",description:"Formato Longo"}],tr=[{value:"America/Sao_Paulo",label:"Brasília (UTC-3)",offset:"-03:00"},{value:"America/Noronha",label:"Fernando de Noronha (UTC-2)",offset:"-02:00"},{value:"America/Manaus",label:"Manaus (UTC-4)",offset:"-04:00"},{value:"America/Rio_Branco",label:"Rio Branco (UTC-5)",offset:"-05:00"},{value:"America/Buenos_Aires",label:"Buenos Aires (UTC-3)",offset:"-03:00"},{value:"America/Santiago",label:"Santiago (UTC-4)",offset:"-04:00"},{value:"America/Bogota",label:"Bogotá (UTC-5)",offset:"-05:00"},{value:"America/Mexico_City",label:"Cidade do México (UTC-6)",offset:"-06:00"},{value:"America/New_York",label:"New York (UTC-5)",offset:"-05:00"},{value:"America/Chicago",label:"Chicago (UTC-6)",offset:"-06:00"},{value:"America/Denver",label:"Denver (UTC-7)",offset:"-07:00"},{value:"America/Los_Angeles",label:"Los Angeles (UTC-8)",offset:"-08:00"},{value:"America/Toronto",label:"Toronto (UTC-5)",offset:"-05:00"},{value:"America/Vancouver",label:"Vancouver (UTC-8)",offset:"-08:00"},{value:"Europe/London",label:"Londres (UTC+0)",offset:"+00:00"},{value:"Europe/Lisbon",label:"Lisboa (UTC+0)",offset:"+00:00"},{value:"Europe/Paris",label:"Paris (UTC+1)",offset:"+01:00"},{value:"Europe/Berlin",label:"Berlim (UTC+1)",offset:"+01:00"},{value:"Europe/Madrid",label:"Madrid (UTC+1)",offset:"+01:00"},{value:"Europe/Rome",label:"Roma (UTC+1)",offset:"+01:00"},{value:"Europe/Amsterdam",label:"Amsterdã (UTC+1)",offset:"+01:00"},{value:"Europe/Moscow",label:"Moscou (UTC+3)",offset:"+03:00"},{value:"Asia/Dubai",label:"Dubai (UTC+4)",offset:"+04:00"},{value:"Asia/Kolkata",label:"Mumbai (UTC+5:30)",offset:"+05:30"},{value:"Asia/Singapore",label:"Singapura (UTC+8)",offset:"+08:00"},{value:"Asia/Hong_Kong",label:"Hong Kong (UTC+8)",offset:"+08:00"},{value:"Asia/Shanghai",label:"Xangai (UTC+8)",offset:"+08:00"},{value:"Asia/Tokyo",label:"Tóquio (UTC+9)",offset:"+09:00"},{value:"Asia/Seoul",label:"Seul (UTC+9)",offset:"+09:00"},{value:"Australia/Perth",label:"Perth (UTC+8)",offset:"+08:00"},{value:"Australia/Sydney",label:"Sydney (UTC+10)",offset:"+10:00"},{value:"Pacific/Auckland",label:"Auckland (UTC+12)",offset:"+12:00"},{value:"UTC",label:"UTC (UTC+0)",offset:"+00:00"}],ar="pt-BR",rr="dd/MM/yyyy HH:mm",sr="America/Sao_Paulo",nr=e=>Za.some(t=>t.value===e),or=e=>tr.some(t=>t.value===e),ir=()=>{if("undefined"==typeof navigator)return ar;const e=navigator.language;if(nr(e))return e;const t=e.split("-")[0],a=Za.find(e=>e.value.startsWith(t));return a?.value||ar},lr=()=>{if("undefined"==typeof Intl)return sr;try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return or(e)?e:sr}catch{return sr}},cr=e=>({"pt-BR":"dd/MM/yyyy HH:mm","en-US":"MM/dd/yyyy hh:mm a","es-ES":"dd/MM/yyyy HH:mm"}[e]||rr),dr={"pt-BR":Ja,"en-US":wt,"es-ES":Ha},ur=(e,t=rr,a=sr,r=ar)=>{if(!e)return"";const s=i.parseISO(e);if(!i.isValid(s))return"Data inválida";const n=dr[r]||Ja;try{return Ua(s,a,t,{locale:n})}catch(o){return Ua(s,sr,t,{locale:n})}},mr=(e,t=ar,a=sr)=>{if(!e)return"";const r=i.parseISO(e);if(!i.isValid(r))return"Data inválida";const s=dr[t]||Ja;try{return Ua(r,a,"PP",{locale:s})}catch(n){return Ua(r,sr,"PP",{locale:s})}};function pr(e){const t=e.replace("#",""),a=3===t.length?t.split("").map(e=>e+e).join(""):t;return{r:parseInt(a.substring(0,2),16),g:parseInt(a.substring(2,4),16),b:parseInt(a.substring(4,6),16)}}function hr(e,t=.1){const{r:a,g:r,b:s}=pr(e);return`rgba(${a}, ${r}, ${s}, ${t})`}function xr(e){const{r:t,g:a,b:r}=pr(e),[s,n,o]=[t,a,r].map(e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)});return.2126*s+.7152*n+.0722*o}function fr(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{l.toast.info("Link copiado para a área de transferência")})}function gr(e,t){return t?e.replace(/\{alias\}/g,t):e}function br(e="uuid"){if("short"===e){const e=new Uint8Array(9);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(36).padStart(2,"0")).join("").slice(0,12)}if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const a=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}const vr=["hint","details","code","where","schema","table","column"],yr="Ocorreu um erro ao processar sua solicitação.",wr=[/relation\s+"[^"]+"\s+does not exist/i,/column\s+"[^"]+"\s+of relation/i,/violates row-level security policy/i,/permission denied for (table|schema|function)/i,/password|token|secret|api[_-]?key/i];function jr(e){const t=function(e){if(!e)return yr;if("string"==typeof e)return e;if(e instanceof Error)return e.message||yr;if("object"==typeof e&&"message"in e)return String(e.message);return yr}(e);return Me()?t:wr.some(e=>e.test(t))?yr:t}function Nr(...e){return o.twMerge(n.clsx(e))}const _r=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(_r);if("object"==typeof e&&e.constructor===Object){const t={};for(const[a,r]of Object.entries(e))t[a]=_r(r);return t}return e},Cr=s.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm hover:shadow-md active:scale-[0.98]",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary-hover border border-input shadow-sm",tertiary:"bg-background text-foreground hover:bg-accent hover:text-accent-foreground border border-border",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",subtle:"text-muted-foreground hover:text-foreground hover:bg-accent/50",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm hover:shadow-md",link:"text-primary underline-offset-4 hover:underline",icon:"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2",loading:"bg-primary/50 text-primary-foreground cursor-wait",default:"bg-primary text-primary-foreground hover:bg-primary/90",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{sm:"h-8 px-3 text-xs rounded-lg",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-12 px-8 text-base rounded-lg",xl:"h-14 px-10 text-lg rounded-lg",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6",default:"h-10 px-4 py-2"}},defaultVariants:{variant:"primary",size:"md"}}),kr=te.forwardRef(({className:e,variant:a,size:s,asChild:n=!1,...o},i)=>{const l=n?r.Slot:"button";return t.jsx(l,{className:Nr(Cr({variant:a,size:s,className:e})),ref:i,...o})});kr.displayName="Button";const Sr=a.forwardRef(({className:e,children:a,variant:r="action",...s},n)=>t.jsx(kr,{ref:n,variant:r,size:"icon",className:Nr("h-8 w-8",e),...s,children:a||t.jsx(c.EllipsisVertical,{size:16})}));Sr.displayName="ActionButton";const Ar=te.forwardRef(({className:e,type:a,showCharCount:r,maxLength:s,onChange:n,...o},i)=>{const[l,c]=te.useState(0);te.useEffect(()=>{"string"==typeof o.value?c(o.value.length):"string"==typeof o.defaultValue&&c(o.defaultValue.length)},[o.value,o.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("input",{type:a,className:Nr("flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors md:text-sm",e),ref:i,maxLength:s,onChange:e=>{c(e.target.value.length),n?.(e)},...o}),r&&s&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[l," / ",s]})]})});Ar.displayName="Input";const Tr=s.cva("text-xs font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Dr=te.forwardRef(({className:e,...a},r)=>t.jsx(re.Root,{ref:r,className:Nr(Tr(),e),...a}));Dr.displayName=re.Root.displayName;const Er=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("rounded-lg border bg-card text-card-foreground shadow-sm",e),...a}));Er.displayName="Card";const Pr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("flex flex-col space-y-1.5 p-6",e),...a}));Pr.displayName="CardHeader";const Ir=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:Nr("text-2xl font-semibold leading-none tracking-tight",e),...a}));Ir.displayName="CardTitle";const Mr=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));Mr.displayName="CardDescription";const Rr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("p-6 pt-0",e),...a}));Rr.displayName="CardContent";const Lr=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("flex items-center p-6 pt-0",e),...a}));Lr.displayName="CardFooter";const Fr=te.forwardRef(({className:e,orientation:a="horizontal",decorative:r=!0,...s},n)=>t.jsx(ne.Root,{ref:n,decorative:r,orientation:a,className:Nr("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Fr.displayName=ne.Root.displayName;const zr=oe.Root,Ur=oe.Trigger,Or=oe.Portal,Br=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Overlay,{className:Nr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));Br.displayName=oe.Overlay.displayName;const qr=te.forwardRef(({className:e,...a},r)=>t.jsxs(Or,{children:[t.jsx(Br,{}),t.jsx(oe.Content,{ref:r,className:Nr("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a})]}));qr.displayName=oe.Content.displayName;const $r=({className:e,...a})=>t.jsx("div",{className:Nr("flex flex-col space-y-2 text-center sm:text-left",e),...a});$r.displayName="AlertDialogHeader";const Vr=({className:e,...a})=>t.jsx("div",{className:Nr("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});Vr.displayName="AlertDialogFooter";const Wr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Title,{ref:r,className:Nr("text-lg font-semibold",e),...a}));Wr.displayName=oe.Title.displayName;const Hr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Description,{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));Hr.displayName=oe.Description.displayName;const Gr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Action,{ref:r,className:Nr(Cr(),e),...a}));Gr.displayName=oe.Action.displayName;const Kr=te.forwardRef(({className:e,...a},r)=>t.jsx(oe.Cancel,{ref:r,className:Nr(Cr({variant:"outline"}),"mt-2 sm:mt-0",e),...a}));Kr.displayName=oe.Cancel.displayName;const Yr=se.Root,Qr=se.Trigger,Xr=se.Portal,Jr=se.Close,Zr=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{ref:r,className:Nr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));Zr.displayName=se.Overlay.displayName;const es={sm:{width:"30vw",minWidth:"320px",maxWidth:"480px",maxHeight:"320px"},md:{width:"50vw",minWidth:"480px",maxWidth:"720px",maxHeight:"70vh"},lg:{width:"85vw",height:"85vh",maxWidth:"1440px",minHeight:"480px",maxHeight:"900px"}},ts=te.forwardRef(({className:a,children:r,size:s,variant:n="informative",isDirty:o,customWidth:i,customMinWidth:l,customMaxWidth:d,customHeight:u,customMinHeight:m,customMaxHeight:p,unsavedChangesTitle:h=e.t("unsaved_changes"),unsavedChangesDescription:x=e.t("unsaved_changes_description"),cancelText:f=e.t("cancel"),leaveWithoutSavingText:g=e.t("leave_without_saving"),style:b,onInteractOutside:v,onEscapeKeyDown:y,...w},j)=>{const[N,_]=te.useState(!1),C=te.useRef(null),k=te.useRef(!1),S=s??(i||l||d||u||m||p?void 0:"md"),A=S?es[S]:{},T={...i??A.width?{width:i??A.width}:{},...l??A.minWidth?{minWidth:l??A.minWidth}:{},...d??A.maxWidth?{maxWidth:d??A.maxWidth}:{},...u??A.height?{height:u??A.height}:{},...m??A.minHeight?{minHeight:m??A.minHeight}:{},...p??A.maxHeight?{maxHeight:p??A.maxHeight}:{},...b},D=te.useCallback(e=>{"form"===n&&o?(C.current=e,_(!0)):e()},[n,o]),E=te.useRef(null),P="destructive"!==n;if("development"===process.env.NODE_ENV&&r){const e=te.Children.toArray(r);e.some(e=>te.isValidElement(e)&&"DialogFooter"===e.type?.displayName),e.some(e=>te.isValidElement(e)&&"DialogBody"===e.type?.displayName)}return t.jsxs(Xr,{children:[t.jsx(Zr,{}),t.jsxs(se.Content,{ref:j,className:Nr("fixed left-[50%] top-[50%] z-50 flex flex-col translate-x-[-50%] translate-y-[-50%] border-0 border-l-[10px] border-l-primary bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-sm:!w-[calc(100vw-2rem)] max-sm:!h-[calc(100dvh-2rem)] max-sm:!min-w-0 max-sm:!min-h-0 max-sm:!max-w-none max-sm:!max-h-none max-sm:p-4",a),style:T,onInteractOutside:e=>{"form"!==n&&"destructive"!==n?v?.(e):e.preventDefault()},onEscapeKeyDown:e=>{if("destructive"!==n)return"form"===n&&o?(e.preventDefault(),void D(()=>{k.current=!0,E.current?.click()})):void y?.(e);e.preventDefault()},...w,children:[r,P&&t.jsxs(se.Close,{ref:E,onClick:e=>{k.current?k.current=!1:"form"===n&&o&&(e.preventDefault(),D(()=>{k.current=!0,E.current?.click()}))},className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]}),t.jsx(zr,{open:N,onOpenChange:_,children:t.jsxs(qr,{children:[t.jsxs($r,{children:[t.jsx(Wr,{children:h}),t.jsx(Hr,{children:x})]}),t.jsxs(Vr,{children:[t.jsx(Kr,{onClick:()=>{_(!1),C.current=null},children:f}),t.jsx(Gr,{onClick:()=>{_(!1),C.current?.(),C.current=null},children:g})]})]})})]})});ts.displayName=se.Content.displayName;const as=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:Nr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Fr,{className:"mt-2"})]});as.displayName="DialogHeader";const rs=({className:e,...a})=>t.jsx("div",{className:Nr("flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2",e),...a});rs.displayName="DialogBody";const ss=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Fr,{className:"mb-4"}),t.jsx("div",{className:Nr("flex flex-row justify-end gap-2",e),...r,children:a})]});ss.displayName="DialogFooter";const ns=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:Nr("text-xl font-semibold leading-none tracking-tight",e),...a}));ns.displayName=se.Title.displayName;const os=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));os.displayName=se.Description.displayName;const is=h.FormProvider,ls=te.createContext({}),cs=()=>{const e=te.useContext(ls),t=te.useContext(ds),{getFieldState:a,formState:r}=h.useFormContext(),s=a(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:n}=t;return{id:n,name:e.name,formItemId:`${n}-form-item`,formDescriptionId:`${n}-form-item-description`,formMessageId:`${n}-form-item-message`,...s}},ds=te.createContext({}),us=te.forwardRef(({className:e,...a},r)=>{const s=te.useId();return t.jsx(ds.Provider,{value:{id:s},children:t.jsx("div",{ref:r,className:Nr("space-y-1.5",e),...a})})});us.displayName="FormItem";const ms=te.forwardRef(({className:e,...a},r)=>{const{error:s,formItemId:n}=cs();return t.jsx(Dr,{ref:r,className:Nr(s&&"text-destructive",e),htmlFor:n,...a})});ms.displayName="FormLabel";const ps=te.forwardRef(({...e},a)=>{const{error:s,formItemId:n,formDescriptionId:o,formMessageId:i}=cs();return t.jsx(r.Slot,{ref:a,id:n,"aria-describedby":s?`${o} ${i}`:`${o}`,"aria-invalid":!!s,...e})});ps.displayName="FormControl";const hs=te.forwardRef(({className:e,...a},r)=>{const{formDescriptionId:s}=cs();return t.jsx("p",{ref:r,id:s,className:Nr("text-sm text-muted-foreground",e),...a})});hs.displayName="FormDescription";const xs=te.forwardRef(({className:e,children:a,...r},s)=>{const{error:n,formMessageId:o}=cs(),i=n?String(n?.message):a;return i?t.jsx("p",{ref:s,id:o,className:Nr("text-sm font-medium text-destructive",e),...r,children:i}):null});xs.displayName="FormMessage";const fs=te.createContext({showCheck:!1}),gs=({showCheck:e=!1,...a})=>t.jsx(fs.Provider,{value:{showCheck:e},children:t.jsx(ie.Root,{...a})}),bs=ie.Group,vs=ie.Value,ys=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ie.Trigger,{ref:s,className:Nr("flex h-10 w-full items-center justify-between rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors [&>span]:line-clamp-1",e),...r,children:[a,t.jsx(ie.Icon,{asChild:!0,children:t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ys.displayName=ie.Trigger.displayName;const ws=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollUpButton,{ref:r,className:Nr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronUp,{className:"h-4 w-4"})}));ws.displayName=ie.ScrollUpButton.displayName;const js=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.ScrollDownButton,{ref:r,className:Nr("flex cursor-default items-center justify-center py-1",e),...a,children:t.jsx(c.ChevronDown,{className:"h-4 w-4"})}));js.displayName=ie.ScrollDownButton.displayName;const Ns=te.forwardRef(({className:e,children:a,position:r="popper",container:s,collisionBoundary:n,...o},i)=>t.jsx(ie.Portal,{container:s,children:t.jsxs(ie.Content,{ref:i,className:Nr("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,collisionBoundary:n,...o,children:[t.jsx(ws,{}),t.jsx(ie.Viewport,{className:Nr("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),t.jsx(js,{})]})}));Ns.displayName=ie.Content.displayName;const _s=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Label,{ref:r,className:Nr("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...a}));_s.displayName=ie.Label.displayName;const Cs=te.forwardRef(({className:e,children:a,...r},s)=>{const{showCheck:n}=te.useContext(fs);return t.jsxs(ie.Item,{ref:s,className:Nr("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n?"pl-8":"pl-2","data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground data-[state=checked]:font-medium data-[state=checked]:border-l-2 data-[state=checked]:border-primary",n?"data-[state=checked]:pl-[calc(2rem-2px)]":"data-[state=checked]:pl-[calc(0.5rem-2px)]",e),...r,children:[n&&t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ie.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),t.jsx(ie.ItemText,{children:a})]})});Cs.displayName=ie.Item.displayName;const ks=te.forwardRef(({className:e,...a},r)=>t.jsx(ie.Separator,{ref:r,className:Nr("-mx-1 my-1 h-px bg-muted",e),...a}));ks.displayName=ie.Separator.displayName;const Ss=te.forwardRef(({className:e,...a},r)=>t.jsx(le.Root,{ref:r,className:Nr("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:t.jsx(le.Indicator,{className:Nr("flex items-center justify-center text-current"),children:t.jsx(c.Check,{className:"h-4 w-4"})})}));Ss.displayName=le.Root.displayName;const As=te.forwardRef(({className:e,showCharCount:a,maxLength:r,onChange:s,...n},o)=>{const[i,l]=te.useState(0);te.useEffect(()=>{"string"==typeof n.value?l(n.value.length):"string"==typeof n.defaultValue&&l(n.defaultValue.length)},[n.value,n.defaultValue]);return t.jsxs("div",{className:"w-full",children:[t.jsx("textarea",{className:Nr("flex min-h-[80px] w-full rounded-lg border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",e),ref:o,maxLength:r,onChange:e=>{l(e.target.value.length),s?.(e)},...n}),a&&r&&t.jsxs("div",{className:"text-right text-xs text-muted-foreground mt-1",children:[i," / ",r]})]})});As.displayName="Textarea";const Ts=s.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",danger:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-success text-success-foreground hover:bg-success/90",warning:"border-transparent bg-warning text-warning-foreground hover:bg-warning/90",info:"border-transparent bg-primary/10 text-primary hover:bg-primary/20",sharp:"border-transparent bg-[hsl(78,70%,46%)] text-foreground hover:bg-[hsl(78,70%,40%)]"}},defaultVariants:{variant:"default"}}),Ds=te.forwardRef(({className:e,variant:a,...r},s)=>t.jsx("div",{ref:s,className:Nr(Ts({variant:a}),e),...r}));Ds.displayName="Badge";const Es={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Ps({size:e="md",className:a}){return t.jsx(c.Loader2,{className:Nr("animate-spin text-muted-foreground",Es[e],a)})}function Is({isLoading:e,children:a,className:r,type:s="spinner",size:n="md"}){return e?"overlay"===s?t.jsxs("div",{className:Nr("relative",r),children:[a,t.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:t.jsx(Ps,{size:n})})]}):"skeleton"===s?t.jsx("div",{className:Nr("animate-pulse",r),children:t.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):t.jsx("div",{className:Nr("flex items-center justify-center py-8",r),children:t.jsx(Ps,{size:n})}):t.jsx(t.Fragment,{children:a})}const Ms=({...e})=>t.jsx(l.Toaster,{className:"group",position:"top-right",expand:!0,visibleToasts:5,closeButton:!0,icons:{success:t.jsx(c.CircleCheckIcon,{className:"h-4 w-4"}),info:t.jsx(c.InfoIcon,{className:"h-4 w-4"}),warning:t.jsx(c.TriangleAlertIcon,{className:"h-4 w-4"}),error:t.jsx(c.OctagonXIcon,{className:"h-4 w-4"}),loading:t.jsx(c.Loader2Icon,{className:"h-4 w-4 animate-spin"})},toastOptions:{classNames:{toast:"group toast group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:relative",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:right-2 group-[.toast]:top-2 group-[.toast]:left-auto group-[.toast]:transform-none group-[.toast]:border-0 group-[.toast]:bg-transparent group-[.toast]:opacity-70 group-[.toast]:hover:opacity-100 group-[.toast]:hover:bg-transparent group-[.toast]:transition-opacity",success:"!bg-success-light !border-success-light",error:"!bg-destructive-light !border-destructive-light",warning:"!bg-warning-light !border-warning-light",info:"!bg-info-light !border-info-light"}},...e}),Rs=ce.Root,Ls=ce.Trigger,Fs=ce.Group,zs=ce.Portal,Us=ce.Sub,Os=ce.RadioGroup,Bs=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(ce.SubTrigger,{ref:n,className:Nr("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Bs.displayName=ce.SubTrigger.displayName;const qs=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.SubContent,{ref:r,className:Nr("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));qs.displayName=ce.SubContent.displayName;const $s=te.forwardRef(({className:e,sideOffset:a=4,...r},s)=>t.jsx(ce.Portal,{children:t.jsx(ce.Content,{ref:s,sideOffset:a,className:Nr("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground p-1 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));$s.displayName=ce.Content.displayName;const Vs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Item,{ref:s,className:Nr("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Vs.displayName=ce.Item.displayName;const Ws=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(ce.CheckboxItem,{ref:n,className:Nr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Ws.displayName=ce.CheckboxItem.displayName;const Hs=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(ce.RadioItem,{ref:s,className:Nr("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ce.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Hs.displayName=ce.RadioItem.displayName;const Gs=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(ce.Label,{ref:s,className:Nr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));Gs.displayName=ce.Label.displayName;const Ks=te.forwardRef(({className:e,...a},r)=>t.jsx(ce.Separator,{ref:r,className:Nr("-mx-1 my-1 h-px bg-muted",e),...a}));Ks.displayName=ce.Separator.displayName;const Ys=({className:e,...a})=>t.jsx("span",{className:Nr("ml-auto text-xs tracking-widest opacity-60",e),...a});Ys.displayName="DropdownMenuShortcut";const Qs=({delayDuration:e=300,...a})=>t.jsx(de.Provider,{delayDuration:e,...a}),Xs=de.Root,Js=de.Trigger,Zs=te.forwardRef(({className:e,sideOffset:a=4,container:r,...s},n)=>t.jsx(de.Portal,{container:r,children:t.jsx(de.Content,{ref:n,sideOffset:a,className:Nr("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));Zs.displayName=de.Content.displayName;const en=te.forwardRef(({children:e,disabledReason:a,className:r},s)=>{const n=t.jsx(Vs,{ref:s,className:Nr("opacity-50 cursor-not-allowed pointer-events-auto",r),onSelect:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation()},children:e});return a?t.jsx(Qs,{delayDuration:100,children:t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("div",{className:"w-full",children:n})}),t.jsx(Zs,{side:"right",sideOffset:8,className:"max-w-[200px] z-[100]",children:a})]})}):n});en.displayName="DisabledMenuItem";const tn=ue.Root,an=ue.Trigger,rn=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,container:s,...n},o)=>t.jsx(ue.Portal,{container:s,children:t.jsx(ue.Content,{ref:o,align:a,sideOffset:r,className:Nr("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));rn.displayName=ue.Content.displayName;const sn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a}));sn.displayName="Command";const nn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:t.jsx("input",{ref:r,className:Nr("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...a})}));nn.displayName="CommandInput";const on=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a}));on.displayName="CommandList";const ln=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("py-6 text-center text-sm text-muted-foreground",e),...a}));ln.displayName="CommandEmpty";const cn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a}));cn.displayName="CommandGroup";const dn=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("-mx-1 h-px bg-border",e),...a}));dn.displayName="CommandSeparator";const un=te.forwardRef(({className:e,disabled:a,onSelect:r,value:s,...n},o)=>t.jsx("div",{ref:o,className:Nr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":a,onClick:()=>!a&&r?.(s||""),...n}));un.displayName="CommandItem";const mn=({className:e,...a})=>t.jsx("span",{className:Nr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});function pn({className:e,...a}){return t.jsx("div",{className:Nr("animate-pulse rounded-md bg-muted",e),...a})}mn.displayName="CommandShortcut";const hn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function xn({multiple:r,options:s,value:n,onChange:o,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f,required:g,className:b,sortOptions:v,maxDisplayedBadges:y,popoverContainer:w,onOpen:j,onClose:N,clearable:_,showCheck:C}){const[k,S]=a.useState(!1),[A,T]=a.useState(""),D=a.useMemo(()=>n?Array.isArray(n)?n:[n]:[],[n]),E=a.useMemo(()=>{if(!w)return;let e=w,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[w]),P=a.useMemo(()=>{const e=s.map(e=>({original:e,value:i(e),label:l(e)}));return v?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[s,i,l,v]),I=a.useMemo(()=>{if(!A)return P;const e=hn(A);return P.filter(t=>hn(t.label).includes(e))},[P,A]),M=a.useMemo(()=>P.filter(e=>D.includes(e.value)),[P,D]),R=e=>{S(e),e?j?.():(T(""),N?.())},L=(e,t)=>{t.preventDefault(),t.stopPropagation(),o&&o(r?D.filter(t=>t!==e):"")},F=y?M.slice(0,y):M,z=y&&M.length>y?M.length-y:0;return t.jsxs("div",{className:Nr("space-y-2",b),children:[m&&t.jsxs(Dr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(tn,{open:k,onOpenChange:R,modal:!1,children:[r?t.jsx(an,{asChild:!0,children:t.jsxs("div",{role:"combobox","aria-expanded":k,"aria-disabled":f,tabIndex:f?-1:0,onKeyDown:e=>{f||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R(!k))},className:Nr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",f&&"pointer-events-none opacity-50 cursor-not-allowed",0===M.length&&"text-muted-foreground"),children:[0===M.length?t.jsxs("span",{className:"flex items-center gap-2",children:[p&&t.jsx(p,{className:"h-4 w-4"}),u]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[F.map(e=>t.jsxs(Ds,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&L(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>L(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),z>0&&t.jsxs(Ds,{variant:"outline",className:"gap-1",children:["+",z]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}):t.jsxs("div",{className:"relative",children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{variant:"outline",role:"combobox","aria-expanded":k,disabled:f,className:Nr("relative w-full justify-start min-h-10 h-auto pr-10",_&&M.length>0&&"pr-16",0===M.length&&"text-muted-foreground"),children:[0===M.length?t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:u})]}):t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate text-left",children:[p&&t.jsx(p,{className:"h-4 w-4"}),t.jsx("span",{className:"truncate",children:M[0]?.label})]}),t.jsx(c.ChevronDown,{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-50"})]})}),_&&M.length>0&&t.jsx("button",{type:"button",disabled:f,className:"absolute right-8 top-1/2 z-10 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>L("",e),title:"Limpar seleção","aria-label":"Limpar seleção",children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(rn,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:E,collisionBoundary:E,children:t.jsxs(sn,{children:[t.jsxs("div",{className:"relative",children:[t.jsx(nn,{placeholder:x,value:A,onChange:e=>T(e.target.value)}),A&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>T(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx(on,{children:0===s.length?t.jsx(ln,{children:h}):0===I.length?t.jsx(ln,{children:e.t("no_results")}):t.jsx(cn,{children:I.map(e=>{const a=D.includes(e.value);return t.jsxs(un,{value:e.value,onSelect:()=>(e=>{if(o)if(r){const t=D.includes(e)?D.filter(t=>t!==e):[...D,e];o(t)}else o(e),S(!1)})(e.value),className:Nr("cursor-pointer",a&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary pl-[calc(0.5rem-2px)] data-[selected=true]:bg-accent"),children:[C&&t.jsx(c.Check,{className:Nr("mr-2 h-4 w-4",a?"opacity-100":"opacity-0")}),d?d(e.original):e.label]},e.value)})})})]})})]})]})}function fn({multiple:e=!1,options:a,items:r,value:s,onChange:n,onValueChange:o,getOptionValue:i=e=>e.value,getOptionLabel:l=e=>e.label,renderOption:d,placeholder:u,label:m,icon:p,emptyMessage:h,searchPlaceholder:x,disabled:f=!1,required:g=!1,isLoading:b=!1,error:v,className:w,sortOptions:j=!0,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S=!0,showCheck:A=!1}){const{t:T}=y.useTranslation(),D=a||r||[],E=o||n,P=u||T("select_placeholder","Selecione..."),I=h||T("no_results",T("no_results")),M=x||T("search_placeholder","Pesquisar...");if(b)return t.jsxs("div",{className:Nr("space-y-2",w),children:[m&&t.jsxs(Dr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(pn,{className:"h-10 w-full"})]});const R="string"==typeof v?v:v instanceof Error?v.message:v?T("error_loading",T("error_loading")):void 0;return R?t.jsxs("div",{className:Nr("space-y-2",w),children:[m&&t.jsxs(Dr,{children:[m,g&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:R})]})]}):t.jsx(xn,{multiple:e,options:D,value:s||(e?[]:""),onChange:E,getOptionValue:i,getOptionLabel:l,renderOption:d,placeholder:P,label:m,icon:p,emptyMessage:I,searchPlaceholder:M,disabled:f,required:g,className:w,sortOptions:j,maxDisplayedBadges:N,popoverContainer:_,onOpen:C,onClose:k,clearable:S,showCheck:A})}const gn=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();function bn(e,t){if(!t)return null;const a=gn(t),r=[];for(const s of e){const e=gn(s.label).includes(a),n=s.children?bn(s.children,t):null,o=n&&n.length>0;(e||o)&&r.push({...s,children:e?s.children:o?n:s.children})}return r}function vn(e,t){for(const a of e){if(a.value===t)return a.label;if(a.children){const e=vn(a.children,t);if(e)return e}}}function yn({node:e,level:a,expanded:r,onToggleExpand:s,selectedValues:n,onSelect:o,showCheck:i}){const l=e.children&&e.children.length>0,d=n.includes(e.value),u=8+20*a;return t.jsxs("div",{role:"treeitem","aria-expanded":l?r:void 0,"aria-selected":d,className:Nr("flex items-center gap-1 rounded-sm py-1.5 pr-2 text-sm cursor-pointer outline-none","hover:bg-accent hover:text-accent-foreground",d&&"bg-accent text-accent-foreground font-medium border-l-2 border-primary"),style:{paddingLeft:u-(d?2:0)+"px"},children:[t.jsxs("span",{className:"flex flex-1 items-center gap-2 truncate",onClick:t=>{t.stopPropagation(),o(e.value)},children:[i&&t.jsx(c.Check,{className:Nr("h-4 w-4 shrink-0",d?"opacity-100":"opacity-0")}),(()=>{const a=d?e.iconSelected??(r?e.iconOpen:null)??e.icon:r?e.iconOpen??e.icon:e.icon;return a?t.jsx(a,{className:Nr("h-4 w-4 shrink-0",e.iconClassName||"text-muted-foreground")}):null})(),t.jsx("span",{className:"truncate",children:e.label})]}),l&&t.jsx("button",{type:"button",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm hover:bg-muted ml-auto",onClick:t=>{t.stopPropagation(),s(e.value)},tabIndex:-1,"aria-label":r?"Recolher":"Expandir",children:r?t.jsx(c.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})}function wn({nodes:e,level:r,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}){return t.jsx(t.Fragment,{children:e.map(e=>{const c=s.has(e.value);return t.jsxs(a.Fragment,{children:[t.jsx(yn,{node:e,level:r,expanded:c,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l}),c&&e.children&&e.children.length>0&&t.jsx(wn,{nodes:e.children,level:r+1,expandedIds:s,onToggleExpand:n,selectedValues:o,onSelect:i,showCheck:l})]},e.value)})})}function jn({multiple:e=!1,options:r,value:s,onChange:n,placeholder:o,label:i,icon:l,emptyMessage:d,searchPlaceholder:u,disabled:m=!1,required:p=!1,isLoading:h=!1,error:x,className:f,maxDisplayedBadges:g,popoverContainer:b,onOpen:v,onClose:w,defaultExpanded:j=!0,showCheck:N=!1}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),[S,A]=a.useState(""),[T,D]=a.useState(()=>j?function(e){const t=new Set;return function e(a){for(const r of a)r.children&&r.children.length>0&&(t.add(r.value),e(r.children))}(e),t}(r):new Set),E=o||_("select_placeholder","Selecione..."),P=d||_("no_results",_("no_results")),I=u||_("search_placeholder","Pesquisar..."),M=a.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]),R=a.useMemo(()=>{if(!b)return;let e=b,t=0;try{for(;e&&t<3;){const a=window.getComputedStyle(e),r=a.overflowY||a.overflow;if(!r||"visible"===r||"unset"===r)break;e=e.parentElement,t++}}catch{}return e??void 0},[b]),L=a.useMemo(()=>bn(r,S),[r,S])??r,F=a.useMemo(()=>S?function(e,t){const a=new Set,r=gn(t);function s(e){if(!e.children||0===e.children.length)return gn(e.label).includes(r);let t=!1;for(const a of e.children)s(a)&&(t=!0);return t&&a.add(e.value),t||gn(e.label).includes(r)}for(const n of e)s(n);return a}(r,S):new Set,[r,S]),z=S?F:T,U=a.useCallback(e=>{S||D(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[S]),O=a.useMemo(()=>M.map(e=>({value:e,label:vn(r,e)||e})),[M,r]),B=e=>{k(e),e?v?.():(A(""),w?.())},q=a.useCallback(t=>{if(n)if(e){const e=M.includes(t)?M.filter(e=>e!==t):[...M,t];n(e)}else n(t),k(!1)},[n,e,M]),$=(t,a)=>{a.preventDefault(),a.stopPropagation(),n&&n(e?M.filter(e=>e!==t):"")},V=g?O.slice(0,g):O,W=g&&O.length>g?O.length-g:0;if(h)return t.jsxs("div",{className:Nr("space-y-2",f),children:[i&&t.jsxs(Dr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(pn,{className:"h-10 w-full"})]});const H="string"==typeof x?x:x instanceof Error?x.message:x?_("error_loading",_("error_loading")):void 0;return H?t.jsxs("div",{className:Nr("space-y-2",f),children:[i&&t.jsxs(Dr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[t.jsx(c.AlertCircle,{className:"h-4 w-4"}),t.jsx("span",{className:"text-sm",children:H})]})]}):t.jsxs("div",{className:Nr("space-y-2",f),children:[i&&t.jsxs(Dr,{children:[i,p&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(tn,{open:C,onOpenChange:B,modal:!1,children:[t.jsx(an,{asChild:!0,children:e?t.jsxs("div",{role:"combobox","aria-expanded":C,"aria-disabled":m,tabIndex:m?-1:0,onKeyDown:e=>{m||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),B(!C))},className:Nr("flex w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","min-h-10 h-auto cursor-pointer",m&&"pointer-events-none opacity-50 cursor-not-allowed",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),E]}):t.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[V.map(e=>t.jsxs(Ds,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,t.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&$(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>$(e.value,t),children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),W>0&&t.jsxs(Ds,{variant:"outline",className:"gap-1",children:["+",W]})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]}):t.jsxs(kr,{variant:"outline",role:"combobox","aria-expanded":C,disabled:m,className:Nr("w-full justify-between min-h-10 h-auto font-normal",0===O.length&&"text-muted-foreground"),children:[0===O.length?t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),E]}):t.jsxs("span",{className:"flex items-center gap-2",children:[l&&t.jsx(l,{className:"h-4 w-4"}),O[0]?.label]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(rn,{className:"w-full p-0 bg-popover z-[60]",align:"start",container:R,collisionBoundary:R,children:[t.jsxs("div",{className:"flex items-center border-b px-3",children:[t.jsx(c.Search,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("input",{className:"flex h-10 w-full bg-transparent py-3 px-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",placeholder:I,value:S,onChange:e=>A(e.target.value)}),S&&t.jsx("button",{type:"button",className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>A(""),children:t.jsx(c.X,{className:"h-3.5 w-3.5"})})]}),t.jsx("div",{className:"max-h-[300px] overflow-y-auto overflow-x-hidden",children:t.jsx("div",{role:"tree",className:"p-1",children:0===L.length?t.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:0===r.length?P:_("no_search_results",_("no_results"))}):t.jsx(wn,{nodes:L,level:0,expandedIds:z,onToggleExpand:U,selectedValues:M,onSelect:q,showCheck:N})})})]})]})]})}const Nn=void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:Z&&"SCRIPT"===Z.tagName.toUpperCase()&&Z.src||new URL("index.js",document.baseURI).href}&&!1,_n=new Map;function Cn(e,t=1/0){if(!Nn)return 0;const a=(_n.get(e)??0)+1;return _n.set(e,a),a}function kn(e){if(Nn)try{performance.mark(`auth:${e}`)}catch{}}async function Sn(e,t){if(!Nn)return t();const a=performance.now();try{return await t()}finally{performance.now()}}function An(e){if(!Nn)return;if(0===_n.size)return;const t={};for(const[a,r]of _n.entries())t[a]=r}let Tn=null;function Dn(e,t,a){if(!Nn||!t)return;if(a&&"object"==typeof a)for(const r in a)/^co\d+$/.test(r)&&0}const En=()=>Nn;var Pn=Object.defineProperty;const In=class e{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const a=(4-t.length%4)%4;return t+="=".repeat(a),t}static parseJwtPayload(t){if(En()){return Cn(`parseJwtPayload:${t.length}:${t.slice(-8)}`,4),Cn("parseJwtPayload:total"),function(e,t){if(!Nn)return t();performance.now();try{return t()}finally{performance.now()}}(t.length,()=>e._parseJwtPayloadImpl(t))}return e._parseJwtPayloadImpl(t)}static _parseJwtPayloadImpl(e){try{const s=e.split(".");if(3!==s.length)return null;const n=s[1];n.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(n),t=atob(e),a=new Uint8Array(t.length);for(let s=0;s<t.length;s++)a[s]=t.charCodeAt(s);const r=new TextDecoder("utf-8").decode(a);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(n),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(a){try{const e=this.normalizeBase64Url(n),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(s){return null}}static validateTokens(e,t){const a=[],r=[];try{t.split(".")[1],e.split(".")[1];const s=this.parseJwtPayload(t),n=this.parseJwtPayload(e);if(!s){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}let o=!0;if(!n){const e="Access token decode falhou - será tentado novamente nas chamadas de API";a.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(n?.exp&&n.exp<i){const e="Access token expirado - pode precisar de refresh";a.push(e),o=!1}if(s.exp&&s.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:a,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:a,errors:r}}catch(s){const e=`Erro na validação de tokens: ${s}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:a,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}};((e,t,a)=>{t in e?Pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(In,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);let Mn=In;const Rn="qualiex_access_token",Ln="qualiex_id_token",Fn="supabase_token",zn="oauth_state",Un="oauth_nonce",On="selected_alias",Bn="manual_logout",qn="supabase_project_id",$n={setAccessToken:e=>localStorage.setItem(Rn,e),getAccessToken:()=>localStorage.getItem(Rn),setIdToken:e=>localStorage.setItem(Ln,e),getIdToken:()=>localStorage.getItem(Ln),getSupabaseToken:()=>localStorage.getItem(Fn),setOAuthState:e=>sessionStorage.setItem(zn,e),getOAuthState:()=>sessionStorage.getItem(zn),clearOAuthState:()=>sessionStorage.removeItem(zn),setOAuthNonce:e=>sessionStorage.setItem(Un,e),getOAuthNonce:()=>sessionStorage.getItem(Un),clearOAuthNonce:()=>sessionStorage.removeItem(Un),setSelectedAlias:e=>localStorage.setItem(On,e),getSelectedAlias:()=>localStorage.getItem(On),clearSelectedAlias:()=>localStorage.removeItem(On),generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!$n.getAccessToken()||!$n.getIdToken()),checkProjectMismatch:()=>{const e=Ie().supabaseProjectId;if(!e)return!1;const t=localStorage.getItem(qn);return t&&t!==e?($n.clearAll(),localStorage.setItem(qn,e),!0):(t||localStorage.setItem(qn,e),!1)},setSupabaseToken:e=>{localStorage.setItem(Fn,e),$n._clearValidationCache()},areAllTokensValid:()=>{const e=$n.getAccessToken(),t=$n.getIdToken();if(!e||!t)return!1;try{const a=Mn.validateTokens(e,t);return!!a.idTokenValid&&a.idTokenValid}catch(a){return!1}},clearExpiredTokens:()=>{let e=!1;const t=$n.getAccessToken(),a=$n.getIdToken(),r=$n.getSupabaseToken();return t&&$n.isTokenExpired(t)&&(localStorage.removeItem(Rn),e=!0),a&&$n.isTokenExpired(a)&&(localStorage.removeItem(Ln),e=!0),r&&$n.isTokenExpired(r)&&(localStorage.removeItem(Fn),e=!0),e},clearAll:()=>{localStorage.removeItem(Rn),localStorage.removeItem(Ln),localStorage.removeItem(Fn),localStorage.removeItem(On),sessionStorage.removeItem(zn),sessionStorage.removeItem(Un),$n._clearValidationCache()},setManualLogout:()=>localStorage.setItem(Bn,"true"),isManualLogout:()=>"true"===localStorage.getItem(Bn),clearManualLogout:()=>localStorage.removeItem(Bn),isTokenExpired:e=>{try{return Mn.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{$n._validationCache.isValid=!1,$n._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=$n.getSupabaseToken();if(!e)return!1;if($n.isTokenExpired(e))return $n._clearValidationCache(),$n._handleExpiredToken(),!1;const t=Date.now();return t-$n._validationCache.timestamp<$n._validationCache.cacheValidityMs?$n._validationCache.isValid:($n._validationCache.isValid=!0,$n._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>$n.isSupabaseTokenValid()?$n.getSupabaseToken():null,_handleExpiredToken:()=>{$n.clearAll()},extractTokenData:()=>{if(Cn("TokenManager.extractTokenData"),!$n.isSupabaseTokenValid())return null;const e=$n.getSupabaseToken();if(!e)return null;try{const t=Mn.parseJwtPayload(e);if(!t)return null;const a=t.alias||t.default||t.user_alias,r=t.place_id||null,s=t.place_name||null;let n=t.company_id;if(!n&&a)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===a){n=e[7];break}}}return{alias:a,companyId:n,placeId:r,placeName:s,payload:t}}catch(t){return $n._handleExpiredToken(),null}},getCompanyId:e=>{Cn("TokenManager.getCompanyId");const t=$n.getAccessToken();if(t)try{const a=Mn.parseJwtPayload(t);if(a)for(const t in a)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=a[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}const a=$n.extractTokenData();if(a?.companyId)return a.companyId;const r=$n.getIdToken();if(r)try{const t=Mn.parseJwtPayload(r);if(t)for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(s){}return null},getAppGroupId:(e,t)=>{Cn("TokenManager.getAppGroupId");const a=$n.getAccessToken();if(!a)return null;try{const r=Mn.parseJwtPayload(a);if(!r)return null;for(const a in r)if(a.startsWith("co")&&/^co\d+$/.test(a)){const s=r[a];if(s&&"string"==typeof s){const a=s.split(";");if(e&&a.length>5&&a[0]===e){if(t?.includes(a[5]))continue;const e=Number(a[5]);return Number.isNaN(e)?null:e}if(!e&&a.length>5){if(t?.includes(a[5]))continue;const e=Number(a[5]);return Number.isNaN(e)?null:e}}}}catch{}return null},getCompanyIdInt:e=>{Cn("TokenManager.getCompanyIdInt");const t=[$n.getAccessToken(),$n.getIdToken()];for(const a of t)if(a)try{const t=Mn.parseJwtPayload(a);if(!t)continue;for(const a in t)if(a.startsWith("co")&&/^co\d+$/.test(a)){const r=t[a];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>1&&t[0]===e)return t[1];if(!e&&t.length>1)return t[1]}}}catch{}return null},getCurrentCompanyId:()=>{const e=$n.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{Cn("TokenManager.getAllCompaniesData");const e=$n.getIdToken();if(!e)return[];try{const t=Mn.parseJwtPayload(e);if(!t)return[];const a=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&a.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return a}catch{return[]}}};var Vn=Object.defineProperty,Wn=(e,t,a)=>((e,t,a)=>t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);const Hn=new class{constructor(){Wn(this,"errors",[]),Wn(this,"toastCount",0),Wn(this,"lastToastTime",0)}handleError(e,t=!0){const a="string"==typeof e?e:e.message,r=jr(a);if(this.errors.push({id:br("short"),message:a,timestamp:Date.now(),count:1}),this.errors.length>50&&(this.errors=this.errors.slice(-50)),t&&this.shouldShowToast()){const e=this.getErrorTitle(r);l.toast.error(e,{description:r})}}getErrorTitle(t){const a=t.toLowerCase();return a.includes("401")||a.includes("unauthorized")||a.includes("expirou")?e.t("error_session_expired"):a.includes("token")||a.includes("autenticação")?e.t("error_authentication"):a.includes("api")||a.includes("network")?e.t("error_connection"):"Erro"}success(e,t){l.toast.success(e,{description:t})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};["[forlogic-core] ⚠️ VITE_SUPABASE_PUBLISHABLE_KEY contém uma legacy anon key (JWT).","O Supabase desativou legacy API keys. Substitua pela nova publishable key (formato sb_publishable_*).","Todas as requests retornarão 401 Unauthorized.","Causa provável: a integração Supabase do Lovable sobrescreveu o .env com a anon key legada.","Solução: defina VITE_SUPABASE_PK_OVERRIDE no .env com a publishable key correta."].join(" ");function Gn(e){return!!e&&e.startsWith("eyJ")}let Kn=!1;var Yn=Object.defineProperty,Qn=(e,t,a)=>((e,t,a)=>t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);function Xn(){if(Me()){const e=Ie();return{url:e.supabaseUrl,key:e.supabasePublishableKey}}const e=(void 0).VITE_SUPABASE_URL,t=(void 0).VITE_SUPABASE_PK_OVERRIDE||((void 0).VITE_SUPABASE_PUBLISHABLE_KEY??"");return e&&t?{url:e,key:t}:null}const Jn=class e{constructor(e){Qn(this,"client"),Qn(this,"currentToken",null),Qn(this,"config"),this.config=e,function(){const e=(void 0).VITE_SUPABASE_PK_OVERRIDE,t=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY;Kn?Gn(t):e&&Gn(t)?Kn=!0:Gn(t)?Kn=!0:Kn=!0}(),this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:this.config.key};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return w.createClient(this.config.url,this.config.key,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>{const a="string"==typeof e?e:e.url;if(a.includes("/auth/v1/user"))return new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}});if(a.includes("apikey="))try{const e=new URL(a,"https://placeholder.local");if(e.searchParams.has("apikey")){e.searchParams.delete("apikey");const r=a.startsWith("http")?e.toString():e.pathname+e.search+e.hash,s={...t,headers:{...t?.headers,apikey:this.config.key}};return fetch(r,s)}}catch{}return fetch(e,t)}}})}static getInstance(){if(!e.instance){const t=Xn();if(!t)throw new Error("[forlogic-core] Supabase não configurado. Defina VITE_SUPABASE_URL e VITE_SUPABASE_PUBLISHABLE_KEY no .env, ou não invoque getSupabaseClient() (use isSupabaseConfigured() para checar antes).");e.instance=new e(t)}return e.instance}getClient(){const e=$n.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{return!Mn.isTokenExpired(e)}catch(t){return Hn.handleError(t instanceof Error?t:"Supabase - Error validating token",!1),!1}}};Qn(Jn,"instance");let Zn=Jn;function eo(){return Zn.getInstance().getClient()}class to{static async generateToken(e,t,a,r=!1){try{if(!r){const e=$n.getSupabaseToken();if(e&&$n.isSupabaseTokenValid())return e}const s=eo();Cn("SupabaseTokenService.generateToken:invoke");const{data:n,error:o}=await Sn(0,()=>s.functions.invoke("validate-token",{body:{access_token:e,alias:t}}));return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(a?.(),null):n?.access_token?($n.setSupabaseToken(n.access_token),n.access_token):null}catch(s){return s instanceof Error&&(s.message.includes("401")||s.message.includes("Unauthorized"))&&a?.(),null}}}var ao=Object.defineProperty,ro=(e,t,a)=>((e,t,a)=>t in e?ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);class so{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(e=!1){if(this.regenerationPromise)return this.regenerationPromise;this.regenerationPromise=this._doRegenerate(e);try{return await this.regenerationPromise}finally{this.regenerationPromise=null}}static async _doRegenerate(e=!1){try{const t=$n.getAccessToken(),a=$n.getSelectedAlias();if(!t||!a)return null;const r=await to.generateToken(t,a,this.onLogoutCallback||void 0,e);return r||null}catch(t){return null}}}ro(so,"regenerationPromise",null),ro(so,"onLogoutCallback",null);class no{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&($n.clearAll(),window.location.href=Ue("/login"),!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const a=t.toLowerCase();return["401","unauthorized","token expired","invalid token","session expired","jwt expired","authentication failed","not authenticated"].some(e=>a.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var oo=Object.defineProperty;class io{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,a=e.message||e.toString();if(401===t||a.includes("401")||a.includes("Unauthorized")){this.isRetrying=!0;try{return await so.attemptRegeneration()?(this.isRetrying=!1,!0):(no.handleError(e),this.isRetrying=!1,!1)}catch(r){return no.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=$n.getAccessToken();return e?$n.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,a)=>{((e,t,a)=>{t in e?oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,t+"",a)})(io,"isRetrying",!1);const lo=new class{get baseUrl(){return Ge()}async makeApiCall(e,t,a,r){const s=io.validateToken();if(!s.valid)throw new Error(s.message||"Token inválido");const n=$n.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!a||""===a.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=r?new URL(r.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)):new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const i=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":a}});if(!i.ok){const e=new Error(`API call failed: ${i.status} ${i.statusText}`);throw e.status=i.status,e.statusCode=i.status,e}return await i.json()}async fetchHasCommonV5(e,t){const a=await this.makeApiCall(`/api/common/v1/companies/hasCommonV5/${encodeURIComponent(t)}`,{},e),r=a?.data??a,s=Array.isArray(r)?r[0]:r;return Boolean(s?.hasCommonV5)}mapToQualiexUser(e){let t;return t="boolean"==typeof e.isActive?e.isActive:"boolean"==typeof e.active?e.active:"string"!=typeof e.status||"active"===e.status.toLowerCase(),{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0,isActive:t}}parseUsersResponse(e,t=""){let a=e;if(e.data)a=e.data;else{if(!Array.isArray(e))return Hn.handleError(`[QualiexApi] Formato de resposta inesperado${t}`,!1),null;a=e}return Array.isArray(a)?a.map(e=>this.mapToQualiexUser(e)):(Hn.handleError(`[QualiexApi] Resposta não é um array${t}`,!1),null)}async fetchUsers(e,t,a="active"){const r={companyId:t,search:"",filterStatus:a};try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t)??[]}catch(s){if(await io.handleApiError(s))try{const t=await this.makeApiCall("/api/common/v1/companiesusers",r,e);return this.parseUsersResponse(t," após retry")??[]}catch(n){return Hn.handleError(n instanceof Error?n:"Erro ao buscar usuários após renovação de token",!0),[]}return Hn.handleError(s instanceof Error?s.message:"Erro ao buscar usuários da API Qualiex",!0),[]}}async fetchUserById(e,t,a){try{return(await this.fetchUsers(t,a)).find(t=>t.userId===e)||null}catch(r){return Hn.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const a=await this.fetchUsers(e,t,"active"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async fetchAllUsersMap(e,t){const a=await this.fetchUsers(e,t,"all"),r=new Map;return a.forEach(e=>r.set(e.userId,e)),r}async getUsers(e,t="active"){const a=$n.extractTokenData();return a&&a.companyId?this.fetchUsers(e,a.companyId,t):[]}async fetchSoftwares(e){try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):(Hn.handleError("[QualiexApi] fetchSoftwares: formato de resposta inesperado",!1),[])}catch(t){if(await io.handleApiError(t))try{const t=await this.makeApiCall("/api/common/v1/softwares",{},e),a=t?.data||t;return Array.isArray(a)?a.map(e=>({id:e.id,alias:e.alias||"",color:e.color||"",colorLight:e.colorLight||"",namePtBr:e.namePtBr||"",nameUs:e.nameUs||"",nameEs:e.nameEs||""})):[]}catch(a){return Hn.handleError(a instanceof Error?a:"Erro ao buscar softwares após renovação de token",!0),[]}return Hn.handleError(t instanceof Error?t.message:"Erro ao buscar softwares da API Qualiex",!0),[]}}async fetchUserAssociations(e,t,a){const r=!!a?.baseUrl,s=r?`/Users/${e}/associations`:`/api/common/v1/Users/${e}/associations`,n=r?a.baseUrl:void 0,o=e=>e.map(e=>({associationId:e.associationId||"",userId:e.userId||"",userName:e.userName||"",companyId:e.companyId||"",companyName:e.companyName||"",companyAlias:e.companyAlias||"",companyPhotoDate:e.companyPhotoDate,language:e.language,roleId:e.roleId||"",roleName:e.roleName||"",placeId:e.placeId,placeName:e.placeName,softwares:Array.isArray(e.softwares)?e.softwares:[],functionalities:Array.isArray(e.functionalities)?e.functionalities:[],isQualitfy:e.isQualitfy??!1,isMetroex:e.isMetroex??!1}));try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):(Hn.handleError("[QualiexApi] fetchUserAssociations: formato de resposta inesperado",!1),[])}catch(i){if(await io.handleApiError(i))try{const e=await this.makeApiCall(s,{},t,n),a=e?.data||e;return Array.isArray(a)?o(a):[]}catch(l){return Hn.handleError(l instanceof Error?l:"Erro ao buscar associações após renovação de token",!0),[]}return Hn.handleError(i instanceof Error?i.message:"Erro ao buscar associações do usuário",!0),[]}}};function co(e,t){const a=t||Je.userNameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function uo(e,t){const a=t||Je.userEmailFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function mo(e,t){const a=t||Je.userUsernameFieldSuffix;return e.endsWith("_id")?e.replace(/_id$/,a):`${e}${a}`}function po(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||co(e.idField),emailField:e.emailField||uo(e.idField),usernameField:e.usernameField||mo(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:co(e),emailField:uo(e),usernameField:mo(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const ho=new Map;class xo{static async fetchQualiexUsers(e,t){const a=`${t}_${e}_all`,r=ho.get(a);if(r&&Date.now()-r.timestamp<3e5)return r.users;let s=await lo.fetchUsers(e,t,"all");return 0===s.length&&(s=await lo.fetchUsers(e,t,"active")),ho.set(a,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const a=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&a.add(t)}return a}static indexUsers(e){const t=new Map;for(const a of e)a.id&&t.set(a.id,a),a.userId&&t.set(a.userId,a);return t}static enrichEntity(e,t,a){const r={...e};for(const s of t){const t=e[s.idField];if(!t)continue;const n=a.get(t);if(n){if(s.nameField){r[s.nameField]||(r[s.nameField]=n.userName||null)}if(s.emailField){r[s.emailField]||(r[s.emailField]=n.userEmail||null)}if(s.usernameField){r[s.usernameField]||(r[s.usernameField]=n.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{if(!$n.areAllTokensValid())return e;const a=$n.extractTokenData();if(!a)return e;const{alias:r,companyId:s}=a;if(!r||!s)return e;const n=po(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,n).size)return e;const o=await this.fetchQualiexUsers(r,s),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,n,i))}catch(a){return Hn.handleError(a instanceof Error?a:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}}const fo=["responsible_name"],go=e=>fo.includes(e);function bo(e,t,a){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:a||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:s,searchFields:n,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,d=()=>{if(!$n.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return eo().schema(i).from(s)},u=(e,t,a,r)=>{let s=d().select(o||"*",{count:"exact"});s=s.eq("is_removed",!1),Object.entries(r).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?s=s.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?s=s.not(e,"is",null):"is_null"===t.operator&&(s=s.is(e,null)):null!==t&&(s=s.eq(e,t)))}),s=((e,t)=>{if(t&&n.length>0){const a=n.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(a)}return e})(s,e);const i=t.includes(".");return i||go(t)||(s=s.order(t,{ascending:"asc"===a})),{query:s,isForeignKey:i}},m=async(e,t,a,s,n)=>{const o=po(r.userIdFields,r.userFieldsMapping).some(e=>e.nameField===t||e.emailField===t||e.usernameField===t),i=t.includes(".");if(go(t)||i||o){const e={search:"",sortField:void 0,sortDirection:void 0,page:1,limit:500},o=await p.getAll(e);if(!o?.data?.length)return o;const c=await xo.enrichWithUserData(o.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let d;d=i?c.sort((e,r)=>{const s=t.split(".").reduce((e,t)=>e?.[t],e)||"",n=t.split(".").reduce((e,t)=>e?.[t],r)||"",o=String(s).localeCompare(String(n),"pt-BR");return"asc"===a?o:-o}):((e,t,a)=>[...e].sort((e,r)=>{const s=e[t]||"",n=r[t]||"",o=s.localeCompare(n,"pt-BR",{sensitivity:"base"});return"asc"===a?o:-o}))(c,t,a);const u=((e,t=1,a=25)=>{const r=(t-1)*a,s=r+a;return{data:e.slice(r,s),pagination:{currentPage:t,totalPages:Math.ceil(e.length/a),totalItems:e.length,itemsPerPage:a,hasNextPage:s<e.length,hasPreviousPage:t>1}}})(d,s,n);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalItems,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}return await xo.enrichWithUserData(e,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping})},p={async getAll(e={}){const{search:t,sortField:a,sortDirection:n,page:o,limit:i,additionalFilters:d}=(e=>{const{search:t="",sortField:a="updated_at",sortDirection:r="desc",page:s=1,limit:n=25,...o}=e;return{search:t,sortField:a,sortDirection:r,page:s,limit:n,additionalFilters:o}})(e),{query:p}=u(t,a,n,d),h=((e,t,a)=>{const r=(t-1)*a,s=r+a-1;return e.range(r,s)})(p,o,i),{data:x,error:f,count:g}=await h;if(f)throw new Error(`Error fetching ${s}: ${f.message}`);let b=((e,t,a,r)=>{const s=Math.ceil((t||0)/r);return{data:e,currentPage:a,totalPages:s,totalItems:t||0,itemsPerPage:r,hasNextPage:a<s,hasPreviousPage:a>1}})(x||[],g,o,i);if((e=>{if(!c||!l||0===e.length)return!1;const t=po(r.userIdFields,r.userFieldsMapping);return e.some(e=>t.some(t=>e[t.idField]))})(b.data)){const e=await m(b.data,a,n,o,i);if(!Array.isArray(e))return e;b={...b,data:e}}return b},async getById(e){const{data:t,error:a}=await d().select(o||"*").eq("id",e).maybeSingle();if(a)throw new Error(`Error fetching ${s}: ${a.message}`);return t},async create(e){const t=_r(e),a=Object.entries(t).reduce((e,[t,a])=>(void 0!==a&&(e[t]=a),e),{}),{data:r,error:n}=await d().insert(a).select().single();if(n)throw new Error(`Error creating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from create ${s} operation`);return r},async update(e,t){const a={..._r(t),updated_at:(new Date).toISOString()},{data:r,error:n}=await d().update(a).eq("id",e).select().single();if(n)throw new Error(`Error updating ${s}: ${n.message}`);if(!r)throw new Error(`No data returned from update ${s} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:a}=await d().update(t).eq("id",e);if(a)throw new Error(`Error soft deleting ${s}: ${a.message}`)}};return p}const vo={isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null},yo=class{static async initialize(){try{const e=Fe();if(e){if($n.checkProjectMismatch())return{...vo}}if(!$n.hasAllTokens()||!$n.areAllTokensValid())return $n.clearExpiredTokens(),{...vo};const t=$n.getAccessToken(),a=$n.getIdToken();$n.clearManualLogout();const r=this.extractUserFromIdToken(a,t),s=this.extractCompaniesFromIdToken(a),n=e?$n.extractTokenData():null,o=this.resolveAliasFromContext(s,t,n?.alias??null);if(e&&(!$n.isSupabaseTokenValid()&&o&&await so.attemptRegeneration(),!$n.isSupabaseTokenValid()))return{...vo};let i=null;if(o){const e=$n.getCompanyId(o),t=s.find(e=>e.alias===o);t&&(i={id:e||t.id,name:t.name,alias:t.alias,appGroupId:$n.getAppGroupId(t.alias)})}const l=n?.placeId??null,c=n?.placeName??null;return{isAuthenticated:!0,isLoading:!1,user:r,alias:o,companies:s,selectedUnit:i,userId:r?.id||null,userAlias:r?.id||null,placeId:l,placeName:c,activePlaceId:l,activePlaceName:c}}catch(e){return{...vo}}}static async loginDev(){if(!Fe())return this.loginProd(),!0;try{const e=eo(),{data:t,error:a}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(a)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL(Ue("/callback"));return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e="Lw==";$n.setOAuthState(e);const t=$n.generateOAuthNonce();$n.setOAuthNonce(t);const a=Ue("/callback"),r=new URL(ze.oauth.authUrl);r.searchParams.set("client_id",ze.oauth.clientId),r.searchParams.set("response_type",ze.oauth.responseType),r.searchParams.set("scope",ze.oauth.scope),r.searchParams.set("redirect_uri",a),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),window.location.href=r.toString()}static async processCallback(){try{const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),a=a=>e.get(a)||t.get(a),r=a("access_token"),s=a("id_token"),n=a("error");if(n)throw new Error(`Erro OAuth: ${n}`);if(r&&s){const e=$n.getAccessToken();e!==r&&$n.clearAll()}const o=Fe();if($n.hasAllTokens()){if(o){$n.getValidSupabaseToken()||await so.attemptRegeneration(!0)}return!0}const i=r,l=s;if(!i||!l)throw new Error("Tokens não encontrados na URL de callback");$n.setAccessToken(i),$n.setIdToken(l),$n.clearManualLogout();const c=this.extractCompaniesFromIdToken(l),d=this.resolveAliasFromContext(c,i,null);if(!d)throw new Error("Nenhuma empresa encontrada nos tokens");if($n.setSelectedAlias(d),o){if(!await so.attemptRegeneration(!0))throw new Error("Falha ao gerar token Supabase")}return $n.clearOAuthState(),$n.clearOAuthNonce(),!0}catch(e){throw e}}static async logout(){$n.clearAll(),$n.setManualLogout(),localStorage.removeItem("auth_return_url"),sessionStorage.clear();try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}}catch{}try{const e=Ue("/callback"),t=new URL(ze.oauth.logoutUrl);return t.searchParams.set("client_id",ze.oauth.clientId),t.searchParams.set("redirect_uri",e),t.searchParams.set("response_type",ze.oauth.responseType),t.searchParams.set("scope",ze.oauth.scope),t.searchParams.set("state","Lw=="),void(window.location.href=t.toString())}catch{}window.location.href=Ue("/login")}static decodeToken(e){return Mn.parseJwtPayload(e)}static extractUserFromIdToken(e,t){const a=this.decodeToken(e);if(!a)return null;const r=t?this.decodeToken(t):null;return{id:a.subNewId,email:a.email,name:a.name,identifier:a.identifier,isSysAdmin:"1"===r?.admin}}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const a=[];Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)a.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,s]=t[e].split("|");r&&s&&a.push({id:"",alias:r.trim(),name:s.trim()})}}});const r=new Map;for(const n of a){if(!n.alias)continue;const e=r.get(n.alias);(!e||!e.id&&n.id)&&r.set(n.alias,n)}const s=Array.from(r.values());a.length,s.length;return s.length,s}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static getSubdomainAlias(){if("undefined"==typeof window)return null;const e=window.location.hostname;if("localhost"===e||e.startsWith("127.")||e.endsWith(".lovable.app")||e.endsWith(".lovable.dev"))return null;const t=e.split(".");if(t.length<3)return null;const a=t[0];return"www"===a||"admin"===a?null:t.length>=4?t[1]:a}static resolveAliasFromContext(e,t,a){const r=t=>!!t&&e.some(e=>e.alias===t),s=this.getSubdomainAlias();if(r(s))return s;if("undefined"!=typeof window){const e=window.location.hostname.split(".");if(e.length>=4&&r(e[0]))return e[0]}if(r(a))return a;const n=$n.getSelectedAlias();if(r(n))return n;const o=this.extractAliasFromAccessToken(t);return r(o)?o:e[0]?.alias||null}};so.setLogoutCallback(()=>{yo.logout()});let wo=yo;const jo=e=>e?.placeId||null,No=e=>e?.placeName||null,_o=a.createContext(void 0),Co=({children:e})=>{const[r,s]=a.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let n=null;try{n=j.useQueryClient()}catch{}const[o,i]=a.useState(!1),l=a.useRef(0),c=a.useCallback(e=>{s(t=>({...t,...e}))},[]),d=a.useCallback(e=>{s(t=>({...t,isLoading:e}))},[]),u=a.useCallback(()=>{s({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),m=a.useCallback(async e=>{if(e.alias===r.alias)return;const t=++l.current;try{const s=$n.getAccessToken();if(!s)return;const o=$n.getSupabaseToken(),i=r.alias,d=Fe();let u=null;if(d){const a=await to.generateToken(s,e.alias,void 0,!0);if(l.current!==t)return;if(!a)return;$n.setSupabaseToken(a),u=$n.extractTokenData()}$n.setSelectedAlias(e.alias);const m=u?.alias||e.alias,p=u?.companyId||$n.getCompanyId(e.alias);if(p)try{const e=await lo.fetchHasCommonV5(m,p);if(l.current!==t)return;if(!e){const e=Xe();if(e){o&&$n.setSupabaseToken(o),i&&$n.setSelectedAlias(i);const t=e.endsWith("/")?e:`${e}/`;return void(window.location.href=`${t}${m}`)}}}catch(a){}const h={id:p||e.id,name:e.name,alias:m,appGroupId:$n.getAppGroupId(m)};let x=null,f=null;if(r.user?.id&&m&&p)try{const e=await lo.fetchActiveUsersMap(m,p);if(l.current!==t)return;const a=e.get(r.user.id);if(a){const e=(e=>({placeId:jo(e),placeName:No(e)}))(a);x=e.placeId,f=e.placeName}}catch(a){}if(l.current!==t)return;c({alias:m,selectedUnit:h,placeId:x,placeName:f,activePlaceId:x,activePlaceName:f}),n&&await n.clear()}catch(a){}},[c,n,r.user,r.alias]),p=a.useCallback(async()=>{Cn("AuthContext.processCallback");const e=await Sn(0,()=>wo.processCallback());if(e){const e=await Sn(0,()=>wo.initialize());e&&e.isAuthenticated&&(c({user:e.user,companies:e.companies,alias:e.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:e.selectedUnit,userId:e.userId,userAlias:e.userAlias,placeId:e.placeId,placeName:e.placeName,activePlaceId:e.activePlaceId,activePlaceName:e.activePlaceName}),n&&n.invalidateQueries({queryKey:["permission"]}))}return e},[c,n]),h=a.useCallback(async()=>{await wo.logout(),u(),n&&await n.clear()},[u,n]),x=a.useCallback(e=>{i(e)},[]),f=a.useCallback(()=>{},[]),g=a.useCallback(()=>{n&&n.invalidateQueries()},[n]);a.useEffect(()=>{if(!r.isAuthenticated)return;let e=!0;const t=setInterval(async()=>{if(e)if($n.areAllTokensValid()){if(Fe()&&!$n.isSupabaseTokenValid())try{await so.attemptRegeneration()||e&&h()}catch(t){e&&h()}}else e&&h()},6e5);return()=>{e=!1,clearInterval(t)}},[r.isAuthenticated,h]),a.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await wo.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&d(!1)}catch(t){e&&(no.handleError(t),d(!1))}})(),()=>{e=!1}},[c,d,h]);const b=a.useMemo(()=>({...r,logout:h,processCallback:p,switchUnit:m,availableUnits:r.companies,isSearchVisible:o,setSearchVisible:x,clearSearch:f,refreshData:g}),[r.user,r.companies,r.alias,r.isAuthenticated,r.isLoading,r.selectedUnit,r.userId,r.userAlias,r.placeId,r.placeName,r.activePlaceId,r.activePlaceName,h,p,m,o,x,f,g]);return t.jsx(_o.Provider,{value:b,children:e})},ko=()=>{const e=a.useContext(_o);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e};function So({queryKey:e,service:t,entityName:r,searchFields:s,additionalFilters:n={},onSuccess:o}){const[i,c]=N.useSearchParams(),d=j.useQueryClient(),{alias:u,userId:m,isAuthenticated:p}=ko(),{t:h}=y.useTranslation(),x=a.useCallback(t=>{const a=`${e}_${t}`,r=i.get(a);return r||(i.get(t)||"")},[i,e]),f=x("search"),g=x("sortField")||qe.sorting.defaultField,b=x("sortDirection")||qe.sorting.defaultDirection,v=parseInt(x("page")||"1"),w=parseInt(x("limit")||String(qe.pagination.defaultPageSize)),_=f,C=a.useMemo(()=>({search:_,sortField:g,sortDirection:b,page:v,limit:w,...n}),[_,g,b,v,w,n]),k=a.useCallback(()=>t.getAll(C),[t,C]),S=j.useQuery({queryKey:[e,u,m,C],queryFn:k,enabled:!!u&&p});if(!S)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const A=j.useMutation({mutationFn:t.create,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(et.success.created(r)),o?.()},onError:e=>{l.toast.error(`${et.error.create(r)}: ${e.message}`)}}),T=j.useMutation({mutationFn:({id:e,data:a})=>t.update(e,a),onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(et.success.updated(r)),o?.()},onError:e=>{l.toast.error(`${et.error.update(r)}: ${e.message}`)}}),D=j.useMutation({mutationFn:t.delete,onSuccess:()=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(et.success.deleted(r))},onError:e=>{l.toast.error(`${et.error.delete(r)}: ${e.message}`)}}),E=a.useCallback(t=>{const a={...Object.fromEntries(i)};Object.entries(t).forEach(([t,r])=>{const s=`${e}_${t}`;""===r||0===r?delete a[s]:a[s]=String(r)}),delete a.sortField,delete a.sortDirection,c(a)},[i,c,e]),P=a.useCallback(e=>{E({search:e,page:1})},[E]),I=a.useCallback(e=>{E({sortField:e,sortDirection:g===e&&"asc"===b?"desc":"asc",page:1})},[g,b,E]),M=a.useCallback(e=>{E({page:e})},[E]),R=a.useCallback(e=>{E({limit:e,page:1})},[E]),L=a.useCallback(()=>{const t=Object.fromEntries(i),a=`${e}_`,r=Object.fromEntries(Object.entries(t).filter(([e])=>!e.startsWith(a)));c(r)},[c,i,e]),[F,z]=a.useState([]),U=a.useCallback(e=>{z(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),O=a.useCallback(()=>{const e=S?.data?.data.map(e=>e.id)||[];z(t=>t.length===e.length?[]:e)},[S?.data?.data]),B=a.useCallback(()=>{z([])},[]),q=a.useMemo(()=>{const e=S?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,S?.data?.data]),$=j.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>t.delete(e)))},onSuccess:(t,a)=>{d.invalidateQueries({queryKey:[e]}),l.toast.success(h("bulk_delete_success",`${a.length} ${r}(s) deletado(s) com sucesso`)),B()},onError:e=>{l.toast.error(h("bulk_delete_error",`Erro ao deletar itens: ${e.message}`))}}),V=a.useCallback((e,t)=>{const a=t?t(e):e;e.id?T.mutate({id:e.id,data:a}):A.mutate({...a,alias:u})},[u,A,T]);return{entities:S?.data?.data||[],pagination:{data:S?.data?.data||[],currentPage:S?.data?.currentPage||1,totalPages:S?.data?.totalPages||1,totalItems:S?.data?.totalItems||0,itemsPerPage:S?.data?.itemsPerPage||qe.pagination.defaultPageSize,hasNextPage:S?.data?.hasNextPage||!1,hasPreviousPage:S?.data?.hasPreviousPage||!1},isLoading:S?.isLoading??!0,isCreating:A?.isPending??!1,isUpdating:T?.isPending??!1,isDeleting:D?.isPending??!1,error:S?.error||null,searchTerm:f,sortField:g,sortDirection:b,currentPage:v,itemsPerPage:w,queryKey:e,createEntity:A.mutate,updateEntity:(e,t)=>T.mutate({id:e,data:t}),deleteEntity:D.mutate,save:V,handleSearch:P,handleSort:I,handlePageChange:M,handleItemsPerPageChange:R,clearFilters:L,refetch:S.refetch,selectedIds:F,selectItem:U,selectAll:O,clearSelection:B,isAllSelected:q,bulkDelete:e=>$.mutateAsync(e),isBulkDeleting:$.isPending}}function Ao(e){const[t,r]=a.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return a.useEffect(()=>{const t=window.matchMedia(e);r(t.matches);const a=e=>{r(e.matches)};return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),t}function To(e=768){return Ao(`(max-width: ${e-1}px)`)}const Do=te.forwardRef(({className:e,...a},r)=>t.jsx("table",{ref:r,className:Nr("w-full caption-bottom text-[13px] table-fixed",e),...a}));Do.displayName="Table";const Eo=te.forwardRef(({className:e,...a},r)=>t.jsx("thead",{ref:r,className:Nr("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...a}));Eo.displayName="TableHeader";const Po=te.forwardRef(({className:e,...a},r)=>t.jsx("tbody",{ref:r,className:Nr("[&_tr:last-child]:border-0",e),...a}));Po.displayName="TableBody";const Io=te.forwardRef(({className:e,...a},r)=>t.jsx("tfoot",{ref:r,className:Nr("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a}));Io.displayName="TableFooter";const Mo=te.forwardRef(({className:e,...a},r)=>t.jsx("tr",{ref:r,className:Nr("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted even:bg-table-stripe",e),...a}));Mo.displayName="TableRow";const Ro=te.forwardRef(({className:e,...a},r)=>t.jsx("th",{ref:r,className:Nr("h-9 px-4 py-2 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...a}));Ro.displayName="TableHead";const Lo=te.forwardRef(({className:e,...a},r)=>t.jsx("td",{ref:r,className:Nr("px-4 py-2 align-middle overflow-hidden [&:has([role=checkbox])]:pr-0",e),...a}));Lo.displayName="TableCell";const Fo=te.forwardRef(({className:e,...a},r)=>t.jsx("caption",{ref:r,className:Nr("mt-4 text-sm text-muted-foreground",e),...a}));function zo({rows:e=5,columns:a=4}){return t.jsx("div",{className:"w-full",children:t.jsxs("div",{className:"rounded-md border",children:[t.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(pn,{className:"h-4 w-24"},a))})}),t.jsx("div",{children:Array.from({length:e}).map((e,r)=>t.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:t.jsx("div",{className:"flex space-x-4",children:Array.from({length:a}).map((e,a)=>t.jsx(pn,{className:"h-4 w-20"},a))})},r))})]})})}function Uo({count:e=3}){return t.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,a)=>t.jsxs(Er,{children:[t.jsxs(Pr,{children:[t.jsx(pn,{className:"h-4 w-3/4"}),t.jsx(pn,{className:"h-3 w-1/2"})]}),t.jsx(Rr,{children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(pn,{className:"h-3 w-full"}),t.jsx(pn,{className:"h-3 w-2/3"})]})})]},a))})}Fo.displayName="TableCaption";const Oo={default:c.FileX,search:c.Search,error:c.AlertCircle};function Bo({icon:e,title:a,description:r,action:s,className:n,variant:o="default"}){const{t:i}=y.useTranslation(),l=!!e,c=Oo[o];return t.jsxs("div",{className:Nr("flex flex-col items-center justify-center py-12 px-4 text-center",n),children:[t.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:l?e:t.jsx(c,{className:"h-8 w-8 text-muted-foreground"})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:a}),r&&t.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),s&&t.jsx(kr,{onClick:s.onClick,variant:"outline",children:s.label})]})}function qo({children:e,className:a}){const r=te.useRef(null),[s,n]=te.useState(!1);te.useEffect(()=>{const e=()=>{const e=r.current;e&&n(e.scrollWidth>e.clientWidth)};e();const t=new ResizeObserver(e);return r.current&&t.observe(r.current),()=>t.disconnect()},[e]);const o=t.jsx("div",{ref:r,className:`truncate w-full max-w-full ${a||""}`,children:e});return s?t.jsx(Qs,{delayDuration:300,children:t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:o}),t.jsx(Zs,{side:"top",className:"max-w-[400px] break-words",children:e})]})}):o}const $o=te.forwardRef(({direction:e,onMouseDown:a,isDragging:r,className:s},n)=>{const o="horizontal"===e;return t.jsx("div",{ref:n,onMouseDown:a,className:Nr("absolute z-20 select-none touch-none","transition-colors duration-150",o&&["top-0 right-0 h-full w-2 -mr-1","cursor-col-resize","hover:bg-primary/20","group flex items-center justify-center"],!o&&["bottom-0 left-0 w-full h-2 -mb-1","cursor-row-resize","hover:bg-primary/20","group flex items-center justify-center"],r&&"bg-primary/30",s),children:t.jsx("div",{className:Nr("rounded-full bg-border transition-colors group-hover:bg-primary",r&&"bg-primary",o?"h-6 w-0.5":"w-6 h-0.5")})})});$o.displayName="TableResizeHandle";const Vo=me.Root,Wo=me.Trigger,Ho=me.Group,Go=me.Portal,Ko=me.Sub,Yo=me.RadioGroup,Qo=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(me.SubTrigger,{ref:n,className:Nr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Qo.displayName=me.SubTrigger.displayName;const Xo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.SubContent,{ref:r,className:Nr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Xo.displayName=me.SubContent.displayName;const Jo=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Portal,{children:t.jsx(me.Content,{ref:r,className:Nr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Jo.displayName=me.Content.displayName;const Zo=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Item,{ref:s,className:Nr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Zo.displayName=me.Item.displayName;const ei=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(me.CheckboxItem,{ref:n,className:Nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));ei.displayName=me.CheckboxItem.displayName;const ti=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(me.RadioItem,{ref:s,className:Nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(me.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));ti.displayName=me.RadioItem.displayName;const ai=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(me.Label,{ref:s,className:Nr("px-2 py-1.5 text-sm font-semibold text-foreground",a&&"pl-8",e),...r}));ai.displayName=me.Label.displayName;const ri=te.forwardRef(({className:e,...a},r)=>t.jsx(me.Separator,{ref:r,className:Nr("-mx-1 my-1 h-px bg-border",e),...a}));ri.displayName=me.Separator.displayName;const si=({className:e,...a})=>t.jsx("span",{className:Nr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});si.displayName="ContextMenuShortcut";const ni=({onEdit:e,onDelete:a,onToggleStatus:r,isActive:s=!0,canDelete:n=!0,customActions:o=[],renderAs:i})=>{const{t:l}=y.useTranslation(),d=[];if(e){const t={icon:c.Edit,label:l("edit"),onClick:e};d.push(t)}if(o.forEach(e=>{d.push(e)}),r){const e={icon:s?c.PowerOff:c.Power,label:s?"Inativar":"Ativar",onClick:r};d.push(e)}if(n&&a){const e={icon:c.Trash2,label:l("ap_delete"),onClick:a,destructive:!0};d.push(e)}const u="dropdown"===i?Vs:Zo;return t.jsx(t.Fragment,{children:d.map((e,a)=>t.jsxs(u,{onClick:e.onClick,className:Nr("whitespace-normal cursor-pointer",e.destructive&&"text-destructive focus:text-destructive"),children:[t.jsx(e.icon,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.label]},a))})},oi=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsx(kr,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:t.jsx(c.EllipsisVertical,{size:12})})}),t.jsx($s,{align:"end",className:"bg-background border border-border shadow-lg min-w-[160px]",children:t.jsx(ni,{onEdit:e?t=>{t?.stopPropagation(),e?.()}:void 0,onDelete:a?e=>{e?.stopPropagation(),a?.()}:void 0,onToggleStatus:s?e=>{e?.stopPropagation(),s?.()}:void 0,isActive:n,canDelete:r&&!!a,customActions:o,renderAs:"dropdown"})})]}),ii=({onEdit:e,onDelete:a,canDelete:r=!0,onToggleStatus:s,isActive:n=!0,customActions:o=[]})=>{const{t:i}=y.useTranslation();return t.jsx(Qs,{delayDuration:200,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e()},children:t.jsx(c.Pencil,{size:14})})}),t.jsx(Zs,{children:i("edit")})]}),o.map((e,a)=>{const r=e.icon;return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:t=>{t.stopPropagation(),e.onClick()},children:t.jsx(r,{size:14})})}),t.jsx(Zs,{children:e.label})]},a)}),s&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:e=>{e.stopPropagation(),s()},children:n?t.jsx(c.ToggleRight,{size:14}):t.jsx(c.ToggleLeft,{size:14})})}),t.jsx(Zs,{children:n?"Inativar":"Ativar"})]}),a&&r&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:Nr("h-7 w-7 hover:text-destructive"),onClick:e=>{e.stopPropagation(),a()},children:t.jsx(c.Trash2,{size:14})})}),t.jsx(Zs,{children:i("ap_delete")})]})]})})},li=150;function ci({columns:e,storageKey:t,onResize:r,enabled:s=!0}){const[n,o]=a.useState(()=>{if(!s||"undefined"==typeof window)return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??li,e),{});if(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch{}}return e.reduce((e,t)=>(e[t.key]=t.defaultWidth??li,e),{})}),[i,l]=a.useState(!1),[c,d]=a.useState(null),u=a.useRef(0),m=a.useRef(0),p=a.useCallback((e,t)=>{s&&(t.preventDefault(),t.stopPropagation(),l(!0),d(e),u.current=t.clientX,m.current=n[e]??li)},[s,n]);a.useEffect(()=>{if(!i||!c)return;const a=e.find(e=>e.key===c),s=a?.minWidth??60,n=a?.maxWidth??500,p=e=>{const t=e.clientX-u.current,a=Math.max(s,Math.min(n,m.current+t));o(e=>{const t={...e,[c]:a};return r?.(t),t})},h=()=>{l(!1),d(null),t&&o(e=>(localStorage.setItem(t,JSON.stringify(e)),e))};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}},[i,c,e,t,r]),a.useEffect(()=>(i?(document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[i]);const h=a.useCallback(()=>{const a=e.reduce((e,t)=>(e[t.key]=t.defaultWidth??li,e),{});o(a),t&&localStorage.removeItem(t),r?.(a)},[e,t,r]);return{columnWidths:n,isDragging:i,activeColumn:c,handleMouseDown:p,resetWidths:h}}const di=s.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),ui=te.forwardRef(({className:e,variant:a,size:r,...s},n)=>t.jsx(he.Root,{ref:n,className:Nr(di({variant:a,size:r,className:e})),...s}));ui.displayName=he.Root.displayName;const mi=te.createContext({size:"default",variant:"default"}),pi=te.forwardRef(({className:e,variant:a,size:r,children:s,...n},o)=>t.jsx(pe.Root,{ref:o,className:Nr("flex items-center justify-center gap-1",e),...n,children:t.jsx(mi.Provider,{value:{variant:a,size:r},children:s})}));pi.displayName=pe.Root.displayName;const hi=te.forwardRef(({className:e,children:a,variant:r,size:s,...n},o)=>{const i=te.useContext(mi);return t.jsx(pe.Item,{ref:o,className:Nr(di({variant:i.variant||r,size:i.size||s}),e),...n,children:a})});hi.displayName=pe.Item.displayName;const xi=a.memo(function({onNew:e,newButtonLabel:a,showNewButton:r=!0,showSearch:s=!1,searchValue:n="",onSearchChange:o,searchPlaceholder:i,showBulkActions:l=!1,selectedCount:d=0,bulkActions:u=[],onBulkDelete:m,onClearSelection:p,customActions:h=[],filters:x,viewMode:f,onViewModeChange:g,showViewToggle:b=!1,availableViewModes:v=["table","list","grid"],rightSlot:w,className:j}){const{t:N}=y.useTranslation(),_=d>0,C=e&&r||h.length>0,k=x||b||w,S=s&&o;return C||S||k||l&&_?t.jsxs("div",{className:Nr("flex-shrink-0 flex items-center px-4 py-1.5 bg-muted/50 border-b gap-4",j),children:[t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e&&r&&t.jsxs(kr,{onClick:e,children:[t.jsx(c.Plus,{size:16,className:"mr-2"}),a||"Novo"]}),h.map((e,a)=>{const r=e.icon;return t.jsxs(kr,{onClick:e.action,variant:e.variant||"outline",disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,children:[r&&t.jsx(r,{size:16,className:"mr-2"}),e.label]},a)})]}),l&&_&&t.jsxs("div",{className:"flex items-center gap-1 shrink-0 border-l pl-4",children:[t.jsx(Ds,{variant:"secondary",className:"mr-1 tabular-nums",children:d}),t.jsxs(Qs,{delayDuration:200,children:[u.length>0?u.map((e,a)=>{const r=e.icon,s=e.disabled;return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:Nr("h-8 w-8","destructive"===e.variant&&"text-destructive hover:text-destructive hover:bg-destructive/10"),disabled:s,onClick:()=>e.action([]),children:r?t.jsx(r,{size:16}):t.jsx("span",{className:"text-xs",children:e.label[0]})})}),t.jsx(Zs,{children:e.label})]},a)}):t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:m,children:t.jsx(c.Trash2,{size:16})})}),t.jsx(Zs,{children:N("ap_delete")})]}),t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:p,children:t.jsx(c.X,{size:16})})}),t.jsx(Zs,{children:N("clear_selection")})]})]})]}),S&&t.jsx("div",{className:"flex-1 flex justify-center max-w-md mx-auto",children:t.jsxs("div",{className:"relative w-full",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Ar,{type:"text",placeholder:i||"Pesquisar",value:n,onChange:e=>o?.(e.target.value),className:"pl-9 w-full"})]})}),k&&t.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-auto",children:[x,b&&f&&g&&t.jsx(pi,{type:"single",value:f,onValueChange:e=>e&&g(e),size:"sm",children:v.map(e=>{const a=(e=>{switch(e){case"table":return c.Table2;case"list":return c.List;case"grid":return c.LayoutGrid}})(e);return t.jsx(hi,{value:e,"aria-label":"Visualizar como "+("table"===e?"tabela":"list"===e?"lista":"grade"),children:t.jsx(a,{className:"h-4 w-4"})},e)})}),w]})]}):null}),fi=a.memo(({checked:e,onCheckedChange:a})=>t.jsx(Ss,{checked:e,onCheckedChange:a}),(e,t)=>e.checked===t.checked);function gi(e){try{const t=localStorage.getItem(e);if(!t)return null;const a=JSON.parse(t);let r=a.groupByColumns||[];return 0===r.length&&a.groupByColumn&&(r=[a.groupByColumn]),{hiddenColumns:new Set(a.hiddenColumns||[]),columnOrder:a.columnOrder||[],groupByColumns:r}}catch{return null}}function bi({columns:e,storageKey:t,enabled:r=!0,defaultHiddenColumns:s}){const n=a.useMemo(()=>e.map(e=>String(e.key)),[e]),o=a.useMemo(()=>new Set(s??[]),[s]),[i,l]=a.useState(()=>{if(!r)return o;if(!t)return o;const e=gi(t);return e?.hiddenColumns??o}),[c,d]=a.useState(()=>{if(!r||!t)return n;const e=gi(t)?.columnOrder;return e&&e.length>0?e:n}),[u,m]=a.useState(()=>r&&t?gi(t)?.groupByColumns??[]:[]),[p,h]=a.useState(new Set);a.useEffect(()=>{r&&t&&function(e,t){try{localStorage.setItem(e,JSON.stringify({hiddenColumns:Array.from(t.hiddenColumns),columnOrder:t.columnOrder,groupByColumns:t.groupByColumns}))}catch{}}(t,{hiddenColumns:i,columnOrder:c,groupByColumns:u})},[i,c,u,t,r]),a.useEffect(()=>{const t=new Set(e.map(e=>String(e.key))),a=new Set(c),r=[...t].filter(e=>!a.has(e));r.length>0&&d(e=>[...e.filter(e=>t.has(e)),...r])},[e]);const x=a.useCallback(e=>i.has(e),[i]),f=a.useCallback(e=>{l(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),g=a.useCallback(()=>{l(new Set)},[]),b=a.useCallback(()=>{if(l(o),d(n),m([]),h(new Set),t)try{localStorage.removeItem(t)}catch{}},[n,o,t]),v=a.useCallback((e,t)=>{d(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r})},[]),y=a.useCallback(e=>{h(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),w=a.useCallback(e=>{m(e),h(new Set)},[]),j=a.useCallback(e=>{m(t=>t.includes(e)?t:[...t,e])},[]),N=a.useCallback(e=>{m(t=>t.filter(t=>t!==e)),h(t=>{const a=new Set;for(const r of t)r.includes(`${e}:`)||a.add(r);return a})},[]),_=a.useCallback((e,t)=>{m(a=>{const r=[...a],[s]=r.splice(e,1);return r.splice(t,0,s),r}),h(new Set)},[]),C=u[0]??null,k=a.useCallback(e=>{m(e?[e]:[]),h(new Set)},[]),S=a.useMemo(()=>{if(!r)return e;const t=new Map(e.map(e=>[String(e.key),e]));return c.filter(e=>!i.has(e)&&t.has(e)).map(e=>t.get(e))},[e,c,i,r]),A=a.useCallback(e=>{if(0===u.length)return[{groupKey:"__all__",groupValue:"",items:e,count:e.length,level:0}];return function e(t,a,r,s){if(0===a.length)return[{groupKey:s||"__leaf__",groupValue:"",items:t,count:t.length,level:r}];const[n,...o]=a,i=new Map;for(const l of t){const e=String(l[n]??"(vazio)");i.has(e)||i.set(e,[]),i.get(e).push(l)}return Array.from(i.entries()).map(([t,a])=>{const i=s?`${s}|${n}:${t}`:`${n}:${t}`,l=o.length>0?e(a,o,r+1,i):void 0;return{groupKey:i,groupValue:t,items:a,count:a.length,level:r,children:l}})}(e,u,0,"")},[u]);return{visibleColumns:S,allColumns:e,isColumnHidden:x,toggleColumn:f,showAllColumns:g,resetColumns:b,columnOrder:c,reorderColumns:v,groupByColumn:C,setGroupByColumn:k,groupByColumns:u,setGroupByColumns:w,addGroupByColumn:j,removeGroupByColumn:N,reorderGroupByColumns:_,getGroupedData:A,collapsedGroups:p,toggleGroupCollapse:y}}function vi({enabled:e=!1,onReorder:t}){const[r,s]=a.useState(null),[n,o]=a.useState(null),i=a.useCallback(()=>{s(null),o(null)},[]),l=a.useCallback((a,n)=>({draggable:e,onDragStart:t=>{e&&(s(a),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",String(a)),n&&t.dataTransfer.setData("application/column-key",n))},onDragOver:t=>{e&&null!==r&&(t.preventDefault(),t.dataTransfer.dropEffect="move")},onDragEnter:t=>{e&&null!==r&&(t.preventDefault(),o(a))},onDrop:s=>{s.preventDefault(),e&&null!==r&&r!==a?(t(r,a),i()):i()},onDragEnd:()=>{i()}}),[e,r,t,i]);return a.useMemo(()=>({dragFromIndex:r,dragOverIndex:n,isDragging:null!==r,getDragProps:l}),[r,n,l])}function yi({columns:e,columnOrder:r,isColumnHidden:s,toggleColumn:n,showAllColumns:o,reorderColumns:i,groupByColumn:l,setGroupByColumn:d,groupByColumns:u=[],addGroupByColumn:m,removeGroupByColumn:p,resetColumns:h}){const{t:x}=y.useTranslation(),[f,g]=a.useState(null),[b,v]=a.useState(null),w=a.useRef(null),j=new Map(e.map(e=>[String(e.key),e])),N=r.filter(e=>j.has(e)).map(e=>j.get(e)),_=()=>{w.current=null,g(null),v(null)};N.some(e=>s(String(e.key)));const C=N.every(e=>!s(String(e.key)));return t.jsxs(tn,{children:[t.jsx(an,{asChild:!0,children:t.jsx(kr,{variant:"outline",size:"icon",className:"h-8 w-8",children:t.jsx(c.Columns3,{size:16})})}),t.jsxs(rn,{className:"w-[260px] p-0",align:"end",children:[t.jsx("div",{className:"px-3 py-2 border-b",children:t.jsx("span",{className:"text-sm font-medium",children:x("columns")})}),t.jsx("div",{className:"max-h-[300px] overflow-auto py-1",children:t.jsx(Qs,{delayDuration:300,children:N.map((e,a)=>{const r=String(e.key),o=s(r),h=!1!==e.hideable,y=!0===e.groupable,j=u.includes(r)||l===r;return t.jsxs("div",{draggable:!0,onDragStart:()=>(e=>{w.current=e,g(e)})(a),onDragOver:e=>((e,t)=>{e.preventDefault(),v(t)})(e,a),onDrop:()=>(e=>{null!==w.current&&w.current!==e&&i(w.current,e),w.current=null,g(null),v(null)})(a),onDragEnd:_,className:Nr("flex items-center gap-2 px-3 py-1.5 text-sm cursor-grab active:cursor-grabbing","hover:bg-muted/50 transition-colors",f===a&&"opacity-50",b===a&&"border-t-2 border-primary"),children:[t.jsx(c.GripVertical,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx(Ss,{checked:!o,onCheckedChange:()=>h&&n(r),disabled:!h,className:"shrink-0"}),t.jsx("span",{className:Nr("flex-1 truncate",o&&"text-muted-foreground"),children:e.header}),y&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:Nr("h-6 w-6 shrink-0",j&&"text-primary bg-primary/10"),onClick:e=>{e.stopPropagation(),j?p?p(r):d?.(null):m?m(r):d?.(r)},children:t.jsx(c.Group,{size:14})})}),t.jsx(Zs,{children:x(j?"remove_grouping":"group_by_column")})]})]},r)})})}),t.jsxs("div",{className:"border-t px-3 py-2 space-y-1",children:[t.jsx(kr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:C?()=>N.filter(e=>!1!==e.hideable).forEach(e=>n(String(e.key))):o,children:x(C?"deselect_all":"select_all_columns")}),h&&t.jsx(kr,{variant:"ghost",size:"sm",className:"w-full text-xs font-normal justify-start",onClick:h,children:x("reset_default")})]})]})]})}function wi({columns:e,groupByColumns:r,addGroupByColumn:s,removeGroupByColumn:n,reorderGroupByColumns:o}){const[i,l]=a.useState(!1),[d,u]=a.useState(null),[m,p]=a.useState(null),h=new Map(e.map(e=>[String(e.key),e])),x=()=>{u(null),p(null)},f=r.length>0;return t.jsxs("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",l(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)},onDrop:e=>{e.preventDefault(),l(!1);if(Array.from(e.dataTransfer.types).includes("application/group-chip-index"))return;const t=e.dataTransfer.getData("application/column-key");if(t&&!r.includes(t)){const e=h.get(t);e&&e.groupable&&s(t)}},className:Nr("flex items-center gap-2 px-4 py-2 min-h-[40px] border-b transition-colors",i&&"bg-primary/5 border-primary/30",!f&&"text-muted-foreground"),children:[t.jsx(c.Group,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx("div",{className:"flex-1 flex items-center gap-1.5 flex-wrap",children:f?r.map((e,r)=>{const s=h.get(e);if(!s)return null;const i=d===r,l=m===r&&d!==r;return t.jsxs(a.Fragment,{children:[r>0&&t.jsx("span",{className:"text-xs text-muted-foreground",children:"›"}),t.jsxs(Ds,{variant:"secondary",className:Nr("cursor-grab active:cursor-grabbing gap-1 pr-1 select-none",i&&"opacity-50",l&&"ring-2 ring-primary"),draggable:!0,onDragStart:e=>((e,t)=>{e.stopPropagation(),e.dataTransfer.setData("application/group-chip-index",String(t)),e.dataTransfer.effectAllowed="move",u(t)})(e,r),onDragOver:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),p(t)})(e,r),onDrop:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const a=e.dataTransfer.getData("application/group-chip-index");if(""!==a){const e=parseInt(a,10);isNaN(e)||e===t||o(e,t)}u(null),p(null)})(e,r),onDragEnd:x,children:[s.header,t.jsx("button",{onClick:t=>{t.stopPropagation(),n(e)},className:"ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20 transition-colors",children:t.jsx(c.X,{size:12})})]})]},e)}):t.jsx("span",{className:"text-xs",children:"Arraste um cabeçalho de coluna aqui para agrupar"})})]})}const ji=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:d,customRowActions:u,enableBulkActions:m=!1,rowActionsVariant:p="dropdown",onNew:h,newButtonLabel:x,showNewButton:f=!0,customActions:g=[],hideActionBar:b,showActionBar:v=!0,showSearch:w=!1,searchValue:j,onSearchChange:N,searchPlaceholder:_,bulkActions:C=[],onBulkDelete:k,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D=!1,enableColumnResize:E=!0,resizeStorageKey:P,enableColumnManager:I=!0,columnManagerStorageKey:M,defaultHiddenColumns:R,enableGrouping:L=!1,enableExpandableRows:F=!1,renderExpandedContent:z,expandedRowIds:U,onToggleExpand:O,defaultExpandAll:B=!1,hideActionsColumn:q=!1,readOnly:$=!1})=>{const{t:V}=y.useTranslation(),{setSearchVisible:W}=ko(),H=To(),[G,K]=a.useState(()=>B&&F?new Set(r.entities.map(e=>e.id)):new Set),Y=void 0!==U,Q=Y?new Set(U):G,X=a.useCallback(e=>{Y&&O?O(e):K(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[Y,O]),J=void 0!==b?!b:v;a.useEffect(()=>{if(!w)return W(!0),()=>W(!1)},[W,w]);const Z=bi({columns:s,storageKey:M,enabled:I,defaultHiddenColumns:R}),ee=vi({enabled:I,onReorder:Z.reorderColumns}),te=I?Z.visibleColumns:s,{columnWidths:ae,isDragging:re,activeColumn:se,handleMouseDown:ne}=ci({columns:te.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:500,defaultWidth:e.width??e.minWidth??150})),storageKey:P?`${P}-columns`:void 0,enabled:E}),oe=a.useMemo(()=>(()=>{if(E){const e=te.map(e=>ae[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return te.map((a,r)=>({...a,calculatedWidth:e[r],style:{width:e[r]/t*100+"%"}}))}let e=0;const t=te.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const a=t.minWidth||120,r=t.weight||1;return e+=a,{...t,calculatedWidth:a,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})(),[te,E,ae]),ie=h||g.length>0||w||m||S||D||I,le=J&&ie,ce=q||$,de=k||(()=>{r.bulkDelete?.(r.selectedIds)}),ue=e=>t.jsx(Lo,{className:"text-center",children:d?d(e):"inline"===p?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:t.jsx(ii,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}):t.jsx(oi,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})}),me=e=>t.jsx(Jo,{className:"w-[160px]",children:t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:u?u(e):[],renderAs:"context"})}),pe=I?t.jsx(yi,{columns:s,columnOrder:Z.columnOrder,isColumnHidden:Z.isColumnHidden,toggleColumn:Z.toggleColumn,showAllColumns:Z.showAllColumns,resetColumns:Z.resetColumns,reorderColumns:Z.reorderColumns,groupByColumn:L?Z.groupByColumn:void 0,setGroupByColumn:L?Z.setGroupByColumn:void 0,groupByColumns:L?Z.groupByColumns:void 0,addGroupByColumn:L?Z.addGroupByColumn:void 0,removeGroupByColumn:L?Z.removeGroupByColumn:void 0}):void 0;if(H)return r.isLoading?t.jsx(Uo,{count:3}):0===r.entities.length?t.jsx(Bo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"}):t.jsxs("div",{className:"flex flex-col h-full",children:[le&&t.jsx(xi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:de,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),t.jsx("div",{className:"flex-1 overflow-auto space-y-4 p-4",children:r.entities.map(e=>{const a=t.jsx(Er,{className:Nr("overflow-hidden cursor-pointer hover:bg-muted/50",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:t.jsx(Rr,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[m&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(fi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1",children:[te.map(a=>t.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||d)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:d?d(e):t.jsx(oi,{onEdit:n?()=>{n(e)}:void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:u?u(e):[]})})]})]})})},e.id);return $?a:t.jsxs(Vo,{children:[t.jsx(Wo,{asChild:!0,children:a}),me(e)]},e.id)})})]});const he=L&&Z.groupByColumns.length>0?Z.getGroupedData(r.entities):null,xe=null!==he,fe=(F?1:0)+(m?1:0)+te.length+(ce?0:1),ge=e=>{const s=F&&Q.has(e.id),o=t.jsxs(Mo,{className:Nr("cursor-pointer hover:bg-muted/50 relative",("inline"===p||ce)&&"group",m&&r.selectedIds.includes(e.id)&&"bg-muted"),onClick:t=>{t.stopPropagation(),m?r.selectItem(e.id):n?.(e)},children:[F&&t.jsx(Lo,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),X(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":V(s?"collapse_row":"expand_row"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),m&&t.jsx(Lo,{onClick:e=>e.stopPropagation(),children:t.jsx(fi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),te.map(a=>t.jsx(Lo,{className:a.className,children:t.jsx(qo,{children:a.render?a.render(e):String(e[a.key]??"")})},String(a.key))),!ce&&ue(e)]});return t.jsxs(a.Fragment,{children:[$?o:t.jsxs(Vo,{children:[t.jsx(Wo,{asChild:!0,children:o}),me(e)]}),s&&z&&t.jsx(Mo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Lo,{colSpan:fe,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:z(e)})})})]},e.id)},be=(e,r)=>e.map(e=>{const s=Z.collapsedGroups.has(e.groupKey),n=16*e.level,o=Math.max(30,70-15*e.level);return t.jsxs(a.Fragment,{children:[t.jsx(Mo,{className:Nr("hover:bg-muted cursor-pointer"),style:{backgroundColor:`hsl(var(--muted) / ${o}%)`},onClick:()=>Z.toggleGroupCollapse(e.groupKey),children:t.jsx(Lo,{colSpan:r,className:"py-2 px-4",children:t.jsxs("div",{className:"flex items-center gap-2 font-medium text-sm",style:{paddingLeft:`${n}px`},children:[s?t.jsx(c.ChevronRight,{size:16}):t.jsx(c.ChevronDown,{size:16}),t.jsx("span",{children:e.groupValue}),t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",e.count,")"]})]})})}),!s&&(e.children?be(e.children,r):e.items.map(ge))]},e.groupKey)});return t.jsxs("div",{className:"flex flex-col h-full",children:[le&&t.jsx(xi,{onNew:h,newButtonLabel:x,showNewButton:f,showSearch:w,searchValue:j,onSearchChange:N,searchPlaceholder:_,showBulkActions:m,selectedCount:r.selectedIds.length,bulkActions:C,onBulkDelete:de,onClearSelection:r.clearSelection,customActions:g,filters:S,viewMode:A,onViewModeChange:T,showViewToggle:D}),r.isLoading?t.jsx(zo,{rows:5,columns:te.length}):t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L&&t.jsx(wi,{columns:s,groupByColumns:Z.groupByColumns,addGroupByColumn:Z.addGroupByColumn,removeGroupByColumn:Z.removeGroupByColumn,reorderGroupByColumns:Z.reorderGroupByColumns}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs(Do,{className:"table-fixed w-full",children:[t.jsxs("colgroup",{children:[F&&t.jsx("col",{style:{width:"40px"}}),m&&t.jsx("col",{style:{width:"50px"}}),oe.map((e,a)=>t.jsx("col",{style:e.style},a)),!ce&&t.jsx("col",{style:{width:"inline"===p?"auto":"50px",minWidth:"50px"}})]}),t.jsx(Eo,{children:t.jsxs(Mo,{children:[F&&t.jsx(Ro,{className:"w-[40px]"}),m&&t.jsx(Ro,{className:"w-[50px]",children:t.jsx(fi,{checked:r.isAllSelected,onCheckedChange:r.selectAll})}),te.map((e,a)=>{const s=E&&!1!==e.resizable,n=se===String(e.key),o=I?ee.getDragProps(a,String(e.key)):{},i=ee.dragFromIndex===a,l=ee.dragOverIndex===a&&ee.dragFromIndex!==a;return t.jsxs(Ro,{className:Nr(e.className,!1!==e.sortable&&"hover:bg-muted/50 cursor-pointer","relative transition-opacity",I&&ee.isDragging&&"cursor-grabbing",i&&"opacity-50",l&&"border-l-2 border-primary"),onClick:!1!==e.sortable?()=>r.handleSort(String(e.key)):void 0,...o,children:[t.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,!1!==e.sortable&&(d=String(e.key),r.sortField!==d?null:"asc"===r.sortDirection?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}),s&&t.jsx($o,{direction:"horizontal",onMouseDown:t=>ne(String(e.key),t),isDragging:n})]},String(e.key));var d}),!ce&&t.jsx(Ro,{className:"w-[50px] text-center",children:pe||e.t("actions")})]})}),t.jsx(Po,{children:0===r.entities.length?t.jsx(Mo,{children:t.jsx(Lo,{colSpan:fe,className:"h-32",children:t.jsx(Bo,{title:e.t("no_items_found_empty"),description:"Não há dados para exibir no momento.",variant:"search"})})}):xe?be(he,fe):r.entities.map(ge)})]})})]})]})};function Ni(e,t,r,s){const[n,o]=a.useState({}),[i,l]=a.useState({}),c=a.useMemo(()=>e,[e]),d=e=>e instanceof Date&&!isNaN(e.getTime()),u=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},m=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(a){return u(e)}},p=(e,t,a)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let s;if("function"==typeof e.validation?s=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(s=e.validation.custom),s)try{const e=s(t,a);if(e)return e}catch(r){}}};a.useEffect(()=>{if(!s)return;const e=t=>{const a=[];return t.forEach(t=>{a.push(t),t.fields&&a.push(...e(t.fields))}),a},a=e(c),n={};a.forEach(e=>{let a;if(t&&void 0!==t[e.name]){if(a=t[e.name],null==a&&(a=""),"date"===e.type&&a)if("string"==typeof a){const e=new Date(a);d(e)&&(a=e.toISOString().split("T")[0])}else d(a)&&(a=a.toISOString().split("T")[0])}else a=u(e);n[e.name]=a}),a.forEach(e=>{const t=m(e,n);void 0!==t&&(n[e.name]=t)}),t&&Object.keys(t).forEach(e=>{a.find(t=>t.name===e)||void 0===t[e]||(n[e]=t[e])}),o(n),l({}),r&&r(n)},[c,t,r,s]);const h=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...h(e.fields))}),t},x=()=>{const e=h(c),t={};return e.forEach(e=>{const a=p(e,n[e.name],n);a&&(t[e.name]=a)}),l(t),0===Object.keys(t).length};return{formData:n,errors:i,updateField:(e,t)=>{o(a=>{const s={...a,[e]:t},n=((e,t)=>{let a={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=m(e,a);void 0!==t&&(a={...a,[e.name]:t})}),a})(e,s);return r&&r(n),n}),i[e]&&l(t=>{const a={...t};return delete a[e],a});const a=h(c).find(t=>t.name===e);if(a){const r=p(a,t,n);r&&l(t=>({...t,[e]:r}))}},validateForm:x,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),x()&&e(n)}}}const _i=[{name:"gray",hue:220,saturation:8},{name:"red",hue:0,saturation:80},{name:"pink",hue:330,saturation:75},{name:"purple",hue:270,saturation:70},{name:"indigo",hue:230,saturation:75},{name:"blue",hue:210,saturation:85},{name:"cyan",hue:190,saturation:75},{name:"teal",hue:170,saturation:65},{name:"green",hue:140,saturation:60},{name:"yellow",hue:45,saturation:90},{name:"orange",hue:25,saturation:90}],Ci=[10,22,35,45,55,68,78,87,94].flatMap(e=>_i.map(({hue:t,saturation:a})=>((e,t,a)=>{a/=100;const r=t=>(t+e/30)%12,s=(t/=100)*Math.min(a,1-a),n=e=>{const t=a-s*Math.max(-1,Math.min(r(e)-3,Math.min(9-r(e),1)));return Math.round(255*t).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`})(t,a,e))),ki=({value:e="#3b82f6",onChange:r,label:s,customColorLabel:n,presetColorsLabel:o,showHexValue:i=!0})=>{const{t:l}=y.useTranslation(),d=n??l("custom_color"),u=o??l("preset_colors"),[m,p]=a.useState(!1),h=a.useRef([]),x=_i.length,f=a.useMemo(()=>{const t=Ci.findIndex(t=>t.toLowerCase()===e.toLowerCase());return t>=0?t:0},[e]),[g,b]=a.useState(f);a.useEffect(()=>{m&&(b(f),requestAnimationFrame(()=>{h.current[f]?.focus()}))},[m,f]);const v=e=>{const t=Math.max(0,Math.min(Ci.length-1,e));b(t),h.current[t]?.focus()},w=e=>{r?.(e),p(!1)};return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Dr,{children:s}),t.jsxs(tn,{open:m,onOpenChange:p,children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{variant:"outline",className:"w-full justify-between text-left font-normal",onKeyDown:e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),p(!0))},children:[t.jsxs("span",{className:"flex items-center min-w-0",children:[t.jsx("span",{className:"h-4 w-4 rounded border mr-2 shrink-0",style:{backgroundColor:e}}),i&&t.jsx("span",{className:"truncate",children:e})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4 opacity-50 shrink-0"})]})}),t.jsx(rn,{className:"w-auto p-3",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{h.current[f]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(Dr,{children:u}),t.jsx("div",{className:"grid gap-1 mt-2",style:{gridTemplateColumns:`repeat(${_i.length}, minmax(0, 1fr))`},onKeyDown:e=>{switch(e.key){case"ArrowRight":e.preventDefault(),v(g+1);break;case"ArrowLeft":e.preventDefault(),v(g-1);break;case"ArrowDown":e.preventDefault(),v(g+x);break;case"ArrowUp":e.preventDefault(),v(g-x);break;case"Home":e.preventDefault(),v(0);break;case"End":e.preventDefault(),v(Ci.length-1);break;case"Enter":e.preventDefault(),w(Ci[g]);break;case"Tab":e.preventDefault(),p(!1)}},role:"grid",children:Ci.map((a,r)=>{const s=a.toLowerCase()===e.toLowerCase();return t.jsx("button",{ref:e=>{h.current[r]=e},type:"button",tabIndex:r===g?0:-1,className:"h-5 w-5 rounded-sm border transition-transform hover:scale-110 hover:z-10 focus:outline-none focus:ring-2 focus:ring-ring focus:z-10 "+(s?"border-foreground ring-2 ring-foreground/30":"border-border/40"),style:{backgroundColor:a},onClick:()=>w(a),"aria-label":`Selecionar cor ${a}`},`${a}-${r}`)})})]}),t.jsxs("div",{children:[t.jsx(Dr,{htmlFor:"color-input",children:d}),t.jsx(Ar,{id:"color-input",type:"color",value:e,onChange:e=>r?.(e.target.value),className:"h-8 w-full mt-2"})]})]})})]})]})},Si=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(xe.Root,{ref:s,className:Nr("relative overflow-hidden",e),...r,children:[t.jsx(xe.Viewport,{className:"h-full w-full rounded-[inherit]",children:a}),t.jsx(Ai,{}),t.jsx(xe.Corner,{})]}));Si.displayName=xe.Root.displayName;const Ai=te.forwardRef(({className:e,orientation:a="vertical",...r},s)=>t.jsx(xe.ScrollAreaScrollbar,{ref:s,orientation:a,className:Nr("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:t.jsx(xe.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Ai.displayName=xe.ScrollAreaScrollbar.displayName;const Ti=[{name:"alarm",filled:!1},{name:"account_box",filled:!0},{name:"announcement",filled:!0},{name:"assessment",filled:!0},{name:"assignment",filled:!0},{name:"bookmark",filled:!0},{name:"build",filled:!0},{name:"change_history",filled:!1},{name:"credit_card",filled:!1},{name:"date_range",filled:!0},{name:"extension",filled:!0},{name:"face",filled:!0},{name:"favorite",filled:!0},{name:"store",filled:!0},{name:"group_work",filled:!0},{name:"home",filled:!0},{name:"label",filled:!0},{name:"lightbulb_2",filled:!1},{name:"list",filled:!0},{name:"line_weight",filled:!0},{name:"question_answer",filled:!0},{name:"mode_heat",filled:!0},{name:"reorder",filled:!0},{name:"warning",filled:!0},{name:"room",filled:!0},{name:"settings",filled:!0},{name:"shopping_cart",filled:!0},{name:"work",filled:!0},{name:"star_rate",filled:!0},{name:"monetization_on",filled:!0},{name:"view_list",filled:!0},{name:"visibility",filled:!0},{name:"error",filled:!0},{name:"equalizer",filled:!0},{name:"release_alert",filled:!0},{name:"mic",filled:!0},{name:"videocam",filled:!0},{name:"call",filled:!0},{name:"chat",filled:!0},{name:"chat_bubble",filled:!0},{name:"email",filled:!0},{name:"link",filled:!0},{name:"report",filled:!0},{name:"flag",filled:!0},{name:"attach_file",filled:!0},{name:"attachment",filled:!0},{name:"attach_money",filled:!0},{name:"bubble_chart",filled:!0},{name:"folder",filled:!0},{name:"business",filled:!0},{name:"device_hub",filled:!0},{name:"flash_on",filled:!0},{name:"image",filled:!0},{name:"lens",filled:!0},{name:"photo_camera",filled:!0},{name:"style",filled:!0},{name:"view_compact",filled:!0},{name:"wb_incandescent",filled:!0},{name:"directions_bus",filled:!0},{name:"directions_car",filled:!0},{name:"flight",filled:!0},{name:"hotel",filled:!0},{name:"local_offer",filled:!0},{name:"restaurant",filled:!0},{name:"restaurant_menu",filled:!0},{name:"local_shipping",filled:!0},{name:"all_inclusive",filled:!0},{name:"business_center",filled:!0},{name:"notifications",filled:!0},{name:"share",filled:!0}];function Di({name:e,filled:a,className:r}){return t.jsx("span",{className:`material-symbols-outlined ${r??""}`,style:a?{fontVariationSettings:"'FILL' 1"}:void 0,children:e})}const Ei=({value:e=null,onChange:r,label:s,noIconLabel:n="SEM ÍCONE",color:o="text-foreground/60"})=>{const[i,l]=a.useState(!1),d=a.useRef([]),u=e?(m=e,Ti.find(e=>e.name===m)):null;var m;const p=a.useMemo(()=>{if(!e)return 0;const t=Ti.findIndex(t=>t.name===e);return t>=0?t:0},[e]),[h,x]=a.useState(p);a.useEffect(()=>{i&&(x(p),requestAnimationFrame(()=>{d.current[p]?.focus()}))},[i,p]);const f=a.useCallback(e=>{const t=Math.max(0,Math.min(Ti.length-1,e));x(t),d.current[t]?.focus()},[]),g=a.useCallback(e=>{r?.(e),l(!1)},[r]),b=a.useCallback(e=>{"ArrowDown"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),l(!0))},[]),v=a.useCallback(e=>{switch(e.key){case"ArrowRight":e.preventDefault(),f(h+1);break;case"ArrowLeft":e.preventDefault(),f(h-1);break;case"ArrowDown":e.preventDefault(),f(h+10);break;case"ArrowUp":e.preventDefault(),f(h-10);break;case"Home":e.preventDefault(),f(0);break;case"End":e.preventDefault(),f(Ti.length-1);break;case"Enter":e.preventDefault(),g(Ti[h]?.name??null);break;case"Tab":e.preventDefault(),l(!1)}},[h,f,g]);return t.jsxs("div",{className:"space-y-2",children:[s&&t.jsx(Dr,{children:s}),t.jsxs(tn,{open:i,onOpenChange:l,children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{variant:"outline",className:"justify-start text-left font-normal gap-2",onKeyDown:b,children:[u?t.jsx(Di,{name:u.name,filled:u.filled,className:`text-xl ${o}`}):t.jsx("span",{className:"text-muted-foreground text-sm",children:n}),t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 opacity-50"})]})}),t.jsx(rn,{className:"w-auto max-w-[min(640px,calc(100vw-2rem))] p-3",align:"start",onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>{d.current[p]?.focus()})},children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(Si,{className:"max-h-[min(480px,calc(100vh-12rem))]",children:t.jsx("div",{className:"grid grid-cols-10 gap-1",onKeyDown:v,role:"grid",children:Ti.map((a,r)=>t.jsx("button",{ref:e=>{d.current[r]=e},type:"button",tabIndex:r===h?0:-1,className:`flex items-center justify-center p-1.5 rounded border transition-colors ${o} ${e===a.name?"bg-accent border-ring":"border-transparent hover:bg-accent"}`,onClick:()=>g(a.name),title:a.name,children:t.jsx(Di,{name:a.name,filled:a.filled,className:"text-2xl"})},a.name))})}),t.jsx("button",{type:"button",className:"w-full py-2 text-sm font-semibold text-foreground hover:bg-accent rounded transition-colors border-t pt-3",onClick:()=>g(null),children:n})]})})]})]})},Pi=te.forwardRef(({className:e,...a},r)=>t.jsx(fe.Root,{className:Nr("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...a,ref:r,children:t.jsx(fe.Thumb,{className:Nr("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Pi.displayName=fe.Root.displayName;const Ii=(e={})=>{const{user:t,alias:a}=ko(),{enabled:r=!0,status:s="active"}=e;return j.useQuery({queryKey:["qualiex-users",a,s],queryFn:()=>lo.getUsers(a,s),enabled:r&&!!a&&!!t,staleTime:3e5,retry:2,retryDelay:1e3})},Mi=({value:r,onChange:s,multiple:n=!1,label:o,required:i,placeholder:l,icon:c,maxDisplayedBadges:d,className:u,disabled:m,enabled:p,displayFormat:h="name",customDisplayFn:x,filterFn:f,sortOptions:g=!0,popoverContainer:b,onOpen:v,onClose:w})=>{const{t:j}=y.useTranslation(),{data:N=[],isLoading:_,error:C}=Ii({enabled:p}),[k,S]=a.useState(new Map),A=a.useMemo(()=>r?Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean):[],[r]),T=a.useMemo(()=>{if(0===A.length||0===N.length)return"";const e=new Set(N.map(e=>e.userId||e.id||""));return A.filter(t=>t&&!e.has(t)&&!k.has(t)).sort().join(",")},[A,N,k]);a.useEffect(()=>{if(!T)return;const e=T.split(",");let t=!1;const a=$n.extractTokenData();return a?.alias&&a?.companyId?(lo.fetchUsers(a.alias,a.companyId,"all").then(a=>{t||S(t=>{const r=new Map(t);for(const s of e){const e=a.find(e=>e.userId===s||e.id===s);e&&r.set(s,{...e,isActive:e.isActive??!1})}return r})}).catch(()=>{}),()=>{t=!0}):void 0},[T]);const D=a.useMemo(()=>f?N.filter(f):N,[N,f]),E=a.useMemo(()=>{if(0===A.length)return D;const t=new Set(D.map(e=>e.userId||e.id||"")),a=A.filter(e=>e&&!t.has(e));if(0===a.length)return D;const r=a.map(t=>{const a=k.get(t);return a||{userId:t,id:t,userName:e.t("inactive_user"),userEmail:"",isActive:!1}});return[...D,...r]},[D,A,k]),P=a.useCallback(t=>{let a;if("custom"===h&&x)a=x(t);else{const e=t.userName||"";switch(h){case"name-email":a=t.userEmail?`${e} (${t.userEmail})`:e;break;case"name-role":a=t.roleName?`${e} - ${t.roleName}`:e;break;default:a=e}}return!1===t.isActive?`${a} (${e.t("inactive")})`:a},[h,x]);return t.jsx(fn,{multiple:n,value:r??(n?[]:""),onChange:s,options:E,isLoading:_,error:C,getOptionValue:e=>e.userId||e.id||"",getOptionLabel:P,placeholder:l||"Pesquisar...",searchPlaceholder:"Pesquisar...",emptyMessage:j("no_results"),label:o,required:i,icon:c,maxDisplayedBadges:d,disabled:m,className:u,sortOptions:g,popoverContainer:b,onOpen:v,onClose:w})};function Ri({title:e,sections:r,initialData:s,onSubmit:n,onCancel:o,open:i,submitButtonText:l,isLoading:c=!1,usersData:d}){const[u,m]=a.useState(r?.[0]?.id||""),p=a.useRef(null),[h,x]=a.useState(null),f=a.useCallback(e=>{p.current=e,x(e)},[]),g=a.useMemo(()=>r&&Array.isArray(r)?r.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[r]),{formData:b,errors:v,updateField:y,handleSubmit:w}=Ni(g,s,void 0,i),j=a.useMemo(()=>r&&Array.isArray(r)?r.map(e=>({...e,disabled:e.condition?!e.condition(b):e.disabled||!1})):[],[r,b]),N=a.useMemo(()=>{const e=j.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=j.find(e=>!e.disabled);return t?.id||u},[j,u]);a.useEffect(()=>{N!==u&&m(N)},[N,u]);const _=j.find(e=>e.id===N),C=e=>{const a=(e.computedValue,b[e.name]),r=void 0!==a?a:"",s=v[e.name];switch(e.type){case"group":const a="horizontal"===e.layout,n=a?`flex gap-3 w-full ${e.className||""}`:"space-y-3",o=a?Nr("space-y-2 w-full",e.wrapperClassName):Nr("space-y-2",e.className,e.wrapperClassName);return t.jsxs("div",{className:o,children:[e.label,t.jsx("div",{className:n,children:e.fields?.map(e=>C(e))})]},e.name);case"user-select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Mi,{value:r||"",onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:s?"border-destructive":""}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"textarea":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(As,{id:e.name,value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,rows:e.rows,maxLength:e.maxLength,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"select":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsxs(gs,{value:String(r),onValueChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[t.jsx(ys,{className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,children:t.jsx(vs,{placeholder:e.placeholder})}),t.jsx(Ns,{children:e.options?.map(e=>t.jsx(Cs,{value:e.value,children:e.label},e.value))})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"multiselect":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(fn,{options:e.options||[],value:Array.isArray(r)?r:[],onChange:t=>y(e.name,t),placeholder:e.placeholder,disabled:e.disabled,error:s,popoverContainer:h,getOptionValue:e=>String(e.value),getOptionLabel:e=>e.label}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"date":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ar,{id:e.name,type:"date",value:String(r),onChange:t=>y(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Nr("w-full",s?"border-destructive":"",e.disabled?"bg-muted cursor-not-allowed":"")}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"color":return t.jsxs("div",{children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ar,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>y(e.name,t.target.value),className:"h-10"}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"color-picker":return t.jsxs("div",{children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(ki,{value:r||e.defaultValue||"#3b82f6",onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"icon-picker":return t.jsxs("div",{children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ei,{value:r||e.defaultValue||null,onChange:t=>y(e.name,t)}),s&&t.jsx("p",{className:"text-sm text-destructive mt-1",children:s})]},e.name);case"custom":if(!e.component)return null;const i=e.component,l="function"==typeof e.componentProps?e.componentProps(b):e.componentProps||{};return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(i,{value:r,onChange:t=>{y(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:s,popoverContainer:h,...l}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"number":return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ar,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const a=t.target.value,r=""===a?null:Number(a);y(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"checkbox":return t.jsxs("div",{className:`flex items-center space-x-2 ${e.className||""}`,children:[t.jsx(Ss,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),t.jsxs(Dr,{htmlFor:e.name,className:"cursor-pointer",children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name);case"switch":return t.jsxs("div",{className:`flex items-center justify-between space-x-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Pi,{id:e.name,checked:!!r,onCheckedChange:t=>y(e.name,t),disabled:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive mt-2",children:s})]},e.name);default:return t.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[t.jsxs(Dr,{htmlFor:e.name,children:[e.label,e.required&&t.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.jsx(Ar,{id:e.name,type:"text",value:r||"",onChange:t=>{y(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${s?"border-destructive":""} ${e.disabled?"bg-muted cursor-not-allowed":""}`,readOnly:e.disabled}),s&&t.jsx("p",{className:"text-sm text-destructive",children:s})]},e.name)}},k=a.useCallback(()=>{if(!_)return null;if(_.disabled)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:t.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:"Complete as informações obrigatórias na seção i18n.t('ap_general_info') para acessar esta seção."})]});if(_.component){const e=_.component;return t.jsx(e,{formData:b,updateField:y,errors:v,users:d,disabled:_.disabled})}return t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:_.fields.map(C)})},[_,b,y,v,d,C]),S=t.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[j.length>1&&t.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:t.jsx("div",{className:"flex space-x-2",children:j.map(e=>t.jsx(kr,{variant:N===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=j.find(t=>t.id===e);t&&!t.disabled&&m(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 py-4",children:c?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"text-muted-foreground",children:"Carregando..."})}):t.jsxs("form",{onSubmit:w(n),className:"space-y-3 md:space-y-4",children:[k(),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(kr,{type:"button",variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(kr,{type:"submit",disabled:c,children:l||"Salvar"})]})]})})]});return t.jsx(Yr,{open:i,onOpenChange:e=>{!1===e&&!0===i&&o()},children:t.jsxs(ts,{ref:f,variant:"form",className:"max-w-4xl max-h-[90vh] overflow-visible",children:[t.jsxs(as,{showSeparator:!0,children:[t.jsx(ns,{children:e}),t.jsx(os,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),S]})})}function Li({currentPage:e,totalPages:a,totalItems:r,itemsPerPage:s,onPageChange:n,onItemsPerPageChange:o,variant:i="full"}){const{t:l}=y.useTranslation();if(0===r)return null;const d=(e-1)*s+1,u=Math.min(e*s,r);return t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[t.jsx("div",{className:"flex items-center gap-2",children:"full"===i&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:l("rows_per_page","Linhas por página")}),t.jsxs(gs,{value:String(s),onValueChange:e=>o(Number(e)),children:[t.jsx(ys,{className:"h-8 w-[70px]",children:t.jsx(vs,{})}),t.jsxs(Ns,{children:[t.jsx(Cs,{value:"10",children:"10"}),t.jsx(Cs,{value:"25",children:"25"}),t.jsx(Cs,{value:"50",children:"50"}),t.jsx(Cs,{value:"100",children:"100"})]})]})]})}),t.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[d,"-",u," ",l("of","de")," ",r," ",l("items","itens")]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(kr,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsLeft,{size:16})}),t.jsx(kr,{variant:"outline",size:"sm",onClick:()=>n(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronLeft,{size:16})}),t.jsxs("div",{className:"flex items-center gap-1 px-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e}),t.jsx("span",{className:"text-sm text-muted-foreground",children:l("of","de")}),t.jsx("span",{className:"text-sm font-medium",children:a})]}),t.jsx(kr,{variant:"outline",size:"sm",onClick:()=>n(e+1),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronRight,{size:16})}),t.jsx(kr,{variant:"outline",size:"sm",onClick:()=>n(a),disabled:e===a,className:"h-8 w-8 p-0",children:t.jsx(c.ChevronsRight,{size:16})})]})]})}function Fi({manager:e}){return t.jsx(Li,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const zi={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Ui={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Oi={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Bi({children:e,direction:a="column",gap:r="md",align:s="stretch",justify:n="start",wrap:o=!1,className:i}){return t.jsx("div",{className:Nr("flex","column"===a?"flex-col":"flex-row",zi[r],Ui[s],Oi[n],o&&"flex-wrap",i),children:e})}function qi({manager:e,filters:a,inline:r=!1}){const{t:s}=y.useTranslation(),{isSearchVisible:n}=ko(),o=e.searchTerm,i=t.jsxs(t.Fragment,{children:[a.some(e=>"search"===e.type)&&!n&&t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(Ar,{placeholder:"Pesquisar",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),a.filter(e=>"select"===e.type&&e.options).map((e,a)=>t.jsxs(gs,{value:e.value||"",onValueChange:t=>e.onChange?.(t),children:[t.jsx(ys,{className:"w-[180px]",children:t.jsx(vs,{placeholder:e.placeholder})}),t.jsx(Ns,{children:e.options.map(e=>t.jsx(Cs,{value:e.value,children:e.label},e.value))})]},`select-${a}`)),a.filter(e=>"custom"===e.type&&e.component).map((e,a)=>{const s=e.component;return t.jsx("div",{className:r?"":"w-full sm:w-auto",children:t.jsx(s,{...e.props})},`custom-${a}`)}),o&&t.jsxs(kr,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[t.jsx(c.X,{className:"h-4 w-4 mr-2"}),"Limpar"]})]});return r?t.jsx("div",{className:"flex items-center gap-2",children:i}):t.jsx(Bi,{direction:"column",gap:"md",className:"mb-6",children:t.jsx(Bi,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:i})})}function $i({manager:e,config:r,formSections:s,onSave:n,onToggleStatus:o,defaultSort:i,readOnly:l=!1}){e&&e.queryKey;const{setSearchVisible:c}=ko(),[d,u]=N.useSearchParams(),[m,p]=a.useState(!1),[h,x]=a.useState(null),[f,g]=a.useState({isOpen:!1,entityId:null,entityName:""}),[b,v]=a.useState({isOpen:!1,count:0});a.useEffect(()=>(c(!0),()=>{c(!1)}),[c]),a.useEffect(()=>{if(i&&e){const t=`${e.queryKey}_sortField`,a=`${e.queryKey}_sortDirection`;if(!d.has(t)&&!d.has(a)){const e=Object.fromEntries(d);e[t]=i.column,e[a]=i.direction,u(e)}}},[]);const y=!l&&s.length>0?e=>{r.onEdit?r.onEdit(e):(x(e),p(!0))}:void 0,w=l||"function"!=typeof e?.deleteEntity?void 0:e=>{g({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})},j=()=>{g({isOpen:!1,entityId:null,entityName:""})},_=void 0!==r.hideNewButton?!r.hideNewButton:r.showNewButton??!0,C=(r.customActions||[]).map(e=>({label:e.label,icon:e.icon,action:e.action,variant:"destructive"===e.variant?"default":e.variant,disabled:e.disabled,disabledReason:e.disabledReason}));return t.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[(r.showActionBar??!0)&&t.jsx(xi,{onNew:()=>{r.onNew?r.onNew():(x(null),p(!0))},newButtonLabel:r.newButtonLabel,showNewButton:_,showSearch:r.showSearch,searchValue:e.searchTerm,onSearchChange:e.handleSearch,searchPlaceholder:r.searchPlaceholder,showBulkActions:r.enableBulkActions,selectedCount:e.selectedIds.length,bulkActions:r.bulkActions,onBulkDelete:()=>{v({isOpen:!0,count:e.selectedIds.length})},onClearSelection:e.clearSelection,customActions:C,filters:r.filters&&r.filters.length>0?t.jsx(qi,{manager:e,filters:r.filters,inline:!0}):void 0}),t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r.customListView?t.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.customListView(e.entities,e)}):t.jsx(ji,{manager:e,columns:r.columns,onEdit:y,onDelete:w,onToggleStatus:o,enableBulkActions:r.enableBulkActions,customRowActions:r.customRowActions,enableColumnManager:!0,columnManagerStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-columns`,resizeStorageKey:`crud-${r.entityName.toLowerCase().replace(/\s+/g,"-")}-resize`,defaultHiddenColumns:r.defaultHiddenColumns,readOnly:l})}),t.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:t.jsx(Fi,{manager:e})}),!r.useCustomRouting&&!r.onNew&&s.length>0&&t.jsx(Ri,{open:m,title:h?`Editar ${r.entityName}`:`Novo ${r.entityName}`,sections:s,initialData:h||void 0,onSubmit:e=>{n(e),p(!1),x(null)},onCancel:()=>{p(!1),x(null)},isLoading:e.isLoading,submitButtonText:h?"Atualizar":"Criar"}),t.jsx(Yr,{open:f.isOpen,onOpenChange:j,children:t.jsxs(ts,{size:"sm",variant:"destructive",children:[t.jsx(as,{showSeparator:!0,children:t.jsx(ns,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:f.entityName}),". Esta ação não pode ser desfeita."]})}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"outline",onClick:j,children:"Cancelar"}),t.jsx(kr,{variant:"destructive",onClick:()=>{f.entityId&&"function"==typeof e?.deleteEntity&&(e.deleteEntity(f.entityId),g({isOpen:!1,entityId:null,entityName:""}))},disabled:e.isDeleting,children:e.isDeleting?"Excluindo...":"Sim, excluir"})]})]})}),t.jsx(Yr,{open:b.isOpen,onOpenChange:()=>v({isOpen:!1,count:0}),children:t.jsxs(ts,{size:"sm",variant:"destructive",children:[t.jsx(as,{showSeparator:!0,children:t.jsx(ns,{children:"Você tem certeza absoluta?"})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Você está prestes a excluir ",t.jsx("strong",{children:b.count})," ",1===b.count?r.entityName:r.entityNamePlural,". Esta ação não pode ser desfeita."]})}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"outline",onClick:()=>v({isOpen:!1,count:0}),children:"Cancelar"}),t.jsx(kr,{variant:"destructive",onClick:()=>{e.bulkDelete?.(e.selectedIds),v({isOpen:!1,count:0})},disabled:e.isBulkDeleting,children:e.isBulkDeleting?"Excluindo...":"Sim, excluir"})]})]})})]})}function Vi(e,t){const a=e.toLowerCase();return a.includes("email")?{type:"email",required:!0}:a.includes("phone")||a.includes("tel")?{type:"tel"}:a.includes("description")||a.includes("content")||a.includes("notes")?{type:"textarea"}:a.includes("status")||a.includes("type")||a.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function Wi(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}function Hi(e={}){const{paramName:t="alias"}=e,r=N.useParams(),{alias:s,companies:n}=ko(),o=r[t]||null;return a.useMemo(()=>{if(!o)return{urlAlias:null,isAliasMismatch:!1,isValidAlias:!1,isMissing:!0,matchedCompany:null};const e=n?.find(e=>e.alias===o)||null,t=!!e;return{urlAlias:o,isAliasMismatch:t&&o!==s,isValidAlias:t,isMissing:!1,matchedCompany:e}},[o,s,n])}const Gi=s.cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",{variants:{variant:{info:"bg-[hsl(var(--alert-info-bg))] border-[hsl(var(--alert-info-border))] text-[hsl(var(--alert-info-foreground))] [&>svg]:text-[hsl(var(--alert-info-foreground))]",warning:"bg-[hsl(var(--alert-warning-bg))] border-[hsl(var(--alert-warning-border))] text-[hsl(var(--alert-warning-foreground))] [&>svg]:text-[hsl(var(--alert-warning-foreground))]",danger:"bg-[hsl(var(--alert-danger-bg))] border-[hsl(var(--alert-danger-border))] text-[hsl(var(--alert-danger-foreground))] [&>svg]:text-[hsl(var(--alert-danger-foreground))]",success:"bg-[hsl(var(--alert-success-bg))] border-[hsl(var(--alert-success-border))] text-[hsl(var(--alert-success-foreground))] [&>svg]:text-[hsl(var(--alert-success-foreground))]"}},defaultVariants:{variant:"info"}}),Ki={info:c.Info,warning:c.Info,danger:c.AlertTriangle,success:c.CheckCircle},Yi=te.forwardRef(({className:e,variant:a="info",showIcon:r=!0,children:s,...n},o)=>{const i=Ki[a||"info"];return t.jsxs("div",{ref:o,role:"alert",className:Nr(Gi({variant:a}),e),...n,children:[r&&t.jsx(i,{className:"h-4 w-4"}),s]})});Yi.displayName="Alert";const Qi=te.forwardRef(({className:e,...a},r)=>t.jsx("h5",{ref:r,className:Nr("mb-1 font-medium leading-none tracking-tight",e),...a}));Qi.displayName="AlertTitle";const Xi=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("text-sm [&_p]:leading-relaxed",e),...a}));Xi.displayName="AlertDescription";const Ji=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Root,{ref:r,className:Nr("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...a}));Ji.displayName=ge.Root.displayName;const Zi=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Image,{ref:r,className:Nr("aspect-square h-full w-full",e),...a}));Zi.displayName=ge.Image.displayName;const el=te.forwardRef(({className:e,...a},r)=>t.jsx(ge.Fallback,{ref:r,className:Nr("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...a}));function tl(){return Ge()||"https://common-v4-api.qualiex.com"}function al(){const e=Qe();if(e)return e;const t=tl().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://login-api${t[1]||""}.${t[2]}`}return"https://login-api.qualiex.com"}function rl(e){const t=$n.getAccessToken();if(!t)throw new Error("Token Qualiex não encontrado");if(!e)throw new Error("Alias é obrigatório para chamadas à API Qualiex");return{Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","un-alias":e}}async function sl(e,t,a){const r=async()=>{const r=await fetch(e,{...a,headers:{...rl(t),...a?.headers||{}}});if(!r.ok){const e=new Error(`API Error: ${r.status}`);throw e.status=r.status,e.statusCode=r.status,e}return r};try{return await r()}catch(s){if(await io.handleApiError(s))return await r();throw s}}async function nl(e){const t=$n.getAccessToken(),a=$n.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=function(e){const t=Mn.parseJwtPayload(e),a="string"==typeof t?.subNewId?t.subNewId.trim():"";if(!a)throw new Error("NewId do usuário não encontrado no id-token.");return a}(a),s=$n.getSelectedAlias()?.trim()||$n.extractTokenData()?.alias||"",n=`${al()}/api/Users/UpdatePhotoByNewIdAsync?newId=${encodeURIComponent(r)}`,o=async()=>{const r=$n.getAccessToken()||t,o=$n.getIdToken()||a,i=$n.getAppGroupId(s)?.toString()??"1",l=new FormData;l.append(e.name,e,e.name);const c=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${r}`,"id-token":o,Accept:"application/json, text/plain, */*",...s?{"un-alias":s}:{},AppGroupId:i},body:l});if(!c.ok){const e=new Error(`Upload falhou: ${c.status} ${c.statusText}`);throw e.status=c.status,e.statusCode=c.status,e}};try{await o()}catch(i){if(await io.handleApiError(i))try{return void await o()}catch(l){throw Hn.handleError(l instanceof Error?l:"Erro ao enviar foto após renovação de token",!1),l}throw i}}el.displayName=ge.Fallback.displayName;const ol={"en-US":1,"pt-BR":2,"es-ES":3,"fr-FR":4};function il(e,t){const a=e?.trim();if(a)return a;const r=Mn.parseJwtPayload(t),s="string"==typeof r?.subNewId?r.subNewId.trim():"";if(s)return s;throw new Error("Identificador do usuário não encontrado.")}function ll(e){const t=$n.getSelectedAlias()?.trim();if(t)return t;const a=$n.getSupabaseToken(),r=a?Mn.parseJwtPayload(a):null,s="string"==typeof r?.alias?r.alias.trim():"string"==typeof r?.default?r.default.trim():"string"==typeof r?.user_alias?r.user_alias.trim():"";if(s)return s;const n=Mn.parseJwtPayload(e),o="string"==typeof n?.default?n.default.trim():"string"==typeof n?.alias?n.alias.trim():"string"==typeof n?.user_alias?n.user_alias.trim():"";if(o)return o;for(const i in n||{}){if(!/^co\d+$/.test(i))continue;const e=n?.[i];if("string"!=typeof e)continue;const[t]=e.split(";");if(t?.trim())return t.trim()}}async function cl(e){const t=$n.getAccessToken(),a=$n.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=il(e.newId,a),s=ll(a),n={};e.name&&e.name.trim()&&(n.Name=e.name.trim()),e.email&&e.email.trim()&&(n.Email=e.email.trim());const o=function(e){if(void 0!==e)return null===e||""===e?null:"number"==typeof e?1===e||2===e||3===e||4===e?e:null:ol[e]??null}(e.language);void 0!==o&&(n.LanguageId=o);const i=`${al()}/api/Users/UpdateUserProfile/${encodeURIComponent(r)}`,l=async()=>{const e=$n.getAccessToken()||t,r=$n.getIdToken()||a,o=$n.getAppGroupId(s)?.toString()??"1",l=await fetch(i,{method:"PUT",headers:{Authorization:`Bearer ${e}`,"id-token":r,...s?{"un-alias":s}:{},AppGroupId:o,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const e=new Error(`Falha ao atualizar perfil: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}};try{await l()}catch(c){if(await io.handleApiError(c))return void await l();throw c}}const dl={1:"en-US",2:"pt-BR",3:"es-ES",4:"fr-FR"};function ul(e,...t){for(const a of t){const t=e[a];if("string"==typeof t&&t.trim())return t}return null}async function ml(e){const t=$n.getAccessToken(),a=$n.getIdToken();if(!t||!a)throw new Error("Sessão inválida. Faça login novamente.");const r=il(e,a),s=ll(a),n=`${al()}/api/Users/GetUserProfileByNewId/${encodeURIComponent(r)}`,o=async()=>{const e=$n.getAccessToken()||t,o=$n.getIdToken()||a,i=$n.getAppGroupId(s)?.toString()??"1",l=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e}`,"id-token":o,...s?{"un-alias":s}:{},AppGroupId:i,Accept:"application/json, text/plain, */*"}});if(404===l.status){const e=new Error("Usuário não encontrado.");throw e.status=404,e.statusCode=404,e}if(!l.ok){const e=new Error(`Falha ao obter perfil: ${l.status} ${l.statusText}`);throw e.status=l.status,e.statusCode=l.status,e}const c=await l.json(),d=function(e,...t){for(const a of t){const t=e[a];if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t&&t.trim()&&!Number.isNaN(Number(t)))return Number(t)}return null}(c,"languageId","LanguageId"),u=1===d||2===d||3===d||4===d?d:null,m=ul(c,"photoUrl","PhotoUrl");let p=null;if(m)if(/^https?:\/\//i.test(m))p=m;else{const e=m.replace(/^\/+/,""),t=e.includes("?")?"&":"?";p=`${al()}/api/${e}${t}size=96`}return{newId:r,name:ul(c,"name","Name"),email:ul(c,"email","Email"),languageId:u,language:u?dl[u]:null,photoUrl:p}};try{return await o()}catch(i){if(await io.handleApiError(i))return await o();throw i}}const pl=[{value:"pt-BR",label:"Português (Brasil)"},{value:"en-US",label:"English (US)"},{value:"es-ES",label:"Español"}],hl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,xl=({open:e,onOpenChange:r,user:s,userPhotoUrl:n,userInitials:o})=>{const{t:i,i18n:d}=y.useTranslation(),u=a.useRef(null),[m,p]=a.useState(null),[h,x]=a.useState(null),[f,g]=a.useState(d.language||"pt-BR"),[b,v]=a.useState(s.name||""),[w,j]=a.useState(s.email||""),[N,_]=a.useState(!1),[C,k]=a.useState(null);a.useEffect(()=>{if(!e)return;v(s.name||""),j(s.email||""),g(d.language||"pt-BR"),k(null);let t=!1;return(async()=>{try{const e=await ml(s.id||void 0);if(t)return;e.name&&v(e.name),e.email&&j(e.email),e.language&&g(e.language),k(e.photoUrl)}catch{}})(),()=>{t=!0}},[e,s.id,s.name,s.email,d.language]);const S=m||C||n,A=e=>{N||(e||(p(null),x(null),g(d.language||"pt-BR"),v(s.name||""),j(s.email||"")),r(e))};return t.jsx(Yr,{open:e,onOpenChange:A,children:t.jsxs(ts,{className:"sm:max-w-md",children:[t.jsx(as,{children:t.jsx(ns,{children:i("edit_profile","Editar Perfil")})}),t.jsxs(rs,{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(Ji,{className:"w-24 h-24 flex-shrink-0 ring-2 ring-border ring-offset-2 ring-offset-background",children:[S&&t.jsx(Zi,{src:S,alt:s.name||""}),t.jsx(el,{className:"bg-primary text-primary-foreground font-semibold text-2xl",children:o})]}),t.jsxs("div",{children:[t.jsxs(kr,{variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[t.jsx(c.Camera,{className:"mr-2 h-4 w-4"}),i("change_photo","Trocar foto")]}),t.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target.files?.[0];if(!t)return;const a=URL.createObjectURL(t);p(a),x(t)}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"profile-name",children:i("name","Nome")}),t.jsx(Ar,{id:"profile-name",value:b,onChange:e=>v(e.target.value),maxLength:150,autoComplete:"name"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"profile-email",children:i("email","E-mail")}),t.jsx(Ar,{id:"profile-email",type:"email",value:w,onChange:e=>j(e.target.value),maxLength:200,autoComplete:"email"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:i("language","Idioma")}),t.jsxs(gs,{value:f,onValueChange:g,children:[t.jsx(ys,{children:t.jsx(vs,{})}),t.jsx(Ns,{children:pl.map(e=>t.jsx(Cs,{value:e.value,children:e.label},e.value))})]})]})]}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"outline",onClick:()=>A(!1),disabled:N,children:i("cancel","Cancelar")}),t.jsxs(kr,{onClick:async()=>{if(b.trim())if(hl.test(w.trim())){_(!0);try{if(h)try{await nl(h),window.dispatchEvent(new Event("user-photo-updated")),l.toast.success("Foto atualizada com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error("Falha ao atualizar foto"+(t?`: ${t}`:""))}if(b.trim()!==(s.name||"")||w.trim()!==(s.email||"")||f!==d.language)try{await cl({newId:s.id||void 0,name:b.trim(),email:w.trim(),language:f}),l.toast.success("Perfil atualizado com sucesso")}catch(e){const t=e instanceof Error?e.message:String(e);l.toast.error(t||"Falha ao atualizar perfil")}f!==d.language&&d.changeLanguage(f),x(null),p(null),r(!1)}finally{_(!1)}}else l.toast.error("Informe um e-mail válido.");else l.toast.error("Informe o nome.")},disabled:N,children:[N&&t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),N?i("saving","Salvando..."):i("save","Salvar")]})]})]})})},fl=a.createContext(void 0);function gl({children:e,actions:r}){const{t:s}=y.useTranslation(),[n,o]=a.useState({}),[i,l]=a.useState(r);a.useEffect(()=>{l(r)},[r]);const c=a.useCallback(()=>o({}),[]),d=a.useMemo(()=>({metadata:n,setMetadata:o,clearMetadata:c,headerActions:i,setHeaderActions:l}),[n,c,i]);return t.jsx(fl.Provider,{value:d,children:e})}function bl(){const e=a.useContext(fl);if(!e)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return e}var vl={actions:"Ações",activate:"Ativar",add_first_item:"Adicione seu primeiro item para começar",add_item:"Adicionar Item",advanced_filter:"Filtro avançado",all:"Todos",allow:"Permitir",allowed_items:"Itens permitidos",also_discover:"Conheça também",alt_text:"Texto Alternativo",anonymous:"Anônimo",ap_action_plan:"Plano de Ação",ap_action_type:"Tipo de Ação",ap_add:"Adicionar",ap_add_comment_placeholder:"Adicionar comentário...",ap_add_cost:"Adicionar custo",ap_add_predecessor:"Adicionar predecessor",ap_attachments:"Anexos",ap_belongs_to:"Pertence a",ap_cause:"Causa",ap_change_status:"Alterar Status",ap_checker:"Verificador",ap_clear:"Limpar",ap_comments:"Comentários",ap_cost_description:"Descrição do custo",ap_costs:"Custos",ap_delete:"Excluir",ap_description:"Descrição",ap_description_placeholder:"Descreva o plano de ação",ap_duration_days:"Duração (dias)",ap_edit_progress:"Editar Progresso",ap_end_date:"Data de Término",ap_estimated_cost:"Custo Estimado",ap_file_duplicate:"Arquivo duplicado",ap_file_upload_error:"Erro ao enviar arquivo",ap_general:"Geral",ap_general_info:"Informações Gerais",ap_history:"Histórico",ap_justification:"Justificativa",ap_justification_placeholder:"Justificativa do plano de ação",ap_name:"Nome",ap_new_action:"Nova Ação",ap_no_attachments:"Nenhum anexo",ap_no_comments:"Nenhum comentário",ap_no_costs:"Nenhum custo registrado",ap_no_history:"Nenhum registro no histórico",ap_no_predecessors:"Nenhum predecessor adicionado",ap_no_progress:"Sem dados de progresso disponíveis",ap_overall_progress:"Progresso geral",ap_place:"Local",ap_plan_name_placeholder:"Nome do plano de ação",ap_predecessors:"Predecessores",ap_priority:"Prioridade",ap_priority_high:"Alta",ap_priority_low:"Baixa",ap_priority_medium:"Média",ap_progress:"Progresso",ap_progress_comment_placeholder:"Adicione um comentário sobre o progresso",ap_progress_percent:"Progresso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progresso",ap_reporting:"Reportando...",ap_reports_history:"Histórico de reportes",ap_responsible:"Responsável",ap_select_action:"Selecione uma ação",ap_select_cause:"Selecione a causa",ap_select_checker:"Selecione o verificador",ap_select_date:"Selecione a data",ap_select_parent:"Selecione a ação pai",ap_select_place:"Selecione o local",ap_select_priority:"Selecione a prioridade",ap_select_responsible:"Selecione o responsável",ap_select_type:"Selecione o tipo",ap_start_date:"Data de Início",ap_status_canceled:"Cancelada",ap_status_done:"Concluída",ap_status_effectiveness_check:"Verificação de eficácia",ap_status_running:"Em andamento",ap_status_suspended:"Suspensa",ap_status_waiting_start:"Aguardando início",ap_time_label:"Tempo",ap_time_spent:"Tempo gasto (HH:MM)",ap_total_cost:"Custo total realizado",ap_total_time:"Tempo total",ap_type_corrective:"Corretiva",ap_type_immediate:"Imediata",ap_type_improvement:"Oportunidade de Melhoria",ap_type_preventive:"Preventiva",ap_type_standardization:"Padronização",ap_value:"Valor (R$)",ap_via_app:"Via app",approval_approve:"Aprovar",approval_execute_action:"Executar ação",approval_opinion:"Parecer *",approval_read_less:"Ler menos",approval_read_more:"Ler mais",approval_reprove_radio:"Reprovar e retornar para etapa",approval_search_approver:"Buscar aprovador...",approval_select_approver:"Selecionar aprovador",approval_select_approver_placeholder:"Selecione um aprovador...",approval_select_step:"Selecione a etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuários",audit_description:"Descrição",audit_esign:"Assinatura eletrônica",audit_not_informed:"Não informado",audit_references:"Referências",audit_security:"Segurança",audit_trail:"Trilha de Auditoria",auth_error:"Erro durante a autenticação. Tente novamente.",auth_failed:"Falha na autenticação. Tente novamente.",auto_login:"Fazendo login automático...",back:"Voltar",bulk_delete_error:"Erro ao excluir itens em lote",bulk_delete_success:"Itens excluídos com sucesso",cancel:"Cancelar",cannot_be_own_leader:"Um líder não pode ser seu próprio superior",change_photo:"Trocar foto",clear_filters:"Limpar filtros",clear_formatting:"Limpar Formatação",clear_search:"Limpar busca",clear_selection:"Limpar seleção",close:"Fechar",collapse:"Colapsar",collapse_row:"Recolher linha",columns:"Colunas",conclude:"Concluir",confirm_removal:"Confirmar remoção",could_not_load_info:"Não foi possível carregar as informações",create:"Criar",current:"Atual",custom_color:"Cor personalizada",dashboard_advanced_filter:"Filtro avançado",dashboard_all_access:"Todos os colaboradores terão acesso",dashboard_average:"Média",dashboard_code:"Código",dashboard_distinct_count:"Contagem distinta",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Sair do fullscreen",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabela",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Meus dashboards",dashboard_new:"Novo Dashboard",dashboard_no_data:"A consulta não retornou itens para o seu perfil.",dashboard_no_refresh:"Não atualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"Não compartilhado",dashboard_only_mine:"Somente meus",dashboard_only_overdue:"Somente atrasados",dashboard_only_responsible:"Somente o responsável terá acesso",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remover favorito",dashboard_responsible:"Responsável",dashboard_select_groups:"Selecione grupos, locais e colaboradores específicos",dashboard_shared_unit:"Compartilhado com todos os colaboradores da unidade",dashboard_status:"Situação",dashboard_title:"Título",dashboard_wait_refresh:"Aguarde para atualizar novamente",dashboard_work_done:"Trabalho executado",dashboard_work_planned:"Trabalho planejado",deactivate:"Inativar",deselect_all:"Deselecionar todas",dev_login:"Login Desenvolvimento",download:"Download",edit:"Editar",edit_name:"Editar Nome",edit_profile:"Editar Perfil",electronic_signature:"Assinatura Eletrônica",email:"E-mail",embed_code:"Código embed",embedded_content:"Embedded content",enter_code:"Digite o código",enter_password:"Digite sua senha",error_authentication:"Erro de Autenticação",error_connection:"Erro de Conexão",error_copied_clipboard:"Os detalhes do erro foram copiados para a área de transferência.",error_loading:"Erro ao carregar",error_loading_data:"Erro ao carregar dados",error_session_expired:"Sessão Expirada",error_token_expired:"Token de autenticação expirado. Faça login novamente.",esign_code_description:"Um código de verificação foi enviado para o seu e-mail. Insira o código abaixo para confirmar a operação.",esign_code_error:"Erro ao validar o código. Tente novamente.",esign_invalid_code:"Código inválido. Tente novamente.",esign_invalid_password:"Senha incorreta. Tente novamente.",esign_password_description:"Digite sua senha para confirmar a operação.",esign_password_error:"Erro ao validar a senha. Tente novamente.",esign_resend_error:"Erro ao reenviar o código.",expand:"Expandir",expand_row:"Expandir linha",expiration_date:"Data de expiração",file_error:"Erro no arquivo",file_upload:"Upload de arquivo",go_to_next_page:"Ir para próxima página",go_to_previous_page:"Ir para página anterior",group_by_column:"Agrupar por esta coluna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descrição da imagem",import_flows:"Fluxos de Importação",import_manage:"Gerencie seus fluxos de importação",inactive:"inativo",inactive_user:"[Usuário inativo]",input_type:"Tipo de entrada",invalid_form:"Formulário inválido. Preencha todos os campos obrigatórios.",italic:"Itálico",item_details:"Detalhes do item",items:"itens",items_per_page:"Itens por página",know_saber_gestao:"Conheça o Saber Gestão",know_staff:"Conheça Staff",language:"Idioma",last_update:"Última atualização",leader:"Líder",leader_create_error:"Erro ao criar líder",leader_not_found:"Líder não encontrado",leader_promoted_success:"Líder promovido com sucesso",leader_remove_error:"Erro ao remover líder",leader_removed_success:"Líder removido com sucesso",leader_update_error:"Erro ao atualizar líder",leader_updated_success:"Líder atualizado com sucesso",leadership_add_root:"Adicionar Líder Raiz",leadership_add_subordinate:"Adicionar Liderado",leadership_cycle_error:"Esta associação criaria um ciclo na hierarquia",leadership_define_leader:"Definir Líder",leadership_direct_subordinates:"Subordinados diretos:",leadership_drag_hint:"Arraste as linhas para reorganizar • Selecione múltiplos para mover em lote",leadership_drag_to_hierarchy:"Arraste para a hierarquia acima",leadership_immediate_superior:"Superior Imediato",leadership_load_error:"Erro ao carregar hierarquia de liderança",leadership_make_root:"Tornar Líder Raiz",leadership_make_root_short:"Tornar Raiz",leadership_no_direct_subordinates:"Sem subordinados diretos",leadership_no_hierarchy:"Nenhuma hierarquia de liderança encontrada.",leadership_no_members:"Nenhum membro na equipe",leadership_no_user_selected:"Nenhum usuário selecionado",leadership_no_users_available:"Nenhum usuário disponível",leadership_no_users_found:"Nenhum usuário encontrado",leadership_remove_confirmation:"Tem certeza que deseja remover este líder? Esta ação não pode ser desfeita.",leadership_remove_team:"Remover da equipe",leadership_search_superior:"Buscar superior...",leadership_select_subordinates:"Selecione pelo menos um liderado",leadership_unassociated_users:"Usuários não associados",leadership_users_associated:"{{count}} usuário associado",leadership_users_associated_count:"Usuários associados: {{count}}",leadership_users_associated_plural:"{{count}} usuários associados",leadership_users_unassociated_count:"Usuários não associados: {{count}}",learn_qualiex:"Aprenda a usar o Qualiex",leave_without_saving:"Sair sem salvar",lines_per_page:"Linhas por página",link:"Link",loading:"Carregando...",login_with_qualiex:"Entrar com Qualiex",manage_access:"Gerenciar Acessos",mind_map_add_child:"Adicionar filho",mind_map_add_sibling:"Adicionar irmão",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar tudo",mind_map_delete_node:"Excluir nó",mind_map_expand_all:"Expandir tudo",mind_map_export_image:"Exportar como imagem",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar à tela",mind_map_redo:"Refazer",mind_map_undo:"Desfazer",mind_map_zoom_in:"Aproximar",mind_map_zoom_out:"Afastar",modules:"Módulos",more_options:"Mais opções",msg_create_error:"Erro ao criar registro",msg_created_success:"Registro criado com sucesso",msg_delete_error:"Erro ao excluir registro",msg_deleted_success:"Registro excluído com sucesso",msg_load_error:"Erro ao carregar dados",msg_update_error:"Erro ao atualizar registro",msg_updated_success:"Registro atualizado com sucesso",new_document:"Novo Documento",new_folder:"Nova Pasta",new_item:"Novo Item",next:"Próximo",no_access_page:"Parece que você não tem acesso a essa página",no_data_to_display:"Não há dados para exibir no momento.",no_errors_recorded:"Nenhum erro registrado",no_image_selected:"Nenhuma imagem selecionada",no_item_selected:"Nenhum item selecionado",no_items_found:"Nenhum item encontrado",no_items_found_empty:"Nenhum item encontrado",no_place_found:"Nenhum local encontrado",no_place_selected:"Sem local",no_products:"Sem produtos",no_reports_found:"Nenhum relatório encontrado",no_results:"Nenhum resultado encontrado",no_search_results:"Nenhum resultado para a busca",no_video_selected:"Nenhum vídeo selecionado",none_bracketed:"[Nenhum]",not_authenticated:"Não autenticado",not_available:"Não disponível",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Cole o código embed aqui",permissions:"Permissões",preset_colors:"Cores predefinidas",preview:"Visualizar",redirecting_auth:"Redirecionando para autenticação...",refresh_data:"Atualizar dados",remove:"Remover",remove_grouping:"Remover agrupamento",removing:"Removendo...",replace:"Substituir",report:"Relatório",request_date:"Data da solicitação",required_field:"Campo obrigatório",resend_code:"Reenviar código",reset_default:"Redefinir padrão",restricted_access:"Acesso restrito",rows_per_page:"Registros por página",save:"Salvar",save_as_draft:"Salvar como Rascunho",save_as_template:"Salvar como Modelo",saving:"Salvando...",search:"Pesquisar",search_placeholder:"Pesquisar...",search_report_placeholder:"Buscar relatório...",search_user_placeholder:"Buscar usuário...",select_all:"Selecionar todos",select_all_columns:"Selecionar todas",select_all_items:"Selecionar todos",select_at_least_one:"Selecione pelo menos um item",select_at_least_one_item:"Selecione ao menos um item",select_date:"Selecione uma data",select_file_format:"Selecione o formato do arquivo",select_items_to_add:"Selecione itens para adicionar...",select_placeholder:"Selecione...",selected:"Selecionados",selected_count:"{{count}} selecionado",selected_count_plural:"{{count}} selecionados",session_expired:"Sua sessão expirou. Você será redirecionado para fazer login novamente.",sign_access_error:"Erro ao acessar serviço de assinatura",sign_api_key_info:"Informe a API Key do provedor de assinatura",sign_api_key_input:"Insira a API Key do provedor de assinatura",sign_api_key_placeholder:"Insira a chave de API",sign_api_key_required:"Chave de API obrigatória",sign_attempt:"Tentativa de assinatura",sign_auth_required:"Autenticação necessária para assinar",sign_click_to_select:"Clique para selecionar documento",sign_config_save_err:"Erro ao salvar configuração de assinatura",sign_config_save_error:"Erro ao salvar configuração de assinatura",sign_config_saved:"Configuração de assinatura salva",sign_config_saved_success:"Configuração de assinatura salva com sucesso",sign_configured:"Assinatura configurada",sign_configured_unit:"Assinatura digital configurada para esta unidade",sign_digital_config:"Configuração de Assinatura Digital",sign_doc_available:"Documento assinado disponível para download",sign_doc_load_error:"Erro ao carregar documento",sign_doc_process_error:"Erro ao processar documento",sign_doc_sent:"Documento enviado para assinatura",sign_download_signed:"Baixar documento assinado",sign_email_fallback:"E-mail de fallback para assinatura",sign_environment:"Ambiente de assinatura",sign_fetch_failed:"Falha ao buscar documento assinado",sign_file_not_allowed:"Extensão de arquivo não permitida",sign_file_type_not_allowed:"Tipo de arquivo não permitido",sign_incorrect_data:"O signatário reportou dados incorretos.",sign_login_required:"Login necessário para assinar",sign_login_to_sign:"Faça login para utilizar a assinatura digital.",sign_monthly_limit:"Limite mensal de assinaturas atingido",sign_no_access:"Não foi possível obter o acesso para assinatura. Tente novamente.",sign_not_configured:"Assinatura não configurada",sign_not_configured_unit:"Assinatura digital ainda não configurada para esta unidade",sign_preparing_doc:"Preparando documento para assinatura",sign_process_error:"Erro ao processar assinatura",sign_save_config:"Salvar configuração",sign_save_config_btn:"Salvar Configuração",sign_select_pdf:"Selecione um arquivo PDF",sign_sending_doc:"Enviando documento para assinatura",sign_signed_success:"Documento assinado com sucesso",sign_signer_unavailable:"Signer ID não disponível",sign_try_again:"Tentar novamente",sign_update_config:"Atualizar configuração",sign_update_config_btn:"Atualizar Configuração",sign_waiting_provider:"Aguardando provedor de assinatura",sign_widget_error:"Erro no widget de assinatura",something_went_wrong:"Algo deu errado",state:"Estado",status:"Status",status_completed:"Concluído",status_error:"Erro",status_expired:"Expirado",status_processing:"Processando",status_waiting:"Aguardando",steps:"Etapas",subordinates:"Subordinados",subordinates_add_error:"Erro ao adicionar subordinados",subordinates_added_success:"Subordinados adicionados com sucesso",subordinates_sync_error:"Erro ao sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados com sucesso",team_all_groups:"Todos os grupos",terms_confirm_reading:"Confirmar leitura",terms_confirmation_available:"Confirmação disponível em",terms_of_use:"Termos de Uso",terms_read_agree:"Li e concordo",terms_see_later:"Ver depois",terms_updated:"Termos de Uso Atualizados",terms_view:"Visualizar termo de uso",terms_view_short:"View term",try_adjust_search:"Tente ajustar sua busca",try_again:"Tentar Novamente",unit_not_selected:"Nenhuma unidade selecionada",unknown_error:"Erro desconhecido",unsaved_changes:"Alterações não salvas",unsaved_changes_description:"Existem alterações não salvas. Deseja sair sem salvar?",update:"Atualizar",updates:"Atualizações",updates_bar_close:"Fechar",updates_dialog_close:"Fechar",updates_dialog_do_not_show_again:"Não exibir novamente",updates_dialog_like:"Curtir",updating:"Atualizando...",user:"Usuário",user_info:"Informações do Usuário",user_photo:"Foto do usuário",users_already_leaders:"Usuários já são líderes",verification_code:"Código de verificação",video:"Vídeo",video_title:"Título do vídeo",view_report:"Visualizar relatório",want_to_know_more:"Quero conhecer mais",write_content_here:"Escreva o conteúdo aqui..."},yl={actions:"Actions",activate:"Activate",add_first_item:"Add your first item to get started",add_item:"Add Item",advanced_filter:"Advanced filter",all:"All",allow:"Allow",allowed_items:"Allowed items",also_discover:"Also discover",alt_text:"Alternative Text",anonymous:"Anonymous",ap_action_plan:"Action Plan",ap_action_type:"Action type",ap_add:"Add",ap_add_comment_placeholder:"Add a comment...",ap_add_cost:"Add cost",ap_add_predecessor:"Add predecessor",ap_attachments:"Attachments",ap_belongs_to:"Belongs to",ap_cause:"Cause",ap_change_status:"Change Status",ap_checker:"Checker",ap_clear:"Clear",ap_comments:"Comments",ap_cost_description:"Cost description",ap_costs:"Costs",ap_delete:"Delete",ap_description:"Description",ap_description_placeholder:"Describe the action plan",ap_duration_days:"Duration (days)",ap_edit_progress:"Edit Progress",ap_end_date:"End date",ap_estimated_cost:"Estimated cost",ap_file_duplicate:"Duplicate file",ap_file_upload_error:"Error uploading file",ap_general:"General",ap_general_info:"General Information",ap_history:"History",ap_justification:"Justification",ap_justification_placeholder:"Action plan justification",ap_name:"Name",ap_new_action:"New Action",ap_no_attachments:"No attachments",ap_no_comments:"No comments",ap_no_costs:"No costs recorded",ap_no_history:"No history records",ap_no_predecessors:"No predecessors added",ap_no_progress:"No progress data available",ap_overall_progress:"Overall progress",ap_place:"Place",ap_plan_name_placeholder:"Action plan name",ap_predecessors:"Predecessors",ap_priority:"Priority",ap_priority_high:"High",ap_priority_low:"Low",ap_priority_medium:"Medium",ap_progress:"Progress",ap_progress_comment_placeholder:"Add a comment about the progress",ap_progress_percent:"Progress (%)",ap_report:"Report",ap_report_progress:"Report progress",ap_reporting:"Reporting...",ap_reports_history:"Reports history",ap_responsible:"Responsible",ap_select_action:"Select an action",ap_select_cause:"Select cause",ap_select_checker:"Select checker",ap_select_date:"Select date",ap_select_parent:"Select parent action",ap_select_place:"Select place",ap_select_priority:"Select priority",ap_select_responsible:"Select responsible",ap_select_type:"Select type",ap_start_date:"Start date",ap_status_canceled:"Canceled",ap_status_done:"Completed",ap_status_effectiveness_check:"Effectiveness check",ap_status_running:"In progress",ap_status_suspended:"Suspended",ap_status_waiting_start:"Waiting to start",ap_time_label:"Time",ap_time_spent:"Time spent (HH:MM)",ap_total_cost:"Total realized cost",ap_total_time:"Total time",ap_type_corrective:"Corrective",ap_type_immediate:"Immediate",ap_type_improvement:"Improvement Opportunity",ap_type_preventive:"Preventive",ap_type_standardization:"Standardization",ap_value:"Value",ap_via_app:"Via app",approval_approve:"Approve",approval_execute_action:"Execute action",approval_opinion:"Opinion *",approval_read_less:"Read less",approval_read_more:"Read more",approval_reprove_radio:"Reject and return to step",approval_search_approver:"Search approver...",approval_select_approver:"Select approver",approval_select_approver_placeholder:"Select an approver...",approval_select_step:"Select the step",approval_step_label:"Step",approval_user_group:"User group",audit_description:"Description",audit_esign:"Electronic signature",audit_not_informed:"Not informed",audit_references:"References",audit_security:"Security",audit_trail:"Audit Trail",auth_error:"Error during authentication. Try again.",auth_failed:"Authentication failed. Try again.",auto_login:"Logging in automatically...",back:"Back",bulk_delete_error:"Error deleting items in bulk",bulk_delete_success:"Items deleted successfully",cancel:"Cancel",cannot_be_own_leader:"A leader cannot be their own superior",change_photo:"Change photo",clear_filters:"Clear filters",clear_formatting:"Clear Formatting",clear_search:"Clear search",clear_selection:"Clear selection",close:"Close",collapse:"Collapse",collapse_row:"Collapse row",columns:"Columns",conclude:"Finish",confirm_removal:"Confirm removal",could_not_load_info:"Could not load the information",create:"Create",current:"Current",custom_color:"Custom color",dashboard_advanced_filter:"Advanced filter",dashboard_all_access:"All collaborators will have access",dashboard_average:"Average",dashboard_code:"Code",dashboard_distinct_count:"Distinct count",dashboard_edit:"Edit Dashboard",dashboard_exit_fullscreen:"Exit fullscreen",dashboard_export_chart:"Export chart",dashboard_export_table:"Export table",dashboard_max_value:"Maximum value",dashboard_min_value:"Minimum value",dashboard_my:"My dashboards",dashboard_new:"New Dashboard",dashboard_no_data:"The query returned no items for your profile.",dashboard_no_refresh:"Do not refresh",dashboard_normal_page:"Normal page",dashboard_not_shared:"Not shared",dashboard_only_mine:"Only mine",dashboard_only_overdue:"Only overdue",dashboard_only_responsible:"Only the responsible will have access",dashboard_open_query:"Open query",dashboard_remove_favorite:"Remove favorite",dashboard_responsible:"Responsible",dashboard_select_groups:"Select groups, places and specific collaborators",dashboard_shared_unit:"Shared with all unit collaborators",dashboard_status:"Status",dashboard_title:"Title",dashboard_wait_refresh:"Wait to refresh again",dashboard_work_done:"Work done",dashboard_work_planned:"Work planned",deactivate:"Deactivate",deselect_all:"Deselect all",dev_login:"Development Login",download:"Download",edit:"Edit",edit_name:"Edit Name",edit_profile:"Edit Profile",electronic_signature:"Electronic Signature",email:"Email",embed_code:"Embed code",embedded_content:"Embedded content",enter_code:"Enter the code",enter_password:"Enter your password",error_authentication:"Authentication Error",error_connection:"Connection Error",error_copied_clipboard:"Error details were copied to the clipboard.",error_loading:"Error loading",error_loading_data:"Error loading data",error_session_expired:"Session Expired",error_token_expired:"Authentication token expired. Please log in again.",esign_code_description:"A verification code was sent to your email. Enter the code below to confirm the operation.",esign_code_error:"Error validating code. Try again.",esign_invalid_code:"Invalid code. Try again.",esign_invalid_password:"Incorrect password. Try again.",esign_password_description:"Enter your password to confirm the operation.",esign_password_error:"Error validating password. Try again.",esign_resend_error:"Error resending code.",expand:"Expand",expand_row:"Expand row",expiration_date:"Expiration date",file_error:"File error",file_upload:"File upload",go_to_next_page:"Go to next page",go_to_previous_page:"Go to previous page",group_by_column:"Group by this column",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",image_description:"Image description",import_flows:"Import Flows",import_manage:"Manage your import flows",inactive:"inactive",inactive_user:"[Inactive user]",input_type:"Input type",invalid_form:"Invalid form. Fill in all required fields.",italic:"Italic",item_details:"Item details",items:"items",items_per_page:"Items per page",know_saber_gestao:"Discover Saber Gestão",know_staff:"Discover Staff",language:"Language",last_update:"Last update",leader:"Leader",leader_create_error:"Error creating leader",leader_not_found:"Leader not found",leader_promoted_success:"Leader promoted successfully",leader_remove_error:"Error removing leader",leader_removed_success:"Leader removed successfully",leader_update_error:"Error updating leader",leader_updated_success:"Leader updated successfully",leadership_add_root:"Add Root Leader",leadership_add_subordinate:"Add Subordinate",leadership_cycle_error:"This association would create a cycle in the hierarchy",leadership_define_leader:"Define Leader",leadership_direct_subordinates:"Direct subordinates:",leadership_drag_hint:"Drag rows to reorganize • Select multiple to move in bulk",leadership_drag_to_hierarchy:"Drag to the hierarchy above",leadership_immediate_superior:"Immediate Superior",leadership_load_error:"Failed to load leadership hierarchy",leadership_make_root:"Make Root Leader",leadership_make_root_short:"Make Root",leadership_no_direct_subordinates:"No direct subordinates",leadership_no_hierarchy:"No leadership hierarchy found.",leadership_no_members:"No team members",leadership_no_user_selected:"No user selected",leadership_no_users_available:"No users available",leadership_no_users_found:"No users found",leadership_remove_confirmation:"Are you sure you want to remove this leader? This action cannot be undone.",leadership_remove_team:"Remove from team",leadership_search_superior:"Search superior...",leadership_select_subordinates:"Select at least one subordinate",leadership_unassociated_users:"Unassociated users",leadership_users_associated:"{{count}} user associated",leadership_users_associated_count:"Associated users: {{count}}",leadership_users_associated_plural:"{{count}} users associated",leadership_users_unassociated_count:"Unassociated users: {{count}}",learn_qualiex:"Learn how to use Qualiex",leave_without_saving:"Leave without saving",lines_per_page:"Lines per page",link:"Link",loading:"Loading...",login_with_qualiex:"Login with Qualiex",manage_access:"Manage Access",mind_map_add_child:"Add child",mind_map_add_sibling:"Add sibling",mind_map_aria_label:"Mind map",mind_map_collapse_all:"Collapse all",mind_map_delete_node:"Delete node",mind_map_expand_all:"Expand all",mind_map_export_image:"Export as image",mind_map_export_json:"Export as JSON",mind_map_fit_to_screen:"Fit to screen",mind_map_redo:"Redo",mind_map_undo:"Undo",mind_map_zoom_in:"Zoom in",mind_map_zoom_out:"Zoom out",modules:"Modules",more_options:"More options",msg_create_error:"Error creating record",msg_created_success:"Record created successfully",msg_delete_error:"Error deleting record",msg_deleted_success:"Record deleted successfully",msg_load_error:"Error loading data",msg_update_error:"Error updating record",msg_updated_success:"Record updated successfully",new_document:"New Document",new_folder:"New Folder",new_item:"New Item",next:"Next",no_access_page:"It seems you don't have access to this page",no_data_to_display:"No data to display at this time.",no_errors_recorded:"No errors recorded",no_image_selected:"No image selected",no_item_selected:"No item selected",no_items_found:"No items found",no_items_found_empty:"No items found",no_place_found:"No place found",no_place_selected:"No place",no_products:"No products",no_reports_found:"No reports found",no_results:"No results found",no_search_results:"No results for the search",no_video_selected:"No video selected",none_bracketed:"[None]",not_authenticated:"Not authenticated",not_available:"Not available",of:"of",open_popover:"Open Popover",open_wiki:"Open Wiki",ordered_list:"Ordered List",page:"Page",paste_embed_code:"Paste the embed code here",permissions:"Permissions",preset_colors:"Preset colors",preview:"Preview",redirecting_auth:"Redirecting to authentication...",refresh_data:"Refresh data",remove:"Remove",remove_grouping:"Remove grouping",removing:"Removing...",replace:"Replace",report:"Report",request_date:"Request date",required_field:"Required field",resend_code:"Resend code",reset_default:"Reset to default",restricted_access:"Restricted access",rows_per_page:"Rows per page",save:"Save",save_as_draft:"Save as Draft",save_as_template:"Save as Template",saving:"Saving...",search:"Search",search_placeholder:"Search...",search_report_placeholder:"Search report...",search_user_placeholder:"Search user...",select_all:"Select all",select_all_columns:"Select all",select_all_items:"Select all",select_at_least_one:"Select at least one item",select_at_least_one_item:"Select at least one item",select_date:"Select a date",select_file_format:"Select the file format",select_items_to_add:"Select items to add...",select_placeholder:"Select...",selected:"Selected",selected_count:"{{count}} selected",selected_count_plural:"{{count}} selected",session_expired:"Your session has expired. You will be redirected to log in again.",sign_access_error:"Error accessing signature service",sign_api_key_info:"Enter the signature provider API Key",sign_api_key_input:"Enter the signature provider API Key",sign_api_key_placeholder:"Enter API key",sign_api_key_required:"API key is required",sign_attempt:"Signature attempt",sign_auth_required:"Authentication required to sign",sign_click_to_select:"Click to select document",sign_config_save_err:"Error saving signature configuration",sign_config_save_error:"Error saving signature configuration",sign_config_saved:"Signature configuration saved",sign_config_saved_success:"Signature configuration saved successfully",sign_configured:"Signature configured",sign_configured_unit:"Digital signature configured for this unit",sign_digital_config:"Digital Signature Configuration",sign_doc_available:"Signed document available for download",sign_doc_load_error:"Error loading document",sign_doc_process_error:"Error processing document",sign_doc_sent:"Document sent for signature",sign_download_signed:"Download signed document",sign_email_fallback:"Signature fallback email",sign_environment:"Signature environment",sign_fetch_failed:"Failed to fetch signed document",sign_file_not_allowed:"File extension not allowed",sign_file_type_not_allowed:"File type not allowed",sign_incorrect_data:"The signer reported incorrect data.",sign_login_required:"Login required to sign",sign_login_to_sign:"Log in to use the digital signature.",sign_monthly_limit:"Monthly signature limit reached",sign_no_access:"Could not obtain access for signing. Try again.",sign_not_configured:"Signature not configured",sign_not_configured_unit:"Digital signature not yet configured for this unit",sign_preparing_doc:"Preparing document for signature",sign_process_error:"Error processing signature",sign_save_config:"Save configuration",sign_save_config_btn:"Save Configuration",sign_select_pdf:"Select a PDF file",sign_sending_doc:"Sending document for signature",sign_signed_success:"Document signed successfully",sign_signer_unavailable:"Signer ID not available",sign_try_again:"Try again",sign_update_config:"Update configuration",sign_update_config_btn:"Update Configuration",sign_waiting_provider:"Waiting for signature provider",sign_widget_error:"Signature widget error",something_went_wrong:"Something went wrong",state:"State",status:"Status",status_completed:"Completed",status_error:"Error",status_expired:"Expired",status_processing:"Processing",status_waiting:"Waiting",steps:"Steps",subordinates:"Subordinates",subordinates_add_error:"Error adding subordinates",subordinates_added_success:"Subordinates added successfully",subordinates_sync_error:"Error syncing subordinates",subordinates_synced_success:"Subordinates synced successfully",team_all_groups:"All groups",terms_confirm_reading:"Confirm reading",terms_confirmation_available:"Confirmation available at",terms_of_use:"Terms of Use",terms_read_agree:"I have read and agree",terms_see_later:"See later",terms_updated:"Terms of Use Updated",terms_view:"View terms of use",terms_view_short:"View term",try_adjust_search:"Try adjusting your search",try_again:"Try Again",unit_not_selected:"No unit selected",unknown_error:"Unknown error",unsaved_changes:"Unsaved changes",unsaved_changes_description:"There are unsaved changes. Do you want to leave without saving?",update:"Update",updates:"Updates",updates_bar_close:"Close",updates_dialog_close:"Close",updates_dialog_do_not_show_again:"Do not show again",updates_dialog_like:"Like",updating:"Updating...",user:"User",user_info:"User Information",user_photo:"User photo",users_already_leaders:"Users are already leaders",verification_code:"Verification code",video:"Video",video_title:"Video title",view_report:"View report",want_to_know_more:"I want to know more",write_content_here:"Write content here..."},wl={actions:"Acciones",activate:"Activar",add_first_item:"Agregue su primer elemento para comenzar",add_item:"Agregar Elemento",advanced_filter:"Filtro avanzado",all:"Todos",allow:"Permitir",allowed_items:"Elementos permitidos",also_discover:"Conozca también",alt_text:"Texto Alternativo",anonymous:"Anónimo",ap_action_plan:"Plan de Acción",ap_action_type:"Tipo de acción",ap_add:"Agregar",ap_add_comment_placeholder:"Agregar comentario...",ap_add_cost:"Agregar costo",ap_add_predecessor:"Agregar predecesor",ap_attachments:"Anexos",ap_belongs_to:"Pertenece a",ap_cause:"Causa",ap_change_status:"Cambiar Estado",ap_checker:"Verificador",ap_clear:"Limpiar",ap_comments:"Comentarios",ap_cost_description:"Descripción del costo",ap_costs:"Costos",ap_delete:"Eliminar",ap_description:"Descripción",ap_description_placeholder:"Describa el plan de acción",ap_duration_days:"Duración (días)",ap_edit_progress:"Editar Progreso",ap_end_date:"Fecha de finalización",ap_estimated_cost:"Costo estimado",ap_file_duplicate:"Archivo duplicado",ap_file_upload_error:"Error al subir archivo",ap_general:"General",ap_general_info:"Información General",ap_history:"Historial",ap_justification:"Justificación",ap_justification_placeholder:"Justificación del plan de acción",ap_name:"Nombre",ap_new_action:"Nueva Acción",ap_no_attachments:"Sin anexos",ap_no_comments:"Sin comentarios",ap_no_costs:"Ningún costo registrado",ap_no_history:"Sin registros en el historial",ap_no_predecessors:"Sin predecesores agregados",ap_no_progress:"Sin datos de progreso disponibles",ap_overall_progress:"Progreso general",ap_place:"Lugar",ap_plan_name_placeholder:"Nombre del plan de acción",ap_predecessors:"Predecesores",ap_priority:"Prioridad",ap_priority_high:"Alta",ap_priority_low:"Baja",ap_priority_medium:"Media",ap_progress:"Progreso",ap_progress_comment_placeholder:"Agregue un comentario sobre el progreso",ap_progress_percent:"Progreso (%)",ap_report:"Reportar",ap_report_progress:"Reportar progreso",ap_reporting:"Reportando...",ap_reports_history:"Historial de reportes",ap_responsible:"Responsable",ap_select_action:"Seleccione una acción",ap_select_cause:"Seleccione la causa",ap_select_checker:"Seleccione el verificador",ap_select_date:"Seleccione la fecha",ap_select_parent:"Seleccione la acción padre",ap_select_place:"Seleccione el lugar",ap_select_priority:"Seleccione la prioridad",ap_select_responsible:"Seleccione el responsable",ap_select_type:"Seleccione el tipo",ap_start_date:"Fecha de inicio",ap_status_canceled:"Cancelada",ap_status_done:"Completada",ap_status_effectiveness_check:"Verificación de eficacia",ap_status_running:"En progreso",ap_status_suspended:"Suspendida",ap_status_waiting_start:"Esperando inicio",ap_time_label:"Tiempo",ap_time_spent:"Tiempo dedicado (HH:MM)",ap_total_cost:"Costo total realizado",ap_total_time:"Tiempo total",ap_type_corrective:"Correctiva",ap_type_immediate:"Inmediata",ap_type_improvement:"Oportunidad de Mejora",ap_type_preventive:"Preventiva",ap_type_standardization:"Estandarización",ap_value:"Valor",ap_via_app:"Vía app",approval_approve:"Aprobar",approval_execute_action:"Ejecutar acción",approval_opinion:"Opinión *",approval_read_less:"Leer menos",approval_read_more:"Leer más",approval_reprove_radio:"Rechazar y retornar a etapa",approval_search_approver:"Buscar aprobador...",approval_select_approver:"Seleccionar aprobador",approval_select_approver_placeholder:"Seleccione un aprobador...",approval_select_step:"Seleccione la etapa",approval_step_label:"Etapa",approval_user_group:"Grupo de usuarios",audit_description:"Descripción",audit_esign:"Firma electrónica",audit_not_informed:"No informado",audit_references:"Referencias",audit_security:"Seguridad",audit_trail:"Pista de Auditoría",auth_error:"Error durante la autenticación. Intente de nuevo.",auth_failed:"Fallo en la autenticación. Intente de nuevo.",auto_login:"Iniciando sesión automáticamente...",back:"Volver",bulk_delete_error:"Error al eliminar elementos en lote",bulk_delete_success:"Elementos eliminados exitosamente",cancel:"Cancelar",cannot_be_own_leader:"Un líder no puede ser su propio superior",change_photo:"Cambiar foto",clear_filters:"Limpiar filtros",clear_formatting:"Limpiar Formato",clear_search:"Limpiar búsqueda",clear_selection:"Limpiar selección",close:"Cerrar",collapse:"Colapsar",collapse_row:"Contraer fila",columns:"Columnas",conclude:"Concluir",confirm_removal:"Confirmar eliminación",could_not_load_info:"No se pudo cargar la información",create:"Crear",current:"Actual",custom_color:"Color personalizado",dashboard_advanced_filter:"Filtro avanzado",dashboard_all_access:"Todos los colaboradores tendrán acceso",dashboard_average:"Promedio",dashboard_code:"Código",dashboard_distinct_count:"Conteo distinto",dashboard_edit:"Editar Dashboard",dashboard_exit_fullscreen:"Salir de pantalla completa",dashboard_export_chart:"Exportar gráfico",dashboard_export_table:"Exportar tabla",dashboard_max_value:"Valor máximo",dashboard_min_value:"Valor mínimo",dashboard_my:"Mis dashboards",dashboard_new:"Nuevo Dashboard",dashboard_no_data:"La consulta no devolvió elementos para su perfil.",dashboard_no_refresh:"No actualizar",dashboard_normal_page:"Página normal",dashboard_not_shared:"No compartido",dashboard_only_mine:"Solo míos",dashboard_only_overdue:"Solo atrasados",dashboard_only_responsible:"Solo el responsable tendrá acceso",dashboard_open_query:"Abrir consulta",dashboard_remove_favorite:"Quitar favorito",dashboard_responsible:"Responsable",dashboard_select_groups:"Seleccione grupos, lugares y colaboradores específicos",dashboard_shared_unit:"Compartido con todos los colaboradores de la unidad",dashboard_status:"Situación",dashboard_title:"Título",dashboard_wait_refresh:"Espere para actualizar nuevamente",dashboard_work_done:"Trabajo ejecutado",dashboard_work_planned:"Trabajo planificado",deactivate:"Desactivar",deselect_all:"Deseleccionar todas",dev_login:"Login Desarrollo",download:"Descargar",edit:"Editar",edit_name:"Editar Nombre",edit_profile:"Editar Perfil",electronic_signature:"Firma Electrónica",email:"Correo electrónico",embed_code:"Código embed",embedded_content:"Contenido embebido",enter_code:"Ingrese el código",enter_password:"Ingrese su contraseña",error_authentication:"Error de Autenticación",error_connection:"Error de Conexión",error_copied_clipboard:"Los detalles del error se copiaron al portapapeles.",error_loading:"Error al cargar",error_loading_data:"Error al cargar datos",error_session_expired:"Sesión Expirada",error_token_expired:"Token de autenticación expirado. Inicie sesión nuevamente.",esign_code_description:"Un código de verificación fue enviado a su correo. Ingrese el código a continuación para confirmar la operación.",esign_code_error:"Error al validar el código. Intente de nuevo.",esign_invalid_code:"Código inválido. Intente de nuevo.",esign_invalid_password:"Contraseña incorrecta. Intente de nuevo.",esign_password_description:"Ingrese su contraseña para confirmar la operación.",esign_password_error:"Error al validar la contraseña. Intente de nuevo.",esign_resend_error:"Error al reenviar el código.",expand:"Expandir",expand_row:"Expandir fila",expiration_date:"Fecha de expiración",file_error:"Error en el archivo",file_upload:"Subir archivo",go_to_next_page:"Ir a la página siguiente",go_to_previous_page:"Ir a la página anterior",group_by_column:"Agrupar por esta columna",heading_1:"Título 1",heading_2:"Título 2",heading_3:"Título 3",image_description:"Descripción de la imagen",import_flows:"Flujos de Importación",import_manage:"Gestione sus flujos de importación",inactive:"inactivo",inactive_user:"[Usuario inactivo]",input_type:"Tipo de entrada",invalid_form:"Formulario inválido. Complete todos los campos obligatorios.",italic:"Itálica",item_details:"Detalles del elemento",items:"elementos",items_per_page:"Elementos por página",know_saber_gestao:"Conozca Saber Gestión",know_staff:"Conozca Staff",language:"Idioma",last_update:"Última actualización",leader:"Líder",leader_create_error:"Error al crear líder",leader_not_found:"Líder no encontrado",leader_promoted_success:"Líder promovido exitosamente",leader_remove_error:"Error al eliminar líder",leader_removed_success:"Líder eliminado exitosamente",leader_update_error:"Error al actualizar líder",leader_updated_success:"Líder actualizado exitosamente",leadership_add_root:"Agregar Líder Raíz",leadership_add_subordinate:"Agregar Subordinado",leadership_cycle_error:"Esta asociación crearía un ciclo en la jerarquía",leadership_define_leader:"Definir Líder",leadership_direct_subordinates:"Subordinados directos:",leadership_drag_hint:"Arrastre las filas para reorganizar • Seleccione múltiples para mover en lote",leadership_drag_to_hierarchy:"Arrastre a la jerarquía anterior",leadership_immediate_superior:"Superior Inmediato",leadership_load_error:"Error al cargar la jerarquía de liderazgo",leadership_make_root:"Hacer Líder Raíz",leadership_make_root_short:"Hacer Raíz",leadership_no_direct_subordinates:"Sin subordinados directos",leadership_no_hierarchy:"No se encontró jerarquía de liderazgo.",leadership_no_members:"Ningún miembro en el equipo",leadership_no_user_selected:"Ningún usuario seleccionado",leadership_no_users_available:"Ningún usuario disponible",leadership_no_users_found:"Ningún usuario encontrado",leadership_remove_confirmation:"¿Está seguro de que desea eliminar este líder? Esta acción no se puede deshacer.",leadership_remove_team:"Quitar del equipo",leadership_search_superior:"Buscar superior...",leadership_select_subordinates:"Seleccione al menos un subordinado",leadership_unassociated_users:"Usuarios no asociados",leadership_users_associated:"{{count}} usuario asociado",leadership_users_associated_count:"Usuarios asociados: {{count}}",leadership_users_associated_plural:"{{count}} usuarios asociados",leadership_users_unassociated_count:"Usuarios no asociados: {{count}}",learn_qualiex:"Aprenda a usar Qualiex",leave_without_saving:"Salir sin guardar",lines_per_page:"Líneas por página",link:"Enlace",loading:"Cargando...",login_with_qualiex:"Iniciar sesión con Qualiex",manage_access:"Gestionar Accesos",mind_map_add_child:"Agregar hijo",mind_map_add_sibling:"Agregar hermano",mind_map_aria_label:"Mapa mental",mind_map_collapse_all:"Colapsar todo",mind_map_delete_node:"Eliminar nodo",mind_map_expand_all:"Expandir todo",mind_map_export_image:"Exportar como imagen",mind_map_export_json:"Exportar como JSON",mind_map_fit_to_screen:"Ajustar a la pantalla",mind_map_redo:"Rehacer",mind_map_undo:"Deshacer",mind_map_zoom_in:"Acercar",mind_map_zoom_out:"Alejar",modules:"Módulos",more_options:"Más opciones",msg_create_error:"Error al crear registro",msg_created_success:"Registro creado exitosamente",msg_delete_error:"Error al eliminar registro",msg_deleted_success:"Registro eliminado exitosamente",msg_load_error:"Error al cargar datos",msg_update_error:"Error al actualizar registro",msg_updated_success:"Registro actualizado exitosamente",new_document:"Nuevo Documento",new_folder:"Nueva Carpeta",new_item:"Nuevo Elemento",next:"Siguiente",no_access_page:"Parece que no tienes acceso a esta página",no_data_to_display:"No hay datos para mostrar en este momento.",no_errors_recorded:"Sin errores registrados",no_image_selected:"Ninguna imagen seleccionada",no_item_selected:"Ningún elemento seleccionado",no_items_found:"No se encontraron elementos",no_items_found_empty:"Ningún elemento encontrado",no_place_found:"Ningún lugar encontrado",no_place_selected:"Sin lugar",no_products:"Sin productos",no_reports_found:"Ningún informe encontrado",no_results:"No se encontraron resultados",no_search_results:"Sin resultados para la búsqueda",no_video_selected:"Ningún vídeo seleccionado",none_bracketed:"[Ninguno]",not_authenticated:"No autenticado",not_available:"No disponible",of:"de",open_popover:"Abrir Popover",open_wiki:"Abrir Wiki",ordered_list:"Lista Ordenada",page:"Página",paste_embed_code:"Pegue el código embed aquí",permissions:"Permisos",preset_colors:"Colores predefinidos",preview:"Vista previa",redirecting_auth:"Redirigiendo a autenticación...",refresh_data:"Actualizar datos",remove:"Eliminar",remove_grouping:"Quitar agrupación",removing:"Eliminando...",replace:"Reemplazar",report:"Informe",request_date:"Fecha de solicitud",required_field:"Campo obligatorio",resend_code:"Reenviar código",reset_default:"Restablecer predeterminado",restricted_access:"Acceso restringido",rows_per_page:"Registros por página",save:"Guardar",save_as_draft:"Guardar como Borrador",save_as_template:"Guardar como Plantilla",saving:"Guardando...",search:"Buscar",search_placeholder:"Buscar...",search_report_placeholder:"Buscar informe...",search_user_placeholder:"Buscar usuario...",select_all:"Seleccionar todo",select_all_columns:"Seleccionar todas",select_all_items:"Seleccionar todos",select_at_least_one:"Seleccione al menos un elemento",select_at_least_one_item:"Seleccione al menos un elemento",select_date:"Seleccione una fecha",select_file_format:"Seleccione el formato del archivo",select_items_to_add:"Seleccione elementos para agregar...",select_placeholder:"Seleccionar...",selected:"Seleccionados",selected_count:"{{count}} seleccionado",selected_count_plural:"{{count}} seleccionados",session_expired:"Su sesión ha expirado. Será redirigido para iniciar sesión nuevamente.",sign_access_error:"Error al acceder al servicio de firma",sign_api_key_info:"Ingrese la API Key del proveedor de firma",sign_api_key_input:"Ingrese la API Key del proveedor de firma",sign_api_key_placeholder:"Ingrese la clave de API",sign_api_key_required:"Clave de API obligatoria",sign_attempt:"Intento de firma",sign_auth_required:"Autenticación requerida para firmar",sign_click_to_select:"Haga clic para seleccionar documento",sign_config_save_err:"Error al guardar configuración de firma",sign_config_save_error:"Error al guardar configuración de firma",sign_config_saved:"Configuración de firma guardada",sign_config_saved_success:"Configuración de firma guardada exitosamente",sign_configured:"Firma configurada",sign_configured_unit:"Firma digital configurada para esta unidad",sign_digital_config:"Configuración de Firma Digital",sign_doc_available:"Documento firmado disponible para descarga",sign_doc_load_error:"Error al cargar documento",sign_doc_process_error:"Error al procesar documento",sign_doc_sent:"Documento enviado para firma",sign_download_signed:"Descargar documento firmado",sign_email_fallback:"Correo de respaldo para firma",sign_environment:"Ambiente de firma",sign_fetch_failed:"Error al obtener documento firmado",sign_file_not_allowed:"Extensión de archivo no permitida",sign_file_type_not_allowed:"Tipo de archivo no permitido",sign_incorrect_data:"El firmante reportó datos incorrectos.",sign_login_required:"Inicio de sesión requerido para firmar",sign_login_to_sign:"Inicie sesión para usar la firma digital.",sign_monthly_limit:"Límite mensual de firmas alcanzado",sign_no_access:"No se pudo obtener acceso para firma. Intente de nuevo.",sign_not_configured:"Firma no configurada",sign_not_configured_unit:"Firma digital aún no configurada para esta unidad",sign_preparing_doc:"Preparando documento para firma",sign_process_error:"Error al procesar firma",sign_save_config:"Guardar configuración",sign_save_config_btn:"Guardar Configuración",sign_select_pdf:"Seleccione un archivo PDF",sign_sending_doc:"Enviando documento para firma",sign_signed_success:"Documento firmado exitosamente",sign_signer_unavailable:"ID del firmante no disponible",sign_try_again:"Intentar de nuevo",sign_update_config:"Actualizar configuración",sign_update_config_btn:"Actualizar Configuración",sign_waiting_provider:"Esperando proveedor de firma",sign_widget_error:"Error en el widget de firma",something_went_wrong:"Algo salió mal",state:"Estado",status:"Estado",status_completed:"Completado",status_error:"Error",status_expired:"Expirado",status_processing:"Procesando",status_waiting:"Esperando",steps:"Etapas",subordinates:"Subordinados",subordinates_add_error:"Error al agregar subordinados",subordinates_added_success:"Subordinados agregados exitosamente",subordinates_sync_error:"Error al sincronizar subordinados",subordinates_synced_success:"Subordinados sincronizados exitosamente",team_all_groups:"Todos los grupos",terms_confirm_reading:"Confirmar lectura",terms_confirmation_available:"Confirmación disponible en",terms_of_use:"Términos de Uso",terms_read_agree:"He leído y acepto",terms_see_later:"Ver después",terms_updated:"Términos de Uso Actualizados",terms_view:"Ver términos de uso",terms_view_short:"Ver término",try_adjust_search:"Intente ajustar su búsqueda",try_again:"Intentar de Nuevo",unit_not_selected:"Ninguna unidad seleccionada",unknown_error:"Error desconocido",unsaved_changes:"Cambios sin guardar",unsaved_changes_description:"Hay cambios sin guardar. ¿Desea salir sin guardar?",update:"Actualizar",updates:"Actualizaciones",updates_bar_close:"Cerrar",updates_dialog_close:"Cerrar",updates_dialog_do_not_show_again:"No mostrar de nuevo",updates_dialog_like:"Me gusta",updating:"Actualizando...",user:"Usuario",user_info:"Información del Usuario",user_photo:"Foto del usuario",users_already_leaders:"Los usuarios ya son líderes",verification_code:"Código de verificación",video:"Video",video_title:"Título del vídeo",view_report:"Ver informe",want_to_know_more:"Quiero conocer más",write_content_here:"Escriba el contenido aquí..."};const jl="true"===(void 0).VITE_I18N_DEBUG_MODE;function Nl(t,a){e.addResourceBundle(t,"app",a,!0,!0)}jl&&e.use({type:"postProcessor",name:"debugKeys",process:(e,t)=>`🔑 ${Array.isArray(t)?t[0]:t}`}),e.use(y.initReactI18next).init({resources:{"pt-BR":{core:vl},"en-US":{core:yl},"es-ES":{core:wl}},fallbackLng:"pt-BR",lng:"pt-BR",defaultNS:"app",fallbackNS:"core",ns:["core"],interpolation:{escapeValue:!1},react:{useSuspense:!1},saveMissing:!1,returnEmptyString:!1,parseMissingKeyHandler:e=>e,postProcess:jl?["debugKeys"]:[]});const _l=a.createContext({moduleAlias:null,associationsBaseUrl:null,signDocumentsSchema:"common",signDocumentsTable:"sign_documents"});function Cl({moduleAlias:e=null,associationsBaseUrl:a=null,signDocumentsSchema:r="common",signDocumentsTable:s="sign_documents",children:n}){return t.jsx(_l.Provider,{value:{moduleAlias:e,associationsBaseUrl:a,signDocumentsSchema:r,signDocumentsTable:s},children:n})}function kl(){return a.useContext(_l)}const Sl={analysis:12,decisions:13,audit:1,common:0,competencies:23,performance:24,docs:17,education:25,flow:7,suppliers:15,"suppliers-portal":16,mapping:11,metrology:8,control:18,msa:21,occurrences:3,okr:26,pdi:27,plans:6,"strategy-extension":14,pulse:28,boards:10,risks:4,fmea:20,staff:19,"control-plan":22},Al=6e5;function Tl(e){const{moduleAlias:t,associationsBaseUrl:r}=kl(),{alias:s,user:n,isAuthenticated:o}=ko(),i=e??t,l=n?.id??null,c=o&&!!s&&!!l,{data:d=[],isLoading:u}=j.useQuery({queryKey:["qualiex-associations",l,s,r??null],queryFn:()=>lo.fetchUserAssociations(l,s,r?{baseUrl:r}:void 0),enabled:c,staleTime:Al,gcTime:12e5}),m=a.useMemo(()=>s&&0!==d.length?d.find(e=>e.companyAlias===s)??null:null,[d,s]),p=a.useCallback(e=>{if(!m)return!1;return(Array.isArray(e)?e:[e]).every(e=>{const t=Sl[e];return void 0!==t&&m.softwares.includes(t)})},[m]);return{hasAccess:a.useMemo(()=>!i||p(i),[i,p]),isLoading:c&&u,role:a.useMemo(()=>m?{id:m.roleId,name:m.roleName}:null,[m]),association:m,hasAccessTo:p}}const Dl={"pt-br":"pt-BR","pt-BR":"pt-BR",en:"en-US","en-US":"en-US",es:"es-ES","es-ES":"es-ES",fr:"fr-FR","fr-FR":"fr-FR"};function El(){const{association:t}=Tl(),r=t?.language;return a.useEffect(()=>{if(!r)return;const t=Dl[r];t&&e.language!==t&&e.changeLanguage(t)},[r]),null}const Pl=a.createContext(void 0),Il={locale:ar,timezone:sr,datetimeFormat:rr},Ml=async()=>{},Rl=({children:e})=>t.jsx(Pl.Provider,{value:{...Il,setLocale:Ml,setTimezone:Ml,setDatetimeFormat:Ml,isLoading:!1},children:e}),Ll=()=>{const e=a.useContext(Pl);if(!e)throw new Error("useLocale deve ser usado dentro de LocaleProvider");return e},Fl=be.Root,zl=be.CollapsibleTrigger,Ul=be.CollapsibleContent;var Ol=Object.defineProperty,Bl=(e,t,a)=>((e,t,a)=>t in e?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,t+"",a);class ql extends a.Component{constructor(t){super(t),Bl(this,"copyErrorDetails",()=>{const t=Hn.getErrors().slice(0,2),a=`\n=== ERRO ATUAL ===\n${this.state.error?.message||e.t("unknown_error")}\n\nStack Trace:\n${this.state.error?.stack||e.t("not_available")}\n\n=== ÚLTIMOS ERROS ===\n${t.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||e.t("no_errors_recorded")}\n `.trim();navigator.clipboard.writeText(a),l.toast.success("Detalhes copiados!",{description:e.t("error_copied_clipboard")})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,t){if((void 0).DEV)throw e;Hn.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const a=Hn.getErrors().slice(0,2);return t.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:t.jsxs(Er,{className:"w-full max-w-2xl",children:[t.jsxs(Pr,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),t.jsx(Ir,{children:e.t("something_went_wrong")})]}),t.jsxs(Rr,{className:"space-y-4",children:[t.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),t.jsxs(Fl,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[t.jsx(zl,{asChild:!0,children:t.jsxs(kr,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),t.jsxs(Ul,{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),t.jsxs("div",{className:"text-sm space-y-2",children:[t.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||e.t("unknown_error")}),this.state.error?.stack&&t.jsx(Si,{className:"h-32 w-full rounded border bg-muted p-2",children:t.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),a.length>0&&t.jsxs("div",{className:"pt-3 border-t",children:[t.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),t.jsx("div",{className:"space-y-2",children:a.map((e,a)=>t.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[a+1,"."]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),t.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),t.jsxs(kr,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[t.jsx(c.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),t.jsx(kr,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}const $l=ve.Root,Vl=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.List,{ref:r,className:Nr("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));Vl.displayName=ve.List.displayName;const Wl=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.Trigger,{ref:r,className:Nr("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));Wl.displayName=ve.Trigger.displayName;const Hl=te.forwardRef(({className:e,...a},r)=>t.jsx(ve.Content,{ref:r,className:Nr("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));function Gl({className:e}){return t.jsxs("svg",{className:e,width:"32",height:"34",viewBox:"0 0 32 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.5 11.7455C0.5 10.2633 2.25695 9.52546 3.36816 10.4399L22.4346 26.1528C23.3588 26.9137 23.229 28.3353 22.1953 28.9301L16.3418 32.2963C15.7961 32.6097 15.1199 32.6098 14.5742 32.2963L1.36133 24.7006C0.832671 24.3966 0.500052 23.8398 0.5 23.2289V11.7455Z",stroke:"currentColor"}),t.jsx("path",{d:"M14.612 0.735352C15.1576 0.421927 15.833 0.421964 16.3786 0.735352L25.3776 5.90723V5.9082C26.5447 6.5808 26.5183 8.24018 25.3298 8.875L25.3307 8.87598L13.9333 14.9697L13.9323 14.9688C13.3016 15.3066 12.5233 15.2301 11.9733 14.7773L4.90302 8.9541C3.97881 8.19317 4.1086 6.77256 5.14227 6.17773L14.612 0.735352Z",stroke:"currentColor"}),t.jsx("path",{d:"M28.1066 9.7966C29.2466 9.18579 30.6895 9.9732 30.6896 11.2937V23.0691C30.6895 23.6825 30.3539 24.2382 29.8264 24.5417L29.8254 24.5427L27.3449 25.9607C26.7486 26.3015 26.0057 26.264 25.4494 25.8747L25.341 25.7917L16.6076 18.5974C15.6649 17.821 15.8224 16.3676 16.8937 15.7937V15.7927L28.1066 9.79758V9.7966Z",stroke:"currentColor"})]})}function Kl({className:e}){return t.jsxs("svg",{className:e,width:"18",height:"33",viewBox:"0 0 18 33",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M0.524143 8.74979C1.44754 8.74979 2.36325 8.74979 3.30973 8.74979C3.30973 8.90069 3.30973 9.05162 3.30973 9.19497C3.30973 9.79101 3.64061 10.1154 4.24082 10.1154C6.8879 10.1154 9.54268 10.1154 12.1898 10.1154C12.7592 10.1154 13.1286 9.77589 13.1132 9.27793C13.0978 8.8856 12.8054 8.5612 12.3745 8.51594C11.2279 8.38767 10.0736 8.26696 8.91938 8.1387C7.72666 8.01043 6.52625 7.88216 5.33352 7.74635C4.71792 7.67845 4.10232 7.61811 3.48672 7.53511C2.00928 7.32386 0.754978 6.06386 0.547213 4.61526C0.331752 3.10631 1.00122 1.73316 2.34015 0.963593C2.89419 0.646712 3.5021 0.503353 4.14848 0.503353C6.84943 0.503353 9.55038 0.495808 12.2513 0.503353C14.0904 0.510898 15.5448 1.71808 15.8603 3.49865C15.8988 3.7099 15.8988 3.92116 15.9065 4.13996C15.9141 4.2984 15.9065 4.44928 15.9065 4.61526C14.9677 4.61526 14.0443 4.61526 13.0978 4.61526C13.0978 4.44928 13.0978 4.28329 13.0978 4.1173C13.0901 3.58162 12.7592 3.25719 12.2206 3.24965C9.53499 3.24965 6.84943 3.24965 4.17157 3.24965C3.69448 3.24965 3.36359 3.52881 3.30203 3.97396C3.24816 4.3512 3.51749 4.73597 3.90224 4.8265C4.10231 4.87177 4.31008 4.88687 4.51784 4.9095C5.8183 5.05285 7.12645 5.19622 8.42691 5.33957C9.71198 5.48292 10.997 5.63382 12.2898 5.75453C13.1824 5.83753 13.9981 6.08649 14.6906 6.68253C16.1604 7.92742 16.3066 10.2588 14.9984 11.6696C14.2443 12.4845 13.3132 12.8844 12.1975 12.8844C9.5273 12.8844 6.84944 12.8844 4.17927 12.8844C2.55562 12.8844 1.21669 11.9563 0.678043 10.4549C0.539533 9.98715 0.470277 9.38356 0.524143 8.74979Z",stroke:"currentColor"}),t.jsx("path",{d:"M8.21913 24.2393C8.21913 24.2317 8.21913 24.2317 8.21913 24.2393ZM8.21913 24.2393C8.98863 24.2393 9.75812 24.2619 10.5199 24.2317C11.7511 24.1789 12.9285 23.1378 13.067 21.9381C13.1439 21.3119 13.1285 20.6706 13.1131 20.0368C13.067 18.6335 11.8743 17.4339 10.443 17.3962C8.96554 17.3584 7.4881 17.366 6.00296 17.3962C4.70251 17.4263 3.54055 18.4373 3.37896 19.6973C3.29431 20.3462 3.3097 21.0101 3.34048 21.6665C3.40204 23.017 4.58708 24.1789 5.96449 24.2317C6.7186 24.2619 7.46502 24.2393 8.21913 24.2393ZM13.1439 15.427C13.7441 14.8385 14.3367 14.2575 14.9138 13.6917C15.5756 14.333 16.2296 14.9818 16.9222 15.6608C16.8914 15.6759 16.8298 15.7061 16.7837 15.7438C16.2604 16.2493 15.7448 16.7624 15.2216 17.2679C15.1446 17.3434 15.1369 17.4037 15.1908 17.4943C15.7064 18.3845 15.9526 19.3427 15.9295 20.3613C15.9141 20.9799 15.9526 21.6062 15.8603 22.2097C15.5371 24.2846 14.352 25.7332 12.3975 26.5782C11.7126 26.8724 10.9816 26.9931 10.2352 26.9931C8.89629 26.9931 7.56504 26.9931 6.22611 26.9931C3.49438 26.9931 1.20897 25.1899 0.631845 22.5719C0.56259 22.2475 0.524115 21.9155 0.51642 21.5835C0.508725 20.9422 0.470242 20.2933 0.547192 19.6596C0.816518 17.3584 2.08619 15.7967 4.27927 14.9516C4.84101 14.7328 5.42584 14.6347 6.02605 14.6347C7.4958 14.6347 8.96554 14.6272 10.4276 14.6423C11.3279 14.6498 12.1667 14.9064 12.9516 15.3289C13.0131 15.3591 13.067 15.3892 13.1439 15.427Z",stroke:"currentColor"}),t.jsx("path",{d:"M0.508791 28.3813C1.43989 28.3813 2.3633 28.3813 3.2944 28.3813C3.31748 28.4945 3.32516 28.6001 3.35594 28.7058C3.50984 29.2943 4.01772 29.7017 4.63332 29.7319C4.76414 29.7394 4.89496 29.7394 5.02578 29.7394C7.22655 29.7394 9.4273 29.7394 11.6281 29.7394C12.3206 29.7394 12.8439 29.3923 13.0363 28.7963C13.0747 28.668 13.0978 28.5323 13.1286 28.3889C14.0443 28.3889 14.9677 28.3889 15.9142 28.3889C15.9219 28.7435 15.868 29.0906 15.7757 29.4301C15.2986 31.1955 13.6519 32.4782 11.7897 32.4857C9.39653 32.5008 7.01108 32.5083 4.61794 32.4857C2.44025 32.4706 0.624216 30.7353 0.508791 28.6077C0.501096 28.5322 0.508791 28.4643 0.508791 28.3813Z",stroke:"currentColor"})]})}Hl.displayName=ve.Content.displayName;const Yl={init(e){!function(e){try{return t=window,a=document,r="clarity",s="script",n=e,void(a.getElementById("clarity-script")||(t[r]=t[r]||function(){(t[r].q=t[r].q||[]).push(arguments)},(o=a.createElement(s)).async=1,o.src="https://www.clarity.ms/tag/"+n+"?ref=npm",o.id="clarity-script",(i=a.getElementsByTagName(s)[0]).parentNode.insertBefore(o,i)))}catch(l){return}var t,a,r,s,n,o,i}(e)},setTag(e,t){window.clarity("set",e,t)},identify(e,t,a,r){window.clarity("identify",e,t,a,r)},consent(e=!0){window.clarity("consent",e)},consentV2(e={ad_Storage:"granted",analytics_Storage:"granted"}){window.clarity("consentv2",e)},upgrade(e){window.clarity("upgrade",e)},event(e){window.clarity("event",e)}},Ql="forlogic_";function Xl(){return"undefined"!=typeof window&&"function"==typeof window.clarity}function Jl(){return"undefined"!=typeof window&&"piggyback"===window.__forlogicClarityMode}function Zl(e){return Jl()?`${Ql}${e}`:e}function ec(e){return Jl()?`${Ql}${e}`:e}function tc(e){try{e()}catch(t){(void 0).DEV}}function ac(e){for(const[t,a]of Object.entries(e))null!=a&&""!==a&&Yl.setTag(ec(t),a)}function rc({module:e,isContracted:t,sourceModule:a,alias:r}){Xl()&&tc(()=>{ac({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:String(t),source_module:a,alias:r}),Yl.event(Zl("module_menu_click"))})}function sc({module:e,sourceModule:t,alias:a}){Xl()&&tc(()=>{ac({clicked_module:e.name,clicked_module_id:e.softwareAlias,is_contracted:"false",source_module:t,alias:a}),Yl.event(Zl("module_interest_click"))})}function nc({resource:e,sourceModule:t,alias:a}){Xl()&&tc(()=>{ac({footer_resource:e,source_module:t,alias:a}),Yl.event(Zl("module_footer_click"))})}function oc({educaUrl:e="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:a="https://sabergestao.com.br/",wikiUrl:r,alias:s,sourceModule:n}){const{t:o}=y.useTranslation(),i=gr(e||r||"https://educacao.sabergestao.com.br/{alias}/fe",s),l=e=>{nc({resource:e,sourceModule:n,alias:s})};return t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Fr,{className:"mb-4"}),t.jsxs("div",{className:"grid grid-cols-1 min-[480px]:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-3",children:[t.jsxs("div",{className:"bg-primary text-primary-foreground rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-white",children:o("learn_qualiex")}),t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("educa"),className:"inline-flex items-center gap-1 text-sm text-white underline underline-offset-2 hover:opacity-80 mt-2",children:["Conheça o ForLogic Educa",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Gl,{className:"absolute right-2 bottom-2 w-16 h-16 text-[#043481] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:o("know_saber_gestao")}),t.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:()=>l("saber-gestao"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Saiba mais",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(Kl,{className:"absolute right-2 bottom-2 w-12 h-16 text-[#E0E0E0] pointer-events-none"})]}),t.jsxs("div",{className:"bg-muted rounded-lg p-4 relative overflow-hidden",children:[t.jsxs("div",{className:"relative z-10",children:[t.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Dúvidas sobre os módulos?"}),t.jsxs("a",{href:r||"https://wiki.qualiex.com/",target:"_blank",rel:"noopener noreferrer",onClick:()=>l("wiki"),className:"inline-flex items-center gap-1 text-sm text-primary underline underline-offset-2 hover:opacity-80 mt-2",children:["Consulte nossa Wiki",t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]})]}),t.jsx(c.NotebookText,{className:"absolute right-2 top-2 bottom-2 h-[calc(100%-1rem)] w-auto text-[#E0E0E0] pointer-events-none",strokeWidth:1})]})]})]})}const ic=[{id:"qualiex",label:"Qualiex",modules:[{name:"Análises",description:"Análise de dados",color:"bg-[#002338]",softwareAlias:"analysis",url:"https://apps4.qualiex.com/analysis/{alias}"},{name:"Atas e Decisões",description:"Gestão de atas e decisões",color:"bg-[#7DB3B2]",softwareAlias:"decisions",url:"https://apps4.qualiex.com/decisions/{alias}"},{name:"Auditorias",description:"Gestão de auditorias",color:"bg-[#912F71]",softwareAlias:"audit",url:"https://apps4.qualiex.com/audit/{alias}"},{name:"Configurações",description:"Configurações gerais",color:"bg-[#5C6BC0]",softwareAlias:"common",url:"https://apps4.qualiex.com/common/{alias}"},{name:"Documentos",description:"Gestão de documentos",color:"bg-[#1D43A6]",softwareAlias:"docs",url:"https://apps4.qualiex.com/docs/{alias}"},{name:"Fluxos",description:"Gestão de fluxos",color:"bg-[#8BFFE0]",softwareAlias:"flow",url:"https://apps4.qualiex.com/flow/{alias}"},{name:"Fornecedores",description:"Gestão de fornecedores",color:"bg-[#5C5094]",softwareAlias:"suppliers",url:"https://apps4.qualiex.com/suppliers/{alias}"},{name:"Mapeamentos",description:"Mapeamento de dados pessoais",color:"bg-[#62416B]",softwareAlias:"mapping",url:"https://apps4.qualiex.com/mapping/{alias}"},{name:"Metrologia",description:"Gestão de metrologia",color:"bg-[#8CC74F]",softwareAlias:"metrology",url:"https://apps4.qualiex.com/metrology/{alias}"},{name:"Ocorrências",description:"Gestão de ocorrências",color:"bg-[#EE7121]",softwareAlias:"occurrences",url:"https://apps4.qualiex.com/occurrences/{alias}"},{name:"OKR",description:"Objetivos e resultados-chave",color:"bg-[#4A90D9]",softwareAlias:"okr",url:"https://okr.qualiex.com/{alias}"},{name:"Planos",description:"Planos de ação",color:"bg-[#FBC02D]",softwareAlias:"plans",url:"https://apps4.qualiex.com/plans/{alias}"},{name:"Portal do Fornecedor",description:"Portal do Fornecedor",color:"bg-[#26A69A]",softwareAlias:"suppliers-portal",url:"https://portaldofornecedor.qualiex.com/{alias}"},{name:"Riscos",description:"Gestão de riscos",color:"bg-[#ED7096]",softwareAlias:"risks",url:"https://apps4.qualiex.com/risks/{alias}"},{name:"Competências",description:"Gestão de competências",color:"bg-[#9B4F96]",softwareAlias:"competencies",url:"https://competencias.sabergestao.com.br/{alias}"},{name:"Desempenho",description:"Gestão de desempenho",color:"bg-[#4A90D9]",softwareAlias:"performance",url:"https://desempenho.sabergestao.com.br/{alias}"},{name:"Educação",description:"Plataforma de ensino",color:"bg-[#00BCD4]",softwareAlias:"education",url:"https://educacao.sabergestao.com.br/{alias}"},{name:"PDI",description:"Plano de desenvolvimento individual",color:"bg-[#7CB342]",softwareAlias:"pdi",url:"https://pdi.sabergestao.com.br/{alias}"},{name:"Pulso",description:"Pesquisas de clima",color:"bg-[#F5A623]",softwareAlias:"pulse",url:"https://nr1pulso.sabergestao.com.br/{alias}"},{name:"Treinamentos",description:"Gestão de treinamentos",color:"bg-[#26A69A]",softwareAlias:"staff",url:"https://treinamentos.sabergestao.com.br/{alias}"}]},{id:"classico",label:"Clássicos",modules:[{name:"Action",description:"Planos de ação",color:"bg-[#fbe356]",url:"https://apps1.qualiex.com/action?unitalias={alias}"},{name:"Audit",description:"Gestão de auditorias",color:"bg-[#ca76b5]",url:"https://apps1.qualiex.com/audit?unitalias={alias}"},{name:"Configurações v3",description:"Configurações",color:"bg-[#5C6BC0]",url:"https://apps3.qualiex.com/{alias}/common"},{name:"Dashboards v1",description:"Dashboards",color:"bg-[#EC407A]",url:"https://apps1.qualiex.com/shared/dashboard?unitalias={alias}"},{name:"Docs v1",description:"Gestão de Documentos",color:"bg-[#58b4db]",url:"https://apps1.qualiex.com/docs?unitalias={alias}"},{name:"Indicators",description:"Gestão de Indicadores",color:"bg-[#f91b1d]",url:"https://apps1.qualiex.com/indicators?unitalias={alias}"},{name:"Meeting",description:"Gestão de reuniões",color:"bg-[#96c2c1]",url:"https://apps1.qualiex.com/meeting?unitalias={alias}"},{name:"Metrology v3",description:"Gestão de Metrologia",color:"bg-[#afd884]",url:"https://apps3.qualiex.com/{alias}/metrology/"},{name:"Planner",description:"Planejamento estratégico",color:"bg-[#4dc6f4]",url:"https://apps3.qualiex.com/{alias}/planner/m"},{name:"Relatórios v1",description:"Relatórios",color:"bg-[#FFA726]",url:"https://apps1.qualiex.com/common/reports?unitalias={alias}"},{name:"Risks",description:"Gestão de riscos",color:"bg-[#ef7b9e]",url:"https://apps1.qualiex.com/risks?unitalias={alias}"},{name:"Staff",description:"Avaliação de competências",color:"bg-[#0978d6]",url:"https://apps1.qualiex.com/staff?unitalias={alias}"},{name:"Supply",description:"Avaliação de fornecedores",color:"bg-[#8276b7]",url:"https://apps1.qualiex.com/supply?unitalias={alias}"},{name:"Tracker1",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker1?unitalias={alias}"},{name:"Tracker2",description:"Gestão de ocorrências",color:"bg-[#fe883b]",url:"https://apps1.qualiex.com/tracker2?unitalias={alias}"}]},{id:"backoffice",label:"Backoffice",modules:[{name:"Backoffice",description:"Operações administrativas",color:"bg-[#5C6BC0]",url:"https://admin.qualiex.com/{alias}",alwaysContracted:!0}]}];function lc({module:e,onClick:a}){return t.jsxs("button",{type:"button",onClick:a,className:"flex items-start gap-3 p-2 rounded-lg transition-colors text-left w-full group hover:bg-muted/50",children:[t.jsx("div",{className:Nr("w-4 h-4 rounded-sm shrink-0 mt-0.5",e.color)}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium transition-colors text-foreground group-hover:text-primary",children:e.name}),e.description&&t.jsx("div",{className:"text-sm text-muted-foreground truncate",children:e.description})]})]})}function cc(e,t){if(0===e.length)return e;const a=Math.ceil(e.length/t),r=[];for(let s=0;s<a;s++)for(let n=0;n<t;n++){const t=n*a+s;t<e.length&&r.push(e[t])}return r}function dc({modules:e,onModuleClick:r,contractedModules:s,onModuleInterest:n}){const o=function(){const[e,t]=a.useState(4);return a.useEffect(()=>{const e=()=>{window.matchMedia("(min-width: 1280px)").matches?t(4):window.matchMedia("(min-width: 768px)").matches?t(3):window.matchMedia("(min-width: 640px)").matches?t(2):t(1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}(),i=[...e].sort((e,t)=>e.name.localeCompare(t.name)),l=void 0!==s,c=e=>!0===e.alwaysContracted||!l||s.includes(e.name),d=i.filter(c),u=l?i.filter(e=>!c(e)):[],m=cc(d,o),p=cc(u,o),h=(e,t)=>{t?r?.(e):n?.(e)};return t.jsxs("div",{className:"space-y-6",children:[m.length>0&&t.jsx("section",{children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:m.map(e=>t.jsx(lc,{module:e,onClick:()=>h(e,!0)},e.name))})}),p.length>0&&t.jsxs("section",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 mt-4",children:[t.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Conheça também"}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-1",children:p.map(e=>t.jsx(lc,{module:e,onClick:()=>h(e,!1)},e.name))})]})]})}function uc({onModuleClick:e,contractedModules:r,onModuleInterest:s,nonContractedUrl:n="https://qualiex.com/",educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,alias:c,sourceModule:d,showAdminGroup:u=!1}){const[m,p]=a.useState("qualiex"),h=u?ic.find(e=>"backoffice"===e.id)?.modules??[]:[],x=ic.filter(e=>"backoffice"!==e.id).map(e=>"qualiex"===e.id?{...e,modules:[...e.modules,...h]}:e),f=e=>{sc({module:e,sourceModule:d,alias:c}),window.open(n,"_blank","noopener,noreferrer"),s?.(e)};return t.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[t.jsxs($l,{value:m,onValueChange:p,className:"flex-1 flex flex-col min-h-0",children:[t.jsx(Vl,{className:"w-fit shrink-0",children:x.map(e=>t.jsxs(Wl,{value:e.id,children:[e.label,t.jsxs("span",{className:"ml-1.5 text-xs text-muted-foreground",children:["(",e.modules.length,")"]})]},e.id))}),x.map(a=>t.jsx(Hl,{value:a.id,className:"flex-1 mt-4 overflow-auto pr-2",children:t.jsx(dc,{modules:a.modules,onModuleClick:t=>{return s=t,n=a.id,rc({module:s,isContracted:!!s.alwaysContracted||"qualiex"!==n||!r||r.includes(s.name),sourceModule:d,alias:c}),void e?.(s);var s,n},contractedModules:"qualiex"===a.id?r:void 0,onModuleInterest:f})},a.id))]}),t.jsx(oc,{educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:c,sourceModule:d})]})}function mc(e){const{association:t}=Tl();return a.useMemo(()=>{if(e)return e;if(!t?.softwares)return;const a=t.softwares,r=ic.find(e=>"qualiex"===e.id);return r?r.modules.filter(e=>{if(!e.softwareAlias)return!1;const t=Sl[e.softwareAlias];return void 0!==t&&a.includes(t)}).map(e=>e.name):void 0},[e,t])}function pc({open:e,onOpenChange:a,onModuleClick:r,contractedModules:s,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:c,showAdminGroup:d}){const{alias:u,user:m}=ko(),p=mc(s),h=d??!!m?.isSysAdmin;return t.jsx(Yr,{open:e,onOpenChange:a,children:t.jsxs(ts,{size:"lg",className:"overflow-hidden flex flex-col",children:[t.jsx(as,{className:"sr-only",children:t.jsx(ns,{children:"Módulos"})}),t.jsx(uc,{onModuleClick:e=>{r?r(e):e.url&&fr(gr(e.url,u||void 0))},contractedModules:p,onModuleInterest:n,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,alias:u||void 0,sourceModule:c,showAdminGroup:h})]})})}function hc({open:r,onOpenChange:s,onModuleClick:n,contractedModules:o,onModuleInterest:i,userName:l,unitName:d,units:u=[],currentAlias:m,onUnitChange:p,onLogout:h,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,blocking:b=!0,size:v="lg",children:w,sourceModule:j}){const{t:N}=y.useTranslation(),_=a.useMemo(()=>{if(!u.length)return[];const e=new Map;u.forEach(t=>e.set(t.alias,t));const t=Array.from(e.values()),a=t.find(e=>e.alias===m),r=t.filter(e=>e.alias!==m).sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"}));return a?[a,...r]:r},[u,m]);return t.jsx(Yr,{open:r,onOpenChange:b?void 0:s,children:t.jsxs(ts,{size:v,variant:"destructive",className:"overflow-hidden flex flex-col max-h-[85vh]",onPointerDownOutside:b?e=>e.preventDefault():void 0,onEscapeKeyDown:b?e=>e.preventDefault():void 0,children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[t.jsx(ns,{children:N("no_access_page")}),t.jsx(os,{children:"Selecione um módulo para continuar navegando!"})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[_.length>1&&t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsxs(kr,{variant:"outline",size:"sm",className:"gap-2 max-w-[200px]",children:[t.jsx(c.Building2,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate text-xs",children:d||"Unidade"}),t.jsx(c.ChevronDown,{className:"h-3 w-3 shrink-0"})]})}),t.jsx($s,{align:"end",className:"max-h-[300px] overflow-auto",children:_.map(e=>t.jsxs(Vs,{onClick:()=>p?.(e),className:e.alias===m?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),e.alias===m&&t.jsx(Ds,{variant:"outline",className:"ml-auto text-xs shrink-0",children:"Atual"})]},e.alias))})]}),t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsxs(kr,{variant:"ghost",size:"sm",className:"gap-2",children:[t.jsx("div",{className:"w-7 h-7 bg-primary rounded-full flex items-center justify-center",children:t.jsx(c.User,{className:"h-3.5 w-3.5 text-primary-foreground"})}),t.jsx(c.ChevronDown,{className:"h-3 w-3"})]})}),t.jsxs($s,{align:"end",children:[t.jsxs("div",{className:"px-2 py-1.5",children:[t.jsx("p",{className:"text-sm font-medium",children:l||e.t("user")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:d})]}),t.jsx(Ks,{}),t.jsxs(Vs,{onClick:h,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})]}),w?t.jsxs("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col",children:[t.jsx("div",{className:"flex-1",children:w}),t.jsx(oc,{educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]}):t.jsx(uc,{onModuleClick:n,contractedModules:o,onModuleInterest:i,educaUrl:x,saberGestaoUrl:f,wikiUrl:g,alias:m,sourceModule:j})]})})}function xc(e,t){return t.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t)}function fc({children:e,contractedModules:r,onModuleClick:s,onModuleInterest:n,educaUrl:o="https://educacao.sabergestao.com.br/{alias}/fe",saberGestaoUrl:i="https://sabergestao.com.br/",wikiUrl:l,bypassPaths:c,noAccessRedirectPath:d,noAccessRedirectMode:u,accessDeniedRoutes:m,sourceModule:p}){const{t:h}=y.useTranslation(),{hasAccess:x,isLoading:f,association:g}=Tl(),{user:b,alias:v,companies:w,isAuthenticated:j,isLoading:N,logout:_,switchUnit:C}=ko(),k=mc(r),S=a.useMemo(()=>w?.length?v&&w.find(e=>e.alias===v)||w[0]:null,[w,v]),A=a.useMemo(()=>w?.length?w.map(e=>({alias:e.alias,name:e.name||e.alias})):[],[w]),T=a.useCallback(e=>{const t=w?.find(t=>t.alias===e.alias);if(!t)return;const{pathname:a,search:r,hash:s}=window.location;if(v){const e=a.split("/"),n=e.indexOf(v);if(n>=0)return e[n]=t.alias,void(window.location.href=e.join("/")+r+s)}C(t)},[v,C,w]),D=a.useCallback(e=>{s?s(e):e.url&&fr(gr(e.url,v||void 0))},[s,v]),E=a.useMemo(()=>{if(!m)return;const e="undefined"!=typeof window?window.location.pathname:"",t=Object.keys(m).find(t=>xc(e,[t]));return t?m[t]:void 0},[m]),P="undefined"!=typeof window?window.location.pathname:"",I=!(!c?.length||!xc(P,c)),M=!N&&j&&!f&&!x&&!I&&!!d&&"always"===(u??"always")?function(e,t){return t&&e.startsWith("/")?e.split("/")[1]===t?e:`/${t}${e}`:e}(d,v):null;return a.useEffect(()=>{M&&M!==P&&window.location.replace(M)},[M,P]),N||!j||I?t.jsx(t.Fragment,{children:e}):f?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Ps,{size:"lg"})}):x?t.jsx(t.Fragment,{children:e}):M?M===P?t.jsx(t.Fragment,{children:e}):t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsx(Ps,{size:"lg"})}):t.jsx(hc,{open:!0,onModuleClick:D,contractedModules:k,onModuleInterest:n,userName:b?.name,unitName:S?.name,units:A,currentAlias:v||void 0,onUnitChange:T,onLogout:_,educaUrl:o,saberGestaoUrl:i,wikiUrl:l,sourceModule:p,blocking:!0,children:E})}let gc=!1;function bc(){if(gc||"undefined"==typeof document)return;gc=!0;for(const t of["https://fonts.googleapis.com","https://fonts.gstatic.com"])if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=t,t.includes("gstatic")&&(e.crossOrigin="anonymous"),document.head.appendChild(e)}const e=["https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap","https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"];for(const t of e)if(!document.querySelector(`link[href="${t}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}}function vc({projectId:e,mode:t="auto"}){const{user:r,alias:s,isAuthenticated:n}=ko();a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&e&&!We()&&!window.__forlogicClarityOwned)if("function"!=typeof window.clarity)try{Yl.init(e),window.__forlogicClarityOwned=!0,window.__forlogicClarityMode="owned"}catch(a){(void 0).DEV,window.__forlogicClarityMode="inactive"}else window.__forlogicClarityMode="piggyback"},[e,t]),a.useEffect(()=>{if("undefined"!=typeof window&&"disabled"!==t&&n&&r&&"function"==typeof window.clarity)try{const e=r.email||r.identifier||"anonymous";Yl.identify(e,void 0,"modules-menu",r.name||void 0),s&&Yl.setTag("alias",s),"boolean"==typeof r.isSysAdmin&&Yl.setTag("isSysAdmin",String(r.isSysAdmin))}catch(e){(void 0).DEV}},[r,s,n,t])}let yc="legacy";function wc({projectId:e,mode:t}){return vc({projectId:e,mode:t}),null}function jc(){if(!Fe())return null;const e=Gn((void 0).VITE_SUPABASE_PUBLISHABLE_KEY),a=!!(void 0).VITE_SUPABASE_PK_OVERRIDE;if(!e||a||!(void 0).DEV)return null;const r={background:"rgba(0,0,0,.2)",padding:"1px 4px",borderRadius:4};return t.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,zIndex:99999,background:"#dc2626",color:"#fff",padding:"8px 16px",fontSize:"13px",fontFamily:"Inter, system-ui, sans-serif",textAlign:"center",lineHeight:1.4},children:[t.jsx("strong",{children:"⚠️ Legacy Supabase Key Detectada"})," — O ",t.jsx("code",{style:r,children:"VITE_SUPABASE_PUBLISHABLE_KEY"})," contém uma anon key JWT legada. Adicione ",t.jsx("code",{style:r,children:'VITE_SUPABASE_PK_OVERRIDE="sb_publishable_..."'})," no .env para corrigir."]})}const Nc=ye.Root,_c=te.forwardRef(({className:e,...a},r)=>t.jsx(ye.Item,{ref:r,className:Nr("border-b",e),...a}));_c.displayName="AccordionItem";const Cc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Header,{className:"flex",children:t.jsxs(ye.Trigger,{ref:s,className:Nr("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[a,t.jsx(c.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Cc.displayName=ye.Trigger.displayName;const kc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsx(ye.Content,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:t.jsx("div",{className:Nr("pb-4 pt-0",e),children:a})}));kc.displayName=ye.Content.displayName;const Sc=te.forwardRef(({...e},a)=>t.jsx("nav",{ref:a,"aria-label":"breadcrumb",...e}));Sc.displayName="Breadcrumb";const Ac=te.forwardRef(({className:e,...a},r)=>t.jsx("ol",{ref:r,className:Nr("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...a}));Ac.displayName="BreadcrumbList";const Tc=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:Nr("inline-flex items-center gap-1.5",e),...a}));Tc.displayName="BreadcrumbItem";const Dc=te.forwardRef(({asChild:e,className:a,...s},n)=>{const o=e?r.Slot:"a";return t.jsx(o,{ref:n,className:Nr("transition-colors hover:text-foreground",a),...s})});Dc.displayName="BreadcrumbLink";const Ec=te.forwardRef(({className:e,...a},r)=>t.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Nr("font-normal text-foreground",e),...a}));Ec.displayName="BreadcrumbPage";const Pc=({children:e,className:a,...r})=>t.jsx("li",{role:"presentation","aria-hidden":"true",className:Nr("[&>svg]:h-3.5 [&>svg]:w-3.5",a),...r,children:e??t.jsx(c.ChevronRight,{})});Pc.displayName="BreadcrumbSeparator";const Ic=({className:e,...a})=>t.jsxs("span",{role:"presentation","aria-hidden":"true",className:Nr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Mais"})]});Ic.displayName="BreadcrumbEllipsis";const Mc=s.cva("flex items-center",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}}),Rc=te.forwardRef(({className:e,orientation:a,...r},s)=>t.jsx("div",{ref:s,className:Nr(Mc({orientation:a}),e),...r}));Rc.displayName="ButtonGroup";const Lc={"pt-BR":Ja,"en-US":wt,"es-ES":Ha};function Fc({className:e,classNames:a,showOutsideDays:r=!0,captionLayout:s,fromYear:n,toYear:o,startMonth:i,endMonth:l,...d}){const{i18n:u}=y.useTranslation(),m=Lc[u.language]??Ja,p=te.useMemo(()=>i??(n?new Date(n,0,1):void 0),[i,n]),h=te.useMemo(()=>l??(o?new Date(o,11,31):void 0),[l,o]),x=s?.startsWith("dropdown");return t.jsx(I.DayPicker,{showOutsideDays:r,className:Nr("p-3 pointer-events-auto",e),locale:m,captionLayout:s,startMonth:p,endMonth:h,classNames:{months:"relative flex flex-col gap-4 sm:flex-row",month:"flex flex-col gap-4",month_caption:Nr("flex h-9 w-full items-center px-8",x?"justify-center gap-1.5":"justify-center"),nav:Nr("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1 px-1","dropdown"===s&&"hidden"),button_previous:Nr(Cr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:Nr(Cr({variant:"outline"}),"z-10 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal w-9",week:"mt-2 flex w-full",day:"group/day relative h-9 w-9 select-none p-0 text-center text-sm [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md focus-within:relative focus-within:z-20",day_button:Nr(Cr({variant:"ghost"}),"h-9 w-9 p-0 font-normal transition-none aria-selected:opacity-100"),range_start:"bg-accent rounded-l-md",range_end:"bg-accent rounded-r-md",range_middle:"rounded-none aria-selected:bg-accent aria-selected:text-accent-foreground",selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground rounded-md",today:"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",dropdowns:"flex items-center gap-1.5",dropdown_root:"relative inline-flex items-center",dropdown:Nr("cursor-pointer appearance-none rounded-md border border-input bg-background","h-8 pl-2.5 pr-7 text-sm font-medium text-foreground","hover:border-primary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","transition-colors","bg-[right_0.5rem_center] bg-no-repeat","bg-[url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='hsl(215%2016%25%2047%25)'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E\")]"),caption_label:x?"sr-only":"text-sm font-medium",...a},components:{Chevron:({orientation:e})=>"left"===e?t.jsx(c.ChevronLeft,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})},...d})}Fc.displayName="Calendar";const zc={Root:function({children:e,className:a}){return t.jsx("div",{className:Nr("space-y-4",a),children:e})},Item:function({children:e,onClick:a,className:r}){return t.jsx(Er,{className:Nr("transition-colors",a&&"cursor-pointer hover:bg-muted/50",r),onClick:a,children:t.jsx(Rr,{className:"p-4",children:e})})},Field:function({label:e,value:a,className:r}){return t.jsxs("div",{className:Nr("flex justify-between items-center text-sm",r),children:[t.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),t.jsx("span",{className:"text-foreground",children:a})]})}};const Uc=({shouldScaleBackground:e=!0,...a})=>t.jsx(M.Drawer.Root,{shouldScaleBackground:e,...a});Uc.displayName="Drawer";const Oc=M.Drawer.Trigger,Bc=M.Drawer.Portal,qc=M.Drawer.Close,$c=te.forwardRef(({className:e,...a},r)=>t.jsx(M.Drawer.Overlay,{ref:r,className:Nr("fixed inset-0 z-50 bg-black/80",e),...a}));$c.displayName=M.Drawer.Overlay.displayName;const Vc=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Bc,{children:[t.jsx($c,{}),t.jsxs(M.Drawer.Content,{ref:s,className:Nr("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[t.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),a]})]}));Vc.displayName="DrawerContent";const Wc=({className:e,...a})=>t.jsx("div",{className:Nr("grid gap-1.5 p-4 text-center sm:text-left",e),...a});Wc.displayName="DrawerHeader";const Hc=({className:e,...a})=>t.jsx("div",{className:Nr("mt-auto flex flex-col gap-2 p-4",e),...a});Hc.displayName="DrawerFooter";const Gc=te.forwardRef(({className:e,...a},r)=>t.jsx(M.Drawer.Title,{ref:r,className:Nr("text-lg font-semibold leading-none tracking-tight",e),...a}));Gc.displayName=M.Drawer.Title.displayName;const Kc=te.forwardRef(({className:e,...a},r)=>t.jsx(M.Drawer.Description,{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));Kc.displayName=M.Drawer.Description.displayName;const Yc={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},Qc={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};const Xc=we.Root,Jc=we.Trigger,Zc=te.forwardRef(({className:e,align:a="center",sideOffset:r=4,...s},n)=>t.jsx(we.Content,{ref:n,align:a,sideOffset:r,className:Nr("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));Zc.displayName=we.Content.displayName;const ed=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-slot":"input-group",className:Nr("flex min-w-0 items-center rounded-md border border-input bg-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background","has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50","has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50",e),...a}));ed.displayName="InputGroup";const td=s.cva("flex items-center justify-center text-sm text-muted-foreground shrink-0",{variants:{align:{"inline-start":"border-r border-input px-3","inline-end":"border-l border-input px-3","block-start":"border-b border-input px-3 py-2 w-full justify-start","block-end":"border-t border-input px-3 py-2 w-full justify-start"}},defaultVariants:{align:"inline-start"}}),ad=te.forwardRef(({className:e,align:a,...r},s)=>t.jsx("div",{ref:s,"data-slot":"input-group-addon",className:Nr(td({align:a}),e),...r}));ad.displayName="InputGroupAddon";const rd=s.cva("",{variants:{size:{xs:"h-6 px-2 text-xs","icon-xs":"h-6 w-6",sm:"h-7 px-3 text-xs","icon-sm":"h-7 w-7"}},defaultVariants:{size:"xs"}}),sd=te.forwardRef(({className:e,size:a,variant:r="ghost",...s},n)=>t.jsx(kr,{ref:n,"data-slot":"input-group-button",variant:r,className:Nr(rd({size:a}),"rounded-none first:rounded-l-md last:rounded-r-md",e),...s}));sd.displayName="InputGroupButton";const nd=te.forwardRef(({className:e,...a},r)=>t.jsx(Ar,{ref:r,"data-slot":"input-group-control",className:Nr("flex-1 border-0 bg-transparent shadow-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));nd.displayName="InputGroupInput";const od=te.forwardRef(({className:e,...a},r)=>t.jsx(As,{ref:r,"data-slot":"input-group-control",className:Nr("flex-1 border-0 bg-transparent shadow-none resize-none","focus-visible:ring-0 focus-visible:ring-offset-0",e),...a}));od.displayName="InputGroupTextarea";const id=te.forwardRef(({className:e,...a},r)=>t.jsx("h1",{ref:r,className:Nr("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",e),...a}));id.displayName="H1";const ld=te.forwardRef(({className:e,...a},r)=>t.jsx("h2",{ref:r,className:Nr("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",e),...a}));ld.displayName="H2";const cd=te.forwardRef(({className:e,...a},r)=>t.jsx("h3",{ref:r,className:Nr("scroll-m-20 text-2xl font-semibold tracking-tight",e),...a}));cd.displayName="H3";const dd=te.forwardRef(({className:e,...a},r)=>t.jsx("h4",{ref:r,className:Nr("scroll-m-20 text-xl font-semibold tracking-tight",e),...a}));dd.displayName="H4";const ud=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:Nr("leading-7 [&:not(:first-child)]:mt-6",e),...a}));ud.displayName="P";const md=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:Nr("text-xl text-muted-foreground",e),...a}));md.displayName="Lead";const pd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,className:Nr("text-lg font-semibold",e),...a}));pd.displayName="Large";const hd=te.forwardRef(({className:e,...a},r)=>t.jsx("small",{ref:r,className:Nr("text-sm font-medium leading-none",e),...a}));hd.displayName="Small";const xd=te.forwardRef(({className:e,...a},r)=>t.jsx("p",{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));xd.displayName="Muted";const fd=te.forwardRef(({className:e,...a},r)=>t.jsx("code",{ref:r,className:Nr("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),...a}));fd.displayName="InlineCode";const gd=te.forwardRef(({className:e,...a},r)=>t.jsx("blockquote",{ref:r,className:Nr("mt-6 border-l-2 pl-6 italic",e),...a}));gd.displayName="Blockquote";const bd=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:Nr("my-6 ml-6 list-disc [&>li]:mt-2",e),...a}));bd.displayName="List";const vd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Root,{ref:s,className:Nr("relative z-10 flex max-w-max flex-1 items-center justify-center",e),...r,children:[a,t.jsx(kd,{})]}));vd.displayName=je.Root.displayName;const yd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.List,{ref:r,className:Nr("group flex flex-1 list-none items-center justify-center space-x-1",e),...a}));yd.displayName=je.List.displayName;const wd=je.Item,jd=s.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),Nd=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(je.Trigger,{ref:s,className:Nr(jd(),"group",e),...r,children:[a," ",t.jsx(c.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));Nd.displayName=je.Trigger.displayName;const _d=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Content,{ref:r,className:Nr("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",e),...a}));_d.displayName=je.Content.displayName;const Cd=je.Link,kd=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{className:Nr("absolute left-0 top-full flex justify-center"),children:t.jsx(je.Viewport,{className:Nr("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",e),ref:r,...a})}));kd.displayName=je.Viewport.displayName;const Sd=te.forwardRef(({className:e,...a},r)=>t.jsx(je.Indicator,{ref:r,className:Nr("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",e),...a,children:t.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));Sd.displayName=je.Indicator.displayName;const Ad=({className:e,...a})=>t.jsx("nav",{role:"navigation","aria-label":"pagination",className:Nr("mx-auto flex w-full justify-center",e),...a});Ad.displayName="Pagination";const Td=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,className:Nr("flex flex-row items-center gap-1",e),...a}));Td.displayName="PaginationContent";const Dd=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,className:Nr("",e),...a}));Dd.displayName="PaginationItem";const Ed=({className:e,isActive:a,size:r="icon",...s})=>t.jsx("a",{"aria-current":a?"page":void 0,className:Nr(Cr({variant:a?"outline":"ghost",size:r}),e),...s});Ed.displayName="PaginationLink";const Pd=({className:a,...r})=>t.jsxs(Ed,{"aria-label":e.t("go_to_previous_page"),size:"default",className:Nr("gap-1 pl-2.5",a),...r,children:[t.jsx(c.ChevronLeft,{className:"h-4 w-4"}),t.jsx("span",{children:"Previous"})]});Pd.displayName="PaginationPrevious";const Id=({className:a,...r})=>t.jsxs(Ed,{"aria-label":e.t("go_to_next_page"),size:"default",className:Nr("gap-1 pr-2.5",a),...r,children:[t.jsx("span",{children:"Next"}),t.jsx(c.ChevronRight,{className:"h-4 w-4"})]});Id.displayName="PaginationNext";const Md=({className:e,...a})=>t.jsxs("span",{"aria-hidden":!0,className:Nr("flex h-9 w-9 items-center justify-center",e),...a,children:[t.jsx(c.MoreHorizontal,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"More pages"})]});Md.displayName="PaginationEllipsis";const Rd=te.forwardRef(({className:e,value:a,...r},s)=>t.jsx(Ne.Root,{ref:s,className:Nr("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:t.jsx(Ne.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));Rd.displayName=Ne.Root.displayName;const Ld=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Root,{className:Nr("grid gap-2",e),...a,ref:r}));Ld.displayName=_e.Root.displayName;const Fd=te.forwardRef(({className:e,...a},r)=>t.jsx(_e.Item,{ref:r,className:Nr("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:t.jsx(_e.Indicator,{className:"flex items-center justify-center",children:t.jsx(c.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Fd.displayName=_e.Item.displayName;const zd=Ce.Panel,Ud=se.Root,Od=se.Trigger,Bd=se.Close,qd=se.Portal,$d=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Overlay,{className:Nr("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));$d.displayName=se.Overlay.displayName;const Vd=s.cva("fixed z-50 flex flex-col bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b max-h-[70vh] data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t max-h-[70vh] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Wd=te.forwardRef(({side:e="right",className:a,children:r,...s},n)=>t.jsxs(qd,{children:[t.jsx($d,{}),t.jsxs(se.Content,{ref:n,className:Nr(Vd({side:e}),a),...s,children:[r,t.jsxs(se.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-0 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wd.displayName=se.Content.displayName;const Hd=({className:e,showSeparator:a=!1,children:r,...s})=>t.jsxs("div",{className:Nr("flex flex-col flex-shrink-0",e),...s,children:[t.jsx("div",{className:"flex flex-col text-left",children:r}),a&&t.jsx(Fr,{className:"mt-2"})]});Hd.displayName="SheetHeader";const Gd=({className:e,...a})=>t.jsx("div",{className:Nr("flex-1 min-h-0 overflow-auto py-4 px-1 -mx-1",e),...a});Gd.displayName="SheetBody";const Kd=({className:e,children:a,...r})=>t.jsxs("div",{className:"flex-shrink-0 pt-4",children:[t.jsx(Fr,{className:"mb-4"}),t.jsx("div",{className:Nr("flex flex-row justify-end gap-2",e),...r,children:a})]});Kd.displayName="SheetFooter";const Yd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Title,{ref:r,className:Nr("text-lg font-semibold text-foreground",e),...a}));Yd.displayName=se.Title.displayName;const Qd=te.forwardRef(({className:e,...a},r)=>t.jsx(se.Description,{ref:r,className:Nr("text-sm text-muted-foreground",e),...a}));Qd.displayName=se.Description.displayName;const Xd="sidebar:state",Jd=te.createContext(null);function Zd(){const e=te.useContext(Jd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const eu=te.forwardRef(({defaultOpen:e=!0,open:a,onOpenChange:r,className:s,style:n,children:o,...i},l)=>{const c=To(),[d,u]=te.useState(!1),[m,p]=te.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(Xd);return null!==t?"true"===t:e}return e}),h=a??m,x=te.useCallback(e=>{const t="function"==typeof e?e(h):e;r?r(t):p(t),"undefined"!=typeof window&&localStorage.setItem(Xd,String(t))},[r,h]),f=te.useCallback(()=>c?u(e=>!e):x(e=>!e),[c,x,u]);te.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const g=h?"expanded":"collapsed",b=te.useMemo(()=>({state:g,open:h,setOpen:x,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:f}),[g,h,x,c,d,u,f]);return t.jsx(Jd.Provider,{value:b,children:t.jsx(Qs,{delayDuration:0,children:t.jsx("div",{className:Nr("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",s),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4rem",...n},ref:l,...i,children:o})})})});eu.displayName="SidebarProvider";const tu=te.forwardRef(({side:e="left",variant:a="sidebar",collapsible:r="offcanvas",className:s,children:n,...o},i)=>{const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Zd();return"none"===r?t.jsx("div",{className:Nr("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:i,...o,children:n}):l?t.jsx(Ud,{open:d,onOpenChange:u,...o,children:t.jsxs(Wd,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[t.jsx(Yd,{className:"sr-only",children:"Menu de Navegação"}),t.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):t.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":c,"data-collapsible":"collapsed"===c?r:"","data-variant":a,"data-side":e,children:[t.jsx("div",{className:Nr("duration-200 relative h-[calc(100svh-var(--header-height,0px))] w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:Nr("duration-200 fixed z-30 hidden w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex overflow-visible","top-[var(--header-height,0px)] h-[calc(100svh-var(--header-height,0px))]","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col overflow-visible group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:n})})]})});tu.displayName="Sidebar";const au=te.forwardRef(({className:e,onClick:a,...r},s)=>{const{toggleSidebar:n}=Zd();return t.jsxs(kr,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Nr("h-7 w-7",e),onClick:e=>{a?.(e),n()},...r,children:[t.jsx(c.PanelLeft,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});au.displayName="SidebarTrigger";const ru=te.forwardRef(({className:e,...a},r)=>{const{toggleSidebar:s}=Zd();return t.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:Nr("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...a})});ru.displayName="SidebarRail";const su=te.forwardRef(({className:e,...a},r)=>t.jsx("main",{ref:r,className:Nr("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...a}));su.displayName="SidebarInset";const nu=te.forwardRef(({className:e,...a},r)=>t.jsx(Ar,{ref:r,"data-sidebar":"input",className:Nr("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...a}));nu.displayName="SidebarInput";const ou=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"header",className:Nr("flex flex-col gap-2 p-2",e),...a}));ou.displayName="SidebarHeader";const iu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"footer",className:Nr("flex flex-col gap-2 p-2",e),...a}));iu.displayName="SidebarFooter";const lu=te.forwardRef(({className:e,...a},r)=>t.jsx(Fr,{ref:r,"data-sidebar":"separator",className:Nr("mx-2 w-auto bg-sidebar-border",e),...a}));lu.displayName="SidebarSeparator";const cu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"content",className:Nr("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...a}));cu.displayName="SidebarContent";const du=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group",className:Nr("relative flex w-full min-w-0 flex-col p-2",e),...a}));du.displayName="SidebarGroup";const uu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"div";return t.jsx(o,{ref:n,"data-sidebar":"group-label",className:Nr("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...s})});uu.displayName="SidebarGroupLabel";const mu=te.forwardRef(({className:e,asChild:a=!1,...s},n)=>{const o=a?r.Slot:"button";return t.jsx(o,{ref:n,"data-sidebar":"group-action",className:Nr("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...s})});mu.displayName="SidebarGroupAction";const pu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group-content",className:Nr("w-full text-sm",e),...a}));pu.displayName="SidebarGroupContent";const hu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu",className:Nr("flex w-full min-w-0 flex-col gap-1",e),...a}));hu.displayName="SidebarMenu";const xu=te.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Nr("group/menu-item relative",e),...a}));xu.displayName="SidebarMenuItem";const fu=s.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),gu=te.forwardRef(({asChild:e=!1,isActive:a=!1,variant:s="default",size:n="default",tooltip:o,className:i,...l},c)=>{const d=e?r.Slot:"button",{isMobile:u,state:m}=Zd(),p=t.jsx(d,{ref:c,"data-sidebar":"menu-button","data-size":n,"data-active":a,className:Nr(fu({variant:s,size:n}),i),...l});return o?("string"==typeof o&&(o={children:o}),t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:p}),t.jsx(Zs,{side:"right",align:"center",hidden:"collapsed"!==m||u,...o})]})):p});gu.displayName="SidebarMenuButton";const bu=te.forwardRef(({className:e,asChild:a=!1,showOnHover:s=!1,...n},o)=>{const i=a?r.Slot:"button";return t.jsx(i,{ref:o,"data-sidebar":"menu-action",className:Nr("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",s&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});bu.displayName="SidebarMenuAction";const vu=te.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Nr("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...a}));vu.displayName="SidebarMenuBadge";const yu=te.forwardRef(({className:e,showIcon:a=!1,...r},s)=>{const n=te.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return t.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:Nr("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[a&&t.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});yu.displayName="SidebarMenuSkeleton";const wu=te.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Nr("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...a}));wu.displayName="SidebarMenuSub";const ju=te.forwardRef(({...e},a)=>t.jsx("li",{ref:a,...e}));ju.displayName="SidebarMenuSubItem";const Nu=te.forwardRef(({asChild:e=!1,size:a="md",isActive:s,className:n,...o},i)=>{const l=e?r.Slot:"a";return t.jsx(l,{ref:i,"data-sidebar":"menu-sub-button","data-size":a,"data-active":s,className:Nr("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});Nu.displayName="SidebarMenuSubButton";const _u=te.forwardRef(({className:e,value:a,defaultValue:r,...s},n)=>{const o=a||r||[0];return t.jsxs(ke.Root,{ref:n,value:a,defaultValue:r,className:Nr("relative flex w-full touch-none select-none items-center",e),...s,children:[t.jsx(ke.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:t.jsx(ke.Range,{className:"absolute h-full bg-primary"})}),o.map((e,a)=>t.jsx(ke.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},a))]})});_u.displayName=ke.Root.displayName;const Cu=Se.Menu,ku=Se.Group,Su=Se.Portal,Au=Se.Sub,Tu=Se.RadioGroup,Du=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Root,{ref:r,className:Nr("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",e),...a}));Du.displayName=Se.Root.displayName;const Eu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Trigger,{ref:r,className:Nr("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...a}));Eu.displayName=Se.Trigger.displayName;const Pu=te.forwardRef(({className:e,inset:a,children:r,...s},n)=>t.jsxs(Se.SubTrigger,{ref:n,className:Nr("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",a&&"pl-8",e),...s,children:[r,t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Pu.displayName=Se.SubTrigger.displayName;const Iu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.SubContent,{ref:r,className:Nr("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));Iu.displayName=Se.SubContent.displayName;const Mu=te.forwardRef(({className:e,align:a="start",alignOffset:r=-4,sideOffset:s=8,...n},o)=>t.jsx(Se.Portal,{children:t.jsx(Se.Content,{ref:o,align:a,alignOffset:r,sideOffset:s,className:Nr("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Mu.displayName=Se.Content.displayName;const Ru=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Item,{ref:s,className:Nr("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",e),...r}));Ru.displayName=Se.Item.displayName;const Lu=te.forwardRef(({className:e,children:a,checked:r,...s},n)=>t.jsxs(Se.CheckboxItem,{ref:n,className:Nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Check,{className:"h-4 w-4"})})}),a]}));Lu.displayName=Se.CheckboxItem.displayName;const Fu=te.forwardRef(({className:e,children:a,...r},s)=>t.jsxs(Se.RadioItem,{ref:s,className:Nr("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Se.ItemIndicator,{children:t.jsx(c.Circle,{className:"h-2 w-2 fill-current"})})}),a]}));Fu.displayName=Se.RadioItem.displayName;const zu=te.forwardRef(({className:e,inset:a,...r},s)=>t.jsx(Se.Label,{ref:s,className:Nr("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",e),...r}));zu.displayName=Se.Label.displayName;const Uu=te.forwardRef(({className:e,...a},r)=>t.jsx(Se.Separator,{ref:r,className:Nr("-mx-1 my-1 h-px bg-muted",e),...a}));Uu.displayName=Se.Separator.displayName;const Ou=({className:e,...a})=>t.jsx("span",{className:Nr("ml-auto text-xs tracking-widest text-muted-foreground",e),...a});Ou.displayname="MenubarShortcut";const Bu={light:"",dark:".dark"},qu=te.createContext(null);function $u(){const e=te.useContext(qu);if(!e)throw new Error("useChart must be used within a <ChartContainer />");return e}const Vu=te.forwardRef(({id:e,className:a,children:r,config:s,...n},o)=>{const i=te.useId(),l=`chart-${e||i.replace(/:/g,"")}`;return t.jsx(qu.Provider,{value:{config:s},children:t.jsxs("div",{"data-chart":l,ref:o,className:Nr("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...n,children:[t.jsx(Wu,{id:l,config:s}),t.jsx(Ae.ResponsiveContainer,{children:r})]})})});Vu.displayName="Chart";const Wu=({id:e,config:a})=>{const r=Object.entries(a).filter(([,e])=>e.theme||e.color);return r.length?t.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Bu).map(([t,a])=>`\n${a} [data-chart=${e}] {\n${r.map(([e,a])=>{const r=a.theme?.[t]||a.color;return r?` --color-${e}: ${r};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Hu=Ae.Tooltip,Gu=te.forwardRef(({active:e,payload:a,className:r,indicator:s="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:l,labelClassName:c,formatter:d,color:u,nameKey:m,labelKey:p},h)=>{const{config:x}=$u(),f=te.useMemo(()=>{if(n||!a?.length)return null;const[e]=a,r=Qu(x,e,`${p||e?.dataKey||e?.name||"value"}`),s=p||"string"!=typeof i?r?.label:x[i]?.label||i;return l?t.jsx("div",{className:Nr("font-medium",c),children:l(s,a)}):s?t.jsx("div",{className:Nr("font-medium",c),children:s}):null},[i,l,a,n,c,x,p]);if(!e||!a?.length)return null;const g=1===a.length&&"dot"!==s;return t.jsxs("div",{ref:h,className:Nr("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[g?null:f,t.jsx("div",{className:"grid gap-1.5",children:a.map((e,a)=>{const r=`${m||e.name||e.dataKey||"value"}`,n=Qu(x,e,r),i=u||e.payload?.fill||e.color;return t.jsx("div",{className:Nr("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===s&&"items-center"),children:d&&void 0!==e?.value&&e.name?d(e.value,e.name,e,a,e.payload):t.jsxs(t.Fragment,{children:[n?.icon?t.jsx(n.icon,{}):!o&&t.jsx("div",{className:Nr("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===s,"w-1":"line"===s,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===s,"my-0.5":g&&"dashed"===s}),style:{"--color-bg":i,"--color-border":i}}),t.jsxs("div",{className:Nr("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[t.jsxs("div",{className:"grid gap-1.5",children:[g?f:null,t.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),void 0!==e.value&&t.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:"number"==typeof e.value?e.value.toLocaleString():e.value})]})]})},e.dataKey||a)})})]})});Gu.displayName="ChartTooltip";const Ku=Ae.Legend,Yu=te.forwardRef(({className:e,hideIcon:a=!1,payload:r,verticalAlign:s="bottom",nameKey:n},o)=>{const{config:i}=$u();return r?.length?t.jsx("div",{ref:o,className:Nr("flex items-center justify-center gap-4","top"===s?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${n||e.dataKey||"value"}`,s=Qu(i,e,r);return t.jsxs("div",{className:Nr("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[s?.icon&&!a?t.jsx(s.icon,{}):t.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),s?.label]},e.value)})}):null});function Qu(e,t,a){if("object"!=typeof t||null===t)return;const r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let s=a;return a in t&&"string"==typeof t[a]?s=t[a]:r&&a in r&&"string"==typeof r[a]&&(s=r[a]),s in e?e[s]:e[a]}Yu.displayName="ChartLegend";const Xu=({onClick:e,isActive:a,disabled:r,children:s,title:n})=>t.jsx("button",{type:"button",onClick:e,disabled:r,title:n,className:Nr("p-1.5 rounded hover:bg-muted transition-colors",a?"bg-muted text-primary":"text-muted-foreground",r&&"opacity-50 cursor-not-allowed"),children:s}),Ju=()=>t.jsx("div",{className:"w-px h-5 bg-border mx-1"});function Zu({image:e,title:a,className:r}){return t.jsx("div",{className:Nr("relative w-full aspect-video bg-muted rounded-lg overflow-hidden","max-h-[25vh] sm:max-h-[35vh]",r),children:e?t.jsx("img",{src:e,alt:a,className:"w-full h-full object-cover"}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(c.ImageIcon,{className:"w-16 h-16 text-muted-foreground"})})})}function em({steps:e,currentStepIndex:a,onStepSelect:r,stepLabel:s,className:n}){const{t:o}=y.useTranslation(),i=e.length,l=(a+1)/i*100;return t.jsxs("div",{className:Nr("flex items-center gap-3",n),children:[t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsxs(kr,{variant:"ghost",size:"sm",className:"h-8 px-2 text-sm",children:[s," ",a+1,"/",i,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx($s,{align:"start",children:e.map((e,s)=>t.jsxs(Vs,{onClick:()=>r(s),className:Nr(s===a&&"bg-accent"),children:[s+1,". ",e.title]},e.id))})]}),t.jsx(Rd,{value:l,className:"w-32 h-2"})]})}function tm({currentStepIndex:e,totalSteps:a,onBack:r,onNext:s,onComplete:n,backButtonText:o,continueButtonText:i,finishButtonText:l,className:d}){const{t:u}=y.useTranslation(),m=0===e,p=e===a-1;return t.jsxs("div",{className:Nr("flex items-center gap-2",d),children:[!m&&t.jsxs(kr,{variant:"outline",onClick:r,size:"sm",children:[t.jsx(c.ArrowLeft,{className:"h-4 w-4 mr-2"}),o]}),t.jsxs(kr,{onClick:p?n:s,size:"sm",children:[p?l:i,!p&&t.jsx(c.ArrowRight,{className:"h-4 w-4 ml-2"})]})]})}const am=te.forwardRef(({open:a,onOpenChange:r,steps:s,onComplete:n,onStepChange:o,continueButtonText:i="Continuar",backButtonText:l="Voltar",finishButtonText:d="Concluir",stepLabel:u=e.t("approval_step_label"),size:m="md",showProgressIndicator:p=!0,currentStepIndex:h,onCurrentStepChange:x,className:f},g)=>{const[b,v]=te.useState(0),y=void 0!==h,w=y?h:b,j=te.useCallback(e=>{y?x?.(e):v(e),o?.(e)},[y,x,o]);te.useEffect(()=>{a||y||v(0)},[a,y]);const N=s[w],_=s.length;return N?t.jsx(Yr,{open:a,onOpenChange:r,children:t.jsxs(ts,{ref:g,size:m,variant:"informative",className:Nr("p-0 gap-0 overflow-hidden",f),children:[t.jsxs(Jr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10",children:[t.jsx(c.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Fechar"})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(Zu,{image:N.image,title:N.title}),t.jsx(ns,{className:"text-xl font-semibold",children:N.title}),t.jsx(os,{className:"text-muted-foreground",children:N.description})]})}),t.jsxs("div",{className:"flex-shrink-0",children:[t.jsx(Fr,{}),t.jsxs("div",{className:"p-4 flex flex-wrap items-center justify-between gap-2",children:[p&&_>1?t.jsx(em,{steps:s,currentStepIndex:w,onStepSelect:e=>{j(e)},stepLabel:u}):t.jsx("div",{}),t.jsx(tm,{currentStepIndex:w,totalSteps:_,onBack:()=>{w>0&&j(w-1)},onNext:()=>{w<_-1&&j(w+1)},onComplete:()=>{n?.(),r(!1)},backButtonText:l,continueButtonText:i,finishButtonText:d})]})]})]})}):null});function rm({label:e,onClick:a,icon:r,actions:s=[],variant:n="default",size:o="default",disabled:i=!1,loading:l=!1,menuAlign:d="end",className:u}){const{t:m}=y.useTranslation(),p=i||l;if(!(s.length>0))return t.jsxs(kr,{variant:n,size:o,disabled:p,onClick:a,className:u,children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]});return t.jsxs("div",{className:Nr("inline-flex rounded-md shadow-sm",u),children:[t.jsxs(kr,{variant:n,size:o,disabled:p,onClick:a,className:"rounded-r-none border-r-0 focus:z-10",children:[l?t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):r?t.jsx(r,{className:"mr-2 h-4 w-4"}):null,e]}),t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsx(kr,{variant:n,size:o,disabled:p,className:Nr("rounded-l-none focus:z-10",{sm:"w-7 min-w-7 px-0",default:"w-8 min-w-8 px-0",lg:"w-9 min-w-9 px-0"}[o]),"aria-label":m("more_options"),children:t.jsx(c.ChevronDown,{className:{sm:"h-3 w-3",default:"h-4 w-4",lg:"h-4 w-4"}[o]})})}),t.jsx($s,{align:d,className:"min-w-[160px]",children:s.map(e=>{const a=e.icon;return t.jsxs(Vs,{onClick:e.onClick,disabled:e.disabled,className:Nr("destructive"===e.variant&&"text-destructive focus:text-destructive"),children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})]})}am.displayName="OnboardingDialog";var sm=(e=>(e.CSV="csv",e.PDF="pdf",e.XLSX="xlsx",e.PNG="png",e.JPEG="jpeg",e.SVG="svg",e))(sm||{});const nm=[{value:"csv",label:"CSV",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})},{value:"xlsx",label:"XLSX",icon:t.jsx(c.FileSpreadsheet,{className:"h-5 w-5"})}],om=[{value:"png",label:"PNG",icon:t.jsx(c.Image,{className:"h-5 w-5"})},{value:"jpeg",label:"JPEG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"svg",label:"SVG",icon:t.jsx(c.FileImage,{className:"h-5 w-5"})},{value:"pdf",label:"PDF",icon:t.jsx(c.FileText,{className:"h-5 w-5"})}];const im=a.forwardRef(({value:e,onChange:r,onTimeChange:s,label:n,error:o,format:i="24h",className:l,id:d,...u},m)=>{const p=d??te.useId(),h=a.useCallback(e=>{const t=e.target.value;r?.(t),s?.(t)},[r,s]),x=a.useCallback(e=>{["0","1","2","3","4","5","6","7","8","9","Backspace","Tab",":","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault()},[]);return t.jsxs("div",{className:Nr("grid gap-1.5",l),children:[n&&t.jsx(Dr,{htmlFor:p,children:n}),t.jsxs("div",{className:"relative",children:[t.jsx(Ar,{ref:m,id:p,type:"time",value:e??"",onChange:h,onKeyDown:x,min:"00:00",max:"23:59",step:60,className:Nr("pr-9",o&&"border-destructive focus-visible:ring-destructive"),...u}),t.jsx(c.Clock,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]}),o&&t.jsx("p",{className:"text-sm text-destructive",children:o})]})});function lm({currentStep:e,totalSteps:a,onStepChange:r,stepLabels:s,canGoToStep:n,className:o,progressWidth:i="w-32"}){te.useEffect(()=>{process.env.NODE_ENV},[]);const l=Array.from({length:a},(e,t)=>t+1),d=t=>!(t<=e)&&(!!n&&!n(t));return t.jsxs("div",{className:Nr("flex items-center gap-3",o),children:[t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsxs(kr,{variant:"ghost",size:"sm",className:"h-auto py-1 px-2 text-sm text-muted-foreground hover:text-foreground",children:["Etapa ",e,"/",a,t.jsx(c.ChevronDown,{className:"h-3 w-3 ml-1"})]})}),t.jsx($s,{align:"start",children:l.map(a=>t.jsxs(Vs,{onClick:()=>{var t;(t=a)<e?r(t):n&&!n(t)||r(t)},disabled:d(a),className:Nr("cursor-pointer",a===e&&"bg-muted font-medium",d(a)&&"opacity-50 cursor-not-allowed"),children:[t.jsxs("span",{className:"mr-2 text-muted-foreground",children:[a,"."]}),s?.[a-1]||`Etapa ${a}`,a===e&&t.jsx(c.Check,{className:"h-4 w-4 ml-auto"})]},a))})]}),t.jsx(Rd,{value:e/a*100,className:Nr("h-2",i)})]})}function cm(e){const t=$n.getAccessToken(),a={"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{},"un-alias":e};if(t)try{const e=JSON.parse(atob(t.split(".")[1]));e.sub&&(a["x-waf-rate"]=btoa(e.sub))}catch{}return a}async function dm(e,t,a){let r=await fetch(e,t);if(401===r.status){if(await io.handleApiError({status:401})){const s={...t,headers:cm(a)};r=await fetch(e,s)}}return r}function um(e){const[t,r]=a.useState([]),[s,n]=a.useState(0),[o,i]=a.useState(!1);a.useEffect(()=>{if(!e)return;let t=!1;const a=`${Ge().replace(/\/?$/,"/")}api/common/v1/updates/listUpdatesNotification`;return async function(){i(!0);try{const s=cm(e),o=await dm(a,{method:"GET",headers:s},e);if(!o.ok)return;const i=await o.json();!t&&i.data?.[0]&&(r(i.data[0].updates??[]),n(i.data[0].valueBadge??0))}catch(s){}finally{t||i(!1)}}(),()=>{t=!0}},[e]);const l=a.useCallback(async()=>{if(!e||s<=0||0===t.length)return;const a=t[0].id,r=`${Ge().replace(/\/?$/,"/")}api/common/v1/Updates/userVisualized/3/undefined`;n(0);try{const t=cm(e),s=JSON.stringify({id:a,idUpdateType:3});await dm(r,{method:"POST",headers:t,body:s},e)}catch(o){}},[e,s,t]);return{updates:t,badgeCount:s,loading:o,markAsVisualized:l}}im.displayName="Timepicker";const mm=a.forwardRef(({updates:a,badgeCount:r,onOpen:s,onViewAll:n},o)=>{const i=void 0===a,l=ko(),d=l?.alias??null,u=um(i?d:null),m=i?u.updates??[]:a,p=i?u.badgeCount??0:r??0,h=s??(i?u.markAsVisualized:void 0),x=n??(i&&d?()=>{window.open(`${window.location.origin}/common/${d}/up/view`,"_blank","noopener,noreferrer")}:void 0);return t.jsxs(tn,{children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{ref:o,variant:"ghost",size:"sm",className:"relative h-9 w-9 p-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:h,title:e.t("updates"),children:[t.jsx(c.Coffee,{className:"h-7 w-7"}),p>0&&t.jsx("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:p>99?"99+":p})]})}),t.jsxs(rn,{align:"end",className:"w-80 p-0",children:[t.jsx("div",{className:"border-b border-border px-4 py-3",children:t.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Atualizações"})}),t.jsx("div",{className:"max-h-72 overflow-y-auto",children:m.length>0?t.jsx("ul",{className:"divide-y divide-border",children:m.map(e=>t.jsxs("li",{className:"px-4 py-3 hover:bg-muted/50 transition-colors cursor-pointer",onClick:x,children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.title}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.text})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center",children:[t.jsx(c.Coffee,{className:"h-8 w-8 text-muted-foreground mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhum café quentinho, ou melhor, atualização quentinha no momento!"})]})}),t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.jsxs(kr,{variant:"ghost",size:"sm",className:"w-full justify-between text-primary hover:text-primary",onClick:x,children:["Ver todas as atualizações",t.jsx(c.ArrowRight,{className:"h-[18px] w-[18px]"})]})})]})]})});mm.displayName="UpdatesNotification";var pm=(e=>(e[e.none=0]="none",e[e.image=1]="image",e[e.video=2]="video",e[e.audio=3]="audio",e[e.wopi=4]="wopi",e[e.onlineEditor=5]="onlineEditor",e[e.report=6]="report",e))(pm||{}),hm=(e=>(e[e.SimplePrint=0]="SimplePrint",e[e.ManagedCopy=1]="ManagedCopy",e[e.NonManagedCopy=2]="NonManagedCopy",e))(hm||{});const xm={".jpg":1,".jpeg":1,".png":1,".bmp":1,".gif":1,".svg":1,".webp":1,".wav":3,".mp3":3,".mp4":2,".webm":2,".ogg":2,".pdf":4,".ods":4,".xls":4,".xlsb":4,".xlsm":4,".xlsx":4,".doc":4,".docm":4,".docx":4,".dot":4,".dotm":4,".dotx":4,".odt":4,".odp":4,".pot":4,".potm":4,".potx":4,".pps":4,".ppsm":4,".ppsx":4,".ppt":4,".pptm":4,".pptx":4,".gdocs":5,".gsheets":5};function fm(e){const{t:t}=y.useTranslation();return e?xm[e.toLowerCase()]??0:0}const gm={".pdf":"wv/wordviewerframe.aspx?PdfMode=1&",".xls":"x/_layouts/xlviewerinternal.aspx?",".xlsb":"x/_layouts/xlviewerinternal.aspx?",".xlsm":"x/_layouts/xlviewerinternal.aspx?",".xlsx":"x/_layouts/xlviewerinternal.aspx?",".ods":"x/_layouts/xlviewerinternal.aspx?",".doc":"wv/wordviewerframe.aspx?",".docm":"wv/wordviewerframe.aspx?",".docx":"wv/wordviewerframe.aspx?",".dot":"wv/wordviewerframe.aspx?",".dotm":"wv/wordviewerframe.aspx?",".dotx":"wv/wordviewerframe.aspx?",".odt":"wv/wordviewerframe.aspx?",".ppt":"p/PowerPointFrame.aspx?",".pptm":"p/PowerPointFrame.aspx?",".pptx":"p/PowerPointFrame.aspx?",".pot":"p/PowerPointFrame.aspx?",".potm":"p/PowerPointFrame.aspx?",".potx":"p/PowerPointFrame.aspx?",".pps":"p/PowerPointFrame.aspx?",".ppsm":"p/PowerPointFrame.aspx?",".ppsx":"p/PowerPointFrame.aspx?",".odp":"p/PowerPointFrame.aspx?"};function bm(e){const{t:t}=y.useTranslation();return gm[e?.toLowerCase()]||""}function vm(e){const{t:t}=y.useTranslation(),a=e%60;return`${Math.floor(e/60)}min ${a<10?"0":""}${a}`}function ym({open:e,onOpenChange:r,url:s,title:n,className:o,minHeight:i="250px"}){const{t:l}=y.useTranslation(),d=a.useCallback(()=>{r(!1)},[r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&d()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,d]),t.jsx(Yr,{open:e,onOpenChange:r,children:t.jsxs(ts,{className:Nr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",o),children:[t.jsxs("div",{className:"flex items-center justify-end mb-2.5",children:[n&&t.jsx("h2",{className:"text-lg font-medium text-foreground truncate mr-auto",children:n}),t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Zs,{children:"Fechar"})]})]}),t.jsx("iframe",{src:s,className:"border-none w-full",style:{minHeight:i},title:n||l("embedded_content")})]})})}function wm({term:r,open:s,onClose:n,onSign:o,viewOnly:i=!1,title:l=e.t("terms_of_use"),signLabel:d=e.t("terms_read_agree")}){const u=a.useMemo(()=>r.file?function(e,t=""){const{t:a}=y.useTranslation(),r=atob(e),s=[];for(let o=0;o<r.length;o+=512){const e=r.slice(o,o+512),t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);s.push(new Uint8Array(t))}const n=new Blob(s,{type:t});return URL.createObjectURL(n)}(r.file,r.type):null,[r.file,r.type]),m=a.useCallback(()=>{u&&URL.revokeObjectURL(u),n()},[u,n]),p=a.useCallback(()=>{r.hasUserSignature?m():o?.(r.id)},[r,o,m]),h=!i&&!r.hasUserSignature&&o;return t.jsx(Yr,{open:s,onOpenChange:e=>!e&&m(),children:t.jsxs(ts,{className:Nr("flex flex-col p-0 sm:max-w-[80vw] h-[95vh]","[&>button.absolute]:hidden"),children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[t.jsx(c.FileText,{className:"h-5 w-5 text-primary"}),l]}),t.jsxs("div",{className:"flex items-center gap-2",children:[h&&t.jsx(kr,{size:"sm",onClick:p,children:d}),t.jsx(kr,{variant:"ghost",size:"icon",onClick:m,children:t.jsx(c.X,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"flex-1 min-h-0",children:r.file&&u?t.jsx("iframe",{className:"h-full w-full border-0",src:u,title:l}):t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t.jsx("p",{children:"Nenhum termo de uso ativo encontrado."})})})]})})}function jm(e){return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Nm(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function _m(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.allowedIds?.forEach(e=>a.add(e)),r.inheritedIds?.forEach(e=>a.add(e));return a}var Cm=(e=>(e[e.WaitingProcessing=1]="WaitingProcessing",e[e.Processing=2]="Processing",e[e.Completed=3]="Completed",e[e.Error=4]="Error",e[e.Expired=5]="Expired",e))(Cm||{});const km={report:e.t("report"),status:e.t("status"),requestDate:e.t("request_date"),lastUpdate:e.t("last_update"),expirationDate:e.t("expiration_date"),viewReport:e.t("view_report"),searchPlaceholder:e.t("search_report_placeholder"),noResults:e.t("no_reports_found"),statusWaiting:e.t("status_waiting"),statusProcessing:e.t("status_processing"),statusCompleted:e.t("status_completed"),statusError:e.t("status_error"),statusExpired:e.t("status_expired")};function Sm(e){const{t:t}=y.useTranslation();return(e??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function Am(e){const{t:t}=y.useTranslation();return e.toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const Tm={sm:{badge:"px-1.5 py-0.5 text-[11px] gap-1",icon:14},md:{badge:"px-2.5 py-1 text-xs gap-1.5",icon:16},lg:{badge:"px-3 py-1.5 text-sm gap-2",icon:18}};var Dm=(e=>(e.Count="valuecount",e.Sum="sum",e.Average="average",e.DistinctCount="valuecount_distict",e.Max="max",e.Min="min",e))(Dm||{}),Em=(e=>(e.ViewAllAnalysis="nes3j6wn",e))(Em||{}),Pm=(e=>(e.RegisterDashboards="EeKs7CYA",e.RemoveDashboards="3GKZYOQ9",e.ViewAllDashboards="wYBdQNvZ",e.EditDashboards="bMFcbwv4",e))(Pm||{}),Im=(e=>(e[e.Default=1]="Default",e[e.Compact=2]="Compact",e))(Im||{}),Mm=(e=>(e[e.FiveSeconds=1]="FiveSeconds",e[e.TenSeconds=2]="TenSeconds",e[e.FifteenSeconds=3]="FifteenSeconds",e[e.ThirtySeconds=4]="ThirtySeconds",e[e.OneMinute=5]="OneMinute",e[e.ThreeMinutes=6]="ThreeMinutes",e[e.FiveMinutes=7]="FiveMinutes",e[e.TenMinutes=8]="TenMinutes",e))(Mm||{}),Rm=(e=>(e[e.Day=1]="Day",e[e.Month=2]="Month",e[e.Year=3]="Year",e))(Rm||{}),Lm=(e=>(e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending",e))(Lm||{}),Fm=(e=>(e[e.Label=1]="Label",e[e.Value=2]="Value",e))(Fm||{}),zm=(e=>(e[e.LastSevenDays=1]="LastSevenDays",e[e.LastWeek=2]="LastWeek",e[e.LastMonth=3]="LastMonth",e[e.PreviousQuarter=4]="PreviousQuarter",e[e.PreviousSemester=5]="PreviousSemester",e[e.LastYear=6]="LastYear",e[e.SpecificPeriod=7]="SpecificPeriod",e[e.CurrentMonth=8]="CurrentMonth",e[e.CurrentSemester=9]="CurrentSemester",e[e.CurrentWeek=10]="CurrentWeek",e[e.CurrentYear=11]="CurrentYear",e))(zm||{}),Um=(e=>(e[e.Text=1]="Text",e[e.Area=2]="Area",e[e.Bar=3]="Bar",e[e.Column=4]="Column",e[e.StackedColumn=5]="StackedColumn",e[e.Line=6]="Line",e[e.List=7]="List",e[e.Numeric=8]="Numeric",e[e.Pareto=9]="Pareto",e[e.Pie=10]="Pie",e[e.RiskMatrix=11]="RiskMatrix",e[e.Burndown=12]="Burndown",e[e.PerformanceColumns=13]="PerformanceColumns",e[e.EvolutionLine=14]="EvolutionLine",e))(Um||{}),Om=(e=>(e[e.NotUpdate=1]="NotUpdate",e[e.FiveMinutes=2]="FiveMinutes",e[e.TenMinutes=3]="TenMinutes",e[e.FifteenMinutes=4]="FifteenMinutes",e[e.ThirtyMinutes=5]="ThirtyMinutes",e[e.OneHour=6]="OneHour",e))(Om||{}),Bm=(e=>(e[e.NormalPage=1]="NormalPage",e[e.Carousel=2]="Carousel",e))(Bm||{}),qm=(e=>(e[e.General=0]="General",e[e.Share=1]="Share",e))(qm||{}),$m=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))($m||{}),Vm=(e=>(e.PtBr="pt-br",e.EnUs="en",e.EsEs="es",e))(Vm||{}),Wm=(e=>(e[e.Quantity=0]="Quantity",e[e.AllRisksList=1]="AllRisksList",e))(Wm||{}),Hm=(e=>(e[e.Five=5]="Five",e[e.Ten=10]="Ten",e[e.Fifteen=15]="Fifteen",e[e.Twenty=20]="Twenty",e[e.All=0]="All",e[e.Custom=-1]="Custom",e))(Hm||{}),Gm=(e=>(e[e.AlphabeticalAsc=1]="AlphabeticalAsc",e[e.AlphabeticalDesc=2]="AlphabeticalDesc",e[e.CountAsc=3]="CountAsc",e[e.CountDesc=4]="CountDesc",e[e.DateAsc=5]="DateAsc",e[e.DateDesc=6]="DateDesc",e))(Gm||{}),Km=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Error=3]="Error",e[e.NoData=4]="NoData",e[e.Unavailable=5]="Unavailable",e))(Km||{}),Ym=(e=>(e[e.Quantity=1]="Quantity",e[e.Percentage=2]="Percentage",e[e.QuantityPercentage=3]="QuantityPercentage",e))(Ym||{}),Qm=(e=>(e[e.Program=1]="Program",e[e.Project=2]="Project",e[e.Action=3]="Action",e[e.PerformanceProject=4]="PerformanceProject",e[e.PerformanceAction=5]="PerformanceAction",e))(Qm||{}),Xm=(e=>(e.OccurrenceActionPlans="xebGnSSq",e.OccurrenceGeneral="UFws4AvH",e.PlansActionPlans="Kux6CcVC",e.PlansProgramProjects="UWjrp6Dw",e.PlansIdeas="3g7vNm2w",e.RisksGeneral="PZ4b6FhP",e.RisksActionPlans="xZErDg57",e.RisksAnalysis="UxsioMbH",e.RisksIncidences="gNt5IJ2F",e.MetrologyGeneral="4MfEPbRY",e.MetrologyActivities="hdFM9XQW",e.MetrologyServiceOrders="cIrVPdMv",e.DecisionsGeneral="CopsnHDB",e.DecisionsItems="qLFAayjx",e.DecisionsActionPlans="RiQFpxdb",e.FlowGeneral="AFV98JoG",e.AuditGeneral="gON8LJPi",e.AuditPlans="SsCNVOvr",e.AuditPlansItems="OpPkCCFm",e.AuditActionPlans="P1oGePhh",e.CommonGeneral="VVfEzgMQ",e.ActionPlans="C6Z4MgGa",e.SuppliersEvaluations="fSCeS4mH",e.SuppliersGeneral="8qPThkrD",e.SuppliersEvaluationsCriteria="RiSIStdY",e.SuppliersDocuments="Riua4jMa",e.SuppliersMaterialsServices="UpEkatXH",e.DocumentsGeneral="FRhhEX2J",e.DocumentsPhysicalCopies="PZLtJ23h",e.DocumentsObsolete="XDjbga14",e.FmeaGeneral="aPwf4uPr",e.FmeaActionPlans="vQ8PMrVX",e))(Xm||{}),Jm=(e=>(e[e.NotShared=1]="NotShared",e[e.SharedWithAllCollaborators=2]="SharedWithAllCollaborators",e[e.SharedWithUsersGroupsPlacesCollaborators=3]="SharedWithUsersGroupsPlacesCollaborators",e))(Jm||{}),Zm=(e=>(e[e.All=1]="All",e[e.OnlyMine=2]="OnlyMine",e[e.Favorites=3]="Favorites",e))(Zm||{}),ep=(e=>(e[e.Current=1]="Current",e[e.Inherent=2]="Inherent",e))(ep||{}),tp=(e=>(e[e.Default=1]="Default",e[e.Pastel=2]="Pastel",e[e.Vibrant=3]="Vibrant",e[e.Earth=4]="Earth",e[e.Ocean=5]="Ocean",e[e.Floral=6]="Floral",e[e.Night=7]="Night",e[e.Winter=8]="Winter",e[e.Spring=9]="Spring",e[e.Summer=10]="Summer",e[e.Fall=11]="Fall",e[e.Gray=12]="Gray",e[e.Brown=13]="Brown",e[e.Blue=14]="Blue",e[e.Yellow=15]="Yellow",e[e.Green=16]="Green",e[e.Purple=17]="Purple",e[e.Orange=18]="Orange",e[e.Pink=19]="Pink",e[e.Red=20]="Red",e))(tp||{});const ap={jan:1,fev:2,mar:3,abr:4,mai:5,jun:6,jul:7,ago:8,set:9,out:10,nov:11,dez:12},rp=["total_calibration_cost","total_verification_cost","total_maintenance_cost","last_calibration_cost","last_verification_cost","last_maintenance_cost","total_cost","total_reported_cost","estimated_cost","last_report_cost_reported_cost","occurrence_reported_cost","task_estimated_cost"],sp=["link","link_risk","risk_link","link_group","group_link","link_occurrence","occurrence_link","link_audit","link_project","link_program","link_ideia","flow_link","decision_link","link_supplier","auditing_link","fmea_link"];function np(e){if(!e)return 0;const[t,a]=e.split("/"),r=ap[t?.toLowerCase()]??0;return 12*(parseInt(a)||0)+r}function op(e){const t=e.split("/"),a=t[t.length-1];return`${t.slice(0,-1).join("/")}/${encodeURIComponent(a.replace(/[!@#$%^&*()_+={}[\]|\\;:'",.<>?/`~]/g,""))}`}function ip(e){for(const t of sp)if(e[t])return e[t];return null}function lp(e){const t=[];for(const a of Object.keys(e)){const r=e[a];null!=r&&(r instanceof Date?t.push(`${a}=${r.toISOString()}`):Array.isArray(r)?r.forEach(e=>{t.push(...lp({[a]:e}))}):"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||t.push(`${a}=${r}`))}return t}const cp=/^-?\d+(,\d{3})*(\.\d+)?$/;const dp=new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"});const up=new Set([Um.Text]),mp=new Set([Um.Text,Um.Numeric,Um.RiskMatrix,Um.Burndown,Um.PerformanceColumns]),pp=new Set([Um.Text,Um.RiskMatrix,Um.Burndown,Um.PerformanceColumns]);function hp({config:e,viewOnly:r=!1,complement:s,complementPosition:n="before-options",queryUrlBuilder:o,onRefresh:i,onExport:l,onToggleOnlyMine:d,className:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(e.onlyMine??!1),x=up.has(e.typeId),f=!mp.has(e.typeId),g=!pp.has(e.typeId),b=a.useMemo(()=>{if(!e.jsonRules||e.typeId===Um.PerformanceColumns)return!1;try{const t=JSON.parse(e.jsonRules);return t?.rules?.rules?.length>0}catch{return!1}},[e.jsonRules,e.typeId]),v=a.useMemo(()=>o?.(e)??"#",[o,e]),w=a.useCallback(()=>{const e=!p;h(e),d?.(e)},[p,d]),j=[];return p&&j.push(m("dashboard_only_mine")),e.onlyLate&&j.push(m("dashboard_only_overdue")),b&&j.push(m("dashboard_advanced_filter")),t.jsxs("div",{className:Nr("flex items-center justify-between gap-2 border-b bg-muted/30 px-2.5 py-1 text-sm font-medium",u),children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:["before-title"===n&&s,t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("span",{className:"block truncate",children:e.title})}),t.jsx(Zs,{children:e.title})]}),j.length>0&&t.jsx("span",{className:"text-[9px] font-normal text-muted-foreground truncate",children:j.join(" | ")})]}),"after-title"===n&&s]}),!r&&t.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:["before-options"===n&&s,t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-6 w-6",children:t.jsx(c.MoreVertical,{className:"h-3.5 w-3.5"})})}),t.jsxs($s,{align:"end",className:"w-48",children:[e.canUpdate&&t.jsxs(Vs,{onClick:()=>e.onEdit?.(e.id),children:[t.jsx(c.Pencil,{className:"mr-2 h-3.5 w-3.5"}),"Editar"]}),!x&&t.jsxs(Vs,{onClick:i,children:[t.jsx(c.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Atualizar"]}),f&&t.jsxs(Vs,{disabled:e.noData,onClick:l,children:[t.jsx(c.Download,{className:"mr-2 h-3.5 w-3.5"}),"Exportar"]}),!x&&t.jsxs(Vs,{disabled:!e.openQueryEnabled,onClick:()=>window.open(v,"_blank"),children:[t.jsx(c.ExternalLink,{className:"mr-2 h-3.5 w-3.5"}),"Abrir consulta"]}),g&&t.jsxs(t.Fragment,{children:[t.jsx(Ks,{}),t.jsxs(Vs,{onClick:w,children:[p&&t.jsx(c.Check,{className:"mr-2 h-3.5 w-3.5"}),!p&&t.jsx("span",{className:"mr-2 w-3.5"}),"Somente meus"]})]}),e.canUpdate&&t.jsxs(t.Fragment,{children:[t.jsx(Ks,{}),t.jsxs(Vs,{onClick:()=>e.onDuplicate?.(e.id),children:[t.jsx(c.Copy,{className:"mr-2 h-3.5 w-3.5"}),"Duplicar"]}),t.jsxs(Vs,{className:"text-destructive",onClick:()=>e.onRemove?.(e.id),children:[t.jsx(c.Trash2,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})]})]})]}),"after-options"===n&&s]})]})}function xp({config:e,queryUrl:a,className:r}){return t.jsxs("div",{className:Nr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"Erro ao exibir os dados."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"A consulta não pôde ser realizada."}),t.jsxs("p",{className:"mt-2 text-xs",children:[a&&t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:"Verificar a consulta"}),a&&e.canUpdate&&t.jsx("span",{className:"text-muted-foreground",children:" ou "}),e.canUpdate&&t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:()=>e.onEdit?.(e.id),children:"revisar o painel"})]})]})}function fp({panelType:e,className:a}){const r=e===Um.Burndown;return t.jsxs("div",{className:Nr("flex flex-1 flex-col items-center justify-center gap-2 p-4",a),children:[t.jsx(Ps,{className:"h-10 w-10 text-muted-foreground/40"}),r&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Aguarde, processando dados..."})]})}function gp({hasRemovedColumn:a=!1,className:r}){return t.jsxs("div",{className:Nr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",r),children:[t.jsx("h2",{className:"text-lg font-normal text-foreground/80 lg:text-base",children:e.t("no_data_to_display")}),t.jsx("p",{className:"text-sm text-muted-foreground lg:text-xs",children:e.t("dashboard_no_data")})]})}function bp({onRemove:e,className:a}){return t.jsxs("div",{className:Nr("flex flex-1 flex-col items-center justify-center gap-1 p-4 text-center",a),children:[t.jsx(c.AlertTriangle,{className:"h-12 w-12 text-muted-foreground/50"}),t.jsx("h2",{className:"mt-1 text-lg font-normal text-foreground/80",children:"A consulta não pôde ser realizada."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Este recurso não está disponível."}),e&&t.jsx("p",{className:"mt-2 text-xs",children:t.jsx("button",{type:"button",className:"underline hover:text-foreground",onClick:e,children:"Remover painel"})})]})}const vp={[Dm.Count]:e.t("dashboard_distinct_count").replace("distinta","").trim()||"Count",[Dm.Sum]:"Sum",[Dm.Average]:e.t("dashboard_average"),[Dm.DistinctCount]:e.t("dashboard_distinct_count"),[Dm.Max]:e.t("dashboard_max_value"),[Dm.Min]:e.t("dashboard_min_value")};function yp({config:e,state:a,value:r,label:s,viewOnly:n=!1,onClick:o,onRefresh:i,queryUrl:l,queryUrlBuilder:c,className:d}){const{t:u}=y.useTranslation(),m=s??vp[e.aggregationType??""]??"",p=function(e,t){if(null==e)return"—";const a=rp.includes(t.field),r=t.aggregationType===Dm.Count||t.aggregationType===Dm.DistinctCount;return a&&!r?dp.format("string"==typeof e?parseFloat(e):e):"number"==typeof e?r?String(e):e.toLocaleString("pt-BR",{maximumFractionDigits:2}):String(e)}(r,e);return t.jsxs("div",{className:Nr("flex h-full flex-col",d),children:[t.jsx(hp,{config:e,viewOnly:n,onRefresh:i,queryUrlBuilder:c}),a===Km.Loading&&t.jsx(fp,{}),a===Km.Loaded&&t.jsxs("div",{className:Nr("flex flex-1 flex-col items-center justify-center",o&&"cursor-pointer hover:bg-muted/20 transition-colors"),onClick:o,children:[t.jsx("span",{className:"text-[clamp(1.5rem,7vh,5rem)] font-bold text-foreground leading-tight",children:p}),m&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:m})]}),a===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),a===Km.Error&&t.jsx(xp,{config:e,queryUrl:l}),a===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function wp({config:e,state:a,htmlContent:r,viewOnly:s=!1,onRefresh:n,queryUrl:o,queryUrlBuilder:i,className:l}){const c=r??e.textTypeString??"";return t.jsxs("div",{className:Nr("flex h-full flex-col",l),children:[t.jsx(hp,{config:e,viewOnly:s,onRefresh:n,queryUrlBuilder:i}),a===Km.Loading&&t.jsx(fp,{}),a===Km.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 prose prose-sm max-w-none text-foreground",dangerouslySetInnerHTML:{__html:c}}),a===Km.Error&&t.jsx(xp,{config:e,queryUrl:o})]})}function jp({config:e,state:r,data:s=[],columns:n=[],viewOnly:o=!1,onRowClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,enableRowLinks:m=!0,className:p}){const h=a.useMemo(()=>n.filter(e=>!1!==e.visible),[n]),x=a.useCallback(e=>{if(i)i(e);else if(m){const t=ip(e);t&&window.open(op(t),"_blank")}},[i,m]);return t.jsxs("div",{className:Nr("flex h-full flex-col",p),children:[t.jsx(hp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Km.Loading&&t.jsx(fp,{}),r===Km.Loaded&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 z-10 bg-muted/60 backdrop-blur-sm",children:t.jsx("tr",{children:h.map(e=>t.jsx("th",{className:"px-2 py-1.5 text-left text-xs font-medium text-muted-foreground whitespace-nowrap border-b",children:e.header||e.columnLabel||e.columnName},e.columnName))})}),t.jsx("tbody",{children:s.map((e,a)=>{const r=m&&!!ip(e);return t.jsx("tr",{className:Nr("border-b border-border/50 transition-colors hover:bg-muted/30",(r||i)&&"cursor-pointer"),onClick:()=>x(e),children:h.map(a=>t.jsx("td",{className:"px-2 py-1.5 text-foreground whitespace-nowrap truncate max-w-[200px]",children:a.render?a.render(e[a.columnName],e):Np(e[a.columnName],a)},a.columnName))},a)})})]})}),r===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),r===Km.Error&&t.jsx(xp,{config:e,queryUrl:d}),r===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Np(e,t){return null==e?"":e instanceof Date?"datetime"===t.columnType?e.toLocaleString("pt-BR"):e.toLocaleDateString("pt-BR"):"number"==typeof e?e.toLocaleString("pt-BR"):String(e)}const _p=["hsl(var(--primary))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3"];function Cp({config:e,variant:r,state:s,data:n=[],series:o,colors:i,categoryKey:l="key",yAxisFormat:c,viewOnly:d=!1,onPointClick:u,onRefresh:m,onExport:p,queryUrl:h,queryUrlBuilder:x,className:f}){const g=i?.length?i:e.hexColors?.length?e.hexColors:_p,b=a.useMemo(()=>o?.length?o:[{dataKey:"value",name:e.title}],[o,e.title]),v="bar"===r,y="stacked-column"===r,w=a.useMemo(()=>{if(c)return e=>c.replace("{value}",e.toLocaleString("pt-BR"))},[c]);return t.jsxs("div",{className:Nr("flex h-full flex-col",f),children:[t.jsx(hp,{config:e,viewOnly:d,onRefresh:m,onExport:p,queryUrlBuilder:x}),s===Km.Loading&&t.jsx(fp,{}),s===Km.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:kp({variant:r,data:n,series:b,colors:g,categoryKey:l,isHorizontalBar:v,isStacked:y,yAxisTickFormatter:w,tooltipFormatter:e=>"number"==typeof e?e.toLocaleString("pt-BR"):String(e??""),onPointClick:u})})}),s===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),s===Km.Error&&t.jsx(xp,{config:e,queryUrl:h}),s===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function kp({variant:e,data:a,series:r,colors:s,categoryKey:n,isHorizontalBar:o,isStacked:i,yAxisTickFormatter:l,tooltipFormatter:c,onPointClick:d}){const u={tick:{fontSize:11},tickLine:!1,axisLine:!1},m=t.jsx(q.XAxis,{dataKey:o?void 0:n,type:o?"number":"category",...u,angle:o?0:-45,textAnchor:o?"middle":"end",height:o?void 0:60,tickFormatter:o?l:void 0}),p=t.jsx(q.YAxis,{dataKey:o?n:void 0,type:o?"category":"number",...u,width:o?100:60,tickFormatter:o?void 0:l}),h=t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),x=t.jsx(q.Tooltip,{formatter:c,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),f=r.length>1?t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}):null,g=d?(e,t)=>d(a[t],t):void 0;return"bar"===e||"column"===e||"stacked-column"===e?t.jsxs(q.BarChart,{data:a,layout:o?"vertical":"horizontal",margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Bar,{dataKey:e.dataKey,name:e.name||e.dataKey,fill:e.color||s[a%s.length],stackId:i?e.stackId||"stack":void 0,radius:i?void 0:[2,2,0,0],onClick:g,cursor:d?"pointer":void 0},e.dataKey))]}):"area"===e?t.jsxs(q.AreaChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>{const r=e.color||s[a%s.length];return t.jsx(q.Area,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:r,fill:r,fillOpacity:.15,strokeWidth:2,dot:!1,activeDot:{r:4,cursor:d?"pointer":void 0}},e.dataKey)})]}):t.jsxs(q.LineChart,{data:a,margin:{top:5,right:10,left:0,bottom:5},children:[h,m,p,x,f,r.map((e,a)=>t.jsx(q.Line,{type:"monotone",dataKey:e.dataKey,name:e.name||e.dataKey,stroke:e.color||s[a%s.length],strokeWidth:2,dot:{r:3},activeDot:{r:5,cursor:d?"pointer":void 0}},e.dataKey))]})}const Sp=["#1f78b4","#33a02c","#e31a1c","#ff7f00","#6a3d9a","#b15928","#a6cee3","#b2df8a","#fb9a99","#fdbf6f","#cab2d6","#ffff99"];function Ap({config:e,state:r,data:s=[],colors:n,viewOnly:o=!1,onSliceClick:i,onRefresh:l,onExport:c,queryUrl:d,queryUrlBuilder:u,className:m}){const p=n?.length?n:e.hexColors?.length?e.hexColors:Sp,h=a.useMemo(()=>s.map(e=>({...e,name:String(e.key??""),value:e.value??0})),[s]),x=a.useMemo(()=>h.reduce((e,t)=>e+(t.value??0),0),[h]);return t.jsxs("div",{className:Nr("flex h-full flex-col",m),children:[t.jsx(hp,{config:e,viewOnly:o,onRefresh:l,onExport:c,queryUrlBuilder:u}),r===Km.Loading&&t.jsx(fp,{}),r===Km.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.PieChart,{children:[t.jsx(q.Pie,{data:h,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:"80%",label:({name:e,percent:t})=>`${e??""}: ${(100*(t??0)).toFixed(0)}%`,labelLine:!0,onClick:i?(e,t)=>i(s[t],t):void 0,cursor:i?"pointer":void 0,children:h.map((e,a)=>t.jsx(q.Cell,{fill:p[a%p.length]},a))}),t.jsx(q.Tooltip,{formatter:e=>{const t="number"==typeof e?e:0,a=x>0?(t/x*100).toFixed(1):"0";return`${t.toLocaleString("pt-BR")} (${a}%)`}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}})]})})}),r===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),r===Km.Error&&t.jsx(xp,{config:e,queryUrl:d}),r===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Tp({config:e,state:r,data:s=[],barColor:n,lineColor:o="#e31a1c",viewOnly:i=!1,onPointClick:l,onRefresh:c,onExport:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=e.hexColors?.length?e.hexColors:["#1f78b4"],x=n??h[0],f=a.useMemo(()=>{const e=[...s].sort((e,t)=>(t.value??0)-(e.value??0)),t=e.reduce((e,t)=>e+(t.value??0),0);let a=0;return e.map(e=>(a+=e.value??0,{key:String(e.key??""),value:e.value??0,cumulativePercent:t>0?Math.round(a/t*100):0}))},[s]);return t.jsxs("div",{className:Nr("flex h-full flex-col",p),children:[t.jsx(hp,{config:e,viewOnly:i,onRefresh:c,onExport:d,queryUrlBuilder:m}),r===Km.Loading&&t.jsx(fp,{}),r===Km.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.ComposedChart,{data:f,margin:{top:5,right:30,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"key",tick:{fontSize:11},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{yAxisId:"left",tick:{fontSize:11},tickLine:!1,axisLine:!1}),t.jsx(q.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:(e,t)=>"% Acumulado"===t?`${e}%`:"number"==typeof e?e.toLocaleString("pt-BR"):e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{yAxisId:"left",dataKey:"value",name:"Quantidade",fill:x,radius:[2,2,0,0],onClick:l?(e,t)=>l(s[t],t):void 0,cursor:l?"pointer":void 0}),t.jsx(q.Line,{yAxisId:"right",type:"monotone",dataKey:"cumulativePercent",name:"% Acumulado",stroke:o,strokeWidth:2,dot:{r:3,fill:o}})]})})}),r===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),r===Km.Error&&t.jsx(xp,{config:e,queryUrl:u}),r===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Dp({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onRefresh:c,queryUrl:d,queryUrlBuilder:u,className:m}){const{t:p}=y.useTranslation(),h=s??p("dashboard_work_done"),x=n??p("dashboard_work_planned");return t.jsxs("div",{className:Nr("flex h-full flex-col",m),children:[t.jsx(hp,{config:e,viewOnly:l,onRefresh:c,queryUrlBuilder:u}),a===Km.Loading&&t.jsx(fp,{panelType:Um.Burndown}),a===Km.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.AreaChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"date",tick:{fontSize:10},angle:-45,textAnchor:"end",height:50}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`,domain:[0,100]}),t.jsx(q.Tooltip,{formatter:e=>`${e}%`,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Area,{type:"monotone",dataKey:"executedPercentage",name:h,stroke:o,fill:o,fillOpacity:.2,strokeWidth:2,dot:{r:3}}),t.jsx(q.Area,{type:"monotone",dataKey:"plannedPercentage",name:x,stroke:i,fill:i,fillOpacity:.1,strokeWidth:2,dot:{r:3}})]})})}),a===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),a===Km.Error&&t.jsx(xp,{config:e,queryUrl:d}),a===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Ep({config:e,state:a,data:r=[],executedLabel:s,plannedLabel:n,executedColor:o="hsl(var(--primary))",plannedColor:i="hsl(var(--chart-2))",viewOnly:l=!1,onPointClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const{t:h}=y.useTranslation(),x=s??h("dashboard_work_done"),f=n??h("dashboard_work_planned");return t.jsxs("div",{className:Nr("flex h-full flex-col",p),children:[t.jsx(hp,{config:e,viewOnly:l,onRefresh:d,queryUrlBuilder:m}),a===Km.Loading&&t.jsx(fp,{}),a===Km.Loaded&&t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(q.ResponsiveContainer,{width:"100%",height:"100%",children:t.jsxs(q.BarChart,{data:r,margin:{top:5,right:10,left:0,bottom:5},children:[t.jsx(q.CartesianGrid,{strokeDasharray:"3 3",className:"stroke-border/50"}),t.jsx(q.XAxis,{dataKey:"name",tick:{fontSize:10},angle:-45,textAnchor:"end",height:60}),t.jsx(q.YAxis,{tick:{fontSize:11},tickFormatter:e=>`${e}%`}),t.jsx(q.Tooltip,{formatter:e=>"number"==typeof e?`${e}%`:e,contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"12px"}}),t.jsx(q.Legend,{wrapperStyle:{fontSize:"11px"}}),t.jsx(q.Bar,{dataKey:"executedWork",name:x,fill:o,radius:[2,2,0,0],onClick:c?(e,t)=>c(r[t],t):void 0,cursor:c?"pointer":void 0}),t.jsx(q.Bar,{dataKey:"plannedWork",name:f,fill:i,radius:[2,2,0,0]})]})})}),a===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),a===Km.Error&&t.jsx(xp,{config:e,queryUrl:u}),a===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}function Pp({config:e,state:r,rule:s,risks:n=[],matrixViewType:o=Wm.Quantity,viewOnly:i=!1,onCellClick:l,onRiskClick:c,onRefresh:d,queryUrl:u,queryUrlBuilder:m,className:p}){const h=a.useMemo(()=>[...s?.parametersY??[]].sort((e,t)=>t.position-e.position),[s?.parametersY]),x=s?.parametersX??[],f=a.useMemo(()=>{const e={};return n.forEach(t=>{const a=`${t.parameterYPosition}-${t.parameterXPosition}`;e[a]||(e[a]=[]),e[a].push(t)}),e},[n]);return t.jsxs("div",{className:Nr("flex h-full flex-col",p),children:[t.jsx(hp,{config:e,viewOnly:i,onRefresh:d,queryUrlBuilder:m}),r===Km.Loading&&t.jsx(fp,{}),r===Km.Loaded&&s&&t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsxs("div",{className:"flex gap-4 items-stretch min-w-fit",children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("span",{className:"text-xs font-medium text-muted-foreground [writing-mode:vertical-lr] rotate-180",children:s.name_y})}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex mb-1",children:[t.jsx("div",{className:"w-16 shrink-0"}),t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.threat_strategy_type_name}),!s.disable_opportunities&&t.jsx("div",{className:"flex-1 text-center text-xs font-medium text-muted-foreground truncate",children:s.opportunity_strategy_type_name})]}),h.map((e,a)=>t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0 flex items-center justify-center border border-border/50 text-xs font-medium p-1 text-center",children:e.name}),x.map((r,n)=>{const i=((e,t)=>f[`${t.position}-${e.position}`]??[])(r,e),d=((e,t)=>s?.colorMatrix?.[t]?.[e]??"hsl(var(--muted))")(n,a);return t.jsxs("div",{className:Nr("flex-1 min-w-[60px] min-h-[40px] border border-border/50 flex flex-col items-center justify-center gap-0.5 p-1",(l||c)&&i.length>0&&"cursor-pointer hover:opacity-80"),style:{backgroundColor:d},onClick:()=>i.length>0&&l?.(r,e,i),children:[o===Wm.Quantity&&i.length>0&&t.jsxs("span",{className:"text-xs font-semibold",children:[i.length," risco",1!==i.length?"s":""]}),o===Wm.AllRisksList&&i.map(e=>t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("button",{type:"button",className:"text-[10px] text-primary underline hover:text-primary/80",onClick:t=>{t.stopPropagation(),c?.(e)},children:e.code})}),t.jsxs(Zs,{className:"max-w-[250px]",children:[t.jsxs("p",{className:"font-medium",children:[e.code," - ",e.name]}),e.analysisDate&&t.jsxs("p",{className:"text-xs mt-1",children:["Última análise: ",t.jsx("strong",{children:e.analysisDate})]}),e.strategy&&t.jsxs("p",{className:"text-xs",children:["Estratégia: ",t.jsx("strong",{children:e.strategy})]}),e.resultName&&t.jsxs("p",{className:"text-xs",children:["Criticidade: ",t.jsx("strong",{style:{backgroundColor:d},className:"px-1 rounded",children:e.resultName})]})]})]},e.code))]},r.position)})]},e.position)),t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"w-16 shrink-0"}),x.map(e=>t.jsx("div",{className:"flex-1 min-w-[60px] border border-border/50 text-xs font-medium p-1 text-center",children:e.name},e.position))]}),t.jsx("div",{className:"text-center text-xs font-medium text-muted-foreground mt-2",children:s.name_x})]})]})}),r===Km.NoData&&t.jsx(gp,{hasRemovedColumn:e.hasRemovedColumn}),r===Km.Error&&t.jsx(xp,{config:e,queryUrl:u}),r===Km.Unavailable&&t.jsx(bp,{onRemove:()=>e.onRemove?.(e.id)})]})}const Ip=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:a}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:a}=e;return"scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return[Ip.Translate.toString(e),Ip.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function Mp(e){switch(Number(e)){case Um.Area:case Um.Bar:case Um.Column:case Um.Line:case Um.Numeric:case Um.Pie:case Um.Text:return{x:1,y:1};default:return{x:2,y:2}}}function Rp({panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:i}){const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:m,isDragging:p}=X.useSortable({id:e.id,disabled:!o}),h=a.useMemo(()=>({gridColumn:`${e.col+1} / span ${e.sizeX}`,gridRow:`${e.row+1} / span ${e.sizeY}`,minHeight:e.sizeY*s+(e.sizeY-1)*n+"px",transform:Ip.Transform.toString(u),transition:m,zIndex:p?50:void 0,opacity:p?.85:1}),[e,r,s,n,u,m,p]);return t.jsxs("div",{ref:d,style:h,className:Nr("rounded-lg border border-border bg-card shadow-sm overflow-hidden","transition-shadow duration-200",p&&"shadow-lg ring-2 ring-primary/20"),...l,children:[t.jsx("div",{className:Nr("dashboard-panel-drag-handle",o&&"cursor-grab active:cursor-grabbing"),...o?c:{}}),t.jsx("div",{className:"h-full",children:i})]})}function Lp({panels:e,columns:r=8,cellHeight:s=160,cellGap:n=10,allowDragging:o=!1,showGridLines:i=!1,renderPanel:l,onLayoutChange:c,className:d}){const[u,m]=a.useState(e);a.useMemo(()=>{m(e)},[e]);const p=Q.useSensors(Q.useSensor(Q.PointerSensor,{activationConstraint:{distance:8}})),h=a.useMemo(()=>0===u.length?1:Math.max(...u.map(e=>e.row+e.sizeY)),[u]),x=a.useMemo(()=>u.map(e=>e.id),[u]),f=a.useCallback(e=>{const{active:t,over:a}=e;if(!a||t.id===a.id)return;const r=u.findIndex(e=>e.id===t.id),s=u.findIndex(e=>e.id===a.id);if(-1===r||-1===s)return;const n=[...u],o={...n[r]},i={...n[s]},l=o.col,d=o.row;o.col=i.col,o.row=i.row,i.col=l,i.row=d,n[r]=o,n[s]=i,m(n),c?.(n)},[u,c]),g=a.useMemo(()=>({display:"grid",gridTemplateColumns:`repeat(${r}, 1fr)`,gridTemplateRows:`repeat(${h}, ${s}px)`,gap:`${n}px`}),[r,h,s,n]);return 0===u.length?t.jsxs("div",{className:Nr("flex flex-col items-center justify-center py-16 text-center",d),children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Nenhum painel adicionado"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Adicione painéis para visualizar seus dados aqui."})]}):t.jsx(Q.DndContext,{sensors:p,collisionDetection:Q.closestCenter,onDragEnd:f,children:t.jsx(X.SortableContext,{items:x,strategy:X.rectSortingStrategy,children:t.jsx("div",{style:g,className:Nr("relative w-full",i&&"bg-muted/30",d),children:u.map(e=>t.jsx(Rp,{panel:e,columns:r,cellHeight:s,cellGap:n,allowDragging:o,children:l(e.id)},e.id))})})})}const Fp={[Um.Bar]:"bar",[Um.Column]:"column",[Um.StackedColumn]:"stacked-column",[Um.Area]:"area",[Um.Line]:"line",[Um.EvolutionLine]:"evolution-line"};function zp({config:e,state:a,data:r,numericValue:s,listColumns:n,cartesianData:o,cartesianSeries:i,burndownData:l,performanceData:c,matrixRule:d,matrixRisks:u,onPanelClick:m}){const p=Fp[e.typeId];if(p)return t.jsx(Cp,{config:e,variant:p,state:a,data:o,series:i});switch(e.typeId){case Um.Numeric:return t.jsx(yp,{config:e,state:a,value:s});case Um.Text:return t.jsx(wp,{config:e,state:a});case Um.List:return t.jsx(jp,{config:e,state:a,data:r,columns:n??[]});case Um.Pie:return t.jsx(Ap,{config:e,state:a,data:r});case Um.Pareto:return t.jsx(Tp,{config:e,state:a,data:r});case Um.Burndown:return t.jsx(Dp,{config:e,state:a,data:l});case Um.PerformanceColumns:return t.jsx(Ep,{config:e,state:a,data:c});case Um.RiskMatrix:return t.jsx(Pp,{config:e,state:a,rule:d,risks:u??[]});default:return t.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:["Tipo de painel não suportado (",e.typeId,")"]})}}function Up({dashboard:e,panels:r,pages:s,activePageId:n,canEdit:o=!1,isFullscreen:i=!1,isLoading:l=!1,getPanelData:c,onRefresh:d,onToggleFullscreen:u,onToggleFavorite:m,onEdit:p,onShare:h,onAddPanel:x,onEditPanel:f,onRemovePanel:g,onDuplicatePanel:b,onLayoutChange:v,onPageChange:w,toolbarActions:j,className:N}){const{t:_}=y.useTranslation(),[C,k]=a.useState(!1),S=e.idViewType===Bm.Carousel,A=a.useMemo(()=>r,[r,S,n]),T=a.useMemo(()=>A.map(e=>{const t=Mp(e.typeId);return{id:e.id,col:e.col,row:e.row,sizeX:e.sizeX,sizeY:e.sizeY,minSizeX:t.x,minSizeY:t.y}}),[A]),D=a.useCallback(e=>({id:e.id,title:e.titlePtBr||e.titleEnUs||e.titleEsEs,typeId:e.typeId,queryId:e.queryId,queryContextId:e.queryContextId,queryTitle:e.queryTitle,querySelectedColumns:e.querySelectedColumns,field:e.field??"",fieldType:e.fieldType??"",fieldAuxAxis:e.fieldAuxAxis,fieldAuxAxisType:e.fieldAuxAxisType,aggregationType:e.aggregationType,textTypeString:e.textTypeString,referenceDate:e.referenceDate,period:e.period,initialDate:e.initialDate,finalDate:e.finalDate,dimension:e.dimension,yAxis:e.yAxis,yAxisType:e.yAxisType,orderBy:e.orderBy,orderByType:e.orderByType,secondaryGrouping:e.secondaryGrouping,secondaryGroupingType:e.secondaryGroupingType,onlyLate:e.onlyLate,jsonRules:e.jsonRules,ignoreRules:e.ignoreRules,visualizationType:e.visualizationType,sortType:e.sortType,itemsPerPanel:e.itemsPerPanel,secondaryItemsPerPanel:e.secondaryItemsPerPanel,matrixViewRule:e.matrixViewRule,listPanelColumns:e.listPanelColumns,listPanelListType:e.listPanelListType,paletteId:e.paletteId,hexColors:e.hexColors,showNotInformedData:e.showNotInformedData,fieldAnalysisRule:e.fieldAnalysisRule,fieldCriticality:e.fieldCriticality,fieldPlansType:e.fieldPlansType,fieldPlansSelected:e.fieldPlansSelected,fieldPlansBurndown:e.fieldPlansBurndown,fieldPlansBurndownGroup:e.fieldPlansBurndownGroup,analysisCriteriaId:e.analysisCriteriaId,analysisCriteriaParameter:e.analysisCriteriaParameter,evolutionSecondaryGrouping:e.evolutionSecondaryGrouping,canUpdate:o,hasRemovedColumn:e.hasRemovedColumn,panelSize:{x:e.sizeX,y:e.sizeY},onEdit:f,onRemove:g,onDuplicate:b}),[o,f,g,b]),E=a.useCallback(()=>{C||l||(k(!0),d?.(),setTimeout(()=>k(!1),3e4))},[C,l,d]),P=a.useCallback(e=>{const a=A.find(t=>t.id===e);if(!a)return null;const r=D(a),s=c?.(e)??{state:Km.Loaded};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx(hp,{config:r,onRefresh:()=>{}}),t.jsx("div",{className:"flex-1 min-h-0 p-2",children:t.jsx(zp,{config:r,...s})})]})},[A,D,c,o,f,g,b]);return t.jsxs("div",{className:Nr("flex flex-col h-full",i&&"fixed inset-0 z-50 bg-background",N),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:e.title}),e.responsibleName&&!i&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden sm:inline",children:e.responsibleName})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[j,d&&t.jsx("button",{onClick:E,disabled:C||l,className:Nr("inline-flex items-center justify-center rounded-md p-2 text-sm","hover:bg-accent hover:text-accent-foreground transition-colors","disabled:opacity-50 disabled:pointer-events-none"),title:C?_("dashboard_wait_refresh"):"Atualizar",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M21 12a9 9 0 0 1-9 9m9-9a9 9 0 0 0-9-9m9 9H3m0 0a9 9 0 0 1 9-9m-9 9a9 9 0 0 0 9 9"})})}),u&&t.jsx("button",{onClick:u,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:i?_("dashboard_exit_fullscreen"):"Fullscreen",children:t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i?t.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"}):t.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),o&&!i&&h&&t.jsx("button",{onClick:h,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:"Compartilhar",children:t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),m&&!i&&t.jsx("button",{onClick:m,className:"inline-flex items-center justify-center rounded-md p-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",title:e.isFavorite?_("dashboard_remove_favorite"):"Favoritar",children:t.jsx("svg",{className:Nr("h-4 w-4",e.isFavorite&&"fill-yellow-400 text-yellow-400"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})]})]}),S&&s&&s.length>1&&t.jsx("div",{className:"flex items-center gap-1 px-4 py-1 border-b border-border bg-card overflow-x-auto",children:s.map(e=>t.jsx("button",{onClick:()=>w?.(e.id),className:Nr("px-3 py-1.5 text-sm rounded-md whitespace-nowrap transition-colors",n===e.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.name||`Dashboard ${e.position}`},e.id))}),o&&!i&&x&&t.jsx("div",{className:"flex justify-center py-3",children:t.jsxs("button",{onClick:x,className:Nr("inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Adicionar painel"]})}),l&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!l&&t.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted/30",children:t.jsx(Lp,{panels:T,allowDragging:o,showGridLines:o,renderPanel:P,onLayoutChange:v})})]})}function Op(e,t=Vm.PtBr){const{t:a}=y.useTranslation();switch(t){case Vm.EnUs:return e.titleEnUs||e.titlePtBr||e.titleEsEs;case Vm.EsEs:return e.titleEsEs||e.titleEnUs||e.titlePtBr;default:return e.titlePtBr||e.titleEnUs||e.titleEsEs}}function Bp(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}const qp=[{value:Zm.All,label:"Todos"},{value:Zm.OnlyMine,label:e.t("dashboard_my")},{value:Zm.Favorites,label:"Favoritos"}];function $p({dashboards:e,limit:r,isLoading:s=!1,language:n=Vm.PtBr,canAdd:o=!1,canEdit:i=!1,canRemove:l=!1,onOpen:c,onEdit:d,onShare:u,onDuplicate:m,onRemove:p,onAdd:h,onToggleFavorite:x,onRefresh:f,onSearch:g,onQuickFilterChange:b,toolbarExtra:v,className:w}){const{t:j}=y.useTranslation(),[N,_]=a.useState(""),[C,k]=a.useState(Zm.All),[S,A]=a.useState(null),T=a.useCallback(e=>{_(e),g?.(e)},[g]),D=a.useCallback(e=>{k(e),b?.(e)},[b]),E=a.useMemo(()=>{let t=e;if(N){const e=N.toLowerCase();t=t.filter(t=>t.code?.toLowerCase().includes(e)||Op(t,n).toLowerCase().includes(e)||t.responsibleName?.toLowerCase().includes(e))}switch(C){case Zm.OnlyMine:break;case Zm.Favorites:t=t.filter(e=>e.isFavorite)}return t},[e,N,C,n]);return t.jsxs("div",{className:Nr("flex flex-col h-full",w),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Dashboards"}),r&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.countDashboards,"/",r.maxDashboards,")"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative",children:[t.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("path",{d:"m21 21-4.3-4.3"})]}),t.jsx("input",{type:"text",placeholder:"Buscar...",value:N,onChange:e=>T(e.target.value),className:Nr("h-9 w-48 rounded-md border border-input bg-background pl-9 pr-3 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})]}),v,o&&h&&t.jsxs("button",{onClick:h,className:Nr("inline-flex items-center gap-1.5 px-3 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"),children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M12 5v14M5 12h14"})}),"Novo"]})]})]}),t.jsx("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-card",children:qp.map(e=>t.jsx("button",{onClick:()=>D(e.value),disabled:s,className:Nr("px-3 py-1.5 text-sm rounded-md transition-colors",C===e.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground","disabled:opacity-50"),children:e.label},e.value))}),s&&t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),!s&&t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"sticky top-0 bg-muted/80 backdrop-blur-sm border-b border-border",children:t.jsxs("tr",{children:[t.jsx("th",{className:"w-12 px-3 py-2 text-left font-medium text-muted-foreground",children:t.jsx("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Código"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Título"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Responsável"}),t.jsx("th",{className:"w-12 px-3 py-2 text-center font-medium text-muted-foreground",children:t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Última modificação"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:"Situação"}),t.jsx("th",{className:"w-12 px-3 py-2"})]})}),t.jsxs("tbody",{children:[0===E.length&&t.jsx("tr",{children:t.jsx("td",{colSpan:8,className:"px-3 py-12 text-center text-muted-foreground",children:"Nenhum dashboard encontrado."})}),E.map(e=>t.jsxs("tr",{onClick:()=>c?.(e),className:Nr("border-b border-border cursor-pointer transition-colors","hover:bg-accent/50"),children:[t.jsx("td",{className:"px-3 py-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),x?.(e)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsx("svg",{className:Nr("h-4 w-4",e.isFavorite?"fill-yellow-400 text-yellow-400":"text-muted-foreground"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}),t.jsx("td",{className:"px-3 py-2 font-mono text-xs text-foreground",children:e.code}),t.jsx("td",{className:"px-3 py-2 text-foreground font-medium",children:Op(e,n)}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:e.responsibleName}),t.jsx("td",{className:"px-3 py-2 text-center",children:e.hasSharedIcon&&t.jsxs("svg",{className:"h-4 w-4 mx-auto text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"9",cy:"7",r:"4"}),t.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),t.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),t.jsx("td",{className:"px-3 py-2 text-muted-foreground text-xs",children:Bp(e.lastModified)}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:Nr("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",e.isActive?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:e.isActive?"Ativo":"Inativo"})}),t.jsx("td",{className:"px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(S===e.id?null:e.id)},className:"p-1 hover:bg-accent rounded transition-colors",children:t.jsxs("svg",{className:"h-4 w-4 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),S===e.id&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(null)}),t.jsxs("div",{className:"absolute right-0 top-8 z-50 min-w-[160px] rounded-md border border-border bg-popover shadow-md py-1",children:[t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),c?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Abrir"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),d?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Editar"}),i&&t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),u?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Compartilhar"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),m?.(e)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",children:"Duplicar"}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-1 border-t border-border"}),t.jsx("button",{onClick:t=>{t.stopPropagation(),A(null),p?.(e)},className:"w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10 transition-colors",children:"Remover"})]})]})]})]})})]},e.id))]})]})})]})}const Vp=[{value:Om.NotUpdate,label:e.t("dashboard_no_refresh")},{value:Om.FiveMinutes,label:"5 minutos"},{value:Om.TenMinutes,label:"10 minutos"},{value:Om.FifteenMinutes,label:"15 minutos"},{value:Om.ThirtyMinutes,label:"30 minutos"},{value:Om.OneHour,label:"1 hora"}],Wp=[{value:Bm.NormalPage,label:e.t("dashboard_normal_page")},{value:Bm.Carousel,label:"Carrossel"}],Hp=[{value:Mm.FiveSeconds,label:"5 segundos"},{value:Mm.TenSeconds,label:"10 segundos"},{value:Mm.FifteenSeconds,label:"15 segundos"},{value:Mm.ThirtySeconds,label:"30 segundos"},{value:Mm.OneMinute,label:"1 minuto"},{value:Mm.ThreeMinutes,label:"3 minutos"},{value:Mm.FiveMinutes,label:"5 minutos"},{value:Mm.TenMinutes,label:"10 minutos"}],Gp=[{value:$m.NotShared,label:e.t("dashboard_not_shared"),description:e.t("dashboard_only_responsible")},{value:$m.SharedWithAllCollaborators,label:e.t("dashboard_shared_unit"),description:e.t("dashboard_all_access")},{value:$m.SharedWithUsersGroupsPlacesCollaborators,label:e.t("dashboard_select_groups"),description:e.t("dashboard_select_groups")}],Kp=[{key:"pt-br",label:"PT-BR"},{key:"en",label:"EN-US"},{key:"es",label:"ES-ES"}];function Yp({dashboard:e,initialTab:r=qm.General,isSaving:s=!1,isQualitfy:n=!1,users:o=[],groups:i=[],places:l=[],collaborators:c=[],onSave:d,onCancel:u,className:m}){const{t:p}=y.useTranslation(),h=!!e,[x,f]=a.useState(r),[g,b]=a.useState({"pt-br":!!e?.titlePtBr||!h,en:!!e?.titleEnUs,es:!!e?.titleEsEs}),[v,w]=a.useState(e?.titlePtBr??""),[j,N]=a.useState(e?.titleEnUs??""),[_,C]=a.useState(e?.titleEsEs??""),[k,S]=a.useState(e?.responsibleId??""),[A,T]=a.useState(e?.isActive??!0),[D,E]=a.useState(e?.idUpdateTime??Om.NotUpdate),[P,I]=a.useState(e?.idViewType??Bm.NormalPage),[M,R]=a.useState(e?.idPageTime??Mm.FifteenSeconds),[L,F]=a.useState(e?.idShare??$m.NotShared),[z,U]=a.useState(e?.groups??[]),[O,B]=a.useState(e?.places??[]),[q,$]=a.useState(e?.collaborators??[]),V=P===Bm.Carousel,W=g["pt-br"]||g.en||g.es,H=a.useMemo(()=>!!W&&(!(g["pt-br"]&&!v.trim())&&(!(g.en&&!j.trim())&&!(g.es&&!_.trim()))),[W,g,v,j,_]),G=a.useCallback(e=>{b(t=>({...t,[e]:!t[e]}))},[]),K=a.useCallback(()=>{H&&!s&&d?.({titlePtBr:g["pt-br"]?v:"",titleEnUs:g.en?j:"",titleEsEs:g.es?_:"",responsibleId:k||void 0,isActive:A,idUpdateTime:D,idViewType:P,idPageTime:V?M:null,idShare:L,groups:L===$m.SharedWithUsersGroupsPlacesCollaborators?z:[],places:L===$m.SharedWithUsersGroupsPlacesCollaborators?O:[],collaborators:L===$m.SharedWithUsersGroupsPlacesCollaborators?q:[]})},[H,s,d,g,v,j,_,k,A,D,P,M,V,L,z,O,q]);return t.jsxs("div",{className:Nr("flex flex-col h-full bg-background",m),children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h2",{className:"text-lg font-semibold text-foreground",children:p(h?"dashboard_edit":"dashboard_new")}),h&&e&&t.jsx("span",{className:"text-sm text-muted-foreground",children:e.code})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:u,className:"px-3 py-2 text-sm rounded-md border border-input hover:bg-accent transition-colors",children:"Cancelar"}),t.jsxs("button",{onClick:K,disabled:!H||s,className:Nr("inline-flex items-center gap-1.5 px-4 py-2 rounded-md text-sm font-medium","bg-primary text-primary-foreground hover:bg-primary/90 transition-colors","disabled:opacity-50 disabled:pointer-events-none"),children:[s?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"}):t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Salvar"]})]})]}),t.jsxs("div",{className:"flex border-b border-border bg-card",children:[t.jsx("button",{onClick:()=>f(qm.General),className:Nr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===qm.General?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Geral"}),t.jsx("button",{onClick:()=>f(qm.Share),className:Nr("px-4 py-2.5 text-sm font-medium border-b-2 transition-colors",x===qm.Share?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:"Compartilhamento"})]}),t.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x===qm.General&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-foreground",children:"Título *"}),t.jsx("div",{className:"flex gap-2",children:Kp.map(e=>t.jsx("button",{onClick:()=>G(e.key),className:Nr("px-3 py-1 text-xs rounded-md border transition-colors",g[e.key]?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:e.label},e.key))}),!W&&t.jsx("p",{className:"text-xs text-destructive",children:"Selecione pelo menos um idioma"})]}),g["pt-br"]&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Português (BR)"}),t.jsx("input",{value:v,onChange:e=>w(e.target.value),maxLength:200,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[v.length,"/200"]})]}),g.en&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Inglês (US)"}),t.jsx("input",{value:j,onChange:e=>N(e.target.value),maxLength:200,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[j.length,"/200"]})]}),g.es&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Título em Espanhol (ES)"}),t.jsx("input",{value:_,onChange:e=>C(e.target.value),maxLength:200,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[_.length,"/200"]})]}),!e?.isStandard&&o.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Responsável"}),t.jsxs("select",{value:k,onChange:e=>S(e.target.value),disabled:!h,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:[t.jsx("option",{value:"",children:"Selecione..."}),o.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Intervalo de atualização"}),t.jsx("select",{value:D,onChange:e=>E(Number(e.target.value)),disabled:n,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Vp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Situação"}),t.jsxs("div",{className:"flex items-center gap-3 h-10",children:[t.jsx("button",{onClick:()=>T(!A),disabled:e?.isGeneralViewUse,className:Nr("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",A?"bg-primary":"bg-muted","disabled:opacity-50"),children:t.jsx("span",{className:Nr("inline-block h-4 w-4 rounded-full bg-white transition-transform",A?"translate-x-6":"translate-x-1")})}),t.jsx("span",{className:"text-sm text-foreground",children:A?"Ativo":"Inativo"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Tipo de visualização"}),t.jsx("select",{value:P,onChange:e=>I(Number(e.target.value)),disabled:n||V,className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:opacity-50"),children:Wp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]}),V&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-sm text-muted-foreground",children:"Trocar página a cada"}),t.jsx("select",{value:M??"",onChange:e=>R(Number(e.target.value)),className:Nr("w-full h-10 rounded-md border border-input bg-background px-3 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:Hp.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]}),x===qm.Share&&t.jsxs("div",{className:"max-w-2xl space-y-6",children:[t.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted/50 border border-border",children:[t.jsxs("svg",{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M12 16v-4"}),t.jsx("path",{d:"M12 8h.01"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure quem pode visualizar este dashboard. O responsável sempre terá acesso."})]}),t.jsx("div",{className:"space-y-3",children:Gp.map(a=>t.jsxs("label",{className:Nr("flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors",L===a.value?"border-primary bg-primary/5":"border-border hover:bg-accent/50",e?.isGeneralViewUse&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"shareType",value:a.value,checked:L===a.value,onChange:()=>F(a.value),disabled:e?.isGeneralViewUse,className:"mt-1 accent-primary"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:a.label}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})]},a.value))}),L===$m.SharedWithUsersGroupsPlacesCollaborators&&t.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Grupos de usuários (",z.length,")"]}),t.jsx("select",{multiple:!0,value:z,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);U(t)},className:Nr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:i.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Locais (",O.length,")"]}),t.jsx("select",{multiple:!0,value:O,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);B(t)},className:Nr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Colaboradores (",q.length,")"]}),t.jsx("select",{multiple:!0,value:q,onChange:e=>{const t=Array.from(e.target.selectedOptions,e=>e.value);$(t)},className:Nr("w-full h-24 rounded-md border border-input bg-background px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:c.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]})]})]})]})]})}function Qp(){return`n_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Xp(e,t){return{id:t?.id??Qp(),text:e,children:t?.children,collapsed:t?.collapsed,color:t?.color,icon:t?.icon,note:t?.note,side:t?.side}}function Jp(e,t){if(e.id===t)return{node:e,parent:null};const a=[];for(const r of e.children??[])a.push({node:r,parent:e});for(;a.length;){const e=a.pop();if(e.node.id===t)return{node:e.node,parent:e.parent};for(const t of e.node.children??[])a.push({node:t,parent:e.node})}return null}function Zp(e,t){const a=t(e);return a.children?.length?{...a,children:a.children.map(e=>Zp(e,t))}:a}function eh(e,t,a){return Zp(e,e=>e.id===t?a(e):e)}function th(e){return{left:(e.children??[]).filter(e=>"left"===e.side).length,right:(e.children??[]).filter(e=>"left"!==e.side).length}}function ah(e,t,a){const r=Xp(a||"");let s=r.id;return{root:Zp(e,a=>{if(a.id!==t)return a;let n=r;if(a.id===e.id){const t=th(e);n={...n,side:t.left<=t.right?"left":"right"}}else n={...n,side:a.side};return s=n.id,{...a,collapsed:!1,children:[...a.children??[],n]}}),newId:s}}function rh(e,t,a){if(e.id===t)return ah(e,t,a);const r=Jp(e,t);if(!r||!r.parent)return{root:e,newId:t};const s=r.parent,n=Xp(a||"",{side:r.node.side}),o=n.id;return{root:Zp(e,e=>{if(e.id!==s.id)return e;const a=(e.children??[]).findIndex(e=>e.id===t),r=[...e.children??[]];return r.splice(a+1,0,n),{...e,children:r}}),newId:o}}function sh(e,t){if(e.id===t)return{root:e,nextSelectedId:t};const a=Jp(e,t);if(!a||!a.parent)return{root:e,nextSelectedId:null};const r=a.parent,s=r.children??[],n=s.findIndex(e=>e.id===t),o=s[n+1]?.id??s[n-1]?.id??r.id;return{root:Zp(e,e=>e.id!==r.id?e:{...e,children:(e.children??[]).filter(e=>e.id!==t)}),nextSelectedId:o}}function nh(e,t,a){if(t===a)return e;if(t===e.id)return e;if(function(e,t,a){const r=Jp(e,t);return!!r&&!!Jp(r.node,a)}(e,t,a))return e;const r=Jp(e,t);if(!r)return e;const s=(()=>{if(a===e.id){const t=th(e);return{...r.node,side:t.left<=t.right?"left":"right"}}const t=Jp(e,a)?.node;return{...r.node,side:t?.side}})(),n=Zp(e,e=>e.children?.length&&e.children.some(e=>e.id===t)?{...e,children:e.children.filter(e=>e.id!==t)}:e);return Zp(n,e=>e.id!==a?e:{...e,collapsed:!1,children:[...e.children??[],s]})}function oh(e,t){return eh(e,t,e=>({...e,collapsed:!e.collapsed}))}function ih(e,t){return Zp(e,a=>a.children?.length?a.id===e.id&&t?a:{...a,collapsed:t}:a)}function lh(e){const{value:t,defaultValue:r,onChange:s,readOnly:n}=e,o=void 0!==t,[i,l]=a.useState(()=>r??t??Xp("Mapa Mental",{id:"root"})),c=o?t:i,[d,u]=a.useState(c.id),m=a.useRef([]),p=a.useRef([]),h=a.useCallback((e,t)=>{n||(m.current.push(t),m.current.length>50&&m.current.shift(),p.current=[],o||l(e),s?.(e))},[o,s,n]),x=a.useCallback((e,t)=>{const a=eh(c,e,e=>({...e,text:t}));h(a,c)},[c,h]),f=a.useCallback((e,t)=>{const a=eh(c,e,e=>({...e,...t}));h(a,c)},[c,h]),g=a.useCallback((e,t="")=>{const{root:a,newId:r}=ah(c,e,t);return h(a,c),u(r),r},[c,h]),b=a.useCallback((e,t="")=>{const{root:a,newId:r}=rh(c,e,t);return h(a,c),u(r),r},[c,h]),v=a.useCallback(e=>{const{root:t,nextSelectedId:a}=sh(c,e);t!==c&&(h(t,c),u(a))},[c,h]),y=a.useCallback((e,t)=>{const a=nh(c,e,t);a!==c&&h(a,c)},[c,h]),w=a.useCallback(e=>{const t=Jp(c,e);if(!t||!t.node.children?.length)return;const a=oh(c,e);h(a,c)},[c,h]),j=a.useCallback(()=>{h(ih(c,!1),c)},[c,h]),N=a.useCallback(()=>{h(ih(c,!0),c)},[c,h]),_=a.useCallback(()=>{const e=m.current.pop();e&&(p.current.push(c),o||l(e),s?.(e))},[c,o,s]),C=a.useCallback(()=>{const e=p.current.pop();e&&(m.current.push(c),o||l(e),s?.(e))},[c,o,s]),k=m.current.length>0,S=p.current.length>0,A=a.useMemo(()=>d?Jp(c,d)?.node??null:null,[c,d]),T=a.useCallback(e=>{h(e,c)},[c,h]);return{root:c,setRoot:T,selectedId:d,selectedNode:A,setSelectedId:u,renameNode:x,updateNodeProps:f,addChild:g,addSibling:b,removeNode:v,moveNode:y,toggleNode:w,expandAll:j,collapseAll:N,undo:_,redo:C,canUndo:k,canRedo:S}}const ch=180,dh=80,uh=16,mh=60;function ph(e){const t=(e.collapsed?[]:e.children??[]).map(ph);if(!t.length)return{node:e,visibleChildren:t,height:44};const a=t.reduce((e,t)=>e+t.height,0)+uh*(t.length-1);return{node:e,visibleChildren:t,height:Math.max(44,a)}}function hh(e,t,a,r,s,n,o){const i=[],l={node:e.node,parent:t,x:a,y:r,width:180,height:44,side:s,depth:n,visibleChildren:i};if(o.push(l),!e.visibleChildren.length)return l;let c=r+22-(e.visibleChildren.reduce((e,t)=>e+t.height,0)+uh*(e.visibleChildren.length-1))/2;for(const d of e.visibleChildren){const t="right"===s?a+180+dh:a-dh-ch,r=c+d.height/2-22,l=hh(d,e.node,t,r,s,n+1,o);i.push(l),c+=d.height+uh}return l}function xh(e){return a.useMemo(()=>function(e){const t=e.collapsed?[]:e.children??[],a=t.filter(e=>"left"!==e.side).map(ph),r=t.filter(e=>"left"===e.side).map(ph),s=a.reduce((e,t)=>e+t.height,0)+uh*Math.max(0,a.length-1),n=r.reduce((e,t)=>e+t.height,0)+uh*Math.max(0,r.length-1),o=Math.max(s,n,56),i=e=>e.visibleChildren.length?1+Math.max(...e.visibleChildren.map(i)):0,l=a.length?Math.max(...a.map(i))+1:0,c=260*(r.length?Math.max(...r.map(i))+1:0),d=220+260*l+c+120,u=o+120,m=mh+c,p=[],h={node:e,parent:null,x:m,y:mh+o/2-28,width:220,height:56,side:"root",depth:0,visibleChildren:[]};p.push(h);let x=mh+o/2-s/2;for(const b of a){const t=x+b.height/2-22,a=hh(b,e,m+220+dh,t,"right",1,p);h.visibleChildren.push(a),x+=b.height+uh}let f=mh+o/2-n/2;for(const b of r){const t=f+b.height/2-22,a=hh(b,e,m-dh-ch,t,"left",1,p);h.visibleChildren.push(a),f+=b.height+uh}const g=new Map(p.map(e=>[e.node.id,e]));return{nodes:p,byId:g,width:d,height:u}}(e),[e])}function fh(e,t){const{layout:a,selectedId:r,setSelectedId:s}=t;if(!r)return void s(a.nodes[0]?.node.id??null);const n=a.byId.get(r);if(!n)return;if("left"===e||"right"===e){if("root"===n.side){const t=n.visibleChildren.find(t=>t.side===e);return void(t&&s(t.node.id))}if(e===n.side){const e=n.visibleChildren[Math.floor(n.visibleChildren.length/2)];e&&s(e.node.id)}else n.parent&&s(n.parent.id);return}if(!n.parent)return;const o=a.byId.get(n.parent.id);if(!o)return;const i=o.visibleChildren.filter(e=>e.side===n.side),l=i.findIndex(e=>e.node.id===r),c="up"===e?i[l-1]:i[l+1];c&&s(c.node.id)}const gh=({layout:e,selected:a,editing:r,readOnly:s,onSelect:n,onStartEditing:o,onFinishEditing:i,onToggle:l,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,isDropTarget:h,renderNodeContent:x})=>{const f=e.node,g="root"===e.side,b=(v=f.icon)?ae[v]??null:null;var v;const y=!!f.children?.length,w=te.useRef(null),[j,N]=te.useState(f.text);te.useEffect(()=>{if(r){N(f.text);const e=window.setTimeout(()=>{w.current?.focus(),w.current?.select()},0);return()=>window.clearTimeout(e)}},[r,f.text]);const _=()=>{i(j.trim()||f.text)},C=f.color;return t.jsxs("div",{role:"treeitem","aria-selected":a,"aria-expanded":y?!f.collapsed:void 0,tabIndex:a?0:-1,"data-node-id":f.id,draggable:!s&&!g&&!r,onDragStart:d,onDragOver:u,onDragLeave:m,onDrop:p,onClick:e=>{e.stopPropagation(),n()},onDoubleClick:e=>{e.stopPropagation(),s||o()},className:Nr("absolute flex items-center gap-2 rounded-lg border bg-card text-card-foreground px-3 select-none transition-shadow","shadow-sm hover:shadow-md cursor-pointer",g&&"font-semibold border-primary/40 bg-primary text-primary-foreground",a&&!g&&"ring-2 ring-primary ring-offset-1",a&&g&&"ring-2 ring-primary-foreground/60 ring-offset-1",h&&"ring-2 ring-accent border-accent"),style:{left:e.x,top:e.y,width:e.width,height:e.height,backgroundColor:C},children:[b&&t.jsx(b,{className:Nr("h-4 w-4 shrink-0",g&&"text-primary-foreground")}),t.jsx("div",{className:"flex-1 min-w-0",children:r?t.jsx("input",{ref:w,value:j,onChange:e=>N(e.target.value),onBlur:_,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),_()):"Escape"===e.key?(e.preventDefault(),i(null)):e.stopPropagation()},className:Nr("w-full bg-transparent outline-none text-sm",g&&"text-primary-foreground placeholder:text-primary-foreground/60")}):x?t.jsx("div",{className:"text-sm truncate",children:x(f)}):t.jsx("div",{className:"text-sm truncate",children:f.text||t.jsx("span",{className:"opacity-50",children:"—"})})}),f.note&&!r&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("button",{type:"button",onClick:e=>e.stopPropagation(),className:Nr("shrink-0 rounded p-0.5 hover:bg-muted/40",g&&"hover:bg-primary-foreground/10"),"aria-label":f.note,children:t.jsx(c.FileText,{className:"h-3.5 w-3.5 opacity-70"})})}),t.jsx(Zs,{className:"max-w-xs whitespace-pre-line",children:f.note})]}),y&&t.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),l()},className:Nr("shrink-0 rounded-full border bg-background text-foreground h-5 w-5 flex items-center justify-center -mr-1","shadow-sm hover:bg-muted transition-colors",g&&"border-primary-foreground/30"),"aria-label":f.collapsed?"Expandir":"Colapsar",children:f.collapsed?t.jsx(c.Plus,{className:"h-3 w-3"}):"left"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3 rotate-180"}):"right"===e.side?t.jsx(c.ChevronRight,{className:"h-3 w-3"}):t.jsx(c.Minus,{className:"h-3 w-3"})})]})},bh=({parent:e,child:a})=>{const r=a.x+a.width/2<e.x+e.width/2,s=r?e.x:e.x+e.width,n=e.y+e.height/2,o=r?a.x+a.width:a.x,i=a.y+a.height/2,l=(s+o)/2,c=`M ${s} ${n} C ${l} ${n}, ${l} ${i}, ${o} ${i}`;return t.jsx("path",{d:c,fill:"none",stroke:"hsl(var(--border))",strokeWidth:2,strokeLinecap:"round"})},vh=({label:e,icon:a,onClick:r,disabled:s})=>t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:s,"aria-label":e,className:"h-8 w-8",children:a})}),t.jsx(Zs,{children:e})]}),yh=e=>{const{t:a}=y.useTranslation();return t.jsxs("div",{className:"flex items-center gap-1 border-b bg-card px-2 py-1.5",children:[t.jsx(vh,{label:a("mind_map_add_child"),icon:t.jsx(c.CornerDownRight,{className:"h-4 w-4"}),onClick:e.onAddChild,disabled:!e.canAddChild}),t.jsx(vh,{label:a("mind_map_add_sibling"),icon:t.jsx(c.Plus,{className:"h-4 w-4"}),onClick:e.onAddSibling,disabled:!e.canAddSibling}),t.jsx(vh,{label:a("mind_map_delete_node"),icon:t.jsx(c.Trash2,{className:"h-4 w-4"}),onClick:e.onDelete,disabled:!e.canDelete}),t.jsx(Fr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(vh,{label:a("mind_map_expand_all"),icon:t.jsx(c.ChevronsUpDown,{className:"h-4 w-4"}),onClick:e.onExpandAll}),t.jsx(vh,{label:a("mind_map_collapse_all"),icon:t.jsx(c.ChevronsDownUp,{className:"h-4 w-4"}),onClick:e.onCollapseAll}),t.jsx(Fr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(vh,{label:a("mind_map_zoom_out"),icon:t.jsx(c.ZoomOut,{className:"h-4 w-4"}),onClick:e.onZoomOut}),t.jsx(vh,{label:a("mind_map_zoom_in"),icon:t.jsx(c.ZoomIn,{className:"h-4 w-4"}),onClick:e.onZoomIn}),t.jsx(vh,{label:a("mind_map_fit_to_screen"),icon:t.jsx(c.Maximize2,{className:"h-4 w-4"}),onClick:e.onFit}),t.jsx(Fr,{orientation:"vertical",className:"mx-1 h-5"}),t.jsx(vh,{label:a("mind_map_undo"),icon:t.jsx(c.Undo2,{className:"h-4 w-4"}),onClick:e.onUndo,disabled:!e.canUndo}),t.jsx(vh,{label:a("mind_map_redo"),icon:t.jsx(c.Redo2,{className:"h-4 w-4"}),onClick:e.onRedo,disabled:!e.canRedo}),t.jsx("div",{className:"flex-1"}),t.jsx(vh,{label:a("mind_map_export_json"),icon:t.jsx(c.Download,{className:"h-4 w-4"}),onClick:e.onExportJson}),t.jsx(vh,{label:a("mind_map_export_image"),icon:t.jsx(c.Image,{className:"h-4 w-4"}),onClick:e.onExportImage})]})};function wh(e){return JSON.stringify(e,null,2)}function jh(e){if(!e||"object"!=typeof e)throw new Error("Invalid mind map node: not an object");const t=e;if("string"!=typeof t.text)throw new Error('Invalid mind map node: missing "text"');const a=Array.isArray(t.children)?t.children.map(e=>jh(e)):void 0;return Xp(t.text,{id:"string"==typeof t.id?t.id:void 0,collapsed:"boolean"==typeof t.collapsed?t.collapsed:void 0,color:"string"==typeof t.color?t.color:void 0,icon:"string"==typeof t.icon?t.icon:void 0,note:"string"==typeof t.note?t.note:void 0,side:"left"===t.side||"right"===t.side?t.side:void 0,children:a})}function Nh({data:e,columns:r,sortField:s,sortDirection:n,onSort:o,onRowClick:i,renderActions:l,isLoading:d=!1,emptyMessage:u,className:m,enableSelection:p=!1,selectedIds:h=[],onSelectItem:x,onSelectAll:f,isAllSelected:g=!1,enableColumnResize:b=!0,onColumnResize:v,enableColumnReorder:w=!1,onReorderColumns:j,storageKey:N,enableExpandableRows:_=!1,renderExpandedContent:C,expandedRowIds:k,onToggleExpand:S,defaultExpandAll:A=!1,rowActionsVariant:T="default",hideActionsColumn:D=!1,actionsHeaderContent:E}){const{t:P}=y.useTranslation(),I=u||P("no_items_found",P("no_items_found_empty")),[M,R]=a.useState(()=>A?new Set(e.map(e=>e.id)):new Set),L=void 0!==k,F=L?new Set(k):M,z=a.useCallback(e=>{L&&S?S(e):R(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[L,S]),{columnWidths:U,isDragging:O,activeColumn:B,handleMouseDown:q}=ci({columns:r.map(e=>({key:String(e.key),minWidth:e.minWidth??60,maxWidth:e.maxWidth??500,defaultWidth:e.width??e.minWidth??150})),storageKey:N?`${N}-columns`:void 0,onResize:v,enabled:b}),$=vi({enabled:w&&!!j,onReorder:j??(()=>{})}),V=a.useMemo(()=>{if(b){const e=r.map(e=>U[String(e.key)]??e.width??e.minWidth??150),t=e.reduce((e,t)=>e+t,0);return e.map(e=>e/t*100+"%")}const e=r.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return r.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const a=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${a}%)`:`${a}%`})},[r,b,U]);if(d)return t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,a)=>t.jsx(pn,{className:"h-12 w-full"},a))})});if(0===e.length)return t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-center text-muted-foreground",children:t.jsx("p",{children:I})})});const W=l&&!D,H=(p?1:0)+(_?1:0)+r.length+(W?1:0);return t.jsx("div",{className:"flex-1 overflow-auto "+(O?"select-none":""),children:t.jsxs(Do,{className:Nr("table-fixed w-full",m),children:[t.jsx(Eo,{className:"sticky top-0 bg-background z-10",children:t.jsxs(Mo,{children:[_&&t.jsx(Ro,{className:"w-[40px]"}),p&&t.jsx(Ro,{className:"w-[40px]",children:t.jsx(Ss,{checked:g,onCheckedChange:f,"aria-label":P("select_all","Selecionar todos")})}),r.map((e,a)=>{const r=b&&!1!==e.resizable,i=B===String(e.key),l=w&&!!j,d=l?$.getDragProps(a):{},u=$.dragFromIndex===a,m=$.dragOverIndex===a&&$.dragFromIndex!==a;return t.jsxs(Ro,{className:Nr(e.className,"relative transition-opacity",e.sortable&&"cursor-pointer",l&&$.isDragging&&"cursor-grabbing",u&&"opacity-50",m&&"border-l-2 border-primary"),style:{width:V[a]},...d,children:[!1!==e.sortable&&o?t.jsxs("button",{onClick:()=>o(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(p=String(e.key),s!==p?null:"asc"===n?t.jsx(c.ArrowUp,{size:14,className:"ml-1"}):t.jsx(c.ArrowDown,{size:14,className:"ml-1"}))]}):t.jsx("span",{className:"font-medium",children:e.header}),r&&t.jsx($o,{direction:"horizontal",onMouseDown:t=>q(String(e.key),t),isDragging:i})]},String(e.key));var p}),W&&t.jsx(Ro,{className:"w-[80px] text-right",children:E??P("actions","Ações")})]})}),t.jsx(Po,{children:e.map(e=>{const s=_&&F.has(e.id);return t.jsxs(a.Fragment,{children:[t.jsxs(Mo,{onClick:()=>i?.(e),className:Nr(i?"cursor-pointer":"","relative","inline"===T&&"group"),children:[_&&t.jsx(Lo,{className:"w-[40px] px-2",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),z(e.id)},className:"p-1 rounded-sm hover:bg-muted transition-colors","aria-label":s?P("collapse_row","Recolher linha"):P("expand_row","Expandir linha"),children:s?t.jsx(c.ChevronDown,{size:16,className:"text-muted-foreground"}):t.jsx(c.ChevronRight,{size:16,className:"text-muted-foreground"})})}),p&&t.jsx(Lo,{children:t.jsx(Ss,{checked:h.includes(e.id),onCheckedChange:()=>x?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`${P("select_all","Selecionar todos")} ${e.id}`})}),r.map(a=>t.jsx(Lo,{className:a.className,children:t.jsx(qo,{children:a.render?a.render(e):String(e[a.key]??"-")})},String(a.key))),W&&t.jsx(Lo,{className:"text-right",onClick:e=>e.stopPropagation(),children:"inline"===T?t.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:l(e)}):l(e)})]}),s&&C&&t.jsx(Mo,{className:"bg-muted/30 hover:bg-muted/30",children:t.jsx(Lo,{colSpan:H,className:"p-0",children:t.jsx("div",{className:"animate-accordion-down overflow-hidden",children:C(e)})})})]},e.id)})})]})})}function _h({searchValue:e="",onSearchChange:a,customFilters:r=[],onClearFilters:s,showClearButton:n=!0,layout:o="horizontal"}){const{t:i}=y.useTranslation(),l=e||r.length>0;return t.jsxs("div",{className:`flex ${"vertical"===o?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[a&&t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Ar,{type:"text",placeholder:i("search","Pesquisar"),value:e,onChange:e=>a(e.target.value),className:"pl-9 h-9"})]}),r.map((e,a)=>t.jsx("div",{className:"vertical"===o?"w-full":"",children:e},a)),n&&l&&s&&t.jsxs(kr,{variant:"ghost",size:"sm",onClick:s,className:"h-9 px-3 whitespace-nowrap",children:[t.jsx(c.X,{size:14,className:"mr-1"}),i("clear_filters","Limpar filtros")]})]})}function Ch(e,t){const a=new Set;function r(e){if(e)for(const t of e)a.add(t.id),r(t.children)}return function e(a){for(const s of a){if(s.id===t)return r(s.children),!0;if(s.children&&e(s.children))return!0}return!1}(e),a}function kh({children:e,itemId:a,enableDrag:r,onDragStartCell:s,onDragEndCell:n,onDragOverCell:o,onDropCell:i,className:l}){return t.jsx(Lo,{draggable:r,onDragStart:r?e=>s(a,e):void 0,onDragEnd:r?n:void 0,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o(a,e)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),i(a,e)},className:l,children:e})}function Sh({item:e,level:a,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u="default",enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j}){const N=o.has(e.id),_=(e.children?.length??0)>0,C=24*a,k="inline"===u,S=f===e.id||p?.has(e.id)&&f&&p?.has(f),A=g===e.id&&f!==e.id,T=p?.has(e.id)??!1,D={itemId:e.id,enableDrag:x,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w};return t.jsxs(t.Fragment,{children:[t.jsxs(Mo,{className:Nr(l&&"cursor-pointer",k&&"group",S&&"opacity-40",A&&"ring-2 ring-primary ring-inset bg-primary/5"),onClick:l?()=>l(e):void 0,children:[t.jsx(kh,{...D,children:t.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${C}px`},children:[m&&t.jsx(Ss,{checked:T,onCheckedChange:()=>h?.(e.id),onClick:e=>e.stopPropagation(),className:"shrink-0"}),x&&t.jsx("span",{className:"cursor-grab text-muted-foreground shrink-0 select-none",title:"Arrastar",children:"⠿"}),_?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-accent rounded shrink-0",children:N?t.jsx(c.ChevronDown,{className:"h-4 w-4"}):t.jsx(c.ChevronRight,{className:"h-4 w-4"})}):t.jsx("div",{className:"w-6 shrink-0"}),n??t.jsx(c.User,{className:"h-4 w-4 text-muted-foreground shrink-0"}),t.jsx("span",{className:"truncate",children:String(e[s]??e.id)}),f===e.id&&j&&j>1&&t.jsx("span",{className:"ml-1 inline-flex items-center rounded-full bg-primary px-1.5 py-0 text-xs font-semibold text-primary-foreground",children:j})]})}),r.map(r=>{const s=e[r.key],n=r.render?r.render(e,a):null!=s?String(s):"—";return t.jsx(kh,{...D,className:Nr("text-center",r.className),children:r.hoverContent?t.jsxs(Xc,{openDelay:200,children:[t.jsx(Jc,{asChild:!0,children:t.jsx("span",{className:"cursor-default underline decoration-dotted underline-offset-4 text-foreground",children:n})}),t.jsx(Zc,{side:"bottom",align:"center",className:"w-auto max-w-xs",children:r.hoverContent(e)})]}):n},String(r.key))}),d&&t.jsx(kh,{...D,className:"text-right",children:t.jsx("div",{onClick:e=>e.stopPropagation(),className:Nr("flex items-center justify-end gap-1",k&&"opacity-0 group-hover:opacity-100 transition-opacity"),children:d(e)})})]}),_&&N&&e.children.map(e=>t.jsx(Sh,{item:e,level:a+1,columns:r,nameKey:s,iconComponent:n,expandedIds:o,onToggleExpand:i,onRowClick:l,renderActions:d,rowActionsVariant:u,enableSelection:m,selectedIds:p,onSelectItem:h,enableRowDrag:x,draggedId:f,dragOverId:g,onDragStartCell:b,onDragEndCell:v,onDragOverCell:y,onDropCell:w,dragCount:j},e.id))]})}function Ah({onDrop:a,isDragOver:r,onDragOver:s,onDragLeave:n,label:o}){return t.jsxs("div",{className:Nr("absolute top-0 left-0 right-0 z-10 flex items-center justify-center gap-2 py-2 px-4 border-2 border-dashed rounded-md text-sm transition-colors mx-2 mt-2",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground bg-background/95"),onDragOver:s,onDragEnter:s,onDragLeave:n,onDrop:a,children:[t.jsx(c.ArrowUpToLine,{className:"h-4 w-4"}),o??e.t("leadership_make_root_short")]})}function Th(e){const t=N.useNavigate();return{onNew:()=>{const a=e.newPath||`${e.basePath}/new`;t(a)},onEdit:a=>{const r=e.editPath?e.editPath.replace(":id",a.id):`${e.basePath}/${a.id}/edit`;t(r)}}}const Dh="true"===(void 0).VITE_SHOW_EDIT_PROFILE,Eh=a.memo(({variant:e="card",className:r="",selectedUnit:s,onUnitChange:n})=>{const{t:o}=y.useTranslation(),{user:i,companies:l,alias:d,isAuthenticated:u,logout:m,switchUnit:p}=ko(),{role:h}=Tl(),x=h?.name||null,f=l?.[0]||null,g=d?l?.find(e=>e.alias===d):f,b=l||[],v=s||g||f||f,[w,j]=a.useState(0);a.useEffect(()=>{const e=()=>j(e=>e+1);return window.addEventListener("user-photo-updated",e),()=>window.removeEventListener("user-photo-updated",e)},[]);const N=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=48&v=${w}`},[i?.id,w]),_=a.useMemo(()=>{if(!i?.id)return null;const e=(new Date).toISOString().slice(0,10);return`https://login-api.qualiex.com/api/Users/Photo/${i.id}/${e}/1?size=96&v=${w}`},[i?.id,w]),C=a.useMemo(()=>{if(!i?.name)return"";const e=i.name.trim().split(/\s+/);return 1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[e.length-1].charAt(0)).toUpperCase()},[i?.name]),k=a.useCallback(e=>{n?n(e):p(e)},[n,p]),S=a.useMemo(()=>{if(!b?.length)return[];const e=new Map;b.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),a=t.find(e=>e.alias===v?.alias),r=t.filter(e=>e.alias!==v?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),a?[a,...r]:r},[b,v?.alias]),[A,T]=a.useState(!1);if(!u||!i)return null;const D=()=>t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsxs(Ji,{className:"w-10 h-10",children:[N&&t.jsx(Zi,{src:N,alt:i.name||o("user_photo")}),t.jsx(el,{className:"bg-primary text-primary-foreground text-white font-semibold text-sm",children:C||t.jsx(c.User,{className:"h-5 w-5"})})]})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",v?.name||"N/A"]})]})]}),v&&t.jsx("div",{className:"mt-3",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(c.Building2,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:v.name})]})}),S.length>1&&t.jsxs("div",{className:"mt-2",children:[t.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",S.length]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[S.slice(0,3).map(e=>t.jsx(Ds,{variant:e.alias===v?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>k(e),children:e.name},e.alias)),S.length>3&&t.jsxs(Ds,{variant:"outline",className:"text-xs",children:["+",S.length-3]})]})]})]});return"dropdown"===e?t.jsxs(t.Fragment,{children:[t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsx(kr,{variant:"ghost",className:`h-auto p-2 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10 ${r}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"hidden md:block text-right",children:[t.jsxs("p",{className:"text-sm font-medium",children:[i.name?.split(" ")[0],x?` [${x}]`:""]}),t.jsx("p",{className:"text-xs text-primary-foreground/70",children:v?.name||"N/A"})]}),t.jsxs(Ji,{className:"w-8 h-8 border border-primary-foreground/30",children:[N&&t.jsx(Zi,{src:N,alt:i.name||o("user_photo")}),t.jsx(el,{className:"bg-primary-foreground/20 text-primary-foreground font-semibold text-xs",children:C||t.jsx(c.User,{className:"h-4 w-4"})})]}),t.jsx(c.ChevronDown,{className:"h-4 w-4"})]})})}),t.jsxs($s,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[t.jsxs(Us,{children:[t.jsxs(Bs,{children:[t.jsx(c.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),t.jsx(qs,{children:S.map(e=>t.jsxs(Vs,{onClick:()=>k(e),className:e.alias===v?.alias?"bg-muted":"",children:[t.jsx(c.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===v?.alias&&t.jsx(Ds,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Dh&&t.jsxs(t.Fragment,{children:[t.jsx(Ks,{}),t.jsxs(Vs,{onClick:()=>T(!0),children:[t.jsx(c.UserPen,{className:"mr-2 h-4 w-4"}),o("edit_profile","Editar Perfil")]})]}),t.jsx(Ks,{}),t.jsxs(Vs,{onClick:m,children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}),Dh&&t.jsx(xl,{open:A,onOpenChange:T,user:i,userPhotoUrl:_,userInitials:C})]}):t.jsxs(Er,{className:r,children:[t.jsx(Pr,{children:t.jsx(Ir,{className:"text-lg",children:o("user_info")})}),t.jsxs(Rr,{className:"space-y-4",children:[t.jsx(D,{}),t.jsx(Fr,{}),t.jsxs(kr,{variant:"outline",onClick:m,size:"sm",className:"w-full",children:[t.jsx(c.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),Ph=a.createContext({});function Ih({children:e,config:r}){const s=a.useMemo(()=>({navigation:r?.navigation,appName:r?.appName??void 0}),[r?.navigation,r?.appName]);return t.jsx(Ph.Provider,{value:s,children:e})}function Mh(){return a.useContext(Ph)}function Rh(e,t){if(!e)return"";const a=e.find(e=>e.path===t);if(a)return a.label;const r=e.find(e=>t.startsWith(e.path+"/"));return r?.label||""}function Lh(e,t){const[r,s]=a.useState(e),n=a.useRef(),o=a.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=void 0)},[]);return a.useEffect(()=>(o(),n.current=setTimeout(()=>{s(e)},t),o),[e,t,o]),[r,o]}function Fh({appName:e}){const[r,s]=a.useState(!1),{association:n}=Tl(),o=it({isQualitfy:n?.isQualitfy,isMetroex:n?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>s(!0),children:t.jsx("img",{src:o,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),e&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":!0,className:"h-7 w-px shrink-0 bg-primary-foreground/30"}),t.jsx("button",{className:"min-w-0 text-sm font-medium text-left cursor-pointer text-primary-foreground/90 hover:text-primary-foreground/70 transition-colors leading-tight py-1",onClick:()=>s(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(e)})})]})]}),t.jsx(pc,{open:r,onOpenChange:s})]})}const zh=a.memo(function({actions:r}){const s=N.useLocation(),n=N.useNavigate(),{navigation:o,appName:i}=Mh(),l=Rh(o,s.pathname),{metadata:d,headerActions:u}=bl(),{setOpenMobile:m}=Zd(),{companies:p,alias:h,isSearchVisible:x,clearSearch:f,refreshData:g,switchUnit:b}=ko(),v=h?p?.find(e=>e.alias===h)||p?.[0]||null:p?.[0]||null,[y,w]=N.useSearchParams(),j=a.useCallback(e=>{const{pathname:t,search:a,hash:r}=s;if(h){const s=t.split("/"),o=s.indexOf(h);if(o>=0)return s[o]=e.alias,void n(s.join("/")+a+r)}b(e)},[h,s,n,b]),[_,C]=a.useState(()=>y.get("search")||""),[k,S]=Lh(_,$e.debounceDelay);a.useEffect(()=>{if(!x)return;const e=new URLSearchParams(y);k?(e.set("search",k),e.set("page","1")):e.delete("search"),w(e)},[k,w,x]);const A=o?.find(e=>e.path===s.pathname)||o?.find(e=>s.pathname.startsWith(e.path+"/")),T=d.title||l,D=d.subtitle||A?.complementaryText||"";return t.jsx("header",{className:"bg-primary border-b border-primary px-2 md:px-4 py-2",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(kr,{variant:"ghost",size:"sm",className:"md:hidden h-8 w-8 p-0 flex-shrink-0 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:()=>m(!0),children:t.jsx(c.Menu,{size:20})}),t.jsx("div",{className:"hidden md:flex items-center flex-shrink-0",children:t.jsx(Fh,{appName:i})}),t.jsx("div",{className:"hidden md:block w-px h-8 bg-primary-foreground/20 flex-shrink-0"}),t.jsxs("div",{className:"flex-shrink-0",children:[d.breadcrumbs&&d.breadcrumbs.length>0&&t.jsx("nav",{className:"flex items-center gap-1 text-xs text-primary-foreground/70 mb-0.5",children:d.breadcrumbs.map((e,a)=>t.jsxs("span",{className:"flex items-center gap-1",children:[a>0&&t.jsx(c.ChevronRight,{className:"h-3 w-3"}),e.href?t.jsx(N.Link,{to:e.href,className:"hover:text-primary-foreground transition-colors",children:e.label}):t.jsx("span",{children:e.label})]},a))}),t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("h1",{className:"text-lg font-semibold text-primary-foreground truncate",children:T})}),D&&t.jsx("div",{className:"text-sm text-primary-foreground/70 truncate",children:D})]}),x&&t.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),t.jsx(Ar,{placeholder:"Pesquisar",value:_,onChange:e=>(e=>{C(e)})(e.target.value),className:"w-full pl-10 pr-8"}),_&&t.jsx(kr,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-primary-foreground/10 text-primary-foreground/60",onClick:()=>{S(),C("");const e=new URLSearchParams(y);e.delete("search"),e.delete("page"),w(e)},title:e.t("clear_search"),children:t.jsx(c.X,{size:14})})]}),t.jsx(kr,{variant:"outline",size:"sm",onClick:g,className:"flex-shrink-0 h-10 w-10 p-0 bg-primary-foreground/20 border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/30 hover:text-primary-foreground",title:e.t("refresh_data"),children:t.jsx(c.RefreshCw,{size:14})})]}),t.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[(u||r)&&t.jsx("div",{className:"flex items-center gap-2",children:u||r}),(void 0).VITE_WIKI_URL&&t.jsx(kr,{variant:"ghost",size:"sm",className:"h-8 px-3 text-primary-foreground hover:text-primary-foreground hover:bg-primary-foreground/10",onClick:e=>fr((void 0).VITE_WIKI_URL,e),title:e.t("open_wiki"),children:"Wiki"}),t.jsx(mm,{}),t.jsx("div",{className:"text-sm",children:t.jsx(Eh,{variant:"dropdown",selectedUnit:v,onUnitChange:j})})]})]})})}),Uh=({key:e,enabled:t,checkFn:a,staleTime:r=3e5,gcTime:s=6e5})=>j.useQuery({queryKey:["permission",e],queryFn:a,enabled:t,staleTime:r,gcTime:s,retry:0,refetchOnWindowFocus:!1});function Oh({config:e,isCollapsed:a=!1,isDisabled:r=!1,className:s}){const{t:n}=y.useTranslation(),{actions:o,triggerLabel:i="Criar",triggerIcon:l=c.Plus,variant:d="button"}=e;if(!o||0===o.length)return null;if("split-button"===d){const e=o[0],n=e.icon||l,i=o.slice(1).map(e=>({id:e.id,label:e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled}));if(a){const a=t.jsx(kr,{onClick:e.onClick,disabled:r||e.disabled,className:Nr("justify-center px-2 w-full",s),variant:"outline",size:"default",children:t.jsx(n,{className:"h-4 w-4 shrink-0"})});return t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:a}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:e.label})})]})}return t.jsx(rm,{label:e.label,onClick:e.onClick,icon:n,actions:i,variant:"outline",disabled:r||e.disabled,className:Nr("w-full",s),menuAlign:"start"})}const u=(e,r,s=!1)=>t.jsxs(t.Fragment,{children:[e,!a&&r&&t.jsx("span",{className:"truncate",children:r}),!a&&s&&t.jsx(c.ChevronDown,{className:"ml-auto h-4 w-4 shrink-0"})]});if(!(o.length>1)){const e=o[0],n=e.icon||l,i=r||e.disabled,c=t.jsx(kr,{onClick:e.onClick,disabled:i,className:Nr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label)});return a?t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:c}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:e.label})})]}):c}const m=t.jsx(kr,{disabled:r,className:Nr("w-full gap-2 justify-start",a&&"justify-center px-2",s),variant:"outline",size:"default",children:u(t.jsx(l,{className:"h-4 w-4 shrink-0"}),i,!0)});return t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:a?t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:m}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:i})})]}):m}),t.jsx($s,{align:"start",side:a?"right":"bottom",className:"w-56 bg-popover",children:o.map(e=>{const a=e.icon;return t.jsxs(Vs,{onClick:e.onClick,disabled:e.disabled,className:"cursor-pointer",children:[a&&t.jsx(a,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})]})}const Bh="forlogic-sidebar-pinned",qh=()=>{try{const e=localStorage.getItem(Bh);return!!e&&JSON.parse(e)}catch{return!1}};function $h({direction:e="right",minWidth:t=224,maxWidth:r=384,defaultWidth:s=290,storageKey:n="sidebar-width",onResize:o,isOpen:i=!0}={}){const[l,c]=a.useState(()=>{if("undefined"==typeof window)return s;const e=localStorage.getItem(n);return e?parseInt(e):s}),[d,u]=a.useState(!1),m=a.useRef(null);a.useEffect(()=>{const e=document.querySelector(".sidebar-container");e&&e instanceof HTMLElement&&(i?e.style.setProperty("--sidebar-width",`${l}px`):e.style.setProperty("--sidebar-width","290px"))},[l,i]);const p=a.useCallback(e=>{e.preventDefault(),u(!0)},[]);return a.useEffect(()=>{if(!d)return;const a=a=>{let s;s="left"===e?window.innerWidth-a.clientX:a.clientX,s=Math.max(t,Math.min(r,s)),c(s),o?.(s)},s=()=>{u(!1),c(e=>(localStorage.setItem(n,e.toString()),e))};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s)}},[d,e,t,r,l,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="ew-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d,e]),{width:l,isDragging:d,dragRef:m,handleMouseDown:p}}const Vh=a.createContext(void 0);function Wh(){const e=a.useContext(Vh);return e||{openModals:new Set,hasOpenModal:!1,registerModal:()=>{},unregisterModal:()=>{},setHasOpenModal:()=>{}}}function Hh({config:e,customContent:r,resizable:s=!1,minWidth:n=224,maxWidth:o=384}={}){const{t:i}=y.useTranslation(),{open:l,setOpen:d,setOpenMobile:u}=Zd(),m=N.useLocation(),{alias:p,user:h}=ko(),{appName:x}=Mh(),{hasOpenModal:f}=Wh(),[g,b]=a.useState(qh),v=To(),w=!!v||l,j=a.useCallback(()=>{v&&u(!1)},[v,u]),_=s?$h({minWidth:n,maxWidth:o,storageKey:"app-sidebar-width",isOpen:l}):null;a.useEffect(()=>{d(!!g)},[g,d]);const C=e=>m.pathname===e||m.pathname.startsWith(e+"/");return t.jsxs(tu,{collapsible:"icon",className:Nr("app-sidebar bg-background border-r border-border flex flex-col",w?"px-3":"px-1.5"),style:_&&w?{width:`${_.width}px`,transition:"none"}:{transition:"width 300ms ease-in-out"},children:[e?.moduleActions&&e.moduleActions.actions.length>0&&t.jsx("div",{className:"py-3",children:t.jsx(Qs,{children:t.jsx(Oh,{config:e.moduleActions,isCollapsed:!w,isDisabled:f})})}),t.jsx(cu,{className:Nr(e?.moduleActions&&e.moduleActions.actions.length>0?"pt-0":"pt-3"),children:r||t.jsx(du,{className:"p-0",children:t.jsx(pu,{children:t.jsx(hu,{className:"gap-1",children:t.jsx(Qs,{children:e?.navigation?.map((e,a)=>{if("separator"===e.type)return t.jsx(lu,{className:"my-2"},`sep-${a}`);const r=({item:e,index:a})=>{const s=`${e.path}-${a}-${p??"noalias"}-${h?.id??"nouser"}`,{data:n=!0,isLoading:o}=Uh({key:s,enabled:Boolean(e.permissionCheck&&p&&h?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),l=e.permissionCheck&&!n,d=o?c.Loader2:l?c.Lock:e.icon;l?i("restricted_access"):e.complementaryText;return e.children&&e.children.length>0?w?t.jsx(Fl,{defaultOpen:!0,className:"group/collapsible",children:t.jsxs(xu,{children:[t.jsx(zl,{asChild:!0,children:t.jsx(gu,{size:"default",children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label}),t.jsx(c.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90"})]})})}),t.jsx(Ul,{children:t.jsx(wu,{children:e.children.map((e,a)=>t.jsx(r,{item:e,index:a},e.path))})})]})},e.path):t.jsx(xu,{children:t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("div",{className:Nr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors cursor-pointer","hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path):t.jsx(xu,{children:l||o?t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:w?t.jsx(gu,{size:"default",className:"opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsxs("div",{className:"flex w-full items-center gap-3",children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsx("div",{className:"flex items-center justify-center h-8 w-8 mx-auto rounded-md opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:t.jsx(d,{className:"h-4 w-4 "+(o?"animate-spin":"")})})}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:o?"Verificando acesso...":i("restricted_access")})})]}):w?t.jsx(gu,{asChild:!0,isActive:C(e.path),size:"default",children:t.jsxs(N.Link,{to:e.path,className:"flex w-full items-center gap-3",onClick:j,children:[t.jsx("span",{className:"flex items-center justify-center h-8 w-8",children:t.jsx(d,{className:"h-4 w-4"})}),t.jsx("span",{className:"font-medium sidebar-text",children:e.label})]})}):t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(N.Link,{to:e.path,onClick:j,className:Nr("flex items-center justify-center h-8 w-8 mx-auto rounded-md transition-colors",C(e.path)?"bg-primary/10 text-primary":"hover:bg-accent hover:text-accent-foreground"),children:t.jsx(d,{className:"h-4 w-4"})})}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:e.label})})]})},e.path)};return t.jsx(r,{item:e,index:a},e.path)})})})})})}),!v&&t.jsx("div",{className:Nr("mt-auto pb-4 pt-2 flex items-center gap-2",w?"justify-end px-1":"justify-center flex-col"),children:t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx("button",{id:"btn-expand-side-nav",onClick:()=>{const e=!g;b(e),(e=>{try{localStorage.setItem(Bh,JSON.stringify(e))}catch{}})(e)},className:"h-6 w-6 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 shadow-md transition-colors",children:l?t.jsx(c.ChevronLeft,{className:"h-3.5 w-3.5 text-primary-foreground"}):t.jsx(c.ChevronRight,{className:"h-3.5 w-3.5 text-primary-foreground"})})}),t.jsx(Zs,{side:"right",children:t.jsx("p",{children:l?"Recolher":"Expandir"})})]})}),s&&_&&w&&t.jsx("div",{ref:_.dragRef,onMouseDown:_.handleMouseDown,className:Nr("absolute inset-y-0 right-0 w-1 cursor-ew-resize","hover:bg-primary/20 transition-colors","after:absolute after:inset-y-0 after:-left-1 after:-right-1 after:content-['']",_.isDragging&&"bg-primary/40")})]})}function Gh(e){if("string"!=typeof e)return;return e.trim()||void 0}function Kh(){const{alias:e,isAuthenticated:t,isLoading:r,selectedUnit:s}=ko(),n=s?.id??null,o=!!$n.getAccessToken(),i=function(e,t){const a=Gh(t);if(a)return a;const r=$n,s=Gh(r.getCurrentCompanyId?.());if(s)return s;const n=$n.extractTokenData(),o=Gh(n?.companyId)??Gh(n?.company_id);if(o)return o;if(e){const t=Gh($n.getCompanyId(e));if(t)return t}}(e,n),l=!!e&&!!t&&o,c=l&&!!i,[,d]=a.useReducer(e=>e+1,0);a.useEffect(()=>{if(!t||o&&i)return;const e=window.setInterval(()=>d(),500);return()=>window.clearInterval(e)},[t,o,i]);let u=null;return r?u="Carregando autenticação...":t?e?o?i||(u="Aguardando unidade ativa..."):u="Aguardando token de acesso Qualiex...":u="Aguardando alias...":u="Usuário não autenticado",{alias:e,companyId:i,hasAccessToken:o,isAuthLoading:!!r,isAuthenticated:!!t,isReadyForQualiex:l,isReadyForQualiexWithCompany:c,isWaitingCompanyId:!!t&&o&&!i,waitingReason:u}}async function Yh(e,t){const a=await sl(`${tl()}/api/common/v1/updates/userView/${t}`,e),r=await a.json(),s=r?.data??r;return Array.isArray(s)?s:[]}async function Qh(e,t,a,r){const s=void 0===r?"undefined":String(r),n={id:t,idUpdateType:a};void 0!==r&&(n.liked=r),await sl(`${tl()}/api/common/v1/Updates/userVisualized/${a}/${s}`,e,{method:"POST",body:JSON.stringify(n)})}const Xh=3e5;function Jh(){const{alias:e,isReadyForQualiex:t}=Kh();return j.useQuery({queryKey:["user-updates","bar",e],queryFn:()=>Yh(e,1),enabled:t,staleTime:Xh})}function Zh(){const{alias:e,isReadyForQualiex:t}=Kh();return j.useQuery({queryKey:["user-updates","dialog",e],queryFn:()=>Yh(e,2),enabled:t,staleTime:Xh})}function ex({item:e,onDismiss:a}){const{t:r}=y.useTranslation(),s=e.text||e.title,n=e.color||"hsl(var(--primary))";return t.jsxs("div",{"data-testid":`updates-bar-${e.id}`,role:"status",style:{backgroundColor:n},className:"w-full flex items-center justify-center gap-3 px-4 py-2 text-sm text-white relative",children:[e.url?t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:underline",children:[s,t.jsx(c.ExternalLink,{className:"h-3.5 w-3.5"})]}):t.jsx("span",{children:s}),t.jsx("button",{type:"button",onClick:()=>a(e.id),"aria-label":r("updates_bar_close","Fechar"),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:t.jsx(c.X,{className:"h-4 w-4"})})]})}function tx(e){const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/^([a-zA-Z0-9_-]{11})$/];for(const a of t){const t=e.match(a);if(t)return t[1]}return null}function ax(e,t){const a=tx(e);if(!a)return e;return`https://www.youtube.com/embed/${a}${t?"?autoplay=1&mute=1":""}`}function rx(e){const t=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return t?t[1]:null}function sx(e,t){const a=rx(e);if(!a)return e;return`https://player.vimeo.com/video/${a}${t?"?autoplay=1&muted=1":""}`}function nx(e){if(!e)return;const t=e.match(/src="([^"]+)"/);return t?t[1]:void 0}function ox(e){return e?/youtube|youtu\.be/.test(e)?"youtube":/vimeo/.test(e)?"vimeo":"file":"file"}function ix({item:e,open:r,onClose:s}){const{t:n}=y.useTranslation(),[o,i]=a.useState(!1),[l,d]=a.useState(!1);a.useEffect(()=>{i(!1),d(!1)},[e.id]);const u=e.countLiked+(o?1:0);return t.jsx(Yr,{open:r,onOpenChange:e=>{e||s({liked:o,doNotShowAgain:l})},children:t.jsxs(ts,{size:"md",children:[t.jsx(as,{showSeparator:!0,children:t.jsx(ns,{style:e.color?{color:e.color}:void 0,children:e.title})}),t.jsxs(rs,{children:[(()=>{const a=e.urlVideo??e.videoUrl??e.url??"",r=a?tx(a):null;return r?t.jsx("div",{className:"mb-3 aspect-video w-full overflow-hidden rounded-lg border bg-black",children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${r}`,className:"h-full w-full",title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):null})(),t.jsx("div",{className:"text-sm leading-relaxed [&_a]:text-primary [&_a]:underline [&_strong]:font-semibold [&_p]:mb-2 [&_ul]:list-disc [&_ul]:ml-5 [&_ol]:list-decimal [&_ol]:ml-5 [&_img]:max-w-full [&_iframe]:max-w-full",dangerouslySetInnerHTML:{__html:e.description}})]}),t.jsxs(ss,{className:"!justify-between items-center",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>i(e=>!e),"aria-pressed":o,"aria-label":n("updates_dialog_like","Curtir"),className:Nr("inline-flex items-center justify-center h-8 w-8 rounded-full border transition-colors",o?"bg-primary/10 border-primary text-primary":"border-input text-muted-foreground hover:text-foreground hover:bg-accent"),children:t.jsx(c.Heart,{className:Nr("h-4 w-4",o&&"fill-current")})}),t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.5rem] h-6 px-2 rounded-full bg-primary text-primary-foreground text-xs font-medium",children:u})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer select-none",children:[t.jsx(Ss,{checked:l,onCheckedChange:e=>d(!0===e)}),n("updates_dialog_do_not_show_again","Não exibir novamente")]}),t.jsx(kr,{variant:"ghost",onClick:()=>s({liked:o,doNotShowAgain:l}),children:n("updates_dialog_close","Fechar")})]})]})]})})}function lx(e){return e&&e.trim()?e.trim():"anon"}function cx(e){try{const t=localStorage.getItem(e);if(!t)return new Set;const a=JSON.parse(t);return new Set(Array.isArray(a)?a.map(String):[])}catch{return new Set}}function dx(e,t){try{localStorage.setItem(e,JSON.stringify(Array.from(t)))}catch{}}function ux(e,t){if(!e)return e;const a=(t||"").trim().split(" ")[0]||"Colaborador";return e.replace(/@nome_usuario|@nome_usuário/g,a)}function mx(){const{alias:e}=Kh(),{user:r}=ko(),s=a.useMemo(()=>(r?.name||"").trim().split(" ")[0]||"Colaborador",[r?.name]),{data:n=[]}=Jh(),{data:o=[]}=Zh(),i=a.useMemo(()=>function(e){return`updates.bar.dismissed.${lx(e)}`}(e),[e]),l=a.useMemo(()=>function(e){return`updates.dialog.seen.${lx(e)}`}(e),[e]),[c,d]=a.useState(()=>cx(i)),[u,m]=a.useState(()=>cx(l)),[p,h]=a.useState(new Set),[x,f]=a.useState(0);if(a.useEffect(()=>{d(cx(i)),m(cx(l)),h(new Set),f(0)},[i,l]),!e)return null;const g=n.find(e=>!c.has(e.id)),b=o.filter(e=>!u.has(e.id)&&!p.has(e.id))[x],v=g&&{...g,title:ux(g.title,s),text:ux(g.text,s),description:ux(g.description,s)},y=b&&{...b,title:ux(b.title,s),description:ux(b.description,s)};return t.jsxs(t.Fragment,{children:[v&&t.jsx(ex,{item:v,onDismiss:async t=>{const a=new Set(c);a.add(t),d(a),dx(i,a);try{await Qh(e,t,1)}catch{}}}),y&&t.jsx(ix,{item:y,open:!0,onClose:async({liked:t,doNotShowAgain:a})=>{if(!b)return;const r=b.id;if(!a)return h(e=>{const t=new Set(e);return t.add(r),t}),void f(0);const s=new Set(u);s.add(r),m(s),dx(l,s),f(0);try{await Qh(e,r,2,t)}catch{}}})]})}const px=a.memo(function({children:e,sidebar:r,sidebarConfig:s,showHeader:n=!0,showSidebar:o=!0}){const i=a.useMemo(()=>o?r||t.jsx(Hh,{config:s}):null,[r,s,o]),l=a.useMemo(()=>({"--sidebar-width":"290px","--sidebar-width-icon":"58px"}),[]),c=a.useRef(null),d=a.useRef(null),u=a.useCallback(()=>{if(c.current&&d.current){const e=c.current.offsetHeight;d.current.style.setProperty("--header-height",`${e}px`)}},[]);return a.useEffect(()=>{u();const e=new ResizeObserver(u);return c.current&&e.observe(c.current),()=>e.disconnect()},[u]),t.jsx(Ih,{config:s,children:t.jsx(gl,{children:t.jsx(eu,{defaultOpen:!1,style:l,children:t.jsxs("div",{ref:d,className:"flex flex-col h-screen w-full overflow-hidden",children:[n&&t.jsxs("div",{ref:c,className:"flex-shrink-0 sticky top-0 z-40 bg-primary",children:[t.jsx(zh,{}),t.jsx(mx,{})]}),t.jsxs("div",{className:"sidebar-container flex flex-1 overflow-hidden",children:[i,t.jsx("main",{className:"relative z-0 flex-1 flex flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30",children:e})})]})]})})})})});class hx{static async sendEmail(e){const t=eo(),{data:a,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return a}}const xx=hx,fx=J.z.string().trim().toLowerCase().min(3,"E-mail muito curto").max(254,"E-mail muito longo").email("E-mail inválido"),gx=J.z.string().trim().toLowerCase().min(2,"Alias muito curto").max(64,"Alias muito longo").regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,"Alias contém caracteres inválidos"),bx=J.z.string().uuid("UUID inválido"),vx=J.z.string().trim().min(1,"userId obrigatório").max(64,"userId muito longo").regex(/^[a-zA-Z0-9._-]+$/,"userId contém caracteres inválidos"),yx=J.z.object({page:J.z.coerce.number().int().min(1).default(1),pageSize:J.z.coerce.number().int().min(1).max(500).default(50)});function wx(e){const[t,r]=a.useState(!1),{uploadFunction:s,deleteFunction:n,defaultOptions:o,onSuccess:i,onError:c}=e||{};return{upload:async(e,t)=>{if(!s){const e=new Error("uploadFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de upload não configurada. Verifique a documentação."}),e}r(!0);try{const a={...o,...t};if(a.maxSize&&e.size>a.maxSize)throw new Error(`Arquivo muito grande. Tamanho máximo: ${Math.round(a.maxSize/1024/1024)}MB`);if(a.allowedTypes){if(!a.allowedTypes.some(t=>t.endsWith("/*")?e.type.startsWith(t.replace("/*","")):e.type===t))throw new Error(`Tipo de arquivo não permitido. Tipos aceitos: ${a.allowedTypes.join(", ")}`)}const r=await s(e,a);return l.toast.success("Sucesso",{description:"Arquivo enviado com sucesso"}),i?.(r),r}catch(a){const e=a instanceof Error?a:new Error("Erro ao fazer upload");throw l.toast.error("Erro",{description:e.message}),c?.(e),e}finally{r(!1)}},deleteMedia:async(e,t)=>{if(!n){const e=new Error("deleteFunction não fornecida");throw l.toast.error("Erro de configuração",{description:"Função de delete não configurada."}),e}try{await n(e,t),l.toast.success("Sucesso",{description:"Arquivo removido com sucesso"})}catch(a){throw l.toast.error("Erro",{description:"Erro ao remover o arquivo"}),a}},uploading:t}}function jx(e,t){return e/t}const Nx=["application/x-msdownload","application/x-msdos-program","application/x-executable","application/x-javascript","application/javascript","text/javascript","text/vbscript","application/sql","application/x-sh","application/x-shellscript","application/hta","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-powerpoint.presentation.macroEnabled.12"];function _x(e){if(!e)return"";if(e<1024)return`${e} Bytes`;const t=e/1024;if(t<1024)return`${Math.round(t)} KB`;const a=t/1024;if(a<1024)return`${Math.round(a)} MB`;const r=a/1024;return Math.round(100*r)/100+" GB"}function Cx(e){const t=e.lastIndexOf(".");return-1===t?"":e.substring(t+1).toLowerCase()}function kx({storedFile:e,customFileName:r,allowedExtensions:s,customExtensionErrorMessage:n,minSizeInBytes:o=1,maxSizeInBytes:i=314572800,showDownloadButton:l=!0,showViewButton:d=!0,showReplaceButton:u=!0,showCloseButton:m=!0,required:p=!1,touched:h=!1,disabled:x=!1,error:f,onFileSelect:g,onFileRemove:b,onFileReplace:v,onDownload:w,onView:j,className:N}){const{t:_}=y.useTranslation(),C=a.useRef(null),[k,S]=a.useState(null),[A,T]=a.useState(null),[D,E]=a.useState(!1),P=k||e,I=k?.name||e?.name||"",M=k?.size||e?.size;I&&Cx(I);const R=r||I,L=l&&!k&&!!e,F=d&&!k&&!!e,z=!!A||!!f||p&&h&&!P,U=!!P,O=a.useCallback(e=>{if(Nx.includes(e.type))return{type:"forbidden-type"};if(e.size<=o)return{type:"min-size"};if(e.size>=i)return{type:"max-size"};if(s?.length){const t=Cx(e.name);if(!s.includes(t))return{type:"extension",message:n}}return null},[o,i,s,n]),B=a.useCallback(e=>{const t=e.target.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),S(null),void(C.current&&(C.current.value=""));T(null),S(t),g?.(t),C.current&&(C.current.value="")},[O,g]),q=a.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),x)return;const t=e.dataTransfer.files?.[0];if(!t)return;const a=O(t);if(a)return T(a),void S(null);T(null),S(t),g?.(t)},[x,O,g]),$=a.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),V=a.useCallback(()=>{v?.(),C.current?.click()},[v]),W=a.useCallback(()=>{S(null),T(null),b?.(),C.current&&(C.current.value="")},[b]),H=a.useCallback(async()=>{if(!D&&e&&w){E(!0);try{await w(e)}finally{E(!1)}}},[D,e,w]),G=a.useCallback(()=>{e&&j&&j(e)},[e,j]),K=a.useCallback(()=>{x||C.current?.click()},[x]),Y=(()=>{if(f)return f;if(!A)return p&&h&&!P?_("required_field"):null;switch(A.type){case"extension":return A.message||_("sign_file_not_allowed");case"forbidden-type":return _("sign_file_type_not_allowed");case"min-size":return`Tamanho mínimo: ${_x(o)}`;case"max-size":return`Tamanho máximo: ${_x(i)}`;default:return _("file_error")}})();return t.jsxs("div",{className:Nr("space-y-1",N),children:[t.jsx("div",{className:Nr("rounded-md border border-dashed transition-colors",U&&"border-solid border-border",!U&&"border-muted-foreground/30 hover:border-primary/50 cursor-pointer",z&&"border-destructive border-solid",x&&"opacity-50 pointer-events-none"),children:U?t.jsxs("div",{className:"flex items-center justify-between px-3 min-h-[36px]",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx(c.FileText,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),t.jsx("p",{className:"text-xs truncate",children:R})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[null!=M&&t.jsx("span",{className:"text-xs text-muted-foreground",children:_x(M)}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[L&&w&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",disabled:D,onClick:H,children:t.jsx(c.Download,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Zs,{children:"Download"})]}),F&&j&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:G,children:t.jsx(c.Eye,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Zs,{children:"Visualizar"})]}),u&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:V,children:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 text-primary"})})}),t.jsx(Zs,{children:"Substituir"})]}),m&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 bg-muted rounded",onClick:W,children:t.jsx(c.X,{className:"h-3 w-3 text-muted-foreground"})})}),t.jsx(Zs,{children:_("remove")})]})]})]})]}):t.jsxs("div",{className:"flex items-center justify-center gap-2 min-h-[36px] px-3",tabIndex:0,onClick:K,onKeyDown:e=>"Enter"===e.key&&K(),onDrop:q,onDragOver:$,children:[t.jsx(c.CloudUpload,{className:"h-4 w-4 text-muted-foreground"}),t.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Arraste ou ",t.jsx("span",{className:"text-primary",children:"selecione um arquivo"})]})]})}),Y&&t.jsx("p",{className:"text-xs text-destructive",children:Y}),t.jsx("input",{ref:C,type:"file",className:"hidden",accept:s?.map(e=>`.${e}`).join(","),onChange:B,disabled:x})]})}function Sx(){return`${Ke().replace(/\/+$/,"")}/api/documents/v1`}function Ax(){const e=$n.getSelectedAlias()||$n.extractTokenData()?.alias||"";if(!e)throw new Error("Alias da unidade não encontrado (Documents API exige o header un-alias).");return e}function Tx(){const e=$n.getAccessToken();if(!e)throw new Error("Token Qualiex não encontrado.");return{Authorization:`Bearer ${e}`,"un-alias":Ax()}}function Dx(){return{...Tx(),Accept:"application/json"}}function Ex(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t):""}const Px={async upload(e,t,a,r){const s={name:a.name,extension:Ex(a.name),size:a.size,plataformType:1,association:{type:e,associationId:t,associationFieldId:r??null}},n=new FormData;n.append("command",JSON.stringify(s)),n.append(a.name,a,a.name);const o=await fetch(`${Sx()}/files/Upload`,{method:"POST",headers:Tx(),body:n});if(!o.ok)throw new Error(await o.text().catch(()=>"")||"Falha no upload do arquivo.");const i=await o.json().catch(()=>null),l=i?.resultData??i?.ResultData??{};return{id:l.id??"",code:l.code,size:l.size}},async downloadUrl(e,t=10){const a=await fetch(`${Sx()}/files/Download/${encodeURIComponent(e)}?minutesToExpire=${t}`,{headers:Dx()});if(!a.ok)return null;const r=await a.json().catch(()=>null);return r?.url??null},async listByAssociation(e,t,a){const r=new URLSearchParams({type:String(e),associationId:t,page:"1",limit:"100"});a&&r.set("associationFieldId",a);const s=await fetch(`${Sx()}/files?${r.toString()}`,{headers:Dx()});if(!s.ok)return[];const n=await s.json().catch(()=>null);return(n?.data??[]).map(r=>{const s=r.associations??[],n=s.find(r=>r.type===e&&r.associationId===t&&(!a||r.associationFieldId===a))??s[0];return{id:r.id,name:r.name,extension:r.extension,size:r.size,associationRowId:n?.id}})},async remove(e,t){if(!e)return!1;return(await fetch(`${Sx()}/files/associations`,{method:"DELETE",headers:{...Dx(),"Content-Type":"application/json"},body:JSON.stringify({filesAssociationsIds:[e],justification:t??null})})).ok},async count(e,t,a){const r=new URLSearchParams({type:String(e),associationId:t});a&&r.set("associationFieldId",a);const s=await fetch(`${Sx()}/files/Count?${r.toString()}`,{headers:Dx()});if(!s.ok)return 0;const n=await s.json().catch(()=>null);return n?.count??n?.total??0}},Ix=e=>({id:e.id,name:e.name,extension:e.extension,size:e.size??0});var Mx=(e=>(e[e.readOnlyText=1]="readOnlyText",e[e.text=2]="text",e[e.date=3]="date",e[e.time=4]="time",e[e.url=5]="url",e[e.number=6]="number",e[e.singleSelection=7]="singleSelection",e[e.multiSelection=8]="multiSelection",e[e.questions=9]="questions",e))(Mx||{}),Rx=(e=>(e[e.dropdown=1]="dropdown",e[e.buttons=2]="buttons",e[e.radio=3]="radio",e[e.checkbox=4]="checkbox",e))(Rx||{}),Lx=(e=>(e[e.custom=1]="custom",e[e.users=2]="users",e[e.usersLists=3]="usersLists",e))(Lx||{});function Fx(e){switch(e.type){case 2:case 1:return e.textValue;case 6:return e.numberValue;case 3:return e.dateValue;case 4:return e.timeValue;case 5:case 7:case 8:return e.itemsValue;case 9:return e.questionsValue;default:return null}}function zx(e,t){if(!t)return!0;const a=null!=Fx(e)&&""!==Fx(e)&&!(Array.isArray(Fx(e))&&0===Fx(e).length);return!1!==e.isActive||a}function Ux({field:e}){return t.jsxs("div",{className:"space-y-1",children:[e.name&&t.jsx("p",{className:"text-sm font-medium text-foreground",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.description}),e.textValue&&t.jsx("p",{className:"text-sm text-muted-foreground italic",children:e.textValue})]})}function Ox({field:e,readOnly:a,onChange:r}){const s=e.config,n=s?.multiline??!1,o=a||e.readOnly,i=t=>{r?.({...e,textValue:t})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n?t.jsx(As,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o,rows:4}):t.jsx(Ar,{value:e.textValue||"",onChange:e=>i(e.target.value),placeholder:e.placeholder,disabled:o})]})}function Bx({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e.dateValue?"string"==typeof e.dateValue?e.dateValue.substring(0,10):new Date(e.dateValue).toISOString().substring(0,10):"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Ar,{type:"date",value:n,onChange:t=>{return a=t.target.value,void r?.({...e,dateValue:a||void 0});var a},placeholder:e.placeholder,disabled:s})]})}function qx({field:e,readOnly:a,onChange:r}){const s=a||e.readOnly,n=e=>{if(!e)return;const[t,a]=e.split(":").map(Number);return 60*t+a};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Ar,{type:"time",value:(e=>{if(null==e)return"";const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`})(e.timeValue),onChange:t=>r?.({...e,timeValue:n(t.target.value)}),placeholder:e.placeholder,disabled:s})]})}function $x({field:e,readOnly:r,onChange:s}){const n=e.config,o=n?.multiple??!1,i=r||e.readOnly,[l,d]=a.useState(""),u=e.itemsValue||[],m=()=>{if(!l.trim())return;const t={value:crypto.randomUUID(),text:l.trim()};s?.({...e,itemsValue:[...u,t]}),d("")};if(!o){const a=u[0]?.text||"";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ar,{type:"url",value:a,onChange:t=>(t=>{const a={value:t,text:t};s?.({...e,itemsValue:t?[a]:[]})})(t.target.value),placeholder:e.placeholder||"https://",disabled:i}),a&&t.jsx(kr,{variant:"outline",size:"icon",asChild:!0,className:"flex-shrink-0",children:t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:t.jsx(c.ExternalLink,{className:"h-4 w-4"})})})]})]})}return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),!i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ar,{type:"url",value:l,onChange:e=>d(e.target.value),placeholder:e.placeholder||"https://",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),m())}),t.jsx(kr,{variant:"outline",size:"icon",onClick:m,disabled:!l.trim(),className:"flex-shrink-0",children:t.jsx(c.Plus,{className:"h-4 w-4"})})]}),u.length>0&&t.jsx("div",{className:"space-y-1",children:u.map((a,r)=>t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("a",{href:a.text,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate flex-1",children:a.text}),!i&&t.jsx(kr,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>(t=>{const a=u.filter((e,a)=>a!==t);s?.({...e,itemsValue:a})})(r),children:t.jsx(c.Trash2,{className:"h-3 w-3"})})]},a.value))})]})}function Vx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=null!=s?.decimals&&s.decimals>0?(1/Math.pow(10,s.decimals)).toString():"1";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx(Ar,{type:"number",value:e.numberValue??"",onChange:t=>(t=>{if(""===t)return void r?.({...e,numberValue:void 0});const a=parseFloat(t);isNaN(a)||r?.({...e,numberValue:a})})(t.target.value),placeholder:e.placeholder,disabled:n,min:s?.min,max:s?.max,step:o}),null!=s?.min&&null!=s?.max&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Min: ",s.min," | Max: ",s.max]})]})}function Wx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??Rx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=e.itemsValue?.[0]?.value||"",c=t=>{const a=i.find(e=>e.value===t);if(!a)return;const s={value:a.value,text:a.text,isActive:a.isActive};r?.({...e,itemsValue:[s]})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),o===Rx.dropdown&&t.jsxs(gs,{value:l,onValueChange:c,disabled:n,children:[t.jsx(ys,{children:t.jsx(vs,{placeholder:e.placeholder||"Selecione..."})}),t.jsx(Ns,{children:i.map(e=>t.jsxs(Cs,{value:e.value,children:[e.text,!1===e.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]},e.value))})]}),(o===Rx.radio||o===Rx.buttons)&&t.jsx(Ld,{value:l,onValueChange:c,disabled:n,className:Nr(o===Rx.buttons?"flex flex-wrap gap-2":"space-y-2"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Fd,{value:a.value,id:`${e.id}-${a.value}`}),t.jsxs(Dr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))}),!n&&l&&!e.required&&t.jsx("button",{type:"button",onClick:()=>{r?.({...e,itemsValue:[]})},className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Limpar seleção"})]})}function Hx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.viewMode??Rx.dropdown,i=s?.data?.filter(t=>!1!==t.isActive||e.itemsValue?.some(e=>e.value===t.value))||[],l=new Set(e.itemsValue?.map(e=>e.value)||[]);return t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),(e.itemsValue?.length??0)>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.itemsValue.map(a=>t.jsxs(Ds,{variant:"secondary",className:"gap-1 pr-1",children:[t.jsx("span",{className:"text-xs",children:a.text}),!n&&t.jsx("button",{type:"button",onClick:()=>(t=>{const a=(e.itemsValue||[]).filter(e=>e.value!==t);r?.({...e,itemsValue:a})})(a.value),className:"rounded-full p-0.5 hover:bg-muted-foreground/20",children:t.jsx(c.X,{className:"h-3 w-3"})})]},a.value))}),!n&&t.jsx("div",{className:Nr(o===Rx.checkbox?"space-y-2":"grid grid-cols-2 gap-2 border rounded-md p-3 max-h-48 overflow-y-auto"),children:i.map(a=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ss,{id:`${e.id}-${a.value}`,checked:l.has(a.value),onCheckedChange:()=>(t=>{const a=e.itemsValue||[],s=a.some(e=>e.value===t.value)?a.filter(e=>e.value!==t.value):[...a,{value:t.value,text:t.text,isActive:t.isActive}];r?.({...e,itemsValue:s})})(a),disabled:n}),t.jsxs(Dr,{htmlFor:`${e.id}-${a.value}`,className:"text-sm font-normal cursor-pointer",children:[a.text,!1===a.isActive&&t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(inativo)"})]})]},a.value))})]})}function Gx({field:e,readOnly:a,onChange:r}){const s=e.config,n=a||e.readOnly,o=s?.questions||[],i=s?.options||[],l=e.questionsValue||[];return 0===o.length||0===i.length?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{children:e.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhuma questão configurada"})]}):t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{className:Nr(e.required&&"after:content-['*'] after:text-destructive after:ml-0.5"),children:e.name}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),t.jsx("div",{className:"border rounded-md overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b bg-muted/50",children:[t.jsx("th",{className:"text-left p-2 font-medium min-w-[150px]",children:"Pergunta"}),i.map(e=>t.jsx("th",{className:"text-center p-2 font-medium min-w-[80px]",children:e.text},e.value))]})}),t.jsx("tbody",{children:o.map((a,s)=>t.jsxs("tr",{className:Nr(s<o.length-1&&"border-b"),children:[t.jsx("td",{className:"p-2 text-muted-foreground",children:a.text}),i.map(s=>{return t.jsx("td",{className:"text-center p-2",children:t.jsx(Ld,{value:(o=a.value,l.find(e=>e.questionValue===o)?.optionValue||""),onValueChange:t=>((t,a,s,n)=>{const o={questionValue:t,questionText:a,optionValue:s,optionText:n},i=l.filter(e=>e.questionValue!==t);i.push(o),r?.({...e,questionsValue:i})})(a.value,a.text,t,s.text),disabled:n,className:"flex justify-center",children:t.jsx(Fd,{value:s.value,id:`${e.id}-${a.value}-${s.value}`})})},s.value);var o})]},a.value))})]})})]})}function Kx({field:e,readOnly:a,onChange:r}){const s={field:e,readOnly:a,onChange:r};switch(e.type){case Mx.readOnlyText:return t.jsx(Ux,{...s});case Mx.text:return t.jsx(Ox,{...s});case Mx.date:return t.jsx(Bx,{...s});case Mx.time:return t.jsx(qx,{...s});case Mx.url:return t.jsx($x,{...s});case Mx.number:return t.jsx(Vx,{...s});case Mx.singleSelection:return t.jsx(Wx,{...s});case Mx.multiSelection:return t.jsx(Hx,{...s});case Mx.questions:return t.jsx(Gx,{...s});default:return null}}function Yx({open:r,onOpenChange:s,returnSteps:n,initialObservation:o="",title:i=e.t("approval_execute_action"),descriptions:c=[],setDefaultApproverOnInit:d=!0,onSubmit:u}){const[m,p]=a.useState(!0),[h,x]=a.useState(d&&n.length>0?n[0].id:null),[f,g]=a.useState(o),b=e=>{p(e),e&&!d?x(null):!e&&!d&&n.length>0&&x(n[0].id)},v=f!==o||!m;return t.jsx(Yr,{open:r,onOpenChange:s,children:t.jsxs(ts,{className:"sm:max-w-[480px]",variant:"form",isDirty:v,children:[t.jsx(as,{children:t.jsx(ns,{children:i})}),t.jsxs("div",{className:"space-y-4",children:[c.length>0&&t.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:c.map((e,a)=>t.jsx("p",{dangerouslySetInnerHTML:{__html:e}},a))}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:m,onChange:()=>b(!0),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_approve")})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"radio",name:"approved",checked:!m,onChange:()=>b(!1),className:"accent-primary"}),t.jsx("span",{className:"text-sm",children:e.t("approval_reprove_radio")})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{children:"Etapa"}),t.jsxs(gs,{value:h??void 0,onValueChange:x,disabled:m,children:[t.jsx(ys,{children:t.jsx(vs,{placeholder:e.t("approval_select_step")})}),t.jsx(Ns,{children:n.map(e=>t.jsx(Cs,{value:e.id,children:e.name},e.id))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Dr,{children:e.t("approval_opinion")}),t.jsx(As,{value:f,onChange:e=>g(e.target.value),maxLength:4e3,rows:4,autoFocus:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[f.length,"/",4e3]})]})]}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"ghost",onClick:()=>s(!1),children:"Cancelar"}),t.jsx(kr,{onClick:()=>{if(!f.trim())return void l.toast.error("Formulário inválido. Preencha todos os campos obrigatórios.");const e=m?null:n.find(e=>e.id===h);u({approved:m,returnStepId:m?null:h,returnType:e?.type??null,observation:f})},disabled:!v,children:"Concluir"})]})]})})}function Qx({open:e,onOpenChange:r,approvers:s,isLoading:n=!1,ignoreUserIds:o=[],onSubmit:i}){const{t:l}=y.useTranslation(),[c,d]=a.useState(null),u=a.useMemo(()=>{const e=new Set(o);return s.filter(t=>!e.has(t.id))},[s,o]),m=a.useMemo(()=>u.map(e=>({value:e.id,label:e.name})),[u]);return t.jsx(Yr,{open:e,onOpenChange:r,children:t.jsxs(ts,{className:"sm:max-w-[450px]",variant:"form",isDirty:!!c,children:[t.jsx(as,{children:t.jsx(ns,{children:l("approval_select_approver")})}),t.jsx(Is,{isLoading:n,type:"spinner",children:t.jsx("div",{className:"space-y-4",children:t.jsx(fn,{options:m,value:c??void 0,onValueChange:e=>d("string"==typeof e?e:e?.[0]??null),placeholder:l("approval_select_approver_placeholder"),searchPlaceholder:l("approval_search_approver")})})}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),t.jsx(kr,{onClick:()=>{if(!c)return;const e=u.find(e=>e.id===c);e&&i(e)},disabled:!c||n,children:"Concluir"})]})]})})}function Xx(e){const{t:t}=y.useTranslation();if(!e)return"";return("string"==typeof e?new Date(e):e).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})}function Jx({text:e,maxLength:r=130}){const{t:s}=y.useTranslation(),[n,o]=a.useState(!1);return e.length<=r?t.jsx("span",{children:e}):t.jsxs("span",{children:[n?e:`${e.substring(0,r)}... `,t.jsx("button",{className:"text-primary hover:underline text-sm cursor-pointer",onClick:()=>o(!n),children:s(n?"approval_read_less":"approval_read_more")})]})}function Zx({approver:e}){if(1===e.type&&e.approverId)return t.jsxs(Ji,{className:"h-9 w-9 shrink-0",children:[t.jsx(Zi,{src:e.photoUrl,alt:e.name}),t.jsx(el,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]});const a=2===e.type?c.Users:3===e.type?c.MapPin:c.User;return t.jsx("div",{className:"h-9 w-9 rounded-full bg-muted-foreground/30 flex items-center justify-center shrink-0",children:t.jsx(a,{className:"h-4 w-4 text-background"})})}function ef({approver:e}){return e.date?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-green-500/10 text-foreground",children:[t.jsx(c.CheckCircle,{className:"h-3.5 w-3.5 text-green-600"}),"Aprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Xx(e.date)}),1!==e.type&&e.approvedUsername&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["por ",e.approvedUsername]})]}):e.returnDate?t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-red-500/10 text-foreground",children:[t.jsx(c.XCircle,{className:"h-3.5 w-3.5 text-red-600"}),"Reprovado"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Xx(e.returnDate)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs rounded px-2 py-0.5 bg-muted text-muted-foreground",children:[t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),"Aguardando"]})}function tf({approver:e}){const{t:a}=y.useTranslation(),r=1!==e.type||e.approverId?e.name:"A definir";return t.jsxs("div",{children:[2===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:a("approval_user_group")}),3===e.type&&t.jsx("p",{className:"text-xs text-muted-foreground",children:"Local"}),t.jsx("p",{className:"text-sm font-medium break-words",children:r}),t.jsx(ef,{approver:e})]})}var af=(e=>(e[e.ApprovalFlow=1]="ApprovalFlow",e[e.Association=2]="Association",e))(af||{});exports.i18n=e,Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return l.toast}}),Object.defineProperty(exports,"toast",{enumerable:!0,get:function(){return l.toast}}),exports.DialogPrimitive=se,Object.defineProperty(exports,"I18nextProvider",{enumerable:!0,get:function(){return y.I18nextProvider}}),Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:function(){return y.useTranslation}}),exports.AccordionPrimitive=ye,exports.AUTH_CONFIG=ze,exports.AccessDeniedDialog=hc,exports.Accordion=Nc,exports.AccordionContent=kc,exports.AccordionItem=_c,exports.AccordionTrigger=Cc,exports.ActionButton=Sr,exports.ActionMenu=Sr,exports.ActionMenuItems=ni,exports.AggregationType=Dm,exports.Alert=Yi,exports.AlertDescription=Xi,exports.AlertDialog=zr,exports.AlertDialogAction=Gr,exports.AlertDialogCancel=Kr,exports.AlertDialogContent=qr,exports.AlertDialogDescription=Hr,exports.AlertDialogFooter=Vr,exports.AlertDialogHeader=$r,exports.AlertDialogOverlay=Br,exports.AlertDialogPortal=Or,exports.AlertDialogTitle=Wr,exports.AlertDialogTrigger=Ur,exports.AlertTitle=Qi,exports.AliasRedirect=function(){const{alias:e}=ko(),{pathname:a,search:r,hash:s}=N.useLocation();return e?t.jsx(N.Navigate,{to:`/${e}${a}${r}${s}`,replace:!0}):null},exports.AliasRouteGuard=function({children:e,paramName:r="alias"}){const s=N.useNavigate(),n=N.useLocation(),o=N.useParams(),{alias:i,isAuthenticated:l,isLoading:c,switchUnit:d,companies:u}=ko(),{urlAlias:m,isAliasMismatch:p,isValidAlias:h,isMissing:x,matchedCompany:f}=Hi({paramName:r}),[g,b]=a.useState(!1),v=a.useRef(!1),y=r in o,w=a.useCallback(e=>{const t=o[r],{pathname:a,search:s,hash:i}=n;if(t){const r=a.split("/"),n=r.findIndex(e=>e===t);if(n>=0)return r[n]=e,r.join("/")+s+i}return`/${e}${"/"===a?"":a}${s}${i}`},[o,r,n]);return a.useEffect(()=>{if(y&&!c&&l&&i&&!v.current)if(x)s(w(i),{replace:!0});else if(!m||h){if(p&&f&&!v.current){(async()=>{v.current=!0,b(!0);try{await d(f)}catch(e){i&&s(w(i),{replace:!0})}finally{v.current=!1,b(!1)}})()}}else{if(!u||0===u.length)return;s(w(i),{replace:!0})}},[y,c,l,i,x,m,h,p,f,d,w,s,u]),c||!l?t.jsx(t.Fragment,{children:e}):g?t.jsx("div",{className:"flex items-center justify-center min-h-screen",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(Ps,{size:"lg"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Trocando unidade..."})]})}):t.jsx(t.Fragment,{children:e})},exports.AnalysisFunctionality=Em,exports.AppHeader=zh,exports.AppLayout=px,exports.AppSidebar=Hh,exports.ApprovalFlowReturnStep=af,exports.ApprovalSidenav=function({config:e,isLoading:r=!1,onClose:s,onApprove:n,onDefineApprover:o,onRefreshSteps:i,availableApprovers:l=[],isLoadingApprovers:d=!1}){const{t:u}=y.useTranslation(),[m,p]=a.useState(!1),[h,x]=a.useState(!1),[f,g]=a.useState(""),[b,v]=a.useState(""),[w,j]=a.useState(!1),[N,_]=a.useState(""),C=r||m,k=a.useCallback((e,t)=>{g(e),v(t??""),x(!0)},[]),S=a.useCallback(async t=>{x(!1),p(!0);if(!await n(e.associationId,{stepApproverId:f,...t}))return k(f,t.observation),void p(!1);s(),p(!1)},[e.associationId,f,n,s,k]),A=a.useCallback(e=>{_(e),j(!0)},[]),T=a.useCallback(async t=>{j(!1),p(!0),await o(e.associationId,N,t),await(i?.(e.associationId)),p(!1)},[e.associationId,N,o,i]),D=e.approvalFlowSteps.find(e=>e.isCurrentStep)?.approvers.filter(e=>1===e.type&&e.approverId).map(e=>e.approverId)??[],E=(t,a)=>e.canApprove&&t.isCurrentStep&&a.approverId&&!a.date&&a.canApprove,P=(t,a)=>!e.flowReproved&&t.isCurrentStep&&1===a.type&&a.canApprove&&(!a.approverId||a.isToBeDefined);return t.jsxs("div",{className:"w-[550px] max-w-[900px] min-w-[400px] h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 shadow-sm px-1 py-2 flex items-center gap-1 border-l-4",style:{borderLeftColor:e.color},children:[t.jsx(kr,{variant:"ghost",size:"icon",onClick:s,className:"shrink-0",children:t.jsx(c.X,{className:"h-5 w-5"})}),t.jsx("span",{className:"text-lg font-medium",children:e.title})]}),C?t.jsx(Is,{isLoading:!0,type:"spinner",className:"flex-1",children:t.jsx("div",{})}):t.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[e.approvalFlowInfo.length>0&&t.jsx("div",{className:"space-y-1",children:e.approvalFlowInfo.map((e,a)=>t.jsx("div",{className:Nr("flex items-center gap-1.5 text-sm",e.color&&"rounded-lg px-2 py-1"),style:e.color?{color:e.color,backgroundColor:e.backgroundColor}:void 0,children:e.title?`${e.title}: ${e.value}`:e.value},a))}),t.jsx("hr",{className:"border-border"}),e.approvalFlowSteps.map(a=>t.jsxs("div",{className:Nr("space-y-2",(!a.isCurrentStep||e.flowReproved)&&"opacity-50"),children:[t.jsxs("p",{className:"font-semibold text-sm",children:[a.index,". Etapa: ",a.name]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground break-words",children:t.jsx(Jx,{text:a.description})}),a.returnDate&&t.jsxs("div",{className:"border-y border-border py-3 mt-3 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs rounded px-1.5 py-0.5 bg-red-500/10 text-red-600",children:"Retorno de etapa"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.returnUserName," em ",Xx(a.returnDate)]})]}),a.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground bg-muted rounded p-2 break-words",children:t.jsx(Jx,{text:a.returnObservation})})]}),a.approvers.map(e=>t.jsxs("div",{className:"p-2 space-y-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx(Zx,{approver:e}),t.jsx(tf,{approver:e})]}),E(a,e)&&t.jsx(kr,{size:"sm",onClick:()=>k(e.id),children:"Aprovar"}),P(a,e)&&t.jsx(kr,{size:"sm",variant:"outline",onClick:()=>A(e.id),children:"Selecionar"})]}),e.observation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Jx,{text:e.observation})}),e.returnObservation&&t.jsx("p",{className:"text-sm text-muted-foreground break-words ml-11",children:t.jsx(Jx,{text:e.returnObservation})})]},e.id))]},a.id))]}),t.jsx(Yx,{open:h,onOpenChange:x,returnSteps:e.returnSteps,initialObservation:b,title:e.approveDialogTitle,descriptions:e.approveDialogDescriptions,setDefaultApproverOnInit:e.approveDialogSetDefaultApproverOnInit,onSubmit:S}),t.jsx(Qx,{open:w,onOpenChange:j,approvers:l,isLoading:d,ignoreUserIds:D,onSubmit:T})]})},exports.ApproveDialog=Yx,exports.AuthErrorInterceptor=no,exports.AuthProvider=Co,exports.AuthService=wo,exports.AutoComplete=fn,exports.Avatar=Ji,exports.AvatarFallback=el,exports.AvatarImage=Zi,exports.Badge=Ds,exports.BaseForm=Ri,exports.Blockquote=gd,exports.BodyContent=function({breadcrumbs:e,children:a,className:r}){return t.jsxs("div",{className:Nr("bg-neutral-100 dark:bg-neutral-900","h-full overflow-y-auto","p-6",r),children:[e&&e.length>0&&t.jsx(Sc,{className:"mb-4",children:t.jsx(Ac,{children:e.map((a,r)=>{const s=r===e.length-1;return t.jsxs(te.Fragment,{children:[r>0&&t.jsx(Pc,{}),t.jsx(Tc,{children:s||!a.href?t.jsx(Ec,{children:a.label}):a.asChild&&a.children?t.jsx(Dc,{asChild:!0,children:a.children}):t.jsx(Dc,{asChild:!0,children:t.jsx(N.Link,{to:a.href||"/",children:a.label})})})]},`${a.label}-${r}`)})})}),t.jsx("div",{className:"space-y-6",children:a})]})},exports.Breadcrumb=Sc,exports.BreadcrumbEllipsis=Ic,exports.BreadcrumbItem=Tc,exports.BreadcrumbLink=Dc,exports.BreadcrumbList=Ac,exports.BreadcrumbPage=Ec,exports.BreadcrumbSeparator=Pc,exports.BurndownPanel=Dp,exports.Button=kr,exports.ButtonGroup=Rc,exports.CRUD_CONFIG=qe,exports.CURRENCY_FIELDS=rp,exports.Calendar=Fc,exports.CallbackPage=()=>{const{processCallback:e}=ko(),r=N.useNavigate(),[s,n]=a.useState(null),[o,i]=a.useState(!1);a.useEffect(()=>{let t=!1;if(En()){_n.clear(),function(){if(Nn&&"undefined"!=typeof PerformanceObserver&&!Tn)try{Tn=new PerformanceObserver(e=>{for(const t of e.getEntries())t.duration}),Tn.observe({type:"longtask",buffered:!0})}catch{}}(),kn("callback:start");try{const e=$n.getAccessToken(),t=$n.getIdToken();if(e){Dn(0,e,Mn.parseJwtPayload(e))}if(t){Dn(0,t,Mn.parseJwtPayload(t))}}catch{}}const a=En()?window.setTimeout(()=>{t||An()},15e3):0;return(async()=>{try{const a=await e();if(t=!0,En()&&(kn("callback:processCallback:end"),function(e,t,a){if(!Nn)return null;try{return performance.measure(`auth:${e}`,`auth:${t}`,`auth:${a}`).duration}catch{return null}}("callback (total)","callback:start","callback:processCallback:end"),An()),a){window.history.replaceState({},document.title,Ue("/"));const e=localStorage.getItem("auth_return_url");localStorage.removeItem("auth_return_url"),r(e||"/",{replace:!0})}else n("Falha na autenticação. Tente novamente.")}catch(a){t=!0,En()&&An(),localStorage.removeItem("auth_return_url"),n(a?.message||"Erro durante a autenticação. Tente novamente.")}})(),()=>{a&&window.clearTimeout(a),function(){if(Tn){try{Tn.disconnect()}catch{}Tn=null}}()}},[e,r]);const l=async()=>{i(!0),n(null);try{await e()||n("Falha na autenticação. Tente novamente.")}catch(t){n(t?.message||"Erro ao tentar novamente.")}finally{i(!1)}},d=()=>{window.location.href=Ue("/")};return s?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsxs(Ir,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[t.jsx(c.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),t.jsxs(Rr,{className:"space-y-4",children:[t.jsx(Yi,{variant:"danger",children:t.jsx(Xi,{children:s})}),t.jsx("div",{className:"text-sm text-muted-foreground",children:t.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(kr,{onClick:l,disabled:o,className:"flex-1",children:o?t.jsxs(t.Fragment,{children:[t.jsx(Ps,{size:"sm",className:"mr-2"}),"Tentando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),t.jsx(kr,{onClick:d,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsx(Ir,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),t.jsxs(Rr,{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(Ps,{size:"lg"})}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=Er,exports.CardContent=Rr,exports.CardDescription=Mr,exports.CardFooter=Lr,exports.CardHeader=Pr,exports.CardSkeleton=Uo,exports.CardTitle=Ir,exports.CartesianPanel=Cp,exports.ChartContainer=Vu,exports.ChartLegend=Ku,exports.ChartLegendContent=Yu,exports.ChartStyle=Wu,exports.ChartTooltip=Hu,exports.ChartTooltipContent=Gu,exports.Checkbox=Ss,exports.Collapsible=Fl,exports.CollapsibleContent=Ul,exports.CollapsibleTrigger=zl,exports.ColorPicker=ki,exports.ColumnSettingsPopover=yi,exports.ComboTree=jn,exports.Combobox=fn,exports.Command=sn,exports.CommandDialog=({children:e,...a})=>t.jsx("div",{...a,children:t.jsx(sn,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),exports.CommandEmpty=ln,exports.CommandGroup=cn,exports.CommandInput=nn,exports.CommandItem=un,exports.CommandList=on,exports.CommandSeparator=dn,exports.CommandShortcut=mn,exports.ContentContainer=function({title:e,subtitle:a,children:r,className:s,hasHeader:n=!0}){const o=e||a;return t.jsxs("div",{className:Nr("bg-white dark:bg-card","rounded-lg","shadow-sm","border border-border/40","overflow-visible",s),children:[n&&o&&t.jsxs("div",{className:"px-6 py-4 border-b border-border/50",children:[e&&t.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),a&&t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:a})]}),r&&t.jsx("div",{className:Nr("p-6",!n&&o&&"pt-4"),children:r})]})},exports.ContextMenu=Vo,exports.ContextMenuCheckboxItem=ei,exports.ContextMenuContent=Jo,exports.ContextMenuGroup=Ho,exports.ContextMenuItem=Zo,exports.ContextMenuLabel=ai,exports.ContextMenuPortal=Go,exports.ContextMenuRadioGroup=Yo,exports.ContextMenuRadioItem=ti,exports.ContextMenuSeparator=ri,exports.ContextMenuShortcut=si,exports.ContextMenuSub=Ko,exports.ContextMenuSubContent=Xo,exports.ContextMenuSubTrigger=Qo,exports.ContextMenuTrigger=Wo,exports.CoreProviders=function({children:r,queryClient:s,moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i="common",signDocumentsTable:l="sign_documents",moduleAccessGuardProps:c,appTranslations:d,clarityProjectId:u,clarityMode:m="auto",backend:p="supabase",securityMode:h="legacy"}){Le(p),yc=h,bc();const[x]=a.useState(()=>new j.QueryClient({defaultOptions:{queries:{staleTime:3e5,retry:1}}})),f=s??x;a.useEffect(()=>{if(d)for(const[e,t]of Object.entries(d))Nl(e,t)},[d]);const g={sourceModule:n,...c};return t.jsxs(ql,{children:[t.jsx(jc,{}),t.jsx(y.I18nextProvider,{i18n:e,children:t.jsx(j.QueryClientProvider,{client:f,children:t.jsxs(Co,{children:[t.jsx(wc,{projectId:u,mode:m}),t.jsx(Rl,{children:t.jsxs(Cl,{moduleAlias:n,associationsBaseUrl:o,signDocumentsSchema:i,signDocumentsTable:l,children:[t.jsx(El,{}),t.jsx(fc,{...g,children:r})]})})]})})})]})},exports.CrudActionBar=xi,exports.CrudActionMenu=function({onEdit:e,onDelete:r,onToggleStatus:s,isActive:n=!0,canEdit:o=!0,canDelete:i=!0,customActions:l=[],renderAs:d="dropdown",variant:u="default"}){const{t:m}=y.useTranslation(),p=a.useMemo(()=>{const t=[];return e&&o&&t.push({key:"edit",icon:c.Edit,label:m("edit","Editar"),onClick:e,variant:"default"}),s&&t.push({key:"toggle-status",icon:n?c.PowerOff:c.Power,label:n?m("deactivate","Inativar"):m("activate","Ativar"),onClick:s,variant:"default"}),l.forEach(e=>{!1!==e.show&&t.push({key:`custom-${e.label}`,icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default",disabled:e.disabled,disabledReason:e.disabledReason})}),r&&i&&t.push({key:"delete",icon:c.Trash2,label:m("remove","Remover"),onClick:r,variant:"destructive"}),t},[e,r,s,n,o,i,l,m]);return 0===p.length?null:"dropdown"===d?t.jsx(Qs,{delayDuration:200,children:t.jsxs(Rs,{children:[t.jsx(Ls,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"compact"===u?"sm":"default",className:"compact"===u?"h-7 px-2":"",children:t.jsx(c.EllipsisVertical,{size:"compact"===u?14:16})})}),t.jsx($s,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:p.map(e=>e.disabled?t.jsxs(en,{disabledReason:e.disabledReason,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key):t.jsxs(Vs,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},e.key))})]})}):t.jsx("div",{className:"flex items-center gap-1",children:p.map(e=>t.jsxs(kr,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===u?"sm":"default",onClick:e.onClick,className:"compact"===u?"h-7 px-2":"",children:[e.icon&&t.jsx(e.icon,{size:"compact"===u?14:16}),"compact"!==u&&t.jsx("span",{className:"ml-1",children:e.label})]},e.key))})},exports.CrudGrid=({manager:r,columns:s,onEdit:n,onView:o,onToggleStatus:i,onDelete:l,renderActions:c,customRowActions:d,enableBulkActions:u=!1,onNew:m,newButtonLabel:p,showNewButton:h=!0,customActions:x=[],hideActionBar:f,showActionBar:g=!0,showSearch:b=!1,searchValue:v,onSearchChange:w,searchPlaceholder:j,bulkActions:N=[],onBulkDelete:_,filters:C,gridColumns:k=3,renderCard:S,viewMode:A,onViewModeChange:T,listCardRenderer:D,gridCardRenderer:E,showViewToggle:P=!1})=>{const{setSearchVisible:I}=ko(),M=void 0!==f?!f:g;a.useEffect(()=>{if(!b)return I(!0),()=>I(!1)},[I,b]);const R=m||x.length>0||b||u||C||P,L=_||(()=>{r.bulkDelete?.(r.selectedIds)}),F=A||"grid",z="list"===F,U={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[z?1:k],O=M&&R?t.jsx(xi,{onNew:m,newButtonLabel:p,showNewButton:h,showSearch:b,searchValue:v,onSearchChange:w,searchPlaceholder:j,showBulkActions:u,selectedCount:r.selectedIds.length,bulkActions:N,onBulkDelete:L,onClearSelection:r.clearSelection,customActions:x,filters:C,viewMode:F,onViewModeChange:T,showViewToggle:P,availableViewModes:["list","grid"]}):null;return r.isLoading?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx(Uo,{count:6})})]}):0===r.entities.length?t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Bo,{title:e.t("no_items_found_empty"),description:e.t("no_data_to_display"),variant:"search"})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[O,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:t.jsx("div",{className:Nr("grid gap-4",U),children:r.entities.map(e=>{const a=(e=>{const{t:t}=y.useTranslation();return z&&D?D(e):!z&&E?E(e):S?S(e):null})(e);return t.jsxs(Vo,{children:[t.jsx(Wo,{asChild:!0,children:a?t.jsx("div",{className:"cursor-pointer",onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:a}):t.jsx(Er,{className:Nr("overflow-hidden cursor-pointer hover:bg-muted/50 transition-colors",u&&r.selectedIds.includes(e.id)&&"bg-muted ring-2 ring-primary",z&&"flex-row"),onClick:t=>{t.stopPropagation(),u?r.selectItem(e.id):n?.(e)},children:t.jsxs(Rr,{className:Nr("p-4",z&&"flex items-center gap-4 w-full"),children:[u&&t.jsx("div",{className:Nr(z?"":"pt-0.5"),onClick:e=>e.stopPropagation(),children:t.jsx(fi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),z?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1 flex items-center gap-6 min-w-0",children:s.map(a=>t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key)))}),(n||o||c)&&t.jsx("div",{onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(oi,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]}):t.jsxs("div",{className:"flex items-start gap-3",children:[u&&t.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:t.jsx(fi,{checked:r.selectedIds.includes(e.id),onCheckedChange:()=>r.selectItem(e.id)})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[s.map((a,r)=>t.jsxs("div",{className:Nr("flex justify-between items-start gap-2",r!==s.length-1&&"mb-2"),children:[t.jsxs("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:[a.header,":"]}),t.jsx("div",{className:"text-sm text-foreground text-right truncate",children:a.render?a.render(e):String(e[a.key]??"")})]},String(a.key))),(n||o||c)&&t.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:c?c(e):t.jsx(oi,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,customActions:d?d(e):[]})})]})]})]})})}),t.jsx(Jo,{className:"w-[160px]",children:t.jsx(ni,{onEdit:n?()=>n(e):void 0,onDelete:l?()=>l(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived,canDelete:!!l,customActions:d?d(e):[],renderAs:"context"})})]},e.id)})})})]})},exports.CrudPageInternal=$i,exports.CrudPagination=Fi,exports.CrudPrimitiveFilterBar=_h,exports.CrudPrimitivePagination=Li,exports.CrudPrimitiveTable=Nh,exports.CrudTable=ji,exports.CustomFormFields=function({fields:e,readOnly:r=!1,hideInactiveWithoutValue:s=!1,onChange:n,onFieldChange:o}){const i=a.useCallback(t=>{if(o?.(t),n){const a=e.map(e=>e.id===t.id?t:e);n(a)}},[e,n,o]),l=e.filter(e=>zx(e,s));return 0===l.length?null:t.jsx("div",{className:"space-y-4",children:l.map(e=>t.jsx(Kx,{field:e,readOnly:r,onChange:i},e.id))})},exports.DASHBOARD_STORAGE_KEYS={advancedFilter:"analysisDashboardsListFilter"},exports.DATETIME_FORMATS=er,exports.DEFAULT_DATETIME_FORMAT=rr,exports.DEFAULT_LOCALE=ar,exports.DEFAULT_TIMEZONE=sr,exports.DashboardForm=Yp,exports.DashboardFormTab=qm,exports.DashboardFunctionality=Pm,exports.DashboardGeneralView=function({dashboards:e,limit:r,generalView:s,language:n=Vm.PtBr,isLoading:o=!1,canAdd:i=!1,canEdit:l=!1,canRemove:c=!1,canEditStandard:d=!1,activePanels:u=[],activePages:m=[],getPanelData:p,users:h=[],groups:x=[],places:f=[],collaborators:g=[],isSaving:b=!1,onOpen:v,onBackToList:y,onRefresh:w,onRefreshList:j,onToggleFavorite:N,onSave:_,onUpdate:C,onRemove:k,onDuplicate:S,onShare:A,onAddPanel:T,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:P,onLayoutChange:I,onSearch:M,onQuickFilterChange:R,onSetGeneralView:L,viewState:F,onViewStateChange:z,listToolbarExtra:U,viewToolbarActions:O,className:B}){const[q,$]=a.useState({mode:"list"}),V=F??q,W=a.useCallback(e=>{z?z(e):$(e)},[z]),H=a.useMemo(()=>"view"===V.mode||"edit"===V.mode||"share"===V.mode?e.find(e=>e.id===V.dashboardId)??null:null,[e,V]),[G,K]=a.useState(!1),[Y,Q]=a.useState(m[0]?.id);a.useEffect(()=>{m.length>0&&!Y&&Q(m[0]?.id)},[m,Y]),a.useEffect(()=>{if("view"!==V.mode||!H||H.idViewType!==Bm.Carousel||m.length<=1)return;const e=function(e){switch(e){case Mm.FiveSeconds:return 5e3;case Mm.TenSeconds:return 1e4;case Mm.FifteenSeconds:return 15e3;case Mm.ThirtySeconds:return 3e4;case Mm.OneMinute:return 6e4;case Mm.ThreeMinutes:return 18e4;case Mm.FiveMinutes:return 3e5;case Mm.TenMinutes:return 6e5;default:return 15e3}}(H.idPageTime),t=setInterval(()=>{Q(e=>{const t=(m.findIndex(t=>t.id===e)+1)%m.length;return m[t]?.id})},e);return()=>clearInterval(t)},[V,H,m]);const X=a.useCallback(e=>{W({mode:"view",dashboardId:e.id}),Q(void 0),v?.(e)},[W,v]),J=a.useCallback(()=>{W({mode:"list"}),K(!1),y?.()},[W,y]),Z=a.useCallback(()=>{W({mode:"create"})},[W]),ee=a.useCallback(e=>{W({mode:"edit",dashboardId:e.id})},[W]),te=a.useCallback(e=>{W({mode:"share",dashboardId:e.id})},[W]),ae=a.useCallback(e=>{"edit"===V.mode||"share"===V.mode?C?.(V.dashboardId,e):_?.(e)},[V,_,C]),re=a.useCallback(()=>{"edit"===V.mode||"share"===V.mode?W({mode:"view",dashboardId:V.dashboardId}):W({mode:"list"})},[V,W]),se=a.useCallback(()=>{H&&N?.(H)},[H,N]),ne=a.useCallback(()=>{H&&ee(H)},[H,ee]),oe=a.useCallback(()=>{H&&te(H)},[H,te]);return t.jsxs("div",{className:Nr("flex flex-col h-full",B),children:["list"===V.mode&&t.jsx($p,{dashboards:e,limit:r,isLoading:o,language:n,canAdd:i,canEdit:l,canRemove:c,onOpen:X,onEdit:ee,onShare:te,onDuplicate:S,onRemove:k,onAdd:Z,onToggleFavorite:N,onRefresh:j,onSearch:M,onQuickFilterChange:R,toolbarExtra:U,className:"flex-1"}),"view"===V.mode&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[!G&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:[t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]}),s?.dashboardId===H.id&&t.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary",children:[t.jsxs("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),"Visão geral"]}),l&&L&&s?.dashboardId!==H.id&&t.jsx("button",{onClick:()=>L(H.id),className:"ml-auto text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Definir como visão geral"})]}),t.jsx(Up,{dashboard:H,panels:u,pages:m,activePageId:Y,canEdit:l||d&&!!H.isStandard,isFullscreen:G,isLoading:o,getPanelData:p,onRefresh:w,onToggleFullscreen:()=>K(e=>!e),onToggleFavorite:se,onEdit:ne,onShare:oe,onAddPanel:T,onEditPanel:D,onRemovePanel:E,onDuplicatePanel:P,onLayoutChange:I,onPageChange:Q,toolbarActions:O,className:"flex-1"})]}),"create"===V.mode&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:J,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar para lista"]})}),t.jsx(Yp,{users:h,groups:x,places:f,collaborators:g,isSaving:b,onSave:ae,onCancel:re,className:"flex-1"})]}),("edit"===V.mode||"share"===V.mode)&&H&&t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-card",children:t.jsxs("button",{onClick:re,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"m15 18-6-6 6-6"})}),"Voltar"]})}),t.jsx(Yp,{dashboard:H,initialTab:"share"===V.mode?qm.Share:qm.General,users:h,groups:x,places:f,collaborators:g,isSaving:b,isQualitfy:!!H.isStandard&&!d,onSave:ae,onCancel:re,className:"flex-1"})]})]})},exports.DashboardGrid=Lp,exports.DashboardLanguage=Vm,exports.DashboardList=$p,exports.DashboardListType=Im,exports.DashboardPageTime=Mm,exports.DashboardPanelDimension=Rm,exports.DashboardPanelOrderBy=Fm,exports.DashboardPanelOrderByType=Lm,exports.DashboardPanelPeriod=zm,exports.DashboardPanelRenderer=zp,exports.DashboardPanelType=Um,exports.DashboardShareType=$m,exports.DashboardUpdateTime=Om,exports.DashboardView=Up,exports.DashboardViewType=Bm,exports.DataFilterBar=_h,exports.DataList=zc,exports.DataPagination=Li,exports.DataTable=Nh,exports.DatePicker=function({date:e,onDateChange:a,placeholder:r,disabled:s=!1,className:n,disabledDates:o,captionLayout:l,fromYear:d,toYear:u}){const{t:m}=y.useTranslation(),p=r??m("select_date");return t.jsxs(tn,{children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{variant:"outline",disabled:s,className:Nr("w-full justify-start text-left font-normal",!e&&"text-muted-foreground",n),children:[t.jsx(c.Calendar,{className:"mr-2 h-4 w-4"}),e?i.format(e,"d 'de' MMMM 'de' yyyy",{locale:Ja}):t.jsx("span",{children:p})]})}),t.jsx(rn,{className:"w-auto p-0",align:"start",children:t.jsx(Fc,{mode:"single",selected:e,onSelect:a,disabled:o,captionLayout:l,fromYear:d,toYear:u,initialFocus:!0,className:"pointer-events-auto"})})]})},exports.Dialog=Yr,exports.DialogBody=rs,exports.DialogClose=Jr,exports.DialogContent=ts,exports.DialogDescription=os,exports.DialogFooter=ss,exports.DialogHeader=as,exports.DialogOverlay=Zr,exports.DialogPortal=Xr,exports.DialogTitle=ns,exports.DialogTrigger=Qr,exports.DialogWizard=function({open:a,onOpenChange:r,currentStep:s,onStepChange:n,steps:o,canGoToStep:i,children:l,title:d,description:u,onSave:m,saveLabel:p=e.t("save"),nextLabel:h=e.t("next"),backLabel:x=e.t("back"),variant:f="form",isDirty:g,size:b="lg",unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:_,disableNext:C,hideNavigation:k,footerLeft:S}){const{t:A}=y.useTranslation(),T=o.length,D=s>=T,E=s<=1;return t.jsx(Yr,{open:a,onOpenChange:r,children:t.jsxs(ts,{size:b,variant:f,isDirty:g,unsavedChangesTitle:v,unsavedChangesDescription:w,cancelText:j,leaveWithoutSavingText:N,className:Nr("!p-0 !border-l-0 flex-row overflow-hidden",_),children:[t.jsxs("div",{className:"hidden sm:flex w-56 flex-shrink-0 flex-col bg-primary text-primary-foreground p-6 rounded-l-lg",children:[t.jsx("h3",{className:"text-sm font-medium opacity-80 mb-6",children:"Etapas"}),t.jsx("nav",{className:"flex flex-col gap-1 flex-1",children:o.map((e,a)=>{const r=a+1,o=r===s,l=(e=>e<s)(r),d=(u=r)<=s||!i||i(u);var u;return t.jsxs("button",{type:"button",onClick:()=>(e=>{e!==s&&(e<s?n(e):i&&!i(e)||n(e))})(r),disabled:!d,className:Nr("flex items-center gap-2 py-3 px-2 rounded-md text-left transition-colors text-xs",o&&"bg-primary-foreground/20 font-semibold",!o&&d&&"hover:bg-primary-foreground/10 cursor-pointer",!d&&"opacity-40 cursor-not-allowed"),children:[t.jsx("span",{className:Nr("flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold flex-shrink-0 transition-colors",o&&"bg-primary-foreground text-primary",l&&!o&&"bg-primary-foreground/30 text-primary-foreground",!o&&!l&&"border-2 border-primary-foreground/40 text-primary-foreground/60"),children:l&&!o?t.jsx(c.Check,{className:"h-3.5 w-3.5"}):r}),t.jsx("span",{className:Nr("line-clamp-2",o&&"text-primary-foreground",!o&&"text-primary-foreground/70"),children:e})]},r)})})]}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsxs(as,{className:"p-6 pb-0",children:[t.jsxs("p",{className:"text-xs text-muted-foreground sm:hidden mb-1",children:["Etapa ",s," de ",T]}),t.jsx(ns,{children:d}),u&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u})]}),t.jsx(rs,{className:"px-6",children:l}),!k&&t.jsx(ss,{className:"px-6 pb-6",children:t.jsxs("div",{className:"flex items-center justify-between w-full",children:[t.jsx("div",{className:"flex items-center gap-2",children:S}),t.jsxs("div",{className:"flex items-center gap-2",children:[!E&&t.jsx(kr,{variant:"outline",onClick:()=>n(s-1),children:x}),D?t.jsx(kr,{onClick:m,disabled:C,children:p}):t.jsx(kr,{onClick:()=>n(s+1),disabled:C,children:h})]})]})})]})]})})},exports.DisabledMenuItem=en,exports.DocumentFileUpload=function({association:e,canUpload:r=!0,canRemove:s=!0,canDownload:n=!0,canView:o=!0,maxFiles:i,allowedExtensions:c,maxSizeInBytes:d,disabled:u=!1,label:m,onFilesChanged:p,className:h}){const[x,f]=a.useState([]),[g,b]=a.useState(!1),[v,y]=a.useState(0),w=a.useRef(p);w.current=p;const{type:j,associationId:N,associationFieldId:_}=e,C=a.useCallback(async()=>{if(!N)return void f([]);const e=await Px.listByAssociation(j,N,_);f(e),w.current?.(e.length)},[j,N,_]);a.useEffect(()=>{C()},[C]);const k=a.useCallback(async e=>{if(N){b(!0);try{await Px.upload(j,N,e,_),y(e=>e+1),await C()}catch{l.toast.error("Falha ao enviar o arquivo.")}finally{b(!1)}}},[j,N,_,C]),S=a.useCallback(async(e,t)=>{const a=await Px.downloadUrl(e.id);if(a)if(t){const t=document.createElement("a");t.href=a,t.download=e.name,t.click()}else window.open(a,"_blank","noopener,noreferrer");else l.toast.error("Não foi possível abrir o arquivo.")},[]),A=a.useCallback(async e=>{if(e.associationRowId){b(!0);try{if(!await Px.remove(e.associationRowId))throw new Error;await C()}catch{l.toast.error("Falha ao remover o arquivo.")}finally{b(!1)}}},[C]),T=r&&(null==i||x.length<i);return t.jsxs("div",{className:h,children:[m&&t.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:m}),t.jsxs("div",{className:"space-y-2",children:[x.map(e=>t.jsx(kx,{storedFile:Ix(e),showReplaceButton:!1,showDownloadButton:n,showViewButton:o,showCloseButton:s,disabled:u||g,onDownload:()=>S(e,!0),onView:()=>S(e,!1),onFileRemove:()=>A(e)},e.associationRowId||e.id)),T&&t.jsx(kx,{allowedExtensions:c,maxSizeInBytes:d,showReplaceButton:!1,showDownloadButton:!1,showViewButton:!1,showCloseButton:!1,disabled:u||g,onFileSelect:k},`add-${v}`)]})]})},exports.Drawer=Uc,exports.DrawerClose=qc,exports.DrawerContent=Vc,exports.DrawerDescription=Kc,exports.DrawerFooter=Hc,exports.DrawerHeader=Wc,exports.DrawerOverlay=$c,exports.DrawerPortal=Bc,exports.DrawerTitle=Gc,exports.DrawerTrigger=Oc,exports.DropdownMenu=Rs,exports.DropdownMenuCheckboxItem=Ws,exports.DropdownMenuContent=$s,exports.DropdownMenuGroup=Fs,exports.DropdownMenuItem=Vs,exports.DropdownMenuLabel=Gs,exports.DropdownMenuPortal=zs,exports.DropdownMenuRadioGroup=Os,exports.DropdownMenuRadioItem=Hs,exports.DropdownMenuSeparator=Ks,exports.DropdownMenuShortcut=Ys,exports.DropdownMenuSub=Us,exports.DropdownMenuSubContent=qs,exports.DropdownMenuSubTrigger=Bs,exports.DropdownMenuTrigger=Ls,exports.ECustomFormFieldType=Mx,exports.EDocumentAssociationType={Docs:17,Trainings:19},exports.EFieldViewMode=Rx,exports.ESelectionFieldDataSource=Lx,exports.EditProfileDialog=xl,exports.ElectronicSignatureDialog=function({open:r,onOpenChange:s,onConfirm:n,onGenerateCode:o,mode:i="code",email:l,maxLength:d=8,title:u=e.t("electronic_signature"),description:m,confirmLabel:p=e.t("conclude"),cancelLabel:h=e.t("cancel"),resendLabel:x=e.t("resend_code"),errorMessage:f}){const g="password"===i,b=g?e.t("esign_password_description"):e.t("esign_code_description"),v=m??b,[y,w]=a.useState(""),[j,N]=a.useState(!1),[_,C]=a.useState(!1),[k,S]=a.useState(null),A=a.useCallback(async()=>{if(y.trim()){N(!0),S(null);try{await n(y)?(w(""),s(!1)):S(f??(g?e.t("esign_invalid_password"):e.t("esign_invalid_code")))}catch{S(f??(g?e.t("esign_password_error"):e.t("esign_code_error")))}finally{N(!1)}}},[y,n,s,f,g]),T=a.useCallback(async()=>{if(o){C(!0),S(null);try{await o()}catch{S(e.t("esign_resend_error"))}finally{C(!1)}}},[o]),D=e=>{e||(w(""),S(null)),s(e)},E=g?c.Lock:c.ShieldCheck,P=g?"Senha":e.t("verification_code"),I=g?e.t("enter_password"):e.t("enter_code");return t.jsx(Yr,{open:r,onOpenChange:D,children:t.jsxs(ts,{className:"sm:max-w-md",variant:"form",isDirty:!!y,children:[t.jsx(as,{children:t.jsxs(ns,{className:"flex items-center gap-2",children:[t.jsx(E,{className:"h-5 w-5 text-primary"}),u]})}),t.jsxs("div",{className:"py-4 space-y-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:v}),!g&&l&&t.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted/50 rounded-md px-3 py-2",children:[t.jsx(c.Mail,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground",children:"Enviado para:"}),t.jsx("span",{className:"font-medium",children:l})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"signature-input",children:P}),t.jsx(Ar,{id:"signature-input",type:g?"password":"text",value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&y.trim()&&(e.preventDefault(),A())},maxLength:g?void 0:d,placeholder:I,autoFocus:!0,className:Nr(k&&"border-destructive focus-visible:ring-destructive")}),k&&t.jsx("p",{className:"text-sm text-destructive",children:k})]}),!g&&t.jsxs(kr,{variant:"ghost",size:"sm",onClick:T,disabled:_,className:"text-primary",children:[t.jsx(c.RefreshCw,{className:Nr("h-4 w-4 mr-1",_&&"animate-spin")}),x]})]}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"outline",onClick:()=>D(!1),disabled:j,children:h}),t.jsx(kr,{onClick:A,disabled:!y.trim()||j,children:j?"Validando...":p})]})]})})},exports.EllipsisText=qo,exports.EmailService=hx,exports.EmptyState=Bo,exports.EntitySelect=fn,exports.ErrorBoundary=ql,exports.ExportDialog=function({open:e,onOpenChange:r,onExport:s,mode:n="table",options:o,title:i,description:l,cancelLabel:c="Cancelar",exportLabel:d="Exportar"}){const{t:u}=y.useTranslation(),[m,p]=a.useState(""),h=o??("chart"===n?om:nm),x=i??u("chart"===n?"dashboard_export_chart":"dashboard_export_table"),f=l??u("select_file_format"),g=e=>{e||p(""),r(e)};return t.jsx(Yr,{open:e,onOpenChange:g,children:t.jsxs(ts,{className:"sm:max-w-md",variant:"form",isDirty:!!m,children:[t.jsx(as,{children:t.jsx(ns,{children:x})}),t.jsxs("div",{className:"py-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:f}),t.jsx(Ld,{value:m,onValueChange:p,className:"gap-3",children:h.map(e=>t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Fd,{value:e.value,id:`export-${e.value}`}),t.jsxs(Dr,{htmlFor:`export-${e.value}`,className:Nr("flex items-center gap-2 cursor-pointer font-normal",m===e.value&&"font-medium"),children:[e.icon,e.label]})]},e.value))})]}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"outline",onClick:()=>g(!1),children:c}),t.jsx(kr,{onClick:()=>{m&&(s(m),r(!1),p(""))},disabled:!m,children:d})]})]})})},exports.ExportFormat=sm,exports.FORBIDDEN_FILE_TYPES=Nx,exports.FilePrintType=hm,exports.FileViewerType=pm,exports.FilterBar=qi,exports.Form=is,exports.FormControl=ps,exports.FormDateField=Bx,exports.FormDescription=hs,exports.FormField=({...e})=>t.jsx(ls.Provider,{value:{name:e.name},children:t.jsx(h.Controller,{...e})}),exports.FormItem=us,exports.FormLabel=ms,exports.FormMessage=xs,exports.FormMultiSelectionField=Hx,exports.FormNumericField=Vx,exports.FormQuestionsField=Gx,exports.FormSingleSelectionField=Wx,exports.FormSkeleton=function({fields:e=4}){return t.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,a)=>t.jsxs("div",{className:"space-y-2",children:[t.jsx(pn,{className:"h-4 w-24"}),t.jsx(pn,{className:"h-10 w-full"})]},a)),t.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[t.jsx(pn,{className:"h-10 w-20"}),t.jsx(pn,{className:"h-10 w-20"})]})]})},exports.FormTextField=Ox,exports.FormTimeField=qx,exports.FormUrlField=$x,exports.Grid=function({children:e,cols:a="auto-fit",gap:r="md",className:s}){return t.jsx("div",{className:Nr("grid",Yc[a],Qc[r],s),children:e})},exports.H1=id,exports.H2=ld,exports.H3=cd,exports.H4=dd,exports.HeaderSkeleton=function(){return t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(pn,{className:"h-8 w-8 rounded-full"}),t.jsx(pn,{className:"h-6 w-32"})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(pn,{className:"h-8 w-8"}),t.jsx(pn,{className:"h-8 w-24"})]})]})},exports.HoverCard=Xc,exports.HoverCardContent=Zc,exports.HoverCardTrigger=Jc,exports.IconPicker=Ei,exports.IframeDialog=ym,exports.ImageEditor=function({value:e,onChange:r,onSubmit:s,onCancel:n,uploadFunction:o,deleteFunction:i,uploadOptions:d}){const{t:u}=y.useTranslation(),[m,p]=a.useState(e||{alignment:"center",allowDownload:!1}),h=a.useRef(null),{upload:x,uploading:f}=wx({uploadFunction:o,deleteFunction:i,defaultOptions:{...d,allowedTypes:["image/*"],maxSize:5242880}}),g=(e,t)=>{const a={...m,[e]:t};p(a),r(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"URL"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Ar,{type:"url",placeholder:"https://exemplo.com/imagem.jpg",value:m.imageUrl||"",onChange:e=>g("imageUrl",e.target.value),className:"flex-1"}),o&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await x(t),a={...m,imageUrl:e.url,imageFile:e.name,imagePath:e.path,imageSize:e.size};p(a),r(a)}catch(a){}finally{h.current&&(h.current.value="")}},className:"hidden"}),t.jsx(kr,{type:"button",variant:"outline",onClick:()=>h.current?.click(),disabled:f,children:f?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]})]}),m.imageFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Arquivo: ",m.imageFile," (",Math.round((m.imageSize||0)/1024)," KB)"]})]}),m.imageUrl&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:t.jsx("div",{className:"flex "+("left"===m.alignment?"justify-start":"right"===m.alignment?"justify-end":"justify-center"),children:t.jsx("img",{src:m.imageUrl,alt:m.alt||"Preview",style:{width:m.width?`${m.width}px`:"auto",height:m.height?`${m.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"})})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"caption",children:"Legenda"}),t.jsx(As,{id:"caption",placeholder:"Legenda",value:m.caption||"",onChange:e=>g("caption",e.target.value),rows:2})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"alt",children:u("alt_text")}),t.jsx(Ar,{id:"alt",placeholder:u("alt_text"),value:m.alt||"",onChange:e=>g("alt",e.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"Alinhamento"}),t.jsxs(gs,{value:m.alignment||"center",onValueChange:e=>g("alignment",e),children:[t.jsx(ys,{children:t.jsx(vs,{})}),t.jsxs(Ns,{children:[t.jsx(Cs,{value:"left",children:"Esquerda"}),t.jsx(Cs,{value:"center",children:"Centro"}),t.jsx(Cs,{value:"right",children:"Direita"})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"width",children:"Largura"}),t.jsx(Ar,{id:"width",type:"number",placeholder:"px",value:m.width||"",onChange:e=>g("width",e.target.value?Number(e.target.value):void 0)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"height",children:"Altura"}),t.jsx(Ar,{id:"height",type:"number",placeholder:"px",value:m.height||"",onChange:e=>g("height",e.target.value?Number(e.target.value):void 0)})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ss,{id:"allowDownload",checked:m.allowDownload||!1,onCheckedChange:e=>g("allowDownload",!0===e)}),t.jsx(Dr,{htmlFor:"allowDownload",className:"cursor-pointer",children:"Permitir download"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(kr,{variant:"outline",onClick:n,children:"Cancelar"}),t.jsx(kr,{onClick:()=>{m.imageUrl?s(m):l.toast.error("Erro",{description:u("no_image_selected")})},disabled:!m.imageUrl,children:"Salvar"})]})]})},exports.ImageRenderer=function({content:e,className:a="",style:r}){const{t:s}=y.useTranslation();if(!e.imageUrl)return null;const n={left:"justify-start",center:"justify-center",right:"justify-end"}[e.alignment||"center"];return t.jsx("div",{className:`flex ${n} my-4 ${a}`,style:r,children:t.jsxs("div",{className:"space-y-2 max-w-full",children:[t.jsx("img",{src:e.imageUrl,alt:e.alt||"",style:{width:e.width?`${e.width}px`:"auto",height:e.height?`${e.height}px`:"auto",maxWidth:"100%"},className:"rounded-lg shadow-md"}),e.caption&&t.jsx("p",{className:"text-sm text-muted-foreground text-center italic",children:e.caption}),e.allowDownload&&e.imageUrl&&t.jsxs("a",{href:e.imageUrl,download:!0,className:"flex items-center gap-2 text-sm text-primary hover:underline justify-center",children:[t.jsx(c.Download,{className:"h-4 w-4"}),"Baixar imagem"]})]})})},exports.InlineCode=fd,exports.Input=Ar,exports.InputGroup=ed,exports.InputGroupAddon=ad,exports.InputGroupButton=sd,exports.InputGroupInput=nd,exports.InputGroupTextarea=od,exports.LINK_PROPERTIES=sp,exports.LOGO_CONFIG=Ze,exports.Label=Dr,exports.LanguageBootstrap=El,exports.Large=pd,exports.Lead=md,exports.List=bd,exports.ListPanel=jp,exports.LoadingState=Is,exports.LocaleProvider=Rl,exports.LoginPage=()=>{const{t:e}=y.useTranslation();return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsx(Ir,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),t.jsxs(Rr,{className:"text-center space-y-4",children:[t.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),t.jsx(kr,{onClick:async()=>{We()?await wo.loginDev():wo.loginProd()},className:"w-full",size:"lg",children:We()?e("dev_login"):e("login_with_qualiex")})]})]})})},exports.MESSAGES=et,exports.MODULES_DATA=ic,exports.MONTHS_MAP=ap,exports.MatrixRiskPanel=Pp,exports.MatrixViewType=Wm,exports.Menubar=Du,exports.MenubarCheckboxItem=Lu,exports.MenubarContent=Mu,exports.MenubarGroup=ku,exports.MenubarItem=Ru,exports.MenubarLabel=zu,exports.MenubarMenu=Cu,exports.MenubarPortal=Su,exports.MenubarRadioGroup=Tu,exports.MenubarRadioItem=Fu,exports.MenubarSeparator=Uu,exports.MenubarShortcut=Ou,exports.MenubarSub=Au,exports.MenubarSubContent=Iu,exports.MenubarSubTrigger=Pu,exports.MenubarTrigger=Eu,exports.MindMap=({value:e,defaultValue:r,onChange:s,onNodeSelect:n,readOnly:o=!1,hideToolbar:i=!1,extraShortcuts:l,renderNodeContent:c,className:d,height:u=600})=>{const{t:m}=y.useTranslation(),p=lh({value:e,defaultValue:r,onChange:s,readOnly:o}),h=xh(p.root),x=function(){const[e,t]=a.useState({x:0,y:0,scale:1}),r=a.useRef(!1),s=a.useRef({x:0,y:0,tx:0,ty:0}),n=a.useCallback(t=>{0!==t.button&&1!==t.button||(r.current=!0,s.current={x:t.clientX,y:t.clientY,tx:e.x,ty:e.y},t.currentTarget.setPointerCapture(t.pointerId))},[e.x,e.y]),o=a.useCallback(e=>{r.current&&t(t=>({...t,x:s.current.tx+(e.clientX-s.current.x),y:s.current.ty+(e.clientY-s.current.y)}))},[]),i=a.useCallback(e=>{if(r.current){r.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),l=a.useCallback((e,a,r)=>{t(t=>{const s=Math.min(2.5,Math.max(.3,t.scale+e));if(s===t.scale)return t;if(void 0===a||void 0===r)return{...t,scale:s};const n=s/t.scale;return{scale:s,x:a-(a-t.x)*n,y:r-(r-t.y)*n}})},[]),c=a.useCallback(()=>l(.15),[l]),d=a.useCallback(()=>l(-.15),[l]),u=a.useCallback(()=>t({x:0,y:0,scale:1}),[]),m=a.useCallback((e,a,r,s)=>{const n=Math.min((r-64)/e,(s-64)/a,1.5),o=Math.max(.3,n);t({scale:o,x:(r-e*o)/2,y:(s-a*o)/2})},[]),p=a.useCallback(e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),a=e.clientX-t.left,r=e.clientY-t.top;l(e.deltaY>0?-.1:.1,a,r)},[l]);return a.useEffect(()=>{const e=()=>r.current=!1;return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]),{transform:e,setTransform:t,zoomIn:c,zoomOut:d,reset:u,fitTo:m,onBackgroundPointerDown:n,onPointerMove:o,onPointerUp:i,onWheel:p}}(),f=te.useRef(null),g=te.useRef(null),b=te.useRef(null),[v,w]=te.useState(null),[j,N]=te.useState(null);te.useEffect(()=>{n?.(p.selectedNode)},[p.selectedNode,n]),function({api:e,layout:t,containerRef:r,onStartEditing:s,readOnly:n,extraShortcuts:o}){a.useEffect(()=>{const a=a=>{const i=r.current;if(!i)return;if(!i.contains(document.activeElement))return;const l=a.target;if(l?.isContentEditable)return;if(l&&("INPUT"===l.tagName||"TEXTAREA"===l.tagName))return;const c={layout:t,selectedId:e.selectedId,setSelectedId:e.setSelectedId},d=e.selectedId;for(const t of o??[])if(t.key.toLowerCase()===a.key.toLowerCase()&&!!t.ctrl===(a.ctrlKey||a.metaKey)&&!!t.shift===a.shiftKey&&!!t.alt===a.altKey)return a.preventDefault(),void t.handler({selectedId:e.selectedId,root:e.root,setRoot:e.setRoot,select:e.setSelectedId});if((a.ctrlKey||a.metaKey)&&"z"===a.key.toLowerCase())return a.preventDefault(),void(a.shiftKey?e.redo():e.undo());if("ArrowUp"===a.key)return a.preventDefault(),void fh("up",c);if("ArrowDown"===a.key)return a.preventDefault(),void fh("down",c);if("ArrowLeft"===a.key)return a.preventDefault(),void fh("left",c);if("ArrowRight"===a.key)return a.preventDefault(),void fh("right",c);if(d){if(" "===a.key)return a.preventDefault(),void e.toggleNode(d);if("F2"===a.key){if(n)return;return a.preventDefault(),void s(d)}if(!n){if("Enter"===a.key&&!a.shiftKey)return a.preventDefault(),d===e.root.id?e.addChild(d,""):e.addSibling(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Insert"===a.key||"Tab"===a.key)return a.preventDefault(),e.addChild(d,""),void setTimeout(()=>{e.selectedId&&s(e.selectedId)},0);if("Delete"===a.key||"Backspace"===a.key){if(d===e.root.id)return;return a.preventDefault(),void e.removeNode(d)}}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t,r,s,n,o])}({api:p,layout:h,containerRef:f,onStartEditing:e=>{o||w(e)},readOnly:o,extraShortcuts:l});const _=te.useRef(!1);te.useEffect(()=>{if(_.current)return;const e=g.current;if(!e)return;const{clientWidth:t,clientHeight:a}=e;t>0&&a>0&&h.width>0&&(x.fitTo(h.width,h.height,t,a),_.current=!0)},[h.width,h.height,x]);const C=p.selectedId,k=p.selectedNode,S=C===p.root.id,A=te.useRef(null),T=e=>t=>{if(o)return;const a=A.current;if(!a||a===e)return;const r=Jp(p.root,a);r&&Jp(r.node,e)||(t.preventDefault(),t.dataTransfer.dropEffect="move",N(e))},D=()=>N(null),E=e=>t=>{t.preventDefault();const a=A.current;N(null),A.current=null,a&&a!==e&&p.moveNode(a,e)};return t.jsx(Qs,{children:t.jsxs("div",{ref:f,tabIndex:0,role:"tree","aria-label":m("mind_map_aria_label"),className:Nr("relative flex flex-col rounded-lg border bg-muted/20 overflow-hidden focus:outline-none",d),style:{height:u},onClick:()=>f.current?.focus(),children:[!i&&t.jsx(yh,{canAddChild:!!k&&!o,canAddSibling:!!k&&!o,canDelete:!!k&&!S&&!o,canUndo:p.canUndo&&!o,canRedo:p.canRedo&&!o,onAddChild:()=>{if(!C)return;const e=p.addChild(C,"");w(e)},onAddSibling:()=>{if(!C)return;if(S){const e=p.addChild(C,"");return void w(e)}const e=p.addSibling(C,"");w(e)},onDelete:()=>{C&&!S&&p.removeNode(C)},onExpandAll:p.expandAll,onCollapseAll:p.collapseAll,onFit:()=>{const e=g.current;e&&x.fitTo(h.width,h.height,e.clientWidth,e.clientHeight)},onZoomIn:x.zoomIn,onZoomOut:x.zoomOut,onUndo:p.undo,onRedo:p.redo,onExportJson:()=>{!function(e,t,a="application/json"){const r=new Blob([e],{type:a}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(wh(p.root),"mind-map.json")},onExportImage:async()=>{if(b.current)try{await async function(e,t="mind-map.png"){const a=e.cloneNode(!0),r=(new XMLSerializer).serializeToString(a),s=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(r)))}`,n=new Image;await new Promise((e,t)=>{n.onload=()=>e(),n.onerror=()=>t(new Error("Failed to load SVG snapshot")),n.src=s});const o=e.clientWidth||Number(e.getAttribute("width"))||1200,i=e.clientHeight||Number(e.getAttribute("height"))||800,l=document.createElement("canvas");l.width=2*o,l.height=2*i;const c=l.getContext("2d");if(!c)throw new Error("Canvas 2D context unavailable");c.fillStyle="#ffffff",c.fillRect(0,0,l.width,l.height),c.drawImage(n,0,0,l.width,l.height);const d=await new Promise(e=>l.toBlob(e,"image/png"));if(!d)throw new Error("Failed to create PNG blob");const u=URL.createObjectURL(d),m=document.createElement("a");m.href=u,m.download=t,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}(b.current,"mind-map.png")}catch(e){}}}),t.jsx("div",{ref:g,className:"relative flex-1 overflow-hidden cursor-grab active:cursor-grabbing",onPointerDown:e=>{e.target===e.currentTarget&&(x.onBackgroundPointerDown(e),p.setSelectedId(null))},onPointerMove:x.onPointerMove,onPointerUp:x.onPointerUp,onWheel:x.onWheel,children:t.jsxs("div",{className:"absolute origin-top-left",style:{transform:`translate(${x.transform.x}px, ${x.transform.y}px) scale(${x.transform.scale})`,width:h.width,height:h.height},children:[t.jsx("svg",{ref:b,width:h.width,height:h.height,className:"absolute inset-0 pointer-events-none",xmlns:"http://www.w3.org/2000/svg",children:h.nodes.map(e=>e.visibleChildren.map(a=>t.jsx(bh,{parent:e,child:a},`${e.node.id}-${a.node.id}`)))}),h.nodes.map(e=>{return t.jsx(gh,{layout:e,selected:C===e.node.id,editing:v===e.node.id,readOnly:o,onSelect:()=>p.setSelectedId(e.node.id),onStartEditing:()=>w(e.node.id),onFinishEditing:t=>{null!==t&&p.renameNode(e.node.id,t),w(null)},onToggle:()=>p.toggleNode(e.node.id),onDragStart:(a=e.node.id,e=>{o||a===p.root.id||(A.current=a,e.dataTransfer.setData("text/plain",a),e.dataTransfer.effectAllowed="move")}),onDragOver:T(e.node.id),onDragLeave:D,onDrop:E(e.node.id),isDropTarget:j===e.node.id,renderNodeContent:c},e.node.id);var a})]})})]})})},exports.ModalStateProvider=function({children:e}){const[r,s]=a.useState(new Set),[n,o]=a.useState(!1),i=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.add(e),a})},[]),l=a.useCallback(e=>{s(t=>{const a=new Set(t);return a.delete(e),a})},[]),c=a.useCallback(e=>{o(e)},[]),d=a.useMemo(()=>r.size>0||n,[r,n]),u=a.useMemo(()=>({openModals:r,hasOpenModal:d,registerModal:i,unregisterModal:l,setHasOpenModal:c}),[r,d,i,l,c]);return t.jsx(Vh.Provider,{value:u,children:e})},exports.ModuleAccessGuard=fc,exports.ModuleGrid=dc,exports.ModuleOfferContent=function({title:e,description:a,image:r,icon:s,ctaLabel:n,onCtaClick:o,children:i}){const{t:l}=y.useTranslation(),d=n??l("want_to_know_more");return t.jsxs("div",{className:"flex flex-col items-center text-center gap-6 py-8 px-4",children:[!i&&(r||s)&&t.jsx("div",{className:"flex items-center justify-center",children:r?t.jsx("img",{src:r,alt:e,className:"max-h-48 w-auto object-contain rounded-lg"}):s?t.jsx("div",{className:"w-24 h-24 rounded-2xl bg-primary/10 flex items-center justify-center",children:t.jsx(s,{className:"h-12 w-12 text-primary"})}):null}),t.jsxs("div",{className:"space-y-3 max-w-lg",children:[t.jsx("h3",{className:"text-xl font-semibold text-foreground",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a})]}),i?t.jsx("div",{className:"w-full",children:i}):o?t.jsxs(kr,{onClick:o,size:"lg",className:"gap-2",children:[t.jsx(c.Sparkles,{className:"h-4 w-4"}),d]}):null]})},exports.ModuleProvider=Cl,exports.ModulesContent=uc,exports.ModulesDialog=pc,exports.ModulesFooterCards=oc,exports.MultiSelect=fn,exports.MultiselectPermissions=function({items:r,categories:s,value:n,onChange:o,readonly:i=!1,isLoading:l=!1,title:d=e.t("permissions"),addButtonLabel:u=e.t("allow"),chipsTitle:m=e.t("allowed_items"),chipsPlaceholder:p=e.t("no_item_selected"),searchPlaceholder:h=e.t("search_placeholder"),selectPlaceholder:x=e.t("select_items_to_add"),itemInfoTemplate:f=e=>`${e} ${1===e?"item":"itens"}`,disclaimer:g,disclaimerLink:b,onDisclaimerClick:v,className:w}){const[j,N]=a.useState(s[0]?.id??""),[_,C]=a.useState(""),[k,S]=a.useState([]),[A,T]=a.useState(!1),D=a.useMemo(()=>_m(n[j]),[n,j]),E=a.useMemo(()=>function(e){const{t:t}=y.useTranslation(),a=new Set;if(!e)return a;for(const r of e)r.inheritedIds?.forEach(e=>a.add(e));return a}(n[j]),[n,j]),P=a.useMemo(()=>r.filter(e=>D.has(e.id)),[r,D]),I=a.useMemo(()=>{const e=Nm(_);return r.filter(t=>!D.has(t.id)&&!(e&&!Nm(t.name).includes(e)))},[r,D,_]),M=a.useMemo(()=>{const e={};for(const t of s)e[t.id]=_m(n[t.id]).size;return e},[s,n]),R=a.useCallback(e=>{N(e),S([]),C("")},[]),L=a.useCallback(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),F=a.useCallback(()=>{if(0===k.length)return;const e=[...n[j]??[]];for(const t of k){const a=r.find(e=>e.id===t),s=a?.group??"default",n=e.find(e=>e.context===s);n?n.allowedIds.includes(t)||(n.allowedIds=[...n.allowedIds,t]):e.push({context:s,allowedIds:[t],inheritedIds:[]})}o({...n,[j]:e}),S([]),C(""),T(!1)},[k,n,j,r,o]),z=a.useCallback(e=>{if(E.has(e))return;const t=(n[j]??[]).map(t=>({...t,allowedIds:t.allowedIds.filter(t=>t!==e)}));o({...n,[j]:t})},[n,j,E,o]);return l?t.jsxs("div",{className:Nr("rounded-md border bg-muted/30 p-4 animate-pulse space-y-3",w),children:[t.jsx("div",{className:"h-4 w-32 bg-muted rounded"}),t.jsx("div",{className:"h-9 w-full bg-muted rounded"}),t.jsx("div",{className:"h-20 w-full bg-muted rounded"})]}):t.jsx("div",{className:Nr("rounded-md border bg-muted/30",w),children:t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:d}),t.jsxs(gs,{value:j,onValueChange:R,children:[t.jsx(ys,{className:"h-9 text-sm",children:t.jsx(vs,{})}),t.jsx(Ns,{children:s.map(e=>t.jsx(Cs,{value:e.id,children:t.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.name,M[e.id]>0&&t.jsx(Ds,{variant:"secondary",className:"ml-1 text-xs px-1.5 py-0",children:M[e.id]})]})},e.id))})]})]}),!i&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(tn,{open:A,onOpenChange:T,children:[t.jsx(an,{asChild:!0,children:t.jsxs(kr,{variant:"outline",role:"combobox",className:"flex-1 justify-between h-9 text-sm font-normal text-muted-foreground",children:[k.length>0?`${k.length} selecionado${k.length>1?"s":""}`:x,t.jsx(c.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsxs(rn,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:[t.jsx("div",{className:"p-2 border-b",children:t.jsxs("div",{className:"relative",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Ar,{className:"pl-8 h-8 text-sm",placeholder:h,value:_,onChange:e=>C(e.target.value)})]})}),t.jsx(Si,{className:"max-h-[220px]",children:0===I.length?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nenhum item encontrado"}):t.jsx("div",{className:"p-1",children:I.map(e=>{const a=k.includes(e.id);return t.jsxs("div",{className:Nr("flex items-center gap-3 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent",a&&"bg-accent/50"),onClick:()=>L(e.id),children:[t.jsx("div",{className:Nr("flex h-4 w-4 items-center justify-center rounded-sm border border-primary",a&&"bg-primary text-primary-foreground"),children:a&&t.jsx(c.Check,{className:"h-3 w-3"})}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:e.name}),null!=e.count&&t.jsx("span",{className:"text-xs text-muted-foreground",children:f(e.count)})]})]},e.id)})})})]})]}),t.jsxs(kr,{size:"sm",className:"h-9 gap-1",disabled:0===k.length,onClick:F,children:[t.jsx(c.Plus,{className:"h-4 w-4"}),u]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:m}),t.jsx("div",{className:Nr("rounded-md border bg-background p-3 min-h-[60px]",i&&"bg-muted/50"),children:0===P.length?t.jsx("span",{className:"text-sm text-muted-foreground",children:p}):t.jsx("div",{className:"flex flex-wrap gap-1.5",children:P.map(e=>{const a=E.has(e.id);return t.jsxs(Ds,{variant:a?"secondary":"default",className:"gap-1 pl-2 pr-1 py-1 text-xs",children:[e.name,!i&&!a&&t.jsx("button",{type:"button",className:"ml-0.5 rounded-full hover:bg-primary-foreground/20 p-0.5",onClick:()=>z(e.id),children:t.jsx(c.X,{className:"h-3 w-3"})})]},e.id)})})}),i&&g&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{dangerouslySetInnerHTML:{__html:g}})," ",b&&v&&t.jsx("button",{type:"button",className:"text-primary underline hover:no-underline",onClick:v,children:b})]})]})]})})},exports.Muted=xd,exports.NavigationMenu=vd,exports.NavigationMenuContent=_d,exports.NavigationMenuIndicator=Sd,exports.NavigationMenuItem=wd,exports.NavigationMenuLink=Cd,exports.NavigationMenuList=yd,exports.NavigationMenuTrigger=Nd,exports.NavigationMenuViewport=kd,exports.NavigationProvider=Ih,exports.NumericPanel=yp,exports.OnboardingDialog=am,exports.OnlineEditorDialog=function({open:e,onOpenChange:r,identifier:s,fileName:n,mode:o="edit",type:i="document",onClose:l,className:d}){const[u,m]=a.useState(!0),p=function(e,t="edit",a="document"){return`https://docs.google.com/${a}/d/${e}/${t}?usp=drivesdk?embedded=true&rm=demo`}(s,o,i);a.useEffect(()=>{if(e){m(!0);const e=setTimeout(()=>m(!1),300);return()=>clearTimeout(e)}},[e]);const h=a.useCallback(()=>{l?.(),r(!1)},[l,r]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&h()};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,h]),t.jsx(Yr,{open:e,onOpenChange:r,children:t.jsxs(ts,{className:Nr("max-w-[95vw] max-h-[95vh] w-[90vw] p-6 gap-0 [&>button.absolute]:hidden",d),children:[t.jsxs("div",{className:"flex items-center justify-between mb-6 min-h-[30px]",children:[u?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-80px)]",children:n}),t.jsx("div",{className:"flex items-center ml-4 z-20",children:t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:h,children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Zs,{children:"Fechar"})]})})]}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[160px] w-full min-w-[77vw] min-h-[80vh]",children:u?t.jsx(Ps,{className:"h-14 w-14"}):t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Ps,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{src:p,className:"border-none w-full h-full z-[1] relative",title:n})]})})]})})},exports.P=ud,exports.PageBreadcrumb=function({items:e,maxItems:a=3,className:r}){const s=e.length>a?[e[0],...e.slice(-(a-1))]:e,n=e.length>a;return t.jsx(Sc,{className:r,children:t.jsx(Ac,{children:s.map((e,a)=>{const r=0===a,s=n&&1===a;return t.jsxs(Tc,{children:[!r&&t.jsx(Pc,{}),s&&t.jsxs(t.Fragment,{children:[t.jsx(Ic,{}),t.jsx(Pc,{})]}),e.isCurrentPage?t.jsx(Ec,{children:e.label}):t.jsx(Dc,{asChild:!0,children:t.jsx(N.Link,{to:e.href||"/",children:e.label})})]},e.label)})})})},exports.PageMetadataProvider=gl,exports.Pagination=Ad,exports.PaginationContent=Td,exports.PaginationEllipsis=Md,exports.PaginationItem=Dd,exports.PaginationLink=Ed,exports.PaginationNext=Id,exports.PaginationPrevious=Pd,exports.PaletteType=tp,exports.PanelError=xp,exports.PanelHeader=hp,exports.PanelItemsPerPanel=Hm,exports.PanelLoader=fp,exports.PanelNoData=gp,exports.PanelSortType=Gm,exports.PanelState=Km,exports.PanelUnavailable=bp,exports.ParetoPanel=Tp,exports.PerformancePanel=Ep,exports.PiePanel=Ap,exports.PlanType=Qm,exports.Popover=tn,exports.PopoverContent=rn,exports.PopoverTrigger=an,exports.Progress=Rd,exports.ProtectedRoute=({children:r})=>{const{isAuthenticated:s,isLoading:n}=ko();if(a.useEffect(()=>{if(n)return;if(s)return;if($n.isManualLogout())return void(window.location.pathname.endsWith("/login")||(window.location.href=Ue("/login")));const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const r=We(),o=Be(window.location.pathname),i=o+window.location.search+window.location.hash;["/","/login","/callback"].includes(o)||localStorage.setItem("auth_return_url",i);(async()=>{r?await wo.loginDev():wo.loginProd()})()},[s,n]),n&&!s)return t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsx(Ir,{className:"text-xl font-semibold",children:"Carregando..."})}),t.jsxs(Rr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!s){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsx(Ir,{className:"text-xl font-semibold",children:"Processando..."})}),t.jsxs(Rr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):t.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:t.jsxs(Er,{className:"w-full max-w-md",children:[t.jsx(Pr,{className:"text-center",children:t.jsx(Ir,{className:"text-xl font-semibold",children:"Iniciando..."})}),t.jsxs(Rr,{className:"text-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),t.jsx("p",{className:"text-muted-foreground",children:We()?e.t("auto_login"):e.t("redirecting_auth")})]})]})})}return t.jsx(t.Fragment,{children:r})},exports.QUALIEX_CONFIG=Je,exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=xo,exports.QualiexErrorInterceptor=io,exports.QualiexUserField=Mi,exports.QueriesContextType=Xm,exports.QueriesShareType=Jm,exports.QuickFilterDashboard=Zm,exports.RadioGroup=Ld,exports.RadioGroupItem=Fd,exports.ReadOnlyTextField=Ux,exports.ReportRequestList=function({requests:e,isLoading:r=!1,onGetReportUrl:s,formatDate:n=Am,labels:o,className:i}){const{t:l}=y.useTranslation(),d={...km,...o},[u,m]=a.useState(""),[p,h]=a.useState(!1),[x,f]=a.useState(""),[g,b]=a.useState(""),[v,w]=a.useState(null),j=a.useMemo(()=>{if(!u)return e;const t=Sm(u);return e.filter(e=>Sm(e.reportName).includes(t))},[e,u]),N=a.useCallback(async e=>{if(!v){w(e.id);try{const t=await s(e.id);t&&(f(t),b(e.reportName),h(!0))}finally{w(null)}}},[s,v]);return r?t.jsx("div",{className:Nr("space-y-3",i),children:Array.from({length:5}).map((e,a)=>t.jsx(pn,{className:"h-12 w-full"},a))}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:Nr("space-y-3",i),children:[t.jsxs("div",{className:"relative max-w-sm",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Ar,{className:"pl-8 h-9 text-sm",placeholder:d.searchPlaceholder,value:u,onChange:e=>m(e.target.value)})]}),t.jsx(Si,{className:"rounded-md border",children:t.jsxs(Do,{children:[t.jsx(Eo,{children:t.jsxs(Mo,{children:[t.jsx(Ro,{className:"min-w-[140px]",children:d.report}),t.jsx(Ro,{className:"min-w-[150px]",children:d.status}),t.jsx(Ro,{className:"min-w-[160px]",children:d.requestDate}),t.jsx(Ro,{className:"min-w-[160px]",children:d.lastUpdate}),t.jsx(Ro,{className:"min-w-[160px]",children:d.expirationDate}),t.jsx(Ro,{className:"min-w-[140px]"})]})}),t.jsx(Po,{children:0===j.length?t.jsx(Mo,{children:t.jsx(Lo,{colSpan:6,className:"text-center text-muted-foreground py-8",children:d.noResults})}):j.map(e=>{const a=function(e){const{t:t}=y.useTranslation();return new Date>new Date(e.expirationDate)&&3===e.statusId?5:e.statusId}(e),r=function(e,a){const{t:r}=y.useTranslation();switch(e){case 1:return{label:a.statusWaiting,icon:t.jsx(c.Hourglass,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50"};case 2:return{label:a.statusProcessing,icon:t.jsx(c.RefreshCw,{className:"h-3.5 w-3.5 animate-spin"}),variant:"outline",className:"text-blue-600 border-blue-300 bg-blue-50"};case 3:return{label:a.statusCompleted,icon:t.jsx(c.CheckCircle2,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-emerald-600 border-emerald-300 bg-emerald-50"};case 4:return{label:a.statusError,icon:t.jsx(c.AlertCircle,{className:"h-3.5 w-3.5"}),variant:"danger"};case 5:return{label:a.statusExpired,icon:t.jsx(c.TriangleAlert,{className:"h-3.5 w-3.5"}),variant:"outline",className:"text-orange-600 border-orange-300 bg-orange-50"};default:return{label:"—",icon:null,variant:"secondary"}}}(a,d),s=3===a,o=5===a;return t.jsxs(Mo,{children:[t.jsx(Lo,{className:"font-medium",children:e.reportName}),t.jsx(Lo,{children:t.jsxs(Ds,{variant:r.variant,className:Nr("gap-1",r.className),children:[r.icon,r.label]})}),t.jsx(Lo,{className:"text-sm",children:n(new Date(e.requestDate))}),t.jsx(Lo,{className:"text-sm",children:n(new Date(e.lastUpdate))}),t.jsx(Lo,{className:Nr("text-sm",o&&"text-destructive"),children:n(new Date(e.expirationDate))}),t.jsx(Lo,{children:t.jsxs(kr,{variant:"ghost",size:"sm",className:"gap-1.5",disabled:!s||v===e.id,onClick:()=>N(e),children:[v===e.id?t.jsx(c.Loader2,{className:"h-4 w-4 animate-spin"}):t.jsx(c.Eye,{className:"h-4 w-4"}),d.viewReport]})})]},e.id)})})]})})]}),t.jsx(ym,{open:p,onOpenChange:h,url:x,title:g})]})},exports.ReportRequestStatus=Cm,exports.ResizableHandle=({withHandle:e,className:a,...r})=>t.jsx(Ce.PanelResizeHandle,{className:Nr("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(c.GripVertical,{className:"h-2.5 w-2.5"})})}),exports.ResizablePanel=zd,exports.ResizablePanelGroup=({className:e,...a})=>t.jsx(Ce.PanelGroup,{className:Nr("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),exports.RichTextEditor=({value:r,onChange:s,disabled:n,placeholder:o=e.t("write_content_here"),minHeight:i="300px",showModeToggle:l=!0,showVariableHint:d=!0,className:u})=>{const{t:m}=y.useTranslation(),[p,h]=a.useState("visual"),x=$.useEditor({extensions:[V.configure({heading:{levels:[1,2,3]}}),W,H.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),G.TextStyle,K.Color,Y.configure({multicolor:!0})],content:r||"",editable:!n,onUpdate:({editor:e})=>{s(e.getHTML())}});te.useEffect(()=>{x&&r!==x.getHTML()&&x.commands.setContent(r||"")},[r,x]);const f=a.useCallback(()=>{if(!x)return;const e=x.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""!==t?x.chain().focus().extendMarkRange("link").setLink({href:t}).run():x.chain().focus().extendMarkRange("link").unsetLink().run())},[x]);return x?t.jsxs("div",{className:Nr("space-y-2",u),children:[l&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1",children:[t.jsxs(kr,{type:"button",size:"sm",variant:"visual"===p?"default":"outline",onClick:()=>h("visual"),disabled:n,children:[t.jsx(c.Edit3,{className:"h-3.5 w-3.5 mr-1"}),"Editor Visual"]}),t.jsxs(kr,{type:"button",size:"sm",variant:"code"===p?"default":"outline",onClick:()=>h("code"),disabled:n,children:[t.jsx(c.Code,{className:"h-3.5 w-3.5 mr-1"}),"Código HTML"]}),t.jsxs(kr,{type:"button",size:"sm",variant:"preview"===p?"default":"outline",onClick:()=>h("preview"),disabled:n,children:[t.jsx(c.Eye,{className:"h-3.5 w-3.5 mr-1"}),"Preview"]})]}),d&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",t.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:"{{variavel}}"})]})]}),"visual"===p&&t.jsxs("div",{className:"border rounded-md overflow-hidden bg-background cursor-text",onClick:e=>{e.target.closest(".editor-toolbar")||x?.commands.focus()},children:[t.jsxs("div",{className:"editor-toolbar flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[t.jsx(Xu,{onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),isActive:x.isActive("heading",{level:1}),disabled:n,title:e.t("heading_1"),children:t.jsx(c.Heading1,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),isActive:x.isActive("heading",{level:2}),disabled:n,title:e.t("heading_2"),children:t.jsx(c.Heading2,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleHeading({level:3}).run(),isActive:x.isActive("heading",{level:3}),disabled:n,title:e.t("heading_3"),children:t.jsx(c.Heading3,{className:"h-4 w-4"})}),t.jsx(Ju,{}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleBold().run(),isActive:x.isActive("bold"),disabled:n,title:e.t("bold"),children:t.jsx(c.Bold,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleItalic().run(),isActive:x.isActive("italic"),disabled:n,title:e.t("italic"),children:t.jsx(c.Italic,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleUnderline().run(),isActive:x.isActive("underline"),disabled:n,title:"Sublinhado",children:t.jsx(c.Underline,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleStrike().run(),isActive:x.isActive("strike"),disabled:n,title:"Riscado",children:t.jsx(c.Strikethrough,{className:"h-4 w-4"})}),t.jsx(Ju,{}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleBulletList().run(),isActive:x.isActive("bulletList"),disabled:n,title:"Lista",children:t.jsx(c.List,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleOrderedList().run(),isActive:x.isActive("orderedList"),disabled:n,title:m("ordered_list"),children:t.jsx(c.ListOrdered,{className:"h-4 w-4"})}),t.jsx(Ju,{}),t.jsx(Xu,{onClick:()=>x.chain().focus().toggleHighlight().run(),isActive:x.isActive("highlight"),disabled:n,title:"Destacar",children:t.jsx(c.Highlighter,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:f,isActive:x.isActive("link"),disabled:n,title:"Link",children:t.jsx(c.Link,{className:"h-4 w-4"})}),t.jsx(Ju,{}),t.jsx(Xu,{onClick:()=>x.chain().focus().unsetAllMarks().clearNodes().run(),disabled:n,title:m("clear_formatting"),children:t.jsx(c.RemoveFormatting,{className:"h-4 w-4"})}),t.jsx(Ju,{}),t.jsx(Xu,{onClick:()=>x.chain().focus().undo().run(),disabled:n||!x.can().undo(),title:"Desfazer",children:t.jsx(c.Undo,{className:"h-4 w-4"})}),t.jsx(Xu,{onClick:()=>x.chain().focus().redo().run(),disabled:n||!x.can().redo(),title:"Refazer",children:t.jsx(c.Redo,{className:"h-4 w-4"})})]}),t.jsx($.EditorContent,{editor:x,className:Nr("prose prose-sm max-w-none focus:outline-none","[&_.ProseMirror]:p-4","[&_.ProseMirror]:min-h-full","[&_.ProseMirror]:cursor-text","[&_.ProseMirror]:outline-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none"),style:{minHeight:i}})]}),"code"===p&&t.jsx("textarea",{value:r||"",onChange:e=>s(e.target.value),disabled:n,className:"w-full p-3 border rounded-md font-mono text-sm resize-none focus:ring-2 focus:ring-primary bg-background",style:{height:i},placeholder:"Cole ou edite o HTML aqui..."}),"preview"===p&&t.jsx("div",{className:"border rounded-lg p-4 bg-muted overflow-auto",style:{height:i},children:t.jsx("div",{className:"bg-background shadow-sm rounded border p-4",children:t.jsx("div",{dangerouslySetInnerHTML:{__html:r||`<p class="text-muted-foreground">${o}</p>`}})})})]}):null},exports.RiskCriticality=ep,exports.SEARCH_CONFIG=$e,exports.SUPPORTED_LOCALES=Za,exports.ScrollArea=Si,exports.ScrollBar=Ai,exports.Select=gs,exports.SelectApproverDialog=Qx,exports.SelectContent=Ns,exports.SelectGroup=bs,exports.SelectItem=Cs,exports.SelectLabel=_s,exports.SelectScrollDownButton=js,exports.SelectScrollUpButton=ws,exports.SelectSearch=fn,exports.SelectSeparator=ks,exports.SelectTrigger=ys,exports.SelectValue=vs,exports.Separator=Fr,exports.Sheet=Ud,exports.SheetBody=Gd,exports.SheetClose=Bd,exports.SheetContent=Wd,exports.SheetDescription=Qd,exports.SheetFooter=Kd,exports.SheetHeader=Hd,exports.SheetOverlay=$d,exports.SheetPortal=qd,exports.SheetTitle=Yd,exports.SheetTrigger=Od,exports.Sidebar=tu,exports.SidebarActionTrigger=Oh,exports.SidebarContent=cu,exports.SidebarFooter=iu,exports.SidebarGroup=du,exports.SidebarGroupAction=mu,exports.SidebarGroupContent=pu,exports.SidebarGroupLabel=uu,exports.SidebarHeader=function({open:e,appName:r}){const[s,n]=a.useState(!1),{association:o}=Tl(),i=it({isQualitfy:o?.isQualitfy,isMetroex:o?.isMetroex});return t.jsxs(t.Fragment,{children:[t.jsx(ou,{className:"p-0 gap-0",children:e?t.jsxs("div",{className:"flex items-center gap-2 pl-2 min-h-10",children:[t.jsx("button",{className:"flex-shrink-0 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:i,alt:"Logo",className:"h-8 max-w-[140px] object-contain"})}),r&&t.jsx("button",{className:"flex-1 min-w-0 text-sm font-medium text-right cursor-pointer text-primary-foreground hover:text-primary-foreground/80 transition-colors leading-tight py-1",onClick:()=>n(!0),children:t.jsx("span",{className:"line-clamp-2",children:(e=>{const a=e.split(" ");if(a.length<=1)return t.jsxs("span",{className:"whitespace-nowrap",children:[e," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]});const r=a[a.length-1],s=a.slice(0,-1).join(" ");return t.jsxs(t.Fragment,{children:[s," ",t.jsxs("span",{className:"whitespace-nowrap",children:[r," ",t.jsx(c.ChevronDown,{size:12,className:"inline-block align-middle ml-1 opacity-60 text-primary-foreground"})]})]})})(r)})})]}):t.jsx("div",{className:"flex flex-col items-center justify-center w-full",children:t.jsx("button",{className:"flex items-center justify-center h-10 w-8 cursor-pointer",onClick:()=>n(!0),children:t.jsx("img",{src:lt.smallLogo,alt:"Logo",className:"h-6 w-auto object-contain"})})})}),t.jsx(pc,{open:s,onOpenChange:n})]})},exports.SidebarInput=nu,exports.SidebarInset=su,exports.SidebarLogo=Fh,exports.SidebarMenu=hu,exports.SidebarMenuAction=bu,exports.SidebarMenuBadge=vu,exports.SidebarMenuButton=gu,exports.SidebarMenuItem=xu,exports.SidebarMenuSkeleton=yu,exports.SidebarMenuSub=wu,exports.SidebarMenuSubButton=Nu,exports.SidebarMenuSubItem=ju,exports.SidebarProvider=eu,exports.SidebarRail=ru,exports.SidebarSeparator=lu,exports.SidebarSkeleton=function(){return t.jsx("div",{className:"w-64 border-r bg-muted/10",children:t.jsxs("div",{className:"p-4",children:[t.jsx(pn,{className:"h-8 w-32 mb-6"}),t.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,a)=>t.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[t.jsx(pn,{className:"h-4 w-4"}),t.jsx(pn,{className:"h-4 w-20"})]},a))})]})})},exports.SidebarTrigger=au,exports.SingleFileUpload=kx,exports.Skeleton=pn,exports.Slider=_u,exports.Small=hd,exports.SonnerToaster=Ms,exports.Spinner=Ps,exports.SplitButton=rm,exports.Stack=Bi,exports.StatusBadge=function({label:e,color:a,icon:r,showIcon:s,size:n="md",variant:o="filled",backgroundColor:i,className:l}){const c=Tm[n],d=s??!!r;return t.jsxs("span",{className:Nr("inline-flex items-center rounded-md font-medium whitespace-nowrap","outline"===o&&"border",c.badge,l),style:(()=>{switch(o){case"outline":return{color:a,borderColor:hr(a,.3),backgroundColor:"transparent"};case"ghost":return{color:a,backgroundColor:"transparent"};default:return{color:a,backgroundColor:i||hr(a,.1)}}})(),children:[d&&r&&t.jsx(r,{size:c.icon,strokeWidth:2}),e]})},exports.StepSelector=lm,exports.Stepper=lm,exports.StimulsoftViewer=function({reportApiUrl:e,parameters:r={},minHeight:s="80vh",...n}){const o=a.useMemo(()=>{const t=`${e}/api/reports/v1/Viewer/InitViewer`,a=new URLSearchParams(r).toString();return a?`${t}?${a}`:t},[e,r]);return t.jsx(ym,{...n,url:o,minHeight:s})},exports.Switch=Pi,exports.TIMEZONES=tr,exports.TabPageContent=function({children:e,className:a}){return t.jsx("div",{className:Nr("space-y-6",a),children:e})},exports.TabPageHeader=function({title:e,description:a,actions:r,className:s}){return t.jsxs("div",{className:Nr("space-y-4",s),children:[t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),a&&t.jsx("p",{className:"text-muted-foreground text-sm",children:a})]}),r&&t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),t.jsx(Fr,{})]})},exports.TabPageLayout=function({children:e,className:a}){return t.jsx("div",{className:Nr("flex flex-col h-full",a),children:t.jsx(Si,{className:"flex-1",children:t.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Do,exports.TableBody=Po,exports.TableCaption=Fo,exports.TableCell=Lo,exports.TableFooter=Io,exports.TableHead=Ro,exports.TableHeader=Eo,exports.TableResizeHandle=$o,exports.TableRow=Mo,exports.TableRowActions=oi,exports.TableSkeleton=zo,exports.Tabs=$l,exports.TabsContent=Hl,exports.TabsList=Vl,exports.TabsTrigger=Wl,exports.TeamSelector=function({users:e,value:r,onChange:s,disabled:n=!1,placeholder:o="Buscar membro da equipe...",confirmRemoval:i=!0,confirmTitle:l,confirmMessage:d="Tem certeza que deseja remover este membro da equipe?",emptyMessage:u,className:m}){const{t:p}=y.useTranslation(),h=l??p("leadership_remove_team"),x=u??p("leadership_no_members"),[f,g]=a.useState(""),[b,v]=a.useState(!1),[w,j]=a.useState(null),N=a.useMemo(()=>new Set(r),[r]),_=a.useMemo(()=>e.filter(e=>N.has(e.id)),[e,N]),C=a.useMemo(()=>e.filter(e=>!N.has(e.id)).map(e=>({value:e.id,label:e.name})),[e,N]),k=a.useCallback(e=>{e&&!N.has(e)&&(s([...r,e]),g(""))},[r,s,N]),S=a.useCallback(e=>{i?(j(e),v(!0)):s(r.filter(t=>t!==e))},[r,s,i]),A=a.useCallback(()=>{w&&s(r.filter(e=>e!==w)),v(!1),j(null)},[w,r,s]);return t.jsxs("div",{className:Nr("space-y-3",m),children:[t.jsx("div",{className:"flex items-start gap-3",children:t.jsx("div",{className:"flex-1",children:t.jsx(fn,{options:C,value:f,onValueChange:e=>{const t="string"==typeof e?e:e?.[0]??"";g(t),t&&k(t)},placeholder:o,searchPlaceholder:"Buscar...",disabled:n})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Selecionados"}),t.jsx("span",{className:"text-xs bg-muted text-muted-foreground rounded-full px-2 py-0.5 font-medium",children:_.length})]}),_.length>0?t.jsx("div",{className:"space-y-2",children:_.map(e=>t.jsxs("div",{className:"flex items-center border border-border rounded-lg p-2 gap-3",children:[t.jsxs(Ji,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Zi,{src:e.avatar,alt:e.name}),t.jsx(el,{className:"text-xs",children:e.name?.substring(0,2).toUpperCase()})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",title:e.name,dangerouslySetInnerHTML:{__html:e.title||e.name}})}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 text-xs text-muted-foreground",children:[e.roleName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.Shield,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.roleName})]}),e.placeName&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(c.MapPin,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate max-w-[120px]",children:e.placeName})]}),t.jsx("button",{type:"button",className:Nr("text-muted-foreground hover:text-destructive transition-colors",n&&"opacity-50 pointer-events-none"),onClick:()=>!n&&S(e.id),title:p("remove"),children:t.jsx(c.X,{className:"h-4 w-4"})})]})]},e.id))}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[t.jsx(c.User,{className:"h-12 w-12 mb-2 opacity-30"}),t.jsx("p",{className:"text-sm",children:x})]}),t.jsx(Yr,{open:b,onOpenChange:v,children:t.jsxs(ts,{className:"sm:max-w-[400px]",children:[t.jsx(as,{children:t.jsx(ns,{children:h})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:d}),t.jsxs(ss,{children:[t.jsx(kr,{variant:"ghost",onClick:()=>v(!1),children:"Cancelar"}),t.jsx(kr,{variant:"destructive",onClick:A,children:"Remover"})]})]})})]})},exports.TermsOfUseDialog=function({term:r,open:s,onClose:n,onAgree:o,title:i=e.t("terms_updated"),seeLaterLabel:l=e.t("terms_see_later"),agreeLabel:d=e.t("terms_read_agree"),viewTermLabel:u=e.t("terms_view")}){const[m,p]=a.useState(!1),h=a.useCallback(()=>{o(r.id)},[o,r.id]);return t.jsxs(t.Fragment,{children:[t.jsx(Yr,{open:s&&!m,onOpenChange:e=>!e&&n(),children:t.jsxs(ts,{className:"sm:max-w-md",children:[t.jsx(as,{children:t.jsxs(ns,{className:"flex items-center gap-2",children:[t.jsx(c.ShieldCheck,{className:"h-5 w-5 text-primary"}),i]})}),t.jsxs("div",{className:"space-y-4",children:[r.description&&t.jsx(Si,{className:"max-h-48",children:t.jsx("div",{className:"text-sm text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r.description}})}),r.file&&t.jsxs(kr,{variant:"link",className:"px-0 text-primary",onClick:()=>p(!0),children:[t.jsx(c.ExternalLink,{className:"mr-1 h-4 w-4"}),u]})]}),t.jsxs(ss,{className:"gap-2 sm:gap-0",children:[t.jsx(kr,{variant:"ghost",onClick:n,children:l}),t.jsx(kr,{onClick:h,children:d})]})]})}),m&&t.jsx(wm,{term:r,open:m,onClose:()=>p(!1),viewOnly:!0})]})},exports.TermsOfUseViewer=wm,exports.TextPanel=wp,exports.Textarea=As,exports.Timepicker=im,exports.Toaster=Ms,exports.Toggle=ui,exports.ToggleGroup=pi,exports.ToggleGroupItem=hi,exports.TokenManager=$n,exports.TokenService=Mn,exports.Tooltip=Xs,exports.TooltipContent=Zs,exports.TooltipProvider=Qs,exports.TooltipTrigger=Js,exports.TreeSelect=jn,exports.TreeTable=function({data:r,columns:s,nameKey:n,nameHeader:o=e.t("ap_name"),iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,actionsHeader:p="",rowActionsVariant:h="default",isLoading:x,emptyMessage:f="Nenhum registro encontrado.",className:g,enableSelection:b,selectedIds:v,onSelectItem:y,onSelectAll:w,isAllSelected:j,enableRowDrag:N,onMoveNode:_,onMoveNodes:C,rootDropLabel:k,actionsWidth:S=20,nameMinWidth:A=200}){const[T,D]=a.useState(null),[E,P]=a.useState(null),[I,M]=a.useState(!1),[R,L]=a.useState(1),F=a.useRef(null),z=a.useRef([]),U=a.useRef(null),O=a.useMemo(()=>new Set(v??[]),[v]),B=a.useMemo(()=>{if(!T||!r)return new Set;const e=z.current.length>0?z.current:[T],t=function(e,t){const a=new Set;for(const r of t)Ch(e,r).forEach(e=>a.add(e));return a}(r,e);return e.forEach(e=>t.add(e)),t},[T,r]),q=a.useRef(B);q.current=B;const $=a.useCallback(()=>{F.current=null,z.current=[],U.current=null,D(null),P(null),M(!1),L(1)},[]),V=a.useCallback((e,t)=>{e.length>1&&C?C(e,t):1===e.length&&_?.(e[0],t)},[_,C]),W=a.useCallback((e,t)=>{const a=O.has(e)&&O.size>1?Array.from(O):[e];F.current=e,z.current=a,U.current=null,D(e),L(a.length),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e),t.dataTransfer.setData("application/x-tree-ids",JSON.stringify(a))},[O]),H=a.useCallback((e,t)=>{t.preventDefault(),t.dataTransfer.dropEffect="move",q.current.has(e)?P(null):(U.current=e,P(e))},[]),G=a.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const a=q.current.has(e)?U.current:e;if(!a)return void $();let r=z.current;if(0===r.length){try{const e=t.dataTransfer.getData("application/x-tree-ids");if(e){const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(r=t)}}catch{}if(0===r.length){const e=t.dataTransfer.getData("text/plain");e&&(r=[e])}}0===r.length||r.includes(a)||V(r,a),$()},[V,$]),K=a.useCallback(e=>{e.preventDefault(),e.stopPropagation();let t=z.current;if(0===t.length){try{const a=e.dataTransfer.getData("application/x-tree-ids");if(a){const e=JSON.parse(a);Array.isArray(e)&&e.length>0&&(t=e)}}catch{}if(0===t.length){const a=e.dataTransfer.getData("text/plain");a&&(t=[a])}}0!==t.length?(V(t,null),$()):$()},[V,$]),Y=a.useCallback(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",M(!0)},[]),Q=a.useCallback(e=>{N&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[N]),X=a.useCallback(e=>{if(!N)return;const t=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-tree-row-id]"),a=t?.dataset?.treeRowId??U.current;a&&G(a,e)},[N,G]);if(x)return t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."})]})});if(!r||0===r.length)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-2",children:[t.jsx(c.User,{className:"h-10 w-10 text-muted-foreground/50"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f})]});const J=null!==T;return t.jsxs("div",{className:Nr("border rounded-lg overflow-hidden relative",g),onDragOver:Q,onDrop:X,onDragLeave:N?e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(P(null),M(!1))}:void 0,children:[N&&J&&t.jsx(Ah,{onDrop:K,isDragOver:I,onDragOver:Y,onDragLeave:()=>M(!1),label:k}),t.jsxs(Do,{children:[t.jsx(Eo,{children:t.jsxs(Mo,{children:[t.jsx(Ro,{className:"text-left",style:{minWidth:A},children:t.jsxs("div",{className:"flex items-center gap-2",children:[b&&t.jsx(Ss,{checked:j??!1,onCheckedChange:()=>w?.()}),o]})}),s.map(e=>t.jsx(Ro,{className:Nr("text-center",e.className),style:e.width?{width:e.width}:void 0,children:e.header},String(e.key))),m&&t.jsx(Ro,{className:"text-right",style:{width:S},children:p})]})}),t.jsx(Po,{children:r.map(e=>t.jsx(Sh,{item:e,level:0,columns:s,nameKey:n,iconComponent:i,expandedIds:l,onToggleExpand:d,onRowClick:u,renderActions:m,rowActionsVariant:h,enableSelection:b,selectedIds:O,onSelectItem:y,enableRowDrag:N,draggedId:T,dragOverId:E,onDragStartCell:W,onDragEndCell:$,onDragOverCell:H,onDropCell:G,dragCount:R},e.id))})]})]})},exports.TruncatedCell=qo,exports.UpdatesBar=ex,exports.UpdatesDialog=ix,exports.UpdatesNotification=mm,exports.UserUpdatesViewer=mx,exports.UsersGroupsSelector=function({users:r,groups:s=[],value:n,onChange:o,disabled:i=!1,maxHeight:l=350,hideGroupFilter:d=!1,searchPlaceholder:u="Buscar usuário...",selectLabel:m="Selecionar",doneLabel:p="Concluir",allLabel:h="Todos",emptyLabel:x=e.t("leadership_no_user_selected"),selectedLabel:f="selecionado",selectedPluralLabel:g="selecionados",className:b}){const[v,y]=a.useState(!1),[w,j]=a.useState(""),[N,_]=a.useState(void 0),C=a.useMemo(()=>new Set(n),[n]),k=a.useMemo(()=>{let e=r;if(N&&(e=e.filter(e=>e.groupIds?.includes(N))),w){const t=jm(w);e=e.filter(e=>jm(e.name).includes(t)||jm(e.email??"").includes(t))}return e},[r,N,w]),S=a.useMemo(()=>v?k:r.filter(e=>C.has(e.id)),[v,k,r,C]),A=n.length,T=a.useMemo(()=>k.length>0&&k.every(e=>C.has(e.id)),[k,C]),D=a.useCallback(e=>{if(i)return;const t=C.has(e)?n.filter(t=>t!==e):[...n,e];o(t)},[n,C,o,i]),E=a.useCallback(e=>{if(i)return;const t=new Set(k.map(e=>e.id));if(e){const e=new Set([...n,...t]);o(Array.from(e))}else o(n.filter(e=>!t.has(e)))},[n,k,o,i]),P=a.useCallback(()=>{y(e=>!e),j(""),_(void 0)},[]);return t.jsxs("div",{className:Nr("rounded-md border bg-muted/30",b),children:[(!i||A>0)&&t.jsxs("div",{className:Nr("flex items-center justify-between px-4 py-2",!i&&"cursor-pointer hover:bg-muted/50"),onClick:i?void 0:P,children:[t.jsx("span",{className:"text-sm font-medium text-primary uppercase",children:!i&&(v?p:m)}),t.jsx("span",{className:"text-xs text-muted-foreground",children:A>0&&`${A} ${1===A?f:g}`})]}),t.jsxs("div",{className:"px-4 pb-3",children:[v&&t.jsxs("div",{className:"flex gap-3 mb-3",children:[!d&&s.length>0&&t.jsxs(gs,{value:N??"__all__",onValueChange:e=>_("__all__"===e?void 0:e),children:[t.jsx(ys,{className:"w-[200px] h-9 text-sm",children:t.jsx(vs,{placeholder:e.t("approval_user_group")})}),t.jsxs(Ns,{children:[t.jsx(Cs,{value:"__all__",children:e.t("team_all_groups")}),s.map(e=>t.jsx(Cs,{value:e.id,children:e.name},e.id))]})]}),t.jsxs("div",{className:"relative flex-1",children:[t.jsx(c.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(Ar,{className:"pl-8 h-9 text-sm",placeholder:u,value:w,onChange:e=>j(e.target.value)})]})]}),!v&&0===A&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[t.jsx(c.Users,{className:"h-4 w-4 mr-2"}),x]}),v&&k.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(Ss,{checked:T,onCheckedChange:e=>E(!!e)}),t.jsx("span",{className:"text-sm",children:h})]}),S.length>0&&t.jsx(Si,{style:{maxHeight:l},className:"pr-2",children:t.jsx("div",{className:"space-y-0.5",children:S.map(e=>{return t.jsxs("div",{className:Nr("flex items-center gap-3 rounded-md bg-background px-3 py-2 text-sm",v&&!i&&"cursor-pointer hover:bg-accent/50"),onClick:v?()=>D(e.id):void 0,children:[v&&t.jsx(Ss,{checked:C.has(e.id),onCheckedChange:()=>D(e.id),onClick:e=>e.stopPropagation()}),t.jsxs(Ji,{className:"h-8 w-8 shrink-0",children:[e.avatar&&t.jsx(Zi,{src:e.avatar,alt:e.name}),t.jsx(el,{className:"text-xs",children:(a=e.name,a.split(" ").slice(0,2).map(e=>e[0]?.toUpperCase()??"").join(""))})]}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("span",{className:"font-normal truncate",children:e.name}),e.email&&t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:e.email})]})]},e.id);var a})})}),v&&0===k.length&&t.jsx("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:"Nenhum usuário encontrado"})]})]})},exports.VideoEditor=function({value:r,onChange:s,onSubmit:n,onCancel:o,uploadFunction:i,deleteFunction:d,uploadOptions:u}){const{t:m}=y.useTranslation(),[p,h]=a.useState(r||{inputType:"url",controls:!0}),x=a.useRef(null),f=a.useRef(null),{upload:g,uploading:b}=wx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["video/*"],maxSize:104857600}}),{upload:v,uploading:w}=wx({uploadFunction:i,deleteFunction:d,defaultOptions:{...u,allowedTypes:["image/*"],maxSize:5242880}}),j=a.useMemo(()=>ox(p.videoUrl||nx(p.embedCode)||""),[p.videoUrl,p.embedCode]),N=(e,t)=>{const a={...p,[e]:t};h(a),s(a)};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:m("input_type")}),t.jsxs(gs,{value:p.inputType||"url",onValueChange:e=>N("inputType",e),children:[t.jsx(ys,{children:t.jsx(vs,{})}),t.jsxs(Ns,{children:[t.jsx(Cs,{value:"url",children:"URL"}),t.jsx(Cs,{value:"upload",children:m("file_upload")}),t.jsx(Cs,{value:"embed",children:m("embed_code")})]})]})]}),"upload"===p.inputType&&i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"Arquivo"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:x,type:"file",accept:"video/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await g(t),a={...p,videoUrl:e.url,videoFile:e.name,videoPath:e.path,videoSize:e.size,title:p.title||t.name.replace(/\.[^/.]+$/,"")};h(a),s(a)}catch(a){}finally{x.current&&(x.current.value="")}},className:"hidden"}),t.jsx(kr,{type:"button",variant:"outline",onClick:()=>x.current?.click(),disabled:b,children:b?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Selecionar vídeo"]})}),p.videoFile&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate self-center",children:["Arquivo: ",p.videoFile," (",Math.round((p.videoSize||0)/1024/1024)," MB)"]})]})]}),"embed"===p.inputType&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:m("embed_code")}),t.jsx(As,{placeholder:m("paste_embed_code"),value:p.embedCode||"",onChange:e=>N("embedCode",e.target.value),rows:4,className:"font-mono text-sm"})]}),i&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"Thumbnail"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Ar,{type:"url",placeholder:"URL da thumbnail",value:p.thumbnail||"",onChange:e=>N("thumbnail",e.target.value),className:"flex-1"}),t.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:async e=>{const t=e.target.files?.[0];if(t)try{const e=await v(t),a={...p,thumbnail:e.url,thumbnailFile:e.name,thumbnailPath:e.path};h(a),s(a)}catch(a){}finally{f.current&&(f.current.value="")}},className:"hidden"}),t.jsx(kr,{type:"button",variant:"outline",onClick:()=>f.current?.click(),disabled:w,children:w?t.jsxs(t.Fragment,{children:[t.jsx(c.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):t.jsxs(t.Fragment,{children:[t.jsx(c.Upload,{className:"mr-2 h-4 w-4"}),"Upload"]})})]}),p.thumbnailFile&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Thumbnail: ",p.thumbnailFile]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{htmlFor:"title",children:"Título"}),t.jsx(Ar,{id:"title",placeholder:m("video_title"),value:p.title||"",onChange:e=>N("title",e.target.value)})]}),t.jsxs("div",{className:"flex gap-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ss,{id:"autoplay",checked:p.autoplay||!1,onCheckedChange:e=>N("autoplay",!0===e)}),t.jsx(Dr,{htmlFor:"autoplay",className:"cursor-pointer",children:"Autoplay"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ss,{id:"controls",checked:!1!==p.controls,onCheckedChange:e=>N("controls",!0===e)}),t.jsx(Dr,{htmlFor:"controls",className:"cursor-pointer",children:"Controles"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Dr,{children:"Preview"}),t.jsx("div",{className:"border rounded-lg p-4 bg-muted/30",children:(()=>{const a=p.videoUrl||nx(p.embedCode)||"";if(!a)return t.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Nenhum conteúdo para visualizar"});if("file"===j)return t.jsxs("video",{controls:!1!==p.controls,autoPlay:p.autoplay,poster:p.thumbnail,className:"w-full h-auto rounded-md",playsInline:!0,children:[t.jsx("source",{src:a}),"Seu navegador não suporta este vídeo."]});const r="youtube"===j?ax(a,p.autoplay):sx(a,p.autoplay);return t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:p.title||e.t("video"),src:r,className:"absolute inset-0 w-full h-full rounded-md",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})()})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[t.jsx(kr,{variant:"outline",onClick:o,children:"Cancelar"}),t.jsx(kr,{onClick:()=>{p.videoUrl||p.embedCode?n(p):l.toast.error("Erro",{description:m("no_video_selected")})},disabled:!(p.videoUrl||p.embedCode),children:"Salvar"})]})]})},exports.VideoRenderer=function({content:a,className:r="",style:s}){const n=a.videoUrl||nx(a.embedCode)||"";if(!n)return null;const o=ox(n);return t.jsx(Er,{className:`overflow-hidden my-4 ${r}`,style:s,children:t.jsxs(Rr,{className:"p-0",children:["file"===o?t.jsxs("video",{controls:!1!==a.controls,autoPlay:a.autoplay,poster:a.thumbnail,className:"w-full h-auto",playsInline:!0,muted:a.autoplay,children:[t.jsx("source",{src:n}),"Seu navegador não suporta vídeos HTML5."]}):t.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:t.jsx("iframe",{title:a.title||e.t("video"),src:"youtube"===o?ax(n,a.autoplay):sx(n,a.autoplay),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),a.title&&t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm font-medium",children:a.title})})]})})},exports.ViewerDialog=function({open:e,onOpenChange:r,template:s,viewerType:n,isLoading:o=!1,enableDownload:i=!0,onDownload:l,isDownloading:d=!1,enableFavorite:u=!1,isFavorite:m=!1,onFavorite:p,isFavoriting:h=!1,enableConfirmReading:x=!1,readingConfirmationDate:f,onConfirmReading:g,isConfirmingReading:b=!1,readingConfirmationTimeRemaining:v,onIframeLoad:w,className:j}){const{t:N}=y.useTranslation(),_=a.useRef(null),C=n??fm(s.extension),k=d||b||h,S=s.code?`${s.code} – ${s.name}`:s.name,A=a.useCallback(()=>{_.current&&w&&w(_.current)},[w]);return a.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r(!1)};return window.addEventListener("keyup",t),()=>window.removeEventListener("keyup",t)},[e,r]),t.jsx(Yr,{open:e,onOpenChange:r,children:t.jsxs(ts,{className:Nr("max-w-[95vw] max-h-[95vh] p-6 gap-0 [&>button.absolute]:hidden",(4===C||6===C)&&"w-[90vw]",j),children:[t.jsxs("div",{className:"flex items-center justify-between mb-4 min-h-[35px]",children:[o?t.jsx("h2",{className:"text-lg font-medium text-foreground truncate",children:"Carregando..."}):t.jsx("h2",{className:"text-lg font-medium text-foreground truncate max-w-[calc(100%-200px)]",children:S}),t.jsxs("div",{className:"flex items-center gap-1 ml-4 z-20",children:[!o&&t.jsxs(t.Fragment,{children:[(x||f)&&t.jsx(t.Fragment,{children:f?t.jsxs("div",{className:"flex flex-col mr-2.5",children:[t.jsxs("span",{className:"text-sm font-medium flex items-center gap-1 text-foreground",children:[t.jsx(c.CheckCheck,{className:"h-4 w-4"}),"Leitura confirmada"]}),t.jsx("span",{className:"text-xs text-muted-foreground ml-5",children:f.toLocaleDateString()})]}):null!=v&&v>0?t.jsxs("div",{className:"flex items-center gap-1 mr-2.5 text-sm text-muted-foreground",children:[t.jsx("span",{children:N("terms_confirmation_available")}),t.jsx("span",{className:"font-medium min-w-[72px]",children:vm(v)}),t.jsx("span",{children:"segundos"})]}):t.jsxs(kr,{variant:"default",size:"sm",disabled:k,onClick:()=>g?.(),className:"mr-2.5",children:[t.jsx(c.ShieldCheck,{className:"h-4 w-4 mr-1"}),b?"Confirmando...":N("terms_confirm_reading")]})}),0!==C&&u&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>p?.(m),children:t.jsx(c.Star,{className:Nr("h-4 w-4",m&&"fill-accent text-accent")})})}),t.jsx(Zs,{children:m?"Desfavoritar":"Favoritar"})]}),0!==C&&i&&t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>l?.(),children:t.jsx(c.Download,{className:"h-4 w-4"})})}),t.jsx(Zs,{children:"Download"})]})]}),t.jsxs(Xs,{children:[t.jsx(Js,{asChild:!0,children:t.jsx(kr,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:k,onClick:()=>r(!1),children:t.jsx(c.X,{className:"h-4 w-4"})})}),t.jsx(Zs,{children:"Fechar"})]})]})]}),t.jsx("div",{className:Nr("flex flex-col items-center justify-center min-h-[160px] w-full",o&&"relative -top-5",0===C&&"min-h-[124px]",1===C&&"max-h-[85vh]",(4===C||6===C)&&"min-w-[77vw] min-h-[80vh]"),children:o?t.jsx(Ps,{className:"h-14 w-14"}):t.jsxs(t.Fragment,{children:[(0===C||!s.url)&&t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-base text-foreground mb-1",children:"Extensão não suportada para visualização."}),t.jsx("b",{className:"text-base text-foreground",children:"Deseja fazer o download do arquivo?"})]}),1===C&&t.jsx("img",{loading:"eager",src:s.url,alt:s.name,className:"max-w-full max-h-[85vh] object-contain"}),2===C&&t.jsx("video",{controls:!0,autoPlay:!0,src:s.url,className:"w-full h-full"}),3===C&&t.jsx("audio",{controls:!0,autoPlay:!0,src:s.url}),(4===C||6===C)&&t.jsxs("div",{className:"relative w-full h-[79.5vh]",children:[t.jsx(Ps,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-16 w-16"}),t.jsx("iframe",{ref:_,src:s.url,onLoad:A,className:"border-none w-full h-full z-[1] relative",title:s.name})]})]})}),!o&&0===C&&t.jsxs("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-border",children:[t.jsx(kr,{variant:"ghost",onClick:()=>r(!1),children:"Cancelar"}),i&&t.jsx(kr,{variant:"default",onClick:()=>l?.(),children:"Download"})]})]})})},exports.VisualizationType=Ym,exports.addAppTranslations=Nl,exports.addChild=ah,exports.addSibling=rh,exports.aliasSchema=gx,exports.appRedirectUrl=Ue,exports.applyFavicon=ut,exports.assets=lt,exports.badgeVariants=Ts,exports.brandLogos=ot,exports.buildModuleUrl=gr,exports.buildPlacesTree=function(e){e.forEach(t=>{t.children=e.filter(e=>e.parentId===t.id)});const t=e.filter(e=>!e.parentId);return function e(t,a){t?.forEach(t=>{a(t),t.children&&e(t.children,a)})}(t,t=>{t.children=e.filter(e=>e.parentId===t.id)}),t},exports.buildQualiexHeaders=rl,exports.buildWopiUrl=function(e){const{t:t}=y.useTranslation(),{viewerUrl:a,wopiUrl:r,fileId:s,token:n,extension:o,language:i="pt-br"}=e,l=bm(o);return l?`${a}${l}ui=${i}&rs=${i}&access_token=${n}&WOPISrc=${encodeURIComponent(`${r}${s}`)}`:null},exports.buttonGroupVariants=Mc,exports.buttonVariants=Cr,exports.calculateAspectRatio=jx,exports.cn=Nr,exports.configureBrandAssets=function(e){st={...st,...e,logos:{...st.logos,...e.logos}}},exports.configureEnvironment=function(e){Pe={...Pe,...e,oauth:{...Pe.oauth,...e.oauth}}},exports.createCrudPage=function(e){return({manager:a})=>{const{manager:r,config:s,onSave:n,onEdit:o,onToggleStatus:i}=e,l=a??r,c={entityName:s.entityName,entityNamePlural:s.entityNamePlural,filters:s.filters||[],columns:s.columns,cardFields:s.cardFields||[],enableBulkActions:s.enableBulkActions??!1,bulkActions:s.bulkActions||[],customActions:s.customActions,customRowActions:s.customRowActions,customListView:s.customListView,onEdit:o||s.onEdit,onNew:s.onNew,useCustomRouting:s.useCustomRouting,hideNewButton:s.hideNewButton,showNewButton:s.showNewButton,newButtonLabel:s.newButtonLabel,showSearch:s.showSearch,searchPlaceholder:s.searchPlaceholder,showActionBar:s.showActionBar};return t.jsx($i,{manager:l,config:c,formSections:s.formSections,onSave:n,onToggleStatus:i,defaultSort:s.defaultSort,readOnly:s.readOnly})}},exports.createCrudRoutingConfig=function(e,t){const a=Th({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:a.onNew,onEdit:a.onEdit}},exports.createMindMapNode=Xp,exports.createRoutingHandlers=Th,exports.createService=bo,exports.createSimpleSaveHandler=function(e,t,a){return r=>{if(r.id){const t=a(r);e.updateEntity(r.id,t)}else{const a=t(r);e.createEntity(a)}}},exports.createSimpleService=function(e){const t=bo({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment??!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(a,r)=>So({queryKey:e.tableName,service:t,entityName:e.entityName,additionalFilters:a,onSuccess:r})}},exports.createStatusConfig=function(e){return t=>e[t]},exports.createTranslatedMessages=t=>({success:{created:t=>e.t("msg_created_success",`${t} criado com sucesso`).replace("{{entity}}",t),updated:t=>e.t("msg_updated_success",`${t} atualizado com sucesso`).replace("{{entity}}",t),deleted:t=>e.t("msg_deleted_success",`${t} removido com sucesso`).replace("{{entity}}",t)},error:{create:t=>e.t("msg_create_error",`Erro ao criar ${t}`).replace("{{entity}}",t),update:t=>e.t("msg_update_error",`Erro ao atualizar ${t}`).replace("{{entity}}",t),delete:t=>e.t("msg_delete_error",`Erro ao remover ${t}`).replace("{{entity}}",t),load:t=>e.t("msg_load_error",`Erro ao carregar ${t}`).replace("{{entity}}",t)}}),exports.currencyFormatter=dp,exports.debounce=(e,t)=>{let a;return(...r)=>{clearTimeout(a),a=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=uo,exports.deriveNameField=co,exports.deriveUsernameField=mo,exports.detectBrowserLocale=ir,exports.detectBrowserPreferences=()=>{const e=ir();return{locale:e,timezone:lr(),datetimeFormat:cr(e)}},exports.detectBrowserTimezone=lr,exports.detectVideoProvider=ox,exports.documentsFilesApi=Px,exports.emailSchema=fx,exports.emailService=xx,exports.errorService=Hn,exports.exportMindMap=wh,exports.extractImageFileName=function(e){try{const t=new URL(e),a=t.pathname.split("/");return a[a.length-1]||"image"}catch{const t=e.split("/");return t[t.length-1]||"image"}},exports.extractNumberFromCurrency=function(e){const t=e.replace(/[^\d,.-]/g,"").replace(/\./g,"").replace(",",".");return parseFloat(t)},exports.extractVimeoId=rx,exports.extractYouTubeId=tx,exports.findDatetimeFormat=e=>er.find(t=>t.value===e),exports.findLocale=e=>Za.find(t=>t.value===e),exports.findNode=Jp,exports.findTimezone=e=>tr.find(t=>t.value===e),exports.formatBytes=_x,exports.formatCurrency=(e,t="BRL",a="pt-BR")=>null==e?"":new Intl.NumberFormat(a,{style:"currency",currency:t,minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDate=mr,exports.formatDatetime=ur,exports.formatFileSize=function(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(2)} MB`},exports.generateCrudConfig=function(e,t,a={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const a=t[e],s={key:e,header:Wi(e),label:Wi(e),...Vi(e,a),sortable:!0,searchable:"string"==typeof a};r.push(s)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...a}},exports.generateId=br,exports.generateNodeId=Qp,exports.generatePastelBg=hr,exports.getAppBasePath=Oe,exports.getAppEnv=Ee,exports.getBackendMode=function(){return Re},exports.getCommonBaseUrl=tl,exports.getCommonV4AppUrl=Xe,exports.getContrastRatio=function(e,t){const a=xr(e),r=xr(t);return(Math.max(a,r)+.05)/(Math.min(a,r)+.05)},exports.getDefaultPanelSize=function(e){switch(e){case Um.Bar:case Um.Column:case Um.Pie:case Um.List:case Um.Line:case Um.Area:case Um.Text:case Um.StackedColumn:return{x:4,y:2};case Um.Pareto:case Um.RiskMatrix:case Um.Burndown:case Um.PerformanceColumns:return{x:8,y:2};case Um.Numeric:return{x:1,y:1};default:return{x:2,y:2}}},exports.getDocumentsApiUrl=Ke,exports.getEnvironmentConfig=Ie,exports.getFieldValue=Fx,exports.getFileExtension=Cx,exports.getFormFieldValues=function(e){return e.filter(e=>1!==e.type).map(e=>({formFieldAssociationId:e.id,textValue:2===e.type?e.textValue:void 0,numberValue:6===e.type?e.numberValue:void 0,dateValue:3===e.type?e.dateValue:void 0,timeValue:4===e.type?e.timeValue:void 0,itemsValue:[5,7,8].includes(e.type)?e.itemsValue:void 0,questionsValue:9===e.type?e.questionsValue:void 0}))},exports.getIdentApiUrlOverride=Ye,exports.getIdentBaseUrl=function(){const e=Ye();if(e)return e;const t=tl().match(/^https?:\/\/common-v4-api(-[^.]+)?\.(.+)$/);if(t){return`https://ident-api${t[1]||""}.${t[2]}`}return"https://ident-api.qualiex.com"},exports.getLinkFromRow=ip,exports.getLoginApiUrlOverride=Qe,exports.getLuminance=xr,exports.getMinPanelSize=Mp,exports.getOnlineViewerType=function(e){const{t:t}=y.useTranslation();return{".gdocs":"document",".gsheets":"spreadsheets"}[e.toLowerCase()]||"document"},exports.getQualiexApiUrl=Ge,exports.getSecurityMode=function(){return yc},exports.getSupabaseClient=eo,exports.getUserProfile=ml,exports.getViewerType=fm,exports.getWopiViewer=bm,exports.handleExternalLink=fr,exports.importMindMap=function(e){return jh(JSON.parse(e))},exports.inferDatetimeFormat=cr,exports.inputGroupAddonVariants=td,exports.inputGroupButtonVariants=rd,exports.isCurrency=function(e){return!!cp.test(e)&&!isNaN(parseFloat(e.replace(/,/g,"")))},exports.isDevEnv=Me,exports.isDevEnvironment=He,exports.isImageUrl=function(e){const t=[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp",".ico"];try{const a=new URL(e);return t.some(e=>a.pathname.toLowerCase().endsWith(e))}catch{const a=e.toLowerCase();return t.some(e=>a.endsWith(e))}},exports.isLovablePreview=Ve,exports.isNullOrEmptyField=function(e){return null==e?.value||""===e.value.trim()},exports.isSupabaseBackend=Fe,exports.isSupabaseConfigured=function(){return null!==Xn()},exports.isValidDatetimeFormat=e=>er.some(t=>t.value===e),exports.isValidLocale=nr,exports.isValidTimezone=or,exports.loadForlogicFonts=bc,exports.logoSrc=ct,exports.markUpdateVisualized=Qh,exports.mergeTranslationFiles=function(...e){return Object.assign({},...e)},exports.moveNode=nh,exports.navigationMenuTriggerStyle=jd,exports.normalizeVideoUrl=function(e,t,a){switch(t||ox(e)){case"youtube":return ax(e,a);case"vimeo":return sx(e,a);default:return e}},exports.normalizeVimeoUrl=sx,exports.normalizeYouTubeUrl=ax,exports.paginationSchema=yx,exports.parseIframeSrc=nx,exports.processUrl=op,exports.qualiexApi=lo,exports.qualiexFetch=sl,exports.removeNode=sh,exports.resizeKeepingAspect=function(e,t,a,r){const s=jx(e,t);return a&&!r?{width:a,height:Math.round(a/s)}:r&&!a?{width:Math.round(r*s),height:r}:{width:e,height:t}},exports.resolveBrandLogo=it,exports.resolveFieldMappings=po,exports.resolvePageTitle=Rh,exports.safeStringSchema=(e=1e3)=>J.z.string().trim().max(e,`Texto excede ${e} caracteres`).refine(e=>!/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/.test(e),"Contém caracteres inválidos"),exports.sanitizeErrorMessage=jr,exports.setBackendMode=Le,exports.setCollapsedAll=ih,exports.setFormFieldValues=function(e,t){return t?.length?e.map(e=>{const a=t.find(t=>t.formFieldAssociationId===e.id);if(!a)return e;const r={...e};switch(e.type){case 2:r.textValue=a.textValue;break;case 6:r.numberValue=a.numberValue;break;case 3:r.dateValue=a.dateValue;break;case 4:r.timeValue=a.timeValue;break;case 5:case 7:case 8:r.itemsValue=a.itemsValue||[];break;case 9:r.questionsValue=a.questionsValue||[]}return r}):e},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new j.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.shouldShowField=zx,exports.shouldUseDevTokens=We,exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=dt,exports.sortByMonthYear=function(e){return e?.sort((e,t)=>{if(!e?.items?.length||!t?.items?.length)return 0;return np(e.items[0]?.keyDate)-np(t.items[0]?.keyDate)})},exports.stripTechHeaders=function(e){if(!e||"object"!=typeof e)return e;const t={...e};for(const a of vr)delete t[a];return t},exports.timestampId=()=>Date.now().toString(),exports.toQueryString=function(e){return e?lp(e).join("&"):null},exports.toRouterPath=Be,exports.toggleCollapsed=oh,exports.toggleVariants=di,exports.trackFooterClick=nc,exports.trackInterestClick=sc,exports.trackModuleClick=rc,exports.trimTextFields=_r,exports.updateUserProfile=cl,exports.uploadUserPhoto=nl,exports.useActiveModules=(e={})=>{const{enabled:t=!0}=e,{alias:a}=ko();return j.useQuery({queryKey:["active-modules",a],queryFn:async()=>{if(!a)return[];const e=eo(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",a).eq("status","active").order("name");if(r){if(!no.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!a})},exports.useAliasFromUrl=Hi,exports.useAuth=ko,exports.useBaseForm=Ni,exports.useClarity=vc,exports.useColumnManager=bi,exports.useColumnResize=ci,exports.useCrud=So,exports.useDebounce=Lh,exports.useDerivedContractedModules=mc,exports.useFormField=cs,exports.useHasOpenModal=function(){const{hasOpenModal:e}=Wh();return e},exports.useI18nFormatters=()=>{const{locale:e,timezone:t}=Ll(),a=rr;return{formatDatetime:r=>ur(r,a,t,e),formatDate:a=>mr(a,e,t),locale:e,timezone:t,datetimeFormat:a}},exports.useIsMobile=To,exports.useLocale=Ll,exports.useMediaQuery=Ao,exports.useMediaUpload=wx,exports.useModalState=Wh,exports.useModuleAccess=Tl,exports.useModuleConfig=kl,exports.useNavigation=Mh,exports.usePageMetadata=function(e){const{setMetadata:t,clearMetadata:r}=bl(),s=a.useRef({});a.useEffect(()=>{const a=JSON.stringify(s.current.breadcrumbs)!==JSON.stringify(e.breadcrumbs);return(s.current.title!==e.title||s.current.subtitle!==e.subtitle||a)&&(s.current={title:e.title,subtitle:e.subtitle,breadcrumbs:e.breadcrumbs},t(e)),()=>r()},[e.title,e.subtitle,e.breadcrumbs,t,r])},exports.usePageMetadataContext=bl,exports.usePageTitle=function(){const e=N.useLocation(),{navigation:t}=Mh();return Rh(t,e.pathname)},exports.usePermissionQuery=Uh,exports.useQualiexReady=Kh,exports.useQualiexUsers=Ii,exports.useRouteBreadcrumbs=function(){const e=N.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),a=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,s)=>{r+=`/${e}`;const n=s===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");a.push({label:o,href:n?void 0:r,isCurrentPage:n})}),a})()},exports.useRowResize=function({rowIds:e,defaultHeight:t=48,minHeight:r=32,maxHeight:s=120,storageKey:n,onResize:o,enabled:i=!0}){const[l,c]=a.useState(()=>{if(!i||"undefined"==typeof window)return{};if(n){const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{}}return{}}),[d,u]=a.useState(!1),[m,p]=a.useState(null),h=a.useRef(0),x=a.useRef(0),f=a.useCallback(e=>l[e]??t,[l,t]),g=a.useCallback((e,a)=>{i&&(a.preventDefault(),a.stopPropagation(),u(!0),p(e),h.current=a.clientY,x.current=l[e]??t)},[i,l,t]);a.useEffect(()=>{if(!d||!m)return;const e=e=>{const t=e.clientY-h.current,a=Math.max(r,Math.min(s,x.current+t));c(e=>{const t={...e,[m]:a};return o?.(t),t})},t=()=>{u(!1),p(null),n&&c(e=>(localStorage.setItem(n,JSON.stringify(e)),e))};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[d,m,r,s,n,o]),a.useEffect(()=>(d?(document.body.style.cursor="row-resize",document.body.style.userSelect="none"):(document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.body.style.cursor="",document.body.style.userSelect=""}),[d]);const b=a.useCallback(()=>{c({}),n&&localStorage.removeItem(n),o?.({})},[n,o]);return{rowHeights:l,isDragging:d,activeRow:m,handleMouseDown:g,resetHeights:b,getRowHeight:f}},exports.useSidebar=Zd,exports.useSidebarResize=$h,exports.useUpdatesNotification=um,exports.useUserUpdatesBar=Jh,exports.useUserUpdatesDialog=Zh,exports.useWizard=function(e){const{steps:t,initialStep:r=0,initialData:s={},onComplete:n,onCancel:o}=e,[i,l]=a.useState(r),[c,d]=a.useState(s),[u,m]=a.useState(!1),[p,h]=a.useState(!1),x=t.length,f=0===i,g=i===x-1,b=t[i],v=x>1?(i+1)/x*100:100,y=a.useCallback(()=>!b?.canProceed||b.canProceed(),[b]),w=a.useMemo(()=>y(),[y,c]),j=a.useMemo(()=>!f&&!b?.disableBack,[f,b]),N=a.useCallback(e=>{d(t=>({...t,...e}))},[]),_=a.useCallback((e,t)=>{d(a=>({...a,[e]:t}))},[]),C=a.useCallback(()=>{l(r),d(s),m(!1),h(!1),o?.()},[r,s,o]),k=a.useCallback(async()=>{if(y()&&!p){h(!0);try{await(n?.(c))}finally{h(!1)}}},[y,p,c,n]),S=a.useCallback(async()=>{y()&&!u&&(g?await k():l(e=>Math.min(e+1,x-1)))},[y,u,g,x,k]),A=a.useCallback(()=>{j&&!u&&l(e=>Math.max(e-1,0))},[j,u]),T=a.useCallback(e=>{e<0||e>=x||u||(e<=i||e===i+1)&&l(e)},[i,x,u]),D=a.useCallback(e=>{m(e)},[]);return{currentStep:i,currentStepConfig:b,data:c,isFirstStep:f,isLastStep:g,isLoading:u,isCompleting:p,next:S,back:A,goTo:T,canProceed:w,canGoBack:j,setData:N,updateField:_,reset:C,complete:k,setLoading:D,progress:v,stepIndex:i,totalSteps:x}},exports.userIdSchema=vx,exports.uuidSchema=bx,exports.validateFields=function(e){const t=[];return e.forEach(e=>{if(!e.required||e.readOnly||1===e.type)return;const a=Fx(e);if((null==a||""===a||Array.isArray(a)&&0===a.length)&&t.push(e.id),6===e.type&&null!=a){const r=e.config;null!=r?.min&&a<r.min&&t.push(e.id),null!=r?.max&&a>r.max&&t.push(e.id)}}),{valid:0===t.length,invalidFields:[...new Set(t)]}};