biblio-react 2.0.0-alpha129 → 2.0.0-alpha130

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.
@@ -1,2 +1,2 @@
1
- import{forwardRef as e,createElement as o,createContext as t,useContext as n,useState as r,useMemo as i,useCallback as a,Fragment as l,useEffect as s,Children as c,cloneElement as d,isValidElement as u,useRef as m,memo as p}from"react";import g from"@mui/icons-material/Lock";import f from"@mui/icons-material/VpnLock";import{MenuItem as h,ListItemIcon as b,ListItemText as v,useMediaQuery as y,Typography as C,Box as x,alpha as w,createTheme as k,StyledEngineProvider as T,Stack as O,Dialog as S,DialogTitle as R,DialogContent as P,DialogActions as N,Tooltip as j,IconButton as F,ThemeProvider as _,Paper as M,CardContent as L,CircularProgress as E,Collapse as I,List as D,Divider as A}from"@mui/material";import{useTranslate as B,useUserMenu as V,useResourceDefinitions as q,AppBar as z,UserMenu as $,Logout as W,useDataProvider as H,useListContext as G,useNotify as U,useRedirect as J,useRefresh as Y,useResourceContext as Q,useUnselectAll as Z,NumberField as K,DateField as X,TextField as ee,ReferenceField as oe,Button as te,useRecordContext as ne,useInput as re,useGetList as ie,useSafeSetState as ae,Confirm as le,Form as se,SaveButton as ce,useCreatePath as de,useResourceDefinition as ue,DatagridRoot as me,DatagridClasses as pe,BulkActionsToolbar as ge,SimpleList as fe,useGetOne as he,TopToolbar as be,ListButton as ve,ShowButton as ye,required as Ce,minValue as xe,useSaveContext as we,Create as ke,useDelete as Te,useEditController as Oe,Edit as Se,SimpleForm as Re,useSidebarState as Pe,MenuItemLink as Ne,Menu as je,DashboardMenuItem as Fe,Layout as _e,FilterContext as Me,sanitizeListRestProps as Le,FilterButton as Ee,CreateButton as Ie,ExportButton as De,useLogin as Ae,TextInput as Be,PasswordInput as Ve,FieldTitle as qe,useShowController as ze,Show as $e,FormTab as We,getTabbedFormTabFullPath as He,TabbedFormTabs as Ge,Toolbar as Ue,defaultTheme as Je,BooleanField as Ye,ImageInput as Qe,ImageField as Ze,FileInput as Ke,FileField as Xe,BooleanInput as eo,ReferenceInput as oo,useChoicesContext as to,AutocompleteInput as no,SelectInput as ro,ReferenceArrayInput as io,SelectArrayInput as ao,RadioButtonGroupInput as lo,useRecordSelection as so,List as co,Datagrid as uo,NumberInput as mo,DateInput as po,DateTimeInput as go}from"react-admin";import{Link as fo,useLocation as ho,matchPath as bo,useResolvedPath as vo,Routes as yo,Route as Co}from"react-router-dom";import{styled as xo,ThemeProvider as wo,alpha as ko}from"@mui/material/styles";import To,{string as Oo,func as So,any as Ro,bool as Po}from"prop-types";import No from"@mui/icons-material/Add";import jo from"@mui/icons-material/Cancel";import Fo from"@mui/icons-material/Delete";import _o from"@mui/icons-material/Edit";import Mo from"@mui/material/Dialog";import Lo from"@mui/material/DialogActions";import Eo from"@mui/material/DialogContent";import Io from"@mui/material/DialogContentText";import Do from"@mui/material/DialogTitle";import Ao from"@mui/material/Paper";import{esES as Bo,DataGridPremium as Vo,useGridApiContext as qo,useGridApiRef as zo,useKeepGroupedColumnsHidden as $o}from"@mui/x-data-grid-premium";import{useFormContext as Wo,useFormState as Ho}from"react-hook-form";import{useDispatch as Go,useSelector as Uo}from"react-redux";import{useMutation as Jo}from"react-query";import Yo from"@mui/icons-material/Settings";import{GridActionsCellItem as Qo}from"@mui/x-data-grid";import Zo from"@mui/icons-material/Create";import Ko from"@mui/material/Divider";import Xo from"@mui/material/Tab";import et from"@mui/material/Tabs";import ot from"@mui/icons-material/ChevronLeft";import tt from"@mui/material/Typography";import{isAfter as nt}from"date-fns";import rt from"date-fns/locale/en-US";import it from"date-fns/locale/es";import at from"@mui/material/IconButton";import lt from"@mui/material/Tooltip";import st from"@mui/material/Box";import ct from"@mui/icons-material/ExpandMore";import dt from"@mui/material/Avatar";import ut from"@mui/material/Button";import mt from"@mui/material/Card";import pt from"@mui/material/CardActions";import gt from"@mui/material/CircularProgress";import ft from"@mui/material/Menu";import ht from"@mui/material/MenuItem";import bt from"@mui/icons-material/RemoveRedEye";import vt from"ra-language-english";import yt from"@blackbox-vision/ra-language-spanish";import Ct from"@mui/icons-material/Check";import xt from"@mui/icons-material/RemoveCircleOutline";import wt from"@mui/icons-material/Search";import kt from"@mui/icons-material/CheckCircle";import Tt from"@mui/icons-material/ErrorOutline";import Ot from"react-draggable";import{TreeView as St}from"devextreme-react";const Rt=e((e,t)=>{const n=B(),{onClose:r}=V(),i=q(),a=i.form_59;return[i.form_275?o(h,Object.assign({component:fo,ref:t},e,{key:"/form_275",to:"/form_275",onClick:r}),o(b,null,o(g,null)),o(v,null,n("pos.change_pin"))):null,a?o(h,Object.assign({component:fo,ref:t},e,{key:"/form_59",to:"/form_59",onClick:r}),o(b,null,o(f,null)),o(v,null,n("pos.change_password"))):null]}),Pt=()=>o($,null,o(Rt,null),o(W,null)),Nt=e=>{const t=y(e=>e.breakpoints.up("sm"));return o(z,Object.assign({},e,{color:"secondary",userMenu:o(Pt,null)}),o(C,{variant:"h6",color:"inherit",sx:{flex:1,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},id:"react-admin-title"}),t&&o(x,{component:"span",sx:{flex:1}}))},jt=t(),Ft=({children:e})=>{const[t,n]=r(!1),a=i(()=>({open:t,show:()=>n(!0),hide:()=>n(!1)}),[t]);return o(jt.Provider,{value:a},e)},_t=()=>n(jt),Mt=t(),Lt=({children:e})=>{const[t,n]=r(!1),[a,l]=r({}),s=i(()=>({open:t,props:a,show:e=>{l(e),n(!0)},hide:()=>n(!1)}),[t,a]);return o(Mt.Provider,{value:s},e)},Et=()=>n(Mt),It=(e,o,t,n)=>({type:"RELOAD_CB",payload:{id:e,method:o,params:t,callback:n}}),Dt=(e,o)=>({type:"RELOAD_CB_SUCCESS",payload:{id:e,callback:o}}),At=(e,o)=>({type:"HIDE_INPUT",payload:{id:e,hidden:o}}),Bt=(e,o)=>({type:"DISABLE_INPUT",payload:{id:e,disabled:o}}),Vt=(e,o)=>({type:"REQUIRE_INPUT",payload:{id:e,required:o}}),qt=(e,o)=>({type:"ERROR_INPUT",payload:{id:e,error:o}}),zt=()=>{const e=Go();return a((o,t,n,r)=>{e(It(o,t,n,r))},[e])},$t=()=>{const e=Go();return a((o,t)=>{e(At(o,t))},[e])},Wt=()=>{const e=Go();return a((o,t)=>{e(Bt(o,t))},[e])},Ht=()=>{const e=Go();return a((o,t)=>{e(Vt(o,t))},[e])},Gt=()=>{const e=Go();return a((o,t)=>{e(qt(o,t))},[e])},Ut=(e,o)=>{const t=H(),{mutateAsync:n,isLoading:r}=Jo(o=>{const{method:n,params:r}=o;return t.getJson(e,{method:n,params:r})},o);return{mutateAsync:n,isLoading:r}},Jt=e=>{const{mutateAsync:o,isLoading:t}=Ut(e);return[a((e,t,n)=>o({method:e,params:t},{onSuccess:n,onError:n}),[]),t]},Yt=e=>({}),Qt=e=>{const o=G(e),t=U(),n=J(),r=Y(),i=Q(e),a=Z(i),l=Et(),s=B(),[c]=Jt(i);return{ajax:c,data:o,notify:t,redirect:n,refresh:r,refetch:o.refetch,unselectAll:a,asistente:l,translate:s}},Zt=e=>{const o=zt(),t=$t(),n=Wt(),r=Ht(),i=Gt(),a=_t(),l=U(),s=J(),c=Q(e),[d]=Jt(c);return{ajax:d,notify:l,redirect:s,recargarComboBox:o,progress:a,setHidden:t,setDisable:n,setRequire:r,setError:i,etrs:e.etrs||{}}},Kt=e=>{const o=zt(),t=$t(),n=Wt(),r=Ht(),i=Gt(),l=_t(),s=U(),c=J(),d=Wo(),u=Q(e),[m]=Jt(u),p=e.etrs||{},g=e.asisEtr||{},{trigger:f}=d;return{form:d,ajax:m,notify:s,redirect:c,recargarComboBox:o,progress:l,setHidden:a((e,o)=>{t(e,o),setTimeout(()=>{f(e)})},[t,f]),setDisable:a((e,o)=>{n(e,o),setTimeout(()=>{f(e)})},[n,f]),setRequire:a((e,o)=>{r(e,o),setTimeout(()=>{f(e)})},[r,f]),setError:a((e,o)=>{i(e,o),setTimeout(()=>{f(e)})},[i,f]),etrs:p,asisEtr:g}},Xt=t({}),en=t(void 0),on=e=>{const{estado:o,isLoading:t,fichaProps:r={}}=n(Xt),{[e.source]:i={}}=r,{hidden:a=!1,...l}=e,{hidden:s,useContenido:c=Yt,...d}=i,u=void 0!==s?s:a,m=c({...l,estado:o,hidden:u,isLoading:t,...d}),{hidden:p,...g}=m;if(void 0===m)throw new Error(`useContenido está devolviendo undefined para el contenido ${e.source}\n Asegúrese de incluir una instrucción return al final de la función`);return{propsContenido:{...l,...d,...g},hidden:void 0!==p?p:u}},tn=e=>{const{tipo:t,...n}=e,{propsContenido:r,hidden:i}=on(n),a={...r};return!i&&("N"===t||"D"===t?o(K,a):"F"===t?o(X,a):"Z"===t?o(X,Object.assign({},a,{showTime:!0})):o(ee,a))},nn=(e,t,n)=>r=>o(oe,{reference:n,source:t,queryOptions:{meta:{etr:e}},record:{[t]:r.row[t]}},o(tn,{source:"etiqueta"})),rn=e=>{const o={...e};return delete o.id,o},an=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r)=>{const i=rn(e),a=o.current.getRowsCount()+1;o.current.updateRows([{...i,id:a}]);const l=n?Array.from(o.current.getRowModels().values(),e=>({...e,claveFila:"",estado:"N"}))||[]:r.getValues()[t]||[];n||l.push({...i,claveFila:"",estado:"N"}),r.setValue(t,l,{shouldDirty:!0})},[o,t])},ln=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r,i)=>{var a,l;const s="number"==typeof e?"N":"M",c=rn(r);o.current.updateRows([{...c,id:e}]);const d=n?Array.from(o.current.getRowModels().values(),e=>({...e,estado:s}))||[]:i.getValues()[t]||[];let u=d.findIndex(o=>o.id===e);u=-1===u?d.length:u,d[u]={...c,claveFila:"N"===(null===(a=d[u])||void 0===a?void 0:a.estado)?"":e,estado:"N"===(null===(l=d[u])||void 0===l?void 0:l.estado)?"N":"M"},i.setValue(t,d,{shouldDirty:!0})},[o,t])},sn=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r)=>{const i=o.current.getRowModels().get(e);o.current.updateRows([{id:e,_action:"delete"}]);const a=n?Array.from(o.current.getRowModels().values(),e=>({...e,estado:"B"}))||[]:r.getValues()[t]||[];let l=a.findIndex(o=>o.claveFila===e);l=-1===l?a.length:l,a[l]={...i,estado:"B",claveFila:e},"number"==typeof e&&a.splice(l,1),r.setValue(t,a,{shouldDirty:!0})},[o,t])},cn=e=>{const{[e.source]:o}=e.useFormulario(),t={...e,enviarTodo:!(null==o||!o.enviarTodo)};return{addRow:an(t),editRow:ln(t),deleteRow:sn(t),clear:o=>{e.apiRef.current.setRows([]),o.setValue(e.source,"")},api:e.apiRef}},dn=xo("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%","& .ant-empty-img-1":{fill:"light"===e.palette.mode?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===e.palette.mode?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===e.palette.mode?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===e.palette.mode?"#fff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===e.palette.mode?"0.8":"0.08",fill:"light"===e.palette.mode?"#f5f5f5":"#fff"}})),un=()=>o(dn,null,o("svg",{width:"120",height:"100",viewBox:"0 0 184 152","aria-hidden":!0,focusable:"false"},o("g",{fill:"none",fillRule:"evenodd"},o("g",{transform:"translate(24 31.67)"},o("ellipse",{className:"ant-empty-img-5",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),o("path",{className:"ant-empty-img-1",d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"}),o("path",{className:"ant-empty-img-2",d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"}),o("path",{className:"ant-empty-img-3",d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"})),o("path",{className:"ant-empty-img-3",d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"}),o("g",{className:"ant-empty-img-4",transform:"translate(149.65 15.383)"},o("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),o("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"})))),o(x,{sx:{mt:1}},"No hay registros")),mn=xo(te,{name:"EtrDeleteButton",overridesResolver:(e,o)=>o.root})(({theme:e})=>({color:e.palette.primary.main,"&:hover":{backgroundColor:w(e.palette.primary.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}})),pn={},gn=e=>{const t=Wo();return o(en.Provider,{value:{form:t}},e.children)},fn=e=>o(Mo,{open:e.open,onClose:e.onClose,fullWidth:!0},o(Do,null,`${e.labelEstado} ${e.label}`),o(Io,{component:"span"},o(se,{mode:"onBlur",record:pn,resource:e.resource,onSubmit:e.onSubmit},o(gn,null,e.children))));fn.propTypes={label:Oo,onClick:So,icon:Ro,open:Po,onClose:So,labelEstado:Oo,resource:Ro,save:So,render:So};const hn=e=>{const{form:t,resource:r,estado:i,editors:a,recordPadre:u,camposClaveFila:m,setOpen:p,open:g}=e,{dirtyFields:f,isValid:h}=Ho(),{fichaProps:{[e.source]:b={},etrs:v}}=n(Xt),y=n(en),{onAfterRenderAsistente:C}=b,x=Kt({resource:r,etrs:v,asisEtr:y});return s(()=>{g&&"function"==typeof C&&C({...x,form:t})},[g]),o(l,null,o(Eo,null,o(O,{spacing:4},c.map(a,(e,o)=>d(e,{resource:r,estado:i,defaultValue:u[e.props.source]||"",fullWidth:!0,sx:{margin:0},disabled:"N"!==i&&-1!==m.indexOf(e.props.source),...b[e.props.source]})))),o(Lo,null,o(ce,{disabled:0===Object.keys(f).length||!h}),o(te,{label:"ra.action.cancel",onClick:e=>{p(!1),e.stopPropagation()}},o(jo,null))))},bn=e=>{const{editors:t,record:n,camposClaveFila:r,label:i,source:a,enviarTodo:s}=e,[c,d]=ae(!1),u=Q(e),m=Wo(),p=qo(),g=an({apiRef:p,source:a,enviarTodo:s}),f=B()("ra.action.create");return o(l,null,o(te,{onClick:e=>{d(!0),e.stopPropagation()}},o(No,null)),o(fn,{open:c,onClose:e=>{d(!1),e.stopPropagation()},labelEstado:f,label:i,resource:u,onSubmit:(e,o)=>{g(e,m),d(!1)}},o(hn,{source:a,form:m,resource:u,estado:"N",editors:t,recordPadre:n||{},camposClaveFila:r,open:c,setOpen:()=>{d(!1)}})))},vn=e=>{const{editors:t,camposClaveFila:n,resource:r,label:i,source:a,row:s,enviarTodo:c}=e,d=B(),[u,m]=ae(!1),p=qo(),g=Wo(),f=ln({apiRef:p,source:a,enviarTodo:c}),h=d("ra.action.edit");return o(l,null,o(te,{onClick:e=>{m(!0),e.stopPropagation()}},o(_o,null)),o(fn,{open:u,onClose:e=>{m(!1),e.stopPropagation()},labelEstado:h,label:i,resource:r,onSubmit:(e,o)=>{f(s.id,e,g),m(!1)}},o(hn,{source:a,form:g,resource:r,estado:"M",editors:t,recordPadre:s,camposClaveFila:n,open:u,setOpen:()=>{m(!1)}})))},yn=e=>{const{confirmTitle:t="ra.message.delete_title",confirmContent:n="ra.message.delete_content",row:r,source:i,enviarTodo:a}=e,[s,c]=ae(!1),d=qo(),u=Wo(),m=sn({apiRef:d,source:i,enviarTodo:a});return o(l,null,o(mn,{key:"button",onClick:e=>{c(!0),e.stopPropagation()}},o(Fo,null)),o(le,{isOpen:s,title:t,content:n,onConfirm:e=>{m(r.id,u)},onClose:e=>{c(!1),e.stopPropagation()}}))},Cn=k({},Bo),xn=e=>{const{filterBy:t="",claves:a,sortModel:s,columns:c,reference:d,allowAdd:u=!0,allowRemove:m=!0,enableLoad:p=!0,apiRef:g,...f}=e,[h,b]=r([]),v=ne(e),{field:y}=re({defaultValue:"",...e}),{isLoading:C,fichaProps:{[f.source]:x}}=n(Xt),{enviarTodo:w=!1}=x||{},[k,O]=r(s),[{field:S,sort:R}]=s;let P={};v&&t.split(",").forEach(e=>{e&&(P[e]=[{type:"string",comparison:"eq",value:v[e],field:e}])});const{isLoading:N}=ie(d,{pagination:{page:1,perPage:200},sort:{field:S,order:R},filter:P},{enabled:p&&!C,onSuccess:e=>{b((null==e?void 0:e.data)||[])}}),j=[...c,{field:" ",width:80,headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(vn,Object.assign({},f,{enviarTodo:w,camposClaveFila:a,row:e.row}))}];u&&j.unshift({field:"BTN",headerName:"",sortable:!1,renderHeader:e=>o(bn,Object.assign({},f,{enviarTodo:w,camposClaveFila:a}))}),m&&j.push({field:" ",headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(yn,Object.assign({},f,{enviarTodo:w,camposClaveFila:a,row:e.row}))});const F=i(()=>j,[JSON.stringify(j)]);return o(Ao,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(T,{injectFirst:!0},o(wo,{theme:Cn},o(l,null,o(Vo,Object.assign({apiRef:g,loading:N||C,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,rows:h,columns:F,sortModel:k,onSortModelChange:e=>O(e),sortable:!1,resizable:!1,disableReorder:!0,disableExport:!0,filterable:!1,disableColumnMenu:!0,slots:{noRowsOverlay:un}},f)),o("input",Object.assign({type:"hidden"},y))))))},wn=k({},Bo),kn=e=>{const{filterBy:t="",sortModel:a,columns:l,reference:s,enableLoad:c=!0,initialState:d,...u}=e,{isLoading:m}=n(Xt),p=ne(),[g,f]=r(a),[{field:h,sort:b}]=a,v=i(()=>[...l],[JSON.stringify(l)]);let y={};p&&t.split(",").forEach(e=>{e&&(y[e]=[{type:"string",comparison:"eq",value:p[e],field:e}])});const{estado:C,isLoading:x,fichaProps:w={}}=n(Xt),k=Kt(e),{[e.source]:O={}}=w,{useContenido:S=Yt,restInitialProps:R}=O,{data:P=[],isLoading:N,refetch:j}=ie(s,{pagination:{page:1,perPage:200},sort:{field:h,order:b},filter:y},{enabled:c&&!m}),F=zo(),_=$o({apiRef:F,initialState:d});return S({...u,estado:C,hidden:e.hidden,isLoading:x,utils:k,...R,refetch:j,apiRef:F}),o(Ao,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(T,{injectFirst:!0},o(wo,{theme:wn},o(Vo,Object.assign({apiRef:F,rows:P,columns:v,loading:N||m,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,sortModel:g,onSortModelChange:e=>f(e),slots:{noRowsOverlay:un},initialState:_},u)))))},Tn=e=>{const{isLoading:t}=e,n=Q(e),r=Et(),{open:i,hide:a,props:{title:s,controles:c,aceptar:d,tipo:u="form"}}=r;return o(S,{open:i,onClose:()=>a(),fullWidth:!0,maxWidth:"vista"===u?"lg":"sm"},o(R,{id:"draggable-dialog-title"},s),"form"===u?o(se,{resource:n,onSubmit:d},o(P,{dividers:!0},o(O,{spacing:2},c)),o(N,null,o(te,{label:"ra.action.cancel",disabled:t,onClick:()=>a()},o(jo,null)),o(ce,{disabled:t}))):o(l,null,o(P,{dividers:!0},o(O,{spacing:2},c)),o(N,null,o(te,{label:"ra.action.cancel",disabled:t,onClick:()=>a()},o(jo,null)))))},On=e=>{const{alignIcon:t="left",children:n,className:r,disabled:i,label:a,color:l="primary",size:s="small",to:c,...d}=e,u=B(),m=a?u(a,{_:a}):void 0,p=Sn(c);return a&&!i?o(j,{title:m},o(F,Object.assign({"aria-label":m,className:r,color:l,size:"large"},d,p),n)):o(F,Object.assign({className:r,color:l,disabled:i,size:"large"},d,p),n)};On.propTypes={alignIcon:To.oneOf(["left","right"]),children:To.element,className:To.string,color:To.oneOfType([To.oneOf(["inherit","default","primary","secondary","error","info","success","warning"]),To.string]),disabled:To.bool,label:To.string,size:To.oneOf(["small","medium","large"])};const Sn=e=>{if(null==e)return;if("string"==typeof e)return{to:e};const{redirect:o,replace:t,state:n,...r}=e;return{to:r,redirect:o,replace:t,state:n}},Rn=e=>e.stopPropagation(),Pn={true:{_scrollToTop:!0},false:{}},Nn=o(No,null),jn=e=>{const{icon:t=Nn,label:n="ra.action.create",scrollToTop:r=!0,...i}=e,a=Q(e),l=ne(e),s=de();return o(On,Object.assign({component:fo,to:s({type:"create",resource:a}),state:{record:l,...Pn[String(r)]},label:n,onClick:Rn},i),t)},Fn=e=>e.stopPropagation(),_n={true:{_scrollToTop:!0},false:{}},Mn=o(Zo,null),Ln=e=>{const{icon:t=Mn,label:n="ra.action.edit",scrollToTop:r=!0,...i}=e,a=Q(e),l=ne(e),s=de();return l?o(On,Object.assign({component:fo,to:s({type:"edit",resource:a,id:l.id}),state:_n[String(r)],label:n,onClick:Fn},i),t):null},En=(e,o)=>void 0===o||"function"==typeof o&&o(e),In=k({},Bo),Dn=new Map([["is","is"],["not","not"],["after","after"],["onOrAfter","onOrAfter"],["before","before"],["onOrBefore","onOrBefore"],["eq","="],["neq","!="],["gt",">"],["gte",">="],["lt","<"],["lte","<="],["contains","contains"],["equals","equals"],["sw","startsWith"],["ew","endsWith"],["isEmpty","isEmpty"],["isNotEmpty","isNotEmpty"],["isAnyOf","isAnyOf"]]),An=new Map(Array.from(Dn,e=>[e[1],e[0]])),Bn=e=>e.items.reduce((e,o)=>(void 0!==o.field&&o.operator&&(An.has(o.operator)?e[`${o.field}_${An.get(o.operator)}`]=o.value:e[o.field]=o.value),e),{}),Vn=e=>{const{actionButtons:t=[],bulkActionButtons:n,sx:r,columns:i,isRowEditable:a,desktopSize:s=!1,hasEdit:c,initialState:d,convertFilterModelToFilterValues:m=Bn,claveNuevo:p,mobileColumns:g="",...f}=e,h=Qt(e),b=B(),v=Q(e),{data:y=[],isLoading:C,selectedIds:w,onSelect:k,displayedFilters:T,setFilters:O}=G(),S=zo(),R=$o({apiRef:S,initialState:{...d,pinnedColumns:{right:["actions"]}}}),P=i.map((e,o)=>({...e,headerName:""!==e.headerName?b(`resources.${v}.fields.${e.field}`,{_:e.headerName}):e.headerName})),N=t.length>0||c?P.concat([{field:"actions",type:"actions",width:100,hideable:!1,getActions:e=>{const n=S.current.getRowNode(e.id);return e.row.id?[...c?[o(Ln,{record:e.row,disabled:!En(e.row,a)})]:[],...t.filter(e=>!!e).map(t=>{const{handler:n,...r}=t;return o(Qo,Object.assign({showInMenu:!0,onClick:o=>"function"==typeof n&&n({...h,record:e.row},r.key)},r))})]:-1!==n.children[0].indexOf(p+"=")?[o(jn,{record:p?{[p]:n.children[0].split(p+"=")[1].replaceAll("[","").trim().split("AND")[0].trim()}:void 0})]:[]}}]):P,j=u(n);return o(l,null,o(Tn,{isLoading:C}),o(me,{sx:r,className:pe.root},j?o(ge,{selectedIds:w},n):null,o(x,{sx:{height:"70vh",width:"100%"},className:pe.tableWrapper},o(_,{theme:In},o(Vo,Object.assign({sx:{display:"grid",gridTemplateRows:"70vh 1fr auto"},slots:{noRowsOverlay:un},columns:N,rows:y,apiRef:S,loading:C,hideFooterSelectedRowCount:!0,hideFooter:!0,disableMultipleRowSelection:!0,checkboxSelection:j,filterMode:"server",onFilterModelChange:e=>{O(m(e),T)},rowSelectionModel:w,onRowSelectionModelChange:e=>{C||(S.current.isRowSelected(e[0])?k([]):k(e))},isRowSelectable:e=>e.row.id,initialState:R},f))))))},qn=e=>{const{sx:t,columns:n,actionButtons:r=[],hasEdit:i,isRowEditable:a,primaryText:s,mobileColumns:c=""}=e;let d=s;const u=Qt(e),{isLoading:m}=G();if(!s){const e=c?c.split(",").map(e=>n.find(o=>o.field===e)):n;d=t=>o(M,{variant:"outlined",sx:{pt:2,pb:2,pl:2}},e.map(e=>{const{field:n,headerName:r,valueGetter:i,type:a="string",jsxMobile:l}=e;return o(x,null,l?l(t,e):"boolean"===a?o(x,{component:"span",sx:{color:i({value:t[n]})?"green":"red"}},r):t[n])}),o(x,null,r.filter(e=>!!e).map(e=>{const{key:n,handler:r,icon:i=o(Yo,null),...a}=e;return o(te,Object.assign({onClick:e=>"function"==typeof r&&r({...u,record:t},n)},a),i)})))}return o(l,null,o(Tn,{isLoading:m}),o(fe,{linkType:e=>!(!i||!En(e,a))&&"edit",primaryText:d,sx:t}))},zn=e=>{const t=y(e=>e.breakpoints.down("md")),{hasEdit:n}=ue(e);(e=>{const{onRenderGrilla:o,onLoadGrilla:t}=e,{isLoading:n}=G(),r=Qt(e);s(()=>{o&&o(r)},[]),s(()=>{n||t&&t(r)},[n])})(e);const{desktopSize:r=!1}=e;return o(Lt,null,o(t&&!1===r?qn:Vn,Object.assign({},e,{hasEdit:n})))},$n=e=>{const{filterValues:t,setFilters:n,tabs:{ids:r,...i},GridComponent:a=zn,...s}=e,c=t.id;return o(l,null,o(et,{value:c,indicatorColor:"primary",onChange:(e,o)=>{n({...t,id:o})}},r.map(e=>o(Xo,{key:e,label:e.charAt(0).toUpperCase()+e.slice(1),value:e}))),o(Ko,null),o(a,Object.assign({},s,i[c])))},Wn=e=>{const{useFormulario:o=Yt,...t}=e;return{fichaProps:{...o(t),etrs:t.etrs}}},Hn=(e,o)=>he(e,{id:"-1"},o),Gn=e=>e.split("_")[1],Un=/^\d{2}\/\d{2}\/\d{4}$/,Jn=e=>{if(!(e instanceof Date)||isNaN(e.getDate()))return"";const o=e.getFullYear().toString(),t=(e.getMonth()+1).toString(),n=e.getDate().toString();return`${o}-${("00"+t).slice(-2)}-${("00"+n).slice(-2)}`},Yn=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Jn(e);if(Un.test(e)){const o=e.split("/");return o[2]+"-"+o[1]+"-"+o[0]}return Jn(new Date(e))},Qn=e=>{if(!e)return"";const o=e.split("-");return o[2]+"/"+o[1]+"/"+o[0]},Zn=/^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/,Kn=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Jn(e);if(Zn.test(e)){const o=e.split(" "),t=o[0].split("/");return t[2]+"-"+t[1]+"-"+t[0]+" "+o[1]}return Jn(new Date(e))},Xn=e=>{if(!e)return"";const o=e.split("T"),t=o[0].split("-");return t[2]+"/"+t[1]+"/"+t[0]+" "+o[1]},er=e=>{if(!e)return"";if(e instanceof Date)return e.toString();if(-1!==e.indexOf(":")){const o=e.split(":");let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}{const o=/(\d{2}):(\d{2})/.exec(e);if(null===o)return;let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}},or=(e,o)=>e?e.split(" ")[4].substring(0,5):"",tr=e=>{const{source:t}=e,n=Uo(e=>{const o=e.configInputs?e.configInputs.filter(e=>e.id===t):[];return o[0]?o[0]:null}),{hidden:r}=n||{};return!r&&o(tt,{variant:"h6",gutterBottom:!0,id:e.source},e.children)},nr=({children:e,className:t,data:n,hasShow:r,hasList:i=!0,...a})=>o(be,Object.assign({className:t},(({...e})=>e)(a)),e,i&&o(ve,{label:"ra.action.back",icon:o(ot,null)}),r&&o(ye,{record:n})),rr=Ce(),ir=[rr,xe(1)],ar={inputFormat:"dd/MM/yyyy"},lr=e=>(o,t)=>{const n=t[e];if(o&&n){const e=new Date(n.split("/").reverse().join("/")),t=new Date(o.split("/").reverse().join("/"));if(nt(e,t))return{message:"validation.greater_or_equal",args:{menor:n}}}},sr=(e="es")=>({locale:"en"===e?rt:it}),cr=[{id:"1",name:"Aprobado"},{id:"2",name:"Rechazado"},{id:"3",name:"Pendiente"}],dr=(e,o)=>{const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.setAttribute("href",e),t.setAttribute("download",o),t.click()},ur=e=>{if(!e)return"";const[o,t,n]=e.split("/").map(Number);return new Date(n,t-1,o)},mr=e=>{if(!e)return"";const[o,t]=e.split(" "),[n,r,i]=o.split("/").map(Number),[a,l]=t.split(":").map(Number);return new Date(i,r-1,n,a,l)},pr=e=>e?`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getFullYear())}`:"",gr=e=>e.toLocaleString("es",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).replace(",",""),fr=(e,o)=>{const t=Q(),{data:n,isLoading:r,error:i}=he("cb_"+Gn(t)+"_"+e,{id:o});return r||i?"":(null==n?void 0:n.etiqueta)||""},hr={form:"FormEtriek-form",tab:"FormEtriek-tab",contenido:"FormEtriek-contenido"},br=e=>({["& ."+hr.form]:{maxHeight:"70vh",overflow:"auto"},["& ."+hr.tab]:{display:"block",maxHeight:"65vh",overflow:"auto"},["& ."+hr.contenido]:{[e.breakpoints.up("xs")]:{width:"100%"},[e.breakpoints.up("md")]:{width:"12vw","&.MuiAutocomplete-root":{width:"16vw"}}}}),vr=()=>{},yr=e=>{const{fichaProps:{onBeforeSubmitFicha:o}}=n(Xt),t=Zt(e),r=U(),{save:i}=we(),l=a(async e=>{const n=o&&await o({form:{getValues:()=>e},...t},"N");return"string"==typeof n?void r(n,{type:"error"}):void 0===n||n?i(e):void 0},[o,r,vr,i]);return"function"==typeof o?l:void 0},Cr=e=>{const{useFormulario:t=Yt,enableLoad:n=!0,...r}=e,a=Q(e),{data:l,isLoading:s}=Hn(a,{enabled:n}),{fichaProps:c}=Wn(e),d=i(()=>({estado:"N",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Ft,null,o(Xt.Provider,{value:d},o(ke,Object.assign({redirect:"list"},r,null==c?void 0:c.panel))))};Cr.propTypes={useFormulario:To.func};const xr=xo(Cr,{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>br(e));function wr(e){var o,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(o=0;o<e.length;o++)e[o]&&(t=wr(e[o]))&&(n&&(n+=" "),n+=t);else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function kr(){for(var e,o,t=0,n="";t<arguments.length;)(e=arguments[t++])&&(o=wr(e))&&(n&&(n+=" "),n+=o);return n}const Tr=e=>{const t=B(),{resource:n,className:r,icon:i,label:a="ra.action.delete",...l}=e,s=ne(),[c,{isLoading:d}]=Te(n,{id:s.id});return o(lt,{title:t("ra.action.delete")},o(at,Object.assign({disabled:d,onClick:()=>c(),label:a,className:kr("ra-delete-button",r),key:"button"},(({...e})=>e)(l),{size:"large"}),i))};Tr.defaultProps={redirect:"list",icon:o(Fo,null)};const Or=e=>{const o={};for(const t in e)"string"==typeof e[t]&&0===e[t].trim().length||(null==e[t]&&(e[t]=""),o[t]=e[t]);return o},Sr=xo(e=>{const{useFormulario:t=Yt,mutationMode:n="pessimistic",...r}=e,a=Oe({mutationMode:n,...r}),{record:l,isLoading:s}=a,{fichaProps:c}=Wn(e),d=i(()=>({estado:"M",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Ft,null,o(Xt.Provider,{value:d},o(Se,Object.assign({mutationMode:n,transform:Or},r,null==c?void 0:c.panel))))},{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>br(e)),Rr=e((e,t)=>{const{isOpen:n,onSubmit:r,onClose:i,title:a,dialogText:l,children:s,hasAccept:c=!0,hasCancel:d=!0,isLoading:u=!1}=e,m=Q(e),p=e=>{i&&i(e)};return o(Mo,{ref:t,open:n,fullWidth:!0,onClose:p,"aria-labelledby":"form-dialog-title"},o(Do,{id:"form-dialog-title"},a),o(se,{resource:m,onSubmit:r},o(Eo,{dividers:!0},o(Io,null,l),o(st,{sx:{mt:2}},s)),(c||d)&&o(Lo,null,d&&o(te,{label:"ra.action.cancel",disabled:u,onClick:e=>p(e)},o(jo,null)),c&&o(ce,{alwaysEnable:!0,label:"Ok",disabled:u}))))}),Pr={},Nr={pointerEvents:"none",backgroundColor:"#ffffff",opacity:.6,position:"relative"},jr=e=>{const t=_t(),r=Q(e),{estado:i,isLoading:a,initialValues:l,fichaProps:c}=n(Xt),d=Kt({resource:r,etrs:c.etrs});return s(()=>{c.onRenderFicha&&c.onRenderFicha(d,i)},[]),s(()=>{a||c.onLoadFicha&&c.onLoadFicha(d,i,l)},[a]),o(L,{sx:{...e.sx,...t.open?Nr:Pr}},t.open&&o(E,{sx:{position:"absolute",left:"50%",top:"50%"},thickness:4,size:50}),e.children)},Fr=e=>{const{initialValues:t,fichaProps:{config:r={}}}=n(Xt),i=yr(e);return t?o(Re,Object.assign({mode:"onBlur"},e,{onSubmit:i,defaultValues:t,component:jr},r)):null};Fr.propTypes={...Re.propTypes};const _r=e=>{const{handleToggle:t,isOpen:n,name:r,icon:i,children:a,dense:l}=e,s=B(),[c]=Pe(),d=o(h,{dense:l,onClick:t},o(b,{sx:{minWidth:5}},n?o(ct,null):i),o(C,{variant:"inherit",color:"textSecondary"},s(r)));return o("div",null,c||n?d:o(j,{title:s(r),placement:"right"},d),o(I,{in:n,timeout:"auto",unmountOnExit:!0},o(D,{dense:l,component:"div",disablePadding:!0,sx:{paddingLeft:(e.children.props.children[0]?e.children.props.children[0].key:"").startsWith("menu")?2:0,backgroundColor:e=>ko(e.palette.secondary.light,.24),"& a":{transition:"padding-left 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",paddingLeft:c?4:2}}},a)))},Mr=e=>{const{items:t,translate:n,...r}=e,{state:i,handleToggle:a,dense:l}=r;return t&&o("div",null,t.map(e=>{const{name:t,menu:s,label:c,icon:d="settings"}=e;return s?o(_r,{key:t,name:c,handleToggle:()=>a(t),isOpen:i[t],icon:o(Yo,null),dense:l},Mr({items:s,translate:n,...r})):o(Ne,{key:t,to:"/"+t,primaryText:n(`resources.${t}.name`,{_:c}),dense:l,leftIcon:o(Yo,null)})}))},Lr=({dense:e=!1})=>{const t=B(),[n,i]=r({mnuPrueba:!1}),a=y(e=>e.breakpoints.down("sm")),[l]=Pe(),s=JSON.parse(localStorage.getItem("menus")),c=Mr({items:s,handleToggle:e=>{i(o=>({...o,[e]:!o[e]}))},state:n,activeClassName:"",iconClass:"",className:"",open:l,dense:e,translate:t});return o(x,{sx:{width:l?230:50,marginTop:1,marginBottom:1,transition:e=>e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}},o(je,null,o(Fe,{primaryText:t("ra.page.dashboard")}),c,a&&o(Ne,{to:"/configuration",primaryText:t("pos.configuration"),leftIcon:o(Yo,null),dense:e})))};var Er=e=>o(_e,Object.assign({},e,{appBar:Nt,menu:Lr}));const Ir=(e,o)=>{alert("Falta implementar la función jsBotonGrilla")},Dr=e=>{const{className:t,filters:r,children:a,hideFilterButton:l=!1,jsBotonGrilla:s=Ir,...u}=e,{sort:m,displayedFilters:p,filterValues:g,exporter:f,showFilter:h,total:b}=G(e),v=Q(e),{hasCreate:y}=ue(e),C=n(Me)||r,x=G(e),w={...Qt(e),...x};return delete u.hasCreate,i(()=>o(be,Object.assign({className:t},Le(u)),l?null:r?d(r,{resource:v,showFilter:h,displayedFilters:p,filterValues:g,context:"button"}):C&&o(Ee,null),y&&o(Ie,null),!1!==f&&o(De,{disabled:0===b,resource:v,sort:m,filterValues:g}),c.map(a,(e,o)=>d(e,{onClick:e.props.options?null:o=>{e.props.onClick&&e.props.onClick(o),s(w,e.key)},options:e.props.options?e.props.options.map(o=>({...o,onClick:t=>{e.props.onClick&&e.props.onClick(t),s(w,o.key)}})):null}))),[v,p,g,r,h,C,b,t,m,l,f,y])},Ar=e=>{const{loginBackgroundImage:t,nameSource:n="username",passwordSource:i="password"}=e,[a,l]=r(!1),s=B(),c=s("ra.auth.sign_in"),d=U(),u=Ae(),m=ho();return o(se,{onSubmit:e=>{l(!0),u(e,m.state?m.state.nextPathname:"/").catch(e=>{l(!1),d("string"==typeof e?e:void 0!==e&&e.message?e.message:"ra.auth.sign_in_error",{type:"error",messageArgs:{_:"string"==typeof e?e:e&&e.message?e.message:void 0}})})},validate:e=>{const o={};return e[n]||(o[n]=s("ra.validation.required")),e[i]||(o[i]=s("ra.validation.required")),o}},o(x,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",alignItems:"center",justifyContent:"flex-start",backgroundImage:t,backgroundRepeat:"no-repeat",backgroundSize:"cover"}},o(mt,{sx:{minWidth:300,marginTop:"6em"}},o(x,{sx:{margin:"1em",display:"flex",justifyContent:"center"}},o(dt,{sx:{backgroundColor:"secondary.main"}},o(g,null))),o(x,{sx:{marginTop:"1em",marginBottom:"1em",display:"flex",justifyContent:"center",color:"grey.600"}},"Inicio de Sesión"),o(x,{sx:{padding:"0 1em 1em 1em"}},o(x,{sx:{marginTop:0}},o(Be,{autoFocus:!0,fullWidth:!0,name:n,label:s("ra.auth.username"),disabled:a})),o(x,{sx:{marginTop:0}},o(Ve,{name:i,label:s("ra.auth.password"),type:"password",disabled:a}))),o(pt,{sx:{padding:"0 1em 1em 1em"}},o(ut,{variant:"contained",type:"submit",color:"primary",disabled:a,fullWidth:!0},a&&o(gt,{sx:{position:"absolute"},size:18,thickness:2}),c)))))},Br=e=>{var t;const{options:n=[],icon:i,label:a,disabled:l,...s}=e,[c,d]=r(!1),u=m(),[p,g]=r(0),f=Q(e);return o(x,Object.assign({sx:{display:"inline-block"}},(({...e})=>e)(s)),o(te,{size:"large",className:"add-filter",label:a,onClick:e=>{e.preventDefault(),d(!0),u.current=e.currentTarget},title:n[p].label,disabled:l},(null===(t=n[p])||void 0===t?void 0:t.icon)||i),o(ft,{open:c,anchorEl:u.current,onClose:e=>{u.current&&u.current.contains(e.target)||d(!1)}},n.map((e,t)=>o(ht,{key:e.label,disabled:e.disabled,selected:t===p,onClick:o=>{((e,o)=>{g(o),d(!1)})(0,t),e.onClick&&e.onClick(o,t)},resource:f,title:e.label},e.icon,o(x,{component:"span",sx:{paddingRight:"4px"}}),o(qe,{label:e.label,resource:f})))))},Vr=e=>{const{fields:t,className:n,...r}=e,{campos:i,separador:a="",secundario:l=[],hasSecundario:s}=t,c=ne(),d=i.map(e=>void 0!==c[e]?c[e]:e).join(""+a);return o(tt,Object.assign({noWrap:!0,variant:"inherit",className:n},r),d,s&&o(tt,{component:"span",display:"block",color:"textSecondary",variant:"caption"},l.map(e=>`${e.etiqueta||"---"}: ${c[e.campo]||"---"}`).join(" ")))},qr=xo(e=>{const{useFormulario:t=Yt,...n}=e,r=ze(n),{record:a,isLoading:l}=r,{fichaProps:s}=Wn(e),c=i(()=>({estado:"M",initialValues:a,isLoading:l,fichaProps:s}),[a,l,s]);return o(Ft,null,o(Xt.Provider,{value:c},o($e,Object.assign({},n,r,null==s?void 0:s.panel))))},{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>br(e)),zr=e=>{const{icon:t=Wr,label:n="ra.action.show",scrollToTop:r=!0,...i}=e,a=Q(e),l=ne(e),s=de();return l?o(On,Object.assign({component:fo,to:s({type:"show",resource:a,id:l.id}),state:$r[String(r)],label:n,onClick:Hr},i),t):null},$r={true:{_scrollToTop:!0},false:{}},Wr=o(bt,null),Hr=e=>e.stopPropagation();zr.propTypes={icon:To.element,label:To.string,record:To.any,scrollToTop:To.bool};const Gr=p(zr,(e,o)=>e.resource===o.resource&&(e.record&&o.record?e.record.id===o.record.id:e.record==o.record)&&e.label===o.label&&e.disabled===o.disabled),Ur=e=>{const{children:t,className:i,component:a=Yr,formRootPathname:l,syncWithLocation:s=!0,tabs:m=Jr,toolbar:p=Qr,onChange:g,...f}=e,h=ho(),b=vo(""),v=Q(e),[y,C]=r(0),{fichaProps:{etrs:x}}=n(Xt),w=Kt({...e,etrs:x}),{estado:k}=n(Xt),T=(e,o)=>{s||(C(o),g&&g(w,k,{newTab:o,prevTab:y,setTab:C},e))},O=()=>d(m,{onChange:T,syncWithLocation:s,url:l,value:y},t);return o(Zr,Object.assign({className:kr("tabbed-form",i)},Kr(f)),s?o(yo,null,o(Co,{path:"/*",element:O()})):O(),o(A,null),o(a,null,c.map(t,(e,o)=>{if(!e)return null;const t=He(e,o),n=s?!bo(`${b.pathname}/${t}`,h.pathname):y!==o;return u(e)?d(e,{intent:"content",resource:v,hidden:n,value:s?t:o}):null})),!1!==p?p:null)},Jr=o(Ge,null),Yr=({children:e})=>o(L,null,e),Qr=o(Ue,null),Zr=xo("div",{name:"RaTabbedForm",overridesResolver:(e,o)=>o.root})(({theme:e})=>({"& .MuiTab-root.RaTabbedForm-errorTabButton":{color:e.palette.error.main}})),Kr=({...e})=>e,Xr=e=>{const{...t}=e,n=(()=>{const e=ho(),o=bo(":resource/create/*",e.pathname),t=bo(":resource/:id/*",e.pathname);return o?o.pathnameBase:t?t.pathnameBase:""})();return o(se,Object.assign({formRootPathname:n},t),o(Ur,Object.assign({formRootPathname:n},ei(e))))};Xr.Tab=We;const ei=({...e})=>e,oi=e=>{const{initialValues:t,fichaProps:{config:r={}}}=n(Xt),i=yr(e);return t?o(Xr,Object.assign({mode:"onBlur"},e,{onSubmit:i,defaultValues:t,component:jr},r)):null};oi.defaultProps={syncWithLocation:!1};const ti={...Je,palette:{...Je.palette,mode:"dark"},components:{...Je.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}};var ni={__proto__:null,lightTheme:{...Je,palette:{...Je.palette,mode:"light"},components:{...Je.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}},darkTheme:ti};vt.ra.page.empty="No records yet";const ri={...vt,login:{id:"ID",hint:"Login",required:"Insert Username or ID",send:"Send",email:"Enter your email address",check_email:"Check your email inbox, we just send you a verification code!",must_enter_credentials:"You must first enter Username or ID",restore_password:"Restore Password",punch_in:"Punch In"},pos:{search:"Search",change_pin:"Change Pin",change_password:"Change Password",configuration:"Configuration",language:"Language",theme:{name:"Theme",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Welcome",subtitle:"Employee Management",aor_button:"Metiri WebSite"}}},validation:{greater_or_equal:"Must be greater than or equal to %{menor}"}};yt.ra.notification.created="Datos guardados correctamente",yt.ra.action.bulk_actions="1 seleccionado |||| %{smart_count} seleccionados",yt.ra.page.dashboard="Inicio",yt.ra.page.empty="Sin registros todavía",yt.ra.page.invite="¿Quiere agregar uno?",yt.ra.page.list="%{name}",yt.ra.page.edit="Editar %{name}",yt.ra.action.back="Volver",yt.ra.message.delete_title="Eliminar",yt.ra.input.file.upload_single="Seleccione o arrastre archivo";const ii={...yt,login:{id:"Cédula",hint:"Inicio de Sesión",required:"Ingrese Usuario o Cédula",email:"Ingrese su email aquí",send:"Enviar",check_email:"Revisa tu correo electrónico, te enviaremos un código de verificación!",must_enter_credentials:"Debe ingresar Nº de Usuario o Cédula y Contraseña primero",restore_password:"Restablecer Contraseña",punch_in:"Generar Marcas"},pos:{search:"Búsqueda",change_pin:"Cambiar Pin",change_password:"Cambiar Contraseña",configuration:"Configuración",language:"Lenguaje",theme:{name:"Tema Visual",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Bienvenid@",subtitle:"Gestión de Funcionarios",aor_button:"Sitio de Metiri"}}},validation:{greater_or_equal:"Debe ser mayor o igual a %{menor}"}},ai=e=>{const{propsContenido:t,hidden:n}=on(e),r=ne(),i=JSON.parse(JSON.stringify(r)),a=i[e.source];return i[e.source]=""!=a&&"0"!=a,!n&&o(Ye,Object.assign({},t,{record:i}))},li=e=>{const{source:o}=e,{estado:t,isLoading:r,fichaProps:i={}}=n(Xt),a=n(en),l=void 0!==a,s=Uo(e=>{const t=e.configInputs?e.configInputs.filter(e=>e.id===o):[];return t[0]?t[0]:null}),{disabled:c,hidden:d,required:u,error:p}=s||{},g=!0===u?rr:void 0,f="function"==typeof p?p:()=>p,{[o]:h={},etrs:b}=i,{onFocus:v,onChange:y,onBlur:C,hidden:x=!1,disabled:w=!1,validate:k,...T}=e,{field:O}=re(e),{onFocus:S,onBlur:R,onChange:P,hidden:N,disabled:j,useContenido:F=Yt,validate:_,...M}=h,L=l||void 0===N?x:N,E=l||void 0===j?w:j,I=l||void 0===S?v:S,D=l||void 0===R?C:R,A=l||void 0===P?y:P,B=Kt({...e,etrs:b,asisEtr:a}),V=F({...T,estado:t,hidden:L,isLoading:r,utils:B,...M}),q=m(O.value);if(void 0===V)throw new Error(`useContenido está devolviendo undefined para el contenido ${o}\n Asegúrese de incluir una instrucción return al final de la función`);const{hidden:z,disabled:$,onFocus:W,onChange:H,onBlur:G,validate:U,...J}=V,Y=W||I,Q=G||D,Z=H||A,K={...B,prev:q.current};return{propsContenido:{sx:{mt:1,mb:1,ml:{xs:0,md:1},mr:{xs:0,md:1}},onFocus:e=>{Y&&I(B,t,e),q.current=e.target.value},onBlur:e=>Q&&Q(K,t,e),onChange:e=>Z&&Z(K,t,e),helperText:!1,validate:[...Array.isArray(k)?k:[k],...Array.isArray(_)?_:[_],...Array.isArray(U)?U:[U],g,f].filter(e=>void 0!==e),...T,...M,...J,disabled:void 0!==c?c:void 0!==$?$:E},hidden:void 0!==d?d:void 0!==z?z:L}},si=(e,o)=>e&&""!==e?"string"==typeof e?(console.log(`${o}/${e}`),{src:`${o}/${e}`}):e instanceof Array?e.map(e=>({src:`${o}/${e}`})):e:void 0,ci=e=>{const{propsContenido:t,hidden:n}=li(e),{options:r={},disabled:i=!1,tipo:a="file",prefix:l,...s}=t;return!n&&("image"===a?o(Qe,Object.assign({maxSize:5e6},s,{options:{disabled:i,...r},format:e=>si(e,l),labelSingle:"Seleccione o arrastre imagen",accept:"image/*",inputProps:{capture:"user"}}),o(Ze,{source:"src",title:""})):o(Ke,Object.assign({maxSize:5e6},s,{options:{disabled:i,...r},format:e=>si(e,l)}),o(Xe,{download:!0,source:"src",title:"Ver adjunto",target:"_blank"})))},di=e=>{const{propsContenido:{sx:t,...n},hidden:r}=li(e);return!r&&o(eo,Object.assign({},n,{sx:{...t,display:"inline-flex",margin:1}}))},ui=e((e,t)=>o(j,Object.assign({ref:t},e))),mi=e=>{var t;const{callback:n,sx:r,isTC:i,onChange:a,...l}=e,{isLoading:c,allChoices:d}=to(),u=m(null);return s(()=>{c||"function"==typeof n&&n(Object.values([d]))},[d,n,c]),o(ui,{title:(null===(t=u.current)||void 0===t?void 0:t.value)||"",placement:"top",arrow:!0},o(x,{component:"span",sx:i?{margin:1,...r}:{display:{xs:"inherit",md:"inline-flex"},margin:1,...r},width:i?{}:{xs:"100%",md:"auto"}},o(no,Object.assign({size:"small",sx:i?{width:"100% !important"}:{}},l,{onChange:e=>{a({target:{value:e}})},TextFieldProps:{inputRef:u}}))))},pi=e=>{const{propsContenido:t,hidden:n}=li(e),r=Go(),{source:i,reference:a}=e,l=Uo(e=>{const o=e.reload_cb?e.reload_cb.filter(e=>e.id===i):[];return o[0]?o[0]:null}),c=m(l),d=null===l&&c.current?c.current:l;let u,p;if(d){const{callback:e,...o}=d;u=e,p=o}return s(()=>{null!==l&&(c.current=l,r(Dt(i)))},[JSON.stringify(l)]),n?null:o(oo,{reference:a,source:i,perPage:500,filter:p},o(mi,Object.assign({},t,{callback:u,optionText:"etiqueta",optionValue:i})))},gi=e=>{const{propsContenido:t,hidden:n}=li(e);return!n&&o(ro,t)},fi=e=>{const{title:t,source:n,src:r}=e,i=ne(e);return o(dt,{title:t,src:`${r}/${i[n]}`})},hi=e=>{const{propsContenido:t,hidden:n}=li(e),{source:r,reference:i}=e;return n?null:o(io,{source:r,reference:i},o(ao,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},bi=e=>{const{propsContenido:t,hidden:n}=li(e);return!n&&o(Ve,t)},vi=e=>{const{propsContenido:t,hidden:r}=li(e),{isLoading:i}=n(Xt),{source:a,reference:l}=e;return i||r?null:o(oo,{source:a,reference:l},o(lo,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},yi=e=>{const{propsContenido:t,hidden:n}=li(e);return!n&&o(lo,t)},Ci=e=>o(Ot,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(M,e)),xi={cursor:"move"},wi=e=>{const{isOpen:t,isLoading:n,title:r,content:i,cancel:l,ConfirmIcon:s,CancelIcon:c,onClose:d,onConfirm:u,contentResource:m,translateOptions:p={}}=e,g=B(),[f]=so(m),h=a((e,o)=>{e.stopPropagation(),u(e,f)},[f,u]),b=a(e=>{e.stopPropagation()},[]);return o(Mo,{open:t,onClose:d,onClick:b,fullWidth:!0,maxWidth:"lg",PaperComponent:Ci,"aria-labelledby":"draggable-dialog-title"},o(Do,{style:xi,id:"draggable-dialog-title"},g(r,{_:r,...p})),o(Eo,{dividers:!0},i),o(Lo,null,o(ut,{disabled:n,onClick:d},o(c,{sx:{paddingRight:"0.5em"}}),g(l,{_:l})),o(ut,{disabled:n,onClick:e=>h(e,"yes"),autoFocus:!0},o(s,{sx:{paddingRight:"0.5em"}}),g("ra.action.confirm"))))};wi.propTypes={cancel:To.string,classes:To.object,confirm:To.string,confirmColor:To.string,ConfirmIcon:To.elementType,CancelIcon:To.elementType,content:To.node.isRequired,isOpen:To.bool,isLoading:To.bool,onClose:To.func.isRequired,onConfirm:To.func.isRequired,title:To.string.isRequired},wi.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:kt,CancelIcon:Tt,isOpen:!1};const ki=()=>o(l,null),Ti={seleccion:[],all:!0,none:!1},Oi=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,Si=e=>e,Ri=e=>{const{disabled:t,asistant:n,asistantResource:i,label:c,source:d,sx:u,...m}=e,[p,g]=r(!1),f=Wo();s(()=>{b()},[]);const h=a(()=>{g(!1)},[g]),b=e=>{f.setValue(d,{seleccion:[],all:!0,none:!1})};return o(l,null,o(x,{display:"flex",alignItems:"center",sx:{...u,display:"inline-flex",margin:1}},o(Be,Object.assign({defaultValue:Ti},m,{source:d,label:c,disabled:!0,parse:Si,format:Oi,helperText:!1,InputProps:{endAdornment:o(l,null,o(at,{onClick:e=>{f.setValue(d,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(xt,null)),o(at,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(Ct,null)),o(at,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(wt,null)))}}))),o(wi,{isOpen:p,title:"Selección de "+c,contentResource:i,content:o(n,{bulkActionButtons:o(ki,null),hasCreate:!1,exporter:!1,resource:i}),onConfirm:(e,o)=>{g(!1),f.setValue(d,{seleccion:o,all:!1,none:!1})},onClose:h}))},Pi=e=>o(co,Object.assign({},e,{hasCreate:!1,exporter:!1,perPage:50,empty:!1,title:" ",disableSyncWithLocation:!0}),o(uo,{bulkActionButtons:o("span",null)},o(ee,{source:"funced",sortable:!0,label:"Cédula"}),o(ee,{source:"funpriape",sortable:!0,label:"Apellido"}),o(ee,{source:"funprinom",sortable:!0,label:"Nombre"}))),Ni={fillista:"empcod=-1"},ji=e=>{const[t,n]=r(Ni),i=H(),l=a(e=>{n({fillista:e.node.key})},[n]),s=a(e=>i.getChildNodes("form_224",{parentId:e?e.itemData.id:""}).then(e=>e.data).catch(()=>{throw new Error("Data Loading Error")}),[i]);return o(x,{display:"flex",flex:1,alignItems:"flex-start",height:"20em"},o(x,{flexGrow:1},o(St,{id:"funcionarios-treeview",dataStructure:"plain",rootValue:"",onItemClick:l,createChildren:s})),o(x,{flexGrow:2},o(Pi,{resource:"form_224",filter:t})))},Fi=e=>o(Ot,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(M,e)),_i={cursor:"move"},Mi=e=>{const{isOpen:t,isLoading:n,title:r,cancel:i,ConfirmIcon:l,CancelIcon:s,onClose:c,onConfirm:d,translateOptions:u={}}=e,m=B(),p=a((e,o)=>{e.stopPropagation(),d(e,o)},[d]),g=a(e=>{e.stopPropagation()},[]);return o(Mo,{open:t,onClose:c,onClick:g,fullWidth:!0,maxWidth:"lg",PaperComponent:Fi,"aria-labelledby":"draggable-dialog-title"},o(Do,{style:_i,id:"draggable-dialog-title"},m(r,{_:r,...u})),o(Eo,{dividers:!0},o(ji,null)),o(Lo,null,o(ut,{disabled:n,onClick:c},o(s,{sx:{paddingRight:"0.5em"}}),m(i,{_:i})),o(ut,{disabled:n,onClick:e=>p(e,"yes"),autoFocus:!0},o(l,{sx:{paddingRight:"0.5em"}}),m("ra.action.confirm"))))};Mi.propTypes={cancel:To.string,classes:To.object,confirm:To.string,confirmColor:To.string,ConfirmIcon:To.elementType,CancelIcon:To.elementType,isOpen:To.bool,isLoading:To.bool,onClose:To.func.isRequired,onConfirm:To.func.isRequired,title:To.string.isRequired},Mi.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:kt,CancelIcon:Tt,isOpen:!1};const Li={seleccion:[],all:!0,none:!1},Ei=e=>String(e)===e?"Selección (1)":!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,Ii=e=>e,Di=e=>{const{disabled:t,label:n="Funcionarios",allowNone:i=!0,source:c,sx:d,...u}=e,[m]=so("form_224"),[p,g]=r(!1),f=Wo();s(()=>{b()},[]);const h=a(()=>{g(!1)},[g]),b=e=>{f.setValue(c,{seleccion:[],all:!0,none:!1})};return o(l,null,o(x,{display:"flex",alignItems:"center",sx:{...d,display:"inline-flex",margin:1}},o(Be,Object.assign({defaultValue:Li},u,{source:c,label:n,disabled:!0,parse:Ii,format:Ei,helperText:!1,InputProps:{endAdornment:o(l,null,i&&o(at,{onClick:e=>{f.setValue(c,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(xt,null)),o(at,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(Ct,null)),o(at,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(wt,null)))}}))),o(Mi,{isOpen:p,title:"Selección de "+n,onConfirm:(e,o)=>{g(!1),f.setValue(c,{seleccion:m,all:!1,none:!1})},onClose:h}))},Ai=e=>{const{propsContenido:t,hidden:n}=li(e);return!n&&o(Be,Object.assign({multiline:!0},t))},Bi=e=>{const{tipo:t,...n}=e,{propsContenido:r,hidden:i}=li(n),a=Wo();s(()=>{r.value&&a.setValue(e.source,r.value)});const l={...r};return i?null:"N"===t||"D"===t?o(mo,l):"F"===t?o(po,l):"Z"===t?o(go,l):o(Be,"H"===t?Object.assign({},l,{type:"time"}):l)},Vi=e=>{const{source:t,label:n,sx:r}=e,{hidden:i}=li(e);return i?null:o(x,{sx:{...r,display:"inline-flex",alignItems:"flex-start",marginLeft:1,marginBottom:-1,width:{xs:"100%",md:"calc(24vw + 1em)"}}},o(Be,Object.assign({},e,{label:"",source:t,sx:{flex:1,marginTop:1}})),o(pi,Object.assign({},e,{source:t,label:n,isTC:!0,sx:{flex:3}})))};export{Nt as AppBar,Tn as Asistente,Et as AsistenteContext,ai as BooleanField,ci as Camino,di as CheckBox,pi as ComboBox,gi as ComboBoxManual,xr as CreateEtriek,jn as CreateGridButton,Tr as DeleteButtonNoWarning,Sr as EditEtriek,Ln as EditGridButton,xn as EtrGrid,nr as FichaActions,Xt as FichaContext,Mi as FiltroFuncionarios,hr as FormClasses,Rr as FormDialog,Fr as FormEtriek,kn as GE,On as GridButton,zn as GrillaEtriek,fi as ImageField,Er as Layout,Dr as ListActionsEtriek,hi as ListCheck,Ar as Login,Lr as Menu,Br as MenuButton,Vr as MultiTextField,bi as Password,vi as RadioButton,yi as RadioButtonManual,tr as Separador,qr as ShowEtriek,Gr as ShowGridButton,_r as SubMenu,Di as TBSF,oi as TabbedFormEtriek,$n as TabbedGrillaEtriek,Ai as TextArea,Bi as TextBox,Ri as TextBoxSelection,Vi as TextCombo,tn as TextField,cr as choicesEstado,Yn as dateFormat,ar as dateFormatOptions,Qn as dateParser,Kn as dateTimeFormat,Xn as dateTimeParser,gr as dateTimeToString,pr as dateToString,Dt as deleteRecargarComboBox,dr as descargarLink,ri as enMessages,ii as esMessages,lr as etrFechaMayorQue,rr as etrRequerido,ir as etrRequeridoNumerico,Gn as getFormcodFromResource,sr as localeOptions,It as recargarComboBox,nn as renderCellComboBox,Bt as setDisableAction,qt as setErrorAction,At as setHiddenAction,Vt as setRequireAction,ur as stringToDate,mr as stringToDateTime,ni as themes,er as timeFormat,or as timeParser,Jt as useAjax,li as useContenidoController,cn as useEtrActions,on as useFieldController,_t as useFormProgress,yr as useFormSubmit,Ut as useGetJson,Wn as useInitFicha,Hn as useNuevo,fr as useReferenceLabel,Kt as useUtils,Qt as useUtilsGrilla,Zt as useUtilsSubmit};
1
+ import e,{forwardRef as t,createElement as o,createContext as n,useContext as i,useState as r,useMemo as a,useCallback as l,Fragment as s,useEffect as c,Children as d,cloneElement as u,isValidElement as m,useRef as p,memo as g}from"react";import f from"@mui/icons-material/Lock";import h from"@mui/icons-material/VpnLock";import{MenuItem as b,ListItemIcon as v,ListItemText as y,useMediaQuery as C,Typography as x,Box as w,alpha as k,createTheme as T,StyledEngineProvider as O,Stack as S,Dialog as R,DialogTitle as E,DialogContent as P,DialogActions as _,Tooltip as j,IconButton as N,ThemeProvider as F,Paper as I,CardContent as M,CircularProgress as L,Collapse as D,List as B,Divider as A,Button as V}from"@mui/material";import{useTranslate as q,useUserMenu as z,useResourceDefinitions as $,AppBar as W,UserMenu as H,Logout as G,useDataProvider as U,useListContext as J,useNotify as Y,useRedirect as Q,useRefresh as Z,useResourceContext as K,useUnselectAll as X,NumberField as ee,DateField as te,TextField as oe,ReferenceField as ne,Button as ie,useRecordContext as re,useInput as ae,useGetList as le,useSafeSetState as se,Confirm as ce,Form as de,SaveButton as ue,useCreatePath as me,useResourceDefinition as pe,DatagridRoot as ge,DatagridClasses as fe,BulkActionsToolbar as he,SimpleList as be,useGetOne as ve,TopToolbar as ye,ListButton as Ce,ShowButton as xe,required as we,minValue as ke,useSaveContext as Te,Create as Oe,useDelete as Se,useEditController as Re,Edit as Ee,SimpleForm as Pe,useSidebarState as _e,MenuItemLink as je,Menu as Ne,DashboardMenuItem as Fe,Layout as Ie,FilterContext as Me,sanitizeListRestProps as Le,FilterButton as De,CreateButton as Be,ExportButton as Ae,useLogin as Ve,TextInput as qe,PasswordInput as ze,FieldTitle as $e,useShowController as We,Show as He,FormTab as Ge,getTabbedFormTabFullPath as Ue,TabbedFormTabs as Je,Toolbar as Ye,defaultTheme as Qe,BooleanField as Ze,ImageInput as Ke,ImageField as Xe,FileInput as et,FileField as tt,BooleanInput as ot,ReferenceInput as nt,useChoicesContext as it,AutocompleteInput as rt,SelectInput as at,ReferenceArrayInput as lt,SelectArrayInput as st,RadioButtonGroupInput as ct,useRecordSelection as dt,List as ut,Datagrid as mt,NumberInput as pt,DateInput as gt,DateTimeInput as ft}from"react-admin";import{Link as ht,useLocation as bt,matchPath as vt,useResolvedPath as yt,Routes as Ct,Route as xt}from"react-router-dom";import{styled as wt,ThemeProvider as kt,alpha as Tt}from"@mui/material/styles";import Ot,{string as St,func as Rt,any as Et,bool as Pt}from"prop-types";import _t from"@mui/icons-material/Add";import jt from"@mui/icons-material/Cancel";import Nt from"@mui/icons-material/Delete";import Ft from"@mui/icons-material/Edit";import It from"@mui/material/Dialog";import Mt from"@mui/material/DialogActions";import Lt from"@mui/material/DialogContent";import Dt from"@mui/material/DialogContentText";import Bt from"@mui/material/DialogTitle";import At from"@mui/material/Paper";import{esES as Vt,DataGridPremium as qt,useGridApiContext as zt,useGridApiRef as $t,useKeepGroupedColumnsHidden as Wt}from"@mui/x-data-grid-premium";import{useFormContext as Ht,useFormState as Gt}from"react-hook-form";import{useDispatch as Ut,useSelector as Jt}from"react-redux";import{useMutation as Yt}from"react-query";import Qt from"@mui/icons-material/Settings";import{GridActionsCellItem as Zt}from"@mui/x-data-grid";import Kt from"@mui/icons-material/Create";import Xt from"@mui/material/Divider";import eo from"@mui/material/Tab";import to from"@mui/material/Tabs";import oo from"@mui/icons-material/ChevronLeft";import no from"@mui/material/Typography";import{isAfter as io}from"date-fns";import ro from"date-fns/locale/en-US";import ao from"date-fns/locale/es";import lo from"@mui/material/IconButton";import so from"@mui/material/Tooltip";import co from"@mui/material/Box";import uo from"@mui/icons-material/ExpandMore";import mo from"@mui/material/Avatar";import po from"@mui/material/Button";import go from"@mui/material/Card";import fo from"@mui/material/CardActions";import ho from"@mui/material/CircularProgress";import bo from"@mui/material/Menu";import vo from"@mui/material/MenuItem";import yo from"@mui/icons-material/RemoveRedEye";import Co from"ra-language-english";import xo from"@blackbox-vision/ra-language-spanish";import wo from"@mui/material/Stack";import{PhotoCamera as ko}from"@mui/icons-material";import To from"@mui/icons-material/AddAPhoto";import Oo from"@mui/icons-material/Check";import So from"@mui/icons-material/RemoveCircleOutline";import Ro from"@mui/icons-material/Search";import Eo from"@mui/icons-material/CheckCircle";import Po from"@mui/icons-material/ErrorOutline";import _o from"react-draggable";import{TreeView as jo}from"devextreme-react";const No=t((e,t)=>{const n=q(),{onClose:i}=z(),r=$(),a=r.form_59;return[r.form_275?o(b,Object.assign({component:ht,ref:t},e,{key:"/form_275",to:"/form_275",onClick:i}),o(v,null,o(f,null)),o(y,null,n("pos.change_pin"))):null,a?o(b,Object.assign({component:ht,ref:t},e,{key:"/form_59",to:"/form_59",onClick:i}),o(v,null,o(h,null)),o(y,null,n("pos.change_password"))):null]}),Fo=()=>o(H,null,o(No,null),o(G,null)),Io=e=>{const t=C(e=>e.breakpoints.up("sm"));return o(W,Object.assign({},e,{color:"secondary",userMenu:o(Fo,null)}),o(x,{variant:"h6",color:"inherit",sx:{flex:1,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},id:"react-admin-title"}),t&&o(w,{component:"span",sx:{flex:1}}))},Mo=n(),Lo=({children:e})=>{const[t,n]=r(!1),i=a(()=>({open:t,show:()=>n(!0),hide:()=>n(!1)}),[t]);return o(Mo.Provider,{value:i},e)},Do=()=>i(Mo),Bo=n(),Ao=({children:e})=>{const[t,n]=r(!1),[i,l]=r({}),s=a(()=>({open:t,props:i,show:e=>{l(e),n(!0)},hide:()=>n(!1)}),[t,i]);return o(Bo.Provider,{value:s},e)},Vo=()=>i(Bo),qo=(e,t,o,n)=>({type:"RELOAD_CB",payload:{id:e,method:t,params:o,callback:n}}),zo=(e,t)=>({type:"RELOAD_CB_SUCCESS",payload:{id:e,callback:t}}),$o=(e,t)=>({type:"HIDE_INPUT",payload:{id:e,hidden:t}}),Wo=(e,t)=>({type:"DISABLE_INPUT",payload:{id:e,disabled:t}}),Ho=(e,t)=>({type:"REQUIRE_INPUT",payload:{id:e,required:t}}),Go=(e,t)=>({type:"ERROR_INPUT",payload:{id:e,error:t}}),Uo=()=>{const e=Ut();return l((t,o,n,i)=>{e(qo(t,o,n,i))},[e])},Jo=()=>{const e=Ut();return l((t,o)=>{e($o(t,o))},[e])},Yo=()=>{const e=Ut();return l((t,o)=>{e(Wo(t,o))},[e])},Qo=()=>{const e=Ut();return l((t,o)=>{e(Ho(t,o))},[e])},Zo=()=>{const e=Ut();return l((t,o)=>{e(Go(t,o))},[e])},Ko=(e,t)=>{const o=U(),{mutateAsync:n,isLoading:i}=Yt(t=>{const{method:n,params:i}=t;return o.getJson(e,{method:n,params:i})},t);return{mutateAsync:n,isLoading:i}},Xo=e=>{const{mutateAsync:t,isLoading:o}=Ko(e);return[l((e,o,n)=>t({method:e,params:o},{onSuccess:n,onError:n}),[]),o]},en=e=>({}),tn=e=>{const t=J(e),o=Y(),n=Q(),i=Z(),r=K(e),a=X(r),l=Vo(),s=q(),[c]=Xo(r);return{ajax:c,data:t,notify:o,redirect:n,refresh:i,refetch:t.refetch,unselectAll:a,asistente:l,translate:s}},on=e=>{const t=Uo(),o=Jo(),n=Yo(),i=Qo(),r=Zo(),a=Do(),l=Y(),s=Q(),c=K(e),[d]=Xo(c);return{ajax:d,notify:l,redirect:s,recargarComboBox:t,progress:a,setHidden:o,setDisable:n,setRequire:i,setError:r,etrs:e.etrs||{}}},nn=e=>{const t=Uo(),o=Jo(),n=Yo(),i=Qo(),r=Zo(),a=Do(),s=Y(),c=Q(),d=Ht(),u=K(e),[m]=Xo(u),p=e.etrs||{},g=e.asisEtr||{},{trigger:f}=d;return{form:d,ajax:m,notify:s,redirect:c,recargarComboBox:t,progress:a,setHidden:l((e,t)=>{o(e,t),setTimeout(()=>{f(e)})},[o,f]),setDisable:l((e,t)=>{n(e,t),setTimeout(()=>{f(e)})},[n,f]),setRequire:l((e,t)=>{i(e,t),setTimeout(()=>{f(e)})},[i,f]),setError:l((e,t)=>{r(e,t),setTimeout(()=>{f(e)})},[r,f]),etrs:p,asisEtr:g}},rn=n({}),an=n(void 0),ln=e=>{const{estado:t,isLoading:o,fichaProps:n={}}=i(rn),{[e.source]:r={}}=n,{hidden:a=!1,...l}=e,{hidden:s,useContenido:c=en,...d}=r,u=void 0!==s?s:a,m=c({...l,estado:t,hidden:u,isLoading:o,...d}),{hidden:p,...g}=m;if(void 0===m)throw new Error(`useContenido está devolviendo undefined para el contenido ${e.source}\n Asegúrese de incluir una instrucción return al final de la función`);return{propsContenido:{...l,...d,...g},hidden:void 0!==p?p:u}},sn=e=>{const{tipo:t,...n}=e,{propsContenido:i,hidden:r}=ln(n),a={...i};return!r&&("N"===t||"D"===t?o(ee,a):"F"===t?o(te,a):"Z"===t?o(te,Object.assign({},a,{showTime:!0})):o(oe,a))},cn=(e,t,n)=>i=>o(ne,{reference:n,source:t,queryOptions:{meta:{etr:e}},record:{[t]:i.row[t]}},o(sn,{source:"etiqueta"})),dn=e=>{const t={...e};return delete t.id,t},un=e=>{const{apiRef:t,source:o,enviarTodo:n}=e;return l((e,i)=>{const r=dn(e),a=t.current.getRowsCount()+1;t.current.updateRows([{...r,id:a}]);const l=n?Array.from(t.current.getRowModels().values(),e=>({...e,claveFila:"",estado:"N"}))||[]:i.getValues()[o]||[];n||l.push({...r,claveFila:"",estado:"N"}),i.setValue(o,l,{shouldDirty:!0})},[t,o])},mn=e=>{const{apiRef:t,source:o,enviarTodo:n}=e;return l((e,i,r)=>{var a,l;const s="number"==typeof e?"N":"M",c=dn(i);t.current.updateRows([{...c,id:e}]);const d=n?Array.from(t.current.getRowModels().values(),e=>({...e,estado:s}))||[]:r.getValues()[o]||[];let u=d.findIndex(t=>t.id===e);u=-1===u?d.length:u,d[u]={...c,claveFila:"N"===(null===(a=d[u])||void 0===a?void 0:a.estado)?"":e,estado:"N"===(null===(l=d[u])||void 0===l?void 0:l.estado)?"N":"M"},r.setValue(o,d,{shouldDirty:!0})},[t,o])},pn=e=>{const{apiRef:t,source:o,enviarTodo:n}=e;return l((e,i)=>{const r=t.current.getRowModels().get(e);t.current.updateRows([{id:e,_action:"delete"}]);const a=n?Array.from(t.current.getRowModels().values(),e=>({...e,estado:"B"}))||[]:i.getValues()[o]||[];let l=a.findIndex(t=>t.claveFila===e);l=-1===l?a.length:l,a[l]={...r,estado:"B",claveFila:e},"number"==typeof e&&a.splice(l,1),i.setValue(o,a,{shouldDirty:!0})},[t,o])},gn=e=>{const{[e.source]:t}=e.useFormulario(),o={...e,enviarTodo:!(null==t||!t.enviarTodo)};return{addRow:un(o),editRow:mn(o),deleteRow:pn(o),clear:t=>{e.apiRef.current.setRows([]),t.setValue(e.source,"")},api:e.apiRef}},fn=wt("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%","& .ant-empty-img-1":{fill:"light"===e.palette.mode?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===e.palette.mode?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===e.palette.mode?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===e.palette.mode?"#fff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===e.palette.mode?"0.8":"0.08",fill:"light"===e.palette.mode?"#f5f5f5":"#fff"}})),hn=()=>o(fn,null,o("svg",{width:"120",height:"100",viewBox:"0 0 184 152","aria-hidden":!0,focusable:"false"},o("g",{fill:"none",fillRule:"evenodd"},o("g",{transform:"translate(24 31.67)"},o("ellipse",{className:"ant-empty-img-5",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),o("path",{className:"ant-empty-img-1",d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"}),o("path",{className:"ant-empty-img-2",d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"}),o("path",{className:"ant-empty-img-3",d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"})),o("path",{className:"ant-empty-img-3",d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"}),o("g",{className:"ant-empty-img-4",transform:"translate(149.65 15.383)"},o("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),o("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"})))),o(w,{sx:{mt:1}},"No hay registros")),bn=wt(ie,{name:"EtrDeleteButton",overridesResolver:(e,t)=>t.root})(({theme:e})=>({color:e.palette.primary.main,"&:hover":{backgroundColor:k(e.palette.primary.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}})),vn={},yn=e=>{const t=Ht();return o(an.Provider,{value:{form:t}},e.children)},Cn=e=>o(It,{open:e.open,onClose:e.onClose,fullWidth:!0},o(Bt,null,`${e.labelEstado} ${e.label}`),o(Dt,{component:"span"},o(de,{mode:"onBlur",record:vn,resource:e.resource,onSubmit:e.onSubmit},o(yn,null,e.children))));Cn.propTypes={label:St,onClick:Rt,icon:Et,open:Pt,onClose:Rt,labelEstado:St,resource:Et,save:Rt,render:Rt};const xn=e=>{const{form:t,resource:n,estado:r,editors:a,recordPadre:l,camposClaveFila:m,setOpen:p,open:g}=e,{dirtyFields:f,isValid:h}=Gt(),{fichaProps:{[e.source]:b={},etrs:v}}=i(rn),y=i(an),{onAfterRenderAsistente:C}=b,x=nn({resource:n,etrs:v,asisEtr:y});return c(()=>{g&&"function"==typeof C&&C({...x,form:t})},[g]),o(s,null,o(Lt,null,o(S,{spacing:4},d.map(a,(e,t)=>u(e,{resource:n,estado:r,defaultValue:l[e.props.source]||"",fullWidth:!0,sx:{margin:0},disabled:"N"!==r&&-1!==m.indexOf(e.props.source),...b[e.props.source]})))),o(Mt,null,o(ue,{disabled:0===Object.keys(f).length||!h}),o(ie,{label:"ra.action.cancel",onClick:e=>{p(!1),e.stopPropagation()}},o(jt,null))))},wn=e=>{const{editors:t,record:n,camposClaveFila:i,label:r,source:a,enviarTodo:l}=e,[c,d]=se(!1),u=K(e),m=Ht(),p=zt(),g=un({apiRef:p,source:a,enviarTodo:l}),f=q()("ra.action.create");return o(s,null,o(ie,{onClick:e=>{d(!0),e.stopPropagation()}},o(_t,null)),o(Cn,{open:c,onClose:e=>{d(!1),e.stopPropagation()},labelEstado:f,label:r,resource:u,onSubmit:(e,t)=>{g(e,m),d(!1)}},o(xn,{source:a,form:m,resource:u,estado:"N",editors:t,recordPadre:n||{},camposClaveFila:i,open:c,setOpen:()=>{d(!1)}})))},kn=e=>{const{editors:t,camposClaveFila:n,resource:i,label:r,source:a,row:l,enviarTodo:c}=e,d=q(),[u,m]=se(!1),p=zt(),g=Ht(),f=mn({apiRef:p,source:a,enviarTodo:c}),h=d("ra.action.edit");return o(s,null,o(ie,{onClick:e=>{m(!0),e.stopPropagation()}},o(Ft,null)),o(Cn,{open:u,onClose:e=>{m(!1),e.stopPropagation()},labelEstado:h,label:r,resource:i,onSubmit:(e,t)=>{f(l.id,e,g),m(!1)}},o(xn,{source:a,form:g,resource:i,estado:"M",editors:t,recordPadre:l,camposClaveFila:n,open:u,setOpen:()=>{m(!1)}})))},Tn=e=>{const{confirmTitle:t="ra.message.delete_title",confirmContent:n="ra.message.delete_content",row:i,source:r,enviarTodo:a}=e,[l,c]=se(!1),d=zt(),u=Ht(),m=pn({apiRef:d,source:r,enviarTodo:a});return o(s,null,o(bn,{key:"button",onClick:e=>{c(!0),e.stopPropagation()}},o(Nt,null)),o(ce,{isOpen:l,title:t,content:n,onConfirm:e=>{m(i.id,u)},onClose:e=>{c(!1),e.stopPropagation()}}))},On=T({},Vt),Sn=e=>{const{filterBy:t="",claves:n,sortModel:l,columns:c,reference:d,allowAdd:u=!0,allowRemove:m=!0,enableLoad:p=!0,apiRef:g,...f}=e,[h,b]=r([]),v=re(e),{field:y}=ae({defaultValue:"",...e}),{isLoading:C,fichaProps:{[f.source]:x}}=i(rn),{enviarTodo:w=!1}=x||{},[k,T]=r(l),[{field:S,sort:R}]=l;let E={};v&&t.split(",").forEach(e=>{e&&(E[e]=[{type:"string",comparison:"eq",value:v[e],field:e}])});const{isLoading:P}=le(d,{pagination:{page:1,perPage:200},sort:{field:S,order:R},filter:E},{enabled:p&&!C,onSuccess:e=>{b((null==e?void 0:e.data)||[])}}),_=[...c,{field:" ",width:80,headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(kn,Object.assign({},f,{enviarTodo:w,camposClaveFila:n,row:e.row}))}];u&&_.unshift({field:"BTN",headerName:"",sortable:!1,renderHeader:e=>o(wn,Object.assign({},f,{enviarTodo:w,camposClaveFila:n}))}),m&&_.push({field:" ",headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(Tn,Object.assign({},f,{enviarTodo:w,camposClaveFila:n,row:e.row}))});const j=a(()=>_,[JSON.stringify(_)]);return o(At,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(O,{injectFirst:!0},o(kt,{theme:On},o(s,null,o(qt,Object.assign({apiRef:g,loading:P||C,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,rows:h,columns:j,sortModel:k,onSortModelChange:e=>T(e),sortable:!1,resizable:!1,disableReorder:!0,disableExport:!0,filterable:!1,disableColumnMenu:!0,slots:{noRowsOverlay:hn}},f)),o("input",Object.assign({type:"hidden"},y))))))},Rn=T({},Vt),En=e=>{const{filterBy:t="",sortModel:n,columns:l,reference:s,enableLoad:c=!0,initialState:d,...u}=e,{isLoading:m}=i(rn),p=re(),[g,f]=r(n),[{field:h,sort:b}]=n,v=a(()=>[...l],[JSON.stringify(l)]);let y={};p&&t.split(",").forEach(e=>{e&&(y[e]=[{type:"string",comparison:"eq",value:p[e],field:e}])});const{estado:C,isLoading:x,fichaProps:w={}}=i(rn),k=nn(e),{[e.source]:T={}}=w,{useContenido:S=en,restInitialProps:R}=T,{data:E=[],isLoading:P,refetch:_}=le(s,{pagination:{page:1,perPage:200},sort:{field:h,order:b},filter:y},{enabled:c&&!m}),j=$t(),N=Wt({apiRef:j,initialState:d});return S({...u,estado:C,hidden:e.hidden,isLoading:x,utils:k,...R,refetch:_,apiRef:j}),o(At,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(O,{injectFirst:!0},o(kt,{theme:Rn},o(qt,Object.assign({apiRef:j,rows:E,columns:v,loading:P||m,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,sortModel:g,onSortModelChange:e=>f(e),slots:{noRowsOverlay:hn},initialState:N},u)))))},Pn=e=>{const{isLoading:t}=e,n=K(e),i=Vo(),{open:r,hide:a,props:{title:l,controles:c,aceptar:d,tipo:u="form"}}=i;return o(R,{open:r,onClose:()=>a(),fullWidth:!0,maxWidth:"vista"===u?"lg":"sm"},o(E,{id:"draggable-dialog-title"},l),"form"===u?o(de,{resource:n,onSubmit:d},o(P,{dividers:!0},o(S,{spacing:2},c)),o(_,null,o(ie,{label:"ra.action.cancel",disabled:t,onClick:()=>a()},o(jt,null)),o(ue,{disabled:t}))):o(s,null,o(P,{dividers:!0},o(S,{spacing:2},c)),o(_,null,o(ie,{label:"ra.action.cancel",disabled:t,onClick:()=>a()},o(jt,null)))))},_n=e=>{const{alignIcon:t="left",children:n,className:i,disabled:r,label:a,color:l="primary",size:s="small",to:c,...d}=e,u=q(),m=a?u(a,{_:a}):void 0,p=jn(c);return a&&!r?o(j,{title:m},o(N,Object.assign({"aria-label":m,className:i,color:l,size:"large"},d,p),n)):o(N,Object.assign({className:i,color:l,disabled:r,size:"large"},d,p),n)};_n.propTypes={alignIcon:Ot.oneOf(["left","right"]),children:Ot.element,className:Ot.string,color:Ot.oneOfType([Ot.oneOf(["inherit","default","primary","secondary","error","info","success","warning"]),Ot.string]),disabled:Ot.bool,label:Ot.string,size:Ot.oneOf(["small","medium","large"])};const jn=e=>{if(null==e)return;if("string"==typeof e)return{to:e};const{redirect:t,replace:o,state:n,...i}=e;return{to:i,redirect:t,replace:o,state:n}},Nn=e=>e.stopPropagation(),Fn={true:{_scrollToTop:!0},false:{}},In=o(_t,null),Mn=e=>{const{icon:t=In,label:n="ra.action.create",scrollToTop:i=!0,...r}=e,a=K(e),l=re(e),s=me();return o(_n,Object.assign({component:ht,to:s({type:"create",resource:a}),state:{record:l,...Fn[String(i)]},label:n,onClick:Nn},r),t)},Ln=e=>e.stopPropagation(),Dn={true:{_scrollToTop:!0},false:{}},Bn=o(Kt,null),An=e=>{const{icon:t=Bn,label:n="ra.action.edit",scrollToTop:i=!0,...r}=e,a=K(e),l=re(e),s=me();return l?o(_n,Object.assign({component:ht,to:s({type:"edit",resource:a,id:l.id}),state:Dn[String(i)],label:n,onClick:Ln},r),t):null},Vn=(e,t)=>void 0===t||"function"==typeof t&&t(e),qn=T({},Vt),zn=new Map([["is","is"],["not","not"],["after","after"],["onOrAfter","onOrAfter"],["before","before"],["onOrBefore","onOrBefore"],["eq","="],["neq","!="],["gt",">"],["gte",">="],["lt","<"],["lte","<="],["contains","contains"],["equals","equals"],["sw","startsWith"],["ew","endsWith"],["isEmpty","isEmpty"],["isNotEmpty","isNotEmpty"],["isAnyOf","isAnyOf"]]),$n=new Map(Array.from(zn,e=>[e[1],e[0]])),Wn=e=>e.items.reduce((e,t)=>(void 0!==t.field&&t.operator&&($n.has(t.operator)?e[`${t.field}_${$n.get(t.operator)}`]=t.value:e[t.field]=t.value),e),{}),Hn=e=>{const{actionButtons:t=[],bulkActionButtons:n,sx:i,columns:r,isRowEditable:a,desktopSize:l=!1,hasEdit:c,initialState:d,convertFilterModelToFilterValues:u=Wn,claveNuevo:p,mobileColumns:g="",...f}=e,h=tn(e),b=q(),v=K(e),{data:y=[],isLoading:C,selectedIds:x,onSelect:k,displayedFilters:T,setFilters:O}=J(),S=$t(),R=Wt({apiRef:S,initialState:{...d,pinnedColumns:{right:["actions"]}}}),E=r.map((e,t)=>({...e,headerName:""!==e.headerName?b(`resources.${v}.fields.${e.field}`,{_:e.headerName}):e.headerName})),P=t.length>0||c?E.concat([{field:"actions",type:"actions",width:100,hideable:!1,getActions:e=>{const n=S.current.getRowNode(e.id);return e.row.id?[...c?[o(An,{record:e.row,disabled:!Vn(e.row,a)})]:[],...t.filter(e=>!!e).map(t=>{const{handler:n,...i}=t;return o(Zt,Object.assign({showInMenu:!0,onClick:t=>"function"==typeof n&&n({...h,record:e.row},i.key)},i))})]:-1!==n.children[0].indexOf(p+"=")?[o(Mn,{record:p?{[p]:n.children[0].split(p+"=")[1].replaceAll("[","").trim().split("AND")[0].trim()}:void 0})]:[]}}]):E,_=m(n);return o(s,null,o(Pn,{isLoading:C}),o(ge,{sx:i,className:fe.root},_?o(he,{selectedIds:x},n):null,o(w,{sx:{height:"70vh",width:"100%"},className:fe.tableWrapper},o(F,{theme:qn},o(qt,Object.assign({sx:{display:"grid",gridTemplateRows:"70vh 1fr auto"},slots:{noRowsOverlay:hn},columns:P,rows:y,apiRef:S,loading:C,hideFooterSelectedRowCount:!0,hideFooter:!0,disableMultipleRowSelection:!0,checkboxSelection:_,filterMode:"server",onFilterModelChange:e=>{O(u(e),T)},rowSelectionModel:x,onRowSelectionModelChange:e=>{C||(S.current.isRowSelected(e[0])?k([]):k(e))},isRowSelectable:e=>e.row.id,initialState:R},f))))))},Gn=e=>{const{sx:t,columns:n,actionButtons:i=[],hasEdit:r,isRowEditable:a,primaryText:l,mobileColumns:c=""}=e;let d=l;const u=tn(e),{isLoading:m}=J();if(!l){const e=c?c.split(",").map(e=>n.find(t=>t.field===e)):n;d=t=>o(I,{variant:"outlined",sx:{pt:2,pb:2,pl:2}},e.map(e=>{const{field:n,headerName:i,valueGetter:r,type:a="string",jsxMobile:l}=e;return o(w,null,l?l(t,e):"boolean"===a?o(w,{component:"span",sx:{color:r({value:t[n]})?"green":"red"}},i):t[n])}),o(w,null,i.filter(e=>!!e).map(e=>{const{key:n,handler:i,icon:r=o(Qt,null),...a}=e;return o(ie,Object.assign({onClick:e=>"function"==typeof i&&i({...u,record:t},n)},a),r)})))}return o(s,null,o(Pn,{isLoading:m}),o(be,{linkType:e=>!(!r||!Vn(e,a))&&"edit",primaryText:d,sx:t}))},Un=e=>{const t=C(e=>e.breakpoints.down("md")),{hasEdit:n}=pe(e);(e=>{const{onRenderGrilla:t,onLoadGrilla:o}=e,{isLoading:n}=J(),i=tn(e);c(()=>{t&&t(i)},[]),c(()=>{n||o&&o(i)},[n])})(e);const{desktopSize:i=!1}=e;return o(Ao,null,o(t&&!1===i?Gn:Hn,Object.assign({},e,{hasEdit:n})))},Jn=e=>{const{filterValues:t,setFilters:n,tabs:{ids:i,...r},GridComponent:a=Un,...l}=e,c=t.id;return o(s,null,o(to,{value:c,indicatorColor:"primary",onChange:(e,o)=>{n({...t,id:o})}},i.map(e=>o(eo,{key:e,label:e.charAt(0).toUpperCase()+e.slice(1),value:e}))),o(Xt,null),o(a,Object.assign({},l,r[c])))},Yn=e=>{const{useFormulario:t=en,...o}=e;return{fichaProps:{...t(o),etrs:o.etrs}}},Qn=(e,t)=>ve(e,{id:"-1"},t),Zn=e=>e.split("_")[1],Kn=/^\d{2}\/\d{2}\/\d{4}$/,Xn=e=>{if(!(e instanceof Date)||isNaN(e.getDate()))return"";const t=e.getFullYear().toString(),o=(e.getMonth()+1).toString(),n=e.getDate().toString();return`${t}-${("00"+o).slice(-2)}-${("00"+n).slice(-2)}`},ei=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Xn(e);if(Kn.test(e)){const t=e.split("/");return t[2]+"-"+t[1]+"-"+t[0]}return Xn(new Date(e))},ti=e=>{if(!e)return"";const t=e.split("-");return t[2]+"/"+t[1]+"/"+t[0]},oi=/^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/,ni=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Xn(e);if(oi.test(e)){const t=e.split(" "),o=t[0].split("/");return o[2]+"-"+o[1]+"-"+o[0]+" "+t[1]}return Xn(new Date(e))},ii=e=>{if(!e)return"";const t=e.split("T"),o=t[0].split("-");return o[2]+"/"+o[1]+"/"+o[0]+" "+t[1]},ri=e=>{if(!e)return"";if(e instanceof Date)return e.toString();if(-1!==e.indexOf(":")){const t=e.split(":");let o=new Date;return o.setHours(t[0]),o.setMinutes(t[1]),o.toString()}{const t=/(\d{2}):(\d{2})/.exec(e);if(null===t)return;let o=new Date;return o.setHours(t[0]),o.setMinutes(t[1]),o.toString()}},ai=(e,t)=>e?e.split(" ")[4].substring(0,5):"",li=e=>{const{source:t}=e,n=Jt(e=>{const o=e.configInputs?e.configInputs.filter(e=>e.id===t):[];return o[0]?o[0]:null}),{hidden:i}=n||{};return!i&&o(no,{variant:"h6",gutterBottom:!0,id:e.source},e.children)},si=({children:e,className:t,data:n,hasShow:i,hasList:r=!0,...a})=>o(ye,Object.assign({className:t},(({...e})=>e)(a)),e,r&&o(Ce,{label:"ra.action.back",icon:o(oo,null)}),i&&o(xe,{record:n})),ci=we(),di=[ci,ke(1)],ui={inputFormat:"dd/MM/yyyy"},mi=e=>(t,o)=>{const n=o[e];if(t&&n){const e=new Date(n.split("/").reverse().join("/")),o=new Date(t.split("/").reverse().join("/"));if(io(e,o))return{message:"validation.greater_or_equal",args:{menor:n}}}},pi=(e="es")=>({locale:"en"===e?ro:ao}),gi=[{id:"1",name:"Aprobado"},{id:"2",name:"Rechazado"},{id:"3",name:"Pendiente"}],fi=(e,t)=>{const o=document.createElement("a");o.style.display="none",document.body.appendChild(o),o.setAttribute("href",e),o.setAttribute("download",t),o.click()},hi=e=>{if(!e)return"";const[t,o,n]=e.split("/").map(Number);return new Date(n,o-1,t)},bi=e=>{if(!e)return"";const[t,o]=e.split(" "),[n,i,r]=t.split("/").map(Number),[a,l]=o.split(":").map(Number);return new Date(r,i-1,n,a,l)},vi=e=>e?`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${String(e.getFullYear())}`:"",yi=e=>e.toLocaleString("es",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).replace(",",""),Ci=(e,t)=>{const o=K(),{data:n,isLoading:i,error:r}=ve("cb_"+Zn(o)+"_"+e,{id:t});return i||r?"":(null==n?void 0:n.etiqueta)||""},xi={form:"FormEtriek-form",tab:"FormEtriek-tab",contenido:"FormEtriek-contenido"},wi=e=>({["& ."+xi.form]:{maxHeight:"70vh",overflow:"auto"},["& ."+xi.tab]:{display:"block",maxHeight:"65vh",overflow:"auto"},["& ."+xi.contenido]:{[e.breakpoints.up("xs")]:{width:"100%"},[e.breakpoints.up("md")]:{width:"12vw","&.MuiAutocomplete-root":{width:"16vw"}}}}),ki=()=>{},Ti=e=>{const{fichaProps:{onBeforeSubmitFicha:t}}=i(rn),o=on(e),n=Y(),{save:r}=Te(),a=l(async e=>{const i=t&&await t({form:{getValues:()=>e},...o},"N");return"string"==typeof i?void n(i,{type:"error"}):void 0===i||i?r(e):void 0},[t,n,ki,r]);return"function"==typeof t?a:void 0},Oi=e=>{const{useFormulario:t=en,enableLoad:n=!0,...i}=e,r=K(e),{data:l,isLoading:s}=Qn(r,{enabled:n}),{fichaProps:c}=Yn(e),d=a(()=>({estado:"N",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Lo,null,o(rn.Provider,{value:d},o(Oe,Object.assign({redirect:"list"},i,null==c?void 0:c.panel))))};Oi.propTypes={useFormulario:Ot.func};const Si=wt(Oi,{name:"FormEtriek",overridesResolver:(e,t)=>t.root})(({theme:e})=>wi(e));function Ri(e){var t,o,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=Ri(e[t]))&&(n&&(n+=" "),n+=o);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ei(){for(var e,t,o=0,n="";o<arguments.length;)(e=arguments[o++])&&(t=Ri(e))&&(n&&(n+=" "),n+=t);return n}const Pi=e=>{const t=q(),{resource:n,className:i,icon:r,label:a="ra.action.delete",...l}=e,s=re(),[c,{isLoading:d}]=Se(n,{id:s.id});return o(so,{title:t("ra.action.delete")},o(lo,Object.assign({disabled:d,onClick:()=>c(),label:a,className:Ei("ra-delete-button",i),key:"button"},(({...e})=>e)(l),{size:"large"}),r))};Pi.defaultProps={redirect:"list",icon:o(Nt,null)};const _i=e=>{const t={};for(const o in e)"string"==typeof e[o]&&0===e[o].trim().length||(null==e[o]&&(e[o]=""),t[o]=e[o]);return t},ji=wt(e=>{const{useFormulario:t=en,mutationMode:n="pessimistic",...i}=e,r=Re({mutationMode:n,...i}),{record:l,isLoading:s}=r,{fichaProps:c}=Yn(e),d=a(()=>({estado:"M",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Lo,null,o(rn.Provider,{value:d},o(Ee,Object.assign({mutationMode:n,transform:_i},i,null==c?void 0:c.panel))))},{name:"FormEtriek",overridesResolver:(e,t)=>t.root})(({theme:e})=>wi(e)),Ni=t((e,t)=>{const{isOpen:n,onSubmit:i,onClose:r,title:a,dialogText:l,children:s,hasAccept:c=!0,hasCancel:d=!0,isLoading:u=!1}=e,m=K(e),p=e=>{r&&r(e)};return o(It,{ref:t,open:n,fullWidth:!0,onClose:p,"aria-labelledby":"form-dialog-title"},o(Bt,{id:"form-dialog-title"},a),o(de,{resource:m,onSubmit:i},o(Lt,{dividers:!0},o(Dt,null,l),o(co,{sx:{mt:2}},s)),(c||d)&&o(Mt,null,d&&o(ie,{label:"ra.action.cancel",disabled:u,onClick:e=>p(e)},o(jt,null)),c&&o(ue,{alwaysEnable:!0,label:"Ok",disabled:u}))))}),Fi={},Ii={pointerEvents:"none",backgroundColor:"#ffffff",opacity:.6,position:"relative"},Mi=e=>{const t=Do(),n=K(e),{estado:r,isLoading:a,initialValues:l,fichaProps:s}=i(rn),d=nn({resource:n,etrs:s.etrs});return c(()=>{s.onRenderFicha&&s.onRenderFicha(d,r)},[]),c(()=>{a||s.onLoadFicha&&s.onLoadFicha(d,r,l)},[a]),o(M,{sx:{...e.sx,...t.open?Ii:Fi}},t.open&&o(L,{sx:{position:"absolute",left:"50%",top:"50%"},thickness:4,size:50}),e.children)},Li=e=>{const{initialValues:t,fichaProps:{config:n={}}}=i(rn),r=Ti(e);return t?o(Pe,Object.assign({mode:"onBlur"},e,{onSubmit:r,defaultValues:t,component:Mi},n)):null};Li.propTypes={...Pe.propTypes};const Di=e=>{const{handleToggle:t,isOpen:n,name:i,icon:r,children:a,dense:l}=e,s=q(),[c]=_e(),d=o(b,{dense:l,onClick:t},o(v,{sx:{minWidth:5}},n?o(uo,null):r),o(x,{variant:"inherit",color:"textSecondary"},s(i)));return o("div",null,c||n?d:o(j,{title:s(i),placement:"right"},d),o(D,{in:n,timeout:"auto",unmountOnExit:!0},o(B,{dense:l,component:"div",disablePadding:!0,sx:{paddingLeft:(e.children.props.children[0]?e.children.props.children[0].key:"").startsWith("menu")?2:0,backgroundColor:e=>Tt(e.palette.secondary.light,.24),"& a":{transition:"padding-left 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",paddingLeft:c?4:2}}},a)))},Bi=e=>{const{items:t,translate:n,...i}=e,{state:r,handleToggle:a,dense:l}=i;return t&&o("div",null,t.map(e=>{const{name:t,menu:s,label:c,icon:d="settings"}=e;return s?o(Di,{key:t,name:c,handleToggle:()=>a(t),isOpen:r[t],icon:o(Qt,null),dense:l},Bi({items:s,translate:n,...i})):o(je,{key:t,to:"/"+t,primaryText:n(`resources.${t}.name`,{_:c}),dense:l,leftIcon:o(Qt,null)})}))},Ai=({dense:e=!1})=>{const t=q(),[n,i]=r({mnuPrueba:!1}),a=C(e=>e.breakpoints.down("sm")),[l]=_e(),s=JSON.parse(localStorage.getItem("menus")),c=Bi({items:s,handleToggle:e=>{i(t=>({...t,[e]:!t[e]}))},state:n,activeClassName:"",iconClass:"",className:"",open:l,dense:e,translate:t});return o(w,{sx:{width:l?230:50,marginTop:1,marginBottom:1,transition:e=>e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}},o(Ne,null,o(Fe,{primaryText:t("ra.page.dashboard")}),c,a&&o(je,{to:"/configuration",primaryText:t("pos.configuration"),leftIcon:o(Qt,null),dense:e})))};var Vi=e=>o(Ie,Object.assign({},e,{appBar:Io,menu:Ai}));const qi=(e,t)=>{alert("Falta implementar la función jsBotonGrilla")},zi=e=>{const{className:t,filters:n,children:r,hideFilterButton:l=!1,jsBotonGrilla:s=qi,...c}=e,{sort:m,displayedFilters:p,filterValues:g,exporter:f,showFilter:h,total:b}=J(e),v=K(e),{hasCreate:y}=pe(e),C=i(Me)||n,x=J(e),w={...tn(e),...x};return delete c.hasCreate,a(()=>o(ye,Object.assign({className:t},Le(c)),l?null:n?u(n,{resource:v,showFilter:h,displayedFilters:p,filterValues:g,context:"button"}):C&&o(De,null),y&&o(Be,null),!1!==f&&o(Ae,{disabled:0===b,resource:v,sort:m,filterValues:g}),d.map(r,(e,t)=>u(e,{onClick:e.props.options?null:t=>{e.props.onClick&&e.props.onClick(t),s(w,e.key)},options:e.props.options?e.props.options.map(t=>({...t,onClick:o=>{e.props.onClick&&e.props.onClick(o),s(w,t.key)}})):null}))),[v,p,g,n,h,C,b,t,m,l,f,y])},$i=e=>{const{loginBackgroundImage:t,nameSource:n="username",passwordSource:i="password"}=e,[a,l]=r(!1),s=q(),c=s("ra.auth.sign_in"),d=Y(),u=Ve(),m=bt();return o(de,{onSubmit:e=>{l(!0),u(e,m.state?m.state.nextPathname:"/").catch(e=>{l(!1),d("string"==typeof e?e:void 0!==e&&e.message?e.message:"ra.auth.sign_in_error",{type:"error",messageArgs:{_:"string"==typeof e?e:e&&e.message?e.message:void 0}})})},validate:e=>{const t={};return e[n]||(t[n]=s("ra.validation.required")),e[i]||(t[i]=s("ra.validation.required")),t}},o(w,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",alignItems:"center",justifyContent:"flex-start",backgroundImage:t,backgroundRepeat:"no-repeat",backgroundSize:"cover"}},o(go,{sx:{minWidth:300,marginTop:"6em"}},o(w,{sx:{margin:"1em",display:"flex",justifyContent:"center"}},o(mo,{sx:{backgroundColor:"secondary.main"}},o(f,null))),o(w,{sx:{marginTop:"1em",marginBottom:"1em",display:"flex",justifyContent:"center",color:"grey.600"}},"Inicio de Sesión"),o(w,{sx:{padding:"0 1em 1em 1em"}},o(w,{sx:{marginTop:0}},o(qe,{autoFocus:!0,fullWidth:!0,name:n,label:s("ra.auth.username"),disabled:a})),o(w,{sx:{marginTop:0}},o(ze,{name:i,label:s("ra.auth.password"),type:"password",disabled:a}))),o(fo,{sx:{padding:"0 1em 1em 1em"}},o(po,{variant:"contained",type:"submit",color:"primary",disabled:a,fullWidth:!0},a&&o(ho,{sx:{position:"absolute"},size:18,thickness:2}),c)))))},Wi=e=>{var t;const{options:n=[],icon:i,label:a,disabled:l,...s}=e,[c,d]=r(!1),u=p(),[m,g]=r(0),f=K(e);return o(w,Object.assign({sx:{display:"inline-block"}},(({...e})=>e)(s)),o(ie,{size:"large",className:"add-filter",label:a,onClick:e=>{e.preventDefault(),d(!0),u.current=e.currentTarget},title:n[m].label,disabled:l},(null===(t=n[m])||void 0===t?void 0:t.icon)||i),o(bo,{open:c,anchorEl:u.current,onClose:e=>{u.current&&u.current.contains(e.target)||d(!1)}},n.map((e,t)=>o(vo,{key:e.label,disabled:e.disabled,selected:t===m,onClick:o=>{((e,t)=>{g(t),d(!1)})(0,t),e.onClick&&e.onClick(o,t)},resource:f,title:e.label},e.icon,o(w,{component:"span",sx:{paddingRight:"4px"}}),o($e,{label:e.label,resource:f})))))},Hi=e=>{const{fields:t,className:n,...i}=e,{campos:r,separador:a="",secundario:l=[],hasSecundario:s}=t,c=re(),d=r.map(e=>void 0!==c[e]?c[e]:e).join(""+a);return o(no,Object.assign({noWrap:!0,variant:"inherit",className:n},i),d,s&&o(no,{component:"span",display:"block",color:"textSecondary",variant:"caption"},l.map(e=>`${e.etiqueta||"---"}: ${c[e.campo]||"---"}`).join(" ")))},Gi=wt(e=>{const{useFormulario:t=en,...n}=e,i=We(n),{record:r,isLoading:l}=i,{fichaProps:s}=Yn(e),c=a(()=>({estado:"M",initialValues:r,isLoading:l,fichaProps:s}),[r,l,s]);return o(Lo,null,o(rn.Provider,{value:c},o(He,Object.assign({},n,i,null==s?void 0:s.panel))))},{name:"FormEtriek",overridesResolver:(e,t)=>t.root})(({theme:e})=>wi(e)),Ui=e=>{const{icon:t=Yi,label:n="ra.action.show",scrollToTop:i=!0,...r}=e,a=K(e),l=re(e),s=me();return l?o(_n,Object.assign({component:ht,to:s({type:"show",resource:a,id:l.id}),state:Ji[String(i)],label:n,onClick:Qi},r),t):null},Ji={true:{_scrollToTop:!0},false:{}},Yi=o(yo,null),Qi=e=>e.stopPropagation();Ui.propTypes={icon:Ot.element,label:Ot.string,record:Ot.any,scrollToTop:Ot.bool};const Zi=g(Ui,(e,t)=>e.resource===t.resource&&(e.record&&t.record?e.record.id===t.record.id:e.record==t.record)&&e.label===t.label&&e.disabled===t.disabled),Ki=e=>{const{children:t,className:n,component:a=er,formRootPathname:l,syncWithLocation:s=!0,tabs:c=Xi,toolbar:p=tr,onChange:g,...f}=e,h=bt(),b=yt(""),v=K(e),[y,C]=r(0),{fichaProps:{etrs:x}}=i(rn),w=nn({...e,etrs:x}),{estado:k}=i(rn),T=(e,t)=>{s||(C(t),g&&g(w,k,{newTab:t,prevTab:y,setTab:C},e))},O=()=>u(c,{onChange:T,syncWithLocation:s,url:l,value:y},t);return o(or,Object.assign({className:Ei("tabbed-form",n)},nr(f)),s?o(Ct,null,o(xt,{path:"/*",element:O()})):O(),o(A,null),o(a,null,d.map(t,(e,t)=>{if(!e)return null;const o=Ue(e,t),n=s?!vt(`${b.pathname}/${o}`,h.pathname):y!==t;return m(e)?u(e,{intent:"content",resource:v,hidden:n,value:s?o:t}):null})),!1!==p?p:null)},Xi=o(Je,null),er=({children:e})=>o(M,null,e),tr=o(Ye,null),or=wt("div",{name:"RaTabbedForm",overridesResolver:(e,t)=>t.root})(({theme:e})=>({"& .MuiTab-root.RaTabbedForm-errorTabButton":{color:e.palette.error.main}})),nr=({...e})=>e,ir=e=>{const{...t}=e,n=(()=>{const e=bt(),t=vt(":resource/create/*",e.pathname),o=vt(":resource/:id/*",e.pathname);return t?t.pathnameBase:o?o.pathnameBase:""})();return o(de,Object.assign({formRootPathname:n},t),o(Ki,Object.assign({formRootPathname:n},rr(e))))};ir.Tab=Ge;const rr=({...e})=>e,ar=e=>{const{initialValues:t,fichaProps:{config:n={}}}=i(rn),r=Ti(e);return t?o(ir,Object.assign({mode:"onBlur"},e,{onSubmit:r,defaultValues:t,component:Mi},n)):null};ar.defaultProps={syncWithLocation:!1};const lr={...Qe,palette:{...Qe.palette,mode:"dark"},components:{...Qe.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}};var sr={__proto__:null,lightTheme:{...Qe,palette:{...Qe.palette,mode:"light"},components:{...Qe.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}},darkTheme:lr};Co.ra.page.empty="No records yet";const cr={...Co,from_camera:"From camera",take_foto:"Take photo",login:{id:"ID",hint:"Login",required:"Insert Username or ID",send:"Send",email:"Enter your email address",check_email:"Check your email inbox, we just send you a verification code!",must_enter_credentials:"You must first enter Username or ID",restore_password:"Restore Password",punch_in:"Punch In"},pos:{search:"Search",change_pin:"Change Pin",change_password:"Change Password",configuration:"Configuration",language:"Language",theme:{name:"Theme",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Welcome",subtitle:"Employee Management",aor_button:"Metiri WebSite"}}},validation:{greater_or_equal:"Must be greater than or equal to %{menor}"}};xo.ra.notification.created="Datos guardados correctamente",xo.ra.action.bulk_actions="1 seleccionado |||| %{smart_count} seleccionados",xo.ra.page.dashboard="Inicio",xo.ra.page.empty="Sin registros todavía",xo.ra.page.invite="¿Quiere agregar uno?",xo.ra.page.list="%{name}",xo.ra.page.edit="Editar %{name}",xo.ra.action.back="Volver",xo.ra.message.delete_title="Eliminar",xo.ra.input.file.upload_single="Seleccione o arrastre archivo",xo.ra.input.image.upload_single="Seleccione o arrastre imagen";const dr={...xo,from_camera:"Desde camara",take_foto:"Tomar foto",login:{id:"Cédula",hint:"Inicio de Sesión",required:"Ingrese Usuario o Cédula",email:"Ingrese su email aquí",send:"Enviar",check_email:"Revisa tu correo electrónico, te enviaremos un código de verificación!",must_enter_credentials:"Debe ingresar Nº de Usuario o Cédula y Contraseña primero",restore_password:"Restablecer Contraseña",punch_in:"Generar Marcas"},pos:{search:"Búsqueda",change_pin:"Cambiar Pin",change_password:"Cambiar Contraseña",configuration:"Configuración",language:"Lenguaje",theme:{name:"Tema Visual",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Bienvenid@",subtitle:"Gestión de Funcionarios",aor_button:"Sitio de Metiri"}}},validation:{greater_or_equal:"Debe ser mayor o igual a %{menor}"}},ur=e=>{const{propsContenido:t,hidden:n}=ln(e),i=re(),r=JSON.parse(JSON.stringify(i)),a=r[e.source];return r[e.source]=""!=a&&"0"!=a,!n&&o(Ze,Object.assign({},t,{record:r}))},mr=t=>{const[o,n]=r(!1),[i,a]=r(!1),l=Y(),d=q(),{field:u,sx:m}=t;return c(()=>{o&&(async()=>{let e=null;try{e=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1}),document.getElementById("video").srcObject=e}catch(e){l(e.message,{type:"error"})}})()},[o]),e.createElement(s,null,e.createElement(ce,{isOpen:o,loading:!o,maxWidth:"sm",title:"",content:e.createElement(w,{display:"flex",flexDirection:"column"},e.createElement(V,{variant:"outlined",disableElevation:!0,onClick:()=>{const e=document.getElementById("video"),t=document.getElementById("canvas");t.getContext("2d").drawImage(e,0,0,t.width,t.height),a(!0)},startIcon:e.createElement(ko,null)},d("take_foto")),e.createElement("video",{id:"video",width:"320",height:"240",autoPlay:!0,style:{border:"solid 1px"}}),e.createElement("div",{id:"dataurl-container",style:{border:"dotted 1px",width:320,height:240,marginTop:4}},e.createElement("canvas",{id:"canvas",width:"320",height:"240"}))),onConfirm:e=>{i&&document.getElementById("canvas").toBlob(function(e){const t=document.getElementById("video"),o=document.getElementById(u),i=new DataTransfer;let r=new File([e],u+"-img.jpg",{type:"image/jpeg",lastModified:(new Date).getTime()});i.items.add(r),o.files=i.files,o.dispatchEvent(new Event("change",{bubbles:!0})),t.srcObject.getTracks().forEach(e=>e.stop()),a(!1),n(!1)},"image/jpeg")},onClose:()=>{a(!1),n(!1)}}),e.createElement(so,{title:d("from_camera")},e.createElement(V,{sx:m,onClick:()=>{n(!0)}},e.createElement(To,null))))},pr=e=>{const{source:t}=e,{estado:o,isLoading:n,fichaProps:r={}}=i(rn),a=i(an),l=void 0!==a,s=Jt(e=>{const o=e.configInputs?e.configInputs.filter(e=>e.id===t):[];return o[0]?o[0]:null}),{disabled:c,hidden:d,required:u,error:m}=s||{},g=!0===u?ci:void 0,f="function"==typeof m?m:()=>m,{[t]:h={},etrs:b}=r,{onFocus:v,onChange:y,onBlur:C,hidden:x=!1,disabled:w=!1,validate:k,...T}=e,{field:O}=ae(e),{onFocus:S,onBlur:R,onChange:E,hidden:P,disabled:_,useContenido:j=en,validate:N,...F}=h,I=l||void 0===P?x:P,M=l||void 0===_?w:_,L=l||void 0===S?v:S,D=l||void 0===R?C:R,B=l||void 0===E?y:E,A=nn({...e,etrs:b,asisEtr:a}),V=j({...T,estado:o,hidden:I,isLoading:n,utils:A,...F}),q=p(O.value);if(void 0===V)throw new Error(`useContenido está devolviendo undefined para el contenido ${t}\n Asegúrese de incluir una instrucción return al final de la función`);const{hidden:z,disabled:$,onFocus:W,onChange:H,onBlur:G,validate:U,...J}=V,Y=W||L,Q=G||D,Z=H||B,K={...A,prev:q.current};return{propsContenido:{sx:{mt:1,mb:1,ml:{xs:0,md:1},mr:{xs:0,md:1}},onFocus:e=>{Y&&L(A,o,e),q.current=e.target.value},onBlur:e=>Q&&Q(K,o,e),onChange:e=>Z&&Z(K,o,e),helperText:!1,validate:[...Array.isArray(k)?k:[k],...Array.isArray(N)?N:[N],...Array.isArray(U)?U:[U],g,f].filter(e=>void 0!==e),...T,...F,...J,disabled:void 0!==c?c:void 0!==$?$:M},hidden:void 0!==d?d:void 0!==z?z:I}},gr=(e,t)=>e&&""!==e?"string"==typeof e?{src:`${t}/${e}`}:e instanceof Array?e.map(e=>({src:`${t}/${e}`})):e:void 0,fr=e=>{const{propsContenido:t,hidden:n}=pr(e),i=q(),r=C(e=>e.breakpoints.down("sm")),{options:a={},disabled:l=!1,tipo:s="file",prefix:c,...d}=t;return!n&&("image"===s?o(wo,{direction:"row",alignItems:"flex-start",justifyContent:"flex-start",divider:o(Xt,{orientation:"vertical",variant:"middle",flexItem:!0})},o(Ke,Object.assign({maxSize:5e6},d,{options:{disabled:l,...a},format:e=>gr(e,c),placeholder:i("ra.input.image.upload_single"),accept:"image/*",inputProps:{capture:"user"}}),o(Xe,{source:"src",title:""})),!r&&o(mr,{sx:{mt:3},field:d.source})):o(et,Object.assign({maxSize:5e6},d,{options:{disabled:l,...a},format:e=>gr(e,c),placeholder:i("ra.input.file.upload_single")}),o(tt,{download:!0,source:"src",title:"Ver adjunto",target:"_blank"})))},hr=e=>{const{propsContenido:{sx:t,...n},hidden:i}=pr(e);return!i&&o(ot,Object.assign({},n,{sx:{...t,display:"inline-flex",margin:1}}))},br=t((e,t)=>o(j,Object.assign({ref:t},e))),vr=e=>{var t;const{callback:n,sx:i,isTC:r,onChange:a,...l}=e,{isLoading:s,allChoices:d}=it(),u=p(null);return c(()=>{s||"function"==typeof n&&n(Object.values([d]))},[d,n,s]),o(br,{title:(null===(t=u.current)||void 0===t?void 0:t.value)||"",placement:"top",arrow:!0},o(w,{component:"span",sx:r?{margin:1,...i}:{display:{xs:"inherit",md:"inline-flex"},margin:1,...i},width:r?{}:{xs:"100%",md:"auto"}},o(rt,Object.assign({size:"small",sx:r?{width:"100% !important"}:{}},l,{onChange:e=>{a({target:{value:e}})},TextFieldProps:{inputRef:u}}))))},yr=e=>{const{propsContenido:t,hidden:n}=pr(e),i=Ut(),{source:r,reference:a}=e,l=Jt(e=>{const t=e.reload_cb?e.reload_cb.filter(e=>e.id===r):[];return t[0]?t[0]:null}),s=p(l),d=null===l&&s.current?s.current:l;let u,m;if(d){const{callback:e,...t}=d;u=e,m=t}return c(()=>{null!==l&&(s.current=l,i(zo(r)))},[JSON.stringify(l)]),n?null:o(nt,{reference:a,source:r,perPage:500,filter:m},o(vr,Object.assign({},t,{callback:u,optionText:"etiqueta",optionValue:r})))},Cr=e=>{const{propsContenido:t,hidden:n}=pr(e);return!n&&o(at,t)},xr=e=>{const{title:t,source:n,src:i}=e,r=re(e);return o(mo,{title:t,src:`${i}/${r[n]}`})},wr=e=>{const{propsContenido:t,hidden:n}=pr(e),{source:i,reference:r}=e;return n?null:o(lt,{source:i,reference:r},o(st,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},kr=e=>{const{propsContenido:t,hidden:n}=pr(e);return!n&&o(ze,t)},Tr=e=>{const{propsContenido:t,hidden:n}=pr(e),{isLoading:r}=i(rn),{source:a,reference:l}=e;return r||n?null:o(nt,{source:a,reference:l},o(ct,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},Or=e=>{const{propsContenido:t,hidden:n}=pr(e);return!n&&o(ct,t)},Sr=e=>o(_o,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(I,e)),Rr={cursor:"move"},Er=e=>{const{isOpen:t,isLoading:n,title:i,content:r,cancel:a,ConfirmIcon:s,CancelIcon:c,onClose:d,onConfirm:u,contentResource:m,translateOptions:p={}}=e,g=q(),[f]=dt(m),h=l((e,t)=>{e.stopPropagation(),u(e,f)},[f,u]),b=l(e=>{e.stopPropagation()},[]);return o(It,{open:t,onClose:d,onClick:b,fullWidth:!0,maxWidth:"lg",PaperComponent:Sr,"aria-labelledby":"draggable-dialog-title"},o(Bt,{style:Rr,id:"draggable-dialog-title"},g(i,{_:i,...p})),o(Lt,{dividers:!0},r),o(Mt,null,o(po,{disabled:n,onClick:d},o(c,{sx:{paddingRight:"0.5em"}}),g(a,{_:a})),o(po,{disabled:n,onClick:e=>h(e,"yes"),autoFocus:!0},o(s,{sx:{paddingRight:"0.5em"}}),g("ra.action.confirm"))))};Er.propTypes={cancel:Ot.string,classes:Ot.object,confirm:Ot.string,confirmColor:Ot.string,ConfirmIcon:Ot.elementType,CancelIcon:Ot.elementType,content:Ot.node.isRequired,isOpen:Ot.bool,isLoading:Ot.bool,onClose:Ot.func.isRequired,onConfirm:Ot.func.isRequired,title:Ot.string.isRequired},Er.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:Eo,CancelIcon:Po,isOpen:!1};const Pr=()=>o(s,null),_r={seleccion:[],all:!0,none:!1},jr=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,Nr=e=>e,Fr=e=>{const{disabled:t,asistant:n,asistantResource:i,label:a,source:d,sx:u,...m}=e,[p,g]=r(!1),f=Ht();c(()=>{b()},[]);const h=l(()=>{g(!1)},[g]),b=e=>{f.setValue(d,{seleccion:[],all:!0,none:!1})};return o(s,null,o(w,{display:"flex",alignItems:"center",sx:{...u,display:"inline-flex",margin:1}},o(qe,Object.assign({defaultValue:_r},m,{source:d,label:a,disabled:!0,parse:Nr,format:jr,helperText:!1,InputProps:{endAdornment:o(s,null,o(lo,{onClick:e=>{f.setValue(d,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(So,null)),o(lo,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(Oo,null)),o(lo,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(Ro,null)))}}))),o(Er,{isOpen:p,title:"Selección de "+a,contentResource:i,content:o(n,{bulkActionButtons:o(Pr,null),hasCreate:!1,exporter:!1,resource:i}),onConfirm:(e,t)=>{g(!1),f.setValue(d,{seleccion:t,all:!1,none:!1})},onClose:h}))},Ir=e=>o(ut,Object.assign({},e,{hasCreate:!1,exporter:!1,perPage:50,empty:!1,title:" ",disableSyncWithLocation:!0}),o(mt,{bulkActionButtons:o("span",null)},o(oe,{source:"funced",sortable:!0,label:"Cédula"}),o(oe,{source:"funpriape",sortable:!0,label:"Apellido"}),o(oe,{source:"funprinom",sortable:!0,label:"Nombre"}))),Mr={fillista:"empcod=-1"},Lr=e=>{const[t,n]=r(Mr),i=U(),a=l(e=>{n({fillista:e.node.key})},[n]),s=l(e=>i.getChildNodes("form_224",{parentId:e?e.itemData.id:""}).then(e=>e.data).catch(()=>{throw new Error("Data Loading Error")}),[i]);return o(w,{display:"flex",flex:1,alignItems:"flex-start",height:"20em"},o(w,{flexGrow:1},o(jo,{id:"funcionarios-treeview",dataStructure:"plain",rootValue:"",onItemClick:a,createChildren:s})),o(w,{flexGrow:2},o(Ir,{resource:"form_224",filter:t})))},Dr=e=>o(_o,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(I,e)),Br={cursor:"move"},Ar=e=>{const{isOpen:t,isLoading:n,title:i,cancel:r,ConfirmIcon:a,CancelIcon:s,onClose:c,onConfirm:d,translateOptions:u={}}=e,m=q(),p=l((e,t)=>{e.stopPropagation(),d(e,t)},[d]),g=l(e=>{e.stopPropagation()},[]);return o(It,{open:t,onClose:c,onClick:g,fullWidth:!0,maxWidth:"lg",PaperComponent:Dr,"aria-labelledby":"draggable-dialog-title"},o(Bt,{style:Br,id:"draggable-dialog-title"},m(i,{_:i,...u})),o(Lt,{dividers:!0},o(Lr,null)),o(Mt,null,o(po,{disabled:n,onClick:c},o(s,{sx:{paddingRight:"0.5em"}}),m(r,{_:r})),o(po,{disabled:n,onClick:e=>p(e,"yes"),autoFocus:!0},o(a,{sx:{paddingRight:"0.5em"}}),m("ra.action.confirm"))))};Ar.propTypes={cancel:Ot.string,classes:Ot.object,confirm:Ot.string,confirmColor:Ot.string,ConfirmIcon:Ot.elementType,CancelIcon:Ot.elementType,isOpen:Ot.bool,isLoading:Ot.bool,onClose:Ot.func.isRequired,onConfirm:Ot.func.isRequired,title:Ot.string.isRequired},Ar.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:Eo,CancelIcon:Po,isOpen:!1};const Vr={seleccion:[],all:!0,none:!1},qr=e=>String(e)===e?"Selección (1)":!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,zr=e=>e,$r=e=>{const{disabled:t,label:n="Funcionarios",allowNone:i=!0,source:a,sx:d,...u}=e,[m]=dt("form_224"),[p,g]=r(!1),f=Ht();c(()=>{b()},[]);const h=l(()=>{g(!1)},[g]),b=e=>{f.setValue(a,{seleccion:[],all:!0,none:!1})};return o(s,null,o(w,{display:"flex",alignItems:"center",sx:{...d,display:"inline-flex",margin:1}},o(qe,Object.assign({defaultValue:Vr},u,{source:a,label:n,disabled:!0,parse:zr,format:qr,helperText:!1,InputProps:{endAdornment:o(s,null,i&&o(lo,{onClick:e=>{f.setValue(a,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(So,null)),o(lo,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(Oo,null)),o(lo,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(Ro,null)))}}))),o(Ar,{isOpen:p,title:"Selección de "+n,onConfirm:(e,t)=>{g(!1),f.setValue(a,{seleccion:m,all:!1,none:!1})},onClose:h}))},Wr=e=>{const{propsContenido:t,hidden:n}=pr(e);return!n&&o(qe,Object.assign({multiline:!0},t))},Hr=e=>{const{tipo:t,...n}=e,{propsContenido:i,hidden:r}=pr(n),a=Ht();c(()=>{i.value&&a.setValue(e.source,i.value)});const l={...i};return r?null:"N"===t||"D"===t?o(pt,l):"F"===t?o(gt,l):"Z"===t?o(ft,l):o(qe,"H"===t?Object.assign({},l,{type:"time"}):l)},Gr=e=>{const{source:t,label:n,sx:i}=e,{hidden:r}=pr(e);return r?null:o(w,{sx:{...i,display:"inline-flex",alignItems:"flex-start",marginLeft:1,marginBottom:-1,width:{xs:"100%",md:"calc(24vw + 1em)"}}},o(qe,Object.assign({},e,{label:"",source:t,sx:{flex:1,marginTop:1}})),o(yr,Object.assign({},e,{source:t,label:n,isTC:!0,sx:{flex:3}})))};export{Io as AppBar,Pn as Asistente,Vo as AsistenteContext,ur as BooleanField,fr as Camino,hr as CheckBox,yr as ComboBox,Cr as ComboBoxManual,Si as CreateEtriek,Mn as CreateGridButton,Pi as DeleteButtonNoWarning,ji as EditEtriek,An as EditGridButton,Sn as EtrGrid,si as FichaActions,rn as FichaContext,Ar as FiltroFuncionarios,xi as FormClasses,Ni as FormDialog,Li as FormEtriek,En as GE,_n as GridButton,Un as GrillaEtriek,xr as ImageField,Vi as Layout,zi as ListActionsEtriek,wr as ListCheck,$i as Login,Ai as Menu,Wi as MenuButton,Hi as MultiTextField,kr as Password,Tr as RadioButton,Or as RadioButtonManual,li as Separador,Gi as ShowEtriek,Zi as ShowGridButton,Di as SubMenu,$r as TBSF,ar as TabbedFormEtriek,Jn as TabbedGrillaEtriek,Wr as TextArea,Hr as TextBox,Fr as TextBoxSelection,Gr as TextCombo,sn as TextField,gi as choicesEstado,ei as dateFormat,ui as dateFormatOptions,ti as dateParser,ni as dateTimeFormat,ii as dateTimeParser,yi as dateTimeToString,vi as dateToString,zo as deleteRecargarComboBox,fi as descargarLink,cr as enMessages,dr as esMessages,mi as etrFechaMayorQue,ci as etrRequerido,di as etrRequeridoNumerico,Zn as getFormcodFromResource,pi as localeOptions,qo as recargarComboBox,cn as renderCellComboBox,Wo as setDisableAction,Go as setErrorAction,$o as setHiddenAction,Ho as setRequireAction,hi as stringToDate,bi as stringToDateTime,sr as themes,ri as timeFormat,ai as timeParser,Xo as useAjax,pr as useContenidoController,gn as useEtrActions,ln as useFieldController,Do as useFormProgress,Ti as useFormSubmit,Ko as useGetJson,Yn as useInitFicha,Qn as useNuevo,Ci as useReferenceLabel,nn as useUtils,tn as useUtilsGrilla,on as useUtilsSubmit};
2
2
  //# sourceMappingURL=index.modern.js.map