import{h as C}from"./app-core.82d0a9b8.js";import{u as K}from"./ScrollTo.f4df02aa.js";import{b as M,r as a,u as U}from"./vendor-vue-ui.02763c14.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),x=a(0),l=L||a(!1),p=C(),A=K().scrollTo,B=()=>(l.value=!0,r().then(()=>{l.value=!1,F?.editRow(null)})),I=({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)},R=e=>{typeof e=="object"&&(e=e?.target?.value),t.value=1,u.value=e,l.value=!0,r().then(()=>l.value=!1)},w=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(()=>A(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:I,processChangeItemsPerPage:O,processFetchTableData:r,processFilterTable:N,processPagination:w,processSearch:R,processSort:W,refreshTable:B,resultsPerPage:s,searchTerm:u,selectedFilters:v,wpTableKey:x,wpTableLoading:l}};export{E as u};
