@codebit-programando-solucoes/codebit-web-antd 1.1.39 → 1.1.41

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.
package/dist/index.cjs CHANGED
@@ -298,10 +298,11 @@ var __webpack_exports__ = {};
298
298
  LoggedMainContainer: ()=>LoggedMainContainer,
299
299
  CodebitThemeProvider: ()=>CodebitThemeProvider,
300
300
  Login: ()=>Login,
301
- useErrorModal: ()=>useErrorModal,
301
+ UserMenu: ()=>UserMenu,
302
302
  ErrorRetry: ()=>ErrorRetry,
303
303
  CodebitThemeContext: ()=>CodebitThemeContext,
304
304
  LocalLoginChangePasswordResult: ()=>LocalLoginChangePasswordResult,
305
+ useErrorModal: ()=>useErrorModal,
305
306
  ChangePassword: ()=>ChangePassword,
306
307
  ListCard: ()=>ListCard,
307
308
  ForgotPassword: ()=>ForgotPassword,
@@ -326,6 +327,9 @@ var __webpack_exports__ = {};
326
327
  logout: 'Sair',
327
328
  version: 'Versão'
328
329
  },
330
+ UserMenu: {
331
+ openMenu: 'Abrir menu do usuário'
332
+ },
329
333
  HandleError: {
330
334
  notFoundTitle: 'Página não encontrada',
331
335
  forbiddenTitle: 'Acesso negado',
@@ -391,7 +395,7 @@ var __webpack_exports__ = {};
391
395
  passwordUpperCase: 'uma letra maiúscula',
392
396
  passwordLowerCase: 'uma letra minúscula',
393
397
  passwordNumbers: 'um número',
394
- passwordSpecialChars: 'um caractere especial (!@#$%^&*)',
398
+ passwordSpecialChars: 'um caractere especial (ex: !@#$%=+)',
395
399
  passwordWeak: 'Senha fraca: Deve ter pelo menos {{requirements}}',
396
400
  passwordsNotMatch: 'As senhas digitadas não coincidem!',
397
401
  tokenInvalidTitle: 'Token inválido',
@@ -467,6 +471,9 @@ var __webpack_exports__ = {};
467
471
  logout: 'Logout',
468
472
  version: 'Version'
469
473
  },
474
+ UserMenu: {
475
+ openMenu: 'Open user menu'
476
+ },
470
477
  HandleError: {
471
478
  notFoundTitle: 'Page not found',
472
479
  forbiddenTitle: 'Access denied',
@@ -532,7 +539,7 @@ var __webpack_exports__ = {};
532
539
  passwordUpperCase: 'an uppercase letter',
533
540
  passwordLowerCase: 'a lowercase letter',
534
541
  passwordNumbers: 'a number',
535
- passwordSpecialChars: 'a special character (!@#$%^&*)',
542
+ passwordSpecialChars: 'a special character (e.g. !@#$%=+)',
536
543
  passwordWeak: 'Weak password: Must have at least {{requirements}}',
537
544
  passwordsNotMatch: 'The passwords do not match!',
538
545
  tokenInvalidTitle: 'Invalid Token',
@@ -613,7 +620,7 @@ var __webpack_exports__ = {};
613
620
  const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
614
621
  const logger = new codebit_web_namespaceObject.Logger('CodebitConfigContext');
615
622
  const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
616
- function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, doLogout, checkLogin, onMenuClick }) {
623
+ function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, userMenuItems, doLogout, checkLogin, onMenuClick }) {
617
624
  const [isLogged, setIsLogged] = (0, external_react_.useState)(null);
618
625
  const [user, setUser] = (0, external_react_.useState)(null);
619
626
  const logout = async ()=>{
@@ -658,6 +665,7 @@ var __webpack_exports__ = {};
658
665
  secondarySidebar,
659
666
  secondarySidebarWidth,
660
667
  bottomMenuItems,
668
+ userMenuItems,
661
669
  onMenuClick
662
670
  }), [
663
671
  menuItems,
@@ -668,6 +676,7 @@ var __webpack_exports__ = {};
668
676
  secondarySidebar,
669
677
  secondarySidebarWidth,
670
678
  bottomMenuItems,
679
+ userMenuItems,
671
680
  onMenuClick
672
681
  ]);
673
682
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitConfigContext.Provider, {
@@ -683,10 +692,119 @@ var __webpack_exports__ = {};
683
692
  secondarySidebar: external_prop_types_default().func,
684
693
  secondarySidebarWidth: external_prop_types_default().number,
685
694
  bottomMenuItems: external_prop_types_default().func,
695
+ userMenuItems: external_prop_types_default().func,
686
696
  doLogout: external_prop_types_default().func.isRequired,
687
697
  checkLogin: external_prop_types_default().func.isRequired,
688
698
  onMenuClick: external_prop_types_default().func
689
699
  };
700
+ const CodebitThemeContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
701
+ const CodebitThemeProvider = ({ children, storeThemeInLocalStorage = true, containerId = 'root', forcedTheme = null, ...props })=>{
702
+ const hasLoaded = (0, external_react_.useRef)(false);
703
+ const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
704
+ if (forcedTheme) return 'dark' === forcedTheme;
705
+ try {
706
+ if (storeThemeInLocalStorage) {
707
+ const savedTheme = localStorage?.getItem('theme');
708
+ if (null !== savedTheme) return 'dark' === savedTheme;
709
+ }
710
+ return globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
711
+ } finally{
712
+ hasLoaded.current = true;
713
+ }
714
+ });
715
+ (0, external_react_.useEffect)(()=>{
716
+ if (forcedTheme) {
717
+ const mode = 'dark' === forcedTheme;
718
+ setIsDarkMode(mode);
719
+ }
720
+ }, [
721
+ forcedTheme
722
+ ]);
723
+ const toggleTheme = ()=>{
724
+ setIsDarkMode((prev)=>!prev);
725
+ };
726
+ (0, external_react_.useEffect)(()=>{
727
+ const target = document.getElementById(containerId);
728
+ if (!target) return;
729
+ if (isDarkMode) {
730
+ document.documentElement.classList.add('dark-theme');
731
+ target.classList.add('dark-theme');
732
+ } else {
733
+ document.documentElement.classList.remove('dark-theme');
734
+ target.classList.remove('dark-theme');
735
+ }
736
+ document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
737
+ }, [
738
+ isDarkMode,
739
+ containerId
740
+ ]);
741
+ (0, external_react_.useEffect)(()=>{
742
+ if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
743
+ if (hasLoaded.current && storeThemeInLocalStorage && !forcedTheme) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
744
+ }, [
745
+ isDarkMode,
746
+ storeThemeInLocalStorage,
747
+ forcedTheme
748
+ ]);
749
+ const themeContextValue = (0, external_react_.useMemo)(()=>({
750
+ isDarkMode,
751
+ toggleTheme,
752
+ setIsDarkMode
753
+ }), [
754
+ isDarkMode
755
+ ]);
756
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
757
+ value: themeContextValue,
758
+ children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
759
+ theme: {
760
+ algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
761
+ token: {
762
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266',
763
+ colorInfo: isDarkMode ? '#589C75' : '#29D266',
764
+ colorLink: isDarkMode ? '#589C75' : '#29D266'
765
+ },
766
+ components: {
767
+ Menu: {
768
+ itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
769
+ itemSelectedColor: '#FAFAFA',
770
+ darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
771
+ darkItemSelectedColor: '#FAFAFA'
772
+ },
773
+ Button: {
774
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266',
775
+ colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
776
+ colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
777
+ },
778
+ Layout: {
779
+ siderBg: isDarkMode ? '#1a1a1a' : '#001529',
780
+ triggerBg: isDarkMode ? '#589C75' : '#29D266',
781
+ triggerColor: '#FAFAFA'
782
+ },
783
+ Header: {
784
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266'
785
+ }
786
+ }
787
+ },
788
+ ...props,
789
+ children: [
790
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {
791
+ containerId: containerId
792
+ }),
793
+ children
794
+ ]
795
+ })
796
+ });
797
+ };
798
+ CodebitThemeProvider.propTypes = {
799
+ children: external_prop_types_default().node.isRequired,
800
+ storeThemeInLocalStorage: external_prop_types_default().bool,
801
+ containerId: external_prop_types_default().string,
802
+ forcedTheme: external_prop_types_default().oneOf([
803
+ 'dark',
804
+ 'light',
805
+ null
806
+ ])
807
+ };
690
808
  const ThemeToggle = ()=>{
691
809
  const config = (0, external_react_.useContext)(CodebitThemeContext);
692
810
  if (!config) throw new Error('ThemeToggle must be used within CodebitThemeContext');
@@ -725,1176 +843,1220 @@ var __webpack_exports__ = {};
725
843
  const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
726
844
  i18n: i18n
727
845
  });
728
- function useErrorMessage() {
729
- const { t } = useCodebitWebAntdTranslation();
730
- const getErrorMessage = (error)=>{
731
- let status = 'error';
732
- const responseStatus = error?.response?.status || null;
733
- let errorMessage = t('Error.defaultError');
734
- let retryText = t('Error.retryButton');
735
- let onRetryAction = null;
736
- if (error?.errorCode) switch(error.errorCode){
737
- case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
738
- errorMessage = t('Error.networkError');
739
- break;
740
- case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
741
- errorMessage = t('Error.timeoutError');
742
- break;
743
- }
744
- else if (responseStatus) switch(responseStatus){
745
- case 400:
746
- errorMessage = t('Error.badRequestError');
747
- break;
748
- case 403:
749
- errorMessage = t('Error.forbiddenError');
750
- retryText = t('Error.reloadPageButton');
751
- status = 403;
752
- onRetryAction = ()=>{
753
- globalThis.location.reload();
754
- };
755
- break;
756
- case 404:
757
- errorMessage = t('Error.notFoundError');
758
- status = 404;
759
- break;
760
- case 500:
761
- errorMessage = t('Error.internalServerError');
762
- status = 500;
763
- break;
764
- case 401:
765
- errorMessage = t('Error.sessionExpiredError');
766
- retryText = t('Error.reloadPageButton');
767
- onRetryAction = ()=>{
768
- globalThis.location.reload();
769
- };
770
- break;
771
- }
772
- return {
773
- errorMessage,
774
- status,
775
- retryText,
776
- onRetryAction
777
- };
778
- };
779
- return {
780
- getErrorMessage
781
- };
782
- }
783
- const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
784
- function ErrorRetry({ error, onRetry }) {
785
- if (error && error instanceof Error) {
786
- ErrorRetry_logger.error('Fail to load.', error);
787
- react_namespaceObject.captureException(error);
788
- }
789
- const { getErrorMessage } = useErrorMessage();
790
- const { status, errorMessage, retryText, onRetryAction } = getErrorMessage(error);
791
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
792
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
793
- status: status,
794
- title: errorMessage,
795
- extra: [
796
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
797
- type: 'primary',
798
- onClick: onRetryAction ?? onRetry,
799
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
800
- children: retryText
801
- }, 'retry')
802
- ]
803
- })
804
- });
805
- }
806
- ErrorRetry.propTypes = {
807
- error: external_prop_types_default().object.isRequired,
808
- onRetry: external_prop_types_default().func.isRequired
809
- };
810
- const ListCard_module = {
811
- listCard: "listCard-ISftFd",
812
- headerRow: "headerRow-UsZAzP",
813
- actions: "actions-ig53s2",
814
- filtersRow: "filtersRow-f3Xk5a",
815
- expandArea: "expandArea-czOoFS"
846
+ const UserMenu_module = {
847
+ trigger: "trigger-tlcps4",
848
+ avatar: "avatar-Tmnqa_",
849
+ caret: "caret-OWS8_0",
850
+ panel: "panel-GCcfCo",
851
+ userInfo: "userInfo-fDuDn1",
852
+ userName: "userName-sIs1iq",
853
+ userSubtitle: "userSubtitle-Fflhaw",
854
+ divider: "divider-JJjJVy",
855
+ menu: "menu-cuORr_"
816
856
  };
817
- const { Title } = external_antd_namespaceObject.Typography;
818
- function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
819
- const { token } = external_antd_namespaceObject.theme.useToken();
820
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
821
- const margin = token['margin'];
822
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
823
- className: ListCard_module.listCard,
857
+ const OPEN_KEYS = new Set([
858
+ 'Enter',
859
+ ' '
860
+ ]);
861
+ const { Text } = external_antd_namespaceObject.Typography;
862
+ function getInitials(name) {
863
+ const parts = name?.trim().split(/\s+/).filter(Boolean) ?? [];
864
+ if (0 === parts.length) return '';
865
+ const first = [
866
+ ...parts[0]
867
+ ];
868
+ if (1 === parts.length) return first.slice(0, 2).join('').toUpperCase();
869
+ const last = [
870
+ ...parts.at(-1)
871
+ ];
872
+ return `${first[0]}${last[0]}`.toUpperCase();
873
+ }
874
+ function UserMenuPanel({ user, items, onItemClick }) {
875
+ return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
876
+ className: UserMenu_module.panel,
824
877
  children: [
825
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
826
- gutter: margin,
827
- align: 'middle',
828
- className: ListCard_module.headerRow,
878
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
879
+ className: UserMenu_module.userInfo,
829
880
  children: [
830
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
831
- xs: 24,
832
- sm: 24,
833
- md: 12,
834
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
835
- level: 4,
836
- children: title
837
- })
881
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
882
+ className: UserMenu_module.userName,
883
+ strong: true,
884
+ children: user?.name
838
885
  }),
839
- (!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
840
- xs: 24,
841
- sm: 24,
842
- md: 12,
843
- className: ListCard_module.actions,
844
- children: [
845
- !!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
846
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
847
- onClick: onClearFilters,
848
- children: t('ListCard.clearFilters')
849
- }),
850
- actions
851
- ]
886
+ user?.subtitle && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
887
+ className: UserMenu_module.userSubtitle,
888
+ type: 'secondary',
889
+ children: user.subtitle
852
890
  })
853
891
  ]
854
892
  }),
855
- !!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
856
- gutter: margin,
857
- className: ListCard_module.filtersRow,
858
- children: headerContainer
893
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
894
+ className: UserMenu_module.divider
859
895
  }),
860
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
861
- className: ListCard_module.expandArea,
862
- children: tableContainer
896
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
897
+ className: UserMenu_module.menu,
898
+ items: items,
899
+ onClick: ({ key })=>onItemClick?.(key)
863
900
  })
864
901
  ]
865
902
  });
866
903
  }
867
- ListCard.propTypes = {
868
- title: external_prop_types_default().string.isRequired,
869
- onClearFilters: external_prop_types_default().func,
870
- headerContainer: external_prop_types_default().node,
871
- tableContainer: external_prop_types_default().node,
872
- actions: external_prop_types_default().node
904
+ UserMenuPanel.propTypes = {
905
+ user: external_prop_types_default().shape({
906
+ name: external_prop_types_default().string,
907
+ subtitle: external_prop_types_default().string
908
+ }),
909
+ items: external_prop_types_default().arrayOf(external_prop_types_default().object).isRequired,
910
+ onItemClick: external_prop_types_default().func
873
911
  };
874
- ListCard.defaultProps = {
875
- onClearFilters: null,
876
- headerContainer: null,
877
- tableContainer: null,
878
- actions: null
879
- };
880
- const CssTokenBridge = ({ containerId })=>{
881
- const { token } = external_antd_namespaceObject.theme.useToken();
882
- (0, external_react_.useLayoutEffect)(()=>{
883
- const root = containerId ? document.getElementById(containerId) ?? document.documentElement : document.documentElement;
884
- root.style.setProperty('--antd-color-bg-base', token['colorBgBase']);
885
- root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
886
- root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
887
- root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
888
- root.style.setProperty('--antd-color-bg-mask', token['colorBgMask']);
889
- root.style.setProperty('--antd-color-bg-spotlight', token['colorBgSpotlight']);
890
- root.style.setProperty('--antd-color-primary', token['colorPrimary']);
891
- root.style.setProperty('--antd-color-success', token['colorSuccess']);
892
- root.style.setProperty('--antd-color-success-bg', token['colorSuccessBg']);
893
- root.style.setProperty('--antd-color-success-border', token['colorSuccessBorder']);
894
- root.style.setProperty('--antd-color-success-text', token['colorSuccessText']);
895
- root.style.setProperty('--antd-color-warning', token['colorWarning']);
896
- root.style.setProperty('--antd-color-warning-bg', token['colorWarningBg']);
897
- root.style.setProperty('--antd-color-warning-border', token['colorWarningBorder']);
898
- root.style.setProperty('--antd-color-warning-text', token['colorWarningText']);
899
- root.style.setProperty('--antd-color-error', token['colorError']);
900
- root.style.setProperty('--antd-color-error-bg', token['colorErrorBg']);
901
- root.style.setProperty('--antd-color-error-border', token['colorErrorBorder']);
902
- root.style.setProperty('--antd-color-error-text', token['colorErrorText']);
903
- root.style.setProperty('--antd-color-info', token['colorInfo']);
904
- root.style.setProperty('--antd-color-info-bg', token['colorInfoBg']);
905
- root.style.setProperty('--antd-color-info-border', token['colorInfoBorder']);
906
- root.style.setProperty('--antd-color-info-text', token['colorInfoText']);
907
- root.style.setProperty('--antd-color-text', token['colorText']);
908
- root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
909
- root.style.setProperty('--antd-color-text-tertiary', token['colorTextTertiary']);
910
- root.style.setProperty('--antd-color-text-quaternary', token['colorTextQuaternary']);
911
- root.style.setProperty('--antd-color-text-disabled', token['colorTextDisabled']);
912
- root.style.setProperty('--antd-color-border', token['colorBorder']);
913
- root.style.setProperty('--antd-color-border-secondary', token['colorBorderSecondary']);
914
- root.style.setProperty('--antd-color-border-hover', token['colorBorderHover']);
915
- root.style.setProperty('--antd-color-border-secondary-hover', token['colorBorderSecondaryHover']);
916
- root.style.setProperty('--antd-color-border-disabled', token['colorBorderDisabled']);
917
- root.style.setProperty('--antd-color-split', token['colorSplit']);
918
- root.style.setProperty('--antd-color-link', token['colorLink']);
919
- root.style.setProperty('--antd-color-link-hover', token['colorLinkHover']);
920
- root.style.setProperty('--antd-color-link-active', token['colorLinkActive']);
921
- root.style.setProperty('--antd-color-fill', token['colorFill']);
922
- root.style.setProperty('--antd-color-fill-secondary', token['colorFillSecondary']);
923
- root.style.setProperty('--antd-color-fill-tertiary', token['colorFillTertiary']);
924
- root.style.setProperty('--antd-color-fill-quaternary', token['colorFillQuaternary']);
925
- root.style.setProperty('--antd-color-fill-content', token['colorFillContent']);
926
- root.style.setProperty('--antd-color-fill-content-hover', token['colorFillContentHover']);
927
- root.style.setProperty('--antd-color-fill-content-selected', token['colorFillContentSelected']);
928
- root.style.setProperty('--antd-color-fill-alter', token['colorFillAlter']);
929
- root.style.setProperty('--antd-color-fill-alter-hover', token['colorFillAlterHover']);
930
- root.style.setProperty('--antd-color-fill-alter-active', token['colorFillAlterActive']);
931
- root.style.setProperty('--antd-color-fill-alter-selected', token['colorFillAlterSelected']);
932
- root.style.setProperty('--antd-color-fill-alter-disabled', token['colorFillAlterDisabled']);
933
- root.style.setProperty('--antd-color-white', token['colorWhite']);
934
- root.style.setProperty('--antd-color-black', token['colorBlack']);
935
- root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
936
- root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
937
- root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
938
- root.style.setProperty('--antd-margin', `${token['margin']}px`);
939
- root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
940
- root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
941
- root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
942
- root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
943
- root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
944
- root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
945
- root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
946
- root.style.setProperty('--antd-padding', `${token['padding']}px`);
947
- root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
948
- root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
949
- root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
950
- root.style.setProperty('--antd-font-size-xxs', '8px');
951
- root.style.setProperty('--antd-font-size-xs', '10px');
952
- root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
953
- root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
954
- root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
955
- root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
956
- root.style.setProperty('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
957
- root.style.setProperty('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
958
- root.style.setProperty('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
959
- root.style.setProperty('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
960
- root.style.setProperty('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
961
- root.style.setProperty('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
962
- root.style.setProperty('--antd-line-height', token['lineHeight']);
963
- root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
964
- root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
965
- root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
966
- root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
967
- root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
968
- root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
969
- root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
970
- }, [
971
- containerId,
972
- token
973
- ]);
974
- return null;
975
- };
976
- CssTokenBridge.propTypes = {
977
- containerId: external_prop_types_default().string
978
- };
979
- const TableContainer_module = {
980
- tableContainer: "tableContainer-EhNwOm"
981
- };
982
- function isPaginationNode(node) {
983
- if (node.nodeType !== Node.ELEMENT_NODE) return false;
984
- const element = node;
985
- return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
986
- }
987
- function hasPaginationInMutation(mutation) {
988
- return Array.from(mutation.addedNodes).some(isPaginationNode);
989
- }
990
- function TableContainer({ children }) {
991
- const containerRef = (0, external_react_.useRef)(null);
992
- const containerHeightRef = (0, external_react_.useRef)(null);
993
- const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
994
- (0, external_react_.useLayoutEffect)(()=>{
995
- const calculateHeights = ()=>{
996
- if (!containerRef.current) return;
997
- containerHeightRef.current = containerRef.current.offsetHeight;
998
- const thead = containerRef.current.querySelector('thead');
999
- let theadHeight = 0;
1000
- if (thead) {
1001
- const rect = thead.getBoundingClientRect();
1002
- const styles = globalThis.getComputedStyle(thead);
1003
- const marginTop = Number.parseFloat(styles.marginTop) || 0;
1004
- const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1005
- theadHeight = rect.height + marginTop + marginBottom;
1006
- }
1007
- const pagination = containerRef.current.querySelector('.ant-table-pagination');
1008
- let paginationHeight = 0;
1009
- if (pagination) {
1010
- const rect = pagination.getBoundingClientRect();
1011
- const styles = globalThis.getComputedStyle(pagination);
1012
- const marginTop = Number.parseFloat(styles.marginTop) || 0;
1013
- const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1014
- paginationHeight = rect.height + marginTop + marginBottom;
1015
- }
1016
- const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
1017
- setScrollY(availableHeight);
1018
- };
1019
- calculateHeights();
1020
- const observer = new MutationObserver((mutations)=>{
1021
- const hasPagination = mutations.some(hasPaginationInMutation);
1022
- if (hasPagination) calculateHeights();
1023
- });
1024
- if (containerRef.current) observer.observe(containerRef.current, {
1025
- childList: true,
1026
- subtree: true
912
+ function createPopupRender(user, items, onItemClick) {
913
+ return ()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(UserMenuPanel, {
914
+ user: user,
915
+ items: items,
916
+ onItemClick: onItemClick
1027
917
  });
1028
- globalThis.addEventListener('resize', calculateHeights);
1029
- return ()=>{
1030
- observer.disconnect();
1031
- globalThis.removeEventListener('resize', calculateHeights);
1032
- };
1033
- }, []);
1034
- const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
1035
- scroll: {
1036
- ...children.props?.scroll,
1037
- y: scrollY,
1038
- x: 'max-content'
1039
- }
1040
- }) : children;
1041
- return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
1042
- ref: containerRef,
1043
- className: TableContainer_module.tableContainer,
1044
- children: enhancedChildren
1045
- });
1046
918
  }
1047
- TableContainer.propTypes = {
1048
- children: external_prop_types_default().element.isRequired
1049
- };
1050
- function FilterContainer({ children, ...props }) {
1051
- const { token } = external_antd_namespaceObject.theme.useToken();
1052
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
1053
- styles: {
1054
- body: {
1055
- padding: token['paddingXS'] + 'px'
1056
- }
1057
- },
1058
- ...props,
1059
- children: children
919
+ function UserMenu({ user, items = [], onItemClick, caretIcon = /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.DownOutlined, {}) }) {
920
+ const { t } = useCodebitWebAntdTranslation();
921
+ const [open, setOpen] = (0, external_react_.useState)(false);
922
+ const initials = getInitials(user?.name);
923
+ const handleItemClick = (key)=>{
924
+ setOpen(false);
925
+ onItemClick?.(key);
926
+ };
927
+ const avatar = /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Avatar, {
928
+ className: UserMenu_module.avatar,
929
+ children: initials || /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.UserOutlined, {})
930
+ });
931
+ if (!items.length) return avatar;
932
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Dropdown, {
933
+ trigger: [
934
+ 'click'
935
+ ],
936
+ open: open,
937
+ onOpenChange: setOpen,
938
+ placement: 'bottomRight',
939
+ popupRender: createPopupRender(user, items, handleItemClick),
940
+ children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
941
+ className: UserMenu_module.trigger,
942
+ role: 'button',
943
+ tabIndex: 0,
944
+ "aria-haspopup": 'menu',
945
+ "aria-expanded": open,
946
+ "aria-label": t('UserMenu.openMenu'),
947
+ onKeyDown: (event)=>{
948
+ if (!OPEN_KEYS.has(event.key)) return;
949
+ event.preventDefault();
950
+ setOpen((wasOpen)=>!wasOpen);
951
+ },
952
+ children: [
953
+ avatar,
954
+ /*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
955
+ className: UserMenu_module.caret,
956
+ children: caretIcon
957
+ })
958
+ ]
959
+ })
1060
960
  });
1061
961
  }
1062
- FilterContainer.propTypes = {
1063
- children: external_prop_types_default().node.isRequired,
1064
- ...external_antd_namespaceObject.Card.propTypes
962
+ UserMenu.propTypes = {
963
+ user: external_prop_types_default().shape({
964
+ name: external_prop_types_default().string,
965
+ email: external_prop_types_default().string,
966
+ id: external_prop_types_default().string,
967
+ roles: external_prop_types_default().arrayOf(external_prop_types_default().string),
968
+ subtitle: external_prop_types_default().string
969
+ }),
970
+ items: external_prop_types_default().arrayOf(external_prop_types_default().object),
971
+ onItemClick: external_prop_types_default().func,
972
+ caretIcon: external_prop_types_default().node
1065
973
  };
1066
- const external_date_fns_namespaceObject = require("date-fns");
1067
- const AudioPlayer_module = {
1068
- audioPlayer: "audioPlayer-a4xARM",
1069
- durationTimeContainer: "durationTimeContainer-kmkK6M",
1070
- slider: "slider-bdta4v"
974
+ const LoggedMainContainer_module = {
975
+ layout: "layout-mL5o6I",
976
+ drawer: "drawer-oj0mJX",
977
+ drawerBody: "drawerBody-YtAN37",
978
+ drawerFlex: "drawerFlex-AGTAax",
979
+ sider: "sider-BDy1Bs",
980
+ siderLayout: "siderLayout-C8H0uI",
981
+ secondarySidebar: "secondarySidebar-P6J_Xn",
982
+ menu: "menu-KMvPt7",
983
+ menuContainer: "menuContainer-ahnhBu",
984
+ menuLabel: "menuLabel-csBJTc",
985
+ menuDescription: "menuDescription-d6BFBO",
986
+ menuSpacer: "menuSpacer-RIB3II",
987
+ versionMenu: "versionMenu-NM4uyG",
988
+ bottomMenu: "bottomMenu-VtOktS",
989
+ header: "header-vgc67L",
990
+ mobile: "mobile-mKGxb5",
991
+ headerSpace: "headerSpace-Fd_iha",
992
+ headerDivider: "headerDivider-yfEwNN",
993
+ content: "content-OZHp2h"
1071
994
  };
1072
- const AudioPlayer = ({ audioUrl })=>{
1073
- const [isMuted, setIsMuted] = (0, external_react_.useState)(false);
1074
- const [duration, setDuration] = (0, external_react_.useState)(0);
1075
- const [currentTime, setCurrentTime] = (0, external_react_.useState)(0);
1076
- const [isPlaying, setIsPlaying] = (0, external_react_.useState)(false);
995
+ const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
996
+ const { Text: LoggedMainContainer_Text } = external_antd_namespaceObject.Typography;
997
+ const MENU_KEY_APP_LOGOUT = 'app-logout';
998
+ function filterMenuItemsByRole(items, user) {
999
+ return items.filter((item)=>{
1000
+ if (!item.roles) return true;
1001
+ if (!user?.roles) return false;
1002
+ return item.roles.some((role)=>user.roles.includes(role));
1003
+ });
1004
+ }
1005
+ function LoggedMainContainer({ children }) {
1006
+ const [collapsed, setCollapsed] = (0, external_react_.useState)(true);
1007
+ const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
1008
+ const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
1009
+ const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
1077
1010
  const { t } = useCodebitWebAntdTranslation();
1078
- const audioRef = (0, external_react_.useRef)(null);
1079
- const hasSource = !!audioUrl;
1080
- const formatTime = (seconds)=>{
1081
- const sec = Math.max(0, Math.floor(seconds));
1082
- const date = (0, external_date_fns_namespaceObject.addSeconds)(new Date(0), sec);
1083
- const h = Math.floor(sec / 3600);
1084
- const timeFormat = h > 0 ? 'H:mm:ss' : 'm:ss';
1085
- return (0, external_date_fns_namespaceObject.format)(date, timeFormat);
1086
- };
1087
- const togglePlay = async ()=>{
1088
- if (!audioRef.current || !hasSource) return;
1089
- if (audioRef.current.paused) {
1090
- await audioRef.current.play();
1091
- setIsPlaying(true);
1092
- } else {
1093
- audioRef.current.pause();
1094
- setIsPlaying(false);
1095
- }
1096
- };
1097
- const toggleMute = ()=>{
1098
- if (!audioRef.current) return;
1099
- audioRef.current.muted = !audioRef.current.muted;
1100
- setIsMuted(audioRef.current.muted);
1101
- };
1102
- const handleSliderChange = (value)=>{
1103
- if (!audioRef.current) return;
1104
- const safeValue = Math.min(Math.round(value), Math.round(duration));
1105
- audioRef.current.currentTime = safeValue;
1106
- setCurrentTime(safeValue);
1107
- };
1011
+ const configCodebit = (0, external_react_.useContext)(CodebitConfigContext);
1012
+ const configTheme = (0, external_react_.useContext)(CodebitThemeContext);
1013
+ const navigate = (0, external_react_router_namespaceObject.useNavigate)();
1014
+ const location = (0, external_react_router_namespaceObject.useLocation)();
1015
+ if (!configCodebit || !configTheme) throw new Error('LoggedContainer must be used within CodebitConfigProvider and CodebitThemeContext');
1016
+ const { logout, user, menuItems, version, showVersion, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, userMenuItems, onMenuClick } = configCodebit;
1017
+ const { isDarkMode } = configTheme;
1018
+ const theme = isDarkMode ? 'dark' : 'light';
1019
+ const allMenuItems = (0, external_react_.useMemo)(()=>[
1020
+ ...menuItems(user),
1021
+ ...bottomMenuItems?.(user) ?? []
1022
+ ], [
1023
+ menuItems,
1024
+ user,
1025
+ bottomMenuItems
1026
+ ]);
1027
+ const filteredMenuItems = (0, external_react_.useMemo)(()=>filterMenuItemsByRole(menuItems(user), user), [
1028
+ menuItems,
1029
+ user
1030
+ ]);
1031
+ const filteredBottomMenuItems = (0, external_react_.useMemo)(()=>{
1032
+ if (!bottomMenuItems) return [];
1033
+ return filterMenuItemsByRole(bottomMenuItems(user), user);
1034
+ }, [
1035
+ bottomMenuItems,
1036
+ user
1037
+ ]);
1038
+ const filteredUserMenuItems = (0, external_react_.useMemo)(()=>{
1039
+ if (!userMenuItems) return [];
1040
+ return filterMenuItemsByRole(userMenuItems(user), user);
1041
+ }, [
1042
+ userMenuItems,
1043
+ user
1044
+ ]);
1045
+ const memoizedBottomMenuItems = (0, external_react_.useMemo)(()=>[
1046
+ ...filteredBottomMenuItems,
1047
+ {
1048
+ key: MENU_KEY_APP_LOGOUT,
1049
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.LogoutOutlined, {}),
1050
+ label: t('LoggedMainContainer.logout'),
1051
+ danger: true
1052
+ }
1053
+ ], [
1054
+ filteredBottomMenuItems,
1055
+ t
1056
+ ]);
1057
+ const [selectedKeys, setSelectedKeys] = (0, external_react_.useState)('');
1108
1058
  (0, external_react_.useEffect)(()=>{
1109
- if (audioRef.current && audioUrl) {
1110
- audioRef.current.pause();
1111
- audioRef.current.currentTime = 0;
1112
- audioRef.current.src = audioUrl;
1113
- audioRef.current.load();
1059
+ const computeSelectedKey = ()=>{
1060
+ const match = allMenuItems.find((item)=>item.key ? (0, external_react_router_namespaceObject.matchPath)({
1061
+ path: item.key,
1062
+ end: true
1063
+ }, location.pathname) : false);
1064
+ return match?.key ?? '';
1065
+ };
1066
+ setSelectedKeys(computeSelectedKey());
1067
+ }, [
1068
+ location.pathname,
1069
+ allMenuItems
1070
+ ]);
1071
+ const handleLogout = (0, external_react_.useCallback)(async ()=>{
1072
+ await logout?.();
1073
+ if (isMobile) setDrawerVisible(false);
1074
+ navigate('/');
1075
+ }, [
1076
+ logout,
1077
+ isMobile,
1078
+ setDrawerVisible,
1079
+ navigate
1080
+ ]);
1081
+ const handleMenuClick = (0, external_react_.useCallback)(async (key)=>{
1082
+ if (onMenuClick?.(key) === false) return;
1083
+ try {
1084
+ if (key === MENU_KEY_APP_LOGOUT) return void await handleLogout();
1085
+ navigate(key);
1086
+ } finally{
1087
+ if (isMobile) setDrawerVisible(false);
1114
1088
  }
1115
- setIsPlaying(false);
1116
- setCurrentTime(0);
1117
- setDuration(0);
1118
1089
  }, [
1119
- audioUrl
1090
+ onMenuClick,
1091
+ handleLogout,
1092
+ navigate,
1093
+ isMobile,
1094
+ setDrawerVisible
1120
1095
  ]);
1121
- const handleLoadedMetadata = ()=>{
1122
- if (!audioRef.current) return;
1123
- const audio = audioRef.current;
1124
- if (audio.duration !== 1 / 0 && Number.isFinite(audio.duration)) {
1125
- if (audio.duration > 0) setDuration(audio.duration);
1126
- } else {
1127
- audio.currentTime = 1e101;
1128
- const timeUpdateHandler = ()=>{
1129
- audio.removeEventListener('timeupdate', timeUpdateHandler);
1130
- audio.currentTime = 0;
1131
- setDuration(audio.duration || 0);
1132
- };
1133
- audio.addEventListener('timeupdate', timeUpdateHandler);
1134
- }
1096
+ const handleUserMenuItemClick = (0, external_react_.useCallback)((key)=>{
1097
+ onMenuClick?.(key);
1098
+ }, [
1099
+ onMenuClick
1100
+ ]);
1101
+ const primaryMenu = (0, external_react_.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1102
+ theme: theme,
1103
+ mode: 'inline',
1104
+ selectedKeys: selectedKeys ? [
1105
+ selectedKeys
1106
+ ] : [],
1107
+ onClick: ({ key })=>handleMenuClick(key),
1108
+ items: filteredMenuItems,
1109
+ className: LoggedMainContainer_module.menu
1110
+ }, 'primary-menu'), [
1111
+ selectedKeys,
1112
+ filteredMenuItems,
1113
+ theme,
1114
+ handleMenuClick
1115
+ ]);
1116
+ (0, external_react_.useEffect)(()=>{
1117
+ const checkScreenSize = ()=>setIsMobile(window.innerWidth < 768);
1118
+ checkScreenSize();
1119
+ window.addEventListener('resize', checkScreenSize);
1120
+ return ()=>window.removeEventListener('resize', checkScreenSize);
1121
+ }, []);
1122
+ const menuContent = /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
1123
+ children: [
1124
+ primaryMenu,
1125
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
1126
+ className: LoggedMainContainer_module.menuSpacer
1127
+ }),
1128
+ showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1129
+ motion: false,
1130
+ theme: theme,
1131
+ mode: 'horizontal',
1132
+ className: LoggedMainContainer_module.versionMenu,
1133
+ disabled: true,
1134
+ items: [
1135
+ {
1136
+ icon: collapsed ? version : `${t('LoggedMainContainer.version')}: ${version}`,
1137
+ title: ''
1138
+ }
1139
+ ]
1140
+ }, 'version-menu'),
1141
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1142
+ motion: false,
1143
+ theme: theme,
1144
+ mode: 'inline',
1145
+ selectedKeys: selectedKeys ? [
1146
+ selectedKeys
1147
+ ] : [],
1148
+ onClick: ({ key })=>handleMenuClick(key),
1149
+ className: LoggedMainContainer_module.bottomMenu,
1150
+ items: memoizedBottomMenuItems
1151
+ }, 'bottom-menu')
1152
+ ]
1153
+ });
1154
+ const renderMenuContent = ()=>{
1155
+ if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
1156
+ placement: 'left',
1157
+ onClose: ()=>setDrawerVisible(false),
1158
+ open: drawerVisible,
1159
+ size: 250,
1160
+ className: LoggedMainContainer_module.drawer,
1161
+ classNames: {
1162
+ body: LoggedMainContainer_module.drawerBody
1163
+ },
1164
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Flex, {
1165
+ vertical: true,
1166
+ className: LoggedMainContainer_module.drawerFlex,
1167
+ children: menuContent
1168
+ })
1169
+ });
1170
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1171
+ theme: theme,
1172
+ trigger: null,
1173
+ collapsible: true,
1174
+ collapsed: collapsed,
1175
+ breakpoint: 'lg',
1176
+ collapsedWidth: 80,
1177
+ className: LoggedMainContainer_module.sider,
1178
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
1179
+ className: LoggedMainContainer_module.siderLayout,
1180
+ children: menuContent
1181
+ })
1182
+ });
1135
1183
  };
1136
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
1137
- className: AudioPlayer_module.audioPlayer,
1184
+ const renderSecondarySidebar = ()=>{
1185
+ if (!secondarySidebar) return null;
1186
+ if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
1187
+ placement: 'right',
1188
+ onClose: ()=>setSecondarySidebarDrawerVisible(false),
1189
+ open: secondarySidebarDrawerVisible,
1190
+ size: 280,
1191
+ className: LoggedMainContainer_module.drawer,
1192
+ title: null,
1193
+ closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
1194
+ children: secondarySidebar(user)
1195
+ });
1196
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1197
+ theme: theme,
1198
+ width: secondarySidebarWidth,
1199
+ children: secondarySidebar(user)
1200
+ });
1201
+ };
1202
+ return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
1203
+ className: LoggedMainContainer_module.layout,
1138
1204
  children: [
1139
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1140
- orientation: 'vertical',
1141
- size: 'middle',
1205
+ renderMenuContent(),
1206
+ renderSecondarySidebar(),
1207
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
1142
1208
  children: [
1143
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1144
- align: 'center',
1209
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
1210
+ className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1145
1211
  children: [
1146
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1147
- type: 'primary',
1148
- shape: 'circle',
1149
- icon: isPlaying ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PauseCircleOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PlayCircleOutlined, {}),
1150
- onClick: togglePlay,
1151
- disabled: !hasSource,
1152
- title: isPlaying ? t('AudioPlayer.pause') : t('AudioPlayer.play'),
1153
- "aria-label": isPlaying ? t('AudioPlayer.pauseAudio') : t('AudioPlayer.playAudio')
1154
- }),
1155
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Slider, {
1156
- min: 0,
1157
- max: duration,
1158
- value: currentTime,
1159
- onChange: handleSliderChange,
1160
- tooltip: {
1161
- open: false
1162
- },
1163
- disabled: 0 === duration,
1164
- className: AudioPlayer_module.slider
1212
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
1213
+ children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1214
+ type: 'text',
1215
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
1216
+ onClick: ()=>setDrawerVisible(true)
1217
+ }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1218
+ type: 'text',
1219
+ icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
1220
+ onClick: ()=>setCollapsed(!collapsed)
1221
+ })
1165
1222
  }),
1166
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1167
- shape: 'circle',
1168
- icon: isMuted ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MutedOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SoundOutlined, {}),
1169
- onClick: toggleMute,
1170
- disabled: !hasSource,
1171
- title: isMuted ? t('AudioPlayer.unmute') : t('AudioPlayer.mute'),
1172
- "aria-label": isMuted ? t('AudioPlayer.unmuteAudio') : t('AudioPlayer.muteAudio')
1223
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1224
+ size: isMobile ? 'small' : 'middle',
1225
+ className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1226
+ children: [
1227
+ secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1228
+ type: 'text',
1229
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.WechatOutlined, {}),
1230
+ onClick: ()=>setSecondarySidebarDrawerVisible(true)
1231
+ }),
1232
+ !isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(LoggedMainContainer_Text, {
1233
+ children: t('LoggedMainContainer.theme')
1234
+ }),
1235
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {}),
1236
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
1237
+ type: 'vertical',
1238
+ className: LoggedMainContainer_module.headerDivider
1239
+ }),
1240
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(UserMenu, {
1241
+ user: user,
1242
+ items: filteredUserMenuItems,
1243
+ onItemClick: handleUserMenuItemClick
1244
+ })
1245
+ ]
1173
1246
  })
1174
1247
  ]
1175
1248
  }),
1176
- /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
1177
- className: AudioPlayer_module.durationTimeContainer,
1178
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Text, {
1179
- children: `${formatTime(currentTime)} / ${formatTime(duration)}`
1180
- })
1249
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
1250
+ className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1251
+ children: children
1181
1252
  })
1182
1253
  ]
1183
- }),
1184
- /*#__PURE__*/ (0, jsx_runtime.jsx)("audio", {
1185
- ref: audioRef,
1186
- onTimeUpdate: (e)=>{
1187
- if (!isPlaying) return;
1188
- const audioElement = e.target;
1189
- setCurrentTime(audioElement.currentTime);
1190
- },
1191
- onLoadedMetadata: handleLoadedMetadata,
1192
- onEnded: ()=>{
1193
- setIsPlaying(false);
1194
- setCurrentTime(0);
1195
- },
1196
- onPlay: ()=>setIsPlaying(true),
1197
- onPause: ()=>setIsPlaying(false),
1198
- muted: isMuted,
1199
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)("track", {
1200
- kind: 'captions'
1201
- })
1202
1254
  })
1203
1255
  ]
1204
1256
  });
1257
+ }
1258
+ LoggedMainContainer.propTypes = {
1259
+ children: external_prop_types_default().node.isRequired
1205
1260
  };
1206
- AudioPlayer.propTypes = {
1207
- audioUrl: external_prop_types_default().string.isRequired
1208
- };
1209
- const PhoneInput_module = {
1210
- container: "container-IJ_oCC",
1211
- countrySelect: "countrySelect-hsVqWh",
1212
- phoneInput: "phoneInput-Pz8eaz"
1213
- };
1214
- const COUNTRIES = [
1215
- {
1216
- code: 'BR',
1217
- dialCode: '55',
1218
- flag: '🇧🇷',
1219
- maxLocalDigits: 11
1220
- },
1221
- {
1222
- code: 'US',
1223
- dialCode: '1',
1224
- flag: '🇺🇸',
1225
- maxLocalDigits: 10
1226
- },
1227
- {
1228
- code: 'CA',
1229
- dialCode: '1',
1230
- flag: '🇨🇦',
1231
- maxLocalDigits: 10
1232
- },
1233
- {
1234
- code: 'MX',
1235
- dialCode: '52',
1236
- flag: '🇲🇽',
1237
- maxLocalDigits: 10
1238
- },
1239
- {
1240
- code: 'AR',
1241
- dialCode: '54',
1242
- flag: '🇦🇷',
1243
- maxLocalDigits: 10
1244
- },
1245
- {
1246
- code: 'CL',
1247
- dialCode: '56',
1248
- flag: '🇨🇱',
1249
- maxLocalDigits: 9
1250
- },
1251
- {
1252
- code: 'CO',
1253
- dialCode: '57',
1254
- flag: '🇨🇴',
1255
- maxLocalDigits: 10
1256
- },
1257
- {
1258
- code: 'PE',
1259
- dialCode: '51',
1260
- flag: '🇵🇪',
1261
- maxLocalDigits: 9
1262
- },
1263
- {
1264
- code: 'VE',
1265
- dialCode: '58',
1266
- flag: '🇻🇪',
1267
- maxLocalDigits: 10
1268
- },
1269
- {
1270
- code: 'UY',
1271
- dialCode: '598',
1272
- flag: '🇺🇾',
1273
- maxLocalDigits: 8
1274
- },
1275
- {
1276
- code: 'PY',
1277
- dialCode: '595',
1278
- flag: '🇵🇾',
1279
- maxLocalDigits: 9
1280
- },
1281
- {
1282
- code: 'BO',
1283
- dialCode: '591',
1284
- flag: '🇧🇴',
1285
- maxLocalDigits: 8
1286
- },
1287
- {
1288
- code: 'PT',
1289
- dialCode: '351',
1290
- flag: '🇵🇹',
1291
- maxLocalDigits: 9
1292
- },
1293
- {
1294
- code: 'ES',
1295
- dialCode: '34',
1296
- flag: '🇪🇸',
1297
- maxLocalDigits: 9
1298
- },
1299
- {
1300
- code: 'IT',
1301
- dialCode: '39',
1302
- flag: '🇮🇹',
1303
- maxLocalDigits: 10
1304
- },
1305
- {
1306
- code: 'FR',
1307
- dialCode: '33',
1308
- flag: '🇫🇷',
1309
- maxLocalDigits: 9
1310
- },
1311
- {
1312
- code: 'DE',
1313
- dialCode: '49',
1314
- flag: '🇩🇪',
1315
- maxLocalDigits: 11
1316
- },
1317
- {
1318
- code: 'GB',
1319
- dialCode: '44',
1320
- flag: '🇬🇧',
1321
- maxLocalDigits: 10
1322
- },
1323
- {
1324
- code: 'AO',
1325
- dialCode: '244',
1326
- flag: '🇦🇴',
1327
- maxLocalDigits: 9
1328
- },
1329
- {
1330
- code: 'MZ',
1331
- dialCode: '258',
1332
- flag: '🇲🇿',
1333
- maxLocalDigits: 9
1334
- },
1335
- {
1336
- code: 'ZA',
1337
- dialCode: '27',
1338
- flag: '🇿🇦',
1339
- maxLocalDigits: 9
1340
- },
1341
- {
1342
- code: 'CN',
1343
- dialCode: '86',
1344
- flag: '🇨🇳',
1345
- maxLocalDigits: 11
1346
- },
1347
- {
1348
- code: 'JP',
1349
- dialCode: '81',
1350
- flag: '🇯🇵',
1351
- maxLocalDigits: 10
1352
- },
1353
- {
1354
- code: 'IN',
1355
- dialCode: '91',
1356
- flag: '🇮🇳',
1357
- maxLocalDigits: 10
1358
- },
1359
- {
1360
- code: 'AU',
1361
- dialCode: '61',
1362
- flag: '🇦🇺',
1363
- maxLocalDigits: 9
1364
- }
1365
- ];
1366
- function applyBrMask(digits) {
1367
- if (digits.length <= 2) return `(${digits}`;
1368
- if (digits.length <= 7) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
1369
- if (digits.length <= 10) return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6)}`;
1370
- return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
1371
- }
1372
- function applyUsMask(digits) {
1373
- if (digits.length <= 3) return `(${digits}`;
1374
- if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
1375
- return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6, 10)}`;
1376
- }
1377
- function applyArMask(digits) {
1378
- if (digits.length <= 2) return `(${digits}`;
1379
- if (digits.length <= 6) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
1380
- return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6, 10)}`;
1381
- }
1382
- function applyGenericMask(digits, areaLen, totalLen) {
1383
- if (digits.length <= areaLen) return `(${digits}`;
1384
- const area = digits.slice(0, areaLen);
1385
- const rest = digits.slice(areaLen, totalLen);
1386
- const mid = Math.floor(rest.length / 2 + rest.length % 2);
1387
- if (rest.length <= mid) return `(${area}) ${rest}`;
1388
- return `(${area}) ${rest.slice(0, mid)}-${rest.slice(mid)}`;
1261
+ function useErrorMessage() {
1262
+ const { t } = useCodebitWebAntdTranslation();
1263
+ const getErrorMessage = (error)=>{
1264
+ let status = 'error';
1265
+ const responseStatus = error?.response?.status || null;
1266
+ let errorMessage = t('Error.defaultError');
1267
+ let retryText = t('Error.retryButton');
1268
+ let onRetryAction = null;
1269
+ if (error?.errorCode) switch(error.errorCode){
1270
+ case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
1271
+ errorMessage = t('Error.networkError');
1272
+ break;
1273
+ case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
1274
+ errorMessage = t('Error.timeoutError');
1275
+ break;
1276
+ }
1277
+ else if (responseStatus) switch(responseStatus){
1278
+ case 400:
1279
+ errorMessage = t('Error.badRequestError');
1280
+ break;
1281
+ case 403:
1282
+ errorMessage = t('Error.forbiddenError');
1283
+ retryText = t('Error.reloadPageButton');
1284
+ status = 403;
1285
+ onRetryAction = ()=>{
1286
+ globalThis.location.reload();
1287
+ };
1288
+ break;
1289
+ case 404:
1290
+ errorMessage = t('Error.notFoundError');
1291
+ status = 404;
1292
+ break;
1293
+ case 500:
1294
+ errorMessage = t('Error.internalServerError');
1295
+ status = 500;
1296
+ break;
1297
+ case 401:
1298
+ errorMessage = t('Error.sessionExpiredError');
1299
+ retryText = t('Error.reloadPageButton');
1300
+ onRetryAction = ()=>{
1301
+ globalThis.location.reload();
1302
+ };
1303
+ break;
1304
+ }
1305
+ return {
1306
+ errorMessage,
1307
+ status,
1308
+ retryText,
1309
+ onRetryAction
1310
+ };
1311
+ };
1312
+ return {
1313
+ getErrorMessage
1314
+ };
1389
1315
  }
1390
- function applyMask(digits, countryCode) {
1391
- switch(countryCode){
1392
- case 'BR':
1393
- return applyBrMask(digits);
1394
- case 'US':
1395
- case 'CA':
1396
- return applyUsMask(digits);
1397
- case 'MX':
1398
- case 'CO':
1399
- case 'VE':
1400
- return applyGenericMask(digits, 2, 10);
1401
- case 'AR':
1402
- return applyArMask(digits);
1403
- case 'CL':
1404
- case 'PE':
1405
- case 'PT':
1406
- case 'ES':
1407
- case 'AU':
1408
- case 'ZA':
1409
- case 'AO':
1410
- case 'MZ':
1411
- return applyGenericMask(digits, 2, 9);
1412
- case 'UY':
1413
- case 'BO':
1414
- return applyGenericMask(digits, 1, 8);
1415
- case 'PY':
1416
- return applyGenericMask(digits, 3, 9);
1417
- case 'FR':
1418
- return applyGenericMask(digits, 2, 9);
1419
- case 'IT':
1420
- return applyGenericMask(digits, 3, 10);
1421
- case 'DE':
1422
- return applyGenericMask(digits, 3, 11);
1423
- case 'GB':
1424
- return applyGenericMask(digits, 4, 10);
1425
- case 'CN':
1426
- return applyGenericMask(digits, 3, 11);
1427
- case 'JP':
1428
- return applyGenericMask(digits, 3, 10);
1429
- case 'IN':
1430
- return applyGenericMask(digits, 5, 10);
1431
- default:
1432
- return digits;
1316
+ const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
1317
+ function ErrorRetry({ error, onRetry }) {
1318
+ if (error && error instanceof Error) {
1319
+ ErrorRetry_logger.error('Fail to load.', error);
1320
+ react_namespaceObject.captureException(error);
1433
1321
  }
1322
+ const { getErrorMessage } = useErrorMessage();
1323
+ const { status, errorMessage, retryText, onRetryAction } = getErrorMessage(error);
1324
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
1325
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
1326
+ status: status,
1327
+ title: errorMessage,
1328
+ extra: [
1329
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1330
+ type: 'primary',
1331
+ onClick: onRetryAction ?? onRetry,
1332
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
1333
+ children: retryText
1334
+ }, 'retry')
1335
+ ]
1336
+ })
1337
+ });
1434
1338
  }
1435
- function detectCountry(fullDigits) {
1436
- if (!fullDigits) return COUNTRIES[0];
1437
- const sorted = [
1438
- ...COUNTRIES
1439
- ].sort((a, b)=>b.dialCode.length - a.dialCode.length);
1440
- for (const c of sorted)if (fullDigits.startsWith(c.dialCode)) return c;
1441
- return COUNTRIES[0];
1442
- }
1443
- const PhoneInput = ({ value, onChange, disabled, size, placeholder })=>{
1444
- const { t } = useCodebitWebAntdTranslation();
1445
- const countrySearchLabel = (c)=>{
1446
- const name = t(`PhoneInput.countries.${c.code}`);
1447
- return `${c.flag} ${name} +${c.dialCode}`;
1448
- };
1449
- const [selectedCountry, setSelectedCountry] = (0, external_react_.useState)(()=>detectCountry(value));
1450
- const [displayValue, setDisplayValue] = (0, external_react_.useState)(()=>{
1451
- if (!value) return '';
1452
- const country = detectCountry(value);
1453
- const localDigits = value.slice(country.dialCode.length);
1454
- return applyMask(localDigits, country.code);
1455
- });
1456
- (0, external_react_.useEffect)(()=>{
1457
- if (!value) return void setDisplayValue('');
1458
- const country = detectCountry(value);
1459
- setSelectedCountry(country);
1460
- const localDigits = value.slice(country.dialCode.length);
1461
- setDisplayValue(applyMask(localDigits, country.code));
1462
- }, [
1463
- value
1464
- ]);
1465
- const handleCountryChange = (countryCode)=>{
1466
- const country = COUNTRIES.find((c)=>c.code === countryCode) ?? COUNTRIES[0];
1467
- setSelectedCountry(country);
1468
- setDisplayValue('');
1469
- onChange?.('');
1470
- };
1471
- const handleInputChange = (e)=>{
1472
- const rawDigits = e.target.value.replaceAll(/\D/g, '').slice(0, selectedCountry.maxLocalDigits);
1473
- setDisplayValue(applyMask(rawDigits, selectedCountry.code));
1474
- onChange?.(selectedCountry.dialCode + rawDigits);
1475
- };
1476
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Input.Group, {
1477
- compact: true,
1478
- className: PhoneInput_module.container,
1339
+ ErrorRetry.propTypes = {
1340
+ error: external_prop_types_default().object.isRequired,
1341
+ onRetry: external_prop_types_default().func.isRequired
1342
+ };
1343
+ const ListCard_module = {
1344
+ listCard: "listCard-ISftFd",
1345
+ headerRow: "headerRow-UsZAzP",
1346
+ actions: "actions-ig53s2",
1347
+ filtersRow: "filtersRow-f3Xk5a",
1348
+ expandArea: "expandArea-czOoFS"
1349
+ };
1350
+ const { Title } = external_antd_namespaceObject.Typography;
1351
+ function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
1352
+ const { token } = external_antd_namespaceObject.theme.useToken();
1353
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
1354
+ const margin = token['margin'];
1355
+ return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
1356
+ className: ListCard_module.listCard,
1479
1357
  children: [
1480
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Select, {
1481
- value: selectedCountry.code,
1482
- onChange: handleCountryChange,
1483
- disabled: disabled,
1484
- size: size,
1485
- className: PhoneInput_module.countrySelect,
1486
- popupMatchSelectWidth: false,
1487
- showSearch: true,
1488
- filterOption: (input, option)=>option?.searchLabel?.toLowerCase().includes(input.toLowerCase()) ?? false,
1489
- options: COUNTRIES.map((c)=>({
1490
- value: c.code,
1491
- label: `${c.flag} +${c.dialCode}`,
1492
- searchLabel: countrySearchLabel(c)
1493
- })),
1494
- optionRender: (option)=>option.data.searchLabel
1358
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
1359
+ gutter: margin,
1360
+ align: 'middle',
1361
+ className: ListCard_module.headerRow,
1362
+ children: [
1363
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
1364
+ xs: 24,
1365
+ sm: 24,
1366
+ md: 12,
1367
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
1368
+ level: 4,
1369
+ children: title
1370
+ })
1371
+ }),
1372
+ (!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
1373
+ xs: 24,
1374
+ sm: 24,
1375
+ md: 12,
1376
+ className: ListCard_module.actions,
1377
+ children: [
1378
+ !!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1379
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
1380
+ onClick: onClearFilters,
1381
+ children: t('ListCard.clearFilters')
1382
+ }),
1383
+ actions
1384
+ ]
1385
+ })
1386
+ ]
1387
+ }),
1388
+ !!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
1389
+ gutter: margin,
1390
+ className: ListCard_module.filtersRow,
1391
+ children: headerContainer
1495
1392
  }),
1496
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
1497
- value: displayValue,
1498
- onChange: handleInputChange,
1499
- disabled: disabled,
1500
- size: size,
1501
- placeholder: placeholder,
1502
- className: PhoneInput_module.phoneInput
1393
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
1394
+ className: ListCard_module.expandArea,
1395
+ children: tableContainer
1503
1396
  })
1504
1397
  ]
1505
1398
  });
1399
+ }
1400
+ ListCard.propTypes = {
1401
+ title: external_prop_types_default().string.isRequired,
1402
+ onClearFilters: external_prop_types_default().func,
1403
+ headerContainer: external_prop_types_default().node,
1404
+ tableContainer: external_prop_types_default().node,
1405
+ actions: external_prop_types_default().node
1506
1406
  };
1507
- PhoneInput.propTypes = {
1508
- value: external_prop_types_default().string,
1509
- onChange: external_prop_types_default().func,
1510
- disabled: external_prop_types_default().bool,
1511
- size: external_prop_types_default().oneOf([
1512
- 'large',
1513
- 'middle',
1514
- 'small'
1515
- ]),
1516
- placeholder: external_prop_types_default().string
1517
- };
1518
- PhoneInput.format = (fullDigits)=>{
1519
- if (!fullDigits) return '';
1520
- const country = detectCountry(fullDigits);
1521
- const localDigits = fullDigits.slice(country.dialCode.length);
1522
- const masked = applyMask(localDigits, country.code);
1523
- return `${country.flag} +${country.dialCode} ${masked}`;
1407
+ ListCard.defaultProps = {
1408
+ onClearFilters: null,
1409
+ headerContainer: null,
1410
+ tableContainer: null,
1411
+ actions: null
1524
1412
  };
1525
- const CodebitThemeContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
1526
- const CodebitThemeProvider = ({ children, storeThemeInLocalStorage = true, containerId = 'root', forcedTheme = null, ...props })=>{
1527
- const hasLoaded = (0, external_react_.useRef)(false);
1528
- const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
1529
- if (forcedTheme) return 'dark' === forcedTheme;
1530
- try {
1531
- if (storeThemeInLocalStorage) {
1532
- const savedTheme = localStorage?.getItem('theme');
1533
- if (null !== savedTheme) return 'dark' === savedTheme;
1534
- }
1535
- return globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
1536
- } finally{
1537
- hasLoaded.current = true;
1538
- }
1539
- });
1540
- (0, external_react_.useEffect)(()=>{
1541
- if (forcedTheme) {
1542
- const mode = 'dark' === forcedTheme;
1543
- setIsDarkMode(mode);
1544
- }
1545
- }, [
1546
- forcedTheme
1547
- ]);
1548
- const toggleTheme = ()=>{
1549
- setIsDarkMode((prev)=>!prev);
1550
- };
1551
- (0, external_react_.useEffect)(()=>{
1552
- const target = document.getElementById(containerId);
1553
- if (!target) return;
1554
- if (isDarkMode) {
1555
- document.documentElement.classList.add('dark-theme');
1556
- target.classList.add('dark-theme');
1557
- } else {
1558
- document.documentElement.classList.remove('dark-theme');
1559
- target.classList.remove('dark-theme');
1560
- }
1561
- document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
1562
- }, [
1563
- isDarkMode,
1564
- containerId
1565
- ]);
1566
- (0, external_react_.useEffect)(()=>{
1567
- if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
1568
- if (hasLoaded.current && storeThemeInLocalStorage && !forcedTheme) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
1413
+ const CssTokenBridge = ({ containerId })=>{
1414
+ const { token } = external_antd_namespaceObject.theme.useToken();
1415
+ (0, external_react_.useLayoutEffect)(()=>{
1416
+ const scopedContainer = containerId ? document.getElementById(containerId) : null;
1417
+ const targets = scopedContainer ? [
1418
+ document.documentElement,
1419
+ scopedContainer
1420
+ ] : [
1421
+ document.documentElement
1422
+ ];
1423
+ const setVar = (name, value)=>{
1424
+ for (const target of targets)target.style.setProperty(name, value);
1425
+ };
1426
+ setVar('--antd-color-bg-base', token['colorBgBase']);
1427
+ setVar('--antd-color-bg-container', token['colorBgContainer']);
1428
+ setVar('--antd-color-bg-elevated', token['colorBgElevated']);
1429
+ setVar('--antd-color-bg-layout', token['colorBgLayout']);
1430
+ setVar('--antd-color-bg-mask', token['colorBgMask']);
1431
+ setVar('--antd-color-bg-spotlight', token['colorBgSpotlight']);
1432
+ setVar('--antd-color-primary', token['colorPrimary']);
1433
+ setVar('--antd-color-success', token['colorSuccess']);
1434
+ setVar('--antd-color-success-bg', token['colorSuccessBg']);
1435
+ setVar('--antd-color-success-border', token['colorSuccessBorder']);
1436
+ setVar('--antd-color-success-text', token['colorSuccessText']);
1437
+ setVar('--antd-color-warning', token['colorWarning']);
1438
+ setVar('--antd-color-warning-bg', token['colorWarningBg']);
1439
+ setVar('--antd-color-warning-border', token['colorWarningBorder']);
1440
+ setVar('--antd-color-warning-text', token['colorWarningText']);
1441
+ setVar('--antd-color-error', token['colorError']);
1442
+ setVar('--antd-color-error-bg', token['colorErrorBg']);
1443
+ setVar('--antd-color-error-border', token['colorErrorBorder']);
1444
+ setVar('--antd-color-error-text', token['colorErrorText']);
1445
+ setVar('--antd-color-info', token['colorInfo']);
1446
+ setVar('--antd-color-info-bg', token['colorInfoBg']);
1447
+ setVar('--antd-color-info-border', token['colorInfoBorder']);
1448
+ setVar('--antd-color-info-text', token['colorInfoText']);
1449
+ setVar('--antd-color-text', token['colorText']);
1450
+ setVar('--antd-color-text-secondary', token['colorTextSecondary']);
1451
+ setVar('--antd-color-text-tertiary', token['colorTextTertiary']);
1452
+ setVar('--antd-color-text-quaternary', token['colorTextQuaternary']);
1453
+ setVar('--antd-color-text-disabled', token['colorTextDisabled']);
1454
+ setVar('--antd-color-border', token['colorBorder']);
1455
+ setVar('--antd-color-border-secondary', token['colorBorderSecondary']);
1456
+ setVar('--antd-color-border-hover', token['colorBorderHover']);
1457
+ setVar('--antd-color-border-disabled', token['colorBorderDisabled']);
1458
+ setVar('--antd-color-split', token['colorSplit']);
1459
+ setVar('--antd-color-link', token['colorLink']);
1460
+ setVar('--antd-color-link-hover', token['colorLinkHover']);
1461
+ setVar('--antd-color-link-active', token['colorLinkActive']);
1462
+ setVar('--antd-color-fill', token['colorFill']);
1463
+ setVar('--antd-color-fill-secondary', token['colorFillSecondary']);
1464
+ setVar('--antd-color-fill-tertiary', token['colorFillTertiary']);
1465
+ setVar('--antd-color-fill-quaternary', token['colorFillQuaternary']);
1466
+ setVar('--antd-color-fill-content', token['colorFillContent']);
1467
+ setVar('--antd-color-fill-content-hover', token['colorFillContentHover']);
1468
+ setVar('--antd-color-fill-content-selected', token['colorFillContentSelected']);
1469
+ setVar('--antd-color-fill-alter', token['colorFillAlter']);
1470
+ setVar('--antd-color-fill-alter-hover', token['colorFillAlterHover']);
1471
+ setVar('--antd-color-fill-alter-active', token['colorFillAlterActive']);
1472
+ setVar('--antd-color-fill-alter-selected', token['colorFillAlterSelected']);
1473
+ setVar('--antd-color-fill-alter-disabled', token['colorFillAlterDisabled']);
1474
+ setVar('--antd-color-white', token['colorWhite']);
1475
+ setVar('--antd-color-black', token['colorBlack']);
1476
+ setVar('--antd-margin-xxs', `${token['marginXXS']}px`);
1477
+ setVar('--antd-margin-xs', `${token['marginXS']}px`);
1478
+ setVar('--antd-margin-sm', `${token['marginSM']}px`);
1479
+ setVar('--antd-margin', `${token['margin']}px`);
1480
+ setVar('--antd-margin-md', `${token['marginMD']}px`);
1481
+ setVar('--antd-margin-lg', `${token['marginLG']}px`);
1482
+ setVar('--antd-margin-xl', `${token['marginXL']}px`);
1483
+ setVar('--antd-margin-xxl', `${token['marginXXL']}px`);
1484
+ setVar('--antd-padding-xxs', `${token['paddingXXS']}px`);
1485
+ setVar('--antd-padding-xs', `${token['paddingXS']}px`);
1486
+ setVar('--antd-padding-sm', `${token['paddingSM']}px`);
1487
+ setVar('--antd-padding', `${token['padding']}px`);
1488
+ setVar('--antd-padding-md', `${token['paddingMD']}px`);
1489
+ setVar('--antd-padding-lg', `${token['paddingLG']}px`);
1490
+ setVar('--antd-padding-xl', `${token['paddingXL']}px`);
1491
+ setVar('--antd-font-size-xxs', '8px');
1492
+ setVar('--antd-font-size-xs', '10px');
1493
+ setVar('--antd-font-size-sm', `${token['fontSizeSM']}px`);
1494
+ setVar('--antd-font-size', `${token['fontSize']}px`);
1495
+ setVar('--antd-font-size-lg', `${token['fontSizeLG']}px`);
1496
+ setVar('--antd-font-size-xl', `${token['fontSizeXL']}px`);
1497
+ setVar('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
1498
+ setVar('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
1499
+ setVar('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
1500
+ setVar('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
1501
+ setVar('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
1502
+ setVar('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
1503
+ setVar('--antd-line-height-sm', token['lineHeightSM']);
1504
+ setVar('--antd-line-height', token['lineHeight']);
1505
+ setVar('--antd-line-height-lg', token['lineHeightLG']);
1506
+ setVar('--antd-control-height-xs', `${token['controlHeightXS']}px`);
1507
+ setVar('--antd-control-height-sm', `${token['controlHeightSM']}px`);
1508
+ setVar('--antd-control-height', `${token['controlHeight']}px`);
1509
+ setVar('--antd-control-height-lg', `${token['controlHeightLG']}px`);
1510
+ setVar('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
1511
+ setVar('--antd-border-radius', `${token['borderRadius']}px`);
1512
+ setVar('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
1513
+ setVar('--antd-shadow', token['boxShadow']);
1514
+ setVar('--antd-shadow-lg', token['boxShadowSecondary']);
1569
1515
  }, [
1570
- isDarkMode,
1571
- storeThemeInLocalStorage,
1572
- forcedTheme
1573
- ]);
1574
- const themeContextValue = (0, external_react_.useMemo)(()=>({
1575
- isDarkMode,
1576
- toggleTheme,
1577
- setIsDarkMode
1578
- }), [
1579
- isDarkMode
1516
+ containerId,
1517
+ token
1580
1518
  ]);
1581
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
1582
- value: themeContextValue,
1583
- children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
1584
- theme: {
1585
- algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
1586
- token: {
1587
- colorPrimary: isDarkMode ? '#589C75' : '#29D266',
1588
- colorInfo: isDarkMode ? '#589C75' : '#29D266',
1589
- colorLink: isDarkMode ? '#589C75' : '#29D266'
1590
- },
1591
- components: {
1592
- Menu: {
1593
- itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
1594
- itemSelectedColor: '#FAFAFA',
1595
- darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
1596
- darkItemSelectedColor: '#FAFAFA'
1597
- },
1598
- Button: {
1599
- colorPrimary: isDarkMode ? '#589C75' : '#29D266',
1600
- colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
1601
- colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
1602
- },
1603
- Layout: {
1604
- siderBg: isDarkMode ? '#1a1a1a' : '#001529',
1605
- triggerBg: isDarkMode ? '#589C75' : '#29D266',
1606
- triggerColor: '#FAFAFA'
1607
- },
1608
- Header: {
1609
- colorPrimary: isDarkMode ? '#589C75' : '#29D266'
1610
- }
1611
- }
1612
- },
1613
- ...props,
1614
- children: [
1615
- /*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {
1616
- containerId: containerId
1617
- }),
1618
- children
1619
- ]
1620
- })
1621
- });
1519
+ return null;
1622
1520
  };
1623
- CodebitThemeProvider.propTypes = {
1624
- children: external_prop_types_default().node.isRequired,
1625
- storeThemeInLocalStorage: external_prop_types_default().bool,
1626
- containerId: external_prop_types_default().string,
1627
- forcedTheme: external_prop_types_default().oneOf([
1628
- 'dark',
1629
- 'light',
1630
- null
1631
- ])
1521
+ CssTokenBridge.propTypes = {
1522
+ containerId: external_prop_types_default().string
1632
1523
  };
1633
- const LoggedMainContainer_module = {
1634
- layout: "layout-mL5o6I",
1635
- drawer: "drawer-oj0mJX",
1636
- drawerBody: "drawerBody-YtAN37",
1637
- drawerFlex: "drawerFlex-AGTAax",
1638
- sider: "sider-BDy1Bs",
1639
- siderLayout: "siderLayout-C8H0uI",
1640
- secondarySidebar: "secondarySidebar-P6J_Xn",
1641
- menu: "menu-KMvPt7",
1642
- menuContainer: "menuContainer-ahnhBu",
1643
- menuLabel: "menuLabel-csBJTc",
1644
- menuDescription: "menuDescription-d6BFBO",
1645
- menuSpacer: "menuSpacer-RIB3II",
1646
- versionMenu: "versionMenu-NM4uyG",
1647
- bottomMenu: "bottomMenu-VtOktS",
1648
- header: "header-vgc67L",
1649
- mobile: "mobile-mKGxb5",
1650
- headerSpace: "headerSpace-Fd_iha",
1651
- content: "content-OZHp2h"
1524
+ const TableContainer_module = {
1525
+ tableContainer: "tableContainer-EhNwOm"
1652
1526
  };
1653
- const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
1654
- const { Text } = external_antd_namespaceObject.Typography;
1655
- const MENU_KEY_APP_LOGOUT = 'app-logout';
1656
- function LoggedMainContainer({ children }) {
1657
- const [collapsed, setCollapsed] = (0, external_react_.useState)(true);
1658
- const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
1659
- const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
1660
- const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
1661
- const { t } = useCodebitWebAntdTranslation();
1662
- const configCodebit = (0, external_react_.useContext)(CodebitConfigContext);
1663
- const configTheme = (0, external_react_.useContext)(CodebitThemeContext);
1664
- const navigate = (0, external_react_router_namespaceObject.useNavigate)();
1665
- const location = (0, external_react_router_namespaceObject.useLocation)();
1666
- if (!configCodebit || !configTheme) throw new Error('LoggedContainer must be used within CodebitConfigProvider and CodebitThemeContext');
1667
- const { logout, user, menuItems, version, showVersion, secondarySidebar, secondarySidebarWidth = 280, bottomMenuItems, onMenuClick } = configCodebit;
1668
- const { isDarkMode } = configTheme;
1669
- const theme = isDarkMode ? 'dark' : 'light';
1670
- const allMenuItems = (0, external_react_.useMemo)(()=>[
1671
- ...menuItems(user),
1672
- ...bottomMenuItems?.(user) ?? []
1673
- ], [
1674
- menuItems,
1675
- user,
1676
- bottomMenuItems
1677
- ]);
1678
- const filteredMenuItems = (0, external_react_.useMemo)(()=>menuItems(user).filter((item)=>{
1679
- if (!item.roles) return true;
1680
- if (!user?.roles) return false;
1681
- return item.roles.some((role)=>user.roles.includes(role));
1682
- }), [
1683
- menuItems,
1684
- user
1685
- ]);
1686
- const filteredBottomMenuItems = (0, external_react_.useMemo)(()=>{
1687
- if (!bottomMenuItems) return [];
1688
- return bottomMenuItems(user).filter((item)=>{
1689
- if (!item.roles) return true;
1690
- if (!user?.roles) return false;
1691
- return item.roles.some((role)=>user.roles.includes(role));
1527
+ function isPaginationNode(node) {
1528
+ if (node.nodeType !== Node.ELEMENT_NODE) return false;
1529
+ const element = node;
1530
+ return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
1531
+ }
1532
+ function hasPaginationInMutation(mutation) {
1533
+ return Array.from(mutation.addedNodes).some(isPaginationNode);
1534
+ }
1535
+ function TableContainer({ children }) {
1536
+ const containerRef = (0, external_react_.useRef)(null);
1537
+ const containerHeightRef = (0, external_react_.useRef)(null);
1538
+ const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
1539
+ (0, external_react_.useLayoutEffect)(()=>{
1540
+ const calculateHeights = ()=>{
1541
+ if (!containerRef.current) return;
1542
+ containerHeightRef.current = containerRef.current.offsetHeight;
1543
+ const thead = containerRef.current.querySelector('thead');
1544
+ let theadHeight = 0;
1545
+ if (thead) {
1546
+ const rect = thead.getBoundingClientRect();
1547
+ const styles = globalThis.getComputedStyle(thead);
1548
+ const marginTop = Number.parseFloat(styles.marginTop) || 0;
1549
+ const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1550
+ theadHeight = rect.height + marginTop + marginBottom;
1551
+ }
1552
+ const pagination = containerRef.current.querySelector('.ant-table-pagination');
1553
+ let paginationHeight = 0;
1554
+ if (pagination) {
1555
+ const rect = pagination.getBoundingClientRect();
1556
+ const styles = globalThis.getComputedStyle(pagination);
1557
+ const marginTop = Number.parseFloat(styles.marginTop) || 0;
1558
+ const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1559
+ paginationHeight = rect.height + marginTop + marginBottom;
1560
+ }
1561
+ const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
1562
+ setScrollY(availableHeight);
1563
+ };
1564
+ calculateHeights();
1565
+ const observer = new MutationObserver((mutations)=>{
1566
+ const hasPagination = mutations.some(hasPaginationInMutation);
1567
+ if (hasPagination) calculateHeights();
1692
1568
  });
1693
- }, [
1694
- bottomMenuItems,
1695
- user
1696
- ]);
1697
- const memoizedBottomMenuItems = (0, external_react_.useMemo)(()=>[
1698
- ...filteredBottomMenuItems,
1699
- {
1700
- key: MENU_KEY_APP_LOGOUT,
1701
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.LogoutOutlined, {}),
1702
- label: t('LoggedMainContainer.logout'),
1703
- danger: true
1569
+ if (containerRef.current) observer.observe(containerRef.current, {
1570
+ childList: true,
1571
+ subtree: true
1572
+ });
1573
+ globalThis.addEventListener('resize', calculateHeights);
1574
+ return ()=>{
1575
+ observer.disconnect();
1576
+ globalThis.removeEventListener('resize', calculateHeights);
1577
+ };
1578
+ }, []);
1579
+ const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
1580
+ scroll: {
1581
+ ...children.props?.scroll,
1582
+ y: scrollY,
1583
+ x: 'max-content'
1584
+ }
1585
+ }) : children;
1586
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
1587
+ ref: containerRef,
1588
+ className: TableContainer_module.tableContainer,
1589
+ children: enhancedChildren
1590
+ });
1591
+ }
1592
+ TableContainer.propTypes = {
1593
+ children: external_prop_types_default().element.isRequired
1594
+ };
1595
+ function FilterContainer({ children, ...props }) {
1596
+ const { token } = external_antd_namespaceObject.theme.useToken();
1597
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
1598
+ styles: {
1599
+ body: {
1600
+ padding: token['paddingXS'] + 'px'
1704
1601
  }
1705
- ], [
1706
- filteredBottomMenuItems,
1707
- t
1602
+ },
1603
+ ...props,
1604
+ children: children
1605
+ });
1606
+ }
1607
+ FilterContainer.propTypes = {
1608
+ children: external_prop_types_default().node.isRequired,
1609
+ ...external_antd_namespaceObject.Card.propTypes
1610
+ };
1611
+ const external_date_fns_namespaceObject = require("date-fns");
1612
+ const AudioPlayer_module = {
1613
+ audioPlayer: "audioPlayer-a4xARM",
1614
+ durationTimeContainer: "durationTimeContainer-kmkK6M",
1615
+ slider: "slider-bdta4v"
1616
+ };
1617
+ const AudioPlayer = ({ audioUrl })=>{
1618
+ const [isMuted, setIsMuted] = (0, external_react_.useState)(false);
1619
+ const [duration, setDuration] = (0, external_react_.useState)(0);
1620
+ const [currentTime, setCurrentTime] = (0, external_react_.useState)(0);
1621
+ const [isPlaying, setIsPlaying] = (0, external_react_.useState)(false);
1622
+ const { t } = useCodebitWebAntdTranslation();
1623
+ const audioRef = (0, external_react_.useRef)(null);
1624
+ const hasSource = !!audioUrl;
1625
+ const formatTime = (seconds)=>{
1626
+ const sec = Math.max(0, Math.floor(seconds));
1627
+ const date = (0, external_date_fns_namespaceObject.addSeconds)(new Date(0), sec);
1628
+ const h = Math.floor(sec / 3600);
1629
+ const timeFormat = h > 0 ? 'H:mm:ss' : 'm:ss';
1630
+ return (0, external_date_fns_namespaceObject.format)(date, timeFormat);
1631
+ };
1632
+ const togglePlay = async ()=>{
1633
+ if (!audioRef.current || !hasSource) return;
1634
+ if (audioRef.current.paused) {
1635
+ await audioRef.current.play();
1636
+ setIsPlaying(true);
1637
+ } else {
1638
+ audioRef.current.pause();
1639
+ setIsPlaying(false);
1640
+ }
1641
+ };
1642
+ const toggleMute = ()=>{
1643
+ if (!audioRef.current) return;
1644
+ audioRef.current.muted = !audioRef.current.muted;
1645
+ setIsMuted(audioRef.current.muted);
1646
+ };
1647
+ const handleSliderChange = (value)=>{
1648
+ if (!audioRef.current) return;
1649
+ const safeValue = Math.min(Math.round(value), Math.round(duration));
1650
+ audioRef.current.currentTime = safeValue;
1651
+ setCurrentTime(safeValue);
1652
+ };
1653
+ (0, external_react_.useEffect)(()=>{
1654
+ if (audioRef.current && audioUrl) {
1655
+ audioRef.current.pause();
1656
+ audioRef.current.currentTime = 0;
1657
+ audioRef.current.src = audioUrl;
1658
+ audioRef.current.load();
1659
+ }
1660
+ setIsPlaying(false);
1661
+ setCurrentTime(0);
1662
+ setDuration(0);
1663
+ }, [
1664
+ audioUrl
1708
1665
  ]);
1709
- const [selectedKeys, setSelectedKeys] = (0, external_react_.useState)('');
1666
+ const handleLoadedMetadata = ()=>{
1667
+ if (!audioRef.current) return;
1668
+ const audio = audioRef.current;
1669
+ if (audio.duration !== 1 / 0 && Number.isFinite(audio.duration)) {
1670
+ if (audio.duration > 0) setDuration(audio.duration);
1671
+ } else {
1672
+ audio.currentTime = 1e101;
1673
+ const timeUpdateHandler = ()=>{
1674
+ audio.removeEventListener('timeupdate', timeUpdateHandler);
1675
+ audio.currentTime = 0;
1676
+ setDuration(audio.duration || 0);
1677
+ };
1678
+ audio.addEventListener('timeupdate', timeUpdateHandler);
1679
+ }
1680
+ };
1681
+ return /*#__PURE__*/ (0, jsx_runtime.jsxs)("div", {
1682
+ className: AudioPlayer_module.audioPlayer,
1683
+ children: [
1684
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1685
+ orientation: 'vertical',
1686
+ size: 'middle',
1687
+ children: [
1688
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1689
+ align: 'center',
1690
+ children: [
1691
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1692
+ type: 'primary',
1693
+ shape: 'circle',
1694
+ icon: isPlaying ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PauseCircleOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.PlayCircleOutlined, {}),
1695
+ onClick: togglePlay,
1696
+ disabled: !hasSource,
1697
+ title: isPlaying ? t('AudioPlayer.pause') : t('AudioPlayer.play'),
1698
+ "aria-label": isPlaying ? t('AudioPlayer.pauseAudio') : t('AudioPlayer.playAudio')
1699
+ }),
1700
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Slider, {
1701
+ min: 0,
1702
+ max: duration,
1703
+ value: currentTime,
1704
+ onChange: handleSliderChange,
1705
+ tooltip: {
1706
+ open: false
1707
+ },
1708
+ disabled: 0 === duration,
1709
+ className: AudioPlayer_module.slider
1710
+ }),
1711
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1712
+ shape: 'circle',
1713
+ icon: isMuted ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MutedOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SoundOutlined, {}),
1714
+ onClick: toggleMute,
1715
+ disabled: !hasSource,
1716
+ title: isMuted ? t('AudioPlayer.unmute') : t('AudioPlayer.mute'),
1717
+ "aria-label": isMuted ? t('AudioPlayer.unmuteAudio') : t('AudioPlayer.muteAudio')
1718
+ })
1719
+ ]
1720
+ }),
1721
+ /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
1722
+ className: AudioPlayer_module.durationTimeContainer,
1723
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Text, {
1724
+ children: `${formatTime(currentTime)} / ${formatTime(duration)}`
1725
+ })
1726
+ })
1727
+ ]
1728
+ }),
1729
+ /*#__PURE__*/ (0, jsx_runtime.jsx)("audio", {
1730
+ ref: audioRef,
1731
+ onTimeUpdate: (e)=>{
1732
+ if (!isPlaying) return;
1733
+ const audioElement = e.target;
1734
+ setCurrentTime(audioElement.currentTime);
1735
+ },
1736
+ onLoadedMetadata: handleLoadedMetadata,
1737
+ onEnded: ()=>{
1738
+ setIsPlaying(false);
1739
+ setCurrentTime(0);
1740
+ },
1741
+ onPlay: ()=>setIsPlaying(true),
1742
+ onPause: ()=>setIsPlaying(false),
1743
+ muted: isMuted,
1744
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)("track", {
1745
+ kind: 'captions'
1746
+ })
1747
+ })
1748
+ ]
1749
+ });
1750
+ };
1751
+ AudioPlayer.propTypes = {
1752
+ audioUrl: external_prop_types_default().string.isRequired
1753
+ };
1754
+ const COUNTRIES = [
1755
+ {
1756
+ code: 'BR',
1757
+ dialCode: '55',
1758
+ flag: '🇧🇷',
1759
+ maxLocalDigits: 11
1760
+ },
1761
+ {
1762
+ code: 'US',
1763
+ dialCode: '1',
1764
+ flag: '🇺🇸',
1765
+ maxLocalDigits: 10
1766
+ },
1767
+ {
1768
+ code: 'CA',
1769
+ dialCode: '1',
1770
+ flag: '🇨🇦',
1771
+ maxLocalDigits: 10
1772
+ },
1773
+ {
1774
+ code: 'MX',
1775
+ dialCode: '52',
1776
+ flag: '🇲🇽',
1777
+ maxLocalDigits: 10
1778
+ },
1779
+ {
1780
+ code: 'AR',
1781
+ dialCode: '54',
1782
+ flag: '🇦🇷',
1783
+ maxLocalDigits: 10
1784
+ },
1785
+ {
1786
+ code: 'CL',
1787
+ dialCode: '56',
1788
+ flag: '🇨🇱',
1789
+ maxLocalDigits: 9
1790
+ },
1791
+ {
1792
+ code: 'CO',
1793
+ dialCode: '57',
1794
+ flag: '🇨🇴',
1795
+ maxLocalDigits: 10
1796
+ },
1797
+ {
1798
+ code: 'PE',
1799
+ dialCode: '51',
1800
+ flag: '🇵🇪',
1801
+ maxLocalDigits: 9
1802
+ },
1803
+ {
1804
+ code: 'VE',
1805
+ dialCode: '58',
1806
+ flag: '🇻🇪',
1807
+ maxLocalDigits: 10
1808
+ },
1809
+ {
1810
+ code: 'UY',
1811
+ dialCode: '598',
1812
+ flag: '🇺🇾',
1813
+ maxLocalDigits: 8
1814
+ },
1815
+ {
1816
+ code: 'PY',
1817
+ dialCode: '595',
1818
+ flag: '🇵🇾',
1819
+ maxLocalDigits: 9
1820
+ },
1821
+ {
1822
+ code: 'BO',
1823
+ dialCode: '591',
1824
+ flag: '🇧🇴',
1825
+ maxLocalDigits: 8
1826
+ },
1827
+ {
1828
+ code: 'PT',
1829
+ dialCode: '351',
1830
+ flag: '🇵🇹',
1831
+ maxLocalDigits: 9
1832
+ },
1833
+ {
1834
+ code: 'ES',
1835
+ dialCode: '34',
1836
+ flag: '🇪🇸',
1837
+ maxLocalDigits: 9
1838
+ },
1839
+ {
1840
+ code: 'IT',
1841
+ dialCode: '39',
1842
+ flag: '🇮🇹',
1843
+ maxLocalDigits: 10
1844
+ },
1845
+ {
1846
+ code: 'FR',
1847
+ dialCode: '33',
1848
+ flag: '🇫🇷',
1849
+ maxLocalDigits: 9
1850
+ },
1851
+ {
1852
+ code: 'DE',
1853
+ dialCode: '49',
1854
+ flag: '🇩🇪',
1855
+ maxLocalDigits: 11
1856
+ },
1857
+ {
1858
+ code: 'GB',
1859
+ dialCode: '44',
1860
+ flag: '🇬🇧',
1861
+ maxLocalDigits: 10
1862
+ },
1863
+ {
1864
+ code: 'AO',
1865
+ dialCode: '244',
1866
+ flag: '🇦🇴',
1867
+ maxLocalDigits: 9
1868
+ },
1869
+ {
1870
+ code: 'MZ',
1871
+ dialCode: '258',
1872
+ flag: '🇲🇿',
1873
+ maxLocalDigits: 9
1874
+ },
1875
+ {
1876
+ code: 'ZA',
1877
+ dialCode: '27',
1878
+ flag: '🇿🇦',
1879
+ maxLocalDigits: 9
1880
+ },
1881
+ {
1882
+ code: 'CN',
1883
+ dialCode: '86',
1884
+ flag: '🇨🇳',
1885
+ maxLocalDigits: 11
1886
+ },
1887
+ {
1888
+ code: 'JP',
1889
+ dialCode: '81',
1890
+ flag: '🇯🇵',
1891
+ maxLocalDigits: 10
1892
+ },
1893
+ {
1894
+ code: 'IN',
1895
+ dialCode: '91',
1896
+ flag: '🇮🇳',
1897
+ maxLocalDigits: 10
1898
+ },
1899
+ {
1900
+ code: 'AU',
1901
+ dialCode: '61',
1902
+ flag: '🇦🇺',
1903
+ maxLocalDigits: 9
1904
+ }
1905
+ ];
1906
+ function applyBrMask(digits) {
1907
+ if (digits.length <= 2) return `(${digits}`;
1908
+ if (digits.length <= 7) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
1909
+ if (digits.length <= 10) return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6)}`;
1910
+ return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
1911
+ }
1912
+ function applyUsMask(digits) {
1913
+ if (digits.length <= 3) return `(${digits}`;
1914
+ if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
1915
+ return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6, 10)}`;
1916
+ }
1917
+ function applyArMask(digits) {
1918
+ if (digits.length <= 2) return `(${digits}`;
1919
+ if (digits.length <= 6) return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
1920
+ return `(${digits.slice(0, 2)}) ${digits.slice(2, 6)}-${digits.slice(6, 10)}`;
1921
+ }
1922
+ function applyGenericMask(digits, areaLen, totalLen) {
1923
+ if (digits.length <= areaLen) return `(${digits}`;
1924
+ const area = digits.slice(0, areaLen);
1925
+ const rest = digits.slice(areaLen, totalLen);
1926
+ const mid = Math.floor(rest.length / 2 + rest.length % 2);
1927
+ if (rest.length <= mid) return `(${area}) ${rest}`;
1928
+ return `(${area}) ${rest.slice(0, mid)}-${rest.slice(mid)}`;
1929
+ }
1930
+ function applyMask(digits, countryCode) {
1931
+ switch(countryCode){
1932
+ case 'BR':
1933
+ return applyBrMask(digits);
1934
+ case 'US':
1935
+ case 'CA':
1936
+ return applyUsMask(digits);
1937
+ case 'MX':
1938
+ case 'CO':
1939
+ case 'VE':
1940
+ return applyGenericMask(digits, 2, 10);
1941
+ case 'AR':
1942
+ return applyArMask(digits);
1943
+ case 'CL':
1944
+ case 'PE':
1945
+ case 'PT':
1946
+ case 'ES':
1947
+ case 'AU':
1948
+ case 'ZA':
1949
+ case 'AO':
1950
+ case 'MZ':
1951
+ return applyGenericMask(digits, 2, 9);
1952
+ case 'UY':
1953
+ case 'BO':
1954
+ return applyGenericMask(digits, 1, 8);
1955
+ case 'PY':
1956
+ return applyGenericMask(digits, 3, 9);
1957
+ case 'FR':
1958
+ return applyGenericMask(digits, 2, 9);
1959
+ case 'IT':
1960
+ return applyGenericMask(digits, 3, 10);
1961
+ case 'DE':
1962
+ return applyGenericMask(digits, 3, 11);
1963
+ case 'GB':
1964
+ return applyGenericMask(digits, 4, 10);
1965
+ case 'CN':
1966
+ return applyGenericMask(digits, 3, 11);
1967
+ case 'JP':
1968
+ return applyGenericMask(digits, 3, 10);
1969
+ case 'IN':
1970
+ return applyGenericMask(digits, 5, 10);
1971
+ default:
1972
+ return digits;
1973
+ }
1974
+ }
1975
+ function detectCountry(fullDigits) {
1976
+ if (!fullDigits) return COUNTRIES[0];
1977
+ const sorted = [
1978
+ ...COUNTRIES
1979
+ ].sort((a, b)=>b.dialCode.length - a.dialCode.length);
1980
+ for (const c of sorted)if (fullDigits.startsWith(c.dialCode)) return c;
1981
+ return COUNTRIES[0];
1982
+ }
1983
+ const PhoneInput = ({ value, onChange, disabled, size, placeholder })=>{
1984
+ const { t } = useCodebitWebAntdTranslation();
1985
+ const countrySearchLabel = (c)=>{
1986
+ const name = t(`PhoneInput.countries.${c.code}`);
1987
+ return `${c.flag} ${name} +${c.dialCode}`;
1988
+ };
1989
+ const [selectedCountry, setSelectedCountry] = (0, external_react_.useState)(()=>detectCountry(value));
1990
+ const [displayValue, setDisplayValue] = (0, external_react_.useState)(()=>{
1991
+ if (!value) return '';
1992
+ const country = detectCountry(value);
1993
+ const localDigits = value.slice(country.dialCode.length);
1994
+ return applyMask(localDigits, country.code);
1995
+ });
1710
1996
  (0, external_react_.useEffect)(()=>{
1711
- const computeSelectedKey = ()=>{
1712
- const match = allMenuItems.find((item)=>item.key ? (0, external_react_router_namespaceObject.matchPath)({
1713
- path: item.key,
1714
- end: true
1715
- }, location.pathname) : false);
1716
- return match?.key ?? '';
1717
- };
1718
- setSelectedKeys(computeSelectedKey());
1719
- }, [
1720
- location.pathname,
1721
- allMenuItems
1722
- ]);
1723
- const handleLogout = (0, external_react_.useCallback)(async ()=>{
1724
- await logout?.();
1725
- if (isMobile) setDrawerVisible(false);
1726
- navigate('/');
1727
- }, [
1728
- logout,
1729
- isMobile,
1730
- setDrawerVisible,
1731
- navigate
1732
- ]);
1733
- const handleMenuClick = (0, external_react_.useCallback)(async (key)=>{
1734
- if (onMenuClick?.(key) === false) return;
1735
- try {
1736
- if (key === MENU_KEY_APP_LOGOUT) return void await handleLogout();
1737
- navigate(key);
1738
- } finally{
1739
- if (isMobile) setDrawerVisible(false);
1740
- }
1997
+ if (!value) return void setDisplayValue('');
1998
+ const country = detectCountry(value);
1999
+ setSelectedCountry(country);
2000
+ const localDigits = value.slice(country.dialCode.length);
2001
+ setDisplayValue(applyMask(localDigits, country.code));
1741
2002
  }, [
1742
- onMenuClick,
1743
- handleLogout,
1744
- navigate,
1745
- isMobile,
1746
- setDrawerVisible
1747
- ]);
1748
- const primaryMenu = (0, external_react_.useMemo)(()=>/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1749
- theme: theme,
1750
- mode: 'inline',
1751
- selectedKeys: selectedKeys ? [
1752
- selectedKeys
1753
- ] : [],
1754
- onClick: ({ key })=>handleMenuClick(key),
1755
- items: filteredMenuItems,
1756
- className: LoggedMainContainer_module.menu
1757
- }, 'primary-menu'), [
1758
- selectedKeys,
1759
- filteredMenuItems,
1760
- theme,
1761
- handleMenuClick
2003
+ value
1762
2004
  ]);
1763
- (0, external_react_.useEffect)(()=>{
1764
- const checkScreenSize = ()=>setIsMobile(window.innerWidth < 768);
1765
- checkScreenSize();
1766
- window.addEventListener('resize', checkScreenSize);
1767
- return ()=>window.removeEventListener('resize', checkScreenSize);
1768
- }, []);
1769
- const menuContent = /*#__PURE__*/ (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
1770
- children: [
1771
- primaryMenu,
1772
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
1773
- className: LoggedMainContainer_module.menuSpacer
1774
- }),
1775
- showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1776
- motion: false,
1777
- theme: theme,
1778
- mode: 'horizontal',
1779
- className: LoggedMainContainer_module.versionMenu,
1780
- disabled: true,
1781
- items: [
1782
- {
1783
- icon: collapsed ? version : `${t('LoggedMainContainer.version')}: ${version}`,
1784
- title: ''
1785
- }
1786
- ]
1787
- }, 'version-menu'),
1788
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1789
- motion: false,
1790
- theme: theme,
1791
- mode: 'inline',
1792
- selectedKeys: selectedKeys ? [
1793
- selectedKeys
1794
- ] : [],
1795
- onClick: ({ key })=>handleMenuClick(key),
1796
- className: LoggedMainContainer_module.bottomMenu,
1797
- items: memoizedBottomMenuItems
1798
- }, 'bottom-menu')
1799
- ]
1800
- });
1801
- const renderMenuContent = ()=>{
1802
- if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
1803
- placement: 'left',
1804
- onClose: ()=>setDrawerVisible(false),
1805
- open: drawerVisible,
1806
- size: 250,
1807
- className: LoggedMainContainer_module.drawer,
1808
- classNames: {
1809
- body: LoggedMainContainer_module.drawerBody
1810
- },
1811
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Flex, {
1812
- vertical: true,
1813
- className: LoggedMainContainer_module.drawerFlex,
1814
- children: menuContent
1815
- })
1816
- });
1817
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1818
- theme: theme,
1819
- trigger: null,
1820
- collapsible: true,
1821
- collapsed: collapsed,
1822
- breakpoint: 'lg',
1823
- collapsedWidth: 80,
1824
- className: LoggedMainContainer_module.sider,
1825
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
1826
- className: LoggedMainContainer_module.siderLayout,
1827
- children: menuContent
1828
- })
1829
- });
2005
+ const handleCountryChange = (countryCode)=>{
2006
+ const country = COUNTRIES.find((c)=>c.code === countryCode) ?? COUNTRIES[0];
2007
+ setSelectedCountry(country);
2008
+ setDisplayValue('');
2009
+ onChange?.('');
1830
2010
  };
1831
- const renderSecondarySidebar = ()=>{
1832
- if (!secondarySidebar) return null;
1833
- if (isMobile) return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
1834
- placement: 'right',
1835
- onClose: ()=>setSecondarySidebarDrawerVisible(false),
1836
- open: secondarySidebarDrawerVisible,
1837
- size: 280,
1838
- className: LoggedMainContainer_module.drawer,
1839
- title: null,
1840
- closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
1841
- children: secondarySidebar(user)
1842
- });
1843
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1844
- theme: theme,
1845
- width: secondarySidebarWidth,
1846
- children: secondarySidebar(user)
1847
- });
2011
+ const handleInputChange = (e)=>{
2012
+ const rawDigits = e.target.value.replaceAll(/\D/g, '').slice(0, selectedCountry.maxLocalDigits);
2013
+ setDisplayValue(applyMask(rawDigits, selectedCountry.code));
2014
+ onChange?.(selectedCountry.dialCode + rawDigits);
1848
2015
  };
1849
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
1850
- className: LoggedMainContainer_module.layout,
1851
- children: [
1852
- renderMenuContent(),
1853
- renderSecondarySidebar(),
1854
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
1855
- children: [
1856
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
1857
- className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1858
- children: [
1859
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
1860
- children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1861
- type: 'text',
1862
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
1863
- onClick: ()=>setDrawerVisible(true)
1864
- }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1865
- type: 'text',
1866
- icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
1867
- onClick: ()=>setCollapsed(!collapsed)
1868
- })
1869
- }),
1870
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1871
- size: isMobile ? 'small' : 'middle',
1872
- className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1873
- children: [
1874
- secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1875
- type: 'text',
1876
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.WechatOutlined, {}),
1877
- onClick: ()=>setSecondarySidebarDrawerVisible(true)
1878
- }),
1879
- !isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
1880
- children: t('LoggedMainContainer.theme')
1881
- }),
1882
- /*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
1883
- ]
1884
- })
1885
- ]
1886
- }),
1887
- /*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
1888
- className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1889
- children: children
1890
- })
1891
- ]
1892
- })
1893
- ]
2016
+ const countrySelector = /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Select, {
2017
+ value: selectedCountry.code,
2018
+ onChange: handleCountryChange,
2019
+ disabled: disabled,
2020
+ size: size,
2021
+ style: {
2022
+ width: 110
2023
+ },
2024
+ popupMatchSelectWidth: false,
2025
+ showSearch: true,
2026
+ filterOption: (input, option)=>option?.searchLabel?.toLowerCase().includes(input.toLowerCase()) ?? false,
2027
+ options: COUNTRIES.map((c)=>({
2028
+ value: c.code,
2029
+ label: `${c.flag} +${c.dialCode}`,
2030
+ searchLabel: countrySearchLabel(c)
2031
+ })),
2032
+ optionRender: (option)=>option.data.searchLabel
1894
2033
  });
1895
- }
1896
- LoggedMainContainer.propTypes = {
1897
- children: external_prop_types_default().node.isRequired
2034
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
2035
+ addonBefore: countrySelector,
2036
+ value: displayValue,
2037
+ onChange: handleInputChange,
2038
+ disabled: disabled,
2039
+ size: size,
2040
+ placeholder: placeholder
2041
+ });
2042
+ };
2043
+ PhoneInput.propTypes = {
2044
+ value: external_prop_types_default().string,
2045
+ onChange: external_prop_types_default().func,
2046
+ disabled: external_prop_types_default().bool,
2047
+ size: external_prop_types_default().oneOf([
2048
+ 'large',
2049
+ 'middle',
2050
+ 'small'
2051
+ ]),
2052
+ placeholder: external_prop_types_default().string
2053
+ };
2054
+ PhoneInput.format = (fullDigits)=>{
2055
+ if (!fullDigits) return '';
2056
+ const country = detectCountry(fullDigits);
2057
+ const localDigits = fullDigits.slice(country.dialCode.length);
2058
+ const masked = applyMask(localDigits, country.code);
2059
+ return `${country.flag} +${country.dialCode} ${masked}`;
1898
2060
  };
1899
2061
  const Login_module = {
1900
2062
  containerRow: "containerRow-lnjnDt",
@@ -2508,7 +2670,7 @@ var __webpack_exports__ = {};
2508
2670
  hasUpperCase: /[A-Z]/.test(value),
2509
2671
  hasLowerCase: /[a-z]/.test(value),
2510
2672
  hasNumbers: /\d/.test(value),
2511
- hasSpecialChars: /[!@#$%^&*(),.?":{}|<>]/.test(value)
2673
+ hasSpecialChars: /[^a-zA-Z0-9\s]/.test(value)
2512
2674
  };
2513
2675
  const failedChecks = Object.entries(strengthChecks).filter(([, passes])=>!passes).map(([key])=>key);
2514
2676
  if (0 === failedChecks.length) return Promise.resolve();
@@ -2697,6 +2859,7 @@ exports.OllamaOutlinedIcon = __webpack_exports__.OllamaOutlinedIcon;
2697
2859
  exports.PhoneInput = __webpack_exports__.PhoneInput;
2698
2860
  exports.TableContainer = __webpack_exports__.TableContainer;
2699
2861
  exports.ThemeToggle = __webpack_exports__.ThemeToggle;
2862
+ exports.UserMenu = __webpack_exports__.UserMenu;
2700
2863
  exports.useErrorMessage = __webpack_exports__.useErrorMessage;
2701
2864
  exports.useErrorModal = __webpack_exports__.useErrorModal;
2702
2865
  for(var __rspack_i in __webpack_exports__)if (-1 === [
@@ -2724,6 +2887,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
2724
2887
  "PhoneInput",
2725
2888
  "TableContainer",
2726
2889
  "ThemeToggle",
2890
+ "UserMenu",
2727
2891
  "useErrorMessage",
2728
2892
  "useErrorModal"
2729
2893
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];