Loading
function(e,t,n){"use strict";n.d(t,{A:()=>Y,k:()=>W}),n(142703);var i=n(613412),r=n(136722),a=n(620632),s=n(73153),l=n(178253),o=n(612200),d=n(323073);n(323874),n(14289),n(35956);var c=n(376943),u=n(569745),_=n(288254),E=n(734057),A=n(71393),f=n(652215),h=n(746080);let I=/\/threads\/(\d+)/;function p(e){let t=E.A.getChannel(e);return null!=t&&!(0,d.qR)(t)&&!(0,_.BV)(t)}var m=n(45645),g=n(448741),T=n(357566),S=n(879408),N=n(568185),C=n(362280),O=n(854492),R=n(398884),L=n(700241),y=n(879982),D=n(976860),b=n(46653),v=n(383394),P=n(808728),M=n(309010),U=n(967198),w=n(287809),G=n(129230),x=n(488926),k=n(499785),F=n(157559),B=n(204925),V=n(792996);function H(e){F.A.show({title:V.intl.string(V.t.cTaRxF),body:V.intl.formatToPlainString(V.t["VSd+Aj"],{quantity:e})})}function j(e){s.h.dispatch({type:"GUILD_DELETE",guild:{id:e}})}function W(e){return new Promise(t=>A.A.addConditionalChangeListener(()=>{let n=A.A.getGuild(e);return null==n||(t(n),!1)}))}let Y={joinGuild:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{source:i,loadId:r,lurkLocation:l,autoNavigate:d=!0}=t,c=t.lurker??!1,u=w.default.getCurrentUser();if(u?.hasFlag(f.nhx.QUARANTINED))throw(0,L.default)(),new g.w;s.h.dispatch({type:"GUILD_JOIN",guildId:e,lurker:c,source:i,loadId:r});try{let t=U.A.getGuildId(),o=e===t&&null!=A.A.getGuild(e)?M.Ay.getChannelId(e):null,u=await a.Bo.put({url:f.Rsh.GUILD_JOIN(e),query:{lurker:c,session_id:c?b.default.getSessionId():null,recommendation_load_id:r,location:c&&null!=l?l:null,from_directory:i===f.Q4z.DIRECTORY_ENTRY||null},context:{source:i},oldFormErrors:!0,body:{},rejectWithError:(0,a.fT)()});if(null!=u.body.join_request&&s.h.dispatch({type:"USER_GUILD_JOIN_REQUEST_UPDATE",guildId:e,request:u.body.join_request}),A.A.getGuild(e)?.joinedAt==null&&u.body.show_verification_form&&d)return(0,T.q)(e),u;if(null!=u.body.welcome_screen&&s.h.dispatch({type:"WELCOME_SCREEN_UPDATE",guildId:u.body.id,welcomeScreen:u.body.welcome_screen}),null!=u.body.approximate_presence_count&&s.h.dispatch({type:"ONLINE_GUILD_MEMBER_COUNT_UPDATE",guildId:u.body.id,count:u.body.approximate_presence_count}),!c&&d){let{default:t}=await Promise.resolve().then(n.bind(n,197463));await t({guildId:e,returnChannelId:o})}return u}catch(t){if(t.body?.code===f.t02.USER_GUILD_JOIN_LARGE_GUILD_UNDERAGE_DISALLOWED)throw(0,o.yO)(B.w_.JOIN_LARGE_GUILD_UNDERAGE),new g.w({cause:t});if(t.body?.code===f.t02.TOO_MANY_USER_GUILDS)throw(0,R.Om)(w.default.getCurrentUser())?H(200):H(100),new g.w({cause:t});if(t.body?.code===f.t02.GUILD_AT_CAPACITY)throw F.A.show({title:V.intl.string(V.t.ZZlox4),body:V.intl.string(V.t.ZUEGFn)}),new g.w({cause:t});if(c&&t.body?.code===f.t02.UNKNOWN_GUILD&&j(e),t.body?.code===f.t02.USER_GUILD_JOIN_AGE_RESTRICTED_IOS_DISALLOWED)throw c&&j(e),(0,m.e)(e),new g.w({cause:t});throw t}},waitForGuild:W,async transitionToGuildSync(e,t,n,i){var r;let a=(r=(await W(e)).id,null!=n?n:(0,y.q)(r)[0]),s=t;t?.hasOwnProperty("welcomeModalChannelId")&&null==t.welcomeModalChannelId&&(s={...t,welcomeModalChannelId:a??void 0}),(0,C.A)(f.BVt.CHANNEL(e,a,i),s),await new Promise(setImmediate)},deleteGuild:j,selectGuild(e){(0,O.j)(e)},createGuild(e){s.h.dispatch({type:"GUILD_CREATE",guild:e})},setServerMute:(e,t,n)=>a.Bo.patch({url:f.Rsh.GUILD_MEMBER(e,t),body:{mute:n},oldFormErrors:!0,rejectWithError:(0,a.fT)()}),setServerDeaf:(e,t,n)=>a.Bo.patch({url:f.Rsh.GUILD_MEMBER(e,t),body:{deaf:n},oldFormErrors:!0,rejectWithError:(0,a.fT)()}),setChannel(e,t,n){a.Bo.patch({url:f.Rsh.GUILD_MEMBER(e,t),body:{channel_id:n},oldFormErrors:!0,rejectWithError:!0})},setMemberFlags(e,t,n){a.Bo.patch({url:f.Rsh.GUILD_MEMBER(e,t),body:{flags:n},oldFormErrors:!0,rejectWithError:!0})},kickUser:(e,t,n,i)=>a.Bo.del({url:f.Rsh.GUILD_MEMBER(e,t),query:{reason:n,moderator_report_id:i},oldFormErrors:!0,rejectWithError:(0,a.fT)()}).then(()=>{s.h.dispatch({type:"GUILD_MEMBER_REMOVE_LOCAL",guildId:e,userId:t})}),setCommunicationDisabledUntil(e){let{guildId:t,userId:n,communicationDisabledUntilTimestamp:r,duration:s,reason:l,location:o,moderatorReportId:d}=e;return k.A.patch({url:f.Rsh.GUILD_MEMBER(t,n),reason:l,body:{communication_disabled_until:r,moderator_report_id:d},oldFormErrors:!0,trackedActionData:{event:i.NetworkActionNames.USER_COMMUNICATION_DISABLED_UPDATE,properties:{guild_id:t,target_user_id:n,duration:null!=s?s:null,reason:null!=l?l:null,communication_disabled_until:r,location:null!=o?o:null}},rejectWithError:(0,a.fT)()})},banUser:(e,t,n,i,r)=>a.Bo.put({url:f.Rsh.GUILD_BAN(e,t),reason:i,body:{delete_message_seconds:n,moderator_report_id:r},oldFormErrors:!0,rejectWithError:(0,a.fT)()}),unbanUser:(e,t)=>a.Bo.del({url:f.Rsh.GUILD_BAN(e,t),oldFormErrors:!0,rejectWithError:(0,a.fT)()}),banMultipleUsers:(e,t,n,i)=>a.Bo.post({url:f.Rsh.BULK_GUILD_BAN_V2(e),body:{user_ids:t,delete_message_seconds:n},reason:i,oldFormErrors:!0,rejectWithError:(0,a.fT)()}),async startBulkBan(e,t,n,i){try{if(await this.banMultipleUsers(e,t,n,i),S.A.consumeCompletedBeforeStarted(e,b.default.getId()))return;s.h.dispatch({type:"GUILD_BULK_BAN_STARTED",guildId:e})}catch(t){s.h.dispatch({type:"GUILD_BULK_BAN_FAILED",guildId:e})}},async createRole(e,t,n,i){let{skipSelect:o=!1}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},d={name:null!=t&&""!==t?t:V.intl.string(V.t.QBMHvB),color:n??0,colors:i??{primary_color:n??0,secondary_color:null,tertiary_color:null},permissions:x.x3};try{let t=await a.Bo.post({url:f.Rsh.GUILD_ROLES(e),oldFormErrors:!0,body:d,rejectWithError:(0,a.fT)()}),n=t.body;return n.permissions=r.iu(n.permissions),o||s.h.dispatch({type:"GUILD_SETTINGS_ROLE_SELECT",roleId:t.body.id,role:n}),N.A.checkGuildTemplateDirty(e),n}catch(e){throw new l.A(e)}},async updateRole(e,t,n){let{icon:i,unicodeEmoji:r,...s}=n,l=null===i||i?.startsWith("data:")?i:void 0,o=await a.Bo.patch({url:f.Rsh.GUILD_ROLE(e,t),body:{...s,icon:l,unicode_emoji:r},oldFormErrors:!0,rejectWithError:(0,a.fT)()});return N.A.checkGuildTemplateDirty(e),o},updateRolePermissions:(e,t,n)=>a.Bo.patch({url:f.Rsh.GUILD_ROLE(e,t),body:{permissions:n},oldFormErrors:!0,rejectWithError:(0,a.fT)()}),deleteRole(e,t){a.Bo.del({url:f.Rsh.GUILD_ROLE(e,t),oldFormErrors:!0,rejectWithError:!0}).then(()=>{N.A.checkGuildTemplateDirty(e)})},async batchChannelUpdate(e,t){let n=await a.Bo.patch({url:f.Rsh.GUILD_CHANNELS(e),body:t,oldFormErrors:!0,rejectWithError:(0,a.fT)()});return N.A.checkGuildTemplateDirty(e),n},async batchRoleUpdate(e,t){let n=await a.Bo.patch({url:f.Rsh.GUILD_ROLES(e),body:t,oldFormErrors:!0,rejectWithError:(0,a.fT)()});return N.A.checkGuildTemplateDirty(e),n},requestMembers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return s.h.dispatch({type:"GUILD_MEMBERS_REQUEST",guildIds:Array.isArray(e)?e:[e],query:t,limit:n,presences:i})},searchRecentMembers(e,t){let{query:n,continuationToken:i}=t??{};return s.h.dispatch({type:"GUILD_SEARCH_RECENT_MEMBERS",guildId:e,query:n,continuationToken:i})},requestMembersById(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return s.h.dispatch({type:"GUILD_MEMBERS_REQUEST",guildIds:Array.isArray(e)?e:[e],userIds:Array.isArray(t)?t:[t],presences:n})},requestMembersByIdWithNonce:(e,t,n)=>s.h.dispatch({type:"GUILD_MEMBERS_REQUEST",guildIds:[e],userIds:t,presences:!1,nonce:n}),move(e,t,n,i){s.h.dispatch({type:"GUILD_MOVE",fromIndex:e,toIndex:t,fromFolderIndex:n,toFolderIndex:i})},moveById(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e===t)throw Error(`GuildActionCreators.moveById: \`sourceId\` and \`targetId\` cannot be the same value: ${e}`);s.h.dispatch({type:"GUILD_MOVE_BY_ID",sourceId:e,targetId:t,moveToBelow:n,combine:i})},createGuildFolderLocal(e,t){G.default.track(f.HAw.GUILD_FOLDER_CREATED),s.h.dispatch({type:"GUILD_FOLDER_CREATE_LOCAL",sourceIds:e,name:t})},editGuildFolderLocal(e,t,n){s.h.dispatch({type:"GUILD_FOLDER_EDIT_LOCAL",targetId:e,sourceIds:t,name:n})},deleteGuildFolderLocal(e){s.h.dispatch({type:"GUILD_FOLDER_DELETE_LOCAL",targetId:e})},toggleGuildFolderExpand(e){let t=v.A.isFolderExpanded(e);G.default.track(f.HAw.GUILD_FOLDER_CLICKED,{source:"sidebar",action:t?"collapsed":"expanded"}),s.h.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:e})},setGuildFolderExpanded(e,t){s.h.dispatch({type:"SET_GUILD_FOLDER_EXPANDED",folderId:e,expanded:t})},collapseAllFolders(){s.h.dispatch({type:"GUILD_FOLDER_COLLAPSE"})},nsfwAgree(e){s.h.dispatch({type:"GUILD_NSFW_AGREE",guildId:e})},nsfwReturnToSafety(e){let t=function(){let e=window.navigation,t=e?.currentEntry?.index;if(null==e||null==t)return null;let n=e.entries();for(let e=t;e>=0;e--){let t=n[e].url;if(null==t)continue;let{pathname:i,search:r,hash:a}=new URL(t);if(!(0,u.Q)(i)||i===f.BVt.APP||i.startsWith(`${f.BVt.APP}/`))continue;let s=(0,c.vu)(i),l=s?.channelId;if(null==l||(0,h.jq)(l)){if(null!=s&&s.guildId!==f.ME){let e=s.guildId;if(null==A.A.getGuild(e)||(0,d.k8)(e))continue}}else if(!p(l))continue;let o=i.match(I)?.[1];if(null==o||p(o))return{path:`${i}${r}${a}`,opensChannel:!0}}return null}();if(null!=t)return void(t.opensChannel?(0,D.pX)(t.path):(0,D.pX)(t.path,{navigationReplace:!0}));if(null==e)return void(0,D.pX)(f.BVt.FRIENDS,{navigationReplace:!1,openChannel:!0});let n=P.A.getDefaultChannel(e);null==n||(0,d.qR)(n)||(0,_.BV)(n)?(0,D.pX)(f.BVt.FRIENDS,{navigationReplace:!1,openChannel:!0}):(0,D.pX)(f.BVt.CHANNEL(e,n.id))},spoilerAgree(e){s.h.dispatch({type:"CHANNEL_SPOILER_AGREE",channelId:e})},clearSpoilerAgree(e){s.h.dispatch({type:"CHANNEL_SPOILER_AGREE_CLEAR",channelId:e})},escapeToDefaultChannel(e){let t=P.A.getDefaultChannel(e);null!=t?(0,D.pX)(f.BVt.CHANNEL(e,t.id)):(0,D.pX)(f.BVt.FRIENDS)},async fetchApplications(e,t){let n={url:f.Rsh.GUILD_APPLICATIONS(e),oldFormErrors:!0,rejectWithError:(0,a.fT)()};null!=t&&(n.query={channel_id:t});let i=(await a.Bo.get(n)).body;s.h.dispatch({type:"GUILD_APPLICATIONS_FETCH_SUCCESS",guildId:e,applications:i})},async fetchGuildBansBatch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i={limit:t};null!=n&&(i.after=n),await a.Bo.get({url:f.Rsh.GUILD_BANS(e),oldFormErrors:!0,query:i,rejectWithError:(0,a.fT)()}).then(t=>{s.h.dispatch({type:"GUILD_SETTINGS_LOADED_BANS_BATCH",bans:t.body,guildId:e})})},async searchGuildBans(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,r={limit:i};null!=n&&n.length>0&&(r.user_ids=n),null!=t&&t.trim().length>0&&(r.query=t),await a.Bo.get({url:f.Rsh.GUILD_BANS_SEARCH(e),oldFormErrors:!0,query:r,rejectWithError:(0,a.fT)()}).then(t=>{s.h.dispatch({type:"GUILD_SETTINGS_LOADED_BANS_BATCH",bans:t.body,userIds:n,guildId:e})})},async fetchGuildBans(e){await a.Bo.get({url:f.Rsh.GUILD_BANS(e),oldFormErrors:!0,rejectWithError:(0,a.fT)()}).then(e=>{s.h.dispatch({type:"GUILD_SETTINGS_LOADED_BANS",bans:e.body})})},fetchGuildRoleConnectionsEligibility:(e,t)=>a.Bo.get({url:f.Rsh.GUILD_ROLE_CONNECTIONS_ELIGIBILITY(e,t),oldFormErrors:!0,rejectWithError:(0,a.fT)()}).then(e=>{let{body:n}=e;return s.h.dispatch({type:"GUILD_ROLE_CONNECTION_ELIGIBILITY_FETCH_SUCCESS",roleId:t,roleConnectionEligibility:n}),n}),async assignGuildRoleConnection(e,t){await a.Bo.post({url:f.Rsh.GUILD_ROLE_CONNECTIONS_ASSIGN(e,t),oldFormErrors:!0,rejectWithError:(0,a.fT)()})},async unassignGuildRoleConnection(e,t){await a.Bo.post({url:f.Rsh.GUILD_ROLE_CONNECTIONS_UNASSIGN(e,t),oldFormErrors:!0,rejectWithError:(0,a.fT)()})},getGuildRoleConnectionsConfigurations:async e=>(await a.Bo.get({url:f.Rsh.GUILD_ROLE_CONNECTIONS_CONFIGURATIONS(e),oldFormErrors:!0,rejectWithError:(0,a.fT)()})).body}}