1import{C as R}from"./BlvJBiV5.js";import{u as G}from"./B5PTxJh8.js";import{e as H,r as o,p as g,c as p,a as V,j as J,F as W,k as A,f as C,t as K,o as d,i as O,b as U,_ as X,x as Y,n as Z}from"./D8PiJXAC.js";import{g as E}from"./Cd-7wpi2.js";import{u as z}from"./CzZsnjVt.js";const ee={class:"category-list"},te={class:"category-list__desktop"},ae={class:"category-list__mobile"},se=H({__name:"CategoryList",props:{categories:{},selectedCategory:{},defaultShowCount:{default:4},maxShowCount:{default:null}},emits:["category-click"],setup(c,{emit:w}){const s=c,{windowWidth:k}=G(),f=o(!1),h=g(()=>s.categories.filter((a,n)=>k.value<1024||f.value?s.maxShowCount?n<s.maxShowCount:!0:n<s.defaultShowCount)),S=w,_=a=>{S("category-click",a)},r=g(()=>s.maxShowCount?Math.min(s.maxShowCount,s.categories.length)-s.defaultShowCount:s.categories.length-s.defaultShowCount);return(a,n)=>(d(),p("div",ee,[V("div",te,[(d(!0),p(W,null,A(C(h),t=>(d(),O(R,{key:t.id,"is-active":a.selectedCategory===t.code,category:t,onSelect:i=>_(t.code)},null,8,["is-active","category","onSelect"]))),128)),C(f)?J("",!0):(d(),p("div",{key:0,onClick:n[0]||(n[0]=t=>f.value=!0),class:"category-list__counter"}," +"+K(C(r)),1))]),V("div",ae,[(d(!0),p(W,null,A(C(h),t=>(d(),p("div",{key:t.id,class:"category-list__item"},[U(R,{"is-active":a.selectedCategory===t.code,category:t,onSelect:i=>_(t.code)},null,8,["is-active","category","onSelect"])]))),128))])]))}}),ce=X(se,[["__scopeId","data-v-f8076f9b"]]),ie=async(c=20,w=null,s="small",k=null,f=0,h=null,S=!1)=>{const _=Z(),r=o(1),a=o(w),n=o(h),t=o(s),i=o([]),b=o(!1),$=o(0),v=o(""),m=o(k||""),N=o(c),B=e=>{var u;return(u=e==null?void 0:e.data)!=null&&u.items?{items:e.data.items.map(L=>({...L,preview_image:[...L.preview_image.map(l=>{var M;return{...l,url:(M=l==null?void 0:l.url)!=null&&M.startsWith("https://")?`${_.public.apiBase}${l==null?void 0:l.path}`:l==null?void 0:l.url}})]})),total:e.data.total||0,currentPage:e.data.current_page,lastPage:e.data.last_page}:{items:[],total:0}},{data:x,error:F,refresh:I,pending:P}=await z(`news-list-${c}`,async()=>{b.value=!0;try{let e;if(m.value){const y={page:r.value,page_size:c,...a.value?{category:a.value}:{},...t.value?{block_type:t.value}:{},...v.value?{date:v.value}:{},query:m.value},u=await E("news/search",y);e=B(u)}else{const y={page:1,page_size:r.value*c+f,...a.value?{category:a.value}:{},...t.value?{block_type:t.value}:{},...v.value?{date:v.value}:{},...n.value?{tag:n.value}:{},...S?{"main-page":!0}:{}},u=await E("news/list",y);e=B(u),N.value=u.data.to}return e}catch(e){console.error(e),i.value=[]}finally{b.value=!1}},{immediate:!0,watch:[r,a,t]});Y(()=>{x.value&&(i.value=x.value.items,$.value=x.value.total)});const T=()=>{D.value&&(r.value+=1)},j=e=>{a.value!==e&&(m.value="",a.value=e,r.value=1)},q=e=>{v.value!==e&&(v.value=e,r.value=1,m.value="",I())},Q=async e=>{e&&(m.value=e,I())},D=g(()=>i.value.length<$.value);return{newsItems:i,totalItems:$,loading:g(()=>P.value||b.value),hasMore:D,fetchMore:T,setCategory:j,setDateNews:q,refreshNews:Q,error:F,currentRecordsTo:N}};export{ce as C,ie as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.