import{j as C}from"./index.e0fdfdc6.js";import{u as K}from"./ScrollTo.81bea8a7.js";import{Y as t,W as M,f as U}from"./runtime-core.esm-bundler.ce5add0b.js";const z=(h={})=>{const{changeItemsPerPageSlug:c,fetchData:P,orderBy:b,orderDir:y,pageNumber:T,resetSelectedFilters:_=()=>{},resultsPerPage:m,selectedFilters:S,slug:D,tableId:F,tableRef:i,wpTableLoading:L}=h,v=t("all"),o=b||t(null),f=y||t(null),a=T||t(1),s=t(m||20),u=t(null),p=S||t(null),x=t(0),l=L||t(!1),g=C(),A=K().scrollTo,B=()=>(l.value=!0,r().then(()=>{l.value=!1,i==null||i.editRow(null)})),I=({filters:e,term:n=null,number:R=null})=>{l.value=!0,p.value=e,u.value=n??u.value,a.value=R??a.value,r(e).then(()=>l.value=!1)},w=e=>{var n;typeof e=="object"&&(e=(n=e==null?void 0:e.target)==null?void 0:n.value),a.value=1,u.value=e,l.value=!0,r().then(()=>l.value=!1)},W=e=>{a.value=e,l.value=!0,r().then(()=>l.value=!1)},j=e=>{v.value=e.slug,u.value=null,a.value=1,l.value=!0,_(),r().then(()=>l.value=!1)},N=e=>{a.value=1,s.value=e,l.value=!0,g.changeItemsPerPage({slug:c,value:e}).then(()=>r().then(()=>A(F))).then(()=>l.value=!1)},O=(e,n)=>(n.target.blur(),o.value=e.slug,f.value=o.value!==e.slug?e.sortDir:e.sortDir==="asc"?"desc":"asc",l.value=!0,r().then(()=>l.value=!1)),d=M(()=>a.value===1?0:(a.value-1)*s.value),r=(e=p.value)=>P({slug:D,orderBy:o.value,orderDir:f.value,limit:s.value,offset:d.value,searchTerm:u.value,filter:v.value,additionalFilters:e});return U(()=>{c&&(s.value=g.settings.tablePagination[c]||s.value)}),{filter:v,offset:d,orderBy:o,orderDir:f,pageNumber:a,processAdditionalFilters:I,processChangeItemsPerPage:N,processFetchTableData:r,processFilterTable:j,processPagination:W,processSearch:w,processSort:O,refreshTable:B,resultsPerPage:s,searchTerm:u,selectedFilters:p,wpTableKey:x,wpTableLoading:l}};export{z as u};
