import{a0 as E,y as L,a7 as q,bh as M,bE as D,bi as _,r as a,g6 as P,bv as j,j as t,a9 as A,m as $,g7 as O,l as x,dA as Q,S as H,z as R,_ as T,B as I,i as N,a$ as U}from"./index-cc84e56a.js";import{N as Z}from"./NoRowsComponent-73b1b6ea.js";import{C as W}from"./Card-ecc10a21.js";import{C as J}from"./CardHeader-ce2759f4.js";const K=["quickFilterParser","quickFilterFormatter","debounceMs"],X=E(L,{name:"MuiDataGrid",slot:"ToolbarQuickFilter",overridesResolver:(e,s)=>s.toolbarQuickFilter})(({theme:e})=>({width:"auto",paddingBottom:e.spacing(.5),"& input":{marginLeft:e.spacing(.5)},"& .MuiInput-underline:before":{borderBottom:`1px solid ${e.palette.divider}`},"& input[type=search]::-ms-clear,\n& input[type=search]::-ms-reveal":{display:"none",width:0,height:0},'& input[type="search"]::-webkit-search-decoration,\n  & input[type="search"]::-webkit-search-cancel-button,\n  & input[type="search"]::-webkit-search-results-button,\n  & input[type="search"]::-webkit-search-results-decoration':{display:"none"}})),Y=e=>e.split(" ").filter(s=>s!==""),ee=e=>e.join(" ");function te(e){var s;const{quickFilterParser:c=Y,quickFilterFormatter:u=ee,debounceMs:d=500}=e,g=q(e,K),l=M(),o=D(),r=_(l,O),[m,i]=a.useState(()=>u(r??[])),[k,p]=a.useState(r);a.useEffect(()=>{P(k,r)||(p(r),i(n=>P(c(n),r)?n:u(r??[])))},[k,r,u,c]);const h=a.useCallback(n=>{l.current.setQuickFilterValues(c(n))},[l,c]),S=a.useMemo(()=>j(h,d),[h,d]),f=a.useCallback(n=>{const b=n.target.value;i(b),S(b)},[S]),v=a.useCallback(()=>{i(""),h("")},[h]);return t(X,A({as:o.components.BaseTextField,ownerState:o,variant:"standard",value:m,onChange:f,placeholder:l.current.getLocaleText("toolbarQuickFilterPlaceholder"),"aria-label":l.current.getLocaleText("toolbarQuickFilterLabel"),type:"search",InputProps:{startAdornment:t(o.components.QuickFilterIcon,{fontSize:"small"}),endAdornment:t($,{"aria-label":l.current.getLocaleText("toolbarQuickFilterDeleteIconLabel"),size:"small",sx:{visibility:m?"visible":"hidden"},onClick:v,children:t(o.components.QuickFilterClearIcon,{fontSize:"small"})})}},g,(s=o.componentsProps)==null?void 0:s.baseTextField))}var re=(e=>(e[e.IZQUIERDA=0]="IZQUIERDA",e[e.DERECHA=1]="DERECHA",e))(re||{});const ne=({itemsSinTransferir:e,itemsTransferidos:s,transferirItems:c,itemsLoading:u,deshabilitaAcciones:d,columns:g,columnsTransferidos:l,titulos:o,height:r,cantidadFilasDefault:m})=>{const[i,k]=a.useState([]),[p,h]=a.useState([]),S=()=>{i.length>=1?c(i,1):T.error("Seleccione al menos una opción para transferir")},f=()=>{p.length>=1?c(p,0):T.error("Seleccione al menos una opción para transferir")},[v,n]=a.useState(m!==void 0?m:5),b=(F,C,V,z,G)=>x("div",{children:[t(W,{variant:"outlined",style:{width:"auto",marginBottom:"5px"},children:t(J,{sx:{px:2,py:1,width:"100%"},title:F,subheader:`${V}/${C.length} seleccionados`,titleTypographyProps:{fontSize:"15px"},subheaderTypographyProps:{fontSize:"13px"}})}),t(I,{sx:{width:"100%",height:N.isTruthy(r)?r:"300px"},children:t(U,{columns:G,rows:C,rowsPerPageOptions:[5,10,20,50,100],pageSize:v,onPageSizeChange:y=>n(y),density:"compact",checkboxSelection:!0,style:{backgroundColor:"white"},isRowSelectable:()=>!z,onSelectionModelChange:y=>{const w=y.map(B=>B.toString());F===o.sinTransferir?k(w):h(w)},components:{NoRowsOverlay:Z,Toolbar:ae},loading:u,componentsProps:{toolbar:{showQuickFilter:!0,quickFilterProps:{debounceMs:500}}},sx:{"& .MuiDataGrid-cell--textRight":{fontFamily:"monospace"}}})})]});return x("div",{style:{display:"grid",gridTemplateColumns:"1fr max-content 1fr",alignItems:"center",columnGap:"10px"},children:[u?x("div",{children:[t(Q,{variant:"rounded",height:52,style:{marginBottom:"5px"}}),t(Q,{variant:"rounded",height:298})]}):t("div",{children:b(o.sinTransferir,e,i.length,d,g)}),t("div",{children:x(H,{container:!0,direction:"column",alignItems:"center",children:[t(R,{sx:{my:.5},variant:"outlined",size:"small",onClick:S,disabled:i.length===0||d,"aria-label":"move selected right",children:">"}),t(R,{sx:{my:.5},variant:"outlined",size:"small",onClick:f,disabled:p.length===0||d,"aria-label":"move selected left",children:"<"})]})}),t("div",{children:b(o.transferidos,s,p.length,d,l??g)})]})},ae=()=>t(I,{sx:{p:.5,pb:0},children:t(te,{style:{width:"100%"}})});export{re as D,te as G,ne as O};
