1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5480],{17403:(e,t,n)=>{function r(e){return`beegames:play-orientation:${e}`}function i(e,t){try{var n;return n=(t??window.localStorage).getItem(r(e)),"landscape"===n||"portrait"===n?n:null}catch{return null}}function a(e,t,n){try{(n??window.localStorage).setItem(r(e),t)}catch{}}function o(e,t){let n=null!=t&&"object"==typeof t?t:{override:t},r=n.override;if(r)return{orientation:r,source:"override",locked:!1};let i=n.deviceOrientation??l(),a=()=>({orientation:i,source:"device",locked:!1}),o=function(e,t){let n="portrait"===t?e.devicePortraitFrame??e.device_portrait_frame:e.deviceLandscapeFrame??e.device_landscape_frame;return"landscape"===n||"portrait"===n?n:"auto"}(e,i);if("auto"!==o)return{orientation:o,source:"device_frame",locked:!0};let s=e.playOrientation??e.play_orientation??e.orientation,c=e.orientationConfidence??e.orientation_confidence??0,u=e.orientationLocked??e.orientation_locked??!1;if(("landscape"===s||"portrait"===s)&&c>=.75)return{orientation:s,source:"server",locked:u};if("responsive"===s)return{orientation:i,source:"device",locked:u};let d=Number(e.width),f=Number(e.height);return d>0&&f>0?d===f?a():{orientation:f>d?"portrait":"landscape",source:"dimensions",locked:!1}:a()}function l(){return window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function s(e,t){return`${e}:${t}`}n.d(t,{$b:()=>d,Fm:()=>o,Gj:()=>u,PR:()=>l,R8:()=>i,lG:()=>s,ow:()=>a});let c=new Map;function u(e,t){if(!e)return;let n=c.get(e);(n||t.initial&&t.final)&&c.set(e,{initial:t.initial??n.initial,final:t.final??n.final,switches:t.switches??(null==n?void 0:n.switches)??0,visibleStartedAt:"visibleStartedAt"in t?t.visibleStartedAt??null:(null==n?void 0:n.visibleStartedAt)??null,visibleMs:t.visibleMs??(null==n?void 0:n.visibleMs)??0})}function d(e,t){let n=e?c.get(e):void 0,r=t?o(t).orientation:"landscape";return{initial_orientation:(null==n?void 0:n.initial)??r,final_orientation:(null==n?void 0:n.final)??r,orientation_switch_count:(null==n?void 0:n.switches)??0,visible_duration_ms:((null==n?void 0:n.visibleMs)??0)+((null==n?void 0:n.visibleStartedAt)==null?0:Date.now()-n.visibleStartedAt),device_orientation:l()}}},56745:(e,t,n)=>{n.d(t,{Ff:()=>c,oK:()=>s,vn:()=>l});let r="/_player/embed.html";function i(e){return"https:"===e.protocol&&(""===e.port||"443"===e.port)}function a(e){return/%(?:2e|2f|5c)/i.test(e)}function o(e){let t;if(!("img.bee.games"===e.hostname?e.pathname.startsWith("/games/")&&e.pathname.length>7:"f.bee.games"===e.hostname&&(e.pathname.startsWith("/flashpoint/")&&e.pathname.length>12||"/_player/ruffle.html"===e.pathname))||a(e.pathname))return!1;if(!/(?:^|\/)_player\/ruffle\.html$/.test(e.pathname))return!0;let n=[...e.searchParams.keys()];if(1!==n.length||"swf"!==n[0]||1!==e.searchParams.getAll("swf").length)return!1;let r=e.searchParams.get("swf");if(!r)return!1;try{t=new URL(r,e.origin)}catch{return!1}return t.origin===e.origin&&i(t)&&""===t.username&&""===t.password&&""===t.hash&&t.pathname.startsWith("/flashpoint/")&&!a(t.pathname)}function l(e){let t,n=e.split(/[?#]/,1)[0];try{t=new URL(e)}catch{return e}if(!i(t)||""!==t.username||""!==t.password||t.pathname===r||e.includes("\\")||/\/(?:\.{1,2})(?:\/|$)/.test(n)||a(n)||""!==t.hash||!o(t))return e;let l=new URL(r,t.origin);return l.searchParams.set("src",`${t.pathname}${t.search}`),l.href}function s(e){let t;try{t=new URL(e)}catch{return!1}if(!i(t)||""!==t.username||""!==t.password||t.pathname!==r||""!==t.hash)return!1;let n=[...t.searchParams.keys()];if(1!==n.length||"src"!==n[0]||1!==t.searchParams.getAll("src").length)return!1;let a=t.searchParams.get("src");if(!a||a.includes("\\"))return!1;let l=new URL(a,t.origin);return l.origin===t.origin&&""===l.hash&&`${l.pathname}${l.search}`===a&&o(l)}function c(e,t){e.src=l(t)}},95480:(e,t,n)=>{n.d(t,{A:()=>_});var r=n(50692),i=n(92616),a=n(30004),o=n(56745);let l="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gamepad; gyroscope; picture-in-picture; pointer-lock",s="allow-scripts allow-same-origin allow-forms allow-modals allow-orientation-lock allow-pointer-lock";function c(e){return" "===e||"Spacebar"===e||"ArrowUp"===e||"ArrowDown"===e||"ArrowLeft"===e||"ArrowRight"===e||"PageUp"===e||"PageDown"===e}function u(e){null==e||e.focus({preventScroll:!0})}let d=(0,i.forwardRef)(function(e,t){let{src:n,title:a,width:d,height:h,onLoad:m,onError:v,className:p}=e,w=!!(d&&h&&d>0&&h>0),{src:g,usesPlayShell:b}=function(e){let t=(0,o.vn)(e);return{src:t,usesPlayShell:(0,o.oK)(t)}}(n),y=(0,i.useRef)(null);(0,i.useImperativeHandle)(t,()=>y.current,[]),(0,i.useEffect)(()=>{let e=window.requestAnimationFrame(()=>u(y.current));return()=>window.cancelAnimationFrame(e)},[g]),(0,i.useEffect)(()=>{let e=e=>{if(!function(e,t,n){var r,i,a;if((null==n?void 0:n.ctrlKey)||(null==n?void 0:n.metaKey)||(null==n?void 0:n.altKey)||function(e){if(!e||"string"!=typeof e.tagName)return!1;let t=e.tagName.toUpperCase();return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||!0===e.isContentEditable}(e)||(null==e||null==(r=e.closest)?void 0:r.call(e,'[role="dialog"]')))return!1;let o=null==e||null==(i=e.tagName)?void 0:i.toUpperCase();return("BUTTON"!==o&&"A"!==o&&"SUMMARY"!==o||!!(null==e||null==(a=e.closest)?void 0:a.call(e,"[data-play-stage]")))&&(1===t.length||c(t))}(e.target,e.key,e))return;let t=y.current;t&&(c(e.key)&&e.preventDefault(),document.activeElement!==t&&u(t))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]);let _=()=>u(y.current);return((0,i.useEffect)(()=>
1{if(!b)return;let e=e=>{let t=y.current;if(!t)return;let n=function(e,t){var n;let r;if(!(0,o.oK)(t.src)||e.source!==t.contentWindow)return null;try{r=new URL(t.src).origin}catch{return null}if(e.origin!==r)return null;let i="object"!=typeof(n=e.data)||null===n||Array.isArray(n)||"channel,error,event,src,version"!==Object.keys(n).sort().join(",")||"bee-games-player"!==n.channel||1!==n.version||"load"!==n.event&&"error"!==n.event||null!==n.src&&"string"!=typeof n.src||null!==n.error&&"INVALID_SRC"!==n.error&&"FRAME_LOAD_ERROR"!==n.error||"load"===n.event&&("string"!=typeof n.src||null!==n.error)||"error"===n.event&&"string"!=typeof n.error?null:n;if(!i)return null;let a=new URL(t.src).searchParams.get("src");return i.src!==a?null:i.event}(e,t);"load"===n?null==m||m():"error"===n&&(null==v||v())};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[v,m,g,b]),w)?(0,r.jsx)(f,{src:g,title:a,naturalWidth:d,naturalHeight:h,iframeRef:y,onLoad:b?void 0:m,onError:b?void 0:v,className:p}):(0,r.jsx)("div",{className:`relative h-full min-h-0 ${p??""}`.trim(),onPointerDown:_,children:(0,r.jsx)("iframe",{ref:y,src:g,title:a,tabIndex:0,className:"w-full h-full border-0 block [overscroll-behavior:none]",allow:l,allowFullScreen:!0,sandbox:s,onLoad:()=>{_(),b||null==m||m()},onError:b?void 0:v})})});function f(e){let{src:t,title:n,naturalWidth:a,naturalHeight:o,iframeRef:c,onLoad:d,onError:f,className:h}=e,m=(0,i.useRef)(null),[v,p]=(0,i.useState)({width:0,height:0});return(0,i.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=e.clientHeight;if(!t||!n)return;let r=Math.min(t/a,n/o),i=Math.round(a*r),l=Math.round(o*r);p(e=>e.width===i&&e.height===l?e:{width:i,height:l})};t();let n=new ResizeObserver(t);n.observe(e);let r=0,i=()=>{t(),cancelAnimationFrame(r),r=requestAnimationFrame(()=>{t(),r=requestAnimationFrame(t)})};return document.addEventListener("fullscreenchange",i),window.addEventListener("resize",t),()=>{cancelAnimationFrame(r),n.disconnect(),document.removeEventListener("fullscreenchange",i),window.removeEventListener("resize",t)}},[a,o]),(0,r.jsx)("div",{ref:m,className:`relative h-full min-h-0 overflow-hidden bg-black ${h??""}`.trim(),onPointerDown:()=>u(c.current),children:(0,r.jsx)("iframe",{ref:c,src:t,title:n,tabIndex:0,className:"border-0 block absolute left-1/2 top-1/2 [overscroll-behavior:none]",style:{width:v.width?`${v.width}px`:void 0,height:v.height?`${v.height}px`:void 0,visibility:v.width?"visible":"hidden",transform:"translate(-50%, -50%)",overscrollBehavior:"none"},allow:l,allowFullScreen:!0,sandbox:s,onLoad:()=>{u(c.current),null==d||d()},onError:f})})}var h=n(72890),m=n(27874),v=n(26745),p=n(95939);function w(e,t,n){let r=(null==n?void 0:n.sessionKey)??("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`s${Date.now().toString(16)}${Math.random().toString(16).slice(2)}`.slice(0,64)),i=(null==n?void 0:n.heartbeatMs)??3e4,a=(null==n?void 0:n.fetchImpl)??fetch,o=((null==n?void 0:n.base)??((p.env.NEXT_PUBLIC_GAPI_BASE??"").trim()||"https://gapi.bee.games").replace(/\/+$/,"")).replace(/\/+$/,""),l=!1,s=!1,c=null,u=function(n){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a(`${o}/api/games/${encodeURIComponent(e)}/play/${n}`,{method:"POST",headers:function(e){let t={"Content-Type":"application/json"};return e.userId&&(t["User-Id"]=String(e.userId)),t}(t),body:JSON.stringify(function(e,t){var n;let r={session_key:e};!t.userId&&t.deviceId&&(r.device_id=t.deviceId);let i=null==(n=t.playerName)?void 0:n.trim();return i&&(r.player_name=i),r}(r,t)),keepalive:i,credentials:"omit"}).catch(()=>void 0)};return{sessionKey:r,get ended(){return s},start(){l||s||(l=!0,u("start"),c=setInterval(()=>u("heartbeat"),i))},end(){l&&!s&&(s=!0,c&&clearInterval(c),c=null,u("end",!0))}}}var g=n(6806),b=n(17403);function y(e){return"device"===e||"device_frame"===e}let _=(0,i.forwardRef)(function(e,t){let{game:n,src:o,title:l,width:s,height:c,playSessionId:u,playActive:f=!0,onLoad:p,onError:_,className:E}=e,{t:x}=(0,h.o)();!function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{user:n,status:r}=(0,m.A)();(0,i.useEffect)(()=>
1{if(!t||!e||"loading"===r)return;let i={userId:(null==n?void 0:n.id)??null,deviceId:n?null:(0,v.Ck)(),playerName:(null==n?void 0:n.display_name)??null};if(!i.userId&&!i.deviceId)return;let a=!1,o=w(e,i);o.start();let l=()=>o.end(),s=()=>{"hidden"===document.visibilityState?l():!a&&"visible"===document.visibilityState&&o.ended&&(o=w(e,i)).start()};return window.addEventListener("pagehide",l),document.addEventListener("visibilitychange",s),()=>{a=!0,l(),window.removeEventListener("pagehide",l),document.removeEventListener("visibilitychange",s)}},[t,e,r,null==n?void 0:n.id,null==n?void 0:n.display_name])}(n.sourceTaskId,f);let{orientation:k,toggle:R,isUncertain:A,allowPlayerToggle:L}=function(e,t){let n=(0,i.useMemo)(()=>(0,b.Fm)(e,{override:(0,b.R8)(e.id),deviceOrientation:(0,b.PR)()}),[e.id,e.width,e.height,e.coverAspect,e.playOrientation,e.play_orientation,e.orientation,e.orientationConfidence,e.orientation_confidence,e.devicePortraitFrame,e.device_portrait_frame,e.deviceLandscapeFrame,e.device_landscape_frame]),[r,a]=(0,i.useState)(n.orientation),[o,l]=(0,i.useState)(n.source),s=(0,i.useRef)(n.orientation),c=(0,i.useRef)(0),u=(0,i.useRef)(0),d=(0,i.useRef)(null),f=(0,i.useRef)(n.source);f.current=o,(0,i.useEffect)(()=>{let n=(0,b.Fm)(e,{override:(0,b.R8)(e.id),deviceOrientation:(0,b.PR)()});a(n.orientation),l(n.source),s.current=n.orientation,c.current=0,u.current=0,d.current="undefined"==typeof document||document.hidden?null:Date.now(),(0,b.Gj)(t,{initial:n.orientation,final:n.orientation,switches:0,visibleMs:0,visibleStartedAt:
1d.current})},[e.id,n,t]),(0,i.useEffect)(()=>{if(!y(o))return;let n=()=>{if((0,b.R8)(e.id)||!y(f.current))return;let n=(0,b.Fm)(e,{deviceOrientation:(0,b.PR)()});l(n.source),a(e=>e===n.orientation?e:((0,b.Gj)(t,{final:n.orientation}),n.orientation))},r=window.matchMedia("(orientation: portrait)");n();let i=()=>n();return r.addEventListener("change",i),window.addEventListener("orientationchange",i),()=>{r.removeEventListener("change",i),window.removeEventListener("orientationchange",i)}},[o,e,e.id,t]),(0,i.useEffect)(()=>{let e=()=>{null!=d.current&&(u.current+=Date.now()-d.current,d.current=null),(0,b.Gj)(t,{visibleMs:u.current,visibleStartedAt:null})},n=()=>{document.hidden?e():(d.current=Date.now(),(0,b.Gj)(t,{visibleMs:u.current,visibleStartedAt:d.current}))};return n(),document.addEventListener("visibilitychange",n),()=>{e(),document.removeEventListener("visibilitychange",n)}},[e.id,t]),(0,i.useEffect)(()=>{let n;if("number"!=typeof e.id||"default"!==o&&"cover"!==o&&"device"!==o)return;let r=new AbortController,i=0,s=async()=>{i+=1;try{let n=await (0,g.h)(e.id,{signal:r.signal});if((0,b.R8)(e.id))return;let i=(0,b.Fm)(n,{deviceOrientation:(0,b.PR)()});if("server"===i.source||"dimensions"===i.source||"device_frame"===i.source){a(i.orientation),l(i.source),(0,b.Gj)(t,{final:i.orientation});return}}catch{}!r.signal.aborted&&i<15&&(n=setTimeout(s,4e3))};return n=setTimeout(s,4e3),()=>{r.abort(),n&&clearTimeout(n)}},[o,e.id,t]);let h=(0,i.useCallback)(function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"button";a(r=>{let i="landscape"===r?"portrait":"landscape";return c.current+=1,u.current=0,d.current="undefined"==typeof document||document.hidden?null:Date.now(),l("override"),(0,b.ow)(e.id,i),(0,b.Gj)(t,{final:i,switches:c.current,visibleMs:0,visibleStartedAt:
1d.current}),(0,v.u4)("game_orientation_toggle",{game_id:"number"==typeof e.id?e.id:void 0,from:r,to:i,trigger:n,play_session_id:t,device_orientation:(0,b.PR)()}),i})},[e.id,t]),m=(0,i.useCallback)(()=>({initial_orientation:s.current,final_orientation:r,orientation_switch_count:c.current,visible_duration_ms:u.current+(null==d.current?0:Date.now()-d.current),device_orientation:(0,b.PR)()}),[r]);return{orientation:r,toggle:h,analyticsProps:m,initialOrientation:s.current,decisionSource:o,allowPlayerToggle:!0,isUncertain:"default"===o||"cover"===o}}(n,u),S="portrait"===k,I=S?"9:16 â 16:9":"16:9 â 9:16",[N,P]=(0,i.useState)(!1),[j,M]=(0,i.useState)(!1),U="game.orientationHelp",$=x(U);return(0,i.useEffect)(()=>{M(!1)},[n.id]),(0,i.useEffect)(()=>{let e=()=>{let e=window.matchMedia("(max-width: 768px)").matches,t=window.matchMedia("(orientation: portrait)").matches;P(e&&t!==S)};return e(),window.addEventListener("orientationchange",e),()=>window.removeEventListener("orientationchange",e)},[S]),(0,r.jsxs)("div",{className:`relative flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-black ${E??""}`,"data-play-stage":"","data-game-orientation":k,style:{containerType:"size"},children:[(0,r.jsx)("div",{className:S?"relative max-h-full max-w-full overflow-hidden bg-black":"absolute inset-0 overflow-hidden bg-black",style:S?{aspectRatio:"9 / 16",width:"min(100%, calc(100cqh * 9 / 16))",height:"auto",maxHeight:"100%"}:void 0,children:(0,r.jsx)(d,{ref:t,src:o,title:l,width:s,height:c,onLoad:p,onError:_,className:"h-full w-full"},(0,b.lG)(n.id,k))}),L&&A&&!j&&(0,r.jsxs)("button",{type:"button",tabIndex:-1,onClick:()=>{R("uncertain_prompt"),M(!0)},className:"absolute top-3 left-1/2 z-30 flex min-h-10 -translate-x-1/2 items-center gap-2 rounded-full bg-amber-400 px-4 text-xs font-semibold text-black shadow-lg hover:bg-amber-300",children:[(0,r.jsx)(a.A,{className:"h-4 w-4 shrink-0"}),$===U?"Display looks wrong or blank? Switch orientation":$]}),N&&!(L&&A)&&(0,r.jsx)("div",{role:"status",className:"pointer-events-none absolute top-3 left-1/2 z-30 -translate-x-1/2 rounded-full bg-black/70 px-3 py-2 text-xs text-white backdrop-blur",children:x("game.rotateHint")}),L&&(0,r.jsxs)("button",{type:"button",tabIndex:-1,onClick:()=>R("button"),className:"absolute bottom-3 right-3 z-30 flex min-h-10 items-center gap-1.5 rounded-full bg-black/70 px-3 text-xs font-semibold text-white shadow-lg backdrop-blur hover:bg-black/85","aria-label":I,title:I,children:[(0,r.jsx)(a.A,{className:"h-4 w-4"}),I]})]})})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.