import{d}from"./site.Deo0TYgJ.js";import{c as s}from"./index.BHh4vvK5.js";import{a}from"./index.3whys8t3.js";const u=(d.announcements??[]).map(t=>({id:t.id,title:t.title,content:t.content,type:t.type,publishDate:t.publishDate,startDate:t.startDate,endDate:t.endDate,priority:t.priority,link:t.link,color:t.color})),r="announcement-read-ids",o=a(new Set),f=a(!1),i=a(!1);function l(t){const e=new Date;if(t.startDate){const n=new Date(t.startDate);if(e<n)return!1}if(t.endDate){const n=new Date(t.endDate);if(e>n)return!1}return!0}const c=s(o,()=>u.filter(l).sort((t,e)=>(e.priority??0)-(t.priority??0))),m=s([c,o],(t,e)=>t.filter(n=>!e.has(n.id))),g=s(m,t=>t.length);function p(){if(!(typeof window>"u"))try{const t=localStorage.getItem(r);if(t){const e=JSON.parse(t);o.set(new Set(e))}}catch(t){console.warn("[Announcement] Failed to parse stored read IDs",t)}}function y(){p(),f.set(!0)}function w(t){const e=o.get();if(e.has(t))return;const n=new Set(e);n.add(t),o.set(n),typeof localStorage<"u"&&localStorage.setItem(r,JSON.stringify([...n]))}function I(){i.set(!0)}function h(){i.set(!1)}function O(){const t=c.get(),e=new Set(o.get());for(const n of t)e.add(n.id);o.set(e),typeof localStorage<"u"&&localStorage.setItem(r,JSON.stringify([...e]))}export{c as a,i as b,h as c,w as d,f as e,m as f,y as i,O as m,I as o,o as r,g as u};
