"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[2539],{22539:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var s=a(71633),n=a.n(s),r=a(36418),c=a.n(r),l=a(14778),o=a(37270),d=a(81911),i=a(49664),u=a(65642),m=a(77440),f=a(73969),b=a(14776),p=a(26241),h=a(67173),E=a(45697),C=a(78451);const S=(0,h.wV)(),k=c().createElement("i",{"data-testid":"scheduledPostIcon",className:"icon icon-draft-indicator icon-clock-send-outline"}),N=c().createElement("i",{"data-testid":"draftIcon",className:"icon icon-draft-indicator icon-pencil-outline"});function v(){const e=(0,o.useDispatch)(),t=(0,r.useRef)(!1),a=(0,o.useSelector)(m.LW),s=(0,o.useSelector)(S),h=(0,o.useSelector)(b.Sy),v=(0,o.useSelector)((e=>(0,f.cn)(e,h,!0))),M=(0,o.useSelector)(f.Ck),g=s>0||M&&v>0,L=(0,o.useSelector)((e=>(0,f.U)(e,h))),{url:_}=(0,d.useRouteMatch)(),w=(0,d.useRouteMatch)("/:team/drafts"),I=(0,d.useRouteMatch)("/:team/"+C.pj),P=Boolean(w||I),D=(0,r.useCallback)((()=>P),[P]);(0,r.useEffect)((()=>{a&&e((0,p.Vp)(h))}),[h,a,e]),(0,r.useEffect)((()=>{const a=!t.current;M&&e((0,u.cT)(h,a)),t.current=!0}),[e,M,h]);const R=M&&v>0,x=(0,r.useMemo)((()=>c().createElement(l.FormattedMessage,{id:"drafts.tooltipText",defaultMessage:"{draftCount, plural, =0 {} =1 {1 Draft} other {{draftCount} Drafts}} <br></br> {scheduledPostCount, plural, =0 {} other {{scheduledPostCount} Scheduled}}",values:{draftCount:s,scheduledPostCount:v,br:e=>s>0&&v>0?c().createElement(c().Fragment,null,c().createElement("br",null),e):null}})),[s,v]);return g||P?c().createElement("ul",{className:"SidebarDrafts NavGroupContent nav nav-pills__container"},c().createElement("li",{className:"SidebarChannel",tabIndex:-1,id:"sidebar-drafts-button"},c().createElement(d.NavLink,{to:`${_}/drafts`,id:"sidebarItem_drafts",activeClassName:"active",draggable:"false",className:"SidebarLink sidebar-item",tabIndex:0,isActive:D},c().createElement("i",{"data-testid":"sendPostIcon",className:"icon icon-send-post icon-send"}),c().createElement("div",{className:"SidebarChannelLinkLabel_wrapper"},c().createElement("span",{className:"SidebarChannelLinkLabel sidebar-item__name"},c().createElement(l.FormattedMessage,{id:"drafts.sidebarLink",defaultMessage:"Drafts"}))),c().createElement(i.WithTooltip,{title:x},c().createElement("div",null,s>0&&c().createElement(E.A,{unreadMentions:s,icon:N}),R&&c().createElement(E.A,{unreadMentions:v,icon:k,className:n()("scheduledPostBadge",{persistent:L}),hasUrgent:L})))))):null}const M=(0,r.memo)(v)}}]);
//# sourceMappingURL=2539.b15bd27a029f9989ca0a.js.map