PageSourceSearch

https://tesana.com/assets/useCanonicalPlayPath-DJjTWyxc.js

js tesana.com collected 2026-10-09 22:42:10 UTC 5,637 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{ao as _,aT as T,aU as F,H as R,aV as B,u as U,v as b,L as V,q as $}from"./index-BKzE8EQ8.js";import{p as L}from"./publicGameMetadata-qDtp_1-a.js";import{r as s,e as A}from"./vendor-react-E98sgxjj.js";import{du as m}from"./vendor-fa-Bn2dnpnC.js";import{N as G,u as z,a as D,b as H,E as M,t as O}from"./useGameVolume-DDLs3th3.js";import{e as j,o as q}from"./StudioContext-C1fnzqLL.js";import{V as I}from"./VolumeControl-DJ2K5ohZ.js";function ae({game:t,surface:n,canonicalUrl:o,ogUrl:i}){const r=_(),d=t.public_id?r.replace(new RegExp(`/${n}/[^/]+/?$`),()=>`/${n}/${t.public_id}`):r,c=o??T(t,r)??d,h=i??F(t)??d,a={[B]:"true"};return e.jsxs(R,{children:[e.jsx("link",{rel:"canonical",href:c}),e.jsx("meta",{property:"og:url",content:h,...a}),e.jsx("meta",{name:"description",content:L(t)})]})}function ne(t){const[n,o]=s.useState(0);return e.jsx(G,{gameId:t.gameId,remotePckUrl:t.pckUrl,remotePckSha:t.pckSha,children:e.jsx(J,{...t,onRetry:()=>o(i=>i+1)})},n)}function J({gameId:t,gameName:n,posterUrl:o,pckUrl:i,pckSha:r,studioGameId:d,surface:c,onRetry:h}){const{t:a}=U("game"),p=A(),l=z(),f=D(),[u,P]=H(),y=s.useRef(u);y.current=u,s.useEffect(()=>{j(u)},[u]),s.useEffect(()=>{let k;return q(()=>void j(y.current)).then(C=>{k=C}),()=>k?.()},[]);const v=s.useRef(!1);s.useEffect(()=>{v.current||(v.current=!0,b("Native Play Surface Shown",{surface:c,game_id:t}))},[c,t]);const g=s.useCallback(()=>{l.remotePckState!=="ready"&&i&&r&&l.invalidatePck()},[l,i,r]);if(l.pckPath)return e.jsxs("div",{className:"absolute inset-0",children:[e.jsx(M,{pckPath:l.pckPath,title:n,gameId:t,toolbar:null,onBootError:g}),c==="launch"&&e.jsx("button",{onClick:()=>window.history.length>2?p(-1):p("/dashboard"),className:"absolute top-3 left-3 z-20 h-9 w-9 flex items-center justify-center rounded-md bg-black/70 hover:bg-black/85 text-white transition-colors cursor-pointer",title:a("nativePlay.back","Back"),children:e.jsx(m,{icon:["far","arrow-left"],className:"text-sm"})}),e.jsxs("div",{className:"absolute top-3 right-3 z-20 flex items-center gap-2",children:[e.jsx(I,{volume:u,onVolumeChange:P,muteLabel:a("nativePlay.mute","Mute game"),unmuteLabel:a("nativePlay.unmute","Unmute game"),buttonClassName:"h-9 w-9 flex items-center justify-center rounded-md bg-black/70 hover:bg-black/85 text-white transition-colors cursor-pointer"}),e.jsx("button",{onClick:()=>void O(),className:"h-9 w-9 flex items-center justify-center rounded-md bg-black/70 hover:bg-black/85 text-white transition-colors cursor-pointer",title:f?a("nativePlay.exitFullscreen","Exit fullscreen"):a("nativePlay.fullscreen","Fullscreen"),children:e.jsx(m,{icon:["far",f?"minimize":"maximize"],className:"text-sm"})})]})]});const w=!!(i&&r),N=l.remotePckState==="downloading",x=l.remotePckState==="error",E=!l.probeSettled||w&&!x,S=l.probeSettled&&(!w||x);return e.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black",children:[o&&e.jsx("img",{src:o,alt:"","aria-hidden":!0,className:"absolute inset-0 h-full w-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/60 to-black/40"}),e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center px-6 text-center",children:x?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-medium text-white mb-2",children:a("nativePlay.downloadFailedTitle","Download failed")}),e.jsx("p",{className:"max-w-md text-sm text-white/75 mb-5",children:a("nativePlay.downloadFailedBody","The game package could not be downloaded. Check your connection and try again.")}),e.jsx("button",{onClick:()=>{b("Native Play Surface CTA Clicked",{surface:c,cta:"retry",game_id:t}),h()},className:"h-10 px-5 rounded-md bg-white text-black text-sm font-medium hover:opacity-85 transition-opacity cursor-pointer",children:a("nativePlay.retry","Try again")})]}):S?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-white/10 text-white",children:e.jsx(m,{icon:["far","desktop"],className:"text-xl"})}),e.jsx("h2",{className:"text-xl font-medium text-white mb-2",children:a("nativePlay.unavailableTitle","{{name}} isn’t playable here yet",{name:n})}),e.jsx("p",{className:"max-w-md text-sm text-white/75 mb-5",children:d!=null?a("nativePlay.unavailableBodyOwn","This desktop game has no playable build yet — open it in the Studio once to build it, then come back here to play."):a("nativePlay.unavailableBody","The creator hasn’t published a playable build of this desktop game yet.")}),d!=null&&e.jsxs(V,{to:`/studio/${d}`,onClick:()=>b("Native Play Surface CTA Clicked",{surface:c,cta:"studio_fallback",game_id:t}),className:"h-10 px-5 rounded-md bg-white text-black text-sm font-medium hover:opacity-85 transition-opacity flex items-center gap-2",children:[e.jsx(m,{icon:["far","pen"],className:"text-xs"}),a("nativePlay.openInStudio","Open in Studio")]})]}):E?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 h-8 w-8 animate-spin rounded-full border-2 border-white/20 border-t-white"}),e.jsx("p",{className:"text-sm text-white/85",children:N?a("nativePlay.downloading","Downloading {{name}}…",{name:n}):a("nativePlay.preparing","Preparing {{name}}…",{name:n})})]}):null})]})}function oe(t,n,o){s.useEffect(()=>{if(!t||!n||!t.resolved_via_legacy_numeric_id||!t.public_id)return;$(o,n,t.public_id);const i=window.location.pathname.replace(`/${o}/${n}`,`/${o}
1/${t.public_id}`);i!==window.location.pathname&&window.history.replaceState(null,"",i+window.location.search+window.location.hash)},[t,n,o])}export{ne as N,ae as P,oe as u};

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.