@nocios/crudify-components 2.0.36 → 2.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/coverage/components/CrudiaAutoGenerate.tsx.html +583 -0
  2. package/coverage/components/CrudiaFileField/CrudiaFileField.tsx.html +1276 -0
  3. package/coverage/components/CrudiaFileField/components/DeleteConfirmationDialog.tsx.html +355 -0
  4. package/coverage/components/CrudiaFileField/components/DropZone.tsx.html +433 -0
  5. package/coverage/components/CrudiaFileField/components/FileItemRow.tsx.html +751 -0
  6. package/coverage/components/CrudiaFileField/components/FileThumbnail.tsx.html +1195 -0
  7. package/coverage/components/CrudiaFileField/components/index.html +176 -0
  8. package/coverage/components/CrudiaFileField/components/index.ts.html +115 -0
  9. package/coverage/components/CrudiaFileField/hooks/index.html +146 -0
  10. package/coverage/components/CrudiaFileField/hooks/index.ts.html +112 -0
  11. package/coverage/components/CrudiaFileField/hooks/useDeleteConfirmation.ts.html +421 -0
  12. package/coverage/components/CrudiaFileField/hooks/useDragDrop.ts.html +403 -0
  13. package/coverage/components/CrudiaFileField/index.html +131 -0
  14. package/coverage/components/CrudiaFileField/index.ts.html +112 -0
  15. package/coverage/components/CrudiaFileField/utils/formatters.ts.html +163 -0
  16. package/coverage/components/CrudiaFileField/utils/icons.tsx.html +253 -0
  17. package/coverage/components/CrudiaFileField/utils/index.html +131 -0
  18. package/coverage/components/CrudiaMarkdownField.tsx.html +619 -0
  19. package/coverage/components/CrudifyLogin/Forms/CheckCodeForm.tsx.html +586 -0
  20. package/coverage/components/CrudifyLogin/Forms/ForgotPasswordForm.tsx.html +694 -0
  21. package/coverage/components/CrudifyLogin/Forms/LoginForm.tsx.html +835 -0
  22. package/coverage/components/CrudifyLogin/Forms/ResetPasswordForm.tsx.html +1180 -0
  23. package/coverage/components/CrudifyLogin/Forms/components/CodeInput.tsx.html +283 -0
  24. package/coverage/components/CrudifyLogin/Forms/components/FormAlert.tsx.html +202 -0
  25. package/coverage/components/CrudifyLogin/Forms/components/PasswordInput.tsx.html +340 -0
  26. package/coverage/components/CrudifyLogin/Forms/components/index.html +161 -0
  27. package/coverage/components/CrudifyLogin/Forms/components/index.ts.html +106 -0
  28. package/coverage/components/CrudifyLogin/Forms/index.html +161 -0
  29. package/coverage/components/CrudifyLogin/Forms/utils/errorTranslation.ts.html +268 -0
  30. package/coverage/components/CrudifyLogin/Forms/utils/index.html +161 -0
  31. package/coverage/components/CrudifyLogin/Forms/utils/index.ts.html +106 -0
  32. package/coverage/components/CrudifyLogin/Forms/utils/paramUtils.ts.html +478 -0
  33. package/coverage/components/CrudifyLogin/Forms/utils/validation.ts.html +289 -0
  34. package/coverage/components/CrudifyLogin/components/CrudifyInitializer.tsx.html +262 -0
  35. package/coverage/components/CrudifyLogin/components/index.html +116 -0
  36. package/coverage/components/CrudifyLogin/context/CrudifyProvider.tsx.html +382 -0
  37. package/coverage/components/CrudifyLogin/context/I18nProvider.tsx.html +397 -0
  38. package/coverage/components/CrudifyLogin/context/LoginStateProvider.tsx.html +1249 -0
  39. package/coverage/components/CrudifyLogin/context/index.html +146 -0
  40. package/coverage/components/CrudifyLogin/hooks/index.html +116 -0
  41. package/coverage/components/CrudifyLogin/hooks/useTranslationsFromUrl.ts.html +292 -0
  42. package/coverage/components/CrudifyLogin/index.html +116 -0
  43. package/coverage/components/CrudifyLogin/index.tsx.html +475 -0
  44. package/coverage/components/GlobalNotificationProvider.tsx.html +781 -0
  45. package/coverage/components/LoginComponent.tsx.html +727 -0
  46. package/coverage/components/PasswordRequirements/index.html +116 -0
  47. package/coverage/components/PasswordRequirements/index.tsx.html +226 -0
  48. package/coverage/components/PublicPolicies/FieldSelector/FieldSelector.tsx.html +982 -0
  49. package/coverage/components/PublicPolicies/FieldSelector/index.html +131 -0
  50. package/coverage/components/PublicPolicies/FieldSelector/index.ts.html +85 -0
  51. package/coverage/components/PublicPolicies/Policies.tsx.html +610 -0
  52. package/coverage/components/PublicPolicies/PolicyItem/PolicyItem.tsx.html +856 -0
  53. package/coverage/components/PublicPolicies/PolicyItem/index.html +131 -0
  54. package/coverage/components/PublicPolicies/PolicyItem/index.ts.html +85 -0
  55. package/coverage/components/PublicPolicies/constants.ts.html +127 -0
  56. package/coverage/components/PublicPolicies/index.html +131 -0
  57. package/coverage/components/SessionTimeIndicator/index.html +116 -0
  58. package/coverage/components/SessionTimeIndicator/index.tsx.html +505 -0
  59. package/coverage/components/UserProfile/UserProfileDisplay.tsx.html +826 -0
  60. package/coverage/components/UserProfile/index.html +131 -0
  61. package/coverage/components/UserProfile/index.ts.html +85 -0
  62. package/coverage/components/index.html +176 -0
  63. package/coverage/components/index.ts.html +160 -0
  64. package/coverage/core/CrossTabSyncManager.ts.html +814 -0
  65. package/coverage/core/CrudifyInitializationManager.ts.html +1132 -0
  66. package/coverage/core/SessionManager.ts.html +2764 -0
  67. package/coverage/core/index.html +146 -0
  68. package/coverage/coverage-final.json +52 -85
  69. package/coverage/hooks/index.html +131 -0
  70. package/coverage/hooks/useAutoGenerate.ts.html +562 -0
  71. package/coverage/hooks/useFileUpload/index.html +131 -0
  72. package/coverage/hooks/useFileUpload/index.ts.html +112 -0
  73. package/coverage/hooks/useFileUpload/services/index.html +116 -0
  74. package/coverage/hooks/useFileUpload/services/uploadService.ts.html +610 -0
  75. package/coverage/hooks/useFileUpload/useFileUpload.ts.html +1870 -0
  76. package/coverage/hooks/useFileUpload/utils/fileUtils.ts.html +271 -0
  77. package/coverage/hooks/useFileUpload/utils/index.html +146 -0
  78. package/coverage/hooks/useFileUpload/utils/mimeTypes.ts.html +235 -0
  79. package/coverage/hooks/useFileUpload/utils/validation.ts.html +379 -0
  80. package/coverage/hooks/useSession/constants.ts.html +217 -0
  81. package/coverage/hooks/useSession/hooks/index.html +176 -0
  82. package/coverage/hooks/useSession/hooks/useAuthEventSubscriber.ts.html +331 -0
  83. package/coverage/hooks/useSession/hooks/useCrossTabSync.ts.html +433 -0
  84. package/coverage/hooks/useSession/hooks/useSessionActions.ts.html +664 -0
  85. package/coverage/hooks/useSession/hooks/useSessionState.ts.html +295 -0
  86. package/coverage/hooks/useSession/hooks/useTokenRefreshScheduler.ts.html +490 -0
  87. package/coverage/hooks/useSession/index.html +161 -0
  88. package/coverage/hooks/useSession/index.ts.html +127 -0
  89. package/coverage/hooks/useSession/types.ts.html +427 -0
  90. package/coverage/hooks/useSession/useSession.ts.html +526 -0
  91. package/coverage/hooks/useSession/utils/index.html +131 -0
  92. package/coverage/hooks/useSession/utils/initializeSession.ts.html +424 -0
  93. package/coverage/hooks/useSession/utils/tokenUtils.ts.html +280 -0
  94. package/coverage/hooks/useUserProfile.ts.html +658 -0
  95. package/coverage/index.html +237 -357
  96. package/coverage/providers/SessionProvider.tsx.html +1150 -0
  97. package/coverage/providers/TranslationsProvider.tsx.html +1450 -0
  98. package/coverage/providers/index.html +131 -0
  99. package/coverage/services/credentialsEventBus.ts.html +310 -0
  100. package/coverage/services/index.html +131 -0
  101. package/coverage/services/translationService.ts.html +1318 -0
  102. package/coverage/translations/critical.ts.html +1195 -0
  103. package/coverage/translations/index.html +116 -0
  104. package/coverage/types/index.html +116 -0
  105. package/coverage/types/password.ts.html +178 -0
  106. package/coverage/utils/authEventBus.ts.html +454 -0
  107. package/coverage/utils/configResolver.ts.html +460 -0
  108. package/coverage/utils/cookieSync.ts.html +580 -0
  109. package/coverage/utils/errorHandler.ts.html +1264 -0
  110. package/coverage/utils/errorTranslation.ts.html +862 -0
  111. package/coverage/utils/index.html +296 -0
  112. package/coverage/utils/jwtUtils.ts.html +301 -0
  113. package/coverage/utils/logger.ts.html +901 -0
  114. package/coverage/utils/navigationTracker.ts.html +565 -0
  115. package/coverage/utils/passwordValidation.ts.html +259 -0
  116. package/coverage/utils/redirectSecurity.ts.html +715 -0
  117. package/coverage/utils/tenantConfig.ts.html +700 -0
  118. package/coverage/utils/tokenStorage.ts.html +1768 -0
  119. package/coverage/utils/webCrypto.ts.html +472 -0
  120. package/dist/{CrudiaMarkdownField-Bxl08sRG.d.mts → CrudiaMarkdownField-BvJn2GL8.d.mts} +5 -0
  121. package/dist/{CrudiaMarkdownField-DUJNOOzP.d.ts → CrudiaMarkdownField-CggOpcBM.d.ts} +5 -0
  122. package/dist/chunk-SYHNHKFA.mjs +1 -0
  123. package/dist/chunk-W4ZYKPOK.js +1 -0
  124. package/dist/components.d.mts +1 -1
  125. package/dist/components.d.ts +1 -1
  126. package/dist/components.js +1 -1
  127. package/dist/components.mjs +1 -1
  128. package/dist/index.d.mts +6 -2
  129. package/dist/index.d.ts +6 -2
  130. package/dist/index.js +2 -2
  131. package/dist/index.mjs +1 -1
  132. package/package.json +1 -1
  133. package/dist/chunk-QFACMV2I.mjs +0 -1
  134. package/dist/chunk-QZH3KSJZ.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQZH3KSJZjs = require('./chunk-QZH3KSJZ.js');var _chunkH6XXWDUTjs = require('./chunk-H6XXWDUT.js');require('./chunk-4LMFQECS.js');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function z({showBelowMinutes:f=5,position:m="bottom-right",colorNormal:c="#ed6c02",colorCritical:x="#d32f2f",style:u,className:g}={}){let{isAuthenticated:o,tokens:t}=_chunkH6XXWDUTjs.e.call(void 0, ),[i,y]=_react.useState.call(void 0, 0),[h,C]=_react.useState.call(void 0, 100);if(_react.useEffect.call(void 0, ()=>{if(!o||!t)return;let v=setInterval(()=>{let P=Date.now(),p=t.expiresAt-P,w=900*1e3;y(Math.max(0,p)),C(Math.max(0,p/w*100))},1e3);return()=>clearInterval(v)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),S=Math.floor(i%6e4/1e3);if(e>=f)return null;let s=e<2,a=s?x:c,b={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[m];return _jsxruntime.jsxs.call(void 0, "div",{className:g,style:{position:"fixed",...b,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...u},children:[_jsxruntime.jsxs.call(void 0, "div",{style:{marginBottom:"8px"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),_jsxruntime.jsxs.call(void 0, "div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",S.toString().padStart(2,"0")]})]}),_jsxruntime.jsx.call(void 0, "div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:_jsxruntime.jsx.call(void 0, "div",{style:{width:`${h}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}exports.CrudiaAutoGenerate = _chunkQZH3KSJZjs.v; exports.CrudiaFileField = _chunkQZH3KSJZjs.w; exports.CrudiaMarkdownField = _chunkQZH3KSJZjs.x; exports.CrudifyLogin = _chunkQZH3KSJZjs.o; exports.GlobalNotificationProvider = _chunkH6XXWDUTjs.f; exports.LoginComponent = _chunkQZH3KSJZjs.t; exports.Policies = _chunkQZH3KSJZjs.s; exports.SessionStatus = _chunkQZH3KSJZjs.u; exports.SessionTimeIndicator = z; exports.UserProfileDisplay = _chunkQZH3KSJZjs.p; exports.useGlobalNotification = _chunkH6XXWDUTjs.g;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkW4ZYKPOKjs = require('./chunk-W4ZYKPOK.js');var _chunkH6XXWDUTjs = require('./chunk-H6XXWDUT.js');require('./chunk-4LMFQECS.js');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function z({showBelowMinutes:f=5,position:m="bottom-right",colorNormal:c="#ed6c02",colorCritical:x="#d32f2f",style:u,className:g}={}){let{isAuthenticated:o,tokens:t}=_chunkH6XXWDUTjs.e.call(void 0, ),[i,y]=_react.useState.call(void 0, 0),[h,C]=_react.useState.call(void 0, 100);if(_react.useEffect.call(void 0, ()=>{if(!o||!t)return;let v=setInterval(()=>{let P=Date.now(),p=t.expiresAt-P,w=900*1e3;y(Math.max(0,p)),C(Math.max(0,p/w*100))},1e3);return()=>clearInterval(v)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),S=Math.floor(i%6e4/1e3);if(e>=f)return null;let s=e<2,a=s?x:c,b={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[m];return _jsxruntime.jsxs.call(void 0, "div",{className:g,style:{position:"fixed",...b,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...u},children:[_jsxruntime.jsxs.call(void 0, "div",{style:{marginBottom:"8px"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),_jsxruntime.jsxs.call(void 0, "div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",S.toString().padStart(2,"0")]})]}),_jsxruntime.jsx.call(void 0, "div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:_jsxruntime.jsx.call(void 0, "div",{style:{width:`${h}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}exports.CrudiaAutoGenerate = _chunkW4ZYKPOKjs.v; exports.CrudiaFileField = _chunkW4ZYKPOKjs.w; exports.CrudiaMarkdownField = _chunkW4ZYKPOKjs.x; exports.CrudifyLogin = _chunkW4ZYKPOKjs.o; exports.GlobalNotificationProvider = _chunkH6XXWDUTjs.f; exports.LoginComponent = _chunkW4ZYKPOKjs.t; exports.Policies = _chunkW4ZYKPOKjs.s; exports.SessionStatus = _chunkW4ZYKPOKjs.u; exports.SessionTimeIndicator = z; exports.UserProfileDisplay = _chunkW4ZYKPOKjs.p; exports.useGlobalNotification = _chunkH6XXWDUTjs.g;
@@ -1 +1 @@
1
- import{o as N,p as T,s as M,t as k,u as G,v as L,w as A,x as R}from"./chunk-QFACMV2I.mjs";import{e as d,f as F,g as I}from"./chunk-O4FUHIQG.mjs";import"./chunk-44VU4TSP.mjs";import{useEffect as B,useState as l}from"react";import{jsx as r,jsxs as n}from"react/jsx-runtime";function z({showBelowMinutes:f=5,position:m="bottom-right",colorNormal:c="#ed6c02",colorCritical:x="#d32f2f",style:u,className:g}={}){let{isAuthenticated:o,tokens:t}=d(),[i,y]=l(0),[h,C]=l(100);if(B(()=>{if(!o||!t)return;let v=setInterval(()=>{let P=Date.now(),p=t.expiresAt-P,w=900*1e3;y(Math.max(0,p)),C(Math.max(0,p/w*100))},1e3);return()=>clearInterval(v)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),S=Math.floor(i%6e4/1e3);if(e>=f)return null;let s=e<2,a=s?x:c,b={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[m];return n("div",{className:g,style:{position:"fixed",...b,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...u},children:[n("div",{style:{marginBottom:"8px"},children:[r("div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),n("div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",S.toString().padStart(2,"0")]})]}),r("div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:r("div",{style:{width:`${h}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}export{L as CrudiaAutoGenerate,A as CrudiaFileField,R as CrudiaMarkdownField,N as CrudifyLogin,F as GlobalNotificationProvider,k as LoginComponent,M as Policies,G as SessionStatus,z as SessionTimeIndicator,T as UserProfileDisplay,I as useGlobalNotification};
1
+ import{o as N,p as T,s as M,t as k,u as G,v as L,w as A,x as R}from"./chunk-SYHNHKFA.mjs";import{e as d,f as F,g as I}from"./chunk-O4FUHIQG.mjs";import"./chunk-44VU4TSP.mjs";import{useEffect as B,useState as l}from"react";import{jsx as r,jsxs as n}from"react/jsx-runtime";function z({showBelowMinutes:f=5,position:m="bottom-right",colorNormal:c="#ed6c02",colorCritical:x="#d32f2f",style:u,className:g}={}){let{isAuthenticated:o,tokens:t}=d(),[i,y]=l(0),[h,C]=l(100);if(B(()=>{if(!o||!t)return;let v=setInterval(()=>{let P=Date.now(),p=t.expiresAt-P,w=900*1e3;y(Math.max(0,p)),C(Math.max(0,p/w*100))},1e3);return()=>clearInterval(v)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),S=Math.floor(i%6e4/1e3);if(e>=f)return null;let s=e<2,a=s?x:c,b={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[m];return n("div",{className:g,style:{position:"fixed",...b,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...u},children:[n("div",{style:{marginBottom:"8px"},children:[r("div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),n("div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",S.toString().padStart(2,"0")]})]}),r("div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:r("div",{style:{width:`${h}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}export{L as CrudiaAutoGenerate,A as CrudiaFileField,R as CrudiaMarkdownField,N as CrudifyLogin,F as GlobalNotificationProvider,k as LoginComponent,M as Policies,G as SessionStatus,z as SessionTimeIndicator,T as UserProfileDisplay,I as useGlobalNotification};
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import crudify__default from '@nocios/crudify-sdk';
2
2
  export * from '@nocios/crudify-sdk';
3
3
  export { default as crudify } from '@nocios/crudify-sdk';
4
- import { d as CrudifyLoginConfig, l as PasswordRule, E as EvaluatedPasswordRule } from './CrudiaMarkdownField-Bxl08sRG.mjs';
5
- export { B as BoxScreenType, a as CrudiaAutoGenerate, i as CrudiaAutoGenerateProps, b as CrudiaFileField, o as CrudiaFileFieldDeletionHandlers, j as CrudiaFileFieldProps, c as CrudiaMarkdownField, k as CrudiaMarkdownFieldProps, C as CrudifyLogin, e as CrudifyLoginProps, f as CrudifyLoginTranslations, D as DEFAULT_PASSWORD_RULES, L as LoginComponent, m as POLICY_ACTIONS, n as PREFERRED_POLICY_ORDER, p as PasswordRuleType, P as Policies, h as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './CrudiaMarkdownField-Bxl08sRG.mjs';
4
+ import { d as CrudifyLoginConfig, l as PasswordRule, E as EvaluatedPasswordRule } from './CrudiaMarkdownField-BvJn2GL8.mjs';
5
+ export { B as BoxScreenType, a as CrudiaAutoGenerate, i as CrudiaAutoGenerateProps, b as CrudiaFileField, o as CrudiaFileFieldDeletionHandlers, j as CrudiaFileFieldProps, c as CrudiaMarkdownField, k as CrudiaMarkdownFieldProps, C as CrudifyLogin, e as CrudifyLoginProps, f as CrudifyLoginTranslations, D as DEFAULT_PASSWORD_RULES, L as LoginComponent, m as POLICY_ACTIONS, n as PREFERRED_POLICY_ORDER, p as PasswordRuleType, P as Policies, h as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './CrudiaMarkdownField-BvJn2GL8.mjs';
6
6
  import React, { ReactNode } from 'react';
7
7
  export { A as ApiError, f as CrudifyApiResponse, e as CrudifyEnvironment, l as CrudifyOperationOptions, m as CrudifyRequestOptions, g as CrudifyTransactionResponse, F as ForgotPasswordRequest, J as JwtPayload, i as LoginRequest, L as LoginResponse, j as ResetPasswordRequest, R as ResolvedTenantConfig, T as TenantConfig, a as TenantConfigOptions, o as TransactionInput, n as TransactionOperation, h as TransactionResponseData, U as UserProfile, V as ValidateCodeRequest, k as ValidationError, r as resolveTenantConfig, u as useTenantConfig } from './tenantConfig-DqJqQkoR.mjs';
8
8
  export { F as FileItem, v as FileStatus, L as LoginResult, N as NotificationOptions, a as SessionConfig, g as SessionDebugInfo, S as SessionManager, e as SessionProvider, h as SessionProviderProps, d as SessionState, c as StorageType, b as TokenData, T as TokenStorage, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, f as useSessionContext, i as useUserData, q as useUserProfile } from './index-U--xRr8A.mjs';
@@ -1004,6 +1004,8 @@ declare const CRITICAL_TRANSLATIONS: {
1004
1004
  readonly "base.titles.create": "Nuevo {{moduleName}}";
1005
1005
  readonly "base.titles.read": "Ver {{moduleName}}";
1006
1006
  readonly "base.titles.update": "Editar {{moduleName}}";
1007
+ readonly "base.success.transaction": "La operación se ha completado con éxito.";
1008
+ readonly "base.loading.executing": "Ejecutando operación...";
1007
1009
  readonly "checkCode.codeLabel": "Código de Verificación";
1008
1010
  readonly "checkCode.codePlaceholder": "Ingresa el código de 6 dígitos";
1009
1011
  readonly "checkCode.codeRequired": "El código es obligatorio";
@@ -1174,6 +1176,8 @@ declare const CRITICAL_TRANSLATIONS: {
1174
1176
  readonly "base.titles.create": "New {{moduleName}}";
1175
1177
  readonly "base.titles.read": "View {{moduleName}}";
1176
1178
  readonly "base.titles.update": "Edit {{moduleName}}";
1179
+ readonly "base.success.transaction": "The operation has been completed successfully.";
1180
+ readonly "base.loading.executing": "Processing…";
1177
1181
  readonly "checkCode.codeLabel": "Verification Code";
1178
1182
  readonly "checkCode.codePlaceholder": "Enter the 6-digit code";
1179
1183
  readonly "checkCode.codeRequired": "Code is required";
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import crudify__default from '@nocios/crudify-sdk';
2
2
  export * from '@nocios/crudify-sdk';
3
3
  export { default as crudify } from '@nocios/crudify-sdk';
4
- import { d as CrudifyLoginConfig, l as PasswordRule, E as EvaluatedPasswordRule } from './CrudiaMarkdownField-DUJNOOzP.js';
5
- export { B as BoxScreenType, a as CrudiaAutoGenerate, i as CrudiaAutoGenerateProps, b as CrudiaFileField, o as CrudiaFileFieldDeletionHandlers, j as CrudiaFileFieldProps, c as CrudiaMarkdownField, k as CrudiaMarkdownFieldProps, C as CrudifyLogin, e as CrudifyLoginProps, f as CrudifyLoginTranslations, D as DEFAULT_PASSWORD_RULES, L as LoginComponent, m as POLICY_ACTIONS, n as PREFERRED_POLICY_ORDER, p as PasswordRuleType, P as Policies, h as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './CrudiaMarkdownField-DUJNOOzP.js';
4
+ import { d as CrudifyLoginConfig, l as PasswordRule, E as EvaluatedPasswordRule } from './CrudiaMarkdownField-CggOpcBM.js';
5
+ export { B as BoxScreenType, a as CrudiaAutoGenerate, i as CrudiaAutoGenerateProps, b as CrudiaFileField, o as CrudiaFileFieldDeletionHandlers, j as CrudiaFileFieldProps, c as CrudiaMarkdownField, k as CrudiaMarkdownFieldProps, C as CrudifyLogin, e as CrudifyLoginProps, f as CrudifyLoginTranslations, D as DEFAULT_PASSWORD_RULES, L as LoginComponent, m as POLICY_ACTIONS, n as PREFERRED_POLICY_ORDER, p as PasswordRuleType, P as Policies, h as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './CrudiaMarkdownField-CggOpcBM.js';
6
6
  import React, { ReactNode } from 'react';
7
7
  export { A as ApiError, f as CrudifyApiResponse, e as CrudifyEnvironment, l as CrudifyOperationOptions, m as CrudifyRequestOptions, g as CrudifyTransactionResponse, F as ForgotPasswordRequest, J as JwtPayload, i as LoginRequest, L as LoginResponse, j as ResetPasswordRequest, R as ResolvedTenantConfig, T as TenantConfig, a as TenantConfigOptions, o as TransactionInput, n as TransactionOperation, h as TransactionResponseData, U as UserProfile, V as ValidateCodeRequest, k as ValidationError, r as resolveTenantConfig, u as useTenantConfig } from './tenantConfig-DqJqQkoR.js';
8
8
  export { F as FileItem, v as FileStatus, L as LoginResult, N as NotificationOptions, a as SessionConfig, g as SessionDebugInfo, S as SessionManager, e as SessionProvider, h as SessionProviderProps, d as SessionState, c as StorageType, b as TokenData, T as TokenStorage, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, f as useSessionContext, i as useUserData, q as useUserProfile } from './index-dXVRVcEB.js';
@@ -1004,6 +1004,8 @@ declare const CRITICAL_TRANSLATIONS: {
1004
1004
  readonly "base.titles.create": "Nuevo {{moduleName}}";
1005
1005
  readonly "base.titles.read": "Ver {{moduleName}}";
1006
1006
  readonly "base.titles.update": "Editar {{moduleName}}";
1007
+ readonly "base.success.transaction": "La operación se ha completado con éxito.";
1008
+ readonly "base.loading.executing": "Ejecutando operación...";
1007
1009
  readonly "checkCode.codeLabel": "Código de Verificación";
1008
1010
  readonly "checkCode.codePlaceholder": "Ingresa el código de 6 dígitos";
1009
1011
  readonly "checkCode.codeRequired": "El código es obligatorio";
@@ -1174,6 +1176,8 @@ declare const CRITICAL_TRANSLATIONS: {
1174
1176
  readonly "base.titles.create": "New {{moduleName}}";
1175
1177
  readonly "base.titles.read": "View {{moduleName}}";
1176
1178
  readonly "base.titles.update": "Edit {{moduleName}}";
1179
+ readonly "base.success.transaction": "The operation has been completed successfully.";
1180
+ readonly "base.loading.executing": "Processing…";
1177
1181
  readonly "checkCode.codeLabel": "Verification Code";
1178
1182
  readonly "checkCode.codePlaceholder": "Enter the 6-digit code";
1179
1183
  readonly "checkCode.codeRequired": "Code is required";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkQZH3KSJZjs = require('./chunk-QZH3KSJZ.js');var _chunkNIRLP2TCjs = require('./chunk-NIRLP2TC.js');var _chunkH6XXWDUTjs = require('./chunk-H6XXWDUT.js');var _chunkBXFEQ6KPjs = require('./chunk-BXFEQ6KP.js');var _chunk4LMFQECSjs = require('./chunk-4LMFQECS.js');var _crudifysdk = require('@nocios/crudify-sdk'); var _crudifysdk2 = _interopRequireDefault(_crudifysdk); _createStarExport(_crudifysdk);var _react = require('react');var _material = require('@mui/material');var _jsxruntime = require('react/jsx-runtime');var sr=(e={})=>{try{let r=_chunk4LMFQECSjs.b.call(void 0, );if(r.configSource!=="none"&&r.theme)return{...e,...r.theme}}catch(r){_chunk4LMFQECSjs.a.warn("Error reading theme from config",r instanceof Error?{errorMessage:r.message}:{message:String(r)})}return e};function ar({children:e,defaultTheme:r={},disableCssBaseline:t=!1}){let o=_react.useMemo.call(void 0, ()=>{let a=sr(r);return _material.createTheme.call(void 0, a)},[r]);return _jsxruntime.jsxs.call(void 0, _material.ThemeProvider,{theme:o,children:[!t&&_jsxruntime.jsx.call(void 0, _material.CssBaseline,{}),e]})}var _reactrouterdom = require('react-router-dom');var lr={border:"5px solid rgba(0, 0, 0, 0.1)",borderTopColor:"#3B82F6",borderRadius:"50%",width:"50px",height:"50px",animation:"spin 1s linear infinite"},cr=()=>_jsxruntime.jsx.call(void 0, "style",{children:`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkW4ZYKPOKjs = require('./chunk-W4ZYKPOK.js');var _chunkNIRLP2TCjs = require('./chunk-NIRLP2TC.js');var _chunkH6XXWDUTjs = require('./chunk-H6XXWDUT.js');var _chunkBXFEQ6KPjs = require('./chunk-BXFEQ6KP.js');var _chunk4LMFQECSjs = require('./chunk-4LMFQECS.js');var _crudifysdk = require('@nocios/crudify-sdk'); var _crudifysdk2 = _interopRequireDefault(_crudifysdk); _createStarExport(_crudifysdk);var _react = require('react');var _material = require('@mui/material');var _jsxruntime = require('react/jsx-runtime');var sr=(e={})=>{try{let r=_chunk4LMFQECSjs.b.call(void 0, );if(r.configSource!=="none"&&r.theme)return{...e,...r.theme}}catch(r){_chunk4LMFQECSjs.a.warn("Error reading theme from config",r instanceof Error?{errorMessage:r.message}:{message:String(r)})}return e};function ar({children:e,defaultTheme:r={},disableCssBaseline:t=!1}){let o=_react.useMemo.call(void 0, ()=>{let a=sr(r);return _material.createTheme.call(void 0, a)},[r]);return _jsxruntime.jsxs.call(void 0, _material.ThemeProvider,{theme:o,children:[!t&&_jsxruntime.jsx.call(void 0, _material.CssBaseline,{}),e]})}var _reactrouterdom = require('react-router-dom');var lr={border:"5px solid rgba(0, 0, 0, 0.1)",borderTopColor:"#3B82F6",borderRadius:"50%",width:"50px",height:"50px",animation:"spin 1s linear infinite"},cr=()=>_jsxruntime.jsx.call(void 0, "style",{children:`
2
2
  @keyframes spin {
3
3
  0% { transform: rotate(0deg); }
4
4
  100% { transform: rotate(360deg); }
5
5
  }
6
- `});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, cr,{}),_jsxruntime.jsxs.call(void 0, "div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"#f0f2f5",fontFamily:'"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',color:"#333",textAlign:"center",boxSizing:"border-box",padding:"20px",background:"#fff"},children:[_jsxruntime.jsx.call(void 0, "div",{style:lr}),_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.25em",fontWeight:"500",marginTop:"24px",color:"#1f2937"},children:o})]})]})}function _({children:e,loadingComponent:r,loginPath:t="/login"}){let{isAuthenticated:o,isLoading:a,isLoggingOut:s,isInitialized:y,tokens:l,error:f}=_chunkH6XXWDUTjs.l.call(void 0, ),u=_reactrouterdom.useLocation.call(void 0, );if(!y||a&&!s)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:r||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})});let c=o&&_optionalChain([l, 'optionalAccess', _2 => _2.accessToken])&&l.accessToken.length>0;if(f||!o||!c){if(s)return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let C=u.pathname+u.search;if(u.pathname===t||u.pathname.startsWith(t))return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let T=_chunkQZH3KSJZjs.h.call(void 0, C),k=encodeURIComponent(T);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:`${t}?redirect=${k}`,replace:!0})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}var L="crudify_tokens",mr="crudify_enc_key";function B(){try{let e=localStorage.getItem(L);return e?e.startsWith("v2:")&&e.length>50:!1}catch (e2){return!1}}function W(){try{let e=localStorage.getItem(mr);return e!==null&&e.length>=32}catch (e3){return!1}}function U(){return B()&&W()}function H(){try{let e=localStorage.getItem(L);return e?!e.startsWith("v2:")||e.length<50:!1}catch (e4){return!1}}function gr(){try{H()&&localStorage.removeItem(L)}catch (e5){}}function Y({children:e,redirectTo:r="/",loadingComponent:t,initTimeout:o=3e3}){let{isAuthenticated:a,isInitialized:s}=_chunkH6XXWDUTjs.l.call(void 0, ),y=_reactrouterdom.useLocation.call(void 0, ),[l]=_react.useState.call(void 0, ()=>U()),[f,u]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>{if(!s&&l){let c=setTimeout(()=>{u(!0)},o);return()=>clearTimeout(c)}},[s,l,o]),s&&a){let c=new URLSearchParams(y.search),C=_chunkQZH3KSJZjs.j.call(void 0, c,r);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:C,replace:!0})}return s&&!a?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):l&&!f?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}function J({children:e,behavior:r="redirect-if-authenticated",redirectTo:t="/",loadingComponent:o}){let{isAuthenticated:a,isInitialized:s}=_chunkH6XXWDUTjs.l.call(void 0, );return s?r==="allow-all"?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):a?_jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})})}var X=_react.createContext.call(void 0, void 0),hr= exports.CrudifyInitializer =({config:e,children:r,fallback:t=null,onInitialized:o,onError:a})=>{let[s,y]=_react.useState.call(void 0, !1),[l,f]=_react.useState.call(void 0, !1),[u,c]=_react.useState.call(void 0, null),C=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{C.current||(_chunkH6XXWDUTjs.q.registerHighPriorityInitializer(),C.current=!0),T.current||(T.current=!0,(async()=>{f(!0),c(null);try{let d=_chunk4LMFQECSjs.d.call(void 0, {publicApiKey:_optionalChain([e, 'optionalAccess', _3 => _3.publicApiKey]),env:_optionalChain([e, 'optionalAccess', _4 => _4.env]),enableDebug:_optionalChain([e, 'optionalAccess', _5 => _5.enableLogging])});if(!d.publicApiKey)throw new Error("Crudify configuration missing. Please provide publicApiKey via props or ensure cookies are set by Lambda.");let v=d.env||"prod";_chunk4LMFQECSjs.a.setEnvironment(v),await _chunkH6XXWDUTjs.q.initialize({priority:"HIGH",publicApiKey:d.publicApiKey,env:d.env||"prod",enableLogging:_optionalChain([e, 'optionalAccess', _6 => _6.enableLogging]),requestedBy:"CrudifyInitializer"}),y(!0),f(!1),o&&o()}catch(d){let v=d instanceof Error?d:new Error(String(d));c(v),f(!1),a&&a(v)}})())},[_optionalChain([e, 'optionalAccess', _7 => _7.publicApiKey]),_optionalChain([e, 'optionalAccess', _8 => _8.env]),_optionalChain([e, 'optionalAccess', _9 => _9.enableLogging]),o,a]);let k={isInitialized:s,isInitializing:l,error:u};return l&&t?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t}):(u&&_chunk4LMFQECSjs.a.error("[CrudifyInitializer] Initialization failed",u),_jsxruntime.jsx.call(void 0, X.Provider,{value:k,children:r}))},Tr= exports.useCrudifyInitializer =()=>{let e=_react.useContext.call(void 0, X);if(!e)throw new Error("useCrudifyInitializer must be used within CrudifyInitializer");return e};var _crudifyadminsdk = require('@nocios/crudify-admin-sdk'); var _crudifyadminsdk2 = _interopRequireDefault(_crudifyadminsdk);var Z=!1,I=null,h=null;async function Sr(){let r=await _chunkH6XXWDUTjs.d.getInstance().getTokenInfo(),t=_optionalChain([r, 'optionalAccess', _10 => _10.apiEndpointAdmin]),o=_optionalChain([r, 'optionalAccess', _11 => _11.apiKeyEndpointAdmin]);return t&&o?{apiUrl:t,apiKey:o}:_chunkH6XXWDUTjs.h.waitForCredentials()}async function Er(){if(!Z)return I||(I=(async()=>{try{let e=_chunkH6XXWDUTjs.d.getInstance(),{apiUrl:r,apiKey:t}=await Sr();h=await _asyncOptionalChain([(await e.getTokenInfo()), 'optionalAccess', async _12 => _12.crudifyTokens, 'optionalAccess', async _13 => _13.accessToken])||null,_crudifyadminsdk2.default.init({url:r,apiKey:t,getAdditionalHeaders:()=>h?{Authorization:`Bearer ${h}`}:{}}),Z=!0}catch(e){throw I=null,_chunk4LMFQECSjs.a.error("[crudifyAdminWrapper] Initialization failed",e instanceof Error?e:{message:String(e)}),e}})(),I)}async function n(e){try{await Er();let r=_chunkH6XXWDUTjs.d.getInstance();h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _14 => _14.crudifyTokens, 'optionalAccess', async _15 => _15.accessToken])||null;let o=await e(),a=o.errors&&(typeof o.errors=="string"&&o.errors.includes("401")||Array.isArray(o.errors)&&o.errors.some(s=>typeof s=="string"&&s.includes("401")));return!o.success&&a?await r.refreshTokens()?(h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _16 => _16.crudifyTokens, 'optionalAccess', async _17 => _17.accessToken])||null,await e()):(_chunk4LMFQECSjs.a.error("[crudifyAdmin] Token refresh failed"),typeof window<"u"&&(window.location.href="/login"),o):o}catch(r){return _chunk4LMFQECSjs.a.error("[crudifyAdmin] Operation error",r instanceof Error?r:{message:String(r)}),{success:!1,errors:r instanceof Error?r.message:"Unknown error"}}}var kr={listModules:()=>n(()=>_crudifyadminsdk2.default.listModules()),getModule:e=>n(()=>_crudifyadminsdk2.default.getModule(e)),createModule:e=>n(()=>_crudifyadminsdk2.default.createModule(e)),editModule:(e,r)=>n(()=>_crudifyadminsdk2.default.editModule(e,r)),deleteModule:e=>n(()=>_crudifyadminsdk2.default.deleteModule(e)),activateModule:e=>n(()=>_crudifyadminsdk2.default.activateModule(e)),deactivateModule:e=>n(()=>_crudifyadminsdk2.default.deactivateModule(e)),getModuleVersions:e=>n(()=>_crudifyadminsdk2.default.getModuleVersions(e)),listActions:e=>n(()=>_crudifyadminsdk2.default.listActions(e)),getAction:e=>n(()=>_crudifyadminsdk2.default.getAction(e)),createAction:e=>n(()=>_crudifyadminsdk2.default.createAction(e)),editAction:(e,r)=>n(()=>_crudifyadminsdk2.default.editAction(e,r)),deleteAction:e=>n(()=>_crudifyadminsdk2.default.deleteAction(e)),activateAction:e=>n(()=>_crudifyadminsdk2.default.activateAction(e)),deactivateAction:e=>n(()=>_crudifyadminsdk2.default.deactivateAction(e)),getActionVersions:e=>n(()=>_crudifyadminsdk2.default.getActionVersions(e)),getActionsByProfile:e=>n(()=>_crudifyadminsdk2.default.getActionsByProfile(e)),updateActionsProfiles:e=>n(()=>_crudifyadminsdk2.default.updateActionsProfiles(e)),calculatePermissions:e=>n(()=>_crudifyadminsdk2.default.calculatePermissions(e))};exports.AuthRoute = Y; exports.CRITICAL_TRANSLATIONS = _chunkQZH3KSJZjs.a; exports.CrossTabSyncManager = _chunkH6XXWDUTjs.b; exports.CrudiaAutoGenerate = _chunkQZH3KSJZjs.v; exports.CrudiaFileField = _chunkQZH3KSJZjs.w; exports.CrudiaMarkdownField = _chunkQZH3KSJZjs.x; exports.CrudifyInitializationManager = _chunkH6XXWDUTjs.p; exports.CrudifyInitializer = hr; exports.CrudifyLogin = _chunkQZH3KSJZjs.o; exports.CrudifyProvider = _chunkH6XXWDUTjs.i; exports.CrudifyThemeProvider = ar; exports.DEFAULT_PASSWORD_RULES = _chunkQZH3KSJZjs.n; exports.ERROR_CODES = _chunk4LMFQECSjs.u; exports.ERROR_SEVERITY_MAP = _chunk4LMFQECSjs.v; exports.GlobalNotificationProvider = _chunkH6XXWDUTjs.f; exports.GuestRoute = J; exports.LoginComponent = _chunkQZH3KSJZjs.t; exports.POLICY_ACTIONS = _chunkQZH3KSJZjs.q; exports.PREFERRED_POLICY_ORDER = _chunkQZH3KSJZjs.r; exports.PasswordRequirements = _chunkQZH3KSJZjs.k; exports.Policies = _chunkQZH3KSJZjs.s; exports.ProtectedRoute = _; exports.SessionDebugInfo = _chunkH6XXWDUTjs.m; exports.SessionLoadingScreen = g; exports.SessionManager = _chunkH6XXWDUTjs.d; exports.SessionProvider = _chunkH6XXWDUTjs.k; exports.SessionStatus = _chunkQZH3KSJZjs.u; exports.TokenStorage = _chunkH6XXWDUTjs.a; exports.TranslationService = _chunkQZH3KSJZjs.d; exports.TranslationsProvider = _chunkQZH3KSJZjs.f; exports.UserProfileDisplay = _chunkQZH3KSJZjs.p; exports.allPasswordRulesPassed = _chunkQZH3KSJZjs.m; exports.clearCorruptedTokens = gr; exports.createErrorTranslator = _chunk4LMFQECSjs.p; exports.crossTabSync = _chunkH6XXWDUTjs.c; exports.crudify = _crudifysdk2.default; exports.crudifyAdmin = kr; exports.crudifyInitManager = _chunkH6XXWDUTjs.q; exports.decodeJwtSafely = _chunk4LMFQECSjs.r; exports.evaluatePasswordRules = _chunkQZH3KSJZjs.l; exports.extractSafeRedirectFromUrl = _chunkQZH3KSJZjs.j; exports.getCriticalLanguages = _chunkQZH3KSJZjs.b; exports.getCriticalTranslations = _chunkQZH3KSJZjs.c; exports.getCurrentUserEmail = _chunk4LMFQECSjs.s; exports.getErrorMessage = _chunk4LMFQECSjs.y; exports.handleCrudifyError = _chunk4LMFQECSjs.A; exports.hasCorruptedTokens = H; exports.hasEncryptionKeyHash = W; exports.hasStoredTokens = B; exports.isTokenExpired = _chunk4LMFQECSjs.t; exports.logger = _chunk4LMFQECSjs.a; exports.parseApiError = _chunk4LMFQECSjs.w; exports.parseJavaScriptError = _chunk4LMFQECSjs.z; exports.parseTransactionError = _chunk4LMFQECSjs.x; exports.resolveTenantConfig = _chunk4LMFQECSjs.b; exports.secureLocalStorage = _chunkBXFEQ6KPjs.b; exports.secureSessionStorage = _chunkBXFEQ6KPjs.a; exports.shouldWaitForInitialization = U; exports.translateError = _chunk4LMFQECSjs.o; exports.translateErrorCode = _chunk4LMFQECSjs.m; exports.translateErrorCodes = _chunk4LMFQECSjs.n; exports.translationService = _chunkQZH3KSJZjs.e; exports.useAuth = _chunkNIRLP2TCjs.b; exports.useAutoGenerate = _chunkH6XXWDUTjs.o; exports.useCrudify = _chunkH6XXWDUTjs.j; exports.useCrudifyInitializer = Tr; exports.useCrudifyWithNotifications = _chunkNIRLP2TCjs.d; exports.useData = _chunkNIRLP2TCjs.c; exports.useFileUpload = _chunkH6XXWDUTjs.r; exports.useGlobalNotification = _chunkH6XXWDUTjs.g; exports.useSession = _chunkH6XXWDUTjs.e; exports.useSessionContext = _chunkH6XXWDUTjs.l; exports.useTenantConfig = _chunk4LMFQECSjs.c; exports.useTranslations = _chunkQZH3KSJZjs.g; exports.useUserData = _chunkNIRLP2TCjs.a; exports.useUserProfile = _chunkH6XXWDUTjs.n; exports.validateInternalRedirect = _chunkQZH3KSJZjs.h; exports.validateTrustedRedirect = _chunkQZH3KSJZjs.i;
6
+ `});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, cr,{}),_jsxruntime.jsxs.call(void 0, "div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"#f0f2f5",fontFamily:'"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',color:"#333",textAlign:"center",boxSizing:"border-box",padding:"20px",background:"#fff"},children:[_jsxruntime.jsx.call(void 0, "div",{style:lr}),_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.25em",fontWeight:"500",marginTop:"24px",color:"#1f2937"},children:o})]})]})}function _({children:e,loadingComponent:r,loginPath:t="/login"}){let{isAuthenticated:o,isLoading:a,isLoggingOut:s,isInitialized:y,tokens:l,error:f}=_chunkH6XXWDUTjs.l.call(void 0, ),u=_reactrouterdom.useLocation.call(void 0, );if(!y||a&&!s)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:r||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})});let c=o&&_optionalChain([l, 'optionalAccess', _2 => _2.accessToken])&&l.accessToken.length>0;if(f||!o||!c){if(s)return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let C=u.pathname+u.search;if(u.pathname===t||u.pathname.startsWith(t))return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let T=_chunkW4ZYKPOKjs.h.call(void 0, C),k=encodeURIComponent(T);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:`${t}?redirect=${k}`,replace:!0})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}var L="crudify_tokens",mr="crudify_enc_key";function B(){try{let e=localStorage.getItem(L);return e?e.startsWith("v2:")&&e.length>50:!1}catch (e2){return!1}}function W(){try{let e=localStorage.getItem(mr);return e!==null&&e.length>=32}catch (e3){return!1}}function U(){return B()&&W()}function H(){try{let e=localStorage.getItem(L);return e?!e.startsWith("v2:")||e.length<50:!1}catch (e4){return!1}}function gr(){try{H()&&localStorage.removeItem(L)}catch (e5){}}function Y({children:e,redirectTo:r="/",loadingComponent:t,initTimeout:o=3e3}){let{isAuthenticated:a,isInitialized:s}=_chunkH6XXWDUTjs.l.call(void 0, ),y=_reactrouterdom.useLocation.call(void 0, ),[l]=_react.useState.call(void 0, ()=>U()),[f,u]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>{if(!s&&l){let c=setTimeout(()=>{u(!0)},o);return()=>clearTimeout(c)}},[s,l,o]),s&&a){let c=new URLSearchParams(y.search),C=_chunkW4ZYKPOKjs.j.call(void 0, c,r);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:C,replace:!0})}return s&&!a?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):l&&!f?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}function J({children:e,behavior:r="redirect-if-authenticated",redirectTo:t="/",loadingComponent:o}){let{isAuthenticated:a,isInitialized:s}=_chunkH6XXWDUTjs.l.call(void 0, );return s?r==="allow-all"?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):a?_jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})})}var X=_react.createContext.call(void 0, void 0),hr= exports.CrudifyInitializer =({config:e,children:r,fallback:t=null,onInitialized:o,onError:a})=>{let[s,y]=_react.useState.call(void 0, !1),[l,f]=_react.useState.call(void 0, !1),[u,c]=_react.useState.call(void 0, null),C=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{C.current||(_chunkH6XXWDUTjs.q.registerHighPriorityInitializer(),C.current=!0),T.current||(T.current=!0,(async()=>{f(!0),c(null);try{let d=_chunk4LMFQECSjs.d.call(void 0, {publicApiKey:_optionalChain([e, 'optionalAccess', _3 => _3.publicApiKey]),env:_optionalChain([e, 'optionalAccess', _4 => _4.env]),enableDebug:_optionalChain([e, 'optionalAccess', _5 => _5.enableLogging])});if(!d.publicApiKey)throw new Error("Crudify configuration missing. Please provide publicApiKey via props or ensure cookies are set by Lambda.");let v=d.env||"prod";_chunk4LMFQECSjs.a.setEnvironment(v),await _chunkH6XXWDUTjs.q.initialize({priority:"HIGH",publicApiKey:d.publicApiKey,env:d.env||"prod",enableLogging:_optionalChain([e, 'optionalAccess', _6 => _6.enableLogging]),requestedBy:"CrudifyInitializer"}),y(!0),f(!1),o&&o()}catch(d){let v=d instanceof Error?d:new Error(String(d));c(v),f(!1),a&&a(v)}})())},[_optionalChain([e, 'optionalAccess', _7 => _7.publicApiKey]),_optionalChain([e, 'optionalAccess', _8 => _8.env]),_optionalChain([e, 'optionalAccess', _9 => _9.enableLogging]),o,a]);let k={isInitialized:s,isInitializing:l,error:u};return l&&t?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t}):(u&&_chunk4LMFQECSjs.a.error("[CrudifyInitializer] Initialization failed",u),_jsxruntime.jsx.call(void 0, X.Provider,{value:k,children:r}))},Tr= exports.useCrudifyInitializer =()=>{let e=_react.useContext.call(void 0, X);if(!e)throw new Error("useCrudifyInitializer must be used within CrudifyInitializer");return e};var _crudifyadminsdk = require('@nocios/crudify-admin-sdk'); var _crudifyadminsdk2 = _interopRequireDefault(_crudifyadminsdk);var Z=!1,I=null,h=null;async function Sr(){let r=await _chunkH6XXWDUTjs.d.getInstance().getTokenInfo(),t=_optionalChain([r, 'optionalAccess', _10 => _10.apiEndpointAdmin]),o=_optionalChain([r, 'optionalAccess', _11 => _11.apiKeyEndpointAdmin]);return t&&o?{apiUrl:t,apiKey:o}:_chunkH6XXWDUTjs.h.waitForCredentials()}async function Er(){if(!Z)return I||(I=(async()=>{try{let e=_chunkH6XXWDUTjs.d.getInstance(),{apiUrl:r,apiKey:t}=await Sr();h=await _asyncOptionalChain([(await e.getTokenInfo()), 'optionalAccess', async _12 => _12.crudifyTokens, 'optionalAccess', async _13 => _13.accessToken])||null,_crudifyadminsdk2.default.init({url:r,apiKey:t,getAdditionalHeaders:()=>h?{Authorization:`Bearer ${h}`}:{}}),Z=!0}catch(e){throw I=null,_chunk4LMFQECSjs.a.error("[crudifyAdminWrapper] Initialization failed",e instanceof Error?e:{message:String(e)}),e}})(),I)}async function n(e){try{await Er();let r=_chunkH6XXWDUTjs.d.getInstance();h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _14 => _14.crudifyTokens, 'optionalAccess', async _15 => _15.accessToken])||null;let o=await e(),a=o.errors&&(typeof o.errors=="string"&&o.errors.includes("401")||Array.isArray(o.errors)&&o.errors.some(s=>typeof s=="string"&&s.includes("401")));return!o.success&&a?await r.refreshTokens()?(h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _16 => _16.crudifyTokens, 'optionalAccess', async _17 => _17.accessToken])||null,await e()):(_chunk4LMFQECSjs.a.error("[crudifyAdmin] Token refresh failed"),typeof window<"u"&&(window.location.href="/login"),o):o}catch(r){return _chunk4LMFQECSjs.a.error("[crudifyAdmin] Operation error",r instanceof Error?r:{message:String(r)}),{success:!1,errors:r instanceof Error?r.message:"Unknown error"}}}var kr={listModules:()=>n(()=>_crudifyadminsdk2.default.listModules()),getModule:e=>n(()=>_crudifyadminsdk2.default.getModule(e)),createModule:e=>n(()=>_crudifyadminsdk2.default.createModule(e)),editModule:(e,r)=>n(()=>_crudifyadminsdk2.default.editModule(e,r)),deleteModule:e=>n(()=>_crudifyadminsdk2.default.deleteModule(e)),activateModule:e=>n(()=>_crudifyadminsdk2.default.activateModule(e)),deactivateModule:e=>n(()=>_crudifyadminsdk2.default.deactivateModule(e)),getModuleVersions:e=>n(()=>_crudifyadminsdk2.default.getModuleVersions(e)),listActions:e=>n(()=>_crudifyadminsdk2.default.listActions(e)),getAction:e=>n(()=>_crudifyadminsdk2.default.getAction(e)),createAction:e=>n(()=>_crudifyadminsdk2.default.createAction(e)),editAction:(e,r)=>n(()=>_crudifyadminsdk2.default.editAction(e,r)),deleteAction:e=>n(()=>_crudifyadminsdk2.default.deleteAction(e)),activateAction:e=>n(()=>_crudifyadminsdk2.default.activateAction(e)),deactivateAction:e=>n(()=>_crudifyadminsdk2.default.deactivateAction(e)),getActionVersions:e=>n(()=>_crudifyadminsdk2.default.getActionVersions(e)),getActionsByProfile:e=>n(()=>_crudifyadminsdk2.default.getActionsByProfile(e)),updateActionsProfiles:e=>n(()=>_crudifyadminsdk2.default.updateActionsProfiles(e)),calculatePermissions:e=>n(()=>_crudifyadminsdk2.default.calculatePermissions(e))};exports.AuthRoute = Y; exports.CRITICAL_TRANSLATIONS = _chunkW4ZYKPOKjs.a; exports.CrossTabSyncManager = _chunkH6XXWDUTjs.b; exports.CrudiaAutoGenerate = _chunkW4ZYKPOKjs.v; exports.CrudiaFileField = _chunkW4ZYKPOKjs.w; exports.CrudiaMarkdownField = _chunkW4ZYKPOKjs.x; exports.CrudifyInitializationManager = _chunkH6XXWDUTjs.p; exports.CrudifyInitializer = hr; exports.CrudifyLogin = _chunkW4ZYKPOKjs.o; exports.CrudifyProvider = _chunkH6XXWDUTjs.i; exports.CrudifyThemeProvider = ar; exports.DEFAULT_PASSWORD_RULES = _chunkW4ZYKPOKjs.n; exports.ERROR_CODES = _chunk4LMFQECSjs.u; exports.ERROR_SEVERITY_MAP = _chunk4LMFQECSjs.v; exports.GlobalNotificationProvider = _chunkH6XXWDUTjs.f; exports.GuestRoute = J; exports.LoginComponent = _chunkW4ZYKPOKjs.t; exports.POLICY_ACTIONS = _chunkW4ZYKPOKjs.q; exports.PREFERRED_POLICY_ORDER = _chunkW4ZYKPOKjs.r; exports.PasswordRequirements = _chunkW4ZYKPOKjs.k; exports.Policies = _chunkW4ZYKPOKjs.s; exports.ProtectedRoute = _; exports.SessionDebugInfo = _chunkH6XXWDUTjs.m; exports.SessionLoadingScreen = g; exports.SessionManager = _chunkH6XXWDUTjs.d; exports.SessionProvider = _chunkH6XXWDUTjs.k; exports.SessionStatus = _chunkW4ZYKPOKjs.u; exports.TokenStorage = _chunkH6XXWDUTjs.a; exports.TranslationService = _chunkW4ZYKPOKjs.d; exports.TranslationsProvider = _chunkW4ZYKPOKjs.f; exports.UserProfileDisplay = _chunkW4ZYKPOKjs.p; exports.allPasswordRulesPassed = _chunkW4ZYKPOKjs.m; exports.clearCorruptedTokens = gr; exports.createErrorTranslator = _chunk4LMFQECSjs.p; exports.crossTabSync = _chunkH6XXWDUTjs.c; exports.crudify = _crudifysdk2.default; exports.crudifyAdmin = kr; exports.crudifyInitManager = _chunkH6XXWDUTjs.q; exports.decodeJwtSafely = _chunk4LMFQECSjs.r; exports.evaluatePasswordRules = _chunkW4ZYKPOKjs.l; exports.extractSafeRedirectFromUrl = _chunkW4ZYKPOKjs.j; exports.getCriticalLanguages = _chunkW4ZYKPOKjs.b; exports.getCriticalTranslations = _chunkW4ZYKPOKjs.c; exports.getCurrentUserEmail = _chunk4LMFQECSjs.s; exports.getErrorMessage = _chunk4LMFQECSjs.y; exports.handleCrudifyError = _chunk4LMFQECSjs.A; exports.hasCorruptedTokens = H; exports.hasEncryptionKeyHash = W; exports.hasStoredTokens = B; exports.isTokenExpired = _chunk4LMFQECSjs.t; exports.logger = _chunk4LMFQECSjs.a; exports.parseApiError = _chunk4LMFQECSjs.w; exports.parseJavaScriptError = _chunk4LMFQECSjs.z; exports.parseTransactionError = _chunk4LMFQECSjs.x; exports.resolveTenantConfig = _chunk4LMFQECSjs.b; exports.secureLocalStorage = _chunkBXFEQ6KPjs.b; exports.secureSessionStorage = _chunkBXFEQ6KPjs.a; exports.shouldWaitForInitialization = U; exports.translateError = _chunk4LMFQECSjs.o; exports.translateErrorCode = _chunk4LMFQECSjs.m; exports.translateErrorCodes = _chunk4LMFQECSjs.n; exports.translationService = _chunkW4ZYKPOKjs.e; exports.useAuth = _chunkNIRLP2TCjs.b; exports.useAutoGenerate = _chunkH6XXWDUTjs.o; exports.useCrudify = _chunkH6XXWDUTjs.j; exports.useCrudifyInitializer = Tr; exports.useCrudifyWithNotifications = _chunkNIRLP2TCjs.d; exports.useData = _chunkNIRLP2TCjs.c; exports.useFileUpload = _chunkH6XXWDUTjs.r; exports.useGlobalNotification = _chunkH6XXWDUTjs.g; exports.useSession = _chunkH6XXWDUTjs.e; exports.useSessionContext = _chunkH6XXWDUTjs.l; exports.useTenantConfig = _chunk4LMFQECSjs.c; exports.useTranslations = _chunkW4ZYKPOKjs.g; exports.useUserData = _chunkNIRLP2TCjs.a; exports.useUserProfile = _chunkH6XXWDUTjs.n; exports.validateInternalRedirect = _chunkW4ZYKPOKjs.h; exports.validateTrustedRedirect = _chunkW4ZYKPOKjs.i;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{a as j,b as ee,c as re,d as oe,e as te,f as ne,g as se,h as z,i as be,j as b,k as we,l as Le,m as Ue,n as Fe,o as Oe,p as Ge,q as De,r as Ke,s as Ve,t as _e,u as Be,v as He,w as Je,x as $e}from"./chunk-QFACMV2I.mjs";import{a as Qe,b as Xe,c as Ze,d as rr}from"./chunk-77UKXG5L.mjs";import{a as ae,b as de,c as fe,d as x,e as me,f as Re,g as xe,h as D,i as Pe,j as Ae,k as Ie,l as m,m as he,n as Ne,o as We,p as qe,q as S,r as Ye}from"./chunk-O4FUHIQG.mjs";import{a as je,b as er}from"./chunk-WMLIOPUC.mjs";import{A as ze,a as p,b as M,c as ie,d as G,m as ue,n as pe,o as le,p as ce,r as ge,s as ye,t as Ce,u as Te,v as ve,w as Se,x as Ee,y as ke,z as Me}from"./chunk-44VU4TSP.mjs";import{default as vo}from"@nocios/crudify-sdk";export*from"@nocios/crudify-sdk";import{useMemo as or}from"react";import{ThemeProvider as tr,createTheme as ir,CssBaseline as nr}from"@mui/material";import{jsx as ur,jsxs as pr}from"react/jsx-runtime";var sr=(e={})=>{try{let r=M();if(r.configSource!=="none"&&r.theme)return{...e,...r.theme}}catch(r){p.warn("Error reading theme from config",r instanceof Error?{errorMessage:r.message}:{message:String(r)})}return e};function ar({children:e,defaultTheme:r={},disableCssBaseline:t=!1}){let o=or(()=>{let a=sr(r);return ir(a)},[r]);return pr(tr,{theme:o,children:[!t&&ur(nr,{}),e]})}import{Navigate as w,useLocation as fr}from"react-router-dom";import{Fragment as dr,jsx as E,jsxs as K}from"react/jsx-runtime";var lr={border:"5px solid rgba(0, 0, 0, 0.1)",borderTopColor:"#3B82F6",borderRadius:"50%",width:"50px",height:"50px",animation:"spin 1s linear infinite"},cr=()=>E("style",{children:`
1
+ import{a as j,b as ee,c as re,d as oe,e as te,f as ne,g as se,h as z,i as be,j as b,k as we,l as Le,m as Ue,n as Fe,o as Oe,p as Ge,q as De,r as Ke,s as Ve,t as _e,u as Be,v as He,w as Je,x as $e}from"./chunk-SYHNHKFA.mjs";import{a as Qe,b as Xe,c as Ze,d as rr}from"./chunk-77UKXG5L.mjs";import{a as ae,b as de,c as fe,d as x,e as me,f as Re,g as xe,h as D,i as Pe,j as Ae,k as Ie,l as m,m as he,n as Ne,o as We,p as qe,q as S,r as Ye}from"./chunk-O4FUHIQG.mjs";import{a as je,b as er}from"./chunk-WMLIOPUC.mjs";import{A as ze,a as p,b as M,c as ie,d as G,m as ue,n as pe,o as le,p as ce,r as ge,s as ye,t as Ce,u as Te,v as ve,w as Se,x as Ee,y as ke,z as Me}from"./chunk-44VU4TSP.mjs";import{default as vo}from"@nocios/crudify-sdk";export*from"@nocios/crudify-sdk";import{useMemo as or}from"react";import{ThemeProvider as tr,createTheme as ir,CssBaseline as nr}from"@mui/material";import{jsx as ur,jsxs as pr}from"react/jsx-runtime";var sr=(e={})=>{try{let r=M();if(r.configSource!=="none"&&r.theme)return{...e,...r.theme}}catch(r){p.warn("Error reading theme from config",r instanceof Error?{errorMessage:r.message}:{message:String(r)})}return e};function ar({children:e,defaultTheme:r={},disableCssBaseline:t=!1}){let o=or(()=>{let a=sr(r);return ir(a)},[r]);return pr(tr,{theme:o,children:[!t&&ur(nr,{}),e]})}import{Navigate as w,useLocation as fr}from"react-router-dom";import{Fragment as dr,jsx as E,jsxs as K}from"react/jsx-runtime";var lr={border:"5px solid rgba(0, 0, 0, 0.1)",borderTopColor:"#3B82F6",borderRadius:"50%",width:"50px",height:"50px",animation:"spin 1s linear infinite"},cr=()=>E("style",{children:`
2
2
  @keyframes spin {
3
3
  0% { transform: rotate(0deg); }
4
4
  100% { transform: rotate(360deg); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-components",
3
- "version": "2.0.36",
3
+ "version": "2.0.38",
4
4
  "engines": {
5
5
  "node": ">=24.12.0"
6
6
  },
@@ -1 +0,0 @@
1
- import{g as fo,i as go,j as ye,l as be,n as ho,o as yo,r as bo}from"./chunk-O4FUHIQG.mjs";import{A as K,a as w,b as co,d as uo,f as po,p as mo}from"./chunk-44VU4TSP.mjs";var ue={es:{"base.actions.create":"Nuevo","base.actions.delete":"Eliminar","base.actions.read":"Ver","base.actions.refresh":"Refrescar","base.actions.update":"Editar","base.btn.back":"Volver","base.btn.cancel":"Cancelar","base.btn.hidePassword":"Ocultar contrase\xF1a","base.btn.showPassword":"Mostrar contrase\xF1a","base.errors.errorUnknown":"Ocurri\xF3 un error desconocido.","base.fields.actions":"Acciones","base.fields.confirmPassword":"Confirmar contrase\xF1a","base.fields.createdAt":"Creado el","base.fields.email":"Correo electr\xF3nico","base.fields.lastName":"Apellido","base.fields.name":"Nombre","base.fields.password":"Contrase\xF1a","base.fields.profile":"Perfil","base.fields.updatedAt":"Actualizado el","base.file.allowedTypes":"Tipos permitidos: {{types}}","base.file.clickToDownload":"Clic para descargar","base.file.clickToPreview":"Clic para ver imagen","base.file.confirmDelete.cancel":"Cancelar","base.file.confirmDelete.confirm":"Eliminar","base.file.confirmDelete.message":"\xBFEst\xE1s seguro de que deseas eliminar este archivo? Esta acci\xF3n no se puede deshacer.","base.file.confirmDelete.title":"Eliminar archivo","base.file.delete":"Eliminar","base.file.deleting":"Eliminando...","base.file.dragOrClick":"Arrastra archivos aqu\xED o haz clic para seleccionar","base.file.dropHere":"Suelta el archivo aqu\xED","base.file.maxFiles":"M\xE1ximo {{count}} archivos","base.file.maxSize":"M\xE1ximo {{size}} por archivo","base.file.noPreview":"Sin vista previa","base.file.pendingDeletion":"Pendiente de eliminaci\xF3n","base.file.privateFile":"Archivo privado","base.file.restore":"Restaurar","base.file.uploading":"Subiendo archivos...","base.file.validation.filesWithErrors":"Algunos archivos tienen errores","base.file.validation.maxFilesExceeded":"M\xE1ximo {{count}} archivos permitidos","base.file.validation.minFilesRequired":"Se requiere al menos un archivo","base.file.validation.minFilesRequiredPlural":"Se requieren al menos {{count}} archivos","base.lastUpdated":"\xDAltima actualizaci\xF3n a las {{formattedLastUpdated}}","base.loading.configInitial":"Cargando configuraci\xF3n inicial...","base.loading.pleaseWait":"Cargando, por favor espera...","base.loading.starting":"Iniciando aplicaci\xF3n...","base.loading.themeSetup":"Generando tema...","base.loading.validatingSession":"Validando sesi\xF3n...","base.titles.create":"Nuevo {{moduleName}}","base.titles.read":"Ver {{moduleName}}","base.titles.update":"Editar {{moduleName}}","checkCode.codeLabel":"C\xF3digo de Verificaci\xF3n","checkCode.codePlaceholder":"Ingresa el c\xF3digo de 6 d\xEDgitos","checkCode.codeRequired":"El c\xF3digo es obligatorio","checkCode.emailLabel":"Correo Electr\xF3nico","checkCode.emailPlaceholder":"Ingresa tu correo electr\xF3nico","checkCode.emailRequired":"El correo electr\xF3nico es obligatorio","checkCode.instructions":"Ingresa el c\xF3digo de 6 d\xEDgitos que enviamos a tu correo electr\xF3nico.","checkCode.invalidEmail":"Ingresa un correo electr\xF3nico v\xE1lido","checkCode.resendCodeLink":"Reenviar c\xF3digo","checkCode.title":"Verificar C\xF3digo","checkCode.verifyButton":"Verificar C\xF3digo","error.app.config":"Error de Configuraci\xF3n: {{message}}","error.app.initialization":"Error durante la inicializaci\xF3n final de la aplicaci\xF3n.","error.transaction":"Error en la operaci\xF3n","errors.DUPLICATE":"El campo <b>{{field}}</b> debe ser \xFAnico.","errors.FOREIGN_KEY_NOT_FOUND":"El campo <b>{{field}}</b> debe referenciar un \xEDtem existente.","errors.INVALID_EMAIL":"El campo <b>{{field}}</b> debe ser un correo electr\xF3nico v\xE1lido.","errors.INVALID_OBJECT_ID":"El campo <b>{{field}}</b> debe ser un valor v\xE1lido.","errors.IN_USE":"El \xEDtem est\xE1 en uso y no puede ser eliminado.","errors.MAX_LENGTH":"El campo <b>{{field}}</b> no debe exceder los <b>{{length}}</b> caracteres.","errors.MIN_LENGTH":"El campo <b>{{field}}</b> debe tener al menos <b>{{length}}</b> caracteres.","errors.MUST_NOT_BE_EMAIL":"El campo <b>{{field}}</b> no debe ser un correo electr\xF3nico.","errors.NO_PERMISSION":"No tienes permiso para realizar esta acci\xF3n.","errors.NO_SPACES":"El campo <b>{{field}}</b> no debe contener espacios.","errors.ONE_OR_MORE_OPERATIONS_FAILED":"Error en la operaci\xF3n","errors.REQUIRED":"El campo <b>{{field}}</b> es obligatorio.","errors.TOKEN_HAS_EXPIRED":"La sesi\xF3n ha expirado. Por favor, inicia sesi\xF3n nuevamente.","errors.TOO_MANY_REQUESTS":"L\xEDmite de solicitudes alcanzado. Por favor intenta m\xE1s tarde.","errors.UNAUTHORIZED":"No est\xE1s autorizado para realizar esta acci\xF3n.","errors.all_password_fields_required":"Todos los campos de contrase\xF1a son obligatorios","errors.auth.INVALID_API_KEY":"Clave de API inv\xE1lida","errors.auth.INVALID_CREDENTIALS":"Usuario y/o contrase\xF1a incorrectos","errors.auth.NO_PERMISSION":"No tienes permisos suficientes","errors.auth.SESSION_EXPIRED":"Tu sesi\xF3n ha expirado. Por favor, inicia sesi\xF3n nuevamente.","errors.auth.TOO_MANY_REQUESTS":"Demasiados intentos. Por favor espera 15 minutos e intenta nuevamente","errors.auth.UNAUTHORIZED":"No tienes permisos para realizar esta acci\xF3n","errors.auth.USER_NOT_ACTIVE":"Usuario no activo","errors.auth.USER_NOT_FOUND":"Usuario no encontrado","errors.data.BAD_REQUEST":"Solicitud inv\xE1lida","errors.data.FIELD_ERROR":"Error en los datos ingresados","errors.data.IN_USE":"El elemento est\xE1 en uso y no puede ser eliminado","errors.data.ITEM_NOT_FOUND":"El elemento solicitado no fue encontrado","errors.data.NOT_FOUND":"No se encontr\xF3 lo solicitado","errors.internal_error_changing_password":"Error interno al cambiar la contrase\xF1a. Intenta nuevamente","errors.password_min_length":"La contrase\xF1a debe tener al menos 8 caracteres","errors.password_mismatch":"Las contrase\xF1as no coinciden","errors.password_must_be_different":"La nueva contrase\xF1a debe ser diferente a la actual","errors.system.DATABASE_CONNECTION_ERROR":"Error de conexi\xF3n. Verifica tu conexi\xF3n a internet.","errors.system.INTERNAL_SERVER_ERROR":"Error interno del servidor. Intenta nuevamente.","errors.system.INVALID_CONFIGURATION":"Error de configuraci\xF3n del sistema","errors.system.TOO_MANY_REQUESTS":"Demasiadas solicitudes. Por favor espera un momento e intenta nuevamente","errors.system.UNKNOWN_OPERATION":"Operaci\xF3n no reconocida","errors.users_module_not_configured":"M\xF3dulo de usuarios no configurado","footer.copyright":"Nocios S.R.L. Todos los derechos reservados.","footer.version":"Versi\xF3n","forgotPassword.checkEmailInstructions":"Revisa tu bandeja de entrada para el c\xF3digo de verificaci\xF3n","forgotPassword.codeAlreadyExistsMessage":"Ya se envi\xF3 un c\xF3digo y a\xFAn es v\xE1lido","forgotPassword.emailLabel":"Correo Electr\xF3nico","forgotPassword.emailPlaceholder":"Ingresa tu correo electr\xF3nico","forgotPassword.emailRequired":"El correo electr\xF3nico es obligatorio","forgotPassword.emailSentMessage":"C\xF3digo enviado exitosamente","forgotPassword.enterCodeLink":"Ingresar C\xF3digo","forgotPassword.instructions":"Ingresa tu correo electr\xF3nico y te enviaremos un c\xF3digo para restablecer tu contrase\xF1a.","forgotPassword.invalidEmail":"Ingresa un correo electr\xF3nico v\xE1lido","forgotPassword.sendCodeButton":"Enviar C\xF3digo","forgotPassword.title":"Recuperar Contrase\xF1a","login.alreadyHaveCodeLink":"\xBFYa tienes un c\xF3digo?","login.forgotPasswordLink":"\xBFOlvidaste tu contrase\xF1a?","login.initializationError":"Error de inicializaci\xF3n","login.initializing":"Inicializando...","login.loginButton":"Iniciar sesi\xF3n","login.logoAlt":"Logotipo","login.noAccountPrompt":"\xBFNo tienes una cuenta?","login.notInitialized":"Sistema no inicializado","login.passwordLabel":"Contrase\xF1a","login.passwordPlaceholder":"Ingresa tu contrase\xF1a","login.passwordRequired":"Contrase\xF1a es obligatoria","login.signUpLink":"Reg\xEDstrate","login.usernameOrEmailLabel":"Usuario o correo electr\xF3nico","login.usernameOrEmailPlaceholder":"Ingresa tu correo electr\xF3nico","login.usernameRequired":"El usuario es requerido","passwordRequirements.lowercase":"Una letra min\xFAscula","passwordRequirements.minLength":"M\xEDnimo 8 caracteres","passwordRequirements.number":"Un n\xFAmero","passwordRequirements.special":"Un car\xE1cter especial (!@#$%...)","passwordRequirements.uppercase":"Una letra may\xFAscula","profiles.actions.assignProfiles":"Asignar perfiles","profiles.moduleName":"Perfiles","profiles.moduleSingular":"Perfil","publicPolicies.fields.conditions.customEdit":"Edici\xF3n personalizada","resetPassword.codeExpiredOrInvalid":"El c\xF3digo ha expirado o es inv\xE1lido","resetPassword.confirmPasswordLabel":"Confirmar Contrase\xF1a","resetPassword.confirmPasswordPlaceholder":"Confirma tu nueva contrase\xF1a","resetPassword.confirmPasswordRequired":"Confirma tu contrase\xF1a","resetPassword.goToLoginButton":"Ir al Login","resetPassword.instructions":"Ingresa tu nueva contrase\xF1a.","resetPassword.invalidCode":"El c\xF3digo de verificaci\xF3n es inv\xE1lido. Por favor, verifica el enlace o solicita uno nuevo.","resetPassword.missingParameters":"Faltan par\xE1metros obligatorios","resetPassword.newPasswordLabel":"Nueva Contrase\xF1a","resetPassword.newPasswordPlaceholder":"Ingresa tu nueva contrase\xF1a","resetPassword.newPasswordRequired":"La nueva contrase\xF1a es obligatoria","resetPassword.passwordRequirementsNotMet":"La contrase\xF1a no cumple con todos los requisitos","resetPassword.passwordTooShort":"La contrase\xF1a debe tener al menos 8 caracteres","resetPassword.passwordsDoNotMatch":"Las contrase\xF1as no coinciden","resetPassword.requestNewCodeButton":"Solicitar Nuevo C\xF3digo","resetPassword.resetPasswordButton":"Restablecer Contrase\xF1a","resetPassword.successInstructions":"Ahora puedes iniciar sesi\xF3n con tu nueva contrase\xF1a","resetPassword.successMessage":"Contrase\xF1a restablecida exitosamente","resetPassword.title":"Nueva Contrase\xF1a","resetPassword.validatingCode":"Validando c\xF3digo...","translations.fields.lang":"Idioma","translations.moduleName":"Traducciones","translations.moduleSingular":"Traducci\xF3n","users.fields.currentPassword":"Contrase\xF1a actual","users.fields.newPassword":"Nueva Contrase\xF1a","users.fields.repeatNewPassword":"Repetir Nueva Contrase\xF1a","users.moduleName":"Usuarios","users.moduleSingular":"Usuario"},en:{"base.actions.create":"New","base.actions.delete":"Delete","base.actions.read":"View","base.actions.refresh":"Refresh","base.actions.update":"Edit","base.btn.back":"Back","base.btn.cancel":"Cancel","base.btn.hidePassword":"Hide password","base.btn.showPassword":"Show password","base.errors.errorUnknown":"An unknown error occurred.","base.fields.actions":"Actions","base.fields.confirmPassword":"Confirm password","base.fields.createdAt":"Created at","base.fields.email":"Email","base.fields.lastName":"Last name","base.fields.name":"Name","base.fields.password":"Password","base.fields.profile":"Profile","base.fields.updatedAt":"Updated at","base.file.allowedTypes":"Allowed types: {{types}}","base.file.clickToDownload":"Click to download","base.file.clickToPreview":"Click to preview image","base.file.confirmDelete.cancel":"Cancel","base.file.confirmDelete.confirm":"Delete","base.file.confirmDelete.message":"Are you sure you want to delete this file? This action cannot be undone.","base.file.confirmDelete.title":"Delete file","base.file.delete":"Delete","base.file.deleting":"Deleting...","base.file.dragOrClick":"Drag files here or click to select","base.file.dropHere":"Drop file here","base.file.maxFiles":"Maximum {{count}} files","base.file.maxSize":"Maximum {{size}} per file","base.file.noPreview":"No preview","base.file.pendingDeletion":"Pending deletion","base.file.privateFile":"Private file","base.file.restore":"Restore","base.file.uploading":"Uploading files...","base.file.validation.filesWithErrors":"Some files have errors","base.file.validation.maxFilesExceeded":"Maximum {{count}} files allowed","base.file.validation.minFilesRequired":"At least one file is required","base.file.validation.minFilesRequiredPlural":"At least {{count}} files are required","base.lastUpdated":"Last updated at {{formattedLastUpdated}}","base.loading.configInitial":"Loading initial configuration...","base.loading.pleaseWait":"Loading, please wait...","base.loading.starting":"Starting application...","base.loading.themeSetup":"Generating theme...","base.loading.validatingSession":"Validating session...","base.titles.create":"New {{moduleName}}","base.titles.read":"View {{moduleName}}","base.titles.update":"Edit {{moduleName}}","checkCode.codeLabel":"Verification Code","checkCode.codePlaceholder":"Enter the 6-digit code","checkCode.codeRequired":"Code is required","checkCode.emailLabel":"Email","checkCode.emailPlaceholder":"Enter your email","checkCode.emailRequired":"Email is required","checkCode.instructions":"Enter the 6-digit code we sent to your email.","checkCode.invalidEmail":"Enter a valid email address","checkCode.resendCodeLink":"Resend code","checkCode.title":"Verify Code","checkCode.verifyButton":"Verify Code","error.app.config":"Configuration Error: {{message}}","error.app.initialization":"Error during final application initialization.","error.transaction":"Operation error","errors.DUPLICATE":"The <b>{{field}}</b> field must be unique.","errors.FOREIGN_KEY_NOT_FOUND":"The <b>{{field}}</b> field must reference an existing item.","errors.INVALID_EMAIL":"The <b>{{field}}</b> field must be a valid email address.","errors.INVALID_OBJECT_ID":"The <b>{{field}}</b> field must be a valid value.","errors.IN_USE":"The item is in use and cannot be deleted.","errors.MAX_LENGTH":"The <b>{{field}}</b> field must not exceed <b>{{length}}</b> characters.","errors.MIN_LENGTH":"The <b>{{field}}</b> field must be at least <b>{{length}}</b> characters.","errors.MUST_NOT_BE_EMAIL":"The <b>{{field}}</b> field must not be an email.","errors.NO_PERMISSION":"You don't have permission to perform this action.","errors.NO_SPACES":"The <b>{{field}}</b> field must not contain spaces.","errors.ONE_OR_MORE_OPERATIONS_FAILED":"Operation error","errors.REQUIRED":"The <b>{{field}}</b> field is required.","errors.TOKEN_HAS_EXPIRED":"Session has expired. Please log in again.","errors.TOO_MANY_REQUESTS":"Request limit reached. Please try again later.","errors.UNAUTHORIZED":"You are not authorized to perform this action.","errors.all_password_fields_required":"All password fields are required","errors.auth.INVALID_API_KEY":"Invalid API key","errors.auth.INVALID_CREDENTIALS":"Invalid username and/or password","errors.auth.NO_PERMISSION":"You don't have sufficient permissions","errors.auth.SESSION_EXPIRED":"Your session has expired. Please log in again.","errors.auth.TOO_MANY_REQUESTS":"Too many attempts. Please wait 15 minutes and try again","errors.auth.UNAUTHORIZED":"You don't have permission to perform this action","errors.auth.USER_NOT_ACTIVE":"User not active","errors.auth.USER_NOT_FOUND":"User not found","errors.data.BAD_REQUEST":"Invalid request","errors.data.FIELD_ERROR":"Error in submitted data","errors.data.IN_USE":"The item is in use and cannot be deleted","errors.data.ITEM_NOT_FOUND":"The requested item was not found","errors.data.NOT_FOUND":"Not found","errors.internal_error_changing_password":"Internal error changing password. Please try again","errors.password_min_length":"Password must be at least 8 characters","errors.password_mismatch":"Passwords do not match","errors.password_must_be_different":"New password must be different from current password","errors.system.DATABASE_CONNECTION_ERROR":"Connection error. Please check your internet connection.","errors.system.INTERNAL_SERVER_ERROR":"Internal server error. Please try again.","errors.system.INVALID_CONFIGURATION":"System configuration error","errors.system.TOO_MANY_REQUESTS":"Too many requests. Please wait a moment and try again","errors.system.UNKNOWN_OPERATION":"Unrecognized operation","errors.users_module_not_configured":"Users module not configured","footer.copyright":"Nocios S.R.L. All rights reserved.","footer.version":"Version","forgotPassword.checkEmailInstructions":"Check your inbox for the verification code","forgotPassword.codeAlreadyExistsMessage":"A code has already been sent and is still valid","forgotPassword.emailLabel":"Email","forgotPassword.emailPlaceholder":"Enter your email","forgotPassword.emailRequired":"Email is required","forgotPassword.emailSentMessage":"Code sent successfully","forgotPassword.enterCodeLink":"Enter Code","forgotPassword.instructions":"Enter your email and we'll send you a code to reset your password.","forgotPassword.invalidEmail":"Enter a valid email address","forgotPassword.sendCodeButton":"Send Code","forgotPassword.title":"Recover Password","login.alreadyHaveCodeLink":"Already have a code?","login.forgotPasswordLink":"Forgot your password?","login.initializationError":"Initialization error","login.initializing":"Initializing...","login.loginButton":"Log In","login.logoAlt":"Logo","login.noAccountPrompt":"Don't have an account?","login.notInitialized":"System not initialized","login.passwordLabel":"Password","login.passwordPlaceholder":"Enter your password","login.passwordRequired":"Password is required","login.signUpLink":"Sign up","login.usernameOrEmailLabel":"Username or email","login.usernameOrEmailPlaceholder":"Enter your email","login.usernameRequired":"Username is required","passwordRequirements.lowercase":"One lowercase letter","passwordRequirements.minLength":"Minimum 8 characters","passwordRequirements.number":"One number","passwordRequirements.special":"One special character (!@#$%...)","passwordRequirements.uppercase":"One uppercase letter","profiles.actions.assignProfiles":"Assign profiles","profiles.moduleName":"Profiles","profiles.moduleSingular":"Profile","publicPolicies.fields.conditions.customEdit":"Custom edit","resetPassword.codeExpiredOrInvalid":"The code has expired or is invalid","resetPassword.confirmPasswordLabel":"Confirm Password","resetPassword.confirmPasswordPlaceholder":"Confirm your new password","resetPassword.confirmPasswordRequired":"Confirm your password","resetPassword.goToLoginButton":"Go to Login","resetPassword.instructions":"Enter your new password.","resetPassword.invalidCode":"The verification code is invalid. Please check the link or request a new one.","resetPassword.missingParameters":"Missing required parameters","resetPassword.newPasswordLabel":"New Password","resetPassword.newPasswordPlaceholder":"Enter your new password","resetPassword.newPasswordRequired":"New password is required","resetPassword.passwordRequirementsNotMet":"Password does not meet all requirements","resetPassword.passwordTooShort":"Password must be at least 8 characters","resetPassword.passwordsDoNotMatch":"Passwords do not match","resetPassword.requestNewCodeButton":"Request New Code","resetPassword.resetPasswordButton":"Reset Password","resetPassword.successInstructions":"You can now log in with your new password","resetPassword.successMessage":"Password reset successfully","resetPassword.title":"New Password","resetPassword.validatingCode":"Validating code...","translations.fields.lang":"Language","translations.moduleName":"Translations","translations.moduleSingular":"Translation","users.fields.currentPassword":"Current password","users.fields.newPassword":"New Password","users.fields.repeatNewPassword":"Repeat New Password","users.moduleName":"Users","users.moduleSingular":"User"}},ti=()=>Object.keys(ue),ni=e=>ue[e]||ue.es;import Xe from"@nocios/crudify-sdk";var wo="crudify_translations_",Ft=3600*1e3;function xo(e){let r=0;for(let o=0;o<e.length;o++){let t=e.charCodeAt(o);r=(r<<5)-r+t,r=r&r}return Math.abs(r).toString(36)}var Pr=class e{constructor(){this.enableDebug=!1;this.initializationPromise=null;this.isInitialized=!1}static getInstance(){return e.instance||(e.instance=new e),e.instance}setDebug(r){this.enableDebug=r}async ensureCrudifyInitialized(r,o){if(!this.isInitialized)return this.initializationPromise?(this.enableDebug&&w.debug("[TranslationService] Waiting for crudify initialization..."),this.initializationPromise):(this.enableDebug&&w.debug("[TranslationService] Initializing crudify SDK..."),this.initializationPromise=(async()=>{try{let t=Xe.getTokenData();if(t&&t.endpoint){this.enableDebug&&w.debug("[TranslationService] Crudify already initialized"),this.isInitialized=!0;return}Xe.config(o);let a=await Xe.init(r,this.enableDebug?"debug":"none");if(a.success===!1)throw new Error(`Failed to initialize crudify: ${JSON.stringify(a.errors||"Unknown error")}`);this.isInitialized=!0,this.enableDebug&&w.debug("[TranslationService] Crudify SDK initialized successfully")}catch(t){throw w.error("[TranslationService] Failed to initialize crudify",t instanceof Error?t:{message:String(t)}),this.initializationPromise=null,t}})(),this.initializationPromise)}async fetchTranslations(r){let{apiKey:o,featureKeys:t,crudifyEnv:a="stg",urlTranslations:n}=r;this.enableDebug&&w.debug("[TranslationService] fetchTranslations called with:",{apiKeyHash:xo(o),crudifyEnv:a,featureKeys:t,hasUrlTranslations:!!n});let s=this.getFromCache(o),l=s?this.isCacheExpired(s):!0;if(s&&!l)return this.enableDebug&&w.debug("[TranslationService] Using cached translations"),this.mergeWithUrlTranslations(s.data.translations,n);try{await this.ensureCrudifyInitialized(o,a)}catch(i){return w.error("[TranslationService] Failed to initialize crudify",i instanceof Error?i:{message:String(i)}),s?(w.warn("[TranslationService] Using expired cache (init failed)"),this.mergeWithUrlTranslations(s.data.translations,n)):(w.warn("[TranslationService] Using critical bundle (init failed)"),this.getCriticalTranslationsOnly())}try{this.enableDebug&&w.debug("[TranslationService] Fetching from API via crudify SDK");let i=await this.fetchFromAPI(t);this.hasDataChanged(s,i)||!s?this.saveToCache(o,i):this.refreshCacheTimestamp(o);let d=this.mergeWithUrlTranslations(i.translations,n);return this.enableDebug&&w.debug("[TranslationService] Translations loaded:",{languages:Object.keys(d),keysCount:d[Object.keys(d)[0]]?Object.keys(d[Object.keys(d)[0]]).length:0}),d}catch(i){return w.error("[TranslationService] API fetch failed",i instanceof Error?i:{message:String(i)}),s?(w.warn("[TranslationService] Using expired cache as fallback"),this.mergeWithUrlTranslations(s.data.translations,n)):(w.warn("[TranslationService] Using critical bundle translations"),this.getCriticalTranslationsOnly())}}async fetchFromAPI(r){let o=await Xe.getTranslation(r);if(!o.success)throw new Error(`Crudify API error: ${o.errors?JSON.stringify(o.errors):"Unknown error"}`);if(!o.data)throw new Error("No translation data in response");return o.data}mergeWithUrlTranslations(r,o){if(!o||Object.keys(o).length===0)return r;let t={};return Object.keys(r).forEach(a=>{t[a]={...r[a],...o}}),t}hasDataChanged(r,o){if(!r||r.data.timestamp!==o.timestamp)return!0;let t=this.hashData(o.translations);return r.dataHash!==t}hashData(r){let o=JSON.stringify(r),t=0;for(let a=0;a<o.length;a++){let n=o.charCodeAt(a);t=(t<<5)-t+n,t=t&t}return t.toString(36)}saveToCache(r,o){try{let t=this.getCacheKey(r),a={data:o,cachedAt:Date.now(),dataHash:this.hashData(o.translations)};localStorage.setItem(t,JSON.stringify(a)),this.enableDebug&&w.debug("[TranslationService] Saved to cache:",{cacheKey:t})}catch(t){w.error("[TranslationService] Failed to save cache",t instanceof Error?t:{message:String(t)})}}getFromCache(r){try{let o=this.getCacheKey(r),t=localStorage.getItem(o);return t?JSON.parse(t):null}catch(o){return w.error("[TranslationService] Failed to read cache",o instanceof Error?o:{message:String(o)}),null}}refreshCacheTimestamp(r){try{let o=this.getFromCache(r);if(o){o.cachedAt=Date.now();let t=this.getCacheKey(r);localStorage.setItem(t,JSON.stringify(o))}}catch(o){w.error("[TranslationService] Failed to refresh cache timestamp",o instanceof Error?o:{message:String(o)})}}isCacheExpired(r){return Date.now()-r.cachedAt>Ft}hasValidCache(r){let o=this.getFromCache(r);return o?!this.isCacheExpired(o):!1}getCacheKey(r){return`${wo}${xo(r)}`}getCriticalTranslationsOnly(){return ue}invalidateCache(r){let o=this.getCacheKey(r);localStorage.removeItem(o),this.enableDebug&&w.debug("[TranslationService] Cache invalidated:",{cacheKey:o})}async prefetchTranslations(r){try{await this.fetchTranslations(r),this.enableDebug&&w.debug("[TranslationService] Prefetch completed")}catch(o){w.error("[TranslationService] Prefetch failed",o instanceof Error?o:{message:String(o)})}}clearAllCaches(){try{let o=Object.keys(localStorage).filter(t=>t.startsWith(wo));o.forEach(t=>localStorage.removeItem(t)),this.enableDebug&&w.debug(`[TranslationService] Cleared ${o.length} cache entries`)}catch(r){w.error("[TranslationService] Failed to clear caches",r instanceof Error?r:{message:String(r)})}}},Ze=Pr.getInstance();import{createContext as _t,useContext as Ot,useEffect as vo,useState as De,useMemo as Co,useCallback as Nt}from"react";import{Fragment as Ut,jsx as Qe}from"react/jsx-runtime";var Je=null,vr=!1,Eo=_t(null);function Po(e,r,o){return{...e,...r,...o||{}}}function Bt(e,r,o,t,a){vo(()=>{if(!t||!e||!r)return;let n=o||typeof window<"u"&&window.i18next||typeof window<"u"&&window.i18n;if(!n||!n.addResourceBundle){a&&w.debug("[TranslationsProvider] i18next not found, skipping auto-sync");return}a&&w.debug("[TranslationsProvider] Auto-syncing translations with i18next",{languages:Object.keys(e),currentLanguage:r}),Object.keys(e).forEach(s=>{e[s]&&Object.keys(e[s]).length>0&&(n.addResourceBundle(s,"translation",e[s],!0,!0),a&&w.debug(`[TranslationsProvider] Synced ${Object.keys(e[s]).length} keys for language: ${s}`))}),n.language!==r&&n.changeLanguage&&(n.changeLanguage(r),a&&w.debug(`[TranslationsProvider] Changed i18next language to: ${r}`))},[e,r,o,t,a])}var hi=({children:e,apiKey:r,crudifyEnv:o="prod",featureKeys:t,language:a="es",devTranslations:n,translationUrl:s,enableDebug:l=!1,skipAutoInit:i=!0,autoSyncI18n:p=!0,i18nInstance:d,loadingFallback:b,waitForInitialLoad:x=!0})=>{let u=Co(()=>uo({publicApiKey:r,env:o,featureKeys:t,enableDebug:l}),[r,o,t,l]),c=u.publicApiKey||"",h=u.env||o||"prod",m=u.featureKeys||t,[f,g]=De({}),[C,T]=De(!0),[S,y]=De(!0),[R,L]=De(null),[M,fe]=De(void 0),[te,de]=De(!1),ne=Nt(async()=>{if(!c){l&&w.debug("[TranslationsProvider] No apiKey - skipping translation fetch"),T(!1),y(!1);return}if(te){l&&w.debug("[TranslationsProvider] Skipping reload - using fallback translations");return}if(Ze.hasValidCache(c)&&S&&(l&&w.debug("[TranslationsProvider] Valid cache found - not blocking initial render"),y(!1)),vr&&Je){l&&w.debug("[TranslationsProvider] Fetch already in progress, waiting for existing promise");try{let v=await Je;g(v),T(!1);return}catch{l&&w.warn("[TranslationsProvider] Global fetch failed, retrying")}}vr=!0,T(!0),L(null);let I;if(s)try{l&&w.debug(`[TranslationsProvider] Fetching translations from URL: ${s}`);let v=await fetch(s);if(!v.ok)throw new Error(`Failed to fetch translations: ${v.statusText}`);I=await v.json(),fe(I),l&&w.debug("[TranslationsProvider] URL translations loaded:",{keysCount:I?Object.keys(I).length:0})}catch(v){w.error("[TranslationsProvider] Failed to load URL translations",v instanceof Error?v:{message:String(v)}),I=void 0,fe(void 0)}let J=(async()=>{try{Ze.setDebug(l);let v=await Ze.fetchTranslations({apiKey:c,crudifyEnv:h,featureKeys:m,urlTranslations:I}),U={};return Object.keys(v).forEach(F=>{let se=ue[F]||{},Y=v[F]||{};U[F]=Po(se,Y,n)}),l&&w.debug("[TranslationsProvider] Loaded translations:",{languages:Object.keys(U),keysCount:Object.keys(U[a]||{}).length}),U}catch(v){w.error("[TranslationsProvider] Failed to load",v instanceof Error?v:{message:String(v)}),L(v instanceof Error?v.message:String(v)),de(!0);let U={};return Object.keys(ue).forEach(F=>{let se=ue[F],Y=I||M||{};U[F]=Po(se,Y,n)}),l&&w.debug("[TranslationsProvider] Using fallback translations (critical + URL)"),U}})();Je=J;try{let v=await J;g(v)}finally{T(!1),y(!1),vr=!1,setTimeout(()=>{Je=null},1e3)}},[c,h,m,s,n,l,a,te]);vo(()=>{ne();let E=setInterval(ne,3600*1e3);return()=>clearInterval(E)},[ne]);let Ae=Co(()=>(E,I)=>{let v=(f[a]||{})[E];if(!v){let U=Object.keys(f);for(let F of U)if(f[F][E]){v=f[F][E];break}}return v||(l&&w.warn(`[TranslationsProvider] Missing translation: "${E}"`),v=E),I&&typeof v=="string"&&Object.entries(I).forEach(([U,F])=>{let se=new RegExp(`{{${U}}}`,"g");v=v.replace(se,String(F))}),v},[f,a,l]);Bt(f,a,d,p,l);let ae={t:Ae,language:a,availableLanguages:Object.keys(f),translations:f,isLoading:C,error:R,refreshTranslations:ne};return c?x&&S&&C?b||Qe("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:Qe("div",{children:"Loading translations..."})}):Qe(Eo.Provider,{value:ae,children:e}):(l&&w.warn("[TranslationsProvider] No API key available. Skipping translations. Provide apiKey via props or ensure cookies are set by Lambda."),Qe(Ut,{children:e}))},Te=()=>{let e=Ot(Eo);if(!e)throw new Error("useTranslations must be used within TranslationsProvider");return e};var zt=/^[a-zA-Z0-9\-_./\?=&%#]+$/,Mt=[/^https?:\/\//i,/^ftp:\/\//i,/^\/\//,/javascript:/i,/data:/i,/vbscript:/i,/about:/i,/\.\.\//,/\.\.\\/,/%2e%2e%2f/i,/%2e%2e%5c/i,/%2f%2f/i,/%5c%5c/i,/[\x00-\x1f\x7f-\x9f]/,/\\/],To=(e,r="/")=>{if(!e||typeof e!="string")return r;let o=e.trim();if(!o)return r;if(!o.startsWith("/"))return w.warn("Open redirect blocked (relative path)",{path:e}),r;if(!zt.test(o))return w.warn("Open redirect blocked (invalid characters)",{path:e}),r;let t=o.toLowerCase();for(let n of Mt)if(n.test(t))return w.warn("Open redirect blocked (dangerous pattern)",{path:e}),r;let a=o.split("?")[0].split("/").filter(Boolean);if(a.length===0)return o;for(let n of a)if(n===".."||n.includes(":")||n.length>100)return w.warn("Open redirect blocked (suspicious path part)",{part:n}),r;return o},Vt=[/^files\.nocios\.link$/,/^files\.crudia\.com$/,/^[a-z0-9][a-z0-9-]*\.nocios\.link$/,/^[a-z0-9][a-z0-9-]*\.crudia\.com$/],Ro=(e,r="/")=>{if(!e||typeof e!="string")return r;let o=e.trim();if(!o)return r;if(o.startsWith("/"))return To(o,r);try{if(o.includes("..")||o.includes("//",8))return w.warn("Redirect blocked (dangerous path pattern)",{url:o}),r;let t=new URL(o);if(t.protocol!=="https:")return w.warn("Redirect blocked (non-HTTPS protocol)",{url:o}),r;let a=t.hostname.toLowerCase();return Vt.some(s=>s.test(a))?o:(w.warn("Redirect blocked (untrusted domain)",{url:o,hostname:a}),r)}catch{return w.warn("Redirect blocked (invalid URL)",{url:o}),r}},xi=(e,r="/")=>{try{let t=(typeof e=="string"?new URLSearchParams(e):e).get("redirect");if(!t)return r;let a=decodeURIComponent(t);return To(a,r)}catch(o){return w.warn("Error parsing redirect parameter",o instanceof Error?{errorMessage:o.message}:{message:String(o)}),r}};import{Box as So,Typography as qt}from"@mui/material";import Wt from"@mui/icons-material/CheckCircle";import Ht from"@mui/icons-material/RadioButtonUnchecked";import{jsx as ze,jsxs as jt}from"react/jsx-runtime";var Kt=({message:e,valid:r})=>jt(So,{sx:{display:"flex",alignItems:"center",gap:.5,py:.25},children:[r?ze(Wt,{sx:{fontSize:16,color:"success.main"}}):ze(Ht,{sx:{fontSize:16,color:"text.disabled"}}),ze(qt,{variant:"caption",sx:{color:r?"success.main":"text.secondary",transition:"color 0.2s ease"},children:e})]}),$t=({requirements:e,show:r=!0})=>!r||e.length===0?null:ze(So,{sx:{mt:.5,mb:1,px:.5},children:e.map((o,t)=>ze(Kt,{message:o.message,valid:o.valid},t))}),Io=$t;var Gt=/[A-Z]/,Yt=/[a-z]/,Xt=/[0-9]/,Zt=/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/,Jt=/^[A-Za-z0-9]+$/;function ko(e,r){return r.map(o=>{let t=!0;switch(o.type){case"minLength":t=e.length>=Number(o.value??0);break;case"alphanumeric":t=e.length>0&&Jt.test(e);break;case"uppercase":t=Gt.test(e);break;case"lowercase":t=Yt.test(e);break;case"number":t=Xt.test(e);break;case"special":t=Zt.test(e);break;default:t=!0}return{message:o.message,valid:t,enforce:!!o.enforce}})}function Ao(e){return e.filter(r=>r.enforce).every(r=>r.valid)}var Lo=[{type:"minLength",value:8,message:"passwordRequirements.minLength",enforce:!0},{type:"uppercase",message:"passwordRequirements.uppercase",enforce:!0},{type:"lowercase",message:"passwordRequirements.lowercase",enforce:!0},{type:"number",message:"passwordRequirements.number",enforce:!0},{type:"special",message:"passwordRequirements.special",enforce:!0}];import{Box as Jn,Typography as Qn}from"@mui/material";import{createContext as en,useContext as rn,useMemo as Tr}from"react";import{useState as Er,useEffect as Qt}from"react";var Do=(e,r)=>{let[o,t]=Er({}),[a,n]=Er(!1),[s,l]=Er(null);return Qt(()=>{if(r&&Object.keys(r).length>0){t(r),n(!1),l(null);return}if(!e){t({}),n(!1),l(null);return}let i=!1;return n(!0),l(null),fetch(e).then(p=>{if(!p.ok)throw new Error(`Failed to load translations: ${p.status}`);return p.json()}).then(p=>{i||(t(p),n(!1))}).catch(p=>{i||(w.error("[I18nProvider] Failed to load translations from URL",p instanceof Error?p:{message:String(p),url:e}),l(p instanceof Error?p.message:String(p)),t({}),n(!1))}),()=>{i=!0}},[e,r]),{translations:o,loading:a,error:s}};import{jsx as Fo}from"react/jsx-runtime";var _o=en(null),on=()=>{try{return Te()}catch{return null}},tn=(e,r)=>{if(r.includes(".")){let o=r.split(".").reduce((t,a)=>t&&typeof t=="object"?t[a]:void 0,e);if(o!==void 0)return o}if(e&&e[r])return e[r]},Oo=({children:e,translations:r,translationsUrl:o,language:t="en"})=>{let n=on()?.translations?.[t]||{},{translations:s,loading:l}=Do(o,r),i=Tr(()=>({...n,...s,...r||{}}),[n,s,r]),p=Tr(()=>(b,x)=>{let u=tn(i,b);return u==null&&(u=b),x&&typeof u=="string"&&Object.entries(x).forEach(([c,h])=>{u=u.replace(new RegExp(`{{${c}}}`,"g"),h)}),typeof u=="string"?u:b},[i]),d=Tr(()=>({t:p,language:t}),[p,t]);return l?Fo("div",{children:"Loading translations..."}):Fo(_o.Provider,{value:d,children:e})},X=()=>{let e=rn(_o);if(!e)throw new Error("useTranslation must be used within I18nProvider");return e};import{createContext as nn,useContext as an,useReducer as sn,useEffect as Rr,useCallback as ln}from"react";import{jsx as dn}from"react/jsx-runtime";var No={currentScreen:"login",searchParams:{},formData:{username:"",password:"",email:"",code:"",newPassword:"",confirmPassword:""},loading:!1,errors:{global:[]},emailSent:!1,codeAlreadyExists:!1,codeValidated:!1,fromCodeVerification:!1,config:{}};function cn(e,r){switch(r.type){case"SET_SCREEN":let o={...e,currentScreen:r.payload.screen,searchParams:r.payload.params||e.searchParams,errors:{global:[]}},t=new URLSearchParams(o.searchParams),a=t.toString()?`?${t.toString()}`:window.location.pathname;try{window.history.replaceState({},"",a)}catch{}return o;case"SET_SEARCH_PARAMS":return{...e,searchParams:r.payload};case"CLEAR_SEARCH_PARAMS":return{...e,searchParams:{}};case"UPDATE_FORM_DATA":return{...e,formData:{...e.formData,...r.payload},errors:{...e.errors,...Object.keys(r.payload).reduce((n,s)=>({...n,[s]:void 0}),{})}};case"SET_LOADING":return{...e,loading:r.payload};case"SET_ERRORS":return{...e,errors:{...e.errors,...r.payload}};case"CLEAR_ERRORS":return{...e,errors:{global:[]}};case"SET_EMAIL_SENT":return{...e,emailSent:r.payload};case"SET_CODE_ALREADY_EXISTS":return{...e,codeAlreadyExists:r.payload};case"SET_CODE_VALIDATED":return{...e,codeValidated:r.payload};case"SET_FROM_CODE_VERIFICATION":return{...e,fromCodeVerification:r.payload};case"RESET_FORM":return{...e,formData:No.formData,errors:{global:[]},loading:!1,emailSent:!1,codeAlreadyExists:!1,codeValidated:!1,fromCodeVerification:!1};case"INIT_CONFIG":return{...e,config:r.payload};default:return e}}var Bo=nn(void 0),Uo=({children:e,initialScreen:r="login",config:o,autoReadFromCookies:t=!0})=>{let[a,n]=sn(cn,{...No,currentScreen:r});Rr(()=>{n({type:"INIT_CONFIG",payload:(()=>{let c={};if(t)try{let h=co();h.configSource!=="none"&&h.logo&&(c.logo=h.logo)}catch(h){w.error("Error reading configuration",h instanceof Error?h:{message:String(h)})}return{publicApiKey:o?.publicApiKey,env:o?.env,appName:o?.appName,logo:o?.logo||c.logo,loginActions:o?.loginActions}})()})},[o,t]),Rr(()=>{let u=new URLSearchParams(window.location.search),c={};u.forEach((h,m)=>{c[m]=h}),Object.keys(c).length>0&&n({type:"SET_SEARCH_PARAMS",payload:c}),r==="checkCode"&&c.email&&n({type:"UPDATE_FORM_DATA",payload:{email:c.email,code:c.code||""}}),r==="resetPassword"&&c.link&&n({type:"SET_SEARCH_PARAMS",payload:c})},[r]),Rr(()=>{let u=po.subscribe(c=>{(c.type==="LOGOUT"||c.type==="SESSION_EXPIRED")&&(w.debug("LoginStateProvider: Clearing state due to auth event",{type:c.type}),n({type:"CLEAR_SEARCH_PARAMS"}),n({type:"RESET_FORM"}))});return()=>u()},[]);let s=(u,c)=>{n({type:"SET_SCREEN",payload:{screen:u,params:c}})},l=u=>{n({type:"UPDATE_FORM_DATA",payload:u})},i=(u,c)=>{n({type:"SET_ERRORS",payload:{[u]:c}})},p=()=>{n({type:"CLEAR_ERRORS"})},d=u=>{n({type:"SET_LOADING",payload:u})},b=ln(()=>{n({type:"CLEAR_SEARCH_PARAMS"})},[]),x={state:a,dispatch:n,setScreen:s,updateFormData:l,setFieldError:i,clearErrors:p,setLoading:d,clearSearchParams:b};return dn(Bo.Provider,{value:x,children:e})},er=()=>{let e=an(Bo);if(e===void 0)throw new Error("useLoginState must be used within a LoginStateProvider");return e};import{useEffect as un,useRef as pn}from"react";import{Typography as Sr,TextField as zo,Button as mn,Box as Me,CircularProgress as fn,Alert as gn,Link as Mo}from"@mui/material";import{Fragment as yn,jsx as Z,jsxs as Ve}from"react/jsx-runtime";var hn=({onScreenChange:e,onExternalNavigate:r,onLoginSuccess:o,onError:t,redirectUrl:a="/"})=>{let{state:n,updateFormData:s,setFieldError:l,clearErrors:i,setLoading:p}=er(),{login:d}=be(),b=X(),{t:x}=b,u="i18n"in b?b.i18n:void 0,c=pn(null),h=mo(x,{currentLanguage:u?.language,enableDebug:!1}),m=()=>{if(n.searchParams.redirect)try{let y=decodeURIComponent(n.searchParams.redirect);return Ro(y,a||"/")}catch{}return a||"/"};un(()=>{let y=setTimeout(()=>{c.current&&c.current.focus()},100);return()=>clearTimeout(y)},[]);let f=y=>h.translateError({code:y.code,message:y.message,field:y.field}),g=async()=>{if(!n.loading){if(!n.formData.username.trim()){l("username",x("login.usernameRequired"));return}if(!n.formData.password.trim()){l("password",x("login.passwordRequired"));return}i(),p(!0);try{let y=await d(n.formData.username,n.formData.password);if(p(!1),y.success){let R=m();o&&o(y.data,R)}else{let R=y.rawResponse||y;C(R)}}catch(y){p(!1);let L=K(y).map(f);l("global",L),t&&t(L.join(", "))}}},C=y=>{let R=K(y),L=[];R.forEach(M=>{M.field?l(M.field,f(M)):L.push(f(M))}),L.length>0&&l("global",L)};return Ve(yn,{children:[Ve(Me,{component:"form",noValidate:!0,onSubmit:y=>{y.preventDefault(),g()},onKeyDown:y=>{y.key==="Enter"&&!n.loading&&(y.preventDefault(),g())},sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[Ve(Me,{sx:{mb:1},children:[Z(Sr,{variant:"body2",component:"label",htmlFor:"email",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:x("login.usernameOrEmailLabel")}),Z(zo,{fullWidth:!0,id:"email",name:"email",type:"email",value:n.formData.username,disabled:n.loading,onChange:y=>s({username:y.target.value}),error:!!n.errors.username,helperText:n.errors.username,autoComplete:"email",placeholder:x("login.usernameOrEmailPlaceholder"),inputRef:c,required:!0})]}),Ve(Me,{sx:{mb:1},children:[Z(Sr,{variant:"body2",component:"label",htmlFor:"password",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:x("login.passwordLabel")}),Z(zo,{fullWidth:!0,id:"password",name:"password",type:"password",value:n.formData.password,disabled:n.loading,onChange:y=>s({password:y.target.value}),error:!!n.errors.password,helperText:n.errors.password,autoComplete:"current-password",placeholder:x("login.passwordPlaceholder"),required:!0})]}),n.config.loginActions?.includes("forgotPassword")&&Z(Me,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:Z(Mo,{sx:{cursor:"pointer"},onClick:()=>{e?.("forgotPassword",n.searchParams)},variant:"body2",color:"secondary",children:x("login.forgotPasswordLink")})}),Z(mn,{disabled:n.loading,type:"submit",fullWidth:!0,variant:"contained",color:"primary",sx:{mt:1,mb:2},children:n.loading?Z(fn,{size:20}):x("login.loginButton")})]}),Z(Me,{children:n.errors.global&&n.errors.global.length>0&&n.errors.global.map((y,R)=>Z(gn,{variant:"filled",sx:{mt:2},severity:"error",children:Z("div",{children:y})},R))}),n.config.loginActions?.includes("createUser")&&Ve(Sr,{variant:"body2",align:"center",sx:{color:"text.secondary",mt:3},children:[x("login.noAccountPrompt")," ",Z(Mo,{sx:{cursor:"pointer"},onClick:()=>{let R=`/public/users/create${Object.keys(n.searchParams).length>0?`?${new URLSearchParams(n.searchParams).toString()}`:""}`;r?.(R)},fontWeight:"medium",color:"secondary",children:x("login.signUpLink")})]})]})},Vo=hn;import{useState as Fe,useEffect as wn,useRef as xn}from"react";import{Typography as _e,TextField as Cn,Button as qo,Box as xe,CircularProgress as Pn,Alert as vn,Link as Ir}from"@mui/material";var Re=(e,r)=>o=>{let t=[`errors.auth.${o.code}`,`errors.data.${o.code}`,`errors.system.${o.code}`,`errors.${o.code}`,`${r}.${o.code.toLowerCase()}`];for(let a of t){let n=e(a);if(n!==a)return n}return o.message||e("base.errors.errorUnknown")};var we=(e,r)=>e?e instanceof URLSearchParams?e.get(r):e[r]||null:null;var bn=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,rr=e=>!e||typeof e!="string"?!1:bn.test(e.trim());var or=e=>!e||typeof e!="string"?"":e.replace(/\D/g,"").slice(0,6);import{Fragment as Wo,jsx as B,jsxs as Se}from"react/jsx-runtime";var En=({onScreenChange:e,onError:r})=>{let{crudify:o}=ye(),[t,a]=Fe(""),[n,s]=Fe(!1),[l,i]=Fe([]),[p,d]=Fe(null),[b,x]=Fe(!1),[u,c]=Fe(!1),h=xn(null),{t:m}=X(),f=Re(m,"forgotPassword");wn(()=>{h.current&&!b&&!u&&h.current.focus()},[b,u]);let g=async()=>{if(!(n||!o)){if(i([]),d(null),!t){d(m("forgotPassword.emailRequired"));return}if(!rr(t)){d(m("forgotPassword.invalidEmail"));return}s(!0);try{let y=[{operation:"requestPasswordReset",data:{email:t}}],R=await o.transaction(y);if(R.success)R.data&&R.data.existingCodeValid?c(!0):x(!0);else{let M=K(R).map(f);i(M)}}catch(y){let L=K(y).map(f);i(L),r&&r(L.join(", "))}finally{s(!1)}}},C=()=>{e?.("login")},T=()=>{if(b||u){e?.("checkCode",{email:t});return}if(!t){d(m("forgotPassword.emailRequired"));return}if(!rr(t)){d(m("forgotPassword.invalidEmail"));return}e?.("checkCode",{email:t})};return b||u?B(Wo,{children:Se(xe,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2,textAlign:"center"},children:[Se(xe,{sx:{mb:2},children:[B(_e,{variant:"h5",component:"h1",sx:{mb:1,fontWeight:600},children:m(u?"forgotPassword.codeAlreadyExistsMessage":"forgotPassword.emailSentMessage")}),B(_e,{variant:"body2",sx:{color:u?"success.main":"grey.600"},children:m("forgotPassword.checkEmailInstructions")})]}),B(qo,{type:"button",onClick:T,fullWidth:!0,variant:"contained",color:"primary",sx:{mt:2,mb:2},children:m("forgotPassword.enterCodeLink")}),B(xe,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:B(Ir,{sx:{cursor:"pointer"},onClick:C,variant:"body2",color:"secondary",children:m("base.btn.back")})})]})}):Se(Wo,{children:[Se(xe,{component:"form",noValidate:!0,onSubmit:y=>{y.preventDefault(),g()},sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[Se(xe,{sx:{mb:2},children:[B(_e,{variant:"h5",component:"h1",sx:{mb:1,fontWeight:600},children:m("forgotPassword.title")}),B(_e,{variant:"body2",sx:{color:"grey.600"},children:m("forgotPassword.instructions")})]}),Se(xe,{sx:{mb:1},children:[B(_e,{variant:"body2",component:"label",htmlFor:"email",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:m("forgotPassword.emailLabel")}),B(Cn,{fullWidth:!0,id:"email",name:"email",type:"email",value:t,disabled:n,onChange:y=>a(y.target.value),error:!!p,helperText:p,autoComplete:"email",placeholder:m("forgotPassword.emailPlaceholder"),required:!0,autoFocus:!0,inputRef:h})]}),B(qo,{disabled:n,type:"submit",fullWidth:!0,variant:"contained",color:"primary",sx:{mt:2,mb:2},children:n?B(Pn,{size:20}):m("forgotPassword.sendCodeButton")}),Se(xe,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:2},children:[B(Ir,{sx:{cursor:"pointer"},onClick:C,variant:"body2",color:"secondary",children:m("base.btn.back")}),B(_e,{variant:"body2",sx:{color:"grey.400"},children:"\u2022"}),B(Ir,{sx:{cursor:"pointer"},onClick:T,variant:"body2",color:"secondary",children:m("login.alreadyHaveCodeLink")})]})]}),B(xe,{children:l.length>0&&l.map((y,R)=>B(vn,{variant:"filled",sx:{mt:2},severity:"error",children:y},R))})]})},Ho=En;import{useState as j,useEffect as kr,useMemo as Ar,useRef as On,useCallback as Nn}from"react";import{Typography as ar,Button as Bn,Box as Ie,CircularProgress as $o,Link as Un}from"@mui/material";import{useState as Tn}from"react";import{TextField as Rn,IconButton as Sn,InputAdornment as In}from"@mui/material";import kn from"@mui/icons-material/Visibility";import An from"@mui/icons-material/VisibilityOff";import{jsx as qe}from"react/jsx-runtime";var Ln=({id:e,name:r,value:o,onChange:t,disabled:a=!1,error:n=!1,helperText:s,label:l,placeholder:i,autoComplete:p="current-password",showPasswordLabel:d="Show password",hidePasswordLabel:b="Hide password"})=>{let[x,u]=Tn(!1);return qe(Rn,{fullWidth:!0,id:e,name:r,type:x?"text":"password",value:o,disabled:a,onChange:t,error:n,helperText:s,autoComplete:p,placeholder:i,label:l,required:!0,InputProps:{endAdornment:qe(In,{position:"end",children:qe(Sn,{"aria-label":x?b:d,onClick:()=>{u(h=>!h)},edge:"end",size:"small",disabled:a,children:x?qe(An,{}):qe(kn,{})})})}})},tr=Ln;import{TextField as kl}from"@mui/material";import{jsx as Dl}from"react/jsx-runtime";import{Box as Dn,Alert as Fn}from"@mui/material";import{jsx as Ko}from"react/jsx-runtime";var _n=({errors:e,severity:r="error",variant:o="filled"})=>!e||e.length===0?null:Ko(Dn,{children:e.map((t,a)=>Ko(Fn,{variant:o,severity:r,sx:{mt:2},children:t},a))}),nr=_n;import{Fragment as Mn,jsx as z,jsxs as We}from"react/jsx-runtime";var zn=({onScreenChange:e,onError:r,searchParams:o,onResetSuccess:t,passwordRules:a})=>{let{crudify:n}=ye(),[s,l]=j(""),[i,p]=j(""),[d,b]=j(!1),[x,u]=j([]),[c,h]=j(null),[m,f]=j(null),[g,C]=j(""),[T,S]=j(""),[y,R]=j(!1),[L,M]=j(!0),[fe,te]=j(!1),[de,ne]=j(null),[Ae,ae]=j(!1),{t:E}=X(),I=On(null);kr(()=>()=>{I.current&&clearTimeout(I.current)},[]);let J=Nn((_,D=3e3)=>{I.current&&clearTimeout(I.current),I.current=setTimeout(()=>e?.(_),D)},[e]),v=Ar(()=>(a||Lo).map(D=>({...D,message:E(D.message)})),[a,E]),U=Ar(()=>ko(s,v),[s,v]),F=Ar(()=>Ao(U),[U]),se=s===i,Y=Re(E,"resetPassword");kr(()=>{if(!o)return;let _=we(o,"fromCodeVerification"),D=we(o,"email"),$=we(o,"code");if(_==="true"&&D&&$){C(D),S($),R(!0),te(!0),M(!1);return}let Q=we(o,"link");if(Q)try{let H=decodeURIComponent(Q),[ee,ge]=H.split("/");if(ee&&ge&&ee.length===6){S(ee),C(ge),R(!1),ne({email:ge,code:ee});return}}catch(H){console.warn("Failed to parse reset password link:",H)}if(D&&$){C(D),S($),R(!1),ne({email:D,code:$});return}u([E("resetPassword.invalidCode")]),M(!1),J("forgotPassword")},[o,E,J]),kr(()=>{n&&de&&!Ae&&(ae(!0),(async(D,$)=>{try{let Q=[{operation:"validatePasswordResetCode",data:{email:D,codePassword:$}}],H=await n.transaction(Q);if(H.data&&Array.isArray(H.data)&&H.data[0]?.response?.status==="OK"){te(!0);return}if(H.success)te(!0);else{let ge=K(H).map(Y);u(ge),J("forgotPassword")}}catch(Q){let ee=K(Q).map(Y);u(ee),J("forgotPassword")}finally{M(!1),ne(null),ae(!1)}})(de.email,de.code))},[n,de,Ae,E,Y,J]);let to=async()=>{if(d||!n)return;u([]),h(null),f(null);let _=!1;if(s?F||(h(E("resetPassword.passwordRequirementsNotMet")),_=!0):(h(E("resetPassword.newPasswordRequired")),_=!0),i?se||(f(E("resetPassword.passwordsDoNotMatch")),_=!0):(f(E("resetPassword.confirmPasswordRequired")),_=!0),!_){b(!0);try{let D=[{operation:"validateAndResetPassword",data:{email:g,codePassword:T,newPassword:s}}],$=await n.transaction(D);if($.success)u([]),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{t?.()},1e3);else{let H=K($).map(Y);u(H)}}catch(D){let Q=K(D).map(Y);u(Q),r&&r(Q.join(", "))}b(!1)}},Ge=()=>{y?e?.("checkCode",{email:g}):e?.("forgotPassword")};return L?z(Ie,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"300px"},children:z($o,{})}):fe?We(Mn,{children:[We(Ie,{component:"form",noValidate:!0,sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[We(Ie,{sx:{mb:2},children:[z(ar,{variant:"h5",component:"h1",sx:{mb:1,fontWeight:600},children:E("resetPassword.title")}),z(ar,{variant:"body2",sx:{color:"grey.600"},children:E("resetPassword.instructions")})]}),We(Ie,{sx:{mb:1},children:[z(ar,{variant:"body2",component:"label",htmlFor:"newPassword",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:E("resetPassword.newPasswordLabel")}),z(tr,{id:"newPassword",name:"newPassword",value:s,disabled:d,onChange:_=>l(_.target.value),error:!!c,helperText:c??void 0,autoComplete:"new-password",placeholder:E("resetPassword.newPasswordPlaceholder"),showPasswordLabel:E("base.btn.showPassword"),hidePasswordLabel:E("base.btn.hidePassword")}),z(Io,{requirements:U,show:s.length>0})]}),We(Ie,{sx:{mb:1},children:[z(ar,{variant:"body2",component:"label",htmlFor:"confirmPassword",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:E("resetPassword.confirmPasswordLabel")}),z(tr,{id:"confirmPassword",name:"confirmPassword",value:i,disabled:d,onChange:_=>p(_.target.value),error:!!m,helperText:m??void 0,autoComplete:"new-password",placeholder:E("resetPassword.confirmPasswordPlaceholder"),showPasswordLabel:E("base.btn.showPassword"),hidePasswordLabel:E("base.btn.hidePassword")})]}),z(Bn,{disabled:d||!F||!se||!s||!i,type:"button",onClick:to,fullWidth:!0,variant:"contained",color:"primary",sx:{mt:2,mb:2},children:d?z($o,{size:20}):E("resetPassword.resetPasswordButton")}),z(Ie,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:z(Un,{sx:{cursor:"pointer"},onClick:Ge,variant:"body2",color:"secondary",children:E("base.btn.back")})})]}),z(nr,{errors:x})]}):z(Ie,{children:z(nr,{errors:x})})},jo=zn;import{useState as He,useEffect as Go,useRef as Vn}from"react";import{Typography as Lr,TextField as qn,Button as Wn,Box as Ke,CircularProgress as Hn,Alert as Kn,Link as $n}from"@mui/material";import{Fragment as Gn,jsx as le,jsxs as sr}from"react/jsx-runtime";var jn=({onScreenChange:e,onError:r,searchParams:o})=>{let{crudify:t}=ye(),[a,n]=He(""),[s,l]=He(!1),[i,p]=He([]),[d,b]=He(null),[x,u]=He(""),c=Vn(null),{t:h}=X(),m=Re(h,"checkCode");Go(()=>{let S=we(o,"email");S?u(S):e?.("forgotPassword")},[o,e]),Go(()=>{c.current&&c.current.focus()},[]);let f=async()=>{if(!(s||!t)){if(p([]),b(null),!a){b(h("checkCode.codeRequired"));return}if(a.length!==6){b(h("checkCode.codeRequired"));return}l(!0);try{let S=[{operation:"validatePasswordResetCode",data:{email:x,codePassword:a}}],y=await t.transaction(S);if(y.success)e?.("resetPassword",{email:x,code:a,fromCodeVerification:"true"});else{let L=K(y).map(m);p(L),l(!1)}}catch(S){let R=K(S).map(m);p(R),l(!1),r&&r(R.join(", "))}}},g=()=>{e?.("forgotPassword")},C=S=>{n(or(S.target.value))};return sr(Gn,{children:[sr(Ke,{component:"form",noValidate:!0,onSubmit:S=>{S.preventDefault(),f()},sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[sr(Ke,{sx:{mb:2},children:[le(Lr,{variant:"h5",component:"h1",sx:{mb:1,fontWeight:600},children:h("checkCode.title")}),le(Lr,{variant:"body2",sx:{color:"grey.600"},children:h("checkCode.instructions")})]}),sr(Ke,{sx:{mb:1},children:[le(Lr,{variant:"body2",component:"label",htmlFor:"code",sx:{display:"block",fontWeight:500,color:"grey.700",mb:.5},children:h("checkCode.codeLabel")}),le(qn,{fullWidth:!0,id:"code",name:"code",type:"text",value:a,disabled:s,onChange:C,error:!!d,helperText:d,placeholder:h("checkCode.codePlaceholder"),inputProps:{maxLength:6,style:{textAlign:"center",fontSize:"1.5rem",letterSpacing:"0.4rem"}},required:!0,autoFocus:!0,inputRef:c})]}),le(Wn,{disabled:s||a.length!==6,type:"submit",fullWidth:!0,variant:"contained",color:"primary",sx:{mt:2,mb:2},children:s?le(Hn,{size:20}):h("checkCode.verifyButton")}),le(Ke,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:le($n,{sx:{cursor:"pointer"},onClick:g,variant:"body2",color:"secondary",children:h("base.btn.back")})})]}),le(Ke,{children:i.length>0&&i.map((S,y)=>le(Kn,{sx:{mt:2},severity:"error",children:S},y))})]})},Yo=jn;import{Box as Yn,CircularProgress as Xn,Alert as Xo,Typography as Dr}from"@mui/material";import{Fragment as Zn,jsx as Oe,jsxs as Zo}from"react/jsx-runtime";var Jo=({children:e,fallback:r})=>{let{isLoading:o,error:t,isInitialized:a}=ye(),{t:n}=X();return o?r||Zo(Yn,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:[Oe(Xn,{}),Oe(Dr,{variant:"body2",color:"text.secondary",children:n("login.initializing")!=="login.initializing"?n("login.initializing"):"Initializing..."})]}):t?Oe(Xo,{severity:"error",sx:{mt:2},children:Zo(Dr,{variant:"body2",children:[n("login.initializationError")!=="login.initializationError"?n("login.initializationError"):"Initialization error",":"," ",t]})}):a?Oe(Zn,{children:e}):Oe(Xo,{severity:"warning",sx:{mt:2},children:Oe(Dr,{variant:"body2",children:n("login.notInitialized")!=="login.notInitialized"?n("login.notInitialized"):"System not initialized"})})};import{jsx as re,jsxs as oa}from"react/jsx-runtime";var ea=({onScreenChange:e,onExternalNavigate:r,onLoginSuccess:o,onError:t,redirectUrl:a="/",passwordRules:n})=>{let{t:s}=X(),{state:l,setScreen:i}=er(),{config:p}=be(),{showNotification:d}=fo(),b=(u,c)=>{let h=c;u==="login"?h={}:u==="forgotPassword"&&!c&&(h={}),i(u,h),e?.(u,h)},x=()=>{let u={onScreenChange:b,onExternalNavigate:r,onError:t,redirectUrl:a};switch(l.currentScreen){case"forgotPassword":return re(Ho,{...u});case"checkCode":return re(Yo,{...u,searchParams:l.searchParams});case"resetPassword":return re(jo,{...u,searchParams:l.searchParams,passwordRules:n,onResetSuccess:()=>{let c=s("resetPassword.successMessage");d(c,"success"),b("login")}});default:return re(Vo,{...u,onLoginSuccess:o})}};return oa(Jo,{children:[re(Jn,{sx:{display:"flex",justifyContent:"center",mb:3},children:re("img",{src:p.logo||"https://logos.crudia.com/nocios-default.png",alt:s("login.logoAlt"),style:{width:"100%",maxWidth:"150px",height:"auto"},onError:u=>{let c=u.target;c.src="https://logos.crudia.com/nocios-default.png"}})}),!p.logo&&p.appName&&re(Qn,{variant:"h6",component:"h1",sx:{textAlign:"center",mb:2},children:p.appName}),x()]})},ra=({translations:e,translationsUrl:r,language:o="en",initialScreen:t="login",autoReadFromCookies:a=!0,...n})=>{let{config:s}=be();return re(Oo,{translations:e,translationsUrl:r,language:o,children:re(go,{config:s,children:re(Uo,{config:s,initialScreen:t,autoReadFromCookies:a,children:re(ea,{...n})})})})},Ec=ra;import{Box as G,Card as Qo,CardContent as et,Typography as oe,Chip as ir,Avatar as ta,Divider as na,CircularProgress as aa,Alert as rt,List as sa,ListItem as Fr,ListItemText as _r,ListItemIcon as ia,Collapse as la,IconButton as Or}from"@mui/material";import{Person as ca,Email as da,Badge as ua,Security as pa,Schedule as ma,AccountCircle as fa,ExpandMore as ga,ExpandLess as ha,Info as ya}from"@mui/icons-material";import{useState as ba}from"react";import{Fragment as Ca,jsx as P,jsxs as k}from"react/jsx-runtime";var wa=({showExtendedData:e=!0,showProfileCard:r=!0,autoRefresh:o=!0})=>{let{userProfile:t,loading:a,error:n,extendedData:s,refreshProfile:l}=ho({autoFetch:o,retryOnError:!0,maxRetries:3}),[i,p]=ba(!1);if(a)return k(G,{display:"flex",justifyContent:"center",alignItems:"center",p:3,children:[P(aa,{}),P(oe,{variant:"body2",sx:{ml:2},children:"Cargando perfil de usuario..."})]});if(n)return k(rt,{severity:"error",action:P(Or,{color:"inherit",size:"small",onClick:l,children:P(oe,{variant:"caption",children:"Reintentar"})}),children:["Error al cargar el perfil: ",n]});if(!t)return P(rt,{severity:"warning",children:"No se encontr\xF3 informaci\xF3n del usuario"});let d=s?.displayData||{},b=s?.totalFields||0,x=g=>{if(!g)return"No disponible";try{return new Date(g).toLocaleString("es-ES",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return g}},u=(g,C)=>C==null?"No disponible":typeof C=="boolean"?C?"S\xED":"No":Array.isArray(C)?C.length>0?C.join(", "):"Ninguno":typeof C=="object"?JSON.stringify(C,null,2):String(C),c=[{key:"id",label:"ID",icon:P(ua,{})},{key:"email",label:"Email",icon:P(da,{})},{key:"username",label:"Usuario",icon:P(ca,{})},{key:"fullName",label:"Nombre completo",icon:P(fa,{})},{key:"role",label:"Rol",icon:P(pa,{})}],h=[{key:"firstName",label:"Nombre"},{key:"lastName",label:"Apellido"},{key:"isActive",label:"Activo"},{key:"lastLogin",label:"\xDAltimo login"},{key:"createdAt",label:"Creado"},{key:"updatedAt",label:"Actualizado"}],m=[...c.map(g=>g.key),...h.map(g=>g.key),"permissions"],f=Object.keys(d).filter(g=>!m.includes(g)).map(g=>({key:g,label:g}));return k(G,{children:[r&&P(Qo,{sx:{mb:2},children:k(et,{children:[k(G,{display:"flex",alignItems:"center",mb:2,children:[P(ta,{src:d.avatar,sx:{width:56,height:56,mr:2},children:d.fullName?.[0]||d.username?.[0]||d.email?.[0]}),k(G,{children:[P(oe,{variant:"h6",children:d.fullName||d.username||d.email}),P(oe,{variant:"body2",color:"text.secondary",children:d.role||"Usuario"}),d.isActive!==void 0&&P(ir,{label:d.isActive?"Activo":"Inactivo",color:d.isActive?"success":"error",size:"small",sx:{mt:.5}})]})]}),P(G,{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:2,children:c.map(({key:g,label:C,icon:T})=>d[g]?k(G,{display:"flex",alignItems:"center",children:[P(G,{sx:{mr:1,color:"text.secondary"},children:T}),k(G,{children:[P(oe,{variant:"caption",color:"text.secondary",children:C}),P(oe,{variant:"body2",children:u(g,d[g])})]})]},g):null)}),d.permissions&&Array.isArray(d.permissions)&&d.permissions.length>0&&k(G,{mt:2,children:[P(oe,{variant:"caption",color:"text.secondary",display:"block",children:"Permisos"}),k(G,{display:"flex",flexWrap:"wrap",gap:.5,mt:.5,children:[d.permissions.slice(0,5).map((g,C)=>P(ir,{label:g,size:"small",variant:"outlined"},C)),d.permissions.length>5&&P(ir,{label:`+${d.permissions.length-5} m\xE1s`,size:"small"})]})]})]})}),e&&P(Qo,{children:k(et,{children:[k(G,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[k(oe,{variant:"h6",display:"flex",alignItems:"center",children:[P(ya,{sx:{mr:1}}),"Informaci\xF3n Detallada"]}),P(ir,{label:`${b} campos totales`,size:"small"})]}),k(sa,{dense:!0,children:[h.map(({key:g,label:C})=>d[g]!==void 0&&k(Fr,{divider:!0,children:[P(ia,{children:P(ma,{fontSize:"small"})}),P(_r,{primary:C,secondary:g.includes("At")||g.includes("Login")?x(d[g]):u(g,d[g])})]},g)),f.length>0&&k(Ca,{children:[P(na,{sx:{my:1}}),P(Fr,{children:P(_r,{primary:k(G,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k(oe,{variant:"subtitle2",children:["Campos Personalizados (",f.length,")"]}),P(Or,{size:"small",onClick:()=>p(!i),children:i?P(ha,{}):P(ga,{})})]})})}),P(la,{in:i,children:f.map(({key:g,label:C})=>P(Fr,{sx:{pl:4},children:P(_r,{primary:C,secondary:u(g,d[g])})},g))})]})]}),k(G,{mt:2,display:"flex",justifyContent:"space-between",alignItems:"center",children:[k(oe,{variant:"caption",color:"text.secondary",children:["\xDAltima actualizaci\xF3n: ",x(d.updatedAt)]}),P(Or,{size:"small",onClick:l,disabled:a,children:P(oe,{variant:"caption",children:"Actualizar"})})]})]})})]})},xa=wa;var ot=["create","read","update","delete"],tt=["create","read","update","delete"];import{useRef as Ha}from"react";import{useTranslation as Ka}from"react-i18next";import{Box as dr,Typography as dt,Button as $a,Stack as ja,Alert as ut,Divider as Ga}from"@mui/material";import{Add as Ya}from"@mui/icons-material";import{forwardRef as La}from"react";import{useTranslation as Da}from"react-i18next";import{Box as ke,FormControl as Fa,InputLabel as _a,Select as Oa,MenuItem as Na,IconButton as Ba,Typography as Ne,FormHelperText as Ua,Stack as cr,Paper as ct,Divider as za,Button as zr}from"@mui/material";import{Delete as Ma,SelectAll as Va,ClearAll as qa}from"@mui/icons-material";import{useState as nt,useEffect as at,useRef as st}from"react";import{useTranslation as Pa}from"react-i18next";import{Box as lr,Typography as $e,Button as it,Stack as Nr,FormControlLabel as va,FormHelperText as lt,Switch as Ea,ToggleButton as Br,ToggleButtonGroup as Ta}from"@mui/material";import{CheckCircle as Ra,Cancel as Sa,SelectAll as Ia,ClearAll as ka}from"@mui/icons-material";import{jsx as O,jsxs as Ce}from"react/jsx-runtime";var Aa=({value:e,onChange:r,availableFields:o,error:t,disabled:a=!1})=>{let{t:n}=Pa(),[s,l]=nt("custom"),[i,p]=nt(!1),d=st(null);at(()=>{i&&d.current?.scrollIntoView({behavior:"smooth",block:"start"})},[i]);let b=st(!1);at(()=>{let m=e||{allow:[],owner_allow:[],deny:[]},f=new Set(o),g=(m.allow||[]).filter(y=>f.has(y)),C=(m.owner_allow||[]).filter(y=>f.has(y)),T=(m.deny||[]).filter(y=>f.has(y));o.forEach(y=>{!g.includes(y)&&!C.includes(y)&&!T.includes(y)&&T.push(y)});let S={allow:g,owner_allow:C,deny:T};JSON.stringify(S)!==JSON.stringify(m)&&r(S),g.length===o.length?l("all"):T.length===o.length?l("none"):l("custom")},[o,e]);let x=()=>{b.current=!0,r({allow:[...o],owner_allow:[],deny:[]}),l("all"),setTimeout(()=>{b.current=!1},0)},u=()=>{b.current=!0,r({allow:[],owner_allow:[],deny:[...o]}),l("none"),setTimeout(()=>{b.current=!1},0)},c=m=>e?.allow?.includes(m)?"allow":e?.owner_allow?.includes(m)?"owner_allow":"deny",h=(m,f)=>{b.current=!0;let g=new Set(e?.allow||[]),C=new Set(e?.owner_allow||[]),T=new Set(e?.deny||[]);g.delete(m),C.delete(m),T.delete(m),f==="allow"&&g.add(m),f==="owner_allow"&&C.add(m),f==="deny"&&T.add(m),r({allow:Array.from(g),owner_allow:Array.from(C),deny:Array.from(T)}),l("custom"),setTimeout(()=>{b.current=!1},0)};return o.length===0?Ce(lr,{children:[O($e,{variant:"body2",color:"text.secondary",sx:{mb:1},children:n("publicPolicies.fields.conditions.label")}),O($e,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:n("publicPolicies.fields.conditions.noFieldsAvailable")}),t&&O(lt,{error:!0,sx:{mt:1},children:t})]}):Ce(lr,{children:[O($e,{variant:"body2",color:"text.secondary",sx:{mb:2},children:n("publicPolicies.fields.conditions.label")}),Ce(Nr,{direction:"row",spacing:1,alignItems:"center",sx:{mb:i?3:1},children:[O(it,{variant:s==="all"?"contained":"outlined",startIcon:O(Ia,{}),onClick:x,disabled:a,size:"small",sx:{minWidth:120,...s==="all"&&{backgroundColor:"#16a34a","&:hover":{backgroundColor:"#15803d"}}},children:n("publicPolicies.fields.conditions.allFields")}),O(it,{variant:s==="none"?"contained":"outlined",startIcon:O(ka,{}),onClick:u,disabled:a,size:"small",sx:{minWidth:120,...s==="none"&&{backgroundColor:"#cf222e","&:hover":{backgroundColor:"#bc1f2c"}}},children:n("publicPolicies.fields.conditions.noFields")}),O(lr,{sx:{display:"flex",alignItems:"center",px:1.5,py:.35,borderRadius:"999px",backgroundColor:"#f3f4f6",border:"1px solid #d1d9e0"},children:O(va,{control:O(Ea,{size:"small",checked:i,onChange:()=>p(m=>!m),disabled:a,color:"primary",sx:{transform:"scale(1.15)",transformOrigin:"center",m:0}}),label:n("publicPolicies.fields.conditions.customEdit"),labelPlacement:"end",sx:{ml:0,".MuiFormControlLabel-label":{fontSize:"0.75rem"}}})})]}),i&&Ce(lr,{ref:d,sx:{p:2,border:"1px solid #d1d9e0",borderRadius:1,backgroundColor:"#f6f8fa"},children:[O($e,{variant:"body2",color:"text.secondary",sx:{mb:2},children:n("publicPolicies.fields.conditions.help")}),O(Nr,{spacing:1,children:o.map(m=>{let f=c(m);return Ce(Nr,{direction:"row",spacing:1,alignItems:"center",children:[O($e,{variant:"body2",sx:{minWidth:100,fontFamily:"monospace"},children:m}),Ce(Ta,{value:f,exclusive:!0,size:"small",children:[Ce(Br,{value:"allow",onClick:()=>h(m,"allow"),disabled:a,sx:{px:2,color:f==="allow"?"#ffffff":"#6b7280",backgroundColor:f==="allow"?"#16a34a":"#f3f4f6",borderColor:f==="allow"?"#16a34a":"#d1d5db","&:hover":{backgroundColor:f==="allow"?"#15803d":"#e5e7eb",borderColor:f==="allow"?"#15803d":"#9ca3af"},"&.Mui-selected":{backgroundColor:"#16a34a",color:"#ffffff","&:hover":{backgroundColor:"#15803d"}}},children:[O(Ra,{sx:{fontSize:16,mr:.5}}),n("publicPolicies.fields.conditions.states.allow")]}),O(Br,{value:"owner_allow",onClick:()=>h(m,"owner_allow"),disabled:a,sx:{px:2,color:f==="owner_allow"?"#ffffff":"#6b7280",backgroundColor:f==="owner_allow"?"#0ea5e9":"#f3f4f6",borderColor:f==="owner_allow"?"#0ea5e9":"#d1d5db","&:hover":{backgroundColor:f==="owner_allow"?"#0284c7":"#e5e7eb",borderColor:f==="owner_allow"?"#0284c7":"#9ca3af"},"&.Mui-selected":{backgroundColor:"#0ea5e9",color:"#ffffff","&:hover":{backgroundColor:"#0284c7"}}},children:n("publicPolicies.fields.conditions.states.ownerAllow")}),Ce(Br,{value:"deny",onClick:()=>h(m,"deny"),disabled:a,sx:{px:2,color:f==="deny"?"#ffffff":"#6b7280",backgroundColor:f==="deny"?"#dc2626":"#f3f4f6",borderColor:f==="deny"?"#dc2626":"#d1d5db","&:hover":{backgroundColor:f==="deny"?"#b91c1c":"#e5e7eb",borderColor:f==="deny"?"#b91c1c":"#9ca3af"},"&.Mui-selected":{backgroundColor:"#dc2626",color:"#ffffff","&:hover":{backgroundColor:"#b91c1c"}}},children:[O(Sa,{sx:{fontSize:16,mr:.5}}),n("publicPolicies.fields.conditions.states.deny")]})]})]},m)})})]}),t&&O(lt,{error:!0,sx:{mt:1},children:t})]})},Ur=Aa;import{jsx as N,jsxs as V}from"react/jsx-runtime";var Wa=La(({policy:e,onChange:r,onRemove:o,availableFields:t,isSubmitting:a=!1,usedActions:n,error:s},l)=>{let{t:i}=Da(),p=new Set(Array.from(n||[]));p.delete(e.action);let d=ot.map(b=>({value:b,label:i(`publicPolicies.fields.action.options.${b}`)}));return V(ct,{ref:l,sx:{p:3,border:"1px solid #d1d9e0",borderRadius:2,position:"relative",backgroundColor:"#ffffff"},children:[V(ke,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:3},children:[N(Ne,{variant:"subtitle1",sx:{fontWeight:600,color:"#111418",fontSize:"1rem"},children:i("publicPolicies.policyTitle")}),N(Ba,{onClick:o,size:"small",disabled:a,"aria-label":i("publicPolicies.removePolicy"),sx:{color:"#656d76","&:hover":{color:"#cf222e",backgroundColor:"rgba(207, 34, 46, 0.1)"}},children:N(Ma,{})})]}),V(cr,{spacing:1,children:[N(cr,{direction:{xs:"column",md:"row"},spacing:2,children:N(ke,{sx:{flex:1,minWidth:200},children:V(Fa,{fullWidth:!0,children:[N(_a,{children:i("publicPolicies.fields.action.label")}),N(Oa,{value:e.action,label:i("publicPolicies.fields.action.label"),disabled:a,onChange:b=>{let x=b.target.value,u={...e,action:x};x==="delete"?(u.permission="deny",delete u.fields):(u.fields={allow:[],owner_allow:[],deny:t},delete u.permission),r(u)},sx:{backgroundColor:"#ffffff","&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#8c959f"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#0969da",borderWidth:2}},children:d.map(b=>{let x=p.has(b.value);return N(Na,{value:b.value,disabled:x,children:b.label},b.value)})}),s&&N(Ua,{error:!0,children:s})]})})}),e.action==="delete"?V(ke,{children:[N(Ne,{variant:"body2",color:"text.secondary",sx:{mb:2},children:i("publicPolicies.fields.conditions.label")}),V(cr,{direction:"row",spacing:1,sx:{mb:1},children:[N(zr,{variant:e.permission==="*"?"contained":"outlined",startIcon:N(Va,{}),onClick:()=>r({...e,permission:"*"}),disabled:a,size:"small",sx:{minWidth:140,whiteSpace:"nowrap",...e.permission==="*"&&{backgroundColor:"#16a34a","&:hover":{backgroundColor:"#15803d"}}},children:i("publicPolicies.fields.conditions.allFields")}),N(zr,{variant:e.permission==="owner"?"contained":"outlined",onClick:()=>r({...e,permission:"owner"}),disabled:a,size:"small",sx:{minWidth:140,whiteSpace:"nowrap",...e.permission==="owner"&&{backgroundColor:"#0ea5e9","&:hover":{backgroundColor:"#0284c7"}}},children:i("publicPolicies.fields.conditions.states.ownerAllow")}),N(zr,{variant:e.permission==="deny"?"contained":"outlined",startIcon:N(qa,{}),onClick:()=>r({...e,permission:"deny"}),disabled:a,size:"small",sx:{minWidth:140,whiteSpace:"nowrap",...e.permission==="deny"&&{backgroundColor:"#cf222e","&:hover":{backgroundColor:"#bc1f2c"}}},children:i("publicPolicies.fields.conditions.noFields")})]})]}):N(Ur,{value:e.fields||{allow:[],owner_allow:[],deny:[]},onChange:b=>r({...e,fields:b}),availableFields:t,disabled:a}),N(ct,{variant:"outlined",sx:{p:2,backgroundColor:"#f9fafb"},children:e.action==="delete"?V(Ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.secondary"},children:[V(ke,{component:"span",sx:{color:e.permission==="*"?"#16a34a":e.permission==="owner"?"#0ea5e9":"#dc2626"},children:[i("publicPolicies.fields.conditions.states.allow"),":"]})," ",e.permission||"-"]}):V(cr,{spacing:.5,divider:N(za,{sx:{borderColor:"#e5e7eb"}}),children:[V(Ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.secondary"},children:[V(ke,{component:"span",sx:{color:"#16a34a"},children:[i("publicPolicies.fields.conditions.states.allow"),":"]})," ",(e?.fields?.allow||[]).join(", ")||"-"]}),V(Ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.secondary"},children:[V(ke,{component:"span",sx:{color:"#0ea5e9"},children:[i("publicPolicies.fields.conditions.states.ownerAllow"),":"]})," ",(e?.fields?.owner_allow||[]).join(", ")||"-"]}),V(Ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.secondary"},children:[V(ke,{component:"span",sx:{color:"#dc2626"},children:[i("publicPolicies.fields.conditions.states.deny"),":"]})," ",(e?.fields?.deny||[]).join(", ")||"-"]})]})})]})]})}),Mr=Wa;import{Fragment as Ja,jsx as ce,jsxs as ur}from"react/jsx-runtime";var Xa=()=>typeof globalThis<"u"&&globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,Za=({policies:e,onChange:r,availableFields:o,errors:t,isSubmitting:a=!1})=>{let{t:n}=Ka(),s=Ha({}),l=new Set((e||[]).map(c=>c.action).filter(Boolean)),i=tt.filter(c=>!l.has(c)),p=i.length>0,d=()=>{let c=i[0]||"create",h={id:Xa(),action:c};c==="delete"?h.permission="deny":h.fields={allow:[],owner_allow:[],deny:o};let m=[...e||[],h];r(m),setTimeout(()=>{let f=m.length-1,g=s.current[f];g&&g.scrollIntoView({behavior:"smooth",block:"center"})},100)},b=c=>{let h=[...e];h.splice(c,1),r(h)},x=(()=>{if(!t)return null;if(typeof t=="string")return t;let c=t._error;return typeof c=="string"?c:null})(),u=new Set((e||[]).map(c=>c.action));return ur(Ja,{children:[ce(Ga,{sx:{borderColor:"#e0e4e7"}}),ur(dr,{children:[ce(dr,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:ur(dr,{children:[ce(dt,{variant:"h6",sx:{fontWeight:600,color:"#111418",mb:1},children:n("publicPolicies.title")}),ce(dt,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.875rem"},children:n("publicPolicies.description")})]})}),x&&ce(ut,{severity:"error",sx:{mb:3},children:x}),ur(ja,{spacing:3,children:[(e||[]).length===0?ce(ut,{severity:"info",children:n("publicPolicies.noPolicies")}):e.map((c,h)=>ce(Mr,{ref:m=>{s.current[h]=m},policy:c,onChange:m=>{let f=[...e];f[h]=m,r(f)},onRemove:()=>b(h),availableFields:o,isSubmitting:a,usedActions:u,error:typeof t=="object"&&t!==null&&!("_error"in t)&&c.id in t?t[c.id]:void 0},c.id)),p&&ce(dr,{children:ce($a,{type:"button",variant:"outlined",startIcon:ce(Ya,{}),onClick:d,disabled:a,sx:{borderColor:"#d0d7de",color:"#656d76","&:hover":{borderColor:"#8c959f",backgroundColor:"transparent"}},children:n("publicPolicies.addPolicy")})})]})]})]})},ld=Za;import{useState as Vr}from"react";import{Button as pr,TextField as pt,Box as Be,Alert as je,Typography as Pe,CircularProgress as qr}from"@mui/material";import{jsx as A,jsxs as pe}from"react/jsx-runtime";function gd(){let[e,r]=Vr(""),[o,t]=Vr(""),[a,n]=Vr(!1),{isAuthenticated:s,isLoading:l,error:i,login:p,logout:d,refreshTokens:b,clearError:x,isExpiringSoon:u,expiresIn:c}=be(),h=async g=>{if(g.preventDefault(),!e||!o)return;(await p(e,o)).success&&(r(""),t(""),n(!1))},m=async()=>{await d()},f=async()=>{await b()};return s?pe(Be,{sx:{maxWidth:600,mx:"auto",p:3},children:[A(Pe,{variant:"h4",gutterBottom:!0,children:"Welcome! \u{1F389}"}),A(je,{severity:"success",sx:{mb:3},children:"You are successfully logged in with Refresh Token Pattern enabled"}),pe(Be,{sx:{mb:3,p:2,bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1},children:[A(Pe,{variant:"h6",gutterBottom:!0,children:"Token Status"}),pe(Pe,{variant:"body2",color:"text.secondary",children:["Access Token expires in: ",Math.round(c/1e3/60)," minutes"]}),u&&A(je,{severity:"warning",sx:{mt:1},children:"Token expires soon - automatic refresh will happen"})]}),pe(Be,{sx:{display:"flex",gap:2,flexWrap:"wrap"},children:[A(pr,{variant:"contained",onClick:f,disabled:l,startIcon:l?A(qr,{size:16}):null,children:"Refresh Tokens"}),A(pr,{variant:"outlined",color:"error",onClick:m,disabled:l,children:"Logout"})]}),i&&A(je,{severity:"error",sx:{mt:2},onClose:x,children:i})]}):pe(Be,{sx:{maxWidth:400,mx:"auto",p:3},children:[A(Pe,{variant:"h4",gutterBottom:!0,align:"center",children:"Login with Refresh Tokens"}),A(je,{severity:"info",sx:{mb:3},children:"This demo shows the new Refresh Token Pattern with automatic session management"}),a?pe("form",{onSubmit:h,children:[A(pt,{fullWidth:!0,label:"Email",type:"email",value:e,onChange:g=>r(g.target.value),margin:"normal",required:!0,autoComplete:"email"}),A(pt,{fullWidth:!0,label:"Password",type:"password",value:o,onChange:g=>t(g.target.value),margin:"normal",required:!0,autoComplete:"current-password"}),A(pr,{type:"submit",fullWidth:!0,variant:"contained",size:"large",disabled:l,startIcon:l?A(qr,{size:16}):null,sx:{mt:3,mb:2},children:l?"Logging in...":"Login"})]}):A(pr,{fullWidth:!0,variant:"contained",size:"large",onClick:()=>n(!0),sx:{mt:2},children:"Show Login Form"}),i&&A(je,{severity:"error",sx:{mt:2},onClose:x,children:i})]})}function hd(){let{isAuthenticated:e,isLoading:r,isExpiringSoon:o,expiresIn:t}=be();return r?pe(Be,{sx:{display:"flex",alignItems:"center",gap:1},children:[A(qr,{size:16}),A(Pe,{variant:"caption",children:"Loading session..."})]}):e?pe(Be,{children:[A(Pe,{variant:"caption",color:"success.main",children:"\u2713 Authenticated"}),o&&pe(Pe,{variant:"caption",color:"warning.main",display:"block",children:["\u26A0 Token expires in ",Math.round(t/1e3/60)," min"]})]}):A(Pe,{variant:"caption",color:"text.secondary",children:"Not logged in"})}import Qa from"@mui/material/TextField";import es from"@mui/material/CircularProgress";import mt from"@mui/material/InputAdornment";import rs from"@mui/material/IconButton";import os from"@mui/icons-material/Refresh";import{jsx as ve}from"react/jsx-runtime";var ts=e=>e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/javascript:/gi,"").replace(/on\w+\s*=/gi,"").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),ns=({html:e})=>ve("span",{dangerouslySetInnerHTML:{__html:ts(e)}}),Td=({config:e,value:r,onChange:o,label:t,error:a=!1,helperText:n,readOnly:s=!1,disabled:l=!1})=>{let{value:i,loading:p,error:d,regenerate:b}=yo(e,{autoFetch:!r,onSuccess:f=>{o?.(f)}}),x=r||i,u=a||!!d,c=d||n,h=u&&c&&(c.toLowerCase().includes("duplicate")||c.toLowerCase().includes("duplicado")||c.toLowerCase().includes("duplicada")||c.toLowerCase().includes("unique")||c.toLowerCase().includes("\xFAnico")||c.toLowerCase().includes("unico")||c.toLowerCase().includes("\xFAnica")||c.toLowerCase().includes("unica")||c.toLowerCase().includes("already exists")||c.toLowerCase().includes("ya existe")||c.toLowerCase().includes("e11000"));return ve(Qa,{label:t,fullWidth:!0,value:x,error:u,helperText:c?ve(ns,{html:c}):" ",disabled:l,InputProps:{readOnly:!0,startAdornment:p?ve(mt,{position:"start",children:ve(es,{size:20})}):void 0,endAdornment:h&&!p?ve(mt,{position:"end",children:ve(rs,{edge:"end",onClick:async()=>{!l&&!p&&await b()},disabled:l,size:"small",color:"error","aria-label":"regenerar c\xF3digo",title:"Regenerar c\xF3digo",children:ve(os,{})})}):void 0}})};import Qr,{useCallback as yr,useRef as eo}from"react";import xt from"@mui/material/Box";import Ct from"@mui/material/Typography";import Ds from"@mui/material/CircularProgress";import Fs from"@mui/material/List";import _s from"@mui/material/FormHelperText";var ft=e=>e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/javascript:/gi,"").replace(/on\w+\s*=/gi,"").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),gt=e=>{if(e===0)return"0 B";let r=1024,o=["B","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(r));return`${parseFloat((e/Math.pow(r,t)).toFixed(1))} ${o[t]}`};import{useCallback as Wr,useState as as}from"react";var Hr=({disabled:e,onFilesDropped:r,onInteraction:o})=>{let[t,a]=as(!1),n=Wr(i=>{i.preventDefault(),i.stopPropagation(),e||a(!0)},[e]),s=Wr(i=>{i.preventDefault(),i.stopPropagation(),a(!1)},[]),l=Wr(i=>{if(i.preventDefault(),i.stopPropagation(),a(!1),e)return;o?.();let p=i.dataTransfer.files;p&&p.length>0&&r(p)},[e,r,o]);return{isDragging:t,handleDragOver:n,handleDragLeave:s,handleDrop:l}};import{useCallback as Kr,useState as $r}from"react";var jr=({deleteFileImmediately:e})=>{let[r,o]=$r(!1),[t,a]=$r(null),[n,s]=$r(!1),l=Kr(d=>{a(d),o(!0)},[]),i=Kr(async()=>{if(t){s(!0);try{let d=await e(t);d.success||w.error("Error deleting file",{error:d.error})}finally{s(!1),o(!1),a(null)}}},[t,e]),p=Kr(()=>{o(!1),a(null)},[]);return{isOpen:r,isDeleting:n,fileToDelete:t,openConfirmation:l,handleConfirm:i,handleCancel:p}};import{useState as ps}from"react";import mr from"@mui/material/Box";import fr from"@mui/material/Typography";import Yr from"@mui/material/IconButton";import ms from"@mui/material/LinearProgress";import fs from"@mui/material/ListItem";import gs from"@mui/material/ListItemText";import hs from"@mui/material/ListItemSecondaryAction";import ys from"@mui/icons-material/Delete";import bs from"@mui/icons-material/Refresh";import ws from"@mui/icons-material/Restore";import ht from"@mui/material/CircularProgress";import ss from"@mui/material/Chip";import is from"@mui/icons-material/InsertDriveFile";import ls from"@mui/icons-material/Image";import cs from"@mui/icons-material/PictureAsPdf";import ds from"@mui/icons-material/CheckCircle";import us from"@mui/icons-material/Error";import{jsx as Ee}from"react/jsx-runtime";var Gr=e=>e.startsWith("image/")?Ee(ls,{color:"primary"}):e==="application/pdf"?Ee(cs,{color:"error"}):Ee(is,{color:"action"}),yt=(e,r)=>{switch(e){case"completed":return Ee(ds,{color:"success",fontSize:"small"});case"error":return Ee(us,{color:"error",fontSize:"small"});case"uploading":case"pending":return Ee(ht,{size:16});case"removing":return Ee(ht,{size:16,color:"error"});case"pendingDeletion":return Ee(ss,{label:r("base.file.pendingDeletion"),size:"small",color:"warning",variant:"outlined",sx:{fontSize:"0.65rem",height:20}});default:return null}};import{jsx as q,jsxs as gr}from"react/jsx-runtime";var Xr=({file:e,baseUrl:r,disabled:o,onRemove:t,onRestore:a,onRetry:n})=>{let{t:s}=Te(),[l,i]=ps(!1),p=e.status==="pendingDeletion",d=!o&&e.status!=="uploading"&&e.status!=="removing"&&!p,b=!o&&p,x=!o&&e.status==="error"&&e.file,u=e.contentType.startsWith("image/"),c=e.visibility==="public"||e.filePath?.startsWith("public/")||e.filePath?.startsWith(r),m=!e.filePath||!c?null:e.filePath.startsWith("http://")||e.filePath.startsWith("https://")||e.filePath.startsWith(r)?e.filePath:`${r}${e.filePath}`,f=e.status==="completed"&&m,g=()=>u&&f&&!l?q(mr,{component:f?"a":"div",href:m||void 0,target:"_blank",rel:"noopener noreferrer",sx:{width:48,height:48,borderRadius:1,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.100",border:"1px solid",borderColor:"divider",cursor:f?"pointer":"default",transition:"all 0.2s ease",flexShrink:0,"&:hover":f?{borderColor:"primary.main",transform:"scale(1.05)"}:{}},children:q("img",{src:m,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"},onError:()=>i(!0)})}):q(mr,{component:f?"a":"div",href:m||void 0,target:"_blank",rel:"noopener noreferrer",sx:{width:48,height:48,borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.50",border:"1px solid",borderColor:"divider",cursor:f?"pointer":"default",transition:"all 0.2s ease",flexShrink:0,textDecoration:"none","&:hover":f?{borderColor:"primary.main",bgcolor:"action.hover"}:{}},children:Gr(e.contentType)});return gr(fs,{sx:{borderRadius:1,mb:.5,bgcolor:e.status==="error"?"error.lighter":"background.paper",border:"1px solid",borderColor:e.status==="error"?"error.light":"divider",gap:1.5},children:[g(),q(gs,{primary:gr(mr,{sx:{display:"flex",alignItems:"center",gap:1},children:[q(fr,{variant:"body2",noWrap:!0,sx:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",textDecoration:p?"line-through":"none",opacity:p?.6:1},children:e.name}),yt(e.status,s)]}),secondary:gr(mr,{sx:{opacity:p?.6:1},children:[e.size>0&&q(fr,{variant:"caption",color:"text.secondary",children:gt(e.size)}),e.status==="uploading"&&q(ms,{variant:"determinate",value:e.progress,sx:{mt:.5,height:4,borderRadius:2}}),e.status==="error"&&e.errorMessage&&q(fr,{variant:"caption",color:"error",display:"block",children:e.errorMessage}),f&&q(fr,{variant:"caption",color:"primary",display:"block",component:"a",href:m||void 0,target:"_blank",rel:"noopener noreferrer",sx:{cursor:"pointer",textDecoration:"underline","&:hover":{textDecoration:"none"}},children:s(u?"base.file.clickToPreview":"base.file.clickToDownload")})]})}),gr(hs,{children:[x&&q(Yr,{edge:"end",size:"small",onClick:()=>n(e.id),color:"primary",title:s("base.file.restore"),children:q(bs,{fontSize:"small"})}),b&&q(Yr,{edge:"end",size:"small",onClick:()=>a(e.id),color:"primary",title:s("base.file.restore"),children:q(ws,{fontSize:"small"})}),d&&q(Yr,{edge:"end",size:"small",onClick:()=>t(e.id),color:"error",title:s("base.file.delete"),children:q(ys,{fontSize:"small"})})]})]})};import{useState as uu}from"react";import mu from"@mui/material/Box";import gu from"@mui/material/Typography";import yu from"@mui/material/IconButton";import wu from"@mui/material/CircularProgress";import Cu from"@mui/icons-material/Delete";import vu from"@mui/icons-material/Refresh";import Tu from"@mui/icons-material/Restore";import Su from"@mui/icons-material/BrokenImage";import ku from"@mui/icons-material/Image";import{jsx as Fu,jsxs as _u}from"react/jsx-runtime";import xs from"@mui/material/Box";import Cs from"@mui/material/Typography";import Ps from"@mui/material/Chip";import vs from"@mui/material/Paper";import Es from"@mui/icons-material/CloudUpload";import{jsx as hr,jsxs as Ts}from"react/jsx-runtime";var Zr=({isDragging:e,disabled:r,hasError:o,placeholder:t,accept:a,onClick:n,onDragOver:s,onDragLeave:l,onDrop:i})=>Ts(vs,{variant:"outlined",onClick:n,onDragOver:s,onDragLeave:l,onDrop:i,sx:{p:3,textAlign:"center",cursor:r?"not-allowed":"pointer",borderStyle:"dashed",borderWidth:2,borderColor:e?"primary.main":o?"error.main":"divider",bgcolor:e?"primary.lighter":r?"action.disabledBackground":"background.paper",transition:"all 0.2s ease","&:hover":r?{}:{borderColor:"primary.main",bgcolor:"action.hover"}},children:[hr(Es,{sx:{fontSize:48,color:e?"primary.main":r?"action.disabled":"action.active",mb:1}}),hr(Cs,{variant:"body2",color:r?"text.disabled":"text.secondary",children:t}),a&&a.length>0&&!e&&hr(xs,{sx:{mt:1,display:"flex",gap:.5,justifyContent:"center",flexWrap:"wrap"},children:a.map(p=>hr(Ps,{label:p.split("/")[1]?.toUpperCase()||p,size:"small",variant:"outlined",sx:{fontSize:"0.7rem"}},p))})]});import Rs from"@mui/material/Dialog";import Ss from"@mui/material/DialogTitle";import Is from"@mui/material/DialogContent";import ks from"@mui/material/DialogActions";import bt from"@mui/material/Button";import As from"@mui/material/Typography";import Ls from"@mui/material/CircularProgress";import{jsx as Ue,jsxs as wt}from"react/jsx-runtime";var Jr=({open:e,isDeleting:r,onConfirm:o,onCancel:t,title:a,message:n,cancelText:s,confirmText:l,deletingText:i})=>wt(Rs,{open:e,onClose:r?void 0:t,children:[Ue(Ss,{children:a}),Ue(Is,{children:Ue(As,{children:n})}),wt(ks,{children:[Ue(bt,{onClick:t,disabled:r,children:s}),Ue(bt,{onClick:o,color:"error",variant:"contained",disabled:r,startIcon:r?Ue(Ls,{size:16,color:"inherit"}):void 0,children:r?i:l})]})]});import{jsx as me,jsxs as ro}from"react/jsx-runtime";var Os=({label:e,accept:r,maxFileSize:o=10*1024*1024,multiple:t=!1,maxFiles:a,minFiles:n=0,required:s=!1,disabled:l=!1,error:i=!1,helperText:p,onChange:d,onValidation:b,initialFiles:x,placeholder:u,showFileList:c=!0,visibility:h="private",showPreview:m=!0,baseUrl:f,onDeletionHandlersReady:g,mode:C="create"})=>{let{t:T}=Te(),S=eo(null),y=t?a:1,R=s?Math.max(n,1):n,L={acceptedTypes:r,maxFileSize:o,maxFiles:y,minFiles:R,visibility:h,mode:C,onFilesChange:ie=>{let he=ie.filter(Ye=>Ye.status==="completed"&&Ye.filePath).map(Ye=>{let Cr=Ye.filePath;return Cr.startsWith("/")?Cr:`/${Cr}`});d?.(he)}},{files:M,isUploading:fe,addFiles:te,removeFile:de,restoreFile:ne,retryUpload:Ae,isValid:ae,validationError:E,validationErrorKey:I,validationErrorParams:J,initializeFiles:v,isTouched:U,markAsTouched:F,isSubmitted:se,markAsSubmitted:Y,getPreviewUrl:to,commitDeletions:Ge,restorePendingDeletions:_,hasPendingDeletions:D,deleteFileImmediately:$,activeFiles:Q,activeFileCount:H,waitForUploads:ee,completedFilePaths:ge}=bo(L),no=yr(()=>ge,[ge]),ao=eo(!1),wr=eo(!1);Qr.useEffect(()=>{x&&x.length>0&&!ao.current&&!wr.current&&(wr.current=!0,(async()=>{try{await v(x,f),ao.current=!0}catch(he){w.error("Failed to initialize files",{error:he})}finally{wr.current=!1}})())},[x,v,f]),Qr.useEffect(()=>{b?.(ae,E)},[ae,E,b]),Qr.useEffect(()=>{g&&g({commitDeletions:Ge,restorePendingDeletions:_,hasPendingDeletions:D,markAsSubmitted:Y,isValid:ae,isUploading:fe,waitForUploads:ee,getCompletedFilePaths:no})},[g,Ge,_,D,Y,ae,fe,ee,no]);let{isDragging:so,handleDragOver:Tt,handleDragLeave:Rt,handleDrop:St}=Hr({disabled:l,onFilesDropped:te,onInteraction:F}),Le=jr({deleteFileImmediately:$}),It=yr(ie=>{F();let he=ie.target.files;he&&he.length>0&&te(he),S.current&&(S.current.value="")},[te,F]),kt=yr(()=>{l||S.current?.click()},[l]),At=yr(async ie=>{(await de(ie)).needsConfirmation&&Le.openConfirmation(ie)},[de,Le]),Lt=r?.join(",")||"",Dt=!l&&(t||H===0),io=se&&!ae,xr=i||io,lo=p||(io&&I?T(I,J):null);return ro(xt,{sx:{width:"100%"},children:[e&&ro(Ct,{variant:"body2",sx:{mb:1,fontWeight:500,color:xr?"error.main":"text.primary"},children:[e,s&&me("span",{style:{color:"red"},children:" *"})]}),me("input",{ref:S,type:"file",accept:Lt,multiple:t,onChange:It,disabled:l,style:{display:"none"}}),Dt&&me(Zr,{isDragging:so,disabled:l,hasError:xr,placeholder:u||T(so?"base.file.dropHere":"base.file.dragOrClick"),accept:r,onClick:kt,onDragOver:Tt,onDragLeave:Rt,onDrop:St}),c&&M.length>0&&me(Fs,{dense:!0,sx:{mt:1,p:0},children:M.map(ie=>me(Xr,{file:ie,baseUrl:f,disabled:l,onRemove:At,onRestore:ne,onRetry:Ae},ie.id))}),fe&&ro(xt,{sx:{display:"flex",alignItems:"center",gap:1,mt:1},children:[me(Ds,{size:16}),me(Ct,{variant:"caption",color:"text.secondary",children:T("base.file.uploading")})]}),lo&&me(_s,{error:xr,sx:{mt:.5},dangerouslySetInnerHTML:{__html:ft(lo)}}),me(Jr,{open:Le.isOpen,isDeleting:Le.isDeleting,onConfirm:Le.handleConfirm,onCancel:Le.handleCancel,title:T("base.file.confirmDelete.title"),message:T("base.file.confirmDelete.message"),cancelText:T("base.file.confirmDelete.cancel"),confirmText:T("base.file.confirmDelete.confirm"),deletingText:T("base.file.deleting")})]})};import{useCallback as Ns,useRef as Bs,useEffect as Us}from"react";import Pt from"@mui/material/Box";import vt from"@mui/material/Typography";import Et from"@mui/material/FormHelperText";import{MDXEditor as zs,headingsPlugin as Ms,listsPlugin as Vs,quotePlugin as qs,thematicBreakPlugin as Ws,markdownShortcutPlugin as Hs,linkPlugin as Ks,linkDialogPlugin as $s,tablePlugin as js,toolbarPlugin as Gs,UndoRedo as Ys,BoldItalicUnderlineToggles as Xs,BlockTypeSelect as Zs,CreateLink as Js,InsertTable as Qs,ListsToggle as ei,Separator as br}from"@mdxeditor/editor";import"@mdxeditor/editor/style.css";import{Fragment as ri,jsx as W,jsxs as oo}from"react/jsx-runtime";var Ip=({label:e,value:r="",onChange:o,required:t=!1,disabled:a=!1,error:n=!1,helperText:s,placeholder:l="Write here...",minHeight:i=200,maxHeight:p=500})=>{let d=Bs(null);Us(()=>{d.current&&d.current.getMarkdown()!==r&&d.current.setMarkdown(r||"")},[r]);let b=Ns(x=>{o?.(x)},[o]);return oo(Pt,{sx:{width:"100%"},children:[e&&oo(vt,{component:"label",sx:{display:"block",mb:.5,fontSize:"0.875rem",fontWeight:500,color:n?"error.main":"text.primary"},children:[e,t&&W(vt,{component:"span",color:"error.main",sx:{ml:.5},children:"*"})]}),W(Pt,{sx:{border:1,borderColor:n?"error.main":"divider",borderRadius:1,overflow:"hidden",opacity:a?.6:1,pointerEvents:a?"none":"auto","& .mdxeditor":{minHeight:i,maxHeight:p,overflow:"auto"},"& .mdxeditor-toolbar":{borderBottom:1,borderColor:"divider",backgroundColor:"background.default"},"& .mdxeditor-root-contenteditable":{padding:2,minHeight:i-50}},children:W(zs,{ref:d,markdown:r||"",onChange:b,placeholder:l,readOnly:a,plugins:[Ms(),Vs(),qs(),Ws(),Hs(),Ks(),$s(),js(),Gs({toolbarContents:()=>oo(ri,{children:[W(Ys,{}),W(br,{}),W(Xs,{}),W(br,{}),W(Zs,{}),W(br,{}),W(ei,{}),W(br,{}),W(Js,{}),W(Qs,{})]})})]})}),s&&W(Et,{error:n,sx:{mx:0,mt:.5},children:s}),!s&&W(Et,{sx:{mx:0,mt:.5},children:"\xA0"})]})};export{ue as a,ti as b,ni as c,Pr as d,Ze as e,hi as f,Te as g,To as h,Ro as i,xi as j,Io as k,ko as l,Ao as m,Lo as n,Ec as o,xa as p,ot as q,tt as r,ld as s,gd as t,hd as u,Td as v,Os as w,Ip as x};