"use strict";(self["webpackChunk_zoom_client_email_desktop"]=self["webpackChunk_zoom_client_email_desktop"]||[]).push([[597],{9058:function(e,t,i){i.d(t,{Z:function(){return A}});var n=function(){var e,t=this,i=t._self._c;return i("div",[i("zm-dropdown",{ref:"labelsRef",staticClass:"tab-focus",attrs:{trigger:"click",placement:"bottom-start"},on:{"visible-change":t.handleVisibleChange,command:t.handleApply}},["button"===t.triggerStyle?i("zm-button",{ref:"trigger",staticClass:"button-trigger-override",attrs:{tabindex:"-1"}},[t._t("trigger")],2):"dropdown-item"===t.triggerStyle?i("zm-dropdown-item",{ref:"trigger",staticClass:"button-trigger-override"},[t._t("trigger")],2):t._e(),i("zm-dropdown-menu",{ref:"menu",staticClass:"menu",attrs:{slot:"dropdown"},slot:"dropdown"},[i("zm-input",{ref:"searchInput",staticClass:"search-input",attrs:{placeholder:t.$t("search.search"),autocorrect:"off",autocapitalize:"none","zm-ta":"setting-template-search-input","aria-activedescendant":null===(e=t.$refs.menu)||void 0===e?void 0:e.activedescendant},model:{value:t.searchQuery,callback:function(e){t.searchQuery=e},expression:"searchQuery"}},[i("SvgIcon",{attrs:{slot:"prefix",iconClass:"search"},slot:"prefix"})],1),i("div",{staticClass:"menu-divider"}),i("zm-dropdown-item",{staticClass:"menu-item",attrs:{tabindex:"0",command:"createNewLabel","zm-ta":(t.isMove?"move-":"")+"dropdown-user-label-add"}},[i("div",{staticClass:"menu-item-content"},[i("svg-icon",{attrs:{iconClass:"plus"}}),i("span",{staticClass:"menu-item--text"},[t._v(" "+t._s(t.isOutlook?t.$t("label.createFolder"):t.$t("label.createLabel"))+" ")])],1)]),t.displayedLabels.length-1&&s>-1?n-s:s>-1&&void 0===n?1:-1}))}},mounted:function(){this.initItem()},methods:(0,c.Z)((0,c.Z)((0,c.Z)({},(0,v.nv)("inbox",["removeSelectedInboxMailIds"])),(0,v.nv)("action",["moveMails"])),{},{initUserLabels:function(){var e,t=this.userLabels;return(this.isOutlook||this.isZmail)&&(t=this.flattenedUserLabels),t=null===(e=t)||void 0===e?void 0:e.map(this.$pickItemFromUserLabel),t.forEach((function(e){e.checked=0})),t},initItem:function(){this.labels=this.initUserLabels(),this.bindDropdownScroll(this.$refs.menu)},showCreateDialog:function(){this.dialogVisible=!0},onCheck:function(e,t){var i,n=null===(i=t.target)||void 0===i?void 0:i.value;if(n){var s,a=this.labels.find((function(e){return e.id===n})),l=null===(s=JSON.parse(this.labelsCopy))||void 0===s?void 0:s.find((function(e){return e.id===n}));if(a)if(2===l.checked)switch(a.checked){case 0:a.checked=2;break;case 2:a.checked=1;break;case 1:a.checked=0;break}else a.checked=e?1:0}this.handleApplyBatchLabels()},handleApply:function(e){e&&("createNewLabel"===e?this.showCreateDialog():this.isMove?(this.handleMove(e),this.goBack()):this.handleLabel(e))},handleLabel:function(e){var t=this.labels.find((function(t){return t.id===e}));if(t){var i=1===t.checked?0:1;t.checked=i,this.handleApplyBatchLabels();var n=this.selectedInboxItems.length;this.$undoNotice({iconClass:"checkmark",title:i?this.$tc("common.messageAddedTo",n,[t.title]):this.$tc("common.messageRemovedFrom",n,[t.title]),duration:5e3}),this.$metric.report("action_bar",{location:this.location,msgId:this.selectedInboxItems.map((function(e){return e.groupId})),actionKey:"label"})}},handleMove:function(e){var t=this;return(0,r.Z)((0,o.Z)().mark((function i(){var n;return(0,o.Z)().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(console.debug("handleMove (in LabelMenu.vue)",e,"selectedInboxItems",t.selectedInboxItems),n=t.selectMailLabel.id,n!==e){i.next=4;break}return i.abrupt("return");case 4:return i.next=6,t.moveMails({mails:t.selectedInboxItems.map((function(e){return{mailId:e.groupId,msgIds:e.msgIds}})),fromLabelId:n,toLabelId:e,metricConfig:{metricKey:"action_bar",params:{location:t.location,msgId:t.selectedInboxItems.map((function(e){return e.groupId})),actionKey:"move"}}});case 6:case"end":return i.stop()}}),i)})))()},handleApplyBatchLabels:function(){var e=(0,r.Z)((0,o.Z)().mark((function e(){var t,i,n,s,a,l,r;return(0,o.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=this.labels.reduce((function(e,t){var i=t.id,n=t.checked;return 2!==n&&e.push({labelId:i,owned:1===n?"OwnerByAllMails":"OwnerByNoneMails"}),e}),[]),i=this.$store.state.selectMailLabel.id,n=this.selectedInboxItems.map((function(e){var t=e.groupId,i=e.msgIds;return{groupId:t,msgIds:i}})),e.prev=3,e.next=6,f.Inbox.labelsMails({fromLabelId:i,groupMsgsIds:n,labelOwnedList:t});case 6:if(s=e.sent,0!==s.errorCode){e.next=11;break}this.$Bus.$emit("labelChangeEvent",{labelOwnedList:t}),e.next=12;break;case 11:throw Error("Changing label failed!");case 12:e.next=18;break;case 14:e.prev=14,e.t0=e["catch"](3),this.$msg({type:"Error",content:this.$t("label.updatingLabelFailed")}),console.log(e.t0);case 18:a=this.selectMailLabel.id,l=this.labels.find((function(e){return e.id===a})),0===(null===l||void 0===l?void 0:l.checked)&&(r=n.map((function(e){var t=e.groupId;return t})),this.removeSelectedInboxMailIds({mailIds:r}));case 21:case"end":return e.stop()}}),e,this,[[3,14]])})));function t(){return e.apply(this,arguments)}return t}(),setCheckedLabelList:function(){var e=this;return(0,r.Z)((0,o.Z)().mark((function t(){var i,n,s;return(0,o.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return i=function(){return e.selectedInboxItems.map(function(){var t=(0,r.Z)((0,o.Z)().mark((function t(i){return(0,o.Z)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,f.Inbox.getMailLabelStatus({labelId:e.$store.state.selectMailLabel.id,groupMsgsIds:[(0,c.Z)({},i)]});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},t.next=3,Promise.all(i());case 3:n=t.sent,s=new Map,n.forEach((function(t,i){for(var n=new Set,a=new Set,o=t||[],r=0;r0,expression:"actionsInMoreMenu.length > 0"}],staticClass:"item",attrs:{placement:"bottom-start"},on:{command:function(e){return e()},"visible-change":e.onVisibleChange}},[t("HeaderAction",{attrs:{iconClass:"more-horizontal",hideLabel:"",tabindex:"0",label:e.$t("common.moreOptions"),"zm-ta":e.location+"-action-header-more",location:e.location}}),t("zm-dropdown-menu",{ref:"menu",staticClass:"more-menu",attrs:{slot:"dropdown"},slot:"dropdown"},e._l(e.actionsInMoreMenu,(function(i){return t("zm-dropdown-item",{key:i.key,attrs:{"zm-ta":e.location+"-action-header-"+(i.taTag||i.label.replaceAll(" ","-").toLowerCase()),command:["label","move"].includes(i.key)?function(){return e.$refs[i.key][0].openLabelMenu()}:i.onClick}},[["label","move"].includes(i.key)?t("LabelMenu",{ref:i.key,refInFor:!0,attrs:{selectedInboxItems:e.selectedInboxItems,isMove:"move"===i.key,triggerStyle:"dropdown-item"},scopedSlots:e._u([{key:"trigger",fn:function(){return[e._v(" "+e._s(i.label)+" ")]},proxy:!0}],null,!0)}):"snooze"===i.key?t("context-menu-sub",[t("div",{staticClass:"snooze-item",attrs:{slot:"trigger"},slot:"trigger"},[t("div",{staticClass:"label"},[e._v(e._s(e.$t("operation.snooze")))]),t("svg-icon",{attrs:{iconClass:"arrow-right"}})],1),t("snooze-menu",{attrs:{hasUnsnooze:i.isInSnoozed},on:{onSnoozeTime:i.onSnooze,unsnooze:i.unsnooze}})],1):t("div",[e._v(" "+e._s(i.label)+" ")])],1)})),1)],1)],2)},s=[],a=i(6041),l=i(37761),o=i(33223),r=i(66106),c=i(9058),u=i(91007),d=i(60753),h=i(78543),b=i(69003),m=500,f=100,p=24,v=50,g={name:"ActionBar",components:{HeaderAction:r.Z,LabelMenu:c.Z,ShortcutReminder:u.Z,SnoozeMenu:d.Z,ContextMenuSub:b.Z},mixins:[h.Z],props:{actions:{type:Array,default:function(){return[]}},menuActions:{type:Array,default:function(){return[]}},selectedInboxItems:{type:Array,default:function(){return[]}},hideLabels:{type:Boolean,default:!1},maxNumDisplayed:{type:Number,default:null},alignment:{type:String,default:"left"},location:{type:String,default:"inbox"}},data:function(){return{numActionsInBar:0}},computed:{visibleActions:function(){return this.actions.slice(0,this.numActionsInBar)},overflowActions:function(){return this.actions.slice(this.numActionsInBar)},actionsInMoreMenu:function(){return[].concat((0,a.Z)(this.overflowActions),(0,a.Z)(this.menuActions))}},watch:{overflowActions:function(){this.visible&&this.resetDropdownOptions(this.$refs.menu)}},created:function(){this.debouncedAdjust=(0,l.throttle)(this.adjustNumActions,16)},mounted:function(){this.adjustNumActions(),this.resizeObserver=new o.Z(this.debouncedAdjust),this.visible&&this.resizeObserver.observe(this.$refs.bar)},beforeDestroy:function(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.debouncedAdjust.cancel()},methods:{getActionBarWidth:function(){var e,t=(null===(e=this.$refs.bar)||void 0===e?void 0:e.getBoundingClientRect().width)||m;return Math.max(0,t-v-p)},adjustNumActions:function(){var e=this.getActionBarWidth();this.numActionsInBar=Math.floor(e/f),this.checkActionBarFit()},checkActionBarFit:function(){var e=this;this.$nextTick((function(){var t,i=e.getActionBarWidth(),n=null===(t=e.$refs.buttons)||void 0===t?void 0:t.reduce((function(e,t){return e+(null===t||void 0===t?void 0:t.getBoundingClientRect().width)||f}),0);return!(n>i)||(console.debug("Width correction triggered"),e.numActionsInBar--,e.checkActionBarFit())}))},onVisibleChange:function(){this.$Bus.$emit("hideActions")}}},k=g,L=i(93483),y=(0,L.Z)(k,n,s,!1,null,"3d348226",null),I=y.exports}}]);