1import{f as G,N as I,c as y,r as E,o as i,a as d,h as u,n as p,F as L,d as T,O as F,e as _,L as O,C as g,p as M,P,j as W,k as A,Q as D,R as Q}from"./Ce_T0jsJ.js";import{_ as q}from"./m8WrKqPa.js";const H={class:"c-grid-list"},J={key:1,class:"g"},X=G({__name:"c-grid-list",props:{itemsToShow:{},skeleton:{type:Boolean,default:!1},rows:{default:()=>[2,3]},status:{default:"success"},btnShowMore:{type:Boolean,default:!0},btnRedirect:{type:Boolean,default:!1},threshold:{default:0},buttonNegative:{type:Boolean,default:!1},teaserConfig:{},bannerConfig:{default:()=>({columns:12})},skeletonVariant:{default:"teaser-vertical"},gridGap:{},showMoreWrapStyle:{},content:{}},setup(R){const t=R,{$event:N}=I(),C=y(()=>{var e,o,n;return!((o=(e=t.content)==null?void 0:e.items)!=null&&o.length)||((n=t==null?void 0:t.content)==null?void 0:n.status)==="pending"?"loading":"loaded"}),m=E(t.itemsToShow),$=y(()=>{var e,o,n,s,a,l,r;return t.btnShowMore?m.value?m.value<((o=(e=t.content)==null?void 0:e.items)==null?void 0:o.length):((s=(n=t==null?void 0:t.content)==null?void 0:n.loadMore)==null?void 0:s.url)&&((l=(a=t==null?void 0:t.content)==null?void 0:a.loadMore)==null?void 0:l.id)&&((r=t.content)==null?void 0:r.status)==="success":!1}),S=y(()=>{var e,o,n;return m.value?((n=(o=t.content)==null?void 0:o.items)==null?void 0:n.slice(0,m.value))||[]:(e=t.content)==null?void 0:e.items}),V=()=>{var e,o,n,s,a,l,r,f;(o=(e=t==null?void 0:t.content)==null?void 0:e.loadMore)!=null&&o.id&&((s=(n=t==null?void 0:t.content)==null?void 0:n.loadMore)!=null&&s.url)&&N((l=(a=t==null?void 0:t.content)==null?void 0:a.loadMore)==null?void 0:l.id),m.value&&m.value<((f=(r=t.content)==null?void 0:r.items)==null?void 0:f.length)&&(m.value+=t.itemsToShow||0)};function j(){var n;const e=(n=t.content)==null?void 0:n.items;if(!e)return[];const o=[];return t.rows.forEach((s,a)=>
1{if(t.rows.length===1){o.push({items:e,row:s});return}const l=o.reduce((v,b)=>b.items.length+v,0),r=l,f=a+1===t.rows.length?e.length:s+l;o.push({items:e.slice(r,f),row:s})}),o.map(s=>s.items.map(a=>s.row)).flat()}const h=y(()=>{var e;if(t.rows.length&&typeof t.rows[0]=="number"){const o=[],n=j();for(let s=0;s<n.length;s++)o.push(`g-${12/n[s]}`);return o}else return((e=t.rows)==null?void 0:e.reduce((o,n)=>{var s,a;if(typeof n=="object")if(n!=null&&n.num)for(let l=0;l<n.num;l++)o.push(n.class);else{const l=((a=(s=t.content)==null?void 0:s.items)==null?void 0:a.length)-o.length;for(let r=0;r<l;r++)o.push(n.class)}return o},[]))||[]}),k=e=>{var n;const o=(n=e==null?void 0:e.replace(/g-/g,""))==null?void 0:n.replace(/\s/g,"-");return o==="3"?"4":o};return(e,o)=>{var r,f,v,b,B,z;const n=A,s=q,a=D,l=Q;return i(),d("div",H,[u(C)==="loaded"?(i(),d("div",{key:0,class:p(`g ${e.gridGap}`)},[(i(!0),d(L,null,T(u(S),(w,c)=>(i(),d("div",{key:c,class:p(`${u(h)[c]}`)},[F(e.$slots,"item",{index:c,item:w,columns:k(u(h)[c])},()=>[_(n,O({ref_for:!0},e.teaserConfig,{columns:k(u(h)[c]),content:w}),null,16,["columns","content"])])],2))),128))],2)):g("",!0),u(C)==="loading"?(i(),d("div",J,[(i(!0),d(L,null,T(u(S),(w,c)=>(i(),d("div",{key:c,class:p([`${u(h)[c]}`,"flex"])},[_(s,{layout:e.skeletonVariant,columns:k(u(h)[c]),class:"flex-1"},null,8,["layout","columns"])],2))),128))])):g("",!0),u($)||((r=e.content)==null?void 0:r.status)==="loading"||e.btnRedirect&&e.content.url?(i(),d("div",{key:2,class:p(`w-full flex items-center justify-center pt-4 xl:pt-6 ${e.showMoreWrapStyle}`)},[e.btnRedirect&&((f=e.content)!=null&&f.url)?(i(),M(a,{key:"redirect",variant:"secondary",size:"lg",content:{label:((v=e.content)==null?void 0:v.button_more)??"Mostra altro",url:(b=e.content)==null?void 0:b.url},negative:e.buttonNegative,ariaLabel:"Mostra altro reindirizzamento"},null,8,["content","negative"])):g("",!0),u($)?(i(),M(a,{key:"load-more",variant:"secondary",size:"lg",content:{label:((B=e.content)==null?void 0:B.button_more)??"Mostra altro"},negative:e.buttonNegative,onClick:P(V,["prevent"]),clickable:"",ariaLabel:"Mostra altro"},null,8,["content","negative"])):g("",!0),((z=e.content)==null?void 0:z.status)==="loading"?(i(),M(a,{key:"loading",size:"lg",disabled:"",variant:"secondary",negative:e.buttonNegative,content:{label:"Caricamento..."},ariaLabel:"Caricamento in corso"},{"icon-before":W(()=>[_(l,{name:"loader-2",class:"w-4 h-4 animate-spin"})]),_:1},8,["negative"])):g("",!0)],2)):g("",!0)])}}});export{X as _};
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.