Module 8088

7,402 characters · in 1363d89f74899bc0.js
Dependencies
Source Raw
function(e,t,n){"use strict";let i;n.d(t,{A:()=>eA}),n(321073);var s=n(627968),l=n(64700),a=n(503698),r=n.n(a),o=n(695497),d=n.n(o),c=n(111956),u=n.n(c),h=n(33851),p=n.n(h),A=n(311907),f=n(397927),g=n(442433),m=n(684013),_=n(684136),x=n(34968),E=n(775121),y=n(836753),v=n(793574),S=n(688810),C=n(235986);n(607470);var I=n(15285),N=n(880144),T=n(905552),O=n(768841),b=n(265367),j=n(616356),D=n(734057),R=n(71393),L=n(555528),w=n(430452),k=n(309010),M=n(70142),P=n(157257),G=n(712687),V=n(532624),U=n(242286),z=n(899699),H=n(256415),W=n(531685),K=n(927813),B=n(723702),F=n(837921),Y=n(316501),Z=n(350535),X=n(9302),J=n(41984),Q=n(589051),q=n(223251),$=n(227308),ee=n(409110),et=n(160162),en=n(755029),ei=n(592598),es=n(672396);n(644434);var el=n(652215),ea=n(985018),er=n(610291);A.Ay.PersistedStore.disableWrites=__OVERLAY__,A.Ay.initialize();let eo=null;function ed(e){e.preventDefault()}function ec(e){(0,g.L3)(e,async()=>{let{default:e}=await n.e("92843").then(n.bind(n,254790));return t=>(0,s.jsx)(e,{...t,version:0})})}B.isPlatformEmbedded;let eu=e=>{let{keybind:t,onClick:n,isPreviewingInGame:i,locked:l}=e,a=l?f.DUT:"div";return(0,s.jsx)(a,{className:r()(er.LK,{[er.Zo]:!l,[er.vZ]:l,[er.Az]:!l&&i}),onMouseDown:e=>{let{currentTarget:t,target:i,button:s}=e;s===el.hE4.PRIMARY&&t===i&&n()},onContextMenu:ec,children:l?null:(0,s.jsx)("div",{className:er.G3,children:(0,s.jsx)(_.A,{variant:_.A.Variants.BOLD,keybind:t,closeAction:n})})})},eh=e=>{let{keyCode:t,shiftKey:n,metaKey:i,altKey:s,ctrlKey:l}=e;return{keyCode:t,shiftKey:n,metaKey:i,altKey:s,ctrlKey:l}};class ep extends l.Component{didUpdate=!1;constructor(e){super(e);const t=e.locked&&H.default.isPinned(el.uss.TEXT);E.A.setLayout(t?x.dY:x.CJ),t&&E.A.enable()}handleLock(){(0,f.ueM)()||G.A.isOpen()||m.A.setInputLocked(!0,(0,X.getPID)())}handleDeactivate(){m.A.deactivateAllRegions()}debouncedForceUpdate=u()(()=>{this.forceUpdate()},500);handleWindowResize=()=>{U.default.isFocusedPidOutOfProcess()?this.forceUpdate():this.debouncedForceUpdate()};componentDidMount(){m.A.startSession(),O.A.initialize(),y.A.initialize(),b.A.initialize()}componentDidUpdate(e){let{initialized:t}=this.props;if(t){if(!this.didUpdate){this.didUpdate=!0,this.initialSetup();return}if(!e.locked&&this.props.locked){if(window.addEventListener("contextmenu",ed,!1),null!=eo){let e=Date.now()-eo;m.A.track(el.HAw.OVERLAY_LOCKED,{unlocked_duration:e}),eo=null}E.A.disable(),this.activeKeyEventShapes=[],H.default.isPinned(el.uss.TEXT)&&(E.A.setLayout(x.dY),E.A.enable())}else e.locked&&!this.props.locked&&(window.removeEventListener("contextmenu",ed,!1),null==eo&&(eo=Date.now(),m.A.track(el.HAw.OVERLAY_UNLOCKED)),E.A.disable(),this.activeKeyEventShapes=[],E.A.setLayout(x.CJ),E.A.enable());e.keybindKeyCodes!==this.props.keybindKeyCodes&&(this.lockEventShape=(0,Z.pi)(this.props.keybindKeyCodes))}}initialSetup(){let e,{connectedToVoice:t,locked:i,canGoLive:l,isStreaming:a,voiceGuild:r,voiceChannelId:o,game:d}=this.props;m.A.track(el.HAw.OVERLAY_INITIALIZED,{voice_widget_connected:t,text_widget_connected:H.default.isPinned(el.uss.TEXT),overlay_render_method:J.Ue[J.Ue.Hook],unpinned_widget_types:L.A.getAllUnpinnedPinnedWidgets(X.OVERLAY_LAYOUT_ID)});let c=l&&!a&&null!=d,u=t&&null!=r&&null!=o,h=ei.A.isNotificationDisabled(es.KS.WelcomeNudge),p=ei.A.isNotificationDisabled(es.KS.GoLiveNudge);if(h||(e={type:es.Jr.WELCOME}),c&&u&&!p?e={type:es.Jr.GO_LIVE_VOICE,game:d,voiceChannelId:o,voiceGuild:r}:c&&!p&&(e={type:es.Jr.GO_LIVE_NON_VOICE,game:d}),setTimeout(async()=>{await (0,Y.pF)(),null!=e?m.A.overlayMounted(e):m.A.overlayMounted()},128),window.addEventListener("resize",this.handleWindowResize),i&&window.addEventListener("contextmenu",ed,!1),B.isPlatformEmbedded){let e=(0,z.m)();if(null==e)return;void 0!==e.setPerfInfoCallback&&(e.setPerfInfoCallback(e=>{m.A.track(el.HAw.OVERLAY_PERF_INFO,e)}),e.broadcastCommand?.({message:"set_perf_report_interval",interval:15*K.A.Millis.MINUTE})),F.Ay.on("REQUEST_OPEN_EXTERNAL_URL",(e,t)=>{H.default.getDisableExternalLinkAlert()||t===M.A.getLastURL()?F.Ay.send("OPEN_EXTERNAL_URL",t):(0,f.mMO)(async()=>{let{default:e}=await n.e("30582").then(n.bind(n,613429));return n=>(0,s.jsx)(e,{...n,url:t})})})}window.addEventListener("keydown",this.onKeyDownGlobal,!0),window.addEventListener("keyup",this.onKeyUpGlobal,!0)}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("keydown",this.onKeyDownGlobal,!0),window.removeEventListener("keyup",this.onKeyUpGlobal,!0),this.props.locked&&window.removeEventListener("contextmenu",ed,!1),O.A.terminate(),y.A.terminate(),b.A.terminate()}activeKeyEventShapes=[];lockEventShape=(0,Z.pi)(this.props.keybindKeyCodes);getActiveKeyEventIndex=e=>this.activeKeyEventShapes.findIndex(t=>p()(t,e));onKeyDownGlobal=e=>{let t=eh(e),n=this.getActiveKeyEventIndex(t)>-1,i=[16,17,18,91].includes(e.keyCode);n||i||this.activeKeyEventShapes.push(t),this.activeKeyEventShapes.length===this.lockEventShape.length&&this.lockEventShape.every(e=>this.activeKeyEventShapes.some(t=>p()(e,t)))&&(e.preventDefault(),e.stopPropagation());let{locked:s,activeRegions:l}=this.props;t.keyCode===d().codes.esc&&s&&l.has(el.ajI.TEXT_WIDGET)&&m.A.deactivateAllRegions()};onKeyUpGlobal=e=>{let t=eh(e),n=this.getActiveKeyEventIndex(t);n>-1&&this.activeKeyEventShapes.splice(n,1)};renderInvalidSizeMessage(){return(0,s.jsx)(C.A,{justify:C.A.Justify.CENTER,align:C.A.Align.CENTER,className:er.rU,children:(0,s.jsx)("div",{className:er.JV,children:ea.intl.format(ea.t.ketnW0,X.OVERLAY_MIN_RESOLUTION)})})}render(){let{locked:e,keybind:t,incompatibleApp:n,initialized:l,isPreviewingInGame:a,activeRegions:o,windowSize:d}=this.props,{width:c,height:u}=d;if(0===c||0===u||n||!l)return null;let h=e||a;return(0,s.jsxs)("div",{className:er.Lw,children:[(0,s.jsx)(et.A,{}),a&&(0,s.jsx)("header",{className:er.tk,children:ea.intl.string(ea.t.iOq96m)}),i,(!e||o.has(el.ajI.TEXT_WIDGET))&&(0,s.jsx)(eu,{locked:e,keybind:t,onClick:e?this.handleDeactivate:this.handleLock,isPreviewingInGame:a}),(0,X.validResolution)(d)?(0,s.jsx)(ee.A,{className:r()({[er.ZK]:e,[er.al]:!e})}):e?null:this.renderInvalidSizeMessage(),(0,s.jsx)(en.A,{}),(0,s.jsx)($.A,{locked:h,keybind:t}),(0,s.jsx)(q.A,{}),(0,s.jsx)("div",{className:er._C})]})}}function eA(){let{locked:e,initialized:t,incompatibleApp:n,activeRegions:i,isPreviewingInGame:a}=(0,A.cf)([H.default],()=>({locked:H.default.isLocked((0,X.getPID)()),initialized:H.default.initialized,incompatibleApp:H.default.incompatibleApp,activeRegions:H.default.getActiveRegions(),isPreviewingInGame:H.default.isPreviewingInGame()})),r=(0,A.bG)([W.A],()=>W.A.windowSize()),o=(0,A.bG)([V.Ay],()=>V.Ay.getOverlayKeybind()),d=(0,A.bG)([k.A],()=>k.A.getVoiceChannelId()),c=(0,A.bG)([D.A],()=>D.A.getChannel(d)),u=(0,A.bG)([R.A],()=>null!=c?R.A.getGuild(c.guild_id):null),h=(0,A.bG)([I.Ay,P.A],()=>(0,T.A)(I.Ay,P.A)),p=(0,A.bG)([w.Ay],()=>(0,N.A)(w.Ay)),f=(0,A.bG)([j.A],()=>null!=j.A.getCurrentUserActiveStream()),{analyticsLocations:g}=(0,S.Ay)(v.A.OVERLAY);return l.useEffect(()=>{t&&(0,Q.E)()},[t]),(0,s.jsx)(S.f5,{value:g,children:(0,s.jsx)(ep,{locked:e,initialized:t,incompatibleApp:n,activeRegions:i,isPreviewingInGame:a,windowSize:r,keybind:null!=o?(0,Z.dI)(o.shortcut,!0):"???",keybindKeyCodes:null!=o?o.shortcut:[],connectedToVoice:null!=d,voiceChannelId:null!=c?c.id:null,voiceGuild:u,game:h,canGoLive:p,isStreaming:f})})}}