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