1import{j as y}from"./jsx-runtime-D_zvdyIk.js";import{r as e}from"./chunk-JZWAC4HX-CWXBk4Fr.js";import"./section-layout-D_T60sp3.js";import"./index-eoqpUOz7.js";import"./tabs-CGsfRUoC.js";import"./index-DeeQjsLN.js";function j(){const[r,s]=e.useState({unreadCount:0,totalCount:0}),[n,o]=e.useState([]),[u,c]=e.useState(!1),[l,f]=e.useState(!1),i=e.useCallback(async()=>{try{const t=await fetch("/api/notifications?stats=true");if(t.ok){const a=await t.json();s(a)}}catch(t){console.error("Failed to fetch notification stats:",t)}},[]),m=e.useCallback(async()=>{if(!l){c(!0);try{const t=await fetch("/api/notifications?limit=10");if(t.ok){const a=await t.json();o(a.notifications||[]),s({unreadCount:a.unreadCount,totalCount:a.totalCount}),f(!0)}}catch(t){console.error("Failed to fetch notifications:",t)}finally{c(!1)}}},[l]),p=e.useCallback(async t=>{try{await fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationIds:t})}),o(a=>a.map(d=>t.includes(d.id)?{...d,isRead:!0}:d)),s(a=>({...a,unreadCount:Math.max(0,a.unreadCount-t.length)}))}catch(a){console.error("Failed to mark notifications as read:",a)}},[]),C=e.useCallback(async()=>{try{await fetch("/api/notifications",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markAll:!0})}),o(t=>t.map(a=>({...a,isRead:!0}))),s(t=>({...t,unreadCount:0}))}catch(t){console.error("Failed to mark all notifications as read:",t)}},[]),S=e.useCallback(()=>{setTimeout(()=>f(!1),5e3)},[]);return e.useEffect(()=>{i();const t=setInterval(i,6e4),a=()=>{i(),f(!1)};return window.addEventListener("notifications:refresh",a),()=>{clearInterval(t),window.removeEventListener("notifications:refresh",a)}},[i]),{stats:r,notifications:n,isLoading:u,hasFetched:l,fetchStats:i,fetchNotifications:m,markAsRead:p,markAllAsRead:C,resetFetchState:S}}const h=e.createContext({masthead:null,setMasthead:()=>{}});function F({children:r}){const[s,n]=e.useState(null),o=e.useCallback(c=>{n(()=>c)},[]),u=e.useMemo(()=>({masthead:s,setMasthead:o}),[s,o]);return y.jsx(h.Provider,{value:u,children:r})}function R(){return e.useContext(h).masthead}function E(r,s){const{setMasthead:n}=e.useContext(h),o=e.useRef(r);o.current=r,e.useEffect(()=>(n(o.current),()=>n(null)),[n,s])}export{F as H,E as a,R as b,j as u};
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.