@scmlatam/web-ui 0.2.23 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-ui.js +34 -28
- package/dist/web-ui.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/web-ui.js
CHANGED
|
@@ -16208,37 +16208,39 @@ var xT = () => ({
|
|
|
16208
16208
|
]
|
|
16209
16209
|
}, t)] }, t))
|
|
16210
16210
|
}), n.filter((e) => !e.hide).map((e, t) => /* @__PURE__ */ H(l, { children: e.dialog }, t))] }), kT = ({ label: e, values: t, placeholder: n, value: r, setValue: i, disabled: a, fullWidth: o, white: s, search: c }) => {
|
|
16211
|
-
let l = xe(null), u = xe(null),
|
|
16211
|
+
let l = xe(null), u = xe(null), d = xe(null), [f, p] = B({
|
|
16212
16212
|
width: 0,
|
|
16213
16213
|
height: 0
|
|
16214
|
-
}), [
|
|
16214
|
+
}), [m, h] = B(!1), g = (e) => /* @__PURE__ */ H(Ve, {
|
|
16215
16215
|
...e,
|
|
16216
16216
|
sx: {
|
|
16217
16217
|
color: s ? "black !important" : "white !important",
|
|
16218
16218
|
...e.sx
|
|
16219
16219
|
},
|
|
16220
16220
|
onClick: () => {
|
|
16221
|
-
console.log("icon click"),
|
|
16221
|
+
console.log("icon click"), h(!m);
|
|
16222
16222
|
}
|
|
16223
16223
|
});
|
|
16224
16224
|
ge(() => {
|
|
16225
16225
|
if (!l.current) return;
|
|
16226
16226
|
let e = new ResizeObserver((e) => {
|
|
16227
16227
|
let { width: t, height: n } = e[0].contentRect;
|
|
16228
|
-
|
|
16228
|
+
p({
|
|
16229
16229
|
width: t,
|
|
16230
16230
|
height: n
|
|
16231
16231
|
});
|
|
16232
16232
|
});
|
|
16233
16233
|
return e.observe(l.current), () => e.disconnect();
|
|
16234
|
-
}, [
|
|
16235
|
-
|
|
16234
|
+
}, [f]), ge(() => {
|
|
16235
|
+
m && d.current?.focus();
|
|
16236
|
+
}, [m]);
|
|
16237
|
+
let _ = {
|
|
16236
16238
|
marginTop: "-55px",
|
|
16237
16239
|
maxHeight: "500px",
|
|
16238
16240
|
borderRadius: "24px",
|
|
16239
16241
|
borderTopLeftRadius: "24px",
|
|
16240
16242
|
borderTopRightRadius: "24px",
|
|
16241
|
-
width:
|
|
16243
|
+
width: f.width + 20,
|
|
16242
16244
|
backgroundColor: "transparent",
|
|
16243
16245
|
"--Paper-overlay": "none",
|
|
16244
16246
|
border: "1px solid rgba(255, 255, 255, 0.2)"
|
|
@@ -16259,13 +16261,13 @@ var xT = () => ({
|
|
|
16259
16261
|
ref: l,
|
|
16260
16262
|
labelId: `filter-table-label-${e}`,
|
|
16261
16263
|
id: `filter-${e}`,
|
|
16262
|
-
open:
|
|
16264
|
+
open: m,
|
|
16263
16265
|
onOpen: () => {
|
|
16264
|
-
|
|
16266
|
+
h(!0);
|
|
16265
16267
|
},
|
|
16266
16268
|
onClose: (e) => {
|
|
16267
16269
|
let t = e?.target;
|
|
16268
|
-
t && u.current?.contains(t) ||
|
|
16270
|
+
t && u.current?.contains(t) || h(!1);
|
|
16269
16271
|
},
|
|
16270
16272
|
value: r,
|
|
16271
16273
|
label: e,
|
|
@@ -16277,21 +16279,25 @@ var xT = () => ({
|
|
|
16277
16279
|
},
|
|
16278
16280
|
color: "gr-yellow",
|
|
16279
16281
|
sx: { color: s ? "black" : "white" },
|
|
16280
|
-
IconComponent:
|
|
16281
|
-
MenuProps: {
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16282
|
+
IconComponent: g,
|
|
16283
|
+
MenuProps: {
|
|
16284
|
+
autoFocus: !1,
|
|
16285
|
+
disableAutoFocusItem: !0,
|
|
16286
|
+
slotProps: {
|
|
16287
|
+
paper: { style: _ },
|
|
16288
|
+
list: { sx: {
|
|
16289
|
+
marginTop: "60px",
|
|
16287
16290
|
backgroundColor: (e) => s ? "white" : e.palette["gr-base-dark"].main,
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
|
|
16292
|
-
|
|
16293
|
-
|
|
16294
|
-
|
|
16291
|
+
"& .MuiMenuItem-root": {
|
|
16292
|
+
backgroundColor: (e) => s ? "white" : e.palette["gr-base-dark"].main,
|
|
16293
|
+
color: s ? "black" : "white",
|
|
16294
|
+
"&:hover": { backgroundColor: (e) => s ? "white" : e.palette["gr-base-dark"].main },
|
|
16295
|
+
"&.Mui-selected": { backgroundColor: (e) => s ? "white" : e.palette["gr-base-dark"].main },
|
|
16296
|
+
"&.Mui-focusVisible": { backgroundColor: (e) => s ? "white" : e.palette["gr-base-dark"].main }
|
|
16297
|
+
}
|
|
16298
|
+
} }
|
|
16299
|
+
}
|
|
16300
|
+
},
|
|
16295
16301
|
displayEmpty: !0,
|
|
16296
16302
|
disabled: a,
|
|
16297
16303
|
children: [/* @__PURE__ */ H(P, {
|
|
@@ -16309,16 +16315,17 @@ var xT = () => ({
|
|
|
16309
16315
|
},
|
|
16310
16316
|
children: /* @__PURE__ */ H(ae, {
|
|
16311
16317
|
ref: u,
|
|
16318
|
+
inputRef: d,
|
|
16312
16319
|
variant: "standard",
|
|
16313
16320
|
fullWidth: !0,
|
|
16314
16321
|
size: "small",
|
|
16315
16322
|
placeholder: c?.placeholder || "Buscar...",
|
|
16316
16323
|
value: c?.value || "",
|
|
16317
16324
|
onMouseDown: (e) => {
|
|
16318
|
-
e.stopPropagation(),
|
|
16325
|
+
e.stopPropagation(), h(!0);
|
|
16319
16326
|
},
|
|
16320
16327
|
onClick: (e) => {
|
|
16321
|
-
e.stopPropagation(),
|
|
16328
|
+
e.stopPropagation(), h(!0);
|
|
16322
16329
|
},
|
|
16323
16330
|
onKeyDown: (e) => {
|
|
16324
16331
|
e.stopPropagation();
|
|
@@ -16326,14 +16333,13 @@ var xT = () => ({
|
|
|
16326
16333
|
onChange: (e) => {
|
|
16327
16334
|
c?.setValue(e.target.value);
|
|
16328
16335
|
},
|
|
16329
|
-
focused: !1,
|
|
16330
16336
|
color: "gr-yellow"
|
|
16331
16337
|
})
|
|
16332
16338
|
}), t.map((e) => /* @__PURE__ */ H(I, {
|
|
16333
16339
|
value: e.value,
|
|
16334
16340
|
sx: { display: `${e.label} ${e.sublabel ?? ""}`.toLowerCase().includes(c?.value?.toLowerCase() ?? "") ? "block" : "none" },
|
|
16335
16341
|
onClick: () => {
|
|
16336
|
-
|
|
16342
|
+
h(!1);
|
|
16337
16343
|
},
|
|
16338
16344
|
children: /* @__PURE__ */ U(se, {
|
|
16339
16345
|
variant: "caption",
|
package/dist/web-ui.umd.cjs
CHANGED
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
scale(1);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
`})]});return r?(0,f.createPortal)(a,document.body):null};function dw(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():Math.random().toString(36).slice(2,10)}var fw=()=>({showAlert:(e,t,n={})=>{let r=dw(),i=e===`loading`||e==="default";return ew({id:r,severity:e,message:t,duration:n.duration??(i?void 0:5e3),closeLabel:n.closeLabel}),r},closeAlert:e=>{tw(e)}}),pw=`(max-width: 63.9375rem)`,mw=({sidebar:e,routes:t,account:n})=>{let{state:r,setState:i,getWidth:a}=pe(),[o,s]=(0,l.useState)(()=>typeof window>`u`?!1:window.matchMedia(pw).matches),[c,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=window.matchMedia(pw),t=()=>{let t=e.matches;s(t),t||u(!1)};return t(),e.addEventListener?.(`change`,t),()=>{e.removeEventListener?.(`change`,t)}},[]),(0,d.jsxs)(`div`,{className:`rb-shell rb-shell--${r}`,children:[(0,d.jsx)(zp,{items:e.items,signOut:e.signOut,tooltips:e.tooltips,state:r,setState:i,getWidth:a,isMobile:o,mobileOpen:c,onCloseMobile:()=>u(!1)}),(0,d.jsx)(YC,{account:n,sidebarItems:e.items,onOpenMobile:o?()=>u(!0):void 0}),(0,d.jsx)(WC,{state:r,getWidth:a,routes:t,account:n}),(0,d.jsx)(uw,{})]})},hw=e=>(0,d.jsx)(mw,{...e}),gw=({sidebar:e,routes:t,product:n,account:r,languages:i,loginForm:a,signup:o,unsavedChangesAlert:s})=>{let{isAuthenticated:c,openUnsaved:u,setOpenUnsaved:f}=(0,l.useContext)(fe),p=[{text:s.message,ncolumn:12,element:`TypographyField`}];return(0,d.jsxs)(d.Fragment,{children:[c?(0,d.jsx)(hw,{routes:t,sidebar:e,account:r}):(0,d.jsx)(IC,{product:n,languages:i,form:a,signup:o}),(0,d.jsx)(Bw,{title:s.title,open:u,setOpen:f,fields:p,loading:!1,onClickSave:s.actionButton.onClick,action:{actionButton:s.actionButton,cancelButton:s.cancelButton}})]})},_w=({sidebar:e,routes:t,product:n,account:r,languages:o,loginForm:s,signup:c,unsavedChangesAlert:f,msalInstance:g})=>{let{isAuthenticated:_,setIsAuthenticated:v}=(0,l.useContext)(fe),[y,b]=(0,l.useState)(0),x=o.find(e=>e.active)||o[0];(0,l.useEffect)(()=>{switch(x.code){case`es`:a.default.locale(`es`);break;case`en`:a.default.locale(`en`);break;case`pt`:a.default.locale(`pt`);break;default:a.default.locale(`en`)}let e=[`token`,`company`,`config`,`privileges`,`account`,`language`,`authenticated`,`type-signin`].filter(e=>localStorage.getItem(e)===null);if(localStorage.getItem(`ues`)===`403`){localStorage.removeItem(`ues`),window.location.href=`/signup`;return}y===0&&window.location.pathname!==`/signup`&&(g.getActiveAccount()&&e.length>0?(console.log(`if 1`),A_(g,g.getActiveAccount())):g.getActiveAccount()&&e.length===0?(console.log(`if 2`),v(!0),localStorage.setItem(`authenticated`,`true`)):!g.getActiveAccount()&&_?(console.log(`if 6`),v(!0)):!g.getActiveAccount()&&e.length===0?(console.log(`if 3`),v(!0),localStorage.setItem(`authenticated`,`true`)):!g.getActiveAccount()&&e.length>0&&(console.log(`if 4`),v(!1),localStorage.setItem(`authenticated`,`false`)),b(y+1))},[x,y]);let S={rabbitLight:de,rabbitDark:(0,i.createTheme)(le,x.theme.dg,x.theme.core,x.theme.pickers)};return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(Cp,{instance:g,children:(0,d.jsx)(i.Box,{sx:{overflow:`hidden`,height:`100vh`},children:(0,d.jsx)(u.BrowserRouter,{children:(0,d.jsx)(i.ThemeProvider,{theme:S.rabbitDark,children:(0,d.jsx)(m.LocalizationProvider,{dateAdapter:h.AdapterDayjs,adapterLocale:x.code,children:(0,d.jsxs)(p.SnackbarProvider,{maxSnack:15,autoHideDuration:1e4,anchorOrigin:{vertical:`top`,horizontal:`center`},children:[(0,d.jsx)(i.CssBaseline,{}),(0,d.jsx)(gw,{sidebar:e,routes:t,product:n,account:r,languages:o,msalInstance:g,loginForm:s,signup:c,unsavedChangesAlert:f})]})})})})})})})},vw=({children:e})=>{let[t,n]=(0,l.useState)(localStorage.getItem(`authenticated`)===`true`),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(``),[u,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(`DD/MM/YYYY`),[h,g]=(0,l.useState)([]),[_,v]=(0,l.useState)([]),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(!1);return(0,d.jsx)(fe.Provider,{value:{isAuthenticated:t,setIsAuthenticated:n,user:r,setUser:i,pass:a,setPass:o,avatar:s,setAvatar:c,email:u,setEmail:f,loadingAuth:C,setLoadingAuth:w,format:p,setFormat:m,singleShortcut:h,setSingleShortcut:g,rangeShortcut:_,setRangeShortcut:v,encrypter:(e,t,n)=>{e===`session`?sessionStorage.setItem(t,n):e===`local`&&localStorage.setItem(t,n)},decrypter:(e,t)=>e===`session`?sessionStorage.getItem(t)||``:e===`local`&&localStorage.getItem(t)||``,openUnsaved:y,setOpenUnsaved:b,redirect:x,setRedirect:S},children:e})},yw=({contextMenu:e,setContextMenu:t,options:n,checked:r,optionGroup:a})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.Menu,{open:e!==null,onClose:()=>t(null),anchorReference:`anchorPosition`,anchorPosition:e===null?void 0:{top:e.mouseY,left:e.mouseX},slots:{transition:i.Fade},slotProps:{paper:{sx:{bgcolor:e=>a===`toolbar`?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main,borderRadius:`12px`},elevation:1}},sx:{cursor:`pointer`},children:n.filter(e=>!e.hide).map((e,t)=>(0,d.jsxs)(i.Box,{children:[t!==0&&n[t-1].group!==e.group?(0,d.jsx)(i.Divider,{}):null,(0,d.jsxs)(i.MenuItem,{onClick:e.click,disabled:e.disabled,children:[(0,d.jsx)(i.ListItemIcon,{sx:{color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},children:e.icon}),(0,d.jsx)(i.ListItemText,{children:(0,d.jsx)(i.Typography,{sx:{color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},children:e.name})}),e.selected?(0,d.jsxs)(i.Typography,{sx:{pl:3,color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},variant:`body2`,children:[`selecionados`,`:`,r.length]}):null,e.onlyOne?(0,d.jsx)(i.Typography,{sx:{pl:3,color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},variant:`body2`,children:`solo uno`}):null]},t)]},t))}),n.filter(e=>!e.hide).map((e,t)=>(0,d.jsx)(i.Box,{children:e.dialog},t))]}),bw=({label:e,values:t,placeholder:n,value:r,setValue:a,disabled:o,fullWidth:s,white:c,search:u})=>{let f=(0,l.useRef)(null),p=(0,l.useRef)(null),[m,h]=(0,l.useState)({width:0,height:0}),[g,v]=(0,l.useState)(!1),y=e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx},onClick:()=>{console.log(`icon click`),v(!g)}});(0,l.useEffect)(()=>{if(!f.current)return;let e=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect;h({width:t,height:n})});return e.observe(f.current),()=>e.disconnect()},[m]);let b={marginTop:`-55px`,maxHeight:`500px`,borderRadius:`24px`,borderTopLeftRadius:`24px`,borderTopRightRadius:`24px`,width:m.width+20,backgroundColor:`transparent`,"--Paper-overlay":`none`,border:`1px solid rgba(255, 255, 255, 0.2)`};return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{ref:f,labelId:`filter-table-label-${e}`,id:`filter-${e}`,open:g,onOpen:()=>{v(!0)},onClose:e=>{let t=e?.target;t&&p.current?.contains(t)||v(!1)},value:r,label:e,onChange:e=>a(e.target.value),multiple:!1,renderValue:e=>{let r=Array.isArray(e)?e[0]:e;return r==null||r===``?n:t.find(e=>e.value===r)?.label||n},color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:y,MenuProps:{slotProps:{paper:{style:b},list:{sx:{marginTop:`60px`,backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},displayEmpty:!0,disabled:o,children:[(0,d.jsx)(i.ListSubheader,{disableSticky:!0,sx:{backgroundColor:`transparent`,px:1.5,py:1},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:(0,d.jsx)(i.TextField,{ref:p,variant:`standard`,fullWidth:!0,size:`small`,placeholder:u?.placeholder||`Buscar...`,value:u?.value||``,onMouseDown:e=>{e.stopPropagation(),v(!0)},onClick:e=>{e.stopPropagation(),v(!0)},onKeyDown:e=>{e.stopPropagation()},onChange:e=>{u?.setValue(e.target.value)},focused:!1,color:`gr-yellow`})}),t.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,sx:{display:`${e.label} ${e.sublabel??``}`.toLowerCase().includes(u?.value?.toLowerCase()??``)?`block`:`none`},onClick:()=>{v(!1)},children:(0,d.jsxs)(i.Typography,{variant:`caption`,color:`textSecondary`,children:[e.label,e.sublabel&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`br`,{}),e.sublabel]})]})},e.value))]})]})})},xw=({label:e,value:t,setValue:n,values:r,placeholder:a,disabled:o,fullWidth:s,white:c,search:u})=>{let f=(0,l.useRef)(null),p=(0,l.useRef)(null),[m,h]=(0,l.useState)({width:0,height:0}),[g,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(``),x=u?.value??y,S=r.filter(e=>`${e.label} ${e.sublabel??``}`.toLowerCase().includes(x.toLowerCase())).map(e=>e.value),C=S.filter(e=>t.includes(e)).length,w=S.length>0&&C===S.length,T=C>0&&!w,E=e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx},onClick:()=>{v(!g)}});(0,l.useEffect)(()=>{if(!f.current)return;let e=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect;h({width:t,height:n})});return e.observe(f.current),()=>e.disconnect()},[m]);let D={marginTop:`-55px`,maxHeight:`500px`,borderRadius:`24px`,borderTopLeftRadius:`24px`,borderTopRightRadius:`24px`,width:m.width+20,backgroundColor:`transparent`,"--Paper-overlay":`none`,border:`1px solid rgba(255, 255, 255, 0.2)`};return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{ref:f,labelId:`filter-table-label-${e}`,id:`filter-${e}`,open:g,onOpen:()=>{v(!0)},onClose:e=>{let t=e?.target;t&&p.current?.contains(t)||v(!1)},value:t,label:e,onChange:e=>{let{target:{value:r}}=e,i=typeof r==`string`?r.split(`,`):r;if(i.includes(`select-all`)){if(w){n(t.filter(e=>!S.includes(e)));return}n(Array.from(new Set([...t,...S])));return}n(i.filter(e=>e!==`select-all`))},color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:E,MenuProps:{slotProps:{paper:{style:D},list:{sx:{marginTop:`60px`,backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},renderValue:e=>!e||e.length===0?a:r.filter(t=>e.includes(t.value)).map(e=>e.label).join(`, `),displayEmpty:!0,disabled:o,multiple:!0,children:[(0,d.jsx)(i.ListSubheader,{disableSticky:!0,sx:{backgroundColor:`transparent`,px:1.5,py:1},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:(0,d.jsx)(i.TextField,{ref:p,variant:`standard`,fullWidth:!0,size:`small`,placeholder:u?.placeholder||`Buscar...`,value:x,onMouseDown:e=>{e.stopPropagation(),v(!0)},onClick:e=>{e.stopPropagation(),v(!0)},onKeyDown:e=>{e.stopPropagation()},onChange:e=>{let t=e.target.value;if(u?.setValue){u.setValue(t);return}b(t)},focused:!1,color:`gr-yellow`})}),(0,d.jsxs)(i.MenuItem,{value:`select-all`,disabled:S.length===0,children:[(0,d.jsx)(i.Checkbox,{checked:w,indeterminate:T}),(0,d.jsx)(i.ListItemText,{slotProps:{primary:{sx:{color:`#FFFFFF`}}},primary:`Seleccionar todo`})]}),r.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,sx:{display:S.includes(e.value)?`block`:`none`},children:(0,d.jsxs)(i.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,d.jsx)(i.Checkbox,{checked:t.includes(e.value)}),(0,d.jsxs)(i.Typography,{variant:`caption`,color:`textSecondary`,children:[e.label,e.sublabel&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`br`,{}),e.sublabel]})]})]})},e.value))]})]})})},Sw=({label:e,value:t,setValue:n,disabled:r,fullWidth:i})=>{let{format:a}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(y.LocalizationProvider,{dateAdapter:h.AdapterDayjs,children:(0,d.jsx)(v.SingleInputDateRangeField,{label:e,value:t,onChange:e=>{n(e)},sx:{"& .MuiInputBase-root":{borderRadius:`16px`}},size:`small`,color:`gr-yellow`,slotProps:{textField:{sx:{"& .MuiInputLabel-root":{color:`white !important`}}}},focused:!0,format:a,disabled:r,fullWidth:i})})})},Cw=({label:e,initialValue:t,value:n,setValue:r,calendars:i,disabled:a,white:o,fullWidth:s,maxDate:c,minDate:u})=>{let{format:f,rangeShortcut:p}=(0,l.useContext)(fe),m=(0,x.useTheme)(),h=(0,x.createTheme)({...m,palette:{...m.palette,primary:{main:`#9D9A95`}}});return(0,d.jsx)(x.ThemeProvider,{theme:h,children:(0,d.jsx)(b.DateRangePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:a,format:f,calendars:i,slotProps:{shortcuts:{items:p},textField:{variant:`outlined`,size:`small`,fullWidth:s,color:`gr-yellow`,focused:!0,sx:{"& .MuiInputLabel-root":{color:o?`black !important`:`white !important`},"& .MuiInputLabel-root.Mui-focused":{color:o?`black !important`:`white !important`},"& .MuiGrid-root":{marginBottom:`0px !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>o?e.palette[`gr-grey`].light:e.palette[`gr-grey`].main},"& .MuiChip-label":{color:o?`black !important`:`white !important`},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>o?e.palette[`gr-base-dark`].main:`white !important`},"& .MuiPickersCalendarHeader-label":{color:o?`black !important`:`white !important`},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>o?e.palette[`gr-base-dark`].main:`white !important`},"& .Mui-disabled":{color:e=>`${e.palette[`gr-grey`].main} !important`},"& .MuiPickersArrowSwitcher-root":{color:`(theme) => theme.palette["gr-base-dark"].main`},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:o?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:e=>o?e.palette[`gr-grey`].light:`black !important`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}},maxDate:c,minDate:u})})},ww=({label:e,initialValue:t,value:n,setValue:r,disabled:i,white:a,fullWidth:o})=>{let{format:s,singleShortcut:c}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.DatePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:i,format:s,slotProps:{shortcuts:{items:c},textField:{variant:`outlined`,size:`small`,fullWidth:o,color:`gr-yellow`,focused:!0,sx:{"& .MuiInputLabel-root":{color:a?`black !important`:`white !important`},"& .MuiInputLabel-root.Mui-focused":{color:a?`black !important`:`white !important`},"& .MuiGrid-root":{marginBottom:`0px !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:a?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:a?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>a?e.palette[`gr-grey`].light:e.palette[`gr-grey`].main},"& .MuiChip-label":{color:a?`black !important`:`white !important`},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>a?e.palette[`gr-base-dark`].main:`white !important`},"& .MuiPickersCalendarHeader-label":{color:a?`black !important`:`white !important`},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>a?e.palette[`gr-base-dark`].main:`white !important`},"& .Mui-disabled":{color:e=>`${e.palette[`gr-grey`].main} !important`},"& .MuiPickersArrowSwitcher-root":{color:`(theme) => theme.palette["gr-base-dark"].main`},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:e=>a?e.palette[`gr-grey`].light:`black !important`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Tw=e=>{let{name:t={title:``,ncolumn:0},fields:n=[],actions:r={ncolumn:1,buttons:[]}}=e,a=(e,t)=>{switch(e.element){case`SelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(bw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:e.disable,search:e.search,multiple:e.multiple,fullWidth:!0,white:!1})},t);case`MultiSelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(xw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:e.disable,search:e.search,fullWidth:!0,white:!1})},t);case`DateRangeField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(Sw,{label:e.label,value:e.value,setValue:e.setValue,disabled:e.disable,fullWidth:!0})},t);case`DatePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(ww,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:e.disable,fullWidth:!0,white:!1})},t)});case`DateRangePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(Cw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:e.disable,fullWidth:!0,white:!1,maxDate:e.maxDate,minDate:e.minDate})},t)});default:return(0,d.jsx)(d.Fragment,{})}};return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Box,{sx:{bgcolor:e=>e.palette.background.paper,height:`70px`,borderTopLeftRadius:`20px`,borderTopRightRadius:`20px`,display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`flex-end`,padding:`20px`,gap:`20px`},children:(0,d.jsxs)(i.Grid,{container:!0,spacing:2,sx:{flexGrow:1},children:[t.title&&(0,d.jsx)(i.Grid,{size:t.ncolumn,sx:{display:`flex`,alignItems:`center`},children:t.title}),n.map((e,t)=>a(e,t)),r&&r.buttons.length>0&&(0,d.jsx)(i.Grid,{size:r.ncolumn,children:(0,d.jsx)(i.Box,{sx:{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,gap:`10px`},children:r.buttons.map((e,t)=>(0,d.jsx)(i.Button,{variant:e.variant,color:`gr-yellow`,sx:{...e.sx},onClick:e.onClick,disabled:e.disabled,disableElevation:!0,children:e.icon?e.icon:(0,d.jsx)(`span`,{style:{marginTop:`2px`,textTransform:`none`,padding:`0px 5px`},children:e.text})},t))})})]})})})},Ew=e=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.DataGridPro,{...e,apiRef:e.apiRef,showToolbar:e.toolbar!==void 0,headerFilters:e.headerFilters,slots:{toolbar:Tw,headerFilterMenu:null,...e.slots},slotProps:{...e.slotProps,toolbar:{...e.toolbar},baseTextField:{color:e.toolbar===void 0?`error`:`primary`,slotProps:{input:{endAdornment:(0,d.jsx)(i.InputAdornment,{sx:{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette[`gr-grey`].main},position:`end`,children:(0,d.jsx)(S.default,{})})}}},loadingOverlay:{variant:`circular-progress`,noRowsVariant:`circular-progress`}},sx:{border:`none`,color:`black`,flex:1,borderTopLeftRadius:e.toolbar?`0px`:`20px !important`,borderTopRightRadius:e.toolbar?`0px`:`20px !important`,"--DataGrid-t-color-background-base":`transparent !important`,"& .MuiDataGrid-columnHeaderCheckbox":{backgroundColor:`white`},"& .MuiDataGrid-filler--pinnedLeft":{backgroundColor:`white`},"& .MuiDataGrid-filterForm .MuiInputBase-root":{backgroundColor:`#F3F2F2`},"& .MuiDataGrid-columnHeader":{backgroundColor:e.toolbar?`white`:`transparent`,color:e.toolbar?`black`:`white`,borderBottom:e.headerFilters?`none !important`:e=>`${e.palette.primary.main} 1px solid !important`},"& .MuiDataGrid-headerFilterRow":{bgcolor:e.toolbar?`white !important`:`transparent !important`,borderBottom:e=>`${e.palette.primary.main} 1px solid !important`},"& .MuiDataGrid-virtualScroller":{bgcolor:`white`,borderBottomLeftRadius:e.slots?.footer?`0px`:`20px`,borderBottomRightRadius:e.slots?.footer?`0px`:`20px`},"& .MuiDataGrid-columnHeaderTitleContainer":{"& .MuiCheckbox-root":{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette.background.paper}},"& .MuiDataGrid-iconButtonContainer":{"& .MuiIconButton-root":{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette[`gr-grey`].main}},"& .MuiDataGrid-footerContainer":{borderTop:`none`,fontWeight:`500`,display:`flex`,justifyContent:`center`,alignItems:`center`,borderBottomLeftRadius:`20px`,borderBottomRightRadius:`20px`,backgroundColor:`black`},"& .MuiIconButton-root":{color:e=>e.palette.background.paper,"&.Mui-disabled":{color:`#888`,backgroundColor:`#eee`,opacity:.7}},"& .MuiDataGrid-row":{minHeight:45,maxHeight:`none`},"& .MuiDataGrid-cell":{minHeight:45,height:`auto`,maxHeight:`none`,display:`flex`,flexDirection:`column`,alignItems:`start`,justifyContent:`flex-start`,gap:1.5,p:1,borderBottom:`none`,borderTop:`1px solid #CECDCA`},"& .MuiDataGrid-cell--editing":{minHeight:45,height:`auto`,maxHeight:`none`,display:`flex`,flexDirection:`column`,alignItems:`start`,justifyContent:`flex-start`,gap:1.5,p:1},"& .MuiDataGrid-cell--editing input":{color:`black !important`,backgroundColor:`white !important`},"& .MuiDataGrid-row:hover, & .MuiDataGrid-row.Mui-selected":{bgcolor:`#B6B4AF`},"& .MuiDataGrid-cell.enable-cell":{backgroundColor:`white !important`,"& .MuiCheckbox-root":{color:e=>e.palette.background.paper}},"& .MuiDataGrid-cell.parcial-cell":{backgroundColor:`#E7E6E4 !important`,"& .MuiCheckbox-root":{color:e=>e.palette.background.paper}},"& .MuiDataGrid-cell.disable-cell":{backgroundColor:`#E7E6E4 !important`,"& .MuiCheckbox-root":{color:`#CECDCA`}},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.enable-cell":{backgroundColor:`#B6B4AF !important`},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.parcial-cell":{backgroundColor:`#B6B4AF !important`},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.disable-cell":{backgroundColor:`#B6B4AF !important`},...e.sx},loading:e.loading,checkboxSelection:e.checkboxSelection,paginationModel:e.paginationModel,onPaginationModelChange:e.setPaginationModel,onRowSelectionModelChange:e.setRowSelectionModel,rowSelectionModel:e.rowSelectionModel,disableRowSelectionOnClick:e.disableRowSelectionOnClick,getRowHeight:()=>`auto`,onCellEditStop:e.onCellEditStop,disableVirtualization:!0,initialState:e.initialState,showColumnVerticalBorder:!1,showCellVerticalBorder:!1}),(0,d.jsx)(yw,{contextMenu:e.contextMenu,setContextMenu:e.setContextMenu,options:e.options,checked:e.rowSelectionModel,optionGroup:e.optionGroup})]}),Dw=()=>{let e=(0,g.useGridApiRef)(),[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)({pageSize:25,page:0}),[s,c]=(0,l.useState)({type:`include`,ids:new Set}),[u,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`table`);return{apiRef:e,rows:r,setRows:i,loading:t,setLoading:n,paginationModel:a,setPaginationModel:o,rowSelectionModel:s,setRowSelectionModel:c,contextMenu:u,setContextMenu:d,optionGroup:f,setOptionGroup:p}},Ow=()=>{let{enqueueSnackbar:e}=(0,p.useSnackbar)(),t=e=>{(0,p.closeSnackbar)(e)};return{showAlert:(n,r)=>e(r,{variant:n,content:(e,r)=>(0,d.jsx)(i.Alert,{sx:{borderRadius:`24px`,bgcolor:`#fff`,boxShadow:3,color:e=>e.palette[`gr-base-dark`].main},severity:n,iconMapping:{error:(0,d.jsx)(C.default,{}),info:(0,d.jsx)(E.default,{}),success:(0,d.jsx)(w.default,{}),warning:(0,d.jsx)(T.default,{}),default:(0,d.jsx)(i.CircularProgress,{color:`gr-blue`,size:20})},onClose:()=>t(e),children:r},e)}),closeAlert:t}},kw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,fullWidth:a,white:o})=>{let{format:s}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(k.DateTimeField,{label:e,defaultValue:t,value:n,onChange:e=>{r(e)},sx:{"& .MuiInputBase-root":{borderRadius:`16px`,color:o?`black !important`:`white !important`}},size:`small`,color:`gr-yellow`,slotProps:{textField:{sx:{"& .MuiInputLabel-root":{color:o?`black !important`:`white !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}}},focused:!0,format:s,disabled:i,fullWidth:a})})},Aw=({label:e,placeholder:t,values:n,value:r,setValue:a,white:o})=>{let[s,c]=(0,l.useState)(!1);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Autocomplete,{multiple:!0,options:n,getOptionLabel:e=>e.label,value:n.filter(e=>r.includes(e.value)),onChange:(e,t)=>{a(t.map(e=>e.value))},onOpen:()=>c(!0),onClose:()=>c(!1),renderInput:n=>(0,d.jsx)(i.TextField,{...n,label:e,placeholder:t,variant:`outlined`,sx:{backgroundColor:e=>o?`white`:e.palette[`gr-base-dark`].main,borderTopLeftRadius:`18px`,borderTopRightRadius:`18px`,borderBottomLeftRadius:s?`0px`:`18px`,borderBottomRightRadius:s?`0px`:`18px`,color:o?`black !important`:`white !important`,"& .MuiChip-root":{maxWidth:`100px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},"& .MuiAutocomplete-tag":{maxHeight:`32px`,overflow:`hidden`,display:`inline-flex`,flexWrap:`nowrap`},"& .MuiAutocomplete-inputRoot":{flexWrap:`nowrap`}},color:`gr-yellow`,focused:!0}),renderValue:(e,t)=>e.map((e,n)=>{let{key:r,...a}=t({index:n});return(0,d.jsx)(i.Tooltip,{title:e.highlight?.tooltip,sx:{borderRadius:`24px`},children:(0,d.jsx)(i.Chip,{variant:`filled`,label:e.label,size:`small`,...a,sx:{bgcolor:t=>e.highlight?.active?`${t.palette[`gr-orange`].main}20`:`${t.palette[`gr-grey`].main}20`,color:e=>e.palette[`gr-base-dark`].main,"& .MuiChip-deleteIcon":{color:e=>e.palette[`gr-base-dark`].main,"&:hover":{color:e=>e.palette[`gr-base-dark`].main}},border:e.highlight?.active?`1px solid`:`none`,borderColor:t=>e.highlight?.active?t.palette[`gr-orange`].main:`none`}},r)})}),popupIcon:(0,d.jsx)(A.default,{sx:{color:o?`black`:`white`}}),slotProps:{paper:{sx:{maxHeight:`500px`,borderBottomLeftRadius:`32px`,borderBottomRightRadius:`32px`,borderTopLeftRadius:`0px`,borderTopRightRadius:`0px`,backgroundColor:e=>o?`white`:e.palette[`gr-base-dark`].main,color:o?`black`:`white`}},chip:{sx:{bgcolor:e=>o?`${e.palette[`gr-grey`].light} !important`:`${e.palette[`gr-grey`].main} !important`,color:o?`black`:`white`},size:`small`,deleteIcon:(0,d.jsx)(C.default,{sx:{color:o?`black !important`:`white !important`}})}},limitTags:2,size:`small`})})},jw=({label:e,value:t,setValue:n,values:r,placeholder:a,disabled:o,fullWidth:s,white:c})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{labelId:`filter-table-label-${e}`,id:`filter-${e}`,value:t,label:e,onChange:e=>n(e.target.value),color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx}}),MenuProps:{slotProps:{paper:{style:{maxHeight:`500px`,borderBottomLeftRadius:`32px`,borderBottomRightRadius:`32px`,borderTopLeftRadius:`0px`,borderTopRightRadius:`0px`}},list:{sx:{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},displayEmpty:!0,disabled:o,children:[(0,d.jsx)(i.MenuItem,{sx:{mt:2},disabled:!0,value:``,children:(0,d.jsx)(`em`,{children:a})}),r.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,children:e.label},e.value))]})]})}),Mw=({item:e,path:t})=>e.children.length===0?(0,d.jsx)(M.TreeItem,{itemId:`${t}/${e.id}`,label:e.name,disabled:e.disabled,onClick:()=>{e.onClick&&e.onClick(`${t}/${e.id}`)}}):(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(M.TreeItem,{itemId:`${t}/${e.id}`,label:e.name,disabled:e.disabled,children:e.children.map(n=>(0,d.jsx)(Mw,{item:n,path:`${t}/${e.id}`},n.id))})}),Nw=({items:e})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(j.SimpleTreeView,{sx:{borderRadius:`16px`,border:e=>`1px solid ${e.palette[`gr-base-dark`].main}`,p:1.5},children:e.map(e=>(0,d.jsx)(Mw,{item:e,path:`origin`},e.id))})}),Pw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,fullWidth:a,white:o})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.TimeField,{label:e,disabled:i,format:`HH:mm`,ampm:!1,defaultValue:t,value:n,autoFocus:!0,onChange:e=>{r(e)},slotProps:{textField:{variant:`outlined`,size:`small`,fullWidth:a,color:`gr-yellow`,focused:!0,sx:{borderRadius:`16px`},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`},endAdornment:(0,d.jsx)(N.default,{style:{color:o?`black`:`white`}})}}}}})}),Fw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,white:a,fullWidth:o})=>{let{format:s,singleShortcut:c}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.DatePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:i,format:s,slotProps:{shortcuts:{items:c},textField:{variant:`outlined`,size:`small`,fullWidth:o,color:`gr-yellow`,focused:!0,slotProps:{input:{sx:{borderRadius:`16px`,color:a?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:a?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>e.palette[`gr-base-dark`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:a?`white`:`black`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Iw=({label:e,initialValue:t,value:n,setValue:r,calendars:i,disabled:a,white:o,fullWidth:s})=>{let{format:c,rangeShortcut:u}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(b.DateRangePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:a,format:c,calendars:i,slotProps:{shortcuts:{items:u},textField:{variant:`outlined`,size:`small`,fullWidth:s,color:`gr-yellow`,focused:!0,slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiPickersArrowSwitcher-root":{color:e=>e.palette[`gr-base-dark`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:o?`white`:`black`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Lw=({initialValue:e,value:t,setValue:n,calendars:r,disabled:i,white:a})=>{let{rangeShortcut:o}=(0,l.useContext)(fe);return(0,d.jsx)(P.StaticDateRangePicker,{defaultValue:e,value:t,onChange:e=>{n(e),console.log(`Selected Range:`,e)},calendars:r,disabled:i,sx:{width:`560px`,overflowX:`auto`,borderRadius:`20px`,"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiYearCalendar-button":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiButtonBase-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiPickersArrowSwitcher-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiPickersDay-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiChip-label":{color:e=>`${e.palette[`gr-base-dark`].main} !important`},"& .MuiTypography-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiPickersCalendarHeader-label":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main}},slotProps:{shortcuts:{items:o},actionBar:{actions:[]},layout:{sx:{borderRadius:`20px !important`,bgcolor:a?`white !important`:`black !important`}}}})},Rw=({data:e,setData:t,columnLabels:n,buttons:r})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.Grid,{sx:{overflow:`hidden`},container:!0,spacing:2,children:[(0,d.jsxs)(i.Grid,{size:1,children:[(0,d.jsx)(i.Button,{variant:`contained`,size:`small`,color:`gr-base-dark`,sx:{borderRadius:`20px`,height:`40px`,maxWidth:`40px`,minWidth:`40px`,width:`40px`,p:1,mt:7,mb:2},onClick:()=>t(e.slice(0,-1)),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:`#FFFFFF`,fontSize:`18px`},children:`remove`})}),(0,d.jsx)(i.Button,{variant:`contained`,size:`small`,color:`gr-base-dark`,sx:{borderRadius:`20px`,height:`40px`,maxWidth:`40px`,minWidth:`40px`,width:`40px`,p:1},onClick:()=>t([...e,n.map(()=>({value:``}))]),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:`#FFFFFF`,fontSize:`18px`},children:`add`})})]}),(0,d.jsx)(i.Grid,{size:11,children:(0,d.jsxs)(i.Grid,{container:!0,children:[(0,d.jsx)(i.Grid,{size:8,sx:{bgcolor:e=>e.palette[`gr-base-dark`].main,borderTopLeftRadius:`20px`,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:1},children:r.map((e,t)=>(0,d.jsxs)(i.Button,{sx:{borderRadius:`20px`,textTransform:`none`},variant:`outlined`,size:`small`,color:`gr-base-light`,onClick:e.onClick,children:[e.label,(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{ml:1,mt:-.5,color:`#FFFFFF`,fontSize:`18px`},children:e.icon})]},t))}),(0,d.jsx)(i.Grid,{size:4,sx:{bgcolor:e=>e.palette[`gr-base-dark`].main,borderTopRightRadius:`20px`,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:1}}),(0,d.jsx)(i.Grid,{size:12,sx:{overflowX:`auto`,width:`55vh`,borderBottomLeftRadius:`20px`,borderBottomRightRadius:`20px`},children:(0,d.jsx)(F.default,{data:e,columnLabels:n,onChange:e=>t(e),className:``})})]})})]})}),zw=e=>{let t=(0,l.useRef)(null);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(D.default,{nodeRef:t,handle:`#draggable-dialog-title`,cancel:`[class*="MuiDialogContent-root"]`,children:(0,d.jsx)(i.Paper,{...e,ref:t,sx:{bgcolor:`white`,color:e=>e.palette.background.paper,padding:`20px`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,gap:`50px`,borderRadius:`20px`}})})})},Bw=({title:e,alert:t,action:n,fields:r,open:a,setOpen:o,loading:s,onClickSave:c})=>{let[u,f]=(0,l.useState)(!1),p=(e,t)=>{switch(e.element){case`TextField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.TextField,{fullWidth:!0,variant:`outlined`,label:e.label,type:e.type,placeholder:e.placeholder,focused:!0,value:e.value,multiline:e.multiline,rows:e.rows,onChange:t=>{e.setValue(t.target.value)},disabled:e.disable||n?.actionButton?.loading,size:`small`})},t);case`SelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(jw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`DateField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(kw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`CheckboxField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.FormGroup,{children:(0,d.jsx)(i.FormControlLabel,{control:(0,d.jsx)(i.Checkbox,{sx:{ml:1.5,color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}},checked:e.value,onChange:t=>e.setValue(t.target.checked),disabled:!!(e.disable||n?.actionButton?.loading)}),label:e.label})})},t);case`CheckboxGroup`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.FormGroup,{children:e.checkboxs.map((e,t)=>(0,d.jsx)(i.FormControlLabel,{control:(0,d.jsx)(i.Checkbox,{sx:{ml:1.5,color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}},checked:e.value,onChange:t=>e.setValue(t.target.checked)}),label:e.label},t))})},t);case`RadioGroupField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsxs)(i.FormControl,{sx:{mt:e.label.text?`none`:`-7px`},children:[(0,d.jsx)(i.FormLabel,{children:e.label.text}),(0,d.jsx)(i.RadioGroup,{value:e.value,onChange:t=>e.setValue(t.target.value),row:e.row,children:e.radios.map((e,t)=>(0,d.jsx)(i.FormControlLabel,{value:e.value,control:(0,d.jsx)(i.Radio,{sx:{color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}}}),label:e.label.text,labelPlacement:e.label.position,disabled:e.disable},t))})]})},t);case`AutoCompleteField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Aw,{label:e.label,placeholder:`Seleccionar`,values:e.values,value:e.value,setValue:e.setValue,white:!0})},t);case`ListField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.List,{dense:!0,sx:{borderRadius:`16px`,border:t=>e.border?`1px solid ${t.palette[`gr-grey`].dark}`:`none`},children:e.items.map((t,n)=>(0,d.jsxs)(i.ListItem,{secondaryAction:e.action,children:[t.icon&&(0,d.jsx)(i.ListItemIcon,{children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:t.icon?.color},children:t.icon?.name})}),(0,d.jsx)(i.ListItemText,{primary:t.primaryText,secondary:t.secondaryText})]},n))})},t);case`TreeviewField`:return(0,d.jsxs)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:[(0,d.jsx)(i.Typography,{variant:`body1`,children:e.label}),(0,d.jsx)(Nw,{items:e.items})]},t);case`TimeField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Pw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`TypographyField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.Typography,{variant:`body1`,children:e.text})},t);case`DatePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Fw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!!e.white})},t)});case`DateRangePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Iw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t)});case`DateRangeCalendarField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Lw,{initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:!!(e.disable||n?.actionButton?.loading),white:e.white})},t)});case`SheetField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Rw,{data:e.data,setData:e.setData,columnLabels:e.columnLabels,buttons:e.buttons})},t)});case`DividerField`:return(0,d.jsx)(i.Grid,{size:12,sx:{mb:`20px`},children:(0,d.jsx)(i.Box,{sx:{width:`100%`,height:`1px`,bgcolor:e=>e.palette[`gr-grey`].dark}})},t);case`CustomField`:return(0,d.jsx)(i.Grid,{size:12,sx:{mb:`20px`},children:e.content},t);default:return(0,d.jsx)(d.Fragment,{})}},m=()=>{r.forEach(e=>{switch(e.element){case`TextField`:e.setValue(e.initialValue);break;case`SelectField`:e.setValue(e.initialValue);break;case`DateField`:e.setValue(e.initialValue);break;case`CheckboxField`:e.setValue(e.initialValue);break;case`CheckboxGroup`:e.checkboxs.forEach(e=>{e.setValue(e.initialValue)});break;case`AutoCompleteField`:e.setValue(e.initialValue);break;case`ListField`:break;case`TreeviewField`:break;case`TimeField`:e.setValue(e.initialValue);break;case`DatePickerField`:e.setValue(e.initialValue);break;case`DateRangePickerField`:e.setValue(e.initialValue);break;case`TypographyField`:break;case`DateRangeCalendarField`:e.setValue(e.initialValue);break;case`RadioGroup`:e.setValue(e.initialValue)}}),f(!1)},h=e=>{e.some(e=>{if(e.element===`CheckboxGroup`)return e.checkboxs.some(e=>e.value!==e.initialValue);if(e.element===`CheckboxField`||e.element===`TextField`||e.element===`SelectField`||e.element===`DateField`)return e.value!==e.initialValue;if(e.element===`AutoCompleteField`)return JSON.stringify(e.value.sort())!==JSON.stringify(e.initialValue.sort());if(e.element===`TimeField`||e.element===`DatePickerField`)return e.value!==e.initialValue;if(e.element===`DateRangePickerField`||e.element===`DateRangeCalendarField`)return JSON.stringify(e.value)!==JSON.stringify(e.initialValue);if(e.element===`RadioGroup`)return e.value!==e.initialValue})?f(!0):o(!1)};return(0,l.useEffect)(()=>{a||m()},[a]),(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.Dialog,{open:a,onClose:()=>h(r),PaperComponent:zw,"aria-labelledby":`draggable-dialog-title`,children:[(0,d.jsxs)(i.DialogTitle,{style:{cursor:`move`,textAlign:`left`,margin:0,padding:0,width:`100%`},id:`draggable-dialog-title`,children:[e,(0,d.jsx)(i.IconButton,{sx:{position:`absolute`,right:10,top:10},onClick:()=>h(r),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:e=>e.palette[`gr-base-dark`].main,fontSize:`24px`},children:`close`})})]}),u&&t&&(0,d.jsx)(i.DialogContent,{sx:{padding:0,margin:0,width:`100%`,overflow:`hidden`,minHeight:`85px`},children:(0,d.jsxs)(i.Alert,{icon:(0,d.jsx)(O.default,{}),sx:{borderRadius:`24px`,bgcolor:`#FFEFE5`,border:e=>`1px solid ${e.palette[`gr-orange`].main}`,"& .MuiAlert-icon":{color:e=>e.palette[`gr-orange`].main}},action:(0,d.jsxs)(i.Box,{sx:{mt:3.75},children:[(0,d.jsx)(i.Button,{color:`gr-grey`,size:`small`,onClick:()=>f(!1),children:(0,d.jsx)(`b`,{children:t.actionButton.buttonText})}),(0,d.jsx)(i.Button,{color:`gr-grey`,size:`small`,onClick:()=>{m(),o(!1)},children:(0,d.jsx)(`b`,{children:t.cancelButton.buttonText})})]}),children:[(0,d.jsx)(i.AlertTitle,{children:t.title}),(0,d.jsx)(i.Typography,{variant:`body2`,children:t.message})]})}),(0,d.jsxs)(i.DialogContent,{sx:{padding:0,margin:0,position:`relative`,overflow:s?`hidden`:`auto`},children:[(0,d.jsx)(i.Grid,{container:!0,spacing:2,sx:{mt:1,visibility:s?`hidden`:`visible`},children:r.map((e,t)=>p(e,t))}),s&&(0,d.jsx)(i.Box,{sx:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,d.jsx)(i.CircularProgress,{size:60})})]}),(0,d.jsxs)(i.DialogActions,{sx:{display:`flex`,flexDirection:`row`,justifyContent:`flex-end`,alignItems:`center`,width:`100%`},children:[n?.cancelButton&&(0,d.jsx)(i.Button,{variant:`outlined`,autoFocus:!0,onClick:()=>h(r),sx:{minWidth:`130px`,borderRadius:`44px`,fontWeight:`500`,textTransform:`none`},color:`gr-base-dark`,children:n.cancelButton?.buttonText}),n?.actionButton&&(0,d.jsx)(i.Button,{variant:`contained`,onClick:()=>{c()},sx:{minWidth:`130px`,borderRadius:`44px`,color:`white`,fontWeight:`500`,textTransform:`none`},color:`gr-base-dark`,disableElevation:!0,disabled:n.actionButton.disabled,loading:n.actionButton.loading,children:n.actionButton.buttonText})]})]})})},Vw={error:``,warning:``,success:``,suggestion:``,info:``},Hw={error:J.feedbackError,warning:J.feedbackWarning,success:J.feedbackSuccess,suggestion:J.feedbackSuggestion,info:J.feedbackInfo};function Uw({type:e=`info`,title:t,children:n,message:r,onClose:i,closeLabel:a=`Close message`,actions:o,hideIcon:s=!1,className:c}){let l=n??r,u=t??Vw[e]??``,f=!!o?.length;return(0,d.jsxs)(`div`,{className:Z(`rb-message-alert`,`rb-message-alert--${e}`,s&&`rb-message-alert--no-icon`,f&&`rb-message-alert--with-actions`,c),role:e===`error`||e===`warning`?`alert`:`status`,children:[s?null:(0,d.jsx)(`span`,{className:`rb-message-alert__icon`,"aria-hidden":`true`,children:(0,d.jsx)(`img`,{src:Hw[e],alt:``,className:`size-6`,draggable:!1})}),(0,d.jsxs)(`div`,{className:`rb-message-alert__content`,children:[u?(0,d.jsx)(`div`,{className:`rb-message-alert__title h5`,children:u}):null,l?(0,d.jsx)(`div`,{className:`rb-message-alert__text p1`,children:l}):null]}),f?(0,d.jsx)(`div`,{className:`rb-message-alert__actions`,children:o?.map((e,t)=>(0,d.jsx)(L_,{type:`button`,variant:`ghost`,size:`s`,onClick:e.onClick,disabled:e.disabled,children:e.label},t))}):null,i?(0,d.jsx)(`button`,{type:`button`,className:`rb-message-alert__close`,onClick:i,"aria-label":a,children:(0,d.jsx)(`img`,{src:J.close,alt:``,className:`size-4`,draggable:!1})}):null]})}var Ww={s:`max-w-[var(--form-shell-s)]`,m:`max-w-[var(--form-shell-m)]`,l:`max-w-[var(--form-shell-l)]`},Gw=16,Kw=[`button:not([disabled])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function qw(e){return e?Array.from(e.querySelectorAll(Kw)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`):[]}function Jw(e,t,n){return Math.min(Math.max(e,t),n)}function Yw({open:e,title:t,ariaLabel:n,alert:r,children:i,footer:a,onClose:o,loading:s=!1,loadingLabel:c=`Cargando`,closeLabel:u=`Cerrar`,size:f=`m`,draggable:p=!0,closeOnEscape:m=!0,closeOnBackdrop:h=!1,className:g,headerClassName:_,bodyClassName:v,footerClassName:y}){let b=(0,l.useId)(),x=(0,l.useRef)(null),S=(0,l.useRef)(null),[C,w]=(0,l.useState)({x:0,y:0}),[T,E]=(0,l.useState)(!1),D=(0,l.useRef)({mouseX:0,mouseY:0,startX:0,startY:0});if((0,l.useEffect)(()=>{e||(w({x:0,y:0}),E(!1))},[e]),(0,l.useEffect)(()=>{if(!e||typeof document>`u`)return;S.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=window.requestAnimationFrame(()=>{(qw(x.current)[0]??x.current)?.focus()});return()=>{window.cancelAnimationFrame(t),S.current?.focus()}},[e]),(0,l.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Escape`&&m){e.preventDefault(),o?.();return}if(e.key!==`Tab`||!x.current)return;let t=qw(x.current);if(t.length===0){e.preventDefault(),x.current.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;if(e.shiftKey&&i===n){e.preventDefault(),r.focus();return}!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,o,m]),!e)return null;let O=e=>{!p||e.button!==0||e.target instanceof HTMLElement&&e.target.closest(`[data-form-shell-close]`)||(E(!0),D.current={mouseX:e.clientX,mouseY:e.clientY,startX:C.x,startY:C.y},e.currentTarget.setPointerCapture?.(e.pointerId))},k=e=>{if(!p||!T)return;let t=e.clientX-D.current.mouseX,n=e.clientY-D.current.mouseY,r=D.current.startX+t,i=D.current.startY+n,a=x.current;if(!a){w({x:r,y:i});return}let o=Gw,s=Math.max(0,(window.innerWidth-a.offsetWidth)/2-o),c=Math.max(0,(window.innerHeight-a.offsetHeight)/2-o);w({x:Jw(r,-s,s),y:Jw(i,-c,c)})},A=e=>{p&&(E(!1),e.currentTarget.releasePointerCapture?.(e.pointerId))};return(0,d.jsx)(OC,{children:(0,d.jsx)(`div`,{className:`rb-modal-layer fixed inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.24)] p-4`,role:`presentation`,onPointerDown:e=>{!h||e.target!==e.currentTarget||o?.()},children:(0,d.jsx)(`section`,{ref:x,role:`dialog`,tabIndex:-1,"aria-modal":`true`,"aria-labelledby":t?b:void 0,"aria-label":t?void 0:n??`Formulario`,"aria-busy":s||void 0,className:Z(`relative flex h-fit w-full min-w-0`,`flex-col overflow-hidden`,`font-sans`,`max-h-[calc(100dvh-2rem)]`,`rounded-[var(--r-m)]`,`border border-[var(--border)]`,`bg-[var(--surface-elevated)]`,`text-[var(--text)]`,`shadow-none`,`p-4 min-[36rem]:p-5`,Ww[f],g),style:{transform:`translate(${C.x}px, ${C.y}px)`},children:(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--surface-elevated)]`,children:[(0,d.jsx)(`header`,{className:Z(`flex shrink-0`,`touch-none select-none`,`items-start gap-3 pr-10`,`bg-[var(--surface-elevated)]`,p?T?`cursor-grabbing`:`cursor-move`:`cursor-default`,_),onPointerDown:O,onPointerMove:k,onPointerUp:A,onPointerCancel:A,children:(0,d.jsx)(`div`,{className:`min-w-0 flex-1`,children:t?(0,d.jsx)(`h2`,{id:b,className:`h4 truncate`,children:t}):null})}),o?(0,d.jsx)(`button`,{type:`button`,"data-form-shell-close":!0,onClick:o,"aria-label":u,className:Z(`motion-fast`,`absolute right-4 top-4`,`z-20 flex size-8`,`items-center justify-center`,`rounded-full`,`min-[36rem]:right-5`,`min-[36rem]:top-5`,`bg-transparent`,`text-[var(--text)]`,`hover:bg-[var(--interaction-hover)]`,`focus-visible:outline-none`,`focus-visible:shadow-[var(--focus-ring-shadow)]`),children:(0,d.jsx)(`img`,{src:J.close,alt:``,className:`size-4`,draggable:!1})}):null,r?(0,d.jsx)(`div`,{className:`p1 mt-5 shrink-0 bg-[var(--surface-elevated)]`,children:r}):null,(0,d.jsxs)(`div`,{className:Z(`relative flex min-h-0 flex-1`,`flex-col overflow-hidden`,`bg-[var(--surface-elevated)]`,r?`mt-8`:`mt-12`),children:[(0,d.jsx)(`div`,{className:Z(`min-h-0 flex-1`,`overflow-x-hidden`,`overflow-y-auto`,`bg-[var(--surface-elevated)] pr-1`,s&&`overflow-hidden`,v),children:(0,d.jsx)(`div`,{className:Z(`p1 min-w-0 pt-3`,s&&`invisible`),children:i})}),s?(0,d.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`
|
|
280
|
+
`})]});return r?(0,f.createPortal)(a,document.body):null};function dw(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():Math.random().toString(36).slice(2,10)}var fw=()=>({showAlert:(e,t,n={})=>{let r=dw(),i=e===`loading`||e==="default";return ew({id:r,severity:e,message:t,duration:n.duration??(i?void 0:5e3),closeLabel:n.closeLabel}),r},closeAlert:e=>{tw(e)}}),pw=`(max-width: 63.9375rem)`,mw=({sidebar:e,routes:t,account:n})=>{let{state:r,setState:i,getWidth:a}=pe(),[o,s]=(0,l.useState)(()=>typeof window>`u`?!1:window.matchMedia(pw).matches),[c,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=window.matchMedia(pw),t=()=>{let t=e.matches;s(t),t||u(!1)};return t(),e.addEventListener?.(`change`,t),()=>{e.removeEventListener?.(`change`,t)}},[]),(0,d.jsxs)(`div`,{className:`rb-shell rb-shell--${r}`,children:[(0,d.jsx)(zp,{items:e.items,signOut:e.signOut,tooltips:e.tooltips,state:r,setState:i,getWidth:a,isMobile:o,mobileOpen:c,onCloseMobile:()=>u(!1)}),(0,d.jsx)(YC,{account:n,sidebarItems:e.items,onOpenMobile:o?()=>u(!0):void 0}),(0,d.jsx)(WC,{state:r,getWidth:a,routes:t,account:n}),(0,d.jsx)(uw,{})]})},hw=e=>(0,d.jsx)(mw,{...e}),gw=({sidebar:e,routes:t,product:n,account:r,languages:i,loginForm:a,signup:o,unsavedChangesAlert:s})=>{let{isAuthenticated:c,openUnsaved:u,setOpenUnsaved:f}=(0,l.useContext)(fe),p=[{text:s.message,ncolumn:12,element:`TypographyField`}];return(0,d.jsxs)(d.Fragment,{children:[c?(0,d.jsx)(hw,{routes:t,sidebar:e,account:r}):(0,d.jsx)(IC,{product:n,languages:i,form:a,signup:o}),(0,d.jsx)(Bw,{title:s.title,open:u,setOpen:f,fields:p,loading:!1,onClickSave:s.actionButton.onClick,action:{actionButton:s.actionButton,cancelButton:s.cancelButton}})]})},_w=({sidebar:e,routes:t,product:n,account:r,languages:o,loginForm:s,signup:c,unsavedChangesAlert:f,msalInstance:g})=>{let{isAuthenticated:_,setIsAuthenticated:v}=(0,l.useContext)(fe),[y,b]=(0,l.useState)(0),x=o.find(e=>e.active)||o[0];(0,l.useEffect)(()=>{switch(x.code){case`es`:a.default.locale(`es`);break;case`en`:a.default.locale(`en`);break;case`pt`:a.default.locale(`pt`);break;default:a.default.locale(`en`)}let e=[`token`,`company`,`config`,`privileges`,`account`,`language`,`authenticated`,`type-signin`].filter(e=>localStorage.getItem(e)===null);if(localStorage.getItem(`ues`)===`403`){localStorage.removeItem(`ues`),window.location.href=`/signup`;return}y===0&&window.location.pathname!==`/signup`&&(g.getActiveAccount()&&e.length>0?(console.log(`if 1`),A_(g,g.getActiveAccount())):g.getActiveAccount()&&e.length===0?(console.log(`if 2`),v(!0),localStorage.setItem(`authenticated`,`true`)):!g.getActiveAccount()&&_?(console.log(`if 6`),v(!0)):!g.getActiveAccount()&&e.length===0?(console.log(`if 3`),v(!0),localStorage.setItem(`authenticated`,`true`)):!g.getActiveAccount()&&e.length>0&&(console.log(`if 4`),v(!1),localStorage.setItem(`authenticated`,`false`)),b(y+1))},[x,y]);let S={rabbitLight:de,rabbitDark:(0,i.createTheme)(le,x.theme.dg,x.theme.core,x.theme.pickers)};return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(Cp,{instance:g,children:(0,d.jsx)(i.Box,{sx:{overflow:`hidden`,height:`100vh`},children:(0,d.jsx)(u.BrowserRouter,{children:(0,d.jsx)(i.ThemeProvider,{theme:S.rabbitDark,children:(0,d.jsx)(m.LocalizationProvider,{dateAdapter:h.AdapterDayjs,adapterLocale:x.code,children:(0,d.jsxs)(p.SnackbarProvider,{maxSnack:15,autoHideDuration:1e4,anchorOrigin:{vertical:`top`,horizontal:`center`},children:[(0,d.jsx)(i.CssBaseline,{}),(0,d.jsx)(gw,{sidebar:e,routes:t,product:n,account:r,languages:o,msalInstance:g,loginForm:s,signup:c,unsavedChangesAlert:f})]})})})})})})})},vw=({children:e})=>{let[t,n]=(0,l.useState)(localStorage.getItem(`authenticated`)===`true`),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(``),[u,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(`DD/MM/YYYY`),[h,g]=(0,l.useState)([]),[_,v]=(0,l.useState)([]),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(!1);return(0,d.jsx)(fe.Provider,{value:{isAuthenticated:t,setIsAuthenticated:n,user:r,setUser:i,pass:a,setPass:o,avatar:s,setAvatar:c,email:u,setEmail:f,loadingAuth:C,setLoadingAuth:w,format:p,setFormat:m,singleShortcut:h,setSingleShortcut:g,rangeShortcut:_,setRangeShortcut:v,encrypter:(e,t,n)=>{e===`session`?sessionStorage.setItem(t,n):e===`local`&&localStorage.setItem(t,n)},decrypter:(e,t)=>e===`session`?sessionStorage.getItem(t)||``:e===`local`&&localStorage.getItem(t)||``,openUnsaved:y,setOpenUnsaved:b,redirect:x,setRedirect:S},children:e})},yw=({contextMenu:e,setContextMenu:t,options:n,checked:r,optionGroup:a})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.Menu,{open:e!==null,onClose:()=>t(null),anchorReference:`anchorPosition`,anchorPosition:e===null?void 0:{top:e.mouseY,left:e.mouseX},slots:{transition:i.Fade},slotProps:{paper:{sx:{bgcolor:e=>a===`toolbar`?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main,borderRadius:`12px`},elevation:1}},sx:{cursor:`pointer`},children:n.filter(e=>!e.hide).map((e,t)=>(0,d.jsxs)(i.Box,{children:[t!==0&&n[t-1].group!==e.group?(0,d.jsx)(i.Divider,{}):null,(0,d.jsxs)(i.MenuItem,{onClick:e.click,disabled:e.disabled,children:[(0,d.jsx)(i.ListItemIcon,{sx:{color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},children:e.icon}),(0,d.jsx)(i.ListItemText,{children:(0,d.jsx)(i.Typography,{sx:{color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},children:e.name})}),e.selected?(0,d.jsxs)(i.Typography,{sx:{pl:3,color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},variant:`body2`,children:[`selecionados`,`:`,r.length]}):null,e.onlyOne?(0,d.jsx)(i.Typography,{sx:{pl:3,color:e=>a===`toolbar`?e.palette[`gr-base-light`].main:e.palette[`gr-base-dark`].main},variant:`body2`,children:`solo uno`}):null]},t)]},t))}),n.filter(e=>!e.hide).map((e,t)=>(0,d.jsx)(i.Box,{children:e.dialog},t))]}),bw=({label:e,values:t,placeholder:n,value:r,setValue:a,disabled:o,fullWidth:s,white:c,search:u})=>{let f=(0,l.useRef)(null),p=(0,l.useRef)(null),m=(0,l.useRef)(null),[h,g]=(0,l.useState)({width:0,height:0}),[v,y]=(0,l.useState)(!1),b=e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx},onClick:()=>{console.log(`icon click`),y(!v)}});(0,l.useEffect)(()=>{if(!f.current)return;let e=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect;g({width:t,height:n})});return e.observe(f.current),()=>e.disconnect()},[h]),(0,l.useEffect)(()=>{v&&m.current?.focus()},[v]);let x={marginTop:`-55px`,maxHeight:`500px`,borderRadius:`24px`,borderTopLeftRadius:`24px`,borderTopRightRadius:`24px`,width:h.width+20,backgroundColor:`transparent`,"--Paper-overlay":`none`,border:`1px solid rgba(255, 255, 255, 0.2)`};return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{ref:f,labelId:`filter-table-label-${e}`,id:`filter-${e}`,open:v,onOpen:()=>{y(!0)},onClose:e=>{let t=e?.target;t&&p.current?.contains(t)||y(!1)},value:r,label:e,onChange:e=>a(e.target.value),multiple:!1,renderValue:e=>{let r=Array.isArray(e)?e[0]:e;return r==null||r===``?n:t.find(e=>e.value===r)?.label||n},color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:b,MenuProps:{autoFocus:!1,disableAutoFocusItem:!0,slotProps:{paper:{style:x},list:{sx:{marginTop:`60px`,backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},displayEmpty:!0,disabled:o,children:[(0,d.jsx)(i.ListSubheader,{disableSticky:!0,sx:{backgroundColor:`transparent`,px:1.5,py:1},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:(0,d.jsx)(i.TextField,{ref:p,inputRef:m,variant:`standard`,fullWidth:!0,size:`small`,placeholder:u?.placeholder||`Buscar...`,value:u?.value||``,onMouseDown:e=>{e.stopPropagation(),y(!0)},onClick:e=>{e.stopPropagation(),y(!0)},onKeyDown:e=>{e.stopPropagation()},onChange:e=>{u?.setValue(e.target.value)},color:`gr-yellow`})}),t.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,sx:{display:`${e.label} ${e.sublabel??``}`.toLowerCase().includes(u?.value?.toLowerCase()??``)?`block`:`none`},onClick:()=>{y(!1)},children:(0,d.jsxs)(i.Typography,{variant:`caption`,color:`textSecondary`,children:[e.label,e.sublabel&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`br`,{}),e.sublabel]})]})},e.value))]})]})})},xw=({label:e,value:t,setValue:n,values:r,placeholder:a,disabled:o,fullWidth:s,white:c,search:u})=>{let f=(0,l.useRef)(null),p=(0,l.useRef)(null),[m,h]=(0,l.useState)({width:0,height:0}),[g,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(``),x=u?.value??y,S=r.filter(e=>`${e.label} ${e.sublabel??``}`.toLowerCase().includes(x.toLowerCase())).map(e=>e.value),C=S.filter(e=>t.includes(e)).length,w=S.length>0&&C===S.length,T=C>0&&!w,E=e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx},onClick:()=>{v(!g)}});(0,l.useEffect)(()=>{if(!f.current)return;let e=new ResizeObserver(e=>{let{width:t,height:n}=e[0].contentRect;h({width:t,height:n})});return e.observe(f.current),()=>e.disconnect()},[m]);let D={marginTop:`-55px`,maxHeight:`500px`,borderRadius:`24px`,borderTopLeftRadius:`24px`,borderTopRightRadius:`24px`,width:m.width+20,backgroundColor:`transparent`,"--Paper-overlay":`none`,border:`1px solid rgba(255, 255, 255, 0.2)`};return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{ref:f,labelId:`filter-table-label-${e}`,id:`filter-${e}`,open:g,onOpen:()=>{v(!0)},onClose:e=>{let t=e?.target;t&&p.current?.contains(t)||v(!1)},value:t,label:e,onChange:e=>{let{target:{value:r}}=e,i=typeof r==`string`?r.split(`,`):r;if(i.includes(`select-all`)){if(w){n(t.filter(e=>!S.includes(e)));return}n(Array.from(new Set([...t,...S])));return}n(i.filter(e=>e!==`select-all`))},color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:E,MenuProps:{slotProps:{paper:{style:D},list:{sx:{marginTop:`60px`,backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},renderValue:e=>!e||e.length===0?a:r.filter(t=>e.includes(t.value)).map(e=>e.label).join(`, `),displayEmpty:!0,disabled:o,multiple:!0,children:[(0,d.jsx)(i.ListSubheader,{disableSticky:!0,sx:{backgroundColor:`transparent`,px:1.5,py:1},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:(0,d.jsx)(i.TextField,{ref:p,variant:`standard`,fullWidth:!0,size:`small`,placeholder:u?.placeholder||`Buscar...`,value:x,onMouseDown:e=>{e.stopPropagation(),v(!0)},onClick:e=>{e.stopPropagation(),v(!0)},onKeyDown:e=>{e.stopPropagation()},onChange:e=>{let t=e.target.value;if(u?.setValue){u.setValue(t);return}b(t)},focused:!1,color:`gr-yellow`})}),(0,d.jsxs)(i.MenuItem,{value:`select-all`,disabled:S.length===0,children:[(0,d.jsx)(i.Checkbox,{checked:w,indeterminate:T}),(0,d.jsx)(i.ListItemText,{slotProps:{primary:{sx:{color:`#FFFFFF`}}},primary:`Seleccionar todo`})]}),r.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,sx:{display:S.includes(e.value)?`block`:`none`},children:(0,d.jsxs)(i.Box,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,d.jsx)(i.Checkbox,{checked:t.includes(e.value)}),(0,d.jsxs)(i.Typography,{variant:`caption`,color:`textSecondary`,children:[e.label,e.sublabel&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`br`,{}),e.sublabel]})]})]})},e.value))]})]})})},Sw=({label:e,value:t,setValue:n,disabled:r,fullWidth:i})=>{let{format:a}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(y.LocalizationProvider,{dateAdapter:h.AdapterDayjs,children:(0,d.jsx)(v.SingleInputDateRangeField,{label:e,value:t,onChange:e=>{n(e)},sx:{"& .MuiInputBase-root":{borderRadius:`16px`}},size:`small`,color:`gr-yellow`,slotProps:{textField:{sx:{"& .MuiInputLabel-root":{color:`white !important`}}}},focused:!0,format:a,disabled:r,fullWidth:i})})})},Cw=({label:e,initialValue:t,value:n,setValue:r,calendars:i,disabled:a,white:o,fullWidth:s,maxDate:c,minDate:u})=>{let{format:f,rangeShortcut:p}=(0,l.useContext)(fe),m=(0,x.useTheme)(),h=(0,x.createTheme)({...m,palette:{...m.palette,primary:{main:`#9D9A95`}}});return(0,d.jsx)(x.ThemeProvider,{theme:h,children:(0,d.jsx)(b.DateRangePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:a,format:f,calendars:i,slotProps:{shortcuts:{items:p},textField:{variant:`outlined`,size:`small`,fullWidth:s,color:`gr-yellow`,focused:!0,sx:{"& .MuiInputLabel-root":{color:o?`black !important`:`white !important`},"& .MuiInputLabel-root.Mui-focused":{color:o?`black !important`:`white !important`},"& .MuiGrid-root":{marginBottom:`0px !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>o?e.palette[`gr-grey`].light:e.palette[`gr-grey`].main},"& .MuiChip-label":{color:o?`black !important`:`white !important`},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>o?e.palette[`gr-base-dark`].main:`white !important`},"& .MuiPickersCalendarHeader-label":{color:o?`black !important`:`white !important`},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>o?e.palette[`gr-base-dark`].main:`white !important`},"& .Mui-disabled":{color:e=>`${e.palette[`gr-grey`].main} !important`},"& .MuiPickersArrowSwitcher-root":{color:`(theme) => theme.palette["gr-base-dark"].main`},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:o?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:e=>o?e.palette[`gr-grey`].light:`black !important`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}},maxDate:c,minDate:u})})},ww=({label:e,initialValue:t,value:n,setValue:r,disabled:i,white:a,fullWidth:o})=>{let{format:s,singleShortcut:c}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.DatePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:i,format:s,slotProps:{shortcuts:{items:c},textField:{variant:`outlined`,size:`small`,fullWidth:o,color:`gr-yellow`,focused:!0,sx:{"& .MuiInputLabel-root":{color:a?`black !important`:`white !important`},"& .MuiInputLabel-root.Mui-focused":{color:a?`black !important`:`white !important`},"& .MuiGrid-root":{marginBottom:`0px !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:a?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:a?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>a?e.palette[`gr-grey`].light:e.palette[`gr-grey`].main},"& .MuiChip-label":{color:a?`black !important`:`white !important`},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>a?e.palette[`gr-base-dark`].main:`white !important`},"& .MuiPickersCalendarHeader-label":{color:a?`black !important`:`white !important`},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>a?e.palette[`gr-base-dark`].main:`white !important`},"& .Mui-disabled":{color:e=>`${e.palette[`gr-grey`].main} !important`},"& .MuiPickersArrowSwitcher-root":{color:`(theme) => theme.palette["gr-base-dark"].main`},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:e=>a?e.palette[`gr-grey`].light:`black !important`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Tw=e=>{let{name:t={title:``,ncolumn:0},fields:n=[],actions:r={ncolumn:1,buttons:[]}}=e,a=(e,t)=>{switch(e.element){case`SelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(bw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:e.disable,search:e.search,multiple:e.multiple,fullWidth:!0,white:!1})},t);case`MultiSelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(xw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:e.disable,search:e.search,fullWidth:!0,white:!1})},t);case`DateRangeField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(Sw,{label:e.label,value:e.value,setValue:e.setValue,disabled:e.disable,fullWidth:!0})},t);case`DatePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(ww,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:e.disable,fullWidth:!0,white:!1})},t)});case`DateRangePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,children:(0,d.jsx)(Cw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:e.disable,fullWidth:!0,white:!1,maxDate:e.maxDate,minDate:e.minDate})},t)});default:return(0,d.jsx)(d.Fragment,{})}};return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Box,{sx:{bgcolor:e=>e.palette.background.paper,height:`70px`,borderTopLeftRadius:`20px`,borderTopRightRadius:`20px`,display:`flex`,flexDirection:`row`,alignItems:`center`,justifyContent:`flex-end`,padding:`20px`,gap:`20px`},children:(0,d.jsxs)(i.Grid,{container:!0,spacing:2,sx:{flexGrow:1},children:[t.title&&(0,d.jsx)(i.Grid,{size:t.ncolumn,sx:{display:`flex`,alignItems:`center`},children:t.title}),n.map((e,t)=>a(e,t)),r&&r.buttons.length>0&&(0,d.jsx)(i.Grid,{size:r.ncolumn,children:(0,d.jsx)(i.Box,{sx:{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,gap:`10px`},children:r.buttons.map((e,t)=>(0,d.jsx)(i.Button,{variant:e.variant,color:`gr-yellow`,sx:{...e.sx},onClick:e.onClick,disabled:e.disabled,disableElevation:!0,children:e.icon?e.icon:(0,d.jsx)(`span`,{style:{marginTop:`2px`,textTransform:`none`,padding:`0px 5px`},children:e.text})},t))})})]})})})},Ew=e=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.DataGridPro,{...e,apiRef:e.apiRef,showToolbar:e.toolbar!==void 0,headerFilters:e.headerFilters,slots:{toolbar:Tw,headerFilterMenu:null,...e.slots},slotProps:{...e.slotProps,toolbar:{...e.toolbar},baseTextField:{color:e.toolbar===void 0?`error`:`primary`,slotProps:{input:{endAdornment:(0,d.jsx)(i.InputAdornment,{sx:{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette[`gr-grey`].main},position:`end`,children:(0,d.jsx)(S.default,{})})}}},loadingOverlay:{variant:`circular-progress`,noRowsVariant:`circular-progress`}},sx:{border:`none`,color:`black`,flex:1,borderTopLeftRadius:e.toolbar?`0px`:`20px !important`,borderTopRightRadius:e.toolbar?`0px`:`20px !important`,"--DataGrid-t-color-background-base":`transparent !important`,"& .MuiDataGrid-columnHeaderCheckbox":{backgroundColor:`white`},"& .MuiDataGrid-filler--pinnedLeft":{backgroundColor:`white`},"& .MuiDataGrid-filterForm .MuiInputBase-root":{backgroundColor:`#F3F2F2`},"& .MuiDataGrid-columnHeader":{backgroundColor:e.toolbar?`white`:`transparent`,color:e.toolbar?`black`:`white`,borderBottom:e.headerFilters?`none !important`:e=>`${e.palette.primary.main} 1px solid !important`},"& .MuiDataGrid-headerFilterRow":{bgcolor:e.toolbar?`white !important`:`transparent !important`,borderBottom:e=>`${e.palette.primary.main} 1px solid !important`},"& .MuiDataGrid-virtualScroller":{bgcolor:`white`,borderBottomLeftRadius:e.slots?.footer?`0px`:`20px`,borderBottomRightRadius:e.slots?.footer?`0px`:`20px`},"& .MuiDataGrid-columnHeaderTitleContainer":{"& .MuiCheckbox-root":{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette.background.paper}},"& .MuiDataGrid-iconButtonContainer":{"& .MuiIconButton-root":{color:t=>e.toolbar===void 0?t.palette[`gr-grey`].light:t.palette[`gr-grey`].main}},"& .MuiDataGrid-footerContainer":{borderTop:`none`,fontWeight:`500`,display:`flex`,justifyContent:`center`,alignItems:`center`,borderBottomLeftRadius:`20px`,borderBottomRightRadius:`20px`,backgroundColor:`black`},"& .MuiIconButton-root":{color:e=>e.palette.background.paper,"&.Mui-disabled":{color:`#888`,backgroundColor:`#eee`,opacity:.7}},"& .MuiDataGrid-row":{minHeight:45,maxHeight:`none`},"& .MuiDataGrid-cell":{minHeight:45,height:`auto`,maxHeight:`none`,display:`flex`,flexDirection:`column`,alignItems:`start`,justifyContent:`flex-start`,gap:1.5,p:1,borderBottom:`none`,borderTop:`1px solid #CECDCA`},"& .MuiDataGrid-cell--editing":{minHeight:45,height:`auto`,maxHeight:`none`,display:`flex`,flexDirection:`column`,alignItems:`start`,justifyContent:`flex-start`,gap:1.5,p:1},"& .MuiDataGrid-cell--editing input":{color:`black !important`,backgroundColor:`white !important`},"& .MuiDataGrid-row:hover, & .MuiDataGrid-row.Mui-selected":{bgcolor:`#B6B4AF`},"& .MuiDataGrid-cell.enable-cell":{backgroundColor:`white !important`,"& .MuiCheckbox-root":{color:e=>e.palette.background.paper}},"& .MuiDataGrid-cell.parcial-cell":{backgroundColor:`#E7E6E4 !important`,"& .MuiCheckbox-root":{color:e=>e.palette.background.paper}},"& .MuiDataGrid-cell.disable-cell":{backgroundColor:`#E7E6E4 !important`,"& .MuiCheckbox-root":{color:`#CECDCA`}},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.enable-cell":{backgroundColor:`#B6B4AF !important`},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.parcial-cell":{backgroundColor:`#B6B4AF !important`},"& .MuiDataGrid-row:hover .MuiDataGrid-cell.disable-cell":{backgroundColor:`#B6B4AF !important`},...e.sx},loading:e.loading,checkboxSelection:e.checkboxSelection,paginationModel:e.paginationModel,onPaginationModelChange:e.setPaginationModel,onRowSelectionModelChange:e.setRowSelectionModel,rowSelectionModel:e.rowSelectionModel,disableRowSelectionOnClick:e.disableRowSelectionOnClick,getRowHeight:()=>`auto`,onCellEditStop:e.onCellEditStop,disableVirtualization:!0,initialState:e.initialState,showColumnVerticalBorder:!1,showCellVerticalBorder:!1}),(0,d.jsx)(yw,{contextMenu:e.contextMenu,setContextMenu:e.setContextMenu,options:e.options,checked:e.rowSelectionModel,optionGroup:e.optionGroup})]}),Dw=()=>{let e=(0,g.useGridApiRef)(),[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)({pageSize:25,page:0}),[s,c]=(0,l.useState)({type:`include`,ids:new Set}),[u,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`table`);return{apiRef:e,rows:r,setRows:i,loading:t,setLoading:n,paginationModel:a,setPaginationModel:o,rowSelectionModel:s,setRowSelectionModel:c,contextMenu:u,setContextMenu:d,optionGroup:f,setOptionGroup:p}},Ow=()=>{let{enqueueSnackbar:e}=(0,p.useSnackbar)(),t=e=>{(0,p.closeSnackbar)(e)};return{showAlert:(n,r)=>e(r,{variant:n,content:(e,r)=>(0,d.jsx)(i.Alert,{sx:{borderRadius:`24px`,bgcolor:`#fff`,boxShadow:3,color:e=>e.palette[`gr-base-dark`].main},severity:n,iconMapping:{error:(0,d.jsx)(C.default,{}),info:(0,d.jsx)(E.default,{}),success:(0,d.jsx)(w.default,{}),warning:(0,d.jsx)(T.default,{}),default:(0,d.jsx)(i.CircularProgress,{color:`gr-blue`,size:20})},onClose:()=>t(e),children:r},e)}),closeAlert:t}},kw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,fullWidth:a,white:o})=>{let{format:s}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(k.DateTimeField,{label:e,defaultValue:t,value:n,onChange:e=>{r(e)},sx:{"& .MuiInputBase-root":{borderRadius:`16px`,color:o?`black !important`:`white !important`}},size:`small`,color:`gr-yellow`,slotProps:{textField:{sx:{"& .MuiInputLabel-root":{color:o?`black !important`:`white !important`}},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}}},focused:!0,format:s,disabled:i,fullWidth:a})})},Aw=({label:e,placeholder:t,values:n,value:r,setValue:a,white:o})=>{let[s,c]=(0,l.useState)(!1);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Autocomplete,{multiple:!0,options:n,getOptionLabel:e=>e.label,value:n.filter(e=>r.includes(e.value)),onChange:(e,t)=>{a(t.map(e=>e.value))},onOpen:()=>c(!0),onClose:()=>c(!1),renderInput:n=>(0,d.jsx)(i.TextField,{...n,label:e,placeholder:t,variant:`outlined`,sx:{backgroundColor:e=>o?`white`:e.palette[`gr-base-dark`].main,borderTopLeftRadius:`18px`,borderTopRightRadius:`18px`,borderBottomLeftRadius:s?`0px`:`18px`,borderBottomRightRadius:s?`0px`:`18px`,color:o?`black !important`:`white !important`,"& .MuiChip-root":{maxWidth:`100px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},"& .MuiAutocomplete-tag":{maxHeight:`32px`,overflow:`hidden`,display:`inline-flex`,flexWrap:`nowrap`},"& .MuiAutocomplete-inputRoot":{flexWrap:`nowrap`}},color:`gr-yellow`,focused:!0}),renderValue:(e,t)=>e.map((e,n)=>{let{key:r,...a}=t({index:n});return(0,d.jsx)(i.Tooltip,{title:e.highlight?.tooltip,sx:{borderRadius:`24px`},children:(0,d.jsx)(i.Chip,{variant:`filled`,label:e.label,size:`small`,...a,sx:{bgcolor:t=>e.highlight?.active?`${t.palette[`gr-orange`].main}20`:`${t.palette[`gr-grey`].main}20`,color:e=>e.palette[`gr-base-dark`].main,"& .MuiChip-deleteIcon":{color:e=>e.palette[`gr-base-dark`].main,"&:hover":{color:e=>e.palette[`gr-base-dark`].main}},border:e.highlight?.active?`1px solid`:`none`,borderColor:t=>e.highlight?.active?t.palette[`gr-orange`].main:`none`}},r)})}),popupIcon:(0,d.jsx)(A.default,{sx:{color:o?`black`:`white`}}),slotProps:{paper:{sx:{maxHeight:`500px`,borderBottomLeftRadius:`32px`,borderBottomRightRadius:`32px`,borderTopLeftRadius:`0px`,borderTopRightRadius:`0px`,backgroundColor:e=>o?`white`:e.palette[`gr-base-dark`].main,color:o?`black`:`white`}},chip:{sx:{bgcolor:e=>o?`${e.palette[`gr-grey`].light} !important`:`${e.palette[`gr-grey`].main} !important`,color:o?`black`:`white`},size:`small`,deleteIcon:(0,d.jsx)(C.default,{sx:{color:o?`black !important`:`white !important`}})}},limitTags:2,size:`small`})})},jw=({label:e,value:t,setValue:n,values:r,placeholder:a,disabled:o,fullWidth:s,white:c})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.FormControl,{fullWidth:s,focused:!0,children:[(0,d.jsx)(i.InputLabel,{id:`filter-table-label-${e}`,sx:{color:c?`black`:`white`,position:`absolute`,"&.Mui-focused":{color:c?`black`:`white`},'&[data-shrink="false"]':{transform:`translateY(12px) translateX(12px)`}},children:e}),(0,d.jsxs)(i.Select,{labelId:`filter-table-label-${e}`,id:`filter-${e}`,value:t,label:e,onChange:e=>n(e.target.value),color:`gr-yellow`,sx:{color:c?`black`:`white`},IconComponent:e=>(0,d.jsx)(_.default,{...e,sx:{color:c?`black !important`:`white !important`,...e.sx}}),MenuProps:{slotProps:{paper:{style:{maxHeight:`500px`,borderBottomLeftRadius:`32px`,borderBottomRightRadius:`32px`,borderTopLeftRadius:`0px`,borderTopRightRadius:`0px`}},list:{sx:{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,"& .MuiMenuItem-root":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main,color:c?`black`:`white`,"&:hover":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-selected":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main},"&.Mui-focusVisible":{backgroundColor:e=>c?`white`:e.palette[`gr-base-dark`].main}}}}}},displayEmpty:!0,disabled:o,children:[(0,d.jsx)(i.MenuItem,{sx:{mt:2},disabled:!0,value:``,children:(0,d.jsx)(`em`,{children:a})}),r.map(e=>(0,d.jsx)(i.MenuItem,{value:e.value,children:e.label},e.value))]})]})}),Mw=({item:e,path:t})=>e.children.length===0?(0,d.jsx)(M.TreeItem,{itemId:`${t}/${e.id}`,label:e.name,disabled:e.disabled,onClick:()=>{e.onClick&&e.onClick(`${t}/${e.id}`)}}):(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(M.TreeItem,{itemId:`${t}/${e.id}`,label:e.name,disabled:e.disabled,children:e.children.map(n=>(0,d.jsx)(Mw,{item:n,path:`${t}/${e.id}`},n.id))})}),Nw=({items:e})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(j.SimpleTreeView,{sx:{borderRadius:`16px`,border:e=>`1px solid ${e.palette[`gr-base-dark`].main}`,p:1.5},children:e.map(e=>(0,d.jsx)(Mw,{item:e,path:`origin`},e.id))})}),Pw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,fullWidth:a,white:o})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.TimeField,{label:e,disabled:i,format:`HH:mm`,ampm:!1,defaultValue:t,value:n,autoFocus:!0,onChange:e=>{r(e)},slotProps:{textField:{variant:`outlined`,size:`small`,fullWidth:a,color:`gr-yellow`,focused:!0,sx:{borderRadius:`16px`},slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`},endAdornment:(0,d.jsx)(N.default,{style:{color:o?`black`:`white`}})}}}}})}),Fw=({label:e,initialValue:t,value:n,setValue:r,disabled:i,white:a,fullWidth:o})=>{let{format:s,singleShortcut:c}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(m.DatePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:i,format:s,slotProps:{shortcuts:{items:c},textField:{variant:`outlined`,size:`small`,fullWidth:o,color:`gr-yellow`,focused:!0,slotProps:{input:{sx:{borderRadius:`16px`,color:a?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:a?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>e.palette[`gr-base-dark`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:a?`white`:`black`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Iw=({label:e,initialValue:t,value:n,setValue:r,calendars:i,disabled:a,white:o,fullWidth:s})=>{let{format:c,rangeShortcut:u}=(0,l.useContext)(fe);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(b.DateRangePicker,{label:e,defaultValue:t,value:n,onChange:e=>r(e),disabled:a,format:c,calendars:i,slotProps:{shortcuts:{items:u},textField:{variant:`outlined`,size:`small`,fullWidth:s,color:`gr-yellow`,focused:!0,slotProps:{input:{sx:{borderRadius:`16px`,color:o?`black !important`:`white !important`,"& .MuiIconButton-root .MuiSvgIcon-root":{color:o?`black !important`:`white !important`}}}}},popper:{sx:{"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiYearCalendar-button":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiButtonBase-root":{color:e=>e.palette[`gr-base-dark`].main},"& .MuiPickersArrowSwitcher-root":{color:e=>e.palette[`gr-base-dark`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:`black !important`},"& .MuiPaper-root":{bgcolor:o?`white`:`black`,borderRadius:`20px`},"& .MuiPickersDay-root":{color:e=>e.palette[`gr-base-dark`].main}}}}})})},Lw=({initialValue:e,value:t,setValue:n,calendars:r,disabled:i,white:a})=>{let{rangeShortcut:o}=(0,l.useContext)(fe);return(0,d.jsx)(P.StaticDateRangePicker,{defaultValue:e,value:t,onChange:e=>{n(e),console.log(`Selected Range:`,e)},calendars:r,disabled:i,sx:{width:`560px`,overflowX:`auto`,borderRadius:`20px`,"& .MuiChip-root":{bgcolor:e=>e.palette[`gr-grey`].light},"& .MuiChip-root:hover":{bgcolor:e=>e.palette[`gr-grey`].dark},"& .MuiDayCalendar-weekDayLabel":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiYearCalendar-button":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiButtonBase-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiPickersArrowSwitcher-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .Mui-selected, & .MuiPickersDay-root.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiYearCalendar-yearButton.Mui-selected":{bgcolor:e=>`${e.palette[`gr-yellow`].main} !important`,color:a?`black !important`:`white !important`},"& .MuiPickersDay-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiChip-label":{color:e=>`${e.palette[`gr-base-dark`].main} !important`},"& .MuiTypography-root":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main},"& .MuiPickersCalendarHeader-label":{color:e=>a?e.palette[`gr-base-dark`].main:e.palette[`gr-base-light`].main}},slotProps:{shortcuts:{items:o},actionBar:{actions:[]},layout:{sx:{borderRadius:`20px !important`,bgcolor:a?`white !important`:`black !important`}}}})},Rw=({data:e,setData:t,columnLabels:n,buttons:r})=>(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.Grid,{sx:{overflow:`hidden`},container:!0,spacing:2,children:[(0,d.jsxs)(i.Grid,{size:1,children:[(0,d.jsx)(i.Button,{variant:`contained`,size:`small`,color:`gr-base-dark`,sx:{borderRadius:`20px`,height:`40px`,maxWidth:`40px`,minWidth:`40px`,width:`40px`,p:1,mt:7,mb:2},onClick:()=>t(e.slice(0,-1)),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:`#FFFFFF`,fontSize:`18px`},children:`remove`})}),(0,d.jsx)(i.Button,{variant:`contained`,size:`small`,color:`gr-base-dark`,sx:{borderRadius:`20px`,height:`40px`,maxWidth:`40px`,minWidth:`40px`,width:`40px`,p:1},onClick:()=>t([...e,n.map(()=>({value:``}))]),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:`#FFFFFF`,fontSize:`18px`},children:`add`})})]}),(0,d.jsx)(i.Grid,{size:11,children:(0,d.jsxs)(i.Grid,{container:!0,children:[(0,d.jsx)(i.Grid,{size:8,sx:{bgcolor:e=>e.palette[`gr-base-dark`].main,borderTopLeftRadius:`20px`,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:1},children:r.map((e,t)=>(0,d.jsxs)(i.Button,{sx:{borderRadius:`20px`,textTransform:`none`},variant:`outlined`,size:`small`,color:`gr-base-light`,onClick:e.onClick,children:[e.label,(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{ml:1,mt:-.5,color:`#FFFFFF`,fontSize:`18px`},children:e.icon})]},t))}),(0,d.jsx)(i.Grid,{size:4,sx:{bgcolor:e=>e.palette[`gr-base-dark`].main,borderTopRightRadius:`20px`,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:1}}),(0,d.jsx)(i.Grid,{size:12,sx:{overflowX:`auto`,width:`55vh`,borderBottomLeftRadius:`20px`,borderBottomRightRadius:`20px`},children:(0,d.jsx)(F.default,{data:e,columnLabels:n,onChange:e=>t(e),className:``})})]})})]})}),zw=e=>{let t=(0,l.useRef)(null);return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(D.default,{nodeRef:t,handle:`#draggable-dialog-title`,cancel:`[class*="MuiDialogContent-root"]`,children:(0,d.jsx)(i.Paper,{...e,ref:t,sx:{bgcolor:`white`,color:e=>e.palette.background.paper,padding:`20px`,display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,gap:`50px`,borderRadius:`20px`}})})})},Bw=({title:e,alert:t,action:n,fields:r,open:a,setOpen:o,loading:s,onClickSave:c})=>{let[u,f]=(0,l.useState)(!1),p=(e,t)=>{switch(e.element){case`TextField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.TextField,{fullWidth:!0,variant:`outlined`,label:e.label,type:e.type,placeholder:e.placeholder,focused:!0,value:e.value,multiline:e.multiline,rows:e.rows,onChange:t=>{e.setValue(t.target.value)},disabled:e.disable||n?.actionButton?.loading,size:`small`})},t);case`SelectField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(jw,{label:e.label,placeholder:e.placeholder,value:e.value,setValue:e.setValue,values:e.values,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`DateField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(kw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`CheckboxField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.FormGroup,{children:(0,d.jsx)(i.FormControlLabel,{control:(0,d.jsx)(i.Checkbox,{sx:{ml:1.5,color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}},checked:e.value,onChange:t=>e.setValue(t.target.checked),disabled:!!(e.disable||n?.actionButton?.loading)}),label:e.label})})},t);case`CheckboxGroup`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.FormGroup,{children:e.checkboxs.map((e,t)=>(0,d.jsx)(i.FormControlLabel,{control:(0,d.jsx)(i.Checkbox,{sx:{ml:1.5,color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}},checked:e.value,onChange:t=>e.setValue(t.target.checked)}),label:e.label},t))})},t);case`RadioGroupField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsxs)(i.FormControl,{sx:{mt:e.label.text?`none`:`-7px`},children:[(0,d.jsx)(i.FormLabel,{children:e.label.text}),(0,d.jsx)(i.RadioGroup,{value:e.value,onChange:t=>e.setValue(t.target.value),row:e.row,children:e.radios.map((e,t)=>(0,d.jsx)(i.FormControlLabel,{value:e.value,control:(0,d.jsx)(i.Radio,{sx:{color:e=>e.palette[`gr-base-dark`].main,"&.Mui-checked":{color:e=>e.palette[`gr-base-dark`].main}}}),label:e.label.text,labelPlacement:e.label.position,disabled:e.disable},t))})]})},t);case`AutoCompleteField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Aw,{label:e.label,placeholder:`Seleccionar`,values:e.values,value:e.value,setValue:e.setValue,white:!0})},t);case`ListField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.List,{dense:!0,sx:{borderRadius:`16px`,border:t=>e.border?`1px solid ${t.palette[`gr-grey`].dark}`:`none`},children:e.items.map((t,n)=>(0,d.jsxs)(i.ListItem,{secondaryAction:e.action,children:[t.icon&&(0,d.jsx)(i.ListItemIcon,{children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:t.icon?.color},children:t.icon?.name})}),(0,d.jsx)(i.ListItemText,{primary:t.primaryText,secondary:t.secondaryText})]},n))})},t);case`TreeviewField`:return(0,d.jsxs)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:[(0,d.jsx)(i.Typography,{variant:`body1`,children:e.label}),(0,d.jsx)(Nw,{items:e.items})]},t);case`TimeField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Pw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t);case`TypographyField`:return(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(i.Typography,{variant:`body1`,children:e.text})},t);case`DatePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Fw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!!e.white})},t)});case`DateRangePickerField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Iw,{label:e.label,initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:!!(e.disable||n?.actionButton?.loading),fullWidth:!0,white:!0})},t)});case`DateRangeCalendarField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Lw,{initialValue:e.initialValue,value:e.value,setValue:e.setValue,calendars:e.calendars,disabled:!!(e.disable||n?.actionButton?.loading),white:e.white})},t)});case`SheetField`:return(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(i.Grid,{size:e.ncolumn,sx:{mb:`20px`},children:(0,d.jsx)(Rw,{data:e.data,setData:e.setData,columnLabels:e.columnLabels,buttons:e.buttons})},t)});case`DividerField`:return(0,d.jsx)(i.Grid,{size:12,sx:{mb:`20px`},children:(0,d.jsx)(i.Box,{sx:{width:`100%`,height:`1px`,bgcolor:e=>e.palette[`gr-grey`].dark}})},t);case`CustomField`:return(0,d.jsx)(i.Grid,{size:12,sx:{mb:`20px`},children:e.content},t);default:return(0,d.jsx)(d.Fragment,{})}},m=()=>{r.forEach(e=>{switch(e.element){case`TextField`:e.setValue(e.initialValue);break;case`SelectField`:e.setValue(e.initialValue);break;case`DateField`:e.setValue(e.initialValue);break;case`CheckboxField`:e.setValue(e.initialValue);break;case`CheckboxGroup`:e.checkboxs.forEach(e=>{e.setValue(e.initialValue)});break;case`AutoCompleteField`:e.setValue(e.initialValue);break;case`ListField`:break;case`TreeviewField`:break;case`TimeField`:e.setValue(e.initialValue);break;case`DatePickerField`:e.setValue(e.initialValue);break;case`DateRangePickerField`:e.setValue(e.initialValue);break;case`TypographyField`:break;case`DateRangeCalendarField`:e.setValue(e.initialValue);break;case`RadioGroup`:e.setValue(e.initialValue)}}),f(!1)},h=e=>{e.some(e=>{if(e.element===`CheckboxGroup`)return e.checkboxs.some(e=>e.value!==e.initialValue);if(e.element===`CheckboxField`||e.element===`TextField`||e.element===`SelectField`||e.element===`DateField`)return e.value!==e.initialValue;if(e.element===`AutoCompleteField`)return JSON.stringify(e.value.sort())!==JSON.stringify(e.initialValue.sort());if(e.element===`TimeField`||e.element===`DatePickerField`)return e.value!==e.initialValue;if(e.element===`DateRangePickerField`||e.element===`DateRangeCalendarField`)return JSON.stringify(e.value)!==JSON.stringify(e.initialValue);if(e.element===`RadioGroup`)return e.value!==e.initialValue})?f(!0):o(!1)};return(0,l.useEffect)(()=>{a||m()},[a]),(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(i.Dialog,{open:a,onClose:()=>h(r),PaperComponent:zw,"aria-labelledby":`draggable-dialog-title`,children:[(0,d.jsxs)(i.DialogTitle,{style:{cursor:`move`,textAlign:`left`,margin:0,padding:0,width:`100%`},id:`draggable-dialog-title`,children:[e,(0,d.jsx)(i.IconButton,{sx:{position:`absolute`,right:10,top:10},onClick:()=>h(r),children:(0,d.jsx)(i.Icon,{baseClassName:`material-symbols-rounded`,sx:{color:e=>e.palette[`gr-base-dark`].main,fontSize:`24px`},children:`close`})})]}),u&&t&&(0,d.jsx)(i.DialogContent,{sx:{padding:0,margin:0,width:`100%`,overflow:`hidden`,minHeight:`85px`},children:(0,d.jsxs)(i.Alert,{icon:(0,d.jsx)(O.default,{}),sx:{borderRadius:`24px`,bgcolor:`#FFEFE5`,border:e=>`1px solid ${e.palette[`gr-orange`].main}`,"& .MuiAlert-icon":{color:e=>e.palette[`gr-orange`].main}},action:(0,d.jsxs)(i.Box,{sx:{mt:3.75},children:[(0,d.jsx)(i.Button,{color:`gr-grey`,size:`small`,onClick:()=>f(!1),children:(0,d.jsx)(`b`,{children:t.actionButton.buttonText})}),(0,d.jsx)(i.Button,{color:`gr-grey`,size:`small`,onClick:()=>{m(),o(!1)},children:(0,d.jsx)(`b`,{children:t.cancelButton.buttonText})})]}),children:[(0,d.jsx)(i.AlertTitle,{children:t.title}),(0,d.jsx)(i.Typography,{variant:`body2`,children:t.message})]})}),(0,d.jsxs)(i.DialogContent,{sx:{padding:0,margin:0,position:`relative`,overflow:s?`hidden`:`auto`},children:[(0,d.jsx)(i.Grid,{container:!0,spacing:2,sx:{mt:1,visibility:s?`hidden`:`visible`},children:r.map((e,t)=>p(e,t))}),s&&(0,d.jsx)(i.Box,{sx:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,d.jsx)(i.CircularProgress,{size:60})})]}),(0,d.jsxs)(i.DialogActions,{sx:{display:`flex`,flexDirection:`row`,justifyContent:`flex-end`,alignItems:`center`,width:`100%`},children:[n?.cancelButton&&(0,d.jsx)(i.Button,{variant:`outlined`,autoFocus:!0,onClick:()=>h(r),sx:{minWidth:`130px`,borderRadius:`44px`,fontWeight:`500`,textTransform:`none`},color:`gr-base-dark`,children:n.cancelButton?.buttonText}),n?.actionButton&&(0,d.jsx)(i.Button,{variant:`contained`,onClick:()=>{c()},sx:{minWidth:`130px`,borderRadius:`44px`,color:`white`,fontWeight:`500`,textTransform:`none`},color:`gr-base-dark`,disableElevation:!0,disabled:n.actionButton.disabled,loading:n.actionButton.loading,children:n.actionButton.buttonText})]})]})})},Vw={error:``,warning:``,success:``,suggestion:``,info:``},Hw={error:J.feedbackError,warning:J.feedbackWarning,success:J.feedbackSuccess,suggestion:J.feedbackSuggestion,info:J.feedbackInfo};function Uw({type:e=`info`,title:t,children:n,message:r,onClose:i,closeLabel:a=`Close message`,actions:o,hideIcon:s=!1,className:c}){let l=n??r,u=t??Vw[e]??``,f=!!o?.length;return(0,d.jsxs)(`div`,{className:Z(`rb-message-alert`,`rb-message-alert--${e}`,s&&`rb-message-alert--no-icon`,f&&`rb-message-alert--with-actions`,c),role:e===`error`||e===`warning`?`alert`:`status`,children:[s?null:(0,d.jsx)(`span`,{className:`rb-message-alert__icon`,"aria-hidden":`true`,children:(0,d.jsx)(`img`,{src:Hw[e],alt:``,className:`size-6`,draggable:!1})}),(0,d.jsxs)(`div`,{className:`rb-message-alert__content`,children:[u?(0,d.jsx)(`div`,{className:`rb-message-alert__title h5`,children:u}):null,l?(0,d.jsx)(`div`,{className:`rb-message-alert__text p1`,children:l}):null]}),f?(0,d.jsx)(`div`,{className:`rb-message-alert__actions`,children:o?.map((e,t)=>(0,d.jsx)(L_,{type:`button`,variant:`ghost`,size:`s`,onClick:e.onClick,disabled:e.disabled,children:e.label},t))}):null,i?(0,d.jsx)(`button`,{type:`button`,className:`rb-message-alert__close`,onClick:i,"aria-label":a,children:(0,d.jsx)(`img`,{src:J.close,alt:``,className:`size-4`,draggable:!1})}):null]})}var Ww={s:`max-w-[var(--form-shell-s)]`,m:`max-w-[var(--form-shell-m)]`,l:`max-w-[var(--form-shell-l)]`},Gw=16,Kw=[`button:not([disabled])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function qw(e){return e?Array.from(e.querySelectorAll(Kw)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`):[]}function Jw(e,t,n){return Math.min(Math.max(e,t),n)}function Yw({open:e,title:t,ariaLabel:n,alert:r,children:i,footer:a,onClose:o,loading:s=!1,loadingLabel:c=`Cargando`,closeLabel:u=`Cerrar`,size:f=`m`,draggable:p=!0,closeOnEscape:m=!0,closeOnBackdrop:h=!1,className:g,headerClassName:_,bodyClassName:v,footerClassName:y}){let b=(0,l.useId)(),x=(0,l.useRef)(null),S=(0,l.useRef)(null),[C,w]=(0,l.useState)({x:0,y:0}),[T,E]=(0,l.useState)(!1),D=(0,l.useRef)({mouseX:0,mouseY:0,startX:0,startY:0});if((0,l.useEffect)(()=>{e||(w({x:0,y:0}),E(!1))},[e]),(0,l.useEffect)(()=>{if(!e||typeof document>`u`)return;S.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=window.requestAnimationFrame(()=>{(qw(x.current)[0]??x.current)?.focus()});return()=>{window.cancelAnimationFrame(t),S.current?.focus()}},[e]),(0,l.useEffect)(()=>{if(!e)return;let t=e=>{if(e.key===`Escape`&&m){e.preventDefault(),o?.();return}if(e.key!==`Tab`||!x.current)return;let t=qw(x.current);if(t.length===0){e.preventDefault(),x.current.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;if(e.shiftKey&&i===n){e.preventDefault(),r.focus();return}!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t)}},[e,o,m]),!e)return null;let O=e=>{!p||e.button!==0||e.target instanceof HTMLElement&&e.target.closest(`[data-form-shell-close]`)||(E(!0),D.current={mouseX:e.clientX,mouseY:e.clientY,startX:C.x,startY:C.y},e.currentTarget.setPointerCapture?.(e.pointerId))},k=e=>{if(!p||!T)return;let t=e.clientX-D.current.mouseX,n=e.clientY-D.current.mouseY,r=D.current.startX+t,i=D.current.startY+n,a=x.current;if(!a){w({x:r,y:i});return}let o=Gw,s=Math.max(0,(window.innerWidth-a.offsetWidth)/2-o),c=Math.max(0,(window.innerHeight-a.offsetHeight)/2-o);w({x:Jw(r,-s,s),y:Jw(i,-c,c)})},A=e=>{p&&(E(!1),e.currentTarget.releasePointerCapture?.(e.pointerId))};return(0,d.jsx)(OC,{children:(0,d.jsx)(`div`,{className:`rb-modal-layer fixed inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.24)] p-4`,role:`presentation`,onPointerDown:e=>{!h||e.target!==e.currentTarget||o?.()},children:(0,d.jsx)(`section`,{ref:x,role:`dialog`,tabIndex:-1,"aria-modal":`true`,"aria-labelledby":t?b:void 0,"aria-label":t?void 0:n??`Formulario`,"aria-busy":s||void 0,className:Z(`relative flex h-fit w-full min-w-0`,`flex-col overflow-hidden`,`font-sans`,`max-h-[calc(100dvh-2rem)]`,`rounded-[var(--r-m)]`,`border border-[var(--border)]`,`bg-[var(--surface-elevated)]`,`text-[var(--text)]`,`shadow-none`,`p-4 min-[36rem]:p-5`,Ww[f],g),style:{transform:`translate(${C.x}px, ${C.y}px)`},children:(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--surface-elevated)]`,children:[(0,d.jsx)(`header`,{className:Z(`flex shrink-0`,`touch-none select-none`,`items-start gap-3 pr-10`,`bg-[var(--surface-elevated)]`,p?T?`cursor-grabbing`:`cursor-move`:`cursor-default`,_),onPointerDown:O,onPointerMove:k,onPointerUp:A,onPointerCancel:A,children:(0,d.jsx)(`div`,{className:`min-w-0 flex-1`,children:t?(0,d.jsx)(`h2`,{id:b,className:`h4 truncate`,children:t}):null})}),o?(0,d.jsx)(`button`,{type:`button`,"data-form-shell-close":!0,onClick:o,"aria-label":u,className:Z(`motion-fast`,`absolute right-4 top-4`,`z-20 flex size-8`,`items-center justify-center`,`rounded-full`,`min-[36rem]:right-5`,`min-[36rem]:top-5`,`bg-transparent`,`text-[var(--text)]`,`hover:bg-[var(--interaction-hover)]`,`focus-visible:outline-none`,`focus-visible:shadow-[var(--focus-ring-shadow)]`),children:(0,d.jsx)(`img`,{src:J.close,alt:``,className:`size-4`,draggable:!1})}):null,r?(0,d.jsx)(`div`,{className:`p1 mt-5 shrink-0 bg-[var(--surface-elevated)]`,children:r}):null,(0,d.jsxs)(`div`,{className:Z(`relative flex min-h-0 flex-1`,`flex-col overflow-hidden`,`bg-[var(--surface-elevated)]`,r?`mt-8`:`mt-12`),children:[(0,d.jsx)(`div`,{className:Z(`min-h-0 flex-1`,`overflow-x-hidden`,`overflow-y-auto`,`bg-[var(--surface-elevated)] pr-1`,s&&`overflow-hidden`,v),children:(0,d.jsx)(`div`,{className:Z(`p1 min-w-0 pt-3`,s&&`invisible`),children:i})}),s?(0,d.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`
|
|
281
281
|
absolute inset-0
|
|
282
282
|
flex items-center justify-center
|
|
283
283
|
bg-[var(--loading-overlay)]
|