Build 571251stable
Module 503509
2,378 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";let i;n.d(t,{A:()=>D,c:()=>g});var r=n(17928),s=n(506774),a=n(228366),o=n(313961),l=n(885386),u=n(617617),c=n(164891),d=n(495544),_=n(734057),h=n(461213),f=n(607567),p=n(531685),E=n(652215);let m={width:232,height:315},g={width:400,height:374},A=new Set,I=[],T=new Map,S=new Set,y=!1;function C(e){if(null==e||null==T.get(e))return!1;T.delete(e),(S=new Set(S)).delete(e)}function N(e){let{channelId:t,ongoingRings:n}=e,r="GUILD_RING_START"===e.type;if(r&&!c.A.getCurrentConfig({guildId:e.guildId,location:"IncomingCallCreate"}).enabled)return!1;let s=d.default.getId(),a=s in n&&null!=n[s];if(!S.has(t)&&a){var l;let e,a,u=_.A.getChannel(t);if(null==u)return!1;let d=10*S.size,{x:h,y:E}=(l=r?u:void 0,e=p.A.windowSize(),a=function(e){let{enabled:t}=c.A.getCurrentConfig({guildId:e?.guild_id,location:"IncomingCallStore"});if(e?.guild_id==null||!t)return m;let n=f.Ay.getVoiceStatesForChannel(e).filter(t=>!o.A.getGuildRingingUsers(e.id).has(t.user.id)),i=n.length>2,r=48*Math.min(n.length,2)+22*!!i;return{...g,height:g.height+r}}(l),null!=i&&i.x+a.width<e.width&&i.y+a.height<e.height?i:{x:e.width/2-a.width/2,y:e.height/2-a.height/2});return T.set(t,{channel:u,senderId:n[s],x:h+d,y:E+d}),void(S=new Set(S)).add(t)}return!!S.has(t)&&!a&&C(t)}function v(e){let{channelId:t}=e;return("GUILD_RING_STOP"!==e.type||!!c.A.getCurrentConfig({guildId:e.guildId,location:"IncomingCallDelete"}).enabled&&!!e.ringing.includes(d.default.getId()))&&C(t)}function R(){y=h.A.getStatus()===E.clD.DND||l.NO.getSetting()}function O(){let e=d.default.getId();S.forEach(t=>{null==_.A.getChannel(t)?.guild_id||o.A.getGuildRingingUsers(t).has(e)||C(t)})}class b extends r.Ay.Store{static displayName="IncomingCallStore";initialize(){this.waitFor(d.default,o.A,_.A,h.A,f.Ay,u.A,p.A),this.syncWith([h.A],R),this.syncWith([u.A],R),this.syncWith([o.A],O)}getIncomingCalls(){return y?I:Array.from(T.values())}getIncomingCallChannelIds(){return y?A:S}getFirstIncomingCallId(){return y?null:S.values().next().value}hasIncomingCalls(){return!y&&S.size>0}}let D=new b(a.h,{CALL_CREATE:N,CALL_UPDATE:N,CALL_DELETE:v,GUILD_RING_START:N,GUILD_RING_STOP:v,VOICE_CHANNEL_SELECT:function(e){let{channelId:t}=e;return C(t)},INCOMING_CALL_MOVE:function(e){let{x:t,y:n}=e;return i={x:t,y:n},s.w.set("IncomingCallStore",i),!1},CHANNEL_DELETE:function(e){let{channel:t}=e;return C(t.id)}})}