import{m as k}from"./index.36512665.js";import{u as C}from"./ScrollTo.81bea8a7.js";import{g as t,f as K,k as M}from"./runtime-dom.esm-bundler.c4caba60.js";const E=(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),g=S||t(null),x=t(0),l=L||t(!1),p=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,g.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)},N=e=>{a.value=e,l.value=!0,r().then(()=>l.value=!1)},O=e=>{v.value=e.slug,u.value=null,a.value=1,l.value=!0,_(),r().then(()=>l.value=!1)},R=e=>{a.value=1,s.value=e,l.value=!0,p.changeItemsPerPage({slug:c,value:e}).then(()=>r().then(()=>A(F))).then(()=>l.value=!1)},W=(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=g.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=p.settings.tablePagination[c]||s.value)}),{filter:v,offset:d,orderBy:o,orderDir:f,pageNumber:a,processAdditionalFilters:I,processChangeItemsPerPage:R,processFetchTableData:r,processFilterTable:O,processPagination:N,processSearch:w,processSort:W,refreshTable:B,resultsPerPage:s,searchTerm:u,selectedFilters:g,wpTableKey:x,wpTableLoading:l}};export{E as u};
