1import{_ as pe}from"./xwfsBOoF.js";import{d as ge,u as ve,U as ye,c as me,e as V,r as f,o as fe,l as be,n as u,v as t,t as M,s as k,L as n,p as e,m as I,x as N,ae as z,y as xe,z as ke,G as y,H as A,I as E,F as _e,q as d,D as O,K as L,N as $,M as he}from"#entry";import{u as we}from"./DFp59i6L.js";import{u as Ce}from"./BA38kEZL.js";const Se={class:"mb-6"},Fe={class:"flex items-center justify-between gap-4 mb-4"},Me={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4"},Ne={class:"flex items-center gap-2"},Re={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},Pe={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3"},Ae={class:"relative"},Ee=["value"],Te={class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},De={class:"relative"},Ve=["value"],Ie={class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},Oe={class:"relative"},Be={class:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},je={class:"relative"},Ue=["value"],ze={class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},Le={key:0,class:"bg-primary rounded-lg p-12 border border-primary text-center"},$e={class:"flex flex-col items-center justify-center"},Ge={key:1,class:"bg-primary rounded-lg p-6 border border-red-500 mb-6"},He={class:"flex items-start gap-3"},Ye={class:"flex-1"},We={key:2,class:"flex flex-col",style:{"min-height":"calc(100vh - 20rem)"}},Je={class:"flex-1 overflow-y-auto mb-4"},Ke={class:"space-y-3"},qe=["onClick"],Qe={class:"flex items-start gap-4"},Xe={class:"flex-1 min-w-0"},Ze={class:"flex items-start gap-3 mb-2"},et={key:0,class:"flex items-center gap-2 flex-wrap mt-2"},tt={key:0,class:"text-sm font-medium",style:{color:"#ef4444"}},ot={key:1,class:"flex flex-wrap gap-2 mt-3"},st={class:"flex-shrink-0 flex flex-col items-end gap-2"},lt=["checked","onClick"],rt={class:"flex items-center justify-center gap-1 sm:gap-2"},nt={class:"flex items-center gap-1"},at={key:3,class:"bg-primary rounded-lg p-12 border border-primary text-center"},it={class:"flex flex-col items-center justify-center"},vt=ge({__name:"notifications",setup(ct){const{isDark:B}=ve(),{getColorScheme:G}=ye(),{success:j,error:R}=me(),{fetchNotifications:H,markMultipleAsRead:Y,markAsRead:W,dismissNotification:J}=we(),{trackPageView:K,trackEngagement:q,trackEvent:m}=Ce(),s=V(()=>G(B.value)),h=f([]),p=f([]),w=f(!1),P=f(null),C=f(!1);f(!1);const g=f(1),_=f(20),S=f(0),x=V(()=>Math.ceil(S.value/_.value)),c=f({type:null,priority:null,category:null,isRead:null,tags:null,status:"ACTIVE",startDate:null,endDate:null});let T=null;const Q=()=>{T&&clearTimeout(T),T=setTimeout(()=>{F()},500)},b=async()=>{P.value=null,w.value=!0;try{const r={type:c.value.type||void 0,priority:c.value.priority||void 0,category:c.value.category||void 0,isRead:c.value.isRead!==null?c.value.isRead:void 0,tags:c.value.tags||void 0,status:c.value.status||void 0,startDate:c.value.startDate||void 0,endDate:c.value.endDate||void 0,limit:_.value,offset:(g.value-1)*_.value};Object.keys(r).forEach(a=>{r[a]===void 0&&delete r[a]});const o=await H(r);if(o&&typeof o=="object"&&"notifications"in o){const a=o;h.value=a.notifications,S.value=a.total}else{const a=o;h.value=a,S.value=a.length}}catch(r){const o=r.message||"Failed to load notifications";P.value=o,R("Failed to load notifications",o)}finally{w.value=!1}},F=()=>{m("notifications_filter_apply",{filters:{type:c.value.type||"all",priority:c.value.priority||"all",category:c.value.category||"all",isRead:c.value.isRead!==null?c.value.isRead?"read":"unread":"all",status:c.value.status||"all"},event_category:"notifications_interaction",event_label:"filter_application"}),g.value=1,p.value=[],b()},X=()=>{m("notifications_filter_clear",{event_category:"notifications_interaction",event_label:"filter_clear"}),c.value={type:null,priority:null,category:null,isRead:null,tags:null,status:"ACTIVE",startDate:null,endDate:null},F()},Z=r=>{m("notifications_item_click",{notification_id:r.id,notification_type:r.type,is_read:r.isRead,event_category:"notifications_interaction",event_label:"notification_card_click"}),U(r.id)},U=r=>{const o=p.value.indexOf(r),a=o===-1;o>-1?p.value.splice(o,1):p.value.push(r),m("notifications_selection_toggle",{notification_id:r,action:a?"select":"deselect",total_selected:p.value.length,event_category:"notifications_interaction",event_label:"notification_selection"})},ee=async()=>
1{if(p.value.length!==0){m("notifications_mark_as_read",{notification_count:p.value.length,event_category:"notifications_interaction",event_label:"mark_multiple_as_read"}),C.value=!0;try{await Y(p.value),j("Success",`${p.value.length} notification(s) marked as read`),p.value=[],await b()}catch(r){R("Error",r.message||"Failed to mark notifications as read"),m("notifications_mark_as_read_error",{error_message:r.message||"Unknown error",notification_count:p.value.length,event_category:"notifications_error",event_label:"mark_as_read_failed"})}finally{C.value=!1}}},te=async(r,o)=>{try{if(m("notifications_action_click",{notification_id:o.id,notification_type:o.type,action_type:r.type,action_label:r.label,action_url:r.url||null,event_category:"notifications_interaction",event_label:"notification_action"}),r.type==="LINK"&&r.url){if(r.dismissOnClick)try{await W(o.id)}catch{}const a=r.url;a.startsWith("http://")||a.startsWith("https://")?window.open(a,"_blank"):await he(a)}else if(r.type==="DISMISS"||r.dismissOnClick)try{await J(o.id),j("Success","Notification dismissed"),await b()}catch(a){R("Error",a.message||"Failed to dismiss notification")}else r.type}catch(a){R("Error",a.message||"Failed to handle action")}},oe=r=>{const o={INFO:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",SUCCESS:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",WARNING:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",ERROR:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",PROMOTION:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",UPDATE:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200",SYSTEM:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",PAYMENT:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",SUBSCRIPTION:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"};return o[r]||o.INFO},se=r=>{const o=new Date(r),a=o.getDate(),l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][o.getMonth()],i=o.getFullYear(),D=o.getHours(),ie=o.getMinutes(),ce=D>=12?"PM":"AM",de=D%12||12,ue=ie.toString().padStart(2,"0");return`${a} ${l} ${i} at ${de}:${ue} ${ce}`},le=V(()=>{const r=[];let a=Math.max(1,g.value-Math.floor(2.5)),v=Math.min(x.value,a+5-1);v-a<4&&(a=Math.max(1,v-5+1));for(let l=a;l<=v;l++)r.push(l);return r}),re=r=>{r>=1&&r<=x.value&&(m("notifications_pagination",{page_number:r,total_pages:x.value,page_size:_.value,event_category:"notifications_interaction",event_label:"pagination_navigation"}),g.value=r,b())},ne=()=>{g.value<x.value&&(m("notifications_pagination_next",{current_page:g.value,next_page:g.value+1,total_pages:x.value,event_category:"notifications_interaction",event_label:"pagination_next"}),g.value++,b())},ae=()=>{g.value>1&&(m("notifications_pagination_prev",{current_page:g.value,prev_page:g.value-1,total_pages:x.value,event_category:"notifications_interaction",event_label:"pagination_previous"}),g.value--,b())};return fe(async()=>{K("Notifications","/notifications"),q("page_load",1),await b()}),be({title:"Notifications - yLnk",description:"View and manage your notifications"}),(r,o)=>{const a=pe,v=_e;return d(),u("div",null,[t("div",Se,[t("div",Fe,[M(a,{title:"User Notifications",description:"View and manage your notifications","show-back-button":!0}),M(v,{onClick:X,variant:"outline",size:"sm",class:"font-medium flex items-center gap-2 flex-shrink-0",style:n({borderColor:e(s).border,color:e(s).textSecondary,backgroundColor:"transparent",border:`1px solid ${e(s).border}`})},{default:k(()=>[...o[4]||(o[4]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),t("span",null,"Clear Filters",-1)])]),_:1},8,["style"])])]),t("div",{class:"bg-secondary/50 rounded-xl shadow-sm p-4 sm:p-5 border mb-6",style:n({backgroundColor:e(s).background,borderColor:e(s).border})},[t("div",Me,[t("div",Ne,[(d(),u("svg",{class:"w-5 h-5",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[5]||(o[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"},null,-1)])],4)),t("h3",{class:"text-sm font-semibold",style:n({color:e(s).textPrimary})},"Filters",4)]),e(p).length>0?(d(),I(v,{key:0,onClick:ee,disabled:e(C),size:"sm",class:"font-medium flex items-center gap-2 shadow-sm",style:n({backgroundColor:e(s).accent,color:"#FFFFFF"})},{default:k(()=>[e(C)?(d(),u("svg",Re,[...o[6]||(o[6]=[t("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),t("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)])])):N("",!0),t("span",null,y(e(C)?"Marking...":`Mark ${e(p).length} as Read`),1)]),_:1},8,["disabled","style"])):N("",!0)]),t("div",Pe,[t("div",null,[t("label",{class:"block text-xs font-medium mb-1.5",style:n({color:e(s).textSecondary})},"Type",4),t("div",Ae,[t("select",{value:e(c).type||"",onChange:o[0]||(o[0]=l=>{const i=l.target;e(c).type=i.value===""?null:i.value,F()}),class:"w-full px-3 py-2 pr-8 rounded-lg text-sm border focus:outline-none focus:ring-2 transition-all appearance-none cursor-pointer",style:n({backgroundColor:e(s).background,borderColor:e(s).border,color:e(s).textPrimary,"--tw-ring-color":e(s).accent})},[...o[7]||(o[7]=[z('<option value="">All Types</option><option value="INFO">Info</option><option value="SUCCESS">Success</option><option value="WARNING">Warning</option><option value="ERROR">Error</option><option value="PROMOTION">Promotion</option><option value="UPDATE">Update</option><option value="SYSTEM">System</option><option value="PAYMENT">Payment</option><option value="SUBSCRIPTION">Subscription</option>',10)])],44,Ee),t("div",Te,[(d(),u("svg",{class:"w-4 h-4",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[8]||(o[8]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],4))])])]),t("div",null,[t("label",{class:"block text-xs font-medium mb-1.5",style:n({color:e(s).textSecondary})}
1,"Priority",4),t("div",De,[t("select",{value:e(c).priority||"",onChange:o[1]||(o[1]=l=>{const i=l.target;e(c).priority=i.value===""?null:i.value,F()}),class:"w-full px-3 py-2 pr-8 rounded-lg text-sm border focus:outline-none focus:ring-2 transition-all appearance-none cursor-pointer",style:n({backgroundColor:e(s).background,borderColor:e(s).border,color:e(s).textPrimary,"--tw-ring-color":e(s).accent})},[...o[9]||(o[9]=[z('<option value="">All Priorities</option><option value="LOW">Low</option><option value="NORMAL">Normal</option><option value="HIGH">High</option><option value="URGENT">Urgent</option>',5)])],44,Ve),t("div",Ie,[(d(),u("svg",{class:"w-4 h-4",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[10]||(o[10]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],4))])])]),t("div",null,[t("label",{class:"block text-xs font-medium mb-1.5",style:n({color:e(s).textSecondary})},"Category",4),t("div",Oe,[t("div",Be,[(d(),u("svg",{class:"w-4 h-4",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[11]||(o[11]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},null,-1)])],4))]),xe(t("input",{"onUpdate:modelValue":o[2]||(o[2]=l=>e(c).category=l),onInput:Q,type:"text",placeholder:"Search category...",class:"w-full pl-9 pr-3 py-2 rounded-lg text-sm border focus:outline-none focus:ring-2 transition-all",style:n({backgroundColor:e(s).background,borderColor:e(s).border,color:e(s).textPrimary,"--tw-ring-color":e(s).accent})},null,36),[[ke,e(c).category]])])]),t("div",null,[t("label",{class:"block text-xs font-medium mb-1.5",style:n({color:e(s).textSecondary})},"Status",4),t("div",je,[t("select",{value:e(c).isRead===null?"":e(c).isRead.toString(),onChange:o[3]||(o[3]=l=>{const i=l.target;e(c).isRead=i.value===""?null:i.value==="true",F()}),class:"w-full px-3 py-2 pr-8 rounded-lg text-sm border focus:outline-none focus:ring-2 transition-all appearance-none cursor-pointer",style:n({backgroundColor:e(s).background,borderColor:e(s).border,color:e(s).textPrimary,"--tw-ring-color":e(s).accent})},[...o[12]||(o[12]=[t("option",{value:""},"All Status",-1),t("option",{value:"true"},"Read",-1),t("option",{value:"false"},"Unread",-1)])],44,Ue),t("div",ze,[(d(),u("svg",{class:"w-4 h-4",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[13]||(o[13]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],4))])])])])],4),e(w)&&e(h).length===0?(d(),u("div",Le,[t("div",$e,[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 mb-4",style:n({borderColor:e(s).accent})},null,4),t("p",{class:"text-sm",style:n({color:e(s).textSecondary})},"Loading notifications...",4)])])):e(P)?(d(),u("div",Ge,[t("div",He,[o[15]||(o[15]=t("svg",{class:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("div",Ye,[t("h3",{class:"text-sm font-semibold mb-1",style:n({color:e(s).textPrimary})},"Error Loading Notifications",4),t("p",{class:"text-sm",style:n({color:e(s).textSecondary})},y(e(P)),5),M(v,{onClick:b,size:"sm",class:"mt-3 font-medium",style:n({backgroundColor:e(s).accent,color:"#FFFFFF"})},{default:k(()=>[...o[14]||(o[14]=[O(" Try Again ",-1)])]),_:1},8,["style"])])])])):e(h).length>0?(d(),u("div",We,[t("div",Je,[t("div",Ke,[(d(!0),u(A,null,E(e(h),l=>(d(),u("div",{key:l.id,class:L(["group rounded-lg p-4 cursor-pointer transition-all hover:shadow-md",{"opacity-75":l.isRead}]),style:n({borderWidth:e(p).includes(l.id)?"2px":"1px",borderStyle:"solid",borderColor:e(p).includes(l.id)?e(s).accent:e(s).border,backgroundColor:e(s).background,outline:e(p).includes(l.id)?`2px solid ${e(s).accent}`:"none",outlineOffset:e(p).includes(l.id)?"2px":"0"}),onClick:i=>Z(l)},[t("div",Qe,[t("div",Xe,[t("div",Ze,[t("span",{class:L(["px-2.5 py-1 rounded-md text-xs font-semibold uppercase tracking-wide flex-shrink-0",oe(l.type)])},y(l.type),3),t("h4",{class:"text-base font-bold flex-1 min-w-0",style:n({color:e(s).textPrimary})},y(l.title),5)]),t("p",{class:"text-sm leading-relaxed mb-2",style:n({color:e(s).textSecondary})},y(l.message),5),l.category||l.tags?.length?(d(),u("div",et,[l.category?(d(),u("span",tt,y(l.category),1)):N("",!0),(d(!0),u(A,null,E(l.tags?.slice(0,2),i=>(d(),u("span",{key:i,class:"text-xs px-2 py-0.5 rounded",style:n({backgroundColor:e(B)?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.04)",color:e(s).textSecondary})}," #"+y(i),5))),128))])):N("",!0),l.actions&&l.actions.length>0?(d(),u("div",ot,[(d(!0),u(A,null,E(l.actions,i=>(d(),I(v,{key:i.id,onClick:$(D=>te(i,l),["stop"]),variant:i.style==="PRIMARY"||i.style==="SUCCESS"||i.style==="DANGER"?"solid":"outline",size:"xs",class:"font-medium",style:n(i.style==="PRIMARY"?{backgroundColor:e(s).accent,color:"#FFFFFF"}:i.style==="SUCCESS"?{backgroundColor:"#10b981",color:"#FFFFFF"}:i.style==="DANGER"?{backgroundColor:"#ef4444",color:"#FFFFFF"}:{})},{default:k(()=>[O(y(i.label),1)]),_:2},1032,["onClick","variant","style"]))),128))])):N("",!0)]),t("div",st,[t("div",{class:"flex items-center gap-1.5 text-xs",style:n({color:e(s).textSecondary})},[o[16]||(o[16]=t("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("span",null,y(se(l.createdAt)),1)],4),t("input",{type:"checkbox",checked:e(p).includes(l.id),onClick:$(i=>U(l.id),["stop"]),class:"w-4 h-4 rounded border-2 cursor-pointer transition-all",style:n({accentColor:e(s).accent,borderColor:e(p).includes(l.id)?e(s).accent:e(s).border})},null,12,lt)])])],14,qe))),128))])]),t("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mt-4 bg-primary rounded-lg p-4 border border-primary flex-shrink-0",style:n({borderColor:e(s).border})},[t("div",{class:"text-xs sm:text-sm text-center sm:text-left",style:n({color:e(s).textSecondary})}," Showing "+y((e(g)-1)*e(_)+1)+" to "+y(Math.min(e(g)*e(_),e(S)))+" of "+y(e(S))+" notifications ",5),t("div",rt,[M(v,{onClick:ae,disabled:e(g)===1||e(w),variant:"outline",size:"sm",style:n({borderColor:e(s).border,color:e(s).textPrimary,backgroundColor:"transparent"})},{default:k(()=>[...o[17]||(o[17]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1},8,["disabled","style"]),t("div",nt,[(d(!0),u(A,null,E(e(le),l=>(d(),I(v,{key:l,onClick:i=>re(l),variant:l===e(g)?"solid":"outline",size:"sm",style:n(l===e(g)?{backgroundColor:e(s).accent,color:"#FFFFFF"}:{borderColor:e(s).border,color:e(s).textPrimary})},{default:k(()=>[O(y(l),1)]),_:2},1032,["onClick","variant","style"]))),128))]),M(v,{onClick:ne,disabled:e(g)===e(x)||e(w),variant:"outline",size:"sm",style:n({borderColor:e(s).border,color:e(s).textPrimary,backgroundColor:"transparent"})},{default:k(()=>[...o[18]||(o[18]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)])]),_:1},8,["disabled","style"])])],4)])):(d(),u("div",at,[t("div",it,[(d(),u("svg",{class:"w-16 h-16 mb-4",style:n({color:e(s).textSecondary}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[19]||(o[19]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},null,-1)])],4)),t("h3",{class:"text-lg font-semibold mb-2",style:n({color:e(s).textPrimary})},"No Notifications",4),t("p",{class:"text-sm",style:n({color:e(s).textSecondary})},"You don't have any notifications yet.",4)])]))])}}});
1export{vt 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.