1import{_ as B}from"./B-nHRWJb.js";import{_ as A}from"./OTB3yi_y.js";import{q as R,K as T,L as H,x as K,h as c,u as V,v as D,y as h,c as r,a as k,l as i,k as F,F as I,G as M,b as O,N as Q,o as n,j as z}from"./By76FmM_.js";import{u as E}from"./Clb_K38H.js";import{u as G}from"./BUo2t9N4.js";import{u as J}from"./Dwj1deVD.js";const W={class:"mt-25 lg:mt-37.5 left-0 right-0 mx-auto px-4 flex flex-col lg:w-220 gap-5 lg:gap-10 justify-center items-start self-stretch"},X={class:"w-full overflow-hidden"},Y={key:0,class:"mt-6"},Z={key:1},ee={key:0,class:"mt-6 text-sm text-gray-500"},te={key:1,class:"mt-3 grid grid-cols-1 gap-2"},ae={key:2,class:"mt-10 text-center w-full flex justify-center"},P="activity",N=20,d="Kegiatan",pe=R({__name:"index",async setup(ne){let p,w;const l=T(),b=H(),{fetchNewsList:q}=E(),{siteUrl:_,siteName:u,siteDescription:f}=G(),g=e=>{const t=Array.isArray(e)?e[0]:e,s=Number(t);return Number.isInteger(s)&&s>0?s:1},S=e=>e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim(),a=K(g(l.query.page)),y=c(()=>{const e=new URL(_);return e.pathname="/informasi-publik/kegiatan",a.value>1&&e.searchParams.set("page",String(a.value)),e.toString()}),C=c(()=>`${d}${a.value>1?` (Halaman ${a.value})`:""}`);V(()=>({title:C.value,meta:[{name:"description",content:f},{property:"og:title",content:`${d} - ${u}`},{property:"og:description",content:f},{property:"og:url",content:y.value},{property:"og:image",content:`${_}/og-image.jpg`},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:title",content:`${d} - ${u}`},{name:"twitter:description",content:f}],link:[{rel:"canonical",href:y.value}],script:[{type:"application/ld+json",innerHTML:JSON.stringify({"@context":"https://schema.org","@type":"CollectionPage",name:`${d} - ${u}`,url:y.value,isPartOf:{"@type":"WebSite",name:u,url:_}})}]}));const{data:x,pending:L}=([p,w]=D(()=>J(()=>`posts:${P}:${a.value}:${N}`,()=>q({type:P,page:a.value,per_page:N}),{watch:[a]})),p=await p,w(),p),$=c(()=>x.value?.items??[]),m=c(()=>x.value?.meta??null),U=c(()=>(m.value?.last_page??1)>1),j=e=>{const t={...l.query};return delete t.category,{...t,page:e===1?void 0:String(e)}};return h(()=>l.query.page,e=>{const t=g(e);t!==a.value&&(a.value=t)}),h(a,async e=>{const t=g(e);
1if(t!==e){a.value=t;return}const s=g(l.query.page),v=l.query.page!==void 0;s===t&&(t>1||!v)||await b.replace({query:j(t)})}),h(m,e=>{if(!e)return;const t=Math.max(1,e.last_page);a.value>t&&(a.value=t)},{immediate:!0}),(e,t)=>{const s=B,v=A;return n(),r("div",W,[k("div",X,[t[1]||(t[1]=k("div",{class:"mt-3 title"},"Kegiatan",-1)),i(L)?(n(),r("div",Y,"Loading...")):(n(),r("div",Z,[i($).length===0?(n(),r("div",ee," Belum ada kegiatan. ")):(n(),r("div",te,[(n(!0),r(I,null,M(i($),o=>(n(),z(s,{key:o.id,title:o.title,description:S(o.content),date:o.published_at,to:`/home/berita/${o.slug}`},null,8,["title","description","date","to"]))),128))])),i(U)?(n(),r("div",ae,[O(v,{page:i(a),"onUpdate:page":t[0]||(t[0]=o=>Q(a)?a.value=o:null),total:i(m)?.total??0,"items-per-page":i(m)?.per_page??20,variant:"link"},null,8,["page","total","items-per-page"])])):F("",!0)]))])])}}});export{pe 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.