Build 545032stable
Module 422844
1,385 characters · in 4ab0ef30505b744b.jsDependencies
Source Raw
function(t,e,a){a.d(e,{R:()=>p,p:()=>A});var n=a(284009),s=a.n(n),l=a(353640),r=a(371444),h=a(392421),g=a(602137),i=a(121894),S=a(17928),u=a(734057),o=a(679804);let C=new Set,T={layoutType:r.C.LIST,sortOrder:g.T.CREATION_DATE,tagFilter:C,tagSetting:h.n.MATCH_SOME};class d{set;get;channelStates={};constructor(t,e){this.set=t,this.get=e}setChannelState=(t,e)=>{let a=this.get(),n=this.getChannelState(t),s={...a.channelStates};s[t]={...n,...e},(0,i.r)(()=>this.set({channelStates:s}))};getChannelState=t=>{if(null==t)return T;let{channelStates:e}=this.get(),a=e[t];if(null==a){let e=u.A.getChannel(t);s()(null!=e,"[Forum Channel Store] The channel should not be missing."),a={layoutType:e.getDefaultLayout(),sortOrder:e.getDefaultSortOrder(),tagFilter:C,tagSetting:e.getDefaultTagSetting()}}return a};toggleTagFilter=(t,e)=>{let a=new Set(this.getChannelState(t).tagFilter);a.has(e)?a.delete(e):a.add(e),this.setTagFilter(t,a)};setTagFilter=(t,e)=>{this.setChannelState(t,{tagFilter:e}),o.A.setFilterTagIds(e)};setSortOrder=(t,e)=>{this.setChannelState(t,{sortOrder:e}),o.A.setSortOrder(e)};setLayoutType=(t,e)=>{this.setChannelState(t,{layoutType:e}),o.A.setLayout(e)};setTagSetting=(t,e)=>{this.setChannelState(t,{tagSetting:e}),o.A.setTagSetting(e)}}let c=(0,l.v)((t,e)=>new d(t,e)),p=t=>{let e=c();return null==(0,S.bG)([u.A],()=>u.A.getChannel(t))?T:e.getChannelState(t)},A=()=>c}