Build 614181stable
Module 979186
8,846 characters · in 2bb1f50d6fc5248e.jsDependencies
Lazily required by (0)none
Requires (66)
142141792819575285284198443990718559296097469121894144400164942192308203480231723258873259678261289267102284009287809302614318009337836346142375708392164435558477900479669489277503698549205557361561028573435577063582128590703597619622242638495652215670735672396677134681582684013688810697138723702731738750506775602777334780907793574807393834730869146892019927813933958964486965830976860
Lazily requires (0)none
Source Raw
function(e,t,n){n.d(t,{q:()=>eE,A:()=>eN});var r=n(477900),i=n(582128),s=n(503698),l=n.n(s),o=n(284009),a=n.n(o),c=n(561028),d=n(121894),u=n(337836),h=n(43990),f=n(557361),g=n(17928),p=n(192308),m=n(231723),A=n(259678),v=n(638495),y=n(965830),x=n(318009),w=n(92960),E=n(14214),C=n(775602),b=n(697138),N=n(933958),O=n(793574),_=n(688810),D=n(590703),I=n(681582),T=n(573435),j=n(71855),k=n(203480),S=n(670735),L=n(549205),P=n(750506),R=n(267102),M=n(435558),U=n.n(M),K=n(479669),G=n(258873),F=n(622242),B=n(731738),V=n(834730),W=n(780907),H=n(684013),Y=n(964486),z=n(807393),J=n(976860),X=n(287809),$=n(144400),Z=n(927813),q=n(777334),Q=n(41984),ee=n(302614),et=n(489277),en=n(28528),er=n(672396),ei=n(652215),es=n(375708),el=n(261289);let eo=U().throttle(()=>{z.A.increment({name:B.K.APP_CRASHED,tags:[`reason:${G.J.UNHANDLED_JS_ERROR}`,`level:${F.k.FATAL}`]},!0)},100,{trailing:!1}),ea=10*Z.A.Millis.SECOND;function ec(e){let{error:t,onLock:n,onReload:s,onDisable:l,onCrashDisabled:o}=e,a=i.useMemo(()=>new K.SpringValue(1),[]),c=i.useRef(null),[d,u]=i.useState(!1),[h,f]=i.useState(!1),p=(0,g.bG)([X.default],()=>X.default.getCurrentUser());(0,Y.Ay)(()=>(c.current=setTimeout(A,ea),H.A.track(ei.HAw.NOTIFICATION_VIEWED,{notif_type:er.KS.OverlayCrashed}),()=>{null!=c.current&&clearTimeout(c.current)}));let m=(p?.isStaff()??!1)||(p?.isStaffPersonal()??!1),A=i.useCallback(()=>{a.set(0),null!=c.current&&clearTimeout(c.current),c.current=null,n?.(),o?.()},[a,n,o]),v=i.useCallback(e=>{h||(f(!0),n?.(),H.A.track(ei.HAw.NOTIFICATION_CLICKED,{notif_type:er.KS.OverlayCrashed,action_type:"reload"},!0),e.stopPropagation(),setTimeout(()=>s?.(),200))},[n,s,h]),y=i.useCallback(e=>{e.stopPropagation(),e.shiftKey?(u(!0),null!=c.current&&clearTimeout(c.current)):u(!1)},[u]),x=i.useCallback(e=>{e.stopPropagation(),n?.(),l?.()},[l,n]),w=(0,g.bG)([et.A],()=>et.A.getFocusedRunningGame()),E=d?(0,r.jsxs)("div",{children:[(0,r.jsx)(V.E,{variant:"text-md/semibold",color:"text-strong",children:es.intl.string(es.t.mn4eXC)}),(0,r.jsxs)("div",{className:el.Xh,children:[(0,r.jsx)(V.E,{variant:"text-sm/normal",color:"text-subtle",children:t.message}),(0,r.jsx)(V.E,{variant:"text-xxs/normal",color:"text-subtle",children:(0,r.jsx)("code",{className:el.aY,children:(0,r.jsx)("pre",{children:t.stack})})})]})]}):null,C=d?null:es.intl.string(es.t.oEJEFq);return(0,r.jsx)(en.$,{title:es.intl.string(es.t.U38qZj),body:E,hint:m?C:void 0,confirmText:es.intl.string(es.t.a3HlgJ),cancelText:null!=w?es.intl.string(es.t.qIYnPo):void 0,icon:(0,r.jsx)($.A,{width:40,height:40,className:el.Lo}),onNotificationClick:y,onConfirmClick:v,onCancelClick:null!=w?x:void 0,onDismissClick:n,expand:!0,locked:!0,notificationId:"overlay-crashed",index:0,status:ei.yFH.ACTIVE,containerRef:null,contentOpacity:a,className:el.Pl,wrapperClassName:el.fl})}class ed extends i.PureComponent{state={error:null,showError:!0,info:null};pid=null;componentDidCatch(e,t){let n=(0,J.JK)().location;this.setState({error:e,info:t});let r=et.A.getTargetPID();H.A.setOverlayCrashed(r,e),H.A.setInputLocked(!0,r);let i=(0,q.St)(e,Q.Ue.OutOfProcess,{extra:{info:t,location:n}});H.A.track(ei.HAw.APP_CRASHED,{path:n.pathname,extra:t,error_message:e.message,error_stack:e.stack,sentry_issue_id:i,error_level:"fatal"}),eo(),this.pid=r}render(){let{children:e,className:t}=this.props,{error:n,showError:i}=this.state;return null!=n?i?(0,r.jsx)(ee.A,{className:el.wz,children:(0,r.jsx)(ec,{error:n,onLock:()=>{let e=this.pid??et.A.getTargetPID();H.A.setInputLocked(!0,e),this.setState({showError:!1})},onDisable:()=>{let e=et.A.getFocusedRunningGame();null!=e&&W.Ay.toggleOverlay(e,!1,!1)},onCrashDisabled:()=>{let e=this.pid??et.A.getTargetPID();H.A.updateOverlayState(e,Q.AR.OVERLAY_CRASHED_DISABLED,"OOPOverlayErrorBoundary"),this.setState({showError:!1})},onReload:()=>{H.A.setReloadOverlay(et.A.getTargetPID()),this.setState({showError:!1})}})}):null:(0,r.jsx)("div",{className:t,children:e})}}var eu=n(97469),eh=n(164942),ef=n(597619),eg=n(892019),ep=n(723702),em=n(677134),eA=n(19575),ev=n(346142),ey=n(869146),ex=n(392164),ew=n(577063);function eE(e){let{withTitleBar:t,isFullScreen:n}=e;return t&&ep.isPlatformEmbedded&&!n}class eC extends i.Component{rootRef=i.createRef();_cleanupWindowActionCreators=void 0;_combokeys=null;static defaultProps={withTitleBar:!0};componentDidMount(){let{guestWindow:e}=this.props,t=e.document;null==t.querySelector("title")&&null!=t.head&&t.head.appendChild(t.createElement("title")),this.updateTitle(),this.updateClientTheme(),(0,ev.M)(e),e.addEventListener("blur",this.handleBlur),ep.isPlatformEmbedded?t.addEventListener("contextmenu",em.contextMenuCallbackNative,!1):t.addEventListener("contextmenu",em.contextMenuCallbackWeb,!1),e.addEventListener("beforeunload",this.beforeUnload),this.registerPopoutGlobalKeybinds()}beforeUnload=e=>{let{onBeforeUnload:t}=this.props,n=()=>{ey.A.unmountWindow(this.props.windowKey),ep.isPlatformEmbedded&&eA.Ay.close(this.props.windowKey)};null!=t?t({e,unmountWindow:n}):n()};componentDidUpdate(e){let{title:t,clientThemesCSS:n}=this.props;e.title!==t&&this.updateTitle(),e.clientThemesCSS!==n&&this.updateClientTheme()}componentWillUnmount(){let{guestWindow:e}=this.props,t=e.document;this.unregisterPopoutGlobalKeybinds(),e.removeEventListener("blur",this.handleBlur),ep.isPlatformEmbedded?t.removeEventListener("contextmenu",em.contextMenuCallbackNative):t.removeEventListener("contextmenu",em.contextMenuCallbackWeb),(0,d.r)(()=>p.useModalsStore.setState(e=>({...e,[m.KX]:[]}))),e.removeEventListener("beforeunload",this.beforeUnload)}updateTitle(){let{title:e,guestWindow:t}=this.props,n=t.document.querySelector("title");null!=n&&(n.innerText=e)}updateClientTheme(){let{clientThemesCSS:e,guestWindow:t}=this.props,n=t.document,r=n.head;a()(null!=r,"Window document head was null");let i=r.querySelector(`style[${D.Vg}]`);if(null!=i){i.textContent=e;return}let s=n.createElement("style");s.setAttribute(D.Vg,"true"),s.textContent=e,r.appendChild(s)}handleBlur=()=>{this.props.onBlur?.()};registerPopoutGlobalKeybinds(){let{guestWindow:e,channelId:t}=this.props,n=e.document;for(let e of(this._combokeys=(0,L.I)(n.documentElement),[E.VT,E.rR,(0,w.LB)(t),...this.props.keybinds??[]]))if(e.comboKeysBindGlobal)for(let t of e.binds)this._combokeys.bindGlobal(t,(t,n)=>("function"==typeof e.action&&e.action(t,n),!1))}unregisterPopoutGlobalKeybinds(){null!=this._combokeys&&this._combokeys.reset()}render(){let{forcedColors:e,children:t,windowKey:n,isFullScreen:i,withTitleBar:s,guestWindow:o,clientThemesClassName:a,contentClassName:d,themeOverride:g,titleBarTheme:p,hideModals:m=!1,appContext:y}=this.props,w=eE({withTitleBar:s,isFullScreen:i}),E=n===ex.f,C=E?ed:S.A;return(0,r.jsx)(c.Kd,{children:(0,r.jsx)(eh.e,{windowKey:n,themeOverride:g,children:(0,r.jsx)(b.A,{children:(0,r.jsxs)(A.xp,{containerRef:this.rootRef,children:[(0,r.jsx)(eb,{guestWindow:o,className:l()(a,{overlay:E}),children:(0,r.jsxs)(C,{children:[(0,r.jsx)(T.Al,{}),(0,r.jsx)(R.Wr,{appContext:y??ei.BRT.POPOUT,renderWindow:o,children:(0,r.jsx)(I.l,{children:(0,r.jsxs)(P.Yf,{children:[(0,r.jsxs)("div",{className:ew.SW,children:[w&&(0,r.jsx)(h.N,{theme:p,children:e=>(0,r.jsx)(j.cq,{windowKey:n,className:l()(e,ew.uv)})}),(0,r.jsx)("div",{className:l()(ew.Qs,d),children:t})]}),!m&&(0,r.jsx)(v.b,{}),(0,r.jsx)(x.A,{}),(0,r.jsx)(u.P,{}),(0,r.jsx)(P.C8,{})]})})})]})}),(0,r.jsx)(f.Ut,{})]})})},e)})}}let eb=i.forwardRef(function(e,t){let{guestWindow:n,className:s,children:o}=e,{lang:c,style:d,className:u}=(0,ef.xb)();i.useEffect(()=>{let e=n.document.documentElement;a()(null!=e,"Window document element was null"),e.setAttribute("style",d)},[n,d]),i.useEffect(()=>{let e=n.document.documentElement;a()(null!=e,"Window document element was null"),e.setAttribute("lang",c)},[n,c]),(0,eg.A)(n.document.documentElement);let h=l()(u,s,"in-popout");return i.useLayoutEffect(()=>{let e=n.document.documentElement;a()(null!=e,"Window document element was null"),e.setAttribute("class",h)},[n,h]),(0,r.jsx)("div",{"data-popout-root":!0,ref:t,children:o})}),eN=i.forwardRef(function(e,t){let{guestWindow:n,isFullScreen:i}=(0,g.cf)([ey.A],()=>({guestWindow:ey.A.getWindow(e.windowKey),isFullScreen:ey.A.isWindowFullScreen(e.windowKey)}));a()(null!=n,"Missing guestWindow reference");let{forcedColors:s,connectedEmbeddedActivity:l}=(0,g.cf)([C.Ay,N.Ay],()=>({forcedColors:C.Ay.useForcedColors?"yes":"no",connectedEmbeddedActivity:N.Ay.getCurrentEmbeddedActivity()}));(0,k.A)(n,!1);let{analyticsLocations:o}=(0,_.Ay)(O.A.POPOUT_WINDOW),{clientThemesClassName:c,clientThemesCSS:d}=(0,D.Ay)(),u=(0,eu.NC)(),h=e.themeOverride??u;return null==n?null:(0,r.jsx)(y.W,{children:(0,r.jsx)(_.f5,{value:o,children:(0,r.jsx)(eC,{ref:t,...e,titleBarTheme:h,guestWindow:n,isFullScreen:i,forcedColors:s,connectedEmbeddedActivity:l,clientThemesClassName:c,clientThemesCSS:d})})})})}