import{k}from"./index.4b887428.js";import{u as C}from"./ScrollTo.81bea8a7.js";import{Y as t,W as K,f as M}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=k(),A=C().scrollTo,B=()=>(l.value=!0,r().then(()=>{l.value=!1,i==null||i.editRow(null)})),I=({filters:e,term:n=null,number:j=null})=>{l.value=!0,p.value=e,u.value=n??u.value,a.value=j??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)},N=e=>{v.value=e.slug,u.value=null,a.value=1,l.value=!0,_(),r().then(()=>l.value=!1)},O=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)},R=(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=K(()=>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 M(()=>{c&&(s.value=g.settings.tablePagination[c]||s.value)}),{filter:v,offset:d,orderBy:o,orderDir:f,pageNumber:a,processAdditionalFilters:I,processChangeItemsPerPage:O,processFetchTableData:r,processFilterTable:N,processPagination:W,processSearch:w,processSort:R,refreshTable:B,resultsPerPage:s,searchTerm:u,selectedFilters:p,wpTableKey:x,wpTableLoading:l}};export{z as u};
