PageSourceSearch

https://countryherald.com/assets/NotificationsPanel-cXAGtQz2.js

js countryherald.com collected 2026-09-25 02:35:36 UTC 14,770 bytes, 1 lines download raw bytes

1import{ab as H,r as i,o as $,aZ as se,a_ as ae,b0 as re,j as e,b5 as O,a0 as A,b4 as D,t as K,b3 as V,b2 as q,S as X,b1 as Y,L as Z,b6 as le,a9 as ne,M as J,C as ie,V as z,X as ce,v as oe}from"./index-CzU4y74h.js";import{I as de}from"./image-cmfMftKY.js";import{g as me}from"./articleBarStyle--RsA8IeN.js";import{d as xe}from"./decodeEntities-CLxPUvbq.js";import ue from"./LiveIncidentMap-B3DsW45Z.js";import{E as B}from"./external-link-DQV9ai_O.js";import{G as Q}from"./graduation-cap-DNS0lkXl.js";import{W as ee}from"./wrench-DiSXd-dw.js";import{S as fe}from"./star-CsT53tHA.js";import"./rotate-ccw-vvEPYHKa.js";import"./layers-DdqmGEgT.js";const T=[{key:"all",label:"All",icon:null},{key:"fire",label:"Fire",icon:Y},{key:"police",label:"Police",icon:X},{key:"traffic",label:"Traffic",icon:q},{key:"transit",label:"Transit",icon:V},{key:"weather",label:"Weather",icon:K},{key:"utility",label:"Utility",icon:ee},{key:"school",label:"School",icon:Q},{key:"hazmat",label:"Hazmat",icon:A},{key:"ems",label:"Medical",icon:D},{key:"rescue",label:"Rescue",icon:D}],_={fire:"#dc2626",police:"#2563eb",traffic:"#f59e0b",transit:"#047857",weather:"#eab308",utility:"#475569",school:"#0f172a",hazmat:"#ea580c",ems:"#dc2626",rescue:"#059669",other:"#dc2626"},L={fire:Y,police:X,traffic:q,transit:V,weather:K,utility:ee,school:Q,hazmat:A,ems:D,rescue:D,other:A};function he({userState:r,userLocation:a,onClose:c}){const f=H(),[x,p]=i.useState(null),[o,d]=i.useState([]),[S,j]=i.useState({}),[g,N]=i.useState("all"),[E,y]=i.useState(null),[w,v]=i.useState(!0);i.useEffect(()=>{let t=!1;return(async()=>{try{const m=await $.entities.LiveMarket.filter({active:!0,public_enabled:!0},"-created_date",25),s=se(m||[],{...a||{},state_abbr:(a==null?void 0:a.state_abbr)||r||""});if(!s){t||(p(null),d([]),j({}));return}const l=Date.now(),u=(await $.entities.LiveIncident.filter({market_slug:s.slug,public_visible:!0},"-final_score",100)||[]).filter(b=>ae(b,l));t||(p(s),d(u));try{const b=await $.entities.LiveIncidentUpdate.filter({market_slug:s.slug,public_visible:!0},"-occurred_at",250),I={};for(const h of u){const F=(b||[]).filter(te=>te.incident_id===h.id),R=re(h,F,l);R.length&&(I[h.id]=R)}t||j(I)}catch{t||j({})}}catch{t||d([])}finally{t||v(!1)}})(),()=>{t=!0}},[r,a==null?void 0:a.city,a==null?void 0:a.county,a==null?void 0:a.state_abbr]);const k=i.useMemo(()=>o.filter(t=>g==="all"||t.category===g),[o,g]),C=i.useMemo(()=>{const t={};return o.forEach(m=>{t[m.category]=(t[m.category]||0)+1}),t},[o]),M=o.filter(t=>Number.isFinite(Number(t.lat))&&Number.isFinite(Number(t.lon)));return e.jsxs("div",{className:"bg-[#FAFBFB] min-h-full",children:[e.jsxs("section",{className:"px-4 pt-4 pb-3 bg-white border-b border-emerald-50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(O,{className:"w-9 h-9 text-[#E00012] shrink-0",strokeWidth:2.2}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"font-heading font-black text-[22px] leading-none text-emerald-950",children:x!=null&&x.name?`${x.name} Live`:"Live Nearby"}),e.jsx("p",{className:"mt-1 text-[12px] leading-tight text-slate-500",children:"Real-time incidents and public safety updates."})]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-extrabold text-slate-600 shrink-0 pt-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-red-600"})," ",o.length," active"]})]}),e.jsxs("div",{className:"relative mt-3 overflow-hidden rounded-[18px] border border-slate-200 bg-slate-100",children:[e.jsx(ue,{incidents:M,className:"h-[210px]",category:g,onCategoryChange:N,updatesByIncident:S}),e.jsxs("button",{type:"button",onClick:()=>{c==null||c(),f(`/live?market=${encodeURIComponent((x==null?void 0:x.slug)||"")}&map=1`)},className:"absolute z-[500] right-3 top-3 inline-flex items-center gap-1.5 rounded-xl bg-white/95 border border-slate-200 px-3 py-2 text-xs font-extrabold text-slate-900 shadow-md",children:["Full map ",e.jsx(B,{className:"w-3.5 h-3.5"})]})]}),e.jsx("div",{className:"flex items-center gap-4 overflow-x-auto no-scrollbar mt-3 pb-0.5",children:["fire","police","traffic","transit"].map(t=>{var s;const m=L[t];return e.jsxs("button",{onClick:()=>N(t),className:"inline-flex items-center gap-1.5 shrink-0 text-[11px] font-extrabold text-slate-700",children:[e.jsx(m,{className:"w-4 h-4",style:{color:_[t]}}),e.jsx("span",{children:(s=T.find(l=>l.key===t))==null?void 0:s.label}),e.jsx("span",{className:"text-slate-400",children:C[t]||0})]},t)})})]}),e.jsx("div",{className:"bg-white border-b border-emerald-50 px-3 py-2.5 flex gap-2 overflow-x-auto no-scrollbar sticky top-0 z-10",children:T.map(({key:t,label:m,icon:s})=>e.jsxs("button",{onClick:()=>N(t),className:`shrink-0 inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[11px] font-extrabold ${g===t?"bg-emerald-800 border-emerald-800 text-white":"bg-white border-slate-200 text-slate-700"}`,children:[s&&e.jsx(s,{className:"w-3.5 h-3.5",style:{color:g===t?"white":_[t]}}),m]},t))}),w&&e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(Z,{className:"w-5 h-5 animate-spin text-emerald-600"})}),!w&&k.length===0&&e.jsxs("div",{className:"px-6 py-14 text-center",children:[e.jsx(O,{className:"w-9 h-9 mx-auto text-slate-200"}),e.jsx("p",{className:"font-heading font-bold text-emerald-950 mt-3",children:"No active updates in this category."})]}),e.jsx("div",{className:"divide-y divide-slate-100 bg-white",children:k.map((t,m)=>{var I;const s=L[t.category]||A,l=U(le(t)),n=S[t.id]||[],u=n.length>1||!!t.source_url,b=E===t.id;return e.jsxs(ne.Fragment,{children:[e.jsxs("article",{className:"bg-white",children:[e.jsxs("button",{type:"button",onClick:()=>u&&y(b?null:t.id),className:`w-full grid grid-cols-[64px_44px_minmax(0,1fr)_22px] gap-3 px-4 py-4 text-left ${u?"active:bg-slate-50":"cursor-default"}`,"aria-expanded":u?b:void 0,children:[e.jsxs("div",{className:"flex items-baseline justify-center text-[#E00012] font-black leading-none pt-0.5",children:[e.jsx("span",{className:"text-[36px] tracking-[-0.05em]",children:l.value}),e.jsx("span",{className:"text-[15px] ml-0.5 lowercase",children:l.unit})]}),e.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:`${_[t.category]||_.other}12`},children:e.jsx(s,{className:"w-6 h-6",style:{color:_[t.category]||_.other}}
1)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-heading font-black text-[17px] leading-[1.1] text-emerald-950",children:t.headline}),t.status==="developing"&&e.jsx("span",{className:"inline-flex mt-1 rounded bg-red-600 text-white px-2 py-0.5 text-[9px] font-black uppercase tracking-wide",children:"Developing"}),t.summary&&e.jsx("p",{className:"mt-1.5 text-[12px] text-slate-500 leading-snug line-clamp-2",children:t.summary}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 mt-2 text-[10px] font-semibold text-slate-500",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(J,{className:"w-3.5 h-3.5 text-red-500"}),t.city,", ",t.state_abbr]}),e.jsx("span",{children:((I=T.find(h=>h.key===t.category))==null?void 0:I.label)||"Update"}),n.length>0&&e.jsxs("span",{children:[n.length," current update",n.length===1?"":"s"]}),e.jsxs("span",{children:[P(t,n)," source",P(t,n)===1?"":"s"]})]})]}),u?e.jsx(ie,{className:`w-5 h-5 text-red-600 self-center transition-transform ${b?"rotate-180":""}`}):e.jsx("span",{})]}),b&&u&&e.jsxs("div",{className:"mx-4 mb-4 ml-[124px] rounded-xl border border-slate-200 bg-slate-50/70 p-3",children:[n.slice(0,6).map(h=>{const F=U(h.occurred_at);return e.jsxs("div",{className:"grid grid-cols-[38px_1fr] gap-2 py-1.5 text-xs border-b last:border-b-0 border-slate-200/70",children:[e.jsxs("div",{className:"font-black text-red-600",children:[F.value,F.unit]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-700 leading-snug",children:h.summary}),h.source_name&&e.jsx("p",{className:"text-[10px] text-slate-400 mt-0.5",children:h.source_name})]})]},h.id)}),t.source_url&&e.jsxs("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 mt-2 text-[11px] font-extrabold text-emerald-700",children:["Open source ",e.jsx(B,{className:"w-3 h-3"})]}),e.jsx(z,{slotKey:"live_incident_detail",format:"rectangle",className:"mt-3 pt-3 border-t border-slate-200"})]})]}),(m+1)%2===0&&e.jsx("div",{className:"px-4 py-3 border-t border-slate-100 bg-[#FAFBFB]",children:e.jsx(z,{slotKey:"live_feed_inline",format:"auto"})})]},t.id)})})]})}function P(r,a){const c=new Set;return r.source_name&&c.add(r.source_name),a.forEach(f=>{f.source_name&&c.add(f.source_name)}),Math.max(1,c.size)}function U(r){const a=Date.parse(r||"");if(!Number.isFinite(a))return{value:"0",unit:"m"};const c=Math.max(0,Math.floor((Date.now()-a)/6e4));if(c<60)return{value:String(c),unit:"m"};const f=Math.floor(c/60);return f<24?{value:String(f),unit:"h"}:{value:String(Math.floor(f/24)),unit:"d"}}const W=30;function Me({open:r,onClose:a,userState:c,userLocation:f}){const x=H(),[p,o]=i.useState([]),[d,S]=i.useState(!1),[j,g]=i.useState(!1),[N,E]=i.useState(null),[y,w]=i.useState(!0),[v,k]=i.useState("stories"),C=i.useRef(null);i.useEffect(()=>{if(!r)return;const s=document.body.style.overflow,l=n=>{n.key==="Escape"&&a()};return document.body.style.overflow="hidden",document.addEventListener("keydown",l),()=>{document.body.style.overflow=s,document.removeEventListener("keydown",l)}},[r,a]);const M=i.useCallback(async s=>{if(!d){S(!0);try{const l=await $.functions.invoke("getLatestStories",{cursor:s?null:N,limit:W}),n=(l==null?void 0:l.data)||l,u=(n==null?void 0:n.articles)||[];o(s?u:b=>[...b,...u]),E((n==null?void 0:n.nextCursor)||null),w(!!(n!=null&&n.nextCursor)&&u.length===W)}catch{w(!1)}S(!1)}},[N,d]);if(i.useEffect(()=>{r&&(k("stories"),o([]),E(null),w(!0),M(!0))},[r]),i.useEffect(()=>{if(!r||!y)return;const s=new IntersectionObserver(l=>{l[0].isIntersecting&&!d&&M(!1)},{threshold:.1});return C.current&&s.observe(C.current),()=>s.disconnect()},[r,y,d,M]),!r)return null;const t=[...p].sort((s,l)=>G(l)-G(s)),m=j&&c?t.filter(s=>s.state_abbr===c):t;return e.jsx("div",{className:"fixed inset-0 z-[60] md:bg-emerald-950/20 md:backdrop-blur-[1px]",onMouseDown:s=>{s.target===s.currentTarget&&a()},children:e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-label":"Latest stories",className:"absolute inset-0 bg-white flex flex-col md:inset-y-0 md:left-auto md:right-0 md:w-[430px] md:max-w-[90vw] md:border-l md:border-emerald-100 md:shadow-2xl md:animate-in md:slide-in-from-right md:duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b border-emerald-50 shrink-0",children:[e.jsx("h1",{className:"font-heading font-bold text-base text-emerald-950",children:v==="stories"?"Latest Stories":"Live Nearby"}),e.jsxs("div",{className:"flex items-center gap-2",children:[v==="stories"&&e.jsxs("button",{onClick:()=>g(!j),className:`flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[11px] font-bold transition-colors ${j?"bg-emerald-700 text-white":"bg-emerald-50 text-emerald-700"}`,children:[e.jsx(J,{className:"w-3 h-3"}),"Local"]}),e.jsx("button",{onClick:a,className:"p-1 text-emerald-950/60 hover:text-emerald-950","aria-label":"Close",children:e.jsx(ce,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 border-b border-emerald-100 shrink-0 bg-white",children:[e.jsx("button",{onClick:()=>k("stories"),className:`py-3 text-xs font-extrabold uppercase tracking-wide transition-colors ${v==="stories"?"text-emerald-950 border-b-2 border-amber-500":"text-slate-400 border-b-2 border-transparent"}`,children:"Latest Stories"}),e.jsx("button",{onClick:()=>k("live"),className:`py-3 text-xs font-extrabold uppercase tracking-wide transition-colors ${v==="live"?"text-emerald-950 border-b-2 border-emerald-700":"text-slate-400 border-b-2 border-transparent"}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-600"}),"Live Nearby"]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:v==="live"?e.jsx(he,{userState:c,userLocation:f,onClose:a}):e.jsxs(e.Fragment,{children:[m.map(s=>{const l=me(s);return e.jsxs("button",{onClick:()=>{a(),x(`/article/${s.slug}`)},className:"flex items-start gap-2.5 w-full px-4 py-2 border-b border-emerald-50 text-left hover:bg-emerald-50/50 transition-colors",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[e.jsxs("div",{className:`flex items-center gap-1 min-w-0 ${l.barClass}`,children:[s.is_lead&&e.jsx(fe,{className:"w-3 h-3 text-amber-500 fill-amber-500 shrink-0"}),e.jsx("span",{className:`text-[10px] font-bold uppercase tracking-wide truncate ${l.textClass||"text-emerald-700"}`,children:s.category})]}),e.jsx("span",{className:"text-[10px] text-slate-400 shrink-0 leading-none",children:be(s.published_at)})]}),e.jsx("h2",{className:"text-[14px] font-heading font-bold text-emerald-950 leading-[1.18] line-clamp-2",children:xe(s.headline)}),s.source_name&&s.content_origin!=="country_herald"&&e.jsx("span",{className:"text-[10px] text-slate-400 mt-0.5 leading-none truncate block",children:s.source_name})]}),s.image_url&&e.jsx("div",{className:"w-[110px] shrink-0",children:e.jsx("div",{className:"relative w-full overflow-hidden rounded-[6px] bg-emerald-50",style:{aspectRatio:"16 / 9"},children:e.jsx(de,{src:s.image_url,alt:s.image_alt||s.headline,className:"absolute inset-0 w-full h-full object-cover",fittingType:"fill"})})})]},s.id)}),d&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Z,{className:"w-5 h-5 text-emerald-300 animate-spin"})}),y&&e.jsx("div",{ref:C,className:"h-4"}),!d&&!y&&m.length>0&&e.jsx("p",{className:"text-center text-xs text-emerald-950/40 py-4",children:"You're all caught up."}),!d&&m.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(oe,{className:"w-10 h-10 text-emerald-100 mb-3"}),e.jsx("p",{className:"text-sm text-emerald-950/60",children:"No stories available right now."})]})]})})]})})}function G(r){const a=Date.parse((r==null?void 0:r.published_at)||"");return Number.isFinite(a)?a:0}function be(r){if(!r)return"";const a=Date.parse(r);if(!Number.isFinite(a))return"";const c=new Date(a),x=Math.max(0,Math.floor((new Date-c)/1e3));if(x<60)return"just now";const p=Math.floor(x/60);if(p<60)return`${p}m ago`;const o=Math.floor(p/60);if(o<24)return`${o}h ago`;const d=Math.floor(o/24);return d<7?`${d}
1d ago`:c.toLocaleDateString()}export{Me 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.