var T=Object.defineProperty,k=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var r=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var p=(n,i,e)=>i in n?T(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e,m=(n,i)=>{for(var e in i||(i={}))R.call(i,e)&&p(n,e,i[e]);if(r)for(var e of r(i))b.call(i,e)&&p(n,e,i[e]);return n},f=(n,i)=>k(n,M(i));import{M as q}from"./MkPagination-urywMrXv.js";import{X as x}from"./MkNotification-CZxoNE6o.js";import{_ as B}from"./MkDateSeparatedList.vue_vue_type_style_index_0_lang-bpwwzSpi.js";import{M as C}from"./MkNote-Y7yPCL5J.js";import{$ as y,B as _,r as X,i as O,n as S}from"./app-JmgyQoR0.js";import{b as $,a as w,c as I,e as V,o as j,h as l,i as u,j as d,u as c,z as v,E as z,l as A}from"./vue-y3KLWBaS.js";const D={class:"_fullinfo"},E=["src"],P=$({__name:"MkNotifications",props:{includeTypes:{},unreadOnly:{type:Boolean}},setup(n){const i=n,e=w(),g={endpoint:"i/notifications",limit:10,params:I(()=>{var t;return{includeTypes:(t=i.includeTypes)!=null?t:void 0,excludeTypes:i.includeTypes?void 0:y.mutingNotificationTypes,unreadOnly:i.unreadOnly}})},N=t=>{const s=i.includeTypes?!i.includeTypes.includes(t.type):y.mutingNotificationTypes.includes(t.type);(s||document.visibilityState==="visible")&&_.send("readNotification",{id:t.id}),s||e.value.prepend(f(m({},t),{isRead:document.visibilityState==="visible"}))};let a;return V(()=>{a=_.useChannel("main"),a.on("notification",N),a.on("readAllNotifications",()=>{if(e.value){for(const t of e.value.queue)t.isRead=!0;for(const t of e.value.items)t.isRead=!0}}),a.on("readNotifications",t=>{if(e.value){for(let s=0;s<e.value.queue.length;s++)t.includes(e.value.queue[s].id)&&(e.value.queue[s].isRead=!0);for(let s=0;s<(e.value.items||[]).length;s++)t.includes(e.value.items[s].id)&&(e.value.items[s].isRead=!0)}})}),j(()=>{a&&a.dispose()}),(t,s)=>(l(),u(q,{ref_key:"pagingComponent",ref:e,pagination:g},{empty:d(()=>[c("div",D,[c("img",{src:v(X).images.info,class:"_ghost",alt:"Info"},null,8,E),c("div",null,z(v(O).ts.noNotifications),1)])]),default:d(({items:h})=>[A(B,{class:"elsfgstc",items:h,"no-gap":!0},{default:d(({item:o})=>[["reply","quote","mention"].includes(o.type)?(l(),u(C,{key:o.id,note:o.note,collapsedReply:o.type==="reply"||o.type==="mention"&&o.note.replyId!=null},null,8,["note","collapsedReply"])):(l(),u(x,{key:o.id,notification:o,"with-time":!0,full:!0,class:"_panel notification"},null,8,["notification"]))]),_:2},1032,["items"])]),_:1},512))}}),Q=S(P,[["__scopeId","data-v-de468fb4"]]);export{Q as X};
