Build 608660stable
Module 531685
2,291 characters · in no known chunkDependencies
Required by (72)
2459445837570195934573473738708398292960114166119031139384145497159730164942174755183636184809197808208343218394267889273147276208305385326337328461350527368033382567392553401124416799423562436405474397492385493387503509519342548118556525573163578839588857589158590114599812635832684013692200710637725807728321736924739416790610802867806911812808815280819235827059828515869014869362888250908742915614946228951592963977970812
Lazily required by (0)none
Lazily requires (1)
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>A});var i=n(284009),r=n.n(i),a=n(17928),s=n(228366),l=n(365971);let o=null,d=new Map,c=new Set;function u(e){let t=d.get(e);return null==t?(c.has(e)||console.warn("Window state not initialized",e),{isElementFullscreen:!1,focused:!1,windowSize:{width:0,height:0},visible:!1}):t}class _ extends a.Ay.Store{static displayName="WindowStore";isFocused(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.Xg)();return u(e).focused}isAppFocused(){return null!=this.getFocusedWindowId()}isVisible(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.Xg)();return u(e).visible}getFocusedWindowId(){let e=null;return d.forEach((t,n)=>{t.focused&&(e=n)}),e}getLastFocusedWindowId(){return o}isElementFullScreen(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.Xg)();return u(e).isElementFullscreen}windowSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,l.Xg)();return u(e).windowSize}}let E=new _(s.h,{WINDOW_INIT:function(e){r()(!d.has(e.windowId),"Window initialized multiple times");let{width:t,height:n,isElementFullscreen:i,focused:a,visible:s}=e;return d.set(e.windowId,{windowSize:{width:t,height:n},isElementFullscreen:i,focused:a,visible:s}),a&&(o=e.windowId),!0},WINDOW_FULLSCREEN_CHANGE:function(e){let t=u(e.windowId);return t.isElementFullscreen!==e.isElementFullscreen&&(d.set(e.windowId,{...t,isElementFullscreen:e.isElementFullscreen}),!0)},WINDOW_FOCUS:function(e){let t=u(e.windowId);return t.focused!==e.focused&&(e.focused&&(o=e.windowId),d.set(e.windowId,{...t,focused:e.focused}),!0)},WINDOW_RESIZED:function(e){let t=u(e.windowId);return(t.windowSize.width!==e.width||t.windowSize.height!==e.height)&&(d.set(e.windowId,{...t,windowSize:{width:e.width,height:e.height}}),!0)},WINDOW_UNLOAD:function(e){return c.add(e.windowId),d.delete(e.windowId),o===e.windowId&&(o=null),!0},WINDOW_VISIBILITY_CHANGE:function(e){let t=u(e.windowId);return t.visible!==e.visible&&(d.set(e.windowId,{...t,visible:e.visible}),!0)}});Promise.resolve().then(n.bind(n,174459)).then(e=>{let{addExtraAnalyticsDecorator:t}=e;t(e=>{{e.client_app_state=E.isAppFocused()?"focused":"unfocused";let t=E.windowSize();e.client_viewport_width=t.width,e.client_viewport_height=t.height}})});let A=E}