1import{f as j,o as l,c,a as i,F as x,r as b,J as S,t as k,m as o,l as w,z as B,x as C,G as $,A,B as p,C as D,b as g,w as _,i as O,D as E,j as H,d as v,q as J,k as L}from"./aCHmRW9u.js";import{_ as R}from"./CCi8zC-C.js";import{_ as U}from"./DpNES2Yp.js";import{t as q}from"./yI7HeE6Z.js";import"./gfvOXkdB.js";const I={key:0,class:"isolate flex justify-center"},K={class:"inline-flex -space-x-px shadow-xs rounded-full"},Q=["disabled"],W=["disabled","onClick"],X=["disabled"],N=3,Y=j({__name:"Paginator",props:{currentPage:{},totalPages:{}},emits:["goToPage"],setup(n,{emit:s}){const a=s,r=B(()=>{const u=Math.max(1,n.currentPage-N),e=Math.min(n.totalPages,n.currentPage+N),t=[];for(let d=u;d<=e;d++)t.push(d);return t});return(u,e)=>n.totalPages>1?(l(),c("nav",I,[i("div",K,[i("button",{class:"w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900 rounded-l-full",disabled:n.currentPage===1,onClick:e[0]||(e[0]=t=>a("goToPage",n.currentPage-1))},[...e[2]||(e[2]=[i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1)])],8,Q),(l(!0),c(x,null,b(o(r),t=>(l(),c("button",{key:t,class:S(["w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900",{"bg-accent text-light z-10":n.currentPage===t}]),disabled:n.currentPage===t,onClick:d=>a("goToPage",t)},k(t),11,W))),128)),i("button",{class:"w-10 h-12 relative inline-flex items-center justify-center ring-1 ring-inset ring-dark/30 cursor-pointer disabled:cursor-not-allowed text-neutral-900 rounded-r-full",disabled:n.currentPage===n.totalPages,onClick:e[1]||(e[1]=t=>a("goToPage",n.currentPage+1))},[...e[3]||(e[3]=[i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})],-1)])],8,X)])])):w("",!0)}}),Z=Object.assign(Y,{__name:"UiPaginator"});class ee{currentPage=C(1);itemsPerPage=5;totalPages;collections;url;constructor(s,a,r,u=5){if(this.collections=s,this.url=a,this.itemsPerPage=u,!this.collections.length)this.totalPages=1,this.currentPage.value=1;else if(this.totalPages=Math.ceil(this.collections.length/this.itemsPerPage),"page"in r&&!Number.isNaN(r.page)){const e=Number(r.page);e>0&&e<=this.totalPages?this.currentPage.value=e:$(`${this.url}?page=${this.currentPage.value}`)}}paginatedCollections=()=>{const s=(this.currentPage.value-1)*this.itemsPerPage,a=s+this.itemsPerPage;return this.collections.slice(s,a)};goToPage=s=>{s>0&&s<=this.totalPages&&(this.currentPage.value=s,$(`${this.url}?page=${this.currentPage.value}`))}}const te={class:"mx-auto max-w-4xl"},ne={key:0,class:"mx-auto max-w-4xl"},se={class:"flex flex-wrap gap-2"},ae={class:"mx-auto max-w-4xl"},oe={key:0},le=!0,T="blog",de=j({__name:"index",setup(n){const s=A(),a=p("blog-page"),r=p("blog-posts");D({page:"blog-page",title:"Blog",description:q(a.body.value,155,E)});const u=C(r),e=B(()=>new ee(u.value,`/${T}`,s.query)),t=C(null),d=p("blog-categories"),z=h=>{h===t.value?(t.value=null,u.value=r):(t.value=h,u.value=r.filter(f=>f.fields.category?f.fields.category.fields.name.value===t.value:!1))};return(h,f)=>{const y=H,M=J,P=O,V=R,F=U,G=Z;return l(),c("div",null,[g(P,{first:"",primary:""},{default:_(()=>[i("div",te,[g(y,{as:"h1",light:"",class:"mb-6"},{default:_(()=>[v(k(o(a)?.heading.value),1)]),_:1}),g(M,{light:"",field:o(a)?.body},null,8,["field"])])]),_:1}),g(P,{dark:""},{default:_(()=>[o(d).length&&le?(l(),c("div",ne,[g(y,{as:"h4",light:"",class:"mb-6"},{default:_(()=>[...f[0]||(f[0]=[v("Filter by category",-1)])]),_:1}),i("div",se,[(l(!0),c(x,null,b(o(d),m=>(l(),L(V,{key:m.id,class:"cursor-pointer",active:o(t)===m.fields.name.value,onClick:()=>z(m.fields.name.value)},{default:_(()=>[v(k(m.fields.name.value),1)]),_:2},1032,["active","onClick"]))),128))])])):w("",!0)]),_:1}),g(P,{light:""},{default:_(()=>[i("div",ae,[o(e).paginatedCollections().length?(l(),c("div",oe,[(l(!0),c(x,null,b(o(e).paginatedCollections(),m=>(l(),c("article",{key:m.fields.heading.value},[g(F,{post:m,"page-name":T},null,8,["post"])]))),128)),g(G,{"current-page":o(e).currentPage.value,"total-pages":o(e).totalPages,onGoToPage:o(e).goToPage},null,8,["current-page","total-pages","onGoToPage"])])):w("",!0)])]),_:1})])}}});
1export{de as default};
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.