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