import{M as U,R as g,U as n,V as s,X as l,W as r,a8 as h,Y as i,Z as f,e as a,az as O,bp as N,aA as T,S as E,N as B,ap as $,O as c,C as P,Q as H,P as I}from"./vendor-CsGITfgk.js";import{u as L}from"./usePushMessages-DPqg3nD3.js";import{_ as F}from"./push-message.vue_vue_type_script_setup_true_lang-Dqabwhp3.js";const q={class:"vc-push-messages__head"},Q={class:"vc-push-messages__title"},W={class:"vc-push-messages__items"},X={key:0,class:"vc-push-messages__empty"},Y={class:"vc-push-messages__empty-title"},Z={class:"vc-push-messages__empty-text"},j={class:"vc-push-messages__foot"},G=U({__name:"vc-push-messages",props:{totalCount:{},unreadCount:{},removable:{type:Boolean},canViewAll:{type:Boolean},showUnreadOnly:{type:Boolean},withOptions:{type:Boolean},offsetOptions:{default:12},placement:{default:"bottom-end"}},emits:["markReadAll","markUnreadAll","clearAll","viewAll","update:showUnreadOnly"],setup(A,{emit:p}){const d=N(A,"showUnreadOnly",p);return(e,_)=>{const y=n("VcBadge"),k=n("VcSwitch"),m=n("VcIcon"),t=n("VcButton"),o=n("VcMenuItem"),C=n("VcDropdownMenu"),M=n("VcDialogHeader"),b=n("VcDialogContent"),D=n("VcDialogFooter"),R=n("VcDialog"),S=n("VcPopover");return c(),g(S,{class:"vc-push-messages",placement:e.placement,"offset-options":e.offsetOptions,"arrow-enabled":"","max-height":"none"},{default:s(({triggerProps:w})=>[$(e.$slots,"trigger",{triggerProps:w})]),content:s(({close:w})=>[l(R,{dividers:"",size:"xs"},{default:s(()=>[l(M,{closable:!1},{default:s(()=>[r("div",q,[r("div",Q,[r("span",null,i(e.$t("push_messages.title")),1),e.unreadCount>0?(c(),g(y,{key:0,variant:"outline",size:"sm",rounded:""},{default:s(()=>[f(i(e.unreadCount),1)]),_:1})):h("",!0)]),l(k,{modelValue:a(d),"onUpdate:modelValue":_[0]||(_[0]=u=>O(d)?d.value=u:null),size:"sm"},{default:s(()=>[f(i(e.$t("push_messages.show_unread_only")),1)]),_:1},8,["modelValue"]),l(C,{class:T(["vc-push-messages__options",{"vc-push-messages__options--invisible":!e.withOptions}]),placement:"bottom-end",width:"9rem"},{trigger:s(({triggerProps:u})=>[l(t,E({icon:"",variant:"no-background"},u),{default:s(()=>[l(m,{class:"vc-push-messages__options-icon",name:"dots-vertical",size:"sm"})]),_:1},16)]),content:s(({close:u})=>[l(o,{truncate:"",onClick:z=>{u(),e.$emit("markReadAll")}},{default:s(()=>[r("span",null,i(e.$t("push_messages.options.make_all_as_read")),1)]),_:1},8,["onClick"]),l(o,{truncate:"",onClick:z=>{u(),e.$emit("markUnreadAll")}},{default:s(()=>[r("span",null,i(e.$t("push_messages.options.make_all_as_unread")),1)]),_:1},8,["onClick"])]),_:1},8,["class"])])]),_:1}),l(b,null,{container:s(()=>[r("div",W,[$(e.$slots,"items")]),e.totalCount===0?(c(),B("div",X,[r("div",Y,i(e.$t("push_messages.empty.title")),1),r("div",Z,i(e.$t("push_messages.empty.description")),1)])):h("",!0)]),_:3}),l(D,null,{default:s(()=>[r("div",j,[e.removable&&e.totalCount?(c(),g(t,{key:0,variant:"outline",color:"secondary",class:"vc-push-messages__action-start",onClick:_[1]||(_[1]=u=>e.$emit("clearAll"))},{default:s(()=>[f(i(e.$t("push_messages.clear_all")),1)]),_:1})):h("",!0),e.canViewAll?(c(),g(t,{key:1,variant:"outline",color:"secondary",class:"vc-push-messages__action-end",onClick:u=>{w(),e.$emit("viewAll")}},{default:s(()=>[f(i(e.$t("push_messages.view_all")),1)]),_:1},8,["onClick"])):h("",!0)])]),_:2},1024)]),_:2},1024)]),_:3},8,["placement","offset-options"])}}}),ee=U({__name:"push-messages",props:{offsetOptions:{}},setup(A){const p=P("showUnreadOnly_pushMessages_popup",!1),{totalCount:v,unreadCount:V,items:d,markReadAll:e,markUnreadAll:_,clearAll:y}=L({showUnreadOnly:p});function k(m){const t=document.querySelector(`.vc-push-messages__items .vc-push-message:nth-child(${m+2})`);if(t instanceof HTMLElement){t.focus();return}const o=document.querySelector(".vc-push-messages__foot");o instanceof HTMLElement&&o.focus()}return(m,t)=>(c(),g(G,{ref:"pushMessagesRef","show-unread-only":a(p),"onUpdate:showUnreadOnly":t[0]||(t[0]=o=>O(p)?p.value=o:null),"total-count":a(v),"unread-count":a(V),items:a(d),removable:"","can-view-all":"","with-options":"","offset-options":m.offsetOptions,onMarkReadAll:a(e),onMarkUnreadAll:a(_),onClearAll:a(y),onViewAll:t[1]||(t[1]=o=>m.$router.push({name:"Notifications"}))},{trigger:s(({triggerProps:o})=>[$(m.$slots,"trigger",{totalCount:a(v),unreadCount:a(V),triggerProps:o})]),items:s(()=>[(c(!0),B(I,null,H(a(d),(o,C)=>(c(),g(F,{key:o.id,"push-message":o,onToggleRead:M=>k(C)},null,8,["push-message","onToggleRead"]))),128))]),_:3},8,["show-unread-only","total-count","unread-count","items","offset-options","onMarkReadAll","onMarkUnreadAll","onClearAll"]))}});export{ee as _};
//# sourceMappingURL=push-messages.vue_vue_type_script_setup_true_lang-BMl1m4dC.js.map
