1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`c266728332924abe0c0bcd76be8d76410acb17b5`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`a0401de6-5633-4f60-916c-ec3f89da187d`,e._sentryDebugIdIdentifier=`sentry-dbid-a0401de6-5633-4f60-916c-ec3f89da187d`)}catch{}})();import{o as e}from"./D2iY1ktH.js";import{D as t,E as n,Kt as r,Lt as i,On as a,Qn as o,Yt as s,_ as c,b as l,bt as u,et as d,g as f,k as p,mt as m,nr as h,o as g,qt as _,un as v,v as y,vn as b,w as x,xt as S,y as C}from"./CZ33vjiJ.js";import{S as w}from"./TZ2IHAYE.js";import{r as T}from"./B0154EaC.js";import{n as E}from"./lca_Zceh.js";import{t as D}from"./DPG89Wqb.js";import{f as O,n as k,t as A,u as j}from"./DNz_CJBD.js";import{K as ee,t as te}from"./QtpvXaml.js";import{n as M,t as ne}from"./BYHSEk25.js";import{t as re}from"./BKx1-XJs.js";import{t as ie}from"./B_YFYKkJ.js";import{t as N}from"./eo8kQqGv.js";import{h as P}from"#entry";import{t as F}from"./C4GlBRkH.js";import{t as I}from"./D9tC_EBG.js";import{t as L}from"./BL2XytHW.js";import{t as R}from"./CrerLkAO.js";import{t as z}from"./B7vwNHpo.js";import{t as B}from"./BPooOtEJ.js";var V={base:`flex flex-col gap-8 lg:gap-y-16`,variants:{orientation:{horizontal:`sm:grid sm:grid-cols-2 lg:grid-cols-3`,vertical:``}}},H={__name:`UBlogPosts`,props:{as:{type:null,required:!1},posts:{type:Array,required:!1},orientation:{type:null,required:!1,default:`horizontal`},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=e,n=i(),r=k(`blogPosts`,t),s=()=>j(n,[`default`]),c=T(),p=f(()=>A({extend:V,...c.ui?.blogPosts||{}}));return(e,t)=>(m(),y(a(O),{as:a(r).as,"data-orientation":a(r).orientation,class:o(p.value({orientation:a(r).orientation,class:[a(r).ui?.base,a(r).class]}))},{default:_(()=>[S(e.$slots,`default`,{},()=>[(m(!0),l(g,null,u(a(r).posts,(t,n)=>(m(),y(M,d({key:n,orientation:a(r).orientation===`vertical`?`horizontal`:`vertical`},{ref_for:!0},t),x({_:2},[u(s(),(n,r)=>({name:r,fn:_(n=>[S(e.$slots,r,d({ref_for:!0},n,{post:t}))])}))]),1040,[`orientation`]))),128))])]),_:3},8,[`as`,`data-orientation`,`class`]))}},U={class:`flex flex-row flex-wrap gap-y-2 gap-x-4 items-center`},W={key:0,class:`flex flex-col lg:grid lg:grid-cols-2 gap-x-8 gap-y-8 my-8`},G={class:`my-8`},K={class:`flex flex-row justify-between align-middle items-center`},q=4,J=10,Y=p({__name:`index`,async setup(i){let o,d,p=([o,d]=r(()=>L(`/blog`)),o=await o,d(),o);R(p);let{$directus:x,$aggregate:S,$readItems:T}=e(),{fetchBlogPosts:O}=B(),k=b({pageIndex:0,pageSize:J}),A=b([{id:`publish_at`,desc:!0}]),j=f(()=>A.value[0]?[`${A.value[0].desc?`-`:``}${A.value[0]?.id}`]:void 0),M=b(),V=b(),{data:Y}=([o,d]=r(()=>E(`recent-blog-posts`,()=>O(void 0,void 0,q,[`-publish_at`]))),o=await o,d(),o),{data:ae}=([o,d]=r(()=>E(`total-blog-posts`,()=>x.request(S(`posts`,{aggregate:{count:`*`},filter:{status:{_eq:`published`}}})).then(e=>+(e[0]?.count??0)),{lazy:!0})),o=await o,d(),o),{data:X}=([o,d]=r(()=>E(`aggregate-blog-posts`,()=>x.request(T(`posts`,{fields:[`publish_at`],groupBy:[`year(publish_at)`],aggregate:{count:`*`}})),{lazy:!0})),o=await o,d(),o),Z=f(()=>{let e=[];return V.value&&e.push({"year(publish_at)":{_eq:V.value}}),{_and:e}}),oe=f(()=>{let e={fields:[`name`,`publish_at`,{authors:[{directus_users_id:[`first_name`,`last_name`]}]},`slug`,`author_first`,`author_last`],limit:k.value.pageSize,page:k.value.pageIndex+1,sort:j.value};return M.value&&(e.search=M.value),Z.value&&(e.filter=Z.value),e}),Q=ee(oe,500),{data:se,pending:$}=([o,d]=r(()=>E(`older-blog-posts`,()=>x.request(T(`posts`,Q.value)),{watch:[Q],lazy:!0})),o=await o,d(),o);return(e,r)=>{let i=re,o=te,d=F,f=I,b=ne,x=z,S=H,T=N,E=ie,O=P;return m(),l(g,null,[t(f,{page:a(p)},{default:_(()=>[c(`span`,null,h(a(p)?.subtitle),1),c(`div`,U,[r[6]||=c(`span`,{class:`text-neutral-700 dark:text-neutral-200`},`Search Posts`,-1),a(X)?(m(),y(i,{key:0,modelValue:a(V),"onUpdate:modelValue":r[0]||=e=>v(V)?V.value=e:null,class:`w-32 inline-block`,items:[{publish_at_year:void 0,label:`None`},...a(X).toReversed()],"value-key":`publish_at_year`,"search-input":!1},{item:_(({item:e})=>[`label`in e?(m(),l(g,{key:0},[n(h(e.label),1)],64)):(m(),l(g,{key:1},[n(h(e.publish_at_year)+` (`+h(e.count)+`) `,1)],64))]),default:_(()=>[n(` `+h(a(V)?a(V):`Filter Year`),1)]),_:1},8,[`modelValue`,`items`])):C(``,!0),t(d,{modelValue:a(M),"onUpdate:modelValue":r[2]||=e=>v(M)?M.value=e:null,class:`max-w-sm inline-block`,color:`primary`,variant:`outline`,icon:`i-heroicons-magnifying-glass-20-solid`,placeholder:`Search...`,loading:a($),"aria-label":`Search blogs`},{trailing:_(()=>[s(t(o,{color:`neutral`,variant:`link`,icon:`i-heroicons-x-mark-20-solid`,ui:{base:`p-0`},label:``,"aria-label":`Clear search`,onClick:r[1]||=e=>M.value=``},null,512),[[w,a(M)!==``]])]),_:1},8,[`modelValue`,`loading`])])]),_:1},8,[`page`]),t(O,{name:`page`},{default:_(()=>[a(Y)&&!a(V)&&!a(M)?(m(),l(`div`,W,[a(Y)[0]?(m(),y(b,{key:0,orientation:`vertical`,post:a(Y)[0]},null,8,[`post`])):C(``,!0),c(`div`,null,[t(x,null,{default:_(()=>[...r[7]||=[n(` Latest Posts `,-1)]]),_:1}),t(S,{orientation:`vertical`,ui:{base:`gap-2 lg:gap-y-4`}},{default:_(()=>[(m(!0),l(g,null,u(a(Y),(e,t)=>(m(),l(g,{key:e.slug},[a(Y)&&t>0?(m(),y(b,{key:0,orientation:`horizontal`,variant:`ghost`,post:e},null,8,[`post`])):C(``,!0)],64))),128))]),_:1})])])):C(``,!0),!a(V)&&!a(M)?(m(),y(T,{key:1})):C(``,!0),c(`div`,G,[c(`div`,K,[t(x,null,{default:_(()=>[...r[8]||=[n(` Blog Archive `,-1)]]),_:1})]),t(E,{pagination:a(k),"onUpdate:pagination":r[3]||=e=>v(k)?k.value=e:null,sorting:a(A),"onUpdate:sorting":r[4]||=e=>v(A)?A.value=e:null,class:`w-full section-no-clip`,empty:`No matching posts found.`,loading:a($),rows:a(se)??[],columns:[{id:`publish_at`,accessorKey:`publish_at`,header:`Date`,sortable:!0,custom:!0},{id:`name`,accessorKey:`name`,header:`Title`,sortable:!0},{id:`author`,accessorKey:`author`,header:`Author`,sortable:!0,custom:!0}],"use-pagination":!0,async:!0,total:a(ae),selectable:!0,onSelect:r[5]||=t=>e.$router.push({name:`blog-slug`,params:{slug:t.slug}})},{publish_at:_(({row:t})=>[n(h((`useFormat`in e?e.useFormat:a(D))(t.original.publish_at,`Time`,{dateFormat:`yyyy-MM-dd`})),1)]),author:_(({row:e})=>[n(h(e.original.authors&&e.original.authors[0]?`${e.original.authors[0].directus_users_id.first_name} ${e.original.authors[0].directus_users_id.last_name}`:`${e.original.author_first} ${e.original.author_last}`),1)]),_:1},8,[`pagination`,`sorting`,`loading`,`rows`,`total`])])]),_:1})],64)}}});
1export{Y 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.