PageSourceSearch

https://www.cladia.ai/_next/static/chunks/5713-a4e85fef9cc8e958.js

js cladia.ai collected 2026-10-09 22:56:52 UTC 9,357 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5713],{45713:function(t,e,n){n.r(e),n.d(e,{default:function(){return d}});var o=n(27573),i=n(7653),r=n(88146),a=n(81695),l=n(28764),s=n(77701),c=n(63677);function d(){let[t,e]=(0,i.useState)(!1),n=(0,i.useRef)(null),d=(0,a.useRouter)(),{notifications:u,unreadCount:f,loading:h,markAsRead:p,markAllAsRead:x}=function(t){var e,n;let{limit:o=10}=t||{},r=(0,s.oE)(),[a,l]=(0,i.useState)(null!==(e=null==r?void 0:r.notifications)&&void 0!==e?e:[]),[c,d]=(0,i.useState)(null!==(n=null==r?void 0:r.unreadCount)&&void 0!==n?n:0),[u,f]=(0,i.useState)(!(null==r?void 0:r.loaded)),[h,p]=(0,i.useState)(null),x=(0,i.useCallback)(async()=>{try{let t=await fetch("/api/notifications/unread-count");if(t.ok){let e=await t.json();d(e.count)}}catch(t){console.error("Failed to fetch unread count:",t)}},[]),g=(0,i.useCallback)(async()=>{try{let t=await fetch("/api/notifications?limit=".concat(o));if(t.ok){let e=await t.json();l(e.notifications)}else p("Failed to fetch notifications")}catch(t){console.error("Failed to fetch notifications:",t),p("Failed to fetch notifications")}finally{f(!1)}},[o]),m=(0,i.useCallback)(async()=>{await Promise.all([x(),g()])},[x,g]),y=(0,i.useCallback)(async t=>{try{(await fetch("/api/notifications/".concat(t,"/read"),{method:"PUT"})).ok&&(l(e=>e.map(e=>e.id===t?{...e,isRead:!0,readAt:new Date().toISOString()}:e)),d(t=>Math.max(0,t-1)))}catch(t){console.error("Failed to mark notification as read:",t)}},[]),v=(0,i.useCallback)(async()=>{try{(await fetch("/api/notifications/mark-all-read",{method:"PUT"})).ok&&(l(t=>t.map(t=>({...t,isRead:!0,readAt:new Date().toISOString()}))),d(0))}catch(t){console.error("Failed to mark all as read:",t)}},[]),k=(0,i.useCallback)(async t=>{try{if((await fetch("/api/notifications/".concat(t),{method:"DELETE"})).ok){var e;let n=(null===(e=a.find(e=>e.id===t))||void 0===e?void 0:e.isRead)===!1;l(e=>e.filter(e=>e.id!==t)),n&&d(t=>Math.max(0,t-1))}}catch(t){console.error("Failed to delete notification:",t)}},[a]);(0,i.useEffect)(()=>{if(null===r)m();else if(r.loaded){var t,e;l(null!==(t=r.notifications)&&void 0!==t?t:[]),d(null!==(e=r.unreadCount)&&void 0!==e?e:0),f(!1)}},[null==r?void 0:r.loaded]);let b=(0,i.useRef)(c);return(0,i.useEffect)(()=>{c>b.current&&g(),b.current=c},[c,g]),(0,i.useEffect)(()=>{let t=setInterval(()=>{m()},3e4);return()=>clearInterval(t)},[m]),{notifications:a,unreadCount:c,loading:u,error:h,markAsRead:y,markAllAsRead:v,deleteNotification:k,refresh:m}}({limit:10});(0,i.useEffect)(()=>{function o(t){n.current&&!n.current.contains(t.target)&&e(!1)}if(t)return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[t]);let g=t=>{let e=new Date(t),n=new Date().getTime()-e.getTime(),o=Math.floor(n/6e4),i=Math.floor(n/36e5),r=Math.floor(n/864e5);return o<1?"Just now":o<60?"".concat(o,"m ago"):i<24?"".concat(i,"h ago"):r<7?"".concat(r,"d ago"):e.toLocaleDateString()},m=(t,e)=>{switch(e){case"TASK":return"\uD83D\uDCCB";case"PROJECT":return"\uD83D\uDCC1";case"TIME":return"⏰";case"FINANCE":return"\uD83D\uDCB0";case"APPROVAL":return"✅";case"SYSTEM":return"\uD83D\uDD14";case"FEEDBACK":return"\uD83D\uDCAC";default:return"\uD83D\uDCE2"}},y=t=>{t.link&&(e(!1),d.push(t.link)),t.isRead||p(t.id)};return(0,o.jsxs)("div",{ref:n,style:{position:"relative"},children:[(0,o.jsxs)("button",{onClick:()=>e(!t),style:{position:"relative",background:"transparent",border:"none",cursor:"pointer",padding:8,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",transition:"background 150ms ease"},onMouseEnter:t=>{t.currentTarget.style.background=l.rS.colors.bgTertiary},onMouseLeave:t=>{t.currentTarget.style.background="transparent"},children:[(0,o.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:l.rS.colors.textSecondary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,o.jsx)("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),(0,o.jsx)("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),f>0&&(0,o.jsx)("div",{style:{position:"absolute",top:4,right:4,background:l.rS.colors.error,color:"white",borderRadius:"50%",minWidth:18,height:18,dis
1play:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600,padding:"0 4px"},children:f>99?"99+":f})]}),t&&(0,o.jsxs)("div",{className:"notification-dropdown",style:{position:"absolute",top:"calc(100% + 8px)",right:0,width:400,maxWidth:"calc(100vw - 32px)",maxHeight:500,background:l.rS.colors.bgSecondary,border:"1px solid ".concat(l.rS.colors.borderLight),borderRadius:l.rS.borderRadius.lg,boxShadow:"0 10px 40px rgba(0,0,0,0.15)",zIndex:1e3,display:"flex",flexDirection:"column"},children:[(0,o.jsx)("style",{children:"\n            @media (max-width: 480px) {\n              .notification-dropdown {\n                position: fixed !important;\n                top: 64px !important;\n                left: 16px !important;\n                right: 16px !important;\n                width: auto !important;\n                max-width: none !important;\n              }\n            }\n          "}),(0,o.jsxs)("div",{style:{padding:"16px 20px",borderBottom:"1px solid ".concat(l.rS.colors.borderLight),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,o.jsx)("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Notifications"}),f>0&&(0,o.jsx)("button",{onClick:x,style:{background:"transparent",border:"none",color:l.rS.colors.primary,fontSize:13,fontWeight:500,cursor:"pointer",padding:"4px 8px"},children:"Mark all read"})]}),(0,o.jsx)("div",{style:{overflowY:"auto",maxHeight:400},children:h?(0,o.jsx)("div",{style:{padding:40,textAlign:"center",color:l.rS.colors.textMuted},children:"Loading..."}):0===u.length?(0,o.jsxs)("div",{style:{padding:40,textAlign:"center",color:l.rS.colors.textMuted},children:[(0,o.jsx)("div",{style:{fontSize:40,marginBottom:12},children:"\uD83D\uDD14"}),(0,o.jsx)("div",{style:{fontSize:14},children:"No notifications"})]}):u.map((t,e)=>(0,o.jsx)("div",{onClick:()=>y(t),style:{padding:"12px 20px",borderBottom:e<u.length-1?"1px solid ".concat(l.rS.colors.bgTertiary):"none",cursor:"pointer",background:t.isRead?"transparent":"".concat((0,c.f)(l.rS.colors.primary,"08")),transition:"background 150ms ease"},onMouseEnter:e=>{t.link&&(e.currentTarget.style.background=l.rS.colors.bgTertiary)},onMouseLeave:e=>{e.currentTarget.style.background=t.isRead?"transparent":"".concat((0,c.f)(l.rS.colors.primary,"08"))},children:(0,o.jsxs)("div",{style:{display:"flex",gap:12,alignItems:"start"},children:[(0,o.jsx)("div",{style:{fontSize:20,marginTop:2},children:m(t.type,t.category)}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsx)("div",{style:{fontSize:14,fontWeight:t.isRead?400:600,color:l.rS.colors.textPrimary,marginBottom:4},children:t.title}),(0,o.jsx)("div",{style:{fontSize:13,color:l.rS.colors.textSecondary,marginBottom:6,lineHeight:1.45,display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:t.message}),(0,o.jsx)("div",{style:{fontSize:12,color:l.rS.colors.textMuted},children:g(t.createdAt)})]}),!t.isRead&&(0,o.jsx)("div",{style:{width:8,height:8,borderRadius:"50%",background:l.rS.colors.primary,marginTop:8,flexShrink:0}})]})},t.id))}),u.length>0&&(0,o.jsx)("div",{style:{padding:"12px 20px",borderTop:"1px solid ".concat(l.rS.colors.borderLight),textAlign:"center"},children:(0,o.jsx)(r.default,{href:"/notifications",onClick:()=>e(!1),style:{color:l.rS.colors.primary,fontSize:13,fontWeight:500,textDecoration:"none"},children:"View all notifications →"})})]})]})}},77701:function(t,e,n){n.d(e,{oE:function(){return l},zH:function(){return s}});var o=n(27573),i=n(7653),r=n(64387);let a=(0,i.createContext)(null);function l(){return(0,i.useContext)(a)}function s(t){let{children:e}=t,{status:n}=(0,r.useSession)(),[l,s]=(0,i.useState)(!1),[c,d]=(0,i.useState)({settings:null,modules:[],timer:null,pinnedNotes:[],unreadCount:0,notifications:[]}),u=(0,i.useRef)(!1);(0,i.useEffect)(()=>{"authenticated"===n&&(u.current||(u.current=!0,fetch("/api/layout/init").then(t=>t.ok?t.json():null).then(t=>{t&&d(t)}).catch(()=>{}).finally(()=>s(!0))))},[n]);let f=(0,i.useCallback)(t=>{d(e=>({...e,timer:t}))},[]),h=(0,i.useCallback)(t=>{d(e=>({...e,unreadCount:t}))},[]),p=(0,i.useCallback)(t=>{d(e=>({...e,notifications:t}))},[]),x=(0,i.useCallback)(async()=>{try{let t=await fetch("/api/timer");if(t.ok){let e=await t.json();d(t=>{var n;return{...t,timer:null!==(n=e.timer)&&void 0!==n?n:null}})}}catch(t){}},[]),g=(0,i.useCallback)(async()=>{try{let t=await fetch("/api/notes?pinned=true");if(t.ok){let e=await t.json();d(t=>{var n,o;return{...t,pinnedNotes:null!==(o=null!==(n=e.notes)&&void 0!==n?n:e)&&void 0!==o?o:[]}})}}catch(t){}},[]),m=(0,i.useCallback)(async()=>{try{let[t,e]=await Promise.all([fetch("/api/notifications/unread-count"),fetch("/api/notifications?limit=10")]),[n,o]=await Promise.all([t.ok?t.json():{count:0},e.ok?e.json():{notifications:[]}]);d(t=>{var e,i;return{...t,unreadCount:null!==(e=n.count)&&void 0!==e?e:0,notifications:null!==(i=o.notifications)&&void 0!==i?i:[]}})}catch(t){}},[]);return(0,o.jsx)(a.Provider,{value:{...c,loaded:l,setTimer:f,setUnreadCount:h,setNotifications:p,refreshTimer:x,refreshPinnedNotes:g,refreshNotifications:m},children:e})}}}]);

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.