Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
mattermost
/
client
/
Filename :
544.0086e1c1357e62f672ca.js
back
Copy
"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[544],{58628:(e,t,a)=>{a.d(t,{Ht:()=>d,uN:()=>c,Fu:()=>u,ng:()=>h,_M:()=>m}),a(43813);var n=a(23877),s=a(40693),r=a(92159),i=a(1418),o=a(87988),l=a(21413);function c(e,t){return(a,i)=>{const o=i(),c=(0,l.K7)(o);return a(function(e,t,a){return async(i,o)=>{const l=o(),c=(0,r.K)(l,e,t);try{await s.mT.deleteChannelBookmark(e,t,a),i({type:n.Fi.BOOKMARK_DELETED,data:c})}catch(e){return{data:!1,error:e}}return{data:!0}}}(e,t,c))}}function d(e,t){return(a,r)=>{const i=r(),o=(0,l.K7)(i);return a(function(e,t,a){return async r=>{try{const i=await s.mT.createChannelBookmark(e,t,a);r({type:n.Fi.RECEIVED_BOOKMARK,data:i})}catch(e){return{data:!1,error:e}}return{data:!0}}}(e,t,o))}}function u(e,t,a){return async(r,i)=>{const o=i(),c=(0,l.K7)(o);return r(function(e,t,a,r){return async i=>{try{const{updated:o,deleted:l}=await s.mT.updateChannelBookmark(e,t,a,r);o&&i({type:n.Fi.RECEIVED_BOOKMARK,data:o}),l&&i({type:n.Fi.BOOKMARK_DELETED,data:l})}catch(e){return{data:!1,error:e}}return{data:!0}}}(e,t,a,c))}}function m(e,t,a){return(r,i)=>{const o=i(),c=(0,l.K7)(o);return r(function(e,t,a,r){return async i=>{try{const o=await s.mT.updateChannelBookmarkSortOrder(e,t,a,r);i({type:n.Fi.RECEIVED_BOOKMARKS,data:{channelId:e,bookmarks:o}})}catch(e){return{data:!1,error:e}}return{data:!0}}}(e,t,a,c))}}function h(e){return function(e){return async(t,a)=>{let r;try{r=await s.mT.getChannelBookmarks(e),t({type:n.Fi.RECEIVED_BOOKMARKS,data:{channelId:e,bookmarks:r}})}catch(e){return(0,o.UP)(e,t,a),t((0,i.vV)(e)),{error:e}}return{data:r}}}(e)}},52073:(e,t,a)=>{a.d(t,{Go:()=>C,Jb:()=>m,Lt:()=>g,U5:()=>h,lE:()=>b,nh:()=>f,wf:()=>E,zZ:()=>p,zk:()=>u}),a(43813),a(74883);var n=a(4629),s=a(40057),r=a(8907),i=a(57676),o=a(65952),l=a(24380),c=a(9916),d=a(78451);function u(e){return{type:d.Q3.SET_UNREAD_FILTER_ENABLED,enabled:e}}function m(e){return{type:d.Q3.SIDEBAR_DRAGGING_SET_STATE,data:e}}function h(){return{type:d.Q3.SIDEBAR_DRAGGING_STOP}}function p(e,t,a){return async(s,r)=>{if(a){const e=r().views.channelSidebar.multiSelectedChannelIds;a.forEach((t=>{e.indexOf(t)>=0&&s(E(t))}))}const i=await s((0,n.zZ)(e,t,a));return s({type:d.Q3.ADD_NEW_CATEGORY_ID,data:i.data.id})}}function g(e,t){return f(e,0,t,!1)}function f(e,t,a){let o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return(d,u)=>{const m=u(),h=m.views.channelSidebar.multiSelectedChannelIds;let p=[];if(h.length&&-1!==h.indexOf(a)){const t=(0,c.WJ)(m),n=(0,c.sC)(m);let i=[a];const o=t.find((t=>t.id===e));i=h.filter((e=>{const t=n.find((t=>e===t.id)),a=(null==t?void 0:t.type)===s.Bz.DM_CHANNEL||(null==t?void 0:t.type)===s.Bz.GM_CHANNEL;return(null==o?void 0:o.type)===r.e.CUSTOM||(null==o?void 0:o.type)===r.e.FAVORITES||a&&(null==o?void 0:o.type)===r.e.DIRECT_MESSAGES||!a&&(null==o?void 0:o.type)!==r.e.DIRECT_MESSAGES}));const l=n.map((e=>e.id));i.sort(((e,t)=>l.indexOf(e)-l.indexOf(t))),i.forEach((e=>d(E(e)))),p=i}else p=[a];const g=function(e,t,a,n,s){if(0===n)return 0;const r=(0,i.p7)(e,t),o=(0,i.n7)()(e,r),c=o.filter(((e,t)=>e!==s&&-1!==a.indexOf(e)&&t<=n)),d=n-c.length;if(r.channel_ids.length===o.length)return d;const u=(0,l.q3)(o,a,d),m=u[u.indexOf(a[0])-1];let h=r.channel_ids.indexOf(m)+1;const p=r.channel_ids.indexOf(a[0]);return-1!==p&&p<h&&(h-=1),Math.max(h-c.length,0)}(m,e,p,t,a);return d((0,n.jN)(e,p,g,o))}}function b(){return(e,t)=>0===t().views.channelSidebar.multiSelectedChannelIds.length?{data:!1}:(e({type:d.Q3.MULTISELECT_CHANNEL_CLEAR}),{data:!0})}function E(e){return(t,a)=>{const n=a();if(!n.views.channelSidebar.multiSelectedChannelIds.length){const e=(0,o.eH)(n);t({type:d.Q3.MULTISELECT_CHANNEL,data:e})}return t({type:d.Q3.MULTISELECT_CHANNEL_ADD,data:e})}}function C(e){return(t,a)=>{const n=a(),s=n.views.channelSidebar.multiSelectedChannelIds;let r=n.views.channelSidebar.lastSelectedChannel;if(!s.length){const e=(0,o.eH)(n);t({type:d.Q3.MULTISELECT_CHANNEL,data:e}),r=e}const i=(0,c.qY)(n).map((e=>e.id)),l=i.indexOf(e),u=i.indexOf(r);if(l===u)return{data:!1};const m=Math.min(u,l),h=Math.max(u,l),p=i.slice(m,h+1);return t({type:d.Q3.MULTISELECT_CHANNEL_TO,data:p})}}},52052:(e,t,a)=>{a.r(t),a.d(t,{default:()=>$});var n=a(37270),s=a(32446),r=a(30413),i=a(40057),o=a(8361),l=a(65952),c=a(14776),d=a(7430),u=a(61185),m=a(79751),h=a(2386),p=a(75270),g=a(77212),f=a(78451),b=a(62688),E=a.n(b),C=(a(3188),a(30973),a(43813),a(10844),a(74883),a(17046),a(54823),a(29012),a(4290),a(71633)),v=a.n(C),y=a(36418),M=a.n(y),_=a(14778),T=a(14696),S=a(16983),w=a(1396),I=a(63234),A=a(26808),N=a(85406),R=a(16230),P=a(36057),L=a(70669),O=a(86255),D=a(59050),k=a(90617),F=a(55476),x=a(78064),H=a(19513),U=a(4715);function B(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class q extends M().PureComponent{static getDerivedStateFromProps(e,t){return{isSearch:e.isSearch,page:e.isSearch&&!t.isSearch?0:t.page}}constructor(e){super(e),B(this,"onKeyDown",(e=>{const t=e.target,a=(0,H.e)(e,f.Ay.KeyCodes.ENTER);a&&(e.shiftKey||e.ctrlKey||e.altKey)||a&&null!=t&&t.classList.contains("more-modal__row")&&t.click()})),B(this,"handleJoin",((e,t)=>{t.stopPropagation(),this.setState({joiningChannel:e.id}),this.props.handleJoin(e,(()=>{this.setState({joiningChannel:""})})),this.isMemberOfChannel(e.id)&&this.props.closeModal(f.IQ.MORE_CHANNELS)})),B(this,"createChannelRow",(e=>{var t;const a="".concat(e.display_name,", ").concat(e.purpose).toLowerCase();let n;n=(0,x.Oj)(e)?M().createElement(N.ArchiveOutlineIcon,{size:18}):(0,R.Zp)(e)?M().createElement(N.LockOutlineIcon,{size:18}):M().createElement(N.GlobeIcon,{size:18});let s=0;null!==(t=this.props.channelsMemberCount)&&void 0!==t&&t[e.id]&&(s=this.props.channelsMemberCount[e.id]);const r=this.isMemberOfChannel(e.id)?M().createElement("div",{id:"membershipIndicatorContainer","aria-label":this.props.intl.formatMessage({id:"more_channels.membership_indicator",defaultMessage:"Membership Indicator: Joined"})},M().createElement(N.CheckIcon,{size:14}),M().createElement(_.FormattedMessage,{id:"more_channels.joined",defaultMessage:"Joined"})):null,i=this.props.intl.formatMessage(j.channelPurpose,{memberCount:s,channelPurpose:e.purpose||""}),o=M().createElement("div",{id:"channelPurposeContainer","aria-label":i},r,r?M().createElement("span",{className:"dot"}):null,M().createElement(N.AccountOutlineIcon,{size:14}),M().createElement("span",{"data-testid":"channelMemberCount-".concat(e.name)},s),e.purpose.length>0?M().createElement("span",{className:"dot"}):null,M().createElement("span",{className:"more-modal__description"},e.purpose)),l=v()("btn btn-sm",{"btn-secondary outlineButton":this.isMemberOfChannel(e.id),"btn-primary primaryButton":!this.isMemberOfChannel(e.id)}),c=M().createElement("button",{id:"joinViewChannelButton",onClick:t=>this.handleJoin(e,t),className:l,disabled:Boolean(this.state.joiningChannel),tabIndex:-1,"aria-label":this.isMemberOfChannel(e.id)?this.props.intl.formatMessage({id:"more_channels.view",defaultMessage:"View"}):this.props.intl.formatMessage({id:"joinChannel.JoinButton",defaultMessage:"Join"})},M().createElement(F.A,{loading:this.state.joiningChannel===e.id,text:j.joiningButton},M().createElement(_.FormattedMessage,{id:this.isMemberOfChannel(e.id)?"more_channels.view":"joinChannel.JoinButton",defaultMessage:this.isMemberOfChannel(e.id)?"View":"Join"}))),d=e.shared?M().createElement(D.A,{className:"shared-channel-icon",withTooltip:!0}):null;return M().createElement("div",{className:"more-modal__row",key:e.id,id:"ChannelRow-".concat(e.name),"data-testid":"ChannelRow-".concat(e.name),"aria-label":a,onClick:t=>this.handleJoin(e,t),tabIndex:0},M().createElement("div",{className:"more-modal__details"},M().createElement("div",{className:"style--none more-modal__name"},n,M().createElement("span",{id:"channelName"},e.display_name),d),o),M().createElement("div",{className:"more-modal__actions"},c,this.state.joiningChannel===e.id&&!this.isMemberOfChannel(e.id)&&M().createElement("span",{className:"sr-only",role:"alert"},M().createElement(_.FormattedMessage,{id:"more_channels.joinedChannel",defaultMessage:"Joined channel {channelName}",values:{channelName:e.display_name}}))))})),B(this,"nextPage",(e=>{var t;e.preventDefault(),this.setState({page:this.state.page+1,nextDisabled:!0}),this.nextTimeoutId=setTimeout((()=>this.setState({nextDisabled:!1})),500),this.props.nextPage(this.state.page+1),null===(t=this.channelListScroll.current)||void 0===t||t.scrollTo({top:0})})),B(this,"previousPage",(e=>{var t;e.preventDefault(),this.setState({page:this.state.page-1}),null===(t=this.channelListScroll.current)||void 0===t||t.scrollTo({top:0})})),B(this,"doSearch",(()=>{this.props.search(this.state.channelSearchValue),""===this.state.channelSearchValue&&this.setState({page:0})})),B(this,"filterChange",(e=>{this.props.changeFilter(e),this.props.filter!==e&&this.setState({page:0})})),B(this,"handleChange",(e=>{null!=e&&e.currentTarget&&this.setState({channelSearchValue:null==e?void 0:e.currentTarget.value},(()=>this.doSearch()))})),B(this,"handleClear",(()=>{this.setState({channelSearchValue:""},(()=>this.doSearch()))})),B(this,"handleChecked",(()=>{this.props.rememberHideJoinedChannelsChecked?this.props.hideJoinedChannelsPreference(!1):this.props.hideJoinedChannelsPreference(!0)})),B(this,"getEmptyStateMessage",(()=>{if(this.state.channelSearchValue.length>0)return M().createElement(_.FormattedMessage,{id:"more_channels.noMore",tagName:"strong",defaultMessage:"No results for {text}",values:{text:this.state.channelSearchValue}});switch(this.props.filter){case Y.Archived:return M().createElement(_.FormattedMessage,{id:"more_channels.noArchived",tagName:"strong",defaultMessage:"No archived channels"});case Y.Private:return M().createElement(_.FormattedMessage,{id:"more_channels.noPrivate",tagName:"strong",defaultMessage:"No private channels"});case Y.Public:return M().createElement(_.FormattedMessage,{id:"more_channels.noPublic",tagName:"strong",defaultMessage:"No public channels"});default:return M().createElement(_.FormattedMessage,{id:"more_channels.noChannels",tagName:"strong",defaultMessage:"No channels"})}})),B(this,"getFilterLabel",(()=>{switch(this.props.filter){case Y.Archived:return M().createElement(_.FormattedMessage,{id:"more_channels.show_archived_channels",defaultMessage:"Channel Type: Archived"});case Y.Public:return M().createElement(_.FormattedMessage,{id:"more_channels.show_public_channels",defaultMessage:"Channel Type: Public"});case Y.Private:return M().createElement(_.FormattedMessage,{id:"more_channels.show_private_channels",defaultMessage:"Channel Type: Private"});default:return M().createElement(_.FormattedMessage,{id:"more_channels.show_all_channels",defaultMessage:"Channel Type: All"})}})),this.nextTimeoutId=0,this.state={joiningChannel:"",page:0,nextDisabled:!1,channelSearchValue:""},this.filter=M().createRef(),this.channelListScroll=M().createRef()}componentDidMount(){!U.Fr()&&this.filter.current&&this.filter.current.focus(),document.addEventListener("keydown",this.onKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.onKeyDown)}isMemberOfChannel(e){return this.props.myChannelMemberships[e]}render(){const e=this.props.channels;let t,a,n;if(this.props.loading&&0===e.length)t=M().createElement(w.A,null);else if(0===e.length)t=M().createElement("div",{className:"no-channel-message","aria-label":this.state.channelSearchValue.length>0?this.props.intl.formatMessage(j.noMore,{text:this.state.channelSearchValue}):this.props.intl.formatMessage({id:"widgets.channels_input.empty",defaultMessage:"No channels found"})},M().createElement(P.A,null),M().createElement("h3",{className:"primary-message"},this.getEmptyStateMessage()),this.props.noResultsText);else{const e=this.state.page*this.props.channelsPerPage,s=e+this.props.channelsPerPage,r=this.props.channels.slice(e,s);t=r.map(this.createChannelRow),r.length>=this.props.channelsPerPage&&s<this.props.channels.length&&(a=M().createElement("button",{className:"btn btn-sm btn-tertiary filter-control filter-control__next",onClick:this.nextPage,disabled:this.state.nextDisabled,"aria-label":this.props.intl.formatMessage({id:"more_channels.next",defaultMessage:"Next"})},M().createElement(_.FormattedMessage,{id:"more_channels.next",defaultMessage:"Next"}))),this.state.page>0&&(n=M().createElement("button",{className:"btn btn-sm btn-tertiary filter-control filter-control__prev",onClick:this.previousPage,"aria-label":this.props.intl.formatMessage({id:"more_channels.prev",defaultMessage:"Previous"})},M().createElement(_.FormattedMessage,{id:"more_channels.prev",defaultMessage:"Previous"})))}const s=M().createElement("div",{className:"filter-row"},M().createElement("span",{id:"searchIcon","aria-hidden":"true"},M().createElement("i",{className:"icon icon-magnify"})),M().createElement(O.A,{id:"searchChannelsTextbox",ref:this.filter,className:"form-control filter-textbox",placeholder:this.props.intl.formatMessage({id:"filtered_channels_list.search",defaultMessage:"Search channels"}),onInput:this.handleChange,clearable:!0,onClear:this.handleClear,value:this.state.channelSearchValue,"aria-label":this.props.intl.formatMessage({id:"filtered_channels_list.search",defaultMessage:"Search Channels"})})),r=M().createElement(N.CheckIcon,{size:18,color:"var(--button-bg)"}),i=[M().createElement(L.q7,{key:"channelsMoreDropdownAll",id:"channelsMoreDropdownAll",onClick:()=>this.filterChange(Y.All),leadingElement:M().createElement(N.GlobeCheckedIcon,{size:16}),labels:M().createElement(_.FormattedMessage,{id:"suggestion.all",defaultMessage:"All channel types"}),trailingElements:this.props.filter===Y.All?r:null,"aria-label":this.props.intl.formatMessage({id:"suggestion.all",defaultMessage:"All channel types"})}),M().createElement(L.q7,{key:"channelsMoreDropdownPublic",id:"channelsMoreDropdownPublic",onClick:()=>this.filterChange(Y.Public),leadingElement:M().createElement(N.GlobeIcon,{size:16}),labels:M().createElement(_.FormattedMessage,{id:"suggestion.public",defaultMessage:"Public channels"}),trailingElements:this.props.filter===Y.Public?r:null,"aria-label":this.props.intl.formatMessage({id:"suggestion.public",defaultMessage:"Public channels"})}),M().createElement(L.q7,{key:"channelsMoreDropdownPrivate",id:"channelsMoreDropdownPrivate",onClick:()=>this.filterChange(Y.Private),leadingElement:M().createElement(N.LockOutlineIcon,{size:16}),labels:M().createElement(_.FormattedMessage,{id:"suggestion.private",defaultMessage:"Private channels"}),trailingElements:this.props.filter===Y.Private?r:null,"aria-label":this.props.intl.formatMessage({id:"suggestion.private",defaultMessage:"Private channels"})})];i.push(M().createElement(L.wv,{key:"channelsMoreDropdownSeparator"}),M().createElement(L.q7,{key:"channelsMoreDropdownArchived",id:"channelsMoreDropdownArchived",onClick:()=>this.filterChange(Y.Archived),leadingElement:M().createElement(N.ArchiveOutlineIcon,{size:16}),labels:M().createElement(_.FormattedMessage,{id:"suggestion.archive",defaultMessage:"Archived channels"}),trailingElements:this.props.filter===Y.Archived?r:null,"aria-label":this.props.intl.formatMessage({id:"suggestion.archive",defaultMessage:"Archived channels"})}));const o=M().createElement(M().Fragment,null,this.getFilterLabel(),M().createElement(N.ChevronDownIcon,{color:"rgba(var(--center-channel-color-rgb), 0.64)",size:16})),l=M().createElement(M().Fragment,null,M().createElement("div",{role:"status","aria-atomic":"true",className:"sr-only"},this.props.intl.formatMessage({id:"more_channels.channel_type_filter.filter_type_set",defaultMessage:"Channel type filter set to {filterType}"},{filterType:this.props.filter})),M().createElement(L.mc,{menuButton:{id:"menuWrapper",children:o,"aria-label":this.props.intl.formatMessage({id:"more_channels.channel_type_filter",defaultMessage:"Channel type filter"})},menu:{id:"browseChannelsDropdown","aria-label":this.props.intl.formatMessage({id:"more_channels.channel_type_filter",defaultMessage:"Channel type filter"})}},i.map((e=>e)))),c=v()("get-app__checkbox",{checked:this.props.rememberHideJoinedChannelsChecked}),d=M().createElement("div",{id:"hideJoinedPreferenceCheckbox",onClick:this.handleChecked,onKeyDown:e=>{e.stopPropagation(),"Enter"!==e.key&&" "!==e.key||this.handleChecked()},role:"checkbox","aria-checked":this.props.rememberHideJoinedChannelsChecked,"aria-label":this.props.intl.formatMessage({id:"more_channels.hide_joined_channels",defaultMessage:"Hide joined channels"}),tabIndex:0},M().createElement("div",{className:c},this.props.rememberHideJoinedChannelsChecked?M().createElement(k.A,null):null),M().createElement(_.FormattedMessage,{id:"more_channels.hide_joined",defaultMessage:"Hide Joined"}));let u;u=0===e.length?this.props.intl.formatMessage({id:"more_channels.count_zero",defaultMessage:"0 Results"}):1===e.length?this.props.intl.formatMessage({id:"more_channels.count_one",defaultMessage:"1 Result"}):e.length>1?this.props.intl.formatMessage(j.channelCount,{count:e.length}):this.props.intl.formatMessage({id:"more_channels.count_zero",defaultMessage:"0 Results"});const m=M().createElement("div",{className:"more-modal__dropdown"},M().createElement("span",{id:"channelCountLabel"},u),M().createElement("span",{className:"sr-only",role:"status","aria-live":"polite"},u),M().createElement("div",{id:"modalPreferenceContainer"},l,d));return M().createElement("div",{className:"filtered-user-list"},s,m,M().createElement("div",{role:"search",className:"more-modal__list",tabIndex:-1},M().createElement("div",{id:"moreChannelsList",tabIndex:-1,ref:this.channelListScroll},t)),M().createElement("div",{className:"filter-controls"},n,a))}}B(q,"propTypes",{channels:E().array.isRequired,channelsPerPage:E().number.isRequired,nextPage:E().func.isRequired,isSearch:E().bool.isRequired,search:E().func.isRequired,handleJoin:E().func.isRequired,noResultsText:E().element.isRequired,changeFilter:E().func.isRequired,closeModal:E().func.isRequired,hideJoinedChannelsPreference:E().func.isRequired,rememberHideJoinedChannelsChecked:E().bool.isRequired,loading:E().bool,channelsMemberCount:E().objectOf(E().number)});const j=(0,_.defineMessages)({channelCount:{id:"more_channels.count",defaultMessage:"{count} Results"},channelPurpose:{id:"more_channels.channel_purpose",defaultMessage:"Channel Information: Membership Indicator: Joined, Member count {memberCount} , Purpose: {channelPurpose}"},joiningButton:{id:"joinChannel.joiningButton",defaultMessage:"Joining..."},noMore:{id:"more_channels.noMore",defaultMessage:"No results for {text}"}}),V=(0,_.injectIntl)(q);var G=a(83007),z=a(63155),W=a(85873);function K(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}let Y=function(e){return e.All="All",e.Public="Public",e.Private="Private",e.Archived="Archived",e}({});class J extends M().PureComponent{constructor(e){super(e),K(this,"activeChannels",[]),K(this,"loadComplete",(()=>{this.setState({loading:!1})})),K(this,"handleNewChannel",(()=>{this.handleExit(),this.closeEditRHS(),this.props.actions.openModal({modalId:f.IQ.NEW_CHANNEL_MODAL,dialogType:I.default})})),K(this,"handleExit",(()=>{this.props.actions.closeModal(f.IQ.MORE_CHANNELS)})),K(this,"closeEditRHS",(()=>{this.props.rhsOpen&&this.props.rhsState===f._n.EDIT_HISTORY&&this.props.actions.closeRightHandSide()})),K(this,"onChange",(e=>{this.state.search&&!e||this.setState({searchedChannels:[],serverError:null})})),K(this,"nextPage",(e=>{this.props.actions.getChannels(this.props.teamId,e+1,50).then((e=>{e.data&&e.data.length>0&&this.props.actions.getChannelsMemberCount(e.data.map((e=>e.id)))}))})),K(this,"handleJoin",(async(e,t)=>{var a;const{actions:n,currentUserId:s,teamId:r,teamName:i}=this.props;let o;this.isMemberOfChannel(e.id)||(o=await n.joinChannel(s,r,e.id)),null!==(a=o)&&void 0!==a&&a.error?this.setState({serverError:o.error.message}):(this.props.actions.getChannelsMemberCount([e.id]),(0,G.J)().push((0,z.d7)(i,e.name)),this.closeEditRHS()),t&&t()})),K(this,"search",(e=>{if(clearTimeout(this.searchTimeoutId),""===e)return this.onChange(!0),this.setState({search:!1,searchedChannels:[],searching:!1,searchTerm:e}),void(this.searchTimeoutId=0);this.setState({search:!0,searching:!0,searchTerm:e});const t=window.setTimeout((async()=>{try{const{data:a}=await this.props.actions.searchAllChannels(e,{team_ids:[this.props.teamId],nonAdminSearch:!0,include_deleted:!0});if(t!==this.searchTimeoutId)return;if(a){const e=a.map((e=>e.id));e.length>0&&this.props.actions.getChannelsMemberCount(e),this.setSearchResults(a.filter((e=>e.team_id===this.props.teamId)))}else this.setState({searchedChannels:[],searching:!1})}catch(e){this.setState({searchedChannels:[],searching:!1})}}),100);this.searchTimeoutId=t})),K(this,"setSearchResults",(e=>{let t=e.filter((e=>e.type!==f.Ay.PRIVATE_CHANNEL||this.isMemberOfChannel(e.id)));this.state.filter===Y.Private&&(t=e.filter((e=>e.type===f.Ay.PRIVATE_CHANNEL&&this.isMemberOfChannel(e.id)))),this.state.filter===Y.Public&&(t=e.filter((e=>e.type===f.Ay.OPEN_CHANNEL&&0===e.delete_at))),this.state.filter===Y.Archived&&(t=e.filter((e=>0!==e.delete_at))),this.props.shouldHideJoinedChannels&&(t=this.getChannelsWithoutJoined(t)),this.setState({searchedChannels:t,searching:!1})})),K(this,"changeFilter",(e=>{this.search(this.state.searchTerm),this.setState({filter:e})})),K(this,"handleShowJoinedChannelsPreference",(e=>{this.search(this.state.searchTerm),this.props.actions.setGlobalItem(f.eN.HIDE_JOINED_CHANNELS,e.toString())})),K(this,"getChannelsWithoutJoined",(e=>e.filter((e=>!this.isMemberOfChannel(e.id))))),K(this,"getActiveChannels",(()=>{const{channels:e,archivedChannels:t,shouldHideJoinedChannels:a,privateChannels:n}=this.props,{search:s,searchedChannels:r,filter:i}=this.state,o=e.concat(n).sort(((e,t)=>e.display_name.localeCompare(t.display_name))),l=this.getChannelsWithoutJoined(o),c=this.getChannelsWithoutJoined(e),d=this.getChannelsWithoutJoined(t),u=this.getChannelsWithoutJoined(n),m={[Y.All]:a?l:o,[Y.Archived]:a?d:t,[Y.Private]:a?u:n,[Y.Public]:a?c:e};return s?r:m[i]||m[Y.All]})),this.searchTimeoutId=0,this.state={loading:!0,filter:Y.All,search:!1,searchedChannels:[],serverError:null,searching:!1,searchTerm:""}}componentDidMount(){if(!this.props.teamId)return void this.loadComplete();const e=[this.props.actions.getChannels(this.props.teamId,0,100),this.props.actions.getArchivedChannels(this.props.teamId,0,100)];Promise.all(e).then((e=>{const t=e.flatMap((e=>e.data?e.data.map((e=>e.id)):[]));this.props.privateChannels.forEach((e=>t.push(e.id))),t.length>0&&this.props.actions.getChannelsMemberCount(t)})),this.loadComplete()}isMemberOfChannel(e){return this.props.myChannelMemberships[e]}render(){const{teamId:e,channelsRequestStarted:t,shouldHideJoinedChannels:a}=this.props,{search:n,serverError:s,searching:r}=this.state;let i;this.activeChannels=this.getActiveChannels(),s&&(i=M().createElement("div",{className:"form-group has-error"},M().createElement("label",{className:"control-label"},s)));const o=(t,a)=>{const n=v()("btn",t);return M().createElement(A.A,{teamId:e,permissions:[S.A.CREATE_PUBLIC_CHANNEL]},M().createElement("button",{type:"button",id:"createNewChannelButton",className:n,onClick:this.handleNewChannel,"aria-label":(0,W.Vw)({id:"more_channels.create",defaultMessage:"Create New Channel"})},a,M().createElement(_.FormattedMessage,{id:"more_channels.create",defaultMessage:"Create New Channel"})))},l=M().createElement(M().Fragment,null,M().createElement("p",{className:"secondary-message"},M().createElement(_.FormattedMessage,{id:"more_channels.searchError",defaultMessage:"Try searching different keywords, checking for typos or adjusting the filters."})),o("btn-primary",M().createElement("i",{className:"icon-plus"}))),c=this.state.loading?M().createElement(w.A,null):M().createElement(M().Fragment,null,M().createElement(V,{channels:this.activeChannels,channelsPerPage:50,nextPage:this.nextPage,isSearch:n,search:this.search,handleJoin:this.handleJoin,noResultsText:l,loading:n?r:t,changeFilter:this.changeFilter,filter:this.state.filter,myChannelMemberships:this.props.myChannelMemberships,closeModal:this.props.actions.closeModal,hideJoinedChannelsPreference:this.handleShowJoinedChannelsPreference,rememberHideJoinedChannelsChecked:a,channelsMemberCount:this.props.channelsMemberCount}),i),d=M().createElement(_.FormattedMessage,{id:"more_channels.title",defaultMessage:"Browse Channels"});return M().createElement(T.zW,{id:"browseChannelsModal",onExited:this.handleExit,compassDesign:!0,modalHeaderText:d,headerButton:o("btn-secondary btn-sm"),autoCloseOnConfirmButton:!1,"aria-modal":!0,enforceFocus:!1,bodyPadding:!1},c)}}K(J,"propTypes",{channels:E().array.isRequired,archivedChannels:E().array.isRequired,privateChannels:E().array.isRequired,currentUserId:E().string.isRequired,teamId:E().string.isRequired,teamName:E().string,channelsRequestStarted:E().bool,shouldHideJoinedChannels:E().bool.isRequired,rhsOpen:E().bool,channelsMemberCount:E().objectOf(E().number),actions:E().shape({getChannels:E().func.isRequired,getArchivedChannels:E().func.isRequired,joinChannel:E().func.isRequired,searchAllChannels:E().func.isRequired,openModal:E().func.isRequired,closeModal:E().func.isRequired,setGlobalItem:E().func.isRequired,closeRightHandSide:E().func.isRequired,getChannelsMemberCount:E().func.isRequired}).isRequired});const Q=(0,o.Mz)("getChannelsWithoutArchived",l.aW,(e=>e&&e.filter((e=>0===e.delete_at&&e.type!==f.Ay.PRIVATE_CHANNEL)))),Z=(0,o.Mz)("getArchivedOtherChannels",l.aW,(e=>e&&e.filter((e=>0!==e.delete_at)))),X=(0,o.Mz)("getPrivateChannelsSelector",l.aW,(e=>e&&e.filter((e=>e.type===f.Ay.PRIVATE_CHANNEL)))),$=(0,n.connect)((function(e){const t=(0,c.H7)(e),a=(0,g.zR)(f.eN.HIDE_JOINED_CHANNELS,"false");return{channels:Q(e)||[],archivedChannels:Z(e)||[],privateChannels:X(e)||[],currentUserId:(0,d.WR)(e),teamId:(0,c.Sy)(e),teamName:null==t?void 0:t.name,channelsRequestStarted:e.requests.channels.getChannels.status===i.IZ.STARTED,myChannelMemberships:(0,l.vd)(e)||{},shouldHideJoinedChannels:"true"===a(e),rhsState:(0,p.bM)(e),rhsOpen:(0,p.A)(e),channelsMemberCount:(0,l.kV)(e)}}),(function(e){return{actions:(0,s.zH)({getChannels:r.Jp,getArchivedChannels:r.xM,joinChannel:r.Cg,searchAllChannels:r.Q1,openModal:m.q,closeModal:m.O,setGlobalItem:u.X2,closeRightHandSide:h.bP,getChannelsMemberCount:r.kV},e)}}))(J)},97026:(e,t,a)=>{a.d(t,{GX:()=>S,PM:()=>f,_4:()=>_,_E:()=>A,bY:()=>w,wR:()=>I}),a(74883),a(17046),a(76409),a(43813);var n=a(36418),s=a(37270),r=a(40057),i=a(92159),o=a(65952),l=a(26614),c=a(80635),d=a(24380),u=a(58628),m=a(33172),h=a(78451),p=a(78138),g=a(68124);const f=50,{OPEN_CHANNEL:b,PRIVATE_CHANNEL:E,GM_CHANNEL:C,DM_CHANNEL:v}=h.Ay,y=(e,t)=>"".concat(e).concat(t),M={[y("add",b)]:r.xB.ADD_BOOKMARK_PUBLIC_CHANNEL,[y("edit",b)]:r.xB.EDIT_BOOKMARK_PUBLIC_CHANNEL,[y("delete",b)]:r.xB.DELETE_BOOKMARK_PUBLIC_CHANNEL,[y("order",b)]:r.xB.ORDER_BOOKMARK_PUBLIC_CHANNEL,[y("add",E)]:r.xB.ADD_BOOKMARK_PRIVATE_CHANNEL,[y("edit",E)]:r.xB.EDIT_BOOKMARK_PRIVATE_CHANNEL,[y("delete",E)]:r.xB.DELETE_BOOKMARK_PRIVATE_CHANNEL,[y("order",E)]:r.xB.ORDER_BOOKMARK_PRIVATE_CHANNEL},_=(e,t)=>(0,s.useSelector)((a=>T(a,e,t))),T=(e,t,a)=>{const n=(0,o.c)(e,t);if(!n)return!1;if(0!==n.delete_at)return!1;const{type:s}=n;if("threads"===s)return!1;if(s===C||s===v){const a=(0,o.MQ)(e,t);return(null==a?void 0:a.channel_id)===t}const r=M[y(a,s)];return n&&r&&(0,c.Ec)(e,n.team_id,t,r)},S=()=>(0,s.useSelector)((e=>(0,g.DE)((0,l.zj)(e)))),w=()=>(0,s.useSelector)((e=>(0,g.kc)((0,l.zj)(e)))),I=e=>{if("true"!==(0,l.Y6)(e,"ChannelBookmarks"))return!1;const t=(0,l.Ay)(e);return"true"===(null==t?void 0:t.IsLicensed)},A=e=>{const t=(0,s.useDispatch)(),a=(0,s.useSelector)((t=>(0,i.H)(t,e))),r=(0,n.useMemo)((()=>Object.keys(a).sort(((e,t)=>a[e].sort_order-a[t].sort_order))),[a]),[o,l]=(0,n.useState)();return(0,n.useEffect)((()=>{o&&l(void 0)}),[r]),(0,n.useEffect)((()=>{e&&t((0,u.ng)(e))}),[e]),(0,n.useEffect)((()=>{const e=Object.values(a).reduce(((e,t)=>{let{emoji:a}=t;return a&&e.push((0,p.at)(a)),e}),[]);e.length&&t((0,m.fS)(e))}),[a]),{bookmarks:a,order:null!=o?o:r,reorder:async(a,n,s)=>{l((0,d.wq)(r,a,s));const{error:i}=await t((0,u._M)(e,a,s));i&&l(void 0)}}}},34086:(e,t,a)=>{a.d(t,{A:()=>C}),a(17046),a(57406),a(55448);var n=a(36418),s=a.n(n),r=a(14778),i=a(37270),o=a(85406),l=a(8907),c=a(57676),d=a(65952),u=a(14776),m=a(52073),h=a(79751),p=a(9916),g=a(12555),f=a(70669),b=a(78451);const E=e=>{const{formatMessage:t}=(0,r.useIntl)(),a=(0,i.useDispatch)(),n=(0,i.useSelector)(d.ou),E=(0,i.useSelector)((e=>e.views.channelSidebar.multiSelectedChannelIds)),C=(0,i.useSelector)(u.H7),v=(0,i.useSelector)((e=>C?(0,p.WJ)(e):void 0)),y=(0,i.useSelector)((t=>C?(0,c.oT)(t,(null==C?void 0:C.id)||"",e.channel.id):void 0));function M(t,n){t.preventDefault(),(null==y?void 0:y.id)!==n&&a((0,m.Lt)(n,e.channel.id))}function _(){a((0,h.q)({modalId:b.IQ.EDIT_CATEGORY,dialogType:g.default,dialogProps:{channelIdsToAdd:-1===E.indexOf(e.channel.id)?[e.channel.id]:E}}))}function T(t,a){return[...t.map((t=>{let n=s().createElement("span",null,t.display_name);t.type===l.e.FAVORITES&&(n=s().createElement(r.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.favorites",defaultMessage:"Favorites"})),t.type===l.e.CHANNELS&&(n=s().createElement(r.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.channels",defaultMessage:"Channels"}));let i=null;return a&&a.display_name===t.display_name&&(i=s().createElement(o.CheckIcon,{color:"var(--button-bg)",size:18})),s().createElement(f.q7,{id:"moveToCategory-".concat(e.channel.id,"-").concat(t.id),key:"moveToCategory-".concat(e.channel.id,"-").concat(t.id),leadingElement:t.type===l.e.FAVORITES?s().createElement(o.StarOutlineIcon,{size:18}):s().createElement(o.FolderOutlineIcon,{size:18}),labels:n,trailingElements:i,onClick:e=>M(e,t.id)})})),s().createElement(f.wv,{key:"ChannelMenu-moveToDivider"}),s().createElement(f.q7,{id:"moveToNewCategory-".concat(e.channel.id),key:"moveToNewCategory-".concat(e.channel.id),"aria-haspopup":!0,leadingElement:s().createElement(o.FolderMoveOutlineIcon,{size:18}),labels:s().createElement(r.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.moveToNewCategory",defaultMessage:"New Category"}),onClick:_})]}function S(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e.filter((e=>e.type!==l.e.CHANNELS)):e.filter((e=>e.type!==l.e.DIRECT_MESSAGES))}return v?s().createElement(f.g8,{id:"moveTo-".concat(e.channel.id),labels:s().createElement(r.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.moveTo",defaultMessage:"Move to..."}),leadingElement:e.inHeaderDropdown?null:s().createElement(o.FolderMoveOutlineIcon,{size:18}),trailingElements:s().createElement(o.ChevronRightIcon,{size:16}),menuId:"moveTo-".concat(e.channel.id,"-menu"),menuAriaLabel:t({id:"sidebar_left.sidebar_channel_menu.moveTo.dropdownAriaLabel",defaultMessage:"Move to submenu"})},function(t,a){const s=E.includes(e.channel.id);return e.inHeaderDropdown||!s?T(S(t,e.channel.type===b.Ay.DM_CHANNEL||e.channel.type===b.Ay.GM_CHANNEL),a):E.every((e=>n[e].type===b.Ay.DM_CHANNEL||n[e].type===b.Ay.GM_CHANNEL))?T(S(t,!0),a):E.every((e=>n[e].type!==b.Ay.DM_CHANNEL&&n[e].type!==b.Ay.GM_CHANNEL))?T(S(t,!1),a):T(t.filter((e=>e.type!==l.e.CHANNELS&&e.type!==l.e.DIRECT_MESSAGES)),a)}(v,y)):null},C=(0,n.memo)(E)},12555:(e,t,a)=>{a.r(t),a.d(t,{default:()=>E});var n=a(37270),s=a(32446),r=a(4629),i=a(14776),o=a(52073),l=a(62688),c=a.n(l),d=(a(4290),a(36418)),u=a.n(d),m=a(14778),h=a(14696),p=a(86255),g=a(85873);function f(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class b extends u().PureComponent{constructor(e){super(e),f(this,"timeoutId",null),f(this,"isProcessing",!1),f(this,"handleClear",(()=>{this.setState({categoryName:""})})),f(this,"handleChange",(e=>{this.setState({categoryName:e.target.value})})),f(this,"handleCancel",(()=>{this.handleClear()})),f(this,"handleConfirm",(()=>{this.isProcessing||(this.isProcessing=!0,this.timeoutId=setTimeout((()=>{this.isProcessing=!1}),1e3),this.props.categoryId?this.props.actions.renameCategory(this.props.categoryId,this.state.categoryName):this.props.actions.createCategory(this.props.currentTeamId,this.state.categoryName,this.props.channelIdsToAdd))})),f(this,"isConfirmDisabled",(()=>!this.state.categoryName||Boolean(this.props.initialCategoryName)&&this.props.initialCategoryName===this.state.categoryName||this.state.categoryName.length>22)),f(this,"getText",(()=>{let e,t,a;return this.props.categoryId?(e=u().createElement(m.FormattedMessage,{id:"rename_category_modal.renameCategory",defaultMessage:"Rename Category"}),t=u().createElement(m.FormattedMessage,{id:"rename_category_modal.rename",defaultMessage:"Rename"})):(e=u().createElement(m.FormattedMessage,{id:"create_category_modal.createCategory",defaultMessage:"Create New Category"}),t=u().createElement(m.FormattedMessage,{id:"create_category_modal.create",defaultMessage:"Create"}),a=u().createElement(m.FormattedMessage,{id:"edit_category_modal.helpText",defaultMessage:"Drag channels into this category to organize your sidebar."})),{modalHeaderText:e,editButtonText:t,helpText:a}})),this.state={categoryName:e.initialCategoryName||""}}componentWillUnmount(){this.timeoutId&&clearTimeout(this.timeoutId)}render(){const{modalHeaderText:e,editButtonText:t,helpText:a}=this.getText();return u().createElement(h.zW,{id:"editCategoryModal",modalHeaderText:e,confirmButtonText:t,compassDesign:!0,onExited:this.props.onExited,handleEnterKeyPress:this.handleConfirm,handleConfirm:this.handleConfirm,handleCancel:this.handleCancel,isConfirmDisabled:this.isConfirmDisabled()},u().createElement(p.A,{inputComponent:p.P,autoFocus:!0,className:"form-control filter-textbox",type:"text",value:this.state.categoryName,placeholder:(0,g.Vw)({id:"edit_category_modal.placeholder",defaultMessage:"Name your category"}),clearable:!0,onClear:this.handleClear,onChange:this.handleChange,maxLength:22}),Boolean(a)&&u().createElement("span",{className:"edit-category__helpText"},a))}}f(b,"propTypes",{onExited:c().func.isRequired,currentTeamId:c().string.isRequired,categoryId:c().string,initialCategoryName:c().string,channelIdsToAdd:c().arrayOf(c().string),actions:c().shape({createCategory:c().func.isRequired,renameCategory:c().func.isRequired}).isRequired});const E=(0,n.connect)((function(e){return{currentTeamId:(0,i.Sy)(e)}}),(function(e){return{actions:(0,s.zH)({createCategory:o.zZ,renameCategory:r.D8},e)}}))(b)},31892:(e,t,a)=>{a.d(t,{A:()=>_});var n=a(37270),s=a(32446),r=a(23739),i=a(65952),o=a(14776),l=a(7430),c=a(91767),d=a(78451),u=a(62688),m=a.n(u),h=(a(4290),a(36418)),p=a.n(h),g=a(89735),f=a(14778),b=a(79342),E=a(19513);function C(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class v extends p().PureComponent{constructor(e){super(e),C(this,"handleHide",(()=>{this.setState({show:!1})})),C(this,"handleKeyPress",(e=>{(0,E.e)(e,d.Ay.KeyCodes.ENTER)&&this.handleSubmit()})),C(this,"handleSubmit",(()=>{this.handleHide(),this.props.actions.leaveTeam(this.props.currentTeamId,this.props.currentUserId),this.props.actions.toggleSideBarRightMenu()})),this.state={show:!0}}componentDidMount(){document.addEventListener("keypress",this.handleKeyPress)}componentWillUnmount(){document.removeEventListener("keypress",this.handleKeyPress)}render(){const{currentUser:e,numOfPrivateChannels:t,numOfPublicChannels:a}=this.props;let n;return n=b.P(e.roles)?0!==a&&0!==t?p().createElement(f.FormattedMessage,{id:"leave_team_modal_guest.description",defaultMessage:"<strong>You will be removed from {num_of_public_channels} public {num_of_public_channels,plural,one {channel} other {channels}} and {num_of_private_channels} private {num_of_private_channels,plural,one {channel} other {channels}} on this team.</strong> You won't be able to rejoin it without an invitation from another team member. Are you sure?",values:{num_of_public_channels:a,num_of_private_channels:t,strong:e=>p().createElement("strong",null,e)}}):0===a?p().createElement(f.FormattedMessage,{id:"leave_team_modal_guest_only_private.description",defaultMessage:"<strong>You will be removed from {num_of_private_channels} private {num_of_private_channels,plural,one {channel} other {channels}} on this team.</strong> You won't be able to rejoin it without an invitation from another team member. Are you sure?",values:{num_of_private_channels:t,strong:e=>p().createElement("strong",null,e)}}):p().createElement(f.FormattedMessage,{id:"leave_team_modal_guest_only_public.description",defaultMessage:"<strong>You will be removed from {num_of_public_channels} public {num_of_public_channels,plural,one {channel} other {channels}} on this team.</strong> You won't be able to rejoin it without an invitation from another team member. Are you sure?",values:{num_of_public_channels:a,strong:e=>p().createElement("strong",null,e)}}):0!==a&&0!==t?p().createElement(f.FormattedMessage,{id:"leave_team_modal.description",defaultMessage:"<strong>You will be removed from {num_of_public_channels} public {num_of_public_channels,plural,one {channel} other {channels}} and {num_of_private_channels} private {num_of_private_channels,plural,one {channel} other {channels}} on this team.</strong> If the team is private you won't be able to rejoin it without an invitation from another team member. Are you sure?",values:{num_of_public_channels:a,num_of_private_channels:t,strong:e=>p().createElement("strong",null,e)}}):0===a?p().createElement(f.FormattedMessage,{id:"leave_team_modal_private.description",defaultMessage:"<strong>You will be removed from {num_of_private_channels} private {num_of_private_channels,plural,one {channel} other {channels}} on this team.</strong> If the team is private you won't be able to rejoin it without an invitation from another team member. Are you sure?",values:{num_of_private_channels:t,strong:e=>p().createElement("strong",null,e)}}):p().createElement(f.FormattedMessage,{id:"leave_team_modal_public.description",defaultMessage:"<strong>You will be removed from {num_of_public_channels} public {num_of_public_channels,plural,one {channel} other {channels}} on this team.</strong> Are you sure?",values:{num_of_public_channels:a,strong:e=>p().createElement("strong",null,e)}}),p().createElement(g.Modal,{dialogClassName:"a11y__modal",className:"modal-confirm",show:this.state.show,onExited:this.props.onExited,onHide:this.handleHide,id:"leaveTeamModal",role:"none","aria-labelledby":"leaveTeamModalLabel"},p().createElement(g.Modal.Header,{closeButton:!1},p().createElement(g.Modal.Title,{componentClass:"h1",id:"leaveTeamModalLabel"},p().createElement(f.FormattedMessage,{id:"leave_team_modal.title",defaultMessage:"Leave the team?"}))),p().createElement(g.Modal.Body,null,n),p().createElement(g.Modal.Footer,null,p().createElement("button",{type:"button",className:"btn btn-tertiary",onClick:this.handleHide,id:"leaveTeamNo"},p().createElement(f.FormattedMessage,{id:"leave_team_modal.no",defaultMessage:"No"})),p().createElement("button",{type:"button",className:"btn btn-danger",onClick:this.handleSubmit,id:"leaveTeamYes"},p().createElement(f.FormattedMessage,{id:"leave_team_modal.yes",defaultMessage:"Yes"}))))}}function y(e){return(0,i.$3)(e).filter((e=>e.type===d.YM.PRIVATE_CHANNEL)).length}function M(e){return(0,i.$3)(e).filter((e=>e.type===d.YM.OPEN_CHANNEL)).length}C(v,"propTypes",{currentUserId:m().string.isRequired,currentTeamId:m().string.isRequired,numOfPublicChannels:m().number.isRequired,numOfPrivateChannels:m().number.isRequired,onExited:m().func.isRequired,actions:m().shape({leaveTeam:m().func.isRequired,toggleSideBarRightMenu:m().func.isRequired}).isRequired});const _=(0,n.connect)((function(e){return{currentUserId:(0,l.WR)(e),currentTeamId:(0,o.Sy)(e),currentUser:(0,l.HW)(e),numOfPrivateChannels:y(e),numOfPublicChannels:M(e)}}),(function(e){return{actions:(0,s.zH)({leaveTeam:r.fy,toggleSideBarRightMenu:c.u9},e)}}))(v)},1277:(e,t,a)=>{a.d(t,{$:()=>u,A:()=>m});var n=a(62688),s=a.n(n),r=(a(43813),a(4290),a(36418)),i=a.n(r),o=a(89735),l=a(14778),c=a(1396);function d(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const u=50;class m extends i().PureComponent{constructor(e){super(e),d(this,"handleHide",(()=>{this.setState({show:!1})})),d(this,"handleExit",(()=>{this.props.onHide&&this.props.onHide()})),d(this,"onNext",(()=>{const e=this.state.page+1;this.onPageChange(e)})),d(this,"onPrev",(()=>{const e=this.state.page-1;this.onPageChange(e)})),d(this,"onPageChange",(async e=>{this.setState({loading:!0});const t=await this.props.loadItems(e,this.state.searchTerm);this.setState({page:e,items:t.items,loading:!1})})),d(this,"onSearchInput",(async e=>{const{target:t}=e,a=t.value;this.setState({loading:!0,searchTerm:a});const n=await this.props.loadItems(0,a),{items:s,totalCount:r}=n;this.setState({loading:!1,items:s,totalCount:r})})),this.numPerPage=e.numPerPage||u,this.state={show:!0,page:0,items:[],totalCount:0,loading:!0,searchTerm:""}}async componentDidMount(){const{totalCount:e,items:t}=await this.props.loadItems(0,"");this.setState({totalCount:e,items:t,loading:!1})}renderRows(){return this.state.loading?i().createElement("div",null,i().createElement(c.A,{position:"absolute",key:"loading"})):this.state.items.map((e=>this.props.renderRow(e,this)))}paginationRange(){let e=this.state.page*this.numPerPage+1;const t=e+this.state.items.length-1;return 0===t&&(e=0),{startCount:e,endCount:t}}render(){if(!this.props.show)return null;const{endCount:e,startCount:t}=this.paginationRange();return i().createElement("div",null,i().createElement(o.Modal,{dialogClassName:"a11y__modal more-modal more-modal--action",show:this.state.show,onHide:this.handleHide,onExited:this.handleExit},i().createElement(o.Modal.Header,{closeButton:!0},i().createElement(o.Modal.Title,{componentClass:"h1"},i().createElement("span",{className:"name"},this.props.titleText)),this.props.titleBarButtonText&&this.props.titleBarButtonOnClick&&i().createElement("a",{className:"btn btn-md btn-primary",href:"#",onClick:this.props.titleBarButtonOnClick},this.props.titleBarButtonText)),i().createElement(o.Modal.Body,null,i().createElement("div",{className:"filtered-user-list"},i().createElement("div",{className:"filter-row"},i().createElement("div",{className:"col-xs-12"},i().createElement("label",{className:"hidden-label",htmlFor:"searchUsersInput"},this.props.searchPlaceholderText),i().createElement("input",{id:"searchUsersInput",className:"form-control filter-textbox",placeholder:this.props.searchPlaceholderText,onChange:this.onSearchInput})),i().createElement("div",{className:"col-sm-12"},i().createElement("span",{className:"member-count pull-left"},i().createElement(l.FormattedMessage,{id:"list_modal.paginatorCount",defaultMessage:"{startCount, number} - {endCount, number} of {total, number} total",values:{startCount:t,endCount:e,total:this.state.totalCount}})))),i().createElement("div",{className:"more-modal__list"},i().createElement("div",null,this.renderRows())),i().createElement("div",{className:"filter-controls"},this.state.page>0&&i().createElement("button",{onClick:this.onPrev,className:"btn btn-sm btn-tertiary filter-control filter-control__prev"},i().createElement(l.FormattedMessage,{id:"filtered_user_list.prev",defaultMessage:"Previous"})),this.props.numPerPage&&this.state.items.length>=this.props.numPerPage&&e!==this.state.totalCount&&i().createElement("button",{onClick:this.onNext,className:"btn btn-sm btn-tertiary filter-control filter-control__next"},i().createElement(l.FormattedMessage,{id:"filtered_user_list.next",defaultMessage:"Next"})))))))}}d(m,"propTypes",{titleText:s().string,searchPlaceholderText:s().string,titleBarButtonText:s().string,numPerPage:s().number,show:s().bool,titleBarButtonOnClick:s().func,loadItems:s().func.isRequired,onHide:s().func,renderRow:s().func.isRequired}),d(m,"defaultProps",{show:!0})},83642:(e,t,a)=>{a.d(t,{t:()=>u});var n=a(62688),s=a.n(n),r=a(71633),i=a.n(r),o=a(36418),l=a.n(o),c=a(95025),d=a(4715);const u=e=>{let{className:t,variant:a}=e;const n=(0,d.cX)()?"⌘":"Ctrl",s=a||c.l.Contrast;return l().createElement("span",{className:i()("search-shortcut",t)},l().createElement(c.e,{variant:s},n),!(0,d.y3)()&&l().createElement(c.e,{variant:s},"Shift"),l().createElement(c.e,{variant:s},"F"))};u.propTypes={className:s().string}},19174:(e,t,a)=>{a.d(t,{A:()=>f});var n=a(62688),s=a.n(n),r=(a(29206),a(36418)),i=a.n(r),o=a(14778),l=a(37270),c=a(85406),d=a(79751),u=a(12555),m=a(70669),h=a(78451);const p=["id"],g=e=>{let{id:t}=e,a=function(e,t){if(null==e)return{};var a,n,s=function(e,t){if(null==e)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;a[n]=e[n]}return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],-1===t.indexOf(a)&&{}.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}(e,p);const n=(0,l.useDispatch)(),s=(0,r.useCallback)((()=>{n((0,d.q)({modalId:h.IQ.EDIT_CATEGORY,dialogType:u.default}))}),[n]);return i().createElement(m.q7,Object.assign({id:"create-".concat(t),onClick:s,"aria-haspopup":!0,leadingElement:i().createElement(c.FolderPlusOutlineIcon,{size:18}),labels:i().createElement(o.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.createCategory",defaultMessage:"Create New Category"})},a))};g.propTypes={id:s().string.isRequired};const f=g},51877:(e,t,a)=>{a.d(t,{A:()=>C});var n=a(62688),s=a.n(n),r=(a(29206),a(36418)),i=a.n(r),o=a(14778),l=a(37270),c=a(85406),d=a(79751),u=a(70669),m=a(78451),h=a(14696);const p=()=>null,g=e=>{let{handleConfirm:t,numChannels:a,onExited:n}=e;const s=(0,o.useIntl)(),r=s.formatMessage({id:"mark_as_read_confirm_modal.header",defaultMessage:"Mark as read"}),l=s.formatMessage({id:"mark_as_read_confirm_modal.body",defaultMessage:"Are you sure you want to mark {numChannels} channels as read?"},{numChannels:a}),c=s.formatMessage({id:"mark_as_read_confirm_modal.confirm",defaultMessage:"Mark as read"});return i().createElement(h.zW,{ariaLabel:r,compassDesign:!0,modalHeaderText:r,handleConfirm:t,handleCancel:p,onExited:n,confirmButtonText:c},i().createElement("span",{className:"mark-as-read__helpText"},l))};g.propTypes={handleConfirm:s().func.isRequired,numChannels:s().number.isRequired,onExited:s().func.isRequired};const f=g,b=["id","handleViewCategory","numChannels"],E=e=>{let{id:t,handleViewCategory:a,numChannels:n}=e,s=function(e,t){if(null==e)return{};var a,n,s=function(e,t){if(null==e)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;a[n]=e[n]}return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],-1===t.indexOf(a)&&{}.propertyIsEnumerable.call(e,a)&&(s[a]=e[a])}return s}(e,b);const h=(0,l.useDispatch)(),p=(0,r.useCallback)((()=>{n<=0||(1!==n?h((0,d.q)({modalId:m.IQ.DELETE_CATEGORY,dialogType:f,dialogProps:{handleConfirm:a,numChannels:n}})):a())}),[h,a,n]);return i().createElement(u.q7,Object.assign({id:"view-".concat(t),onClick:p,"aria-haspopup":n>1,leadingElement:i().createElement(c.MarkAsUnreadIcon,{size:18}),labels:i().createElement(o.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.viewCategory",defaultMessage:"Mark category as read"})},s))};E.propTypes={id:s().string.isRequired,handleViewCategory:s().func.isRequired,numChannels:s().number.isRequired};const C=E},77813:(e,t,a)=>{a.d(t,{A:()=>h});var n=a(62688),s=a.n(n),r=(a(17046),a(71633)),i=a.n(r),o=a(36418),l=a.n(o),c=a(14778),d=a(85406),u=a(70669);const m=e=>{let{id:t,children:a,name:n}=e;const[s,r]=(0,o.useState)(!1),{formatMessage:m}=(0,c.useIntl)();return l().createElement("div",{className:i()("SidebarMenu","MenuWrapper",{"MenuWrapper--open":s,menuOpen:s})},l().createElement(u.mc,{menuButton:{id:"SidebarCategoryMenu-Button-".concat(t),"aria-label":m({id:"sidebar_left.sidebar_category_menu.editCategory",defaultMessage:"Category options"},{name:n}),class:"SidebarMenu_menuButton",children:l().createElement(d.DotsVerticalIcon,{size:16})},menuButtonTooltip:{text:m({id:"sidebar_left.sidebar_category_menu.editCategory",defaultMessage:"Category options"},{name:n}),class:"hidden-xs"},menu:{id:"SidebarChannelMenu-MenuList-".concat(t),"aria-label":m({id:"sidebar_left.sidebar_category_menu.dropdownAriaLabel",defaultMessage:"Edit category menu"}),onToggle:function(e){r(e)}}},a))};m.propTypes={id:s().string.isRequired,children:s().arrayOf(s().node).isRequired,name:s().string.isRequired};const h=(0,o.memo)(m)},66039:(e,t,a)=>{a.d(t,{U:()=>d,w:()=>u});var n=a(62688),s=a.n(n),r=(a(29206),a(71633)),i=a.n(r),o=a(36418),l=a.n(o),c=a(78138);const d=l().forwardRef(((e,t)=>l().createElement("div",{className:"SidebarChannelGroupHeader SidebarChannelGroupHeader--static"},l().createElement("div",{ref:t,className:"SidebarChannelGroupHeader_groupButton"},l().createElement("div",{className:"SidebarChannelGroupHeader_text"},(0,c.uN)(e.displayName)),e.children))));d.propTypes={children:s().node,displayName:s().string.isRequired},d.displayName="SidebarCategoryHeaderStatic";const u=l().forwardRef(((e,t)=>{let{children:a,displayName:n,dragHandleProps:s,isCollapsed:r,isCollapsible:o=!0,isDragging:d=!1,muted:u,onClick:m}=e;return s&&s.role&&Reflect.deleteProperty(s,"role"),l().createElement("div",{className:i()("SidebarChannelGroupHeader",{muted:u,dragging:d})},l().createElement("button",{ref:t,className:i()("SidebarChannelGroupHeader_groupButton"),"aria-label":n,onClick:m,"aria-expanded":!r},l().createElement("i",{className:i()("icon icon-chevron-down",{"icon-rotate-minus-90":r,"hide-arrow":!o})}),l().createElement("div",Object.assign({className:"SidebarChannelGroupHeader_text"},s,{tabIndex:-1}),(0,c.uN)(n))),a)}));u.propTypes={children:s().node,displayName:s().string.isRequired,isCollapsed:s().bool.isRequired,isCollapsible:s().bool.isRequired,isDragging:s().bool,isDraggingOver:s().bool,muted:s().bool.isRequired,onClick:s().func.isRequired},u.displayName="SidebarCategoryHeader"},45697:(e,t,a)=>{a.d(t,{A:()=>c});var n=a(62688),s=a.n(n),r=a(71633),i=a.n(r),o=a(36418),l=a.n(o);function c(e){let{unreadMentions:t,hasUrgent:a,icon:n,className:s}=e;return t>0?l().createElement("span",{id:"unreadMentions",className:i()({badge:!0,urgent:a},s)},n,l().createElement("span",{className:"unreadMentions"},t)):null}c.propTypes={unreadMentions:s().number.isRequired,hasUrgent:s().bool,icon:s().node,className:s().string}},69440:(e,t,a)=>{a.d(t,{A:()=>Pe});var n=a(37270),s=a(65952),r=a(14776),i=a(9916),o=(a(17046),a(29206),a(71633)),l=a.n(o),c=a(36418),d=a.n(c),u=a(22005),m=a(14778),h=a(78451),p=a(32446),g=a(25778),f=a(79751),b=a(62688),E=a.n(b),C=a(69238),v=a(56707),y=a(3569),M=a(26614),_=a(77440),T=a(73996),S=a(16230),w=a(87778),I=a(52073),A=a(2386),N=a(51140),R=a(75270),P=a(53791),L=a(99243),O=(a(4290),a(81911)),D=a(59671),k=a(67277),F=a(59050),x=a(64766),H=a(87131),U=a(694),B=a(78138),q=a(19513),j=a(3295),V=a(45697);function G(e){let{hasDraft:t}=e;return t?d().createElement("i",{"data-testid":"draftIcon",className:"icon icon-pencil-outline channel-pencil-icon"}):null}a(76685),G.propTypes={hasDraft:E().bool.isRequired};const z=(0,c.memo)(G);function W(e,t,a){return null!==e&&Boolean(e.message.trim()||e.fileInfos.length||e.uploadsInProgress.length)&&a!==t}const K=(0,n.connect)((function(e,t){const a=(0,s.eH)(e);return{hasDraft:W((0,R.UR)(e,h.eN.DRAFT,t.id),t.id,a)}}))(z);function Y(e){let{isDeleted:t,icon:a}=e;return t?d().createElement("i",{className:"icon icon-archive-outline"}):a}Y.propTypes={icon:E().oneOfType([E().element,E().oneOf([null])]),isDeleted:E().bool.isRequired};const J=Y;var Q=a(30413),Z=a(16983),X=a(80635),$=a(15755),ee=a(63155),te=a(85406),ae=a(46),ne=a(34086),se=a(70669),re=a(85873);const ie=e=>{let{channel:t,channelLink:a,currentUserId:n,favoriteChannel:s,isFavorite:r,isMuted:i,isUnread:o,managePrivateChannelMembers:l,managePublicChannelMembers:u,readMultipleChannels:p,markMostRecentPostInChannelAsUnread:g,muteChannel:f,onMenuToggle:b,openModal:E,unfavoriteChannel:C,unmuteChannel:v,channelLeaveHandler:y}=e;const M=(0,c.useRef)(!1),{formatMessage:_}=(0,m.useIntl)();let T=null;if(o){function R(){p([t.id])}T=d().createElement(se.q7,{id:"markAsRead-".concat(t.id),onClick:R,leadingElement:d().createElement(te.MarkAsUnreadIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.markAsRead",defaultMessage:"Mark as Read"})})}else{function P(){g(t.id)}T=d().createElement(se.q7,{id:"markAsUnread-".concat(t.id),onClick:P,leadingElement:d().createElement(te.MarkAsUnreadIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.markAsUnread",defaultMessage:"Mark as Unread"})})}let S=null;if(r){function L(){C(t.id)}S=d().createElement(se.q7,{id:"unfavorite-".concat(t.id),onClick:L,leadingElement:d().createElement(te.StarIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.unfavoriteChannel",defaultMessage:"Unfavorite"})})}else{function O(){s(t.id)}S=d().createElement(se.q7,{id:"favorite-".concat(t.id),onClick:O,leadingElement:d().createElement(te.StarOutlineIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.favoriteChannel",defaultMessage:"Favorite"})})}let w=null;if(i){let D=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.unmuteChannel",defaultMessage:"Unmute Channel"});function k(){v(n,t.id)}t.type!==h.Ay.DM_CHANNEL&&t.type!==h.Ay.GM_CHANNEL||(D=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.unmute",defaultMessage:"Unmute"})),w=d().createElement(se.q7,{id:"unmute-".concat(t.id),onClick:k,leadingElement:d().createElement(te.BellOffOutlineIcon,{size:18}),labels:D})}else{let F=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.muteChannel",defaultMessage:"Mute Channel"});function x(){f(n,t.id)}t.type!==h.Ay.DM_CHANNEL&&t.type!==h.Ay.GM_CHANNEL||(F=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.mute",defaultMessage:"Mute"})),w=d().createElement(se.q7,{id:"mute-".concat(t.id),onClick:x,leadingElement:d().createElement(te.BellOutlineIcon,{size:18}),labels:F})}let I=null;if(t.type===h.Ay.OPEN_CHANNEL||t.type===h.Ay.PRIVATE_CHANNEL){function H(){(0,re.lW)(a)}I=d().createElement(se.q7,{id:"copyLink-".concat(t.id),onClick:H,leadingElement:d().createElement(te.LinkVariantIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.copyLink",defaultMessage:"Copy Link"})})}let A=null;if(t.type===h.Ay.PRIVATE_CHANNEL&&l||t.type===h.Ay.OPEN_CHANNEL&&u){function U(){E({modalId:h.IQ.CHANNEL_INVITE,dialogType:ae.A,dialogProps:{channel:t}})}A=d().createElement(se.q7,{id:"addMembers-".concat(t.id),onClick:U,"aria-haspopup":"true",leadingElement:d().createElement(te.AccountPlusOutlineIcon,{size:18}),labels:d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.addMembers",defaultMessage:"Add Members"})})}let N=null;if(t.name!==h.Ay.DEFAULT_CHANNEL){let B=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.leaveChannel",defaultMessage:"Leave Channel"});function q(){!M.current&&y&&(M.current=!0,y((()=>{M.current=!1})))}t.type!==h.Ay.DM_CHANNEL&&t.type!==h.Ay.GM_CHANNEL||(B=d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel_menu.leaveConversation",defaultMessage:"Close Conversation"})),N=d().createElement(se.q7,{id:"leave-".concat(t.id),onClick:q,leadingElement:d().createElement(te.ExitToAppIcon,{size:18}),labels:B,isDestructive:!0})}return d().createElement(se.mc,{menuButton:{id:"SidebarChannelMenu-Button-".concat(t.id),class:"SidebarMenu_menuButton","aria-label":_({id:"sidebar_left.sidebar_channel_menu.editChannel.ariaLabel",defaultMessage:"Channel options for {channelName}"},{channelName:t.name}),children:d().createElement(te.DotsVerticalIcon,{size:16})},menuButtonTooltip:{class:"hidden-xs",text:_({id:"sidebar_left.sidebar_channel_menu.editChannel",defaultMessage:"Channel options"})},menu:{id:"SidebarChannelMenu-MenuList-".concat(t.id),"aria-label":_({id:"sidebar_left.sidebar_channel_menu.dropdownAriaLabel",defaultMessage:"Edit channel menu"}),onToggle:b}},T,S,w,d().createElement(se.wv,null),d().createElement(ne.A,{channel:t}),(I||A)&&d().createElement(se.wv,null),I,A,N&&d().createElement(se.wv,null),N)},oe=(0,c.memo)(ie),le={readMultipleChannels:Q.Zi,markMostRecentPostInChannelAsUnread:w.pr,favoriteChannel:Q.yc,unfavoriteChannel:Q.XJ,muteChannel:$.vW,unmuteChannel:$.c2,openModal:f.q},ce=(0,n.connect)((function(e,t){const a=(0,y.vd)(e)[t.channel.id],n=(0,r.H7)(e);let i=!1,o=!1;return n&&(i=(0,X.Ec)(e,n.id,t.channel.id,Z.A.MANAGE_PUBLIC_CHANNEL_MEMBERS),o=(0,X.Ec)(e,n.id,t.channel.id,Z.A.MANAGE_PRIVATE_CHANNEL_MEMBERS)),{currentUserId:(0,y.WR)(e),isFavorite:(0,s.g1)(e,t.channel.id),isMuted:(0,S.X4)(a),channelLink:"".concat((0,ee.vV)()).concat(t.channelLink),managePublicChannelMembers:i,managePrivateChannelMembers:o}}),le)(oe);function de(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ue extends d().PureComponent{constructor(e){super(e),de(this,"enableToolTipIfNeeded",(()=>{const e=this.labelRef.current,t=e&&e.offsetWidth<e.scrollWidth;this.setState({showTooltip:Boolean(t)})})),de(this,"getAriaLabel",(()=>{const{label:e,ariaLabelPrefix:t,unreadMentions:a,intl:n}=this.props;let s=e;return t&&(s+=" ".concat(t)),1===a?s+=" ".concat(a," ").concat(n.formatMessage({id:"accessibility.sidebar.types.mention",defaultMessage:"mention"})):a>1&&(s+=" ".concat(a," ").concat(n.formatMessage({id:"accessibility.sidebar.types.mentions",defaultMessage:"mentions"}))),this.props.isUnread&&0===a&&(s+=" ".concat(n.formatMessage({id:"accessibility.sidebar.types.unread",defaultMessage:"unread"}))),s.toLowerCase()})),de(this,"handleChannelClick",(e=>{(0,D.Gy)(j.CU.ChannelLinkClicked),this.handleSelectChannel(e),this.props.rhsOpen&&this.props.rhsState===h._n.EDIT_HISTORY&&this.props.actions.closeRightHandSide()})),de(this,"handleSelectChannel",(e=>{e.defaultPrevented||0!==e.button||((0,q.r)(e)?(e.preventDefault(),this.props.actions.multiSelectChannelAdd(this.props.channel.id)):e.shiftKey?(e.preventDefault(),this.props.actions.multiSelectChannelTo(this.props.channel.id)):e.altKey&&!this.props.isUnread?(e.preventDefault(),this.props.actions.markMostRecentPostInChannelAsUnread(this.props.channel.id)):this.props.actions.clearChannelSelection())})),de(this,"handleMenuToggle",(e=>{this.setState({isMenuOpen:e})})),this.labelRef=d().createRef(),this.state={isMenuOpen:!1,showTooltip:!1}}componentDidMount(){var e;this.enableToolTipIfNeeded(),this.props.isSharedChannel&&null!==(e=this.props.channel)&&void 0!==e&&e.id&&0===this.props.remoteNames.length&&this.props.actions.fetchChannelRemotes(this.props.channel.id)}componentDidUpdate(e){var t,a,n,s,r;e.label!==this.props.label&&this.enableToolTipIfNeeded(),this.props.isSharedChannel&&((null===(t=e.channel)||void 0===t?void 0:t.id)!==(null===(a=this.props.channel)||void 0===a?void 0:a.id)||(null===(n=e.channel)||void 0===n?void 0:n.team_id)!==(null===(s=this.props.channel)||void 0===s?void 0:s.team_id))&&0===this.props.remoteNames.length&&null!==(r=this.props.channel)&&void 0!==r&&r.id&&this.props.actions.fetchChannelRemotes(this.props.channel.id)}render(){const{channel:e,icon:t,isChannelSelected:a,isMuted:n,isUnread:s,label:r,link:i,unreadMentions:o,firstChannelName:c,showChannelsTutorialStep:u,hasUrgent:m}=this.props;let p=null;(c===e.name||!c&&u&&e.name===h.Ay.DEFAULT_CHANNEL)&&(p=c?d().createElement(x.Pr,{firstChannelName:e.display_name}):d().createElement(x.Pr,null));let g=d().createElement("span",{ref:this.labelRef,className:"SidebarChannelLinkLabel"},(0,B.uN)(r));this.state.showTooltip&&(g=d().createElement(H.A,{title:r},g));const f=this.props.teammateId?d().createElement(k.A,{userID:this.props.teammateId,showTooltip:!0,spanStyle:{height:18},emojiStyle:{marginTop:-4,marginBottom:0,opacity:.8}}):null,b=this.props.isSharedChannel?d().createElement(F.A,{className:"icon",withTooltip:!0,remoteNames:this.props.remoteNames}):null,E=d().createElement(d().Fragment,null,d().createElement(J,{isDeleted:0!==e.delete_at,icon:t}),d().createElement("div",{className:"SidebarChannelLinkLabel_wrapper"},g,f,d().createElement(U.default,{pluggableName:"SidebarChannelLinkLabel",channel:this.props.channel}),b),d().createElement(K,{id:e.id}),d().createElement(V.A,{unreadMentions:o,hasUrgent:m}),d().createElement("div",{className:l()("SidebarMenu","MenuWrapper",{menuOpen:this.state.isMenuOpen},{"MenuWrapper--open":this.state.isMenuOpen})},d().createElement(ce,{channel:e,channelLink:i,isUnread:s,channelLeaveHandler:this.props.channelLeaveHandler,onMenuToggle:this.handleMenuToggle}))),C=l()(["SidebarLink",{menuOpen:this.state.isMenuOpen,muted:n,"unread-title":this.props.isUnread,selected:a}]);return d().createElement(O.Link,{className:C,id:"sidebarItem_".concat(e.name),"aria-label":this.getAriaLabel(),to:i,onClick:this.handleChannelClick,tabIndex:0},E,p)}}de(ue,"propTypes",{link:E().string.isRequired,label:E().string.isRequired,ariaLabelPrefix:E().string,channelLeaveHandler:E().func,icon:E().oneOfType([E().element,E().oneOf([null])]),unreadMentions:E().number.isRequired,isUnread:E().bool.isRequired,isMuted:E().bool.isRequired,isChannelSelected:E().bool.isRequired,teammateId:E().string,firstChannelName:E().string,showChannelsTutorialStep:E().bool.isRequired,hasUrgent:E().bool.isRequired,rhsOpen:E().bool,isSharedChannel:E().bool,remoteNames:E().arrayOf(E().string).isRequired,actions:E().shape({markMostRecentPostInChannelAsUnread:E().func.isRequired,clearChannelSelection:E().func.isRequired,multiSelectChannelTo:E().func.isRequired,multiSelectChannelAdd:E().func.isRequired,unsetEditingPost:E().func.isRequired,closeRightHandSide:E().func.isRequired,fetchChannelRemotes:E().func.isRequired}).isRequired});const me=(0,m.injectIntl)(ue),he=(0,n.connect)((function(){const e=(0,s.KP)();return(t,a)=>{var n;const s=(0,y.vd)(t)[a.channel.id],r=e(t,a.channel.id),o=(0,M.zj)(t),l="true"===o.EnableTutorial,c=(0,y.WR)(t),d=(0,_.yW)(t,L.AG.ONBOARDING_TUTORIAL_STEP,c,0),u=(0,_.yW)(t,P.XV,P.Z.CHANNELS_TOUR,L.BL)===P.gy.STARTED,m=o.EnableOnboardingFlow,h=l&&d===L.NI.CHANNELS_AND_DIRECT_MESSAGES&&u&&"true"===m,p=null!==(n=a.channel)&&void 0!==n&&n.shared?(0,T.lk)(t,a.channel.id):[];return{unreadMentions:r.mentions,unreadMsgs:r.messages,isUnread:r.showUnread,isMuted:(0,S.X4)(s),hasUrgent:r.hasUrgent,isChannelSelected:(0,i.T$)(t,a.channel.id),firstChannelName:h?(0,N.Hd)(t):"",showChannelsTutorialStep:h,rhsState:(0,R.bM)(t),rhsOpen:(0,R.A)(t),remoteNames:p}}}),(function(e){return{actions:(0,p.zH)({markMostRecentPostInChannelAsUnread:w.pr,unsetEditingPost:w.K4,clearChannelSelection:I.lE,multiSelectChannelTo:I.Go,multiSelectChannelAdd:I.wf,closeRightHandSide:A.bP,fetchChannelRemotes:v.No},e)}}))(me);var pe=a(9386);const ge=e=>{let{channel:t,currentTeamName:a,actions:n}=e;const s=(0,m.useIntl)(),r=(0,c.useCallback)((e=>{n.leaveChannel(t.id),e()}),[t.id,n.leaveChannel]),i=(0,c.useCallback)((e=>{n.openModal({modalId:h.IQ.LEAVE_PRIVATE_CHANNEL_MODAL,dialogType:C.A,dialogProps:{channel:t}}),e()}),[t,n.openModal]);let o=null;t.type===h.Ay.OPEN_CHANNEL&&t.name!==h.Ay.DEFAULT_CHANNEL?o=r:t.type===h.Ay.PRIVATE_CHANNEL&&(o=i);const l=d().createElement(pe.A,{channelType:t.type});let u;return t.type===h.Ay.OPEN_CHANNEL?u=s.formatMessage({id:"accessibility.sidebar.types.public",defaultMessage:"public channel"}):t.type===h.Ay.PRIVATE_CHANNEL&&(u=s.formatMessage({id:"accessibility.sidebar.types.private",defaultMessage:"private channel"})),d().createElement(he,{channel:t,link:"/".concat(a,"/channels/").concat(t.name),label:t.display_name,ariaLabelPrefix:u,channelLeaveHandler:o,icon:l,isSharedChannel:t.shared})};ge.propTypes={currentTeamName:E().string.isRequired};const fe=ge,be=(0,n.connect)(null,(function(e){return{actions:(0,p.zH)({leaveChannel:g.nE,openModal:f.q},e)}}))(fe);var Ee=a(35631),Ce=a(7430),ve=a(40693),ye=a(61767),Me=a(83007);function _e(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Te extends d().PureComponent{constructor(){super(...arguments),_e(this,"handleLeaveChannel",(e=>{const t=this.props.channel.teammate_id,a=h.YM.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,n=this.props.currentUserId;this.props.actions.savePreferences(n,[{user_id:n,category:a,name:t,value:"false"}]).then(e),this.props.actions.leaveDirectChannel(this.props.channel.name),this.props.active&&(0,Me.J)().push("/".concat(this.props.currentTeamName,"/channels/").concat(this.props.redirectChannel))})),_e(this,"getIcon",(()=>{const{channel:e,teammate:t}=this.props;if(!t)return null;if(t.id&&t.delete_at)return d().createElement("i",{className:"icon icon-archive-outline"});let a="";return"online"===e.status?a="status-online":"away"===e.status?a="status-away":"dnd"===e.status&&(a="status-dnd"),d().createElement(ye.A,{src:ve.mT.getProfilePictureUrl(t.id,t.last_picture_update),size:"xs",status:t.is_bot?"":e.status,wrapperClass:"DirectChannel__profile-picture",newStatusIcon:!0,statusClass:"DirectChannel__status-icon ".concat(a)})}))}render(){const{channel:e,teammate:t,currentTeamName:a}=this.props;if(!t)return null;let n=e.display_name;return this.props.currentUserId===t.id&&(n=this.props.intl.formatMessage({id:"sidebar.directchannel.you",defaultMessage:"{displayname} (you)"},{displayname:e.display_name})),d().createElement(he,{teammateId:t.id,channel:e,link:"/".concat(a,"/messages/@").concat(t.username),label:n,channelLeaveHandler:this.handleLeaveChannel,icon:this.getIcon(),isSharedChannel:Boolean(t.remote_id)})}}_e(Te,"propTypes",{currentTeamName:E().string.isRequired,currentUserId:E().string.isRequired,redirectChannel:E().string.isRequired,active:E().bool.isRequired,actions:E().shape({savePreferences:E().func.isRequired,leaveDirectChannel:E().func.isRequired}).isRequired});const Se=(0,m.injectIntl)(Te),we=(0,n.connect)((function(e,t){const a=(0,Ce.wz)(e,t.channel.teammate_id),n=(0,Ce.HW)(e),i=(0,r.H7)(e),o=i?(0,s.Dn)(e,i.id):"",l=(0,s.eH)(e),c=t.channel.id===l;return{teammate:a,currentUserId:n.id,redirectChannel:o,active:c}}),(function(e){return{actions:(0,p.zH)({savePreferences:Ee.SF,leaveDirectChannel:g.iq},e)}}))(Se),Ie=e=>{let{channel:t,currentUserId:a,actions:n,active:s,currentTeamName:r,redirectChannel:i,membersCount:o}=e;const l=(0,c.useCallback)((e=>{const o=t.id,l=h.Ay.Preferences.CATEGORY_GROUP_CHANNEL_SHOW;n.savePreferences(a,[{user_id:a,category:l,name:o,value:"false"}]).then(e),s&&(0,Me.J)().push("/".concat(r,"/channels/").concat(i))}),[t.id,n,s,r,i,a]);return d().createElement(he,{channel:t,link:"/".concat(r,"/messages/").concat(t.name),label:t.display_name,channelLeaveHandler:l,icon:d().createElement("div",{className:"status status--group"},o)})};Ie.propTypes={currentTeamName:E().string.isRequired,currentUserId:E().string.isRequired,redirectChannel:E().string.isRequired,active:E().bool.isRequired,membersCount:E().number.isRequired,actions:E().shape({savePreferences:E().func.isRequired}).isRequired};const Ae=(0,c.memo)(Ie),Ne=(0,n.connect)((function(){const e=(0,s.fV)();return(t,a)=>{const n=(0,Ce.WR)(t),i=(0,r.H7)(t),o=i?(0,s.Dn)(t,i.id):"",l=(0,s.eH)(t),c=e(t,a.channel);return{currentUserId:n,redirectChannel:o,active:a.channel.id===l,membersCount:c}}}),(function(e){return{actions:(0,p.zH)({savePreferences:Ee.SF},e)}}))(Ae),Re=(0,n.connect)((function(){const e=(0,s.s9)(),t=(0,s.KP)();return(a,n)=>{const o=e(a,n.channelId),l=(0,r.H7)(a),c=(0,s.eH)(a),d=t(a,(null==o?void 0:o.id)||"");return{channel:o,isCurrentChannel:(null==o?void 0:o.id)===c,currentTeamName:null==l?void 0:l.name,unreadMentions:d.mentions,isUnread:d.showUnread,draggingState:(0,i.NX)(a),isChannelSelected:(0,i.T$)(a,n.channelId),multiSelectedChannelIds:a.views.channelSidebar.multiSelectedChannelIds,autoSortedCategoryIds:(0,i.VM)(a)}}})),Pe=Re((function(e){let{isCategoryCollapsed:t,isCategoryDragged:a,isUnread:n,isCurrentChannel:s,setChannelRef:r,channel:i,currentTeamName:o,isDraggable:p,isChannelSelected:g,draggingState:f,multiSelectedChannelIds:b,channelIndex:E,isAutoSortedCategory:C,autoSortedCategoryIds:v}=e;const[y,M]=(0,c.useState)(!0);if(!i)return null;if(!o)return null;function _(){return a||t&&!n&&!s}function T(e){return t=>{r((null==i?void 0:i.id)||"",t),null==e||e(t)}}function S(e){e&&"toOpaqueAnimation"===e.animationName&&!_()&&M(!0)}function w(e){e&&"toTransparentAnimation"===e.animationName&&_()&&M(!1)}let I;if(I=y?i.type===h.Ay.DM_CHANNEL?d().createElement(we,{channel:i,currentTeamName:o}):i.type===h.Ay.GM_CHANNEL?d().createElement(Ne,{channel:i,currentTeamName:o}):d().createElement(be,{channel:i,currentTeamName:o}):null,p){let e;return g&&f.state&&f.id===i.id&&b.length>1&&(e=y?d().createElement("div",{className:"SidebarChannel__selectedCount"},d().createElement(m.FormattedMessage,{id:"sidebar_left.sidebar_channel.selectedCount",defaultMessage:"{count} selected",values:{count:b.length}})):null),d().createElement(u.Draggable,{draggableId:i.id,index:E},((t,a)=>d().createElement("li",Object.assign({draggable:"false",ref:T(t.innerRef),className:l()("SidebarChannel",{collapsed:_(),expanded:!_(),unread:n,active:s,dragging:a.isDragging,selectedDragging:g&&f.state&&f.id!==i.id,fadeOnDrop:a.isDropAnimating&&a.draggingOver&&v.has(a.draggingOver),noFloat:C&&!a.isDragging})},t.draggableProps,t.dragHandleProps,{onAnimationStart:S,onAnimationEnd:w,role:"listitem",tabIndex:-1}),I,e)))}return d().createElement("li",{ref:T(),className:l()("SidebarChannel",{collapsed:_(),expanded:!_(),unread:n,active:s}),onAnimationStart:S,onAnimationEnd:w,role:"listitem"},I)}))},99894:(e,t,a)=>{a.r(t),a.d(t,{default:()=>Ar}),a(3188),a(6552);var n=a(37270),s=a(30413),r=a(65952),i=a(26614),o=a(14776),l=a(7430),c=a(25778),d=a(75270),u=a(10189),m=(a(43813),a(4290),a(1418)),h=a(87373),p=a(87988),g=a(23739),f=a(3569),b=a(77440),E=a(59935),C=a(46859),v=a(30388),y=a(83949);function M(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?M(Object(a),!0).forEach((function(t){T(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):M(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function T(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function S(e){return async(t,a)=>{t((0,g.Uv)(e.id));const n=a(),s=(0,l.HW)(n);v.A.setPreviousTeamId(s.id,e.id),(0,f.F4)(n)&&t((0,E.I8)());const r=(0,i.Ay)(n),o=(0,b.h7)(n);if(r&&"true"===r.IsLicensed&&("true"===r.LDAPGroups||o)){const a={filter_allow_reference:!1,page:0,per_page:60,include_member_count:!0,include_member_ids:!0,include_archived:!1},n=_(_({},a),{},{filter_has_member:s.id});s&&t((0,h.N9)(n)),"true"===r.LDAPGroups&&t((0,h.jM)(e.id,!0)),e.group_constrained&&"true"===r.LDAPGroups?t((0,h.UT)(e.id,!0)):t((0,h.f)(a))}return{data:e}}}var w=a(20553),I=a(44785),A=a.n(I),N=(a(17046),a(74883),a(57406),a(55448),a(70727)),R=a.n(N),P=a(36418),L=a.n(P),O=a(81911),D=a(88350),k=a(83739),F=a(55171),x=a(15252),H=a(62688),U=a.n(H),B=a(71633),q=a.n(B),j=a(11925),V=a(7380),G=a(32446),z=a(17085),W=a(49176),K=a(35664),Y=a(78451),J=(a(29206),a(97309),a(10844),a(59297),a(40693)),Q=a(15755),Z=a(91767),X=a(78064),$=a(85873);const ee=new RegExp("^[a-zA-Z0-9]{".concat(26,"}__[a-zA-Z0-9]{").concat(26,"}$"));function te(e){let{match:t,history:a}=e;return async(e,n)=>{const i=n(),{path:c,identifier:d,team:u}=t.params;if(!d)return{data:void 0};const m=(0,o.Uj)(i,u);if(!m)return{data:void 0};const h=await async function(e,t,a){if("channels"===t){const t=(0,r.Os)(e,a),n=(0,r.pd)(e).find((e=>e.name===a));if(26===a.length){if(!t&&!n)try{return await J.mT.getChannel(a),"channel_id"}catch(e){return 404===e.status_code?"channel_name":"error"}return"channel_name"}return!t&&!n&&40===a.length||t&&t.type===Y.YM.GM_CHANNEL||n&&n.type===Y.YM.GM_CHANNEL?"group_channel_group_id":function(e){return 54===e.length&&ee.test(e)}(a)?"direct_channel_user_ids":"channel_name"}return"messages"===t?0===a.indexOf("@")?"direct_channel_username":a.indexOf("@")>0?"direct_channel_email":26===a.length?"direct_channel_user_id":40===a.length?"group_channel_group_id":"error":"error"}(i,c,d);switch(h){case"channel_name":e(function(e,t){return async(a,n)=>{const i=n(),{team:c,identifier:d}=e.params,u=d.toLowerCase(),m=(0,o.Uj)(i,c);if(!m)return{data:void 0};let h,p=(0,r.wX)(i,m.id)[u];if(!p){const e=await a((0,s.lB)(c,u,!0));"data"in e&&(p=e.data)}if(p&&(h=i.entities.channels.myMembers[p.id],!h)){const e=await a((0,s.UB)(p.id,(0,l.WR)(i)));"data"in e&&(h=e.data)}if(!p||!h){var g,f;if((null===(g=p)||void 0===g?void 0:g.type)===Y.YM.PRIVATE_CHANNEL){const e=await a((0,X.DT)(m,p.display_name));if("data"in e&&!e.data.join)return{data:void 0}}const n=await a((0,s.Cg)((0,l.WR)(i),m.id,(null===(f=p)||void 0===f?void 0:f.id)||"",u));if("error"in n){if(!p){const n=await a((0,s.lB)(c,u,!0));if("error"in n||0===n.data.delete_at)return await a((0,s.DC)(m.id)),ie(e,t,(0,r.Dn)(i,m.id)),{data:void 0};p=n.data}}else p=n.data.channel}return p.type===Y.YM.DM_CHANNEL?a(ne(e,t)):p.type===Y.YM.GM_CHANNEL?t.replace("/".concat(c,"/messages/").concat(p.name)):se(p),{data:void 0}}}(t,a));break;case"channel_id":e(function(e,t){return async(a,n)=>{const i=n(),{team:c,identifier:d}=e.params,u=d.toLowerCase();let m=(0,r.c)(i,u);const h=i.entities.channels.myMembers[u],p=(0,o.Uj)(i,c);if(!m||!h){const n=await a((0,s.Cg)((0,l.WR)(i),p.id,u,""));if("error"in n)return await a((0,s.DC)(p.id)),ie(e,t,(0,r.Dn)(i,p.id)),{data:void 0};m=n.data.channel}return m.type===Y.YM.DM_CHANNEL?a(ae(e,t,$.zj(m.name,(0,l.WR)(i)))):m.type===Y.YM.GM_CHANNEL?t.replace("/".concat(c,"/messages/").concat(m.name)):t.replace("/".concat(c,"/channels/").concat(m.name)),{data:void 0}}}(t,a));break;case"group_channel_group_id":e(function(e,t){return async(a,n)=>{const i=n(),{identifier:c,team:d}=e.params,u=c.toLowerCase();t.replace(e.url.replace("/channels/","/messages/"));let m=(0,r.Os)(i,u);const h=(0,o.Uj)(i,d);if(!m){const n=await a((0,s.Cg)((0,l.WR)(i),h.id,"",u));if("error"in n)return await a((0,s.DC)(h.id)),re(e,t,(0,r.Dn)(i,h.id)),{data:void 0};m=n.data.channel}return a((0,s.wO)(m.id)),se(m),{data:void 0}}}(t,a));break;case"direct_channel_username":e(function(e,t){return async(a,n)=>{const i=n(),{team:c,identifier:d}=e.params,u=d.slice(1,d.length).toLowerCase(),m=(0,o.Uj)(i,c);let h=(0,l.JE)(i,u);if(!h){const n=await a((0,z.JE)(u));if("error"in n)return await a((0,s.DC)(m.id)),re(e,t,(0,r.Dn)(i,m.id)),{data:void 0};h=n.data}const p=await a((0,Q.q6)(h.id));return"error"in p?(await a((0,s.DC)(m.id)),re(e,t,(0,r.Dn)(i,m.id)),{data:void 0}):(se(p.data),{data:void 0})}}(t,a));break;case"direct_channel_email":e(function(e,t){return async(a,n)=>{const i=n(),{team:c,identifier:d}=e.params,u=d.toLowerCase(),m=(0,o.Uj)(i,c);let h=(0,l.ht)(i,u);if(!h){const n=await a((0,z.ht)(u));if("error"in n)return await a((0,s.DC)(m.id)),re(e,t,(0,r.Dn)(i,m.id)),{data:void 0};h=n.data}return t.replace("/".concat(c,"/messages/@").concat(h.username)),{data:void 0}}}(t,a));break;case"direct_channel_user_ids":e(ne(t,a));break;case"direct_channel_user_id":e(ae(t,a,d));break;case"error":await e((0,s.DC)(m.id)),re(t,a,(0,r.Dn)(i,m.id))}return{data:void 0}}}function ae(e,t,a){return async(n,i)=>{const c=i(),{team:d}=e.params,u=(0,o.Uj)(c,d);let m=(0,l.wz)(c,a);if(!m){const i=await n((0,z.wz)(a));if("error"in i)return await n((0,s.DC)(u.id)),re(e,t,(0,r.Dn)(c,u.id)),{data:void 0};m=i.data}return t.replace("/".concat(d,"/messages/@").concat(m.username)),{data:void 0}}}function ne(e,t){return async(a,n)=>{const i=n(),{team:c,identifier:d}=e.params,u=$.zj(d.toLowerCase(),(0,l.WR)(n())),m=(0,o.Uj)(i,c);let h=(0,l.wz)(i,u);if(!h){const n=await a((0,z.wz)(u));if("error"in n)return await a((0,s.DC)(m.id)),re(e,t,(0,r.Dn)(i,m.id)),{data:void 0};h=n.data}return t.replace("/".concat(c,"/messages/@").concat(h.username)),{data:void 0}}}function se(e){Z.tk(e)}function re(e,t,a){const{team:n}=e.params;t.push(n?"/".concat(n,"/channels/").concat(a):"/")}async function ie(e,t,a){const{team:n}=e.params;t.push(n?"/error?type=channel_not_found&returnTo=/".concat(n,"/channels/").concat(a):"/")}var oe=a(35073),le=a(97026),ce=a(14778),de=a(87818),ue=a(78417),me=a(1396),he=a(40057),pe=a(52729),ge=a(78546),fe=a(30112),be=a(92008),Ee=a(59671),Ce=a(52445),ve=a(72870),ye=a(63022),Me=a(99255),_e=a(87778),Te=a(69410),Se=a(70689),we=a(2809),Ie=a(69657),Ae=a(85406),Ne=a(62351),Re=a(16230),Pe=a(69669),Le=a(64109);const Oe=e=>{var t,a;return P.createElement("svg",Object.assign({width:null!==(t=e.width)&&void 0!==t?t:"130",height:null!==(a=e.height)&&void 0!==a?a:"102",viewBox:"0 0 130 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),P.createElement("g",{clipPath:"url(#clip0_4212_90419)"},P.createElement("path",{d:"M2.50001 16L2.5 31L127.5 31L127.5 75L66 75",stroke:"var(--center-channel-color)",strokeOpacity:"0.32",strokeLinecap:"round"}),P.createElement("path",{d:"M2.5 69L2.5 42L29 42",stroke:"var(--center-channel-color)",strokeOpacity:"0.32",strokeLinecap:"round"}),P.createElement("path",{d:"M18.5 70.5L18.5 56.5L106 56.5",stroke:"var(--center-channel-color)",strokeOpacity:"0.32",strokeLinecap:"round"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 16)",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 74)",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 16 74)",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"71",cy:"59",r:"43",fill:"var(--center-channel-color)",fillOpacity:"0.12"}),P.createElement("path",{d:"M110.748 91.5258L119 100V56C119 54.8954 118.105 54 117 54H76.0005C74.8959 54 74.0005 54.8954 74.0005 56V88.9211C74.0005 90.0256 74.8959 90.9211 76.0005 90.9211H109.316C109.855 90.9211 110.372 91.1391 110.748 91.5258Z",fill:"#28427B"}),P.createElement("circle",{opacity:"0.48",cx:"86.831",cy:"65.831",r:"5.83099",fill:"var(--button-color)"}),P.createElement("path",{opacity:"0.4",d:"M96 64H112",stroke:"var(--button-color-rgb)",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M82 79H103.38",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M82 83H96.2535",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M96 68H110",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M82 75H93.0141",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M95.6064 75H107.268",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),P.createElement("path",{d:"M28.605 67.5638L15 81V12C15 10.8954 15.8954 10 17 10H83C84.1046 10 85 10.8954 85 12V64.9868C85 66.0914 84.1046 66.9868 83 66.9868H30.0103C29.4842 66.9868 28.9793 67.1941 28.605 67.5638Z",fill:"var(--center-channel-bg)"}),P.createElement("path",{d:"M28.2536 67.2081L15.5 79.8035V12C15.5 11.1716 16.1716 10.5 17 10.5H83C83.8284 10.5 84.5 11.1716 84.5 12V64.9868C84.5 65.8153 83.8284 66.4868 83 66.4868H30.0103C29.3527 66.4868 28.7215 66.746 28.2536 67.2081Z",stroke:"var(--center-channel-color)",strokeOpacity:"0.8"}),P.createElement("circle",{cx:"33",cy:"29",r:"9",fill:"var(--center-channel-color)",fillOpacity:"0.4"}),P.createElement("path",{d:"M48 25H64",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 49H62",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 55H47",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M48 31H73",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 43H42",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M46 43H64",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("circle",{cx:"78",cy:"19",r:"19",fill:"#32539A"}),P.createElement("path",{d:"M98 49L80 49",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),P.createElement("path",{d:"M76 49L70 49",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),P.createElement("path",{d:"M67 49L65 49",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),P.createElement("circle",{cx:"44",cy:"75",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"52",cy:"75",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"60",cy:"75",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("rect",{x:"70.5",y:"15.5",width:"15",height:"12",rx:"1.5",stroke:"var(--button-color)"}),P.createElement("path",{d:"M73 16V13C73 10.2386 75.2386 8 78 8V8C80.7614 8 83 10.2386 83 13V16",stroke:"var(--button-color)"})),P.createElement("defs",null,P.createElement("clipPath",{id:"clip0_4212_90419"},P.createElement("rect",{width:"130",height:"102",fill:"white"}))))};Oe.propTypes={width:U().number,height:U().number};const De=Oe,ke=e=>{var t,a;return L().createElement("svg",{width:null!==(t=e.width)&&void 0!==t?t:"130",height:null!==(a=e.height)&&void 0!==a?a:"102",viewBox:"0 0 130 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},L().createElement("g",{clipPath:"url(#clip0_4212_90121)"},L().createElement("path",{d:"M2.50001 16L2.5 31L127.5 31L127.5 75L66 75",stroke:"rgba(var(--center-channel-color-rgb), 0.32)",strokeLinecap:"round"}),L().createElement("path",{d:"M2.5 69L2.5 42L29 42",stroke:"rgba(var(--center-channel-color-rgb), 0.32)",strokeLinecap:"round"}),L().createElement("path",{d:"M18.5 70.5L18.5 56.5L106 56.5",stroke:"rgba(var(--center-channel-color-rgb), 0.32)",strokeLinecap:"round"}),L().createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 16)",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 74)",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 16 74)",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"71",cy:"59",r:"43",fill:"rgba(var(--center-channel-color-rgb), 0.12)"}),L().createElement("path",{d:"M110.748 91.5258L119 100V56C119 54.8954 118.105 54 117 54H76.0005C74.8959 54 74.0005 54.8954 74.0005 56V88.9211C74.0005 90.0256 74.8959 90.9211 76.0005 90.9211H109.316C109.855 90.9211 110.372 91.1391 110.748 91.5258Z",fill:"#28427B"}),L().createElement("circle",{opacity:"0.48",cx:"86.831",cy:"65.831",r:"5.83099",fill:"var(--button-color)"}),L().createElement("path",{opacity:"0.4",d:"M96 64H112",stroke:"var(--button-color-rgb)",strokeLinecap:"round"}),L().createElement("path",{opacity:"0.4",d:"M82 79H103.38",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),L().createElement("path",{opacity:"0.4",d:"M82 83H96.2535",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),L().createElement("path",{opacity:"0.4",d:"M96 68H110",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),L().createElement("path",{opacity:"0.4",d:"M82 75H93.0141",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),L().createElement("path",{opacity:"0.4",d:"M95.6064 75H107.268",stroke:"rgba(var(--button-color-rgb))",strokeLinecap:"round"}),L().createElement("path",{d:"M28.605 67.5638L15 81V12C15 10.8954 15.8954 10 17 10H83C84.1046 10 85 10.8954 85 12V64.9868C85 66.0914 84.1046 66.9868 83 66.9868H30.0103C29.4842 66.9868 28.9793 67.1941 28.605 67.5638Z",fill:"rgba(var(--center-channel-bg-rgb))"}),L().createElement("path",{d:"M28.2536 67.2081L15.5 79.8035V12C15.5 11.1716 16.1716 10.5 17 10.5H83C83.8284 10.5 84.5 11.1716 84.5 12V64.9868C84.5 65.8153 83.8284 66.4868 83 66.4868H30.0103C29.3527 66.4868 28.7215 66.746 28.2536 67.2081Z",stroke:"rgba(var(--center-channel-color-rgb), 0.8)"}),L().createElement("circle",{cx:"33",cy:"29",r:"9",fill:"rgba(var(--center-channel-color-rgb), 0.4)"}),L().createElement("path",{d:"M48 25H64",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("path",{d:"M25 49H62",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("path",{d:"M25 55H47",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("path",{d:"M48 31H73",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("path",{d:"M25 43H42",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("path",{d:"M46 43H64",stroke:"rgba(var(--center-channel-color-rgb), 0.4)",strokeLinecap:"round"}),L().createElement("circle",{cx:"78",cy:"19",r:"19",fill:"#32539A"}),L().createElement("path",{d:"M98 49L80 49",stroke:"rgba(var(--center-channel-color-rgb), 0.8)",strokeLinecap:"round",strokeLinejoin:"round"}),L().createElement("path",{d:"M76 49L70 49",stroke:"rgba(var(--center-channel-color-rgb), 0.8)",strokeLinecap:"round",strokeLinejoin:"round"}),L().createElement("path",{d:"M67 49L65 49",stroke:"rgba(var(--center-channel-color-rgb), 0.8)",strokeLinecap:"round",strokeLinejoin:"round"}),L().createElement("circle",{cx:"44",cy:"75",r:"2",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"52",cy:"75",r:"2",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"60",cy:"75",r:"2",fill:"rgba(var(--center-channel-color-rgb), 0.32)"}),L().createElement("circle",{cx:"78",cy:"19",r:"9.5",stroke:"rgba(var(--button-color-rgb))"}),L().createElement("path",{d:"M87.5 20.2525C86.1859 21.8482 82.4292 23 78 23C73.5708 23 69.8141 21.8482 68.5 20.2525",stroke:"rgba(var(--button-color-rgb))"}),L().createElement("path",{d:"M86.6622 15C84.9331 16.1956 81.7014 17 78 17C74.2986 17 71.0669 16.1956 69.3378 15",stroke:"rgba(var(--button-color-rgb))"}),L().createElement("path",{d:"M81.5 19C81.5 21.7141 81.059 24.1482 80.3642 25.8854C80.0162 26.7553 79.6144 27.4258 79.1937 27.8706C78.7741 28.3143 78.3705 28.5 78 28.5C77.6295 28.5 77.2259 28.3143 76.8063 27.8706C76.3856 27.4258 75.9838 26.7553 75.6358 25.8854C74.941 24.1482 74.5 21.7141 74.5 19C74.5 16.2859 74.941 13.8518 75.6358 12.1146C75.9838 11.2447 76.3856 10.5742 76.8063 10.1294C77.2259 9.6857 77.6295 9.5 78 9.5C78.3705 9.5 78.7741 9.6857 79.1937 10.1294C79.6144 10.5742 80.0162 11.2447 80.3642 12.1146C81.059 13.8518 81.5 16.2859 81.5 19Z",stroke:"rgba(var(--button-color-rgb))"})),L().createElement("defs",null,L().createElement("clipPath",{id:"clip0_4212_90121"},L().createElement("rect",{width:"130",height:"102",fill:"rgba(var(--center-channel-bg-rgb))"}))))};ke.propTypes={width:U().number,height:U().number};const Fe=ke,xe=e=>{var t,a;return P.createElement("svg",Object.assign({width:null!==(t=e.width)&&void 0!==t?t:"130",height:null!==(a=e.height)&&void 0!==a?a:"92",viewBox:"0 0 130 92",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),P.createElement("g",{clipPath:"url(#clip0_4210_88396)"},P.createElement("path",{d:"M2.50001 6.00001L2.5 21L127.5 21L127.5 65L66 65",stroke:"var(--center-channel-color)",strokeOpacity:"0.24",strokeLinecap:"round"}),P.createElement("path",{d:"M2.49999 59L2.49999 32L29 32",stroke:"var(--center-channel-color)",strokeOpacity:"0.24",strokeLinecap:"round"}),P.createElement("path",{d:"M18.5 60.5L18.5 46.5L106 46.5",stroke:"var(--center-channel-color)",strokeOpacity:"0.24",strokeLinecap:"round"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 6)",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 0 64)",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",transform:"matrix(1 8.74228e-08 8.74228e-08 -1 16 64)",fill:"var(--center-channel-color)",fillOpacity:"0.4"}),P.createElement("circle",{cx:"71",cy:"49",r:"43",fill:"var(--center-channel-color)",fillOpacity:"0.12"}),P.createElement("path",{d:"M109.748 82.5258L117.999 91V47C117.999 45.8954 117.104 45 115.999 45H74.9998C73.8952 45 72.9998 45.8954 72.9998 47V79.9211C72.9998 81.0256 73.8952 81.9211 74.9998 81.9211H108.315C108.855 81.9211 109.371 82.1391 109.748 82.5258Z",fill:"#28427B"}),P.createElement("circle",{opacity:"0.48",cx:"85.8309",cy:"56.831",r:"5.83099",fill:"#FFFFFF"}),P.createElement("path",{opacity:"0.4",d:"M94.9999 55H111",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M80.9999 70H102.38",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M80.9999 74H95.2535",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M94.9999 59H109",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M80.9999 66H92.014",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{opacity:"0.4",d:"M94.6064 66H106.268",stroke:"#FFFFFF",strokeLinecap:"round"}),P.createElement("path",{d:"M28.605 57.5638L15 71V2C15 0.895431 15.8954 0 17 0H83C84.1046 0 85 0.89543 85 2V54.9868C85 56.0914 84.1046 56.9868 83 56.9868H30.0103C29.4842 56.9868 28.9793 57.1941 28.605 57.5638Z",fill:"var(--center-channel-bg)"}),P.createElement("path",{d:"M28.2536 57.2081L15.5 69.8035V2C15.5 1.17157 16.1716 0.5 17 0.5H83C83.8284 0.5 84.5 1.17157 84.5 2V54.9868C84.5 55.8153 83.8284 56.4868 83 56.4868H30.0103C29.3527 56.4868 28.7215 56.746 28.2536 57.2081Z",stroke:"var(--center-channel-color)",strokeOpacity:"0.8"}),P.createElement("circle",{cx:"33",cy:"19",r:"9",fill:"var(--center-channel-color)",fillOpacity:"0.4"}),P.createElement("path",{d:"M48 15H64",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 39H69",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 45H47",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M48 21H73",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M25 33H42",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("path",{d:"M46 33H64",stroke:"var(--center-channel-color)",strokeOpacity:"0.4",strokeLinecap:"round"}),P.createElement("circle",{cx:"44",cy:"65",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"52",cy:"65",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("circle",{cx:"60",cy:"65",r:"2",fill:"var(--center-channel-color)",fillOpacity:"0.32"}),P.createElement("path",{d:"M101 33L83 33",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),P.createElement("path",{d:"M79 33L73 33",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),P.createElement("path",{d:"M70 33L68 33",stroke:"var(--center-channel-color)",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"})),P.createElement("defs",null,P.createElement("clipPath",{id:"clip0_4210_88396"},P.createElement("rect",{width:"130",height:"92",fill:"white"}))))};xe.propTypes={width:U().number,height:U().number};const He=xe;var Ue=a(64182),Be=a(57486),qe=a(26808),je=a(61767),Ve=a(12762),Ge=a(72180),ze=a(45036),We=a(40142),Ke=a(46),Ye=a(49888),Je=a(53654);const Qe=e=>{let{totalUsers:t,usersLimit:a,channel:s,pluginButtons:r}=e;const i=(0,n.useSelector)(o.Sy);if(!t)return L().createElement(Je.A,null);const l=t<a;return L().createElement(qe.A,{teamId:i,permissions:[he.xB.ADD_USER_TO_TEAM,he.xB.INVITE_GUEST]},l?L().createElement(Ze,{pluginButtons:r}):L().createElement(Xe,{channel:s,pluginButtons:r}))};Qe.propTypes={totalUsers:U().number,usersLimit:U().number.isRequired,pluginButtons:U().node};const Ze=e=>{let{pluginButtons:t}=e;const{formatMessage:a}=(0,ce.useIntl)();return L().createElement(L().Fragment,null,t,L().createElement("div",{className:"LessThanMaxFreeUsers"},L().createElement(Ve.A,{id:"introTextInvite",className:"btn btn-sm btn-primary",modalId:Y.IQ.INVITATION,dialogType:Ye.default,dialogProps:{focusOriginElement:"browseOrAddChannelMenuButton"}},L().createElement("i",{className:"icon-email-plus-outline",title:a({id:"generic_icons.add",defaultMessage:"Add Icon"}),"aria-hidden":"true"}),L().createElement(ce.FormattedMessage,{id:"intro_messages.inviteOthersToWorkspace.button",defaultMessage:"Invite others to the workspace"}))))},Xe=e=>{let{channel:t,pluginButtons:a}=e;const{formatMessage:n}=(0,ce.useIntl)(),s=t.group_constrained?Y.IQ.ADD_GROUPS_TO_CHANNEL:Y.IQ.CHANNEL_INVITE,r=t.group_constrained?We.A:Ke.A;if(0!==t.delete_at)return null;const i=t.type===Y.YM.PRIVATE_CHANNEL;return L().createElement("div",{className:"MoreThanMaxFreeUsersWrapper"},L().createElement("div",{className:"MoreThanMaxFreeUsers"},L().createElement(Be.A,{channelId:t.id,teamId:t.team_id,permissions:[i?he.xB.MANAGE_PRIVATE_CHANNEL_MEMBERS:he.xB.MANAGE_PUBLIC_CHANNEL_MEMBERS]},L().createElement(Ve.A,{className:"action-button",modalId:s,dialogType:r,dialogProps:{channel:t}},L().createElement("i",{className:"icon-account-plus-outline",title:n({id:"generic_icons.add",defaultMessage:"Add Icon"}),"aria-hidden":"true"}),t.group_constrained&&L().createElement(ce.FormattedMessage,{id:"intro_messages.inviteGropusToChannel.button",defaultMessage:"Add groups"}),!t.group_constrained&&L().createElement(ce.FormattedMessage,{id:"intro_messages.inviteMembersToChannel.button",defaultMessage:"Add people"})))),a)},$e=L().memo(Qe);var et=a(21650),tt=a(66935);const at=L().memo((e=>{let{channel:t,pluginButtons:a,channelMember:n}=e;const s=0!==t.delete_at;if(!(0,tt.K)(t.id))return null;if(s||0===a.length||!n)return null;const r=a.map((e=>L().createElement("button",{key:e.id,className:"action-button",onClick:()=>{var a;return null===(a=e.action)||void 0===a?void 0:a.call(e,t,n)}},e.icon,e.text)));return L().createElement(L().Fragment,null,r)}));at.propTypes={pluginButtons:U().array.isRequired},at.displayName="PluggableIntroButtons";const nt=at,st=(0,n.connect)((function(e,t){return{channelMember:(0,r.M9)(e,t.channel.id),pluginButtons:(0,et.qm)(e)}}))(nt);function rt(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class it extends L().PureComponent{constructor(){super(...arguments),rt(this,"toggleFavorite",(()=>{this.props.channel&&(this.props.isFavorite?this.props.actions.unfavoriteChannel(this.props.channel.id):this.props.actions.favoriteChannel(this.props.channel.id))}))}componentDidMount(){var e;null!==(e=this.props.stats)&&void 0!==e&&e.total_users_count||this.props.actions.getTotalUsersStats()}render(){const{currentUserId:e,channel:t,fullWidth:a,locale:n,channelProfiles:s,enableUserCreation:r,isReadOnly:i,isFavorite:o,teamIsGroupConstrained:l,creatorName:c,teammate:d,teammateName:u,currentUser:m,stats:h,usersLimit:p,channelMember:g,isMobileView:f}=this.props;let b="";return a||(b="channel-intro--centered"),t?t.type===Y.YM.DM_CHANNEL?function(e,t,a,n,s,r,i,o){const l="channelIntro";if(i){const a=i?$.RG(i.id,i.last_picture_update):"";let s=null,c=null;null!=i&&i.is_bot||(s=L().createElement(st,{channel:e}),c=ct(e));const d=L().createElement("div",{className:"channel-intro__actions"},dt(n,r),c,s);return L().createElement("div",{id:l,className:"channel-intro "+t},L().createElement("div",{className:"post-profile-img__container channel-intro-img"},L().createElement(je.A,{src:a,size:"xl-custom-DM",status:i.is_bot?"":e.status,userId:null==i?void 0:i.id,username:null==i?void 0:i.username})),L().createElement("h2",{className:"channel-intro__title"},L().createElement(Ge.A,{userId:null==i?void 0:i.id})),L().createElement("p",{className:"channel-intro__text"},L().createElement(ce.FormattedMessage,{id:"intro_messages.DM",defaultMessage:"This is the start of your direct message history with {teammate}. Messages and files shared here are not shown to anyone else.",values:{teammate:o}})),d)}return L().createElement("div",{id:l,className:"channel-intro "+t},L().createElement("p",{className:"channel-intro__text"},L().createElement(ce.FormattedMessage,{id:"intro_messages.teammate",defaultMessage:"This is the start of your direct message history with this teammate. Messages and files shared here are not shown to anyone else."})))}(t,b,0,o,0,this.toggleFavorite,d,u):t.type===Y.YM.GM_CHANNEL?function(e,t,a,n,s,r,i,o,l){const c="channelIntro";if(r.length>0){const d=r.find((e=>e.id===i)),u=r.filter((e=>e.id!==i)).map((e=>L().createElement(je.A,{key:"introprofilepicture"+e.id,src:$.RG(e.id,e.last_picture_update),size:"xl-custom-GM",userId:e.id,username:e.username}))),m=L().createElement("div",{className:"channel-intro__actions"},dt(a,s),ct(e),!n&&ut(e,o),L().createElement(st,{channel:e}));return L().createElement("div",{id:c,className:"channel-intro "+t},L().createElement("div",{className:"post-profile-img__container channel-intro-img channel-intro-img__group"},u),L().createElement("h2",{className:"channel-intro__title"},e.display_name),L().createElement("p",{className:"channel-intro__text"},L().createElement(ce.FormattedMessage,{id:"intro_messages.group_message",defaultMessage:"This is the start of your group message history with these teammates. "}),lt(d,l)),m)}return L().createElement("div",{id:c,className:"channel-intro "+t},L().createElement("p",{className:"channel-intro__text"},L().createElement(ce.FormattedMessage,{id:"intro_messages.group_message",defaultMessage:"This is the start of your group message history with these teammates. Messages and files shared here are not shown to people outside this area."})))}(t,b,o,f,this.toggleFavorite,s,e,m,g):t.name===Y.YM.DEFAULT_CHANNEL?function(e,t,a,n,s,r,i,o,l,c,d){let u=null;const m=i.total_users_count,h=e.type===Y.YM.PRIVATE_CHANNEL,p=m<o;let g=null,f=null,b=null;if(!c){f=L().createElement(st,{channel:e});const t=ct(e);t&&(g=L().createElement(Be.A,{teamId:e.team_id,channelId:e.id,permissions:[h?he.xB.MANAGE_PRIVATE_CHANNEL_PROPERTIES:he.xB.MANAGE_PUBLIC_CHANNEL_PROPERTIES]},t))}return!c&&l&&(u=L().createElement(qe.A,{teamId:e.team_id,permissions:[he.xB.INVITE_USER]},L().createElement(qe.A,{teamId:e.team_id,permissions:[he.xB.ADD_USER_TO_TEAM]},!d&&L().createElement($e,{totalUsers:m,usersLimit:o,channel:e,pluginButtons:f}),d&&L().createElement(Ve.A,{className:"intro-links color--link",modalId:Y.IQ.ADD_GROUPS_TO_TEAM,dialogType:Pe.A,dialogProps:{channel:e}},L().createElement("i",{className:"fa fa-user-plus"}),L().createElement(ce.FormattedMessage,{id:"intro_messages.addGroupsToTeam",defaultMessage:"Add other groups to this team"}))))),b=p?L().createElement("div",{className:"channel-intro__actions"},b=u):L().createElement("div",{className:"channel-intro__actions"},dt(n,r),g,ut(e,a),d&&f),L().createElement("div",{id:"channelIntro",className:"channel-intro "+t},L().createElement(He,null),L().createElement("h2",{className:"channel-intro__title"},e.display_name),L().createElement("p",{className:"channel-intro__text"},!c&&L().createElement(ce.FormattedMessage,{id:"intro_messages.default",defaultMessage:"Welcome to {display_name}. Post messages here that you want everyone to see. Everyone automatically becomes a member of this channel when they join the team.",values:{display_name:e.display_name}}),c&&L().createElement(ce.FormattedMessage,{id:"intro_messages.readonly.default",defaultMessage:"Welcome to {display_name}. Messages can only be posted by admins. Everyone automatically becomes a permanent member of this channel when they join the team.",values:{display_name:e.display_name}})),b)}(t,b,m,o,0,this.toggleFavorite,h,p,r,i,l):t.name===Y.YM.OFFTOPIC_CHANNEL?function(e,t,a,n,s,r,i,o){const l=e.type===Y.YM.PRIVATE_CHANNEL,c=ct(e),d=i.total_users_count,u=d<o;let m=null,h=null;c&&(m=L().createElement(Be.A,{teamId:e.team_id,channelId:e.id,permissions:[l?he.xB.MANAGE_PRIVATE_CHANNEL_PROPERTIES:he.xB.MANAGE_PUBLIC_CHANNEL_PROPERTIES]},c));const p=L().createElement($e,{totalUsers:d,usersLimit:o,channel:e,pluginButtons:L().createElement(st,{channel:e})});return h=u?L().createElement("div",{className:"channel-intro__actions"},h=p):L().createElement("div",{className:"channel-intro__actions"},dt(a,r),m,ut(e,s)),L().createElement("div",{id:"channelIntro",className:"channel-intro "+t},L().createElement(Fe,null),L().createElement("h2",{className:"channel-intro__title"},e.display_name),L().createElement("p",{className:"channel-intro__text"},L().createElement(ce.FormattedMessage,{id:"intro_messages.offTopic",defaultMessage:"This is the start of {display_name}, a channel for non-work-related conversations.",values:{display_name:e.display_name}})),h)}(t,b,o,0,m,this.toggleFavorite,h,p):t.type===Y.YM.OPEN_CHANNEL||t.type===Y.YM.PRIVATE_CHANNEL?function(e,t,a,n,s,r,i,o,l,c){const d=e.display_name;let u,m=null;const h=0!==e.delete_at,p=i.total_users_count,g=p<o;u=h?"":e.type===Y.YM.PRIVATE_CHANNEL?L().createElement(ce.FormattedMessage,{id:"intro_messages.onlyInvited",defaultMessage:"This is the start of {display_name}. Only invited members can see this private channel.",values:{display_name:e.display_name}}):L().createElement(ce.FormattedMessage,{id:"intro_messages.anyMember",defaultMessage:"This is the start of {display_name}. Any team member can join and read this channel.",values:{display_name:e.display_name}});const f=L().createElement(ce.FormattedDate,{value:e.create_at,month:(0,ze.FS)(l),day:"2-digit",year:"numeric"});let b,E;""===c?e.type===Y.YM.PRIVATE_CHANNEL?b=L().createElement(ce.FormattedMessage,{id:"intro_messages.noCreatorPrivate",defaultMessage:"Private channel created on {date}.",values:{name:d,date:f}}):e.type===Y.YM.OPEN_CHANNEL&&(b=L().createElement(ce.FormattedMessage,{id:"intro_messages.noCreator",defaultMessage:"Public channel created on {date}.",values:{name:d,date:f}})):e.type===Y.YM.PRIVATE_CHANNEL?b=L().createElement("span",null,L().createElement(ce.FormattedMessage,{id:"intro_messages.creatorPrivate",defaultMessage:"Private channel created by {creator} on {date}.",values:{name:d,creator:c,date:f}})):e.type===Y.YM.OPEN_CHANNEL&&(b=L().createElement("span",null,L().createElement(ce.FormattedMessage,{id:"intro_messages.creator",defaultMessage:"Public channel created by {creator} on {date}.",values:{name:d,creator:c,date:f}}))),e.purpose&&""!==e.purpose&&(E=L().createElement("span",null,L().createElement(ce.FormattedMessage,{id:"intro_messages.purpose",defaultMessage:" This channel's purpose is: {purpose}",values:{purpose:e.purpose}})));const C=e.type===Y.YM.PRIVATE_CHANNEL;let v=null,y=null;const M=ct(e);return M&&(v=L().createElement(Be.A,{teamId:e.team_id,channelId:e.id,permissions:[C?he.xB.MANAGE_PRIVATE_CHANNEL_PROPERTIES:he.xB.MANAGE_PUBLIC_CHANNEL_PROPERTIES]},M)),m=L().createElement($e,{totalUsers:p,usersLimit:o,channel:e,pluginButtons:L().createElement(st,{channel:e})}),y=g?L().createElement("div",{className:"channel-intro__actions"},y=m):L().createElement("div",{className:"channel-intro__actions"},dt(n,r),m,v,!s&&ut(e,a),L().createElement(st,{channel:e})),L().createElement("div",{id:"channelIntro",className:"channel-intro "+t},C?L().createElement(De,null):L().createElement(Fe,null),L().createElement("h2",{className:"channel-intro__title"},e.display_name),L().createElement("div",{className:"channel-intro__created"},C?L().createElement(Ae.LockOutlineIcon,{size:14}):L().createElement(Ae.GlobeIcon,{size:14}),b),L().createElement("p",{className:"channel-intro__text"},u,E),y)}(t,b,m,o,f,this.toggleFavorite,h,p,n,c):null:null}}rt(it,"propTypes",{currentUserId:U().string.isRequired,fullWidth:U().bool.isRequired,locale:U().string.isRequired,channelProfiles:U().array.isRequired,enableUserCreation:U().bool,isReadOnly:U().bool,isFavorite:U().bool.isRequired,teamIsGroupConstrained:U().bool,creatorName:U().string.isRequired,teammateName:U().string,stats:U().any.isRequired,usersLimit:U().number.isRequired,isMobileView:U().bool.isRequired,actions:U().shape({getTotalUsersStats:U().func.isRequired,favoriteChannel:U().func.isRequired,unfavoriteChannel:U().func.isRequired}).isRequired});const ot=(0,ce.defineMessages)({muted:{id:"intro_messages.GM.muted",defaultMessage:"This group message is currently <b>muted</b>, so you will not be notified."},[Ne.S.ALL]:{id:"intro_messages.GM.all",defaultMessage:"You'll be notified <b>for all activity</b> in this group message."},[Ne.S.DEFAULT]:{id:"intro_messages.GM.all",defaultMessage:"You'll be notified <b>for all activity</b> in this group message."},[Ne.S.MENTION]:{id:"intro_messages.GM.mention",defaultMessage:"You have selected to be notified <b>only when mentioned</b> in this group message."},[Ne.S.NONE]:{id:"intro_messages.GM.none",defaultMessage:"You have selected to <b>never</b> be notified in this group message."}}),lt=(e,t)=>{var a,n;if((0,Re.X4)(t))return L().createElement(ce.FormattedMessage,Object.assign({},ot.muted,{values:{b:e=>L().createElement("b",null,e)}}));const s=(null==t||null===(a=t.notify_props)||void 0===a?void 0:a.desktop)||Ne.S.DEFAULT,r=(null==e||null===(n=e.notify_props)||void 0===n?void 0:n.desktop)||Ne.S.MENTION;let i=s;return i===Ne.S.DEFAULT&&(i=r),s===Ne.S.DEFAULT&&r===Ne.S.MENTION&&(i=Ne.S.ALL),L().createElement(ce.FormattedMessage,Object.assign({},ot[i],{values:{b:e=>L().createElement("b",null,e)}}))};function ct(e){return 0!==e.delete_at?null:L().createElement(Ve.A,{modalId:Y.IQ.EDIT_CHANNEL_HEADER,ariaLabel:$.Vw({id:"intro_messages.setHeader",defaultMessage:"Set header"}),className:"action-button",dialogType:Ue.A,dialogProps:{channel:e}},L().createElement(Ae.PencilOutlineIcon,{size:24}),L().createElement(ce.FormattedMessage,{id:"intro_messages.setHeader",defaultMessage:"Set header"}))}function dt(e,t,a){let n;return n=e?L().createElement(ce.FormattedMessage,{id:"channel_info_rhs.top_buttons.favorited",defaultMessage:"Favorited"}):L().createElement(ce.FormattedMessage,{id:"channel_info_rhs.top_buttons.favorite",defaultMessage:"Favorite"}),L().createElement("button",{id:"toggleFavoriteIntroButton",className:"action-button ".concat(e?"active":""," ").concat(a),onClick:t,"aria-label":"Favorite"},e?L().createElement(Ae.StarIcon,{size:24}):L().createElement(Ae.StarOutlineIcon,{size:24}),n)}function ut(e,t){return L().createElement(Ve.A,{id:"channelIntroNotificationPreferencesButton",modalId:Y.IQ.CHANNEL_NOTIFICATIONS,ariaLabel:$.Vw({id:"intro_messages.notificationPreferences",defaultMessage:"Notification Preferences"}),className:"action-button",dialogType:Le.A,dialogProps:{channel:e,currentUser:t,focusOriginElement:"channelIntroNotificationPreferencesButton"}},L().createElement(Ae.BellRingOutlineIcon,{size:24}),L().createElement(ce.FormattedMessage,{id:"intro_messages.notificationPreferences",defaultMessage:"Notifications"}))}const mt=(0,n.connect)((function(e){const t="true"===(0,i.zj)(e).EnableUserCreation,a=(0,o.H7)(e),n=(0,r.Lw)(e),s=(0,r.tW)(e),c=n?(0,r.yH)(e,n.id):void 0,d=(0,l.HW)(e),u=n?(0,l.wz)(e,n.creator_id):void 0,m=(0,l.ig)(e)||{total_users_count:0};return{currentUserId:(0,l.WR)(e),channel:n,fullWidth:(0,b.Jt)(e,Y.pm.CATEGORY_DISPLAY_SETTINGS,Y.pm.CHANNEL_DISPLAY_MODE,Y.pm.CHANNEL_DISPLAY_MODE_DEFAULT)===Y.pm.CHANNEL_DISPLAY_MODE_FULL_SCREEN,locale:(0,Ie.k)(e),channelProfiles:(0,l.Gv)(e),enableUserCreation:t,isReadOnly:!1,isFavorite:(0,r.TJ)(e),teamIsGroupConstrained:Boolean(null==a?void 0:a.group_constrained),creatorName:(0,$.GZ)(e,u),teammate:c,teammateName:(0,$.GZ)(e,c),currentUser:d,stats:m,usersLimit:10,channelMember:s,isMobileView:(0,V.w3)(e)}}),(function(e){return{actions:(0,G.zH)({getTotalUsersStats:z.ig,favoriteChannel:s.yc,unfavoriteChannel:s.XJ},e)}}))(it);var ht,pt,gt,ft=a(42599),bt=a(50800),Et=a(76261);class Ct extends L().PureComponent{blockShortcutReactToLastPostForNonMessages(e){const{actions:{emitShortcutReactToLastPostFrom:t}}=this.props;(0,be.Bn)(e)&&t(Y.Hc.NO_WHERE)}componentDidUpdate(e){const{listId:t,isLastPost:a,shortcutReactToLastPostEmittedFrom:n}=this.props,s=e.shortcutReactToLastPostEmittedFrom!==n&&n===Y.Hc.CENTER;a&&s&&this.blockShortcutReactToLastPostForNonMessages(t)}render(){const{listId:e,previousListId:t,loadingOlderPosts:a,loadingNewerPosts:n}=this.props,{OLDER_MESSAGES_LOADER:s,NEWER_MESSAGES_LOADER:r,CHANNEL_INTRO_MESSAGE:i,LOAD_OLDER_MESSAGES_TRIGGER:o,LOAD_NEWER_MESSAGES_TRIGGER:l}=Y.D3;if(fe.fE(e)){const t=fe.GG(e);return L().createElement(bt.A,{key:t,date:t})}if(fe.OO(e))return L().createElement(Et.A,{separatorId:e,newMessagesSeparatorActions:this.props.newMessagesSeparatorActions,channelId:this.props.channelId});if(this.props.exceededLimitChannelId)return L().createElement(Se.A,null);if(e===i)return L().createElement(mt,null);if(e===o||e===l)return L().createElement("button",{className:"more-messages-text theme style--none color--link",onClick:e===o?this.props.loadOlderPosts:this.props.loadNewerPosts},L().createElement(ce.FormattedMessage,{id:"posts_view.loadMore",defaultMessage:"Load More Messages"}));if(e===s||e===r){const e=!a&&!n;return L().createElement("div",{className:"loading-screen"},L().createElement("div",{className:q()("loading__content",{hideAnimation:e})},L().createElement("div",{className:"round round-1"}),L().createElement("div",{className:"round round-2"}),L().createElement("div",{className:"round round-3"})))}const c={previousPostId:t,shouldHighlight:Boolean(this.props.shouldHighlight),togglePostMenu:this.props.togglePostMenu,isLastPost:this.props.isLastPost};return fe.mD(e)?L().createElement(ft.A,Object.assign({location:Y.Hc.CENTER,combinedId:e},c)):L().createElement(we.A,Object.assign({post:this.props.post,location:Y.Hc.CENTER},c))}}ht=Ct,pt="propTypes",gt={listId:U().string.isRequired,previousListId:U().string,fullWidth:U().bool,shouldHighlight:U().bool,loadOlderPosts:U().func.isRequired,loadNewerPosts:U().func.isRequired,togglePostMenu:U().func.isRequired,isLastPost:U().bool.isRequired,shortcutReactToLastPostEmittedFrom:U().string.isRequired,loadingNewerPosts:U().bool.isRequired,loadingOlderPosts:U().bool.isRequired,exceededLimitChannelId:U().string,firstInaccessiblePostTime:U().number,channelId:U().string.isRequired,newMessagesSeparatorActions:U().array.isRequired,actions:U().shape({emitShortcutReactToLastPostFrom:U().any.isRequired}).isRequired},(pt=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(pt))in ht?Object.defineProperty(ht,pt,{value:gt,enumerable:!0,configurable:!0,writable:!0}):ht[pt]=gt;const vt=(0,n.connect)((function(e,t){const a={shortcutReactToLastPostEmittedFrom:(0,Te.l6)(e),post:(0,pe.f5)(e,t.listId),currentUserId:(0,f.WR)(e),newMessagesSeparatorActions:e.plugins.components.NewMessagesSeparatorAction};if(t.listId===Y.D3.OLDER_MESSAGES_LOADER||t.listId===Y.D3.CHANNEL_INTRO_MESSAGE){const t=(0,f.eH)(e),n=(0,pe.VT)(e).channels[t];(Boolean(n)||0===n)&&(a.exceededLimitChannelId=t,a.firstInaccessiblePostTime=n)}return a}),(function(e){return{actions:(0,G.zH)({emitShortcutReactToLastPostFrom:_e.Sq},e)}}))(Ct);function yt(e){const{formatMessage:t}=(0,ce.useIntl)();return L().createElement("span",e,L().createElement("svg",{x:"0px",y:"0px",viewBox:"-239 239 21 23",enableBackground:"new -239 239 21 23",role:"img","aria-label":t({id:"generic_icons.arrow.down",defaultMessage:"Down Arrow Icon"})},L().createElement("path",{d:"M-239,241.4l2.4-2.4l8.1,8.2l8.1-8.2l2.4,2.4l-10.5,10.6L-239,241.4z M-228.5,257.2l8.1-8.2l2.4,2.4l-10.5,10.6l-10.5-10.6 l2.4-2.4L-228.5,257.2z"})))}const Mt=e=>{let{isScrolling:t,atBottom:a,onClick:n}=e;return window.innerWidth>768?null:L().createElement("div",{className:q()("post-list__arrows",{scrolling:t&&!1===a}),onClick:n},L().createElement(yt,null))};Mt.propTypes={isScrolling:U().bool.isRequired,atBottom:U().bool,onClick:U().func.isRequired};const _t=Mt;a(76409);var Tt=a(8361),St=a(99044);const wt=e=>{let{children:t,onDismiss:a}=e;return L().createElement("div",{"data-testid":"hint-toast",className:"hint-toast"},L().createElement("div",{className:"hint-toast__message"},t),L().createElement("div",{className:"hint-toast__dismiss",onClick:()=>{"function"==typeof a&&a()},"data-testid":"dismissHintToast"},L().createElement(St.A,{className:"close-btn",id:"dismissHintToast"})))};wt.propTypes={children:U().node.isRequired,onDismiss:U().func.isRequired};var It=a(87383);const At=e=>{let{onDismiss:t,onClick:a}=e;const{formatMessage:n}=(0,ce.useIntl)(),s=n({id:"postlist.toast.scrollToBottom",defaultMessage:"Jump to recents"});return L().createElement("div",{"data-testid":"scroll-to-bottom-toast",className:"scroll-to-bottom-toast btn btn-primary",onClick:e=>{e.preventDefault(),a()}},L().createElement(It.A,null),s,L().createElement("div",{className:"scroll-to-bottom-toast__dismiss",onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"data-testid":"scroll-to-bottom-toast--dismiss-button"},L().createElement(St.A,{className:"close-btn",id:"dismissScrollToBottomToast"})))};At.propTypes={onDismiss:U().func.isRequired,onClick:U().func.isRequired};const Nt=At;var Rt=a(83642),Pt=a(77828),Lt=a(89227),Ot=a(83007),Dt=a(36397),kt=a(19513);function Ft(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const xt=[Pt.hp.t8];class Ht extends L().PureComponent{constructor(e){var t;super(e),t=this,Ft(this,"handleShortcut",(e=>{(0,kt.e)(e,Y.Ay.KeyCodes.ESCAPE)&&(this.state.showUnreadToast?this.hideUnreadToast():this.state.showNewMessagesToast?this.hideNewMessagesToast():this.state.showUnreadWithBottomStartToast?this.hideUnreadWithBottomStartToast():this.hideArchiveToast())})),Ft(this,"hideUnreadToast",(()=>{this.state.showUnreadToast&&this.setState({showUnreadToast:!1})})),Ft(this,"hideArchiveToast",(()=>{this.state.showMessageHistoryToast&&this.setState({showMessageHistoryToast:!1})})),Ft(this,"hideNewMessagesToast",(function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t.state.showNewMessagesToast&&(t.setState({showNewMessagesToast:!1}),e&&t.props.updateLastViewedBottomAt())})),Ft(this,"hideSearchHintToast",(()=>{this.props.onSearchHintDismiss&&this.props.onSearchHintDismiss()})),Ft(this,"hideUnreadWithBottomStartToast",(()=>{this.state.showUnreadWithBottomStartToast&&this.setState({showUnreadWithBottomStartToast:!1})})),Ft(this,"newMessagesToastText",((e,t)=>this.props.width>500&&void 0!==t?L().createElement(ce.FormattedMessage,{id:"postlist.toast.newMessagesSince",defaultMessage:"{count, number} new {count, plural, one {message} other {messages}} {isToday, select, true {} other {since}} {date}",values:{count:e,isToday:(0,Dt.cK)(new Date(t)).toString(),date:L().createElement(Pt.Ay,{value:t,useTime:!1,ranges:xt})}}):L().createElement(ce.FormattedMessage,{id:"postlist.toast.newMessages",defaultMessage:"{count, number} new {count, plural, one {message} other {messages}}",values:{count:e}}))),Ft(this,"archiveToastText",(()=>L().createElement(ce.FormattedMessage,{id:"postlist.toast.history",defaultMessage:"Viewing message history"}))),Ft(this,"getSearchHintToastText",(()=>L().createElement(ce.FormattedMessage,{id:"postlist.toast.searchHint",defaultMessage:"Tip: Try {searchShortcut} to search this channel",values:{searchShortcut:L().createElement(Rt.t,null)}}))),Ft(this,"changeUrlToRemountChannelView",(()=>{const{match:e}=this.props;(0,Ot.J)().replace("/".concat(e.params.team))})),Ft(this,"scrollToNewMessage",(()=>{const{focusedPostId:e,atLatestPost:t,scrollToNewMessage:a,updateLastViewedBottomAt:n}=this.props;!e||t?(a(),n(),this.hideNewMessagesToast()):this.changeUrlToRemountChannelView()})),Ft(this,"scrollToLatestMessages",(()=>{var e,t;const{focusedPostId:a,atLatestPost:n,scrollToLatestMessages:s}=this.props;if(a){if(!n)return void this.changeUrlToRemountChannelView();this.hideArchiveToast()}s(),this.hideUnreadToast(),null===(e=(t=this.props).hideScrollToBottomToast)||void 0===e||e.call(t)})),Ft(this,"scrollToUnreadMessages",(()=>{this.props.scrollToUnreadMessages(),this.hideUnreadWithBottomStartToast()})),this.state={unreadCountInChannel:e.unreadCountInChannel,unreadCount:0}}static getDerivedStateFromProps(e,t){let a,{showUnreadToast:n,showNewMessagesToast:s,showMessageHistoryToast:r,showUnreadWithBottomStartToast:i}=t;return a=e.atLatestPost?e.unreadScrollPosition===he.pm.UNREAD_SCROLL_POSITION_START_FROM_NEWEST&&t.unreadCountInChannel?t.unreadCountInChannel+e.newRecentMessagesCount:Ht.countNewMessages(e.rootPosts,e.isCollapsedThreadsEnabled,e.postListIds):e.channelMarkedAsUnread?e.unreadScrollPosition===he.pm.UNREAD_SCROLL_POSITION_START_FROM_NEWEST?e.unreadCountInChannel+e.newRecentMessagesCount:t.unreadCountInChannel:t.unreadCountInChannel+e.newRecentMessagesCount,void 0===n&&null!==e.atBottom&&(n=a>0&&!e.atBottom),void 0===r&&""!==e.focusedPostId&&null!==e.atBottom&&(r=e.initScrollOffsetFromBottom>1e3||!e.atLatestPost),!e.channelMarkedAsUnread||!1!==e.atBottom||t.channelMarkedAsUnread||t.showUnreadToast||(n=!0),e.channelMarkedAsUnread&&e.lastViewedAt!==t.lastViewedAt&&!1===e.atBottom&&(n=!0),!n&&a>0&&!1===e.atBottom&&e.latestPostTimeStamp&&e.lastViewedBottom<e.latestPostTimeStamp&&(s=!0),e.unreadScrollPosition!==he.pm.UNREAD_SCROLL_POSITION_START_FROM_NEWEST||e.channelMarkedAsUnread||(n=!1),a||(n=!1,s=!1),e.isNewMessageLineReached&&(i=!1),void 0===i&&e.lastViewedAt&&e.lastViewedAt!==t.lastViewedAt&&e.shouldStartFromBottomWhenUnread&&a>0&&!e.isNewMessageLineReached&&(i=!0),{unreadCount:a,showUnreadToast:n,showNewMessagesToast:s,showUnreadWithBottomStartToast:i,lastViewedAt:e.lastViewedAt,atBottom:e.atBottom,channelMarkedAsUnread:e.channelMarkedAsUnread,showMessageHistoryToast:r}}componentDidMount(){this.mounted=!0;const{showUnreadToast:e,showNewMessagesToast:t,showMessageHistoryToast:a,showUnreadWithBottomStartToast:n}=this.state,s=Boolean(e||t||a||n);document.addEventListener("keydown",this.handleShortcut),this.props.actions.updateToastStatus(s)}componentDidUpdate(e,t){const{showUnreadToast:a,showNewMessagesToast:n,showMessageHistoryToast:s,showUnreadWithBottomStartToast:r}=this.state,{atBottom:i,atLatestPost:o,postListIds:l,lastViewedBottom:c,updateNewMessagesAtInChannel:d,actions:u}=this.props;!e.atBottom&&i&&o&&(this.hideNewMessagesToast(!1),this.hideUnreadToast(),this.hideArchiveToast());const m=e.postListIds.length,h=l.length;if(h!==m&&l[0]!==e.postListIds[0]&&!1===i&&o&&h>0&&!a&&d(c),t.showUnreadToast!==a||t.showNewMessagesToast!==n||t.showMessageHistoryToast!==s||t.showUnreadWithBottomStartToast!==r){const e=Boolean(a||n||s||r);u.updateToastStatus(e)}}componentWillUnmount(){document.removeEventListener("keydown",this.handleShortcut)}getToastToRender(){const{atLatestPost:e,atBottom:t,width:a,lastViewedAt:n,showSearchHintToast:s,showScrollToBottomToast:r}=this.props,{showUnreadToast:i,showNewMessagesToast:o,showMessageHistoryToast:l,showUnreadWithBottomStartToast:c,unreadCount:d}=this.state,u={show:!0,width:a,onDismiss:this.hideUnreadToast,onClick:this.scrollToLatestMessages,onClickMessage:L().createElement(ce.FormattedMessage,{id:"postlist.toast.scrollToBottom",defaultMessage:"Jump to recents"}),showActions:!e||e&&!1===t};if(i&&d>0)return L().createElement(Lt.A,u,this.newMessagesToastText(d,n));const m={show:!0,width:a,onDismiss:this.hideUnreadWithBottomStartToast,onClick:this.scrollToUnreadMessages,onClickMessage:L().createElement(ce.FormattedMessage,{id:"postlist.toast.scrollToUnread",defaultMessage:"Jump to unreads"}),showActions:!0,jumpDirection:"up"};if(c&&d>0)return L().createElement(Lt.A,m,this.newMessagesToastText(d,n));if(o){const e={onDismiss:this.hideNewMessagesToast,onClick:this.scrollToNewMessage,onClickMessage:L().createElement(ce.FormattedMessage,{id:"postlist.toast.scrollToLatest",defaultMessage:"Jump to new messages"})};return L().createElement(Lt.A,Object.assign({},u,e),this.newMessagesToastText(d,n))}if(l){const e={show:!0,width:a,onDismiss:this.hideArchiveToast,onClick:this.scrollToLatestMessages,onClickMessage:L().createElement(ce.FormattedMessage,{id:"postlist.toast.scrollToBottom",defaultMessage:"Jump to recents"}),showActions:!0,extraClasses:"toast__history"};return L().createElement(Lt.A,e,this.archiveToastText())}const h=[];return r&&h.push(L().createElement(Nt,{key:"scroll-to-bottom-toast",onClick:this.scrollToLatestMessages,onDismiss:this.props.onScrollToBottomToastDismiss})),s&&h.push(L().createElement(wt,{key:"search-hint-toast",onDismiss:this.hideSearchHintToast},this.getSearchHintToastText())),h.length>0?L().createElement("div",{className:"toasts-wrapper"},h):null}render(){const e=this.getToastToRender();return L().createElement(L().Fragment,null,e)}}Ft(Ht,"propTypes",{channelMarkedAsUnread:U().bool,postListIds:U().arrayOf(U().string).isRequired,latestPostTimeStamp:U().number,atBottom:U().oneOfType([U().bool,U().oneOf([null])]),lastViewedBottom:U().number.isRequired,width:U().number.isRequired,focusedPostId:U().string,initScrollOffsetFromBottom:U().number.isRequired,updateNewMessagesAtInChannel:U().func.isRequired,scrollToNewMessage:U().func.isRequired,scrollToLatestMessages:U().func.isRequired,scrollToUnreadMessages:U().func.isRequired,updateLastViewedBottomAt:U().func.isRequired,showSearchHintToast:U().bool.isRequired,onSearchHintDismiss:U().func.isRequired,showScrollToBottomToast:U().bool.isRequired,onScrollToBottomToastDismiss:U().func.isRequired,hideScrollToBottomToast:U().func.isRequired,shouldStartFromBottomWhenUnread:U().bool.isRequired,isNewMessageLineReached:U().bool.isRequired,rootPosts:U().objectOf(U().bool).isRequired,lastViewedAt:U().number.isRequired,newRecentMessagesCount:U().number.isRequired,unreadScrollPosition:U().string.isRequired,isCollapsedThreadsEnabled:U().bool.isRequired}),Ft(Ht,"defaultProps",{focusedPostId:""}),Ft(Ht,"countNewMessages",(function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const n=(0,fe.V)(a);if(n<=0)return 0;let s=a.slice(0,n).filter((e=>!(0,be.Bn)(e)));return t&&(s=s.filter((t=>e[t]))),s.length}));const Ut=(0,ce.injectIntl)(Ht),Bt=(0,O.withRouter)((0,n.connect)((function(){const e=(0,Tt.Mz)("makeCountUnreadsBelow",pe.zX,l.WR,((e,t)=>t),((e,t,a)=>a),b.WW,((e,t,a,n,s)=>a?a.map((t=>e[t])).filter((e=>e&&e.user_id!==t&&e.state!==he.AF.POST_DELETED&&e.create_at>n&&(!s||""===e.root_id))).length:0)),t=(0,Tt.Mz)("makeGetRootPosts",pe.zX,l.WR,r.Lw,((e,t,a)=>Object.values(e).filter((e=>""===e.root_id&&e.channel_id===(null==a?void 0:a.id)&&e.state!==he.AF.POST_DELETED)).reduce(((e,t)=>(e[t.id]=!0,e)),{}))),a=(0,fe.fG)();return function(n,s){let i=0;const o=(0,r.PW)(n,s.channelId),l=n.views.channel.lastChannelViewTime[s.channelId],c=(0,b.z0)(n);if(!s.atLatestPost){let t=(0,pe.Lf)(n,s.channelId)||[];t&&(t=a(n,{postIds:t,lastViewedAt:l})),i=e(n,t,l)}return{rootPosts:t(n),lastViewedAt:l,newRecentMessagesCount:i,unreadScrollPosition:c,isCollapsedThreadsEnabled:(0,b.WW)(n),unreadCountInChannel:(0,r.zk)(n),channelMarkedAsUnread:o}}}),(function(e){return{actions:(0,G.zH)({updateToastStatus:c.p4},e)}}))(Ut));var qt=a(694),jt=a(89092);const Vt=e=>{const{postIds:t}=e,a=(0,P.useMemo)((()=>(0,be.h7)(t||[])),[t]),s=(0,n.useSelector)((e=>(0,pe.f5)(e,a))),r=(0,be.VD)(s);return L().createElement("span",{className:"sr-only","aria-live":"polite"},r)};Vt.propTypes={postIds:U().arrayOf(U().string)};const Gt=Vt;function zt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Wt(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(a),!0).forEach((function(t){Kt(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):zt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function Kt(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const Yt={padding:"14px 0px 7px"},Jt={position:"absolute",bottom:"0",maxHeight:"100%"};class Qt extends L().PureComponent{constructor(e){var t;super(e),t=this,Kt(this,"scrollStopAction",null),Kt(this,"handleWindowResize",(()=>{this.showSearchHintThreshold=this.getShowSearchHintThreshold()})),Kt(this,"togglePostMenu",(e=>{let t=this.state.dynamicListStyle;this.props.isMobileView&&(t=Wt(Wt({},t),{},{willChange:e?"unset":"transform"})),this.setState({postMenuOpened:e,dynamicListStyle:t})})),Kt(this,"onNewMessageLineReached",(()=>{this.setState({isNewMessageLineReached:!0})})),Kt(this,"renderRow",(e=>{let{data:t,itemId:a,style:n}=e;const s=t.indexOf(a);let r="";const i="post-row__padding",o=-1!==s&&s<t.length-1?t[s+1]:"",l=s>0&&s<t.length?t[s-1]:"";((0,fe.fE)(l)||(0,fe.OO)(l))&&(r+=i+" bottom"),((0,fe.fE)(o)||(0,fe.OO)(o))&&(r.includes(i)?r+=" top":r+=i+" top");const c=a===this.state.postListIds[0];return L().createElement("div",{style:n,className:r},L().createElement(vt,{listId:a,previousListId:(0,be.fn)(t,s),shouldHighlight:a===this.props.focusedPostId,loadOlderPosts:this.props.actions.loadOlderPosts,loadNewerPosts:this.props.actions.loadNewerPosts,togglePostMenu:this.togglePostMenu,isLastPost:c,loadingNewerPosts:this.props.loadingNewerPosts,loadingOlderPosts:this.props.loadingOlderPosts,channelId:this.props.channelId}))})),Kt(this,"scrollToFailed",(e=>{0===e?this.props.actions.changeUnreadChunkTimeStamp(0):this.props.actions.changeUnreadChunkTimeStamp(this.props.lastViewedAt)})),Kt(this,"onScroll",(e=>{let{scrollDirection:t,scrollOffset:a,scrollUpdateWasRequested:n,clientHeight:s,scrollHeight:r}=e;if(r<=0)return;const i="backward"===t&&!n,o="forward"===t&&!n,l=a<1e3,c=this.getOffsetFromBottom(a,r,s),d=c<1e3;if(i&&l&&!this.props.atOldestPost?this.props.actions.loadOlderPosts():o&&d&&!this.props.atLatestPost&&this.props.actions.loadNewerPosts(),this.props.isMobileView&&(this.state.isScrolling||this.setState({isScrolling:!0}),this.scrollStopAction&&this.scrollStopAction.fireAfter(Y.Ay.SCROLL_DELAY)),this.checkBottom(a,r,s),n){var u;const e=null===(u=this.listRef.current)||void 0===u?void 0:u._getRangeToRender();e&&e[3]<=1&&!this.props.atLatestPost&&this.props.actions.canLoadMorePosts(Y.DL.AFTER_ID),!this.state.atBottom&&r&&this.setState({initScrollOffsetFromBottom:c})}this.props.isMobileView&&this.state.showSearchHint&&this.setState({showSearchHint:!1}),this.props.isMobileView||this.state.isSearchHintDismissed||this.setState({showSearchHint:c>this.showSearchHintThreshold}),this.updateScrollToBottomToastVisibility(a,r,s)})),Kt(this,"getShowSearchHintThreshold",(()=>3*window.screen.height)),Kt(this,"checkBottom",((e,t,a)=>{this.updateAtBottom(this.isAtBottom(e,t,a))})),Kt(this,"getOffsetFromBottom",((e,t,a)=>t-a-e)),Kt(this,"isAtBottom",((e,t,a)=>this.getOffsetFromBottom(e,t,a)<=10&&t>0)),Kt(this,"updateAtBottom",(e=>{if(e!==this.state.atBottom){let t=Date.now();this.props.latestPostTimeStamp&&this.props.latestPostTimeStamp>t&&(t=this.props.latestPostTimeStamp),this.setState({atBottom:e,lastViewedBottom:t})}})),Kt(this,"updateLastViewedBottomAt",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();t.setState({lastViewedBottom:e})})),Kt(this,"handleScrollStop",(()=>{this.mounted&&this.setState({isScrolling:!1})})),Kt(this,"handleSearchHintDismiss",(()=>{this.setState({showSearchHint:!1,isSearchHintDismissed:!0})})),Kt(this,"handleScrollToBottomToastDismiss",(()=>{this.setState({showScrollToBottomToast:!1,isScrollToBottomDismissed:!0})})),Kt(this,"hideScrollToBottomToast",(()=>{this.setState({showScrollToBottomToast:!1})})),Kt(this,"updateScrollToBottomToastVisibility",((e,t,a)=>{if(this.state.showScrollToBottomToast&&this.state.atBottom)this.setState({showScrollToBottomToast:!1});else if(!this.state.isScrollToBottomDismissed){const n=this.getOffsetFromBottom(e,t,a);this.setState({showScrollToBottomToast:n>this.showSearchHintThreshold})}})),Kt(this,"updateFloatingTimestamp",(e=>{this.props.isMobileView&&this.props.postListIds&&this.setState({topPostId:(0,be.h7)(this.props.postListIds.slice(e))})})),Kt(this,"onItemsRendered",(e=>{let{visibleStartIndex:t,visibleStopIndex:a}=e;this.updateFloatingTimestamp(t),this.newMessageLineIndex>0&&!this.state.isNewMessageLineReached&&this.newMessageLineIndex<=t&&this.newMessageLineIndex>=a&&this.onNewMessageLineReached()})),Kt(this,"initScrollToIndex",(()=>{if(this.props.focusedPostId)return{index:this.state.postListIds.findIndex((e=>e===this.props.focusedPostId)),position:"center"};if(this.props.shouldStartFromBottomWhenUnread)return{index:0,position:"end"};const e=(0,fe.V)(this.state.postListIds);return e>0?(0,fe.fE)(this.state.postListIds[e+1])?{index:e+1,position:"start",offset:-50}:{index:e,position:"start",offset:-50}:{index:0,position:"end"}})),Kt(this,"scrollToLatestMessages",(()=>{this.props.atLatestPost?this.scrollToBottom():(this.updateNewMessagesAtInChannel(),this.props.actions.changeUnreadChunkTimeStamp(0))})),Kt(this,"scrollToUnreadMessages",(()=>{this.props.actions.toggleShouldStartFromBottomWhenUnread()})),Kt(this,"scrollToBottom",(()=>{var e;null===(e=this.listRef.current)||void 0===e||e.scrollToItem(0,"end")})),Kt(this,"scrollToNewMessage",(()=>{var e;null===(e=this.listRef.current)||void 0===e||e.scrollToItem((0,fe.V)(this.state.postListIds),"start",-50)})),Kt(this,"updateNewMessagesAtInChannel",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();t.props.actions.updateNewMessagesAtInChannel(t.props.channelId,e)})),Kt(this,"renderToasts",(e=>L().createElement(Bt,{atLatestPost:this.props.atLatestPost,postListIds:this.state.postListIds,atBottom:this.state.atBottom,width:e,lastViewedBottom:this.state.lastViewedBottom,latestPostTimeStamp:this.props.latestPostTimeStamp,scrollToUnreadMessages:this.scrollToUnreadMessages,scrollToNewMessage:this.scrollToNewMessage,scrollToLatestMessages:this.scrollToLatestMessages,updateNewMessagesAtInChannel:this.updateNewMessagesAtInChannel,updateLastViewedBottomAt:this.updateLastViewedBottomAt,shouldStartFromBottomWhenUnread:this.props.shouldStartFromBottomWhenUnread,isNewMessageLineReached:this.state.isNewMessageLineReached,channelId:this.props.channelId,focusedPostId:this.props.focusedPostId,initScrollOffsetFromBottom:this.state.initScrollOffsetFromBottom,onSearchHintDismiss:this.handleSearchHintDismiss,showSearchHintToast:this.state.showSearchHint,showScrollToBottomToast:this.state.showScrollToBottomToast,onScrollToBottomToastDismiss:this.handleScrollToBottomToastDismiss,hideScrollToBottomToast:this.hideScrollToBottomToast})));const a=Y.D3.CHANNEL_INTRO_MESSAGE;this.mounted=!0,this.state={isScrolling:!1,atBottom:null,lastViewedBottom:Date.now(),postListIds:[a],topPostId:"",postMenuOpened:!1,dynamicListStyle:{willChange:"transform"},initScrollCompleted:!1,initScrollOffsetFromBottom:0,showSearchHint:!1,isSearchHintDismissed:!1,isNewMessageLineReached:!1,showScrollToBottomToast:!1,isScrollToBottomDismissed:!1},this.listRef=L().createRef(),this.postListRef=L().createRef(),this.props.isMobileView&&(this.scrollStopAction=new jt.A(this.handleScrollStop)),this.initRangeToRender=this.props.focusedPostId?[0,100]:[0,50];let n=0;n=e.focusedPostId?(this.props.postListIds||[]).findIndex((e=>e===this.props.focusedPostId)):(0,fe.V)(e.postListIds||[]),this.newMessageLineIndex=(0,fe.V)(e.postListIds||[]);const s=e.focusedPostId?100:50;this.initRangeToRender=[Math.max(n-30,0),Math.max(n+30,Math.min((e.postListIds||[]).length-1,s))],this.showSearchHintThreshold=this.getShowSearchHintThreshold()}componentDidMount(){this.mounted=!0,window.addEventListener("resize",this.handleWindowResize),ve.A.addListener(Y.wf.POST_LIST_SCROLL_TO_BOTTOM,this.scrollToLatestMessages)}getSnapshotBeforeUpdate(e){if(this.postListRef&&this.postListRef.current){const a=this.props.postListIds&&this.props.postListIds.length!==(e.postListIds||[]).length&&this.props.postListIds[0]===(e.postListIds||[])[0],n=this.props.atOldestPost!==e.atOldestPost;if((a||n)&&!1===this.state.atBottom){var t;const e=this.postListRef.current;return{previousScrollTop:null===(t=e.parentElement)||void 0===t?void 0:t.scrollTop,previousScrollHeight:e.scrollHeight}}}return null}componentDidUpdate(e,t,a){if(this.props.isMobileView&&!e.isMobileView&&(this.scrollStopAction=new jt.A(this.handleScrollStop)),!this.postListRef.current)return;const n=(e.postListIds||[]).length,s=(this.props.postListIds||[]).length;if(this.newMessageLineIndex=(0,fe.V)(this.props.postListIds||[]),a){const t=this.postListRef.current.scrollHeight,i=s!==n&&(this.props.postListIds||[])[0]===(e.postListIds||[])[0],o=this.props.atOldestPost!==e.atOldestPost;if((i||o)&&!this.state.atBottom&&a){const e=a.previousScrollTop+(t-a.previousScrollHeight);var r;0!==e&&e-a.previousScrollTop!=0&&(null===(r=this.listRef.current)||void 0===r||r.scrollTo(e,e-a.previousScrollTop,!0))}}}componentWillUnmount(){this.mounted=!1,window.removeEventListener("resize",this.handleWindowResize),ve.A.removeListener(Y.wf.POST_LIST_SCROLL_TO_BOTTOM,this.scrollToLatestMessages)}static getDerivedStateFromProps(e,t){const a=e.postListIds||[];let n;n=e.atOldestPost?[...a,Y.D3.CHANNEL_INTRO_MESSAGE]:e.autoRetryEnable?[...a,Y.D3.OLDER_MESSAGES_LOADER]:[...a,Y.D3.LOAD_OLDER_MESSAGES_TRIGGER],e.atLatestPost||(n=e.autoRetryEnable?[Y.D3.NEWER_MESSAGES_LOADER,...n]:[Y.D3.LOAD_NEWER_MESSAGES_TRIGGER,...n]);const s={postListIds:n};if(e.isMobileView!==t.isMobileView){s.isMobileView=e.isMobileView;const a=t.dynamicListStyle;t.postMenuOpened&&(e.isMobileView||"unset"!==a.willChange?e.isMobileView&&"transform"===a.willChange&&(s.dynamicListStyle=Wt(Wt({},a),{},{willChange:"unset"})):s.dynamicListStyle=Wt(Wt({},a),{},{willChange:"transform"}))}return s}render(){const{channelId:e}=this.props,{dynamicListStyle:t}=this.state;return L().createElement("div",{className:"a11y__region","data-a11y-sort-order":"1","data-a11y-focus-child":!0,"data-a11y-order-reversed":!0,"data-a11y-loop-navigation":!1,"aria-label":$.Vw({id:"accessibility.sections.centerContent",defaultMessage:"message list main region"})},this.props.isMobileView&&L().createElement(L().Fragment,null,L().createElement(Me.A,{isScrolling:this.state.isScrolling,postId:this.state.topPostId}),L().createElement(_t,{isScrolling:this.state.isScrolling,atBottom:Boolean(this.state.atBottom),onClick:this.scrollToBottom})),L().createElement("div",{className:"post-list-holder-by-time",key:"postlist-"+e},L().createElement("div",{className:"post-list__table"},L().createElement("div",{id:"postListContent",className:"post-list__content"},L().createElement(Gt,{postIds:this.props.postListIds}),L().createElement(Ce.Ay,null,(e=>{let{height:a,width:n}=e;return L().createElement(L().Fragment,null,L().createElement("div",null,L().createElement(qt.default,{pluggableName:"ChannelToast"}),this.renderToasts(n)),L().createElement(ye.D,{ref:this.listRef,id:"postListScrollContainer",className:"post-list__dynamic",height:a,width:n,itemData:this.state.postListIds,overscanCountForward:80,overscanCountBackward:80,onScroll:this.onScroll,initScrollToIndex:this.initScrollToIndex,canLoadMorePosts:this.props.actions.canLoadMorePosts,innerRef:this.postListRef,style:Wt(Wt({},Jt),t),innerListStyle:Yt,initRangeToRender:this.initRangeToRender,loaderId:Y.D3.OLDER_MESSAGES_LOADER,correctScrollToBottom:this.props.atLatestPost,onItemsRendered:this.onItemsRendered,scrollToFailed:this.scrollToFailed},this.renderRow))}))))))}}Kt(Qt,"propTypes",{postListIds:U().arrayOf(U().string),channelId:U().string.isRequired,autoRetryEnable:U().bool.isRequired,loadingNewerPosts:U().bool.isRequired,loadingOlderPosts:U().bool.isRequired,isMobileView:U().bool.isRequired,atOldestPost:U().bool,atLatestPost:U().bool,latestPostTimeStamp:U().number,lastViewedAt:U().number.isRequired,focusedPostId:U().string,shouldStartFromBottomWhenUnread:U().bool.isRequired,actions:U().shape({loadOlderPosts:U().func.isRequired,loadNewerPosts:U().func.isRequired,canLoadMorePosts:U().func.isRequired,changeUnreadChunkTimeStamp:U().func.isRequired,updateNewMessagesAtInChannel:U().any.isRequired,toggleShouldStartFromBottomWhenUnread:U().func.isRequired}).isRequired});var Zt=a(3295);function Xt(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const $t=Y.YM.POST_CHUNK_SIZE/2;function ea(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,Ee.Gy)(Zt.CU.PostListLoaded),(0,Zt.uB)({name:Zt.t$.ChannelSwitch,startMark:Zt.CU.ChannelLinkClicked,endMark:Zt.CU.PostListLoaded,labels:{fresh:e.toString()},canFail:!0}),(0,Zt.uB)({name:Zt.t$.TeamSwitch,startMark:Zt.CU.TeamLinkClicked,endMark:Zt.CU.PostListLoaded,labels:{fresh:e.toString()},canFail:!0}),(0,Ee.MR)([Zt.CU.ChannelLinkClicked,Zt.CU.TeamLinkClicked,Zt.CU.PostListLoaded])}class ta extends L().PureComponent{constructor(e){var t;super(e),t=this,Xt(this,"postsOnLoad",(async e=>{const{focusedPostId:t,isFirstLoad:a,latestPostTimeStamp:n,isPrefetchingInProcess:s,actions:r}=this.props;t?await r.loadPostsAround(e,t):a?s||await r.loadUnreads(e):n?await r.syncPostsInChannel(e,n,!1):await r.loadLatestPosts(e),t||this.props.actions.markChannelAsRead(e),this.mounted&&this.setState({loadingOlderPosts:!1,loadingNewerPosts:!1})})),Xt(this,"callLoadPosts",(async(e,t,a,n)=>{const{error:s}=await this.props.actions.loadPosts({channelId:e,postId:t,type:a,perPage:n});return a===Y.DL.BEFORE_ID?this.setState({loadingOlderPosts:!1}):this.setState({loadingNewerPosts:!1}),s?this.autoRetriesCount<3?(this.autoRetriesCount++,await this.callLoadPosts(e,t,a,n)):this.mounted&&this.setState({autoRetryEnable:!1}):(this.mounted&&this.setState({autoRetryEnable:!0}),this.state.autoRetryEnable||(this.autoRetriesCount=0)),{error:s}})),Xt(this,"getOldestVisiblePostId",(()=>(0,be.J3)(this.props.postListIds||[]))),Xt(this,"getLatestVisiblePostId",(()=>(0,be.h7)(this.props.postListIds||[]))),Xt(this,"canLoadMorePosts",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Y.DL.BEFORE_ID;t.props.hasInaccessiblePosts||t.props.postListIds&&(t.state.loadingOlderPosts||t.state.loadingNewerPosts||(t.extraPagesLoaded>30?t.state.autoRetryEnable&&t.setState({autoRetryEnable:!1}):(t.props.atOldestPost||e!==Y.DL.BEFORE_ID?t.props.atLatestPost||await t.getPostsAfter():await t.getPostsBeforeAutoLoad(),t.extraPagesLoaded+=1)))})),Xt(this,"getPostsBefore",(async()=>{if(this.state.loadingOlderPosts)return;this.state.autoRetryEnable||(this.extraPagesLoaded=0);const e=this.getOldestVisiblePostId();this.setState({loadingOlderPosts:!0}),await this.callLoadPosts(this.props.channelId,e,Y.DL.BEFORE_ID,$t)})),Xt(this,"getPostsAfter",(async()=>{if(this.state.loadingNewerPosts)return;this.state.autoRetryEnable||(this.extraPagesLoaded=0);const e=this.getLatestVisiblePostId();this.setState({loadingNewerPosts:!0}),await this.callLoadPosts(this.props.channelId,e,Y.DL.AFTER_ID,$t)})),Xt(this,"getPostsBeforeAutoLoad",(async()=>{if(this.state.loadingOlderPosts)return;const e=this.getOldestVisiblePostId();this.setState({loadingOlderPosts:!0}),await this.callLoadPosts(this.props.channelId,e,Y.DL.BEFORE_ID,200)})),this.state={loadingNewerPosts:!1,loadingOlderPosts:!1,autoRetryEnable:!0},this.extraPagesLoaded=0,this.autoRetriesCount=0,this.actionsForPostList={loadOlderPosts:this.getPostsBefore,loadNewerPosts:this.getPostsAfter,canLoadMorePosts:this.canLoadMorePosts,changeUnreadChunkTimeStamp:e.changeUnreadChunkTimeStamp,toggleShouldStartFromBottomWhenUnread:e.toggleShouldStartFromBottomWhenUnread,updateNewMessagesAtInChannel:this.props.actions.updateNewMessagesAtInChannel}}componentDidMount(){this.mounted=!0,this.props.channelId&&(this.postsOnLoad(this.props.channelId),this.props.postListIds&&ea())}componentDidUpdate(e){this.props.channelId!==e.channelId&&this.postsOnLoad(this.props.channelId),null!=this.props.postListIds&&null==e.postListIds&&ea(!0)}componentWillUnmount(){this.mounted=!1}render(){return this.props.postListIds?L().createElement("div",{className:"post-list-holder-by-time",key:"postlist-"+this.props.channelId},L().createElement("div",{className:"post-list__table"},L().createElement("div",{id:"virtualizedPostListContent",className:"post-list__content"},L().createElement(Qt,{loadingNewerPosts:this.state.loadingNewerPosts,loadingOlderPosts:this.state.loadingOlderPosts,atOldestPost:this.props.atOldestPost,atLatestPost:this.props.atLatestPost,focusedPostId:this.props.focusedPostId,channelId:this.props.channelId,autoRetryEnable:this.state.autoRetryEnable,shouldStartFromBottomWhenUnread:this.props.shouldStartFromBottomWhenUnread,actions:this.actionsForPostList,postListIds:this.props.formattedPostIds,latestPostTimeStamp:this.props.latestPostTimeStamp,isMobileView:this.props.isMobileView,lastViewedAt:this.props.lastViewedAt})))):L().createElement(me.A,{centered:!0})}}Xt(ta,"propTypes",{formattedPostIds:U().arrayOf(U().string),postListIds:U().arrayOf(U().string),channelId:U().string.isRequired,focusedPostId:U().string,atLatestPost:U().bool.isRequired,atOldestPost:U().bool,isFirstLoad:U().bool.isRequired,latestPostTimeStamp:U().number,changeUnreadChunkTimeStamp:U().func.isRequired,isPrefetchingInProcess:U().bool.isRequired,isMobileView:U().bool.isRequired,lastViewedAt:U().number.isRequired,toggleShouldStartFromBottomWhenUnread:U().func.isRequired,shouldStartFromBottomWhenUnread:U().bool.isRequired,hasInaccessiblePosts:U().bool.isRequired,actions:U().shape({loadPostsAround:U().func.isRequired,loadUnreads:U().func.isRequired,loadPosts:U().func.isRequired,syncPostsInChannel:U().func.isRequired,loadLatestPosts:U().func.isRequired,markChannelAsRead:U().func.isRequired,updateNewMessagesAtInChannel:U().any.isRequired}).isRequired});const aa=(e,t)=>!e.entities.posts.postsInChannel[t],na=(0,ge.el)((e=>(0,be.h7)(e))),sa=(0,n.connect)((function(){const e=(0,pe.A8)(),t=(0,fe.fG)();return function(a,n){let s,r,i,o=0,l=!1,c=!1;const{focusedPostId:d,unreadChunkTimeStamp:u,channelId:m,shouldStartFromBottomWhenUnread:h}=n,p=a.views.channel,g=p.lastChannelViewTime[m],f=p.channelPrefetchStatus[m]===he.IZ.STARTED,b=(0,pe.VT)(a),E=Boolean(b.channels[m])||0===b.channels[m],C=(0,pe.f5)(a,d||"");r=d&&void 0!==C?e(a,d,m):u&&!h?(0,pe.AB)(a,m,u):(0,pe.Gn)(a,m),r&&(s=r.order,l=Boolean(r.recent),c=Boolean(r.oldest));let v=!1;if(null!=u&&(v=h&&!(0,pe.dH)(a,r,u)),s&&(i=t(a,{postIds:s,lastViewedAt:g,indicateNewMessages:!v}),s.length)){const e=na(s);o=(0,pe.f5)(a,e).create_at}return{lastViewedAt:g,isFirstLoad:aa(a,m),formattedPostIds:i,atLatestPost:l,atOldestPost:c,latestPostTimeStamp:o,postListIds:s,isPrefetchingInProcess:f,shouldStartFromBottomWhenUnread:h,isMobileView:(0,V.w3)(a),hasInaccessiblePosts:E}}}),(function(e){return{actions:(0,G.zH)({loadUnreads:c.jw,loadPosts:c.i,loadLatestPosts:c.F8,loadPostsAround:c.zp,syncPostsInChannel:c.LD,markChannelAsRead:s.Zn,updateNewMessagesAtInChannel:Z.Lg},e)}}))(ta);function ra(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ia extends L().PureComponent{constructor(e){super(e),ra(this,"changeUnreadChunkTimeStamp",(e=>{this.setState({unreadChunkTimeStamp:e,loaderForChangeOfPostsChunk:!0},(()=>{window.requestAnimationFrame((()=>{this.setState({loaderForChangeOfPostsChunk:!1})}))}))})),ra(this,"toggleShouldStartFromBottomWhenUnread",(()=>{this.setState((e=>({loaderForChangeOfPostsChunk:!0,shouldStartFromBottomWhenUnread:!e.shouldStartFromBottomWhenUnread})),(()=>{window.requestAnimationFrame((()=>{this.setState({loaderForChangeOfPostsChunk:!1})}))}))}));const t=this.props.unreadScrollPosition===Y.pm.UNREAD_SCROLL_POSITION_START_FROM_NEWEST;this.state={unreadChunkTimeStamp:e.lastViewedAt,shouldStartFromBottomWhenUnread:t,loaderForChangeOfPostsChunk:!1,channelLoading:e.channelLoading}}static getDerivedStateFromProps(e,t){return null===t.unreadChunkTimeStamp&&e.lastViewedAt?{unreadChunkTimeStamp:e.lastViewedAt}:e.channelLoading!==t.channelLoading?{unreadChunkTimeStamp:e.lastViewedAt,channelLoading:e.channelLoading}:null}render(){return this.props.channelLoading||this.state.loaderForChangeOfPostsChunk?L().createElement("div",{id:"post-list"},L().createElement(me.A,{centered:!0})):L().createElement("div",{id:"post-list",role:"main"},L().createElement(sa,{unreadChunkTimeStamp:this.state.unreadChunkTimeStamp,channelId:this.props.channelId,changeUnreadChunkTimeStamp:this.changeUnreadChunkTimeStamp,shouldStartFromBottomWhenUnread:this.state.shouldStartFromBottomWhenUnread,toggleShouldStartFromBottomWhenUnread:this.toggleShouldStartFromBottomWhenUnread,focusedPostId:this.props.focusedPostId}))}}ra(ia,"propTypes",{lastViewedAt:U().number,channelLoading:U().bool.isRequired,channelId:U().string.isRequired,focusedPostId:U().string,unreadScrollPosition:U().string.isRequired});const oa=(0,O.withRouter)((0,n.connect)((function(){return function(e,t){var a;const n=null===(a=t.match)||void 0===a?void 0:a.params,s=(0,o.Uj)(e,(null==n?void 0:n.team)||"");let i;const c=(0,r.c)(e,t.channelId);let d=e.views.channel.lastChannelViewTime[t.channelId];c&&(c.type===Y.YM.DM_CHANNEL&&c.teammate_id&&(i=(0,l.wz)(e,c.teammate_id)),d=c.last_post_at?d:c.last_post_at);const u=((e,t,a,n,s)=>{var r;if(e.postid)return!1;const i=null===(r=e.identifier)||void 0===r?void 0:r.toLowerCase();if(t&&a){if(t.type!==Y.YM.DM_CHANNEL&&t.name!==i)return!0;if(t.type===Y.YM.DM_CHANNEL&&n&&i!=="@".concat(n.username))return!0;const e=a.id;return!!(t.team_id&&t.team_id!==e||s&&!s[e])}return!0})(n,c,s,i,(0,o.bO)(e));return{unreadScrollPosition:(0,b.z0)(e),lastViewedAt:d,channelLoading:u}}}))(ia));var la=a(7344);const ca=()=>{location.reload()},da=e=>{let{updateWaitForLoader:t}=e;const[a,n]=(0,P.useState)(!1);return(0,P.useEffect)((()=>{let e=setTimeout((()=>{n(!0),t(!0),e=setTimeout((()=>{t(!1)}),2e3)}),5e3);return()=>{clearTimeout(e),t(!1)}}),[]),L().createElement("div",{className:"AdvancedTextEditor__skeleton"},a&&L().createElement(L().Fragment,null,L().createElement(ce.FormattedMessage,{id:"center_panel.input.cannot_load_component",defaultMessage:"Something went wrong while loading the component. Please wait a moment, or try reloading the app."}),L().createElement("button",{className:"btn btn-tertiary channel-archived__close-btn",onClick:ca},L().createElement(ce.FormattedMessage,{id:"center_panel.reloadPage",defaultMessage:"Reload"}))))};da.propTypes={updateWaitForLoader:U().func.isRequired};const ua=da;function ma(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ha(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ma(Object(a),!0).forEach((function(t){pa(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ma(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function pa(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const ga=(0,x.S)("ChannelHeader",(0,P.lazy)((()=>Promise.all([a.e(7011),a.e(1852),a.e(6098),a.e(9949),a.e(4446),a.e(1633),a.e(6222)]).then(a.bind(a,86222))))),fa=(0,x.S)("FileUploadOverlay",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,77143))))),ba=(0,x.S)("ChannelBookmarks",(0,P.lazy)((()=>Promise.all([a.e(4446),a.e(1119)]).then(a.bind(a,39403))))),Ea=(0,x.S)("AdvancedCreatePost",(0,P.lazy)((()=>a.e(3797).then(a.bind(a,73797))))),Ca=(0,x.S)("ChannelBanner",(0,P.lazy)((()=>a.e(388).then(a.bind(a,10388)))));class va extends L().PureComponent{static getDerivedStateFromProps(e,t){let a={};const n=e.match.params.postid;return e.match.url!==t.url&&e.channelId!==t.channelId&&(a={deferredPostView:va.createDeferredPostView(),url:e.match.url,focusedPostId:n}),e.channelId!==t.channelId&&(a=ha(ha({},a),{},{channelId:e.channelId,focusedPostId:n})),n&&n!==t.focusedPostId&&(a=ha(ha({},a),{},{focusedPostId:n})),Object.keys(a).length?a:null}constructor(e){super(e),pa(this,"onClickCloseChannel",(()=>{this.props.goToLastViewedChannel()})),pa(this,"onUpdateInputShowLoader",(e=>{this.setState({waitForLoader:e})})),this.state={url:e.match.url,channelId:e.channelId,focusedPostId:e.match.params.postid,deferredPostView:va.createDeferredPostView(),waitForLoader:!1},this.channelViewRef=L().createRef()}componentDidUpdate(e){e.channelId!==this.props.channelId&&this.props.enableWebSocketEventScope&&la.A.updateActiveChannel(this.props.channelId),this.props.canRestrictDirectMessage&&void 0===this.props.restrictDirectMessage&&this.props.fetchIsRestrictedDM(this.props.channelId)}render(){let e;e=this.props.deactivatedChannel?L().createElement("div",{className:"post-create__container AdvancedTextEditor__ctr",id:"post-create"},L().createElement("div",{className:"channel-archived__message"},L().createElement(ce.FormattedMessage,{id:"channelView.archivedChannelWithDeactivatedUser",defaultMessage:"You are viewing an archived channel with a <b>deactivated user</b>. New messages cannot be posted.",values:{b:e=>L().createElement("b",null,e)}}),L().createElement("button",{className:"btn btn-primary channel-archived__close-btn",onClick:this.onClickCloseChannel},L().createElement(ce.FormattedMessage,{id:"center_panel.archived.closeChannel",defaultMessage:"Close Channel"})))):this.props.channelIsArchived?L().createElement("div",{className:"post-create__container",id:"post-create"},L().createElement("div",{id:"channelArchivedMessage",className:"channel-archived__message"},L().createElement(ce.FormattedMessage,{id:"channelView.archivedChannel",defaultMessage:"You are viewing an <b>archived channel</b>. New messages cannot be posted.",values:{b:e=>L().createElement("b",null,e)}}),L().createElement("button",{className:"btn btn-primary channel-archived__close-btn",onClick:this.onClickCloseChannel},L().createElement(ce.FormattedMessage,{id:"center_panel.archived.closeChannel",defaultMessage:"Close Channel"})))):this.props.restrictDirectMessage?L().createElement("div",{className:"post-create__container",id:"post-create"},L().createElement("div",{id:"noSharedTeamMessage",className:"channel-archived__message"},L().createElement(ce.FormattedMessage,{id:"channelView.noSharedTeam",defaultMessage:"You no longer have any teams in common with this user. New messages cannot be posted.",values:{b:e=>L().createElement("b",null,e)}}),L().createElement("button",{className:"btn btn-primary channel-archived__close-btn",onClick:this.onClickCloseChannel},L().createElement(ce.FormattedMessage,{id:"center_panel.noSharedTeam.closeChannel",defaultMessage:"Close Channel"})))):this.props.missingChannelRole||this.state.waitForLoader?L().createElement(ua,{updateWaitForLoader:this.onUpdateInputShowLoader}):L().createElement("div",{id:"post-create","data-testid":"post-create",className:"post-create__container AdvancedTextEditor__ctr"},L().createElement(Ea,null));const t=this.state.deferredPostView;return L().createElement("div",{ref:this.channelViewRef,id:"app-content",className:"app__content"},L().createElement(fa,{overlayType:"center",id:ue.nY}),L().createElement(ga,null),this.props.isChannelBookmarksEnabled&&L().createElement(ba,{channelId:this.props.channelId}),L().createElement(Ca,{channelId:this.props.channelId}),L().createElement(t,{channelId:this.props.channelId,focusedPostId:this.state.focusedPostId}),e)}}pa(va,"createDeferredPostView",(()=>(0,de.A)(oa,L().createElement("div",{id:"post-list",className:"a11y__region","data-a11y-sort-order":"1","data-a11y-focus-child":!0,"data-a11y-order-reversed":!0}))));const ya={goToLastViewedChannel:c.TJ,fetchIsRestrictedDM:s.NE},Ma=(0,n.connect)((function(e){const t=(0,r.Lw)(e),a=(0,i.zj)(e),n="true"===a.EnableOnboardingFlow,s="true"===a.FeatureFlagWebSocketEventScope,c=function(e,t){var a;return!(t&&(null===(a=(0,r.M9)(e,t.id))||void 0===a?void 0:a.roles)||"").split(" ").some((t=>Boolean((0,oe.O0)(e)[t])))}(e,t);return{channelId:t?t.id:"",deactivatedChannel:!!t&&(0,r.nO)(e,t.id),enableOnboardingFlow:n,channelIsArchived:!!t&&0!==t.delete_at,isCloud:"true"===(0,i.Ay)(e).Cloud,teamUrl:(0,o._p)(e),isFirstAdmin:(0,l.OK)(e),enableWebSocketEventScope:s,canRestrictDirectMessage:"team"===a.RestrictDirectMessage&&("D"===(null==t?void 0:t.type)||"G"===(null==t?void 0:t.type)),restrictDirectMessage:!!t&&e.entities.channels.restrictedDMs[t.id],isChannelBookmarksEnabled:(0,le.wR)(e),missingChannelRole:c}}),ya),_a=(0,O.withRouter)(Ma(va));function Ta(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Sa extends L().PureComponent{constructor(e){super(e),Ta(this,"replaceUrlIfPermalink",(()=>{this.props.match.params.postid&&(this.replaceUrlTimeout=setTimeout((()=>{const e=this.props.match.url.split("/").slice(0,-1).join("/");(0,Ot.J)().replace(e)}),Y.Ay.PERMALINK_FADEOUT))})),this.state={prevProps:e}}componentDidUpdate(e){this.props.match.params.team===e.match.params.team&&this.props.match.params.identifier===e.match.params.identifier||(clearTimeout(this.replaceUrlTimeout),this.props.actions.onChannelByIdentifierEnter(this.props),this.replaceUrlIfPermalink())}componentDidMount(){this.props.actions.onChannelByIdentifierEnter(this.props),this.replaceUrlIfPermalink()}componentWillUnmount(){clearTimeout(this.replaceUrlTimeout)}render(){return L().createElement(_a,null)}}Ta(Sa,"propTypes",{actions:U().shape({onChannelByIdentifierEnter:U().func.isRequired}).isRequired});const wa=(0,O.withRouter)((0,n.connect)(null,(function(e){return{actions:(0,G.zH)({onChannelByIdentifierEnter:te},e)}}))(Sa));var Ia=a(82739);const Aa=(0,x.S)("MobileChannelHeader",(0,P.lazy)((()=>Promise.all([a.e(7011),a.e(9949),a.e(4446),a.e(1633),a.e(8844)]).then(a.bind(a,88844))))),Na=(0,x.S)("GlobalThreads",(0,P.lazy)((()=>a.e(1082).then(a.bind(a,81082)))),L().createElement("div",{className:"app__content"},L().createElement(me.A,null))),Ra=(0,x.S)("Drafts",(0,P.lazy)((()=>a.e(2794).then(a.bind(a,22794)))),L().createElement("div",{className:"app__content"},L().createElement(me.A,null))),Pa=(0,x.S)("PermalinkView",(0,P.lazy)((()=>a.e(1300).then(a.bind(a,21300))))),La=(0,x.S)("PlaybookRunner",(0,P.lazy)((()=>a.e(7422).then(a.bind(a,87422)))));class Oa extends L().PureComponent{constructor(e){super(e),this.state={returnTo:"",lastReturnTo:""}}static getDerivedStateFromProps(e,t){return t.lastReturnTo!==e.location.pathname&&e.location.pathname.includes("/pl/")?{lastReturnTo:e.location.pathname,returnTo:t.lastReturnTo}:{lastReturnTo:e.location.pathname}}async componentDidMount(){const{actions:e}=this.props;await e.getProfiles()}render(){const{lastChannelPath:e,isCollapsedThreadsEnabled:t,isMobileView:a}=this.props,n=this.props.match.url;return L().createElement("div",{key:"inner-wrap",className:q()("inner-wrap","channel__wrap",{"move--right":this.props.lhsOpen,"move--left":this.props.rhsOpen,"move--left-small":this.props.rhsMenuOpen})},a&&L().createElement(Aa,null),L().createElement("div",{className:"row main"},L().createElement(O.Switch,null,L().createElement(O.Route,{path:"".concat(n,"/pl/:postid(").concat(Ia.Zv,")"),render:e=>L().createElement(Pa,Object.assign({},e,{returnTo:this.state.returnTo}))}),L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/:path(channels|messages)/:identifier(").concat(Ia.x,")/:postid(").concat(Ia.Zv,")?"),component:wa}),L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/_playbooks/:playbookId(").concat(Ia.Zv,")/run")},L().createElement(La,null)),t?L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/threads/:threadIdentifier(").concat(Ia.Zv,")?"),component:Na}):null,L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/drafts"),component:Ra}),L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/").concat(Y.pj),component:Ra}),L().createElement(O.Redirect,{to:e}))))}}const Da=(0,n.connect)(((e,t)=>{const a=(0,K.Gw)(e,t.match.params.team);let n=(0,K.y1)(e,t.match.params.team);const s=(0,K.Kf)(e),i=(0,o.Uj)(e,t.match.params.team);let c,u;return s!==(null==i?void 0:i.id)&&(c=(0,K.Jl)(e)),n||(n=(0,r.Dn)(e,i.id)),u=!(0,b.WW)(e)||c!==Y.po.THREADS&&a!==Y.po.THREADS?"".concat(t.match.url,"/channels/").concat(n):"".concat(t.match.url,"/threads"),{lastChannelPath:u,lhsOpen:(0,W.Cu)(e),rhsOpen:(0,d.A)(e),rhsMenuOpen:(0,d.ZE)(e),isCollapsedThreadsEnabled:(0,b.WW)(e),currentUserId:(0,l.WR)(e),isMobileView:(0,V.w3)(e)}}),(function(e){return{actions:(0,G.zH)({getProfiles:z.r7},e)}})),ka=(0,O.withRouter)(Da(Oa));a(36169),a(30973);var Fa=a(79751);const xa=function(){const e=(0,O.useLocation)(),t=(0,n.useDispatch)(),a=(0,O.useHistory)(),s={open_invitation_modal:{modalId:Y.IQ.INVITATION,dialogType:Ye.default}};return(0,P.useEffect)((()=>{const n=new URLSearchParams(e.search),r=n.get("action");r&&s[r]&&(t((0,Fa.q)(s[r])),n.delete("action"),a.replace({search:n.toString()}))}),[e,s]),null};var Ha=a(4629),Ua=a(16983),Ba=a(80635),qa=a(52073),ja=a(2386),Va=a(9916),Ga=a(98496);function za(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Wa(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?za(Object(a),!0).forEach((function(t){Ka(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):za(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function Ka(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Ya=function(e){return e[e.high=1]="high",e[e.medium=2]="medium",e[e.low=3]="low",e}(Ya||{}),Ja=function(e){return e[e.mentionMax=10]="mentionMax",e[e.unreadMax=20]="unreadMax",e}(Ja||{});const Qa=(0,ge.el)(((e,t,a)=>{const n=e.length;let s={[Ya.high]:[],[Ya.medium]:[],[Ya.low]:[]};if(!n||n>Ja.unreadMax)return s;for(const r of e){const e=r.id,i=t[e];if(n>=Ja.mentionMax&&s[Ya.high].length>=Ja.mentionMax)break;i&&!(0,Re.X4)(i)&&((a?i.mention_count_root:i.mention_count)?s=Wa(Wa({},s),{},{[Ya.high]:[...s[Ya.high],e]}):i.notify_props&&"mention"!==i.notify_props.mark_unread&&n<Ja.mentionMax&&(s=Wa(Wa({},s),{},{[Ya.medium]:[...s[Ya.medium],e]})))}return s}));var Za=a(79030),Xa=a(65357);function $a(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const en=new Za.A({concurrency:2});class tn extends L().PureComponent{constructor(){super(...arguments),$a(this,"prefetchPosts",(e=>{let t;const a=this.props.unreadChannels.find((t=>e===t.id));return!a||a.type!==Y.YM.PRIVATE_CHANNEL&&a.type!==Y.YM.OPEN_CHANNEL||Date.now()-a.last_post_at<=1e3&&(t=1e3*Math.random()),this.props.actions.prefetchChannelPosts(e,t)})),$a(this,"prefetchData",(()=>{const{prefetchRequestStatus:e,prefetchQueueObj:t}=this.props;for(const a in t){if(!Object.hasOwn(t,a))continue;const n=t[a];for(const t of n)Object.hasOwn(e,t)||en.add((async()=>this.prefetchPosts(t)))}}))}async componentDidUpdate(e){const{currentChannelId:t,prefetchQueueObj:a,sidebarLoaded:n}=this.props;n&&!e.sidebarLoaded&&(0,Xa.mp)(),!t||!n||e.currentChannelId&&e.sidebarLoaded?e.prefetchQueueObj!==a&&(clearTimeout(this.prefetchTimeout),await en.clear(),this.prefetchData()):(en.add((async()=>this.prefetchPosts(t))),this.prefetchData())}render(){return null}}function an(e){return(0,Va.WJ)(e).length>0}$a(tn,"propTypes",{currentChannelId:U().string.isRequired,prefetchQueueObj:U().objectOf(U().arrayOf(U().string)).isRequired,prefetchRequestStatus:U().objectOf(U().string).isRequired,sidebarLoaded:U().bool.isRequired,unreadChannels:U().array.isRequired,actions:U().shape({prefetchChannelPosts:U().func.isRequired}).isRequired});const nn=(0,n.connect)((function(e){const t=e.views.channel.lastUnreadChannel,a=(0,f.vd)(e),n=(0,r.OM)(e,t),s=Qa(n,a,(0,b.WW)(e)),i=e.views.channel.channelPrefetchStatus;return{currentChannelId:(0,r.eH)(e),prefetchQueueObj:s,prefetchRequestStatus:i,sidebarLoaded:an(e),unreadChannels:n}}),(function(e){return{actions:(0,G.zH)({prefetchChannelPosts:c.At},e)}}))(tn);var sn=a(71769),rn=a(7021);function on(e){let{children:t,id:a,className:n}=e;const s=(0,P.useRef)(null);return L().createElement("div",{id:a,className:n,ref:s},t,L().createElement(rn.A,{name:"lhsResizeHandle",globalCssVar:sn.Oq.LHS,defaultWidth:sn.LA,dir:sn.Cr.LEFT,containerRef:s}))}on.propTypes={children:U().node.isRequired};const ln=on;var cn=a(74754),dn=a(45955),un=a(30135),mn=a(31892),hn=a(70669),pn=a(8283),gn=a(87364),fn=a(8610),bn=a(3289),En=a(86145),Cn=a(52231);function vn(e){var t;const a=(0,n.useSelector)(i.Ay),s=(0,n.useSelector)(i.zj),r=(0,n.useSelector)((e=>(0,oe.y4)(e,{permission:he.xB.CREATE_TEAM}))),l=(0,n.useSelector)((e=>(0,Ba.pU)(e,he.xB.MANAGE_TEAM))),c=(0,n.useSelector)((e=>(0,Ba.pU)(e,he.xB.ADD_USER_TO_TEAM))),d=(0,n.useSelector)((e=>(0,Ba.pU)(e,he.xB.INVITE_GUEST))),u=(0,Cn.P3)(a),m="true"===(null==s?void 0:s.EnableGuestAccounts),h=Boolean(null===(t=e.currentTeam)||void 0===t?void 0:t.group_constrained),p="true"===(null==a?void 0:a.LDAPGroups),g=s.ExperimentalPrimaryTeam,f=(0,n.useSelector)(o.sZ),b=(null==f?void 0:f.length)>0,E=!g&&b,C=e.currentTeam.description?e.currentTeam.description:e.currentTeam.display_name;return L().createElement(hn.mc,{menuButton:{id:"sidebarTeamMenuButton",class:"btn btn-sm btn-quaternary btn-inverted",children:L().createElement(L().Fragment,null,L().createElement("span",null,e.currentTeam.display_name),L().createElement("i",{className:"icon icon-chevron-down"}))},menuButtonTooltip:{text:C},menu:{id:"sidebarTeamMenu"}},(m&&d||c)&&L().createElement(yn,null),h&&p&&l&&L().createElement(Mn,null),l&&L().createElement(_n,null),L().createElement(Tn,null),h&&p&&l&&L().createElement(Sn,{teamID:e.currentTeam.id}),!h&&g!==e.currentTeam.name&&L().createElement(wn,null),(E||r)&&L().createElement(hn.wv,null),E&&L().createElement(In,null),r&&L().createElement(An,{isCloud:u}),L().createElement(hn.wv,null),L().createElement(Pn,null),L().createElement(Ln,null))}function yn(e){const t=(0,n.useDispatch)(),a=(0,P.useCallback)((()=>{t((0,Fa.q)({modalId:Y.IQ.INVITATION,dialogType:Ye.default,dialogProps:{focusOriginElement:"sidebarTeamMenuButton"}}))}),[t]);return L().createElement(hn.q7,Object.assign({onClick:a,leadingElement:L().createElement(Ae.AccountMultiplePlusOutlineIcon,{size:18,"aria-hidden":"true"}),labels:L().createElement(L().Fragment,null,L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.invitePeopleMenuItem.primaryLabel",defaultMessage:"Invite people"}),L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.invitePeopleMenuItem.secondaryLabel",defaultMessage:"Add or invite people to the team"})),"aria-haspopup":"dialog"},e))}function Mn(e){const t=(0,n.useDispatch)(),a=(0,P.useCallback)((()=>{t((0,Fa.q)({modalId:Y.IQ.ADD_GROUPS_TO_TEAM,dialogType:Pe.A,dialogProps:{focusOriginElement:"sidebarTeamMenuButton"}}))}),[t]);return L().createElement(hn.q7,Object.assign({onClick:a,leadingElement:L().createElement(Ae.AccountPlusOutlineIcon,{size:18,"aria-hidden":"true"}),labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.addGroupsToTeamMenuItem.primaryLabel",defaultMessage:"Add groups"}),"aria-haspopup":"dialog"},e))}function _n(e){const t=(0,n.useDispatch)(),a=(0,P.useCallback)((()=>{t((0,Fa.q)({modalId:Y.IQ.TEAM_SETTINGS,dialogType:fn.A,dialogProps:{focusOriginElement:"sidebarTeamMenuButton"}}))}),[t]);return L().createElement(hn.q7,Object.assign({leadingElement:L().createElement(Ae.SettingsOutlineIcon,{size:18,"aria-hidden":"true"}),onClick:a,labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.teamSettingsMenuItem.primaryLabel",defaultMessage:"Team settings"}),"aria-haspopup":"dialog"},e))}function Tn(e){const t=(0,n.useDispatch)(),a=(0,n.useSelector)((e=>(0,Ba.pU)(e,he.xB.REMOVE_USER_FROM_TEAM))),s=(0,n.useSelector)((e=>(0,Ba.pU)(e,he.xB.MANAGE_TEAM_ROLES))),r=(0,P.useCallback)((()=>{t((0,Fa.q)({modalId:Y.IQ.TEAM_MEMBERS,dialogType:gn.A,dialogProps:{focusOriginElement:"sidebarTeamMenuButton"}}))}),[t]);let i=L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.viewMembersMenuItem.primaryLabel",defaultMessage:"View members"});return a&&s&&(i=L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.manageMembersMenuItem.primaryLabel",defaultMessage:"Manage members"})),L().createElement(hn.q7,Object.assign({leadingElement:L().createElement(Ae.AccountMultipleOutlineIcon,{size:18,"aria-hidden":"true"}),onClick:r,labels:i,"aria-haspopup":"dialog"},e))}function Sn(e){let{teamID:t}=e;const a=(0,n.useDispatch)(),s=(0,P.useCallback)((()=>{a((0,Fa.q)({modalId:Y.IQ.MANAGE_TEAM_GROUPS,dialogType:pn.A,dialogProps:{teamID:t}}))}),[a,t]);return L().createElement(hn.q7,{leadingElement:L().createElement(Ae.MonitorAccountIcon,{size:18,"aria-hidden":"true"}),onClick:s,labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.manageGroupsMenuItem.primaryLabel",defaultMessage:"Manage groups"}),"aria-haspopup":"dialog"})}function wn(){const e=(0,n.useDispatch)(),t=(0,P.useCallback)((()=>{e((0,Fa.q)({modalId:Y.IQ.LEAVE_TEAM,dialogType:mn.A}))}),[e]);return L().createElement(hn.q7,{leadingElement:L().createElement(Ae.ExitToAppIcon,{size:18,"aria-hidden":"true"}),onClick:t,isDestructive:!0,labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.leaveTeamMenuItem.primaryLabel",defaultMessage:"Leave team"}),"aria-haspopup":"dialog"})}function In(){const e=(0,O.useHistory)(),t=(0,P.useCallback)((()=>{e.push("/select_team")}),[e]);return L().createElement(hn.q7,{leadingElement:L().createElement(Ae.MessagePlusOutlineIcon,{size:18,"aria-hidden":"true"}),onClick:t,labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.joinAnotherTeamMenuItem.primaryLabel",defaultMessage:"Join another team"})})}function An(e){let{isCloud:t}=e;const a=(0,O.useHistory)(),s=(0,n.useSelector)(dn.dw),r=(0,n.useSelector)(dn.Pd),i=t&&"true"===(null==s?void 0:s.is_free_trial),o=t&&(null==r?void 0:r.sku)===Y.YE.STARTER,l=(0,un.A)(),c=o&&!i&&l.teams.active>=0,d=t&&(i||c),u=(0,P.useCallback)((()=>{c||d||a.push("/create_team")}),[a,c]);return L().createElement(hn.q7,{leadingElement:L().createElement(Ae.PlusIcon,{size:18,"aria-hidden":"true"}),onClick:u,labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.createTeamMenuItem.primaryLabel",defaultMessage:"Create a team"}),trailingElements:d&&L().createElement(Nn,{isFreeTrial:i})})}function Nn(e){let{isFreeTrial:t}=e;const{formatMessage:a}=(0,ce.useIntl)();return L().createElement(bn.A,{feature:Y.W0.CREATE_MULTIPLE_TEAMS,minimumPlanRequiredForFeature:Y.gS.Professional,blocked:!t,tooltipMessage:a({id:"navbar_dropdown.create.tooltip.cloudFreeTrial",defaultMessage:"During your trial you are able to create multiple teams. These teams will be archived after your trial."}),titleAdminPreTrial:a({id:"navbar_dropdown.create.modal.titleAdminPreTrial",defaultMessage:"Try unlimited teams with a free trial"}),messageAdminPreTrial:a({id:"navbar_dropdown.create.modal.messageAdminPreTrial",defaultMessage:"Create unlimited teams with one of our paid plans. Get the full experience of Enterprise when you start a free, {trialLength} day trial."},{trialLength:En.$w}),titleAdminPostTrial:a({id:"navbar_dropdown.create.modal.titleAdminPostTrial",defaultMessage:"Upgrade to create unlimited teams"}),messageAdminPostTrial:a({id:"navbar_dropdown.create.modal.messageAdminPostTrial",defaultMessage:"Multiple teams allow for context-specific spaces that are more attuned to your and your teams' needs. Upgrade to the Professional plan to create unlimited teams."}),titleEndUser:a({id:"navbar_dropdown.create.modal.titleEndUser",defaultMessage:"Multiple teams available in paid plans"}),messageEndUser:a({id:"navbar_dropdown.create.modal.messageEndUser",defaultMessage:"Multiple teams allow for context-specific spaces that are more attuned to your teams' needs."})})}An.propTypes={isCloud:U().bool.isRequired};const Rn="https://mattermost.com/pl/mattermost-academy-team-training";function Pn(){const e=(0,P.useCallback)((()=>{window.open(Rn,"_blank","noopener noreferrer")}),[]);return L().createElement(hn.q7,{className:"learnAboutTeamsMenuItem",onClick:e,leadingElement:L().createElement(Ae.LightbulbOutlineIcon,{size:18,"aria-hidden":"true"}),labels:L().createElement(ce.FormattedMessage,{id:"sidebarLeft.teamMenu.learnAboutTeamsMenuItem.primaryLabel",defaultMessage:"Learn about teams"})})}function Ln(){const e=(0,n.useSelector)(et.Ui);if(e.length>0){const t=e.map((e=>L().createElement(hn.q7,{id:"".concat(e.id,"_pluginmenuitem"),key:e.id,onClick:function(){e.action&&e.action()},labels:L().createElement("span",null,e.text)})));return L().createElement(L().Fragment,null,L().createElement(hn.wv,null),t)}return null}const On=e=>{const t=(0,n.useSelector)(o.H7);return t?L().createElement("div",{className:"sidebarHeaderContainer"},L().createElement(vn,{currentTeam:t}),(e.canCreateChannel||e.canJoinPublicChannel)&&L().createElement(cn.Ay,{canCreateChannel:e.canCreateChannel,onCreateNewChannelClick:e.showNewChannelModal,canJoinPublicChannel:e.canJoinPublicChannel,onBrowseChannelClick:e.showMoreChannelsModal,onOpenDirectMessageClick:e.handleOpenDirectMessagesModal,canCreateCustomGroups:e.canCreateCustomGroups,onCreateNewUserGroupClick:e.showCreateUserGroupModal,unreadFilterEnabled:e.unreadFilterEnabled,onCreateNewCategoryClick:e.showCreateCategoryModal,onInvitePeopleClick:e.invitePeopleModal})):null};On.propTypes={showNewChannelModal:U().func.isRequired,showMoreChannelsModal:U().func.isRequired,showCreateUserGroupModal:U().func.isRequired,invitePeopleModal:U().func.isRequired,showCreateCategoryModal:U().func.isRequired,canCreateChannel:U().bool.isRequired,canJoinPublicChannel:U().bool.isRequired,handleOpenDirectMessagesModal:U().func.isRequired,unreadFilterEnabled:U().bool.isRequired,canCreateCustomGroups:U().bool.isRequired};const Dn=On;var kn=a(14696),Fn=a(63669),xn=a(92243),Hn=a(32269),Un=a(4565),Bn=a(32721),qn=a(26562),jn=a(30138),Vn=a(4715);function Gn(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const zn="channel";class Wn extends L().PureComponent{constructor(e){super(e),Gn(this,"focusTextbox",(()=>{if(null===this.switchBox)return;const e=this.switchBox.getTextbox();document.activeElement!==e&&(e.focus(),$.PO(e))})),Gn(this,"setSwitchBoxRef",(e=>{this.switchBox=e,this.focusTextbox()})),Gn(this,"hideOnSelect",(()=>{this.focusPostTextbox(),this.setState({text:""}),this.props.onExited()})),Gn(this,"focusPostTextbox",(()=>{Vn.Fr()||setTimeout((()=>{const e=document.querySelector("#post_textbox");e&&e.focus()}))})),Gn(this,"hideOnCancel",(()=>{var e,t;null===(e=(t=this.props).onExited)||void 0===e||e.call(t),(0,jn.p)(this.props.focusOriginElement,!0)})),Gn(this,"onChange",(e=>{this.setState({text:e.target.value,shouldShowLoadingSpinner:!0})})),Gn(this,"handleSubmit",(async e=>{if(e)if(this.props.rhsOpen&&this.props.rhsState===Y._n.EDIT_HISTORY&&this.props.actions.closeRightHandSide(),this.state.mode===zn){const{joinChannelById:t,switchToChannel:a}=this.props.actions,n=e.channel;e.type===Y.Ay.MENTION_MORE_CHANNELS&&n.type===Y.Ay.OPEN_CHANNEL&&await t(n.id),a(n).then((e=>{"data"in e&&this.hideOnSelect()}))}else(0,Ot.J)().push("/"+e.name),this.hideOnSelect()})),Gn(this,"handleSuggestionsReceived",(e=>{const t=(0,Bn.zi)(e),a=t.some((e=>!(0,Bn.pb)(e)));this.setState({shouldShowLoadingSpinner:a,pretext:e.matchedPretext,hasSuggestions:t.length>0})})),Gn(this,"render",(()=>{const e=this.channelProviders,t=L().createElement("h2",{id:"quickSwitchHeader"},L().createElement(ce.FormattedMessage,{id:"quick_switch_modal.switchChannels",defaultMessage:"Find Channels"}));let a;a=this.props.isMobileView?L().createElement(ce.FormattedMessage,{id:"quick_switch_modal.help_mobile",defaultMessage:"Type to find a channel."}):L().createElement(ce.FormattedMessage,{id:"quickSwitchModal.help_no_team",defaultMessage:"Type to find a channel. Use <b>UP/DOWN</b> to browse, <b>ENTER</b> to select, <b>ESC</b> to dismiss.",values:{b:e=>L().createElement("b",null,e)}});const n=L().createElement("div",{className:"channel-switcher__header"},t),s=L().createElement("div",{className:"channel-switcher__hint",id:"quickSwitchHint"},a);return L().createElement(kn.zW,{className:"a11y__modal channel-switcher",id:"quickSwitchModal",show:!0,bodyPadding:!1,enforceFocus:!1,onExited:this.hideOnCancel,onHide:this.hideOnCancel,ariaLabel:this.props.intl.formatMessage({id:"quick_switch_modal.switchChannels",defaultMessage:"Find Channels"}),modalHeaderText:n,modalSubheaderText:s,compassDesign:!0},L().createElement("div",{className:"channel-switcher__suggestion-box"},L().createElement("i",{className:"icon icon-magnify icon-16"}),L().createElement(Hn.A,{ref:this.setSwitchBoxRef,id:"quickSwitchInput","aria-label":this.props.intl.formatMessage({id:"quick_switch_modal.input",defaultMessage:"quick switch input"}),className:"form-control focused",onChange:this.onChange,value:this.state.text,onItemSelected:this.handleSubmit,listComponent:Un.A,listPosition:"bottom",maxLength:"64",providers:e,completeOnTab:!1,spellCheck:"false",delayInputUpdate:!0,openWhenEmpty:!0,onSuggestionsReceived:this.handleSuggestionsReceived,forceSuggestionsWhenBlur:!0,shouldSearchCompleteText:!0}),!this.state.shouldShowLoadingSpinner&&!this.state.hasSuggestions&&this.state.text&&L().createElement(Fn.A,{variant:xn.L.Search,titleValues:{channelName:"".concat(this.state.pretext)}})))})),this.channelProviders=[new qn.Ay],this.switchBox=null,this.state={text:"",mode:zn,hasSuggestions:!0,shouldShowLoadingSpinner:!0,pretext:""}}}Gn(Wn,"propTypes",{onExited:U().func.isRequired,isMobileView:U().bool.isRequired,rhsOpen:U().bool,actions:U().shape({joinChannelById:U().func.isRequired,switchToChannel:U().func.isRequired,closeRightHandSide:U().func.isRequired}).isRequired,focusOriginElement:U().string.isRequired});const Kn=(0,ce.injectIntl)(Wn),Yn=(0,n.connect)((function(e){return{isMobileView:(0,V.w3)(e),rhsState:(0,d.bM)(e),rhsOpen:(0,d.A)(e)}}),(function(e){return{actions:(0,G.zH)({joinChannelById:c.yO,switchToChannel:c.BX,closeRightHandSide:ja.bP},e)}}))(Kn);var Jn=a(87131),Qn=a(61190);function Zn(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const Xn=(0,ce.defineMessages)({disableTooltip:{id:"sidebar_left.channel_filter.showAllChannels",defaultMessage:"Show all channels"},enableTooltip:{id:"sidebar_left.channel_filter.filterByUnread",defaultMessage:"Filter by unread"}}),$n={default:[Qn.f.ctrl,Qn.f.shift,"U"],mac:[Qn.f.cmd,Qn.f.shift,"U"]};class es extends L().PureComponent{constructor(){super(...arguments),Zn(this,"handleUnreadFilterClick",(e=>{null==e||e.preventDefault(),null==e||e.stopPropagation(),this.toggleUnreadFilter()})),Zn(this,"handleUnreadFilterKeyPress",(e=>{kt.r(e)&&e.shiftKey&&kt.e(e,Y.Ay.KeyCodes.U)&&(e.preventDefault(),e.stopPropagation(),this.toggleUnreadFilter())})),Zn(this,"toggleUnreadFilter",(()=>{const{unreadFilterEnabled:e}=this.props;this.props.actions.setUnreadFilterEnabled(!e)}))}componentDidMount(){document.addEventListener("keydown",this.handleUnreadFilterKeyPress)}componentWillUnmount(){document.removeEventListener("keydown",this.handleUnreadFilterKeyPress)}render(){const{intl:e,unreadFilterEnabled:t}=this.props,a=e.formatMessage({id:"sidebar_left.channel_filter.filterUnreadAria",defaultMessage:"unreads filter"});return L().createElement("div",{className:"SidebarFilters"},L().createElement(Jn.A,{title:t?Xn.disableTooltip:Xn.enableTooltip,shortcut:$n},L().createElement("a",{href:"#",className:q()("SidebarFilters_filterButton",{active:t}),onClick:this.toggleUnreadFilter,"aria-label":a},L().createElement("i",{className:"icon icon-filter-variant"}))))}}Zn(es,"propTypes",{unreadFilterEnabled:U().bool.isRequired,actions:U().shape({setUnreadFilterEnabled:U().func.isRequired}).isRequired});const ts=(0,ce.injectIntl)(es),as=(0,n.connect)((function(e){const t=(0,o.vt)(e);return{hasMultipleTeams:t&&t.length>1,unreadFilterEnabled:(0,Va.ZM)(e)}}),(function(e){return{actions:(0,G.zH)({setUnreadFilterEnabled:qa.zk},e)}}))(ts);function ns(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ss extends L().PureComponent{constructor(){super(...arguments),ns(this,"openQuickSwitcher",(e=>{e.preventDefault(),this.props.actions.openModal({modalId:Y.IQ.QUICK_SWITCH,dialogType:Yn,dialogProps:{focusOriginElement:"SidebarChannelNavigatorButton"}})})),ns(this,"handleShortcut",(e=>{const{actions:{closeModal:t}}=this.props;kt.r(e)&&e.shiftKey&&(kt.e(e,Y.Ay.KeyCodes.M)&&(e.preventDefault(),t(Y.IQ.QUICK_SWITCH)),kt.e(e,Y.Ay.KeyCodes.L)&&t(Y.IQ.QUICK_SWITCH))})),ns(this,"handleQuickSwitchKeyPress",(e=>{kt.r(e)&&!e.shiftKey&&kt.e(e,Y.Ay.KeyCodes.K)&&(e.altKey||$.Xz(e)||(e.preventDefault(),this.toggleQuickSwitchModal()))})),ns(this,"toggleQuickSwitchModal",(()=>{const{isQuickSwitcherOpen:e,actions:{openModal:t,closeModal:a}}=this.props;e?a(Y.IQ.QUICK_SWITCH):t({modalId:Y.IQ.QUICK_SWITCH,dialogType:Yn,dialogProps:{focusOriginElement:"SidebarChannelNavigatorButton"}})}))}componentDidMount(){document.addEventListener("keydown",this.handleShortcut),document.addEventListener("keydown",this.handleQuickSwitchKeyPress)}componentWillUnmount(){document.removeEventListener("keydown",this.handleShortcut),document.removeEventListener("keydown",this.handleQuickSwitchKeyPress)}render(){return L().createElement("div",{className:"SidebarChannelNavigator webapp"},!this.props.showUnreadsCategory&&L().createElement(as,null),L().createElement("button",{className:"SidebarChannelNavigator_jumpToButton",onClick:this.openQuickSwitcher,"aria-label":this.props.intl.formatMessage({id:"sidebar_left.channel_navigator.channelSwitcherLabel",defaultMessage:"Channel Switcher"}),"aria-haspopup":"dialog","data-testid":"SidebarChannelNavigatorButton",id:"SidebarChannelNavigatorButton"},L().createElement("i",{className:"icon icon-magnify"}),L().createElement(ce.FormattedMessage,{id:"sidebar_left.channel_navigator.jumpTo",defaultMessage:"Find channel"}),L().createElement("div",{className:"SidebarChannelNavigator_shortcutText"},"".concat(Vn.cX()?"⌘":"Ctrl+","K"))))}}ns(ss,"propTypes",{showUnreadsCategory:U().bool.isRequired,isQuickSwitcherOpen:U().bool.isRequired,actions:U().shape({openModal:U().func.isRequired,closeModal:U().func.isRequired}).isRequired});const rs=(0,ce.injectIntl)(ss),is=(0,n.connect)((function(e){return{showUnreadsCategory:(0,b.pE)(e),isQuickSwitcherOpen:(0,Ga.o)(e,Y.IQ.QUICK_SWITCH)}}),(function(e){return{actions:(0,G.zH)({openModal:Fa.q,closeModal:Fa.O},e)}}))(rs);var os=a(62563),ls=a(62844),cs=(a(6889),a(46177)),ds=a.n(cs),us=a(22005),ms=a(77234),hs=a(61452),ps=a(35631),gs=a(79342),fs=a(16602),bs=a(8907),Es=a(22789),Cs=a(19202);function vs(e){const t=(0,ce.useIntl)(),a=(0,P.useCallback)((()=>{e.actions.deleteCategory(e.category.id)}),[e.actions.deleteCategory,e.category]);return L().createElement(kn.zW,{compassDesign:!0,ariaLabel:t.formatMessage({id:"delete_category_modal.deleteCategory",defaultMessage:"Delete this category?"}),onExited:e.onExited,modalHeaderText:L().createElement(ce.FormattedMessage,{id:"delete_category_modal.deleteCategory",defaultMessage:"Delete this category?"}),handleCancel:e.onExited,handleConfirm:a,confirmButtonText:L().createElement(ce.FormattedMessage,{id:"delete_category_modal.delete",defaultMessage:"Delete"}),confirmButtonClassName:"delete"},L().createElement("span",{className:"delete-category__helpText"},L().createElement(ce.FormattedMessage,{id:"delete_category_modal.helpText",defaultMessage:"Channels in <b>{category_name}</b> will move back to the Channels and Direct messages categories. You're not removed from any channels.",values:{category_name:e.category.display_name,b:e=>L().createElement("b",null,e)}})))}vs.propTypes={onExited:U().func.isRequired,actions:U().shape({deleteCategory:U().func.isRequired}).isRequired},(0,ce.defineMessages)({cancel:{id:"generic_modal.cancel",defaultMessage:"Cancel"},confirm:{id:"generic_modal.confirm",defaultMessage:"Confirm"},paginationCount:{id:"footer_pagination.count",defaultMessage:"Showing {startCount, number}-{endCount, number} of {total, number}"},paginationNext:{id:"footer_pagination.next",defaultMessage:"Next"},paginationPrev:{id:"footer_pagination.prev",defaultMessage:"Previous"}});const ys=(0,n.connect)(null,(function(e){return{actions:(0,G.zH)({deleteCategory:Ha.K7},e)}}))(vs);var Ms=a(12555),_s=a(19174),Ts=a(51877),Ss=a(77813);const ws=e=>{let{category:t}=e;const a=(0,n.useDispatch)(),r=(0,n.useSelector)(b.pE),i=(0,P.useMemo)(Va.vk,[t]),o=(0,n.useSelector)((e=>i(e,t))),{formatMessage:l}=(0,ce.useIntl)();let c=null;if(t.type!==bs.e.DIRECT_MESSAGES){function C(){a((0,Ha.qh)(t.id,!t.muted))}c=L().createElement(hn.q7,{id:"mute-".concat(t.id),onClick:C,leadingElement:L().createElement(Ae.BellOutlineIcon,{size:18}),labels:t.muted?L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.unmuteCategory",defaultMessage:"Unmute Category"}):L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.muteCategory",defaultMessage:"Mute Category"})})}let d=null,u=null;if(t.type===bs.e.CUSTOM){function v(){a((0,Fa.q)({modalId:Y.IQ.DELETE_CATEGORY,dialogType:ys,dialogProps:{category:t}}))}function y(){a((0,Fa.q)({modalId:Y.IQ.EDIT_CATEGORY,dialogType:Ms.default,dialogProps:{categoryId:t.id,initialCategoryName:t.display_name}}))}d=L().createElement(hn.q7,{id:"delete-".concat(t.id),isDestructive:!0,"aria-haspopup":!0,onClick:v,leadingElement:L().createElement(Ae.TrashCanOutlineIcon,{size:18}),labels:L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.deleteCategory",defaultMessage:"Delete Category"})}),u=L().createElement(hn.q7,{id:"rename-".concat(t.id),onClick:y,"aria-haspopup":!0,leadingElement:L().createElement(Ae.PencilOutlineIcon,{size:18}),labels:L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category_menu.renameCategory",defaultMessage:"Rename Category"})})}function m(e){a((0,Ha.rV)(t.id,e))}let h=L().createElement(ce.FormattedMessage,{id:"sidebar.sortedManually",defaultMessage:"Manually"}),p=L().createElement(Ae.FormatListBulletedIcon,{size:18});t.sorting===fs.b.Alphabetical?(h=L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.sortAlpha",defaultMessage:"Alphabetically"}),p=L().createElement(Ae.SortAlphabeticalAscendingIcon,{size:18})):t.sorting===fs.b.Recency&&(h=L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.recent",defaultMessage:"Recent Activity"}),p=L().createElement(Ae.ClockOutlineIcon,{size:18}));const g=L().createElement(hn.g8,{id:"sortChannels-".concat(t.id),leadingElement:p,labels:L().createElement(ce.FormattedMessage,{id:"sidebar.sort",defaultMessage:"Sort"}),trailingElements:L().createElement(L().Fragment,null,h,L().createElement(Ae.ChevronRightIcon,{size:16})),menuId:"sortChannels-".concat(t.id,"-menu"),menuAriaLabel:l({id:"sidebar_left.sidebar_category_menu.sort.dropdownAriaLabel",defaultMessage:"Sort submenu"})},L().createElement(hn.q7,{id:"sortAplhabetical-".concat(t.id),labels:L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.sortAlpha",defaultMessage:"Alphabetically"}),onClick:()=>m(fs.b.Alphabetical),trailingElements:t.sorting===fs.b.Alphabetical?L().createElement(Ae.CheckIcon,{size:16}):null}),L().createElement(hn.q7,{id:"sortByMostRecent-".concat(t.id),labels:L().createElement(ce.FormattedMessage,{id:"sidebar.sortedByRecencyLabel",defaultMessage:"Recent Activity"}),onClick:()=>m(fs.b.Recency),trailingElements:t.sorting===fs.b.Recency?L().createElement(Ae.CheckIcon,{size:16}):null}),L().createElement(hn.q7,{id:"sortManual-".concat(t.id),labels:L().createElement(ce.FormattedMessage,{id:"sidebar.sortedManually",defaultMessage:"Manually"}),onClick:()=>m(fs.b.Manual),trailingElements:t.sorting===fs.b.Manual?L().createElement(Ae.CheckIcon,{size:16}):null})),f=(0,P.useCallback)((()=>{a((0,s.Zi)(o))}),[a,o]),E=!1===r?L().createElement(Ts.A,{id:t.id,handleViewCategory:f,numChannels:o.length}):null;return L().createElement(Ss.A,{id:t.id,name:t.display_name},E,E&&L().createElement(hn.wv,null),c,u,d,L().createElement(hn.wv,null),g,L().createElement(hn.wv,null),L().createElement(_s.A,{id:t.id}))},Is=(0,P.memo)(ws),As=e=>{let{category:t,handleOpenDirectMessagesModal:a}=e;const[s,r]=(0,P.useState)(!1),{formatMessage:i}=(0,ce.useIntl)(),o=(0,n.useDispatch)(),c=(0,n.useSelector)(b.pR),d=(0,n.useSelector)(l.WR);function u(e){o((0,Ha.rV)(t.id,e))}let m=L().createElement(Ae.ClockOutlineIcon,{size:18}),h=L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.recent",defaultMessage:"Recent Activity"});t.sorting===fs.b.Alphabetical&&(h=L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.sortAlpha",defaultMessage:"Alphabetically"}),m=L().createElement(Ae.SortAlphabeticalAscendingIcon,{size:18}));const p=L().createElement(hn.g8,{id:"sortDirectMessages-".concat(t.id),leadingElement:m,labels:L().createElement(ce.FormattedMessage,{id:"sidebar.sort",defaultMessage:"Sort"}),trailingElements:L().createElement(L().Fragment,null,h,L().createElement(Ae.ChevronRightIcon,{size:16})),menuId:"sortDirectMessages-".concat(t.id,"-menu")},L().createElement(hn.q7,{id:"sortAlphabetical-".concat(t.id),labels:L().createElement(ce.FormattedMessage,{id:"user.settings.sidebar.sortAlpha",defaultMessage:"Alphabetically"}),onClick:()=>u(fs.b.Alphabetical),trailingElements:t.sorting===fs.b.Alphabetical?L().createElement(Ae.CheckIcon,{size:16}):null}),L().createElement(hn.q7,{id:"sortByMostRecent-".concat(t.id),labels:L().createElement(ce.FormattedMessage,{id:"sidebar.sortedByRecencyLabel",defaultMessage:"Recent Activity"}),onClick:()=>u(fs.b.Recency),trailingElements:t.sorting===fs.b.Recency?L().createElement(Ae.CheckIcon,{size:16}):null}));let g=L().createElement("span",null,c);1e4===c&&(g=L().createElement(ce.FormattedMessage,{id:"channel_notifications.levels.all",defaultMessage:"All"}));const f=L().createElement(hn.g8,{id:"showMessagesCount-".concat(t.id),leadingElement:L().createElement(Ae.AccountMultipleOutlineIcon,{size:18}),labels:L().createElement(ce.FormattedMessage,{id:"sidebar.show",defaultMessage:"Show"}),trailingElements:L().createElement(L().Fragment,null,g,L().createElement(Ae.ChevronRightIcon,{size:16})),menuId:"showMessagesCount-".concat(t.id,"-menu")},Y.Ay.DM_AND_GM_SHOW_COUNTS.map((e=>L().createElement(hn.q7,{id:"showDmCount-".concat(t.id,"-").concat(e),key:"showDmCount-".concat(t.id,"-").concat(e),labels:L().createElement("span",null,e),onClick:()=>{return t=e,void o((0,ps.SF)(d,[{user_id:d,category:Y.Ay.Preferences.CATEGORY_SIDEBAR_SETTINGS,name:he.pm.LIMIT_VISIBLE_DMS_GMS,value:t.toString()}]));var t},trailingElements:c===e?L().createElement(Ae.CheckIcon,{size:16}):null})))),E=L().createElement(hn.q7,{id:"openDirectMessage-".concat(t.id),onClick:a,leadingElement:L().createElement(Ae.AccountPlusOutlineIcon,{size:18}),labels:L().createElement(ce.FormattedMessage,{id:"sidebar.openDirectMessage",defaultMessage:"Open a direct message"})});return L().createElement("div",{className:q()("SidebarMenu","MenuWrapper",{menuOpen:s},{"MenuWrapper--open":s})},L().createElement(hn.mc,{menuButton:{id:"SidebarCategorySortingMenu-Button-".concat(t.id),"aria-label":i({id:"sidebar_left.sidebar_category_menu.editCategory",defaultMessage:"Category options"},{name:t.display_name}),class:"SidebarMenu_menuButton sortingMenu",children:L().createElement(Ae.DotsVerticalIcon,{size:16})},menuButtonTooltip:{text:i({id:"sidebar_left.sidebar_category_menu.editCategory",defaultMessage:"Category options"},{name:t.display_name}),class:"hidden-xs"},menu:{id:"SidebarCategorySortingMenu-MenuList-".concat(t.id),"aria-label":i({id:"sidebar_left.sidebar_category_menu.dropdownAriaLabel",defaultMessage:"Edit category menu"}),onToggle:function(e){r(e)}}},p,f,L().createElement(hn.wv,null),E))},Ns=(0,P.memo)(As);function Rs(e){return e.views.addChannelCtaDropdown.isOpen}var Ps=a(52052),Ls=a(63234),Os=a(17983),Ds=a(99068);const ks=()=>{const e=(0,n.useDispatch)(),t=(0,n.useSelector)(o.Sy),a=(0,ce.useIntl)(),s=(0,n.useSelector)((e=>(0,b.Jz)(e,Y.pm.TOUCHED,Y.JS.ADD_CHANNELS_CTA))),r=(0,n.useSelector)((e=>(0,Ba.xY)(e,Ua.A.CREATE_PUBLIC_CHANNEL))),i=(0,n.useSelector)((e=>(0,Ba.xY)(e,Ua.A.CREATE_PRIVATE_CHANNEL)))||r,l=(0,n.useSelector)((e=>(0,Ba.xY)(e,Ua.A.JOIN_PUBLIC_CHANNELS))),c=(0,n.useSelector)(Rs),d=(0,n.useSelector)(f.WR),u=(0,P.useCallback)((t=>{e(function(e){return{type:Y.Q3.ADD_CHANNEL_CTA_DROPDOWN_TOGGLE,open:e}}(t))}),[]);let m="SidebarChannelNavigator__addChannelsCtaLhsButton";if(s||(m+=" SidebarChannelNavigator__addChannelsCtaLhsButton--untouched"),!i&&!l||!t)return null;const h=()=>{e((0,Fa.q)({modalId:Y.IQ.MORE_CHANNELS,dialogType:Ps.default}))},p=()=>{e((0,Fa.q)({modalId:Y.IQ.NEW_CHANNEL_MODAL,dialogType:Ls.default}))},g=e=>L().createElement("button",{className:m,id:"addChannelsCta","aria-label":a.formatMessage({id:"sidebar_left.add_channel_dropdown.dropdownAriaLabel",defaultMessage:"Add Channel Dropdown"}),onClick:()=>null==e?void 0:e()},L().createElement("div",{"aria-label":a.formatMessage({id:"sidebar_left.sidebar_channel_navigator.addChannelsCta",defaultMessage:"Add channels"})},L().createElement("i",{className:"icon-plus-box"}),L().createElement("span",null,a.formatMessage({id:"sidebar_left.addChannelsCta",defaultMessage:"Add Channels"})))),E=()=>{s||e((0,ps.SF)(d,[{category:Y.pm.TOUCHED,user_id:d,name:Y.JS.ADD_CHANNELS_CTA,value:"true"}]))};return i?L().createElement(Ds.A,{className:"AddChannelsCtaDropdown",onToggle:e=>{u(e),E()},open:c},g(),L().createElement(Os.A,{id:"AddChannelCtaDropdown",ariaLabel:a.formatMessage({id:"sidebar_left.add_channel_cta_dropdown.dropdownAriaLabel",defaultMessage:"Add Channels Dropdown"})},(()=>{let e,t;return l&&(e=L().createElement(Os.A.ItemAction,{id:"showMoreChannels",onClick:h,icon:L().createElement("i",{className:"icon-globe"}),text:a.formatMessage({id:"sidebar_left.add_channel_dropdown.browseChannels",defaultMessage:"Browse channels"})})),i&&(t=L().createElement(Os.A.ItemAction,{id:"showNewChannel",onClick:p,icon:L().createElement("i",{className:"icon-plus"}),text:a.formatMessage({id:"sidebar_left.add_channel_dropdown.createNewChannel",defaultMessage:"Create new channel"})})),L().createElement(L().Fragment,null,L().createElement(Os.A.Group,null,t,e))})())):g((()=>{h(),E()}))},Fs=e=>{const t=(0,ce.useIntl)(),a=(0,n.useSelector)(o.Sy);return a?L().createElement(qe.A,{teamId:a,permissions:[he.xB.ADD_USER_TO_TEAM,he.xB.INVITE_GUEST]},L().createElement(Ve.A,{ariaLabel:t.formatMessage({id:"sidebar_left.inviteMembers",defaultMessage:"Invite Members"}),id:"inviteMembersButton",className:"intro-links color--link cursor--pointer".concat(e.className?" ".concat(e.className):""),modalId:Y.IQ.INVITATION,dialogType:Ye.default,dialogProps:{focusOriginElement:"inviteMembersButton"}},L().createElement("div",{className:"SidebarChannelNavigator__inviteMembersLhsButton","aria-label":t.formatMessage({id:"sidebar_left.sidebar_channel_navigator.inviteUsers",defaultMessage:"Invite Members"})},L().createElement("i",{className:"icon-plus-box","aria-hidden":"true"}),L().createElement(ce.FormattedMessage,{id:"sidebar_left.inviteMembers",defaultMessage:"Invite Members"})))):null};Fs.propTypes={className:U().string};const xs=Fs;var Hs=a(66039),Us=a(69440);function Bs(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class qs extends L().PureComponent{constructor(e){super(e),Bs(this,"handleA11yActivateEvent",(()=>{var e;null===(e=this.categoryTitleRef.current)||void 0===e||e.addEventListener("keydown",this.handleA11yKeyDown),this.a11yKeyDownRegistered=!0})),Bs(this,"handleA11yDeactivateEvent",(()=>{var e;null===(e=this.categoryTitleRef.current)||void 0===e||e.removeEventListener("keydown",this.handleA11yKeyDown),this.a11yKeyDownRegistered=!1})),Bs(this,"handleA11yKeyDown",(e=>{(0,kt.e)(e,Y.Ay.KeyCodes.ENTER)&&(e.preventDefault(),this.handleCollapse())})),Bs(this,"renderChannel",((e,t)=>{const{setChannelRef:a,category:n,draggingState:s}=this.props;return L().createElement(Us.A,{key:e,channelIndex:t,channelId:e,isDraggable:!0,setChannelRef:a,isCategoryCollapsed:n.collapsed,isCategoryDragged:s.type===Y.I8.CATEGORY&&s.id===n.id,isAutoSortedCategory:n.sorting===fs.b.Alphabetical||n.sorting===fs.b.Recency})})),Bs(this,"handleCollapse",(()=>{const{category:e}=this.props;this.props.actions.setCategoryCollapsed(e.id,!e.collapsed)})),Bs(this,"removeAnimation",(()=>{this.newDropBoxRef.current&&this.newDropBoxRef.current.classList.remove("animating")})),Bs(this,"handleOpenDirectMessagesModal",(e=>{e.preventDefault(),this.props.handleOpenMoreDirectChannelsModal(e.nativeEvent)})),Bs(this,"isDropDisabled",(()=>{const{draggingState:e,category:t}=this.props;return t.type===bs.e.DIRECT_MESSAGES?e.type===Y.I8.CHANNEL:t.type===bs.e.CHANNELS&&e.type===Y.I8.DM})),Bs(this,"renderNewDropBox",(e=>{const{draggingState:t,category:a,isNewCategory:n,channelIds:s}=this.props;return!n||null!=s&&s.length?null:L().createElement(L().Fragment,null,L().createElement(us.Draggable,{draggableId:"NEW_CHANNEL_SPACER__".concat(a.id),isDragDisabled:!0,index:0},(e=>L().createElement("li",Object.assign({ref:e.innerRef,draggable:"false",className:"SidebarChannel noFloat newChannelSpacer"},e.draggableProps,{tabIndex:-1})))),L().createElement("div",{className:"SidebarCategory_newDropBox"},L().createElement("div",{ref:this.newDropBoxRef,className:q()("SidebarCategory_newDropBox-content",{collapsed:a.collapsed||t.type===Y.I8.CATEGORY&&t.id===a.id,isDraggingOver:e}),onTransitionEnd:this.removeAnimation},L().createElement("i",{className:"icon-hand-right"}),L().createElement("span",{className:"SidebarCategory_newDropBox-label"},L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category.newDropBoxLabel",defaultMessage:"Drag channels here..."})))))})),Bs(this,"showPlaceholder",(()=>{const{channelIds:e,draggingState:t,category:a,isNewCategory:n}=this.props;return a.sorting!==fs.b.Alphabetical&&a.sorting!==fs.b.Recency&&!n||!!e.find((e=>e===t.id))})),this.categoryTitleRef=L().createRef(),this.newDropBoxRef=L().createRef(),this.state={isMenuOpen:!1},this.a11yKeyDownRegistered=!1}componentDidUpdate(e){this.props.category.collapsed!==e.category.collapsed&&this.newDropBoxRef.current&&this.newDropBoxRef.current.classList.add("animating")}componentDidMount(){var e,t;null===(e=this.categoryTitleRef.current)||void 0===e||e.addEventListener(Y.pn.ACTIVATE,this.handleA11yActivateEvent),null===(t=this.categoryTitleRef.current)||void 0===t||t.addEventListener(Y.pn.DEACTIVATE,this.handleA11yDeactivateEvent)}componentWillUnmount(){var e,t;null===(e=this.categoryTitleRef.current)||void 0===e||e.removeEventListener(Y.pn.ACTIVATE,this.handleA11yActivateEvent),null===(t=this.categoryTitleRef.current)||void 0===t||t.removeEventListener(Y.pn.DEACTIVATE,this.handleA11yDeactivateEvent),this.a11yKeyDownRegistered&&this.handleA11yDeactivateEvent()}render(){const{category:e,categoryIndex:t,channelIds:a,isNewCategory:n}=this.props;if(!e)return null;if(e.type===bs.e.FAVORITES&&(null==a||!a.length))return null;const s=a.map(this.renderChannel);let r,i,o=!0;if(n)i=L().createElement("div",{className:"SidebarCategory_newLabel"},L().createElement(ce.FormattedMessage,{id:"sidebar_left.sidebar_category.newLabel",defaultMessage:"new"})),r=L().createElement(Is,{category:e});else if(e.type===bs.e.DIRECT_MESSAGES){const t=(0,Es.V)({id:"sidebar.createDirectMessage",defaultMessage:"Create new direct message"});r=L().createElement(L().Fragment,null,L().createElement(Ns,{category:e,handleOpenDirectMessagesModal:this.handleOpenDirectMessagesModal}),L().createElement(Jn.A,{title:L().createElement(L().Fragment,null,t,L().createElement(Cs.h,{shortcut:Cs.A.navDMMenu,hideDescription:!0,isInsideTooltip:!0}))},L().createElement("button",{id:"newDirectMessageButton",className:"SidebarChannelGroupHeader_addButton",onClick:this.handleOpenDirectMessagesModal,"aria-label":t},L().createElement("i",{className:"icon-plus"})))),a&&a.length||(o=!1)}else r=L().createElement(Is,{category:e});let l=e.display_name;if(e.type!==bs.e.CUSTOM){const t=js[e.type];l=(0,Es.V)({id:t.id,defaultMessage:t.defaultMessage})}return L().createElement(us.Draggable,{draggableId:e.id,index:t,disableInteractiveElementBlocking:!0},((t,a)=>{let n=null;"direct_messages"!==e.type||e.collapsed||(n=L().createElement(xs,{className:"followingSibling"}));let c=null;return"channels"!==e.type||e.collapsed||(c=L().createElement(ks,null)),L().createElement("div",Object.assign({className:q()("SidebarChannelGroup a11y__section",{dropDisabled:this.isDropDisabled(),menuIsOpen:this.state.isMenuOpen,capture:this.props.draggingState.state===Y.W7.CAPTURE,isCollapsed:e.collapsed}),ref:t.innerRef},t.draggableProps),L().createElement(us.Droppable,{droppableId:e.id,type:"SIDEBAR_CHANNEL",isDropDisabled:this.isDropDisabled()},((n,c)=>L().createElement("div",Object.assign({},n.droppableProps,{ref:n.innerRef,className:q()({draggingOver:c.isDraggingOver})}),L().createElement(Hs.w,{ref:this.categoryTitleRef,displayName:l,dragHandleProps:t.dragHandleProps,isCollapsed:e.collapsed,isCollapsible:o,isDragging:a.isDragging,isDraggingOver:c.isDraggingOver,muted:e.muted,onClick:this.handleCollapse},i,null,r),L().createElement("div",{className:q()("SidebarChannelGroup_content")},L().createElement("ul",{className:"NavGroupContent"},this.renderNewDropBox(c.isDraggingOver),s,this.showPlaceholder()?n.placeholder:null))))),n,c)}))}}const js=(0,ce.defineMessages)({channels:{id:"sidebar.types.channels",defaultMessage:"CHANNELS"},direct_messages:{id:"sidebar.types.direct_messages",defaultMessage:"DIRECT MESSAGES"},favorites:{id:"sidebar.types.favorites",defaultMessage:"FAVORITES"}}),Vs=(0,n.connect)((function(){const e=(0,Va._)();return(t,a)=>({channelIds:e(t,a.category),draggingState:(0,Va.NX)(t),currentUserId:(0,l.WR)(t),isAdmin:(0,gs.qc)((0,l.HW)(t).roles)})}),(function(e){return{actions:(0,G.zH)({setCategoryCollapsed:Ha.AD,setCategorySorting:Ha.rV,savePreferences:ps.SF},e)}}))(qs);function Gs(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const zs=(0,x.S)("DraftsLink",(0,P.lazy)((()=>a.e(2539).then(a.bind(a,22539))))),Ws=(0,x.S)("GlobalThreadsLink",(0,P.lazy)((()=>a.e(7351).then(a.bind(a,31551))))),Ks=(0,x.S)("UnreadChannelIndicator",(0,P.lazy)((()=>a.e(4986).then(a.bind(a,4986))))),Ys=(0,x.S)("UnreadChannels",(0,P.lazy)((()=>a.e(4526).then(a.bind(a,34526)))));class Js extends L().PureComponent{constructor(e){var t;super(e),t=this,Gs(this,"getDisplayedChannelIds",(()=>this.props.displayedChannels.map((e=>e.id)))),Gs(this,"getDisplayedStaticPageIds",(()=>this.props.staticPages.map((e=>e.id)))),Gs(this,"setChannelRef",((e,t)=>{t?this.channelRefs.set(e,t):this.channelRefs.delete(e)})),Gs(this,"getFirstUnreadChannelFromChannelIdArray",(e=>e.find((e=>e!==this.props.currentChannelId&&this.props.unreadChannelIds.includes(e))))),Gs(this,"handleScrollAnimationUpdate",(e=>{var t,a;const n=e.getCurrentValue();null===(t=(a=this.scrollbar.current).scrollTo)||void 0===t||t.call(a,{top:n})})),Gs(this,"scrollToFirstUnreadChannel",(()=>{this.scrollToChannel(this.getFirstUnreadChannel(),!0)})),Gs(this,"scrollToLastUnreadChannel",(()=>{this.scrollToChannel(this.getLastUnreadChannel(),!0)})),Gs(this,"scrollToChannel",(function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return;const n=t.channelRefs.get(e);if(!n)return;const s=n.offsetTop,r=s+n.offsetHeight,i=t.scrollbar.current.scrollTop,o=t.scrollbar.current.clientHeight;if(s<i+32){const n=a||!t.state.showTopUnread?10:55;let r;const i=t.getDisplayedChannelIds();r=i.length>0&&i[0]===e?0:s-n-32,t.scrollToPosition(r)}else if(r>i+o){const e=r-o+(a||!t.state.showBottomUnread?10:55);t.scrollToPosition(e)}})),Gs(this,"scrollToPosition",(e=>{this.scrollAnimation.setCurrentValue(this.scrollbar.current.scrollTop).setAtRest(),this.scrollAnimation.setEndValue(e)})),Gs(this,"updateUnreadIndicators",(()=>{if(this.props.draggingState.state)return void this.setState({showTopUnread:!1,showBottomUnread:!1});let e=!1,t=!1;const a=this.getFirstUnreadChannel(),n=this.getLastUnreadChannel();if(a){const t=this.channelRefs.get(a);t&&t.offsetTop+t.offsetHeight-10-32<this.scrollbar.current.scrollTop&&(e=!0)}if(n){const e=this.channelRefs.get(n);e&&e.offsetTop+10>this.scrollbar.current.scrollTop+this.scrollbar.current.clientHeight&&(t=!0)}e===this.state.showTopUnread&&t===this.state.showBottomUnread||this.setState({showTopUnread:e,showBottomUnread:t})})),Gs(this,"getFirstUnreadChannel",(()=>this.getFirstUnreadChannelFromChannelIdArray(this.getDisplayedChannelIds()))),Gs(this,"getLastUnreadChannel",(()=>this.getFirstUnreadChannelFromChannelIdArray(this.getDisplayedChannelIds().reverse()))),Gs(this,"navigateById",(e=>{-1===this.props.staticPages.findIndex((t=>t.id===e))?this.props.actions.switchToChannelById(e):this.props.actions.switchToLhsStaticPage(e)})),Gs(this,"navigateChannelShortcut",(e=>{if(!e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||!(0,kt.e)(e,Y.YM.KeyCodes.UP)&&!(0,kt.e)(e,Y.YM.KeyCodes.DOWN))(0,kt.r)(e)&&e.shiftKey&&(0,kt.e)(e,Y.YM.KeyCodes.K)&&this.props.handleOpenMoreDirectChannelsModal(e);else{e.preventDefault();const t=this.getDisplayedStaticPageIds(),a=[...t,...this.getDisplayedChannelIds()],n=this.props.currentChannelId||this.props.currentStaticPageId,s=a.indexOf(n);let r;r=(0,kt.e)(e,Y.YM.KeyCodes.DOWN)?s+1:s-1;const i=a[(0,$.zi)(r,a.length)];this.navigateById(i),r>=t.length&&this.scrollToChannel(i)}})),Gs(this,"navigateUnreadChannelShortcut",(e=>{if(e.altKey&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&((0,kt.e)(e,Y.YM.KeyCodes.UP)||(0,kt.e)(e,Y.YM.KeyCodes.DOWN))){e.preventDefault();const t=this.getDisplayedChannelIds(),a=[...this.props.unreadChannelIds];this.props.collapsedThreads&&(t.unshift(""),this.props.hasUnreadThreads&&a.unshift(""));let n=0;n=(0,kt.e)(e,Y.YM.KeyCodes.UP)?-1:1;const s=(0,X.y9)(this.props.currentChannelId,t,a,n);if(-1!==s){const e=t[s];this.navigateById(e),this.scrollToChannel(e)}}})),Gs(this,"renderCategory",((e,t)=>L().createElement(Vs,{key:e.id,category:e,categoryIndex:t,setChannelRef:this.setChannelRef,handleOpenMoreDirectChannelsModal:this.props.handleOpenMoreDirectChannelsModal,isNewCategory:this.props.newCategoryIds.includes(e.id)}))),Gs(this,"onScroll",ds()((()=>{this.updateUnreadIndicators()}),100)),Gs(this,"onTransitionEnd",ds()((()=>{this.updateUnreadIndicators()}),100)),Gs(this,"onBeforeCapture",(e=>{this.channelRefs.forEach((e=>e.classList.remove("animating")));const t=[...document.querySelectorAll('[data-rbd-droppable-id*="droppable-categories"]')];t[0].style.height="".concat(t[0].scrollHeight,"px"),this.props.multiSelectedChannelIds.find((t=>e.draggableId===t))||this.props.actions.clearChannelSelection();const a={state:Y.W7.CAPTURE,id:e.draggableId};if(this.props.categories.some((t=>t.id===e.draggableId)))a.type=Y.I8.CATEGORY;else{const t=this.props.displayedChannels.filter((t=>-1!==this.props.multiSelectedChannelIds.indexOf(t.id)||t.id===e.draggableId));t.every((e=>e.type===he.Bz.DM_CHANNEL||e.type===he.Bz.GM_CHANNEL))?a.type=Y.I8.DM:t.every((e=>e.type!==he.Bz.DM_CHANNEL&&e.type!==he.Bz.GM_CHANNEL))?a.type=Y.I8.CHANNEL:a.type=Y.I8.MIXED_CHANNELS}this.props.actions.setDraggingState(a)})),Gs(this,"onBeforeDragStart",(()=>{this.props.actions.setDraggingState({state:Y.W7.BEFORE})})),Gs(this,"onDragStart",(e=>{this.props.onDragStart(e),this.props.actions.setDraggingState({state:Y.W7.DURING}),[...document.querySelectorAll('[data-rbd-droppable-id*="droppable-categories"]')][0].style.height=""})),Gs(this,"onDragEnd",(e=>{this.props.onDragEnd(e),"DROP"===e.reason&&e.destination&&("SIDEBAR_CHANNEL"===e.type?this.props.actions.moveChannelsInSidebar(e.destination.droppableId,e.destination.index,e.draggableId):"SIDEBAR_CATEGORY"===e.type&&this.props.actions.moveCategory(this.props.currentTeam.id,e.draggableId,e.destination.index)),this.props.actions.stopDragging()})),this.channelRefs=new Map,this.state={showTopUnread:!1,showBottomUnread:!1},this.scrollbar=L().createRef(),this.animate=new ms.SpringSystem,this.scrollAnimation=this.animate.createSpring(),this.scrollAnimation.setOvershootClampingEnabled(!0),this.scrollAnimation.addListener({onSpringUpdate:this.handleScrollAnimationUpdate})}componentDidMount(){document.addEventListener("keydown",this.navigateChannelShortcut),document.addEventListener("keydown",this.navigateUnreadChannelShortcut)}componentWillUnmount(){document.removeEventListener("keydown",this.navigateChannelShortcut),document.removeEventListener("keydown",this.navigateUnreadChannelShortcut)}componentDidUpdate(e){this.props.currentChannelId&&e.currentChannelId&&(this.props.currentTeam!==e.currentTeam&&this.scrollbar.current.scrollTo({top:0}),this.props.currentChannelId,e.currentChannelId,this.props.currentChannelId!==e.currentChannelId&&this.props.actions.close(),this.updateUnreadIndicators())}render(){const{categories:e}=this.props;let t;if(this.props.isUnreadFilterEnabled)t=L().createElement(Ys,{setChannelRef:this.setChannelRef});else{let a;this.props.showUnreadsCategory&&(a=L().createElement(Ys,{setChannelRef:this.setChannelRef}));const n=e.map(this.renderCategory);t=L().createElement(L().Fragment,null,a,L().createElement(us.DragDropContext,{onDragEnd:this.onDragEnd,onBeforeDragStart:this.onBeforeDragStart,onBeforeCapture:this.onBeforeCapture,onDragStart:this.onDragStart},L().createElement(us.Droppable,{droppableId:"droppable-categories",type:"SIDEBAR_CATEGORY"},(e=>L().createElement("div",Object.assign({id:"sidebar-droppable-categories",ref:e.innerRef},e.droppableProps),n,e.placeholder)))))}const a=L().createElement(ce.FormattedMessage,{id:"sidebar.unreads",defaultMessage:"More unreads"}),n=L().createElement(ce.FormattedMessage,{id:"sidebar.unreads",defaultMessage:"More unreads"}),s=this.props.intl.formatMessage({id:"accessibility.sections.lhsList",defaultMessage:"channel sidebar region"});return L().createElement(L().Fragment,null,L().createElement(Ws,null),L().createElement(zs,null),L().createElement("div",{id:"sidebar-left",role:"application","aria-label":s,className:q()("SidebarNavContainer a11y__region",{disabled:this.props.isUnreadFilterEnabled}),"data-a11y-disable-nav":Boolean(this.props.draggingState.type),"data-a11y-sort-order":"7",onTransitionEnd:this.onTransitionEnd},L().createElement(Ks,{name:"Top",show:this.state.showTopUnread,onClick:this.scrollToFirstUnreadChannel,extraClass:"nav-pills__unread-indicator-top",content:a}),L().createElement(Ks,{name:"Bottom",show:this.state.showBottomUnread,onClick:this.scrollToLastUnreadChannel,extraClass:"nav-pills__unread-indicator-bottom",content:n}),L().createElement(hs.A,{ref:this.scrollbar,onScroll:this.onScroll},t)))}}Gs(Js,"propTypes",{currentChannelId:U().string.isRequired,categories:U().array.isRequired,unreadChannelIds:U().arrayOf(U().string).isRequired,isUnreadFilterEnabled:U().bool.isRequired,displayedChannels:U().array.isRequired,newCategoryIds:U().arrayOf(U().string).isRequired,multiSelectedChannelIds:U().arrayOf(U().string).isRequired,showUnreadsCategory:U().bool.isRequired,collapsedThreads:U().bool.isRequired,hasUnreadThreads:U().bool.isRequired,currentStaticPageId:U().string.isRequired,staticPages:U().array.isRequired,handleOpenMoreDirectChannelsModal:U().func.isRequired,onDragStart:U().func.isRequired,onDragEnd:U().func.isRequired,actions:U().shape({moveChannelsInSidebar:U().func.isRequired,moveCategory:U().func.isRequired,switchToChannelById:U().func.isRequired,switchToLhsStaticPage:U().func.isRequired,close:U().func.isRequired,setDraggingState:U().func.isRequired,stopDragging:U().func.isRequired,clearChannelSelection:U().func.isRequired}).isRequired});const Qs=(0,ce.injectIntl)(Js),Zs=(0,n.connect)((function(e){const t=(0,o.H7)(e),a=(0,b.WW)(e);let n=!1;var s;return a&&(n=Boolean(null===(s=(0,os.kL)(e))||void 0===s?void 0:s.total_unread_threads)),{currentTeam:t,currentChannelId:(0,r.eH)(e),categories:(0,Va.WJ)(e),isUnreadFilterEnabled:(0,Va.ZM)(e),unreadChannelIds:(0,r.tr)(e),displayedChannels:(0,Va.sC)(e),draggingState:(0,Va.NX)(e),newCategoryIds:e.views.channelSidebar.newCategoryIds,multiSelectedChannelIds:e.views.channelSidebar.multiSelectedChannelIds,showUnreadsCategory:(0,b.pE)(e),collapsedThreads:a,hasUnreadThreads:n,currentStaticPageId:(0,W.SM)(e),staticPages:(0,W.j4)(e)}}),(function(e){return{actions:(0,G.zH)({close:ls.VN,switchToChannelById:c.Tw,moveChannelsInSidebar:qa.nh,moveCategory:Ha.Ax,setDraggingState:qa.Jb,stopDragging:qa.U5,clearChannelSelection:qa.lE,switchToLhsStaticPage:ls.S_},e)}}))(Qs);function Xs(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const $s=(0,x.S)("MobileSidebarHeader",(0,P.lazy)((()=>a.e(5808).then(a.bind(a,25808))))),er=(0,x.S)("MoreDirectChannels",(0,P.lazy)((()=>a.e(6532).then(a.bind(a,96532))))),tr=(0,x.S)("BrowseChannels",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,52052))))),ar=(0,x.S)("EditCategoryModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,12555))))),nr=(0,x.S)("CreateUserGroupsModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,36143))))),sr=(0,x.S)("InvitationModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,49888))))),rr=(0,x.S)("KeyboardShortcutsModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,92904))))),ir=(0,x.S)("NewChannelModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,63234))))),or=(0,x.S)("UserSettingsModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,59529)))));class lr extends L().PureComponent{constructor(e){super(e),Xs(this,"handleClickClearChannelSelection",(e=>{e.defaultPrevented||this.props.actions.clearChannelSelection()})),Xs(this,"handleKeyDownEvent",(e=>{(0,kt.e)(e,Y.Ay.KeyCodes.ESCAPE)?this.props.actions.clearChannelSelection():(0,kt.r)(e,!0)&&((0,kt.e)(e,Y.Ay.KeyCodes.FORWARD_SLASH)?(e.preventDefault(),this.props.isKeyBoardShortcutModalOpen?this.props.actions.closeModal(Y.IQ.KEYBOARD_SHORTCUTS_MODAL):this.props.actions.openModal({modalId:Y.IQ.KEYBOARD_SHORTCUTS_MODAL,dialogType:rr})):(0,kt.e)(e,Y.Ay.KeyCodes.A)&&e.shiftKey&&(e.preventDefault(),this.props.actions.openModal({modalId:Y.IQ.USER_SETTINGS,dialogType:or,dialogProps:{isContentProductSettings:!0,focusOriginElement:"sidebar.tsx"}})))})),Xs(this,"showMoreDirectChannelsModal",(()=>{this.setState({showDirectChannelsModal:!0})})),Xs(this,"hideMoreDirectChannelsModal",(()=>{this.setState({showDirectChannelsModal:!1})})),Xs(this,"showCreateCategoryModal",(()=>{this.props.actions.openModal({modalId:Y.IQ.EDIT_CATEGORY,dialogType:ar,dialogProps:{}})})),Xs(this,"showMoreChannelsModal",(()=>{this.props.actions.openModal({modalId:Y.IQ.MORE_CHANNELS,dialogType:tr})})),Xs(this,"invitePeopleModal",(()=>{this.props.actions.openModal({modalId:Y.IQ.INVITATION,dialogType:sr,dialogProps:{focusOriginElement:"browseOrAddChannelMenuButton"}})})),Xs(this,"showNewChannelModal",(()=>{this.props.actions.openModal({modalId:Y.IQ.NEW_CHANNEL_MODAL,dialogType:ir}),this.closeEditRHS()})),Xs(this,"showCreateUserGroupModal",(()=>{this.props.actions.openModal({modalId:Y.IQ.USER_GROUPS_CREATE,dialogType:nr})})),Xs(this,"handleOpenMoreDirectChannelsModal",(e=>{null==e||e.preventDefault(),this.state.showDirectChannelsModal?this.hideMoreDirectChannelsModal():(this.showMoreDirectChannelsModal(),this.closeEditRHS())})),Xs(this,"onDragStart",(()=>{this.setState({isDragging:!0})})),Xs(this,"onDragEnd",(()=>{this.setState({isDragging:!1})})),Xs(this,"renderModals",(()=>{let e;return this.state.showDirectChannelsModal&&(e=L().createElement(er,{onModalDismissed:this.hideMoreDirectChannelsModal,isExistingChannel:!1,focusOriginElement:"newDirectMessageButton"})),L().createElement(L().Fragment,null,e)})),Xs(this,"closeEditRHS",(()=>{this.props.rhsOpen&&this.props.rhsState===Y._n.EDIT_HISTORY&&this.props.actions.closeRightHandSide()})),this.state={showDirectChannelsModal:!1,isDragging:!1}}componentDidMount(){this.props.teamId&&this.props.actions.fetchMyCategories(this.props.teamId),window.addEventListener("click",this.handleClickClearChannelSelection),window.addEventListener("keydown",this.handleKeyDownEvent)}componentDidUpdate(e){this.props.teamId&&e.teamId!==this.props.teamId&&this.props.actions.fetchMyCategories(this.props.teamId)}componentWillUnmount(){window.removeEventListener("click",this.handleClickClearChannelSelection),window.removeEventListener("keydown",this.handleKeyDownEvent)}render(){if(!this.props.teamId)return L().createElement("div",null);const e=(0,$.Vw)({id:"accessibility.sections.lhsNavigator",defaultMessage:"channel navigator region"});return L().createElement(ln,{id:"SidebarContainer",className:q()({"move--right":this.props.isOpen&&this.props.isMobileView,dragging:this.state.isDragging})},this.props.isMobileView?L().createElement($s,null):L().createElement(Dn,{showNewChannelModal:this.showNewChannelModal,showMoreChannelsModal:this.showMoreChannelsModal,showCreateUserGroupModal:this.showCreateUserGroupModal,invitePeopleModal:this.invitePeopleModal,showCreateCategoryModal:this.showCreateCategoryModal,canCreateChannel:this.props.canCreatePrivateChannel||this.props.canCreatePublicChannel,canJoinPublicChannel:this.props.canJoinPublicChannel,handleOpenDirectMessagesModal:this.handleOpenMoreDirectChannelsModal,unreadFilterEnabled:this.props.unreadFilterEnabled,canCreateCustomGroups:this.props.canCreateCustomGroups}),L().createElement("div",{id:"lhsNavigator",role:"application","aria-label":e,className:"a11y__region","data-a11y-sort-order":"6"},L().createElement(is,null)),L().createElement("div",{className:"sidebar--left__icons"},L().createElement(qt.default,{pluggableName:"LeftSidebarHeader"})),L().createElement(Zs,{handleOpenMoreDirectChannelsModal:this.handleOpenMoreDirectChannelsModal,onDragStart:this.onDragStart,onDragEnd:this.onDragEnd}),L().createElement(nn,null),this.renderModals())}}Xs(lr,"propTypes",{teamId:U().string.isRequired,canCreatePublicChannel:U().bool.isRequired,canCreatePrivateChannel:U().bool.isRequired,canJoinPublicChannel:U().bool.isRequired,isOpen:U().bool.isRequired,actions:U().shape({fetchMyCategories:U().func.isRequired,openModal:U().func.isRequired,closeModal:U().func.isRequired,clearChannelSelection:U().func.isRequired,closeRightHandSide:U().func.isRequired}).isRequired,unreadFilterEnabled:U().bool.isRequired,isMobileView:U().bool.isRequired,isKeyBoardShortcutModalOpen:U().bool.isRequired,canCreateCustomGroups:U().bool.isRequired,rhsOpen:U().bool});const cr=(0,n.connect)((function(e){const t=(0,o.H7)(e),a=(0,Va.ZM)(e);let n=!1,s=!1,r=!1;t&&(n=(0,Ba.xY)(e,Ua.A.CREATE_PUBLIC_CHANNEL),s=(0,Ba.xY)(e,Ua.A.CREATE_PRIVATE_CHANNEL),r=(0,Ba.xY)(e,Ua.A.JOIN_PUBLIC_CHANNELS));const i=(0,b.h7)(e)&&(0,Ba.y4)(e,{permission:Ua.A.CREATE_CUSTOM_GROUP});return{teamId:t?t.id:"",canCreatePrivateChannel:s,canCreatePublicChannel:n,canJoinPublicChannel:r,isOpen:(0,W.Cu)(e),unreadFilterEnabled:a,isMobileView:(0,V.w3)(e),isKeyBoardShortcutModalOpen:(0,Ga.o)(e,Y.IQ.KEYBOARD_SHORTCUTS_MODAL),canCreateCustomGroups:i,rhsState:(0,d.bM)(e),rhsOpen:(0,d.A)(e)}}),(function(e){return{actions:(0,G.zH)({clearChannelSelection:qa.lE,fetchMyCategories:Ha.pQ,openModal:Fa.q,closeModal:Fa.O,closeRightHandSide:ja.bP},e)}}))(lr);var dr=a(34574);const ur=()=>{const e=(0,n.useDispatch)(),t=(0,n.useSelector)(b.WW),a=(0,P.useRef)(!1);return(0,P.useEffect)((()=>{a.current?e((0,dr.Eq)()):a.current=!0}),[t]),null};var mr=a(82203);const hr=(0,x.S)("ProductNoticesModal",(0,P.lazy)((()=>a.e(452).then(a.bind(a,20452))))),pr=(0,x.S)("ResetStatusModal",(0,P.lazy)((()=>Promise.resolve().then(a.bind(a,58737))))),gr=(0,x.S)("MobileSidebarRight",(0,P.lazy)((()=>a.e(4302).then(a.bind(a,4302))))),fr=["app__body","channel-view"];function br(e){const t=(0,n.useSelector)(V.w3),a=(0,n.useSelector)(f.F4),s=(0,n.useDispatch)();return(0,P.useEffect)((()=>{var e;const t=(0,Vn.VN)()||(0,Vn.UP)(),{navigator:a}=window,n=(null==a||null===(e=a.userAgentData)||void 0===e?void 0:e.platform)||(null==a?void 0:a.platform)||"unknown";return document.body.classList.add(...function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const a=[...fr];return"Win32"===e||"Win64"===e?a.push("os--windows"):"MacIntel"!==e&&"MacPPC"!==e||a.push("os--mac"),t&&a.push("browser--ie"),a}(n,t)),()=>{document.body.classList.remove(...fr),s((0,j.uF)())}}),[]),(0,P.useEffect)((()=>{let e;return a&&(e=setInterval((()=>{s((0,E.I8)())}),Y.YM.STATUS_INTERVAL)),()=>{clearInterval(e)}}),[a]),L().createElement(L().Fragment,null,L().createElement(ur,null),L().createElement(xa,null),L().createElement(cr,null),L().createElement("div",{id:"channel_view",className:"channel-view","data-testid":"channel_view"},L().createElement(mr.A,null),L().createElement(hr,null),L().createElement("div",{className:q()("container-fluid channel-view-inner")},e.shouldRenderCenterChannel?L().createElement(ka,null):L().createElement(me.A,{centered:!0}),L().createElement(qt.default,{pluggableName:"Root"}),L().createElement(pr,null))),t&&L().createElement(gr,null))}br.propTypes={shouldRenderCenterChannel:U().bool.isRequired};var Er=a(854),Cr=a(51881);const vr=(0,x.S)("BackstageController",(0,P.lazy)((()=>a.e(6347).then(a.bind(a,80342))))),yr=(0,x.n)();var Mr=A()(yr).withConfig({displayName:"_StyledPluggable"})({gridArea:"center"});function _r(e){var t;const a=(0,n.useDispatch)(),s=(0,O.useHistory)(),{team:r}=(0,O.useParams)(),[i,o]=(0,P.useState)(!1),[c,d]=(0,P.useState)(Tr(e.teamsList,r)),u=(0,n.useSelector)(k.Up),m=(0,P.useRef)(Date.now()),h=(0,P.useRef)(Date.now());async function p(t,a){d(null);const{data:n,error:r}=await e.joinTeam(t,a);r?s.push("/error?type=team_not_found"):n&&d(n)}(function(){var e,t;const a=(0,n.useSelector)(l.HW),s=null!==(e=null==a?void 0:a.id)&&void 0!==e?e:"",r=null!==(t=null==a?void 0:a.roles)&&void 0!==t?t:"";(0,P.useEffect)((()=>{s&&J.mT.setUserId(s),r&&J.mT.setUserRoles(r)}),[s,r])})(),(0,P.useEffect)((()=>{Er.A.stop("team_controller"),Cr.h.reactAppInitialized(),e.fetchAllMyChannelMembers(),async function(){await e.fetchAllMyTeamsChannels(),o(!0)}()}),[]),(0,P.useEffect)((()=>{if(e.disableWakeUpReconnectHandler)return()=>{};const t=setInterval((()=>{const e=Date.now();e-h.current>6e4&&(console.log("computer woke up - reconnecting"),(0,F.M6)()),h.current=e}),3e4);return()=>{clearInterval(t)}}),[e.disableWakeUpReconnectHandler]),(0,P.useEffect)((()=>{function t(){window.isActive=!0,e.markAsReadOnFocus(),e.disableRefetchingOnBrowserFocus||Date.now()-m.current>12e4&&e.currentTeamId&&e.fetchChannelsAndMembers(e.currentTeamId)}function a(){window.isActive=!1,m.current=Date.now(),e.unsetActiveChannelOnServer()}function n(e){if(e.shiftKey&&(0,kt.r)(e)&&(0,kt.e)(e,Y.Ay.KeyCodes.L)){const e=document.querySelector("#sidebar-right.is-open.expanded #reply_textbox");if(e)e.focus();else{const e=document.getElementById("post_textbox");e&&e.focus()}}}return window.addEventListener("focus",t),window.addEventListener("blur",a),window.addEventListener("keydown",n),()=>{window.removeEventListener("focus",t),window.removeEventListener("blur",a),window.removeEventListener("keydown",n)}}),[e.currentTeamId]),(0,P.useEffect)((()=>{u&&e.currentTeamId&&a((0,D.CY)(e.currentTeamId))}),[u,a,e.currentTeamId]),(0,P.useEffect)((()=>{const e=(0,Vn.ux)();return e&&R().enable(),window.isActive=!0,v.A.setTeamIdJoinedOnLoad(null),()=>{window.isActive=!1,e&&R().disable()}}),[]);const g=e.teamsList.map((e=>e.id)).sort().join("+");if((0,P.useEffect)((()=>{if(r){if(Y.Ay.RESERVED_TEAM_NAMES.includes(r))return;const t=Tr(e.teamsList,r);t?async function(t){const{data:a,error:n}=await e.initializeTeam(t);n?s.push("/error?type=team_not_found"):a&&d(a)}(t):c&&c.name!==r?p(r,!1):c||p(r,!0)}}),[r,g]),e.mfaRequired)return s.push("/mfa/setup"),null;if(null===c)return null;const f=(null==c?void 0:c.name.toLowerCase())===(null==r?void 0:r.toLowerCase());return L().createElement(O.Switch,null,L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/integrations"),component:vr}),L().createElement(O.Route,{path:"/:team(".concat(Ia.LD,")/emoji"),component:vr}),null===(t=e.plugins)||void 0===t?void 0:t.map((e=>L().createElement(O.Route,{key:e.id,path:"/:team(".concat(Ia.LD,")/")+e.route,render:()=>L().createElement(Mr,{pluggableName:"NeedsTeamComponent",pluggableId:e.id})}))),L().createElement(br,{shouldRenderCenterChannel:i&&f}))}function Tr(e,t){var a;if(!t)return null;return(null!==(a=e.find((e=>e.name===t)))&&void 0!==a?a:null)||null}const Sr=(0,P.memo)(_r),wr={fetchChannelsAndMembers:s.DC,fetchAllMyTeamsChannels:s.al,fetchAllMyChannelMembers:s.AK,markAsReadOnFocus:c.jK,initializeTeam:S,joinTeam:function(e,t){return async(a,n)=>{const r=n(),i=(0,l.HW)(r);try{const r=await a((0,g.Uj)(e));if((0,y.o)(r)){const e=r.data;if(i&&e&&0===e.delete_at){const r=await a((0,C.$w)(e.id,i.id));if((0,y.o)(r)){t&&v.A.setTeamIdJoinedOnLoad(e.id),await a(S(e));try{await a((0,s.DC)(e.id))}catch(e){return(0,p.UP)(e,a,n),a((0,m.vV)(e)),{error:e}}return{data:e}}throw r.error}throw new Error("Team not found or deleted")}throw r.error}catch(e){return(0,p.UP)(e,a,n),a((0,m.vV)(e)),{error:e}}}},unsetActiveChannelOnServer:s.Zw},Ir=(0,n.connect)((function(e,t){const a=(0,i.Ay)(e),n=(0,i.zj)(e),s=(0,l.HW)(e),c=e.plugins.components.NeedsTeamComponent,m="true"===n.DisableRefetchingOnBrowserFocus,h="true"===n.DisableWakeUpReconnectHandler;return{currentTeamId:(0,o.Sy)(e),currentChannelId:(0,r.eH)(e),teamsList:(0,o.vt)(e),plugins:c,selectedThreadId:(0,u.EB)(e),selectedPostId:(0,d.zb)(e),mfaRequired:(0,w.T)(s,a,n,t.match.url),disableRefetchingOnBrowserFocus:m,disableWakeUpReconnectHandler:h}}),wr),Ar=Ir(Sr)},8283:(e,t,a)=>{a.d(t,{A:()=>I});var n=a(37270),s=a(32446),r=a(87373),i=a(23739),o=a(79751),l=a(62688),c=a.n(l),d=(a(17046),a(43813),a(4290),a(36418)),u=a.n(d),m=a(14778),h=a(48774),p=a(69669),g=a(17461),f=a(49136),b=a(1277),E=a(24163),C=a(17983),v=a(99068),y=a(83873),M=a(78451),_=a(85873);function T(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class S extends u().PureComponent{constructor(){super(...arguments),T(this,"state",{showConfirmModal:!1,item:{member_count:0}}),T(this,"loadItems",(async(e,t)=>{const{data:a}=await this.props.actions.getGroupsAssociatedToTeam(this.props.team.id,t,e,b.$,!0);return{items:a.groups,totalCount:a.totalGroupCount}})),T(this,"handleDeleteCanceled",(()=>{this.setState({showConfirmModal:!1})})),T(this,"handleDeleteConfirmed",(()=>{this.setState({showConfirmModal:!1});const{item:e,listModal:t}=this.state;this.props.actions.unlinkGroupSyncable(e.id,this.props.team.id,h.CL.Team).then((async()=>{if(t){t.setState({loading:!0});const{items:e,totalCount:a}=await t.props.loadItems(t.state.page,t.state.searchTerm);t.setState({loading:!1,items:e,totalCount:a})}}))})),T(this,"onClickRemoveGroup",((e,t)=>{this.setState({showConfirmModal:!0,item:e,listModal:t})})),T(this,"onClickConfirmRemoveGroup",((e,t)=>this.props.actions.unlinkGroupSyncable(e.id,this.props.team.id,h.CL.Team).then((async()=>{t.setState({loading:!0});const{items:e,totalCount:a}=await t.props.loadItems(t.state.page,t.state.searchTerm);t.setState({loading:!1,items:e,totalCount:a})})))),T(this,"onHide",(()=>{this.props.actions.closeModal(M.IQ.MANAGE_TEAM_GROUPS)})),T(this,"titleButtonOnClick",(()=>{this.onHide(),this.props.actions.openModal({modalId:M.IQ.ADD_GROUPS_TO_TEAM,dialogType:p.A})})),T(this,"setTeamMemberStatus",(async(e,t,a)=>{this.props.actions.patchGroupSyncable(e.id,this.props.team.id,h.CL.Team,{scheme_admin:a}).then((async()=>{t.setState({loading:!0});const{items:e,totalCount:a}=await t.props.loadItems(t.state.page,t.state.searchTerm);this.props.actions.getMyTeamMembers(),t.setState({loading:!1,items:e,totalCount:a})}))})),T(this,"renderRow",((e,t)=>{let a;return a=e.scheme_admin?u().createElement(m.FormattedMessage,{id:"team_members_dropdown.teamAdmins",defaultMessage:"Team Admins"}):u().createElement(m.FormattedMessage,{id:"team_members_dropdown.teamMembers",defaultMessage:"Team Members"}),u().createElement("div",{key:e.id,className:"more-modal__row"},u().createElement("img",{className:"more-modal__image",src:y,alt:"group picture",width:"32",height:"32"}),u().createElement("div",{className:"more-modal__details"},u().createElement("div",{className:"more-modal__name","data-testid":"group-name"},e.display_name," ",u().createElement(f.A,null)," ","-"," ",u().createElement(f.A,null),u().createElement("span",{className:"more-modal__name_count"},u().createElement(m.FormattedMessage,{id:"numMembers",defaultMessage:"{num, number} {num, plural, one {member} other {members}}",values:{num:e.member_count}})))),u().createElement("div",{className:"more-modal__actions"},u().createElement(v.A,null,u().createElement("button",{id:"teamGroupsDropdown_".concat(e.display_name),className:"dropdown-toggle theme color--link style--none",type:"button","aria-expanded":"true","data-testid":"menu-button"},u().createElement("span",null,a," "),u().createElement(E.A,null)),u().createElement(C.A,{openLeft:!0,ariaLabel:_.Vw({id:"team_members_dropdown.menuAriaLabel",defaultMessage:"Change the role of a team member"})},u().createElement(C.A.ItemAction,{show:!e.scheme_admin,onClick:()=>this.setTeamMemberStatus(e,t,!0),text:_.Vw({id:"team_members_dropdown.makeTeamAdmins",defaultMessage:"Make Team Admins"})}),u().createElement(C.A.ItemAction,{show:Boolean(e.scheme_admin),onClick:()=>this.setTeamMemberStatus(e,t,!1),text:_.Vw({id:"team_members_dropdown.makeTeamMembers",defaultMessage:"Make Team Members"})}),u().createElement(C.A.ItemAction,{id:"remove-group",onClick:()=>this.onClickRemoveGroup(e,t),text:_.Vw({id:"group_list_modal.removeGroupButton",defaultMessage:"Remove Group"})})))))}))}render(){const{formatMessage:e}=this.props.intl,t=this.state.item.member_count;return u().createElement(u().Fragment,null,u().createElement(b.A,{show:!this.state.showConfirmModal,titleText:e({id:"team_groups",defaultMessage:"{team} Groups"},{team:this.props.team.display_name}),searchPlaceholderText:e({id:"manage_team_groups_modal.search_placeholder",defaultMessage:"Search groups"}),renderRow:this.renderRow,loadItems:this.loadItems,onHide:this.onHide,titleBarButtonText:e({id:"group_list_modal.addGroupButton",defaultMessage:"Add Groups"}),titleBarButtonOnClick:this.titleButtonOnClick,"data-testid":"list-modal"}),u().createElement(g.A,{show:this.state.showConfirmModal,title:e({id:"remove_group_confirm_title",defaultMessage:"Remove Group and {memberCount, number} {memberCount, plural, one {Member} other {Members}}"},{memberCount:t}),message:e({id:"remove_group_confirm_message",defaultMessage:"{memberCount, number} {memberCount, plural, one {member} other {members}} associated to this group will be removed from the team. Are you sure you wish to remove this group and {memberCount} {memberCount, plural, one {member} other {members}}?"},{memberCount:t}),confirmButtonText:e({id:"remove_group_confirm_button",defaultMessage:"Yes, Remove Group and {memberCount, plural, one {Member} other {Members}}"},{memberCount:t}),onConfirm:this.handleDeleteConfirmed,onCancel:this.handleDeleteCanceled,id:"confirm-modal"}))}}T(S,"propTypes",{actions:c().shape({getGroupsAssociatedToTeam:c().func.isRequired,closeModal:c().func.isRequired,openModal:c().func.isRequired,unlinkGroupSyncable:c().func.isRequired,patchGroupSyncable:c().func.isRequired,getMyTeamMembers:c().func.isRequired}).isRequired});const w=(0,m.injectIntl)(S),I=(0,n.connect)(((e,t)=>({team:e.entities.teams.teams[t.teamID]})),(e=>({actions:(0,s.zH)({getGroupsAssociatedToTeam:r.Lp,closeModal:o.O,openModal:o.q,unlinkGroupSyncable:r.IC,patchGroupSyncable:r.r2,getMyTeamMembers:i.tt},e)})))(w)},87364:(e,t,a)=>{a.d(t,{A:()=>W});var n=a(37270),s=a(32446),r=a(14776),i=a(79751),o=a(98496),l=a(78451),c=a(62688),d=a.n(c),u=(a(4290),a(36418)),m=a.n(u),h=a(14778),p=a(14696),g=a(16983),f=a(49888),b=(a(3188),a(30973),a(23739)),E=a(17085),C=a(40057),v=a(80635),y=a(7430),M=a(59935),_=a(65357),T=a(89247),S=(a(43813),a(17046),a(24876)),w=a(30413),I=a(77440),A=a(46859),N=(a(57406),a(55448),a(79342)),R=a(17461),P=a(70669),L=a(24163),O=a(83007);function D(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class k extends m().PureComponent{constructor(e){super(e),D(this,"handleMakeMember",(async()=>{const e=this.props.currentUser;if(this.props.user.id===e.id&&e.roles.includes("system_admin"))this.handleDemote(this.props.user,"team_user");else{const{error:t}=await this.props.actions.updateTeamMemberSchemeRoles(this.props.teamMember.team_id,this.props.user.id,!0,!1);t?this.setState({serverError:t.message}):(this.props.actions.getUser(this.props.user.id),this.props.actions.getTeamMember(this.props.teamMember.team_id,this.props.user.id),this.props.user.id===e.id&&(await this.props.actions.getMyTeamMembers(),this.props.actions.getMyTeamUnreads(this.props.collapsedThreads)))}})),D(this,"handleRemoveFromTeam",(async()=>{const{error:e}=await this.props.actions.removeUserFromTeamAndGetStats(this.props.teamMember.team_id,this.props.user.id);e&&this.setState({serverError:e.message})})),D(this,"handleMakeAdmin",(async()=>{const e=this.props.currentUser;if(this.props.user.id===e.id&&e.roles.includes("system_admin"))this.handleDemote(this.props.user,"team_user team_admin");else{const{error:e}=await this.props.actions.updateTeamMemberSchemeRoles(this.props.teamMember.team_id,this.props.user.id,!0,!0);e?this.setState({serverError:e.message}):(this.props.actions.getUser(this.props.user.id),this.props.actions.getTeamMember(this.props.teamMember.team_id,this.props.user.id))}})),D(this,"handleDemote",((e,t)=>{this.setState({serverError:this.state.serverError,showDemoteModal:!0,user:e,role:t})})),D(this,"handleDemoteCancel",(()=>{this.setState({serverError:null,showDemoteModal:!1,user:null,role:null})})),D(this,"handleDemoteSubmit",(async()=>{const{error:e}=await this.props.actions.updateTeamMemberSchemeRoles(this.props.teamMember.team_id,this.props.user.id,!0,!1);e?this.setState({serverError:e.message}):(this.props.actions.getUser(this.props.user.id),(0,O.J)().push(this.props.teamUrl))})),this.state={serverError:null,showDemoteModal:!1,user:null,role:null}}render(){let e=null;this.state.serverError&&(e=m().createElement("div",{className:"has-error"},m().createElement("label",{className:"has-error control-label"},this.state.serverError)));const{currentTeam:t,teamMember:a,user:n,intl:s}=this.props;let r=null;r=(0,N.P)(n.roles)?m().createElement(h.FormattedMessage,{id:"team_members_dropdown.guest",defaultMessage:"Guest"}):n.roles.length>0&&(0,N.FV)(n.roles)?m().createElement(h.FormattedMessage,{id:"team_members_dropdown.systemAdmin",defaultMessage:"System Admin"}):a.roles.length>0&&(0,N.qc)(a.roles)||a.scheme_admin?m().createElement(h.FormattedMessage,{id:"team_members_dropdown.teamAdmin",defaultMessage:"Team Admin"}):m().createElement(h.FormattedMessage,{id:"team_members_dropdown.member",defaultMessage:"Member"});const i=this.props.currentUser;let o=!(0,N.P)(n.roles)&&((0,N.qc)(a.roles)||a.scheme_admin)&&!(0,N.FV)(n.roles),l=!((0,N.P)(n.roles)||(0,N.qc)(a.roles)||(0,N.FV)(n.roles)||a.scheme_admin);n.delete_at>0&&(r=m().createElement(h.FormattedMessage,{id:"team_members_dropdown.inactive",defaultMessage:"Inactive"}),o=!1,l=!1);const c=n.id!==i.id&&(!(null!=t&&t.group_constrained)||n.is_bot);let d=null;if(n.id===i.id){const t=m().createElement(h.FormattedMessage,{id:"team_members_dropdown.confirmDemoteRoleTitle",defaultMessage:"Confirm Demotion from System Admin Role"}),a=m().createElement("div",null,m().createElement(h.FormattedMessage,{id:"team_members_dropdown.confirmDemoteDescription",defaultMessage:"If you demote yourself from the System Admin role and there is not another user with System Admin privileges, you'll need to re-assign a System Admin by accessing the Mattermost server through a terminal and running the following command."}),m().createElement("br",null),m().createElement("br",null),m().createElement(h.FormattedMessage,{id:"team_members_dropdown.confirmDemotionCmd",defaultMessage:"platform roles system_admin {username}",values:{username:i.username}}),e),n=m().createElement(h.FormattedMessage,{id:"team_members_dropdown.confirmDemotion",defaultMessage:"Confirm Demotion"});d=m().createElement(R.A,{show:this.state.showDemoteModal,title:t,message:a,confirmButtonText:n,onConfirm:this.handleDemoteSubmit,onCancel:this.handleDemoteCancel})}if(!c&&!l&&!o)return m().createElement("div",null,r);const{index:u,totalUsers:p}=this.props;let g=!1;p>3&&p-u<=3&&(g=!0);const f=m().createElement(P.q7,{id:"removeFromTeam",onClick:this.handleRemoveFromTeam,labels:m().createElement(h.FormattedMessage,{id:"team_members_dropdown.leave_team",defaultMessage:"Remove from Team"})}),b=m().createElement(P.q7,{onClick:this.handleMakeAdmin,labels:m().createElement(h.FormattedMessage,{id:"team_members_dropdown.makeAdmin",defaultMessage:"Make Team Admin"})}),E=m().createElement(P.q7,{onClick:this.handleMakeMember,labels:m().createElement(h.FormattedMessage,{id:"team_members_dropdown.makeMember",defaultMessage:"Make Team Member"})});return m().createElement(m().Fragment,null,m().createElement(P.mc,{menuButton:{id:"teamMembersDropdown_".concat(n.username),class:"dropdown-toggle theme color--link style--none",children:m().createElement(m().Fragment,null,m().createElement("span",null,r," "),m().createElement(L.A,null))},menu:{id:"teamMembersDropdown_".concat(n.username,"_menu"),"aria-label":s.formatMessage({id:"team_members_dropdown.menuAriaLabel",defaultMessage:"Change the role of a team member"})},anchorOrigin:{vertical:g?"top":"bottom",horizontal:"right"},transformOrigin:{vertical:g?"bottom":"top",horizontal:"right"}},c?f:null,l?b:null,o?E:null),d,e)}}D(k,"propTypes",{teamUrl:d().string.isRequired,index:d().number.isRequired,totalUsers:d().number.isRequired,actions:d().shape({getMyTeamMembers:d().func.isRequired,getMyTeamUnreads:d().func.isRequired,getUser:d().func.isRequired,getTeamMember:d().func.isRequired,getTeamStats:d().func.isRequired,getChannelStats:d().func.isRequired,updateTeamMemberSchemeRoles:d().func.isRequired,updateUserActive:d().func.isRequired,removeUserFromTeamAndGetStats:d().func.isRequired}).isRequired});const F=(0,h.injectIntl)(k),x=(0,n.connect)((function(e){return{currentUser:(0,y.HW)(e),teamUrl:(0,r._p)(e),currentTeam:(0,r.H7)(e),collapsedThreads:(0,I.WW)(e)}}),(function(e){return{actions:(0,s.zH)({getMyTeamMembers:b.tt,getMyTeamUnreads:b.UR,getUser:E.wz,getTeamMember:b.e6,getTeamStats:b.ls,getChannelStats:w.Fe,updateUserActive:E.tS,updateTeamMemberSchemeRoles:b.bd,removeUserFromTeamAndGetStats:A.RF},e)}}))(F);var H=a(4715);function U(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class B extends m().PureComponent{constructor(e){super(e),U(this,"loadComplete",(()=>{this.setState({loading:!1})})),U(this,"nextPage",(async e=>{this.setState({loading:!0}),await Promise.all([this.props.actions.loadProfilesAndTeamMembers(e,50,this.props.currentTeamId,{active:!0}),this.props.actions.getTeamMembers(this.props.currentTeamId,e,l.Ay.DEFAULT_MAX_USERS_PER_TEAM,{sort:C.P9.SORT_USERNAME_OPTION,exclude_deleted_users:!0})]),this.loadComplete()})),U(this,"search",(e=>{this.props.actions.setModalSearchTerm(e)})),this.searchTimeoutId=0,this.state={loading:!0}}async componentDidMount(){await Promise.all([this.props.actions.loadProfilesAndTeamMembers(0,l.Ay.PROFILE_CHUNK_SIZE,this.props.currentTeamId,{active:!0}),this.props.actions.getTeamMembers(this.props.currentTeamId,0,l.Ay.DEFAULT_MAX_USERS_PER_TEAM,{sort:C.P9.SORT_USERNAME_OPTION,exclude_deleted_users:!0}),this.props.actions.getTeamStats(this.props.currentTeamId)]),this.loadComplete()}componentWillUnmount(){this.props.actions.setModalSearchTerm("")}componentDidUpdate(e){if(e.searchTerm!==this.props.searchTerm){clearTimeout(this.searchTimeoutId);const e=this.props.searchTerm;if(""===e)return this.loadComplete(),void(this.searchTimeoutId=0);const t=window.setTimeout((async()=>{const{loadStatusesForProfilesList:a,loadTeamMembersForProfilesList:n,searchProfiles:s}=this.props.actions,{data:r}=await s(e,{team_id:this.props.currentTeamId});t===this.searchTimeoutId&&(this.setState({loading:!0}),a(r),n(r,this.props.currentTeamId,!0).then((e=>{let{data:t}=e;t&&this.loadComplete()})))}),l.Ay.SEARCH_TIMEOUT_MILLISECONDS);this.searchTimeoutId=t}}render(){let e;this.props.canManageTeamMembers&&(e=[x]);const t=this.props.teamMembers,a=this.props.users,n={};let s;if(this.state.loading)s=null;else{s=[];for(let e=0;e<a.length;e++){const r=a[e];t[r.id]&&0===r.delete_at&&(s.push(r),n[r.id]={teamMember:t[r.id]})}}return m().createElement(S.A,{users:s,usersPerPage:50,total:this.props.totalTeamMembers,nextPage:this.nextPage,search:this.search,actions:e,actionUserProps:n,focusOnMount:!H.Fr()})}}U(B,"propTypes",{searchTerm:d().string.isRequired,users:d().array.isRequired,currentTeamId:d().string.isRequired,totalTeamMembers:d().number.isRequired,canManageTeamMembers:d().bool,actions:d().shape({getTeamMembers:d().func.isRequired,searchProfiles:d().func.isRequired,getTeamStats:d().func.isRequired,loadProfilesAndTeamMembers:d().func.isRequired,loadStatusesForProfilesList:d().func.isRequired,loadTeamMembersForProfilesList:d().func.isRequired,setModalSearchTerm:d().func.isRequired}).isRequired});const q=(0,n.connect)((function(e,t){const a=(0,v.mg)(e,t.teamId,C.xB.MANAGE_TEAM_ROLES),n=e.views.search.modalSearch;let s;s=n?(0,y.QJ)(e,n):(0,y.G1)(e);const i=(0,r.MF)(e)||{active_member_count:0};return{searchTerm:n,users:s,teamMembers:(0,r.XK)(e)||{},currentTeamId:e.entities.teams.currentTeamId,totalTeamMembers:i.active_member_count,canManageTeamMembers:a}}),(function(e){return{actions:(0,s.zH)({searchProfiles:E.U,getTeamStats:b.ls,getTeamMembers:b.fP,loadProfilesAndTeamMembers:_.U3,loadStatusesForProfilesList:M.Y5,loadTeamMembersForProfilesList:_.iO,setModalSearchTerm:T.qv},e)}}))(B);var j=a(26808),V=a(30138);function G(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class z extends m().PureComponent{constructor(e){super(e),G(this,"handleHide",(()=>{this.setState({show:!1})})),G(this,"handleInvitePeople",(()=>{const{actions:e}=this.props;e.openModal({modalId:l.IQ.INVITATION,dialogType:f.default}),this.handleHide()})),G(this,"handleExit",(()=>{this.props.focusOriginElement&&(0,V.p)(this.props.focusOriginElement,!0),this.props.onExited()})),this.state={show:!0}}componentDidMount(){this.props.onLoad&&this.props.onLoad()}render(){var e,t;let a="";return this.props.currentTeam&&(a=this.props.currentTeam.display_name),m().createElement(p.zW,{id:"teamMembersModal",className:"more-modal",compassDesign:!0,show:this.state.show,onHide:this.handleHide,onExited:this.handleExit,modalHeaderTextId:"teamMemberModalLabel",modalHeaderText:m().createElement(h.FormattedMessage,{id:"team_member_modal.members",defaultMessage:"{team} Members",values:{team:a}}),ariaLabelledby:"teamMemberModalLabel",headerButton:m().createElement(j.A,{teamId:null===(e=this.props.currentTeam)||void 0===e?void 0:e.id,permissions:[g.A.ADD_USER_TO_TEAM,g.A.INVITE_GUEST]},m().createElement("button",{id:"invitePeople",type:"button",className:"btn btn-primary btn-sm invite-people-btn",onClick:this.handleInvitePeople},m().createElement(h.FormattedMessage,{id:"team_member_modal.invitePeople",defaultMessage:"Invite People"}))),enforceFocus:!1,modalLocation:"top",bodyPadding:!1},m().createElement(q,{teamId:null===(t=this.props.currentTeam)||void 0===t?void 0:t.id}))}}G(z,"propTypes",{onExited:d().func.isRequired,onLoad:d().func,focusOriginElement:d().string,actions:d().shape({openModal:d().func.isRequired}).isRequired});const W=(0,n.connect)((function(e){const t=l.IQ.TEAM_MEMBERS;return{currentTeam:(0,r.H7)(e),show:(0,o.o)(e,t)}}),(function(e){return{actions:(0,s.zH)({openModal:i.q},e)}}))(z)},8610:(e,t,a)=>{a.d(t,{A:()=>le});var n=a(37270),s=a(40057),r=a(80635),i=a(14776),o=a(98496),l=a(78451),c=a(62688),d=a.n(c),u=(a(43813),a(17046),a(36418)),m=a.n(u),h=a(89735),p=a(40140),g=a.n(p),f=a(14778),b=a(32446),E=a(23739),C=(a(57406),a(55448),a(76685),a(49698)),v=a(66215),y=(a(4290),a(84295));function M(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?M(Object(a),!0).forEach((function(t){T(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):M(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function T(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const S={DropdownIndicator:null},w={control:e=>_(_({},e),{},{background:"var(--center-channel-color-rgb)"}),input:e=>_(_({},e),{},{color:"rgba(var(--center-channel-color-rgb), 0.64)"}),multiValue:e=>_(_({},e),{},{borderRadius:"10px",background:"rgba(var(--center-channel-color-rgb), 0.08)",display:"flex",alignItems:"center"}),multiValueLabel:e=>_(_({},e),{},{padding:"4px 6px 4px 10px",color:"var(--center-channel-color)",fontFamily:"Open Sans",fontSize:"10px",fontWeight:600,lineHeight:"12px",letterSpacing:"0.2px"}),multiValueRemove:e=>_(_({},e),{},{borderRadius:"50%",background:"rgba(var(--center-channel-color-rgb), 0.32)",fontFamily:"compass-icons",fontSize:"12px",fontWeight:400,color:"white",width:"10px",height:"10px",padding:0,marginRight:"4px",":hover":{background:"rgba(var(--center-channel-color-rgb), 0.32)",color:"white"}})},I=e=>{let{placeholder:t,value:a,handleNewSelection:n,onChange:s,id:r,isClearable:i,description:o}=e;const[l,c]=m().useState(""),d=(0,u.useCallback)((()=>{null!=a&&a.includes(l.trim())||0===l.length||(n(l),c(""))}),[n,l,a]),h=(0,u.useCallback)((e=>{if(l)switch(e.key){case" ":case",":case"Enter":d(),e.preventDefault()}}),[l,d]),p=(0,u.useMemo)((()=>a.map((e=>({label:e,value:e})))),[a]);return m().createElement(m().Fragment,null,m().createElement(y.A,{id:r,className:"select-text-input",styles:w,components:S,isClearable:i,onChange:(0,u.useCallback)((e=>s(e)),[s]),inputValue:l,isMulti:!0,menuIsOpen:!1,onInputChange:c,onKeyDown:h,placeholder:t,value:p,onBlur:d}),o?m().createElement("p",{className:"select-text-description"},o):void 0)};var A=a(66549);const N=e=>{let{allowedDomains:t,setAllowedDomains:a,setHasChanges:n,setSaveChangesPanelState:s}=e;const[r,i]=(0,u.useState)(t.length>0),{formatMessage:o}=(0,f.useIntl)(),l=(0,u.useCallback)((e=>{i(e),e||a([])}),[a]),c=(0,u.useCallback)((e=>{n(!0),s("editing"),a([...t,e])}),[t,a,n,s]),d=(0,u.useCallback)((e=>{n(!0),s("editing"),a((null==e?void 0:e.map((e=>e.value)))||[])}),[a,n,s]);return m().createElement(m().Fragment,null,m().createElement(A.A,{inputFieldTitle:m().createElement(f.FormattedMessage,{id:"general_tab.allowedDomains",defaultMessage:"Allow only users with a specific email domain to join this team"}),"data-testid":"allowedDomainsCheckbox",className:"access-allowed-domains-section",title:o({id:"general_tab.AllowedDomainsTitle",defaultMessage:"Users with a specific email domain"}),description:o({id:"general_tab.AllowedDomainsInfo",defaultMessage:'When enabled, users can only join the team if their email matches a specific domain (e.g. "mattermost.org")'}),descriptionAboveContent:!0,inputFieldData:{name:"showAllowedDomains"},inputFieldValue:r,handleChange:l}),r&&m().createElement(I,{id:"allowedDomains",placeholder:o({id:"general_tab.AllowedDomainsExample",defaultMessage:"corp.mattermost.com, mattermost.com"}),"aria-label":o({id:"general_tab.allowedDomains.ariaLabel",defaultMessage:"Allowed Domains"}),value:t,onChange:d,handleNewSelection:c,isClearable:!1,description:o({id:"general_tab.AllowedDomainsTip",defaultMessage:"Seperate multiple domains with a space, comma, tab or enter."})}))};N.propTypes={allowedDomains:d().arrayOf(d().string).isRequired,setAllowedDomains:d().func.isRequired,setHasChanges:d().func.isRequired,setSaveChangesPanelState:d().func.isRequired};const R=N;var P=a(85406),L=a(98566),O=a(8589);const D=(0,f.defineMessages)({OpenInviteDescriptionError:{id:"team_settings.openInviteDescription.error",defaultMessage:"There was an error generating the invite code, please try again"}}),k=e=>{var t;let{regenerateTeamInviteId:a}=e;const o=(0,n.useSelector)((e=>(0,i.H7)(e))),l=(0,n.useSelector)((e=>(0,r.mg)(e,(null==o?void 0:o.id)||"",s.xB.INVITE_USER))),[c,d]=(0,u.useState)(null!==(t=null==o?void 0:o.invite_id)&&void 0!==t?t:""),[h,p]=(0,u.useState)(),{formatMessage:g}=(0,f.useIntl)();(0,u.useEffect)((()=>{d((null==o?void 0:o.invite_id)||"")}),[null==o?void 0:o.invite_id]);const b=(0,u.useCallback)((async()=>{const{data:e,error:t}=await a((null==o?void 0:o.id)||"");null!=e&&e.invite_id?d(e.invite_id):t&&p(D.OpenInviteDescriptionError)}),[a,null==o?void 0:o.id]);if(!l)return null;const E=m().createElement("div",{"data-testid":"teamInviteContainer",id:"teamInviteContainer"},m().createElement(L.A,{id:"teamInviteId",type:"text",value:c,maxLength:32}),m().createElement("button",{"data-testid":"regenerateButton",id:"regenerateButton",className:"btn btn-tertiary",onClick:b},m().createElement(P.RefreshIcon,null),g({id:"general_tab.regenerate",defaultMessage:"Regenerate"})));return m().createElement(O.A,{className:"access-invite-section",title:g({id:"general_tab.codeTitle",defaultMessage:"Invite Code"}),description:g({id:"general_tab.codeLongDesc",defaultMessage:"The Invite Code is part of the unique team invitation link which is sent to members you’re inviting to this team. Regenerating the code creates a new invitation link and invalidates the previous link."}),content:E,error:h,descriptionAboveContent:!0})};k.propTypes={regenerateTeamInviteId:d().func.isRequired};const F=k;var x=a(17518);const H=e=>{let{isGroupConstrained:t,allowOpenInvite:a,setAllowOpenInvite:n}=e;const{formatMessage:s}=(0,f.useIntl)();if(t){const e=m().createElement("p",{id:"groupConstrainedContent"},s({id:"team_settings.openInviteDescription.groupConstrained",defaultMessage:"Members of this team are added and removed by linked groups. <link>Learn More</link>"},{link:e=>m().createElement(x.A,{href:"https://mattermost.com/pl/default-ldap-group-constrained-team-channel.html",location:"open_invite"},e)}));return m().createElement(O.A,{className:"access-invite-domains-section",title:s({id:"general_tab.openInviteText",defaultMessage:"Users on this server"}),description:s({id:"general_tab.openInviteDesc",defaultMessage:"When enabled, a link to this team will be included on the landing page allowing anyone with an account to join this team. Changing this setting will create a new invitation link and invalidate the previous link."}),descriptionAboveContent:!0,content:e})}return m().createElement(A.A,{className:"access-invite-domains-section",inputFieldTitle:m().createElement(f.FormattedMessage,{id:"general_tab.openInviteTitle",defaultMessage:"Allow any user with an account on this server to join this team"}),inputFieldData:{name:"allowOpenInvite"},inputFieldValue:a,handleChange:n,title:s({id:"general_tab.openInviteText",defaultMessage:"Users on this server"}),description:s({id:"general_tab.openInviteDesc",defaultMessage:"When enabled, a link to this team will be included on the landing page allowing anyone with an account to join this team. Changing this setting will create a new invitation link and invalidate the previous link."}),descriptionAboveContent:!0})};H.propTypes={allowOpenInvite:d().bool.isRequired,isGroupConstrained:d().bool,setAllowOpenInvite:d().func.isRequired};const U=H,B=e=>e&&0!==e.length?(e.includes(",")?e.split(","):[e]).map((e=>e.trim())):[],q=(0,n.connect)(null,(function(e){return{actions:(0,b.zH)({patchTeam:E.Oy,regenerateTeamInviteId:E.US},e)}}))((e=>{var t;let{closeModal:a,collapseModal:n,hasChangeTabError:s,hasChanges:r,setHasChangeTabError:i,setHasChanges:o,setJustSaved:l,team:c,actions:d}=e;const[h,p]=(0,u.useState)((()=>B(c.allowed_domains))),[g,b]=(0,u.useState)(null!==(t=c.allow_open_invite)&&void 0!==t&&t),[E,y]=(0,u.useState)(),{formatMessage:M}=(0,f.useIntl)(),_=(0,u.useCallback)((async()=>{const{error:e}=await d.patchTeam({id:c.id,allowed_domains:1===h.length?h[0]:h.join(", ")});return!e}),[d,h,c]),T=(0,u.useCallback)((async()=>{if(g===c.allow_open_invite)return!0;const e={id:c.id,allow_open_invite:g},{error:t}=await d.patchTeam(e);return!t}),[d,g,c]),S=(0,u.useCallback)((e=>{o(!0),y("editing"),b(e)}),[o]),w=(0,u.useCallback)((()=>{y("editing"),o(!1),i(!1),l(!1)}),[i,o,l]),I=(0,u.useCallback)((()=>{var e;p(B(c.allowed_domains)),b(null!==(e=c.allow_open_invite)&&void 0!==e&&e),w()}),[w,c.allow_open_invite,c.allowed_domains]),A=(0,u.useCallback)((()=>{r?i(!0):n()}),[n,r,i]),N=(0,u.useCallback)((async()=>{const e=await _(),t=await T();e&&t?(y("saved"),i(!1),l(!0)):y("error")}),[_,T,i,l]);return m().createElement(C.A,{content:m().createElement(m().Fragment,null,m().createElement("div",{className:"modal-header"},m().createElement("button",{id:"closeButton",type:"button",className:"close","data-dismiss":"modal",onClick:a},m().createElement("span",{"aria-hidden":"true"},"×")),m().createElement("h4",{className:"modal-title"},m().createElement("div",{className:"modal-back"},m().createElement("i",{className:"fa fa-angle-left","aria-label":M({id:"generic_icons.collapse",defaultMessage:"Collapes Icon"}),onClick:A})),m().createElement("span",null,M({id:"team_settings_modal.title",defaultMessage:"Team Settings"})))),m().createElement("div",{className:"modal-access-tab-content user-settings",id:"accessSettings","aria-labelledby":"accessButton",role:"tabpanel"},c.group_constrained?void 0:m().createElement(R,{allowedDomains:h,setAllowedDomains:p,setHasChanges:o,setSaveChangesPanelState:y}),m().createElement("div",{className:"divider-light"}),m().createElement(U,{isGroupConstrained:c.group_constrained,allowOpenInvite:g,setAllowOpenInvite:S}),m().createElement("div",{className:"divider-light"}),c.group_constrained?void 0:m().createElement(F,{regenerateTeamInviteId:d.regenerateTeamInviteId}),r?m().createElement(v.A,{handleCancel:I,handleSubmit:N,handleClose:w,tabChangeError:s,state:E}):void 0))})}));a(83931);var j=a(26614);const V=e=>{let{handleDescriptionChanges:t,clientError:a,description:n}=e;const{formatMessage:s}=(0,f.useIntl)(),r=(0,u.useCallback)((e=>{t(e.target.value)}),[t]),i=m().createElement(L.A,{id:"teamDescription","data-testid":"teamDescriptionInput",containerClassName:"description-section-input",type:"textarea",maxLength:l.Ay.MAX_TEAMDESCRIPTION_LENGTH,onChange:r,value:n,label:s({id:"general_tab.teamDescription",defaultMessage:"Description"})});return m().createElement(O.A,{description:s({id:"general_tab.teamDescriptionInfo",defaultMessage:"Team description provides additional information to help users select the right team. Maximum of 50 characters."}),content:i,className:"description-setting-item",error:a})},G=e=>{let{clientError:t,handleNameChanges:a,name:n}=e;const{formatMessage:s}=(0,f.useIntl)(),r=(0,u.useCallback)((e=>a(e.target.value)),[a]),i=m().createElement(L.A,{id:"teamName","data-testid":"teamNameInput",type:"text",maxLength:l.Ay.MAX_TEAMNAME_LENGTH,onChange:r,value:n,label:s({id:"general_tab.teamName",defaultMessage:"Team Name"})});return m().createElement(O.A,{title:s({id:"general_tab.teamInfo",defaultMessage:"Team info"}),description:s({id:"general_tab.teamNameInfo",defaultMessage:"This name will appear on your sign-in screen and at the top of the left sidebar."}),content:i,error:t})};a(60473),a(36169);var z=a(12026),W=a(68124),K=a(85873);function Y(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function J(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const Q=e=>{let{team:t,file:a,teamName:n,disabled:s,onFileChange:r,onRemove:i,clientError:o}=e;const c=(0,u.useRef)(null),[d,h]=(0,u.useState)(""),[p,g]=(0,u.useState)(),{formatMessage:b}=(0,f.useIntl)(),E=(0,K.lt)(t),C=(0,u.useCallback)((()=>{c.current&&(c.current.value="",c.current.click())}),[]);(0,u.useEffect)((()=>{a&&(e=>{if(e){const t=URL.createObjectURL(e),a=new FileReader;a.onload=e=>{const a=W.hM(e.target.result),n=W.R6(a);h(t),g(n)},a.readAsArrayBuffer(e)}})(a)}),[a]);const v=m().createElement(m().Fragment,null,m().createElement("div",{className:"team-picture-section"},(()=>{if(a){const e=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(a),!0).forEach((function(t){J(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Y(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({backgroundImage:"url("+d+")",backgroundSize:"cover",backgroundRepeat:"round"},p);return m().createElement("div",{id:"teamIconImage",style:e,className:"team-img-preview",onClick:C})}return E?m().createElement("img",{id:"teamIconImage",className:"team-img-preview",src:E,onClick:C}):m().createElement("div",{className:"team-picture-section__team-icon"},m().createElement("span",{id:"teamIconInitial",onClick:C,className:"team-picture-section__team-name"},n.charAt(0).toUpperCase()+n.charAt(1)))})(),m().createElement(m().Fragment,null,m().createElement("input",{"data-testid":"uploadPicture",ref:c,className:"hidden",accept:l.Ay.ACCEPT_STATIC_IMAGE,disabled:s,type:"file",onChange:r,"aria-hidden":!0,tabIndex:-1}),m().createElement("span",{disabled:s,onClick:C},m().createElement(z.A,null)))),a||E?m().createElement("button",{onClick:i,"data-testid":"removeImageButton",className:"style--none picture-setting-item__remove-button"},m().createElement(P.TrashCanOutlineIcon,null),b({id:"setting_picture.remove_image",defaultMessage:"Remove image"})):null);return m().createElement(O.A,{title:b({id:"setting_picture.title",defaultMessage:"Team Icon"}),description:E?void 0:b({id:"setting_picture.help.profile",defaultMessage:"Upload a picture in BMP, JPG, JPEG, or PNG format. Maximum file size: {max}"},{max:"50MB"}),content:v,className:"picture-setting-item",error:o})};Q.propTypes={teamName:d().string.isRequired,disabled:d().bool.isRequired,onFileChange:d().func.isRequired,onRemove:d().func.isRequired};const Z=Q,X=["image/jpeg","image/png","image/bmp"],$=(0,f.defineMessages)({Required:{id:"general_tab.required",defaultMessage:"This field is required"},TeamNameRestrictions:{id:"general_tab.teamNameRestrictions",defaultMessage:"Team Name must be {min} or more characters up to a maximum of {max}. You can add a longer team description.",values:{min:l.Ay.MIN_TEAMNAME_LENGTH,max:l.Ay.MAX_TEAMNAME_LENGTH}},TeamIconInvalidFileType:{id:"general_tab.teamIconInvalidFileType",defaultMessage:"Only BMP, JPG or PNG images may be used for team icons"},TeamIconTooLarge:{id:"general_tab.teamIconTooLarge",defaultMessage:"Unable to upload team icon. File is too large."},TeamIconError:{id:"general_tab.teamIconError",defaultMessage:"An error occurred while selecting the image."}}),ee=(0,n.connect)((function(e){var t;const a=(0,j.zj)(e);return{maxFileSize:parseInt(null!==(t=a.MaxFileSize)&&void 0!==t?t:"",10)}}),(function(e){return{actions:(0,b.zH)({getTeam:E.Uo,patchTeam:E.Oy,removeTeamIcon:E.zz,setTeamIcon:E.PY},e)}}))((e=>{var t;let{team:a,hasChanges:n,maxFileSize:s,closeModal:r,collapseModal:i,hasChangeTabError:o,setHasChangeTabError:c,setHasChanges:d,setJustSaved:h,actions:p}=e;const[g,b]=(0,u.useState)(a.display_name),[E,y]=(0,u.useState)(a.description),[M,_]=(0,u.useState)(),[T,S]=(0,u.useState)(!1),[w,I]=(0,u.useState)(),[A,N]=(0,u.useState)(),[R,P]=(0,u.useState)(),{formatMessage:L}=(0,f.useIntl)(),O=(0,u.useCallback)((async()=>{if(g.trim()===a.display_name&&E===a.description)return!0;if(!g)return N($.Required),!1;if(g.length<l.Ay.MIN_TEAMNAME_LENGTH)return N($.TeamNameRestrictions),!1;N(void 0);const{error:e}=await p.patchTeam({id:a.id,display_name:g,description:E});return!e}),[p,E,g,a.description,a.display_name,a.id]),D=(0,u.useCallback)((async()=>{if(!M)return!0;S(!0),I(void 0);const{error:e}=await p.setTeamIcon(a.id,M);return S(!1),!e}),[p,a,M]),k=(0,u.useCallback)((async()=>{const e=await O();await D()&&e?(P("saved"),c(!1),h(!0)):P("error")}),[O,D,c,h]),F=(0,u.useCallback)((()=>{P("editing"),d(!1),c(!1),h(!1)}),[c,d,h]),x=(0,u.useCallback)((()=>{var e;b(null!==(e=a.display_name)&&void 0!==e?e:a.name),y(a.description),_(void 0),I(void 0),N(void 0),F()}),[F,a.description,a.display_name,a.name]),H=(0,u.useCallback)((async()=>{S(!0),I(void 0),_(void 0),F();const{error:e}=await p.removeTeamIcon(a.id);S(!1),e&&(P("error"),d(!0),c(!0))}),[p,F,c,d,a.id]),U=(0,u.useCallback)((e=>{if(e&&e.target&&e.target.files&&e.target.files[0]){const t=e.target.files[0];X.includes(t.type)?t.size>s?I($.TeamIconTooLarge):(_(t),I(void 0),P("editing"),d(!0)):I($.TeamIconInvalidFileType)}else _(void 0),I($.TeamIconError)}),[s,d]),B=(0,u.useCallback)((e=>{d(!0),P("editing"),b(e)}),[d]),q=(0,u.useCallback)((e=>{d(!0),P("editing"),y(e)}),[d]),j=(0,u.useCallback)((()=>{n?c(!0):i()}),[i,n,c]),z=m().createElement(m().Fragment,null,m().createElement("div",{className:"modal-header"},m().createElement("button",{id:"closeButton",type:"button",className:"close","data-dismiss":"modal",onClick:r},m().createElement("span",{"aria-hidden":"true"},"×")),m().createElement("h4",{className:"modal-title"},m().createElement("div",{className:"modal-back"},m().createElement("i",{className:"fa fa-angle-left","aria-label":L({id:"generic_icons.collapse",defaultMessage:"Collapes Icon"}),onClick:j})),m().createElement("span",null,L({id:"team_settings_modal.title",defaultMessage:"Team Settings"})))),m().createElement("div",{className:"modal-info-tab-content user-settings",id:"infoSettings","aria-labelledby":"infoButton",role:"tabpanel"},m().createElement("div",{className:"name-description-container"},m().createElement(G,{name:g,clientError:A,handleNameChanges:B}),m().createElement(V,{description:E,handleDescriptionChanges:q})),m().createElement(Z,{team:a,file:M,disabled:T,onFileChange:U,onRemove:H,teamName:null!==(t=a.display_name)&&void 0!==t?t:a.name,clientError:w}),n?m().createElement(v.A,{handleCancel:x,handleSubmit:k,handleClose:F,tabChangeError:o,state:R}):void 0));return m().createElement(C.A,{content:z})})),te=e=>{let t,{activeTab:a="",closeModal:n,collapseModal:s,team:r,hasChanges:i,hasChangeTabError:o,setHasChanges:l,setHasChangeTabError:c,setJustSaved:d}=e;if(!r)return null;switch(a){case"info":t=m().createElement(ee,{team:r,hasChanges:i,setHasChanges:l,hasChangeTabError:o,setHasChangeTabError:c,setJustSaved:d,closeModal:n,collapseModal:s});break;case"access":t=m().createElement(q,{team:r,hasChanges:i,setHasChanges:l,hasChangeTabError:o,setHasChangeTabError:c,setJustSaved:d,closeModal:n,collapseModal:s});break;default:t=m().createElement("div",null)}return t};te.propTypes={activeTab:d().string.isRequired,hasChanges:d().bool.isRequired,hasChangeTabError:d().bool.isRequired,setHasChanges:d().func.isRequired,setHasChangeTabError:d().func.isRequired,setJustSaved:d().func.isRequired,closeModal:d().func.isRequired,collapseModal:d().func.isRequired};const ae=te,ne=(0,n.connect)((function(e){return{team:(0,i.H7)(e)}}))(ae);var se=a(30138);const re=m().lazy((()=>a.e(9163).then(a.bind(a,61544)))),ie=e=>{let{onExited:t,canInviteUsers:a,focusOriginElement:n}=e;const[s,r]=(0,u.useState)("info"),[i,o]=(0,u.useState)(!0),[l,c]=(0,u.useState)(!1),[d,p]=(0,u.useState)(!1),[b,E]=(0,u.useState)(!1),[C,v]=(0,u.useState)(!1),y=(0,u.useRef)(null),{formatMessage:M}=(0,f.useIntl)(),_=(0,u.useCallback)((e=>{l?p(!0):(r(e),c(!1),p(!1),E(!1))}),[l]),T=(0,u.useCallback)((()=>{!l||b||C?o(!1):(E(!0),p(!0),setTimeout((()=>{p(!1)}),3e3))}),[l,b,C]),S=(0,u.useCallback)((()=>{n&&(0,se.p)(n,!0),r("info"),c(!1),p(!1),E(!1),v(!1),t()}),[t,n]),w=(0,u.useCallback)((()=>{const e=g().findDOMNode(y.current);null==e||e.closest(".modal-dialog").classList.remove("display--content"),r("")}),[]),I=[{name:"info",uiName:M({id:"team_settings_modal.infoTab",defaultMessage:"Info"}),icon:"icon icon-information-outline",iconTitle:M({id:"generic_icons.info",defaultMessage:"Info Icon"})}];return a&&I.push({name:"access",uiName:M({id:"team_settings_modal.accessTab",defaultMessage:"Access"}),icon:"icon icon-account-multiple-outline",iconTitle:M({id:"generic_icons.member",defaultMessage:"Member Icon"})}),m().createElement(h.Modal,{dialogClassName:"a11y__modal settings-modal",show:i,onHide:T,onExited:S,role:"none","aria-labelledby":"teamSettingsModalLabel",id:"teamSettingsModal"},m().createElement(h.Modal.Header,{id:"teamSettingsModalLabel",closeButton:!0},m().createElement(h.Modal.Title,{componentClass:"h2",className:"modal-header__title"},M({id:"team_settings_modal.title",defaultMessage:"Team Settings"}))),m().createElement(h.Modal.Body,{ref:y},m().createElement("div",{className:"settings-table"},m().createElement("div",{className:"settings-links"},m().createElement(m().Suspense,{fallback:null},m().createElement(re,{tabs:I,activeTab:s,updateTab:_}))),m().createElement("div",{className:"settings-content minimize-settings"},m().createElement(ne,{activeTab:s,hasChanges:l,setHasChanges:c,hasChangeTabError:d,setHasChangeTabError:p,setJustSaved:v,closeModal:T,collapseModal:w})))))};ie.propTypes={onExited:d().func.isRequired,canInviteUsers:d().bool.isRequired,focusOriginElement:d().string};const oe=ie,le=(0,n.connect)((function(e){const t=(0,i.Sy)(e),a=(0,r.mg)(e,t,s.xB.INVITE_USER),n=l.IQ.TEAM_SETTINGS;return{show:(0,o.o)(e,n),canInviteUsers:a}}))(oe)},82203:(e,t,a)=>{a.d(t,{A:()=>F});var n=a(37270),s=a(81911),r=a(65952),i=a(26614),o=a(14776),l=a(62688),c=a.n(l),d=(a(17046),a(4290),a(36418)),u=a.n(d),m=a(14778),h=a(39487);const p=a.p+"files/6a2055863ca6d151ebb4.png",g=a.p+"files/5309202966a267198738.png",f=a.p+"files/15307d1bee6d7e48a3c1.png",b=a.p+"files/cd8cb8b2332ebb5e7a6d.png",E=a.p+"files/544631aa0cac60b57833.png",C=a.p+"files/90de726ce0a2fe9958d3.png",v=a.p+"files/940dec81931d4df6027f.png",y=a.p+"files/bbedcb731056777d6679.png",M=a.p+"files/3399e2ee5698233ffe44.png",_=a.p+"files/5230b3ff762bfd3f84df.png",T=a.p+"files/f6ea1b2c4b12cde69e70.png",S=a.p+"files/8f702b9068ad5f14443a.png",w=a.p+"files/9777bf12a1f691f71268.png",I=a.p+"files/20b39a15c40e4db238f1.png",A=a.p+"files/2c18b373ff146fd8108b.png";var N=a(78451),R=a(51881),P=a(4715);function L(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var O=function(e){return e.Mention="Mention",e.Unread="Unread",e.None="None",e}(O||{});class D extends u().PureComponent{constructor(){super(...arguments),L(this,"updateDesktopApp",(()=>{const{unreadStatus:e}=this.props,{isUnread:t,unreadMentionCount:a}=(0,r.pP)(e);R.h.updateUnreadsAndMentions(t,a)})),L(this,"updateTitle",(()=>{const{siteName:e,currentChannel:t,currentTeam:a,currentTeammate:n,unreadStatus:s,inGlobalThreads:i,inDrafts:o,inScheduledPosts:l}=this.props,{formatMessage:c}=this.props.intl,d=e||"",{isUnread:u,unreadMentionCount:m}=(0,r.pP)(s),h=m>0?"(".concat(m,") "):"",p=!this.isDynamicFaviconSupported&&u?"* ":"";if(t&&a&&t.id){let e=t.display_name;t.type===N.YM.DM_CHANNEL&&null!=n&&(e=n.display_name),document.title="".concat(h).concat(p).concat(e," - ").concat(a.display_name," ").concat(d)}else document.title=a&&i?c({id:"globalThreads.title",defaultMessage:"{prefix}Threads - {displayName} {siteName}"},{prefix:"".concat(h).concat(p),displayName:a.display_name,siteName:d}):a&&o?c({id:"drafts.title",defaultMessage:"{prefix}Drafts - {displayName} {siteName}"},{prefix:"".concat(h).concat(p),displayName:a.display_name,siteName:d}):a&&l?c({id:"scheduledPosts.title",defaultMessage:"{prefix}Scheduled - {displayName} {siteName}"},{prefix:"".concat(h).concat(p),displayName:a.display_name,siteName:d}):c({id:"sidebar.team_select",defaultMessage:"{siteName} - Join a team"},{siteName:d||"Mattermost"})})),L(this,"updateFavicon",(e=>{if(!P.gm()&&!P.H8())return;if(!document.querySelector('link[rel="icon"]'))return;const t=document.querySelector('link[rel="icon"][sizes="16x16"]'),a=document.querySelector('link[rel="icon"][sizes="24x24"]'),n=document.querySelector('link[rel="icon"][sizes="32x32"]'),s=document.querySelector('link[rel="icon"][sizes="64x64"]'),r=document.querySelector('link[rel="icon"][sizes="96x96"]'),i=e=>(0,h.GX)(e);switch(e){case O.Mention:t.href=i(C),a.href=i(v),n.href=i(y),s.href=i(M),r.href=i(_);break;case O.Unread:t.href=i(T),a.href=i(S),n.href=i(w),s.href=i(I),r.href=i(A);break;default:t.href=i(p),a.href=i(g),n.href=i(f),s.href=i(b),r.href=i(E)}}))}componentDidUpdate(e){this.updateTitle();const t=this.getBadgeStatus(e.unreadStatus),a=this.getBadgeStatus(this.props.unreadStatus);t!==a&&this.updateFavicon(a),this.updateDesktopApp()}get isDynamicFaviconSupported(){return P.H8()||P.gm()}getBadgeStatus(e){return"number"==typeof e?O.Mention:e?O.Unread:O.None}render(){return null}}L(D,"propTypes",{siteName:c().string,inGlobalThreads:c().bool.isRequired,inDrafts:c().bool.isRequired,inScheduledPosts:c().bool.isRequired});const k=(0,m.injectIntl)(D),F=(0,s.withRouter)((0,n.connect)((function(e,t){let{location:{pathname:a}}=t;const n=(0,i.zj)(e),l=(0,r.Lw)(e),c=l&&l.teammate_id?l:null;return{currentChannel:l,currentTeam:(0,o.H7)(e),currentTeammate:c,siteName:n.SiteName,unreadStatus:(0,r.m5)(e),inGlobalThreads:null!=(0,s.matchPath)(a,{path:"/:team/threads/:threadIdentifier?"}),inDrafts:null!=(0,s.matchPath)(a,{path:"/:team/drafts"}),inScheduledPosts:null!=(0,s.matchPath)(a,{path:"/:team/scheduled_posts"})}}))(k))},12026:(e,t,a)=>{a.d(t,{A:()=>i});var n=a(36418),s=a.n(n),r=a(14778);function i(){const{formatMessage:e}=(0,r.useIntl)();return s().createElement("i",{className:"icon-pencil-outline","aria-hidden":"true",title:e({id:"generic_icons.edit",defaultMessage:"Edit Icon"})})}},66215:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(62688),s=a.n(n),r=a(71633),i=a.n(r),o=a(36418),l=a.n(o),c=a(14778),d=a(85406);function u(e){let{handleSubmit:t,handleCancel:a,handleClose:n,tabChangeError:s=!1,state:r="editing",customErrorMessage:u,saveButtonText:m,cancelButtonText:h}=e;const p=i()("SaveChangesPanel",{error:s||"error"===r},{saved:"saved"===r}),g=i()("SaveChangesPanel__message",{error:s||"error"===r},{saved:"saved"===r}),f=i()("btn btn-tertiary btn-sm SaveChangesPanel__cancel-btn",{error:s||"error"===r},{saved:"saved"===r}),b=i()("btn btn-primary btn-sm SaveChangesPanel__save-btn",{error:s||"error"===r},{saved:"saved"===r});return(0,o.useEffect)((()=>{let e;return"saved"===r&&(e=setTimeout((()=>{n()}),1200)),()=>clearTimeout(e)}),[n,r]),l().createElement("div",{className:p},l().createElement("p",{className:g},l().createElement(d.AlertCircleOutlineIcon,{size:18,color:"currentcolor"}),u&&(s||"error"===r)?u:s||"editing"===r?l().createElement(c.FormattedMessage,{id:"saveChangesPanel.message",defaultMessage:"You have unsaved changes"}):"error"===r?l().createElement(c.FormattedMessage,{id:"saveChangesPanel.error",defaultMessage:"There was an error saving your settings"}):l().createElement(c.FormattedMessage,{id:"saveChangesPanel.saved",defaultMessage:"Settings saved"})),(()=>{if("saved"===r)return l().createElement("div",{className:"SaveChangesPanel__btn-ctr"},l().createElement("button",{id:"panelCloseButton",type:"button",className:"btn btn-icon btn-sm",onClick:n},l().createElement("i",{className:"icon icon-close"})));const e=s||"error"===r;return l().createElement("div",{className:"SaveChangesPanel__btn-ctr"},l().createElement("button",{"data-testid":"SaveChangesPanel__cancel-btn",className:f,onClick:a},h||l().createElement(c.FormattedMessage,{id:"saveChangesPanel.cancel",defaultMessage:"Undo"})),l().createElement("button",{"data-testid":"SaveChangesPanel__save-btn",className:b,onClick:t,disabled:e},m||l().createElement(c.FormattedMessage,{id:"saveChangesPanel.save",defaultMessage:"Save"})))})())}u.propTypes={handleSubmit:s().func.isRequired,handleCancel:s().func.isRequired,handleClose:s().func.isRequired,tabChangeError:s().bool,customErrorMessage:s().string,saveButtonText:s().node,cancelButtonText:s().node};const m=u},92159:(e,t,a)=>{a.d(t,{H:()=>s,K:()=>r});const n={},s=(e,t)=>e.entities.channelBookmarks.byChannelId[t]||n,r=(e,t,a)=>s(e,t)[a]},49176:(e,t,a)=>{a.d(t,{Cu:()=>r,SM:()=>i,j4:()=>l});var n=a(8361),s=a(77440);function r(e){return e.views.lhs.isOpen}function i(e){return e.views.lhs.currentStaticPageId}const o=(0,a(67173).wV)(),l=(0,n.Mz)("getVisibleSidebarStaticPages",s.WW,o,((e,t)=>{const a=[];return e&&a.push({id:"threads",isVisible:!0}),a.push({id:"drafts",isVisible:t>0}),a.filter((e=>e.isVisible))}))}}]); //# sourceMappingURL=544.0086e1c1357e62f672ca.js.map