From 9694e0fd828129780a4c4c19111a15eaf5c8db76 Mon Sep 17 00:00:00 2001 From: Brian Beck Date: Fri, 13 Mar 2026 18:04:02 -0700 Subject: [PATCH] improve input handling --- docs/404.html | 2 +- docs/404/index.html | 2 +- docs/__next.__PAGE__.txt | 4 +- docs/__next._full.txt | 4 +- docs/__next._head.txt | 2 +- docs/__next._index.txt | 2 +- docs/__next._tree.txt | 2 +- ...a364447adf881eb.js => 048c0e679979d576.js} | 2 +- docs/_next/static/chunks/16e2b7e83646cebc.js | 521 ------------------ docs/_next/static/chunks/26c11097581036eb.js | 521 ++++++++++++++++++ ...8d0203d138a3e57.js => 4fb9edf01fb5e4f5.js} | 2 +- ...6808786c34b74b0.js => 628df86be2b8074c.js} | 2 +- ...90cfb71eaf1c762.js => d22dc3fe32e979ff.js} | 2 +- .../_buildManifest.js | 0 .../_clientMiddlewareManifest.json | 0 .../_ssgManifest.js | 0 docs/_not-found/__next._full.txt | 2 +- docs/_not-found/__next._head.txt | 2 +- docs/_not-found/__next._index.txt | 2 +- .../_not-found/__next._not-found.__PAGE__.txt | 2 +- docs/_not-found/__next._not-found.txt | 2 +- docs/_not-found/__next._tree.txt | 2 +- docs/_not-found/index.html | 2 +- docs/_not-found/index.txt | 2 +- docs/index.html | 2 +- docs/index.txt | 4 +- docs/shapes/__next._full.txt | 4 +- docs/shapes/__next._head.txt | 2 +- docs/shapes/__next._index.txt | 2 +- docs/shapes/__next._tree.txt | 2 +- docs/shapes/__next.shapes.__PAGE__.txt | 4 +- docs/shapes/__next.shapes.txt | 2 +- docs/shapes/index.html | 2 +- docs/shapes/index.txt | 4 +- package-lock.json | 418 +++++++++++++- package.json | 1 + relay/crc.ts | 34 +- scripts/t2-login.ts | 178 +++--- src/components/InputConsumer.tsx | 231 +++++--- src/components/InputHandlers.tsx | 15 +- src/components/JoinServerButton.tsx | 2 + src/components/KeyboardOverlay.tsx | 2 +- ...andler.tsx => MouseAndKeyboardHandler.tsx} | 19 +- src/state/liveConnectionStore.ts | 2 + src/stream/StreamEngine.ts | 13 +- 45 files changed, 1307 insertions(+), 720 deletions(-) rename docs/_next/static/chunks/{0a364447adf881eb.js => 048c0e679979d576.js} (96%) delete mode 100644 docs/_next/static/chunks/16e2b7e83646cebc.js create mode 100644 docs/_next/static/chunks/26c11097581036eb.js rename docs/_next/static/chunks/{48d0203d138a3e57.js => 4fb9edf01fb5e4f5.js} (99%) rename docs/_next/static/chunks/{f6808786c34b74b0.js => 628df86be2b8074c.js} (93%) rename docs/_next/static/chunks/{990cfb71eaf1c762.js => d22dc3fe32e979ff.js} (99%) rename docs/_next/static/{GVV-bte23-C1OKGsIpGF4 => qFiVWtG4yk0ykisMKiEZH}/_buildManifest.js (100%) rename docs/_next/static/{GVV-bte23-C1OKGsIpGF4 => qFiVWtG4yk0ykisMKiEZH}/_clientMiddlewareManifest.json (100%) rename docs/_next/static/{GVV-bte23-C1OKGsIpGF4 => qFiVWtG4yk0ykisMKiEZH}/_ssgManifest.js (100%) rename src/components/{KeyboardAndMouseHandler.tsx => MouseAndKeyboardHandler.tsx} (93%) diff --git a/docs/404.html b/docs/404.html index 420eaa0e..47521b99 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index 420eaa0e..47521b99 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/__next.__PAGE__.txt b/docs/__next.__PAGE__.txt index 5214e43b..299b8b56 100644 --- a/docs/__next.__PAGE__.txt +++ b/docs/__next.__PAGE__.txt @@ -1,10 +1,10 @@ 1:"$Sreact.fragment" 2:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -3:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/0a364447adf881eb.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] +3:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/26c11097581036eb.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/048c0e679979d576.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] 6:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] 7:"$Sreact.suspense" :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","async":true}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/0a364447adf881eb.js","async":true}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/26c11097581036eb.js","async":true}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/048c0e679979d576.js","async":true}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} 4:{} 5:"$0:rsc:props:children:0:props:serverProvidedParams:params" 8:null diff --git a/docs/__next._full.txt b/docs/__next._full.txt index a736e8b8..715f0ea9 100644 --- a/docs/__next._full.txt +++ b/docs/__next._full.txt @@ -3,7 +3,7 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/0a364447adf881eb.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/26c11097581036eb.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/048c0e679979d576.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] @@ -11,7 +11,7 @@ e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBounda 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/0a364447adf881eb.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/26c11097581036eb.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/048c0e679979d576.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] diff --git a/docs/__next._head.txt b/docs/__next._head.txt index c07e1c68..9da154c0 100644 --- a/docs/__next._head.txt +++ b/docs/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} diff --git a/docs/__next._index.txt b/docs/__next._index.txt index 0f8c5084..4c48efbe 100644 --- a/docs/__next._index.txt +++ b/docs/__next._index.txt @@ -3,4 +3,4 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/__next._tree.txt b/docs/__next._tree.txt index 13d28f9f..8ba096c2 100644 --- a/docs/__next._tree.txt +++ b/docs/__next._tree.txt @@ -1,3 +1,3 @@ :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/docs/_next/static/chunks/0a364447adf881eb.js b/docs/_next/static/chunks/048c0e679979d576.js similarity index 96% rename from docs/_next/static/chunks/0a364447adf881eb.js rename to docs/_next/static/chunks/048c0e679979d576.js index 2dd80a72..684e588d 100644 --- a/docs/_next/static/chunks/0a364447adf881eb.js +++ b/docs/_next/static/chunks/048c0e679979d576.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76775,(e,t,a)=>{function r(e,t,a,r){return Math.round(e/a)+" "+r+(t>=1.5*a?"s":"")}t.exports=function(e,t){t=t||{};var a,i,n,o,s=typeof e;if("string"===s&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var c=parseFloat(d[1]);switch((d[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===s&&isFinite(e)){return t.long?(i=Math.abs(a=e))>=864e5?r(a,i,864e5,"day"):i>=36e5?r(a,i,36e5,"hour"):i>=6e4?r(a,i,6e4,"minute"):i>=1e3?r(a,i,1e3,"second"):a+" ms":(o=Math.abs(n=e))>=864e5?Math.round(n/864e5)+"d":o>=36e5?Math.round(n/36e5)+"h":o>=6e4?Math.round(n/6e4)+"m":o>=1e3?Math.round(n/1e3)+"s":n+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7003,(e,t,a)=>{t.exports=function(t){function a(e){let t,i,n,o=null;function s(...e){if(!s.enabled)return;let r=Number(new Date);s.diff=r-(t||r),s.prev=t,s.curr=r,t=r,e[0]=a.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";i++;let n=a.formatters[r];if("function"==typeof n){let a=e[i];t=n.call(s,a),e.splice(i,1),i--}return t}),a.formatArgs.call(s,e),(s.log||a.log).apply(s,e)}return s.namespace=e,s.useColors=a.useColors(),s.color=a.selectColor(e),s.extend=r,s.destroy=a.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==a.namespaces&&(i=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(s),s}function r(e,t){let r=a(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function i(e,t){let a=0,r=0,i=-1,n=0;for(;a"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){for(let t of(a.save(e),a.namespaces=e,a.names=[],a.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===t[0]?a.skips.push(t.slice(1)):a.names.push(t)},a.enabled=function(e){for(let t of a.skips)if(i(e,t))return!1;for(let t of a.names)if(i(e,t))return!0;return!1},a.humanize=e.r(76775),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(e){let t=0;for(let a=0;a{let r;var i=e.i(47167);a.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),e.splice(i,0,a)},a.save=function(e){try{e?a.storage.setItem("debug",e):a.storage.removeItem("debug")}catch(e){}},a.load=function(){let e;try{e=a.storage.getItem("debug")||a.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==i.default&&"env"in i.default&&(e=i.default.env.DEBUG),e},a.useColors=function(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch(e){}}(),r=!1,a.destroy=()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))},a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),t.exports=e.r(7003)(a);let{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},91891,11251,88787,94802,25311,89119,10244,e=>{"use strict";var t={},a=function(e,a,r,i,n){var o=new Worker(t[a]||(t[a]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(e){var t=e.data,a=t.$e$;if(a){var r=Error(a[0]);r.code=a[1],r.stack=a[2],n(r,null)}else n(null,t)},o.postMessage(r,i),o},r=Uint8Array,i=Uint16Array,n=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var a=new i(31),r=0;r<31;++r)a[r]=t+=1<>1|(21845&F)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,m[F]=((65280&v)>>8|(255&v)<<8)>>1}for(var y=function(e,t,a){for(var r,n=e.length,o=0,s=new i(t);o>d]=c}else for(o=0,r=new i(n);o>15-e[o]);return r},S=new r(288),F=0;F<144;++F)S[F]=8;for(var F=144;F<256;++F)S[F]=9;for(var F=256;F<280;++F)S[F]=7;for(var F=280;F<288;++F)S[F]=8;for(var k=new r(32),F=0;F<32;++F)k[F]=5;var b=y(S,9,0),I=y(S,9,1),x=y(k,5,0),P=y(k,5,1),D=function(e){for(var t=e[0],a=1;at&&(t=e[a]);return t},C=function(e,t,a){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&a},w=function(e,t){var a=t/8|0;return(e[a]|e[a+1]<<8|e[a+2]<<16)>>(7&t)},E=function(e){return(e+7)/8|0},B=function(e,t,a){return(null==t||t<0)&&(t=0),(null==a||a>e.length)&&(a=e.length),new r(e.subarray(t,a))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(e,t,a){var r=Error(t||M[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,T),!a)throw r;return r},N=function(e,t,a,i){var n=e.length,d=i?i.length:0;if(!n||t.f&&!t.l)return a||new r(0);var c=!a,u=c||2!=t.i,g=t.i;c&&(a=new r(3*n));var f=function(e){var t=a.length;if(e>t){var i=new r(Math.max(2*t,e));i.set(a),a=i}},m=t.f||0,F=t.p||0,v=t.b||0,S=t.l,k=t.d,b=t.m,x=t.n,M=8*n;do{if(!S){m=C(e,F,1);var N=C(e,F+1,3);if(F+=3,N)if(1==N)S=I,k=P,b=9,x=5;else if(2==N){var G=C(e,F,31)+257,R=C(e,F+10,15)+4,U=G+C(e,F+5,31)+1;F+=14;for(var j=new r(U),A=new r(19),V=0;V>4;if(_<16)j[V++]=_;else{var H=0,W=0;for(16==_?(W=3+C(e,F,3),F+=2,H=j[V-1]):17==_?(W=3+C(e,F,7),F+=3):18==_&&(W=11+C(e,F,127),F+=7);W--;)j[V++]=H}}var $=j.subarray(0,G),Z=j.subarray(G);b=D($),x=D(Z),S=y($,b,1),k=y(Z,x,1)}else T(1);else{var _=E(F)+4,X=e[_-4]|e[_-3]<<8,J=_+X;if(J>n){g&&T(0);break}u&&f(v+X),a.set(e.subarray(_,J),v),t.b=v+=X,t.p=F=8*J,t.f=m;continue}if(F>M){g&&T(0);break}}u&&f(v+131072);for(var Y=(1<>4;if((F+=15&H)>M){g&&T(0);break}if(H||T(2),ee<256)a[v++]=ee;else if(256==ee){K=F,S=null;break}else{var et=ee-254;if(ee>264){var V=ee-257,ea=o[V];et=C(e,F,(1<>4;er||T(3),F+=15&er;var Z=p[ei];if(ei>3){var ea=s[ei];Z+=w(e,F)&(1<M){g&&T(0);break}u&&f(v+131072);var en=v+et;if(v>8},R=function(e,t,a){a<<=7&t;var r=t/8|0;e[r]|=a,e[r+1]|=a>>8,e[r+2]|=a>>16},U=function(e,t){for(var a=[],n=0;np&&(p=s[n].s);var f=new i(p+1),m=j(a[u-1],f,0);if(m>t){var n=0,F=0,v=m-t,y=1<t)F+=y-(1<>=v;F>0;){var k=s[n].s;f[k]=0&&F;--n){var b=s[n].s;f[b]==t&&(--f[b],++F)}m=t}return{t:new r(f),l:m}},j=function(e,t,a){return -1==e.s?Math.max(j(e.l,t,a+1),j(e.r,t,a+1)):t[e.s]=a},A=function(e){for(var t=e.length;t&&!e[--t];);for(var a=new i(++t),r=0,n=e[0],o=1,s=function(e){a[r++]=e},l=1;l<=t;++l)if(e[l]==n&&l!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=e[l]}return{c:a.subarray(0,r),n:t}},V=function(e,t){for(var a=0,r=0;r>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var n=0;n4&&!H[l[$-1]];--$);var Z=g+5<<3,X=V(n,S)+V(d,k)+c,J=V(n,P)+V(d,w)+c+14+3*$+V(L,H)+2*L[16]+3*L[17]+7*L[18];if(u>=0&&Z<=X&&Z<=J)return O(t,p,e.subarray(u,u+g));if(G(t,p,1+(J15&&(G(t,p,ee[q]>>5&127),p+=ee[q]>>12)}}else f=b,m=S,F=x,v=k;for(var q=0;q255){var et=ea>>18&31;R(t,p,f[et+257]),p+=m[et+257],et>7&&(G(t,p,ea>>23&31),p+=o[et]);var er=31&ea;R(t,p,F[er]),p+=v[er],er>3&&(R(t,p,ea>>5&8191),p+=s[er])}else R(t,p,f[ea]),p+=m[ea]}return R(t,p,f[256]),p+m[256]},L=new n([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new r(0),_=function(e,t,a,l,d,c){var h=c.z||e.length,g=new r(l+h+5*(1+Math.ceil(h/7e3))+d),p=g.subarray(l,g.length-d),m=c.l,F=7&(c.r||0);if(t){F&&(p[0]=c.r>>3);for(var v=L[t-1],y=v>>13,S=8191&v,k=(1<7e3||R>24576)&&(_>423||!m)){F=z(e,p,0,C,w,M,N,R,j,G-j,F),R=T=N=0,j=G;for(var H=0;H<286;++H)w[H]=0;for(var H=0;H<30;++H)M[H]=0}var W=2,$=0,Z=S,X=V-q&32767;if(_>2&&A==D(G-X))for(var J=Math.min(y,_)-1,Y=Math.min(32767,G),Q=Math.min(258,_);X<=Y&&--Z&&V!=q;){if(e[G+W]==e[G+W-X]){for(var K=0;KW){if(W=K,$=X,K>J)break;for(var ee=Math.min(X,K-2),et=0,H=0;Het&&(et=ei,q=ea)}}}q=b[V=q],X+=V-q&32767}if($){C[R++]=0x10000000|u[W]<<18|f[$];var en=31&u[W],eo=31&f[$];N+=o[en]+s[eo],++w[257+en],++M[eo],U=G+W,++T}else C[R++]=e[G],++w[e[G]]}}for(G=Math.max(G,U);G=h&&(p[F/8|0]=m,es=h),F=O(p,F+1,e.subarray(G,es))}c.i=h}return B(g,0,l+E(F)+d)},H=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var a=t,r=9;--r;)a=(1&a&&-0x12477ce0)^a>>>1;e[t]=a}return e}(),W=function(){var e=-1;return{p:function(t){for(var a=e,r=0;r>>8;e=a},d:function(){return~e}}},$=function(){var e=1,t=0;return{p:function(a){for(var r=e,i=t,n=0|a.length,o=0;o!=n;){for(var s=Math.min(o+2655,n);o>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(255&e)<<24|(65280&e)<<8|(255&t)<<8|t>>8}}},Z=function(e,t,a,i,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,n.w=o.length}return _(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,a,i,n)},X=function(e,t){var a={};for(var r in e)a[r]=e[r];for(var r in t)a[r]=t[r];return a},J=function(e,t,a){for(var r=e(),i=e.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>0},eh=function(e,t){return ec(e,t)+0x100000000*ec(e,t+4)},eu=function(e,t,a){for(;a;++t)e[t]=a,a>>>=8},eg=function(e,t){var a=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&eu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),a){e[3]=8;for(var r=0;r<=a.length;++r)e[r+10]=a.charCodeAt(r)}},ep=function(e){(31!=e[0]||139!=e[1]||8!=e[2])&&T(6,"invalid gzip data");var t=e[3],a=10;4&t&&(a+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[a++]);return a+(2&t)},ef=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},em=function(e){return 10+(e.filename?e.filename.length+1:0)},eF=function(e,t){var a=t.level;if(e[0]=120,e[1]=(0==a?0:a<6?1:9==a?3:2)<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var r=$();r.p(t.dictionary),eu(e,2,r.d())}},ev=function(e,t){return((15&e[0])!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&T(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&T(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function ey(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var eS=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var a=this.o.dictionary.subarray(-32768);this.b.set(a,32768-a.length),this.s.i=32768-a.length}}return e.prototype.p=function(e,t){this.ondata(Z(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||T(5),this.s.l&&T(4);var a=e.length+this.s.z;if(a>this.b.length){if(a>2*this.b.length-32768){var i=new r(-32768&a);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(e.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(n),32768),this.s.z=e.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||T(5),this.s.l&&T(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),ek=function(e,t){el([et,function(){return[es,eS]}],this,ey.call(this,e,t),function(e){onmessage=es(new eS(e.data))},6,1)};function eb(e,t){return Z(e,t||{},0,0)}var eI=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var a=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:a?a.length:0},this.o=new r(32768),this.p=new r(0),a&&this.o.set(a)}return e.prototype.e=function(e){if(this.ondata||T(5),this.d&&T(4),this.p.length){if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,a=N(this.p,this.s,this.o);this.ondata(B(a,t,this.s.b),this.d),this.o=B(a,this.s.b-32768),this.s.b=this.o.length,this.p=B(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),ex=function(e,t){el([ee,function(){return[es,eI]}],this,ey.call(this,e,t),function(e){onmessage=es(new eI(e.data))},7,0)};function eP(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}(function(){function e(e,t){this.c=W(),this.l=0,this.v=1,eS.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,eS.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=Z(e,this.o,this.v&&em(this.o),t&&8,this.s);this.v&&(eg(a,this.o),this.v=0),t&&(eu(a,a.length-8,this.c.d()),eu(a,a.length-4,this.l)),this.ondata(a,t)},e.prototype.flush=function(){eS.prototype.flush.call(this)}})();var eD=function(){function e(e,t){this.v=1,this.r=0,eI.call(this,e,t)}return e.prototype.push=function(e,t){if(eI.prototype.e.call(this,e),this.r+=e.length,this.v){var a=this.p.subarray(this.v-1),i=a.length>3?ep(a):4;if(i>a.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-a.length);this.p=a.subarray(i),this.v=0}eI.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=E(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t))},e}(),eC=function(e,t){var a=this;el([ee,ea,function(){return[es,eI,eD]}],this,ey.call(this,e,t),function(e){var t=new eD(e.data);t.onmember=function(e){return postMessage(e)},onmessage=es(t)},9,0,function(e){return a.onmember&&a.onmember(e)})},ew=(function(){function e(e,t){this.c=$(),this.v=1,eS.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),eS.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=Z(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(eF(a,this.o),this.v=0),t&&eu(a,a.length-4,this.c.d()),this.ondata(a,t)},e.prototype.flush=function(){eS.prototype.flush.call(this)}}(),function(){function e(e,t){eI.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(eI.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ev(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&T(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),eI.prototype.c.call(this,t)},e}()),eE=function(e,t){el([ee,er,function(){return[es,eI,ew]}],this,ey.call(this,e,t),function(e){onmessage=es(new ew(e.data))},11,0)},eB=function(){function e(e,t){this.o=ey.call(this,e,t)||{},this.G=eD,this.I=eI,this.Z=ew}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,a){e.ondata(t,a)}},e.prototype.push=function(e,t){if(this.ondata||T(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var a=new r(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();function eM(e,t){eB.call(this,e,t),this.queuedSize=0,this.G=eC,this.I=ex,this.Z=eE}eM.prototype.i=function(){var e=this;this.s.ondata=function(t,a,r){e.ondata(t,a,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},eM.prototype.push=function(e,t){this.queuedSize+=e.length,eB.prototype.push.call(this,e,t)};var eT="u">typeof TextEncoder&&new TextEncoder,eN="u">typeof TextDecoder&&new TextDecoder,eG=0;try{eN.decode(q,{stream:!0}),eG=1}catch(e){}var eR=function(e){for(var t="",a=0;;){var r=e[a++],i=(r>127)+(r>223)+(r>239);if(a+i>e.length)return{s:t,r:B(e,a-1)};i?3==i?t+=String.fromCharCode(55296|(r=((15&r)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++])-65536)>>10,56320|1023&r):1&i?t+=String.fromCharCode((31&r)<<6|63&e[a++]):t+=String.fromCharCode((15&r)<<12|(63&e[a++])<<6|63&e[a++]):t+=String.fromCharCode(r)}};function eU(e,t){if(t){for(var a=new r(e.length),i=0;i>1)),s=0,l=function(e){o[s++]=e},i=0;io.length){var d=new r(s+8+(n-i<<1));d.set(o),o=d}var c=e.charCodeAt(i);c<128||t?l(c):(c<2048?l(192|c>>6):(c>55295&&c<57344?(l(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>18),l(128|c>>12&63)):l(224|c>>12),l(128|c>>6&63)),l(128|63&c))}return B(o,0,s)}(function(e){this.ondata=e,eG?this.t=new TextDecoder:this.p=q}).prototype.push=function(e,t){if(this.ondata||T(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&T(8),this.t=null);return}this.p||T(4);var a=new r(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length);var i=eR(a),n=i.s,o=i.r;t?(o.length&&T(8),this.p=null):this.p=o,this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){this.ondata||T(5),this.d&&T(4),this.ondata(eU(e),this.d=t||!1)};var ej=function(e){return 1==e?3:e<6?2:+(9==e)},eA=function(e,t){for(;1!=ed(e,t);t+=4+ed(e,t+2));return[eh(e,t+12),eh(e,t+4),eh(e,t+20)]},eV=function(e){var t=0;if(e)for(var a in e){var r=e[a].length;r>65535&&T(9),t+=r+4}return t},eO=function(e,t,a,r,i,n,o,s){var l=r.length,d=a.extra,c=s&&s.length,h=eV(d);eu(e,t,null!=o?0x2014b50:0x4034b50),t+=4,null!=o&&(e[t++]=20,e[t++]=a.os),e[t]=20,t+=2,e[t++]=a.flag<<1|(n<0&&8),e[t++]=i&&8,e[t++]=255&a.compression,e[t++]=a.compression>>8;var u=new Date(null==a.mtime?Date.now():a.mtime),g=u.getFullYear()-1980;if((g<0||g>119)&&T(10),eu(e,t,g<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),t+=4,-1!=n&&(eu(e,t,a.crc),eu(e,t+4,n<0?-n-2:n),eu(e,t+8,a.size)),eu(e,t+12,l),eu(e,t+14,h),t+=16,null!=o&&(eu(e,t,c),eu(e,t+6,a.attrs),eu(e,t+10,o),t+=14),e.set(r,t),t+=l,h)for(var p in d){var f=d[p],m=f.length;eu(e,t,+p),eu(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},ez=function(e,t,a,r,i){eu(e,t,0x6054b50),eu(e,t+8,a),eu(e,t+10,a),eu(e,t+12,r),eu(e,t+16,i)},eL=function(){function e(e){this.filename=e,this.c=W(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||T(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function eq(e,t){var a=this;t||(t={}),eL.call(this,e),this.d=new eS(t,function(e,t){a.ondata(null,e,t)}),this.compression=8,this.flag=ej(t.level)}function e_(e,t){var a=this;t||(t={}),eL.call(this,e),this.d=new ek(t,function(e,t,r){a.ondata(e,t,r)}),this.compression=8,this.flag=ej(t.level),this.terminate=this.d.terminate}function eH(e){this.ondata=e,this.u=[],this.d=1}eq.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},eq.prototype.push=function(e,t){eL.prototype.push.call(this,e,t)},e_.prototype.process=function(e,t){this.d.push(e,t)},e_.prototype.push=function(e,t){eL.prototype.push.call(this,e,t)},eH.prototype.add=function(e){var t=this;if(this.ondata||T(5),2&this.d)this.ondata(T(4+(1&this.d)*8,0,1),null,!1);else{var a=eU(e.filename),i=a.length,n=e.comment,o=n&&eU(n),s=i!=e.filename.length||o&&n.length!=o.length,l=i+eV(e.extra)+30;i>65535&&this.ondata(T(11,0,1),null,!1);var d=new r(l);eO(d,0,e,a,s,-1);var c=[d],h=function(){for(var e=0,a=c;e0){var i=Math.min(this.c,e.length),n=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(i)).length)return this.push(e,t)}else{var o=0,s=0,l=void 0,d=void 0;this.p.length?e.length?((d=new r(this.p.length+e.length)).set(this.p),d.set(e,this.p.length)):d=this.p:d=e;for(var c=d.length,h=this.c,u=h&&this.d,g=this;ss+30+n+u){var p,f,m=[];g.k.unshift(m),o=2;var F=ec(d,s+18),v=ec(d,s+22),y=function(e,t){if(t){for(var a="",r=0;r=0&&(S.size=F,S.originalSize=v),g.onfile(S)}return"break"}if(h){if(0x8074b50==e)return l=s+=12+(-2==h&&8),o=3,g.c=0,"break";else if(0x2014b50==e)return l=s-=4,o=3,g.c=0,"break"}}();++s);if(this.p=q,h<0){var p=o?d.subarray(0,l-12-(-2==h&&8)-(0x8074b50==ec(d,l-16)&&4)):d.subarray(0,s);u?u.push(p,!!o):this.k[+(2==o)].push(p)}if(2&o)return this.push(d.subarray(s),t);this.p=d.subarray(s)}t&&(this.c&&T(13),this.p=null)},eX.prototype.register=function(e){this.o[e.compression]=e},"function"==typeof queueMicrotask&&queueMicrotask;var eJ=e.i(48450);let eY=[0,0,0,0,0,0,0,0,0,329,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2809,68,0,27,0,58,3,62,4,7,0,0,15,65,554,3,394,404,189,117,30,51,27,15,34,32,80,1,142,3,142,39,0,144,125,44,122,275,70,135,61,127,8,12,113,246,122,36,185,1,149,309,335,12,11,14,54,151,0,0,2,0,0,211,0,2090,344,736,993,2872,701,605,646,1552,328,305,1240,735,1533,1713,562,3,1775,1149,1469,979,407,553,59,279,31,0,0,0,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function eQ(e){return e.node?e.node.pop:e.leaf.pop}let eK=new class{nodes=[];leaves=[];tablesBuilt=!1;buildTables(){if(this.tablesBuilt)return;this.tablesBuilt=!0,this.leaves=[];for(let t=0;t<256;t++){var e;this.leaves.push({pop:eY[t]+ +((e=t)>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)+1,symbol:t,numBits:0,code:0})}this.nodes=[{pop:0,index0:0,index1:0}];let t=256,a=[];for(let e=0;e<256;e++)a.push({node:null,leaf:this.leaves[e]});for(;1!==t;){let e=0xfffffffe,r=0xffffffff,i=-1,n=-1;for(let o=0;on?i:n;a[s]={node:o,leaf:null},l!==t-1&&(a[l]=a[t-1]),t--}this.nodes[0]=a[0].node,this.generateCodes(0,0,0)}determineIndex(e){return null!==e.leaf?-(this.leaves.indexOf(e.leaf)+1):this.nodes.indexOf(e.node)}generateCodes(e,t,a){if(t<0){let r=this.leaves[-(t+1)];r.code=e,r.numBits=a}else{let r=this.nodes[t];this.generateCodes(e,r.index0,a+1),this.generateCodes(e|1<=0)t=e.readFlag()?this.nodes[t].index1:this.nodes[t].index0;else{a.push(this.leaves[-(t+1)].symbol);break}}return String.fromCharCode(...a)}{let t=e.readInt(8);return String.fromCharCode(...e.readBytes(t))}}};class e0{data;bitNum;maxReadBitNum;error;stringBuffer=null;constructor(e,t=0){this.data=e,this.bitNum=t,this.maxReadBitNum=e.length<<3,this.error=!1}getCurPos(){return this.bitNum}setCurPos(e){this.bitNum=e}getBytePosition(){return this.bitNum+7>>3}isError(){return this.error}isFull(){return this.bitNum>this.maxReadBitNum}getRemainingBits(){return this.maxReadBitNum-this.bitNum}getMaxPos(){return this.maxReadBitNum}readFlag(){if(this.bitNum>=this.maxReadBitNum)return this.error=!0,!1;let e=1<<(7&this.bitNum),t=(this.data[this.bitNum>>3]&e)!=0;return this.bitNum++,t}readInt(e){if(0===e)return 0;if(this.bitNum+e>this.maxReadBitNum)return this.error=!0,0;let t=this.bitNum>>3,a=7&this.bitNum;if(this.bitNum+=e,e+a<=32){let r=0,i=e+a+7>>3;for(let e=0;e>>=a,32===e)?r>>>0:r&(1<>3;for(let e=0;e>>0:r&(1<>3,a=new Uint8Array(t),r=this.bitNum>>3,i=7&this.bitNum,n=8-i;if(0===i)a.set(this.data.subarray(r,r+t));else{let e=this.data[r];for(let o=0;o>i|t<this.maxReadBitNum)return this.error=!0,0;let e=this.bitNum>>3,t=7&this.bitNum,a=e0.f32U8;if(0===t)a[0]=this.data[e],a[1]=this.data[e+1],a[2]=this.data[e+2],a[3]=this.data[e+3];else{let r=8-t;for(let i=0;i<4;i++){let n=this.data[e+i],o=e+i+1>t|o<>>0)}getCompressionPoint(){return this.compressionPoint}getDataBlockDataMap(){return this.dataBlockDataMap}getConnectionContext(){let e=this.dataBlockDataMap;return{compressionPoint:this.compressionPoint,ghostTracker:this.ghostTracker,getDataBlockParser:e=>this.registry.getDataBlockParser(e),getDataBlockData:e?t=>e.get(t):void 0,getGhostParser:e=>this.registry.getGhostParser(e)}}_setNextRecvEventSeq(e){this.nextRecvEventSeq=e>>>0}setConnectionProtocolState(e){for(this.lastSeqRecvdAtSend=e.lastSeqRecvdAtSend.slice(0,32);this.lastSeqRecvdAtSend.length<32;)this.lastSeqRecvdAtSend.push(0);this.lastSeqRecvd=e.lastSeqRecvd>>>0,this.highestAckedSeq=e.highestAckedSeq>>>0,this.lastSendSeq=e.lastSendSeq>>>0,this.recvAckMask=e.ackMask>>>0,this.connectSequence=e.connectSequence>>>0,this.lastRecvAckAck=e.lastRecvAckAck>>>0,this._connectionEstablished=e.connectionEstablished}onSendPacketTrigger(){this.lastSendSeq=this.lastSendSeq+1>>>0,this.lastSeqRecvdAtSend[31&this.lastSendSeq]=this.lastSeqRecvd>>>0}applyProtocolHeader(e){if(e.connectSeqBit!==(1&this.connectSequence)||e.ackByteCount>4||e.packetType>2)return{accepted:!1,dispatchData:!1};let t=(e.seqNumber|0xfffffe00&this.lastSeqRecvd)>>>0;if(t>>0),this.lastSeqRecvd+31>>0;if(a>>0),this.lastSendSeq>>0,0===e.packetType&&(this.recvAckMask=(1|this.recvAckMask)>>>0);for(let t=this.highestAckedSeq+1;t<=a;t++)(e.ackMask&1<<(a-t&31))!=0&&(this.lastRecvAckAck=this.lastSeqRecvdAtSend[31&t]>>>0);t-this.lastRecvAckAck>32&&(this.lastRecvAckAck=t-32),this.highestAckedSeq=a;let i=this.lastSeqRecvd!==t&&0===e.packetType;return this.lastSeqRecvd=t,{accepted:!0,dispatchData:i}}parsePacket(e){let t=new e0(e),a=this.readDnetHeader(t),r=this.applyProtocolHeader(a);if(this.packetsParsed++,!r.accepted)return this.protocolRejected++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};if(!r.dispatchData)return this.protocolNoDispatch++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};let i=this.readRateInfo(t);t.setStringBuffer(!0);let n=this.readGameState(t),o=void 0===n.controlObjectDataStart||void 0!==n.controlObjectData,s=o?this.readEvents(t):[],l=s[s.length-1],d=!l||l.dataBitsEnd!==l.dataBitsStart,c=o&&d?t.getCurPos():void 0,h=o&&d?this.readGhosts(t,a.seqNumber):[];return t.setStringBuffer(!1),{dnetHeader:a,rateInfo:i,gameState:n,events:s,ghosts:h,ghostSectionStart:c}}readDnetHeader(e){let t=e.readFlag(),a=e.readInt(1),r=e.readInt(9),i=e.readInt(9),n=e.readInt(2),o=e.readInt(3),s=o>0?e.readInt(8*o):0;return{gameFlag:t,connectSeqBit:a,seqNumber:r,highestAck:i,packetType:n,ackByteCount:o,ackMask:s}}readRateInfo(e){let t={};return e.readFlag()&&(t.updateDelay=e.readInt(10),t.packetSize=e.readInt(10)),e.readFlag()&&(t.maxUpdateDelay=e.readInt(10),t.maxPacketSize=e.readInt(10)),t}readGameState(e){let t,a,r,i,n,o,s,l,d,c,h,u,g,p,f,m=e.readInt(32);e.readFlag()&&(e.readFlag()&&(t=e.readFloat(7)),e.readFlag()&&(a=1.5*e.readFloat(7))),e.readFlag()&&(r=e.readFlag(),i=e.readFlag()),e.readFlag()&&((n=e.readFlag())&&(o={x:e.readF32(),y:e.readF32(),z:e.readF32()}),1===(s=e.readRangedU32(0,2))?e.readFlag()&&(l=e.readRangedU32(0,1023)):2===s&&(d={x:e.readF32(),y:e.readF32(),z:e.readF32()}));let F=e.readFlag(),v=e.readFlag();if(e.readFlag())if(e.readFlag()){let f=e.readInt(10);c=f,h=e.getCurPos();let y=e.savePos(),S=this.ghostTracker.getGhost(f),k=S?this.registry.getGhostParser(S.classId):void 0,b=this.controlParserByGhostIndex.get(f),I=this.registry.getGhostParser(25),x=this.registry.getGhostParser(4),P=[],D=new Set,C=e=>{!e?.readPacketData||D.has(e.name)||(D.add(e.name),P.push(e))};C(k),C(b),C(I),C(x);let w=!1;for(let t of P){e.restorePos(y);try{let a=this.getConnectionContext(),r=t.readPacketData(e,a);if(e.getCurPos()-h<=0||e.isError())continue;g=r,u=e.getCurPos(),this.controlParserByGhostIndex.set(f,t),a.compressionPoint!==this.compressionPoint&&(this.compressionPoint=a.compressionPoint,p=this.compressionPoint),this.controlObjectParsed++,w=!0;break}catch{}}if(!w)return e.restorePos(y),u=h,this.controlObjectFailed++,{lastMoveAck:m,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:i,seekerTracking:n,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:d,pinged:F,jammed:v,controlObjectGhostIndex:c,controlObjectDataStart:h,controlObjectDataEnd:u,controlObjectData:g,targetVisibility:[]}}else p={x:e.readF32(),y:e.readF32(),z:e.readF32()},this.compressionPoint=p;let y=[];for(;e.readFlag();)y.push({index:e.readInt(4),mask:e.readInt(32)});return e.readFlag()&&(f=e.readInt(8)),{lastMoveAck:m,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:i,seekerTracking:n,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:d,pinged:F,jammed:v,controlObjectGhostIndex:c,controlObjectDataStart:h,controlObjectDataEnd:u,controlObjectData:g,compressionPoint:p,targetVisibility:y.length>0?y:void 0,cameraFov:f}}readEvents(e){let t=[],a=!0,r=-2;for(;;){let i,n,o,s=e.readFlag();if(a&&!s){if(a=!1,!e.readFlag()){this.dispatchGuaranteedEvents(t);break}}else if(a||s){if(!s)break}else{this.dispatchGuaranteedEvents(t);break}!a&&(r=i=e.readFlag()?r+1&127:e.readInt(7),(n=i|0xffffff80&this.nextRecvEventSeq)0&&this.pendingGuaranteedEvents[0].absoluteSequenceNumber===this.nextRecvEventSeq;){let t=this.pendingGuaranteedEvents.shift();if(!t)break;this.nextRecvEventSeq=this.nextRecvEventSeq+1>>>0,e.push(t.event),t.event.parsedData&&this.applyEventSideEffects(t.event.parsedData)}}applyEventSideEffects(e){let t=e.type;if("GhostingMessageEvent"===t){let t=e.message;"number"==typeof t&&2===t&&this.ghostTracker.clear();return}if("GhostAlwaysObjectEvent"===t){let t=e.ghostIndex,a=e.classId;if("number"==typeof t&&"number"==typeof a){let e=this.registry.getGhostParser(a);this.ghostTracker.createGhost(t,a,e?.name??`unknown_${a}`)}}"SimDataBlockEvent"===t&&this.dataBlockDataMap&&e.dataBlockData&&"number"==typeof e.objectId&&this.dataBlockDataMap.set(e.objectId,e.dataBlockData)}readGhosts(e,t){let a=[];if(!e.readFlag())return a;let r=e.readInt(3)+3;for(;e.readFlag();){let i;if(e.isError())break;let n=e.readInt(r);if(e.isError())break;if(e.readFlag()){this.ghostTracker.deleteGhost(n),this.ghostDeletes++,a.push({index:n,type:"delete",updateBitsStart:e.getCurPos(),updateBitsEnd:e.getCurPos()});continue}let o=!this.ghostTracker.hasGhost(n);i=o?e.readInt(7)+0:this.ghostTracker.getGhost(n)?.classId;let s=e.getCurPos(),l=void 0!==i?this.registry.getGhostParser(i):void 0;if(o&&!l){this.ghostsTrackerDiverged++,e5("DIVERGED pkt=%d seq=%d idx=%d classId=%d bit=%d/%d trackerSize=%d (server sent UPDATE for ghost not in our tracker; 7-bit classId is actually update data)",this.packetsParsed,t,n,i,s,e.getMaxPos(),this.ghostTracker.size()),a.push({index:n,type:"create",classId:i,updateBitsStart:s,updateBitsEnd:s});break}let d=!1;if(l)try{let t=this.getConnectionContext();t.currentGhostIndex=n;let r=l.unpackUpdate(e,o,t),c=e.getCurPos();o&&void 0!==i?(this.ghostTracker.createGhost(n,i,l.name),this.ghostCreatesParsed++):this.ghostUpdatesParsed++,a.push({index:n,type:o?"create":"update",classId:i,updateBitsStart:s,updateBitsEnd:c,parsedData:r}),d=!0}catch(c){this.ghostsFailed++;let r=o?"create":"update",d=c instanceof Error?c.message:String(c);e5("FAIL pkt=%d seq=%d #%d idx=%d op=%s classId=%d parser=%s bit=%d/%d trackerSize=%d err=%s",this.packetsParsed,t,a.length,n,r,i,l.name,s,e.getMaxPos(),this.ghostTracker.size(),d)}if(!d){e5("STOP pkt=%d seq=%d idx=%d op=%s classId=%d parser=%s bit=%d/%d",this.packetsParsed,t,n,o?"create":"update",i,l?.name??"NONE",s,e.getMaxPos()),a.push({index:n,type:o?"create":"update",classId:i,updateBitsStart:s,updateBitsEnd:s});break}}return a}emptyGameState(){return{lastMoveAck:0,pinged:!1,jammed:!1}}}class e6{eventParsers=new Map;ghostParsers=new Map;dataBlockParsers=new Map;eventCatalog=new Map;ghostCatalog=new Map;dataBlockCatalog=new Map;catalogEvent(e){this.eventCatalog.set(e.name,e)}catalogGhost(e){this.ghostCatalog.set(e.name,e)}catalogDataBlock(e){this.dataBlockCatalog.set(e.name,e)}bindDeterministicDataBlocks(e,t){let a=0,r=[];for(let i=0;i0&&(r.sounds=t)}if(e.readFlag()){let t=[];for(let a=0;a<4;a++)e.readFlag()&&t.push({index:a,sequence:e.readInt(5),state:e.readInt(2),forward:e.readFlag(),atEnd:e.readFlag()});t.length>0&&(r.threads=t)}let i=!1;if(e.readFlag()){let a=[];for(let r=0;r<8;r++)if(e.readFlag()){let n={index:r};e.readFlag()?n.dataBlockId=e9(e):n.dataBlockId=0,e.readFlag()&&(e.readFlag()?n.skinTagIndex=e.readInt(10):n.skinName=e.readString(),i=!0),n.triggerDown=e.readFlag(),n.loaded=e.readFlag(),n.ammo=e.readFlag(),n.wet=e.readFlag(),n.target=e.readFlag(),n.fireCount=e.readInt(3),t&&(n.imageExtraFlag=e.readFlag()),a.push(n)}a.length>0&&(r.images=a)}if(e.readFlag()){if(e.readFlag()){r.stateAEnabled=e.readFlag(),r.stateB=e.readFlag();let t=e.readFlag();r.hasInvulnerability=t,t?(r.invulnerabilityVisual=e.readFlag(),r.invulnerabilityTicks=e.readU32()):r.binaryCloak=e.readFlag()}if(e.readFlag())if(e.readFlag()){let t=e.readFlag();r.stateBMode=t,t?r.energyPackOn=!0:r.energyPackOn=!1}else r.shieldNormal=e.readNormalVector(8),r.energyPercent=e.readFloat(5);e.readFlag()&&(r.stateValue1=e.readU32(),r.stateValue2=e.readU32())}return i&&(r.imageSkinDirty=!0),e.readFlag()&&(e.readFlag()?(r.mountObject=e.readInt(10),r.mountNode=e.readInt(5)):r.mountObject=-1),r}function ta(e,t,a){let r=tt(e,t,a);if(e.readFlag()&&(r.impactSound=e.readInt(3)),e.readFlag()&&(r.action=e.readInt(8),r.actionHoldAtEnd=e.readFlag(),r.actionAtEnd=e.readFlag(),r.actionFirstPerson=e.readFlag(),!r.actionAtEnd&&e.readFlag()&&(r.actionAnimPos=e.readSignedFloat(6))),e.readFlag()&&(r.armAction=e.readInt(8)),e.readFlag())return r;if(e.readFlag()){if(r.actionState=e.readInt(3),e.readFlag()&&(r.recoverTicks=e.readInt(7)),r.moveFlag0=e.readFlag(),r.moveFlag1=e.readFlag(),r.position=e.readCompressedPoint(a.compressionPoint),e.readFlag()){let t=e.readInt(13)/32,a=e.readNormalVector(10);r.velocity={x:a.x*t,y:a.y*t,z:a.z*t}}else r.velocity={x:0,y:0,z:0};r.headX=e.readSignedFloat(6),r.headZ=e.readSignedFloat(6),r.rotationZ=2*e.readFloat(7)*Math.PI,r.move=e7(e),r.allowWarp=e.readFlag()}return r.energy=e.readFloat(5),r}function tr(e,t){let a={};if(a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.actionState=e.readInt(3),e.readFlag()&&(a.recoverTicks=e.readInt(7)),e.readFlag()&&(a.jumpDelay=e.readInt(7)),e.readFlag()){let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};a.position=r,t.compressionPoint=r,a.velocity={x:e.readF32(),y:e.readF32(),z:e.readF32()},a.jumpSurfaceLastContact=e.readInt(4)}if(a.headX=e.readF32(),a.headZ=e.readF32(),a.rotationZ=e.readF32(),e.readFlag()){let r=e.readInt(10);a.controlObjectGhost=r;let i=t.ghostTracker.getGhost(r),n=i?t.getGhostParser?.(i.classId):void 0;if(n?.readPacketData){let i=t.currentGhostIndex;t.currentGhostIndex=r,a.controlObjectData=n.readPacketData(e,t),t.currentGhostIndex=i}}return a.disableMove=e.readFlag(),a.pilot=e.readFlag(),a}function ti(e,t,a){let r=tt(e,t,a);return(r.jetting=e.readFlag(),e.readFlag())?r._controlledEarlyReturn=!0:(r.steeringYaw=e.readFloat(9),r.steeringPitch=e.readFloat(9),r.move=e7(e),r.frozen=e.readFlag(),e.readFlag()&&(r.position=e.readCompressedPoint(a.compressionPoint),r.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},r.linMomentum=e.readPoint3F(),r.angMomentum=e.readPoint3F()),e.readFlag()&&(r.energy=e.readFloat(8))),r}function tn(e,t){let a={};a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.steering={x:e.readF32(),y:e.readF32()};let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};return a.linPosition=r,a.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},a.linMomentum=e.readPoint3F(),a.angMomentum=e.readPoint3F(),a.disableMove=e.readFlag(),a.frozen=e.readFlag(),t.compressionPoint=r,a}function to(e,t){let a=tn(e,t);a.braking=e.readFlag();let r=4,i=t.currentGhostIndex;if(void 0!==i){let e=tZ.get(i);void 0!==e&&(r=e)}let n=[];for(let t=0;t64)throw Error(`Invalid Sky fogVolumeCount: ${t}`);r.fogVolumeCount=t,r.useSkyTextures=e.readBool(),r.renderBottomTexture=e.readBool(),r.skySolidColor={r:e.readF32(),g:e.readF32(),b:e.readF32()},r.windEffectPrecipitation=e.readBool();let a=[];for(let r=0;r3)throw Error(`Invalid precipitation colorCount: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/96))throw Error(`Invalid physicalZone point count: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone plane count: ${i}`);let n=[];for(let t=0;tMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone edge count: ${o}`);let s=[];for(let t=0;t0&&(a.audioData=e.readBitsBuffer(8*r)),a}function ad(e,t){return{type:"GhostingMessageEvent",sequence:e.readU32(),message:e.readInt(3),ghostCount:e.readInt(11)}}function ac(e,t){let a={type:"GhostAlwaysObjectEvent"};a.ghostIndex=e.readInt(10);let r=e.readFlag();if(a._hasObjectData=r,r){let r=e.readInt(7);a.classId=r;let i=t.getGhostParser?.(r);if(!i)throw Error(`No ghost parser for GhostAlwaysObjectEvent classId=${r}`);a.objectData=i.unpackUpdate(e,!0,t)}return a}function ah(e,t){let a={type:"PathManagerEvent"};if(e.readFlag()){a.messageType="NewPaths";let t=e.readU32(),r=[];for(let a=0;a0&&(t.hudImages=a),t}function aw(e){let t={};e.readFlag()&&(t.crc=e.readU32()),t.shapeName=e.readString(),t.mountPoint=e.readU32(),e.readFlag()||(t.offset=e.readAffineTransform()),t.firstPerson=e.readFlag(),t.mass=e.readF32(),t.usesEnergy=e.readFlag(),t.minEnergy=e.readF32(),t.hasFlash=e.readFlag(),t.projectile=ab(e),t.muzzleFlash=ab(e),t.isSeeker=e.readFlag(),t.isSeeker&&(t.seekerRadius=e.readF32(),t.maxSeekAngle=e.readF32(),t.seekerLockTime=e.readF32(),t.seekerFreeTime=e.readF32(),t.isTargetLockRequired=e.readFlag(),t.maxLockRange=e.readF32()),t.cloakable=e.readFlag(),t.lightType=e.readRangedU32(0,3),0!==t.lightType&&(t.lightRadius=e.readF32(),t.lightTime=e.readS32(),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)}),t.shellExitDir={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.shellExitVariance=e.readF32(),t.shellVelocity=e.readF32(),t.casing=ab(e),t.accuFire=e.readFlag();let a=[];for(let t=0;t<31;t++){if(!e.readFlag())continue;let t={};t.name=e.readString(),t.transitionOnAmmo=e.readInt(5),t.transitionOnNoAmmo=e.readInt(5),t.transitionOnTarget=e.readInt(5),t.transitionOnNoTarget=e.readInt(5),t.transitionOnWet=e.readInt(5),t.transitionOnNotWet=e.readInt(5),t.transitionOnTriggerUp=e.readInt(5),t.transitionOnTriggerDown=e.readInt(5),t.transitionOnTimeout=e.readInt(5),t.transitionGeneric0In=e.readInt(5),t.transitionGeneric0Out=e.readInt(5),e.readFlag()&&(t.timeoutValue=e.readF32()),t.waitForTimeout=e.readFlag(),t.fire=e.readFlag(),t.ejectShell=e.readFlag(),t.scaleAnimation=e.readFlag(),t.direction=e.readFlag(),t.reload=e.readFlag(),e.readFlag()&&(t.energyDrain=e.readF32()),t.loaded=e.readInt(3),t.spin=e.readInt(3),t.recoil=e.readInt(3),e.readFlag()&&(t.sequence=e.readSignedInt(16)),e.readFlag()&&(t.sequenceVis=e.readSignedInt(16)),t.flashSequence=e.readFlag(),t.ignoreLoadedForReady=e.readFlag(),t.emitter=ab(e),null!==t.emitter&&(t.emitterTime=e.readF32(),t.emitterNode=e.readS32()),t.sound=ab(e),a.push(t)}return t.states=a,t}function aE(e){let t=aC(e);t.renderFirstPerson=e.readFlag(),t.minLookAngle=e.readF32(),t.maxLookAngle=e.readF32(),t.maxFreelookAngle=e.readF32(),t.maxTimeScale=e.readF32(),t.maxStepHeight=e.readF32(),t.runForce=e.readF32(),t.runEnergyDrain=e.readF32(),t.minRunEnergy=e.readF32(),t.maxForwardSpeed=e.readF32(),t.maxBackwardSpeed=e.readF32(),t.maxSideSpeed=e.readF32(),t.maxUnderwaterForwardSpeed=e.readF32(),t.maxUnderwaterBackwardSpeed=e.readF32(),t.maxUnderwaterSideSpeedRef=ab(e),e.readFlag()&&(t.runSurfaceAngleRef=e.readInt(11)),t.runSurfaceAngle=e.readF32(),t.recoverDelay=e.readF32(),t.recoverRunForceScale=e.readF32(),t.jumpForce=e.readF32(),t.jumpEnergyDrain=e.readF32(),t.minJumpEnergy=e.readF32(),t.minJumpSpeed=e.readF32(),t.maxJumpSpeed=e.readF32(),t.jumpSurfaceAngle=e.readF32(),t.minJetEnergy=e.readF32(),t.splashVelocity=e.readF32(),t.splashAngle=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.bubbleEmitTime=e.readF32(),t.medSplashSoundVel=e.readF32(),t.hardSplashSoundVel=e.readF32(),t.exitSplashSoundVel=e.readF32(),t.jumpDelay=e.readInt(7),t.horizMaxSpeed=e.readF32(),t.horizResistSpeed=e.readF32(),t.horizResistFactor=e.readF32(),t.upMaxSpeed=e.readF32(),t.upResistSpeed=e.readF32(),t.upResistFactor=e.readF32(),t.jetEnergyDrain=e.readF32(),t.canJet=e.readF32(),t.maxJetHorizontalPercentage=e.readF32(),t.maxJetForwardSpeed=e.readF32(),t.jetForce=e.readF32(),t.minJetSpeed=e.readF32(),t.maxDamage=e.readF32(),t.minImpactDamageSpeed=e.readF32(),t.impactDamageScale=e.readF32(),t.footSplashHeight=e.readF32();let a=[];for(let t=0;t<32;t++)e.readFlag()?a.push(e.readInt(11)):a.push(null);t.sounds=a,t.boxSize={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.footPuffEmitter=ab(e),t.footPuffNumParts=e.readF32(),t.footPuffRadius=e.readF32(),t.decalData=ab(e),t.decalOffset=e.readF32(),t.dustEmitter=ab(e),t.splash=ab(e);let r=[];for(let t=0;t<3;t++)r.push(ab(e));return t.splashEmitters=r,t.groundImpactMinSpeed=e.readF32(),t.groundImpactShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeDuration=e.readF32(),t.groundImpactShakeFalloff=e.readF32(),t.boundingRadius=e.readF32(),t.moveBubbleSize=e.readF32(),t}function aB(e){let t=aC(e);t.bodyRestitution=e.readF32(),t.bodyFriction=e.readF32();let a=[];for(let t=0;t<2;t++)a.push(ab(e));t.impactSounds=a,t.minImpactSpeed=e.readF32(),t.softImpactSpeed=e.readF32(),t.hardImpactSpeed=e.readF32(),t.minRollSpeed=e.readF32(),t.maxSteeringAngle=e.readF32(),t.maxDrag=e.readF32(),t.minDrag=e.readF32(),t.cameraOffset=e.readF32(),t.cameraLag=e.readF32(),t.jetForce=e.readF32(),t.jetEnergyDrain=e.readF32(),t.minJetEnergy=e.readF32(),t.integration=e.readF32(),t.collisionTol=e.readF32(),t.massCenter=e.readF32(),t.exitSplashSoundVelocity=e.readF32(),t.softSplashSoundVelocity=e.readF32(),t.mediumSplashSoundVelocity=e.readF32(),t.hardSplashSoundVelocity=e.readF32();let r=[];for(let t=0;t<5;t++)r.push(ab(e));t.waterSounds=r,t.dustEmitter=ab(e);let i=[];for(let t=0;t<3;t++)i.push(ab(e));t.damageEmitters=i;let n=[];for(let t=0;t<2;t++)n.push(ab(e));return t.splashEmitters=n,t.damageEmitterOffset0={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageEmitterOffset1={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageLevelTolerance0=e.readF32(),t.damageLevelTolerance1=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.collDamageThresholdVel=e.readF32(),t.collDamageMultiplier=e.readF32(),t}function aM(e){let t=aB(e);t.jetActivateSound=ab(e),t.jetDeactivateSound=ab(e);let a=[];for(let t=0;t<4;t++)a.push(ab(e));return t.jetEmitters=a,t.maneuveringForce=e.readF32(),t.horizontalSurfaceForce=e.readF32(),t.verticalSurfaceForce=e.readF32(),t.autoInputDamping=e.readF32(),t.steeringForce=e.readF32(),t.steeringRollForce=e.readF32(),t.rollForce=e.readF32(),t.autoAngularForce=e.readF32(),t.rotationalDrag=e.readF32(),t.maxAutoSpeed=e.readF32(),t.autoLinearForce=e.readF32(),t.hoverHeight=e.readF32(),t.createHoverHeight=e.readF32(),t.minTrailSpeed=e.readF32(),t.vertThrustMultiple=e.readF32(),t.maxForwardSpeed=e.readF32(),t}function aT(e){let t=aB(e);t.dragForce=e.readF32(),t.mainThrustForce=e.readF32(),t.reverseThrustForce=e.readF32(),t.strafeThrustForce=e.readF32(),t.turboFactor=e.readF32(),t.stabLenMin=e.readF32(),t.stabLenMax=e.readF32(),t.stabSpringConstant=e.readF32(),t.stabDampingConstant=e.readF32(),t.gyroDrag=e.readF32(),t.normalForce=e.readF32(),t.restorativeForce=e.readF32(),t.steeringForce=e.readF32(),t.rollForce=e.readF32(),t.pitchForce=e.readF32(),t.floatingThrustFactor=e.readF32(),t.brakingForce=e.readF32(),t.dustTrailOffset={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.dustTrailFreqMod=e.readF32(),t.triggerTrailHeight=e.readF32(),t.floatSound=ab(e),t.thrustSound=ab(e),t.turboSound=ab(e);let a=[];for(let t=0;t<3;t++)a.push(ab(e));return t.jetEmitters=a,t.dustTrailEmitter=ab(e),t.mainThrustEmitterFactor=e.readF32(),t.strafeThrustEmitterFactor=e.readF32(),t.reverseThrustEmitterFactor=e.readF32(),t}function aN(e){let t=aB(e);return t.tireRadius=e.readF32(),t.tireStaticFriction=e.readF32(),t.tireKineticFriction=e.readF32(),t.tireRestitution=e.readF32(),t.tireLateralForce=e.readF32(),t.tireLateralDamping=e.readF32(),t.tireLateralRelaxation=e.readF32(),t.tireLongitudinalForce=e.readF32(),t.tireLongitudinalDamping=e.readF32(),t.tireEmitter=ab(e),t.jetSound=ab(e),t.engineSound=ab(e),t.squealSound=ab(e),t.wadeSound=ab(e),t.spring=e.readF32(),t.springDamping=e.readF32(),t.springLength=e.readF32(),t.brakeTorque=e.readF32(),t.engineTorque=e.readF32(),t.engineBrake=e.readF32(),t.maxWheelSpeed=e.readF32(),t.steeringAngle=e.readF32(),t.steeringReturn=e.readF32(),t.steeringDamping=e.readF32(),t.powerSteeringFactor=e.readF32(),t}function aG(e){let t=aC(e);return t.noIndividualDamage=e.readFlag(),t.dynamicTypeField=e.readS32(),t}function aR(e){let t=aG(e);return t.thetaMin=e.readF32(),t.thetaMax=e.readF32(),t.thetaNull=e.readF32(),t.neverUpdateControl=e.readFlag(),t.primaryAxis=e.readRangedU32(0,3),t.maxCapacitorEnergy=e.readF32(),t.capacitorRechargeRate=e.readF32(),t}function aU(e){let t=aw(e);return t.activationMS=e.readInt(8),t.deactivateDelayMS=e.readInt(8),t.degPerSecTheta=e.readRangedU32(0,1080),t.degPerSecPhi=e.readRangedU32(0,1080),t.dontFireInsideDamageRadius=e.readFlag(),t.damageRadius=e.readF32(),t.useCapacitor=e.readFlag(),t}function aj(e){let t=aC(e);return t.friction=e.readFloat(10),t.elasticity=e.readFloat(10),t.sticky=e.readFlag(),e.readFlag()&&(t.gravityMod=e.readFloat(10)),e.readFlag()&&(t.maxVelocity=e.readF32()),e.readFlag()&&(t.lightType=e.readInt(2),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)},t.lightTime=e.readS32(),t.lightRadius=e.readF32(),t.lightOnlyStatic=e.readFlag()),t}function aA(e){let t={};t.projectileShapeName=e.readString(),t.faceViewerLinkTime=e.readS32(),t.lifetime=e.readS32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.scale={x:e.readF32(),y:e.readF32(),z:e.readF32()}),t.baseEmitter=ab(e),t.delayEmitter=ab(e),t.bubbleEmitter=ab(e),t.explosion=ab(e),t.underwaterExplosion=ab(e),t.splash=ab(e),t.sound=ab(e),t.wetFireSound=ab(e),t.fireSound=ab(e);let a=[];for(let t=0;t<6;t++)a.push(ab(e));return t.decals=a,e.readFlag()&&(t.lightRadius=e.readFloat(8),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),e.readFlag()&&(t.underwaterLightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),t.explodeOnWaterImpact=aP(e),t.depthTolerance=e.readF32(),t}function aV(e){let t=aA(e);return t.dryVelocity=e.readF32(),t.wetVelocity=e.readF32(),t.fizzleTime=e.readU32(),t.fizzleType=e.readU32(),t.hardRetarget=e.readFlag(),t.inheritedVelocityScale=e.readRangedU32(0,90),t.lifetimeMS=e.readRangedU32(0,90),t.collideWithOwnerTimeMS=e.readU32(),t.proximityRadius=e.readU32(),t.tracerProjectile=e.readFlag(),t}function aO(e){let t=aA(e);return t.armingDelayMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.grenadeElasticity=e.readF32(),t.grenadeFriction=e.readF32(),t.drag=e.readF32(),t.density=e.readF32(),t.gravityMod=e.readF32(),t.lifetimeMS=e.readS32(),t}function az(e){let t=aA(e);return t.lifetimeMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.turningSpeed=e.readF32(),t.proximityRadius=e.readF32(),t.terrainAvoidanceSpeed=e.readF32(),t.terrainScanAhead=e.readF32(),t.terrainHeightFail=e.readF32(),t.terrainAvoidanceRadius=e.readF32(),t.flareDistance=e.readF32(),t.flareAngle=e.readF32(),t.useFlechette=aP(e),t.maxVelocity=e.readF32(),t.acceleration=e.readF32(),t.flechetteDelayMs=e.readS32(),t.exhaustTimeMs=e.readS32(),t.exhaustNodeName=e.readString(),t.casingShapeName=e.readString(),t.casingDebris=ab(e),t.puffEmitter=ab(e),t.exhaustEmitter=ab(e),t}function aL(e){let t=aA(e);t.maxRifleRange=e.readF32(),t.rifleHeadMultiplier=e.readF32(),t.beamColor=ax(e),t.fadeTime=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32(),t.lightColor=ax(e),t.lightRadius=e.readF32();let a=[];for(let t=0;t<12;t++)a.push(e.readString());return t.textures=a,t}function aq(e){let t=aA(e);t.zapDuration=e.readF32(),t.boltLength=e.readF32(),t.numParts=e.readF32(),t.lightningFreq=e.readF32(),t.lightningDensity=e.readF32(),t.lightningAmp=e.readF32(),t.lightningWidth=e.readF32(),t.shockwave=ab(e);let a=[],r=[],i=[],n=[];for(let t=0;t<2;t++)a.push(e.readF32()),r.push(e.readF32()),i.push(e.readF32()),n.push(e.readF32());t.startWidth=a,t.endWidth=r,t.boltSpeed=i,t.texWrap=n;let o=[];for(let t=0;t<4;t++)o.push(e.readString());return t.textures=o,t.emitter=ab(e),t}function a_(e){let t=aA(e);return t.beamRange=e.readF32(),t.beamDrainRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t.flareTexture=e.readString(),t.hitEmitter=ab(e),t}function aH(e){let t=aA(e);return t.beamRange=e.readF32(),t.beamRepairRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t}function aW(e){let t=aA(e);t.maxRifleRange=e.readF32(),t.beamColor=ax(e),t.startBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32();let a=[];for(let t=0;t<4;t++)a.push(e.readString());return t.textures=a,t}function a$(e){let t=aV(e);return t.tracerLength=e.readF32(),t.tracerAlpha=e.readF32(),t.tracerMinPixels=e.readF32(),t.crossViewFraction=aP(e),t.tracerColor=ax(e),t.tracerWidth=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=aP(e),t.textureName0=e.readString(),t.textureName1=e.readString(),t}function aZ(e){let t=aO(e);return t.energyDrainPerSecond=e.readF32(),t.energyMinDrain=e.readF32(),t.beamWidth=e.readF32(),t.beamRange=e.readF32(),t.numSegments=e.readF32(),t.texRepeat=e.readF32(),t.beamFlareAngle=e.readF32(),t.beamTexture=e.readString(),t.flareTexture=e.readString(),t}function aX(e){let t=aV(e);return t.numFlares=e.readF32(),t.flareColor=ax(e),t.flareTexture=e.readString(),t.smokeTexture=e.readString(),t.size=e.readF32(),t.flareModTexture=e.readF32(),t.smokeSize=e.readF32(),t}function aJ(e){let t=aO(e);return t.smokeDist=e.readF32(),t.noSmoke=e.readF32(),t.boomTime=e.readF32(),t.casingDist=e.readF32(),t.smokeCushion=e.readF32(),t.noSmokeCounter=e.readF32(),t.smokeTexture=e.readString(),t.bombTexture=e.readString(),t}function aY(e){let t=aO(e);return t.size=e.readF32(),t.useLensFlare=aP(e),t.flareTexture=e.readString(),t.lensFlareTexture=e.readString(),t}function aQ(e){let t={};t.dtsFileName=e.readString(),t.soundProfile=ab(e),t.particleEmitter=ab(e),t.particleDensity=e.readInt(14),t.particleRadius=e.readF32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.explosionScale={x:e.readInt(16),y:e.readInt(16),z:e.readInt(16)}),t.playSpeed=e.readInt(14),t.debrisThetaMin=e.readRangedU32(0,180),t.debrisThetaMax=e.readRangedU32(0,180),t.debrisPhiMin=e.readRangedU32(0,360),t.debrisPhiMax=e.readRangedU32(0,360),t.debrisMinVelocity=e.readRangedU32(0,1e3),t.debrisMaxVelocity=e.readRangedU32(0,1e3),t.debrisNum=e.readInt(14),t.debrisVariance=e.readRangedU32(0,1e4),t.delayMS=e.readInt(16),t.delayVariance=e.readInt(16),t.lifetimeMS=e.readInt(16),t.lifetimeVariance=e.readInt(16),t.offset=e.readF32(),t.shakeCamera=e.readFlag(),t.hasLight=e.readFlag(),t.camShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeDuration=e.readF32(),t.camShakeRadius=e.readF32(),t.camShakeFalloff=e.readF32(),t.shockwave=ab(e),t.debris=ab(e);let a=[];for(let t=0;t<4;t++)a.push(ab(e));t.emitters=a;let r=[];for(let t=0;t<5;t++)r.push(ab(e));t.subExplosions=r;let i=e.readRangedU32(0,4),n=[];for(let t=0;t0&&ry("DataBlock binding: %d/%d bound, missing parsers: %s",t,e3.length,a.join(", "));const{bound:r,missing:i}=this.registry.bindDeterministicGhosts(e2,0);i.length>0&&ry("Ghost binding: %d/%d bound, missing parsers: %s",r,e2.length,i.join(", "));const{bound:n,missing:o}=this.registry.bindDeterministicEvents(e1,255);o.length>0&&ry("Event binding: %d/%d bound, missing parsers: %s",n,e1.length,o.join(", ")),this.packetParser=new e8(this.registry,this.ghostTracker)}getRegistry(){return this.registry}getGhostTracker(){return this.ghostTracker}getPacketParser(){return this.packetParser}get loaded(){return this._loaded}get header(){if(!this._loaded)throw Error("must call load() first");return this._header}get initialBlock(){if(!this._loaded)throw Error("must call load() first");return this._initialBlock}get blockCount(){if(!this._loaded)throw Error("must call load() first");if(void 0===this._blockCount){let e=this._decompressedData,t=this._decompressedView,a=0,r=0;for(;r+2<=e.length;){let i=4095&t.getUint16(r,!0);if((r+=2+i)>e.length)break;a++}this._blockCount=a}return this._blockCount}get blockCursor(){if(!this._loaded)throw Error("must call load() first");return this._blockCursor}async load(){if(this._loaded)return{header:this._header,initialBlock:this._initialBlock};let e=this.readHeader();ry('header: "%s" version=0x%s length=%dms (%smin) initialBlockSize=%d',e.identString,e.protocolVersion.toString(16),e.demoLengthMs,(e.demoLengthMs/1e3/60).toFixed(1),e.initialBlockSize);let t=this.buffer.subarray(this.offset,this.offset+e.initialBlockSize),a=this.readInitialBlock(t);this.offset+=e.initialBlockSize;let r=this.buffer.subarray(this.offset);ry("compressed block stream: %d bytes",r.length);let i=await new Promise((e,t)=>{var a,i;a=(a,r)=>{a?t(a):e(r)},i||(i=a,a={}),"function"!=typeof i&&T(7),eo(r,a,[ee],function(e){return ei(eP(e.data[0],en(e.data[1])))},1,i)});return ry("decompressed block stream: %d bytes",i.length),this._decompressedData=i,this._decompressedView=new DataView(i.buffer,i.byteOffset,i.byteLength),this.setupPacketParser(a),this._header=e,this._initialBlock=a,this._blockStreamOffset=0,this._blockCursor=0,this._loaded=!0,{header:e,initialBlock:a}}nextBlock(){if(!this._loaded)throw Error("must call load() first");let e=this._decompressedData,t=this._decompressedView,a=this._blockStreamOffset;if(a+2>e.length)return;let r=t.getUint16(a,!0),i=r>>12,n=4095&r;if(a+2+n>e.length)return void rk("block %d: size %d would exceed decompressed data (offset=%d remaining=%d), stopping",this._blockCursor,n,a+2,e.length-a-2);let o=e.subarray(a+2,a+2+n);this._blockStreamOffset=a+2+n;let s={index:this._blockCursor,type:i,size:n,data:o};if(this._blockCursor++,0===i)try{s.parsed=this.packetParser.parsePacket(o)}catch{}else if(1===i)this.packetParser.onSendPacketTrigger();else if(2===i&&64===n)try{s.parsed=this.readRawMove(o)}catch{}else if(3===i&&8===n)try{s.parsed=this.readInfoBlock(o)}catch{}return s}reset(){if(!this._loaded)throw Error("must call load() first");this._blockStreamOffset=0,this._blockCursor=0,this._blockCount=void 0,this.setupPacketParser(this._initialBlock)}processBlocks(e){if(!this._loaded)throw Error("must call load() first");let t=0;for(let a=0;a=128&&t<128+e3.length?e3[t-128]:`unknown(${t})`;throw Error(`No parser for DataBlock classId ${t} (${e}) at bit ${n}`)}}ry("all %d/%d DataBlocks parsed (%d payloads), bit position after DataBlocks: %d",l,n,s.size,r.getCurPos());let d=0!==r.readU8(),c=[];for(let e=0;e<6;e++)c.push(r.readU32());let h=[];for(let e=0;e<16;e++)h.push(r.readU32());let u=r.readU32(),g=[];for(let e=0;e>3<<3),this.readSimpleTargetManager(r),this.readSimpleTargetManager(r),rS('after sequential tail bit=%d mission="%s" CRC=0x%s',r.getCurPos(),B,M.toString(16))}catch(e){a=e instanceof Error?e.message:String(e)}finally{this.ghostTracker=x}let T=b-r.getCurPos(),N=B.length>0?B.split("").filter(e=>{let t=e.charCodeAt(0);return t>=32&&t<=126}).length/B.length:1,G=B.length>0&&N>=.8&&void 0===a;return ry('initial block: events=%d ghosts=%d ghostingSeq=%d controlObj=%d mission="%s" CRC=0x%s valid=%s%s',P.length,w.length,C,E,B,M.toString(16),G,a?` error=${a}`:""),{taggedStrings:i,dataBlockHeaders:o,dataBlockCount:l,dataBlocks:s,firstPerson:d,connectionFields:c,stateArray:h,scoreEntries:g,demoValues:p,sensorGroupColors:f,targetEntries:m,connectionState:F,roundTripTime:v,packetLoss:y,pathManager:S,notifyCount:k,nextRecvEventSeq:D,ghostingSequence:C,initialGhosts:w,initialEvents:P,controlObjectGhostIndex:E,controlObjectData:t,missionName:B,missionCRC:M,phase2TrailingBits:T,phase2Valid:G,phase2Error:a}}readScoreEntry(e){let t=e.readFlag()?e.readInt(16):0,a=e.readFlag()?e.readInt(16):0,r=e.readFlag()?e.readInt(16):0,i=e.readInt(6),n=e.readInt(6),o=e.readInt(6),s=e.readFlag(),l=[];for(let t=0;t<6;t++)l.push(e.readFlag());return{clientId:t,teamId:a,score:r,field0:i,field1:n,field2:o,isBot:s,triggerFlags:l}}readDemoValues(e){let t=[];for(;e.readFlag();)t.push(e.readString());return t}readComplexTargetManager(e){e.readU8(),e.readU8(),e.readU8(),e.readU8();let t=[];for(let a=0;a<32;a++)for(let r=0;r<32;r++)e.readFlag()&&t.push({group:a,targetGroup:r,r:e.readU8(),g:e.readU8(),b:e.readU8(),a:e.readU8()});let a=[];for(let t=0;t<512;t++){if(!e.readFlag())continue;let r={targetId:t,sensorGroup:0,targetData:0,damageLevel:0};e.readFlag()&&(r.sensorData=e.readU32()),e.readFlag()&&(r.voiceMapData=e.readU32()),e.readFlag()&&(r.name=e.readString()),e.readFlag()&&(r.skin=e.readString()),e.readFlag()&&(r.skinPref=e.readString()),e.readFlag()&&(r.voice=e.readString()),e.readFlag()&&(r.typeDescription=e.readString()),r.sensorGroup=e.readInt(5),r.targetData=e.readInt(9),t>=32&&e.readFlag()&&(r.dataBlockRef=e.readInt(11)),r.damageLevel=e.readFloat(7),a.push(r)}return{sensorGroupColors:t,targets:a}}readPathManager(e){let t=[],a=e.readU32();for(let r=0;rthis.registry.getDataBlockParser(e)};t=n.unpack(e,a)}catch{a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:i});break}else{a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:i});break}a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:e.getCurPos(),parsedData:t}),rS(" event classId=%d bits=%d",r,e.getCurPos()-i)}return{nextRecvEventSeq:t,events:a}}readGhostStartBlock(e,t){let a=e.readU32(),r=[];rS("ghost block: seq=%d bit=%d",a,e.getCurPos());let i=this.registry.getGhostCatalog(),n=8*e.getBuffer().length,o=new Map;for(let[e,a]of t)o.set(e,a.data);for(;e.readFlag()&&!e.isError();){let a=e.readInt(10),s=e.readInt(7)+0,l=e.getCurPos(),d=[],c=new Set,{entry:h}=this.identifyGhostViaDataBlock(e,t,i),u=this.registry.getGhostParser(s);u&&(d.push({entry:u,method:"registry"}),c.add(u)),h&&!c.has(h)&&(d.push({entry:h,method:"datablock"}),c.add(h));let g={getDataBlockData:e=>o.get(e),getDataBlockParser:e=>this.registry.getDataBlockParser(e)},p=!1;for(let{entry:t,method:i}of d){let o="registry"===i,d=this.tryGhostParser(e,t,l,n,!1,g,o);if(!1!==d){this.ghostTracker.createGhost(a,s,t.name),rS(" ghost idx=%d classId=%d parser=%s bits=%d via=%s",a,s,t.name,e.getCurPos()-l,i),r.push({index:a,type:"create",classId:s,updateBitsStart:l,updateBitsEnd:e.getCurPos(),parsedData:d}),p=!0;break}}if(!p){rS(" ghost idx=%d classId=%d NO PARSER (stopping at bit=%d, remaining=%d)",a,s,l,n-l);break}}return rS("ghost loop ended at bit=%d remaining=%d count=%d",e.getCurPos(),n-e.getCurPos(),r.length),{ghostingSequence:a,ghosts:r}}tryGhostParser(e,t,a,r,i=!1,n,o=!1){let s=e.savePos();i||rS(" try %s: startBit=%d",t.name,a);try{let l=t.unpackUpdate(e,!0,{compressionPoint:{x:0,y:0,z:0},ghostTracker:this.ghostTracker,...n}),d=e.getCurPos()-a,c=r-e.getCurPos();if(e.isError()||!o&&d<3)return i||rS(" reject %s: bits=%d isError=%s",t.name,d,e.isError()),e.restorePos(s),!1;if(c>1e3){let a=e.getCurPos(),r=e.readFlag();if(e.setCurPos(a),!r)return i||rS(" reject %s: bits=%d misaligned (remaining=%d)",t.name,d,c),e.restorePos(s),!1}return l??{}}catch(a){return i||rS(" reject %s: error at bit=%d: %s",t.name,e.getCurPos(),a instanceof Error?a.message:String(a)),e.restorePos(s),!1}}identifyGhostViaDataBlock(e,t,a){let r;if(!t)return{entry:void 0,dbFlag:!1};let i=e.savePos(),n=!1;try{if(n=e.readFlag()){let i=e.readInt(11),n=t.get(i);if(n){let e=n.className.replace(/Data$/,"");(r=a.get(e))||rS(" identifyGhostViaDataBlock: dbId=%d className=%s ghostName=%s (no ghost parser)",i,n.className,e)}else rS(" identifyGhostViaDataBlock: dbId=%d (no DataBlock found)",i)}else rS(" identifyGhostViaDataBlock: DataBlock flag=0")}catch{}return e.restorePos(i),{entry:r,dbFlag:n}}readRawMove(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getInt32(0,!0),r=t.getInt32(4,!0),i=t.getInt32(8,!0),n=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getFloat32(24,!0),d=t.getFloat32(28,!0),c=t.getFloat32(32,!0),h=t.getFloat32(36,!0),u=t.getFloat32(40,!0),g=t.getFloat32(44,!0),p=t.getUint32(48,!0),f=t.getUint32(52,!0),m=0!==e[56],F=[];for(let t=0;t<6;t++)F.push(0!==e[57+t]);return{px:a,py:r,pz:i,pyaw:n,ppitch:o,proll:s,x:l,y:d,z:c,yaw:h,pitch:u,roll:g,id:p,sendCount:f,freeLook:m,trigger:F}}readInfoBlock(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{value1:t.getUint32(0,!0),value2:t.getFloat32(4,!0)}}}function rI(){let e=new e6,t=new e4;ak(e),t3(e),rv(e),e.bindDeterministicDataBlocks(e3,128),e.bindDeterministicGhosts(e2,0),e.bindDeterministicEvents(e1,255);let a=new e8(e,t,{dataBlockDataMap:new Map});return{registry:e,ghostTracker:t,packetParser:a}}e.s(["DemoParser",()=>rb],88787),e.s(["createLiveParser",()=>rI],94802),e.s([],91891);var rx=e.i(90072);let rP=new Set(["FlyingVehicle","HoverVehicle","WheeledVehicle"]),rD=new Set(["BombProjectile","EnergyProjectile","FlareProjectile","GrenadeProjectile","LinearFlareProjectile","LinearProjectile","Projectile","SeekerProjectile","TracerProjectile"]),rC=new Set(["LinearProjectile","TracerProjectile","LinearFlareProjectile","Projectile"]),rw=new Set(["GrenadeProjectile","EnergyProjectile","FlareProjectile","BombProjectile"]),rE=new Set(["SeekerProjectile"]),rB=new Set(["StaticShape","ScopeAlwaysShape","Turret","BeaconObject","ForceFieldBare"]);function rM(e){return"Player"===e?"Player":rP.has(e)?"Vehicle":"Item"===e?"Item":rD.has(e)?"Projectile":rB.has(e)?"Deployable":"Ghost"}function rT(e,t){return`${e}_${t}`}let rN=Object.freeze({r:0,g:255,b:0}),rG=Object.freeze({r:255,g:0,b:0});e.s(["IFF_GREEN",0,rN,"IFF_RED",0,rG,"TICK_DURATION_MS",0,32,"ballisticProjectileClassNames",0,rw,"linearProjectileClassNames",0,rC,"projectileClassNames",0,rD,"seekerProjectileClassNames",0,rE,"toEntityId",()=>rT,"toEntityType",()=>rM],25311);let rR=new rx.Matrix4,rU=new rx.Quaternion;function rj(e,t,a){return ea?a:e}let rA=.494*Math.PI;function rV(e,t){let a=Math.sin(t),r=Math.cos(t),i=Math.sin(e),n=Math.cos(e);return rR.set(-i,n*a,-n*r,0,0,r,a,0,n,i*a,-i*r,0,0,0,0,1),rU.setFromRotationMatrix(rR),[rU.x,rU.y,rU.z,rU.w]}function rO(e){let t=-e/2;return[0,Math.sin(t),0,Math.cos(t)]}function rz(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(e.z)||!Number.isFinite(e.w))return null;let t=-e.y,a=-e.z,r=-e.x,i=e.w,n=t*t+a*a+r*r+i*i;if(n<=1e-12)return null;let o=1/Math.sqrt(n);return[t*o,a*o,r*o,i*o]}function rL(e){return Math.atan2(2*(e.w*e.z+e.x*e.y),e.w*e.w+e.x*e.x-e.y*e.y-e.z*e.z)}function rq(e){return Math.asin(Math.max(-1,Math.min(1,2*(e.w*e.x-e.y*e.z))))}function r_(e){return null!=e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function rH(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z}function rW(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w}function r$(e,t){let a;if(t)return"string"==typeof(a=rD.has(e)||e.endsWith("ProjectileData")?t.projectileShapeName:"DebrisData"===e?t.shapeFileName:t.shapeName)&&a.length>0?a:void 0}function rZ(e,t){if(e)for(let a of t){let t=e[a];if("number"==typeof t&&Number.isFinite(t))return t}}function rX(e,t){if(e)for(let a of t){let t=e[a];if("string"==typeof t&&t.length>0)return t}}function rJ(e,t){if(!t)return;let a=rX(t,["tracerTex0","textureName0","texture0"])??"";if(!("TracerProjectile"===e||a.length>0&&null!=rZ(t,["tracerLength"]))||!a)return;let r=rX(t,["tracerTex1","textureName1","texture1"]),i=rZ(t,["tracerLength"])??10,n=rZ(t,["tracerWidth"]),o=rZ(t,["tracerAlpha"]),s=null!=n&&(null!=rZ(t,["crossViewAng"])||n<=.7)?n:o??n??.5,l=rZ(t,["crossViewAng","crossViewFraction"])??("number"==typeof t.tracerWidth&&t.tracerWidth>.7?t.tracerWidth:.98);return{kind:"tracer",texture:a,crossTexture:r,tracerLength:i,tracerWidth:s,crossViewAng:l,crossSize:rZ(t,["crossSize","muzzleVelocity"])??.45,renderCross:function(e,t){if(e)for(let a of t){let t=e[a];if("boolean"==typeof t)return t}}(t,["renderCross","proximityRadius"])??!0}}function rY(e,t){if(t){if("LinearFlareProjectile"===e){let e=rX(t,["smokeTexture","flareTexture"]);if(!e)return;let a=t.flareColor,r=rZ(t,["size"])??.5;return{kind:"sprite",texture:e,color:a?{r:a.r,g:a.g,b:a.b}:{r:1,g:1,b:1},size:r}}if("FlareProjectile"===e){let e=rX(t,["flareTexture"]);if(!e)return;return{kind:"sprite",texture:e,color:{r:1,g:.9,b:.5},size:rZ(t,["size"])??4}}}}function rQ(e){let t=e.states;if(Array.isArray(t)&&0!==t.length)return t.map(e=>{let t=e=>null==e?-1:e-1;return{name:e.name??"",transitionOnNotLoaded:t(e.transitionOnAmmo),transitionOnLoaded:t(e.transitionOnNoAmmo),transitionOnNoAmmo:t(e.transitionOnTarget),transitionOnAmmo:t(e.transitionOnNoTarget),transitionOnNoTarget:t(e.transitionOnWet),transitionOnTarget:t(e.transitionOnNotWet),transitionOnNotWet:t(e.transitionOnTriggerUp),transitionOnWet:t(e.transitionOnTriggerDown),transitionOnTriggerUp:t(e.transitionOnTimeout),transitionOnTriggerDown:t(e.transitionGeneric0In),transitionOnTimeout:t(e.transitionGeneric0Out),timeoutValue:e.timeoutValue,waitForTimeout:e.waitForTimeout??!1,fire:e.fire??!1,sequence:e.sequence,spin:e.spin??0,direction:e.direction??!0,scaleAnimation:e.scaleAnimation??!1,loaded:e.loaded??0,soundDataBlockId:e.sound??-1}})}function rK(e){let t="";for(let a=0;a=32&&(t+=e[a]);return t}let r0={2:0,3:1,4:2,5:3,6:4,7:5,8:6,11:7,12:8,14:9};function r3(e){for(let t=0;t=32)break}}function r2(e){let t=[],a=0,r="",i=!1;for(let n=0;n=32&&(r+=e[n]);continue}let s=r0[o];void 0!==s?(r&&(t.push({text:r,colorCode:a}),r=""),a=s):15===o?(r&&(t.push({text:r,colorCode:a}),r=""),a=0):o>=32&&(r+=e[n])}return r&&t.push({text:r,colorCode:a}),t}function r1(e){let t=e.indexOf("~w");return -1===t?{text:e,wavPath:null}:{text:e.substring(0,t),wavPath:e.substring(t+2)}}function r5(e){return e?"number"==typeof e.cameraMode?"camera":"number"==typeof e.rotationZ?"player":null:null}let r8=new Map([["gui/hud_new_packammo",0],["gui/hud_new_packcloak",1],["gui/hud_new_packenergy",2],["gui/hud_new_packrepair",3],["gui/hud_new_packsatchel",4],["gui/hud_new_packshield",5],["gui/hud_new_packinventory",6],["gui/hud_new_packmotionsens",7],["gui/hud_new_packradar",8],["gui/hud_new_packturretout",9],["gui/hud_new_packturretin",10],["gui/hud_new_packsensjam",11],["gui/hud_new_packturret",12],["gui/hud_satchel_unarmed",18]]);function r6(e){let t=e.toLowerCase();for(let[e,a]of r8)if(e===t)return a;return -1}e.s(["CameraMode_OrbitObject",0,3,"MAX_PITCH",0,rA,"backpackBitmapToIndex",()=>r6,"clamp",()=>rj,"detectColorCode",()=>r3,"detectControlObjectType",()=>r5,"extractWavTag",()=>r1,"getNumberField",()=>rZ,"isQuatLike",()=>rW,"isValidPosition",()=>r_,"isVec3Like",()=>rH,"parseColorSegments",()=>r2,"parseWeaponImageStates",()=>rQ,"playerYawToQuaternion",()=>rO,"resolveShapeName",()=>r$,"resolveSpriteVisual",()=>rY,"resolveTracerVisual",()=>rJ,"stripTaggedStringMarkup",()=>rK,"torqueQuatHeading",()=>rL,"torqueQuatPitch",()=>rq,"torqueQuatToThreeJS",()=>rz,"yawPitchToQuaternion",()=>rV],89119),e.i(70847);var r4=e.i(47566);let r7=(0,e.i(25645).createLogger)("StreamEngine");class r9{registry;ghostTracker;entities=new Map;entityIdByGhostIndex=new Map;tickCount=0;camera=null;chatMessages=[];chatMessageIdCounter=0;_chatGen=0;_chatSnapshotGen=-1;_chatSnapshot=[];audioEvents=[];netStrings=new Map;targetNames=new Map;targetTeams=new Map;targetRenderFlags=new Map;pendingNameTags=new Map;sensorGroupColors=new Map;playerSensorGroup=0;lastStatus={health:1,energy:1};latestControl={ghostIndex:-1};controlPlayerGhostId;lastControlType="camera";isPiloting=!1;lastPilotGhostIndex;lastVehicleHeading=0;lastVehiclePitch=0;lastVehicleOrbitDir;lastVehicleVelocity;lastVehiclePosTime=0;lastVehiclePos;firstPerson=!0;lastCameraMode;lastOrbitGhostIndex;lastOrbitDistance;latestFov=90;weaponsHud={slots:new Map,activeIndex:-1};backpackHud={packIndex:-1,active:!1,text:""};inventoryHud={slots:new Map,activeSlot:-1};teamScores=[];playerRoster=new Map;missionDisplayName=null;missionTypeDisplayName=null;gameClassName=null;serverDisplayName=null;connectedPlayerName=null;onMissionInfoChange;nextExplosionId=0;resolveGhostClassName(e,t){if("number"==typeof t){let e=this.registry.getGhostParser(t)?.name;if(e)return e}let a=this.entityIdByGhostIndex.get(e);if(a){let e=this.entities.get(a);if(e?.className)return e.className}let r=this.ghostTracker.getGhost(e);if(r?.className)return r.className}resolveEntityIdForGhostIndex(e){let t=this.entityIdByGhostIndex.get(e);if(t)return t;let a=this.ghostTracker.getGhost(e);if(a)return rT(a.className,e)}resetSharedState(){this.entities.clear(),this.entityIdByGhostIndex.clear(),this.tickCount=0,this.camera=null,this.chatMessages=[],this.chatMessageIdCounter=0,this._chatGen=0,this._chatSnapshotGen=-1,this._chatSnapshot=[],this.audioEvents=[],this.netStrings.clear(),this.targetNames.clear(),this.targetTeams.clear(),this.targetRenderFlags.clear(),this.sensorGroupColors.clear(),this.playerSensorGroup=0,this.lastStatus={health:1,energy:1},this.latestControl={ghostIndex:-1},this.controlPlayerGhostId=void 0,this.lastControlType="camera",this.isPiloting=!1,this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0,this.firstPerson=!0,this.lastCameraMode=void 0,this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0,this.latestFov=90,this.weaponsHud={slots:new Map,activeIndex:-1},this.backpackHud={packIndex:-1,active:!1,text:""},this.inventoryHud={slots:new Map,activeSlot:-1},this.teamScores=[],this.playerRoster.clear(),this.nextExplosionId=0,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null,this.connectedPlayerName=null}resolveNetString(e){if(e.length>=2&&1===e.charCodeAt(0)){let t=parseInt(e.slice(1),10);if(Number.isFinite(t))return this.netStrings.get(t)??e}return e}formatRemoteArgs(e,t){let a=this.resolveNetString(e);for(let e=0;e0&&(this.playerSensorGroup=t.sensorGroup)}if(t){let e=r5(t);if(e&&(this.lastControlType=e),"player"===this.lastControlType)this.isPiloting=!!(t.pilot||null!=t.controlObjectGhost),this.isPiloting&&"number"==typeof t.controlObjectGhost?this.lastPilotGhostIndex=t.controlObjectGhost:this.isPiloting||(this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0);else if(this.isPiloting=!1,"number"==typeof t.cameraMode)if(this.lastCameraMode=t.cameraMode,3===t.cameraMode){"number"==typeof t.orbitObjectGhostIndex&&(this.lastOrbitGhostIndex=t.orbitObjectGhostIndex);let e=t.minOrbitDist,a=t.maxOrbitDist,r=t.curOrbitDist;"number"==typeof e&&"number"==typeof a&&Number.isFinite(e)&&Number.isFinite(a)?this.lastOrbitDistance=Math.max(0,a-e):"number"==typeof r&&Number.isFinite(r)&&(this.lastOrbitDistance=Math.max(0,r))}else this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0}void 0!==e.cameraFov&&(this.latestFov=e.cameraFov)}processEvent(e,t){let a=e.parsedData;if(!a)return;let r=a.type;if("GhostAlwaysObjectEvent"===r){let e=a.ghostIndex,t=a.classId,r=a.objectData,i=a._hasObjectData,n="number"==typeof t?this.registry.getGhostParser(t)?.name??`classId=${t}`:"?";r7.debug("GhostAlwaysObjectEvent: ghost=%d class=%s hasData=%s %s",e,n,i,r?`keys=[${Object.keys(r).join(",")}]`:"(no data)"),null!=e&&null!=t&&this.processGhostUpdate({index:e,type:"create",classId:t,parsedData:r});return}if("NetStringEvent"===r||"NetStringEvent"===t){let e=a.id,t=a.value;if(null!=e&&"string"==typeof t){this.netStrings.set(e,t);let a=this.pendingNameTags.get(e);if(null!=a){this.pendingNameTags.delete(e);let r=rK(t);for(let e of(this.targetNames.set(a,r),this.entities.values()))e.targetId===a&&(e.playerName=r)}}return}if("TargetInfoEvent"===r||"TargetInfoEvent"===t){let e=a.targetId,t=a.nameTag;if(null!=e&&null!=t){let a=this.netStrings.get(t);a?this.targetNames.set(e,rK(a)):this.pendingNameTags.set(t,e)}let r=a.sensorGroup;null!=e&&null!=r&&this.targetTeams.set(e,r);let i=a.renderFlags;if(null!=e&&null!=i&&this.targetRenderFlags.set(e,i),null!=e){let t=this.targetNames.get(e),a=this.targetTeams.get(e),r=this.targetRenderFlags.get(e);for(let i of this.entities.values())i.targetId===e&&(t&&(i.playerName=t),null!=a&&(i.sensorGroup=a),null!=r&&(i.targetRenderFlags=r))}return}if("SetSensorGroupEvent"===r||"SetSensorGroupEvent"===t){let e=a.sensorGroup;null!=e&&(this.playerSensorGroup=e);return}if("SensorGroupColorEvent"===r||"SensorGroupColorEvent"===t){let e=a.sensorGroup,t=a.colors;if(t){let a=this.sensorGroupColors.get(e);for(let r of(a||(a=new Map,this.sensorGroupColors.set(e,a)),t))r.default?a.delete(r.index):a.set(r.index,{r:r.r??0,g:r.g??0,b:r.b??0})}return}if("RemoteCommandEvent"===r||"RemoteCommandEvent"===t){let e=this.resolveNetString(a.funcName),t=a.args,r=this.getTimeSec();if("ChatMessage"===e&&t.length>=4){let e=r3(this.resolveNetString(t[3])),a=t[4]?rK(this.resolveNetString(t[4])):"",i=this.formatRemoteArgs(t[3],t.slice(4));if(i){let n,o,s=i.indexOf(": "),{text:l,wavPath:d}=r1(s>=0?i.slice(s+2):i);if(d){let e=this.resolveNetString(t[1]);n=e?`voice/${e}/${d}.wav`:d;let a=this.resolveNetString(t[2]);if(a){let e=parseFloat(a);Number.isFinite(e)&&(o=Math.max(.5,Math.min(2,e)))}}let c=e??0;this.pushChatMessage({timeSec:r,sender:a,text:l,kind:"chat",colorCode:c,segments:[{text:a?`${a}: ${l}`:l,colorCode:c}],soundPath:n,soundPitch:o})}}else if("CannedChatMessage"===e&&t.length>=6){let e=r3(this.resolveNetString(t[1])),a=rK(this.resolveNetString(t[2])),i=rK(this.resolveNetString(t[4])),n=this.formatRemoteArgs(t[1],t.slice(2));if(n){let o,s,{wavPath:l}=r1(n),d=r1(rK(this.resolveNetString(t[3]))).text;if(l){let e=this.resolveNetString(t[5]);if(o=e?`voice/${e}/${l}.wav`:l,t[6]){let e=parseFloat(this.resolveNetString(t[6]));Number.isFinite(e)&&(s=Math.max(.5,Math.min(2,e)))}}let c=e??0,h=[];i&&h.push({text:`[${i}] `,colorCode:0}),h.push({text:a?`${a}: ${d}`:d,colorCode:c}),this.pushChatMessage({timeSec:r,sender:a,text:d,kind:"chat",colorCode:c,segments:h,soundPath:o,soundPitch:s})}}else if("ServerMessage"===e&&t.length>=2){this.handleServerMessage(t);let e=r3(this.resolveNetString(t[1])),a=this.formatRemoteArgs(t[1],t.slice(2));if(a){let{text:t,wavPath:i}=r1(a),n=e??0;this.pushChatMessage({timeSec:r,sender:"",text:t,kind:"server",colorCode:n,segments:[{text:t,colorCode:n}],soundPath:i??void 0})}}else this.handleHudRemoteCommand(e,t);return}if("Sim3DAudioEvent"===r||"Sim2DAudioEvent"===r||"Sim3DAudioEvent"===t||"Sim2DAudioEvent"===t){let e=a.profileId;if("number"==typeof e){let i=this.getTimeSec(),n="Sim3DAudioEvent"===r||"Sim3DAudioEvent"===t?a.position:void 0;this.audioEvents.push({profileId:e,position:n,timeSec:i}),this.audioEvents.length>100&&this.audioEvents.splice(0,this.audioEvents.length-100)}}}processGhostUpdate(e){let t,a=e.index,r=this.entityIdByGhostIndex.get(a);if(r){let t=this.entities.get(r);t&&"Projectile"===t.type&&!t.hasExploded&&null!=t.explosionDataBlockId&&t.position&&("delete"===e.type||"create"===e.type)&&this.spawnExplosion(t,[...t.position])}if("delete"===e.type){r&&(this.removeSoundSlotEntities(r),this.entities.delete(r),this.entityIdByGhostIndex.delete(a));return}let i=this.resolveGhostClassName(a,e.classId);if(!i){if("create"===e.type)throw Error(`No ghost parser for classId ${e.classId} (ghost index ${a})`);return}let n=rT(i,a);r&&r!==n&&(this.removeSoundSlotEntities(r),this.entities.delete(r));let o=this.entities.get(n);if(o&&"create"===e.type?(this.removeSoundSlotEntities(n),o.spawnTick=this.tickCount,this.resetEntity(o),t=o):o?t=o:(t={id:n,ghostIndex:a,className:i,spawnTick:this.tickCount,type:rM(i),rotation:[0,0,0,1]},this.entities.set(n,t)),t.ghostIndex=a,t.className=i,t.type=rM(i),this.entityIdByGhostIndex.set(a,n),this.applyGhostData(t,e.parsedData),"create"===e.type&&e.parsedData){let r=(0,r4.ghostToSceneObject)(i,a,e.parsedData);r&&(t.sceneData=r)}}resetEntity(e){e.rotation=[0,0,0,1],e.hasExploded=void 0,e.explosionShape=void 0,e.explosionLifetimeTicks=void 0,e.faceViewer=void 0,e.simulatedVelocity=void 0,e.projectilePhysics=void 0,e.gravityMod=void 0,e.direction=void 0,e.velocity=void 0,e.position=void 0,e.dataBlock=void 0,e.dataBlockId=void 0,e.shapeHint=void 0,e.visual=void 0,e.targetId=void 0,e.targetRenderFlags=void 0,e.carryingFlag=void 0,e.sensorGroup=void 0,e.playerName=void 0,e.weaponShape=void 0,e.packShape=void 0,e.falling=void 0,e.jetting=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0,e.weaponImageStatesDbId=void 0,e.itemPhysics=void 0,e.threads=void 0,e.headPitch=void 0,e.headYaw=void 0,e.health=void 0,e.energy=void 0,e.maxEnergy=void 0,e.damageState=void 0,e.actionAnim=void 0,e.actionAtEnd=void 0,e.explosionDataBlockId=void 0,e.maintainEmitterId=void 0}applyGhostData(e,t){if(!t)return;let a=t.dataBlockId;if(null!=a){e.dataBlockId=a;let t=this.getDataBlockData(a),r=r$(e.className,t);if(e.visual=rJ(e.className,t)??rY(e.className,t),"string"==typeof r&&(e.shapeHint=r,e.dataBlock=r),"Player"===e.type&&"number"==typeof t?.maxEnergy&&(e.maxEnergy=t.maxEnergy),"Projectile"===e.type&&(rC.has(e.className)?e.projectilePhysics="linear":rw.has(e.className)?(e.projectilePhysics="ballistic",e.gravityMod=rZ(t,["gravityMod"])??1):rE.has(e.className)&&(e.projectilePhysics="seeker")),"Projectile"===e.type&&null==e.explosionDataBlockId){let t=this.resolveExplosionInfo(a);t&&(e.explosionShape=t.shape,e.faceViewer=t.faceViewer,e.explosionLifetimeTicks=t.lifetimeTicks,e.explosionDataBlockId=t.explosionDataBlockId)}if("Projectile"===e.type&&null==e.maintainEmitterId){let a=t?.baseEmitter;"number"==typeof a&&a>0&&(e.maintainEmitterId=a)}}if("Player"===e.type){let a=t.images;if(Array.isArray(a)&&a.length>0){let t=a.find(e=>0===e.index);if(t?.dataBlockId&&t.dataBlockId>0){let a=this.getDataBlockData(t.dataBlockId),r=r$("ShapeBaseImageData",a);if(r){let t=a?.mountPoint;(null==t||t<=0)&&!/pack_/i.test(r)&&(e.weaponShape=r)}let i=e.weaponImageState;e.weaponImageState={dataBlockId:t.dataBlockId,triggerDown:t.triggerDown??i?.triggerDown??!1,ammo:t.ammo??i?.ammo??!0,loaded:t.loaded??i?.loaded??!0,target:t.target??i?.target??!1,wet:t.wet??i?.wet??!1,fireCount:t.fireCount??i?.fireCount??0},a&&e.weaponImageStatesDbId!==t.dataBlockId&&(e.weaponImageStates=rQ(a),e.weaponImageStatesDbId=t.dataBlockId)}else t&&!t.dataBlockId&&(e.weaponShape=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0);let r=a.find(e=>2===e.index);if(r?.dataBlockId&&r.dataBlockId>0){let t=r$("ShapeBaseImageData",this.getDataBlockData(r.dataBlockId));t&&(e.packShape=t)}else r&&!r.dataBlockId&&(e.packShape=void 0);let i=a.find(e=>3===e.index);if(i?.dataBlockId&&i.dataBlockId>0){e.carryingFlag=!0;let t=r$("ShapeBaseImageData",this.getDataBlockData(i.dataBlockId));if(t&&(e.flagShape=t),null!=e.targetId&&e.targetId>=0){let t=this.targetRenderFlags.get(e.targetId)??0,a=2|t;a!==t&&(this.targetRenderFlags.set(e.targetId,a),e.targetRenderFlags=a)}}else if(i&&!i.dataBlockId&&(e.carryingFlag=!1,e.flagShape=void 0,null!=e.targetId&&e.targetId>=0)){let t=this.targetRenderFlags.get(e.targetId)??0,a=-3&t;a!==t&&(this.targetRenderFlags.set(e.targetId,a),e.targetRenderFlags=a)}}}let r=r_(t.position)?t.position:r_(t.initialPosition)?t.initialPosition:r_(t.explodePosition)?t.explodePosition:r_(t.endPoint)?t.endPoint:r_(t.transform?.position)?t.transform.position:void 0;r&&(e.position=[r.x,r.y,r.z],this.updateSoundSlotPositions(e));let i=rH(t.direction)?t.direction:void 0;if(i&&(e.direction=[i.x,i.y,i.z]),"Player"===e.type&&"number"==typeof t.rotationZ&&(e.rotation=rO(t.rotationZ)),"Player"===e.type&&("number"==typeof t.headX&&(e.headPitch=t.headX),"number"==typeof t.headZ&&(e.headYaw=t.headZ)),rW(t.angPosition)){let a=rz(t.angPosition);a&&(e.rotation=a)}else if(rW(t.transform?.rotation)){let a=rz(t.transform.rotation);a&&(e.rotation=a)}else if("Item"===e.type&&"number"==typeof t.rotation?.angle){let a=t.rotation;e.rotation=rO((a.zSign??1)*a.angle)}else if("Projectile"===e.type){let a=t.velocity??t.direction??(r_(t.initialPosition)&&r_(t.endPos)?{x:t.endPos.x-t.initialPosition.x,y:t.endPos.y-t.initialPosition.y,z:t.endPos.z-t.initialPosition.z}:void 0);rH(a)&&(0!==a.x||0!==a.y)&&(e.rotation=rO(Math.atan2(a.x,a.y)))}if(rH(t.velocity)&&(e.velocity=[t.velocity.x,t.velocity.y,t.velocity.z],e.direction||(e.direction=[t.velocity.x,t.velocity.y,t.velocity.z])),"boolean"==typeof t.moveFlag0&&(e.falling=t.moveFlag0),"boolean"==typeof t.moveFlag1&&(e.jetting=t.moveFlag1),"Item"===e.type){let a=t.atRest;!1===a&&rH(t.velocity)?e.itemPhysics={velocity:[t.velocity.x,t.velocity.y,t.velocity.z],atRest:!1}:!0===a&&(e.itemPhysics=void 0)}if(e.projectilePhysics){if("linear"===e.projectilePhysics){let a=rZ(null!=e.dataBlockId?this.getDataBlockData(e.dataBlockId):void 0,["dryVelocity","muzzleVelocity","bulletVelocity"])??80,r=e.direction??[0,1,0],i=r[0]*a,n=r[1]*a,o=r[2]*a,s=t.excessVel,l=t.excessDir;"number"==typeof s&&s>0&&rH(l)&&(i+=l.x*s,n+=l.y*s,o+=l.z*s),e.simulatedVelocity=[i,n,o]}else rH(t.velocity)&&(e.simulatedVelocity=[t.velocity.x,t.velocity.y,t.velocity.z]);let a=t.currTick;if("number"==typeof a&&a>0&&e.simulatedVelocity&&e.position){let t=.032*a,r=e.simulatedVelocity;if(e.position[0]+=r[0]*t,e.position[1]+=r[1]*t,e.position[2]+=r[2]*t,"ballistic"===e.projectilePhysics){let a=-9.81*(e.gravityMod??1);e.position[2]+=.5*a*t*t,r[2]+=a*t}}}let n=r_(t.explodePosition)?t.explodePosition:r_(t.explodePoint)?t.explodePoint:void 0;if("Projectile"===e.type&&!e.hasExploded&&n&&null!=e.explosionDataBlockId&&this.spawnExplosion(e,[n.x,n.y,n.z]),"number"==typeof t.damageLevel&&(e.health=rj(1-t.damageLevel,0,1)),"number"==typeof t.damageState&&(e.damageState=t.damageState),"number"==typeof t.action&&(e.actionAnim=t.action,e.actionAtEnd=!!t.actionAtEnd),Array.isArray(t.threads)){let a=t.threads;if(e.threads){let t=[...e.threads];for(let e of a){let a=t.findIndex(t=>t.index===e.index);a>=0?t[a]=e:t.push(e)}e.threads=t}else e.threads=a}if("number"==typeof t.energy&&(e.energy=rj(t.energy,0,1)),"number"==typeof t.targetId){e.targetId=t.targetId;let a=this.targetNames.get(t.targetId);a&&(e.playerName=a);let r=this.targetTeams.get(t.targetId);null!=r&&(e.sensorGroup=r,e.ghostIndex===this.latestControl.ghostIndex&&"player"===this.lastControlType&&(this.playerSensorGroup=r));let i=this.targetRenderFlags.get(t.targetId);null!=i&&(e.targetRenderFlags=i)}let o=t.sounds;Array.isArray(o)&&this.syncSoundSlotEntities(e,o),"WayPoint"===e.className&&"string"==typeof t.name&&(e.label=t.name),"AudioEmitter"===e.className&&("string"==typeof t.filename&&(e.audioFileName=t.filename),"number"==typeof t.volume&&(e.audioVolume=t.volume),"boolean"==typeof t.is3D&&(e.audioIs3D=t.is3D),"boolean"==typeof t.isLooping&&(e.audioIsLooping=t.isLooping),"number"==typeof t.minDistance&&(e.audioMinDistance=t.minDistance),"number"==typeof t.maxDistance&&(e.audioMaxDistance=t.maxDistance),"number"==typeof t.minLoopGap&&(e.audioMinLoopGap=t.minLoopGap),"number"==typeof t.maxLoopGap&&(e.audioMaxLoopGap=t.maxLoopGap))}syncSoundSlotEntities(e,t){for(let a of t){let t=`${e.id}:sound:${a.index}`;if(a.playing&&"number"==typeof a.profileId){let r=this.getDataBlockData(a.profileId),i=r?.filename;if(!i)continue;let n=i.endsWith(".wav")?i:`${i}.wav`,o=r.description,s=null!=o?this.getDataBlockData(o):void 0,l=this.entities.get(t);l?l.position=e.position:this.entities.set(t,{id:t,ghostIndex:e.ghostIndex,className:"AudioEmitter",type:"AudioEmitter",spawnTick:this.tickCount,position:e.position,rotation:[0,0,0,1],audioFileName:n,audioVolume:s?.volume??1,audioIs3D:s?.is3D??!0,audioIsLooping:s?.isLooping??!1,audioMinDistance:s?.referenceDistance??20,audioMaxDistance:s?.maxDistance??100,audioMinLoopGap:s?.minLoopGap??0,audioMaxLoopGap:s?.maxLoopGap??0})}else this.entities.delete(t)}}updateSoundSlotPositions(e){for(let t=0;t<4;t++){let a=this.entities.get(`${e.id}:sound:${t}`);a&&(a.position=e.position)}}removeSoundSlotEntities(e){for(let t=0;t<4;t++)this.entities.delete(`${e}:sound:${t}`)}resolveExplosionInfo(e){let t=this.getDataBlockData(e);if(!t)return;let a=t.explosion;if(null==a)return;let r=this.getDataBlockData(a);if(!r)return;let i=r.dtsFileName||void 0,n=r.lifetimeMS??31;return{shape:i,faceViewer:!1!==r.faceViewer&&0!==r.faceViewer,lifetimeTicks:n,explosionDataBlockId:a}}spawnExplosion(e,t){e.hasExploded=!0;let a=e.explosionLifetimeTicks??31,r=`fx_${this.nextExplosionId++}`,i={id:r,ghostIndex:-1,className:"Explosion",spawnTick:this.tickCount,type:"Explosion",dataBlock:e.explosionShape,explosionDataBlockId:e.explosionDataBlockId,position:t,rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==e.faceViewer,expiryTick:this.tickCount+a};if(this.entities.set(r,i),null!=e.explosionDataBlockId){let a=this.getDataBlockData(e.explosionDataBlockId),r=a?.subExplosions;if(Array.isArray(r))for(let e of r){if(null==e)continue;let a=this.getDataBlockData(e);if(!a)continue;let r=a.dtsFileName||void 0;if(!r)continue;let i=a.lifetimeMS??31,n=a.offset??0,o=Math.random()*Math.PI*2,s=[t[0]+Math.cos(o)*n,t[1]+Math.sin(o)*n,t[2]],l=`fx_${this.nextExplosionId++}`,d={id:l,ghostIndex:-1,className:"Explosion",spawnTick:this.tickCount,type:"Explosion",dataBlock:r,explosionDataBlockId:e,position:s,rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==a.faceViewer&&0!==a.faceViewer,expiryTick:this.tickCount+i};this.entities.set(l,d)}}e.position=void 0,e.simulatedVelocity=void 0}advanceProjectiles(){for(let e of this.entities.values()){if(!e.simulatedVelocity||!e.position)continue;let t=e.simulatedVelocity,a=e.position;"ballistic"===e.projectilePhysics&&(t[2]+=-9.81*(e.gravityMod??1)*.032),a[0]+=.032*t[0],a[1]+=.032*t[1],a[2]+=.032*t[2],(0!==t[0]||0!==t[1])&&(e.rotation=rO(Math.atan2(t[0],t[1])))}}advanceItems(){for(let e of this.entities.values()){let t=e.itemPhysics;if(!t||t.atRest||!e.position)continue;let a=t.velocity,r=e.position;r[0]+=.032*a[0],r[1]+=.032*a[1],r[2]+=.032*a[2]}}removeExpiredExplosions(){for(let[e,t]of this.entities)t.isExplosion&&null!=t.expiryTick&&this.tickCount>=t.expiryTick&&this.entities.delete(e)}updateCameraAndHud(){let e=this.latestControl,t=this.getTimeSec(),a=e.data,r=this.lastControlType;if(this.removeExpiredExplosions(),e.position){let{yaw:i,pitch:n}=this.getCameraYawPitch(a);if(this.isPiloting){if(a){let e=a.controlObjectData,t=e?.angPosition;if(t&&"number"==typeof t.w){this.lastVehicleHeading=rL(t),this.lastVehiclePitch=rq(t);let e=rz(t);if(e){let[t,a,r,i]=e;this.lastVehicleOrbitDir=[-(1-2*(a*a+r*r)),-(2*(t*a+r*i)),-(2*(t*r-a*i))]}}}i=this.lastVehicleHeading,n=this.lastVehiclePitch}if(this.camera={time:t,position:[e.position.x,e.position.y,e.position.z],rotation:rV(i,rj(n,-rA,rA)),fov:this.latestFov,mode:"observer",yaw:i,pitch:n},"camera"===r)if(("number"==typeof a?.cameraMode?a.cameraMode:this.lastCameraMode)===3){this.camera.mode="third-person","number"==typeof this.lastOrbitDistance&&(this.camera.orbitDistance=this.lastOrbitDistance);let e="number"==typeof a?.orbitObjectGhostIndex?a.orbitObjectGhostIndex:this.lastOrbitGhostIndex;"number"==typeof e&&e>=0&&(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(e))}else this.camera.mode="observer";else e.ghostIndex>=0&&(this.controlPlayerGhostId=this.resolveEntityIdForGhostIndex(e.ghostIndex)),this.firstPerson?this.camera.mode="first-person":(this.camera.mode="third-person",this.isPiloting&&null!=this.lastPilotGhostIndex?(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),this.camera.orbitDistance=15,this.lastVehicleOrbitDir&&(this.camera.orbitDirection=this.lastVehicleOrbitDir)):(this.camera.orbitTargetId=this.controlPlayerGhostId,this.camera.orbitDistance=3)),this.controlPlayerGhostId&&(this.camera.controlEntityId=this.controlPlayerGhostId);if("player"===r&&e.position){if(this.isPiloting&&null!=this.lastPilotGhostIndex){let r=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),i=r?this.entities.get(r):void 0;if(i){let r=a?.controlObjectData;if(r){i.position=[e.position.x,e.position.y,e.position.z],this.lastVehiclePos=i.position.slice(),this.lastVehiclePosTime=t;let a=r.linMomentum;if(a&&r_(a)){let e=i.dataBlockId,t=null!=e?this.getDataBlockData(e):void 0,r=t?.mass??200,n=r>0?1/r:.005;this.lastVehicleVelocity=[a.x*n,a.y*n,a.z*n],i.velocity=this.lastVehicleVelocity}let n=r.angPosition;if(n&&"number"==typeof n.w){let e=rz(n);e&&(i.rotation=e)}}else if(this.lastVehiclePos&&this.lastVehicleVelocity&&this.lastVehiclePosTime>0){let e=t-this.lastVehiclePosTime;if(e>0&&e<1){let[t,a,r]=this.lastVehicleVelocity;i.position=[this.lastVehiclePos[0]+t*e,this.lastVehiclePos[1]+a*e,this.lastVehiclePos[2]+r*e]}}}}else if(this.controlPlayerGhostId){let t=this.entities.get(this.controlPlayerGhostId);if(t){t.position=[e.position.x,e.position.y,e.position.z],t.rotation=rO(i),t.headPitch=this.getControlPlayerHeadPitch(n);let r=a?.velocity;rH(r)&&(t.velocity=[r.x,r.y,r.z],t.falling=r.z<-10)}}}}else this.camera&&(this.camera={...this.camera,time:t,fov:this.latestFov});let i={health:1,energy:1};if(this.camera?.mode==="first-person"){let e=this.controlPlayerGhostId,t=e?this.entities.get(e):void 0;i.health=t?.health??1;let r=a?.energyLevel;if("number"==typeof r){let e=t?.maxEnergy??60;e>0&&(i.energy=rj(r/e,0,1))}else i.energy=t?.energy??1}else if(this.camera?.mode==="third-person"&&this.camera.orbitTargetId){let e=this.entities.get(this.camera.orbitTargetId);i.health=e?.health??1,i.energy=e?.energy??1}this.lastStatus=i}getControlPlayerHeadPitch(e){return rj(e/rA,-1,1)}getAbsoluteRotation(e){return e?"number"==typeof e.rotationZ&&"number"==typeof e.headX?{yaw:e.rotationZ,pitch:e.headX}:"number"==typeof e.rotZ&&"number"==typeof e.rotX?{yaw:e.rotZ,pitch:e.rotX}:null:null}resolveIffColor(e){if(0===this.playerSensorGroup)return;let t=this.sensorGroupColors.get(this.playerSensorGroup);if(t){let a=t.get(e);if(a)return a}return e===this.playerSensorGroup?rN:0!==e?rG:void 0}pushChatMessage(e){this.chatMessages.push({...e,id:++this.chatMessageIdCounter}),this.chatMessages.length>200&&this.chatMessages.splice(0,this.chatMessages.length-200),this._chatGen++}handleServerMessage(e){if(e.length<2)return;let t=this.resolveNetString(e[0]);if("MsgTeamScoreIs"===t&&e.length>=4){let t=parseInt(this.resolveNetString(e[2]),10),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(t)&&!isNaN(a)){let e=this.teamScores.find(e=>e.teamId===t);e&&(e.score=a,this.onTeamScoresChanged())}}else if("MsgCTFAddTeam"===t&&e.length>=6){let t=parseInt(this.resolveNetString(e[2]),10),a=rK(this.resolveNetString(e[3])),r=parseInt(this.resolveNetString(e[5]),10);if(!isNaN(t)){let e=t+1,i=this.teamScores.find(t=>t.teamId===e);i?(i.name=a,i.score=isNaN(r)?i.score:r):this.teamScores.push({teamId:e,name:a,score:isNaN(r)?0:r,playerCount:0}),this.onTeamScoresChanged()}}else if("MsgClientJoin"===t&&e.length>=4){let t=rK(this.resolveNetString(e[2])).trim(),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(a)){let e=this.playerRoster.get(a);this.playerRoster.set(a,{name:t,teamId:e?.teamId??0}),this.onRosterChanged()}!this.connectedPlayerName&&t&&(this.connectedPlayerName=t,this.onMissionInfoChange?.())}else if("MsgClientDrop"===t&&e.length>=3){let t=parseInt(this.resolveNetString(e[2]),10);isNaN(t)||(this.playerRoster.delete(t),this.onRosterChanged())}else if("MsgClientJoinTeam"===t&&e.length>=4){let t=parseInt(this.resolveNetString(e[2]),10),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(t)&&!isNaN(a)){let e=this.playerRoster.get(t);e?e.teamId=a:this.playerRoster.set(t,{name:"",teamId:a}),this.onRosterChanged()}}else if("MsgMissionDropInfo"===t&&e.length>=5){let t=rK(this.resolveNetString(e[2])),a=rK(this.resolveNetString(e[3])),r=rK(this.resolveNetString(e[4]));r7.info("mission drop info: mission=%s gameType=%s server=%s",t,a,r),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=a||this.missionTypeDisplayName,this.serverDisplayName=r||this.serverDisplayName,this.onMissionInfoChange?.()}else if("MsgLoadInfo"===t&&e.length>=5){let t=rK(this.resolveNetString(e[3])),a=rK(this.resolveNetString(e[4]));r7.info("load info: mission=%s gameType=%s",t,a),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=a||this.missionTypeDisplayName,this.onMissionInfoChange?.()}else if("MsgClientReady"===t&&e.length>=3){let t=this.resolveNetString(e[2]);r7.info("client ready: gameClass=%s",t),this.gameClassName=t||this.gameClassName,this.onMissionInfoChange?.()}}onTeamScoresChanged(){}onRosterChanged(){}handleHudRemoteCommand(e,t){if("setWeaponsHudItem"===e&&t.length>=3){let e=parseInt(t[0],10),a=parseInt(t[1],10),r="1"===t[2]||"true"===t[2];isNaN(e)||(r?this.weaponsHud.slots.set(e,isNaN(a)?-1:a):this.weaponsHud.slots.delete(e),this.onWeaponsHudChanged())}else if("setWeaponsHudAmmo"===e&&t.length>=2){let e=parseInt(t[0],10),a=parseInt(t[1],10);isNaN(e)||(this.weaponsHud.slots.set(e,isNaN(a)?-1:a),this.onWeaponsHudChanged())}else if("setWeaponsHudActive"===e&&t.length>=1){let e=parseInt(t[0],10);this.weaponsHud.activeIndex=isNaN(e)?-1:e,isNaN(e)||!(e>=0)||this.weaponsHud.slots.has(e)||this.weaponsHud.slots.set(e,-1),this.onWeaponsHudChanged()}else if("setWeaponsHudClearAll"===e)this.weaponsHud.slots.clear(),this.weaponsHud.activeIndex=-1,this.onWeaponsHudChanged();else if("setBackpackHudItem"===e&&t.length>=2){let e=parseInt(t[0],10);"1"!==t[1]&&"true"!==t[1]||isNaN(e)?this.backpackHud.packIndex=-1:this.backpackHud.packIndex=e,this.backpackHud.active=!1,this.backpackHud.text=""}else if("setSatchelArmed"===e)this.backpackHud.active=!0;else if("setCloakIconOn"===e||"setRepairPackIconOn"===e||"setShieldIconOn"===e||"setSenJamIconOn"===e)this.backpackHud.active=!0;else if("setCloakIconOff"===e||"setRepairPackIconOff"===e||"setShieldIconOff"===e||"setSenJamIconOff"===e)this.backpackHud.active=!1;else if("updatePackText"===e&&t.length>=1)this.backpackHud.text=t[0]??"";else if("setInventoryHudItem"===e&&t.length>=3){let e=parseInt(t[0],10),a=parseInt(t[1],10),r="1"===t[2]||"true"===t[2];isNaN(e)||(r&&!isNaN(a)?this.inventoryHud.slots.set(e,a):this.inventoryHud.slots.delete(e),this.onInventoryHudChanged())}else if("setInventoryHudAmount"===e&&t.length>=2){let e=parseInt(t[0],10),a=parseInt(t[1],10);isNaN(e)||isNaN(a)||(this.inventoryHud.slots.set(e,a),this.onInventoryHudChanged())}else"setInventoryHudClearAll"===e&&(this.inventoryHud.slots.clear(),this.inventoryHud.activeSlot=-1,this.onInventoryHudChanged())}onWeaponsHudChanged(){}onInventoryHudChanged(){}buildEntityList(e){let t=[];for(let a of this.entities.values()){if(e&&!e(a))continue;let r=null!=a.targetId&&a.targetId>=0?this.targetRenderFlags.get(a.targetId)??a.targetRenderFlags:a.targetRenderFlags;"Player"!==a.type||a.carryingFlag||(r=null!=r?-3&r:r),t.push({id:a.id,type:a.type,visual:a.visual,direction:a.direction,ghostIndex:a.ghostIndex,className:a.className,dataBlockId:a.dataBlockId,shapeHint:a.shapeHint,dataBlock:a.dataBlock,weaponShape:a.weaponShape,packShape:a.packShape,flagShape:a.flagShape,falling:a.falling,jetting:a.jetting,playerName:a.playerName,targetRenderFlags:r,iffColor:("Player"===a.type||((r??0)&2)!=0)&&null!=a.sensorGroup?this.resolveIffColor(a.sensorGroup):void 0,position:a.position&&(a.simulatedVelocity||a.itemPhysics&&!a.itemPhysics.atRest)?[...a.position]:a.position,rotation:a.rotation,velocity:a.velocity,health:a.health,energy:a.energy,actionAnim:a.actionAnim,actionAtEnd:a.actionAtEnd,damageState:a.damageState,faceViewer:a.faceViewer,threads:a.threads,explosionDataBlockId:a.explosionDataBlockId,maintainEmitterId:a.maintainEmitterId,weaponImageState:a.weaponImageState,weaponImageStates:a.weaponImageStates,headPitch:a.headPitch,headYaw:a.headYaw,label:a.label,audioFileName:a.audioFileName,audioVolume:a.audioVolume,audioIs3D:a.audioIs3D,audioIsLooping:a.audioIsLooping,audioMinDistance:a.audioMinDistance,audioMaxDistance:a.audioMaxDistance,audioMinLoopGap:a.audioMinLoopGap,audioMaxLoopGap:a.audioMaxLoopGap,sceneData:a.sceneData})}return t}buildHudState(){let e={slots:Array.from(this.weaponsHud.slots.entries()).map(([e,t])=>({index:e,ammo:t})),activeIndex:this.weaponsHud.activeIndex},t={slots:Array.from(this.inventoryHud.slots.entries()).map(([e,t])=>({slot:e,count:t})),activeSlot:this.inventoryHud.activeSlot},a=this.backpackHud.packIndex>=0?{...this.backpackHud}:null,r=this.teamScores.map(e=>({...e})),i=new Map;for(let{teamId:e}of this.playerRoster.values())e>0&&i.set(e,(i.get(e)??0)+1);for(let e of r)e.playerCount=i.get(e.teamId)??0;return{weaponsHud:e,inventoryHud:t,backpackHud:a,teamScores:r}}buildTimeFilteredEvents(e){return this._chatSnapshotGen!==this._chatGen&&(this._chatSnapshot=this.chatMessages.slice(),this._chatSnapshotGen=this._chatGen),{chatMessages:this._chatSnapshot,audioEvents:this.audioEvents.filter(t=>t.timeSec>e-.5&&t.timeSec<=e)}}}e.s(["StreamEngine",()=>r9],10244)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76775,(e,t,a)=>{function r(e,t,a,r){return Math.round(e/a)+" "+r+(t>=1.5*a?"s":"")}t.exports=function(e,t){t=t||{};var a,i,n,o,s=typeof e;if("string"===s&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var c=parseFloat(d[1]);switch((d[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===s&&isFinite(e)){return t.long?(i=Math.abs(a=e))>=864e5?r(a,i,864e5,"day"):i>=36e5?r(a,i,36e5,"hour"):i>=6e4?r(a,i,6e4,"minute"):i>=1e3?r(a,i,1e3,"second"):a+" ms":(o=Math.abs(n=e))>=864e5?Math.round(n/864e5)+"d":o>=36e5?Math.round(n/36e5)+"h":o>=6e4?Math.round(n/6e4)+"m":o>=1e3?Math.round(n/1e3)+"s":n+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7003,(e,t,a)=>{t.exports=function(t){function a(e){let t,i,n,o=null;function s(...e){if(!s.enabled)return;let r=Number(new Date);s.diff=r-(t||r),s.prev=t,s.curr=r,t=r,e[0]=a.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";i++;let n=a.formatters[r];if("function"==typeof n){let a=e[i];t=n.call(s,a),e.splice(i,1),i--}return t}),a.formatArgs.call(s,e),(s.log||a.log).apply(s,e)}return s.namespace=e,s.useColors=a.useColors(),s.color=a.selectColor(e),s.extend=r,s.destroy=a.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==a.namespaces&&(i=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(s),s}function r(e,t){let r=a(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function i(e,t){let a=0,r=0,i=-1,n=0;for(;a"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){for(let t of(a.save(e),a.namespaces=e,a.names=[],a.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===t[0]?a.skips.push(t.slice(1)):a.names.push(t)},a.enabled=function(e){for(let t of a.skips)if(i(e,t))return!1;for(let t of a.names)if(i(e,t))return!0;return!1},a.humanize=e.r(76775),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(e){let t=0;for(let a=0;a{let r;var i=e.i(47167);a.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),e.splice(i,0,a)},a.save=function(e){try{e?a.storage.setItem("debug",e):a.storage.removeItem("debug")}catch(e){}},a.load=function(){let e;try{e=a.storage.getItem("debug")||a.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==i.default&&"env"in i.default&&(e=i.default.env.DEBUG),e},a.useColors=function(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch(e){}}(),r=!1,a.destroy=()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))},a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),t.exports=e.r(7003)(a);let{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},50593,17711,58281,45853,25311,89119,10244,e=>{"use strict";var t={},a=function(e,a,r,i,n){var o=new Worker(t[a]||(t[a]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(e){var t=e.data,a=t.$e$;if(a){var r=Error(a[0]);r.code=a[1],r.stack=a[2],n(r,null)}else n(null,t)},o.postMessage(r,i),o},r=Uint8Array,i=Uint16Array,n=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var a=new i(31),r=0;r<31;++r)a[r]=t+=1<>1|(21845&F)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,m[F]=((65280&v)>>8|(255&v)<<8)>>1}for(var y=function(e,t,a){for(var r,n=e.length,o=0,s=new i(t);o>d]=c}else for(o=0,r=new i(n);o>15-e[o]);return r},S=new r(288),F=0;F<144;++F)S[F]=8;for(var F=144;F<256;++F)S[F]=9;for(var F=256;F<280;++F)S[F]=7;for(var F=280;F<288;++F)S[F]=8;for(var k=new r(32),F=0;F<32;++F)k[F]=5;var b=y(S,9,0),I=y(S,9,1),x=y(k,5,0),P=y(k,5,1),D=function(e){for(var t=e[0],a=1;at&&(t=e[a]);return t},C=function(e,t,a){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&a},w=function(e,t){var a=t/8|0;return(e[a]|e[a+1]<<8|e[a+2]<<16)>>(7&t)},E=function(e){return(e+7)/8|0},B=function(e,t,a){return(null==t||t<0)&&(t=0),(null==a||a>e.length)&&(a=e.length),new r(e.subarray(t,a))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(e,t,a){var r=Error(t||M[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,T),!a)throw r;return r},N=function(e,t,a,i){var n=e.length,d=i?i.length:0;if(!n||t.f&&!t.l)return a||new r(0);var c=!a,u=c||2!=t.i,g=t.i;c&&(a=new r(3*n));var f=function(e){var t=a.length;if(e>t){var i=new r(Math.max(2*t,e));i.set(a),a=i}},m=t.f||0,F=t.p||0,v=t.b||0,S=t.l,k=t.d,b=t.m,x=t.n,M=8*n;do{if(!S){m=C(e,F,1);var N=C(e,F+1,3);if(F+=3,N)if(1==N)S=I,k=P,b=9,x=5;else if(2==N){var G=C(e,F,31)+257,R=C(e,F+10,15)+4,U=G+C(e,F+5,31)+1;F+=14;for(var j=new r(U),A=new r(19),V=0;V>4;if(_<16)j[V++]=_;else{var H=0,W=0;for(16==_?(W=3+C(e,F,3),F+=2,H=j[V-1]):17==_?(W=3+C(e,F,7),F+=3):18==_&&(W=11+C(e,F,127),F+=7);W--;)j[V++]=H}}var $=j.subarray(0,G),Z=j.subarray(G);b=D($),x=D(Z),S=y($,b,1),k=y(Z,x,1)}else T(1);else{var _=E(F)+4,X=e[_-4]|e[_-3]<<8,J=_+X;if(J>n){g&&T(0);break}u&&f(v+X),a.set(e.subarray(_,J),v),t.b=v+=X,t.p=F=8*J,t.f=m;continue}if(F>M){g&&T(0);break}}u&&f(v+131072);for(var Y=(1<>4;if((F+=15&H)>M){g&&T(0);break}if(H||T(2),ee<256)a[v++]=ee;else if(256==ee){K=F,S=null;break}else{var et=ee-254;if(ee>264){var V=ee-257,ea=o[V];et=C(e,F,(1<>4;er||T(3),F+=15&er;var Z=p[ei];if(ei>3){var ea=s[ei];Z+=w(e,F)&(1<M){g&&T(0);break}u&&f(v+131072);var en=v+et;if(v>8},R=function(e,t,a){a<<=7&t;var r=t/8|0;e[r]|=a,e[r+1]|=a>>8,e[r+2]|=a>>16},U=function(e,t){for(var a=[],n=0;np&&(p=s[n].s);var f=new i(p+1),m=j(a[u-1],f,0);if(m>t){var n=0,F=0,v=m-t,y=1<t)F+=y-(1<>=v;F>0;){var k=s[n].s;f[k]=0&&F;--n){var b=s[n].s;f[b]==t&&(--f[b],++F)}m=t}return{t:new r(f),l:m}},j=function(e,t,a){return -1==e.s?Math.max(j(e.l,t,a+1),j(e.r,t,a+1)):t[e.s]=a},A=function(e){for(var t=e.length;t&&!e[--t];);for(var a=new i(++t),r=0,n=e[0],o=1,s=function(e){a[r++]=e},l=1;l<=t;++l)if(e[l]==n&&l!=t)++o;else{if(!n&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(n),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(n);o=1,n=e[l]}return{c:a.subarray(0,r),n:t}},V=function(e,t){for(var a=0,r=0;r>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var n=0;n4&&!H[l[$-1]];--$);var Z=g+5<<3,X=V(n,S)+V(d,k)+c,J=V(n,P)+V(d,w)+c+14+3*$+V(L,H)+2*L[16]+3*L[17]+7*L[18];if(u>=0&&Z<=X&&Z<=J)return O(t,p,e.subarray(u,u+g));if(G(t,p,1+(J15&&(G(t,p,ee[q]>>5&127),p+=ee[q]>>12)}}else f=b,m=S,F=x,v=k;for(var q=0;q255){var et=ea>>18&31;R(t,p,f[et+257]),p+=m[et+257],et>7&&(G(t,p,ea>>23&31),p+=o[et]);var er=31&ea;R(t,p,F[er]),p+=v[er],er>3&&(R(t,p,ea>>5&8191),p+=s[er])}else R(t,p,f[ea]),p+=m[ea]}return R(t,p,f[256]),p+m[256]},L=new n([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new r(0),_=function(e,t,a,l,d,c){var h=c.z||e.length,g=new r(l+h+5*(1+Math.ceil(h/7e3))+d),p=g.subarray(l,g.length-d),m=c.l,F=7&(c.r||0);if(t){F&&(p[0]=c.r>>3);for(var v=L[t-1],y=v>>13,S=8191&v,k=(1<7e3||R>24576)&&(_>423||!m)){F=z(e,p,0,C,w,M,N,R,j,G-j,F),R=T=N=0,j=G;for(var H=0;H<286;++H)w[H]=0;for(var H=0;H<30;++H)M[H]=0}var W=2,$=0,Z=S,X=V-q&32767;if(_>2&&A==D(G-X))for(var J=Math.min(y,_)-1,Y=Math.min(32767,G),Q=Math.min(258,_);X<=Y&&--Z&&V!=q;){if(e[G+W]==e[G+W-X]){for(var K=0;KW){if(W=K,$=X,K>J)break;for(var ee=Math.min(X,K-2),et=0,H=0;Het&&(et=ei,q=ea)}}}q=b[V=q],X+=V-q&32767}if($){C[R++]=0x10000000|u[W]<<18|f[$];var en=31&u[W],eo=31&f[$];N+=o[en]+s[eo],++w[257+en],++M[eo],U=G+W,++T}else C[R++]=e[G],++w[e[G]]}}for(G=Math.max(G,U);G=h&&(p[F/8|0]=m,es=h),F=O(p,F+1,e.subarray(G,es))}c.i=h}return B(g,0,l+E(F)+d)},H=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var a=t,r=9;--r;)a=(1&a&&-0x12477ce0)^a>>>1;e[t]=a}return e}(),W=function(){var e=-1;return{p:function(t){for(var a=e,r=0;r>>8;e=a},d:function(){return~e}}},$=function(){var e=1,t=0;return{p:function(a){for(var r=e,i=t,n=0|a.length,o=0;o!=n;){for(var s=Math.min(o+2655,n);o>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(255&e)<<24|(65280&e)<<8|(255&t)<<8|t>>8}}},Z=function(e,t,a,i,n){if(!n&&(n={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,n.w=o.length}return _(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,a,i,n)},X=function(e,t){var a={};for(var r in e)a[r]=e[r];for(var r in t)a[r]=t[r];return a},J=function(e,t,a){for(var r=e(),i=e.toString(),n=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>0},eh=function(e,t){return ec(e,t)+0x100000000*ec(e,t+4)},eu=function(e,t,a){for(;a;++t)e[t]=a,a>>>=8},eg=function(e,t){var a=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&eu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),a){e[3]=8;for(var r=0;r<=a.length;++r)e[r+10]=a.charCodeAt(r)}},ep=function(e){(31!=e[0]||139!=e[1]||8!=e[2])&&T(6,"invalid gzip data");var t=e[3],a=10;4&t&&(a+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[a++]);return a+(2&t)},ef=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},em=function(e){return 10+(e.filename?e.filename.length+1:0)},eF=function(e,t){var a=t.level;if(e[0]=120,e[1]=(0==a?0:a<6?1:9==a?3:2)<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var r=$();r.p(t.dictionary),eu(e,2,r.d())}},ev=function(e,t){return((15&e[0])!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&T(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&T(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function ey(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var eS=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var a=this.o.dictionary.subarray(-32768);this.b.set(a,32768-a.length),this.s.i=32768-a.length}}return e.prototype.p=function(e,t){this.ondata(Z(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||T(5),this.s.l&&T(4);var a=e.length+this.s.z;if(a>this.b.length){if(a>2*this.b.length-32768){var i=new r(-32768&a);i.set(this.b.subarray(0,this.s.z)),this.b=i}var n=this.b.length-this.s.z;this.b.set(e.subarray(0,n),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(n),32768),this.s.z=e.length-n+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||T(5),this.s.l&&T(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),ek=function(e,t){el([et,function(){return[es,eS]}],this,ey.call(this,e,t),function(e){onmessage=es(new eS(e.data))},6,1)};function eb(e,t){return Z(e,t||{},0,0)}var eI=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var a=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:a?a.length:0},this.o=new r(32768),this.p=new r(0),a&&this.o.set(a)}return e.prototype.e=function(e){if(this.ondata||T(5),this.d&&T(4),this.p.length){if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,a=N(this.p,this.s,this.o);this.ondata(B(a,t,this.s.b),this.d),this.o=B(a,this.s.b-32768),this.s.b=this.o.length,this.p=B(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),ex=function(e,t){el([ee,function(){return[es,eI]}],this,ey.call(this,e,t),function(e){onmessage=es(new eI(e.data))},7,0)};function eP(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}(function(){function e(e,t){this.c=W(),this.l=0,this.v=1,eS.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,eS.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=Z(e,this.o,this.v&&em(this.o),t&&8,this.s);this.v&&(eg(a,this.o),this.v=0),t&&(eu(a,a.length-8,this.c.d()),eu(a,a.length-4,this.l)),this.ondata(a,t)},e.prototype.flush=function(){eS.prototype.flush.call(this)}})();var eD=function(){function e(e,t){this.v=1,this.r=0,eI.call(this,e,t)}return e.prototype.push=function(e,t){if(eI.prototype.e.call(this,e),this.r+=e.length,this.v){var a=this.p.subarray(this.v-1),i=a.length>3?ep(a):4;if(i>a.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-a.length);this.p=a.subarray(i),this.v=0}eI.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=E(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t))},e}(),eC=function(e,t){var a=this;el([ee,ea,function(){return[es,eI,eD]}],this,ey.call(this,e,t),function(e){var t=new eD(e.data);t.onmember=function(e){return postMessage(e)},onmessage=es(t)},9,0,function(e){return a.onmember&&a.onmember(e)})},ew=(function(){function e(e,t){this.c=$(),this.v=1,eS.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),eS.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var a=Z(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(eF(a,this.o),this.v=0),t&&eu(a,a.length-4,this.c.d()),this.ondata(a,t)},e.prototype.flush=function(){eS.prototype.flush.call(this)}}(),function(){function e(e,t){eI.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(eI.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ev(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&T(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),eI.prototype.c.call(this,t)},e}()),eE=function(e,t){el([ee,er,function(){return[es,eI,ew]}],this,ey.call(this,e,t),function(e){onmessage=es(new ew(e.data))},11,0)},eB=function(){function e(e,t){this.o=ey.call(this,e,t)||{},this.G=eD,this.I=eI,this.Z=ew}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,a){e.ondata(t,a)}},e.prototype.push=function(e,t){if(this.ondata||T(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var a=new r(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();function eM(e,t){eB.call(this,e,t),this.queuedSize=0,this.G=eC,this.I=ex,this.Z=eE}eM.prototype.i=function(){var e=this;this.s.ondata=function(t,a,r){e.ondata(t,a,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},eM.prototype.push=function(e,t){this.queuedSize+=e.length,eB.prototype.push.call(this,e,t)};var eT="u">typeof TextEncoder&&new TextEncoder,eN="u">typeof TextDecoder&&new TextDecoder,eG=0;try{eN.decode(q,{stream:!0}),eG=1}catch(e){}var eR=function(e){for(var t="",a=0;;){var r=e[a++],i=(r>127)+(r>223)+(r>239);if(a+i>e.length)return{s:t,r:B(e,a-1)};i?3==i?t+=String.fromCharCode(55296|(r=((15&r)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++])-65536)>>10,56320|1023&r):1&i?t+=String.fromCharCode((31&r)<<6|63&e[a++]):t+=String.fromCharCode((15&r)<<12|(63&e[a++])<<6|63&e[a++]):t+=String.fromCharCode(r)}};function eU(e,t){if(t){for(var a=new r(e.length),i=0;i>1)),s=0,l=function(e){o[s++]=e},i=0;io.length){var d=new r(s+8+(n-i<<1));d.set(o),o=d}var c=e.charCodeAt(i);c<128||t?l(c):(c<2048?l(192|c>>6):(c>55295&&c<57344?(l(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>18),l(128|c>>12&63)):l(224|c>>12),l(128|c>>6&63)),l(128|63&c))}return B(o,0,s)}(function(e){this.ondata=e,eG?this.t=new TextDecoder:this.p=q}).prototype.push=function(e,t){if(this.ondata||T(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&T(8),this.t=null);return}this.p||T(4);var a=new r(this.p.length+e.length);a.set(this.p),a.set(e,this.p.length);var i=eR(a),n=i.s,o=i.r;t?(o.length&&T(8),this.p=null):this.p=o,this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){this.ondata||T(5),this.d&&T(4),this.ondata(eU(e),this.d=t||!1)};var ej=function(e){return 1==e?3:e<6?2:+(9==e)},eA=function(e,t){for(;1!=ed(e,t);t+=4+ed(e,t+2));return[eh(e,t+12),eh(e,t+4),eh(e,t+20)]},eV=function(e){var t=0;if(e)for(var a in e){var r=e[a].length;r>65535&&T(9),t+=r+4}return t},eO=function(e,t,a,r,i,n,o,s){var l=r.length,d=a.extra,c=s&&s.length,h=eV(d);eu(e,t,null!=o?0x2014b50:0x4034b50),t+=4,null!=o&&(e[t++]=20,e[t++]=a.os),e[t]=20,t+=2,e[t++]=a.flag<<1|(n<0&&8),e[t++]=i&&8,e[t++]=255&a.compression,e[t++]=a.compression>>8;var u=new Date(null==a.mtime?Date.now():a.mtime),g=u.getFullYear()-1980;if((g<0||g>119)&&T(10),eu(e,t,g<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),t+=4,-1!=n&&(eu(e,t,a.crc),eu(e,t+4,n<0?-n-2:n),eu(e,t+8,a.size)),eu(e,t+12,l),eu(e,t+14,h),t+=16,null!=o&&(eu(e,t,c),eu(e,t+6,a.attrs),eu(e,t+10,o),t+=14),e.set(r,t),t+=l,h)for(var p in d){var f=d[p],m=f.length;eu(e,t,+p),eu(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},ez=function(e,t,a,r,i){eu(e,t,0x6054b50),eu(e,t+8,a),eu(e,t+10,a),eu(e,t+12,r),eu(e,t+16,i)},eL=function(){function e(e){this.filename=e,this.c=W(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||T(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function eq(e,t){var a=this;t||(t={}),eL.call(this,e),this.d=new eS(t,function(e,t){a.ondata(null,e,t)}),this.compression=8,this.flag=ej(t.level)}function e_(e,t){var a=this;t||(t={}),eL.call(this,e),this.d=new ek(t,function(e,t,r){a.ondata(e,t,r)}),this.compression=8,this.flag=ej(t.level),this.terminate=this.d.terminate}function eH(e){this.ondata=e,this.u=[],this.d=1}eq.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},eq.prototype.push=function(e,t){eL.prototype.push.call(this,e,t)},e_.prototype.process=function(e,t){this.d.push(e,t)},e_.prototype.push=function(e,t){eL.prototype.push.call(this,e,t)},eH.prototype.add=function(e){var t=this;if(this.ondata||T(5),2&this.d)this.ondata(T(4+(1&this.d)*8,0,1),null,!1);else{var a=eU(e.filename),i=a.length,n=e.comment,o=n&&eU(n),s=i!=e.filename.length||o&&n.length!=o.length,l=i+eV(e.extra)+30;i>65535&&this.ondata(T(11,0,1),null,!1);var d=new r(l);eO(d,0,e,a,s,-1);var c=[d],h=function(){for(var e=0,a=c;e0){var i=Math.min(this.c,e.length),n=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(i)).length)return this.push(e,t)}else{var o=0,s=0,l=void 0,d=void 0;this.p.length?e.length?((d=new r(this.p.length+e.length)).set(this.p),d.set(e,this.p.length)):d=this.p:d=e;for(var c=d.length,h=this.c,u=h&&this.d,g=this;ss+30+n+u){var p,f,m=[];g.k.unshift(m),o=2;var F=ec(d,s+18),v=ec(d,s+22),y=function(e,t){if(t){for(var a="",r=0;r=0&&(S.size=F,S.originalSize=v),g.onfile(S)}return"break"}if(h){if(0x8074b50==e)return l=s+=12+(-2==h&&8),o=3,g.c=0,"break";else if(0x2014b50==e)return l=s-=4,o=3,g.c=0,"break"}}();++s);if(this.p=q,h<0){var p=o?d.subarray(0,l-12-(-2==h&&8)-(0x8074b50==ec(d,l-16)&&4)):d.subarray(0,s);u?u.push(p,!!o):this.k[+(2==o)].push(p)}if(2&o)return this.push(d.subarray(s),t);this.p=d.subarray(s)}t&&(this.c&&T(13),this.p=null)},eX.prototype.register=function(e){this.o[e.compression]=e},"function"==typeof queueMicrotask&&queueMicrotask;var eJ=e.i(48450);let eY=[0,0,0,0,0,0,0,0,0,329,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2809,68,0,27,0,58,3,62,4,7,0,0,15,65,554,3,394,404,189,117,30,51,27,15,34,32,80,1,142,3,142,39,0,144,125,44,122,275,70,135,61,127,8,12,113,246,122,36,185,1,149,309,335,12,11,14,54,151,0,0,2,0,0,211,0,2090,344,736,993,2872,701,605,646,1552,328,305,1240,735,1533,1713,562,3,1775,1149,1469,979,407,553,59,279,31,0,0,0,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function eQ(e){return e.node?e.node.pop:e.leaf.pop}let eK=new class{nodes=[];leaves=[];tablesBuilt=!1;buildTables(){if(this.tablesBuilt)return;this.tablesBuilt=!0,this.leaves=[];for(let t=0;t<256;t++){var e;this.leaves.push({pop:eY[t]+ +((e=t)>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)+1,symbol:t,numBits:0,code:0})}this.nodes=[{pop:0,index0:0,index1:0}];let t=256,a=[];for(let e=0;e<256;e++)a.push({node:null,leaf:this.leaves[e]});for(;1!==t;){let e=0xfffffffe,r=0xffffffff,i=-1,n=-1;for(let o=0;on?i:n;a[s]={node:o,leaf:null},l!==t-1&&(a[l]=a[t-1]),t--}this.nodes[0]=a[0].node,this.generateCodes(0,0,0)}determineIndex(e){return null!==e.leaf?-(this.leaves.indexOf(e.leaf)+1):this.nodes.indexOf(e.node)}generateCodes(e,t,a){if(t<0){let r=this.leaves[-(t+1)];r.code=e,r.numBits=a}else{let r=this.nodes[t];this.generateCodes(e,r.index0,a+1),this.generateCodes(e|1<=0)t=e.readFlag()?this.nodes[t].index1:this.nodes[t].index0;else{a.push(this.leaves[-(t+1)].symbol);break}}return String.fromCharCode(...a)}{let t=e.readInt(8);return String.fromCharCode(...e.readBytes(t))}}};class e0{data;bitNum;maxReadBitNum;error;stringBuffer=null;constructor(e,t=0){this.data=e,this.bitNum=t,this.maxReadBitNum=e.length<<3,this.error=!1}getCurPos(){return this.bitNum}setCurPos(e){this.bitNum=e}getBytePosition(){return this.bitNum+7>>3}isError(){return this.error}isFull(){return this.bitNum>this.maxReadBitNum}getRemainingBits(){return this.maxReadBitNum-this.bitNum}getMaxPos(){return this.maxReadBitNum}readFlag(){if(this.bitNum>=this.maxReadBitNum)return this.error=!0,!1;let e=1<<(7&this.bitNum),t=(this.data[this.bitNum>>3]&e)!=0;return this.bitNum++,t}readInt(e){if(0===e)return 0;if(this.bitNum+e>this.maxReadBitNum)return this.error=!0,0;let t=this.bitNum>>3,a=7&this.bitNum;if(this.bitNum+=e,e+a<=32){let r=0,i=e+a+7>>3;for(let e=0;e>>=a,32===e)?r>>>0:r&(1<>3;for(let e=0;e>>0:r&(1<>3,a=new Uint8Array(t),r=this.bitNum>>3,i=7&this.bitNum,n=8-i;if(0===i)a.set(this.data.subarray(r,r+t));else{let e=this.data[r];for(let o=0;o>i|t<this.maxReadBitNum)return this.error=!0,0;let e=this.bitNum>>3,t=7&this.bitNum,a=e0.f32U8;if(0===t)a[0]=this.data[e],a[1]=this.data[e+1],a[2]=this.data[e+2],a[3]=this.data[e+3];else{let r=8-t;for(let i=0;i<4;i++){let n=this.data[e+i],o=e+i+1>t|o<>>0)}getCompressionPoint(){return this.compressionPoint}getDataBlockDataMap(){return this.dataBlockDataMap}getConnectionContext(){let e=this.dataBlockDataMap;return{compressionPoint:this.compressionPoint,ghostTracker:this.ghostTracker,getDataBlockParser:e=>this.registry.getDataBlockParser(e),getDataBlockData:e?t=>e.get(t):void 0,getGhostParser:e=>this.registry.getGhostParser(e)}}_setNextRecvEventSeq(e){this.nextRecvEventSeq=e>>>0}setConnectionProtocolState(e){for(this.lastSeqRecvdAtSend=e.lastSeqRecvdAtSend.slice(0,32);this.lastSeqRecvdAtSend.length<32;)this.lastSeqRecvdAtSend.push(0);this.lastSeqRecvd=e.lastSeqRecvd>>>0,this.highestAckedSeq=e.highestAckedSeq>>>0,this.lastSendSeq=e.lastSendSeq>>>0,this.recvAckMask=e.ackMask>>>0,this.connectSequence=e.connectSequence>>>0,this.lastRecvAckAck=e.lastRecvAckAck>>>0,this._connectionEstablished=e.connectionEstablished}onSendPacketTrigger(){this.lastSendSeq=this.lastSendSeq+1>>>0,this.lastSeqRecvdAtSend[31&this.lastSendSeq]=this.lastSeqRecvd>>>0}applyProtocolHeader(e){if(e.connectSeqBit!==(1&this.connectSequence)||e.ackByteCount>4||e.packetType>2)return{accepted:!1,dispatchData:!1};let t=(e.seqNumber|0xfffffe00&this.lastSeqRecvd)>>>0;if(t>>0),this.lastSeqRecvd+31>>0;if(a>>0),this.lastSendSeq>>0,0===e.packetType&&(this.recvAckMask=(1|this.recvAckMask)>>>0);for(let t=this.highestAckedSeq+1;t<=a;t++)(e.ackMask&1<<(a-t&31))!=0&&(this.lastRecvAckAck=this.lastSeqRecvdAtSend[31&t]>>>0);t-this.lastRecvAckAck>32&&(this.lastRecvAckAck=t-32),this.highestAckedSeq=a;let i=this.lastSeqRecvd!==t&&0===e.packetType;return this.lastSeqRecvd=t,{accepted:!0,dispatchData:i}}parsePacket(e){let t=new e0(e),a=this.readDnetHeader(t),r=this.applyProtocolHeader(a);if(this.packetsParsed++,!r.accepted)return this.protocolRejected++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};if(!r.dispatchData)return this.protocolNoDispatch++,{dnetHeader:a,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};let i=this.readRateInfo(t);t.setStringBuffer(!0);let n=this.readGameState(t),o=void 0===n.controlObjectDataStart||void 0!==n.controlObjectData,s=o?this.readEvents(t):[],l=s[s.length-1],d=!l||l.dataBitsEnd!==l.dataBitsStart,c=o&&d?t.getCurPos():void 0,h=o&&d?this.readGhosts(t,a.seqNumber):[];return t.setStringBuffer(!1),{dnetHeader:a,rateInfo:i,gameState:n,events:s,ghosts:h,ghostSectionStart:c}}readDnetHeader(e){let t=e.readFlag(),a=e.readInt(1),r=e.readInt(9),i=e.readInt(9),n=e.readInt(2),o=e.readInt(3),s=o>0?e.readInt(8*o):0;return{gameFlag:t,connectSeqBit:a,seqNumber:r,highestAck:i,packetType:n,ackByteCount:o,ackMask:s}}readRateInfo(e){let t={};return e.readFlag()&&(t.updateDelay=e.readInt(10),t.packetSize=e.readInt(10)),e.readFlag()&&(t.maxUpdateDelay=e.readInt(10),t.maxPacketSize=e.readInt(10)),t}readGameState(e){let t,a,r,i,n,o,s,l,d,c,h,u,g,p,f,m=e.readInt(32);e.readFlag()&&(e.readFlag()&&(t=e.readFloat(7)),e.readFlag()&&(a=1.5*e.readFloat(7))),e.readFlag()&&(r=e.readFlag(),i=e.readFlag()),e.readFlag()&&((n=e.readFlag())&&(o={x:e.readF32(),y:e.readF32(),z:e.readF32()}),1===(s=e.readRangedU32(0,2))?e.readFlag()&&(l=e.readRangedU32(0,1023)):2===s&&(d={x:e.readF32(),y:e.readF32(),z:e.readF32()}));let F=e.readFlag(),v=e.readFlag();if(e.readFlag())if(e.readFlag()){let f=e.readInt(10);c=f,h=e.getCurPos();let y=e.savePos(),S=this.ghostTracker.getGhost(f),k=S?this.registry.getGhostParser(S.classId):void 0,b=this.controlParserByGhostIndex.get(f),I=this.registry.getGhostParser(25),x=this.registry.getGhostParser(4),P=[],D=new Set,C=e=>{!e?.readPacketData||D.has(e.name)||(D.add(e.name),P.push(e))};C(k),C(b),C(I),C(x);let w=!1;for(let t of P){e.restorePos(y);try{let a=this.getConnectionContext(),r=t.readPacketData(e,a);if(e.getCurPos()-h<=0||e.isError())continue;g=r,u=e.getCurPos(),this.controlParserByGhostIndex.set(f,t),a.compressionPoint!==this.compressionPoint&&(this.compressionPoint=a.compressionPoint,p=this.compressionPoint),this.controlObjectParsed++,w=!0;break}catch{}}if(!w)return e.restorePos(y),u=h,this.controlObjectFailed++,{lastMoveAck:m,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:i,seekerTracking:n,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:d,pinged:F,jammed:v,controlObjectGhostIndex:c,controlObjectDataStart:h,controlObjectDataEnd:u,controlObjectData:g,targetVisibility:[]}}else p={x:e.readF32(),y:e.readF32(),z:e.readF32()},this.compressionPoint=p;let y=[];for(;e.readFlag();)y.push({index:e.readInt(4),mask:e.readInt(32)});return e.readFlag()&&(f=e.readInt(8)),{lastMoveAck:m,damageFlash:t,whiteOut:a,selfLocked:r,selfHomed:i,seekerTracking:n,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:d,pinged:F,jammed:v,controlObjectGhostIndex:c,controlObjectDataStart:h,controlObjectDataEnd:u,controlObjectData:g,compressionPoint:p,targetVisibility:y.length>0?y:void 0,cameraFov:f}}readEvents(e){let t=[],a=!0,r=-2;for(;;){let i,n,o,s=e.readFlag();if(a&&!s){if(a=!1,!e.readFlag()){this.dispatchGuaranteedEvents(t);break}}else if(a||s){if(!s)break}else{this.dispatchGuaranteedEvents(t);break}!a&&(r=i=e.readFlag()?r+1&127:e.readInt(7),(n=i|0xffffff80&this.nextRecvEventSeq)0&&this.pendingGuaranteedEvents[0].absoluteSequenceNumber===this.nextRecvEventSeq;){let t=this.pendingGuaranteedEvents.shift();if(!t)break;this.nextRecvEventSeq=this.nextRecvEventSeq+1>>>0,e.push(t.event),t.event.parsedData&&this.applyEventSideEffects(t.event.parsedData)}}applyEventSideEffects(e){let t=e.type;if("GhostingMessageEvent"===t){let t=e.message;"number"==typeof t&&2===t&&this.ghostTracker.clear();return}if("GhostAlwaysObjectEvent"===t){let t=e.ghostIndex,a=e.classId;if("number"==typeof t&&"number"==typeof a){let e=this.registry.getGhostParser(a);this.ghostTracker.createGhost(t,a,e?.name??`unknown_${a}`)}}"SimDataBlockEvent"===t&&this.dataBlockDataMap&&e.dataBlockData&&"number"==typeof e.objectId&&this.dataBlockDataMap.set(e.objectId,e.dataBlockData)}readGhosts(e,t){let a=[];if(!e.readFlag())return a;let r=e.readInt(3)+3;for(;e.readFlag();){let i;if(e.isError())break;let n=e.readInt(r);if(e.isError())break;if(e.readFlag()){this.ghostTracker.deleteGhost(n),this.ghostDeletes++,a.push({index:n,type:"delete",updateBitsStart:e.getCurPos(),updateBitsEnd:e.getCurPos()});continue}let o=!this.ghostTracker.hasGhost(n);i=o?e.readInt(7)+0:this.ghostTracker.getGhost(n)?.classId;let s=e.getCurPos(),l=void 0!==i?this.registry.getGhostParser(i):void 0;if(o&&!l){this.ghostsTrackerDiverged++,e5("DIVERGED pkt=%d seq=%d idx=%d classId=%d bit=%d/%d trackerSize=%d (server sent UPDATE for ghost not in our tracker; 7-bit classId is actually update data)",this.packetsParsed,t,n,i,s,e.getMaxPos(),this.ghostTracker.size()),a.push({index:n,type:"create",classId:i,updateBitsStart:s,updateBitsEnd:s});break}let d=!1;if(l)try{let t=this.getConnectionContext();t.currentGhostIndex=n;let r=l.unpackUpdate(e,o,t),c=e.getCurPos();o&&void 0!==i?(this.ghostTracker.createGhost(n,i,l.name),this.ghostCreatesParsed++):this.ghostUpdatesParsed++,a.push({index:n,type:o?"create":"update",classId:i,updateBitsStart:s,updateBitsEnd:c,parsedData:r}),d=!0}catch(c){this.ghostsFailed++;let r=o?"create":"update",d=c instanceof Error?c.message:String(c);e5("FAIL pkt=%d seq=%d #%d idx=%d op=%s classId=%d parser=%s bit=%d/%d trackerSize=%d err=%s",this.packetsParsed,t,a.length,n,r,i,l.name,s,e.getMaxPos(),this.ghostTracker.size(),d)}if(!d){e5("STOP pkt=%d seq=%d idx=%d op=%s classId=%d parser=%s bit=%d/%d",this.packetsParsed,t,n,o?"create":"update",i,l?.name??"NONE",s,e.getMaxPos()),a.push({index:n,type:o?"create":"update",classId:i,updateBitsStart:s,updateBitsEnd:s});break}}return a}emptyGameState(){return{lastMoveAck:0,pinged:!1,jammed:!1}}}class e6{eventParsers=new Map;ghostParsers=new Map;dataBlockParsers=new Map;eventCatalog=new Map;ghostCatalog=new Map;dataBlockCatalog=new Map;catalogEvent(e){this.eventCatalog.set(e.name,e)}catalogGhost(e){this.ghostCatalog.set(e.name,e)}catalogDataBlock(e){this.dataBlockCatalog.set(e.name,e)}bindDeterministicDataBlocks(e,t){let a=0,r=[];for(let i=0;i0&&(r.sounds=t)}if(e.readFlag()){let t=[];for(let a=0;a<4;a++)e.readFlag()&&t.push({index:a,sequence:e.readInt(5),state:e.readInt(2),forward:e.readFlag(),atEnd:e.readFlag()});t.length>0&&(r.threads=t)}let i=!1;if(e.readFlag()){let a=[];for(let r=0;r<8;r++)if(e.readFlag()){let n={index:r};e.readFlag()?n.dataBlockId=e9(e):n.dataBlockId=0,e.readFlag()&&(e.readFlag()?n.skinTagIndex=e.readInt(10):n.skinName=e.readString(),i=!0),n.triggerDown=e.readFlag(),n.loaded=e.readFlag(),n.ammo=e.readFlag(),n.wet=e.readFlag(),n.target=e.readFlag(),n.fireCount=e.readInt(3),t&&(n.imageExtraFlag=e.readFlag()),a.push(n)}a.length>0&&(r.images=a)}if(e.readFlag()){if(e.readFlag()){r.stateAEnabled=e.readFlag(),r.stateB=e.readFlag();let t=e.readFlag();r.hasInvulnerability=t,t?(r.invulnerabilityVisual=e.readFlag(),r.invulnerabilityTicks=e.readU32()):r.binaryCloak=e.readFlag()}if(e.readFlag())if(e.readFlag()){let t=e.readFlag();r.stateBMode=t,t?r.energyPackOn=!0:r.energyPackOn=!1}else r.shieldNormal=e.readNormalVector(8),r.energyPercent=e.readFloat(5);e.readFlag()&&(r.stateValue1=e.readU32(),r.stateValue2=e.readU32())}return i&&(r.imageSkinDirty=!0),e.readFlag()&&(e.readFlag()?(r.mountObject=e.readInt(10),r.mountNode=e.readInt(5)):r.mountObject=-1),r}function ta(e,t,a){let r=tt(e,t,a);if(e.readFlag()&&(r.impactSound=e.readInt(3)),e.readFlag()&&(r.action=e.readInt(8),r.actionHoldAtEnd=e.readFlag(),r.actionAtEnd=e.readFlag(),r.actionFirstPerson=e.readFlag(),!r.actionAtEnd&&e.readFlag()&&(r.actionAnimPos=e.readSignedFloat(6))),e.readFlag()&&(r.armAction=e.readInt(8)),e.readFlag())return r;if(e.readFlag()){if(r.actionState=e.readInt(3),e.readFlag()&&(r.recoverTicks=e.readInt(7)),r.moveFlag0=e.readFlag(),r.moveFlag1=e.readFlag(),r.position=e.readCompressedPoint(a.compressionPoint),e.readFlag()){let t=e.readInt(13)/32,a=e.readNormalVector(10);r.velocity={x:a.x*t,y:a.y*t,z:a.z*t}}else r.velocity={x:0,y:0,z:0};r.headX=e.readSignedFloat(6),r.headZ=e.readSignedFloat(6),r.rotationZ=2*e.readFloat(7)*Math.PI,r.move=e7(e),r.allowWarp=e.readFlag()}return r.energy=e.readFloat(5),r}function tr(e,t){let a={};if(a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.actionState=e.readInt(3),e.readFlag()&&(a.recoverTicks=e.readInt(7)),e.readFlag()&&(a.jumpDelay=e.readInt(7)),e.readFlag()){let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};a.position=r,t.compressionPoint=r,a.velocity={x:e.readF32(),y:e.readF32(),z:e.readF32()},a.jumpSurfaceLastContact=e.readInt(4)}if(a.headX=e.readF32(),a.headZ=e.readF32(),a.rotationZ=e.readF32(),e.readFlag()){let r=e.readInt(10);a.controlObjectGhost=r;let i=t.ghostTracker.getGhost(r),n=i?t.getGhostParser?.(i.classId):void 0;if(n?.readPacketData){let i=t.currentGhostIndex;t.currentGhostIndex=r,a.controlObjectData=n.readPacketData(e,t),t.currentGhostIndex=i}}return a.disableMove=e.readFlag(),a.pilot=e.readFlag(),a}function ti(e,t,a){let r=tt(e,t,a);return(r.jetting=e.readFlag(),e.readFlag())?r._controlledEarlyReturn=!0:(r.steeringYaw=e.readFloat(9),r.steeringPitch=e.readFloat(9),r.move=e7(e),r.frozen=e.readFlag(),e.readFlag()&&(r.position=e.readCompressedPoint(a.compressionPoint),r.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},r.linMomentum=e.readPoint3F(),r.angMomentum=e.readPoint3F()),e.readFlag()&&(r.energy=e.readFloat(8))),r}function tn(e,t){let a={};a.energyLevel=e.readF32(),a.rechargeRate=e.readF32(),a.steering={x:e.readF32(),y:e.readF32()};let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};return a.linPosition=r,a.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},a.linMomentum=e.readPoint3F(),a.angMomentum=e.readPoint3F(),a.disableMove=e.readFlag(),a.frozen=e.readFlag(),t.compressionPoint=r,a}function to(e,t){let a=tn(e,t);a.braking=e.readFlag();let r=4,i=t.currentGhostIndex;if(void 0!==i){let e=tZ.get(i);void 0!==e&&(r=e)}let n=[];for(let t=0;t64)throw Error(`Invalid Sky fogVolumeCount: ${t}`);r.fogVolumeCount=t,r.useSkyTextures=e.readBool(),r.renderBottomTexture=e.readBool(),r.skySolidColor={r:e.readF32(),g:e.readF32(),b:e.readF32()},r.windEffectPrecipitation=e.readBool();let a=[];for(let r=0;r3)throw Error(`Invalid precipitation colorCount: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/96))throw Error(`Invalid physicalZone point count: ${t}`);let a=[];for(let r=0;rMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone plane count: ${i}`);let n=[];for(let t=0;tMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone edge count: ${o}`);let s=[];for(let t=0;t0&&(a.audioData=e.readBitsBuffer(8*r)),a}function ad(e,t){return{type:"GhostingMessageEvent",sequence:e.readU32(),message:e.readInt(3),ghostCount:e.readInt(11)}}function ac(e,t){let a={type:"GhostAlwaysObjectEvent"};a.ghostIndex=e.readInt(10);let r=e.readFlag();if(a._hasObjectData=r,r){let r=e.readInt(7);a.classId=r;let i=t.getGhostParser?.(r);if(!i)throw Error(`No ghost parser for GhostAlwaysObjectEvent classId=${r}`);a.objectData=i.unpackUpdate(e,!0,t)}return a}function ah(e,t){let a={type:"PathManagerEvent"};if(e.readFlag()){a.messageType="NewPaths";let t=e.readU32(),r=[];for(let a=0;a0&&(t.hudImages=a),t}function aw(e){let t={};e.readFlag()&&(t.crc=e.readU32()),t.shapeName=e.readString(),t.mountPoint=e.readU32(),e.readFlag()||(t.offset=e.readAffineTransform()),t.firstPerson=e.readFlag(),t.mass=e.readF32(),t.usesEnergy=e.readFlag(),t.minEnergy=e.readF32(),t.hasFlash=e.readFlag(),t.projectile=ab(e),t.muzzleFlash=ab(e),t.isSeeker=e.readFlag(),t.isSeeker&&(t.seekerRadius=e.readF32(),t.maxSeekAngle=e.readF32(),t.seekerLockTime=e.readF32(),t.seekerFreeTime=e.readF32(),t.isTargetLockRequired=e.readFlag(),t.maxLockRange=e.readF32()),t.cloakable=e.readFlag(),t.lightType=e.readRangedU32(0,3),0!==t.lightType&&(t.lightRadius=e.readF32(),t.lightTime=e.readS32(),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)}),t.shellExitDir={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.shellExitVariance=e.readF32(),t.shellVelocity=e.readF32(),t.casing=ab(e),t.accuFire=e.readFlag();let a=[];for(let t=0;t<31;t++){if(!e.readFlag())continue;let t={};t.name=e.readString(),t.transitionOnAmmo=e.readInt(5),t.transitionOnNoAmmo=e.readInt(5),t.transitionOnTarget=e.readInt(5),t.transitionOnNoTarget=e.readInt(5),t.transitionOnWet=e.readInt(5),t.transitionOnNotWet=e.readInt(5),t.transitionOnTriggerUp=e.readInt(5),t.transitionOnTriggerDown=e.readInt(5),t.transitionOnTimeout=e.readInt(5),t.transitionGeneric0In=e.readInt(5),t.transitionGeneric0Out=e.readInt(5),e.readFlag()&&(t.timeoutValue=e.readF32()),t.waitForTimeout=e.readFlag(),t.fire=e.readFlag(),t.ejectShell=e.readFlag(),t.scaleAnimation=e.readFlag(),t.direction=e.readFlag(),t.reload=e.readFlag(),e.readFlag()&&(t.energyDrain=e.readF32()),t.loaded=e.readInt(3),t.spin=e.readInt(3),t.recoil=e.readInt(3),e.readFlag()&&(t.sequence=e.readSignedInt(16)),e.readFlag()&&(t.sequenceVis=e.readSignedInt(16)),t.flashSequence=e.readFlag(),t.ignoreLoadedForReady=e.readFlag(),t.emitter=ab(e),null!==t.emitter&&(t.emitterTime=e.readF32(),t.emitterNode=e.readS32()),t.sound=ab(e),a.push(t)}return t.states=a,t}function aE(e){let t=aC(e);t.renderFirstPerson=e.readFlag(),t.minLookAngle=e.readF32(),t.maxLookAngle=e.readF32(),t.maxFreelookAngle=e.readF32(),t.maxTimeScale=e.readF32(),t.maxStepHeight=e.readF32(),t.runForce=e.readF32(),t.runEnergyDrain=e.readF32(),t.minRunEnergy=e.readF32(),t.maxForwardSpeed=e.readF32(),t.maxBackwardSpeed=e.readF32(),t.maxSideSpeed=e.readF32(),t.maxUnderwaterForwardSpeed=e.readF32(),t.maxUnderwaterBackwardSpeed=e.readF32(),t.maxUnderwaterSideSpeedRef=ab(e),e.readFlag()&&(t.runSurfaceAngleRef=e.readInt(11)),t.runSurfaceAngle=e.readF32(),t.recoverDelay=e.readF32(),t.recoverRunForceScale=e.readF32(),t.jumpForce=e.readF32(),t.jumpEnergyDrain=e.readF32(),t.minJumpEnergy=e.readF32(),t.minJumpSpeed=e.readF32(),t.maxJumpSpeed=e.readF32(),t.jumpSurfaceAngle=e.readF32(),t.minJetEnergy=e.readF32(),t.splashVelocity=e.readF32(),t.splashAngle=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.bubbleEmitTime=e.readF32(),t.medSplashSoundVel=e.readF32(),t.hardSplashSoundVel=e.readF32(),t.exitSplashSoundVel=e.readF32(),t.jumpDelay=e.readInt(7),t.horizMaxSpeed=e.readF32(),t.horizResistSpeed=e.readF32(),t.horizResistFactor=e.readF32(),t.upMaxSpeed=e.readF32(),t.upResistSpeed=e.readF32(),t.upResistFactor=e.readF32(),t.jetEnergyDrain=e.readF32(),t.canJet=e.readF32(),t.maxJetHorizontalPercentage=e.readF32(),t.maxJetForwardSpeed=e.readF32(),t.jetForce=e.readF32(),t.minJetSpeed=e.readF32(),t.maxDamage=e.readF32(),t.minImpactDamageSpeed=e.readF32(),t.impactDamageScale=e.readF32(),t.footSplashHeight=e.readF32();let a=[];for(let t=0;t<32;t++)e.readFlag()?a.push(e.readInt(11)):a.push(null);t.sounds=a,t.boxSize={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.footPuffEmitter=ab(e),t.footPuffNumParts=e.readF32(),t.footPuffRadius=e.readF32(),t.decalData=ab(e),t.decalOffset=e.readF32(),t.dustEmitter=ab(e),t.splash=ab(e);let r=[];for(let t=0;t<3;t++)r.push(ab(e));return t.splashEmitters=r,t.groundImpactMinSpeed=e.readF32(),t.groundImpactShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeDuration=e.readF32(),t.groundImpactShakeFalloff=e.readF32(),t.boundingRadius=e.readF32(),t.moveBubbleSize=e.readF32(),t}function aB(e){let t=aC(e);t.bodyRestitution=e.readF32(),t.bodyFriction=e.readF32();let a=[];for(let t=0;t<2;t++)a.push(ab(e));t.impactSounds=a,t.minImpactSpeed=e.readF32(),t.softImpactSpeed=e.readF32(),t.hardImpactSpeed=e.readF32(),t.minRollSpeed=e.readF32(),t.maxSteeringAngle=e.readF32(),t.maxDrag=e.readF32(),t.minDrag=e.readF32(),t.cameraOffset=e.readF32(),t.cameraLag=e.readF32(),t.jetForce=e.readF32(),t.jetEnergyDrain=e.readF32(),t.minJetEnergy=e.readF32(),t.integration=e.readF32(),t.collisionTol=e.readF32(),t.massCenter=e.readF32(),t.exitSplashSoundVelocity=e.readF32(),t.softSplashSoundVelocity=e.readF32(),t.mediumSplashSoundVelocity=e.readF32(),t.hardSplashSoundVelocity=e.readF32();let r=[];for(let t=0;t<5;t++)r.push(ab(e));t.waterSounds=r,t.dustEmitter=ab(e);let i=[];for(let t=0;t<3;t++)i.push(ab(e));t.damageEmitters=i;let n=[];for(let t=0;t<2;t++)n.push(ab(e));return t.splashEmitters=n,t.damageEmitterOffset0={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageEmitterOffset1={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageLevelTolerance0=e.readF32(),t.damageLevelTolerance1=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.collDamageThresholdVel=e.readF32(),t.collDamageMultiplier=e.readF32(),t}function aM(e){let t=aB(e);t.jetActivateSound=ab(e),t.jetDeactivateSound=ab(e);let a=[];for(let t=0;t<4;t++)a.push(ab(e));return t.jetEmitters=a,t.maneuveringForce=e.readF32(),t.horizontalSurfaceForce=e.readF32(),t.verticalSurfaceForce=e.readF32(),t.autoInputDamping=e.readF32(),t.steeringForce=e.readF32(),t.steeringRollForce=e.readF32(),t.rollForce=e.readF32(),t.autoAngularForce=e.readF32(),t.rotationalDrag=e.readF32(),t.maxAutoSpeed=e.readF32(),t.autoLinearForce=e.readF32(),t.hoverHeight=e.readF32(),t.createHoverHeight=e.readF32(),t.minTrailSpeed=e.readF32(),t.vertThrustMultiple=e.readF32(),t.maxForwardSpeed=e.readF32(),t}function aT(e){let t=aB(e);t.dragForce=e.readF32(),t.mainThrustForce=e.readF32(),t.reverseThrustForce=e.readF32(),t.strafeThrustForce=e.readF32(),t.turboFactor=e.readF32(),t.stabLenMin=e.readF32(),t.stabLenMax=e.readF32(),t.stabSpringConstant=e.readF32(),t.stabDampingConstant=e.readF32(),t.gyroDrag=e.readF32(),t.normalForce=e.readF32(),t.restorativeForce=e.readF32(),t.steeringForce=e.readF32(),t.rollForce=e.readF32(),t.pitchForce=e.readF32(),t.floatingThrustFactor=e.readF32(),t.brakingForce=e.readF32(),t.dustTrailOffset={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.dustTrailFreqMod=e.readF32(),t.triggerTrailHeight=e.readF32(),t.floatSound=ab(e),t.thrustSound=ab(e),t.turboSound=ab(e);let a=[];for(let t=0;t<3;t++)a.push(ab(e));return t.jetEmitters=a,t.dustTrailEmitter=ab(e),t.mainThrustEmitterFactor=e.readF32(),t.strafeThrustEmitterFactor=e.readF32(),t.reverseThrustEmitterFactor=e.readF32(),t}function aN(e){let t=aB(e);return t.tireRadius=e.readF32(),t.tireStaticFriction=e.readF32(),t.tireKineticFriction=e.readF32(),t.tireRestitution=e.readF32(),t.tireLateralForce=e.readF32(),t.tireLateralDamping=e.readF32(),t.tireLateralRelaxation=e.readF32(),t.tireLongitudinalForce=e.readF32(),t.tireLongitudinalDamping=e.readF32(),t.tireEmitter=ab(e),t.jetSound=ab(e),t.engineSound=ab(e),t.squealSound=ab(e),t.wadeSound=ab(e),t.spring=e.readF32(),t.springDamping=e.readF32(),t.springLength=e.readF32(),t.brakeTorque=e.readF32(),t.engineTorque=e.readF32(),t.engineBrake=e.readF32(),t.maxWheelSpeed=e.readF32(),t.steeringAngle=e.readF32(),t.steeringReturn=e.readF32(),t.steeringDamping=e.readF32(),t.powerSteeringFactor=e.readF32(),t}function aG(e){let t=aC(e);return t.noIndividualDamage=e.readFlag(),t.dynamicTypeField=e.readS32(),t}function aR(e){let t=aG(e);return t.thetaMin=e.readF32(),t.thetaMax=e.readF32(),t.thetaNull=e.readF32(),t.neverUpdateControl=e.readFlag(),t.primaryAxis=e.readRangedU32(0,3),t.maxCapacitorEnergy=e.readF32(),t.capacitorRechargeRate=e.readF32(),t}function aU(e){let t=aw(e);return t.activationMS=e.readInt(8),t.deactivateDelayMS=e.readInt(8),t.degPerSecTheta=e.readRangedU32(0,1080),t.degPerSecPhi=e.readRangedU32(0,1080),t.dontFireInsideDamageRadius=e.readFlag(),t.damageRadius=e.readF32(),t.useCapacitor=e.readFlag(),t}function aj(e){let t=aC(e);return t.friction=e.readFloat(10),t.elasticity=e.readFloat(10),t.sticky=e.readFlag(),e.readFlag()&&(t.gravityMod=e.readFloat(10)),e.readFlag()&&(t.maxVelocity=e.readF32()),e.readFlag()&&(t.lightType=e.readInt(2),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)},t.lightTime=e.readS32(),t.lightRadius=e.readF32(),t.lightOnlyStatic=e.readFlag()),t}function aA(e){let t={};t.projectileShapeName=e.readString(),t.faceViewerLinkTime=e.readS32(),t.lifetime=e.readS32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.scale={x:e.readF32(),y:e.readF32(),z:e.readF32()}),t.baseEmitter=ab(e),t.delayEmitter=ab(e),t.bubbleEmitter=ab(e),t.explosion=ab(e),t.underwaterExplosion=ab(e),t.splash=ab(e),t.sound=ab(e),t.wetFireSound=ab(e),t.fireSound=ab(e);let a=[];for(let t=0;t<6;t++)a.push(ab(e));return t.decals=a,e.readFlag()&&(t.lightRadius=e.readFloat(8),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),e.readFlag()&&(t.underwaterLightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),t.explodeOnWaterImpact=aP(e),t.depthTolerance=e.readF32(),t}function aV(e){let t=aA(e);return t.dryVelocity=e.readF32(),t.wetVelocity=e.readF32(),t.fizzleTime=e.readU32(),t.fizzleType=e.readU32(),t.hardRetarget=e.readFlag(),t.inheritedVelocityScale=e.readRangedU32(0,90),t.lifetimeMS=e.readRangedU32(0,90),t.collideWithOwnerTimeMS=e.readU32(),t.proximityRadius=e.readU32(),t.tracerProjectile=e.readFlag(),t}function aO(e){let t=aA(e);return t.armingDelayMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.grenadeElasticity=e.readF32(),t.grenadeFriction=e.readF32(),t.drag=e.readF32(),t.density=e.readF32(),t.gravityMod=e.readF32(),t.lifetimeMS=e.readS32(),t}function az(e){let t=aA(e);return t.lifetimeMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.turningSpeed=e.readF32(),t.proximityRadius=e.readF32(),t.terrainAvoidanceSpeed=e.readF32(),t.terrainScanAhead=e.readF32(),t.terrainHeightFail=e.readF32(),t.terrainAvoidanceRadius=e.readF32(),t.flareDistance=e.readF32(),t.flareAngle=e.readF32(),t.useFlechette=aP(e),t.maxVelocity=e.readF32(),t.acceleration=e.readF32(),t.flechetteDelayMs=e.readS32(),t.exhaustTimeMs=e.readS32(),t.exhaustNodeName=e.readString(),t.casingShapeName=e.readString(),t.casingDebris=ab(e),t.puffEmitter=ab(e),t.exhaustEmitter=ab(e),t}function aL(e){let t=aA(e);t.maxRifleRange=e.readF32(),t.rifleHeadMultiplier=e.readF32(),t.beamColor=ax(e),t.fadeTime=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32(),t.lightColor=ax(e),t.lightRadius=e.readF32();let a=[];for(let t=0;t<12;t++)a.push(e.readString());return t.textures=a,t}function aq(e){let t=aA(e);t.zapDuration=e.readF32(),t.boltLength=e.readF32(),t.numParts=e.readF32(),t.lightningFreq=e.readF32(),t.lightningDensity=e.readF32(),t.lightningAmp=e.readF32(),t.lightningWidth=e.readF32(),t.shockwave=ab(e);let a=[],r=[],i=[],n=[];for(let t=0;t<2;t++)a.push(e.readF32()),r.push(e.readF32()),i.push(e.readF32()),n.push(e.readF32());t.startWidth=a,t.endWidth=r,t.boltSpeed=i,t.texWrap=n;let o=[];for(let t=0;t<4;t++)o.push(e.readString());return t.textures=o,t.emitter=ab(e),t}function a_(e){let t=aA(e);return t.beamRange=e.readF32(),t.beamDrainRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t.flareTexture=e.readString(),t.hitEmitter=ab(e),t}function aH(e){let t=aA(e);return t.beamRange=e.readF32(),t.beamRepairRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t}function aW(e){let t=aA(e);t.maxRifleRange=e.readF32(),t.beamColor=ax(e),t.startBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32();let a=[];for(let t=0;t<4;t++)a.push(e.readString());return t.textures=a,t}function a$(e){let t=aV(e);return t.tracerLength=e.readF32(),t.tracerAlpha=e.readF32(),t.tracerMinPixels=e.readF32(),t.crossViewFraction=aP(e),t.tracerColor=ax(e),t.tracerWidth=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=aP(e),t.textureName0=e.readString(),t.textureName1=e.readString(),t}function aZ(e){let t=aO(e);return t.energyDrainPerSecond=e.readF32(),t.energyMinDrain=e.readF32(),t.beamWidth=e.readF32(),t.beamRange=e.readF32(),t.numSegments=e.readF32(),t.texRepeat=e.readF32(),t.beamFlareAngle=e.readF32(),t.beamTexture=e.readString(),t.flareTexture=e.readString(),t}function aX(e){let t=aV(e);return t.numFlares=e.readF32(),t.flareColor=ax(e),t.flareTexture=e.readString(),t.smokeTexture=e.readString(),t.size=e.readF32(),t.flareModTexture=e.readF32(),t.smokeSize=e.readF32(),t}function aJ(e){let t=aO(e);return t.smokeDist=e.readF32(),t.noSmoke=e.readF32(),t.boomTime=e.readF32(),t.casingDist=e.readF32(),t.smokeCushion=e.readF32(),t.noSmokeCounter=e.readF32(),t.smokeTexture=e.readString(),t.bombTexture=e.readString(),t}function aY(e){let t=aO(e);return t.size=e.readF32(),t.useLensFlare=aP(e),t.flareTexture=e.readString(),t.lensFlareTexture=e.readString(),t}function aQ(e){let t={};t.dtsFileName=e.readString(),t.soundProfile=ab(e),t.particleEmitter=ab(e),t.particleDensity=e.readInt(14),t.particleRadius=e.readF32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.explosionScale={x:e.readInt(16),y:e.readInt(16),z:e.readInt(16)}),t.playSpeed=e.readInt(14),t.debrisThetaMin=e.readRangedU32(0,180),t.debrisThetaMax=e.readRangedU32(0,180),t.debrisPhiMin=e.readRangedU32(0,360),t.debrisPhiMax=e.readRangedU32(0,360),t.debrisMinVelocity=e.readRangedU32(0,1e3),t.debrisMaxVelocity=e.readRangedU32(0,1e3),t.debrisNum=e.readInt(14),t.debrisVariance=e.readRangedU32(0,1e4),t.delayMS=e.readInt(16),t.delayVariance=e.readInt(16),t.lifetimeMS=e.readInt(16),t.lifetimeVariance=e.readInt(16),t.offset=e.readF32(),t.shakeCamera=e.readFlag(),t.hasLight=e.readFlag(),t.camShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeDuration=e.readF32(),t.camShakeRadius=e.readF32(),t.camShakeFalloff=e.readF32(),t.shockwave=ab(e),t.debris=ab(e);let a=[];for(let t=0;t<4;t++)a.push(ab(e));t.emitters=a;let r=[];for(let t=0;t<5;t++)r.push(ab(e));t.subExplosions=r;let i=e.readRangedU32(0,4),n=[];for(let t=0;t0&&ry("DataBlock binding: %d/%d bound, missing parsers: %s",t,e3.length,a.join(", "));const{bound:r,missing:i}=this.registry.bindDeterministicGhosts(e2,0);i.length>0&&ry("Ghost binding: %d/%d bound, missing parsers: %s",r,e2.length,i.join(", "));const{bound:n,missing:o}=this.registry.bindDeterministicEvents(e1,255);o.length>0&&ry("Event binding: %d/%d bound, missing parsers: %s",n,e1.length,o.join(", ")),this.packetParser=new e8(this.registry,this.ghostTracker)}getRegistry(){return this.registry}getGhostTracker(){return this.ghostTracker}getPacketParser(){return this.packetParser}get loaded(){return this._loaded}get header(){if(!this._loaded)throw Error("must call load() first");return this._header}get initialBlock(){if(!this._loaded)throw Error("must call load() first");return this._initialBlock}get blockCount(){if(!this._loaded)throw Error("must call load() first");if(void 0===this._blockCount){let e=this._decompressedData,t=this._decompressedView,a=0,r=0;for(;r+2<=e.length;){let i=4095&t.getUint16(r,!0);if((r+=2+i)>e.length)break;a++}this._blockCount=a}return this._blockCount}get blockCursor(){if(!this._loaded)throw Error("must call load() first");return this._blockCursor}async load(){if(this._loaded)return{header:this._header,initialBlock:this._initialBlock};let e=this.readHeader();ry('header: "%s" version=0x%s length=%dms (%smin) initialBlockSize=%d',e.identString,e.protocolVersion.toString(16),e.demoLengthMs,(e.demoLengthMs/1e3/60).toFixed(1),e.initialBlockSize);let t=this.buffer.subarray(this.offset,this.offset+e.initialBlockSize),a=this.readInitialBlock(t);this.offset+=e.initialBlockSize;let r=this.buffer.subarray(this.offset);ry("compressed block stream: %d bytes",r.length);let i=await new Promise((e,t)=>{var a,i;a=(a,r)=>{a?t(a):e(r)},i||(i=a,a={}),"function"!=typeof i&&T(7),eo(r,a,[ee],function(e){return ei(eP(e.data[0],en(e.data[1])))},1,i)});return ry("decompressed block stream: %d bytes",i.length),this._decompressedData=i,this._decompressedView=new DataView(i.buffer,i.byteOffset,i.byteLength),this.setupPacketParser(a),this._header=e,this._initialBlock=a,this._blockStreamOffset=0,this._blockCursor=0,this._loaded=!0,{header:e,initialBlock:a}}nextBlock(){if(!this._loaded)throw Error("must call load() first");let e=this._decompressedData,t=this._decompressedView,a=this._blockStreamOffset;if(a+2>e.length)return;let r=t.getUint16(a,!0),i=r>>12,n=4095&r;if(a+2+n>e.length)return void rk("block %d: size %d would exceed decompressed data (offset=%d remaining=%d), stopping",this._blockCursor,n,a+2,e.length-a-2);let o=e.subarray(a+2,a+2+n);this._blockStreamOffset=a+2+n;let s={index:this._blockCursor,type:i,size:n,data:o};if(this._blockCursor++,0===i)try{s.parsed=this.packetParser.parsePacket(o)}catch{}else if(1===i)this.packetParser.onSendPacketTrigger();else if(2===i&&64===n)try{s.parsed=this.readRawMove(o)}catch{}else if(3===i&&8===n)try{s.parsed=this.readInfoBlock(o)}catch{}return s}reset(){if(!this._loaded)throw Error("must call load() first");this._blockStreamOffset=0,this._blockCursor=0,this._blockCount=void 0,this.setupPacketParser(this._initialBlock)}processBlocks(e){if(!this._loaded)throw Error("must call load() first");let t=0;for(let a=0;a=128&&t<128+e3.length?e3[t-128]:`unknown(${t})`;throw Error(`No parser for DataBlock classId ${t} (${e}) at bit ${n}`)}}ry("all %d/%d DataBlocks parsed (%d payloads), bit position after DataBlocks: %d",l,n,s.size,r.getCurPos());let d=0!==r.readU8(),c=[];for(let e=0;e<6;e++)c.push(r.readU32());let h=[];for(let e=0;e<16;e++)h.push(r.readU32());let u=r.readU32(),g=[];for(let e=0;e>3<<3),this.readSimpleTargetManager(r),this.readSimpleTargetManager(r),rS('after sequential tail bit=%d mission="%s" CRC=0x%s',r.getCurPos(),B,M.toString(16))}catch(e){a=e instanceof Error?e.message:String(e)}finally{this.ghostTracker=x}let T=b-r.getCurPos(),N=B.length>0?B.split("").filter(e=>{let t=e.charCodeAt(0);return t>=32&&t<=126}).length/B.length:1,G=B.length>0&&N>=.8&&void 0===a;return ry('initial block: events=%d ghosts=%d ghostingSeq=%d controlObj=%d mission="%s" CRC=0x%s valid=%s%s',P.length,w.length,C,E,B,M.toString(16),G,a?` error=${a}`:""),{taggedStrings:i,dataBlockHeaders:o,dataBlockCount:l,dataBlocks:s,firstPerson:d,connectionFields:c,stateArray:h,scoreEntries:g,demoValues:p,sensorGroupColors:f,targetEntries:m,connectionState:F,roundTripTime:v,packetLoss:y,pathManager:S,notifyCount:k,nextRecvEventSeq:D,ghostingSequence:C,initialGhosts:w,initialEvents:P,controlObjectGhostIndex:E,controlObjectData:t,missionName:B,missionCRC:M,phase2TrailingBits:T,phase2Valid:G,phase2Error:a}}readScoreEntry(e){let t=e.readFlag()?e.readInt(16):0,a=e.readFlag()?e.readInt(16):0,r=e.readFlag()?e.readInt(16):0,i=e.readInt(6),n=e.readInt(6),o=e.readInt(6),s=e.readFlag(),l=[];for(let t=0;t<6;t++)l.push(e.readFlag());return{clientId:t,teamId:a,score:r,field0:i,field1:n,field2:o,isBot:s,triggerFlags:l}}readDemoValues(e){let t=[];for(;e.readFlag();)t.push(e.readString());return t}readComplexTargetManager(e){e.readU8(),e.readU8(),e.readU8(),e.readU8();let t=[];for(let a=0;a<32;a++)for(let r=0;r<32;r++)e.readFlag()&&t.push({group:a,targetGroup:r,r:e.readU8(),g:e.readU8(),b:e.readU8(),a:e.readU8()});let a=[];for(let t=0;t<512;t++){if(!e.readFlag())continue;let r={targetId:t,sensorGroup:0,targetData:0,damageLevel:0};e.readFlag()&&(r.sensorData=e.readU32()),e.readFlag()&&(r.voiceMapData=e.readU32()),e.readFlag()&&(r.name=e.readString()),e.readFlag()&&(r.skin=e.readString()),e.readFlag()&&(r.skinPref=e.readString()),e.readFlag()&&(r.voice=e.readString()),e.readFlag()&&(r.typeDescription=e.readString()),r.sensorGroup=e.readInt(5),r.targetData=e.readInt(9),t>=32&&e.readFlag()&&(r.dataBlockRef=e.readInt(11)),r.damageLevel=e.readFloat(7),a.push(r)}return{sensorGroupColors:t,targets:a}}readPathManager(e){let t=[],a=e.readU32();for(let r=0;rthis.registry.getDataBlockParser(e)};t=n.unpack(e,a)}catch{a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:i});break}else{a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:i});break}a.push({classId:r,guaranteed:!0,dataBitsStart:i,dataBitsEnd:e.getCurPos(),parsedData:t}),rS(" event classId=%d bits=%d",r,e.getCurPos()-i)}return{nextRecvEventSeq:t,events:a}}readGhostStartBlock(e,t){let a=e.readU32(),r=[];rS("ghost block: seq=%d bit=%d",a,e.getCurPos());let i=this.registry.getGhostCatalog(),n=8*e.getBuffer().length,o=new Map;for(let[e,a]of t)o.set(e,a.data);for(;e.readFlag()&&!e.isError();){let a=e.readInt(10),s=e.readInt(7)+0,l=e.getCurPos(),d=[],c=new Set,{entry:h}=this.identifyGhostViaDataBlock(e,t,i),u=this.registry.getGhostParser(s);u&&(d.push({entry:u,method:"registry"}),c.add(u)),h&&!c.has(h)&&(d.push({entry:h,method:"datablock"}),c.add(h));let g={getDataBlockData:e=>o.get(e),getDataBlockParser:e=>this.registry.getDataBlockParser(e)},p=!1;for(let{entry:t,method:i}of d){let o="registry"===i,d=this.tryGhostParser(e,t,l,n,!1,g,o);if(!1!==d){this.ghostTracker.createGhost(a,s,t.name),rS(" ghost idx=%d classId=%d parser=%s bits=%d via=%s",a,s,t.name,e.getCurPos()-l,i),r.push({index:a,type:"create",classId:s,updateBitsStart:l,updateBitsEnd:e.getCurPos(),parsedData:d}),p=!0;break}}if(!p){rS(" ghost idx=%d classId=%d NO PARSER (stopping at bit=%d, remaining=%d)",a,s,l,n-l);break}}return rS("ghost loop ended at bit=%d remaining=%d count=%d",e.getCurPos(),n-e.getCurPos(),r.length),{ghostingSequence:a,ghosts:r}}tryGhostParser(e,t,a,r,i=!1,n,o=!1){let s=e.savePos();i||rS(" try %s: startBit=%d",t.name,a);try{let l=t.unpackUpdate(e,!0,{compressionPoint:{x:0,y:0,z:0},ghostTracker:this.ghostTracker,...n}),d=e.getCurPos()-a,c=r-e.getCurPos();if(e.isError()||!o&&d<3)return i||rS(" reject %s: bits=%d isError=%s",t.name,d,e.isError()),e.restorePos(s),!1;if(c>1e3){let a=e.getCurPos(),r=e.readFlag();if(e.setCurPos(a),!r)return i||rS(" reject %s: bits=%d misaligned (remaining=%d)",t.name,d,c),e.restorePos(s),!1}return l??{}}catch(a){return i||rS(" reject %s: error at bit=%d: %s",t.name,e.getCurPos(),a instanceof Error?a.message:String(a)),e.restorePos(s),!1}}identifyGhostViaDataBlock(e,t,a){let r;if(!t)return{entry:void 0,dbFlag:!1};let i=e.savePos(),n=!1;try{if(n=e.readFlag()){let i=e.readInt(11),n=t.get(i);if(n){let e=n.className.replace(/Data$/,"");(r=a.get(e))||rS(" identifyGhostViaDataBlock: dbId=%d className=%s ghostName=%s (no ghost parser)",i,n.className,e)}else rS(" identifyGhostViaDataBlock: dbId=%d (no DataBlock found)",i)}else rS(" identifyGhostViaDataBlock: DataBlock flag=0")}catch{}return e.restorePos(i),{entry:r,dbFlag:n}}readRawMove(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getInt32(0,!0),r=t.getInt32(4,!0),i=t.getInt32(8,!0),n=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getFloat32(24,!0),d=t.getFloat32(28,!0),c=t.getFloat32(32,!0),h=t.getFloat32(36,!0),u=t.getFloat32(40,!0),g=t.getFloat32(44,!0),p=t.getUint32(48,!0),f=t.getUint32(52,!0),m=0!==e[56],F=[];for(let t=0;t<6;t++)F.push(0!==e[57+t]);return{px:a,py:r,pz:i,pyaw:n,ppitch:o,proll:s,x:l,y:d,z:c,yaw:h,pitch:u,roll:g,id:p,sendCount:f,freeLook:m,trigger:F}}readInfoBlock(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{value1:t.getUint32(0,!0),value2:t.getFloat32(4,!0)}}}function rI(){let e=new e6,t=new e4;ak(e),t3(e),rv(e),e.bindDeterministicDataBlocks(e3,128),e.bindDeterministicGhosts(e2,0),e.bindDeterministicEvents(e1,255);let a=new e8(e,t,{dataBlockDataMap:new Map});return{registry:e,ghostTracker:t,packetParser:a}}e.s(["DemoParser",()=>rb],58281),e.s(["createLiveParser",()=>rI],45853),e.s([],50593);var rx=e.i(90072);let rP=new Set(["FlyingVehicle","HoverVehicle","WheeledVehicle"]),rD=new Set(["BombProjectile","EnergyProjectile","FlareProjectile","GrenadeProjectile","LinearFlareProjectile","LinearProjectile","Projectile","SeekerProjectile","TracerProjectile"]),rC=new Set(["LinearProjectile","TracerProjectile","LinearFlareProjectile","Projectile"]),rw=new Set(["GrenadeProjectile","EnergyProjectile","FlareProjectile","BombProjectile"]),rE=new Set(["SeekerProjectile"]),rB=new Set(["StaticShape","ScopeAlwaysShape","Turret","BeaconObject","ForceFieldBare"]);function rM(e){return"Player"===e?"Player":rP.has(e)?"Vehicle":"Item"===e?"Item":rD.has(e)?"Projectile":rB.has(e)?"Deployable":"Ghost"}function rT(e,t){return`${e}_${t}`}let rN=Object.freeze({r:0,g:255,b:0}),rG=Object.freeze({r:255,g:0,b:0});e.s(["IFF_GREEN",0,rN,"IFF_RED",0,rG,"TICK_DURATION_MS",0,32,"ballisticProjectileClassNames",0,rw,"linearProjectileClassNames",0,rC,"projectileClassNames",0,rD,"seekerProjectileClassNames",0,rE,"toEntityId",()=>rT,"toEntityType",()=>rM],25311);let rR=new rx.Matrix4,rU=new rx.Quaternion;function rj(e,t,a){return ea?a:e}let rA=.494*Math.PI;function rV(e,t){let a=Math.sin(t),r=Math.cos(t),i=Math.sin(e),n=Math.cos(e);return rR.set(-i,n*a,-n*r,0,0,r,a,0,n,i*a,-i*r,0,0,0,0,1),rU.setFromRotationMatrix(rR),[rU.x,rU.y,rU.z,rU.w]}function rO(e){let t=-e/2;return[0,Math.sin(t),0,Math.cos(t)]}function rz(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(e.z)||!Number.isFinite(e.w))return null;let t=-e.y,a=-e.z,r=-e.x,i=e.w,n=t*t+a*a+r*r+i*i;if(n<=1e-12)return null;let o=1/Math.sqrt(n);return[t*o,a*o,r*o,i*o]}function rL(e){return Math.atan2(2*(e.w*e.z+e.x*e.y),e.w*e.w+e.x*e.x-e.y*e.y-e.z*e.z)}function rq(e){return Math.asin(Math.max(-1,Math.min(1,2*(e.w*e.x-e.y*e.z))))}function r_(e){return null!=e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function rH(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z}function rW(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w}function r$(e,t){let a;if(t)return"string"==typeof(a=rD.has(e)||e.endsWith("ProjectileData")?t.projectileShapeName:"DebrisData"===e?t.shapeFileName:t.shapeName)&&a.length>0?a:void 0}function rZ(e,t){if(e)for(let a of t){let t=e[a];if("number"==typeof t&&Number.isFinite(t))return t}}function rX(e,t){if(e)for(let a of t){let t=e[a];if("string"==typeof t&&t.length>0)return t}}function rJ(e,t){if(!t)return;let a=rX(t,["tracerTex0","textureName0","texture0"])??"";if(!("TracerProjectile"===e||a.length>0&&null!=rZ(t,["tracerLength"]))||!a)return;let r=rX(t,["tracerTex1","textureName1","texture1"]),i=rZ(t,["tracerLength"])??10,n=rZ(t,["tracerWidth"]),o=rZ(t,["tracerAlpha"]),s=null!=n&&(null!=rZ(t,["crossViewAng"])||n<=.7)?n:o??n??.5,l=rZ(t,["crossViewAng","crossViewFraction"])??("number"==typeof t.tracerWidth&&t.tracerWidth>.7?t.tracerWidth:.98);return{kind:"tracer",texture:a,crossTexture:r,tracerLength:i,tracerWidth:s,crossViewAng:l,crossSize:rZ(t,["crossSize","muzzleVelocity"])??.45,renderCross:function(e,t){if(e)for(let a of t){let t=e[a];if("boolean"==typeof t)return t}}(t,["renderCross","proximityRadius"])??!0}}function rY(e,t){if(t){if("LinearFlareProjectile"===e){let e=rX(t,["smokeTexture","flareTexture"]);if(!e)return;let a=t.flareColor,r=rZ(t,["size"])??.5;return{kind:"sprite",texture:e,color:a?{r:a.r,g:a.g,b:a.b}:{r:1,g:1,b:1},size:r}}if("FlareProjectile"===e){let e=rX(t,["flareTexture"]);if(!e)return;return{kind:"sprite",texture:e,color:{r:1,g:.9,b:.5},size:rZ(t,["size"])??4}}}}function rQ(e){let t=e.states;if(Array.isArray(t)&&0!==t.length)return t.map(e=>{let t=e=>null==e?-1:e-1;return{name:e.name??"",transitionOnNotLoaded:t(e.transitionOnAmmo),transitionOnLoaded:t(e.transitionOnNoAmmo),transitionOnNoAmmo:t(e.transitionOnTarget),transitionOnAmmo:t(e.transitionOnNoTarget),transitionOnNoTarget:t(e.transitionOnWet),transitionOnTarget:t(e.transitionOnNotWet),transitionOnNotWet:t(e.transitionOnTriggerUp),transitionOnWet:t(e.transitionOnTriggerDown),transitionOnTriggerUp:t(e.transitionOnTimeout),transitionOnTriggerDown:t(e.transitionGeneric0In),transitionOnTimeout:t(e.transitionGeneric0Out),timeoutValue:e.timeoutValue,waitForTimeout:e.waitForTimeout??!1,fire:e.fire??!1,sequence:e.sequence,spin:e.spin??0,direction:e.direction??!0,scaleAnimation:e.scaleAnimation??!1,loaded:e.loaded??0,soundDataBlockId:e.sound??-1}})}function rK(e){let t="";for(let a=0;a=32&&(t+=e[a]);return t}let r0={2:0,3:1,4:2,5:3,6:4,7:5,8:6,11:7,12:8,14:9};function r3(e){for(let t=0;t=32)break}}function r2(e){let t=[],a=0,r="",i=!1;for(let n=0;n=32&&(r+=e[n]);continue}let s=r0[o];void 0!==s?(r&&(t.push({text:r,colorCode:a}),r=""),a=s):15===o?(r&&(t.push({text:r,colorCode:a}),r=""),a=0):o>=32&&(r+=e[n])}return r&&t.push({text:r,colorCode:a}),t}function r1(e){let t=e.indexOf("~w");return -1===t?{text:e,wavPath:null}:{text:e.substring(0,t),wavPath:e.substring(t+2)}}function r5(e){return e?"number"==typeof e.cameraMode?"camera":"number"==typeof e.rotationZ?"player":null:null}let r8=new Map([["gui/hud_new_packammo",0],["gui/hud_new_packcloak",1],["gui/hud_new_packenergy",2],["gui/hud_new_packrepair",3],["gui/hud_new_packsatchel",4],["gui/hud_new_packshield",5],["gui/hud_new_packinventory",6],["gui/hud_new_packmotionsens",7],["gui/hud_new_packradar",8],["gui/hud_new_packturretout",9],["gui/hud_new_packturretin",10],["gui/hud_new_packsensjam",11],["gui/hud_new_packturret",12],["gui/hud_satchel_unarmed",18]]);function r6(e){let t=e.toLowerCase();for(let[e,a]of r8)if(e===t)return a;return -1}e.s(["CameraMode_OrbitObject",0,3,"MAX_PITCH",0,rA,"backpackBitmapToIndex",()=>r6,"clamp",()=>rj,"detectColorCode",()=>r3,"detectControlObjectType",()=>r5,"extractWavTag",()=>r1,"getNumberField",()=>rZ,"isQuatLike",()=>rW,"isValidPosition",()=>r_,"isVec3Like",()=>rH,"parseColorSegments",()=>r2,"parseWeaponImageStates",()=>rQ,"playerYawToQuaternion",()=>rO,"resolveShapeName",()=>r$,"resolveSpriteVisual",()=>rY,"resolveTracerVisual",()=>rJ,"stripTaggedStringMarkup",()=>rK,"torqueQuatHeading",()=>rL,"torqueQuatPitch",()=>rq,"torqueQuatToThreeJS",()=>rz,"yawPitchToQuaternion",()=>rV],89119),e.i(70847);var r4=e.i(47566);let r7=(0,e.i(25645).createLogger)("StreamEngine");class r9{registry;ghostTracker;entities=new Map;entityIdByGhostIndex=new Map;tickCount=0;camera=null;chatMessages=[];chatMessageIdCounter=0;_chatGen=0;_chatSnapshotGen=-1;_chatSnapshot=[];audioEvents=[];netStrings=new Map;targetNames=new Map;targetTeams=new Map;targetRenderFlags=new Map;pendingNameTags=new Map;sensorGroupColors=new Map;playerSensorGroup=0;lastStatus={health:1,energy:1};latestControl={ghostIndex:-1};controlPlayerGhostId;lastControlType="camera";isPiloting=!1;lastPilotGhostIndex;lastVehicleHeading=0;lastVehiclePitch=0;lastVehicleOrbitDir;lastVehicleVelocity;lastVehiclePosTime=0;lastVehiclePos;firstPerson=!0;lastCameraMode;lastOrbitGhostIndex;lastOrbitDistance;latestFov=90;weaponsHud={slots:new Map,activeIndex:-1};backpackHud={packIndex:-1,active:!1,text:""};inventoryHud={slots:new Map,activeSlot:-1};teamScores=[];playerRoster=new Map;missionDisplayName=null;missionTypeDisplayName=null;gameClassName=null;serverDisplayName=null;connectedPlayerName=null;onMissionInfoChange;nextExplosionId=0;resolveGhostClassName(e,t){if("number"==typeof t){let e=this.registry.getGhostParser(t)?.name;if(e)return e}let a=this.entityIdByGhostIndex.get(e);if(a){let e=this.entities.get(a);if(e?.className)return e.className}let r=this.ghostTracker.getGhost(e);if(r?.className)return r.className}resolveEntityIdForGhostIndex(e){let t=this.entityIdByGhostIndex.get(e);if(t)return t;let a=this.ghostTracker.getGhost(e);if(a)return rT(a.className,e)}resetSharedState(){this.entities.clear(),this.entityIdByGhostIndex.clear(),this.tickCount=0,this.camera=null,this.chatMessages=[],this.chatMessageIdCounter=0,this._chatGen=0,this._chatSnapshotGen=-1,this._chatSnapshot=[],this.audioEvents=[],this.netStrings.clear(),this.targetNames.clear(),this.targetTeams.clear(),this.targetRenderFlags.clear(),this.sensorGroupColors.clear(),this.playerSensorGroup=0,this.lastStatus={health:1,energy:1},this.latestControl={ghostIndex:-1},this.controlPlayerGhostId=void 0,this.lastControlType="camera",this.isPiloting=!1,this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0,this.firstPerson=!0,this.lastCameraMode=void 0,this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0,this.latestFov=90,this.weaponsHud={slots:new Map,activeIndex:-1},this.backpackHud={packIndex:-1,active:!1,text:""},this.inventoryHud={slots:new Map,activeSlot:-1},this.teamScores=[],this.playerRoster.clear(),this.nextExplosionId=0,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null,this.connectedPlayerName=null}resolveNetString(e){if(e.length>=2&&1===e.charCodeAt(0)){let t=parseInt(e.slice(1),10);if(Number.isFinite(t))return this.netStrings.get(t)??e}return e}formatRemoteArgs(e,t){let a=this.resolveNetString(e);for(let e=0;e0&&(this.playerSensorGroup=t.sensorGroup)}if(t){let e=r5(t);if(e&&(this.lastControlType=e),"player"===this.lastControlType)this.isPiloting=!!(t.pilot||null!=t.controlObjectGhost),this.isPiloting&&"number"==typeof t.controlObjectGhost?this.lastPilotGhostIndex=t.controlObjectGhost:this.isPiloting||(this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0);else if(this.isPiloting=!1,"number"==typeof t.cameraMode)if(this.lastCameraMode=t.cameraMode,3===t.cameraMode){"number"==typeof t.orbitObjectGhostIndex&&(this.lastOrbitGhostIndex=t.orbitObjectGhostIndex);let e=t.minOrbitDist,a=t.maxOrbitDist,r=t.curOrbitDist;"number"==typeof e&&"number"==typeof a&&Number.isFinite(e)&&Number.isFinite(a)?this.lastOrbitDistance=Math.max(0,a-e):"number"==typeof r&&Number.isFinite(r)&&(this.lastOrbitDistance=Math.max(0,r))}else this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0}void 0!==e.cameraFov&&(this.latestFov=e.cameraFov)}processEvent(e,t){let a=e.parsedData;if(!a)return;let r=a.type;if("GhostAlwaysObjectEvent"===r){let e=a.ghostIndex,t=a.classId,r=a.objectData,i=a._hasObjectData,n="number"==typeof t?this.registry.getGhostParser(t)?.name??`classId=${t}`:"?";r7.debug("GhostAlwaysObjectEvent: ghost=%d class=%s hasData=%s %s",e,n,i,r?`keys=[${Object.keys(r).join(",")}]`:"(no data)"),null!=e&&null!=t&&this.processGhostUpdate({index:e,type:"create",classId:t,parsedData:r});return}if("NetStringEvent"===r||"NetStringEvent"===t){let e=a.id,t=a.value;if(null!=e&&"string"==typeof t){this.netStrings.set(e,t);let a=this.pendingNameTags.get(e);if(null!=a){this.pendingNameTags.delete(e);let r=rK(t);for(let e of(this.targetNames.set(a,r),this.entities.values()))e.targetId===a&&(e.playerName=r)}}return}if("TargetInfoEvent"===r||"TargetInfoEvent"===t){let e=a.targetId,t=a.nameTag;if(null!=e&&null!=t){let a=this.netStrings.get(t);a?this.targetNames.set(e,rK(a)):this.pendingNameTags.set(t,e)}let r=a.sensorGroup;null!=e&&null!=r&&this.targetTeams.set(e,r);let i=a.renderFlags;if(null!=e&&null!=i&&this.targetRenderFlags.set(e,i),null!=e){let t=this.targetNames.get(e),a=this.targetTeams.get(e),r=this.targetRenderFlags.get(e);for(let i of this.entities.values())i.targetId===e&&(t&&(i.playerName=t),null!=a&&(i.sensorGroup=a),null!=r&&(i.targetRenderFlags=r))}return}if("SetSensorGroupEvent"===r||"SetSensorGroupEvent"===t){let e=a.sensorGroup;null!=e&&(this.playerSensorGroup=e);return}if("SensorGroupColorEvent"===r||"SensorGroupColorEvent"===t){let e=a.sensorGroup,t=a.colors;if(t){let a=this.sensorGroupColors.get(e);for(let r of(a||(a=new Map,this.sensorGroupColors.set(e,a)),t))r.default?a.delete(r.index):a.set(r.index,{r:r.r??0,g:r.g??0,b:r.b??0})}return}if("RemoteCommandEvent"===r||"RemoteCommandEvent"===t){let e=this.resolveNetString(a.funcName),t=a.args,r=this.getTimeSec();if("ChatMessage"===e&&t.length>=4){let e=r3(this.resolveNetString(t[3])),a=t[4]?rK(this.resolveNetString(t[4])):"",i=this.formatRemoteArgs(t[3],t.slice(4));if(i){let n,o,s=i.indexOf(": "),{text:l,wavPath:d}=r1(s>=0?i.slice(s+2):i);if(d){let e=this.resolveNetString(t[1]);n=e?`voice/${e}/${d}.wav`:d;let a=this.resolveNetString(t[2]);if(a){let e=parseFloat(a);Number.isFinite(e)&&(o=Math.max(.5,Math.min(2,e)))}}let c=e??0;this.pushChatMessage({timeSec:r,sender:a,text:l,kind:"chat",colorCode:c,segments:[{text:a?`${a}: ${l}`:l,colorCode:c}],soundPath:n,soundPitch:o})}}else if("CannedChatMessage"===e&&t.length>=6){let e=r3(this.resolveNetString(t[1])),a=rK(this.resolveNetString(t[2])),i=rK(this.resolveNetString(t[4])),n=this.formatRemoteArgs(t[1],t.slice(2));if(n){let o,s,{wavPath:l}=r1(n),d=r1(rK(this.resolveNetString(t[3]))).text;if(l){let e=this.resolveNetString(t[5]);if(o=e?`voice/${e}/${l}.wav`:l,t[6]){let e=parseFloat(this.resolveNetString(t[6]));Number.isFinite(e)&&(s=Math.max(.5,Math.min(2,e)))}}let c=e??0,h=[];i&&h.push({text:`[${i}] `,colorCode:0}),h.push({text:a?`${a}: ${d}`:d,colorCode:c}),this.pushChatMessage({timeSec:r,sender:a,text:d,kind:"chat",colorCode:c,segments:h,soundPath:o,soundPitch:s})}}else if("ServerMessage"===e&&t.length>=2){this.handleServerMessage(t);let e=r3(this.resolveNetString(t[1])),a=this.formatRemoteArgs(t[1],t.slice(2));if(a){let{text:t,wavPath:i}=r1(a),n=e??0;this.pushChatMessage({timeSec:r,sender:"",text:t,kind:"server",colorCode:n,segments:[{text:t,colorCode:n}],soundPath:i??void 0})}}else this.handleHudRemoteCommand(e,t);return}if("Sim3DAudioEvent"===r||"Sim2DAudioEvent"===r||"Sim3DAudioEvent"===t||"Sim2DAudioEvent"===t){let e=a.profileId;if("number"==typeof e){let i=this.getTimeSec(),n="Sim3DAudioEvent"===r||"Sim3DAudioEvent"===t?a.position:void 0;this.audioEvents.push({profileId:e,position:n,timeSec:i}),this.audioEvents.length>100&&this.audioEvents.splice(0,this.audioEvents.length-100)}}}processGhostUpdate(e){let t,a=e.index,r=this.entityIdByGhostIndex.get(a);if(r){let t=this.entities.get(r);t&&"Projectile"===t.type&&!t.hasExploded&&null!=t.explosionDataBlockId&&t.position&&("delete"===e.type||"create"===e.type)&&this.spawnExplosion(t,[...t.position])}if("delete"===e.type){r&&(this.removeSoundSlotEntities(r),this.entities.delete(r),this.entityIdByGhostIndex.delete(a));return}let i=this.resolveGhostClassName(a,e.classId);if(!i){if("create"===e.type)throw Error(`No ghost parser for classId ${e.classId} (ghost index ${a})`);return}let n=rT(i,a);r&&r!==n&&(this.removeSoundSlotEntities(r),this.entities.delete(r));let o=this.entities.get(n);if(o&&"create"===e.type?(this.removeSoundSlotEntities(n),o.spawnTick=this.tickCount,this.resetEntity(o),t=o):o?t=o:(t={id:n,ghostIndex:a,className:i,spawnTick:this.tickCount,type:rM(i),rotation:[0,0,0,1]},this.entities.set(n,t)),t.ghostIndex=a,t.className=i,t.type=rM(i),this.entityIdByGhostIndex.set(a,n),this.applyGhostData(t,e.parsedData),"create"===e.type&&e.parsedData){let r=(0,r4.ghostToSceneObject)(i,a,e.parsedData);r&&(t.sceneData=r)}}resetEntity(e){e.rotation=[0,0,0,1],e.hasExploded=void 0,e.explosionShape=void 0,e.explosionLifetimeTicks=void 0,e.faceViewer=void 0,e.simulatedVelocity=void 0,e.projectilePhysics=void 0,e.gravityMod=void 0,e.direction=void 0,e.velocity=void 0,e.position=void 0,e.dataBlock=void 0,e.dataBlockId=void 0,e.shapeHint=void 0,e.visual=void 0,e.targetId=void 0,e.targetRenderFlags=void 0,e.carryingFlag=void 0,e.sensorGroup=void 0,e.playerName=void 0,e.weaponShape=void 0,e.packShape=void 0,e.falling=void 0,e.jetting=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0,e.weaponImageStatesDbId=void 0,e.itemPhysics=void 0,e.threads=void 0,e.headPitch=void 0,e.headYaw=void 0,e.health=void 0,e.energy=void 0,e.maxEnergy=void 0,e.damageState=void 0,e.actionAnim=void 0,e.actionAtEnd=void 0,e.explosionDataBlockId=void 0,e.maintainEmitterId=void 0}applyGhostData(e,t){if(!t)return;let a=t.dataBlockId;if(null!=a){e.dataBlockId=a;let t=this.getDataBlockData(a),r=r$(e.className,t);if(e.visual=rJ(e.className,t)??rY(e.className,t),"string"==typeof r&&(e.shapeHint=r,e.dataBlock=r),"Player"===e.type&&"number"==typeof t?.maxEnergy&&(e.maxEnergy=t.maxEnergy),"Projectile"===e.type&&(rC.has(e.className)?e.projectilePhysics="linear":rw.has(e.className)?(e.projectilePhysics="ballistic",e.gravityMod=rZ(t,["gravityMod"])??1):rE.has(e.className)&&(e.projectilePhysics="seeker")),"Projectile"===e.type&&null==e.explosionDataBlockId){let t=this.resolveExplosionInfo(a);t&&(e.explosionShape=t.shape,e.faceViewer=t.faceViewer,e.explosionLifetimeTicks=t.lifetimeTicks,e.explosionDataBlockId=t.explosionDataBlockId)}if("Projectile"===e.type&&null==e.maintainEmitterId){let a=t?.baseEmitter;"number"==typeof a&&a>0&&(e.maintainEmitterId=a)}}if("Player"===e.type){let a=t.images;if(Array.isArray(a)&&a.length>0){let t=a.find(e=>0===e.index);if(t?.dataBlockId&&t.dataBlockId>0){let a=this.getDataBlockData(t.dataBlockId),r=r$("ShapeBaseImageData",a);if(r){let t=a?.mountPoint;(null==t||t<=0)&&!/pack_/i.test(r)&&(e.weaponShape=r)}let i=e.weaponImageState;e.weaponImageState={dataBlockId:t.dataBlockId,triggerDown:t.triggerDown??i?.triggerDown??!1,ammo:t.ammo??i?.ammo??!0,loaded:t.loaded??i?.loaded??!0,target:t.target??i?.target??!1,wet:t.wet??i?.wet??!1,fireCount:t.fireCount??i?.fireCount??0},a&&e.weaponImageStatesDbId!==t.dataBlockId&&(e.weaponImageStates=rQ(a),e.weaponImageStatesDbId=t.dataBlockId)}else t&&!t.dataBlockId&&(e.weaponShape=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0);let r=a.find(e=>2===e.index);if(r?.dataBlockId&&r.dataBlockId>0){let t=r$("ShapeBaseImageData",this.getDataBlockData(r.dataBlockId));t&&(e.packShape=t)}else r&&!r.dataBlockId&&(e.packShape=void 0);let i=a.find(e=>3===e.index);if(i?.dataBlockId&&i.dataBlockId>0){e.carryingFlag=!0;let t=r$("ShapeBaseImageData",this.getDataBlockData(i.dataBlockId));if(t&&(e.flagShape=t),null!=e.targetId&&e.targetId>=0){let t=this.targetRenderFlags.get(e.targetId)??0,a=2|t;a!==t&&(this.targetRenderFlags.set(e.targetId,a),e.targetRenderFlags=a)}}else if(i&&!i.dataBlockId&&(e.carryingFlag=!1,e.flagShape=void 0,null!=e.targetId&&e.targetId>=0)){let t=this.targetRenderFlags.get(e.targetId)??0,a=-3&t;a!==t&&(this.targetRenderFlags.set(e.targetId,a),e.targetRenderFlags=a)}}}let r=r_(t.position)?t.position:r_(t.initialPosition)?t.initialPosition:r_(t.explodePosition)?t.explodePosition:r_(t.endPoint)?t.endPoint:r_(t.transform?.position)?t.transform.position:void 0;r&&(e.position=[r.x,r.y,r.z],this.updateSoundSlotPositions(e));let i=rH(t.direction)?t.direction:void 0;if(i&&(e.direction=[i.x,i.y,i.z]),"Player"===e.type&&"number"==typeof t.rotationZ&&(e.rotation=rO(t.rotationZ)),"Player"===e.type&&("number"==typeof t.headX&&(e.headPitch=t.headX),"number"==typeof t.headZ&&(e.headYaw=t.headZ)),rW(t.angPosition)){let a=rz(t.angPosition);a&&(e.rotation=a)}else if(rW(t.transform?.rotation)){let a=rz(t.transform.rotation);a&&(e.rotation=a)}else if("Item"===e.type&&"number"==typeof t.rotation?.angle){let a=t.rotation;e.rotation=rO((a.zSign??1)*a.angle)}else if("Projectile"===e.type){let a=t.velocity??t.direction??(r_(t.initialPosition)&&r_(t.endPos)?{x:t.endPos.x-t.initialPosition.x,y:t.endPos.y-t.initialPosition.y,z:t.endPos.z-t.initialPosition.z}:void 0);rH(a)&&(0!==a.x||0!==a.y)&&(e.rotation=rO(Math.atan2(a.x,a.y)))}if(rH(t.velocity)&&(e.velocity=[t.velocity.x,t.velocity.y,t.velocity.z],e.direction||(e.direction=[t.velocity.x,t.velocity.y,t.velocity.z])),"boolean"==typeof t.moveFlag0&&(e.falling=t.moveFlag0),"boolean"==typeof t.moveFlag1&&(e.jetting=t.moveFlag1),"Item"===e.type){let a=t.atRest;!1===a&&rH(t.velocity)?e.itemPhysics={velocity:[t.velocity.x,t.velocity.y,t.velocity.z],atRest:!1}:!0===a&&(e.itemPhysics=void 0)}if(e.projectilePhysics){if("linear"===e.projectilePhysics){let a=rZ(null!=e.dataBlockId?this.getDataBlockData(e.dataBlockId):void 0,["dryVelocity","muzzleVelocity","bulletVelocity"])??80,r=e.direction??[0,1,0],i=r[0]*a,n=r[1]*a,o=r[2]*a,s=t.excessVel,l=t.excessDir;"number"==typeof s&&s>0&&rH(l)&&(i+=l.x*s,n+=l.y*s,o+=l.z*s),e.simulatedVelocity=[i,n,o]}else rH(t.velocity)&&(e.simulatedVelocity=[t.velocity.x,t.velocity.y,t.velocity.z]);let a=t.currTick;if("number"==typeof a&&a>0&&e.simulatedVelocity&&e.position){let t=.032*a,r=e.simulatedVelocity;if(e.position[0]+=r[0]*t,e.position[1]+=r[1]*t,e.position[2]+=r[2]*t,"ballistic"===e.projectilePhysics){let a=-9.81*(e.gravityMod??1);e.position[2]+=.5*a*t*t,r[2]+=a*t}}}let n=r_(t.explodePosition)?t.explodePosition:r_(t.explodePoint)?t.explodePoint:void 0;if("Projectile"===e.type&&!e.hasExploded&&n&&null!=e.explosionDataBlockId&&this.spawnExplosion(e,[n.x,n.y,n.z]),"number"==typeof t.damageLevel&&(e.health=rj(1-t.damageLevel,0,1)),"number"==typeof t.damageState&&(e.damageState=t.damageState),"number"==typeof t.action&&(e.actionAnim=t.action,e.actionAtEnd=!!t.actionAtEnd),Array.isArray(t.threads)){let a=t.threads;if(e.threads){let t=[...e.threads];for(let e of a){let a=t.findIndex(t=>t.index===e.index);a>=0?t[a]=e:t.push(e)}e.threads=t}else e.threads=a}if("number"==typeof t.energy&&(e.energy=rj(t.energy,0,1)),"number"==typeof t.targetId){e.targetId=t.targetId;let a=this.targetNames.get(t.targetId);a&&(e.playerName=a);let r=this.targetTeams.get(t.targetId);null!=r&&(e.sensorGroup=r,e.ghostIndex===this.latestControl.ghostIndex&&"player"===this.lastControlType&&(this.playerSensorGroup=r));let i=this.targetRenderFlags.get(t.targetId);null!=i&&(e.targetRenderFlags=i)}let o=t.sounds;Array.isArray(o)&&this.syncSoundSlotEntities(e,o),"WayPoint"===e.className&&"string"==typeof t.name&&(e.label=t.name),"AudioEmitter"===e.className&&("string"==typeof t.filename&&(e.audioFileName=t.filename),"number"==typeof t.volume&&(e.audioVolume=t.volume),"boolean"==typeof t.is3D&&(e.audioIs3D=t.is3D),"boolean"==typeof t.isLooping&&(e.audioIsLooping=t.isLooping),"number"==typeof t.minDistance&&(e.audioMinDistance=t.minDistance),"number"==typeof t.maxDistance&&(e.audioMaxDistance=t.maxDistance),"number"==typeof t.minLoopGap&&(e.audioMinLoopGap=t.minLoopGap),"number"==typeof t.maxLoopGap&&(e.audioMaxLoopGap=t.maxLoopGap))}syncSoundSlotEntities(e,t){for(let a of t){let t=`${e.id}:sound:${a.index}`;if(a.playing&&"number"==typeof a.profileId){let r=this.getDataBlockData(a.profileId),i=r?.filename;if(!i)continue;let n=i.endsWith(".wav")?i:`${i}.wav`,o=r.description,s=null!=o?this.getDataBlockData(o):void 0,l=this.entities.get(t);l?l.position=e.position:this.entities.set(t,{id:t,ghostIndex:e.ghostIndex,className:"AudioEmitter",type:"AudioEmitter",spawnTick:this.tickCount,position:e.position,rotation:[0,0,0,1],audioFileName:n,audioVolume:s?.volume??1,audioIs3D:s?.is3D??!0,audioIsLooping:s?.isLooping??!1,audioMinDistance:s?.referenceDistance??20,audioMaxDistance:s?.maxDistance??100,audioMinLoopGap:s?.minLoopGap??0,audioMaxLoopGap:s?.maxLoopGap??0})}else this.entities.delete(t)}}updateSoundSlotPositions(e){for(let t=0;t<4;t++){let a=this.entities.get(`${e.id}:sound:${t}`);a&&(a.position=e.position)}}removeSoundSlotEntities(e){for(let t=0;t<4;t++)this.entities.delete(`${e}:sound:${t}`)}resolveExplosionInfo(e){let t=this.getDataBlockData(e);if(!t)return;let a=t.explosion;if(null==a)return;let r=this.getDataBlockData(a);if(!r)return;let i=r.dtsFileName||void 0,n=r.lifetimeMS??31;return{shape:i,faceViewer:!1!==r.faceViewer&&0!==r.faceViewer,lifetimeTicks:n,explosionDataBlockId:a}}spawnExplosion(e,t){e.hasExploded=!0;let a=e.explosionLifetimeTicks??31,r=`fx_${this.nextExplosionId++}`,i={id:r,ghostIndex:-1,className:"Explosion",spawnTick:this.tickCount,type:"Explosion",dataBlock:e.explosionShape,explosionDataBlockId:e.explosionDataBlockId,position:t,rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==e.faceViewer,expiryTick:this.tickCount+a};if(this.entities.set(r,i),null!=e.explosionDataBlockId){let a=this.getDataBlockData(e.explosionDataBlockId),r=a?.subExplosions;if(Array.isArray(r))for(let e of r){if(null==e)continue;let a=this.getDataBlockData(e);if(!a)continue;let r=a.dtsFileName||void 0;if(!r)continue;let i=a.lifetimeMS??31,n=a.offset??0,o=Math.random()*Math.PI*2,s=[t[0]+Math.cos(o)*n,t[1]+Math.sin(o)*n,t[2]],l=`fx_${this.nextExplosionId++}`,d={id:l,ghostIndex:-1,className:"Explosion",spawnTick:this.tickCount,type:"Explosion",dataBlock:r,explosionDataBlockId:e,position:s,rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==a.faceViewer&&0!==a.faceViewer,expiryTick:this.tickCount+i};this.entities.set(l,d)}}e.position=void 0,e.simulatedVelocity=void 0}advanceProjectiles(){for(let e of this.entities.values()){if(!e.simulatedVelocity||!e.position)continue;let t=e.simulatedVelocity,a=e.position;"ballistic"===e.projectilePhysics&&(t[2]+=-9.81*(e.gravityMod??1)*.032),a[0]+=.032*t[0],a[1]+=.032*t[1],a[2]+=.032*t[2],(0!==t[0]||0!==t[1])&&(e.rotation=rO(Math.atan2(t[0],t[1])))}}advanceItems(){for(let e of this.entities.values()){let t=e.itemPhysics;if(!t||t.atRest||!e.position)continue;let a=t.velocity,r=e.position;r[0]+=.032*a[0],r[1]+=.032*a[1],r[2]+=.032*a[2]}}removeExpiredExplosions(){for(let[e,t]of this.entities)t.isExplosion&&null!=t.expiryTick&&this.tickCount>=t.expiryTick&&this.entities.delete(e)}updateCameraAndHud(){let e=this.latestControl,t=this.getTimeSec(),a=e.data,r=this.lastControlType;if(this.removeExpiredExplosions(),e.position){let{yaw:i,pitch:n}=this.getCameraYawPitch(a);if(this.isPiloting){if(a){let e=a.controlObjectData,t=e?.angPosition;if(t&&"number"==typeof t.w){this.lastVehicleHeading=rL(t),this.lastVehiclePitch=rq(t);let e=rz(t);if(e){let[t,a,r,i]=e;this.lastVehicleOrbitDir=[-(1-2*(a*a+r*r)),-(2*(t*a+r*i)),-(2*(t*r-a*i))]}}}i=this.lastVehicleHeading,n=this.lastVehiclePitch}if(this.camera={time:t,position:[e.position.x,e.position.y,e.position.z],rotation:rV(i,rj(n,-rA,rA)),fov:this.latestFov,mode:"observer",yaw:i,pitch:n},"camera"===r)if(("number"==typeof a?.cameraMode?a.cameraMode:this.lastCameraMode)===3){this.camera.mode="third-person","number"==typeof this.lastOrbitDistance&&(this.camera.orbitDistance=this.lastOrbitDistance);let e="number"==typeof a?.orbitObjectGhostIndex?a.orbitObjectGhostIndex:this.lastOrbitGhostIndex;"number"==typeof e&&e>=0&&(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(e))}else this.camera.mode="observer";else e.ghostIndex>=0&&(this.controlPlayerGhostId=this.resolveEntityIdForGhostIndex(e.ghostIndex)),this.firstPerson?this.camera.mode="first-person":(this.camera.mode="third-person",this.isPiloting&&null!=this.lastPilotGhostIndex?(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),this.camera.orbitDistance=15,this.lastVehicleOrbitDir&&(this.camera.orbitDirection=this.lastVehicleOrbitDir)):(this.camera.orbitTargetId=this.controlPlayerGhostId,this.camera.orbitDistance=3)),this.controlPlayerGhostId&&(this.camera.controlEntityId=this.controlPlayerGhostId);if("player"===r&&e.position){if(this.isPiloting&&null!=this.lastPilotGhostIndex){let r=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),i=r?this.entities.get(r):void 0;if(i){let r=a?.controlObjectData;if(r){i.position=[e.position.x,e.position.y,e.position.z],this.lastVehiclePos=i.position.slice(),this.lastVehiclePosTime=t;let a=r.linMomentum;if(a&&r_(a)){let e=i.dataBlockId,t=null!=e?this.getDataBlockData(e):void 0,r=t?.mass??200,n=r>0?1/r:.005;this.lastVehicleVelocity=[a.x*n,a.y*n,a.z*n],i.velocity=this.lastVehicleVelocity}let n=r.angPosition;if(n&&"number"==typeof n.w){let e=rz(n);e&&(i.rotation=e)}}else if(this.lastVehiclePos&&this.lastVehicleVelocity&&this.lastVehiclePosTime>0){let e=t-this.lastVehiclePosTime;if(e>0&&e<1){let[t,a,r]=this.lastVehicleVelocity;i.position=[this.lastVehiclePos[0]+t*e,this.lastVehiclePos[1]+a*e,this.lastVehiclePos[2]+r*e]}}}}else if(this.controlPlayerGhostId){let t=this.entities.get(this.controlPlayerGhostId);if(t){t.position=[e.position.x,e.position.y,e.position.z],t.rotation=rO(i),t.headPitch=this.getControlPlayerHeadPitch(n);let r=a?.velocity;rH(r)&&(t.velocity=[r.x,r.y,r.z],t.falling=r.z<-10)}}}}else this.camera&&(this.camera={...this.camera,time:t,fov:this.latestFov});let i={health:1,energy:1};if(this.camera?.mode==="first-person"){let e=this.controlPlayerGhostId,t=e?this.entities.get(e):void 0;i.health=t?.health??1;let r=a?.energyLevel;if("number"==typeof r){let e=t?.maxEnergy??60;e>0&&(i.energy=rj(r/e,0,1))}else i.energy=t?.energy??1}else if(this.camera?.mode==="third-person"&&this.camera.orbitTargetId){let e=this.entities.get(this.camera.orbitTargetId);i.health=e?.health??1,i.energy=e?.energy??1}this.lastStatus=i}getControlPlayerHeadPitch(e){return rj(e/rA,-1,1)}getAbsoluteRotation(e){return e?"number"==typeof e.rotationZ&&"number"==typeof e.headX?{yaw:e.rotationZ,pitch:e.headX}:"number"==typeof e.rotZ&&"number"==typeof e.rotX?{yaw:e.rotZ,pitch:e.rotX}:null:null}resolveIffColor(e){if(0===this.playerSensorGroup)return;let t=this.sensorGroupColors.get(this.playerSensorGroup);if(t){let a=t.get(e);if(a)return a}return e===this.playerSensorGroup?rN:0!==e?rG:void 0}pushChatMessage(e){this.chatMessages.push({...e,id:++this.chatMessageIdCounter}),this.chatMessages.length>200&&this.chatMessages.splice(0,this.chatMessages.length-200),this._chatGen++}handleServerMessage(e){if(e.length<2)return;let t=this.resolveNetString(e[0]);if("MsgTeamScoreIs"===t&&e.length>=4){let t=parseInt(this.resolveNetString(e[2]),10),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(t)&&!isNaN(a)){let e=this.teamScores.find(e=>e.teamId===t);e&&(e.score=a,this.onTeamScoresChanged())}}else if("MsgCTFAddTeam"===t&&e.length>=6){let t=parseInt(this.resolveNetString(e[2]),10),a=rK(this.resolveNetString(e[3])),r=parseInt(this.resolveNetString(e[5]),10);if(!isNaN(t)){let e=t+1,i=this.teamScores.find(t=>t.teamId===e);i?(i.name=a,i.score=isNaN(r)?i.score:r):this.teamScores.push({teamId:e,name:a,score:isNaN(r)?0:r,playerCount:0}),this.onTeamScoresChanged()}}else if("MsgClientJoin"===t&&e.length>=4){let t=rK(this.resolveNetString(e[2])).trim(),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(a)){let e=this.playerRoster.get(a);this.playerRoster.set(a,{name:t,teamId:e?.teamId??0}),this.onRosterChanged()}!this.connectedPlayerName&&t&&rK(this.resolveNetString(e[1])).includes("Welcome to Tribes")&&(this.connectedPlayerName=t,this.onMissionInfoChange?.())}else if("MsgClientDrop"===t&&e.length>=3){let t=parseInt(this.resolveNetString(e[2]),10);isNaN(t)||(this.playerRoster.delete(t),this.onRosterChanged())}else if("MsgClientJoinTeam"===t&&e.length>=4){let t=parseInt(this.resolveNetString(e[2]),10),a=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(t)&&!isNaN(a)){let e=this.playerRoster.get(t);e?e.teamId=a:this.playerRoster.set(t,{name:"",teamId:a}),this.onRosterChanged()}}else if("MsgMissionDropInfo"===t&&e.length>=5){let t=rK(this.resolveNetString(e[2])),a=rK(this.resolveNetString(e[3])),r=rK(this.resolveNetString(e[4]));r7.info("mission drop info: mission=%s gameType=%s server=%s",t,a,r),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=a||this.missionTypeDisplayName,this.serverDisplayName=r||this.serverDisplayName,this.onMissionInfoChange?.()}else if("MsgLoadInfo"===t&&e.length>=5){let t=rK(this.resolveNetString(e[3])),a=rK(this.resolveNetString(e[4]));r7.info("load info: mission=%s gameType=%s",t,a),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=a||this.missionTypeDisplayName,this.onMissionInfoChange?.()}else if("MsgClientReady"===t&&e.length>=3){let t=this.resolveNetString(e[2]);r7.info("client ready: gameClass=%s",t),this.gameClassName=t||this.gameClassName,this.onMissionInfoChange?.()}}onTeamScoresChanged(){}onRosterChanged(){}handleHudRemoteCommand(e,t){if("setWeaponsHudItem"===e&&t.length>=3){let e=parseInt(t[0],10),a=parseInt(t[1],10),r="1"===t[2]||"true"===t[2];isNaN(e)||(r?this.weaponsHud.slots.set(e,isNaN(a)?-1:a):this.weaponsHud.slots.delete(e),this.onWeaponsHudChanged())}else if("setWeaponsHudAmmo"===e&&t.length>=2){let e=parseInt(t[0],10),a=parseInt(t[1],10);isNaN(e)||(this.weaponsHud.slots.set(e,isNaN(a)?-1:a),this.onWeaponsHudChanged())}else if("setWeaponsHudActive"===e&&t.length>=1){let e=parseInt(t[0],10);this.weaponsHud.activeIndex=isNaN(e)?-1:e,isNaN(e)||!(e>=0)||this.weaponsHud.slots.has(e)||this.weaponsHud.slots.set(e,-1),this.onWeaponsHudChanged()}else if("setWeaponsHudClearAll"===e)this.weaponsHud.slots.clear(),this.weaponsHud.activeIndex=-1,this.onWeaponsHudChanged();else if("setBackpackHudItem"===e&&t.length>=2){let e=parseInt(t[0],10);"1"!==t[1]&&"true"!==t[1]||isNaN(e)?this.backpackHud.packIndex=-1:this.backpackHud.packIndex=e,this.backpackHud.active=!1,this.backpackHud.text=""}else if("setSatchelArmed"===e)this.backpackHud.active=!0;else if("setCloakIconOn"===e||"setRepairPackIconOn"===e||"setShieldIconOn"===e||"setSenJamIconOn"===e)this.backpackHud.active=!0;else if("setCloakIconOff"===e||"setRepairPackIconOff"===e||"setShieldIconOff"===e||"setSenJamIconOff"===e)this.backpackHud.active=!1;else if("updatePackText"===e&&t.length>=1)this.backpackHud.text=t[0]??"";else if("setInventoryHudItem"===e&&t.length>=3){let e=parseInt(t[0],10),a=parseInt(t[1],10),r="1"===t[2]||"true"===t[2];isNaN(e)||(r&&!isNaN(a)?this.inventoryHud.slots.set(e,a):this.inventoryHud.slots.delete(e),this.onInventoryHudChanged())}else if("setInventoryHudAmount"===e&&t.length>=2){let e=parseInt(t[0],10),a=parseInt(t[1],10);isNaN(e)||isNaN(a)||(this.inventoryHud.slots.set(e,a),this.onInventoryHudChanged())}else"setInventoryHudClearAll"===e&&(this.inventoryHud.slots.clear(),this.inventoryHud.activeSlot=-1,this.onInventoryHudChanged())}onWeaponsHudChanged(){}onInventoryHudChanged(){}buildEntityList(e){let t=[];for(let a of this.entities.values()){if(e&&!e(a))continue;let r=null!=a.targetId&&a.targetId>=0?this.targetRenderFlags.get(a.targetId)??a.targetRenderFlags:a.targetRenderFlags;"Player"!==a.type||a.carryingFlag||(r=null!=r?-3&r:r),t.push({id:a.id,type:a.type,visual:a.visual,direction:a.direction,ghostIndex:a.ghostIndex,className:a.className,dataBlockId:a.dataBlockId,shapeHint:a.shapeHint,dataBlock:a.dataBlock,weaponShape:a.weaponShape,packShape:a.packShape,flagShape:a.flagShape,falling:a.falling,jetting:a.jetting,playerName:a.playerName,targetRenderFlags:r,iffColor:("Player"===a.type||((r??0)&2)!=0)&&null!=a.sensorGroup?this.resolveIffColor(a.sensorGroup):void 0,position:a.position&&(a.simulatedVelocity||a.itemPhysics&&!a.itemPhysics.atRest)?[...a.position]:a.position,rotation:a.rotation,velocity:a.velocity,health:a.health,energy:a.energy,actionAnim:a.actionAnim,actionAtEnd:a.actionAtEnd,damageState:a.damageState,faceViewer:a.faceViewer,threads:a.threads,explosionDataBlockId:a.explosionDataBlockId,maintainEmitterId:a.maintainEmitterId,weaponImageState:a.weaponImageState,weaponImageStates:a.weaponImageStates,headPitch:a.headPitch,headYaw:a.headYaw,label:a.label,audioFileName:a.audioFileName,audioVolume:a.audioVolume,audioIs3D:a.audioIs3D,audioIsLooping:a.audioIsLooping,audioMinDistance:a.audioMinDistance,audioMaxDistance:a.audioMaxDistance,audioMinLoopGap:a.audioMinLoopGap,audioMaxLoopGap:a.audioMaxLoopGap,sceneData:a.sceneData})}return t}buildHudState(){let e={slots:Array.from(this.weaponsHud.slots.entries()).map(([e,t])=>({index:e,ammo:t})),activeIndex:this.weaponsHud.activeIndex},t={slots:Array.from(this.inventoryHud.slots.entries()).map(([e,t])=>({slot:e,count:t})),activeSlot:this.inventoryHud.activeSlot},a=this.backpackHud.packIndex>=0?{...this.backpackHud}:null,r=this.teamScores.map(e=>({...e})),i=new Map;for(let{teamId:e}of this.playerRoster.values())e>0&&i.set(e,(i.get(e)??0)+1);for(let e of r)e.playerCount=i.get(e.teamId)??0;return{weaponsHud:e,inventoryHud:t,backpackHud:a,teamScores:r}}buildTimeFilteredEvents(e){return this._chatSnapshotGen!==this._chatGen&&(this._chatSnapshot=this.chatMessages.slice(),this._chatSnapshotGen=this._chatGen),{chatMessages:this._chatSnapshot,audioEvents:this.audioEvents.filter(t=>t.timeSec>e-.5&&t.timeSec<=e)}}}e.s(["StreamEngine",()=>r9],10244)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/16e2b7e83646cebc.js b/docs/_next/static/chunks/16e2b7e83646cebc.js deleted file mode 100644 index 39aca2ef..00000000 --- a/docs/_next/static/chunks/16e2b7e83646cebc.js +++ /dev/null @@ -1,521 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65883,e=>{e.v({ButtonGroup:"InspectorControls-module__gNRB6W__ButtonGroup",ButtonHint:"InspectorControls-module__gNRB6W__ButtonHint",ButtonLabel:"InspectorControls-module__gNRB6W__ButtonLabel",CheckboxField:"InspectorControls-module__gNRB6W__CheckboxField",Control:"InspectorControls-module__gNRB6W__Control",Description:"InspectorControls-module__gNRB6W__Description",Dropdown:"InspectorControls-module__gNRB6W__Dropdown",Field:"InspectorControls-module__gNRB6W__Field",ForceRenderButton:"InspectorControls-module__gNRB6W__ForceRenderButton",Group:"InspectorControls-module__gNRB6W__Group",IconButton:"InspectorControls-module__gNRB6W__IconButton",InspectorControls:"InspectorControls-module__gNRB6W__InspectorControls",Label:"InspectorControls-module__gNRB6W__Label",LabelledButton:"InspectorControls-module__gNRB6W__LabelledButton",MapInfoButton:"InspectorControls-module__gNRB6W__MapInfoButton InspectorControls-module__gNRB6W__IconButton InspectorControls-module__gNRB6W__LabelledButton",Toggle:"InspectorControls-module__gNRB6W__Toggle InspectorControls-module__gNRB6W__IconButton",Tools:"InspectorControls-module__gNRB6W__Tools"})},36679,e=>{e.v({ButtonLabel:"CopyCoordinatesButton-module__BxovtG__ButtonLabel "+e.i(65883).ButtonLabel,ClipboardCheck:"CopyCoordinatesButton-module__BxovtG__ClipboardCheck",MapPin:"CopyCoordinatesButton-module__BxovtG__MapPin",Root:"CopyCoordinatesButton-module__BxovtG__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,showClipboardCheck:"CopyCoordinatesButton-module__BxovtG__showClipboardCheck"})},28903,e=>{e.v({ButtonHint:"LoadDemoButton-module__kGZaoW__ButtonHint "+e.i(65883).ButtonHint,ButtonLabel:"LoadDemoButton-module__kGZaoW__ButtonLabel "+e.i(65883).ButtonLabel,Root:"LoadDemoButton-module__kGZaoW__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton})},9607,e=>{e.v({ButtonHint:"JoinServerButton-module__DIR70a__ButtonHint "+e.i(65883).ButtonHint,PingLabel:"JoinServerButton-module__DIR70a__PingLabel "+e.i(65883).ButtonLabel,Pulsing:"JoinServerButton-module__DIR70a__Pulsing",Root:"JoinServerButton-module__DIR70a__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,TextLabel:"JoinServerButton-module__DIR70a__TextLabel "+e.i(65883).ButtonLabel,blink:"JoinServerButton-module__DIR70a__blink"})},81323,e=>{e.v({AccordionGroup:"Accordion-module__rN-DYq__AccordionGroup",Body:"Accordion-module__rN-DYq__Body",Content:"Accordion-module__rN-DYq__Content",Trigger:"Accordion-module__rN-DYq__Trigger",TriggerIcon:"Accordion-module__rN-DYq__TriggerIcon",slideDown:"Accordion-module__rN-DYq__slideDown",slideUp:"Accordion-module__rN-DYq__slideUp"})},16964,e=>{e.v({ActionButton:"StreamingMissionInfo-module__hEaQnW__ActionButton "+e.i(65883).IconButton,Attribution:"StreamingMissionInfo-module__hEaQnW__Attribution",EjectIcon:"StreamingMissionInfo-module__hEaQnW__EjectIcon",Error:"StreamingMissionInfo-module__hEaQnW__Error",Header:"StreamingMissionInfo-module__hEaQnW__Header",Metadata:"StreamingMissionInfo-module__hEaQnW__Metadata",MissionInfo:"StreamingMissionInfo-module__hEaQnW__MissionInfo",MissionName:"StreamingMissionInfo-module__hEaQnW__MissionName "+e.i(97442).SelectedName,MissionType:"StreamingMissionInfo-module__hEaQnW__MissionType "+e.i(97442).ItemType,MissionTypeDisplayName:"StreamingMissionInfo-module__hEaQnW__MissionTypeDisplayName",PlayerName:"StreamingMissionInfo-module__hEaQnW__PlayerName",RecordingDate:"StreamingMissionInfo-module__hEaQnW__RecordingDate",ServerInfo:"StreamingMissionInfo-module__hEaQnW__ServerInfo",ServerName:"StreamingMissionInfo-module__hEaQnW__ServerName"})},29418,e=>{e.v({Bottom:"PlayerNameplate-module__zYDm0a__Bottom PlayerNameplate-module__zYDm0a__Root",HealthBar:"PlayerNameplate-module__zYDm0a__HealthBar",HealthFill:"PlayerNameplate-module__zYDm0a__HealthFill",IffArrow:"PlayerNameplate-module__zYDm0a__IffArrow",Name:"PlayerNameplate-module__zYDm0a__Name",Root:"PlayerNameplate-module__zYDm0a__Root",Top:"PlayerNameplate-module__zYDm0a__Top PlayerNameplate-module__zYDm0a__Root"})},78779,e=>{e.v({Distance:"FlagMarker-module__INpLba__Distance",Icon:"FlagMarker-module__INpLba__Icon",Root:"FlagMarker-module__INpLba__Root"})},89271,e=>{e.v({LoadingIndicator:"LoadingIndicator-module__F20Nda__LoadingIndicator",Progress:"LoadingIndicator-module__F20Nda__Progress",ProgressBar:"LoadingIndicator-module__F20Nda__ProgressBar",ProgressText:"LoadingIndicator-module__F20Nda__ProgressText",Spinner:"LoadingIndicator-module__F20Nda__Spinner",loadingComplete:"LoadingIndicator-module__F20Nda__loadingComplete",spin:"LoadingIndicator-module__F20Nda__spin"})},82156,e=>{e.v({Backdrop:"MapInspector-module__nU0WNq__Backdrop",CancelButton:"MapInspector-module__nU0WNq__CancelButton",Content:"MapInspector-module__nU0WNq__Content",Frame:"MapInspector-module__nU0WNq__Frame",PlayerBar:"MapInspector-module__nU0WNq__PlayerBar",Sidebar:"MapInspector-module__nU0WNq__Sidebar",ThreeView:"MapInspector-module__nU0WNq__ThreeView",ToggleSidebarButton:"MapInspector-module__nU0WNq__ToggleSidebarButton",Toolbar:"MapInspector-module__nU0WNq__Toolbar",layout:"MapInspector-module__nU0WNq__layout"})},31713,e=>{"use strict";var t,r=e.i(43476),n=e.i(932),a=e.i(71645),o=e.i(17751),i=e.i(12598),l=e.i(38847);let s=(0,a.createContext)({live:!1});function c(e){let t,o,i=(0,n.c)(5),{children:c}=e,[d]=(0,l.useQueryState)("features",l.parseAsString);i[0]!==d?(t=()=>({live:new Set((d??"").split(",").map(u).filter(Boolean)).has("live")}),i[0]=d,i[1]=t):t=i[1];let[m]=(0,a.useState)(t);return i[2]!==c||i[3]!==m?(o=(0,r.jsx)(s.Provider,{value:m,children:c}),i[2]=c,i[3]=m,i[4]=o):o=i[4],o}function u(e){return e.trim().toLowerCase()}var d=e.i(40141);function m(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 21L11.2381 12.2698L15 6L23 21H16ZM8 10L14 21H2L8 10ZM5.5 8C4.11929 8 3 6.88071 3 5.5C3 4.11929 4.11929 3 5.5 3C6.88071 3 8 4.11929 8 5.5C8 6.88071 6.88071 8 5.5 8Z"},child:[]}]})(e)}function f(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0c-41.8 0-77.4 26.7-90.5 64L64 64C28.7 64 0 92.7 0 128L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64l-37.5 0C269.4 26.7 233.8 0 192 0zm0 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM305 273L177 401c-9.4 9.4-24.6 9.4-33.9 0L79 337c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L271 239c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(e)}function h(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"},child:[]}]})(e)}function p(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8V2h6"},child:[]},{tag:"path",attr:{d:"m2 2 10 10"},child:[]},{tag:"path",attr:{d:"M12 2A10 10 0 1 1 2 12"},child:[]}]})(e)}function g(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},child:[]},{tag:"path",attr:{d:"M12 11h4"},child:[]},{tag:"path",attr:{d:"M12 16h4"},child:[]},{tag:"path",attr:{d:"M8 11h.01"},child:[]},{tag:"path",attr:{d:"M8 16h.01"},child:[]}]})(e)}function v(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m16 15-3-3 3-3"},child:[]}]})(e)}function x(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m14 9 3 3-3 3"},child:[]}]})(e)}function y(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m9 16 3-3 3 3"},child:[]}]})(e)}function b(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m15 14-3 3-3-3"},child:[]}]})(e)}var _=e.i(79123),S=e.i(11152),w=e.i(36679);function C(e){let t,o,i,l,s,c=(0,n.c)(12),{cameraRef:u,missionName:d,missionType:m,disabled:h}=e,{fogEnabled:p}=(0,_.useSettings)(),[g,v]=(0,a.useState)(!1),x=(0,a.useRef)(null);c[0]!==u||c[1]!==p||c[2]!==d||c[3]!==m?(t=async()=>{clearTimeout(x.current);let e=u.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,a=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${a}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${m}`),r.set("fog",p.toString());let n=`${window.location.pathname}?${r}${t}`,a=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(a),v(!0),x.current=setTimeout(()=>{v(!1)},1100)}catch(e){console.error(e)}},c[0]=u,c[1]=p,c[2]=d,c[3]=m,c[4]=t):t=c[4];let y=t,b=g?"true":"false";return c[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(S.FaMapPin,{className:w.default.MapPin}),i=(0,r.jsx)(f,{className:w.default.ClipboardCheck}),l=(0,r.jsx)("span",{className:w.default.ButtonLabel,children:" Link to coordinates"}),c[5]=o,c[6]=i,c[7]=l):(o=c[5],i=c[6],l=c[7]),c[8]!==h||c[9]!==y||c[10]!==b?(s=(0,r.jsxs)("button",{type:"button",className:w.default.Root,"aria-label":"Link to coordinates",title:"Copy the current coordinates to URL",onClick:y,disabled:h,"data-copied":b,id:"copyCoordinatesButton",children:[o,i,l]}),c[8]=h,c[9]=y,c[10]=b,c[11]=s):s=c[11],s}function j(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 0 0-2-2zm0 14H3V5h18v12zm-5-6-7 4V7z"},child:[]}]})(e)}var M=e.i(25645),k=e.i(98755),N=e.i(32865),T=e.i(28903);let R=(0,M.createLogger)("LoadDemoButton");function D({isActive:t=!1,choosingMap:n=!1,onCancelChoosingMap:o}){let i=(0,N.useRecording)(),l=i?.source==="demo",{setRecording:s}=(0,N.usePlaybackActions)(),c=(0,a.useRef)(null),u=(0,a.useRef)(0),d=(0,a.useCallback)(()=>{if(n&&l)return void o?.();if(l){u.current+=1,s(null);return}c.current?.click()},[l,n,o,s]),m=(0,a.useCallback)(async t=>{let r=t.target.files?.[0];if(r){t.target.value="";try{let t=await r.arrayBuffer(),n=u.current+1;u.current=n;let{createDemoStreamingRecording:a}=await e.A(60946),o=await a(t);if(u.current!==n)return;let i=k.liveConnectionStore.getState();i.disconnectServer(),i.disconnectRelay(),s(o)}catch(e){R.error("Failed to load demo: %o",e)}}},[s]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:c,type:"file",accept:".rec",style:{display:"none"},onChange:m}),(0,r.jsxs)("button",{type:"button",className:T.default.Root,"aria-label":l?"Unload demo":"Load demo (.rec)",title:l?"Unload demo":"Load demo (.rec)",onClick:d,"data-active":t,children:[(0,r.jsx)(j,{className:T.default.DemoIcon}),(0,r.jsx)("span",{className:T.default.ButtonLabel,children:"Demo"}),(0,r.jsx)("span",{className:T.default.ButtonHint,children:n&&l?"Return to demo":l?"Click to unload":"Load a .rec file"})]})]})}function L(e){return(0,d.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"},child:[]}]})(e)}var F=e.i(9607);function I(e){let t,a,o,i,l,s,c=(0,n.c)(19),{isActive:u,onOpenServerBrowser:d}=e,m=(0,k.useLiveSelector)(B),f=(0,k.useLiveSelector)(k.selectPing),h=(0,k.useLiveSelector)(E),p="connected"===m,g="connecting"===m||"challenging"===m||"authenticating"===m,v=p?"Connected – click to disconnect":"Join server",x=p?"Connected – click to disconnect":"Join server";c[0]!==h||c[1]!==p||c[2]!==d?(t=()=>{p?h():d()},c[0]=h,c[1]=p,c[2]=d,c[3]=t):t=c[3];let y=`${F.default.LiveIcon} ${p?F.default.Pulsing:""}`;if(c[4]!==y?(a=(0,r.jsx)(L,{className:y}),c[4]=y,c[5]=a):a=c[5],c[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)("span",{className:F.default.TextLabel,children:"Live"}),c[6]=o):o=c[6],c[7]!==g||c[8]!==f)i=g?"Connecting…":null!=f?`${f.toLocaleString()} ms`:"Join a game",c[7]=g,c[8]=f,c[9]=i;else i=c[9];return c[10]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,(0,r.jsx)("span",{className:F.default.ButtonHint,children:i})]}),c[10]=i,c[11]=l):l=c[11],c[12]!==u||c[13]!==v||c[14]!==x||c[15]!==t||c[16]!==a||c[17]!==l?(s=(0,r.jsxs)("button",{type:"button",className:F.default.Root,"aria-label":v,title:x,onClick:t,"data-active":u,children:[a,l]}),c[12]=u,c[13]=v,c[14]=x,c[15]=t,c[16]=a,c[17]=l,c[18]=s):s=c[18],s}function E(e){return e.disconnectServer}function B(e){return e.gameStatus}function P(e,t=[]){let n=[],o=()=>{let t=n.map(e=>a.createContext(e));return function(r){let n=r?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return o.scopeName=e,[function(t,o){let i=a.createContext(o),l=n.length;n=[...n,o];let s=t=>{let{scope:n,children:o,...s}=t,c=n?.[e]?.[l]||i,u=a.useMemo(()=>s,Object.values(s));return(0,r.jsx)(c.Provider,{value:u,children:o})};return s.displayName=t+"Provider",[s,function(r,n){let s=n?.[e]?.[l]||i,c=a.useContext(s);if(c)return c;if(void 0!==o)return o;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(o,...t)]}function A(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function z(...e){return t=>{let r=!1,n=e.map(e=>{let n=A(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t{let{children:r,...n}=e;if(a.isValidElement(r)){var o;let e,i,l=(o=r,(i=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(i=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?z(t,l):l),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=a.forwardRef((e,t)=>{let{children:n,...i}=e,l=a.Children.toArray(n),s=l.find(H);if(s){let e=s.props.children,n=l.map(t=>t!==s?t:a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null);return(0,r.jsx)(o,{...i,ref:t,children:a.isValidElement(e)?a.cloneElement(e,void 0,n):null})}return(0,r.jsx)(o,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var W=Symbol("radix.slottable");function H(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===W}var V=new WeakMap;function O(e,t){var r,n;let a,o,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,n=t,a=r.length,(i=(o=q(n))>=0?o:a+o)<0||i>=a?-1:i);return -1===l?void 0:e[l]}function q(e){return e!=e||0===e?0:Math.trunc(e)}function $(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],V.set(this,!0)}set(e,t){return V.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),o=this.#e.length,i=q(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!a;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}}),"u">typeof window&&window.document&&window.document.createElement;var K=globalThis?.document?a.useLayoutEffect:()=>{};a[" useEffectEvent ".trim().toString()],a[" useInsertionEffect ".trim().toString()];var Q=a[" useInsertionEffect ".trim().toString()]||K;function Y({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[o,i,l]=function({defaultProp:e,onChange:t}){let[r,n]=a.useState(e),o=a.useRef(r),i=a.useRef(t);return Q(()=>{i.current=t},[t]),a.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}({defaultProp:t,onChange:r}),s=void 0!==e,c=s?e:o;{let t=a.useRef(void 0!==e);a.useEffect(()=>{let e=t.current;if(e!==s){let t=s?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,n])}return[c,a.useCallback(t=>{if(s){let r="function"==typeof t?t(e):t;r!==e&&l.current?.(r)}else i(t)},[s,e,i,l])]}Symbol("RADIX:SYNC_STATE"),e.i(74080);var X=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=G(`Primitive.${t}`),o=a.forwardRef((e,a)=>{let{asChild:o,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(o?n:t,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Z=e=>{var t;let r,n,{present:o,children:i}=e,l=function(e){var t,r;let[n,o]=a.useState(),i=a.useRef(null),l=a.useRef(e),s=a.useRef("none"),[c,u]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},a.useReducer((e,t)=>r[e][t]??e,t));return a.useEffect(()=>{let e=J(i.current);s.current="mounted"===c?e:"none"},[c]),K(()=>{let t=i.current,r=l.current;if(r!==e){let n=s.current,a=J(t);e?u("MOUNT"):"none"===a||t?.display==="none"?u("UNMOUNT"):r&&n!==a?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),K(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let a=J(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&a&&(u("ANIMATION_END"),!l.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=J(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{i.current=e?getComputedStyle(e):null,o(e)},[])}}(o),s="function"==typeof i?i({present:l.isPresent}):a.Children.only(i),c=U(l.ref,(t=s,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof i||l.isPresent?a.cloneElement(s,{ref:c}):null};function J(e){return e?.animationName||"none"}Z.displayName="Presence";var ee=a[" useId ".trim().toString()]||(()=>void 0),et=0;function er(e){let[t,r]=a.useState(ee());return K(()=>{e||r(e=>e??String(et++))},[e]),e||(t?`radix-${t}`:"")}var en="Collapsible",[ea,eo]=P(en),[ei,el]=ea(en),es=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:l,onOpenChange:s,...c}=e,[u,d]=Y({prop:o,defaultProp:i??!1,onChange:s,caller:en});return(0,r.jsx)(ei,{scope:n,disabled:l,contentId:er(),open:u,onOpenToggle:a.useCallback(()=>d(e=>!e),[d]),children:(0,r.jsx)(X.div,{"data-state":eh(u),"data-disabled":l?"":void 0,...c,ref:t})})});es.displayName=en;var ec="CollapsibleTrigger",eu=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,...a}=e,o=el(ec,n);return(0,r.jsx)(X.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":eh(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...a,ref:t,onClick:$(e.onClick,o.onOpenToggle)})});eu.displayName=ec;var ed="CollapsibleContent",em=a.forwardRef((e,t)=>{let{forceMount:n,...a}=e,o=el(ed,e.__scopeCollapsible);return(0,r.jsx)(Z,{present:n||o.open,children:({present:e})=>(0,r.jsx)(ef,{...a,ref:t,present:e})})});em.displayName=ed;var ef=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:o,children:i,...l}=e,s=el(ed,n),[c,u]=a.useState(o),d=a.useRef(null),m=U(t,d),f=a.useRef(0),h=f.current,p=a.useRef(0),g=p.current,v=s.open||c,x=a.useRef(v),y=a.useRef(void 0);return a.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),K(()=>{let e=d.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();f.current=t.height,p.current=t.width,x.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),u(o)}},[s.open,o]),(0,r.jsx)(X.div,{"data-state":eh(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...l,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&i})});function eh(e){return e?"open":"closed"}var ep=a.createContext(void 0),eg="Accordion",ev=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ex,ey,eb]=function(e){let t=e+"CollectionProvider",[n,o]=P(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,o=a.default.useRef(null),l=a.default.useRef(new Map).current;return(0,r.jsx)(i,{scope:t,itemMap:l,collectionRef:o,children:n})};s.displayName=t;let c=e+"CollectionSlot",u=G(c),d=a.default.forwardRef((e,t)=>{let{scope:n,children:a}=e,o=U(t,l(c,n).collectionRef);return(0,r.jsx)(u,{ref:o,children:a})});d.displayName=c;let m=e+"CollectionItemSlot",f="data-radix-collection-item",h=G(m),p=a.default.forwardRef((e,t)=>{let{scope:n,children:o,...i}=e,s=a.default.useRef(null),c=U(t,s),u=l(m,n);return a.default.useEffect(()=>(u.itemMap.set(s,{ref:s,...i}),()=>void u.itemMap.delete(s))),(0,r.jsx)(h,{...{[f]:""},ref:c,children:o})});return p.displayName=m,[{Provider:s,Slot:d,ItemSlot:p},function(t){let r=l(e+"CollectionConsumer",t);return a.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},o]}(eg),[e_,eS]=P(eg,[eb,eo]),ew=eo(),eC=a.default.forwardRef((e,t)=>{let{type:n,...a}=e;return(0,r.jsx)(ex.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?(0,r.jsx)(eR,{...a,ref:t}):(0,r.jsx)(eT,{...a,ref:t})})});eC.displayName=eg;var[ej,eM]=e_(eg),[ek,eN]=e_(eg,{collapsible:!1}),eT=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:l=!1,...s}=e,[c,u]=Y({prop:n,defaultProp:o??"",onChange:i,caller:eg});return(0,r.jsx)(ej,{scope:e.__scopeAccordion,value:a.default.useMemo(()=>c?[c]:[],[c]),onItemOpen:u,onItemClose:a.default.useCallback(()=>l&&u(""),[l,u]),children:(0,r.jsx)(ek,{scope:e.__scopeAccordion,collapsible:l,children:(0,r.jsx)(eF,{...s,ref:t})})})}),eR=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},...l}=e,[s,c]=Y({prop:n,defaultProp:o??[],onChange:i,caller:eg}),u=a.default.useCallback(e=>c((t=[])=>[...t,e]),[c]),d=a.default.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,r.jsx)(ej,{scope:e.__scopeAccordion,value:s,onItemOpen:u,onItemClose:d,children:(0,r.jsx)(ek,{scope:e.__scopeAccordion,collapsible:!0,children:(0,r.jsx)(eF,{...l,ref:t})})})}),[eD,eL]=e_(eg),eF=a.default.forwardRef((e,t)=>{let n,{__scopeAccordion:o,disabled:i,dir:l,orientation:s="vertical",...c}=e,u=U(a.default.useRef(null),t),d=ey(o),m="ltr"===(n=a.useContext(ep),l||n||"ltr"),f=$(e.onKeyDown,e=>{if(!ev.includes(e.key))return;let t=e.target,r=d().filter(e=>!e.ref.current?.disabled),n=r.findIndex(e=>e.ref.current===t),a=r.length;if(-1===n)return;e.preventDefault();let o=n,i=a-1,l=()=>{(o=n+1)>i&&(o=0)},c=()=>{(o=n-1)<0&&(o=i)};switch(e.key){case"Home":o=0;break;case"End":o=i;break;case"ArrowRight":"horizontal"===s&&(m?l():c());break;case"ArrowDown":"vertical"===s&&l();break;case"ArrowLeft":"horizontal"===s&&(m?c():l());break;case"ArrowUp":"vertical"===s&&c()}let u=o%a;r[u].ref.current?.focus()});return(0,r.jsx)(eD,{scope:o,disabled:i,direction:l,orientation:s,children:(0,r.jsx)(ex.Slot,{scope:o,children:(0,r.jsx)(X.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:f})})})}),eI="AccordionItem",[eE,eB]=e_(eI),eP=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,value:a,...o}=e,i=eL(eI,n),l=eM(eI,n),s=ew(n),c=er(),u=a&&l.value.includes(a)||!1,d=i.disabled||e.disabled;return(0,r.jsx)(eE,{scope:n,open:u,disabled:d,triggerId:c,children:(0,r.jsx)(es,{"data-orientation":i.orientation,"data-state":eH(u),...s,...o,ref:t,disabled:d,open:u,onOpenChange:e=>{e?l.onItemOpen(a):l.onItemClose(a)}})})});eP.displayName=eI;var eA="AccordionHeader";a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eL(eg,n),i=eB(eA,n);return(0,r.jsx)(X.h3,{"data-orientation":o.orientation,"data-state":eH(i.open),"data-disabled":i.disabled?"":void 0,...a,ref:t})}).displayName=eA;var ez="AccordionTrigger",eU=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eL(eg,n),i=eB(ez,n),l=eN(ez,n),s=ew(n);return(0,r.jsx)(ex.ItemSlot,{scope:n,children:(0,r.jsx)(eu,{"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...s,...a,ref:t})})});eU.displayName=ez;var eG="AccordionContent",eW=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eL(eg,n),i=eB(eG,n),l=ew(n);return(0,r.jsx)(em,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...l,...a,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function eH(e){return e?"open":"closed"}function eV(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"m190.06 414 163.12-139.78a24 24 0 0 0 0-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z"},child:[]}]})(e)}eW.displayName=eG;var eO=e.i(81323);function eq(e){let t,a=(0,n.c)(2);return a[0]!==e?(t=(0,r.jsx)(eC,{className:eO.default.AccordionGroup,...e}),a[0]=e,a[1]=t):t=a[1],t}function e$(e){let t,a,o,i,l=(0,n.c)(9),{value:s,label:c,children:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(eV,{className:eO.default.TriggerIcon}),l[0]=t):t=l[0],l[1]!==c?(a=(0,r.jsxs)(eU,{className:eO.default.Trigger,children:[t," ",c]}),l[1]=c,l[2]=a):a=l[2],l[3]!==u?(o=(0,r.jsx)(eW,{className:eO.default.Content,children:(0,r.jsx)("div",{className:eO.default.Body,children:u})}),l[3]=u,l[4]=o):o=l[4],l[5]!==a||l[6]!==o||l[7]!==s?(i=(0,r.jsxs)(eP,{value:s,children:[a,o]}),l[5]=a,l[6]=o,l[7]=s,l[8]=i):i=l[8],i}var eK=e.i(65883),eQ=e.i(21025),eY=e.i(92224),eX=e.i(91996);let eZ=["controls","preferences","audio"];function eJ(e){let t,o,i,l,s,c,u,d,f,p,v,x,y,b,S,w,j,M,T,R,L,F,E,B,P,A,z,U,G,W,H,V,O,q,$,K,Q,Y,X,Z,J,ee,et,er,en,ea,eo,ei,el,es,ec,eu,ed,em,ef,eh,ep,eg,ev,ex,ey,eb,e_,eS,ew,eC,ej,eM,ek,eN,eT,eR,eD=(0,n.c)(169),{missionName:eL,missionType:eF,onOpenMapInfo:eI,onOpenServerBrowser:eE,onChooseMap:eB,onCancelChoosingMap:eP,choosingMap:eA,cameraRef:ez,invalidateRef:eU}=e,eG=(0,eQ.useTouchDevice)(),eW=(0,eY.useDataSource)(),eH=(0,N.useRecording)(),eV=(0,eY.useMissionName)(),eO="demo"===eW||"live"===eW?eV:eL;eD[0]!==eO?(t=!!eO&&(0,eX.hasMission)(eO),eD[0]=eO,eD[1]=t):t=eD[1];let eJ=t,e1=(0,k.useLiveSelector)(e0),{fogEnabled:e2,setFogEnabled:e3,fov:e5,setFov:e4,audioEnabled:e6,setAudioEnabled:e8,audioVolume:e7,setAudioVolume:e9,animationEnabled:te,setAnimationEnabled:tt}=(0,_.useSettings)(),{speedMultiplier:tr,setSpeedMultiplier:tn,touchMode:ta,setTouchMode:to,invertScroll:ti,setInvertScroll:tl,invertDrag:ts,setInvertDrag:tc,invertJoystick:tu,setInvertJoystick:td}=(0,_.useControls)(),{debugMode:tm,setDebugMode:tf,renderOnDemand:th,setRenderOnDemand:tp}=(0,_.useDebug)(),[tg,tv]=(0,a.useState)(!1),tx=(0,a.useRef)(null),ty=(0,a.useRef)(null),tb=(0,a.useRef)(null);eD[2]!==tg?(o=()=>{tg&&tx.current?.focus()},i=[tg],eD[2]=tg,eD[3]=o,eD[4]=i):(o=eD[3],i=eD[4]),(0,a.useEffect)(o,i),eD[5]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let t=e.relatedTarget;t&&tb.current?.contains(t)||tv(!1)},eD[5]=l):l=eD[5];let t_=l;eD[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(tv(!1),ty.current?.focus())},eD[6]=s):s=eD[6];let tS=s,tw="map"===eW&&!eH||eA;eD[7]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(m,{}),u=(0,r.jsx)("span",{className:eK.default.ButtonLabel,children:"Explore"}),d=(0,r.jsx)("span",{className:eK.default.ButtonHint,children:"Browse maps"}),eD[7]=c,eD[8]=u,eD[9]=d):(c=eD[7],u=eD[8],d=eD[9]),eD[10]!==eB||eD[11]!==tw?(f=(0,r.jsxs)("button",{type:"button",className:eK.default.IconButton,"data-active":tw,onClick:eB,children:[c,u,d]}),eD[10]=eB,eD[11]=tw,eD[12]=f):f=eD[12];let tC=!eA&&eH?.source==="demo";eD[13]!==eA||eD[14]!==eP||eD[15]!==tC?(p=(0,r.jsx)(D,{isActive:tC,choosingMap:eA,onCancelChoosingMap:eP}),eD[13]=eA,eD[14]=eP,eD[15]=tC,eD[16]=p):p=eD[16],eD[17]!==eA||eD[18]!==e1||eD[19]!==eE?(v=eE&&(0,r.jsx)(I,{isActive:!eA&&e1,onOpenServerBrowser:eE}),eD[17]=eA,eD[18]=e1,eD[19]=eE,eD[20]=v):v=eD[20],eD[21]!==f||eD[22]!==p||eD[23]!==v?(x=(0,r.jsxs)("div",{className:eK.default.ButtonGroup,children:[f,p,v]}),eD[21]=f,eD[22]=p,eD[23]=v,eD[24]=x):x=eD[24];let tj=!eJ;eD[25]!==ez||eD[26]!==eL||eD[27]!==eF||eD[28]!==tj?(y=(0,r.jsx)(C,{missionName:eL,missionType:eF,cameraRef:ez,disabled:tj}),eD[25]=ez,eD[26]=eL,eD[27]=eF,eD[28]=tj,eD[29]=y):y=eD[29];let tM=!eJ;eD[30]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(g,{}),S=(0,r.jsx)("span",{className:eK.default.ButtonLabel,children:"Show map info"}),eD[30]=b,eD[31]=S):(b=eD[30],S=eD[31]),eD[32]!==eI||eD[33]!==tM?(w=(0,r.jsxs)("button",{type:"button",className:eK.default.MapInfoButton,"aria-label":"Show map info",onClick:eI,disabled:tM,children:[b,S]}),eD[32]=eI,eD[33]=tM,eD[34]=w):w=eD[34],eD[35]!==x||eD[36]!==y||eD[37]!==w?(j=(0,r.jsxs)("div",{className:eK.default.Tools,children:[x,y,w]}),eD[35]=x,eD[36]=y,eD[37]=w,eD[38]=j):j=eD[38],eD[39]===Symbol.for("react.memo_cache_sentinel")?(M=(0,r.jsx)("label",{htmlFor:"speedInput",children:"Fly speed"}),eD[39]=M):M=eD[39],eD[40]!==tr?(T=Math.round(100*tr),eD[40]=tr,eD[41]=T):T=eD[41],eD[42]!==tn?(R=e=>tn(parseFloat(e.target.value)/100),eD[42]=tn,eD[43]=R):R=eD[43],eD[44]!==T||eD[45]!==R?(L=(0,r.jsx)("input",{id:"speedInput",type:"range",min:1,max:100,step:1,value:T,onChange:R}),eD[44]=T,eD[45]=R,eD[46]=L):L=eD[46];let tk=!1===eG?" Use your scroll wheel or trackpad to adjust while flying.":"";return eD[47]!==tk?(F=(0,r.jsxs)("p",{className:eK.default.Description,children:["How fast you move in free-flying mode.",tk]}),eD[47]=tk,eD[48]=F):F=eD[48],eD[49]!==L||eD[50]!==F?(E=(0,r.jsxs)("div",{className:eK.default.Field,children:[M,L,F]}),eD[49]=L,eD[50]=F,eD[51]=E):E=eD[51],eD[52]!==eG||eD[53]!==to||eD[54]!==ta?(B=eG?(0,r.jsxs)("div",{className:eK.default.Field,children:[(0,r.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick"})," ",(0,r.jsxs)("select",{id:"touchModeInput",value:ta,onChange:e=>to(e.target.value),children:[(0,r.jsx)("option",{value:"dualStick",children:"Dual stick"}),(0,r.jsx)("option",{value:"moveLookStick",children:"Single stick"})]}),(0,r.jsx)("p",{className:eK.default.Description,children:"Single stick has a unified move + look control. Dual stick has independent move + look."})]}):null,eD[52]=eG,eD[53]=to,eD[54]=ta,eD[55]=B):B=eD[55],eD[56]!==ti||eD[57]!==eG||eD[58]!==tl?(P=!1===eG?(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertScroll",type:"checkbox",checked:ti,onChange:e=>{tl(e.target.checked)}}),(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"invertScroll",children:"Invert scroll direction"}),(0,r.jsx)("p",{className:eK.default.Description,children:"Reverse which scroll direction increases and decreases fly speed."})]}):null,eD[56]=ti,eD[57]=eG,eD[58]=tl,eD[59]=P):P=eD[59],eD[60]!==tu||eD[61]!==eG||eD[62]!==td?(A=eG?(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertJoystick",type:"checkbox",checked:tu,onChange:e=>{td(e.target.checked)}}),(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"invertJoystick",children:"Invert joystick direction"}),(0,r.jsx)("p",{className:eK.default.Description,children:"Reverse joystick look direction."})]}):null,eD[60]=tu,eD[61]=eG,eD[62]=td,eD[63]=A):A=eD[63],eD[64]!==tc?(z=e=>{tc(e.target.checked)},eD[64]=tc,eD[65]=z):z=eD[65],eD[66]!==ts||eD[67]!==z?(U=(0,r.jsx)("input",{id:"invertDrag",type:"checkbox",checked:ts,onChange:z}),eD[66]=ts,eD[67]=z,eD[68]=U):U=eD[68],eD[69]===Symbol.for("react.memo_cache_sentinel")?(G=(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"invertDrag",children:"Invert drag direction"}),W=(0,r.jsx)("p",{className:eK.default.Description,children:"Reverse how dragging the viewport aims the camera."}),eD[69]=G,eD[70]=W):(G=eD[69],W=eD[70]),eD[71]!==U?(H=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[U,G,W]}),eD[71]=U,eD[72]=H):H=eD[72],eD[73]!==E||eD[74]!==B||eD[75]!==P||eD[76]!==A||eD[77]!==H?(V=(0,r.jsxs)(e$,{value:"controls",label:"Controls",children:[E,B,P,A,H]}),eD[73]=E,eD[74]=B,eD[75]=P,eD[76]=A,eD[77]=H,eD[78]=V):V=eD[78],eD[79]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),eD[79]=O):O=eD[79],eD[80]!==e5?(q=(0,r.jsxs)("output",{htmlFor:"fovInput",children:[e5,"°"]}),eD[80]=e5,eD[81]=q):q=eD[81],eD[82]!==e4?($=e=>e4(parseInt(e.target.value)),eD[82]=e4,eD[83]=$):$=eD[83],eD[84]!==e5||eD[85]!==$?(K=(0,r.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:e5,onChange:$}),eD[84]=e5,eD[85]=$,eD[86]=K):K=eD[86],eD[87]!==q||eD[88]!==K?(Q=(0,r.jsx)(e$,{value:"preferences",label:"Preferences",children:(0,r.jsxs)("div",{className:eK.default.Field,children:[O,(0,r.jsxs)("div",{className:eK.default.Control,children:[q,K]})]})}),eD[87]=q,eD[88]=K,eD[89]=Q):Q=eD[89],eD[90]!==e8?(Y=e=>{e8(e.target.checked)},eD[90]=e8,eD[91]=Y):Y=eD[91],eD[92]!==e6||eD[93]!==Y?(X=(0,r.jsx)("input",{id:"audioInput",type:"checkbox",checked:e6,onChange:Y}),eD[92]=e6,eD[93]=Y,eD[94]=X):X=eD[94],eD[95]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"audioInput",children:"Enable audio"}),eD[95]=Z):Z=eD[95],eD[96]!==X?(J=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[X,Z]}),eD[96]=X,eD[97]=J):J=eD[97],eD[98]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,r.jsx)("label",{htmlFor:"volumeInput",children:"Master volume"}),eD[98]=ee):ee=eD[98],eD[99]!==e7?(et=Math.round(100*e7),eD[99]=e7,eD[100]=et):et=eD[100],eD[101]!==et?(er=(0,r.jsxs)("output",{htmlFor:"volumeInput",children:[et,"%"]}),eD[101]=et,eD[102]=er):er=eD[102],eD[103]!==e9?(en=e=>e9(parseFloat(e.target.value)),eD[103]=e9,eD[104]=en):en=eD[104],eD[105]!==e7||eD[106]!==en?(ea=(0,r.jsx)("input",{id:"volumeInput",type:"range",min:0,max:1,step:.05,value:e7,onChange:en}),eD[105]=e7,eD[106]=en,eD[107]=ea):ea=eD[107],eD[108]!==er||eD[109]!==ea?(eo=(0,r.jsxs)("div",{className:eK.default.Field,children:[ee,(0,r.jsxs)("div",{className:eK.default.Control,children:[er,ea]})]}),eD[108]=er,eD[109]=ea,eD[110]=eo):eo=eD[110],eD[111]!==J||eD[112]!==eo?(ei=(0,r.jsxs)(e$,{value:"audio",label:"Audio",children:[J,eo]}),eD[111]=J,eD[112]=eo,eD[113]=ei):ei=eD[113],eD[114]!==e3?(el=e=>{e3(e.target.checked)},eD[114]=e3,eD[115]=el):el=eD[115],eD[116]!==e2||eD[117]!==el?(es=(0,r.jsx)("input",{id:"fogInput",type:"checkbox",checked:e2,onChange:el}),eD[116]=e2,eD[117]=el,eD[118]=es):es=eD[118],eD[119]===Symbol.for("react.memo_cache_sentinel")?(ec=(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"fogInput",children:"Enable fog"}),eD[119]=ec):ec=eD[119],eD[120]!==es?(eu=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[es,ec]}),eD[120]=es,eD[121]=eu):eu=eD[121],eD[122]!==tt?(ed=e=>{tt(e.target.checked)},eD[122]=tt,eD[123]=ed):ed=eD[123],eD[124]!==te||eD[125]!==ed?(em=(0,r.jsx)("input",{id:"animationInput",type:"checkbox",checked:te,onChange:ed}),eD[124]=te,eD[125]=ed,eD[126]=em):em=eD[126],eD[127]===Symbol.for("react.memo_cache_sentinel")?(ef=(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"animationInput",children:"Enable animations"}),eD[127]=ef):ef=eD[127],eD[128]!==em?(eh=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[em,ef]}),eD[128]=em,eD[129]=eh):eh=eD[129],eD[130]!==eu||eD[131]!==eh?(ep=(0,r.jsxs)(e$,{value:"graphics",label:"Graphics",children:[eu,eh]}),eD[130]=eu,eD[131]=eh,eD[132]=ep):ep=eD[132],eD[133]!==tf?(eg=e=>{tf(e.target.checked)},eD[133]=tf,eD[134]=eg):eg=eD[134],eD[135]!==tm||eD[136]!==eg?(ev=(0,r.jsx)("input",{id:"debugInput",type:"checkbox",checked:tm,onChange:eg}),eD[135]=tm,eD[136]=eg,eD[137]=ev):ev=eD[137],eD[138]===Symbol.for("react.memo_cache_sentinel")?(ex=(0,r.jsx)("label",{className:eK.default.Label,htmlFor:"debugInput",children:"Render debug visuals"}),eD[138]=ex):ex=eD[138],eD[139]!==ev?(ey=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[ev,ex]}),eD[139]=ev,eD[140]=ey):ey=eD[140],eD[141]!==tp?(eb=e=>{tp(e.target.checked)},eD[141]=tp,eD[142]=eb):eb=eD[142],eD[143]!==th||eD[144]!==eb?(e_=(0,r.jsx)("input",{id:"onDemandInput",type:"checkbox",checked:th,onChange:eb}),eD[143]=th,eD[144]=eb,eD[145]=e_):e_=eD[145],eD[146]===Symbol.for("react.memo_cache_sentinel")?(eS=(0,r.jsx)("label",{htmlFor:"onDemandInput",children:"Render on demand "}),eD[146]=eS):eS=eD[146],eD[147]!==eU?(ew=()=>eU.current?.(),eD[147]=eU,eD[148]=ew):ew=eD[148],eD[149]===Symbol.for("react.memo_cache_sentinel")?(eC=(0,r.jsx)(h,{}),eD[149]=eC):eC=eD[149],eD[150]!==ew?(ej=(0,r.jsxs)("div",{className:eK.default.Label,children:[eS,(0,r.jsx)("button",{type:"button",className:eK.default.ForceRenderButton,title:"Force render","aria-label":"Force render",onClick:ew,children:eC})]}),eD[150]=ew,eD[151]=ej):ej=eD[151],eD[152]===Symbol.for("react.memo_cache_sentinel")?(eM=(0,r.jsx)("p",{className:eK.default.Description,children:"Significantly decreases CPU and GPU usage by only rendering frames when requested. Helpful when developing parts of the app unrelated to rendering."}),eD[152]=eM):eM=eD[152],eD[153]!==e_||eD[154]!==ej?(ek=(0,r.jsxs)("div",{className:eK.default.CheckboxField,children:[e_,ej,eM]}),eD[153]=e_,eD[154]=ej,eD[155]=ek):ek=eD[155],eD[156]!==ey||eD[157]!==ek?(eN=(0,r.jsxs)(e$,{value:"debug",label:"Debug",children:[ey,ek]}),eD[156]=ey,eD[157]=ek,eD[158]=eN):eN=eD[158],eD[159]!==V||eD[160]!==Q||eD[161]!==ei||eD[162]!==ep||eD[163]!==eN?(eT=(0,r.jsx)("div",{className:eK.default.Accordions,children:(0,r.jsxs)(eq,{type:"multiple",defaultValue:eZ,children:[V,Q,ei,ep,eN]})}),eD[159]=V,eD[160]=Q,eD[161]=ei,eD[162]=ep,eD[163]=eN,eD[164]=eT):eT=eD[164],eD[165]!==tg||eD[166]!==j||eD[167]!==eT?(eR=(0,r.jsx)("div",{className:eK.default.InspectorControls,children:(0,r.jsx)("div",{ref:tb,children:(0,r.jsxs)("div",{className:eK.default.Dropdown,ref:tx,id:"settingsPanel",tabIndex:-1,onKeyDown:tS,onBlur:t_,"data-open":tg,children:[j,eT]})})}),eD[165]=tg,eD[166]=j,eD[167]=eT,eD[168]=eR):eR=eD[168],eR}function e0(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var e1=e.i(11889),e2=e.i(56373),e3=e.i(86447),e5=e.i(1559),e4=e.i(78440),e6=e.i(59129),e8=e.i(25998),e7=e.i(18364),e9=e.i(68754),te=e.i(70238),tt=e.i(29402),tr=e.i(97442);let tn=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),ta={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/xPack2.vl2":"xPack2","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2":"DMP (Discord Map Pack)"},to={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},ti=(0,eX.getMissionList)().filter(e=>!tn.has(e)).map(e=>{let t,r=(0,eX.getMissionInfo)(e),[n]=(0,eX.getSourceAndPath)(r.resourcePath),a=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",o=ta[n]??to[a]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:o,missionTypes:r.missionTypes}}),tl=new Map(ti.map(e=>[e.missionName,e])),ts=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,tt.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,tt.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(ti),tc="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function tu(e){let t,a,o,i,l,s=(0,n.c)(12),{mission:c}=e,u=c.displayName||c.missionName;return s[0]!==u?(t=(0,r.jsx)("span",{className:tr.default.ItemName,children:u}),s[0]=u,s[1]=t):t=s[1],s[2]!==c.missionTypes?(a=c.missionTypes.length>0&&(0,r.jsx)("span",{className:tr.default.ItemTypes,children:c.missionTypes.map(td)}),s[2]=c.missionTypes,s[3]=a):a=s[3],s[4]!==t||s[5]!==a?(o=(0,r.jsxs)("span",{className:tr.default.ItemHeader,children:[t,a]}),s[4]=t,s[5]=a,s[6]=o):o=s[6],s[7]!==c.missionName?(i=(0,r.jsx)("span",{className:tr.default.ItemMissionName,children:c.missionName}),s[7]=c.missionName,s[8]=i):i=s[8],s[9]!==o||s[10]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,i]}),s[9]=o,s[10]=i,s[11]=l):l=s[11],l}function td(e){return(0,r.jsx)("span",{className:tr.default.ItemType,"data-mission-type":e,children:e},e)}function tm(e){let t,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_=(0,n.c)(48),{value:S,missionType:w,onChange:C,disabled:j,autoFocus:M}=e,[k,N]=(0,a.useState)(""),T=(0,a.useRef)(null),R=(0,a.useRef)(w);_[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,a.startTransition)(()=>N(e))},_[0]=t):t=_[0];let D=(0,e7.useComboboxStore)({resetValueOnHide:!0,selectedValue:S,setSelectedValue:e=>{if(e){let t=R.current,r=(0,eX.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),C({missionName:e,missionType:t}),T.current?.blur()}},setValue:t}),L=(0,e9.useStoreState)(D,"open");_[1]!==D?(o=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),T.current?.focus(),D.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},i=[D],_[1]=D,_[2]=o,_[3]=i):(o=_[2],i=_[3]),(0,a.useEffect)(o,i),_[4]!==S?(l=tl.get(S),_[4]=S,_[5]=l):l=_[5];let F=l;e:{let e,t;if(!k){let e;_[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:ts},_[6]=e):e=_[6],s=e;break e}_[7]!==k?(e=(0,te.matchSorter)(ti,k,{keys:["displayName","missionName","missionTypes","groupName"]}),_[7]=k,_[8]=e):e=_[8];let r=e;_[9]!==r?(t={type:"flat",missions:r},_[9]=r,_[10]=t):t=_[10],s=t}let I=s,E=F?F.displayName||F.missionName:S,B="flat"===I.type?0===I.missions.length:0===I.groups.length,P=e=>(0,r.jsx)(e2.ComboboxItem,{value:e.missionName,className:tr.default.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(R.current=r,e.missionName===S&&C({missionName:e.missionName,missionType:r})):R.current=null}else R.current=null},children:(0,r.jsx)(tu,{mission:e})},e.missionName),A=e4.ComboboxProvider,z=L?"visible":"hidden";_[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)("div",{className:tr.default.Backdrop}),_[11]=c):c=_[11],_[12]!==z?(u=(0,r.jsx)(a.Activity,{mode:z,children:c}),_[12]=z,_[13]=u):u=_[13];let U=F?void 0:"Choose a map…";_[14]!==D?(d=()=>{try{document.exitPointerLock()}catch{}D.show()},m=e=>{"Escape"!==e.key||D.getState().open||T.current?.blur()},_[14]=D,_[15]=d,_[16]=m):(d=_[15],m=_[16]),_[17]!==M||_[18]!==j||_[19]!==d||_[20]!==m||_[21]!==U?(f=(0,r.jsx)(e1.Combobox,{ref:T,autoSelect:!0,autoFocus:M,disabled:j,placeholder:U,className:tr.default.Input,onFocus:d,onKeyDown:m}),_[17]=M,_[18]=j,_[19]=d,_[20]=m,_[21]=U,_[22]=f):f=_[22],_[23]!==E||_[24]!==w||_[25]!==F?(h=F&&(0,r.jsxs)("div",{className:tr.default.SelectedValue,children:[(0,r.jsx)("span",{className:tr.default.SelectedName,children:E}),w&&(0,r.jsx)("span",{className:tr.default.ItemType,"data-mission-type":w,children:w})]}),_[23]=E,_[24]=w,_[25]=F,_[26]=h):h=_[26],_[27]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)("kbd",{className:tr.default.Shortcut,children:tc?"⌘K":"^K"}),_[27]=p):p=_[27],_[28]!==f||_[29]!==h?(g=(0,r.jsxs)("div",{className:tr.default.InputWrapper,children:[f,h,p]}),_[28]=f,_[29]=h,_[30]=g):g=_[30];let G=e5.ComboboxPopover,W=tr.default,H=e3.ComboboxList,V=tr.default,O="flat"===I.type?I.missions.map(P):I.groups.map(e=>{let[t,n]=e;return t?(0,r.jsxs)(e6.ComboboxGroup,{className:tr.default.Group,children:[(0,r.jsx)(e8.ComboboxGroupLabel,{className:tr.default.GroupLabel,children:t}),n.map(P)]},t):(0,r.jsx)(a.Fragment,{children:n.map(P)},"ungrouped")});return _[31]!==B?(v=B&&(0,r.jsx)("div",{className:tr.default.NoResults,children:"No missions found"}),_[31]=B,_[32]=v):v=_[32],_[33]!==H||_[34]!==V.List||_[35]!==O||_[36]!==v?(x=(0,r.jsxs)(H,{className:V.List,children:[O,v]}),_[33]=H,_[34]=V.List,_[35]=O,_[36]=v,_[37]=x):x=_[37],_[38]!==G||_[39]!==W.Popover||_[40]!==x?(y=(0,r.jsx)(G,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:W.Popover,children:x}),_[38]=G,_[39]=W.Popover,_[40]=x,_[41]=y):y=_[41],_[42]!==A||_[43]!==D||_[44]!==g||_[45]!==y||_[46]!==u?(b=(0,r.jsxs)(A,{store:D,children:[u,g,y]}),_[42]=A,_[43]=D,_[44]=g,_[45]=y,_[46]=u,_[47]=b):b=_[47],b}var tf=e.i(58647);function th(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 6-6 8h12zM6 16h12v2H6z"},child:[]}]})(e)}var tp=e.i(16964);function tg(){let e,t,a,o,i,l,s=(0,n.c)(24),c=(0,eY.useDataSource)(),u=(0,eY.useMissionDisplayName)(),d=(0,eY.useMissionType)(),m=(0,eY.useMissionTypeDisplayName)(),f=(0,eY.useServerDisplayName)(),h=(0,eY.useRecorderName)(),g=(0,eY.useRecordingDate)(),[v,x]=g?g.split(" "):[null,null],y="live"===c,b=(0,N.useRecording)(),_=(0,k.useLiveSelector)(ty),S=tp.default;s[0]!==u||s[1]!==d||s[2]!==m?(e=u&&d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:tp.default.MissionName,children:u}),d&&(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)("span",{className:tp.default.MissionType,"data-mission-type":d,children:"LCTF"===m?"LCTF":d})]})]}):null,s[0]=u,s[1]=d,s[2]=m,s[3]=e):e=s[3],s[4]!==e?(t=(0,r.jsx)("div",{className:tp.default.MissionInfo,children:e}),s[4]=e,s[5]=t):t=s[5];let w=tp.default,C=y?_?h?(0,r.jsxs)("div",{className:tp.default.Attribution,children:["Connected as"," ",(0,r.jsx)("span",{className:tp.default.PlayerName,children:h})]}):null:(0,r.jsx)("div",{className:tp.default.Error,children:"Disconnected"}):h&&g?(0,r.jsxs)("div",{className:tp.default.Attribution,children:["Recorded by ",(0,r.jsx)("span",{className:tp.default.PlayerName,children:h})," ","on"," ",(0,r.jsx)("span",{className:tp.default.RecordingDate,children:v.replace(/-/g," ")})," ","at ",(0,r.jsx)("span",{className:tp.default.RecordingDate,children:x})]}):null;return s[6]!==f?(a=f?(0,r.jsxs)("div",{className:tp.default.ServerInfo,children:["Server: ",(0,r.jsx)("span",{className:tp.default.ServerName,children:f})]}):null,s[6]=f,s[7]=a):a=s[7],s[8]!==w.Metadata||s[9]!==C||s[10]!==a?(o=(0,r.jsxs)("div",{className:w.Metadata,children:[C,a]}),s[8]=w.Metadata,s[9]=C,s[10]=a,s[11]=o):o=s[11],s[12]!==c||s[13]!==tv||s[14]!==tx||s[15]!==y||s[16]!==_||s[17]!==b?(i="demo"===c?(0,r.jsx)("button",{type:"button",className:tp.default.ActionButton,title:"Unload demo","aria-label":"Unload demo",onClick:tx,disabled:!b,children:(0,r.jsx)(th,{className:tp.default.EjectIcon})}):y?(0,r.jsx)("button",{type:"button",className:tp.default.ActionButton,title:"Disconnect","aria-label":"Disconnect",onClick:tv,disabled:!_,children:(0,r.jsx)(p,{})}):null,s[12]=c,s[13]=tv,s[14]=tx,s[15]=y,s[16]=_,s[17]=b,s[18]=i):i=s[18],s[19]!==S.Header||s[20]!==t||s[21]!==o||s[22]!==i?(l=(0,r.jsxs)("div",{className:S.Header,children:[t,o,i]}),s[19]=S.Header,s[20]=t,s[21]=o,s[22]=i,s[23]=l):l=s[23],l}function tv(){let e=k.liveConnectionStore.getState();e.disconnectServer(),e.disconnectRelay(),tf.engineStore.getState().setRecording(null)}function tx(){tf.engineStore.getState().setRecording(null)}function ty(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var tb=e.i(31067),t_=e.i(15080),tS=e.i(71753),tw=e.i(90072);let tC=a.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:o,...i},l)=>{let s=(0,t_.useThree)(({set:e})=>e),c=(0,t_.useThree)(({camera:e})=>e),u=(0,t_.useThree)(({size:e})=>e),d=a.useRef(null);a.useImperativeHandle(l,()=>d.current,[]);let m=a.useRef(null),f=function(e,t,r){let n=(0,t_.useThree)(e=>e.size),o=(0,t_.useThree)(e=>e.viewport),i="number"==typeof e?e:n.width*o.dpr,l=n.height*o.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:u,...d}=s,m=null!=u?u:s.depthBuffer,f=a.useMemo(()=>{let e=new tw.WebGLRenderTarget(i,l,{minFilter:tw.LinearFilter,magFilter:tw.LinearFilter,type:tw.HalfFloatType,...d});return m&&(e.depthTexture=new tw.DepthTexture(i,l,tw.FloatType)),e.samples=c,e},[]);return a.useLayoutEffect(()=>{f.setSize(i,l),c&&(f.samples=c)},[c,f,i,l]),a.useEffect(()=>()=>f.dispose(),[]),f}(t);a.useLayoutEffect(()=>{i.manual||(d.current.aspect=u.width/u.height)},[u,i]),a.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let h=0,p=null,g="function"==typeof o;return(0,tS.useFrame)(t=>{g&&(r===1/0||h{if(n)return s(()=>({camera:d.current})),()=>s(()=>({camera:c}))},[d,n,s]),a.createElement(a.Fragment,null,a.createElement("perspectiveCamera",(0,tb.default)({ref:d},i),!g&&o),a.createElement("group",{ref:m},g&&o(f.texture)))});function tj(){let e,t,a=(0,n.c)(3),{fov:o}=(0,_.useSettings)();return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],a[0]=e):e=a[0],a[1]!==o?(t=(0,r.jsx)(tC,{makeDefault:!0,position:e,fov:o}),a[1]=o,a[2]=t):t=a[2],t}var tM=e.i(51434);let tk=(0,a.createContext)(null);function tN(){let e=(0,a.useContext)(tk);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function tT({children:e}){let t=(0,t_.useThree)(e=>e.camera),[n,o]=(0,a.useState)(-1),[i,l]=(0,a.useState)({}),[s,c]=(0,a.useState)(()=>({initialized:!1,position:null,quarternion:null})),u=(0,a.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),d=(0,a.useCallback)(e=>{l(t=>{let{[e.id]:r,...n}=t;return n})},[]),m=Object.keys(i).length,f=(0,a.useCallback)(e=>{if(e>=0&&e{f(m?(n+1)%m:-1)},[m,n,f]);(0,a.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),a=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new tw.Vector3(...n),quarternion:new tw.Quaternion(...a)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,a.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,a.useEffect)(()=>{s.initialized&&!s.position&&m>0&&-1===n&&f(0)},[m,f,n,s]);let p=(0,a.useMemo)(()=>({registerCamera:u,unregisterCamera:d,nextCamera:h,setCameraIndex:f,cameraCount:m}),[u,d,h,f,m]);return 0===m&&-1!==n&&o(-1),(0,r.jsx)(tk.Provider,{value:p,children:e})}var tR=e.i(93784),tD=e.i(65349),tL=e.i(51475),tF=e.i(89119);let tI=(0,M.createLogger)("InputConsumer"),tE=Math.PI/2-.01,tB=1/32,tP=2*Math.PI;function tA(e){return(Math.round(e/tP*65536)<<16>>16)*tP/65536}let tz=new tw.Vector3,tU=new tw.Vector3,tG=new tw.Vector3,tW=new tw.Euler(0,0,0,"YXZ"),tH=new tw.Vector3,tV=new tw.Vector3;function tO(e,t,r,n,a,o,i){if(0===n&&0===a&&0===o)return;let l=Math.sin(t),s=Math.cos(t),c=Math.sin(r),u=Math.cos(r),d=i*tB;e.x+=(s*n+l*u*a+l*c*o)*d,e.y+=(-l*n+s*u*a+s*c*o)*d,e.z+=(-c*a+u*o)*d}function tq(){let{moveQueue:e,mode:t,setMode:r}=(0,tD.useInputContext)(),n=(0,k.useLiveSelector)(e=>e.adapter),o=(0,k.useLiveSelector)(e=>e.gameStatus),i=(0,k.useLiveSelector)(e=>e.sendMoves),l=(0,tf.useEngineStoreApi)(),s=(0,t_.useThree)(e=>e.camera),c=(0,tL.useGetTickFraction)(),u=(0,a.useRef)(null),d=(0,a.useRef)([]),m=(0,a.useRef)(0),f=(0,a.useRef)(0),h=(0,a.useRef)(null),p=(0,a.useRef)(0),g=(0,a.useRef)(0),v=(0,a.useRef)({x:0,y:0,z:0}),x=(0,a.useRef)(0),y=(0,a.useRef)(0),b=(0,a.useRef)({x:0,y:0,z:0}),_=(0,a.useRef)(!1),S=(0,a.useRef)(0),w=(0,a.useRef)(0),C=(0,a.useRef)(0),j=(0,a.useRef)(0),M=(0,a.useRef)(0),N=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),T=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),R=!!n&&("connected"===o||"authenticating"===o);return(0,a.useEffect)(()=>{if(R&&n){if(u.current===n)return;tI.info("wiring adapter to engine store");let e=k.liveConnectionStore.getState(),t={source:"live",duration:1/0,missionName:e.mapName??null,gameType:null,serverDisplayName:e.serverName??null,recorderName:e.warriorName??null,recordingDate:null,streamingPlayback:n};l.getState().setRecording(t),l.getState().setPlaybackStatus("playing"),u.current=n,_.current=!1,d.current.length=0,m.current=0,f.current=0,h.current=null,r("fly")}else if(!R&&u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null,_.current=!1,d.current.length=0,r("local")}},[R,n,l,r]),(0,tL.useTick)(()=>{if(!u.current||"connected"!==o)return;let e=S.current,t=w.current;S.current=0,w.current=0;let n=C.current,a=j.current,l=M.current;C.current=0,j.current=0,M.current=0;let s=[...N.current];N.current.fill(!1),s[2]&&!T.current[2]&&(u.current.toggleObserverMode(),tI.info("observer mode: %s",u.current.observerMode),r("follow"===u.current.observerMode?"follow":"fly")),T.current=s;let c=tA(e),f=tA(t);p.current+=c-e,g.current+=f-t,x.current=p.current,y.current=g.current,b.current={...v.current};let h=p.current-c,_=g.current-f;tO(v.current,h,_,n,a,l,80),s[1]=!0;let k=m.current++,R=d.current;R.push({moveIndex:k,move:{x:n,y:a,z:l,yaw:e,pitch:t,roll:0,trigger:s,freeLook:!1},yaw:c,pitch:f,x:n,y:a,z:l}),R.length>45&&R.splice(0,R.length-45);let D=u.current.lastMoveAck;for(;R.length>0&&R[0].moveIndex0){let e=R.slice(0,31);i(e.map(e=>e.move),e[0].moveIndex)}}),(0,tS.useFrame)((r,n)=>{let a=e.current;if(a.length>0){let t=0,r=0,n=0,c=0,d=0,f=0,h=[!1,!1,!1,!1,!1,!1];for(let e of a){t+=e.deltaYaw,r+=e.deltaPitch,n=e.x,c=e.y,d=e.z,f+=e.delta;for(let t=0;t0&&(tG.multiplyScalar(Math.min(1,e)/e*300*L),i.position.add(tG))}return}}if(!R||!u.current||"connected"!==o)return;let F=u.current,I=F.getSnapshot(),E=I?.camera;if(E&&E!==h.current&&"number"==typeof E.yaw&&"number"==typeof E.pitch){h.current=E;let e=F.lastMoveAck;if(e>f.current){f.current=e;let t=d.current;for(;t.length>0&&t[0].moveIndexe.name===t.orbitTargetId);if(!o)return;tV.copy(o.position);let i=tR.streamPlaybackStore.getState().entities.get(t.orbitTargetId);i?.renderType==="Player"&&(tV.y+=1);let l=Math.sin(n),s=Math.cos(n),c=Math.sin(r),u=Math.cos(r);if(tH.set(-u*s,-l,c*s),tH.lengthSq()>1e-8){tH.normalize();let r=Math.max(.1,t.orbitDistance??4);e.camera.position.copy(tV).addScaledVector(tH,r),e.camera.lookAt(tV)}}(r,E,p.current,g.current)}),(0,a.useEffect)(()=>()=>{if(u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null}},[l]),null}var t$=e.i(77964),tK=e.i(91907),tQ=e.i(25947),tY=e.i(46325),tX=e.i(31999),tZ=e.i(89887);function tJ(e){let t,r,o,i,l=(0,n.c)(12),{entity:s}=e,{registerCamera:c,unregisterCamera:u}=tN(),d=(0,a.useId)(),m=s.cameraDataBlock;l[0]!==s.position?(t=s.position?new tw.Vector3(...s.position):new tw.Vector3,l[0]=s.position,l[1]=t):t=l[1];let f=t;l[2]!==s.rotation?(r=s.rotation?new tw.Quaternion(...s.rotation):new tw.Quaternion,l[2]=s.rotation,l[3]=r):r=l[3];let h=r;return l[4]!==m||l[5]!==d||l[6]!==f||l[7]!==c||l[8]!==h||l[9]!==u?(o=()=>{if("Observer"===m){let e={id:d,position:f,rotation:h};return c(e),()=>{u(e)}}},i=[d,m,c,u,f,h],l[4]=m,l[5]=d,l[6]=f,l[7]=c,l[8]=h,l[9]=u,l[10]=o,l[11]=i):(o=l[10],i=l[11]),(0,a.useEffect)(o,i),null}function t0(e){let t,a=(0,n.c)(3),{entity:o}=e;return a[0]!==o.label||a[1]!==o.position?(t=o.label?(0,r.jsx)(tZ.FloatingLabel,{position:o.position,opacity:.6,children:o.label}):null,a[0]=o.label,a[1]=o.position,a[2]=t):t=a[2],t}var t1=e.i(66027),t2=e.i(63318),t3=e.i(12979),t5=e.i(75567),t4=e.i(47071);let t6={value:!0},t8=` -vec3 terrainLinearToSRGB(vec3 linear) { - vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; - vec3 lower = linear * 12.92; - return mix(lower, higher, step(vec3(0.0031308), linear)); -} - -vec3 terrainSRGBToLinear(vec3 srgb) { - vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); - vec3 lower = srgb / 12.92; - return mix(lower, higher, step(vec3(0.04045), srgb)); -} - -// Debug grid overlay using screen-space derivatives for sharp, anti-aliased lines -// Returns 1.0 on grid lines, 0.0 elsewhere -float terrainDebugGrid(vec2 uv, float gridSize, float lineWidth) { - vec2 scaledUV = uv * gridSize; - vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); - float line = min(grid.x, grid.y); - return 1.0 - min(line / lineWidth, 1.0); -} -`;var t7=e.i(56893),t9=e.i(47021),re=e.i(48066);let rt={0:32,1:32,2:32,3:32,4:32,5:32},rr=(0,a.memo)(function({displacementMap:e,visibilityMask:t,textureNames:n,alphaTextures:o,detailTextureName:i,lightmap:l}){let{debugMode:s}=(0,_.useDebug)(),c=(0,t7.useAnisotropy)(),u=(0,t4.useTexture)(n.map(e=>(0,t3.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,t5.setupTexture)(e,{anisotropy:c}))}),d=i?(0,t3.textureToUrl)(i):null,m=(0,t4.useTexture)(d??t3.FALLBACK_TEXTURE_URL,e=>{(0,t5.setupTexture)(e,{anisotropy:c})}),f=(0,a.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:a,detailTexture:o=null,lightmap:i=null}){e.uniforms.sunLightPointsDown=t6;let l=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:a[r]??32}}),i&&(e.uniforms.terrainLightmap={value:i}),o&&(e.uniforms.detailTexture={value:o},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include ",`#include -varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include ",`#include -vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`)),e.fragmentShader=` -uniform sampler2D albedo0; -uniform sampler2D albedo1; -uniform sampler2D albedo2; -uniform sampler2D albedo3; -uniform sampler2D albedo4; -uniform sampler2D albedo5; -uniform sampler2D mask0; -uniform sampler2D mask1; -uniform sampler2D mask2; -uniform sampler2D mask3; -uniform sampler2D mask4; -uniform sampler2D mask5; -uniform float tiling0; -uniform float tiling1; -uniform float tiling2; -uniform float tiling3; -uniform float tiling4; -uniform float tiling5; -${n?"uniform sampler2D visibilityMask;":""} -${i?"uniform sampler2D terrainLightmap;":""} -uniform bool sunLightPointsDown; -${o?`uniform sampler2D detailTexture; -uniform float detailTiling; -uniform float detailFadeDistance; -varying vec3 vTerrainWorldPos;`:""} - -${t8} - -// Global variable to store shadow factor from RE_Direct for use in output calculation -float terrainShadowFactor = 1.0; -`+e.fragmentShader,n){let t="#include ";e.fragmentShader=e.fragmentShader.replace(t,`${t} - // Early discard for invisible areas (before fog/lighting) - float visibility = texture2D(visibilityMask, vMapUv).r; - if (visibility < 0.5) { - discard; - } - `)}e.fragmentShader=e.fragmentShader.replace("#include ",` - // Sample base albedo layers (sRGB textures auto-decoded to linear by Three.js) - vec2 baseUv = vMapUv; - vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb; - ${l>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""} - ${l>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""} - ${l>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""} - ${l>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""} - ${l>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":""} - - // Sample alpha masks for all layers (use R channel) - // Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices), - // but GPU linear filtering samples at texel centers. This offset aligns them. - vec2 alphaUv = baseUv + vec2(0.5 / 256.0); - float a0 = texture2D(mask0, alphaUv).r; - ${l>1?"float a1 = texture2D(mask1, alphaUv).r;":""} - ${l>2?"float a2 = texture2D(mask2, alphaUv).r;":""} - ${l>3?"float a3 = texture2D(mask3, alphaUv).r;":""} - ${l>4?"float a4 = texture2D(mask4, alphaUv).r;":""} - ${l>5?"float a5 = texture2D(mask5, alphaUv).r;":""} - - // Torque-style additive weighted blending (blender.cc): - // result = tex0 * alpha0 + tex1 * alpha1 + tex2 * alpha2 + ... - // Each layer's alpha map defines its contribution weight. - vec3 blended = c0 * a0; - ${l>1?"blended += c1 * a1;":""} - ${l>2?"blended += c2 * a2;":""} - ${l>3?"blended += c3 * a3;":""} - ${l>4?"blended += c4 * a4;":""} - ${l>5?"blended += c5 * a5;":""} - - // Assign to diffuseColor before lighting - vec3 textureColor = blended; - - ${o?`// Detail texture blending (Torque-style multiplicative blend) - // Sample detail texture at high frequency tiling - vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb; - - // Calculate distance-based fade factor using world positions - // Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance - float distToCamera = distance(vTerrainWorldPos, cameraPosition); - float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0); - - // Torque blending: dst * lerp(1.0, detailTexel, fadeFactor) - // Detail textures are authored with bright values (~0.8 mean), not 0.5 gray - // Direct multiplication adds subtle darkening for surface detail - textureColor *= mix(vec3(1.0), detailColor, detailFade);`:""} - - // Store blended texture in diffuseColor (still in linear space here) - // We'll convert to sRGB in the output calculation - diffuseColor.rgb = textureColor; -`),i&&(e.fragmentShader=e.fragmentShader.replace("#include ",`#include - -// Override RE_Direct to extract shadow factor for Torque-style gamma-space lighting -#undef RE_Direct -void RE_Direct_TerrainShadow( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - // Torque lighting (terrLighting.cc): if light points up, terrain gets only ambient - // This prevents shadow acne from light hitting terrain backfaces - if (!sunLightPointsDown) { - terrainShadowFactor = 0.0; - return; - } - // directLight.color = sunColor * shadowFactor (shadow already applied by Three.js) - // Extract shadow factor by comparing to original sun color - #if ( NUM_DIR_LIGHTS > 0 ) - vec3 originalSunColor = directionalLights[0].color; - float sunMax = max(max(originalSunColor.r, originalSunColor.g), originalSunColor.b); - float shadowedMax = max(max(directLight.color.r, directLight.color.g), directLight.color.b); - terrainShadowFactor = clamp(shadowedMax / max(sunMax, 0.001), 0.0, 1.0); - #endif - // Don't add to reflectedLight - we'll compute lighting in gamma space at output -} -#define RE_Direct RE_Direct_TerrainShadow - -`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include -// Clear indirect diffuse - we'll compute ambient in gamma space -#if defined( RE_IndirectDiffuse ) - irradiance = vec3(0.0); -#endif -`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include - // Clear Three.js lighting - we compute everything in gamma space - reflectedLight.directDiffuse = vec3(0.0); - reflectedLight.indirectDiffuse = vec3(0.0); -`)),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style terrain lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space -{ - // Get texture in sRGB space (undo Three.js linear decode) - vec3 textureSRGB = terrainLinearToSRGB(diffuseColor.rgb); - - ${i?` - // Sample terrain lightmap for smooth NdotL - vec2 lightmapUv = vMapUv + vec2(0.5 / 512.0); - float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r; - - // Get sun and ambient colors from Three.js lights (these ARE sRGB values from mission file) - // Three.js interprets them as linear, but the numerical values are preserved - #if ( NUM_DIR_LIGHTS > 0 ) - vec3 sunColorSRGB = directionalLights[0].color; - #else - vec3 sunColorSRGB = vec3(0.7); - #endif - vec3 ambientColorSRGB = ambientLightColor; - - // Torque formula (terrLighting.cc:471-483): - // lighting = ambient + NdotL * shadowFactor * sunColor - // Clamp lighting to [0,1] before multiplying by texture - vec3 lightingSRGB = clamp(ambientColorSRGB + lightmapNdotL * terrainShadowFactor * sunColorSRGB, 0.0, 1.0); - `:` - // No lightmap - use simple ambient lighting - vec3 lightingSRGB = ambientLightColor; - `} - - // Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space - vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); - - // Convert back to linear for Three.js output pipeline - outgoingLight = terrainSRGBToLinear(resultSRGB) + totalEmissiveRadiance; -} -#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`#if DEBUG_MODE - // Debug mode: overlay green grid matching terrain grid squares (256x256) - float gridIntensity = terrainDebugGrid(vMapUv, 256.0, 1.5); - vec3 gridColor = vec3(0.0, 0.8, 0.4); // Green - gl_FragColor.rgb = mix(gl_FragColor.rgb, gridColor, gridIntensity * 0.1); -#endif - -#include `)}({shader:e,baseTextures:u,alphaTextures:o,visibilityMask:t,tiling:rt,detailTexture:d?m:null,lightmap:l}),(0,t9.injectCustomFog)(e,re.globalFogUniforms)},[u,o,t,m,d,l]),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let p=`${d?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,r.jsx)("meshLambertMaterial",{ref:h,map:e,depthWrite:!0,side:tw.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:f},p)}),rn=(0,a.memo)(function(e){let t,o,i=(0,n.c)(8),{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),i[0]=t):t=i[0],i[1]!==u||i[2]!==d||i[3]!==l||i[4]!==m||i[5]!==c||i[6]!==s?(o=(0,r.jsx)(a.Suspense,{fallback:t,children:(0,r.jsx)(rr,{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m})}),i[1]=u,i[2]=d,i[3]=l,i[4]=m,i[5]=c,i[6]=s,i[7]=o):o=i[7],o}),ra=(0,a.memo)(function(e){let t,a,o,i=(0,n.c)(15),{tileX:l,tileZ:s,blockSize:c,basePosition:u,textureNames:d,geometry:m,displacementMap:f,visibilityMask:h,alphaTextures:p,detailTextureName:g,lightmap:v,visible:x}=e,y=void 0===x||x,b=c/2,_=u.x+l*c+b,S=u.z+s*c+b;i[0]!==_||i[1]!==S?(t=[_,0,S],i[0]=_,i[1]=S,i[2]=t):t=i[2];let w=t;return i[3]!==p||i[4]!==g||i[5]!==f||i[6]!==v||i[7]!==d||i[8]!==h?(a=(0,r.jsx)(rn,{displacementMap:f,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:g,lightmap:v}),i[3]=p,i[4]=g,i[5]=f,i[6]=v,i[7]=d,i[8]=h,i[9]=a):a=i[9],i[10]!==m||i[11]!==w||i[12]!==a||i[13]!==y?(o=(0,r.jsx)("mesh",{position:w,geometry:m,castShadow:!0,receiveShadow:!0,visible:y,children:a}),i[10]=m,i[11]=w,i[12]=a,i[13]=y,i[14]=o):o=i[14],o});function ro(e){}let ri=(0,M.createLogger)("TerrainBlock");function rl(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,a=r>>16,o=256*n;for(let r=0;r0?S.visibleDistance:600,E=(0,t_.useThree)(rc),B=-(128*D);N[0]!==B?(t={x:B,z:B},N[0]=B,N[1]=t):t=N[1];let P=t;N[2]!==T.emptySquareRuns?(o=T.emptySquareRuns??[],N[2]=T.emptySquareRuns,N[3]=o):o=N[3];let A=o,{data:z}=((M=(0,n.c)(8))[0]!==R?(w={queryKey:["terrain",R],queryFn:()=>(ri.debug("Loading terrain: %s",R),(0,t3.loadTerrain)(R))},M[0]=R,M[1]=w):w=M[1],k=(0,t1.useQuery)(w),M[2]!==k.data||M[3]!==k.error||M[4]!==k.status||M[5]!==R?(C=()=>{ri.debug("Query status: %s%s%s file=%s",k.status,k.error?` error=${k.error.message}`:"",k.data?" (data ready)":" (no data)",R)},j=[k.status,k.error,k.data,R],M[2]=k.data,M[3]=k.error,M[4]=k.status,M[5]=R,M[6]=C,M[7]=j):(C=M[6],j=M[7]),(0,a.useEffect)(C,j),k);e:{let e;if(!z){i=null;break e}let t=256*D;N[4]!==t||N[5]!==D||N[6]!==z.heightMap?(!function(e,t,r){let n=e.attributes.position,a=e.attributes.uv,o=e.attributes.normal,i=n.array,l=a.array,s=o.array,c=n.count,u=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),a=Math.floor(r=Math.max(0,Math.min(255,r))),o=Math.min(n+1,255),i=Math.min(a+1,255),l=e-n,s=r-a;return(t[256*a+n]/65535*2048*(1-l)+t[256*a+o]/65535*2048*l)*(1-s)+(t[256*i+n]/65535*2048*(1-l)+t[256*i+o]/65535*2048*l)*s};for(let e=0;e0?(h/=v,p/=v,g/=v):(h=0,p=1,g=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=g}n.needsUpdate=!0,o.needsUpdate=!0}(e=function(e,t){let r=new tw.BufferGeometry,n=new Float32Array(198147),a=new Float32Array(198147),o=new Float32Array(132098),i=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let i=257*t+r;n[3*i]=r*s-e/2,n[3*i+1]=e/2-t*s,n[3*i+2]=0,a[3*i]=0,a[3*i+1]=0,a[3*i+2]=1,o[2*i]=r/256,o[2*i+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,a=(e+1)*257+t,o=a+1;((t^e)&1)==0?(i[l++]=r,i[l++]=a,i[l++]=o,i[l++]=r,i[l++]=o,i[l++]=n):(i[l++]=r,i[l++]=a,i[l++]=n,i[l++]=n,i[l++]=a,i[l++]=o)}return r.setIndex(new tw.BufferAttribute(i,1)),r.setAttribute("position",new tw.Float32BufferAttribute(n,3)),r.setAttribute("normal",new tw.Float32BufferAttribute(a,3)),r.setAttribute("uv",new tw.Float32BufferAttribute(o,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),z.heightMap,D),N[4]=t,N[5]=D,N[6]=z.heightMap,N[7]=e):e=N[7],i=e}let U=i;N[8]!==D||N[9]!==z?(l=()=>{if(z){var e;return ro((e=z.heightMap,(t,r)=>{let n=Math.max(0,Math.min(255,t/D+128)),a=Math.max(0,Math.min(255,r/D+128)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]*(1-c)+e[256*i+l]*c)*(1-u)+(e[256*s+o]*(1-c)+e[256*s+l]*c)*u)/65535*2048})),ru}},s=[z,D],N[8]=D,N[9]=z,N[10]=l,N[11]=s):(l=N[10],s=N[11]),(0,a.useEffect)(l,s);let G=(0,eY.useSceneSun)();t:{let e,t;if(!G){let e;N[12]===Symbol.for("react.memo_cache_sentinel")?(e=new tw.Vector3(.57735,-.57735,.57735),N[12]=e):e=N[12],c=e;break t}N[13]!==G.direction?(e=(0,t2.torqueToThree)(G.direction),N[13]=G.direction,N[14]=e):e=N[14];let[r,n,a]=e,o=Math.sqrt(r*r+n*n+a*a),i=r/o,l=n/o,s=a/o;N[15]!==s||N[16]!==i||N[17]!==l?(t=new tw.Vector3(i,l,s),N[15]=s,N[16]=i,N[17]=l,N[18]=t):t=N[18],c=t}let W=c;r:{let e;if(!z){u=null;break r}N[19]!==D||N[20]!==W||N[21]!==z.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),a=Math.max(0,Math.min(255,r)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]/65535*(1-c)+e[256*i+l]/65535*c)*(1-u)+(e[256*s+o]/65535*(1-c)+e[256*s+l]/65535*c)*u)*2048},a=new tw.Vector3(-t.x,-t.y,-t.z).normalize(),o=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=t/2+.25,l=e/2+.25,s=n(i,l),c=n(i-.5,l),u=n(i+.5,l),d=n(i,l-.5),m=-((n(i,l+.5)-d)/1),f=-((u-c)/1),h=Math.sqrt(m*m+r*r+f*f),p=Math.max(0,m/h*a.x+r/h*a.y+f/h*a.z),g=1;p>0&&(g=function(e,t,r,n,a,o){let i=n.z/a,l=n.x/a,s=n.y,c=Math.sqrt(i*i+l*l);if(c<1e-4)return 1;let u=.5/c,d=i*u,m=l*u,f=s*u,h=e,p=t,g=r+.1;for(let e=0;e<768&&(h+=d,p+=m,g+=f,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(g>2048));e++)if(gArray(Q).fill(null),N[32]=Q,N[33]=g):g=N[33];let[X,Z]=(0,a.useState)(g);N[34]===Symbol.for("react.memo_cache_sentinel")?(v={xStart:0,xEnd:0,zStart:0,zEnd:0},N[34]=v):v=N[34];let J=(0,a.useRef)(v);return(N[35]!==P.x||N[36]!==P.z||N[37]!==F||N[38]!==E.position.x||N[39]!==E.position.z||N[40]!==Q||N[41]!==I?(x=()=>{let e=E.position.x-P.x,t=E.position.z-P.z,r=Math.floor((e-I)/F),n=Math.ceil((e+I)/F),a=Math.floor((t-I)/F),o=Math.ceil((t+I)/F),i=J.current;if(r===i.xStart&&n===i.xEnd&&a===i.zStart&&o===i.zEnd)return;i.xStart=r,i.xEnd=n,i.zStart=a,i.zEnd=o;let l=[];for(let e=r;e{let t=X[e];return(0,r.jsx)(ra,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:F,basePosition:P,textureNames:z.textureNames,geometry:U,displacementMap:V,visibilityMask:q,alphaTextures:$,detailTextureName:L,lightmap:H,visible:null!==t},e)}),N[53]=P,N[54]=F,N[55]=L,N[56]=Y,N[57]=$,N[58]=V,N[59]=U,N[60]=z.textureNames,N[61]=H,N[62]=X,N[63]=b):b=N[63],N[64]!==y||N[65]!==b?(_=(0,r.jsxs)(r.Fragment,{children:[y,b]}),N[64]=y,N[65]=b,N[66]=_):_=N[66],_):(ri.debug("Not ready: terrain=%s geometry=%s displacement=%s alpha=%s",!!z,!!U,!!V,!!$),null)});function rc(e){return e.camera}function ru(){return ro(null)}function rd(e){return(0,t5.setupMask)(e)}function rm(e,t){return t}var rf=e.i(8597),rh=e.i(78140);let rp=` -vec3 interiorLinearToSRGB(vec3 linear) { - vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; - vec3 lower = linear * 12.92; - return mix(lower, higher, step(vec3(0.0031308), linear)); -} - -vec3 interiorSRGBToLinear(vec3 srgb) { - vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); - vec3 lower = srgb / 12.92; - return mix(lower, higher, step(vec3(0.04045), srgb)); -} - -// Debug grid overlay function using screen-space derivatives for sharp, anti-aliased lines -// Returns 1.0 on grid lines, 0.0 elsewhere -float debugGrid(vec2 uv, float gridSize, float lineWidth) { - vec2 scaledUV = uv * gridSize; - vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); - float line = min(grid.x, grid.y); - return 1.0 - min(line / lineWidth, 1.0); -} -`,rg=(0,M.createLogger)("InteriorInstance");function rv({materialName:e,material:t,lightMap:n}){let o=(0,_.useDebug)(),i=o?.debugMode??!1,l=(0,t7.useAnisotropy)(),s=(0,t3.textureToUrl)(e),c=(0,t4.useTexture)(s,e=>(0,t5.setupTexture)(e,{anisotropy:l})),u=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),m=(0,a.useCallback)(e=>{let t;(0,t9.injectCustomFog)(e,re.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new tw.Vector3(0,.4,1):new tw.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include -${rp} -uniform bool useSceneLighting; -uniform vec3 interiorDebugColor; -`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Lightmap handled in custom output calculation -#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); -#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space -// Get texture in sRGB space (undo Three.js linear decode) -vec3 textureSRGB = interiorLinearToSRGB(diffuseColor.rgb); - -// Compute lighting in sRGB space -vec3 lightingSRGB = vec3(0.0); - -if (useSceneLighting) { - // Three.js computed: reflectedLight = lighting \xd7 texture_linear / PI - // Extract pure lighting: lighting = reflectedLight \xd7 PI / texture_linear - vec3 totalLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 safeTexLinear = max(diffuseColor.rgb, vec3(0.001)); - vec3 extractedLighting = totalLight * PI / safeTexLinear; - // NOTE: extractedLighting is ALREADY sRGB values because mission sun/ambient colors - // are sRGB values (Torque used them directly in gamma space). Three.js treats them - // as linear but the numerical values are the same. DO NOT convert to sRGB here! - // IMPORTANT: Torque clamps scene lighting to [0,1] BEFORE adding to lightmap - // (sceneLighting.cc line 1785: tmp.clamp()) - lightingSRGB = clamp(extractedLighting, 0.0, 1.0); -} - -// Add lightmap contribution (for BOTH outside and inside surfaces) -// In Torque, scene lighting is ADDED to lightmaps for outside surfaces at mission load -// (stored in .ml files). Inside surfaces only have base lightmap. Both need lightmap here. -#ifdef USE_LIGHTMAP - // Lightmap is stored as linear in Three.js (decoded from sRGB texture), convert back - lightingSRGB += interiorLinearToSRGB(lightMapTexel.rgb); -#endif -// Torque clamps the sum to [0,1] per channel (sceneLighting.cc lines 1817-1827) -lightingSRGB = clamp(lightingSRGB, 0.0, 1.0); - -// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space -vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); - -// Convert back to linear for Three.js output pipeline -vec3 resultLinear = interiorSRGBToLinear(resultSRGB); - -// Reassign outgoingLight before opaque_fragment consumes it -outgoingLight = resultLinear + totalEmissiveRadiance; - -#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`// Debug mode: overlay colored grid on top of normal rendering -// Blue grid = SurfaceOutsideVisible (receives scene ambient light) -// Red grid = inside surface (no scene ambient light) -#if DEBUG_MODE && defined(USE_MAP) - // gridSize=4 creates 4x4 grid per UV tile, lineWidth=1.5 is ~1.5 pixels wide - float gridIntensity = debugGrid(vMapUv, 4.0, 1.5); - gl_FragColor.rgb = mix(gl_FragColor.rgb, interiorDebugColor, gridIntensity * 0.1); -#endif - -#include `)},[d]),f=(0,a.useRef)(null),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=f.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let p={DEBUG_MODE:+!!i},g=`${d}`;return u?(0,r.jsx)("meshBasicMaterial",{ref:f,map:c,toneMapped:!1,defines:p,onBeforeCompile:m},g):(0,r.jsx)("meshLambertMaterial",{ref:h,map:c,lightMap:n,toneMapped:!1,defines:p,onBeforeCompile:m},g)}function rx(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=tw.SRGBColorSpace),t??null}function ry(e){let t,a,o,i=(0,n.c)(13),{node:l}=e;e:{let e,r;if(!l.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],t=e;break e}if(Array.isArray(l.material)){let e;i[1]!==l.material?(e=l.material.map(rb),i[1]=l.material,i[2]=e):e=i[2],t=e;break e}i[3]!==l.material?(e=rx(l.material),i[3]=l.material,i[4]=e):e=i[4],i[5]!==e?(r=[e],i[5]=e,i[6]=r):r=i[6],t=r}let s=t;return i[7]!==s||i[8]!==l.material?(a=l.material?(0,r.jsx)(tY.DebugSuspense,{name:`InteriorTexture:${Array.isArray(l.material)?l.material[0]?.userData?.resource_path:l.material?.userData?.resource_path??"?"}`,fallback:(0,r.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,t)=>(0,r.jsx)(rv,{materialName:e.userData.resource_path,material:e,lightMap:s[t]},t)):(0,r.jsx)(rv,{materialName:l.material.userData.resource_path,material:l.material,lightMap:s[0]})}):null,i[7]=s,i[8]=l.material,i[9]=a):a=i[9],i[10]!==l.geometry||i[11]!==a?(o=(0,r.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:a}),i[10]=l.geometry,i[11]=a,i[12]=o):o=i[12],o}function rb(e){return rx(e)}let r_=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u=(0,n.c)(10),{interiorFile:d,ghostIndex:m}=e,{nodes:f}=((s=(0,n.c)(2))[0]!==d?(l=(0,t3.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],c=l,(0,rh.useGLTF)(c)),h=(0,_.useDebug)(),p=h?.debugMode??!1;return u[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],u[0]=t):t=u[0],u[1]!==f?(a=Object.entries(f).filter(rj).map(rM),u[1]=f,u[2]=a):a=u[2],u[3]!==p||u[4]!==m||u[5]!==d?(o=p?(0,r.jsxs)(tZ.FloatingLabel,{children:[m,": ",d]}):null,u[3]=p,u[4]=m,u[5]=d,u[6]=o):o=u[6],u[7]!==a||u[8]!==o?(i=(0,r.jsxs)("group",{rotation:t,children:[a,o]}),u[7]=a,u[8]=o,u[9]=i):i=u[9],i});function rS(e){let t,a,o,i,l=(0,n.c)(9),{color:s,label:c}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(a=(0,r.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=a):a=l[2],l[3]!==s||l[4]!==c?(o=c?(0,r.jsx)(tZ.FloatingLabel,{color:s,children:c}):null,l[3]=s,l[4]=c,l[5]=o):o=l[5],l[6]!==a||l[7]!==o?(i=(0,r.jsxs)("mesh",{children:[t,a,o]}),l[6]=a,l[7]=o,l[8]=i):i=l[8],i}function rw(e){let t,a=(0,n.c)(3),{label:o}=e,i=(0,_.useDebug)(),l=i?.debugMode??!1;return a[0]!==l||a[1]!==o?(t=l?(0,r.jsx)(rS,{color:"red",label:o}):null,a[0]=l,a[1]=o,a[2]=t):t=a[2],t}let rC=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u,d,m,f=(0,n.c)(26),{scene:h}=e;f[0]!==h.transform.position?(t=(0,t2.torqueToThree)(h.transform.position),f[0]=h.transform.position,f[1]=t):t=f[1];let p=t;f[2]!==h.transform?(a=(0,t2.matrixFToQuaternion)(h.transform),f[2]=h.transform,f[3]=a):a=f[3];let g=a;f[4]!==h.scale?(o=(0,t2.torqueScaleToThree)(h.scale),f[4]=h.scale,f[5]=o):o=f[5];let v=o,x=`${h.ghostIndex}: ${h.interiorFile}`;f[6]!==x?(i=(0,r.jsx)(rw,{label:x}),f[6]=x,f[7]=i):i=f[7],f[8]!==h.interiorFile?(l=e=>{rg.error("Failed to load %s: %s",h.interiorFile,e.message)},f[8]=h.interiorFile,f[9]=l):l=f[9];let y=`InteriorModel:${h.interiorFile}`;return f[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(rS,{color:"orange"}),f[10]=s):s=f[10],f[11]!==h.ghostIndex||f[12]!==h.interiorFile?(c=(0,r.jsx)(r_,{interiorFile:h.interiorFile,ghostIndex:h.ghostIndex}),f[11]=h.ghostIndex,f[12]=h.interiorFile,f[13]=c):c=f[13],f[14]!==y||f[15]!==c?(u=(0,r.jsx)(tY.DebugSuspense,{name:y,fallback:s,children:c}),f[14]=y,f[15]=c,f[16]=u):u=f[16],f[17]!==u||f[18]!==i||f[19]!==l?(d=(0,r.jsx)(rf.ErrorBoundary,{fallback:i,onError:l,children:u}),f[17]=u,f[18]=i,f[19]=l,f[20]=d):d=f[20],f[21]!==p||f[22]!==g||f[23]!==v||f[24]!==d?(m=(0,r.jsx)("group",{position:p,quaternion:g,scale:v,children:d}),f[21]=p,f[22]=g,f[23]=v,f[24]=d,f[25]=m):m=f[25],m});function rj(e){let[,t]=e;return t.isMesh}function rM(e){let[t,n]=e;return(0,r.jsx)(ry,{node:n},t)}var rk=e.i(99143);function rN(e,{path:t}){let[r]=(0,rk.useLoader)(tw.CubeTextureLoader,[e],e=>e.setPath(t));return r}rN.preload=(e,{path:t})=>rk.useLoader.preload(tw.CubeTextureLoader,[e],e=>e.setPath(t));let rT=()=>{};function rR(e){return e.wrapS=tw.RepeatWrapping,e.wrapT=tw.RepeatWrapping,e.minFilter=tw.LinearFilter,e.magFilter=tw.LinearFilter,e.colorSpace=tw.NoColorSpace,e.needsUpdate=!0,e}let rD=` - attribute float alpha; - - uniform vec2 uvOffset; - - varying vec2 vUv; - varying float vAlpha; - - void main() { - // Apply UV offset for scrolling - vUv = uv + uvOffset; - vAlpha = alpha; - - vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - // Set depth to far plane so clouds are always visible and behind other geometry - gl_Position = pos.xyww; - } -`,rL=` - uniform sampler2D cloudTexture; - uniform float debugMode; - uniform int layerIndex; - - varying vec2 vUv; - varying float vAlpha; - - // Debug grid using screen-space derivatives for sharp, anti-aliased lines - float debugGrid(vec2 uv, float gridSize, float lineWidth) { - vec2 scaledUV = uv * gridSize; - vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); - float line = min(grid.x, grid.y); - return 1.0 - min(line / lineWidth, 1.0); - } - - void main() { - vec4 texColor = texture2D(cloudTexture, vUv); - - // Tribes 2 uses GL_MODULATE: final = texture \xd7 vertex color - // Vertex color is white with varying alpha, so: - // Final RGB = Texture RGB \xd7 1.0 = Texture RGB - // Final Alpha = Texture Alpha \xd7 Vertex Alpha - float finalAlpha = texColor.a * vAlpha; - vec3 color = texColor.rgb; - - // Debug mode: overlay R/G/B grid for layers 0/1/2 - if (debugMode > 0.5) { - float gridIntensity = debugGrid(vUv, 4.0, 1.5); - vec3 gridColor; - if (layerIndex == 0) { - gridColor = vec3(1.0, 0.0, 0.0); // Red - } else if (layerIndex == 1) { - gridColor = vec3(0.0, 1.0, 0.0); // Green - } else { - gridColor = vec3(0.0, 0.0, 1.0); // Blue - } - color = mix(color, gridColor, gridIntensity * 0.5); - } - - // Output clouds with texture color and combined alpha - gl_FragColor = vec4(color, finalAlpha); - } -`;function rF({textureUrl:e,radius:t,heightPercent:n,speed:o,windDirection:i,layerIndex:l}){let{debugMode:s}=(0,_.useDebug)(),{animationEnabled:c}=(0,_.useSettings)(),u=(0,a.useRef)(null),d=(0,t4.useTexture)(e,rR),m=(0,a.useMemo)(()=>{let e=n-.05;return function(e,t,r,n){var a;let o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S=new tw.BufferGeometry,w=new Float32Array(75),C=new Float32Array(50),j=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],M=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,a=-e+r*M,o=e-t*M,i=e*j[n];w[3*n]=a,w[3*n+1]=i,w[3*n+2]=o,C[2*n]=r,C[2*n+1]=t}a=w,o=e=>({x:a[3*e],y:a[3*e+1],z:a[3*e+2]}),i=(e,t,r,n)=>{a[3*e]=t,a[3*e+1]=r,a[3*e+2]=n},l=o(1),s=o(3),c=o(5),u=o(6),d=o(8),m=o(9),f=o(15),h=o(16),p=o(18),g=o(19),v=o(21),x=o(23),y=c.x+(l.x-c.x)*.5,b=c.y+(l.y-c.y)*.5,_=c.z+(l.z-c.z)*.5,i(0,u.x+(y-u.x)*2,u.y+(b-u.y)*2,u.z+(_-u.z)*2),y=m.x+(s.x-m.x)*.5,b=m.y+(s.y-m.y)*.5,_=m.z+(s.z-m.z)*.5,i(4,d.x+(y-d.x)*2,d.y+(b-d.y)*2,d.z+(_-d.z)*2),y=v.x+(f.x-v.x)*.5,b=v.y+(f.y-v.y)*.5,_=v.z+(f.z-v.z)*.5,i(20,h.x+(y-h.x)*2,h.y+(b-h.y)*2,h.z+(_-h.z)*2),y=x.x+(g.x-x.x)*.5,b=x.y+(g.y-x.y)*.5,_=x.z+(g.z-x.z)*.5,i(24,p.x+(y-p.x)*2,p.y+(b-p.y)*2,p.z+(_-p.z)*2);let k=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let a=e[3*n],o=e[3*n+2],i=1.3-Math.sqrt(a*a+o*o)/t;i<.4?i=0:i>.8&&(i=1),r[n]=i}return r}(w,e),N=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,a=r+5,o=a+1;N.push(r,a,o),N.push(r,o,n)}return S.setIndex(N),S.setAttribute("position",new tw.Float32BufferAttribute(w,3)),S.setAttribute("uv",new tw.Float32BufferAttribute(C,2)),S.setAttribute("alpha",new tw.Float32BufferAttribute(k,1)),S.computeBoundingSphere(),S}(t,n,e,0)},[t,n]);(0,a.useEffect)(()=>()=>{m.dispose()},[m]);let f=(0,a.useMemo)(()=>new tw.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new tw.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:rD,fragmentShader:rL,transparent:!0,depthWrite:!1,side:tw.DoubleSide}),[d,s,l]);return(0,a.useEffect)(()=>()=>{f.dispose()},[f]),(0,tS.useFrame)(c?(e,t)=>{let r=1e3*t/32;u.current??=new tw.Vector2(0,0),u.current.x+=i.x*o*r,u.current.y+=i.y*o*r,u.current.x-=Math.floor(u.current.x),u.current.y-=Math.floor(u.current.y),f.uniforms.uvOffset.value.copy(u.current)}:rT),(0,r.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,r.jsx)("primitive",{object:f,attach:"material"})})}function rI(e){var t;let o,i,l,s,c,u,d,m,f,h,p,g=(0,n.c)(18),{scene:v}=e,{data:x}=(t=v.materialList||void 0,(h=(0,n.c)(7))[0]!==t?(d=["detailMapList",t],m=()=>(0,t3.loadDetailMapList)(t),h[0]=t,h[1]=d,h[2]=m):(d=h[1],m=h[2]),p=!!t,h[3]!==d||h[4]!==m||h[5]!==p?(f={queryKey:d,queryFn:m,enabled:p},h[3]=d,h[4]=m,h[5]=p,h[6]=f):f=h[6],(0,t1.useQuery)(f)),y=.95*(v.visibleDistance>0?v.visibleDistance:500);g[0]!==v.cloudLayers?(o=v.cloudLayers.map(rB),g[0]=v.cloudLayers,g[1]=o):o=g[1];let b=o;g[2]!==v.cloudLayers?(i=v.cloudLayers.map(rE),g[2]=v.cloudLayers,g[3]=i):i=g[3];let _=i;e:{let e,{x:t,y:r}=v.windVelocity;if(0!==t||0!==r){let e;g[4]!==t||g[5]!==r?(e=new tw.Vector2(r,-t).normalize(),g[4]=t,g[5]=r,g[6]=e):e=g[6],l=e;break e}g[7]===Symbol.for("react.memo_cache_sentinel")?(e=new tw.Vector2(1,0),g[7]=e):e=g[7],l=e}let S=l;t:{let e;if(!x){let e;g[8]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[8]=e):e=g[8],s=e;break t}if(g[9]!==_||g[10]!==b||g[11]!==x){e=[];for(let t=0;t<3;t++){let r=x[7+t];r&&e.push({texture:r,height:_[t],speed:b[t]})}g[9]=_,g[10]=b,g[11]=x,g[12]=e}else e=g[12];s=e}let w=s,C=(0,a.useRef)(null);return(g[13]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{let{camera:t}=e;C.current&&C.current.position.copy(t.position)},g[13]=c):c=g[13],(0,tS.useFrame)(c),w&&0!==w.length)?(g[14]!==w||g[15]!==y||g[16]!==S?(u=(0,r.jsx)("group",{ref:C,children:w.map((e,t)=>{let n=(0,t3.textureToUrl)(e.texture);return(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rF,{textureUrl:n,radius:y,heightPercent:e.height,speed:e.speed,windDirection:S,layerIndex:t})},t)})}),g[14]=w,g[15]=y,g[16]=S,g[17]=u):u=g[17],u):null}function rE(e,t){return e.heightPercent||[.35,.25,.2][t]}function rB(e,t){return e.speed||[1e-4,2e-4,3e-4][t]}e.i(62395);let rP=(0,M.createLogger)("Sky"),rA=!1;function rz(e){return[new tw.Color().setRGB(e.r,e.g,e.b),new tw.Color().setRGB(e.r,e.g,e.b).convertSRGBToLinear()]}function rU({skyBoxFiles:e,fogColor:t,fogState:n}){let o=(0,t_.useThree)(e=>e.camera),i=rN(e,{path:""}),l=!!t,s=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),c=(0,a.useMemo)(()=>n?(0,re.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),u=(0,a.useRef)({skybox:{value:i},fogColor:{value:t??new tw.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:re.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),d=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]);return(0,a.useEffect)(()=>{u.current.skybox.value=i,u.current.fogColor.value=t??new tw.Color(0,0,0),u.current.enableFog.value=l,u.current.fogVolumeData.value=c,u.current.horizonFogHeight.value=d},[i,t,l,c,d]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = vec4(position.xy, 0.9999, 1.0); - } - `,fragmentShader:` - uniform samplerCube skybox; - uniform vec3 fogColor; - uniform bool enableFog; - uniform mat4 inverseProjectionMatrix; - uniform mat4 cameraMatrixWorld; - uniform float cameraHeight; - uniform float fogVolumeData[12]; - uniform float horizonFogHeight; - - varying vec2 vUv; - - // Convert linear to sRGB for display - // shaderMaterial does NOT get automatic linear->sRGB output conversion - // Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js - vec3 linearToSRGB(vec3 linear) { - vec3 low = linear * 12.92; - vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; - return mix(low, high, step(vec3(0.0031308), linear)); - } - - void main() { - vec2 ndc = vUv * 2.0 - 1.0; - vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); - viewPos.xyz /= viewPos.w; - vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); - direction = vec3(direction.z, direction.y, -direction.x); - // Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear - vec4 skyColor = textureCube(skybox, direction); - vec3 finalColor; - - if (enableFog) { - vec3 effectiveFogColor = fogColor; - - // Calculate how much fog volume the ray passes through - // For skybox at "infinite" distance, the relevant height is how much - // of the volume is above/below camera depending on view direction - float volumeFogInfluence = 0.0; - - for (int i = 0; i < 3; i++) { - int offset = i * 4; - float volVisDist = fogVolumeData[offset + 0]; - float volMinH = fogVolumeData[offset + 1]; - float volMaxH = fogVolumeData[offset + 2]; - float volPct = fogVolumeData[offset + 3]; - - if (volVisDist <= 0.0) continue; - - // Check if camera is inside this volume - if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { - // Camera is inside the fog volume - // Looking horizontally or up at shallow angles means ray travels - // through more fog before exiting the volume - float heightAboveCamera = volMaxH - cameraHeight; - float heightBelowCamera = cameraHeight - volMinH; - float volumeHeight = volMaxH - volMinH; - - // For horizontal rays (direction.y ≈ 0), maximum fog influence - // For rays going up steeply, less fog (exits volume quickly) - // For rays going down, more fog (travels through volume below) - float rayInfluence; - if (direction.y >= 0.0) { - // Looking up: influence based on how steep we're looking - // Shallow angles = long path through fog = high influence - rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); - } else { - // Looking down: always high fog (into the volume) - rayInfluence = 1.0; - } - - // Scale by percentage and volume depth factor - volumeFogInfluence += rayInfluence * volPct; - } - } - - // Base fog factor from view direction (for haze at horizon) - // In Torque, the fog "bans" (bands) are rendered as geometry from - // height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox. - // The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3). - // - // horizonFogHeight is the direction.y value where the fog band ends: - // horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2) - // - // For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18 - // - // Torque renders the fog bands as geometry with linear vertex alpha - // interpolation. We use a squared curve (t^2) to create a gentler - // falloff at the top of the gradient, matching Tribes 2's appearance. - float baseFogFactor; - if (direction.y <= 0.0) { - // Looking at or below horizon: full fog - baseFogFactor = 1.0; - } else if (direction.y >= horizonFogHeight) { - // Above fog band: no fog - baseFogFactor = 0.0; - } else { - // Within fog band: squared curve for gentler falloff at top - float t = direction.y / horizonFogHeight; - baseFogFactor = (1.0 - t) * (1.0 - t); - } - - // Combine base fog with volume fog influence - // When inside a volume, increase fog intensity - float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); - - finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor); - } else { - finalColor = skyColor.rgb; - } - // Convert linear result to sRGB for display - gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); - } - `,depthWrite:!1,depthTest:!1})]})}function rG(e){let t,o,i,l,s,c,u,d=(0,n.c)(6),{materialList:m,fogColor:f,fogState:h}=e,{data:p}=((c=(0,n.c)(8))[0]!==m?(i={queryKey:["detailMapList",m],queryFn:()=>(rP.debug("Loading detail map list: %s",m),(0,t3.loadDetailMapList)(m))},c[0]=m,c[1]=i):i=c[1],u=(0,t1.useQuery)(i),c[2]!==m||c[3]!==u.data||c[4]!==u.error||c[5]!==u.status?(l=()=>{rP.debug("DML query status: %s%s%s file=%s",u.status,u.error?` error=${u.error.message}`:"",u.data?` (${u.data.length} entries)`:" (no data)",m)},s=[u.status,u.error,u.data,m],c[2]=m,c[3]=u.data,c[4]=u.error,c[5]=u.status,c[6]=l,c[7]=s):(l=c[6],s=c[7]),(0,a.useEffect)(l,s),u);d[0]!==p?(t=p?[(0,t3.textureToUrl)(p[1]),(0,t3.textureToUrl)(p[3]),(0,t3.textureToUrl)(p[4]),(0,t3.textureToUrl)(p[5]),(0,t3.textureToUrl)(p[0]),(0,t3.textureToUrl)(p[2])]:null,d[0]=p,d[1]=t):t=d[1];let g=t;return g?(d[2]!==f||d[3]!==h||d[4]!==g?(o=(0,r.jsx)(rU,{skyBoxFiles:g,fogColor:f,fogState:h}),d[2]=f,d[3]=h,d[4]=g,d[5]=o):o=d[5],o):null}function rW({skyColor:e,fogColor:t,fogState:n}){let o=(0,t_.useThree)(e=>e.camera),i=!!t,l=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),s=(0,a.useMemo)(()=>n?(0,re.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),c=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]),u=(0,a.useRef)({skyColor:{value:e},fogColor:{value:t??new tw.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:re.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,a.useEffect)(()=>{u.current.skyColor.value=e,u.current.fogColor.value=t??new tw.Color(0,0,0),u.current.enableFog.value=i,u.current.fogVolumeData.value=s,u.current.horizonFogHeight.value=c},[e,t,i,s,c]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = vec4(position.xy, 0.9999, 1.0); - } - `,fragmentShader:` - uniform vec3 skyColor; - uniform vec3 fogColor; - uniform bool enableFog; - uniform mat4 inverseProjectionMatrix; - uniform mat4 cameraMatrixWorld; - uniform float cameraHeight; - uniform float fogVolumeData[12]; - uniform float horizonFogHeight; - - varying vec2 vUv; - - // Convert linear to sRGB for display - vec3 linearToSRGB(vec3 linear) { - vec3 low = linear * 12.92; - vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; - return mix(low, high, step(vec3(0.0031308), linear)); - } - - void main() { - vec2 ndc = vUv * 2.0 - 1.0; - vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); - viewPos.xyz /= viewPos.w; - vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); - direction = vec3(direction.z, direction.y, -direction.x); - - vec3 finalColor; - - if (enableFog) { - // Calculate volume fog influence (same logic as SkyBoxTexture) - float volumeFogInfluence = 0.0; - - for (int i = 0; i < 3; i++) { - int offset = i * 4; - float volVisDist = fogVolumeData[offset + 0]; - float volMinH = fogVolumeData[offset + 1]; - float volMaxH = fogVolumeData[offset + 2]; - float volPct = fogVolumeData[offset + 3]; - - if (volVisDist <= 0.0) continue; - - if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { - float rayInfluence; - if (direction.y >= 0.0) { - rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); - } else { - rayInfluence = 1.0; - } - volumeFogInfluence += rayInfluence * volPct; - } - } - - // Base fog factor from view direction - float baseFogFactor; - if (direction.y <= 0.0) { - baseFogFactor = 1.0; - } else if (direction.y >= horizonFogHeight) { - baseFogFactor = 0.0; - } else { - float t = direction.y / horizonFogHeight; - baseFogFactor = (1.0 - t) * (1.0 - t); - } - - // Combine base fog with volume fog influence - float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); - - finalColor = mix(skyColor, fogColor, finalFogFactor); - } else { - finalColor = skyColor; - } - - gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); - } - `,depthWrite:!1,depthTest:!1})]})}function rH(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function rV({fogState:e,enabled:t}){let r=(0,t_.useThree)(e=>e.scene),n=(0,t_.useThree)(e=>e.camera),o=(0,a.useRef)(null),i=(0,a.useMemo)(()=>(0,re.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,a.useEffect)(()=>{rA||((0,t9.installCustomFogShader)(),rA=!0)},[]),(0,a.useEffect)(()=>{(0,re.resetGlobalFogUniforms)();let[t,a]=rH(e,n.position.y),l=new tw.Fog(e.fogColor,t,a);return r.fog=l,o.current=l,(0,re.updateGlobalFogUniforms)(n.position.y,i),()=>{r.fog=null,o.current=null,(0,re.resetGlobalFogUniforms)()}},[r,n,e,i]),(0,a.useEffect)(()=>{let r=o.current;if(r)if(t){let[t,a]=rH(e,n.position.y);r.near=t,r.far=a}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,tS.useFrame)(()=>{let r=o.current;if(!r)return;let a=n.position.y;if((0,re.updateGlobalFogUniforms)(a,i,t),t){let[t,n]=rH(e,a);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}let rO=(0,a.memo)(function({entity:e}){let{skyData:t}=e;rP.debug("Rendering: materialList=%s, useSkyTextures=%s",t.materialList,t.useSkyTextures);let{fogEnabled:n}=(0,_.useSettings)(),o=t.materialList||void 0,i=(0,a.useMemo)(()=>rz(t.skySolidColor),[t.skySolidColor]),l=t.useSkyTextures,s=(0,a.useMemo)(()=>(function(e){let t=e.fogDistance,r=e.visibleDistance>0?e.visibleDistance:1e3,{r:n,g:a,b:o}=e.fogColor,i=new tw.Color().setRGB(n,a,o).convertSRGBToLinear(),l=[];for(let t of e.fogVolumes)t.visibleDistance<=0||t.maxHeight<=t.minHeight||l.push({visibleDistance:t.visibleDistance,minHeight:t.minHeight,maxHeight:t.maxHeight,percentage:1});let s=l.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:t,visibleDistance:r,fogColor:i,fogVolumes:l,fogLine:s,enabled:r>t}})(t),[t]);rP.debug("fogState: fogColor=(%s, %s, %s) visibleDistance=%d fogDistance=%d enabled=%s volumes=%d",t.fogColor.r.toFixed(3),t.fogColor.g.toFixed(3),t.fogColor.b.toFixed(3),t.visibleDistance,t.fogDistance,s.enabled,s.fogVolumes.length);let c=(0,a.useMemo)(()=>rz(t.fogColor),[t.fogColor]),u=i||c,d=s.enabled&&n,m=s.fogColor,f=(0,t_.useThree)(e=>e.scene),h=(0,t_.useThree)(e=>e.gl);(0,a.useEffect)(()=>{if(d){let e=m.clone();f.background=e,h.setClearColor(e)}else if(u){let e=u[0].clone();f.background=e,h.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,h,d,m,u]);let p=i?.[1];return(0,r.jsxs)(r.Fragment,{children:[o&&l&&o.length>0?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rG,{materialList:o,fogColor:d?m:void 0,fogState:d?s:void 0},o)}):p?(0,r.jsx)(rW,{skyColor:p,fogColor:d?m:void 0,fogState:d?s:void 0}):null,(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rI,{scene:t})}),s.enabled?(0,r.jsx)(rV,{fogState:s,enabled:n}):null]})});function rq(e){let t,o=(0,n.c)(3),{children:i}=e,{audioEnabled:l}=(0,_.useSettings)();return o[0]!==l||o[1]!==i?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=l,o[1]=i,o[2]=t):t=o[2],t}function r$(e,t){let o=(0,a.lazy)(()=>t().then(t=>({default:t[e]}))),i=t=>{let a,i,l=(0,n.c)(5),{entity:s}=t,c=`${e}:${s.id}`;return l[0]!==s?(a=(0,r.jsx)(o,{entity:s}),l[0]=s,l[1]=a):a=l[1],l[2]!==c||l[3]!==a?(i=(0,r.jsx)(tY.DebugSuspense,{name:c,children:a}),l[2]=c,l[3]=a,l[4]=i):i=l[4],i};return i.displayName=`createLazy(${e})`,i}let rK=r$("PlayerModel",()=>e.A(30814)),rQ=r$("ExplosionShape",()=>e.A(44325)),rY=r$("TracerProjectile",()=>e.A(62125)),rX=r$("SpriteProjectile",()=>e.A(62125)),rZ=r$("ForceFieldBare",()=>e.A(25147)),rJ=r$("AudioEmitter",()=>e.A(61921)),r0=r$("WaterBlock",()=>e.A(18599)),r1=r$("WeaponModel",()=>e.A(44325)),r2={1:"Storm",2:"Inferno"},r3=(0,a.memo)(function(e){let t=(0,n.c)(26),{entity:a}=e;switch(a.renderType){case"Shape":{let e;return t[0]!==a?(e=(0,r.jsx)(r5,{entity:a}),t[0]=a,t[1]=e):e=t[1],e}case"ForceFieldBare":{let e;return t[2]!==a?(e=(0,r.jsx)(rZ,{entity:a}),t[2]=a,t[3]=e):e=t[3],e}case"Player":{let e;return t[4]!==a?(e=(0,r.jsx)(rK,{entity:a}),t[4]=a,t[5]=e):e=t[5],e}case"Explosion":{let e;return t[6]!==a?(e=(0,r.jsx)(rQ,{entity:a}),t[6]=a,t[7]=e):e=t[7],e}case"Tracer":{let e;return t[8]!==a?(e=(0,r.jsx)(rY,{entity:a}),t[8]=a,t[9]=e):e=t[9],e}case"Sprite":{let e;return t[10]!==a?(e=(0,r.jsx)(rX,{entity:a}),t[10]=a,t[11]=e):e=t[11],e}case"AudioEmitter":{let e;return t[12]!==a?(e=(0,r.jsx)(rq,{children:(0,r.jsx)(rJ,{entity:a})}),t[12]=a,t[13]=e):e=t[13],e}case"Camera":{let e;return t[14]!==a?(e=(0,r.jsx)(tJ,{entity:a}),t[14]=a,t[15]=e):e=t[15],e}case"WayPoint":{let e;return t[16]!==a?(e=(0,r.jsx)(t0,{entity:a}),t[16]=a,t[17]=e):e=t[17],e}case"TerrainBlock":{let e;return t[18]!==a.terrainData?(e=(0,r.jsx)(rs,{scene:a.terrainData}),t[18]=a.terrainData,t[19]=e):e=t[19],e}case"InteriorInstance":{let e;return t[20]!==a.interiorData?(e=(0,r.jsx)(rC,{scene:a.interiorData}),t[20]=a.interiorData,t[21]=e):e=t[21],e}case"Sky":{let e;return t[22]!==a?(e=(0,r.jsx)(rO,{entity:a}),t[22]=a,t[23]=e):e=t[23],e}case"Sun":case"MissionArea":case"None":default:return null;case"WaterBlock":{let e;return t[24]!==a?(e=(0,r.jsx)(r0,{entity:a}),t[24]=a,t[25]=e):e=t[25],e}}});function r5(e){let t,o,i,l,s,c,u,d=(0,n.c)(24),{entity:m}=e,{animationEnabled:f}=(0,_.useSettings)(),h=(0,a.useRef)(null);if(d[0]!==f||d[1]!==m.rotate?(t=()=>{if(!h.current||!m.rotate||!f)return;let e=performance.now()/1e3;h.current.rotation.y=e/3*Math.PI*2},d[0]=f,d[1]=m.rotate,d[2]=t):t=d[2],(0,tS.useFrame)(t),!m.shapeName)throw Error(`Shape entity missing shapeName: ${m.id}`);let p=m.runtimeObject,g=m.shapeType??"StaticShape",v=m.dataBlock?.toLowerCase()==="flag",x=m.teamId&&m.teamId>0?r2[m.teamId]:null,y=v&&x?`${x} Flag`:null,b="Item"===m.shapeType?"pink":m.threads?"#00ff88":"yellow",S=m.rotate?h:void 0,w=p?void 0:m;return d[3]!==y?(o=y?(0,r.jsx)(tZ.FloatingLabel,{opacity:.6,children:y}):null,d[3]=y,d[4]=o):o=d[4],d[5]!==b||d[6]!==w||d[7]!==o?(i=(0,r.jsx)(tK.ShapeRenderer,{loadingColor:b,streamEntity:w,children:o}),d[5]=b,d[6]=w,d[7]=o,d[8]=i):i=d[8],d[9]!==m.barrelShapeName||d[10]!==p?(l=m.barrelShapeName&&(0,r.jsx)(tQ.ShapeInfoProvider,{object:p,shapeName:m.barrelShapeName,type:"Turret",children:(0,r.jsx)("group",{position:[0,1.5,0],children:(0,r.jsx)(tK.ShapeRenderer,{})})}),d[9]=m.barrelShapeName,d[10]=p,d[11]=l):l=d[11],d[12]!==m?(s=m.weaponShape&&(0,r.jsx)(tX.ShapeErrorBoundary,{fallback:(0,r.jsx)(tK.ShapePlaceholder,{color:"red",label:m.weaponShape}),children:(0,r.jsx)(tY.DebugSuspense,{name:`Weapon:${m.id}/${m.weaponShape}`,fallback:(0,r.jsx)(tK.ShapePlaceholder,{color:"cyan",label:m.weaponShape}),children:(0,r.jsx)(r1,{entity:m})})}),d[12]=m,d[13]=s):s=d[13],d[14]!==S||d[15]!==i||d[16]!==l||d[17]!==s?(c=(0,r.jsxs)("group",{ref:S,children:[i,l,s]}),d[14]=S,d[15]=i,d[16]=l,d[17]=s,d[18]=c):c=d[18],d[19]!==m.shapeName||d[20]!==g||d[21]!==c||d[22]!==p?(u=(0,r.jsx)(tQ.ShapeInfoProvider,{object:p,shapeName:m.shapeName,type:g,children:c}),d[19]=m.shapeName,d[20]=g,d[21]=c,d[22]=p,d[23]=u):u=d[23],u}var r4=e.i(60099),r6=e.i(85557),r8=e.i(29418);let r7=(0,t3.textureToUrl)("gui/hud_alliedtriangle"),r9=(0,t3.textureToUrl)("gui/hud_enemytriangle"),ne=new tw.Vector3,nt=[];function nr(e){let t,o,i,l,s,c=(0,n.c)(21),{entity:u}=e,d=(0,tK.useStaticShape)(u.shapeName??u.dataBlock),m=(0,t_.useThree)(na),f=(0,a.useRef)(null),h=(0,a.useRef)(null),p=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(null),[x,y]=(0,a.useState)(!0),b=(0,a.useRef)(null);c[0]!==d.scene?(t=new tw.Box3().setFromObject(d.scene),c[0]=d.scene,c[1]=t):t=c[1];let _=t.max.y+.1,S=u.keyframes??nt;c[2]!==S?(o=S.some(nn),c[2]=S,c[3]=o):o=c[3];let w=o;c[4]!==m||c[5]!==u.id||c[6]!==u.iffColor||c[7]!==u.playerName||c[8]!==w||c[9]!==x||c[10]!==S?(i=()=>{let e=f.current;if(!e)return;e.getWorldPosition(ne);let t=m.position.distanceTo(ne),r=m.matrixWorld.elements,n=!(-((ne.x-r[12])*r[8])+-((ne.y-r[13])*r[9])+-((ne.z-r[14])*r[10])<0)&&t<150;if(x!==n&&y(n),!n)return;let a=(0,r6.getKeyframeAtTime)(S,tR.streamPlaybackStore.getState().time),o=a?.health??1;if(a?.damageState!=null&&a.damageState>=1){h.current&&(h.current.style.opacity="0"),p.current&&(p.current.style.opacity="0");return}let i=Math.max(0,Math.min(1,1-t/150)).toString();if(h.current&&(h.current.style.opacity=i),p.current&&(p.current.style.opacity=i),b.current){let e=u.playerName??u.id;b.current.textContent!==e&&(b.current.textContent=e)}if(v.current&&u.iffColor){let e=u.iffColor.r>u.iffColor.g?r9:r7;v.current.getAttribute("src")!==e&&(v.current.src=e)}g.current&&w&&(g.current.style.width=`${Math.max(0,Math.min(100,100*o))}%`,g.current.style.background=u.iffColor?`rgb(${u.iffColor.r}, ${u.iffColor.g}, ${u.iffColor.b})`:"")},c[4]=m,c[5]=u.id,c[6]=u.iffColor,c[7]=u.playerName,c[8]=w,c[9]=x,c[10]=S,c[11]=i):i=c[11],(0,tS.useFrame)(i);let C=u.iffColor&&u.iffColor.r>u.iffColor.g?r9:r7;return c[12]!==u.id||c[13]!==u.playerName||c[14]!==w||c[15]!==_||c[16]!==C||c[17]!==x?(l=x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(r4.Html,{position:[0,_,0],center:!0,children:(0,r.jsx)("div",{ref:h,className:r8.default.Top,children:(0,r.jsx)("img",{ref:v,className:r8.default.IffArrow,src:C,alt:""})})}),(0,r.jsx)(r4.Html,{position:[0,-.2,0],center:!0,children:(0,r.jsxs)("div",{ref:p,className:r8.default.Bottom,children:[(0,r.jsx)("div",{ref:b,className:r8.default.Name,children:u.playerName??u.id}),w&&(0,r.jsx)("div",{className:r8.default.HealthBar,children:(0,r.jsx)("div",{ref:g,className:r8.default.HealthFill})})]})})]}),c[12]=u.id,c[13]=u.playerName,c[14]=w,c[15]=_,c[16]=C,c[17]=x,c[18]=l):l=c[18],c[19]!==l?(s=(0,r.jsx)("group",{ref:f,children:l}),c[19]=l,c[20]=s):s=c[20],s}function nn(e){return null!=e.health}function na(e){return e.camera}var no=e.i(78779);let ni=(0,t3.textureToUrl)("commander/MiniIcons/com_flag_grey"),nl=new tw.Vector3;function ns(e){let t,o,i,l,s,c=(0,n.c)(9),{entity:u}=e,d=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),h=(0,t_.useThree)(nc);c[0]!==h||c[1]!==u.iffColor?(t=()=>{if(m.current&&u.iffColor){let{r:e,g:t,b:r}=u.iffColor;m.current.style.backgroundColor=`rgb(${e},${t},${r})`}if(f.current&&d.current){d.current.getWorldPosition(nl);let e=h.position.distanceTo(nl);f.current.textContent=e.toFixed(1)}},c[0]=h,c[1]=u.iffColor,c[2]=t):t=c[2],(0,tS.useFrame)(t);let p=u.iffColor?`rgb(${u.iffColor.r},${u.iffColor.g},${u.iffColor.b})`:"rgb(200,200,200)";c[3]===Symbol.for("react.memo_cache_sentinel")?(o=[0,1.5,0],c[3]=o):o=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)("span",{ref:f,className:no.default.Distance}),c[4]=i):i=c[4],c[5]!==p?(l={backgroundColor:p,"--flag-icon-url":`url(${ni})`},c[5]=p,c[6]=l):l=c[6];let g=l;return c[7]!==g?(s=(0,r.jsx)("group",{ref:d,children:(0,r.jsx)(r4.Html,{position:o,center:!0,children:(0,r.jsxs)("div",{className:no.default.Root,children:[i,(0,r.jsx)("div",{ref:m,className:no.default.Icon,style:g})]})})}),c[7]=g,c[8]=s):s=c[8],s}function nc(e){return e.camera}function nu(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("group",{ref:nd,children:(0,r.jsx)(nm,{})}),t[0]=e):e=t[0],e}function nd(e){tR.streamPlaybackStore.setState({root:e})}let nm=(0,a.memo)(function(){let e=(0,eY.useAllGameEntities)(),t=(0,a.useRef)(new Map).current,n=new Set;for(let r of e)n.add(r.id),t.set(r.id,r);for(let e of t.keys())n.has(e)||t.delete(e);return(0,r.jsx)(r.Fragment,{children:[...t.values()].map(e=>(0,r.jsx)(nf,{entity:e},e.id))})}),nf=(0,a.memo)(function(e){let t,a=(0,n.c)(7),{entity:o}=e;if((0,t$.isSceneEntity)(o)){let e,t;return a[0]!==o?(e=(0,r.jsx)(r3,{entity:o}),a[0]=o,a[1]=e):e=a[1],a[2]!==o.id||a[3]!==e?(t=(0,r.jsx)("group",{name:o.id,children:e}),a[2]=o.id,a[3]=e,a[4]=t):t=a[4],t}return"None"===o.renderType?null:(a[5]!==o?(t=(0,r.jsx)(nv,{entity:o}),a[5]=o,a[6]=t):t=a[6],t)});function nh(e){let t,a=(0,n.c)(2),{entity:o}=e,i=(0,tf.useEngineSelector)(np);return o.id===i?null:(a[0]!==o?(t=(0,r.jsx)(nr,{entity:o}),a[0]=o,a[1]=t):t=a[1],t)}function np(e){return e.playback.streamSnapshot?.controlPlayerGhostId}function ng({entity:e}){let t=(0,a.useRef)(!1),[n,o]=(0,a.useState)(()=>((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0);return(t.current=n,(0,tS.useFrame)(()=>{let r=((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0;r!==t.current&&(t.current=r,o(r))}),n)?(0,r.jsx)(ns,{entity:e}):null}function nv(e){let t,a,o,i,l,s,c,u,d=(0,n.c)(39),{entity:m}=e,f=m.position,h=m.scale;e:{let e;if(!m.rotation){t=void 0;break e}d[0]!==m.rotation?(e=new tw.Quaternion(...m.rotation),d[0]=m.rotation,d[1]=e):e=d[1],t=e}let p=t,g="Player"===m.renderType;if("Shape"===m.renderType&&!m.shapeName){let e,t,n,a,o,i=m.id;return d[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("sphereGeometry",{args:[.3,6,4]}),d[2]=e):e=d[2],d[3]!==m.className?(t=(0,r6.entityTypeColor)(m.className),d[3]=m.className,d[4]=t):t=d[4],d[5]!==t?(n=(0,r.jsxs)("mesh",{children:[e,(0,r.jsx)("meshBasicMaterial",{color:t,wireframe:!0})]}),d[5]=t,d[6]=n):n=d[6],d[7]!==m?(a=(0,r.jsx)(ng,{entity:m}),d[7]=m,d[8]=a):a=d[8],d[9]!==m.id||d[10]!==f||d[11]!==p||d[12]!==h||d[13]!==n||d[14]!==a?(o=(0,r.jsxs)("group",{name:i,position:f,quaternion:p,scale:h,children:[n,a]}),d[9]=m.id,d[10]=f,d[11]=p,d[12]=h,d[13]=n,d[14]=a,d[15]=o):o=d[15],o}d[16]!==m.className||d[17]!==m.renderType?(a="Explosion"===m.renderType?null:(0,r.jsxs)("mesh",{children:[(0,r.jsx)("sphereGeometry",{args:[.5,8,6]}),(0,r.jsx)("meshBasicMaterial",{color:(0,r6.entityTypeColor)(m.className),wireframe:!0})]}),d[16]=m.className,d[17]=m.renderType,d[18]=a):a=d[18];let v=a;return d[19]!==m?(o=(0,r.jsx)(r3,{entity:m}),d[19]=m,d[20]=o):o=d[20],d[21]!==v||d[22]!==o?(i=(0,r.jsx)(tX.ShapeErrorBoundary,{fallback:v,children:o}),d[21]=v,d[22]=o,d[23]=i):i=d[23],d[24]!==m||d[25]!==g?(l=g&&(0,r.jsx)(nh,{entity:m}),d[24]=m,d[25]=g,d[26]=l):l=d[26],d[27]!==m?(s=(0,r.jsx)(ng,{entity:m}),d[27]=m,d[28]=s):s=d[28],d[29]!==i||d[30]!==l||d[31]!==s?(c=(0,r.jsxs)("group",{name:"model",children:[i,l,s]}),d[29]=i,d[30]=l,d[31]=s,d[32]=c):c=d[32],d[33]!==m.id||d[34]!==f||d[35]!==p||d[36]!==h||d[37]!==c?(u=(0,r.jsx)("group",{name:m.id,position:f,quaternion:p,scale:h,children:c}),d[33]=m.id,d[34]=f,d[35]=p,d[36]=h,d[37]=c,d[38]=u):u=d[38],u}let nx=(0,M.createLogger)("SceneLighting");function ny(){let e,t,o,i=(0,n.c)(6),l=(0,eY.useSceneSun)();if(i[0]!==l?(e=()=>{l?nx.debug("sunData: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",l.direction.x.toFixed(3),l.direction.y.toFixed(3),l.direction.z.toFixed(3),l.color.r.toFixed(3),l.color.g.toFixed(3),l.color.b.toFixed(3),l.ambient.r.toFixed(3),l.ambient.g.toFixed(3),l.ambient.b.toFixed(3)):nx.debug("No sunData — using fallback ambient #888")},t=[l],i[0]=l,i[1]=e,i[2]=t):(e=i[1],t=i[2]),(0,a.useEffect)(e,t),!l){let e;return i[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("ambientLight",{color:"#888888",intensity:1}),i[3]=e):e=i[3],e}return i[4]!==l?(o=(0,r.jsx)(nb,{sunData:l}),i[4]=l,i[5]=o):o=i[5],o}function nb(e){let t,o,i,l,s,c,u,d,m,f,h=(0,n.c)(29),{sunData:p}=e;h[0]!==p.direction?(t=(0,t2.torqueToThree)(p.direction),h[0]=p.direction,h[1]=t):t=h[1];let[g,v,x]=t,y=Math.sqrt(g*g+v*v+x*x),b=g/y,_=v/y,S=x/y;h[2]!==b||h[3]!==_||h[4]!==S?(o=new tw.Vector3(b,_,S),h[2]=b,h[3]=_,h[4]=S,h[5]=o):o=h[5];let w=o,C=-(5e3*w.x),j=-(5e3*w.y),M=-(5e3*w.z);h[6]!==C||h[7]!==j||h[8]!==M?(i=new tw.Vector3(C,j,M),h[6]=C,h[7]=j,h[8]=M,h[9]=i):i=h[9];let k=i;h[10]!==p.color.b||h[11]!==p.color.g||h[12]!==p.color.r?(l=new tw.Color(p.color.r,p.color.g,p.color.b),h[10]=p.color.b,h[11]=p.color.g,h[12]=p.color.r,h[13]=l):l=h[13];let N=l;h[14]!==p.ambient.b||h[15]!==p.ambient.g||h[16]!==p.ambient.r?(s=new tw.Color(p.ambient.r,p.ambient.g,p.ambient.b),h[14]=p.ambient.b,h[15]=p.ambient.g,h[16]=p.ambient.r,h[17]=s):s=h[17];let T=s,R=w.y<0;return h[18]!==R?(c=()=>{t6.value=R},u=[R],h[18]=R,h[19]=c,h[20]=u):(c=h[19],u=h[20]),(0,a.useEffect)(c,u),h[21]!==N||h[22]!==k?(d=(0,r.jsx)("directionalLight",{position:k,color:N,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),h[21]=N,h[22]=k,h[23]=d):d=h[23],h[24]!==T?(m=(0,r.jsx)("ambientLight",{color:T,intensity:1}),h[24]=T,h[25]=m):m=h[25],h[26]!==d||h[27]!==m?(f=(0,r.jsxs)(r.Fragment,{children:[d,m]}),h[26]=d,h[27]=m,h[28]=f):f=h[28],f}function n_(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo,delete window.loadDemoRecording}var nS=e.i(74657),nw=e.i(75056);let nC={toneMapping:tw.NoToneMapping,outputColorSpace:tw.SRGBColorSpace};function nj(e){let t,a,o=(0,n.c)(6),{children:i,renderOnDemand:l,dpr:s,onCreated:c}=e,{renderOnDemand:u}=(0,_.useDebug)(),d=void 0!==l&&l||u?"demand":"always";return o[0]===Symbol.for("react.memo_cache_sentinel")?(t={type:tw.PCFShadowMap},o[0]=t):t=o[0],o[1]!==i||o[2]!==s||o[3]!==c||o[4]!==d?(a=(0,r.jsx)(nw.Canvas,{frameloop:d,dpr:s,gl:nC,shadows:t,onCreated:c,children:i}),o[1]=i,o[2]=s,o[3]=c,o[4]=d,o[5]=a):a=o[5],a}var nM=e.i(12631),nk=e.i(66093),nN=e.i(85413),nT=Object.defineProperty,nR=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?nT(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let nD=new tw.Euler(0,0,0,"YXZ"),nL=new tw.Vector3,nF={type:"change"},nI={type:"lock"},nE={type:"unlock"},nB=Math.PI/2;class nP extends nN.EventDispatcher{constructor(e,t){super(),nR(this,"camera"),nR(this,"domElement"),nR(this,"isLocked"),nR(this,"minPolarAngle"),nR(this,"maxPolarAngle"),nR(this,"pointerSpeed"),nR(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nD.setFromQuaternion(this.camera.quaternion),nD.y-=.002*e.movementX*this.pointerSpeed,nD.x-=.002*e.movementY*this.pointerSpeed,nD.x=Math.max(nB-this.maxPolarAngle,Math.min(nB-this.minPolarAngle,nD.x)),this.camera.quaternion.setFromEuler(nD),this.dispatchEvent(nF))}),nR(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(nI),this.isLocked=!0):(this.dispatchEvent(nE),this.isLocked=!1))}),nR(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),nR(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),nR(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),nR(this,"dispose",()=>{this.disconnect()}),nR(this,"getObject",()=>this.camera),nR(this,"direction",new tw.Vector3(0,0,-1)),nR(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),nR(this,"moveForward",e=>{nL.setFromMatrixColumn(this.camera.matrix,0),nL.crossVectors(this.camera.up,nL),this.camera.position.addScaledVector(nL,e)}),nR(this,"moveRight",e=>{nL.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(nL,e)}),nR(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),nR(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}(t={}).forward="forward",t.backward="backward",t.left="left",t.right="right",t.up="up",t.down="down",t.lookUp="lookUp",t.lookDown="lookDown",t.lookLeft="lookLeft",t.lookRight="lookRight",t.camera1="camera1",t.camera2="camera2",t.camera3="camera3",t.camera4="camera4",t.camera5="camera5",t.camera6="camera6",t.camera7="camera7",t.camera8="camera8",t.camera9="camera9";let nA=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"lookUp",keys:["ArrowUp"]},{name:"lookDown",keys:["ArrowDown"]},{name:"lookLeft",keys:["ArrowLeft"]},{name:"lookRight",keys:["ArrowRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function nz(){let e,t,r,o,i,l,s,c,u,d,m,f,h,p,g=(0,n.c)(38);g[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[0]=e):e=g[0],(0,a.useEffect)(nW,e);let{speedMultiplier:v,setSpeedMultiplier:x,invertScroll:y,invertDrag:b}=(0,_.useControls)(),{onInput:S,mode:w}=(0,tD.useInputContext)(),[C,j]=(0,nM.useKeyboardControls)(),M=(0,t_.useThree)(nG),k=(0,t_.useThree)(nU),{nextCamera:N,setCameraIndex:T,cameraCount:R}=tN(),D=(0,a.useRef)(null);g[1]!==y?(t=()=>y,g[1]=y,g[2]=t):t=g[2];let L=(0,a.useEffectEvent)(t);g[3]!==b?(r=()=>b,g[3]=b,g[4]=r):r=g[4];let F=(0,a.useEffectEvent)(r),I=(0,a.useRef)(0),E=(0,a.useRef)(0),B=(0,a.useRef)(!1),P=(0,a.useRef)(!1);return g[5]!==M||g[6]!==k.domElement?(o=()=>{let e=new nP(M,k.domElement);return D.current=e,()=>{e.dispose()}},i=[M,k.domElement],g[5]=M,g[6]=k.domElement,g[7]=o,g[8]=i):(o=g[7],i=g[8]),(0,a.useEffect)(o,i),g[9]!==F||g[10]!==k.domElement||g[11]!==w||g[12]!==N?(l=()=>{let e=k.domElement,t=!1,r=!1,n=0,a=0,o=o=>{D.current?.isLocked||o.target===e&&(t=!0,r=!1,n=o.clientX,a=o.clientY)},i=e=>{if(D.current?.isLocked){I.current=I.current+.003*e.movementX,E.current=E.current+.003*e.movementY;return}if(!t||!r&&3>Math.abs(e.clientX-n)&&3>Math.abs(e.clientY-a))return;r=!0;let o=F()?-1:1;I.current=I.current+o*e.movementX*.003,E.current=E.current+o*e.movementY*.003},l=()=>{t=!1},s=t=>{let n=D.current;n?.isLocked?"follow"===w?B.current=!0:"local"===w&&N():t.target!==e||r||n?.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",i),document.addEventListener("mouseup",l),document.addEventListener("click",s),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),document.removeEventListener("click",s)}},g[9]=F,g[10]=k.domElement,g[11]=w,g[12]=N,g[13]=l):l=g[13],g[14]!==M||g[15]!==k.domElement||g[16]!==w||g[17]!==N?(s=[M,k.domElement,N,w],g[14]=M,g[15]=k.domElement,g[16]=w,g[17]=N,g[18]=s):s=g[18],(0,a.useEffect)(l,s),g[19]!==R||g[20]!==T||g[21]!==C?(c=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return C(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=L()?-1:1,r=(e.deltaY>0?-1:1)*t,n=Math.max(2,Math.min(10,Math.abs(.01*e.deltaY)))*r;x(e=>{let t=Math.round(100*e)+n;return Math.max(_.MIN_SPEED_MULTIPLIER,Math.min(_.MAX_SPEED_MULTIPLIER,t/100))})},t=k.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},g[24]=L,g[25]=k.domElement,g[26]=x,g[27]=d):d=g[27],g[28]!==k.domElement||g[29]!==x?(m=[k.domElement,x],g[28]=k.domElement,g[29]=x,g[30]=m):m=g[30],(0,a.useEffect)(d,m),g[31]!==w?(f=()=>{if("local"===w)return;let e=e=>{if("KeyO"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(P.current=!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},h=[w],g[31]=w,g[32]=f,g[33]=h):(f=g[32],h=g[33]),(0,a.useEffect)(f,h),g[34]!==j||g[35]!==S||g[36]!==v?(p=(e,t)=>{let{forward:r,backward:n,left:a,right:o,up:i,down:l,lookUp:s,lookDown:c,lookLeft:u,lookRight:d}=j(),m=I.current,f=E.current;I.current=0,E.current=0,u&&(m-=t),d&&(m+=+t),s&&(f-=t),c&&(f+=+t);let h=0,p=0,g=0;a&&(h=-1),o&&(h+=1),r&&(p=1),n&&(p-=1),i&&(g=1),l&&(g-=1);let x=(Math.round(15*((v-_.MIN_SPEED_MULTIPLIER)/(1-_.MIN_SPEED_MULTIPLIER)))+1)/16;h=Math.max(-1,Math.min(1,h*x)),p=Math.max(-1,Math.min(1,p*x)),g=Math.max(-1,Math.min(1,g*x));let y=[!1,!1,!1,!1,!1,!1];B.current&&(y[0]=!0,B.current=!1),P.current&&(y[2]=!0,P.current=!1);let b=0!==m||0!==f,w=0!==h||0!==p||0!==g,C=y.some(Boolean);(b||w||C)&&S({deltaYaw:m,deltaPitch:f,x:h,y:p,z:g,triggers:y,delta:t})},g[34]=j,g[35]=S,g[36]=v,g[37]=p):p=g[37],(0,tS.useFrame)(p),null}function nU(e){return e.gl}function nG(e){return e.camera}function nW(){return window.addEventListener("keydown",nH,{capture:!0}),window.addEventListener("keyup",nH,{capture:!0}),()=>{window.removeEventListener("keydown",nH,{capture:!0}),window.removeEventListener("keyup",nH,{capture:!0})}}function nH(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}let nV=(0,a.lazy)(()=>e.A(34019).then(e=>({default:e.TouchHandler})));function nO(e){let t,o,i,l,s,c=(0,n.c)(9),{children:u}=e;c[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],c[0]=t):t=c[0];let d=(0,a.useRef)(t),[m,f]=(0,a.useState)("local");c[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{d.current.push(e)},c[1]=o):o=c[1];let h=o;return c[2]!==m?(i={moveQueue:d,onInput:h,mode:m,setMode:f},c[2]=m,c[3]=i):i=c[3],c[4]!==u?(l=(0,r.jsx)(nM.KeyboardControls,{map:nA,children:(0,r.jsx)(nk.JoystickProvider,{children:u})}),c[4]=u,c[5]=l):l=c[5],c[6]!==i||c[7]!==l?(s=(0,r.jsx)(tD.InputContext.Provider,{value:i,children:l}),c[6]=i,c[7]=l,c[8]=s):s=c[8],s}function nq(){let e,t,o,i=(0,n.c)(5),l=(0,eQ.useTouchDevice)();return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(nz,{}),i[0]=e):e=i[0],i[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nV,{})}):null,i[1]=l,i[2]=t):t=i[2],i[3]!==t?(o=(0,r.jsxs)(r.Fragment,{children:[e,t]}),i[3]=t,i[4]=o):o=i[4],o}let n$=(0,a.lazy)(()=>e.A(553).then(e=>({default:e.TouchJoystick}))),nK=(0,a.lazy)(()=>e.A(33487).then(e=>({default:e.KeyboardOverlay})));function nQ(){let e,t,o,i=(0,n.c)(7),l=(0,eQ.useTouchDevice)();return i[0]!==l?(e=l?(0,r.jsx)(n$,{}):null,i[0]=l,i[1]=e):e=i[1],i[2]!==l?(t=!1===l?(0,r.jsx)(nK,{}):null,i[2]=l,i[3]=t):t=i[3],i[4]!==e||i[5]!==t?(o=(0,r.jsxs)(a.Suspense,{children:[e,t]}),i[4]=e,i[5]=t,i[6]=o):o=i[6],o}var nY=e.i(89271);function nX(e){let t,a,o,i,l,s=(0,n.c)(11),{isLoading:c,progress:u}=e,d=!c;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:nY.default.Spinner}),s[0]=t):t=s[0];let m=`${100*u}%`;return s[1]!==m?(a=(0,r.jsx)("div",{className:nY.default.Progress,children:(0,r.jsx)("div",{className:nY.default.ProgressBar,style:{width:m}})}),s[1]=m,s[2]=a):a=s[2],s[3]!==u?(o=Math.round(100*u),s[3]=u,s[4]=o):o=s[4],s[5]!==o?(i=(0,r.jsxs)("div",{className:nY.default.ProgressText,children:[o,"%"]}),s[5]=o,s[6]=i):i=s[6],s[7]!==d||s[8]!==a||s[9]!==i?(l=(0,r.jsxs)("div",{className:nY.default.LoadingIndicator,"data-complete":d,children:[t,a,i]}),s[7]=d,s[8]=a,s[9]=i,s[10]=l):l=s[10],l}function nZ(e){let t,o=(0,n.c)(3),{children:i}=e,{debugMode:l}=(0,_.useDebug)();return o[0]!==i||o[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=i,o[1]=l,o[2]=t):t=o[2],t}var nJ=e.i(82156);function n0(e,t){return(0,a.lazy)(()=>t().then(t=>({default:t[e]})))}let n1=n0("StreamingController",()=>e.A(25483)),n2=n0("DemoPlaybackControls",()=>e.A(93884)),n3=n0("DebugElements",()=>e.A(88487)),n5=n0("Mission",()=>e.A(21683)),n4=n0("ChatSoundPlayer",()=>e.A(38496)),n6=n0("PlayerHUD",()=>e.A(57567)),n8=n0("MapInfoDialog",()=>e.A(59197)),n7=n0("ServerBrowser",()=>e.A(70012));function n9(){let[e,t]=(0,nS.useMissionQueryState)(),o=(0,a.useContext)(s),{clearFogEnabledOverride:i,sidebarOpen:l,setSidebarOpen:c}=(0,_.useSettings)(),{missionName:u,missionType:d}=e,[m,f]=(0,a.useState)(!1),[h,p]=(0,a.useState)(!1),[g,S]=(0,a.useState)(!1),[w,C]=(0,a.useState)(0),[j,M]=(0,a.useState)(!0),T=(0,eQ.useTouchDevice)(),R=(0,a.useCallback)(e=>{window.location.hash="",i(),S(!1);let r=k.liveConnectionStore.getState();r.disconnectServer(),r.disconnectRelay(),tf.engineStore.getState().setRecording(null),eY.gameEntityStore.getState().endStreaming(),t(e),T&&c(!1)},[i,t,T,c]);!function(e){let t,r,o=(0,n.c)(5),{onChangeMission:i}=e,{setRecording:l}=(0,N.usePlaybackActions)(),s=(0,a.useEffectEvent)(i);o[0]!==s||o[1]!==l?(t=()=>(window.setMissionName=e=>{let t=(0,eX.getMissionInfo)(e).missionTypes;s({missionName:e,missionType:t[0]})},window.getMissionList=eX.getMissionList,window.getMissionInfo=eX.getMissionInfo,window.loadDemoRecording=l,n_),o[0]=s,o[1]=l,o[2]=t):t=o[2],o[3]!==l?(r=[l],o[3]=l,o[4]=r):r=o[4],(0,a.useEffect)(t,r)}({onChangeMission:R});let D=(0,N.useRecording)(),L=(0,eY.useDataSource)(),F="demo"===L||"live"===L,I=(0,eY.useMissionName)(),E=(0,eY.useMissionType)();(0,a.useEffect)(()=>{if(F&&I)try{let e=(0,eX.getMissionInfo)(I),r=E&&e.missionTypes.includes(E)?E:void 0;t({missionName:I,missionType:r})}catch{t(null)}},[F,I,E,t]),(0,a.useEffect)(()=>{D&&S(!1)},[D]);let B=(0,k.useLiveSelector)(e=>e.gameStatus);(0,a.useEffect)(()=>{"connected"===B&&T&&c(!1)},[B,T,c]),(0,a.useEffect)(()=>{D&&T&&c(!1)},[T,D,c]);let P=w<1;(0,a.useEffect)(()=>{if(P)M(!0);else{let e=setTimeout(()=>M(!1),500);return()=>clearTimeout(e)}},[P]);let A=(0,a.useCallback)((e,t=0)=>{C(t)},[]),z=(0,a.useRef)(null),U=(0,a.useRef)(null);return(0,r.jsx)("main",{className:nJ.default.Frame,children:(0,r.jsxs)(N.RecordingProvider,{children:[(0,r.jsxs)("header",{className:nJ.default.Toolbar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("button",{type:"button",className:nJ.default.ToggleSidebarButton,"data-orientation":"top","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(y,{}):(0,r.jsx)(b,{})}),(0,r.jsx)("button",{type:"button",className:nJ.default.ToggleSidebarButton,"data-orientation":"left","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(v,{}):(0,r.jsx)(x,{})}),(0,r.jsx)(a.Activity,{mode:F&&!g?"visible":"hidden",children:(0,r.jsx)(tg,{})}),(0,r.jsxs)(a.Activity,{mode:!F||g?"visible":"hidden",children:[(0,r.jsx)(tm,{value:g?"":u,missionType:g?"":d,onChange:R,autoFocus:g}),g&&(0,r.jsx)("button",{type:"button",className:nJ.default.CancelButton,onClick:()=>{S(!1)},children:"Cancel"})]})]}),l?(0,r.jsx)("div",{className:nJ.default.Backdrop}):null,(0,r.jsx)(a.Activity,{mode:l?"visible":"hidden",children:(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)("div",{className:nJ.default.Sidebar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-open":l,children:(0,r.jsx)(eJ,{missionName:u,missionType:d,onOpenMapInfo:()=>f(!0),onOpenServerBrowser:o.live?()=>p(!0):void 0,onChooseMap:F?()=>{S(!0)}:void 0,onCancelChoosingMap:()=>{S(!1)},choosingMap:g,cameraRef:z,invalidateRef:U})})})}),(0,r.jsx)(nO,{children:(0,r.jsxs)("div",{className:nJ.default.Content,children:[(0,r.jsx)("div",{className:nJ.default.ThreeView,children:(0,r.jsx)(nj,{dpr:m||h?.25:void 0,onCreated:e=>{z.current=e.camera,U.current=e.invalidate},children:(0,r.jsx)(tL.TickProvider,{children:(0,r.jsxs)(tT,{children:[(0,r.jsx)(nq,{}),(0,r.jsxs)(tM.AudioProvider,{children:[(0,r.jsx)(ny,{}),(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nu,{})}),(0,r.jsx)(tj,{}),(0,r.jsx)(rq,{children:(0,r.jsx)(n4,{})}),(0,r.jsx)(nZ,{children:(0,r.jsx)(n3,{})}),D?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n1,{recording:D})}):null,F?null:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n5,{name:u,missionType:d,onLoadingChange:A},`${u}~${d}`)}),(0,r.jsx)(tq,{})]})]})})})}),F?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n6,{})}):null,(0,r.jsx)(nQ,{}),j&&(0,r.jsx)(nX,{isLoading:P,progress:w})]})}),(0,r.jsx)("footer",{className:nJ.default.PlayerBar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:D?.source==="demo"?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n2,{})}):null}),m?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n8,{onClose:()=>f(!1),missionName:u,missionType:d??""})})}):null,h?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n7,{onClose:()=>p(!1)})})}):null]})})}let ae=new o.QueryClient;function at(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(c,{children:(0,r.jsx)(i.QueryClientProvider,{client:ae,children:(0,r.jsx)(_.SettingsProvider,{children:(0,r.jsx)(n9,{})})})})}),t[0]=e):e=t[0],e}e.s(["default",()=>at],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/26c11097581036eb.js b/docs/_next/static/chunks/26c11097581036eb.js new file mode 100644 index 00000000..2536c2d2 --- /dev/null +++ b/docs/_next/static/chunks/26c11097581036eb.js @@ -0,0 +1,521 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65883,e=>{e.v({ButtonGroup:"InspectorControls-module__gNRB6W__ButtonGroup",ButtonHint:"InspectorControls-module__gNRB6W__ButtonHint",ButtonLabel:"InspectorControls-module__gNRB6W__ButtonLabel",CheckboxField:"InspectorControls-module__gNRB6W__CheckboxField",Control:"InspectorControls-module__gNRB6W__Control",Description:"InspectorControls-module__gNRB6W__Description",Dropdown:"InspectorControls-module__gNRB6W__Dropdown",Field:"InspectorControls-module__gNRB6W__Field",ForceRenderButton:"InspectorControls-module__gNRB6W__ForceRenderButton",Group:"InspectorControls-module__gNRB6W__Group",IconButton:"InspectorControls-module__gNRB6W__IconButton",InspectorControls:"InspectorControls-module__gNRB6W__InspectorControls",Label:"InspectorControls-module__gNRB6W__Label",LabelledButton:"InspectorControls-module__gNRB6W__LabelledButton",MapInfoButton:"InspectorControls-module__gNRB6W__MapInfoButton InspectorControls-module__gNRB6W__IconButton InspectorControls-module__gNRB6W__LabelledButton",Toggle:"InspectorControls-module__gNRB6W__Toggle InspectorControls-module__gNRB6W__IconButton",Tools:"InspectorControls-module__gNRB6W__Tools"})},36679,e=>{e.v({ButtonLabel:"CopyCoordinatesButton-module__BxovtG__ButtonLabel "+e.i(65883).ButtonLabel,ClipboardCheck:"CopyCoordinatesButton-module__BxovtG__ClipboardCheck",MapPin:"CopyCoordinatesButton-module__BxovtG__MapPin",Root:"CopyCoordinatesButton-module__BxovtG__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,showClipboardCheck:"CopyCoordinatesButton-module__BxovtG__showClipboardCheck"})},28903,e=>{e.v({ButtonHint:"LoadDemoButton-module__kGZaoW__ButtonHint "+e.i(65883).ButtonHint,ButtonLabel:"LoadDemoButton-module__kGZaoW__ButtonLabel "+e.i(65883).ButtonLabel,Root:"LoadDemoButton-module__kGZaoW__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton})},9607,e=>{e.v({ButtonHint:"JoinServerButton-module__DIR70a__ButtonHint "+e.i(65883).ButtonHint,PingLabel:"JoinServerButton-module__DIR70a__PingLabel "+e.i(65883).ButtonLabel,Pulsing:"JoinServerButton-module__DIR70a__Pulsing",Root:"JoinServerButton-module__DIR70a__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,TextLabel:"JoinServerButton-module__DIR70a__TextLabel "+e.i(65883).ButtonLabel,blink:"JoinServerButton-module__DIR70a__blink"})},81323,e=>{e.v({AccordionGroup:"Accordion-module__rN-DYq__AccordionGroup",Body:"Accordion-module__rN-DYq__Body",Content:"Accordion-module__rN-DYq__Content",Trigger:"Accordion-module__rN-DYq__Trigger",TriggerIcon:"Accordion-module__rN-DYq__TriggerIcon",slideDown:"Accordion-module__rN-DYq__slideDown",slideUp:"Accordion-module__rN-DYq__slideUp"})},16964,e=>{e.v({ActionButton:"StreamingMissionInfo-module__hEaQnW__ActionButton "+e.i(65883).IconButton,Attribution:"StreamingMissionInfo-module__hEaQnW__Attribution",EjectIcon:"StreamingMissionInfo-module__hEaQnW__EjectIcon",Error:"StreamingMissionInfo-module__hEaQnW__Error",Header:"StreamingMissionInfo-module__hEaQnW__Header",Metadata:"StreamingMissionInfo-module__hEaQnW__Metadata",MissionInfo:"StreamingMissionInfo-module__hEaQnW__MissionInfo",MissionName:"StreamingMissionInfo-module__hEaQnW__MissionName "+e.i(97442).SelectedName,MissionType:"StreamingMissionInfo-module__hEaQnW__MissionType "+e.i(97442).ItemType,MissionTypeDisplayName:"StreamingMissionInfo-module__hEaQnW__MissionTypeDisplayName",PlayerName:"StreamingMissionInfo-module__hEaQnW__PlayerName",RecordingDate:"StreamingMissionInfo-module__hEaQnW__RecordingDate",ServerInfo:"StreamingMissionInfo-module__hEaQnW__ServerInfo",ServerName:"StreamingMissionInfo-module__hEaQnW__ServerName"})},29418,e=>{e.v({Bottom:"PlayerNameplate-module__zYDm0a__Bottom PlayerNameplate-module__zYDm0a__Root",HealthBar:"PlayerNameplate-module__zYDm0a__HealthBar",HealthFill:"PlayerNameplate-module__zYDm0a__HealthFill",IffArrow:"PlayerNameplate-module__zYDm0a__IffArrow",Name:"PlayerNameplate-module__zYDm0a__Name",Root:"PlayerNameplate-module__zYDm0a__Root",Top:"PlayerNameplate-module__zYDm0a__Top PlayerNameplate-module__zYDm0a__Root"})},78779,e=>{e.v({Distance:"FlagMarker-module__INpLba__Distance",Icon:"FlagMarker-module__INpLba__Icon",Root:"FlagMarker-module__INpLba__Root"})},89271,e=>{e.v({LoadingIndicator:"LoadingIndicator-module__F20Nda__LoadingIndicator",Progress:"LoadingIndicator-module__F20Nda__Progress",ProgressBar:"LoadingIndicator-module__F20Nda__ProgressBar",ProgressText:"LoadingIndicator-module__F20Nda__ProgressText",Spinner:"LoadingIndicator-module__F20Nda__Spinner",loadingComplete:"LoadingIndicator-module__F20Nda__loadingComplete",spin:"LoadingIndicator-module__F20Nda__spin"})},82156,e=>{e.v({Backdrop:"MapInspector-module__nU0WNq__Backdrop",CancelButton:"MapInspector-module__nU0WNq__CancelButton",Content:"MapInspector-module__nU0WNq__Content",Frame:"MapInspector-module__nU0WNq__Frame",PlayerBar:"MapInspector-module__nU0WNq__PlayerBar",Sidebar:"MapInspector-module__nU0WNq__Sidebar",ThreeView:"MapInspector-module__nU0WNq__ThreeView",ToggleSidebarButton:"MapInspector-module__nU0WNq__ToggleSidebarButton",Toolbar:"MapInspector-module__nU0WNq__Toolbar",layout:"MapInspector-module__nU0WNq__layout"})},31713,e=>{"use strict";var t,r=e.i(43476),n=e.i(932),a=e.i(71645),o=e.i(17751),i=e.i(12598),l=e.i(38847);let s=(0,a.createContext)({live:!1});function c(e){let t,o,i=(0,n.c)(5),{children:c}=e,[d]=(0,l.useQueryState)("features",l.parseAsString);i[0]!==d?(t=()=>({live:new Set((d??"").split(",").map(u).filter(Boolean)).has("live")}),i[0]=d,i[1]=t):t=i[1];let[m]=(0,a.useState)(t);return i[2]!==c||i[3]!==m?(o=(0,r.jsx)(s.Provider,{value:m,children:c}),i[2]=c,i[3]=m,i[4]=o):o=i[4],o}function u(e){return e.trim().toLowerCase()}var d=e.i(40141);function m(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 21L11.2381 12.2698L15 6L23 21H16ZM8 10L14 21H2L8 10ZM5.5 8C4.11929 8 3 6.88071 3 5.5C3 4.11929 4.11929 3 5.5 3C6.88071 3 8 4.11929 8 5.5C8 6.88071 6.88071 8 5.5 8Z"},child:[]}]})(e)}function f(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0c-41.8 0-77.4 26.7-90.5 64L64 64C28.7 64 0 92.7 0 128L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64l-37.5 0C269.4 26.7 233.8 0 192 0zm0 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM305 273L177 401c-9.4 9.4-24.6 9.4-33.9 0L79 337c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L271 239c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(e)}function h(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"},child:[]}]})(e)}function p(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8V2h6"},child:[]},{tag:"path",attr:{d:"m2 2 10 10"},child:[]},{tag:"path",attr:{d:"M12 2A10 10 0 1 1 2 12"},child:[]}]})(e)}function g(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},child:[]},{tag:"path",attr:{d:"M12 11h4"},child:[]},{tag:"path",attr:{d:"M12 16h4"},child:[]},{tag:"path",attr:{d:"M8 11h.01"},child:[]},{tag:"path",attr:{d:"M8 16h.01"},child:[]}]})(e)}function v(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m16 15-3-3 3-3"},child:[]}]})(e)}function x(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m14 9 3 3-3 3"},child:[]}]})(e)}function y(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m9 16 3-3 3 3"},child:[]}]})(e)}function b(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m15 14-3 3-3-3"},child:[]}]})(e)}var _=e.i(79123),S=e.i(11152),w=e.i(36679);function C(e){let t,o,i,l,s,c=(0,n.c)(12),{cameraRef:u,missionName:d,missionType:m,disabled:h}=e,{fogEnabled:p}=(0,_.useSettings)(),[g,v]=(0,a.useState)(!1),x=(0,a.useRef)(null);c[0]!==u||c[1]!==p||c[2]!==d||c[3]!==m?(t=async()=>{clearTimeout(x.current);let e=u.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,a=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${a}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${m}`),r.set("fog",p.toString());let n=`${window.location.pathname}?${r}${t}`,a=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(a),v(!0),x.current=setTimeout(()=>{v(!1)},1100)}catch(e){console.error(e)}},c[0]=u,c[1]=p,c[2]=d,c[3]=m,c[4]=t):t=c[4];let y=t,b=g?"true":"false";return c[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(S.FaMapPin,{className:w.default.MapPin}),i=(0,r.jsx)(f,{className:w.default.ClipboardCheck}),l=(0,r.jsx)("span",{className:w.default.ButtonLabel,children:" Link to coordinates"}),c[5]=o,c[6]=i,c[7]=l):(o=c[5],i=c[6],l=c[7]),c[8]!==h||c[9]!==y||c[10]!==b?(s=(0,r.jsxs)("button",{type:"button",className:w.default.Root,"aria-label":"Link to coordinates",title:"Copy the current coordinates to URL",onClick:y,disabled:h,"data-copied":b,id:"copyCoordinatesButton",children:[o,i,l]}),c[8]=h,c[9]=y,c[10]=b,c[11]=s):s=c[11],s}function j(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 0 0-2-2zm0 14H3V5h18v12zm-5-6-7 4V7z"},child:[]}]})(e)}var M=e.i(25645),k=e.i(98755),T=e.i(32865),N=e.i(28903);let R=(0,M.createLogger)("LoadDemoButton");function D({isActive:t=!1,choosingMap:n=!1,onCancelChoosingMap:o}){let i=(0,T.useRecording)(),l=i?.source==="demo",{setRecording:s}=(0,T.usePlaybackActions)(),c=(0,a.useRef)(null),u=(0,a.useRef)(0),d=(0,a.useCallback)(()=>{if(n&&l)return void o?.();if(l){u.current+=1,s(null);return}c.current?.click()},[l,n,o,s]),m=(0,a.useCallback)(async t=>{let r=t.target.files?.[0];if(r){t.target.value="";try{let t=await r.arrayBuffer(),n=u.current+1;u.current=n;let{createDemoStreamingRecording:a}=await e.A(60946),o=await a(t);if(u.current!==n)return;let i=k.liveConnectionStore.getState();i.disconnectServer(),i.disconnectRelay(),s(o)}catch(e){R.error("Failed to load demo: %o",e)}}},[s]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:c,type:"file",accept:".rec",style:{display:"none"},onChange:m}),(0,r.jsxs)("button",{type:"button",className:N.default.Root,"aria-label":l?"Unload demo":"Load demo (.rec)",title:l?"Unload demo":"Load demo (.rec)",onClick:d,"data-active":t,children:[(0,r.jsx)(j,{className:N.default.DemoIcon}),(0,r.jsx)("span",{className:N.default.ButtonLabel,children:"Demo"}),(0,r.jsx)("span",{className:N.default.ButtonHint,children:n&&l?"Return to demo":l?"Click to unload":"Load a .rec file"})]})]})}function L(e){return(0,d.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"},child:[]}]})(e)}var F=e.i(9607);function I(e){let t,a,o,i,l,s,c=(0,n.c)(20),{isActive:u,onOpenServerBrowser:d}=e,m=(0,k.useLiveSelector)(P),f=(0,k.useLiveSelector)(k.selectPing),h=(0,k.useLiveSelector)(B),p=(0,k.useLiveSelector)(E),g="connected"===m,v="connecting"===m||"challenging"===m||"authenticating"===m,x=g?"Connected – click to disconnect":"Join server",y=g?"Connected – click to disconnect":"Join server";c[0]!==p||c[1]!==h||c[2]!==g||c[3]!==d?(t=()=>{g?(h(),p()):d()},c[0]=p,c[1]=h,c[2]=g,c[3]=d,c[4]=t):t=c[4];let b=`${F.default.LiveIcon} ${g?F.default.Pulsing:""}`;if(c[5]!==b?(a=(0,r.jsx)(L,{className:b}),c[5]=b,c[6]=a):a=c[6],c[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)("span",{className:F.default.TextLabel,children:"Live"}),c[7]=o):o=c[7],c[8]!==v||c[9]!==f)i=v?"Connecting…":null!=f?`${f.toLocaleString()} ms`:"Join a game",c[8]=v,c[9]=f,c[10]=i;else i=c[10];return c[11]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,(0,r.jsx)("span",{className:F.default.ButtonHint,children:i})]}),c[11]=i,c[12]=l):l=c[12],c[13]!==u||c[14]!==x||c[15]!==y||c[16]!==t||c[17]!==a||c[18]!==l?(s=(0,r.jsxs)("button",{type:"button",className:F.default.Root,"aria-label":x,title:y,onClick:t,"data-active":u,children:[a,l]}),c[13]=u,c[14]=x,c[15]=y,c[16]=t,c[17]=a,c[18]=l,c[19]=s):s=c[19],s}function E(e){return e.disconnectRelay}function B(e){return e.disconnectServer}function P(e){return e.gameStatus}function A(e,t=[]){let n=[],o=()=>{let t=n.map(e=>a.createContext(e));return function(r){let n=r?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return o.scopeName=e,[function(t,o){let i=a.createContext(o),l=n.length;n=[...n,o];let s=t=>{let{scope:n,children:o,...s}=t,c=n?.[e]?.[l]||i,u=a.useMemo(()=>s,Object.values(s));return(0,r.jsx)(c.Provider,{value:u,children:o})};return s.displayName=t+"Provider",[s,function(r,n){let s=n?.[e]?.[l]||i,c=a.useContext(s);if(c)return c;if(void 0!==o)return o;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(o,...t)]}function z(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function U(...e){return t=>{let r=!1,n=e.map(e=>{let n=z(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t{let{children:r,...n}=e;if(a.isValidElement(r)){var o;let e,i,l=(o=r,(i=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(i=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?U(t,l):l),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=a.forwardRef((e,t)=>{let{children:n,...i}=e,l=a.Children.toArray(n),s=l.find(O);if(s){let e=s.props.children,n=l.map(t=>t!==s?t:a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null);return(0,r.jsx)(o,{...i,ref:t,children:a.isValidElement(e)?a.cloneElement(e,void 0,n):null})}return(0,r.jsx)(o,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var H=Symbol("radix.slottable");function O(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===H}var V=new WeakMap;function q(e,t){var r,n;let a,o,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,n=t,a=r.length,(i=(o=$(n))>=0?o:a+o)<0||i>=a?-1:i);return -1===l?void 0:e[l]}function $(e){return e!=e||0===e?0:Math.trunc(e)}function K(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],V.set(this,!0)}set(e,t){return V.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),o=this.#e.length,i=$(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!a;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}}),"u">typeof window&&window.document&&window.document.createElement;var Q=globalThis?.document?a.useLayoutEffect:()=>{};a[" useEffectEvent ".trim().toString()],a[" useInsertionEffect ".trim().toString()];var Y=a[" useInsertionEffect ".trim().toString()]||Q;function X({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[o,i,l]=function({defaultProp:e,onChange:t}){let[r,n]=a.useState(e),o=a.useRef(r),i=a.useRef(t);return Y(()=>{i.current=t},[t]),a.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}({defaultProp:t,onChange:r}),s=void 0!==e,c=s?e:o;{let t=a.useRef(void 0!==e);a.useEffect(()=>{let e=t.current;if(e!==s){let t=s?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,n])}return[c,a.useCallback(t=>{if(s){let r="function"==typeof t?t(e):t;r!==e&&l.current?.(r)}else i(t)},[s,e,i,l])]}Symbol("RADIX:SYNC_STATE"),e.i(74080);var Z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=W(`Primitive.${t}`),o=a.forwardRef((e,a)=>{let{asChild:o,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(o?n:t,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),J=e=>{var t;let r,n,{present:o,children:i}=e,l=function(e){var t,r;let[n,o]=a.useState(),i=a.useRef(null),l=a.useRef(e),s=a.useRef("none"),[c,u]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},a.useReducer((e,t)=>r[e][t]??e,t));return a.useEffect(()=>{let e=ee(i.current);s.current="mounted"===c?e:"none"},[c]),Q(()=>{let t=i.current,r=l.current;if(r!==e){let n=s.current,a=ee(t);e?u("MOUNT"):"none"===a||t?.display==="none"?u("UNMOUNT"):r&&n!==a?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),Q(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let a=ee(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&a&&(u("ANIMATION_END"),!l.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=ee(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{i.current=e?getComputedStyle(e):null,o(e)},[])}}(o),s="function"==typeof i?i({present:l.isPresent}):a.Children.only(i),c=G(l.ref,(t=s,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof i||l.isPresent?a.cloneElement(s,{ref:c}):null};function ee(e){return e?.animationName||"none"}J.displayName="Presence";var et=a[" useId ".trim().toString()]||(()=>void 0),er=0;function en(e){let[t,r]=a.useState(et());return Q(()=>{e||r(e=>e??String(er++))},[e]),e||(t?`radix-${t}`:"")}var ea="Collapsible",[eo,ei]=A(ea),[el,es]=eo(ea),ec=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:l,onOpenChange:s,...c}=e,[u,d]=X({prop:o,defaultProp:i??!1,onChange:s,caller:ea});return(0,r.jsx)(el,{scope:n,disabled:l,contentId:en(),open:u,onOpenToggle:a.useCallback(()=>d(e=>!e),[d]),children:(0,r.jsx)(Z.div,{"data-state":ep(u),"data-disabled":l?"":void 0,...c,ref:t})})});ec.displayName=ea;var eu="CollapsibleTrigger",ed=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,...a}=e,o=es(eu,n);return(0,r.jsx)(Z.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ep(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...a,ref:t,onClick:K(e.onClick,o.onOpenToggle)})});ed.displayName=eu;var em="CollapsibleContent",ef=a.forwardRef((e,t)=>{let{forceMount:n,...a}=e,o=es(em,e.__scopeCollapsible);return(0,r.jsx)(J,{present:n||o.open,children:({present:e})=>(0,r.jsx)(eh,{...a,ref:t,present:e})})});ef.displayName=em;var eh=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:o,children:i,...l}=e,s=es(em,n),[c,u]=a.useState(o),d=a.useRef(null),m=G(t,d),f=a.useRef(0),h=f.current,p=a.useRef(0),g=p.current,v=s.open||c,x=a.useRef(v),y=a.useRef(void 0);return a.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),Q(()=>{let e=d.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();f.current=t.height,p.current=t.width,x.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),u(o)}},[s.open,o]),(0,r.jsx)(Z.div,{"data-state":ep(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...l,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&i})});function ep(e){return e?"open":"closed"}var eg=a.createContext(void 0),ev="Accordion",ex=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ey,eb,e_]=function(e){let t=e+"CollectionProvider",[n,o]=A(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,o=a.default.useRef(null),l=a.default.useRef(new Map).current;return(0,r.jsx)(i,{scope:t,itemMap:l,collectionRef:o,children:n})};s.displayName=t;let c=e+"CollectionSlot",u=W(c),d=a.default.forwardRef((e,t)=>{let{scope:n,children:a}=e,o=G(t,l(c,n).collectionRef);return(0,r.jsx)(u,{ref:o,children:a})});d.displayName=c;let m=e+"CollectionItemSlot",f="data-radix-collection-item",h=W(m),p=a.default.forwardRef((e,t)=>{let{scope:n,children:o,...i}=e,s=a.default.useRef(null),c=G(t,s),u=l(m,n);return a.default.useEffect(()=>(u.itemMap.set(s,{ref:s,...i}),()=>void u.itemMap.delete(s))),(0,r.jsx)(h,{...{[f]:""},ref:c,children:o})});return p.displayName=m,[{Provider:s,Slot:d,ItemSlot:p},function(t){let r=l(e+"CollectionConsumer",t);return a.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},o]}(ev),[eS,ew]=A(ev,[e_,ei]),eC=ei(),ej=a.default.forwardRef((e,t)=>{let{type:n,...a}=e;return(0,r.jsx)(ey.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?(0,r.jsx)(eD,{...a,ref:t}):(0,r.jsx)(eR,{...a,ref:t})})});ej.displayName=ev;var[eM,ek]=eS(ev),[eT,eN]=eS(ev,{collapsible:!1}),eR=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:l=!1,...s}=e,[c,u]=X({prop:n,defaultProp:o??"",onChange:i,caller:ev});return(0,r.jsx)(eM,{scope:e.__scopeAccordion,value:a.default.useMemo(()=>c?[c]:[],[c]),onItemOpen:u,onItemClose:a.default.useCallback(()=>l&&u(""),[l,u]),children:(0,r.jsx)(eT,{scope:e.__scopeAccordion,collapsible:l,children:(0,r.jsx)(eI,{...s,ref:t})})})}),eD=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},...l}=e,[s,c]=X({prop:n,defaultProp:o??[],onChange:i,caller:ev}),u=a.default.useCallback(e=>c((t=[])=>[...t,e]),[c]),d=a.default.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,r.jsx)(eM,{scope:e.__scopeAccordion,value:s,onItemOpen:u,onItemClose:d,children:(0,r.jsx)(eT,{scope:e.__scopeAccordion,collapsible:!0,children:(0,r.jsx)(eI,{...l,ref:t})})})}),[eL,eF]=eS(ev),eI=a.default.forwardRef((e,t)=>{let n,{__scopeAccordion:o,disabled:i,dir:l,orientation:s="vertical",...c}=e,u=G(a.default.useRef(null),t),d=eb(o),m="ltr"===(n=a.useContext(eg),l||n||"ltr"),f=K(e.onKeyDown,e=>{if(!ex.includes(e.key))return;let t=e.target,r=d().filter(e=>!e.ref.current?.disabled),n=r.findIndex(e=>e.ref.current===t),a=r.length;if(-1===n)return;e.preventDefault();let o=n,i=a-1,l=()=>{(o=n+1)>i&&(o=0)},c=()=>{(o=n-1)<0&&(o=i)};switch(e.key){case"Home":o=0;break;case"End":o=i;break;case"ArrowRight":"horizontal"===s&&(m?l():c());break;case"ArrowDown":"vertical"===s&&l();break;case"ArrowLeft":"horizontal"===s&&(m?c():l());break;case"ArrowUp":"vertical"===s&&c()}let u=o%a;r[u].ref.current?.focus()});return(0,r.jsx)(eL,{scope:o,disabled:i,direction:l,orientation:s,children:(0,r.jsx)(ey.Slot,{scope:o,children:(0,r.jsx)(Z.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:f})})})}),eE="AccordionItem",[eB,eP]=eS(eE),eA=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,value:a,...o}=e,i=eF(eE,n),l=ek(eE,n),s=eC(n),c=en(),u=a&&l.value.includes(a)||!1,d=i.disabled||e.disabled;return(0,r.jsx)(eB,{scope:n,open:u,disabled:d,triggerId:c,children:(0,r.jsx)(ec,{"data-orientation":i.orientation,"data-state":eO(u),...s,...o,ref:t,disabled:d,open:u,onOpenChange:e=>{e?l.onItemOpen(a):l.onItemClose(a)}})})});eA.displayName=eE;var ez="AccordionHeader";a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(ez,n);return(0,r.jsx)(Z.h3,{"data-orientation":o.orientation,"data-state":eO(i.open),"data-disabled":i.disabled?"":void 0,...a,ref:t})}).displayName=ez;var eU="AccordionTrigger",eG=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(eU,n),l=eN(eU,n),s=eC(n);return(0,r.jsx)(ey.ItemSlot,{scope:n,children:(0,r.jsx)(ed,{"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...s,...a,ref:t})})});eG.displayName=eU;var eW="AccordionContent",eH=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(eW,n),l=eC(n);return(0,r.jsx)(ef,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...l,...a,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function eO(e){return e?"open":"closed"}function eV(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"m190.06 414 163.12-139.78a24 24 0 0 0 0-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z"},child:[]}]})(e)}eH.displayName=eW;var eq=e.i(81323);function e$(e){let t,a=(0,n.c)(2);return a[0]!==e?(t=(0,r.jsx)(ej,{className:eq.default.AccordionGroup,...e}),a[0]=e,a[1]=t):t=a[1],t}function eK(e){let t,a,o,i,l=(0,n.c)(9),{value:s,label:c,children:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(eV,{className:eq.default.TriggerIcon}),l[0]=t):t=l[0],l[1]!==c?(a=(0,r.jsxs)(eG,{className:eq.default.Trigger,children:[t," ",c]}),l[1]=c,l[2]=a):a=l[2],l[3]!==u?(o=(0,r.jsx)(eH,{className:eq.default.Content,children:(0,r.jsx)("div",{className:eq.default.Body,children:u})}),l[3]=u,l[4]=o):o=l[4],l[5]!==a||l[6]!==o||l[7]!==s?(i=(0,r.jsxs)(eA,{value:s,children:[a,o]}),l[5]=a,l[6]=o,l[7]=s,l[8]=i):i=l[8],i}var eQ=e.i(65883),eY=e.i(21025),eX=e.i(92224),eZ=e.i(91996);let eJ=["controls","preferences","audio"];function e0(e){let t,o,i,l,s,c,u,d,f,p,v,x,y,b,S,w,j,M,N,R,L,F,E,B,P,A,z,U,G,W,H,O,V,q,$,K,Q,Y,X,Z,J,ee,et,er,en,ea,eo,ei,el,es,ec,eu,ed,em,ef,eh,ep,eg,ev,ex,ey,eb,e_,eS,ew,eC,ej,eM,ek,eT,eN,eR,eD=(0,n.c)(169),{missionName:eL,missionType:eF,onOpenMapInfo:eI,onOpenServerBrowser:eE,onChooseMap:eB,onCancelChoosingMap:eP,choosingMap:eA,cameraRef:ez,invalidateRef:eU}=e,eG=(0,eY.useTouchDevice)(),eW=(0,eX.useDataSource)(),eH=(0,T.useRecording)(),eO=(0,eX.useMissionName)(),eV="demo"===eW||"live"===eW?eO:eL;eD[0]!==eV?(t=!!eV&&(0,eZ.hasMission)(eV),eD[0]=eV,eD[1]=t):t=eD[1];let eq=t,e0=(0,k.useLiveSelector)(e1),{fogEnabled:e2,setFogEnabled:e3,fov:e5,setFov:e4,audioEnabled:e6,setAudioEnabled:e8,audioVolume:e7,setAudioVolume:e9,animationEnabled:te,setAnimationEnabled:tt}=(0,_.useSettings)(),{speedMultiplier:tr,setSpeedMultiplier:tn,touchMode:ta,setTouchMode:to,invertScroll:ti,setInvertScroll:tl,invertDrag:ts,setInvertDrag:tc,invertJoystick:tu,setInvertJoystick:td}=(0,_.useControls)(),{debugMode:tm,setDebugMode:tf,renderOnDemand:th,setRenderOnDemand:tp}=(0,_.useDebug)(),[tg,tv]=(0,a.useState)(!1),tx=(0,a.useRef)(null),ty=(0,a.useRef)(null),tb=(0,a.useRef)(null);eD[2]!==tg?(o=()=>{tg&&tx.current?.focus()},i=[tg],eD[2]=tg,eD[3]=o,eD[4]=i):(o=eD[3],i=eD[4]),(0,a.useEffect)(o,i),eD[5]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let t=e.relatedTarget;t&&tb.current?.contains(t)||tv(!1)},eD[5]=l):l=eD[5];let t_=l;eD[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(tv(!1),ty.current?.focus())},eD[6]=s):s=eD[6];let tS=s,tw="map"===eW&&!eH||eA;eD[7]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(m,{}),u=(0,r.jsx)("span",{className:eQ.default.ButtonLabel,children:"Explore"}),d=(0,r.jsx)("span",{className:eQ.default.ButtonHint,children:"Browse maps"}),eD[7]=c,eD[8]=u,eD[9]=d):(c=eD[7],u=eD[8],d=eD[9]),eD[10]!==eB||eD[11]!==tw?(f=(0,r.jsxs)("button",{type:"button",className:eQ.default.IconButton,"data-active":tw,onClick:eB,children:[c,u,d]}),eD[10]=eB,eD[11]=tw,eD[12]=f):f=eD[12];let tC=!eA&&eH?.source==="demo";eD[13]!==eA||eD[14]!==eP||eD[15]!==tC?(p=(0,r.jsx)(D,{isActive:tC,choosingMap:eA,onCancelChoosingMap:eP}),eD[13]=eA,eD[14]=eP,eD[15]=tC,eD[16]=p):p=eD[16],eD[17]!==eA||eD[18]!==e0||eD[19]!==eE?(v=eE&&(0,r.jsx)(I,{isActive:!eA&&e0,onOpenServerBrowser:eE}),eD[17]=eA,eD[18]=e0,eD[19]=eE,eD[20]=v):v=eD[20],eD[21]!==f||eD[22]!==p||eD[23]!==v?(x=(0,r.jsxs)("div",{className:eQ.default.ButtonGroup,children:[f,p,v]}),eD[21]=f,eD[22]=p,eD[23]=v,eD[24]=x):x=eD[24];let tj=!eq;eD[25]!==ez||eD[26]!==eL||eD[27]!==eF||eD[28]!==tj?(y=(0,r.jsx)(C,{missionName:eL,missionType:eF,cameraRef:ez,disabled:tj}),eD[25]=ez,eD[26]=eL,eD[27]=eF,eD[28]=tj,eD[29]=y):y=eD[29];let tM=!eq;eD[30]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(g,{}),S=(0,r.jsx)("span",{className:eQ.default.ButtonLabel,children:"Show map info"}),eD[30]=b,eD[31]=S):(b=eD[30],S=eD[31]),eD[32]!==eI||eD[33]!==tM?(w=(0,r.jsxs)("button",{type:"button",className:eQ.default.MapInfoButton,"aria-label":"Show map info",onClick:eI,disabled:tM,children:[b,S]}),eD[32]=eI,eD[33]=tM,eD[34]=w):w=eD[34],eD[35]!==x||eD[36]!==y||eD[37]!==w?(j=(0,r.jsxs)("div",{className:eQ.default.Tools,children:[x,y,w]}),eD[35]=x,eD[36]=y,eD[37]=w,eD[38]=j):j=eD[38],eD[39]===Symbol.for("react.memo_cache_sentinel")?(M=(0,r.jsx)("label",{htmlFor:"speedInput",children:"Fly speed"}),eD[39]=M):M=eD[39],eD[40]!==tr?(N=Math.round(100*tr),eD[40]=tr,eD[41]=N):N=eD[41],eD[42]!==tn?(R=e=>tn(parseFloat(e.target.value)/100),eD[42]=tn,eD[43]=R):R=eD[43],eD[44]!==N||eD[45]!==R?(L=(0,r.jsx)("input",{id:"speedInput",type:"range",min:1,max:100,step:1,value:N,onChange:R}),eD[44]=N,eD[45]=R,eD[46]=L):L=eD[46];let tk=!1===eG?" Use your scroll wheel or trackpad to adjust while flying.":"";return eD[47]!==tk?(F=(0,r.jsxs)("p",{className:eQ.default.Description,children:["How fast you move in free-flying mode.",tk]}),eD[47]=tk,eD[48]=F):F=eD[48],eD[49]!==L||eD[50]!==F?(E=(0,r.jsxs)("div",{className:eQ.default.Field,children:[M,L,F]}),eD[49]=L,eD[50]=F,eD[51]=E):E=eD[51],eD[52]!==eG||eD[53]!==to||eD[54]!==ta?(B=eG?(0,r.jsxs)("div",{className:eQ.default.Field,children:[(0,r.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick"})," ",(0,r.jsxs)("select",{id:"touchModeInput",value:ta,onChange:e=>to(e.target.value),children:[(0,r.jsx)("option",{value:"dualStick",children:"Dual stick"}),(0,r.jsx)("option",{value:"moveLookStick",children:"Single stick"})]}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Single stick has a unified move + look control. Dual stick has independent move + look."})]}):null,eD[52]=eG,eD[53]=to,eD[54]=ta,eD[55]=B):B=eD[55],eD[56]!==ti||eD[57]!==eG||eD[58]!==tl?(P=!1===eG?(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertScroll",type:"checkbox",checked:ti,onChange:e=>{tl(e.target.checked)}}),(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertScroll",children:"Invert scroll direction"}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse which scroll direction increases and decreases fly speed."})]}):null,eD[56]=ti,eD[57]=eG,eD[58]=tl,eD[59]=P):P=eD[59],eD[60]!==tu||eD[61]!==eG||eD[62]!==td?(A=eG?(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertJoystick",type:"checkbox",checked:tu,onChange:e=>{td(e.target.checked)}}),(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertJoystick",children:"Invert joystick direction"}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse joystick look direction."})]}):null,eD[60]=tu,eD[61]=eG,eD[62]=td,eD[63]=A):A=eD[63],eD[64]!==tc?(z=e=>{tc(e.target.checked)},eD[64]=tc,eD[65]=z):z=eD[65],eD[66]!==ts||eD[67]!==z?(U=(0,r.jsx)("input",{id:"invertDrag",type:"checkbox",checked:ts,onChange:z}),eD[66]=ts,eD[67]=z,eD[68]=U):U=eD[68],eD[69]===Symbol.for("react.memo_cache_sentinel")?(G=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertDrag",children:"Invert drag direction"}),W=(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse how dragging the viewport aims the camera."}),eD[69]=G,eD[70]=W):(G=eD[69],W=eD[70]),eD[71]!==U?(H=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[U,G,W]}),eD[71]=U,eD[72]=H):H=eD[72],eD[73]!==E||eD[74]!==B||eD[75]!==P||eD[76]!==A||eD[77]!==H?(O=(0,r.jsxs)(eK,{value:"controls",label:"Controls",children:[E,B,P,A,H]}),eD[73]=E,eD[74]=B,eD[75]=P,eD[76]=A,eD[77]=H,eD[78]=O):O=eD[78],eD[79]===Symbol.for("react.memo_cache_sentinel")?(V=(0,r.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),eD[79]=V):V=eD[79],eD[80]!==e5?(q=(0,r.jsxs)("output",{htmlFor:"fovInput",children:[e5,"°"]}),eD[80]=e5,eD[81]=q):q=eD[81],eD[82]!==e4?($=e=>e4(parseInt(e.target.value)),eD[82]=e4,eD[83]=$):$=eD[83],eD[84]!==e5||eD[85]!==$?(K=(0,r.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:e5,onChange:$}),eD[84]=e5,eD[85]=$,eD[86]=K):K=eD[86],eD[87]!==q||eD[88]!==K?(Q=(0,r.jsx)(eK,{value:"preferences",label:"Preferences",children:(0,r.jsxs)("div",{className:eQ.default.Field,children:[V,(0,r.jsxs)("div",{className:eQ.default.Control,children:[q,K]})]})}),eD[87]=q,eD[88]=K,eD[89]=Q):Q=eD[89],eD[90]!==e8?(Y=e=>{e8(e.target.checked)},eD[90]=e8,eD[91]=Y):Y=eD[91],eD[92]!==e6||eD[93]!==Y?(X=(0,r.jsx)("input",{id:"audioInput",type:"checkbox",checked:e6,onChange:Y}),eD[92]=e6,eD[93]=Y,eD[94]=X):X=eD[94],eD[95]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"audioInput",children:"Enable audio"}),eD[95]=Z):Z=eD[95],eD[96]!==X?(J=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[X,Z]}),eD[96]=X,eD[97]=J):J=eD[97],eD[98]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,r.jsx)("label",{htmlFor:"volumeInput",children:"Master volume"}),eD[98]=ee):ee=eD[98],eD[99]!==e7?(et=Math.round(100*e7),eD[99]=e7,eD[100]=et):et=eD[100],eD[101]!==et?(er=(0,r.jsxs)("output",{htmlFor:"volumeInput",children:[et,"%"]}),eD[101]=et,eD[102]=er):er=eD[102],eD[103]!==e9?(en=e=>e9(parseFloat(e.target.value)),eD[103]=e9,eD[104]=en):en=eD[104],eD[105]!==e7||eD[106]!==en?(ea=(0,r.jsx)("input",{id:"volumeInput",type:"range",min:0,max:1,step:.05,value:e7,onChange:en}),eD[105]=e7,eD[106]=en,eD[107]=ea):ea=eD[107],eD[108]!==er||eD[109]!==ea?(eo=(0,r.jsxs)("div",{className:eQ.default.Field,children:[ee,(0,r.jsxs)("div",{className:eQ.default.Control,children:[er,ea]})]}),eD[108]=er,eD[109]=ea,eD[110]=eo):eo=eD[110],eD[111]!==J||eD[112]!==eo?(ei=(0,r.jsxs)(eK,{value:"audio",label:"Audio",children:[J,eo]}),eD[111]=J,eD[112]=eo,eD[113]=ei):ei=eD[113],eD[114]!==e3?(el=e=>{e3(e.target.checked)},eD[114]=e3,eD[115]=el):el=eD[115],eD[116]!==e2||eD[117]!==el?(es=(0,r.jsx)("input",{id:"fogInput",type:"checkbox",checked:e2,onChange:el}),eD[116]=e2,eD[117]=el,eD[118]=es):es=eD[118],eD[119]===Symbol.for("react.memo_cache_sentinel")?(ec=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"fogInput",children:"Enable fog"}),eD[119]=ec):ec=eD[119],eD[120]!==es?(eu=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[es,ec]}),eD[120]=es,eD[121]=eu):eu=eD[121],eD[122]!==tt?(ed=e=>{tt(e.target.checked)},eD[122]=tt,eD[123]=ed):ed=eD[123],eD[124]!==te||eD[125]!==ed?(em=(0,r.jsx)("input",{id:"animationInput",type:"checkbox",checked:te,onChange:ed}),eD[124]=te,eD[125]=ed,eD[126]=em):em=eD[126],eD[127]===Symbol.for("react.memo_cache_sentinel")?(ef=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"animationInput",children:"Enable animations"}),eD[127]=ef):ef=eD[127],eD[128]!==em?(eh=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[em,ef]}),eD[128]=em,eD[129]=eh):eh=eD[129],eD[130]!==eu||eD[131]!==eh?(ep=(0,r.jsxs)(eK,{value:"graphics",label:"Graphics",children:[eu,eh]}),eD[130]=eu,eD[131]=eh,eD[132]=ep):ep=eD[132],eD[133]!==tf?(eg=e=>{tf(e.target.checked)},eD[133]=tf,eD[134]=eg):eg=eD[134],eD[135]!==tm||eD[136]!==eg?(ev=(0,r.jsx)("input",{id:"debugInput",type:"checkbox",checked:tm,onChange:eg}),eD[135]=tm,eD[136]=eg,eD[137]=ev):ev=eD[137],eD[138]===Symbol.for("react.memo_cache_sentinel")?(ex=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"debugInput",children:"Render debug visuals"}),eD[138]=ex):ex=eD[138],eD[139]!==ev?(ey=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[ev,ex]}),eD[139]=ev,eD[140]=ey):ey=eD[140],eD[141]!==tp?(eb=e=>{tp(e.target.checked)},eD[141]=tp,eD[142]=eb):eb=eD[142],eD[143]!==th||eD[144]!==eb?(e_=(0,r.jsx)("input",{id:"onDemandInput",type:"checkbox",checked:th,onChange:eb}),eD[143]=th,eD[144]=eb,eD[145]=e_):e_=eD[145],eD[146]===Symbol.for("react.memo_cache_sentinel")?(eS=(0,r.jsx)("label",{htmlFor:"onDemandInput",children:"Render on demand "}),eD[146]=eS):eS=eD[146],eD[147]!==eU?(ew=()=>eU.current?.(),eD[147]=eU,eD[148]=ew):ew=eD[148],eD[149]===Symbol.for("react.memo_cache_sentinel")?(eC=(0,r.jsx)(h,{}),eD[149]=eC):eC=eD[149],eD[150]!==ew?(ej=(0,r.jsxs)("div",{className:eQ.default.Label,children:[eS,(0,r.jsx)("button",{type:"button",className:eQ.default.ForceRenderButton,title:"Force render","aria-label":"Force render",onClick:ew,children:eC})]}),eD[150]=ew,eD[151]=ej):ej=eD[151],eD[152]===Symbol.for("react.memo_cache_sentinel")?(eM=(0,r.jsx)("p",{className:eQ.default.Description,children:"Significantly decreases CPU and GPU usage by only rendering frames when requested. Helpful when developing parts of the app unrelated to rendering."}),eD[152]=eM):eM=eD[152],eD[153]!==e_||eD[154]!==ej?(ek=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[e_,ej,eM]}),eD[153]=e_,eD[154]=ej,eD[155]=ek):ek=eD[155],eD[156]!==ey||eD[157]!==ek?(eT=(0,r.jsxs)(eK,{value:"debug",label:"Debug",children:[ey,ek]}),eD[156]=ey,eD[157]=ek,eD[158]=eT):eT=eD[158],eD[159]!==O||eD[160]!==Q||eD[161]!==ei||eD[162]!==ep||eD[163]!==eT?(eN=(0,r.jsx)("div",{className:eQ.default.Accordions,children:(0,r.jsxs)(e$,{type:"multiple",defaultValue:eJ,children:[O,Q,ei,ep,eT]})}),eD[159]=O,eD[160]=Q,eD[161]=ei,eD[162]=ep,eD[163]=eT,eD[164]=eN):eN=eD[164],eD[165]!==tg||eD[166]!==j||eD[167]!==eN?(eR=(0,r.jsx)("div",{className:eQ.default.InspectorControls,children:(0,r.jsx)("div",{ref:tb,children:(0,r.jsxs)("div",{className:eQ.default.Dropdown,ref:tx,id:"settingsPanel",tabIndex:-1,onKeyDown:tS,onBlur:t_,"data-open":tg,children:[j,eN]})})}),eD[165]=tg,eD[166]=j,eD[167]=eN,eD[168]=eR):eR=eD[168],eR}function e1(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var e2=e.i(11889),e3=e.i(56373),e5=e.i(86447),e4=e.i(1559),e6=e.i(78440),e8=e.i(59129),e7=e.i(25998),e9=e.i(18364),te=e.i(68754),tt=e.i(70238),tr=e.i(29402),tn=e.i(97442);let ta=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),to={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/xPack2.vl2":"xPack2","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2":"DMP (Discord Map Pack)"},ti={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},tl=(0,eZ.getMissionList)().filter(e=>!ta.has(e)).map(e=>{let t,r=(0,eZ.getMissionInfo)(e),[n]=(0,eZ.getSourceAndPath)(r.resourcePath),a=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",o=to[n]??ti[a]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:o,missionTypes:r.missionTypes}}),ts=new Map(tl.map(e=>[e.missionName,e])),tc=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,tr.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,tr.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(tl),tu="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function td(e){let t,a,o,i,l,s=(0,n.c)(12),{mission:c}=e,u=c.displayName||c.missionName;return s[0]!==u?(t=(0,r.jsx)("span",{className:tn.default.ItemName,children:u}),s[0]=u,s[1]=t):t=s[1],s[2]!==c.missionTypes?(a=c.missionTypes.length>0&&(0,r.jsx)("span",{className:tn.default.ItemTypes,children:c.missionTypes.map(tm)}),s[2]=c.missionTypes,s[3]=a):a=s[3],s[4]!==t||s[5]!==a?(o=(0,r.jsxs)("span",{className:tn.default.ItemHeader,children:[t,a]}),s[4]=t,s[5]=a,s[6]=o):o=s[6],s[7]!==c.missionName?(i=(0,r.jsx)("span",{className:tn.default.ItemMissionName,children:c.missionName}),s[7]=c.missionName,s[8]=i):i=s[8],s[9]!==o||s[10]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,i]}),s[9]=o,s[10]=i,s[11]=l):l=s[11],l}function tm(e){return(0,r.jsx)("span",{className:tn.default.ItemType,"data-mission-type":e,children:e},e)}function tf(e){let t,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_=(0,n.c)(48),{value:S,missionType:w,onChange:C,disabled:j,autoFocus:M}=e,[k,T]=(0,a.useState)(""),N=(0,a.useRef)(null),R=(0,a.useRef)(w);_[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,a.startTransition)(()=>T(e))},_[0]=t):t=_[0];let D=(0,e9.useComboboxStore)({resetValueOnHide:!0,selectedValue:S,setSelectedValue:e=>{if(e){let t=R.current,r=(0,eZ.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),C({missionName:e,missionType:t}),N.current?.blur()}},setValue:t}),L=(0,te.useStoreState)(D,"open");_[1]!==D?(o=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),N.current?.focus(),D.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},i=[D],_[1]=D,_[2]=o,_[3]=i):(o=_[2],i=_[3]),(0,a.useEffect)(o,i),_[4]!==S?(l=ts.get(S),_[4]=S,_[5]=l):l=_[5];let F=l;e:{let e,t;if(!k){let e;_[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:tc},_[6]=e):e=_[6],s=e;break e}_[7]!==k?(e=(0,tt.matchSorter)(tl,k,{keys:["displayName","missionName","missionTypes","groupName"]}),_[7]=k,_[8]=e):e=_[8];let r=e;_[9]!==r?(t={type:"flat",missions:r},_[9]=r,_[10]=t):t=_[10],s=t}let I=s,E=F?F.displayName||F.missionName:S,B="flat"===I.type?0===I.missions.length:0===I.groups.length,P=e=>(0,r.jsx)(e3.ComboboxItem,{value:e.missionName,className:tn.default.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(R.current=r,e.missionName===S&&C({missionName:e.missionName,missionType:r})):R.current=null}else R.current=null},children:(0,r.jsx)(td,{mission:e})},e.missionName),A=e6.ComboboxProvider,z=L?"visible":"hidden";_[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)("div",{className:tn.default.Backdrop}),_[11]=c):c=_[11],_[12]!==z?(u=(0,r.jsx)(a.Activity,{mode:z,children:c}),_[12]=z,_[13]=u):u=_[13];let U=F?void 0:"Choose a map…";_[14]!==D?(d=()=>{try{document.exitPointerLock()}catch{}D.show()},m=e=>{"Escape"!==e.key||D.getState().open||N.current?.blur()},_[14]=D,_[15]=d,_[16]=m):(d=_[15],m=_[16]),_[17]!==M||_[18]!==j||_[19]!==d||_[20]!==m||_[21]!==U?(f=(0,r.jsx)(e2.Combobox,{ref:N,autoSelect:!0,autoFocus:M,disabled:j,placeholder:U,className:tn.default.Input,onFocus:d,onKeyDown:m}),_[17]=M,_[18]=j,_[19]=d,_[20]=m,_[21]=U,_[22]=f):f=_[22],_[23]!==E||_[24]!==w||_[25]!==F?(h=F&&(0,r.jsxs)("div",{className:tn.default.SelectedValue,children:[(0,r.jsx)("span",{className:tn.default.SelectedName,children:E}),w&&(0,r.jsx)("span",{className:tn.default.ItemType,"data-mission-type":w,children:w})]}),_[23]=E,_[24]=w,_[25]=F,_[26]=h):h=_[26],_[27]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)("kbd",{className:tn.default.Shortcut,children:tu?"⌘K":"^K"}),_[27]=p):p=_[27],_[28]!==f||_[29]!==h?(g=(0,r.jsxs)("div",{className:tn.default.InputWrapper,children:[f,h,p]}),_[28]=f,_[29]=h,_[30]=g):g=_[30];let G=e4.ComboboxPopover,W=tn.default,H=e5.ComboboxList,O=tn.default,V="flat"===I.type?I.missions.map(P):I.groups.map(e=>{let[t,n]=e;return t?(0,r.jsxs)(e8.ComboboxGroup,{className:tn.default.Group,children:[(0,r.jsx)(e7.ComboboxGroupLabel,{className:tn.default.GroupLabel,children:t}),n.map(P)]},t):(0,r.jsx)(a.Fragment,{children:n.map(P)},"ungrouped")});return _[31]!==B?(v=B&&(0,r.jsx)("div",{className:tn.default.NoResults,children:"No missions found"}),_[31]=B,_[32]=v):v=_[32],_[33]!==H||_[34]!==O.List||_[35]!==V||_[36]!==v?(x=(0,r.jsxs)(H,{className:O.List,children:[V,v]}),_[33]=H,_[34]=O.List,_[35]=V,_[36]=v,_[37]=x):x=_[37],_[38]!==G||_[39]!==W.Popover||_[40]!==x?(y=(0,r.jsx)(G,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:W.Popover,children:x}),_[38]=G,_[39]=W.Popover,_[40]=x,_[41]=y):y=_[41],_[42]!==A||_[43]!==D||_[44]!==g||_[45]!==y||_[46]!==u?(b=(0,r.jsxs)(A,{store:D,children:[u,g,y]}),_[42]=A,_[43]=D,_[44]=g,_[45]=y,_[46]=u,_[47]=b):b=_[47],b}var th=e.i(58647);function tp(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 6-6 8h12zM6 16h12v2H6z"},child:[]}]})(e)}var tg=e.i(16964);function tv(){let e,t,a,o,i,l,s=(0,n.c)(24),c=(0,eX.useDataSource)(),u=(0,eX.useMissionDisplayName)(),d=(0,eX.useMissionType)(),m=(0,eX.useMissionTypeDisplayName)(),f=(0,eX.useServerDisplayName)(),h=(0,eX.useRecorderName)(),g=(0,eX.useRecordingDate)(),[v,x]=g?g.split(" "):[null,null],y="live"===c,b=(0,T.useRecording)(),_=(0,k.useLiveSelector)(tb),S=tg.default;s[0]!==u||s[1]!==d||s[2]!==m?(e=u&&d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:tg.default.MissionName,children:u}),d&&(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)("span",{className:tg.default.MissionType,"data-mission-type":d,children:"LCTF"===m?"LCTF":d})]})]}):null,s[0]=u,s[1]=d,s[2]=m,s[3]=e):e=s[3],s[4]!==e?(t=(0,r.jsx)("div",{className:tg.default.MissionInfo,children:e}),s[4]=e,s[5]=t):t=s[5];let w=tg.default,C=y?_?h?(0,r.jsxs)("div",{className:tg.default.Attribution,children:["Connected as"," ",(0,r.jsx)("span",{className:tg.default.PlayerName,children:h})]}):null:(0,r.jsx)("div",{className:tg.default.Error,children:"Disconnected"}):h&&g?(0,r.jsxs)("div",{className:tg.default.Attribution,children:["Recorded by ",(0,r.jsx)("span",{className:tg.default.PlayerName,children:h})," ","on"," ",(0,r.jsx)("span",{className:tg.default.RecordingDate,children:v.replace(/-/g," ")})," ","at ",(0,r.jsx)("span",{className:tg.default.RecordingDate,children:x})]}):null;return s[6]!==f?(a=f?(0,r.jsxs)("div",{className:tg.default.ServerInfo,children:["Server: ",(0,r.jsx)("span",{className:tg.default.ServerName,children:f})]}):null,s[6]=f,s[7]=a):a=s[7],s[8]!==w.Metadata||s[9]!==C||s[10]!==a?(o=(0,r.jsxs)("div",{className:w.Metadata,children:[C,a]}),s[8]=w.Metadata,s[9]=C,s[10]=a,s[11]=o):o=s[11],s[12]!==c||s[13]!==tx||s[14]!==ty||s[15]!==y||s[16]!==_||s[17]!==b?(i="demo"===c?(0,r.jsx)("button",{type:"button",className:tg.default.ActionButton,title:"Unload demo","aria-label":"Unload demo",onClick:ty,disabled:!b,children:(0,r.jsx)(tp,{className:tg.default.EjectIcon})}):y?(0,r.jsx)("button",{type:"button",className:tg.default.ActionButton,title:"Disconnect","aria-label":"Disconnect",onClick:tx,disabled:!_,children:(0,r.jsx)(p,{})}):null,s[12]=c,s[13]=tx,s[14]=ty,s[15]=y,s[16]=_,s[17]=b,s[18]=i):i=s[18],s[19]!==S.Header||s[20]!==t||s[21]!==o||s[22]!==i?(l=(0,r.jsxs)("div",{className:S.Header,children:[t,o,i]}),s[19]=S.Header,s[20]=t,s[21]=o,s[22]=i,s[23]=l):l=s[23],l}function tx(){let e=k.liveConnectionStore.getState();e.disconnectServer(),e.disconnectRelay(),th.engineStore.getState().setRecording(null)}function ty(){th.engineStore.getState().setRecording(null)}function tb(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var t_=e.i(31067),tS=e.i(15080),tw=e.i(71753),tC=e.i(90072);let tj=a.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:o,...i},l)=>{let s=(0,tS.useThree)(({set:e})=>e),c=(0,tS.useThree)(({camera:e})=>e),u=(0,tS.useThree)(({size:e})=>e),d=a.useRef(null);a.useImperativeHandle(l,()=>d.current,[]);let m=a.useRef(null),f=function(e,t,r){let n=(0,tS.useThree)(e=>e.size),o=(0,tS.useThree)(e=>e.viewport),i="number"==typeof e?e:n.width*o.dpr,l=n.height*o.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:u,...d}=s,m=null!=u?u:s.depthBuffer,f=a.useMemo(()=>{let e=new tC.WebGLRenderTarget(i,l,{minFilter:tC.LinearFilter,magFilter:tC.LinearFilter,type:tC.HalfFloatType,...d});return m&&(e.depthTexture=new tC.DepthTexture(i,l,tC.FloatType)),e.samples=c,e},[]);return a.useLayoutEffect(()=>{f.setSize(i,l),c&&(f.samples=c)},[c,f,i,l]),a.useEffect(()=>()=>f.dispose(),[]),f}(t);a.useLayoutEffect(()=>{i.manual||(d.current.aspect=u.width/u.height)},[u,i]),a.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let h=0,p=null,g="function"==typeof o;return(0,tw.useFrame)(t=>{g&&(r===1/0||h{if(n)return s(()=>({camera:d.current})),()=>s(()=>({camera:c}))},[d,n,s]),a.createElement(a.Fragment,null,a.createElement("perspectiveCamera",(0,t_.default)({ref:d},i),!g&&o),a.createElement("group",{ref:m},g&&o(f.texture)))});function tM(){let e,t,a=(0,n.c)(3),{fov:o}=(0,_.useSettings)();return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],a[0]=e):e=a[0],a[1]!==o?(t=(0,r.jsx)(tj,{makeDefault:!0,position:e,fov:o}),a[1]=o,a[2]=t):t=a[2],t}var tk=e.i(51434);let tT=(0,a.createContext)(null);function tN(){let e=(0,a.useContext)(tT);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function tR({children:e}){let t=(0,tS.useThree)(e=>e.camera),[n,o]=(0,a.useState)(-1),[i,l]=(0,a.useState)({}),[s,c]=(0,a.useState)(()=>({initialized:!1,position:null,quarternion:null})),u=(0,a.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),d=(0,a.useCallback)(e=>{l(t=>{let{[e.id]:r,...n}=t;return n})},[]),m=Object.keys(i).length,f=(0,a.useCallback)(e=>{if(e>=0&&e{f(m?(n+1)%m:-1)},[m,n,f]);(0,a.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),a=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new tC.Vector3(...n),quarternion:new tC.Quaternion(...a)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,a.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,a.useEffect)(()=>{s.initialized&&!s.position&&m>0&&-1===n&&f(0)},[m,f,n,s]);let p=(0,a.useMemo)(()=>({registerCamera:u,unregisterCamera:d,nextCamera:h,setCameraIndex:f,cameraCount:m}),[u,d,h,f,m]);return 0===m&&-1!==n&&o(-1),(0,r.jsx)(tT.Provider,{value:p,children:e})}var tD=e.i(93784),tL=e.i(65349),tF=e.i(51475),tI=e.i(89119);let tE=(0,M.createLogger)("InputConsumer"),tB=Math.PI/2-.01,tP=1/32,tA=2*Math.PI;function tz(e){return(Math.round(e/tA*65536)<<16>>16)*tA/65536}let tU=new tC.Vector3,tG=new tC.Vector3,tW=new tC.Vector3,tH=new tC.Euler(0,0,0,"YXZ");function tO(e,t,r,n,a,o,i){if(0===n&&0===a&&0===o)return;let l=Math.sin(t),s=Math.cos(t),c=Math.sin(r),u=Math.cos(r),d=i*tP;e.x+=(s*n+l*u*a+l*c*o)*d,e.y+=(-l*n+s*u*a+s*c*o)*d,e.z+=(-c*a+u*o)*d}function tV(){let{moveQueue:e,mode:t,setMode:r}=(0,tL.useInputContext)(),n=(0,k.useLiveSelector)(e=>e.adapter),o=(0,k.useLiveSelector)(e=>e.gameStatus),i=(0,k.useLiveSelector)(e=>e.sendMoves),l=(0,th.useEngineStoreApi)(),s=(0,tS.useThree)(e=>e.camera),c=(0,tF.useGetTickFraction)(),u=(0,a.useRef)(null),d=(0,a.useRef)([]),m=(0,a.useRef)(0),f=(0,a.useRef)(0),h=(0,a.useRef)(null),p=(0,a.useRef)(0),g=(0,a.useRef)(0),v=(0,a.useRef)({x:0,y:0,z:0}),x=(0,a.useRef)(0),y=(0,a.useRef)(0),b=(0,a.useRef)({x:0,y:0,z:0}),_=(0,a.useRef)(!1),S=(0,a.useRef)({x:0,y:0,z:0}),w=(0,a.useRef)({x:0,y:0,z:0}),C=(0,a.useRef)(!1),j=(0,a.useRef)(null),M=(0,a.useRef)(0),T=(0,a.useRef)(0),N=(0,a.useRef)(0),R=(0,a.useRef)(0),D=(0,a.useRef)(0),L=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),F=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),I=!!n&&("connected"===o||"authenticating"===o);return(0,a.useEffect)(()=>{if(I&&n){if(u.current===n)return;tE.info("wiring adapter to engine store");let e=k.liveConnectionStore.getState(),t={source:"live",duration:1/0,missionName:e.mapName??null,gameType:null,serverDisplayName:e.serverName??null,recorderName:e.warriorName??null,recordingDate:null,streamingPlayback:n};l.getState().setRecording(t),l.getState().setPlaybackStatus("playing"),u.current=n,_.current=!1,C.current=!1,j.current=null,d.current.length=0,m.current=0,f.current=0,h.current=null,r("fly")}else if(!I&&u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null,_.current=!1,C.current=!1,j.current=null,d.current.length=0,r("local")}},[I,n,l,r]),(0,tF.useTick)(()=>{if(!u.current||"connected"!==o)return;let e=M.current,t=T.current;M.current=0,T.current=0;let n=N.current,a=R.current,l=D.current;N.current=0,R.current=0,D.current=0;let s=[...L.current];L.current.fill(!1),s[2]&&!F.current[2]&&(u.current.toggleObserverMode(),tE.info("observer mode: %s",u.current.observerMode),r("follow"===u.current.observerMode?"follow":"fly")),F.current=s;let c=tz(e),f=tz(t);p.current+=c-e,g.current+=f-t,x.current=p.current,y.current=g.current,b.current={...v.current};let h=p.current-c,_=g.current-f;tO(v.current,h,_,n,a,l,80),s[1]=!0;let k=m.current++,I=d.current;I.push({moveIndex:k,move:{x:n,y:a,z:l,yaw:e,pitch:t,roll:0,trigger:s,freeLook:!1},yaw:c,pitch:f,x:n,y:a,z:l}),I.length>45&&I.splice(0,I.length-45);let E=u.current.lastMoveAck;for(;I.length>0&&I[0].moveIndex0){let e=I.slice(0,31);i(e.map(e=>e.move),e[0].moveIndex)}let B=u.current.getSnapshot();if(B!==j.current){j.current=B;let e=B?.camera;if(e?.orbitTargetId){let t=B.entities.find(t=>t.id===e.orbitTargetId);t?.position&&(S.current={...w.current},w.current={x:t.position[0],y:t.position[1],z:t.position[2]},C.current||(S.current={...w.current},C.current=!0))}}}),(0,tw.useFrame)((r,n)=>{let a=e.current;if(a.length>0){let t=0,r=0,n=0,c=0,d=0,f=0,h=[!1,!1,!1,!1,!1,!1];for(let e of a){t+=e.deltaYaw,r+=e.deltaPitch,n=e.x,c=e.y,d=e.z,f+=e.delta;for(let t=0;t0&&(tW.multiplyScalar(Math.min(1,e)/e*300*E),i.position.add(tW))}return}}if(!I||!u.current||"connected"!==o)return;let B=u.current,P=B.getSnapshot(),A=P?.camera;if(A&&A!==h.current&&"number"==typeof A.yaw&&"number"==typeof A.pitch){h.current=A;let e=B.lastMoveAck;if(e>f.current){f.current=e;let t=d.current;for(;t.length>0&&t[0].moveIndexe.id===A.orbitTargetId);if(e?.position){let t={x:e.position[0],y:e.position[1],z:e.position[2]};w.current=t,S.current={...t},C.current=!0}}}if(_.current){if("fly"===t)!function(e,t,r,n,a,o){let i=t.x+(r.x-t.x)*o,l=t.y+(r.y-t.y)*o,s=t.z+(r.z-t.z)*o;e.position.set(l,s,i);let[c,u,d,m]=(0,tI.yawPitchToQuaternion)(n,a);e.quaternion.set(c,u,d,m)}(r.camera,b.current,v.current,p.current,g.current,c());else if("follow"===t){if(!C.current)return;!function(e,t,r,n,a,o,i,l){let s=t.x+(r.x-t.x)*o,c=t.y+(r.y-t.y)*o,u=t.z+(r.z-t.z)*o,d=null!=l&&tD.streamPlaybackStore.getState().entities.get(l)?.renderType==="Player",m=Math.sin(a),f=Math.cos(a),h=Math.sin(n),p=Math.cos(n),g=Math.max(.1,i);e.position.set(c-p*f*g,u+ +!!d+m*g,s-h*f*g);let[v,x,y,b]=(0,tI.yawPitchToQuaternion)(n,a);e.quaternion.set(v,x,y,b)}(r.camera,S.current,w.current,p.current,g.current,c(),A?.orbitDistance??4,A?.orbitTargetId)}}}),(0,a.useEffect)(()=>()=>{if(u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null}},[l]),null}var tq=e.i(77964),t$=e.i(91907),tK=e.i(25947),tQ=e.i(46325),tY=e.i(31999),tX=e.i(89887);function tZ(e){let t,r,o,i,l=(0,n.c)(12),{entity:s}=e,{registerCamera:c,unregisterCamera:u}=tN(),d=(0,a.useId)(),m=s.cameraDataBlock;l[0]!==s.position?(t=s.position?new tC.Vector3(...s.position):new tC.Vector3,l[0]=s.position,l[1]=t):t=l[1];let f=t;l[2]!==s.rotation?(r=s.rotation?new tC.Quaternion(...s.rotation):new tC.Quaternion,l[2]=s.rotation,l[3]=r):r=l[3];let h=r;return l[4]!==m||l[5]!==d||l[6]!==f||l[7]!==c||l[8]!==h||l[9]!==u?(o=()=>{if("Observer"===m){let e={id:d,position:f,rotation:h};return c(e),()=>{u(e)}}},i=[d,m,c,u,f,h],l[4]=m,l[5]=d,l[6]=f,l[7]=c,l[8]=h,l[9]=u,l[10]=o,l[11]=i):(o=l[10],i=l[11]),(0,a.useEffect)(o,i),null}function tJ(e){let t,a=(0,n.c)(3),{entity:o}=e;return a[0]!==o.label||a[1]!==o.position?(t=o.label?(0,r.jsx)(tX.FloatingLabel,{position:o.position,opacity:.6,children:o.label}):null,a[0]=o.label,a[1]=o.position,a[2]=t):t=a[2],t}var t0=e.i(66027),t1=e.i(63318),t2=e.i(12979),t3=e.i(75567),t5=e.i(47071);let t4={value:!0},t6=` +vec3 terrainLinearToSRGB(vec3 linear) { + vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; + vec3 lower = linear * 12.92; + return mix(lower, higher, step(vec3(0.0031308), linear)); +} + +vec3 terrainSRGBToLinear(vec3 srgb) { + vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); + vec3 lower = srgb / 12.92; + return mix(lower, higher, step(vec3(0.04045), srgb)); +} + +// Debug grid overlay using screen-space derivatives for sharp, anti-aliased lines +// Returns 1.0 on grid lines, 0.0 elsewhere +float terrainDebugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); +} +`;var t8=e.i(56893),t7=e.i(47021),t9=e.i(48066);let re={0:32,1:32,2:32,3:32,4:32,5:32},rt=(0,a.memo)(function({displacementMap:e,visibilityMask:t,textureNames:n,alphaTextures:o,detailTextureName:i,lightmap:l}){let{debugMode:s}=(0,_.useDebug)(),c=(0,t8.useAnisotropy)(),u=(0,t5.useTexture)(n.map(e=>(0,t2.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,t3.setupTexture)(e,{anisotropy:c}))}),d=i?(0,t2.textureToUrl)(i):null,m=(0,t5.useTexture)(d??t2.FALLBACK_TEXTURE_URL,e=>{(0,t3.setupTexture)(e,{anisotropy:c})}),f=(0,a.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:a,detailTexture:o=null,lightmap:i=null}){e.uniforms.sunLightPointsDown=t4;let l=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:a[r]??32}}),i&&(e.uniforms.terrainLightmap={value:i}),o&&(e.uniforms.detailTexture={value:o},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include ",`#include +varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include ",`#include +vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`)),e.fragmentShader=` +uniform sampler2D albedo0; +uniform sampler2D albedo1; +uniform sampler2D albedo2; +uniform sampler2D albedo3; +uniform sampler2D albedo4; +uniform sampler2D albedo5; +uniform sampler2D mask0; +uniform sampler2D mask1; +uniform sampler2D mask2; +uniform sampler2D mask3; +uniform sampler2D mask4; +uniform sampler2D mask5; +uniform float tiling0; +uniform float tiling1; +uniform float tiling2; +uniform float tiling3; +uniform float tiling4; +uniform float tiling5; +${n?"uniform sampler2D visibilityMask;":""} +${i?"uniform sampler2D terrainLightmap;":""} +uniform bool sunLightPointsDown; +${o?`uniform sampler2D detailTexture; +uniform float detailTiling; +uniform float detailFadeDistance; +varying vec3 vTerrainWorldPos;`:""} + +${t6} + +// Global variable to store shadow factor from RE_Direct for use in output calculation +float terrainShadowFactor = 1.0; +`+e.fragmentShader,n){let t="#include ";e.fragmentShader=e.fragmentShader.replace(t,`${t} + // Early discard for invisible areas (before fog/lighting) + float visibility = texture2D(visibilityMask, vMapUv).r; + if (visibility < 0.5) { + discard; + } + `)}e.fragmentShader=e.fragmentShader.replace("#include ",` + // Sample base albedo layers (sRGB textures auto-decoded to linear by Three.js) + vec2 baseUv = vMapUv; + vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb; + ${l>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""} + ${l>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""} + ${l>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""} + ${l>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""} + ${l>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":""} + + // Sample alpha masks for all layers (use R channel) + // Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices), + // but GPU linear filtering samples at texel centers. This offset aligns them. + vec2 alphaUv = baseUv + vec2(0.5 / 256.0); + float a0 = texture2D(mask0, alphaUv).r; + ${l>1?"float a1 = texture2D(mask1, alphaUv).r;":""} + ${l>2?"float a2 = texture2D(mask2, alphaUv).r;":""} + ${l>3?"float a3 = texture2D(mask3, alphaUv).r;":""} + ${l>4?"float a4 = texture2D(mask4, alphaUv).r;":""} + ${l>5?"float a5 = texture2D(mask5, alphaUv).r;":""} + + // Torque-style additive weighted blending (blender.cc): + // result = tex0 * alpha0 + tex1 * alpha1 + tex2 * alpha2 + ... + // Each layer's alpha map defines its contribution weight. + vec3 blended = c0 * a0; + ${l>1?"blended += c1 * a1;":""} + ${l>2?"blended += c2 * a2;":""} + ${l>3?"blended += c3 * a3;":""} + ${l>4?"blended += c4 * a4;":""} + ${l>5?"blended += c5 * a5;":""} + + // Assign to diffuseColor before lighting + vec3 textureColor = blended; + + ${o?`// Detail texture blending (Torque-style multiplicative blend) + // Sample detail texture at high frequency tiling + vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb; + + // Calculate distance-based fade factor using world positions + // Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance + float distToCamera = distance(vTerrainWorldPos, cameraPosition); + float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0); + + // Torque blending: dst * lerp(1.0, detailTexel, fadeFactor) + // Detail textures are authored with bright values (~0.8 mean), not 0.5 gray + // Direct multiplication adds subtle darkening for surface detail + textureColor *= mix(vec3(1.0), detailColor, detailFade);`:""} + + // Store blended texture in diffuseColor (still in linear space here) + // We'll convert to sRGB in the output calculation + diffuseColor.rgb = textureColor; +`),i&&(e.fragmentShader=e.fragmentShader.replace("#include ",`#include + +// Override RE_Direct to extract shadow factor for Torque-style gamma-space lighting +#undef RE_Direct +void RE_Direct_TerrainShadow( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + // Torque lighting (terrLighting.cc): if light points up, terrain gets only ambient + // This prevents shadow acne from light hitting terrain backfaces + if (!sunLightPointsDown) { + terrainShadowFactor = 0.0; + return; + } + // directLight.color = sunColor * shadowFactor (shadow already applied by Three.js) + // Extract shadow factor by comparing to original sun color + #if ( NUM_DIR_LIGHTS > 0 ) + vec3 originalSunColor = directionalLights[0].color; + float sunMax = max(max(originalSunColor.r, originalSunColor.g), originalSunColor.b); + float shadowedMax = max(max(directLight.color.r, directLight.color.g), directLight.color.b); + terrainShadowFactor = clamp(shadowedMax / max(sunMax, 0.001), 0.0, 1.0); + #endif + // Don't add to reflectedLight - we'll compute lighting in gamma space at output +} +#define RE_Direct RE_Direct_TerrainShadow + +`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include +// Clear indirect diffuse - we'll compute ambient in gamma space +#if defined( RE_IndirectDiffuse ) + irradiance = vec3(0.0); +#endif +`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include + // Clear Three.js lighting - we compute everything in gamma space + reflectedLight.directDiffuse = vec3(0.0); + reflectedLight.indirectDiffuse = vec3(0.0); +`)),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style terrain lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space +{ + // Get texture in sRGB space (undo Three.js linear decode) + vec3 textureSRGB = terrainLinearToSRGB(diffuseColor.rgb); + + ${i?` + // Sample terrain lightmap for smooth NdotL + vec2 lightmapUv = vMapUv + vec2(0.5 / 512.0); + float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r; + + // Get sun and ambient colors from Three.js lights (these ARE sRGB values from mission file) + // Three.js interprets them as linear, but the numerical values are preserved + #if ( NUM_DIR_LIGHTS > 0 ) + vec3 sunColorSRGB = directionalLights[0].color; + #else + vec3 sunColorSRGB = vec3(0.7); + #endif + vec3 ambientColorSRGB = ambientLightColor; + + // Torque formula (terrLighting.cc:471-483): + // lighting = ambient + NdotL * shadowFactor * sunColor + // Clamp lighting to [0,1] before multiplying by texture + vec3 lightingSRGB = clamp(ambientColorSRGB + lightmapNdotL * terrainShadowFactor * sunColorSRGB, 0.0, 1.0); + `:` + // No lightmap - use simple ambient lighting + vec3 lightingSRGB = ambientLightColor; + `} + + // Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space + vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); + + // Convert back to linear for Three.js output pipeline + outgoingLight = terrainSRGBToLinear(resultSRGB) + totalEmissiveRadiance; +} +#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`#if DEBUG_MODE + // Debug mode: overlay green grid matching terrain grid squares (256x256) + float gridIntensity = terrainDebugGrid(vMapUv, 256.0, 1.5); + vec3 gridColor = vec3(0.0, 0.8, 0.4); // Green + gl_FragColor.rgb = mix(gl_FragColor.rgb, gridColor, gridIntensity * 0.1); +#endif + +#include `)}({shader:e,baseTextures:u,alphaTextures:o,visibilityMask:t,tiling:re,detailTexture:d?m:null,lightmap:l}),(0,t7.injectCustomFog)(e,t9.globalFogUniforms)},[u,o,t,m,d,l]),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let p=`${d?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,r.jsx)("meshLambertMaterial",{ref:h,map:e,depthWrite:!0,side:tC.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:f},p)}),rr=(0,a.memo)(function(e){let t,o,i=(0,n.c)(8),{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),i[0]=t):t=i[0],i[1]!==u||i[2]!==d||i[3]!==l||i[4]!==m||i[5]!==c||i[6]!==s?(o=(0,r.jsx)(a.Suspense,{fallback:t,children:(0,r.jsx)(rt,{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m})}),i[1]=u,i[2]=d,i[3]=l,i[4]=m,i[5]=c,i[6]=s,i[7]=o):o=i[7],o}),rn=(0,a.memo)(function(e){let t,a,o,i=(0,n.c)(15),{tileX:l,tileZ:s,blockSize:c,basePosition:u,textureNames:d,geometry:m,displacementMap:f,visibilityMask:h,alphaTextures:p,detailTextureName:g,lightmap:v,visible:x}=e,y=void 0===x||x,b=c/2,_=u.x+l*c+b,S=u.z+s*c+b;i[0]!==_||i[1]!==S?(t=[_,0,S],i[0]=_,i[1]=S,i[2]=t):t=i[2];let w=t;return i[3]!==p||i[4]!==g||i[5]!==f||i[6]!==v||i[7]!==d||i[8]!==h?(a=(0,r.jsx)(rr,{displacementMap:f,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:g,lightmap:v}),i[3]=p,i[4]=g,i[5]=f,i[6]=v,i[7]=d,i[8]=h,i[9]=a):a=i[9],i[10]!==m||i[11]!==w||i[12]!==a||i[13]!==y?(o=(0,r.jsx)("mesh",{position:w,geometry:m,castShadow:!0,receiveShadow:!0,visible:y,children:a}),i[10]=m,i[11]=w,i[12]=a,i[13]=y,i[14]=o):o=i[14],o});function ra(e){}let ro=(0,M.createLogger)("TerrainBlock");function ri(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,a=r>>16,o=256*n;for(let r=0;r0?S.visibleDistance:600,E=(0,tS.useThree)(rs),B=-(128*D);T[0]!==B?(t={x:B,z:B},T[0]=B,T[1]=t):t=T[1];let P=t;T[2]!==N.emptySquareRuns?(o=N.emptySquareRuns??[],T[2]=N.emptySquareRuns,T[3]=o):o=T[3];let A=o,{data:z}=((M=(0,n.c)(8))[0]!==R?(w={queryKey:["terrain",R],queryFn:()=>(ro.debug("Loading terrain: %s",R),(0,t2.loadTerrain)(R))},M[0]=R,M[1]=w):w=M[1],k=(0,t0.useQuery)(w),M[2]!==k.data||M[3]!==k.error||M[4]!==k.status||M[5]!==R?(C=()=>{ro.debug("Query status: %s%s%s file=%s",k.status,k.error?` error=${k.error.message}`:"",k.data?" (data ready)":" (no data)",R)},j=[k.status,k.error,k.data,R],M[2]=k.data,M[3]=k.error,M[4]=k.status,M[5]=R,M[6]=C,M[7]=j):(C=M[6],j=M[7]),(0,a.useEffect)(C,j),k);e:{let e;if(!z){i=null;break e}let t=256*D;T[4]!==t||T[5]!==D||T[6]!==z.heightMap?(!function(e,t,r){let n=e.attributes.position,a=e.attributes.uv,o=e.attributes.normal,i=n.array,l=a.array,s=o.array,c=n.count,u=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),a=Math.floor(r=Math.max(0,Math.min(255,r))),o=Math.min(n+1,255),i=Math.min(a+1,255),l=e-n,s=r-a;return(t[256*a+n]/65535*2048*(1-l)+t[256*a+o]/65535*2048*l)*(1-s)+(t[256*i+n]/65535*2048*(1-l)+t[256*i+o]/65535*2048*l)*s};for(let e=0;e0?(h/=v,p/=v,g/=v):(h=0,p=1,g=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=g}n.needsUpdate=!0,o.needsUpdate=!0}(e=function(e,t){let r=new tC.BufferGeometry,n=new Float32Array(198147),a=new Float32Array(198147),o=new Float32Array(132098),i=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let i=257*t+r;n[3*i]=r*s-e/2,n[3*i+1]=e/2-t*s,n[3*i+2]=0,a[3*i]=0,a[3*i+1]=0,a[3*i+2]=1,o[2*i]=r/256,o[2*i+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,a=(e+1)*257+t,o=a+1;((t^e)&1)==0?(i[l++]=r,i[l++]=a,i[l++]=o,i[l++]=r,i[l++]=o,i[l++]=n):(i[l++]=r,i[l++]=a,i[l++]=n,i[l++]=n,i[l++]=a,i[l++]=o)}return r.setIndex(new tC.BufferAttribute(i,1)),r.setAttribute("position",new tC.Float32BufferAttribute(n,3)),r.setAttribute("normal",new tC.Float32BufferAttribute(a,3)),r.setAttribute("uv",new tC.Float32BufferAttribute(o,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),z.heightMap,D),T[4]=t,T[5]=D,T[6]=z.heightMap,T[7]=e):e=T[7],i=e}let U=i;T[8]!==D||T[9]!==z?(l=()=>{if(z){var e;return ra((e=z.heightMap,(t,r)=>{let n=Math.max(0,Math.min(255,t/D+128)),a=Math.max(0,Math.min(255,r/D+128)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]*(1-c)+e[256*i+l]*c)*(1-u)+(e[256*s+o]*(1-c)+e[256*s+l]*c)*u)/65535*2048})),rc}},s=[z,D],T[8]=D,T[9]=z,T[10]=l,T[11]=s):(l=T[10],s=T[11]),(0,a.useEffect)(l,s);let G=(0,eX.useSceneSun)();t:{let e,t;if(!G){let e;T[12]===Symbol.for("react.memo_cache_sentinel")?(e=new tC.Vector3(.57735,-.57735,.57735),T[12]=e):e=T[12],c=e;break t}T[13]!==G.direction?(e=(0,t1.torqueToThree)(G.direction),T[13]=G.direction,T[14]=e):e=T[14];let[r,n,a]=e,o=Math.sqrt(r*r+n*n+a*a),i=r/o,l=n/o,s=a/o;T[15]!==s||T[16]!==i||T[17]!==l?(t=new tC.Vector3(i,l,s),T[15]=s,T[16]=i,T[17]=l,T[18]=t):t=T[18],c=t}let W=c;r:{let e;if(!z){u=null;break r}T[19]!==D||T[20]!==W||T[21]!==z.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),a=Math.max(0,Math.min(255,r)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]/65535*(1-c)+e[256*i+l]/65535*c)*(1-u)+(e[256*s+o]/65535*(1-c)+e[256*s+l]/65535*c)*u)*2048},a=new tC.Vector3(-t.x,-t.y,-t.z).normalize(),o=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=t/2+.25,l=e/2+.25,s=n(i,l),c=n(i-.5,l),u=n(i+.5,l),d=n(i,l-.5),m=-((n(i,l+.5)-d)/1),f=-((u-c)/1),h=Math.sqrt(m*m+r*r+f*f),p=Math.max(0,m/h*a.x+r/h*a.y+f/h*a.z),g=1;p>0&&(g=function(e,t,r,n,a,o){let i=n.z/a,l=n.x/a,s=n.y,c=Math.sqrt(i*i+l*l);if(c<1e-4)return 1;let u=.5/c,d=i*u,m=l*u,f=s*u,h=e,p=t,g=r+.1;for(let e=0;e<768&&(h+=d,p+=m,g+=f,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(g>2048));e++)if(gArray(Q).fill(null),T[32]=Q,T[33]=g):g=T[33];let[X,Z]=(0,a.useState)(g);T[34]===Symbol.for("react.memo_cache_sentinel")?(v={xStart:0,xEnd:0,zStart:0,zEnd:0},T[34]=v):v=T[34];let J=(0,a.useRef)(v);return(T[35]!==P.x||T[36]!==P.z||T[37]!==F||T[38]!==E.position.x||T[39]!==E.position.z||T[40]!==Q||T[41]!==I?(x=()=>{let e=E.position.x-P.x,t=E.position.z-P.z,r=Math.floor((e-I)/F),n=Math.ceil((e+I)/F),a=Math.floor((t-I)/F),o=Math.ceil((t+I)/F),i=J.current;if(r===i.xStart&&n===i.xEnd&&a===i.zStart&&o===i.zEnd)return;i.xStart=r,i.xEnd=n,i.zStart=a,i.zEnd=o;let l=[];for(let e=r;e{let t=X[e];return(0,r.jsx)(rn,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:F,basePosition:P,textureNames:z.textureNames,geometry:U,displacementMap:O,visibilityMask:q,alphaTextures:$,detailTextureName:L,lightmap:H,visible:null!==t},e)}),T[53]=P,T[54]=F,T[55]=L,T[56]=Y,T[57]=$,T[58]=O,T[59]=U,T[60]=z.textureNames,T[61]=H,T[62]=X,T[63]=b):b=T[63],T[64]!==y||T[65]!==b?(_=(0,r.jsxs)(r.Fragment,{children:[y,b]}),T[64]=y,T[65]=b,T[66]=_):_=T[66],_):(ro.debug("Not ready: terrain=%s geometry=%s displacement=%s alpha=%s",!!z,!!U,!!O,!!$),null)});function rs(e){return e.camera}function rc(){return ra(null)}function ru(e){return(0,t3.setupMask)(e)}function rd(e,t){return t}var rm=e.i(8597),rf=e.i(78140);let rh=` +vec3 interiorLinearToSRGB(vec3 linear) { + vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055; + vec3 lower = linear * 12.92; + return mix(lower, higher, step(vec3(0.0031308), linear)); +} + +vec3 interiorSRGBToLinear(vec3 srgb) { + vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); + vec3 lower = srgb / 12.92; + return mix(lower, higher, step(vec3(0.04045), srgb)); +} + +// Debug grid overlay function using screen-space derivatives for sharp, anti-aliased lines +// Returns 1.0 on grid lines, 0.0 elsewhere +float debugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); +} +`,rp=(0,M.createLogger)("InteriorInstance");function rg({materialName:e,material:t,lightMap:n}){let o=(0,_.useDebug)(),i=o?.debugMode??!1,l=(0,t8.useAnisotropy)(),s=(0,t2.textureToUrl)(e),c=(0,t5.useTexture)(s,e=>(0,t3.setupTexture)(e,{anisotropy:l})),u=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),m=(0,a.useCallback)(e=>{let t;(0,t7.injectCustomFog)(e,t9.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new tC.Vector3(0,.4,1):new tC.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include +${rh} +uniform bool useSceneLighting; +uniform vec3 interiorDebugColor; +`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Lightmap handled in custom output calculation +#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`// Torque-style lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space +// Get texture in sRGB space (undo Three.js linear decode) +vec3 textureSRGB = interiorLinearToSRGB(diffuseColor.rgb); + +// Compute lighting in sRGB space +vec3 lightingSRGB = vec3(0.0); + +if (useSceneLighting) { + // Three.js computed: reflectedLight = lighting \xd7 texture_linear / PI + // Extract pure lighting: lighting = reflectedLight \xd7 PI / texture_linear + vec3 totalLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 safeTexLinear = max(diffuseColor.rgb, vec3(0.001)); + vec3 extractedLighting = totalLight * PI / safeTexLinear; + // NOTE: extractedLighting is ALREADY sRGB values because mission sun/ambient colors + // are sRGB values (Torque used them directly in gamma space). Three.js treats them + // as linear but the numerical values are the same. DO NOT convert to sRGB here! + // IMPORTANT: Torque clamps scene lighting to [0,1] BEFORE adding to lightmap + // (sceneLighting.cc line 1785: tmp.clamp()) + lightingSRGB = clamp(extractedLighting, 0.0, 1.0); +} + +// Add lightmap contribution (for BOTH outside and inside surfaces) +// In Torque, scene lighting is ADDED to lightmaps for outside surfaces at mission load +// (stored in .ml files). Inside surfaces only have base lightmap. Both need lightmap here. +#ifdef USE_LIGHTMAP + // Lightmap is stored as linear in Three.js (decoded from sRGB texture), convert back + lightingSRGB += interiorLinearToSRGB(lightMapTexel.rgb); +#endif +// Torque clamps the sum to [0,1] per channel (sceneLighting.cc lines 1817-1827) +lightingSRGB = clamp(lightingSRGB, 0.0, 1.0); + +// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space +vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0); + +// Convert back to linear for Three.js output pipeline +vec3 resultLinear = interiorSRGBToLinear(resultSRGB); + +// Reassign outgoingLight before opaque_fragment consumes it +outgoingLight = resultLinear + totalEmissiveRadiance; + +#include `),e.fragmentShader=e.fragmentShader.replace("#include ",`// Debug mode: overlay colored grid on top of normal rendering +// Blue grid = SurfaceOutsideVisible (receives scene ambient light) +// Red grid = inside surface (no scene ambient light) +#if DEBUG_MODE && defined(USE_MAP) + // gridSize=4 creates 4x4 grid per UV tile, lineWidth=1.5 is ~1.5 pixels wide + float gridIntensity = debugGrid(vMapUv, 4.0, 1.5); + gl_FragColor.rgb = mix(gl_FragColor.rgb, interiorDebugColor, gridIntensity * 0.1); +#endif + +#include `)},[d]),f=(0,a.useRef)(null),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=f.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let p={DEBUG_MODE:+!!i},g=`${d}`;return u?(0,r.jsx)("meshBasicMaterial",{ref:f,map:c,toneMapped:!1,defines:p,onBeforeCompile:m},g):(0,r.jsx)("meshLambertMaterial",{ref:h,map:c,lightMap:n,toneMapped:!1,defines:p,onBeforeCompile:m},g)}function rv(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=tC.SRGBColorSpace),t??null}function rx(e){let t,a,o,i=(0,n.c)(13),{node:l}=e;e:{let e,r;if(!l.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],t=e;break e}if(Array.isArray(l.material)){let e;i[1]!==l.material?(e=l.material.map(ry),i[1]=l.material,i[2]=e):e=i[2],t=e;break e}i[3]!==l.material?(e=rv(l.material),i[3]=l.material,i[4]=e):e=i[4],i[5]!==e?(r=[e],i[5]=e,i[6]=r):r=i[6],t=r}let s=t;return i[7]!==s||i[8]!==l.material?(a=l.material?(0,r.jsx)(tQ.DebugSuspense,{name:`InteriorTexture:${Array.isArray(l.material)?l.material[0]?.userData?.resource_path:l.material?.userData?.resource_path??"?"}`,fallback:(0,r.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,t)=>(0,r.jsx)(rg,{materialName:e.userData.resource_path,material:e,lightMap:s[t]},t)):(0,r.jsx)(rg,{materialName:l.material.userData.resource_path,material:l.material,lightMap:s[0]})}):null,i[7]=s,i[8]=l.material,i[9]=a):a=i[9],i[10]!==l.geometry||i[11]!==a?(o=(0,r.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:a}),i[10]=l.geometry,i[11]=a,i[12]=o):o=i[12],o}function ry(e){return rv(e)}let rb=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u=(0,n.c)(10),{interiorFile:d,ghostIndex:m}=e,{nodes:f}=((s=(0,n.c)(2))[0]!==d?(l=(0,t2.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],c=l,(0,rf.useGLTF)(c)),h=(0,_.useDebug)(),p=h?.debugMode??!1;return u[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],u[0]=t):t=u[0],u[1]!==f?(a=Object.entries(f).filter(rC).map(rj),u[1]=f,u[2]=a):a=u[2],u[3]!==p||u[4]!==m||u[5]!==d?(o=p?(0,r.jsxs)(tX.FloatingLabel,{children:[m,": ",d]}):null,u[3]=p,u[4]=m,u[5]=d,u[6]=o):o=u[6],u[7]!==a||u[8]!==o?(i=(0,r.jsxs)("group",{rotation:t,children:[a,o]}),u[7]=a,u[8]=o,u[9]=i):i=u[9],i});function r_(e){let t,a,o,i,l=(0,n.c)(9),{color:s,label:c}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(a=(0,r.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=a):a=l[2],l[3]!==s||l[4]!==c?(o=c?(0,r.jsx)(tX.FloatingLabel,{color:s,children:c}):null,l[3]=s,l[4]=c,l[5]=o):o=l[5],l[6]!==a||l[7]!==o?(i=(0,r.jsxs)("mesh",{children:[t,a,o]}),l[6]=a,l[7]=o,l[8]=i):i=l[8],i}function rS(e){let t,a=(0,n.c)(3),{label:o}=e,i=(0,_.useDebug)(),l=i?.debugMode??!1;return a[0]!==l||a[1]!==o?(t=l?(0,r.jsx)(r_,{color:"red",label:o}):null,a[0]=l,a[1]=o,a[2]=t):t=a[2],t}let rw=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u,d,m,f=(0,n.c)(26),{scene:h}=e;f[0]!==h.transform.position?(t=(0,t1.torqueToThree)(h.transform.position),f[0]=h.transform.position,f[1]=t):t=f[1];let p=t;f[2]!==h.transform?(a=(0,t1.matrixFToQuaternion)(h.transform),f[2]=h.transform,f[3]=a):a=f[3];let g=a;f[4]!==h.scale?(o=(0,t1.torqueScaleToThree)(h.scale),f[4]=h.scale,f[5]=o):o=f[5];let v=o,x=`${h.ghostIndex}: ${h.interiorFile}`;f[6]!==x?(i=(0,r.jsx)(rS,{label:x}),f[6]=x,f[7]=i):i=f[7],f[8]!==h.interiorFile?(l=e=>{rp.error("Failed to load %s: %s",h.interiorFile,e.message)},f[8]=h.interiorFile,f[9]=l):l=f[9];let y=`InteriorModel:${h.interiorFile}`;return f[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(r_,{color:"orange"}),f[10]=s):s=f[10],f[11]!==h.ghostIndex||f[12]!==h.interiorFile?(c=(0,r.jsx)(rb,{interiorFile:h.interiorFile,ghostIndex:h.ghostIndex}),f[11]=h.ghostIndex,f[12]=h.interiorFile,f[13]=c):c=f[13],f[14]!==y||f[15]!==c?(u=(0,r.jsx)(tQ.DebugSuspense,{name:y,fallback:s,children:c}),f[14]=y,f[15]=c,f[16]=u):u=f[16],f[17]!==u||f[18]!==i||f[19]!==l?(d=(0,r.jsx)(rm.ErrorBoundary,{fallback:i,onError:l,children:u}),f[17]=u,f[18]=i,f[19]=l,f[20]=d):d=f[20],f[21]!==p||f[22]!==g||f[23]!==v||f[24]!==d?(m=(0,r.jsx)("group",{position:p,quaternion:g,scale:v,children:d}),f[21]=p,f[22]=g,f[23]=v,f[24]=d,f[25]=m):m=f[25],m});function rC(e){let[,t]=e;return t.isMesh}function rj(e){let[t,n]=e;return(0,r.jsx)(rx,{node:n},t)}var rM=e.i(99143);function rk(e,{path:t}){let[r]=(0,rM.useLoader)(tC.CubeTextureLoader,[e],e=>e.setPath(t));return r}rk.preload=(e,{path:t})=>rM.useLoader.preload(tC.CubeTextureLoader,[e],e=>e.setPath(t));let rT=()=>{};function rN(e){return e.wrapS=tC.RepeatWrapping,e.wrapT=tC.RepeatWrapping,e.minFilter=tC.LinearFilter,e.magFilter=tC.LinearFilter,e.colorSpace=tC.NoColorSpace,e.needsUpdate=!0,e}let rR=` + attribute float alpha; + + uniform vec2 uvOffset; + + varying vec2 vUv; + varying float vAlpha; + + void main() { + // Apply UV offset for scrolling + vUv = uv + uvOffset; + vAlpha = alpha; + + vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + // Set depth to far plane so clouds are always visible and behind other geometry + gl_Position = pos.xyww; + } +`,rD=` + uniform sampler2D cloudTexture; + uniform float debugMode; + uniform int layerIndex; + + varying vec2 vUv; + varying float vAlpha; + + // Debug grid using screen-space derivatives for sharp, anti-aliased lines + float debugGrid(vec2 uv, float gridSize, float lineWidth) { + vec2 scaledUV = uv * gridSize; + vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV); + float line = min(grid.x, grid.y); + return 1.0 - min(line / lineWidth, 1.0); + } + + void main() { + vec4 texColor = texture2D(cloudTexture, vUv); + + // Tribes 2 uses GL_MODULATE: final = texture \xd7 vertex color + // Vertex color is white with varying alpha, so: + // Final RGB = Texture RGB \xd7 1.0 = Texture RGB + // Final Alpha = Texture Alpha \xd7 Vertex Alpha + float finalAlpha = texColor.a * vAlpha; + vec3 color = texColor.rgb; + + // Debug mode: overlay R/G/B grid for layers 0/1/2 + if (debugMode > 0.5) { + float gridIntensity = debugGrid(vUv, 4.0, 1.5); + vec3 gridColor; + if (layerIndex == 0) { + gridColor = vec3(1.0, 0.0, 0.0); // Red + } else if (layerIndex == 1) { + gridColor = vec3(0.0, 1.0, 0.0); // Green + } else { + gridColor = vec3(0.0, 0.0, 1.0); // Blue + } + color = mix(color, gridColor, gridIntensity * 0.5); + } + + // Output clouds with texture color and combined alpha + gl_FragColor = vec4(color, finalAlpha); + } +`;function rL({textureUrl:e,radius:t,heightPercent:n,speed:o,windDirection:i,layerIndex:l}){let{debugMode:s}=(0,_.useDebug)(),{animationEnabled:c}=(0,_.useSettings)(),u=(0,a.useRef)(null),d=(0,t5.useTexture)(e,rN),m=(0,a.useMemo)(()=>{let e=n-.05;return function(e,t,r,n){var a;let o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S=new tC.BufferGeometry,w=new Float32Array(75),C=new Float32Array(50),j=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],M=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,a=-e+r*M,o=e-t*M,i=e*j[n];w[3*n]=a,w[3*n+1]=i,w[3*n+2]=o,C[2*n]=r,C[2*n+1]=t}a=w,o=e=>({x:a[3*e],y:a[3*e+1],z:a[3*e+2]}),i=(e,t,r,n)=>{a[3*e]=t,a[3*e+1]=r,a[3*e+2]=n},l=o(1),s=o(3),c=o(5),u=o(6),d=o(8),m=o(9),f=o(15),h=o(16),p=o(18),g=o(19),v=o(21),x=o(23),y=c.x+(l.x-c.x)*.5,b=c.y+(l.y-c.y)*.5,_=c.z+(l.z-c.z)*.5,i(0,u.x+(y-u.x)*2,u.y+(b-u.y)*2,u.z+(_-u.z)*2),y=m.x+(s.x-m.x)*.5,b=m.y+(s.y-m.y)*.5,_=m.z+(s.z-m.z)*.5,i(4,d.x+(y-d.x)*2,d.y+(b-d.y)*2,d.z+(_-d.z)*2),y=v.x+(f.x-v.x)*.5,b=v.y+(f.y-v.y)*.5,_=v.z+(f.z-v.z)*.5,i(20,h.x+(y-h.x)*2,h.y+(b-h.y)*2,h.z+(_-h.z)*2),y=x.x+(g.x-x.x)*.5,b=x.y+(g.y-x.y)*.5,_=x.z+(g.z-x.z)*.5,i(24,p.x+(y-p.x)*2,p.y+(b-p.y)*2,p.z+(_-p.z)*2);let k=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let a=e[3*n],o=e[3*n+2],i=1.3-Math.sqrt(a*a+o*o)/t;i<.4?i=0:i>.8&&(i=1),r[n]=i}return r}(w,e),T=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,a=r+5,o=a+1;T.push(r,a,o),T.push(r,o,n)}return S.setIndex(T),S.setAttribute("position",new tC.Float32BufferAttribute(w,3)),S.setAttribute("uv",new tC.Float32BufferAttribute(C,2)),S.setAttribute("alpha",new tC.Float32BufferAttribute(k,1)),S.computeBoundingSphere(),S}(t,n,e,0)},[t,n]);(0,a.useEffect)(()=>()=>{m.dispose()},[m]);let f=(0,a.useMemo)(()=>new tC.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new tC.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:rR,fragmentShader:rD,transparent:!0,depthWrite:!1,side:tC.DoubleSide}),[d,s,l]);return(0,a.useEffect)(()=>()=>{f.dispose()},[f]),(0,tw.useFrame)(c?(e,t)=>{let r=1e3*t/32;u.current??=new tC.Vector2(0,0),u.current.x+=i.x*o*r,u.current.y+=i.y*o*r,u.current.x-=Math.floor(u.current.x),u.current.y-=Math.floor(u.current.y),f.uniforms.uvOffset.value.copy(u.current)}:rT),(0,r.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,r.jsx)("primitive",{object:f,attach:"material"})})}function rF(e){var t;let o,i,l,s,c,u,d,m,f,h,p,g=(0,n.c)(18),{scene:v}=e,{data:x}=(t=v.materialList||void 0,(h=(0,n.c)(7))[0]!==t?(d=["detailMapList",t],m=()=>(0,t2.loadDetailMapList)(t),h[0]=t,h[1]=d,h[2]=m):(d=h[1],m=h[2]),p=!!t,h[3]!==d||h[4]!==m||h[5]!==p?(f={queryKey:d,queryFn:m,enabled:p},h[3]=d,h[4]=m,h[5]=p,h[6]=f):f=h[6],(0,t0.useQuery)(f)),y=.95*(v.visibleDistance>0?v.visibleDistance:500);g[0]!==v.cloudLayers?(o=v.cloudLayers.map(rE),g[0]=v.cloudLayers,g[1]=o):o=g[1];let b=o;g[2]!==v.cloudLayers?(i=v.cloudLayers.map(rI),g[2]=v.cloudLayers,g[3]=i):i=g[3];let _=i;e:{let e,{x:t,y:r}=v.windVelocity;if(0!==t||0!==r){let e;g[4]!==t||g[5]!==r?(e=new tC.Vector2(r,-t).normalize(),g[4]=t,g[5]=r,g[6]=e):e=g[6],l=e;break e}g[7]===Symbol.for("react.memo_cache_sentinel")?(e=new tC.Vector2(1,0),g[7]=e):e=g[7],l=e}let S=l;t:{let e;if(!x){let e;g[8]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[8]=e):e=g[8],s=e;break t}if(g[9]!==_||g[10]!==b||g[11]!==x){e=[];for(let t=0;t<3;t++){let r=x[7+t];r&&e.push({texture:r,height:_[t],speed:b[t]})}g[9]=_,g[10]=b,g[11]=x,g[12]=e}else e=g[12];s=e}let w=s,C=(0,a.useRef)(null);return(g[13]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{let{camera:t}=e;C.current&&C.current.position.copy(t.position)},g[13]=c):c=g[13],(0,tw.useFrame)(c),w&&0!==w.length)?(g[14]!==w||g[15]!==y||g[16]!==S?(u=(0,r.jsx)("group",{ref:C,children:w.map((e,t)=>{let n=(0,t2.textureToUrl)(e.texture);return(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rL,{textureUrl:n,radius:y,heightPercent:e.height,speed:e.speed,windDirection:S,layerIndex:t})},t)})}),g[14]=w,g[15]=y,g[16]=S,g[17]=u):u=g[17],u):null}function rI(e,t){return e.heightPercent||[.35,.25,.2][t]}function rE(e,t){return e.speed||[1e-4,2e-4,3e-4][t]}e.i(62395);let rB=(0,M.createLogger)("Sky"),rP=!1;function rA(e){return[new tC.Color().setRGB(e.r,e.g,e.b),new tC.Color().setRGB(e.r,e.g,e.b).convertSRGBToLinear()]}function rz({skyBoxFiles:e,fogColor:t,fogState:n}){let o=(0,tS.useThree)(e=>e.camera),i=rk(e,{path:""}),l=!!t,s=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),c=(0,a.useMemo)(()=>n?(0,t9.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),u=(0,a.useRef)({skybox:{value:i},fogColor:{value:t??new tC.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:t9.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),d=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]);return(0,a.useEffect)(()=>{u.current.skybox.value=i,u.current.fogColor.value=t??new tC.Color(0,0,0),u.current.enableFog.value=l,u.current.fogVolumeData.value=c,u.current.horizonFogHeight.value=d},[i,t,l,c,d]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` + varying vec2 vUv; + + void main() { + vUv = uv; + gl_Position = vec4(position.xy, 0.9999, 1.0); + } + `,fragmentShader:` + uniform samplerCube skybox; + uniform vec3 fogColor; + uniform bool enableFog; + uniform mat4 inverseProjectionMatrix; + uniform mat4 cameraMatrixWorld; + uniform float cameraHeight; + uniform float fogVolumeData[12]; + uniform float horizonFogHeight; + + varying vec2 vUv; + + // Convert linear to sRGB for display + // shaderMaterial does NOT get automatic linear->sRGB output conversion + // Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js + vec3 linearToSRGB(vec3 linear) { + vec3 low = linear * 12.92; + vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; + return mix(low, high, step(vec3(0.0031308), linear)); + } + + void main() { + vec2 ndc = vUv * 2.0 - 1.0; + vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); + viewPos.xyz /= viewPos.w; + vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); + direction = vec3(direction.z, direction.y, -direction.x); + // Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear + vec4 skyColor = textureCube(skybox, direction); + vec3 finalColor; + + if (enableFog) { + vec3 effectiveFogColor = fogColor; + + // Calculate how much fog volume the ray passes through + // For skybox at "infinite" distance, the relevant height is how much + // of the volume is above/below camera depending on view direction + float volumeFogInfluence = 0.0; + + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + // Check if camera is inside this volume + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + // Camera is inside the fog volume + // Looking horizontally or up at shallow angles means ray travels + // through more fog before exiting the volume + float heightAboveCamera = volMaxH - cameraHeight; + float heightBelowCamera = cameraHeight - volMinH; + float volumeHeight = volMaxH - volMinH; + + // For horizontal rays (direction.y ≈ 0), maximum fog influence + // For rays going up steeply, less fog (exits volume quickly) + // For rays going down, more fog (travels through volume below) + float rayInfluence; + if (direction.y >= 0.0) { + // Looking up: influence based on how steep we're looking + // Shallow angles = long path through fog = high influence + rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); + } else { + // Looking down: always high fog (into the volume) + rayInfluence = 1.0; + } + + // Scale by percentage and volume depth factor + volumeFogInfluence += rayInfluence * volPct; + } + } + + // Base fog factor from view direction (for haze at horizon) + // In Torque, the fog "bans" (bands) are rendered as geometry from + // height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox. + // The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3). + // + // horizonFogHeight is the direction.y value where the fog band ends: + // horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2) + // + // For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18 + // + // Torque renders the fog bands as geometry with linear vertex alpha + // interpolation. We use a squared curve (t^2) to create a gentler + // falloff at the top of the gradient, matching Tribes 2's appearance. + float baseFogFactor; + if (direction.y <= 0.0) { + // Looking at or below horizon: full fog + baseFogFactor = 1.0; + } else if (direction.y >= horizonFogHeight) { + // Above fog band: no fog + baseFogFactor = 0.0; + } else { + // Within fog band: squared curve for gentler falloff at top + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); + } + + // Combine base fog with volume fog influence + // When inside a volume, increase fog intensity + float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); + + finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor); + } else { + finalColor = skyColor.rgb; + } + // Convert linear result to sRGB for display + gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); + } + `,depthWrite:!1,depthTest:!1})]})}function rU(e){let t,o,i,l,s,c,u,d=(0,n.c)(6),{materialList:m,fogColor:f,fogState:h}=e,{data:p}=((c=(0,n.c)(8))[0]!==m?(i={queryKey:["detailMapList",m],queryFn:()=>(rB.debug("Loading detail map list: %s",m),(0,t2.loadDetailMapList)(m))},c[0]=m,c[1]=i):i=c[1],u=(0,t0.useQuery)(i),c[2]!==m||c[3]!==u.data||c[4]!==u.error||c[5]!==u.status?(l=()=>{rB.debug("DML query status: %s%s%s file=%s",u.status,u.error?` error=${u.error.message}`:"",u.data?` (${u.data.length} entries)`:" (no data)",m)},s=[u.status,u.error,u.data,m],c[2]=m,c[3]=u.data,c[4]=u.error,c[5]=u.status,c[6]=l,c[7]=s):(l=c[6],s=c[7]),(0,a.useEffect)(l,s),u);d[0]!==p?(t=p?[(0,t2.textureToUrl)(p[1]),(0,t2.textureToUrl)(p[3]),(0,t2.textureToUrl)(p[4]),(0,t2.textureToUrl)(p[5]),(0,t2.textureToUrl)(p[0]),(0,t2.textureToUrl)(p[2])]:null,d[0]=p,d[1]=t):t=d[1];let g=t;return g?(d[2]!==f||d[3]!==h||d[4]!==g?(o=(0,r.jsx)(rz,{skyBoxFiles:g,fogColor:f,fogState:h}),d[2]=f,d[3]=h,d[4]=g,d[5]=o):o=d[5],o):null}function rG({skyColor:e,fogColor:t,fogState:n}){let o=(0,tS.useThree)(e=>e.camera),i=!!t,l=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),s=(0,a.useMemo)(()=>n?(0,t9.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),c=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]),u=(0,a.useRef)({skyColor:{value:e},fogColor:{value:t??new tC.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:t9.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,a.useEffect)(()=>{u.current.skyColor.value=e,u.current.fogColor.value=t??new tC.Color(0,0,0),u.current.enableFog.value=i,u.current.fogVolumeData.value=s,u.current.horizonFogHeight.value=c},[e,t,i,s,c]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:` + varying vec2 vUv; + + void main() { + vUv = uv; + gl_Position = vec4(position.xy, 0.9999, 1.0); + } + `,fragmentShader:` + uniform vec3 skyColor; + uniform vec3 fogColor; + uniform bool enableFog; + uniform mat4 inverseProjectionMatrix; + uniform mat4 cameraMatrixWorld; + uniform float cameraHeight; + uniform float fogVolumeData[12]; + uniform float horizonFogHeight; + + varying vec2 vUv; + + // Convert linear to sRGB for display + vec3 linearToSRGB(vec3 linear) { + vec3 low = linear * 12.92; + vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055; + return mix(low, high, step(vec3(0.0031308), linear)); + } + + void main() { + vec2 ndc = vUv * 2.0 - 1.0; + vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0); + viewPos.xyz /= viewPos.w; + vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz); + direction = vec3(direction.z, direction.y, -direction.x); + + vec3 finalColor; + + if (enableFog) { + // Calculate volume fog influence (same logic as SkyBoxTexture) + float volumeFogInfluence = 0.0; + + for (int i = 0; i < 3; i++) { + int offset = i * 4; + float volVisDist = fogVolumeData[offset + 0]; + float volMinH = fogVolumeData[offset + 1]; + float volMaxH = fogVolumeData[offset + 2]; + float volPct = fogVolumeData[offset + 3]; + + if (volVisDist <= 0.0) continue; + + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float rayInfluence; + if (direction.y >= 0.0) { + rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y); + } else { + rayInfluence = 1.0; + } + volumeFogInfluence += rayInfluence * volPct; + } + } + + // Base fog factor from view direction + float baseFogFactor; + if (direction.y <= 0.0) { + baseFogFactor = 1.0; + } else if (direction.y >= horizonFogHeight) { + baseFogFactor = 0.0; + } else { + float t = direction.y / horizonFogHeight; + baseFogFactor = (1.0 - t) * (1.0 - t); + } + + // Combine base fog with volume fog influence + float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5); + + finalColor = mix(skyColor, fogColor, finalFogFactor); + } else { + finalColor = skyColor; + } + + gl_FragColor = vec4(linearToSRGB(finalColor), 1.0); + } + `,depthWrite:!1,depthTest:!1})]})}function rW(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function rH({fogState:e,enabled:t}){let r=(0,tS.useThree)(e=>e.scene),n=(0,tS.useThree)(e=>e.camera),o=(0,a.useRef)(null),i=(0,a.useMemo)(()=>(0,t9.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,a.useEffect)(()=>{rP||((0,t7.installCustomFogShader)(),rP=!0)},[]),(0,a.useEffect)(()=>{(0,t9.resetGlobalFogUniforms)();let[t,a]=rW(e,n.position.y),l=new tC.Fog(e.fogColor,t,a);return r.fog=l,o.current=l,(0,t9.updateGlobalFogUniforms)(n.position.y,i),()=>{r.fog=null,o.current=null,(0,t9.resetGlobalFogUniforms)()}},[r,n,e,i]),(0,a.useEffect)(()=>{let r=o.current;if(r)if(t){let[t,a]=rW(e,n.position.y);r.near=t,r.far=a}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,tw.useFrame)(()=>{let r=o.current;if(!r)return;let a=n.position.y;if((0,t9.updateGlobalFogUniforms)(a,i,t),t){let[t,n]=rW(e,a);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}let rO=(0,a.memo)(function({entity:e}){let{skyData:t}=e;rB.debug("Rendering: materialList=%s, useSkyTextures=%s",t.materialList,t.useSkyTextures);let{fogEnabled:n}=(0,_.useSettings)(),o=t.materialList||void 0,i=(0,a.useMemo)(()=>rA(t.skySolidColor),[t.skySolidColor]),l=t.useSkyTextures,s=(0,a.useMemo)(()=>(function(e){let t=e.fogDistance,r=e.visibleDistance>0?e.visibleDistance:1e3,{r:n,g:a,b:o}=e.fogColor,i=new tC.Color().setRGB(n,a,o).convertSRGBToLinear(),l=[];for(let t of e.fogVolumes)t.visibleDistance<=0||t.maxHeight<=t.minHeight||l.push({visibleDistance:t.visibleDistance,minHeight:t.minHeight,maxHeight:t.maxHeight,percentage:1});let s=l.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:t,visibleDistance:r,fogColor:i,fogVolumes:l,fogLine:s,enabled:r>t}})(t),[t]);rB.debug("fogState: fogColor=(%s, %s, %s) visibleDistance=%d fogDistance=%d enabled=%s volumes=%d",t.fogColor.r.toFixed(3),t.fogColor.g.toFixed(3),t.fogColor.b.toFixed(3),t.visibleDistance,t.fogDistance,s.enabled,s.fogVolumes.length);let c=(0,a.useMemo)(()=>rA(t.fogColor),[t.fogColor]),u=i||c,d=s.enabled&&n,m=s.fogColor,f=(0,tS.useThree)(e=>e.scene),h=(0,tS.useThree)(e=>e.gl);(0,a.useEffect)(()=>{if(d){let e=m.clone();f.background=e,h.setClearColor(e)}else if(u){let e=u[0].clone();f.background=e,h.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,h,d,m,u]);let p=i?.[1];return(0,r.jsxs)(r.Fragment,{children:[o&&l&&o.length>0?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rU,{materialList:o,fogColor:d?m:void 0,fogState:d?s:void 0},o)}):p?(0,r.jsx)(rG,{skyColor:p,fogColor:d?m:void 0,fogState:d?s:void 0}):null,(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rF,{scene:t})}),s.enabled?(0,r.jsx)(rH,{fogState:s,enabled:n}):null]})});function rV(e){let t,o=(0,n.c)(3),{children:i}=e,{audioEnabled:l}=(0,_.useSettings)();return o[0]!==l||o[1]!==i?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=l,o[1]=i,o[2]=t):t=o[2],t}function rq(e,t){let o=(0,a.lazy)(()=>t().then(t=>({default:t[e]}))),i=t=>{let a,i,l=(0,n.c)(5),{entity:s}=t,c=`${e}:${s.id}`;return l[0]!==s?(a=(0,r.jsx)(o,{entity:s}),l[0]=s,l[1]=a):a=l[1],l[2]!==c||l[3]!==a?(i=(0,r.jsx)(tQ.DebugSuspense,{name:c,children:a}),l[2]=c,l[3]=a,l[4]=i):i=l[4],i};return i.displayName=`createLazy(${e})`,i}let r$=rq("PlayerModel",()=>e.A(30814)),rK=rq("ExplosionShape",()=>e.A(44325)),rQ=rq("TracerProjectile",()=>e.A(62125)),rY=rq("SpriteProjectile",()=>e.A(62125)),rX=rq("ForceFieldBare",()=>e.A(25147)),rZ=rq("AudioEmitter",()=>e.A(61921)),rJ=rq("WaterBlock",()=>e.A(18599)),r0=rq("WeaponModel",()=>e.A(44325)),r1={1:"Storm",2:"Inferno"},r2=(0,a.memo)(function(e){let t=(0,n.c)(26),{entity:a}=e;switch(a.renderType){case"Shape":{let e;return t[0]!==a?(e=(0,r.jsx)(r3,{entity:a}),t[0]=a,t[1]=e):e=t[1],e}case"ForceFieldBare":{let e;return t[2]!==a?(e=(0,r.jsx)(rX,{entity:a}),t[2]=a,t[3]=e):e=t[3],e}case"Player":{let e;return t[4]!==a?(e=(0,r.jsx)(r$,{entity:a}),t[4]=a,t[5]=e):e=t[5],e}case"Explosion":{let e;return t[6]!==a?(e=(0,r.jsx)(rK,{entity:a}),t[6]=a,t[7]=e):e=t[7],e}case"Tracer":{let e;return t[8]!==a?(e=(0,r.jsx)(rQ,{entity:a}),t[8]=a,t[9]=e):e=t[9],e}case"Sprite":{let e;return t[10]!==a?(e=(0,r.jsx)(rY,{entity:a}),t[10]=a,t[11]=e):e=t[11],e}case"AudioEmitter":{let e;return t[12]!==a?(e=(0,r.jsx)(rV,{children:(0,r.jsx)(rZ,{entity:a})}),t[12]=a,t[13]=e):e=t[13],e}case"Camera":{let e;return t[14]!==a?(e=(0,r.jsx)(tZ,{entity:a}),t[14]=a,t[15]=e):e=t[15],e}case"WayPoint":{let e;return t[16]!==a?(e=(0,r.jsx)(tJ,{entity:a}),t[16]=a,t[17]=e):e=t[17],e}case"TerrainBlock":{let e;return t[18]!==a.terrainData?(e=(0,r.jsx)(rl,{scene:a.terrainData}),t[18]=a.terrainData,t[19]=e):e=t[19],e}case"InteriorInstance":{let e;return t[20]!==a.interiorData?(e=(0,r.jsx)(rw,{scene:a.interiorData}),t[20]=a.interiorData,t[21]=e):e=t[21],e}case"Sky":{let e;return t[22]!==a?(e=(0,r.jsx)(rO,{entity:a}),t[22]=a,t[23]=e):e=t[23],e}case"Sun":case"MissionArea":case"None":default:return null;case"WaterBlock":{let e;return t[24]!==a?(e=(0,r.jsx)(rJ,{entity:a}),t[24]=a,t[25]=e):e=t[25],e}}});function r3(e){let t,o,i,l,s,c,u,d=(0,n.c)(24),{entity:m}=e,{animationEnabled:f}=(0,_.useSettings)(),h=(0,a.useRef)(null);if(d[0]!==f||d[1]!==m.rotate?(t=()=>{if(!h.current||!m.rotate||!f)return;let e=performance.now()/1e3;h.current.rotation.y=e/3*Math.PI*2},d[0]=f,d[1]=m.rotate,d[2]=t):t=d[2],(0,tw.useFrame)(t),!m.shapeName)throw Error(`Shape entity missing shapeName: ${m.id}`);let p=m.runtimeObject,g=m.shapeType??"StaticShape",v=m.dataBlock?.toLowerCase()==="flag",x=m.teamId&&m.teamId>0?r1[m.teamId]:null,y=v&&x?`${x} Flag`:null,b="Item"===m.shapeType?"pink":m.threads?"#00ff88":"yellow",S=m.rotate?h:void 0,w=p?void 0:m;return d[3]!==y?(o=y?(0,r.jsx)(tX.FloatingLabel,{opacity:.6,children:y}):null,d[3]=y,d[4]=o):o=d[4],d[5]!==b||d[6]!==w||d[7]!==o?(i=(0,r.jsx)(t$.ShapeRenderer,{loadingColor:b,streamEntity:w,children:o}),d[5]=b,d[6]=w,d[7]=o,d[8]=i):i=d[8],d[9]!==m.barrelShapeName||d[10]!==p?(l=m.barrelShapeName&&(0,r.jsx)(tK.ShapeInfoProvider,{object:p,shapeName:m.barrelShapeName,type:"Turret",children:(0,r.jsx)("group",{position:[0,1.5,0],children:(0,r.jsx)(t$.ShapeRenderer,{})})}),d[9]=m.barrelShapeName,d[10]=p,d[11]=l):l=d[11],d[12]!==m?(s=m.weaponShape&&(0,r.jsx)(tY.ShapeErrorBoundary,{fallback:(0,r.jsx)(t$.ShapePlaceholder,{color:"red",label:m.weaponShape}),children:(0,r.jsx)(tQ.DebugSuspense,{name:`Weapon:${m.id}/${m.weaponShape}`,fallback:(0,r.jsx)(t$.ShapePlaceholder,{color:"cyan",label:m.weaponShape}),children:(0,r.jsx)(r0,{entity:m})})}),d[12]=m,d[13]=s):s=d[13],d[14]!==S||d[15]!==i||d[16]!==l||d[17]!==s?(c=(0,r.jsxs)("group",{ref:S,children:[i,l,s]}),d[14]=S,d[15]=i,d[16]=l,d[17]=s,d[18]=c):c=d[18],d[19]!==m.shapeName||d[20]!==g||d[21]!==c||d[22]!==p?(u=(0,r.jsx)(tK.ShapeInfoProvider,{object:p,shapeName:m.shapeName,type:g,children:c}),d[19]=m.shapeName,d[20]=g,d[21]=c,d[22]=p,d[23]=u):u=d[23],u}var r5=e.i(60099),r4=e.i(85557),r6=e.i(29418);let r8=(0,t2.textureToUrl)("gui/hud_alliedtriangle"),r7=(0,t2.textureToUrl)("gui/hud_enemytriangle"),r9=new tC.Vector3,ne=[];function nt(e){let t,o,i,l,s,c=(0,n.c)(21),{entity:u}=e,d=(0,t$.useStaticShape)(u.shapeName??u.dataBlock),m=(0,tS.useThree)(nn),f=(0,a.useRef)(null),h=(0,a.useRef)(null),p=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(null),[x,y]=(0,a.useState)(!0),b=(0,a.useRef)(null);c[0]!==d.scene?(t=new tC.Box3().setFromObject(d.scene),c[0]=d.scene,c[1]=t):t=c[1];let _=t.max.y+.1,S=u.keyframes??ne;c[2]!==S?(o=S.some(nr),c[2]=S,c[3]=o):o=c[3];let w=o;c[4]!==m||c[5]!==u.id||c[6]!==u.iffColor||c[7]!==u.playerName||c[8]!==w||c[9]!==x||c[10]!==S?(i=()=>{let e=f.current;if(!e)return;e.getWorldPosition(r9);let t=m.position.distanceTo(r9),r=m.matrixWorld.elements,n=!(-((r9.x-r[12])*r[8])+-((r9.y-r[13])*r[9])+-((r9.z-r[14])*r[10])<0)&&t<150;if(x!==n&&y(n),!n)return;let a=(0,r4.getKeyframeAtTime)(S,tD.streamPlaybackStore.getState().time),o=a?.health??1;if(a?.damageState!=null&&a.damageState>=1){h.current&&(h.current.style.opacity="0"),p.current&&(p.current.style.opacity="0");return}let i=Math.max(0,Math.min(1,1-t/150)).toString();if(h.current&&(h.current.style.opacity=i),p.current&&(p.current.style.opacity=i),b.current){let e=u.playerName??u.id;b.current.textContent!==e&&(b.current.textContent=e)}if(v.current&&u.iffColor){let e=u.iffColor.r>u.iffColor.g?r7:r8;v.current.getAttribute("src")!==e&&(v.current.src=e)}g.current&&w&&(g.current.style.width=`${Math.max(0,Math.min(100,100*o))}%`,g.current.style.background=u.iffColor?`rgb(${u.iffColor.r}, ${u.iffColor.g}, ${u.iffColor.b})`:"")},c[4]=m,c[5]=u.id,c[6]=u.iffColor,c[7]=u.playerName,c[8]=w,c[9]=x,c[10]=S,c[11]=i):i=c[11],(0,tw.useFrame)(i);let C=u.iffColor&&u.iffColor.r>u.iffColor.g?r7:r8;return c[12]!==u.id||c[13]!==u.playerName||c[14]!==w||c[15]!==_||c[16]!==C||c[17]!==x?(l=x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(r5.Html,{position:[0,_,0],center:!0,children:(0,r.jsx)("div",{ref:h,className:r6.default.Top,children:(0,r.jsx)("img",{ref:v,className:r6.default.IffArrow,src:C,alt:""})})}),(0,r.jsx)(r5.Html,{position:[0,-.2,0],center:!0,children:(0,r.jsxs)("div",{ref:p,className:r6.default.Bottom,children:[(0,r.jsx)("div",{ref:b,className:r6.default.Name,children:u.playerName??u.id}),w&&(0,r.jsx)("div",{className:r6.default.HealthBar,children:(0,r.jsx)("div",{ref:g,className:r6.default.HealthFill})})]})})]}),c[12]=u.id,c[13]=u.playerName,c[14]=w,c[15]=_,c[16]=C,c[17]=x,c[18]=l):l=c[18],c[19]!==l?(s=(0,r.jsx)("group",{ref:f,children:l}),c[19]=l,c[20]=s):s=c[20],s}function nr(e){return null!=e.health}function nn(e){return e.camera}var na=e.i(78779);let no=(0,t2.textureToUrl)("commander/MiniIcons/com_flag_grey"),ni=new tC.Vector3;function nl(e){let t,o,i,l,s,c=(0,n.c)(9),{entity:u}=e,d=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),h=(0,tS.useThree)(ns);c[0]!==h||c[1]!==u.iffColor?(t=()=>{if(m.current&&u.iffColor){let{r:e,g:t,b:r}=u.iffColor;m.current.style.backgroundColor=`rgb(${e},${t},${r})`}if(f.current&&d.current){d.current.getWorldPosition(ni);let e=h.position.distanceTo(ni);f.current.textContent=e.toFixed(1)}},c[0]=h,c[1]=u.iffColor,c[2]=t):t=c[2],(0,tw.useFrame)(t);let p=u.iffColor?`rgb(${u.iffColor.r},${u.iffColor.g},${u.iffColor.b})`:"rgb(200,200,200)";c[3]===Symbol.for("react.memo_cache_sentinel")?(o=[0,1.5,0],c[3]=o):o=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)("span",{ref:f,className:na.default.Distance}),c[4]=i):i=c[4],c[5]!==p?(l={backgroundColor:p,"--flag-icon-url":`url(${no})`},c[5]=p,c[6]=l):l=c[6];let g=l;return c[7]!==g?(s=(0,r.jsx)("group",{ref:d,children:(0,r.jsx)(r5.Html,{position:o,center:!0,children:(0,r.jsxs)("div",{className:na.default.Root,children:[i,(0,r.jsx)("div",{ref:m,className:na.default.Icon,style:g})]})})}),c[7]=g,c[8]=s):s=c[8],s}function ns(e){return e.camera}function nc(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("group",{ref:nu,children:(0,r.jsx)(nd,{})}),t[0]=e):e=t[0],e}function nu(e){tD.streamPlaybackStore.setState({root:e})}let nd=(0,a.memo)(function(){let e=(0,eX.useAllGameEntities)(),t=(0,a.useRef)(new Map).current,n=new Set;for(let r of e)n.add(r.id),t.set(r.id,r);for(let e of t.keys())n.has(e)||t.delete(e);return(0,r.jsx)(r.Fragment,{children:[...t.values()].map(e=>(0,r.jsx)(nm,{entity:e},e.id))})}),nm=(0,a.memo)(function(e){let t,a=(0,n.c)(7),{entity:o}=e;if((0,tq.isSceneEntity)(o)){let e,t;return a[0]!==o?(e=(0,r.jsx)(r2,{entity:o}),a[0]=o,a[1]=e):e=a[1],a[2]!==o.id||a[3]!==e?(t=(0,r.jsx)("group",{name:o.id,children:e}),a[2]=o.id,a[3]=e,a[4]=t):t=a[4],t}return"None"===o.renderType?null:(a[5]!==o?(t=(0,r.jsx)(ng,{entity:o}),a[5]=o,a[6]=t):t=a[6],t)});function nf(e){let t,a=(0,n.c)(2),{entity:o}=e,i=(0,th.useEngineSelector)(nh);return o.id===i?null:(a[0]!==o?(t=(0,r.jsx)(nt,{entity:o}),a[0]=o,a[1]=t):t=a[1],t)}function nh(e){return e.playback.streamSnapshot?.controlPlayerGhostId}function np({entity:e}){let t=(0,a.useRef)(!1),[n,o]=(0,a.useState)(()=>((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0);return(t.current=n,(0,tw.useFrame)(()=>{let r=((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0;r!==t.current&&(t.current=r,o(r))}),n)?(0,r.jsx)(nl,{entity:e}):null}function ng(e){let t,a,o,i,l,s,c,u,d=(0,n.c)(39),{entity:m}=e,f=m.position,h=m.scale;e:{let e;if(!m.rotation){t=void 0;break e}d[0]!==m.rotation?(e=new tC.Quaternion(...m.rotation),d[0]=m.rotation,d[1]=e):e=d[1],t=e}let p=t,g="Player"===m.renderType;if("Shape"===m.renderType&&!m.shapeName){let e,t,n,a,o,i=m.id;return d[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("sphereGeometry",{args:[.3,6,4]}),d[2]=e):e=d[2],d[3]!==m.className?(t=(0,r4.entityTypeColor)(m.className),d[3]=m.className,d[4]=t):t=d[4],d[5]!==t?(n=(0,r.jsxs)("mesh",{children:[e,(0,r.jsx)("meshBasicMaterial",{color:t,wireframe:!0})]}),d[5]=t,d[6]=n):n=d[6],d[7]!==m?(a=(0,r.jsx)(np,{entity:m}),d[7]=m,d[8]=a):a=d[8],d[9]!==m.id||d[10]!==f||d[11]!==p||d[12]!==h||d[13]!==n||d[14]!==a?(o=(0,r.jsxs)("group",{name:i,position:f,quaternion:p,scale:h,children:[n,a]}),d[9]=m.id,d[10]=f,d[11]=p,d[12]=h,d[13]=n,d[14]=a,d[15]=o):o=d[15],o}d[16]!==m.className||d[17]!==m.renderType?(a="Explosion"===m.renderType?null:(0,r.jsxs)("mesh",{children:[(0,r.jsx)("sphereGeometry",{args:[.5,8,6]}),(0,r.jsx)("meshBasicMaterial",{color:(0,r4.entityTypeColor)(m.className),wireframe:!0})]}),d[16]=m.className,d[17]=m.renderType,d[18]=a):a=d[18];let v=a;return d[19]!==m?(o=(0,r.jsx)(r2,{entity:m}),d[19]=m,d[20]=o):o=d[20],d[21]!==v||d[22]!==o?(i=(0,r.jsx)(tY.ShapeErrorBoundary,{fallback:v,children:o}),d[21]=v,d[22]=o,d[23]=i):i=d[23],d[24]!==m||d[25]!==g?(l=g&&(0,r.jsx)(nf,{entity:m}),d[24]=m,d[25]=g,d[26]=l):l=d[26],d[27]!==m?(s=(0,r.jsx)(np,{entity:m}),d[27]=m,d[28]=s):s=d[28],d[29]!==i||d[30]!==l||d[31]!==s?(c=(0,r.jsxs)("group",{name:"model",children:[i,l,s]}),d[29]=i,d[30]=l,d[31]=s,d[32]=c):c=d[32],d[33]!==m.id||d[34]!==f||d[35]!==p||d[36]!==h||d[37]!==c?(u=(0,r.jsx)("group",{name:m.id,position:f,quaternion:p,scale:h,children:c}),d[33]=m.id,d[34]=f,d[35]=p,d[36]=h,d[37]=c,d[38]=u):u=d[38],u}let nv=(0,M.createLogger)("SceneLighting");function nx(){let e,t,o,i=(0,n.c)(6),l=(0,eX.useSceneSun)();if(i[0]!==l?(e=()=>{l?nv.debug("sunData: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",l.direction.x.toFixed(3),l.direction.y.toFixed(3),l.direction.z.toFixed(3),l.color.r.toFixed(3),l.color.g.toFixed(3),l.color.b.toFixed(3),l.ambient.r.toFixed(3),l.ambient.g.toFixed(3),l.ambient.b.toFixed(3)):nv.debug("No sunData — using fallback ambient #888")},t=[l],i[0]=l,i[1]=e,i[2]=t):(e=i[1],t=i[2]),(0,a.useEffect)(e,t),!l){let e;return i[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("ambientLight",{color:"#888888",intensity:1}),i[3]=e):e=i[3],e}return i[4]!==l?(o=(0,r.jsx)(ny,{sunData:l}),i[4]=l,i[5]=o):o=i[5],o}function ny(e){let t,o,i,l,s,c,u,d,m,f,h=(0,n.c)(29),{sunData:p}=e;h[0]!==p.direction?(t=(0,t1.torqueToThree)(p.direction),h[0]=p.direction,h[1]=t):t=h[1];let[g,v,x]=t,y=Math.sqrt(g*g+v*v+x*x),b=g/y,_=v/y,S=x/y;h[2]!==b||h[3]!==_||h[4]!==S?(o=new tC.Vector3(b,_,S),h[2]=b,h[3]=_,h[4]=S,h[5]=o):o=h[5];let w=o,C=-(5e3*w.x),j=-(5e3*w.y),M=-(5e3*w.z);h[6]!==C||h[7]!==j||h[8]!==M?(i=new tC.Vector3(C,j,M),h[6]=C,h[7]=j,h[8]=M,h[9]=i):i=h[9];let k=i;h[10]!==p.color.b||h[11]!==p.color.g||h[12]!==p.color.r?(l=new tC.Color(p.color.r,p.color.g,p.color.b),h[10]=p.color.b,h[11]=p.color.g,h[12]=p.color.r,h[13]=l):l=h[13];let T=l;h[14]!==p.ambient.b||h[15]!==p.ambient.g||h[16]!==p.ambient.r?(s=new tC.Color(p.ambient.r,p.ambient.g,p.ambient.b),h[14]=p.ambient.b,h[15]=p.ambient.g,h[16]=p.ambient.r,h[17]=s):s=h[17];let N=s,R=w.y<0;return h[18]!==R?(c=()=>{t4.value=R},u=[R],h[18]=R,h[19]=c,h[20]=u):(c=h[19],u=h[20]),(0,a.useEffect)(c,u),h[21]!==T||h[22]!==k?(d=(0,r.jsx)("directionalLight",{position:k,color:T,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),h[21]=T,h[22]=k,h[23]=d):d=h[23],h[24]!==N?(m=(0,r.jsx)("ambientLight",{color:N,intensity:1}),h[24]=N,h[25]=m):m=h[25],h[26]!==d||h[27]!==m?(f=(0,r.jsxs)(r.Fragment,{children:[d,m]}),h[26]=d,h[27]=m,h[28]=f):f=h[28],f}function nb(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo,delete window.loadDemoRecording}var n_=e.i(74657),nS=e.i(75056);let nw={toneMapping:tC.NoToneMapping,outputColorSpace:tC.SRGBColorSpace};function nC(e){let t,a,o=(0,n.c)(6),{children:i,renderOnDemand:l,dpr:s,onCreated:c}=e,{renderOnDemand:u}=(0,_.useDebug)(),d=void 0!==l&&l||u?"demand":"always";return o[0]===Symbol.for("react.memo_cache_sentinel")?(t={type:tC.PCFShadowMap},o[0]=t):t=o[0],o[1]!==i||o[2]!==s||o[3]!==c||o[4]!==d?(a=(0,r.jsx)(nS.Canvas,{frameloop:d,dpr:s,gl:nw,shadows:t,onCreated:c,children:i}),o[1]=i,o[2]=s,o[3]=c,o[4]=d,o[5]=a):a=o[5],a}var nj=e.i(12631),nM=e.i(66093),nk=e.i(85413),nT=Object.defineProperty,nN=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?nT(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let nR=new tC.Euler(0,0,0,"YXZ"),nD=new tC.Vector3,nL={type:"change"},nF={type:"lock"},nI={type:"unlock"},nE=Math.PI/2;class nB extends nk.EventDispatcher{constructor(e,t){super(),nN(this,"camera"),nN(this,"domElement"),nN(this,"isLocked"),nN(this,"minPolarAngle"),nN(this,"maxPolarAngle"),nN(this,"pointerSpeed"),nN(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nR.setFromQuaternion(this.camera.quaternion),nR.y-=.002*e.movementX*this.pointerSpeed,nR.x-=.002*e.movementY*this.pointerSpeed,nR.x=Math.max(nE-this.maxPolarAngle,Math.min(nE-this.minPolarAngle,nR.x)),this.camera.quaternion.setFromEuler(nR),this.dispatchEvent(nL))}),nN(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(nF),this.isLocked=!0):(this.dispatchEvent(nI),this.isLocked=!1))}),nN(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),nN(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),nN(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),nN(this,"dispose",()=>{this.disconnect()}),nN(this,"getObject",()=>this.camera),nN(this,"direction",new tC.Vector3(0,0,-1)),nN(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),nN(this,"moveForward",e=>{nD.setFromMatrixColumn(this.camera.matrix,0),nD.crossVectors(this.camera.up,nD),this.camera.position.addScaledVector(nD,e)}),nN(this,"moveRight",e=>{nD.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(nD,e)}),nN(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),nN(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}(t={}).forward="forward",t.backward="backward",t.left="left",t.right="right",t.up="up",t.down="down",t.lookUp="lookUp",t.lookDown="lookDown",t.lookLeft="lookLeft",t.lookRight="lookRight",t.camera1="camera1",t.camera2="camera2",t.camera3="camera3",t.camera4="camera4",t.camera5="camera5",t.camera6="camera6",t.camera7="camera7",t.camera8="camera8",t.camera9="camera9";let nP=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"lookUp",keys:["ArrowUp"]},{name:"lookDown",keys:["ArrowDown"]},{name:"lookLeft",keys:["ArrowLeft"]},{name:"lookRight",keys:["ArrowRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function nA(){let e,t,r,o,i,l,s,c,u,d,m,f,h,p,g,v=(0,n.c)(41);v[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],v[0]=e):e=v[0],(0,a.useEffect)(nG,e);let{speedMultiplier:x,setSpeedMultiplier:y,invertScroll:b,invertDrag:S}=(0,_.useControls)(),{onInput:w,mode:C}=(0,tL.useInputContext)(),[j,M]=(0,nj.useKeyboardControls)(),k=(0,tS.useThree)(nU),T=(0,tS.useThree)(nz),{nextCamera:N,setCameraIndex:R,cameraCount:D}=tN(),L=(0,a.useRef)(null);v[1]!==b?(t=()=>b,v[1]=b,v[2]=t):t=v[2];let F=(0,a.useEffectEvent)(t);v[3]!==S?(r=()=>S,v[3]=S,v[4]=r):r=v[4];let I=(0,a.useEffectEvent)(r);v[5]!==C?(o=()=>C,v[5]=C,v[6]=o):o=v[6];let E=(0,a.useEffectEvent)(o),B=(0,a.useRef)(0),P=(0,a.useRef)(0),A=(0,a.useRef)(!1),z=(0,a.useRef)(!1);return v[7]!==k||v[8]!==T.domElement?(i=()=>{let e=new nB(k,T.domElement);return L.current=e,()=>{e.dispose()}},l=[k,T.domElement],v[7]=k,v[8]=T.domElement,v[9]=i,v[10]=l):(i=v[9],l=v[10]),(0,a.useEffect)(i,l),v[11]!==I||v[12]!==E||v[13]!==T.domElement||v[14]!==C||v[15]!==N?(s=()=>{let e=T.domElement,t=!1,r=!1,n=0,a=0,o=o=>{L.current?.isLocked||o.target===e&&(t=!0,r=!1,n=o.clientX,a=o.clientY)},i=e=>{if(L.current?.isLocked){B.current=B.current+.002*e.movementX,P.current=P.current+.002*e.movementY;return}if(!t||!r&&3>Math.abs(e.clientX-n)&&3>Math.abs(e.clientY-a))return;r=!0;let o="follow"===E()?-1:1,i=(I()?1:-1)*o;B.current=B.current+i*e.movementX*.002,P.current=P.current+i*e.movementY*.002},l=()=>{t=!1},s=t=>{let n=L.current;n?.isLocked?"follow"===C?A.current=!0:"local"===C&&N():t.target!==e||r||n?.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",i),document.addEventListener("mouseup",l),document.addEventListener("click",s),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),document.removeEventListener("click",s)}},v[11]=I,v[12]=E,v[13]=T.domElement,v[14]=C,v[15]=N,v[16]=s):s=v[16],v[17]!==k||v[18]!==T.domElement||v[19]!==C||v[20]!==N?(c=[k,T.domElement,N,C],v[17]=k,v[18]=T.domElement,v[19]=C,v[20]=N,v[21]=c):c=v[21],(0,a.useEffect)(s,c),v[22]!==D||v[23]!==R||v[24]!==j?(u=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return j(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=F()?-1:1,r=(e.deltaY>0?-1:1)*t,n=Math.max(2,Math.min(11,Math.ceil(Math.log2(Math.abs(e.deltaY)+1))))*r;y(e=>{let t=Math.round(100*e)+n;return Math.max(_.MIN_SPEED_MULTIPLIER,Math.min(_.MAX_SPEED_MULTIPLIER,t/100))})},t=T.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},v[27]=F,v[28]=T.domElement,v[29]=y,v[30]=m):m=v[30],v[31]!==T.domElement||v[32]!==y?(f=[T.domElement,y],v[31]=T.domElement,v[32]=y,v[33]=f):f=v[33],(0,a.useEffect)(m,f),v[34]!==C?(h=()=>{if("local"===C)return;let e=e=>{if("KeyO"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(z.current=!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},p=[C],v[34]=C,v[35]=h,v[36]=p):(h=v[35],p=v[36]),(0,a.useEffect)(h,p),v[37]!==M||v[38]!==w||v[39]!==x?(g=(e,t)=>{let{forward:r,backward:n,left:a,right:o,up:i,down:l,lookUp:s,lookDown:c,lookLeft:u,lookRight:d}=M(),m=B.current,f=P.current;B.current=0,P.current=0,u&&(m-=t),d&&(m+=+t),s&&(f-=t),c&&(f+=+t);let h=0,p=0,g=0;a&&(h=-1),o&&(h+=1),r&&(p=1),n&&(p-=1),i&&(g=1),l&&(g-=1);let v=(Math.round(15*((x-_.MIN_SPEED_MULTIPLIER)/(1-_.MIN_SPEED_MULTIPLIER)))+1)/16;h=Math.max(-1,Math.min(1,h*v)),p=Math.max(-1,Math.min(1,p*v)),g=Math.max(-1,Math.min(1,g*v));let y=[!1,!1,!1,!1,!1,!1];A.current&&(y[0]=!0,A.current=!1),z.current&&(y[2]=!0,z.current=!1);let b=0!==m||0!==f,S=0!==h||0!==p||0!==g,C=y.some(Boolean);(b||S||C)&&w({deltaYaw:m,deltaPitch:f,x:h,y:p,z:g,triggers:y,delta:t})},v[37]=M,v[38]=w,v[39]=x,v[40]=g):g=v[40],(0,tw.useFrame)(g),null}function nz(e){return e.gl}function nU(e){return e.camera}function nG(){return window.addEventListener("keydown",nW,{capture:!0}),window.addEventListener("keyup",nW,{capture:!0}),()=>{window.removeEventListener("keydown",nW,{capture:!0}),window.removeEventListener("keyup",nW,{capture:!0})}}function nW(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}let nH=(0,a.lazy)(()=>e.A(34019).then(e=>({default:e.TouchHandler})));function nO(e){let t,o,i,l,s,c=(0,n.c)(9),{children:u}=e;c[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],c[0]=t):t=c[0];let d=(0,a.useRef)(t),[m,f]=(0,a.useState)("local");c[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{d.current.push(e)},c[1]=o):o=c[1];let h=o;return c[2]!==m?(i={moveQueue:d,onInput:h,mode:m,setMode:f},c[2]=m,c[3]=i):i=c[3],c[4]!==u?(l=(0,r.jsx)(nj.KeyboardControls,{map:nP,children:(0,r.jsx)(nM.JoystickProvider,{children:u})}),c[4]=u,c[5]=l):l=c[5],c[6]!==i||c[7]!==l?(s=(0,r.jsx)(tL.InputContext.Provider,{value:i,children:l}),c[6]=i,c[7]=l,c[8]=s):s=c[8],s}function nV(){let e,t,o,i=(0,n.c)(5),l=(0,eY.useTouchDevice)();return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(nA,{}),i[0]=e):e=i[0],i[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nH,{})}):null,i[1]=l,i[2]=t):t=i[2],i[3]!==t?(o=(0,r.jsxs)(r.Fragment,{children:[e,t]}),i[3]=t,i[4]=o):o=i[4],o}let nq=(0,a.lazy)(()=>e.A(553).then(e=>({default:e.TouchJoystick}))),n$=(0,a.lazy)(()=>e.A(33487).then(e=>({default:e.KeyboardOverlay})));function nK(){let e,t,o,i=(0,n.c)(7),l=(0,eY.useTouchDevice)();return i[0]!==l?(e=l?(0,r.jsx)(nq,{}):null,i[0]=l,i[1]=e):e=i[1],i[2]!==l?(t=!1===l?(0,r.jsx)(n$,{}):null,i[2]=l,i[3]=t):t=i[3],i[4]!==e||i[5]!==t?(o=(0,r.jsxs)(a.Suspense,{children:[e,t]}),i[4]=e,i[5]=t,i[6]=o):o=i[6],o}var nQ=e.i(89271);function nY(e){let t,a,o,i,l,s=(0,n.c)(11),{isLoading:c,progress:u}=e,d=!c;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:nQ.default.Spinner}),s[0]=t):t=s[0];let m=`${100*u}%`;return s[1]!==m?(a=(0,r.jsx)("div",{className:nQ.default.Progress,children:(0,r.jsx)("div",{className:nQ.default.ProgressBar,style:{width:m}})}),s[1]=m,s[2]=a):a=s[2],s[3]!==u?(o=Math.round(100*u),s[3]=u,s[4]=o):o=s[4],s[5]!==o?(i=(0,r.jsxs)("div",{className:nQ.default.ProgressText,children:[o,"%"]}),s[5]=o,s[6]=i):i=s[6],s[7]!==d||s[8]!==a||s[9]!==i?(l=(0,r.jsxs)("div",{className:nQ.default.LoadingIndicator,"data-complete":d,children:[t,a,i]}),s[7]=d,s[8]=a,s[9]=i,s[10]=l):l=s[10],l}function nX(e){let t,o=(0,n.c)(3),{children:i}=e,{debugMode:l}=(0,_.useDebug)();return o[0]!==i||o[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=i,o[1]=l,o[2]=t):t=o[2],t}var nZ=e.i(82156);function nJ(e,t){return(0,a.lazy)(()=>t().then(t=>({default:t[e]})))}let n0=nJ("StreamingController",()=>e.A(25483)),n1=nJ("DemoPlaybackControls",()=>e.A(93884)),n2=nJ("DebugElements",()=>e.A(88487)),n3=nJ("Mission",()=>e.A(21683)),n5=nJ("ChatSoundPlayer",()=>e.A(38496)),n4=nJ("PlayerHUD",()=>e.A(57567)),n6=nJ("MapInfoDialog",()=>e.A(59197)),n8=nJ("ServerBrowser",()=>e.A(70012));function n7(){let[e,t]=(0,n_.useMissionQueryState)(),o=(0,a.useContext)(s),{clearFogEnabledOverride:i,sidebarOpen:l,setSidebarOpen:c}=(0,_.useSettings)(),{missionName:u,missionType:d}=e,[m,f]=(0,a.useState)(!1),[h,p]=(0,a.useState)(!1),[g,S]=(0,a.useState)(!1),[w,C]=(0,a.useState)(0),[j,M]=(0,a.useState)(!0),N=(0,eY.useTouchDevice)(),R=(0,a.useCallback)(e=>{window.location.hash="",i(),S(!1);let r=k.liveConnectionStore.getState();r.disconnectServer(),r.disconnectRelay(),th.engineStore.getState().setRecording(null),eX.gameEntityStore.getState().endStreaming(),t(e),N&&c(!1)},[i,t,N,c]);!function(e){let t,r,o=(0,n.c)(5),{onChangeMission:i}=e,{setRecording:l}=(0,T.usePlaybackActions)(),s=(0,a.useEffectEvent)(i);o[0]!==s||o[1]!==l?(t=()=>(window.setMissionName=e=>{let t=(0,eZ.getMissionInfo)(e).missionTypes;s({missionName:e,missionType:t[0]})},window.getMissionList=eZ.getMissionList,window.getMissionInfo=eZ.getMissionInfo,window.loadDemoRecording=l,nb),o[0]=s,o[1]=l,o[2]=t):t=o[2],o[3]!==l?(r=[l],o[3]=l,o[4]=r):r=o[4],(0,a.useEffect)(t,r)}({onChangeMission:R});let D=(0,T.useRecording)(),L=(0,eX.useDataSource)(),F="demo"===L||"live"===L,I=(0,eX.useMissionName)(),E=(0,eX.useMissionType)();(0,a.useEffect)(()=>{if(F&&I)try{let e=(0,eZ.getMissionInfo)(I),r=E&&e.missionTypes.includes(E)?E:void 0;t({missionName:I,missionType:r})}catch{t(null)}},[F,I,E,t]),(0,a.useEffect)(()=>{D&&S(!1)},[D]);let B=(0,k.useLiveSelector)(e=>e.gameStatus);(0,a.useEffect)(()=>{"connected"===B&&N&&c(!1)},[B,N,c]),(0,a.useEffect)(()=>{D&&N&&c(!1)},[N,D,c]);let P=w<1;(0,a.useEffect)(()=>{if(P)M(!0);else{let e=setTimeout(()=>M(!1),500);return()=>clearTimeout(e)}},[P]);let A=(0,a.useCallback)((e,t=0)=>{C(t)},[]),z=(0,a.useRef)(null),U=(0,a.useRef)(null);return(0,r.jsx)("main",{className:nZ.default.Frame,children:(0,r.jsxs)(T.RecordingProvider,{children:[(0,r.jsxs)("header",{className:nZ.default.Toolbar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("button",{type:"button",className:nZ.default.ToggleSidebarButton,"data-orientation":"top","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(y,{}):(0,r.jsx)(b,{})}),(0,r.jsx)("button",{type:"button",className:nZ.default.ToggleSidebarButton,"data-orientation":"left","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(v,{}):(0,r.jsx)(x,{})}),(0,r.jsx)(a.Activity,{mode:F&&!g?"visible":"hidden",children:(0,r.jsx)(tv,{})}),(0,r.jsxs)(a.Activity,{mode:!F||g?"visible":"hidden",children:[(0,r.jsx)(tf,{value:g?"":u,missionType:g?"":d,onChange:R,autoFocus:g}),g&&(0,r.jsx)("button",{type:"button",className:nZ.default.CancelButton,onClick:()=>{S(!1)},children:"Cancel"})]})]}),l?(0,r.jsx)("div",{className:nZ.default.Backdrop}):null,(0,r.jsx)(a.Activity,{mode:l?"visible":"hidden",children:(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)("div",{className:nZ.default.Sidebar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-open":l,children:(0,r.jsx)(e0,{missionName:u,missionType:d,onOpenMapInfo:()=>f(!0),onOpenServerBrowser:o.live?()=>p(!0):void 0,onChooseMap:F?()=>{S(!0)}:void 0,onCancelChoosingMap:()=>{S(!1)},choosingMap:g,cameraRef:z,invalidateRef:U})})})}),(0,r.jsx)(nO,{children:(0,r.jsxs)("div",{className:nZ.default.Content,children:[(0,r.jsx)("div",{className:nZ.default.ThreeView,children:(0,r.jsx)(nC,{dpr:m||h?.25:void 0,onCreated:e=>{z.current=e.camera,U.current=e.invalidate},children:(0,r.jsx)(tF.TickProvider,{children:(0,r.jsxs)(tR,{children:[(0,r.jsx)(nV,{}),(0,r.jsxs)(tk.AudioProvider,{children:[(0,r.jsx)(nx,{}),(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nc,{})}),(0,r.jsx)(tM,{}),(0,r.jsx)(rV,{children:(0,r.jsx)(n5,{})}),(0,r.jsx)(nX,{children:(0,r.jsx)(n2,{})}),D?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n0,{recording:D})}):null,F?null:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n3,{name:u,missionType:d,onLoadingChange:A},`${u}~${d}`)}),(0,r.jsx)(tV,{})]})]})})})}),F?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n4,{})}):null,(0,r.jsx)(nK,{}),j&&(0,r.jsx)(nY,{isLoading:P,progress:w})]})}),(0,r.jsx)("footer",{className:nZ.default.PlayerBar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:D?.source==="demo"?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n1,{})}):null}),m?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n6,{onClose:()=>f(!1),missionName:u,missionType:d??""})})}):null,h?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n8,{onClose:()=>p(!1)})})}):null]})})}let n9=new o.QueryClient;function ae(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(c,{children:(0,r.jsx)(i.QueryClientProvider,{client:n9,children:(0,r.jsx)(_.SettingsProvider,{children:(0,r.jsx)(n7,{})})})})}),t[0]=e):e=t[0],e}e.s(["default",()=>ae],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/48d0203d138a3e57.js b/docs/_next/static/chunks/4fb9edf01fb5e4f5.js similarity index 99% rename from docs/_next/static/chunks/48d0203d138a3e57.js rename to docs/_next/static/chunks/4fb9edf01fb5e4f5.js index ef70c148..ba9ebe95 100644 --- a/docs/_next/static/chunks/48d0203d138a3e57.js +++ b/docs/_next/static/chunks/4fb9edf01fb5e4f5.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,0,t=>{"use strict";t.i(91891);var e=t.i(11251),s=t.i(88787);t.i(70847);var a=t.i(47566),i=t.i(25311),o=t.i(89119),r=t.i(10244);class n extends r.StreamEngine{parser;initialBlock;moveTicks=0;absoluteYaw=0;absolutePitch=0;lastAbsYaw=0;lastAbsPitch=0;exhausted=!1;_teamScoresGen=0;_rosterGen=0;_weaponsHudGen=0;_inventoryHudGen=0;_cachedSnapshot=null;_cachedSnapshotTick=-1;_snap=null;constructor(t){super(),this.parser=t,this.registry=t.getRegistry(),this.ghostTracker=t.getGhostTracker();const e=t.initialBlock;this.initialBlock={dataBlocks:e.dataBlocks,initialGhosts:e.initialGhosts,controlObjectGhostIndex:e.controlObjectGhostIndex,controlObjectData:e.controlObjectData,targetEntries:e.targetEntries,sensorGroupColors:e.sensorGroupColors,taggedStrings:e.taggedStrings,initialEvents:e.initialEvents,demoValues:e.demoValues,firstPerson:e.firstPerson},this.reset()}getDataBlockData(t){let e=this.initialBlock.dataBlocks.get(t);if(e?.data)return e.data;let s=this.parser.getPacketParser();return s.dataBlockDataMap?.get(t)}_shapeConstructorCache=null;getShapeConstructorSequences(t){if(!this._shapeConstructorCache)for(let[,t]of(this._shapeConstructorCache=new Map,this.initialBlock.dataBlocks)){if("TSShapeConstructor"!==t.className||!t.data)continue;let e=t.data.shape,s=t.data.sequences;e&&s&&this._shapeConstructorCache.set(e.toLowerCase(),s)}return this._shapeConstructorCache.get(t.toLowerCase())}getTimeSec(){return this.moveTicks*(i.TICK_DURATION_MS/1e3)}getCameraYawPitch(t){let e="player"===this.lastControlType,s=e?this.absoluteYaw:this.lastAbsYaw,a=e?this.absolutePitch:this.lastAbsPitch;return e&&(this.lastAbsYaw=s,this.lastAbsPitch=a),{yaw:s,pitch:a}}getControlPlayerHeadPitch(t){return(0,o.clamp)(this.absolutePitch/o.MAX_PITCH,-1,1)}onTeamScoresChanged(){this._teamScoresGen++}onRosterChanged(){this._rosterGen++}onWeaponsHudChanged(){this._weaponsHudGen++}onInventoryHudChanged(){this._inventoryHudGen++}reset(){for(let[t,e]of(this.parser.reset(),this.ghostTracker=this.parser.getGhostTracker(),this._cachedSnapshot=null,this._cachedSnapshotTick=-1,this._snap=null,this.resetSharedState(),this.initialBlock.taggedStrings))this.netStrings.set(t,e);for(let t of this.initialBlock.targetEntries)t.name&&this.targetNames.set(t.targetId,(0,o.stripTaggedStringMarkup)(t.name)),this.targetTeams.set(t.targetId,t.sensorGroup),this.targetRenderFlags.set(t.targetId,t.targetData);for(let t of this.initialBlock.sensorGroupColors){let e=this.sensorGroupColors.get(t.group);e||(e=new Map,this.sensorGroupColors.set(t.group,e)),e.set(t.targetGroup,{r:t.r,g:t.g,b:t.b})}if(this.moveTicks=0,this.absoluteYaw=0,this.absolutePitch=0,this.lastAbsYaw=0,this.lastAbsPitch=0,this.firstPerson=this.initialBlock.firstPerson,this.lastControlType=(0,o.detectControlObjectType)(this.initialBlock.controlObjectData)??"player",this.isPiloting="player"===this.lastControlType&&!!(this.initialBlock.controlObjectData?.pilot||this.initialBlock.controlObjectData?.controlObjectGhost!=null),this.lastPilotGhostIndex=this.isPiloting&&"number"==typeof this.initialBlock.controlObjectData?.controlObjectGhost?this.initialBlock.controlObjectData.controlObjectGhost:void 0,this.isPiloting){let t=this.initialBlock.controlObjectData?.controlObjectData,e=t?.angPosition;if(e&&"number"==typeof e.w){this.lastVehicleHeading=(0,o.torqueQuatHeading)(e),this.lastVehiclePitch=(0,o.torqueQuatPitch)(e);let t=(0,o.torqueQuatToThreeJS)(e);if(t){let[e,s,a,i]=t;this.lastVehicleOrbitDir=[-(1-2*(s*s+a*a)),-(2*(e*s+a*i)),-(2*(e*a-s*i))]}}}if(this.lastCameraMode="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.cameraMode?this.initialBlock.controlObjectData.cameraMode:void 0,this.lastOrbitGhostIndex="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.orbitObjectGhostIndex?this.initialBlock.controlObjectData.orbitObjectGhostIndex:void 0,"camera"===this.lastControlType){let t=this.initialBlock.controlObjectData?.minOrbitDist,e=this.initialBlock.controlObjectData?.maxOrbitDist,s=this.initialBlock.controlObjectData?.curOrbitDist;"number"==typeof t&&"number"==typeof e&&Number.isFinite(t)&&Number.isFinite(e)?this.lastOrbitDistance=Math.max(0,e-t):"number"==typeof s&&Number.isFinite(s)?this.lastOrbitDistance=Math.max(0,s):this.lastOrbitDistance=void 0}else this.lastOrbitDistance=void 0;let t=this.getAbsoluteRotation(this.initialBlock.controlObjectData);for(let e of(t&&(this.absoluteYaw=t.yaw,this.absolutePitch=t.pitch,this.lastAbsYaw=t.yaw,this.lastAbsPitch=t.pitch),this.exhausted=!1,this.latestFov=100,this.latestControl={ghostIndex:this.initialBlock.controlObjectGhostIndex,data:this.initialBlock.controlObjectData,position:(0,o.isValidPosition)(this.initialBlock.controlObjectData?.position)?this.initialBlock.controlObjectData?.position:void 0},this.controlPlayerGhostId="player"===this.lastControlType&&this.initialBlock.controlObjectGhostIndex>=0?(0,i.toEntityId)("Player",this.initialBlock.controlObjectGhostIndex):void 0,this.initialBlock.initialGhosts)){if("create"!==e.type||null==e.classId)continue;let t=this.registry.getGhostParser(e.classId)?.name;if(!t)throw Error(`No ghost parser for classId ${e.classId} (ghost index ${e.index})`);let s=(0,i.toEntityId)(t,e.index),o={id:s,ghostIndex:e.index,className:t,spawnTick:0,type:(0,i.toEntityType)(t),rotation:[0,0,0,1]};if(this.applyGhostData(o,e.parsedData),e.parsedData){let s=(0,a.ghostToSceneObject)(t,e.index,e.parsedData);s&&(o.sceneData=s)}this.entities.set(s,o),this.entityIdByGhostIndex.set(e.index,s)}if(0===this.playerSensorGroup&&"player"===this.lastControlType&&this.latestControl.ghostIndex>=0){let t=this.entityIdByGhostIndex.get(this.latestControl.ghostIndex),e=t?this.entities.get(t):void 0;e?.sensorGroup!=null&&e.sensorGroup>0&&(this.playerSensorGroup=e.sensorGroup)}for(let t of this.initialBlock.initialEvents){let e=this.registry.getEventParser(t.classId)?.name;if("SetSensorGroupEvent"===e&&t.parsedData){let e=t.parsedData.sensorGroup;null!=e&&(this.playerSensorGroup=e)}else if("RemoteCommandEvent"===e&&t.parsedData){let e=this.resolveNetString(t.parsedData.funcName),s=t.parsedData.args;"ServerMessage"===e&&this.handleServerMessage(s),this.handleHudRemoteCommand(e,s)}}let e=function(t){let e={weaponsHud:null,backpackHud:null,inventoryHud:null,teamScores:[],playerRoster:new Map,chatMessages:[],gravity:-20};if(!t.length)return e;let s=0,a=()=>{let e=t[s++];return""===e?"":e??""};if(a(),s>=t.length)return e;let i=parseInt(a(),10)||0,r=new Map;for(let t=0;t0&&r.set(o,(r.get(o)??0)+1)}if(s>=t.length||(a(),s>=t.length))return e;{let t=a().split(" "),s=t[0]??"",i="1"===t[1]||"true"===t[1],r=t[2]??"",n="1"===t[4]||"true"===t[4];i&&s&&(e.backpackHud={packIndex:(0,o.backpackBitmapToIndex)(s),active:n,text:r})}if(s>=t.length)return e;let n=a().split(" "),l=parseInt(n[4],10)||0,c=parseInt(n[5],10)||0,h=parseInt(n[6],10);for(let t=0;t=t.length)return e;let d=a().split(" "),u=parseInt(d[4],10)||0,m=parseInt(d[5],10)||0,k=parseInt(d[6],10);for(let t=0;t0)||t.set(s,i)}t.size>0&&(e.inventoryHud={slots:t,activeSlot:isNaN(k)?-1:k})}if(s>=t.length)return e;let b=a().split(" "),g=b[1]??"",y=parseInt(b[2],10)||0,f=[];for(let t=0;t=8)for(let t=0;t<2;t++){let s=4*t,a=t+1;e.teamScores.push({teamId:a,name:f[s]??"",score:parseInt(f[s+1],10)||0,playerCount:r.get(a)??0})}else if("TR2Game"===g&&y>=4)for(let t=0;t<2;t++){let s=2*t,a=t+1;e.teamScores.push({teamId:a,name:f[s+1]??"",score:parseInt(f[s],10)||0,playerCount:r.get(a)??0})}if(s>=t.length)return e;a();for(let i=0;i<10&&!(s>=t.length);i++){let t=a();t&&e.chatMessages.push(t)}if(st.text).join("");if(!s.trim())continue;let a=e[0].colorCode;if(e.some(t=>3===t.colorCode||4===t.colorCode)&&s.includes(": ")){let t=s.indexOf(": ");this.pushChatMessage({timeSec:0,sender:s.slice(0,t),text:s.slice(t+2),kind:"chat",colorCode:a,segments:e})}else this.pushChatMessage({timeSec:0,sender:"",text:s,kind:"server",colorCode:a,segments:e})}this.updateCameraAndHud()}getSnapshot(){if(this._cachedSnapshot&&this._cachedSnapshotTick===this.moveTicks)return this._cachedSnapshot;let t=this.buildSnapshot();return this._cachedSnapshot=t,this._cachedSnapshotTick=this.moveTicks,t}getEffectShapes(){let t=new Set,e=e=>{let s=e.dtsFileName;s&&t.add(s);let a=e.subExplosions;if(Array.isArray(a))for(let e of a){if(null==e)continue;let s=this.getDataBlockData(e);s?.dtsFileName&&t.add(s.dtsFileName)}};for(let[,t]of this.initialBlock.dataBlocks){let s=t.data?.explosion;if(null==s)continue;let a=this.getDataBlockData(s);a&&e(a)}return[...t]}stepToTime(t,e=1/0){let s=Math.floor(1e3*(Number.isFinite(t)?Math.max(0,t):0)/i.TICK_DURATION_MS),a=!1;s({index:t,ammo:e})),activeIndex:this.weaponsHud.activeIndex},n=a&&a.inventoryHudGen===this._inventoryHudGen?a.inventoryHud:{slots:Array.from(this.inventoryHud.slots.entries()).map(([t,e])=>({slot:t,count:e})),activeSlot:this.inventoryHud.activeSlot},l=a&&a.backpackPackIndex===this.backpackHud.packIndex&&a.backpackActive===this.backpackHud.active&&a.backpackText===this.backpackHud.text?a.backpackHud:this.backpackHud.packIndex>=0?{...this.backpackHud}:null;if(a&&a.teamScoresGen===this._teamScoresGen&&a.rosterGen===this._rosterGen)t=a.teamScores;else{t=this.teamScores.map(t=>({...t}));let e=new Map;for(let{teamId:t}of this.playerRoster.values())t>0&&e.set(t,(e.get(t)??0)+1);for(let s of t)s.playerCount=e.get(s.teamId)??0}return this._snap={teamScoresGen:this._teamScoresGen,rosterGen:this._rosterGen,teamScores:t,weaponsHudGen:this._weaponsHudGen,weaponsHud:r,inventoryHudGen:this._inventoryHudGen,inventoryHud:n,backpackPackIndex:this.backpackHud.packIndex,backpackActive:this.backpackHud.active,backpackText:this.backpackHud.text,backpackHud:l},{timeSec:s,exhausted:this.exhausted,camera:this.camera,entities:e,controlPlayerGhostId:this.controlPlayerGhostId,playerSensorGroup:this.playerSensorGroup,status:this.lastStatus,chatMessages:i,audioEvents:o,weaponsHud:r,backpackHud:l,inventoryHud:n,teamScores:t}}isPacketData(t){return!!t&&"object"==typeof t&&"gameState"in t&&"events"in t&&"ghosts"in t}isMoveData(t){return!!t&&"object"==typeof t&&"yaw"in t}isInfoData(t){return!!t&&"object"==typeof t&&"value1"in t&&"number"==typeof t.value1&&"value2"in t&&"number"==typeof t.value2}}async function l(t){let e=new s.DemoParser(new Uint8Array(t)),{header:a,initialBlock:i}=await e.load(),r=function(t){let e=null,s=null,a=null,i=null,r=null,n=null,l=null;for(let c=0;c=3&&h[1]?.endsWith("Game")&&(a=h[1]),"readplayerinfo"!==t[c])continue;let p=t[c+1];if(p){if(p.startsWith("1 ")){let t=p.split(" ");t[2]&&(n=(0,o.stripTaggedStringMarkup)(t[2]).trim());continue}if(p.startsWith("2 ")){let t=p.split(" ");t[1]&&(i=t[1]),t[3]&&(l=t[3]),t[4]&&(e=t[4]);continue}if(p.startsWith("3 ")){let t=p.split(" ");t[1]&&(r=t[1]),t[2]&&(s=t[2])}}}return{missionDisplayName:e,missionType:s,gameClassName:a,serverDisplayName:i,mod:r,recorderName:n,recordingDate:l}}(i.demoValues),l=new n(e);return l.missionDisplayName=r.missionDisplayName,l.missionTypeDisplayName=r.missionType,l.gameClassName=r.gameClassName,l.serverDisplayName=r.serverDisplayName,l.connectedPlayerName=r.recorderName,{source:"demo",duration:a.demoLengthMs/1e3,missionName:i.missionName??null,gameType:r.missionType,serverDisplayName:r.serverDisplayName,recorderName:r.recorderName,recordingDate:r.recordingDate,streamingPlayback:l}}t.s(["createDemoStreamingRecording",()=>l])}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,0,t=>{"use strict";t.i(50593);var e=t.i(17711),s=t.i(58281);t.i(70847);var a=t.i(47566),i=t.i(25311),o=t.i(89119),r=t.i(10244);class n extends r.StreamEngine{parser;initialBlock;moveTicks=0;absoluteYaw=0;absolutePitch=0;lastAbsYaw=0;lastAbsPitch=0;exhausted=!1;_teamScoresGen=0;_rosterGen=0;_weaponsHudGen=0;_inventoryHudGen=0;_cachedSnapshot=null;_cachedSnapshotTick=-1;_snap=null;constructor(t){super(),this.parser=t,this.registry=t.getRegistry(),this.ghostTracker=t.getGhostTracker();const e=t.initialBlock;this.initialBlock={dataBlocks:e.dataBlocks,initialGhosts:e.initialGhosts,controlObjectGhostIndex:e.controlObjectGhostIndex,controlObjectData:e.controlObjectData,targetEntries:e.targetEntries,sensorGroupColors:e.sensorGroupColors,taggedStrings:e.taggedStrings,initialEvents:e.initialEvents,demoValues:e.demoValues,firstPerson:e.firstPerson},this.reset()}getDataBlockData(t){let e=this.initialBlock.dataBlocks.get(t);if(e?.data)return e.data;let s=this.parser.getPacketParser();return s.dataBlockDataMap?.get(t)}_shapeConstructorCache=null;getShapeConstructorSequences(t){if(!this._shapeConstructorCache)for(let[,t]of(this._shapeConstructorCache=new Map,this.initialBlock.dataBlocks)){if("TSShapeConstructor"!==t.className||!t.data)continue;let e=t.data.shape,s=t.data.sequences;e&&s&&this._shapeConstructorCache.set(e.toLowerCase(),s)}return this._shapeConstructorCache.get(t.toLowerCase())}getTimeSec(){return this.moveTicks*(i.TICK_DURATION_MS/1e3)}getCameraYawPitch(t){let e="player"===this.lastControlType,s=e?this.absoluteYaw:this.lastAbsYaw,a=e?this.absolutePitch:this.lastAbsPitch;return e&&(this.lastAbsYaw=s,this.lastAbsPitch=a),{yaw:s,pitch:a}}getControlPlayerHeadPitch(t){return(0,o.clamp)(this.absolutePitch/o.MAX_PITCH,-1,1)}onTeamScoresChanged(){this._teamScoresGen++}onRosterChanged(){this._rosterGen++}onWeaponsHudChanged(){this._weaponsHudGen++}onInventoryHudChanged(){this._inventoryHudGen++}reset(){for(let[t,e]of(this.parser.reset(),this.ghostTracker=this.parser.getGhostTracker(),this._cachedSnapshot=null,this._cachedSnapshotTick=-1,this._snap=null,this.resetSharedState(),this.initialBlock.taggedStrings))this.netStrings.set(t,e);for(let t of this.initialBlock.targetEntries)t.name&&this.targetNames.set(t.targetId,(0,o.stripTaggedStringMarkup)(t.name)),this.targetTeams.set(t.targetId,t.sensorGroup),this.targetRenderFlags.set(t.targetId,t.targetData);for(let t of this.initialBlock.sensorGroupColors){let e=this.sensorGroupColors.get(t.group);e||(e=new Map,this.sensorGroupColors.set(t.group,e)),e.set(t.targetGroup,{r:t.r,g:t.g,b:t.b})}if(this.moveTicks=0,this.absoluteYaw=0,this.absolutePitch=0,this.lastAbsYaw=0,this.lastAbsPitch=0,this.firstPerson=this.initialBlock.firstPerson,this.lastControlType=(0,o.detectControlObjectType)(this.initialBlock.controlObjectData)??"player",this.isPiloting="player"===this.lastControlType&&!!(this.initialBlock.controlObjectData?.pilot||this.initialBlock.controlObjectData?.controlObjectGhost!=null),this.lastPilotGhostIndex=this.isPiloting&&"number"==typeof this.initialBlock.controlObjectData?.controlObjectGhost?this.initialBlock.controlObjectData.controlObjectGhost:void 0,this.isPiloting){let t=this.initialBlock.controlObjectData?.controlObjectData,e=t?.angPosition;if(e&&"number"==typeof e.w){this.lastVehicleHeading=(0,o.torqueQuatHeading)(e),this.lastVehiclePitch=(0,o.torqueQuatPitch)(e);let t=(0,o.torqueQuatToThreeJS)(e);if(t){let[e,s,a,i]=t;this.lastVehicleOrbitDir=[-(1-2*(s*s+a*a)),-(2*(e*s+a*i)),-(2*(e*a-s*i))]}}}if(this.lastCameraMode="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.cameraMode?this.initialBlock.controlObjectData.cameraMode:void 0,this.lastOrbitGhostIndex="camera"===this.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.orbitObjectGhostIndex?this.initialBlock.controlObjectData.orbitObjectGhostIndex:void 0,"camera"===this.lastControlType){let t=this.initialBlock.controlObjectData?.minOrbitDist,e=this.initialBlock.controlObjectData?.maxOrbitDist,s=this.initialBlock.controlObjectData?.curOrbitDist;"number"==typeof t&&"number"==typeof e&&Number.isFinite(t)&&Number.isFinite(e)?this.lastOrbitDistance=Math.max(0,e-t):"number"==typeof s&&Number.isFinite(s)?this.lastOrbitDistance=Math.max(0,s):this.lastOrbitDistance=void 0}else this.lastOrbitDistance=void 0;let t=this.getAbsoluteRotation(this.initialBlock.controlObjectData);for(let e of(t&&(this.absoluteYaw=t.yaw,this.absolutePitch=t.pitch,this.lastAbsYaw=t.yaw,this.lastAbsPitch=t.pitch),this.exhausted=!1,this.latestFov=100,this.latestControl={ghostIndex:this.initialBlock.controlObjectGhostIndex,data:this.initialBlock.controlObjectData,position:(0,o.isValidPosition)(this.initialBlock.controlObjectData?.position)?this.initialBlock.controlObjectData?.position:void 0},this.controlPlayerGhostId="player"===this.lastControlType&&this.initialBlock.controlObjectGhostIndex>=0?(0,i.toEntityId)("Player",this.initialBlock.controlObjectGhostIndex):void 0,this.initialBlock.initialGhosts)){if("create"!==e.type||null==e.classId)continue;let t=this.registry.getGhostParser(e.classId)?.name;if(!t)throw Error(`No ghost parser for classId ${e.classId} (ghost index ${e.index})`);let s=(0,i.toEntityId)(t,e.index),o={id:s,ghostIndex:e.index,className:t,spawnTick:0,type:(0,i.toEntityType)(t),rotation:[0,0,0,1]};if(this.applyGhostData(o,e.parsedData),e.parsedData){let s=(0,a.ghostToSceneObject)(t,e.index,e.parsedData);s&&(o.sceneData=s)}this.entities.set(s,o),this.entityIdByGhostIndex.set(e.index,s)}if(0===this.playerSensorGroup&&"player"===this.lastControlType&&this.latestControl.ghostIndex>=0){let t=this.entityIdByGhostIndex.get(this.latestControl.ghostIndex),e=t?this.entities.get(t):void 0;e?.sensorGroup!=null&&e.sensorGroup>0&&(this.playerSensorGroup=e.sensorGroup)}for(let t of this.initialBlock.initialEvents){let e=this.registry.getEventParser(t.classId)?.name;if("SetSensorGroupEvent"===e&&t.parsedData){let e=t.parsedData.sensorGroup;null!=e&&(this.playerSensorGroup=e)}else if("RemoteCommandEvent"===e&&t.parsedData){let e=this.resolveNetString(t.parsedData.funcName),s=t.parsedData.args;"ServerMessage"===e&&this.handleServerMessage(s),this.handleHudRemoteCommand(e,s)}}let e=function(t){let e={weaponsHud:null,backpackHud:null,inventoryHud:null,teamScores:[],playerRoster:new Map,chatMessages:[],gravity:-20};if(!t.length)return e;let s=0,a=()=>{let e=t[s++];return""===e?"":e??""};if(a(),s>=t.length)return e;let i=parseInt(a(),10)||0,r=new Map;for(let t=0;t0&&r.set(o,(r.get(o)??0)+1)}if(s>=t.length||(a(),s>=t.length))return e;{let t=a().split(" "),s=t[0]??"",i="1"===t[1]||"true"===t[1],r=t[2]??"",n="1"===t[4]||"true"===t[4];i&&s&&(e.backpackHud={packIndex:(0,o.backpackBitmapToIndex)(s),active:n,text:r})}if(s>=t.length)return e;let n=a().split(" "),l=parseInt(n[4],10)||0,c=parseInt(n[5],10)||0,h=parseInt(n[6],10);for(let t=0;t=t.length)return e;let d=a().split(" "),u=parseInt(d[4],10)||0,m=parseInt(d[5],10)||0,k=parseInt(d[6],10);for(let t=0;t0)||t.set(s,i)}t.size>0&&(e.inventoryHud={slots:t,activeSlot:isNaN(k)?-1:k})}if(s>=t.length)return e;let b=a().split(" "),g=b[1]??"",y=parseInt(b[2],10)||0,f=[];for(let t=0;t=8)for(let t=0;t<2;t++){let s=4*t,a=t+1;e.teamScores.push({teamId:a,name:f[s]??"",score:parseInt(f[s+1],10)||0,playerCount:r.get(a)??0})}else if("TR2Game"===g&&y>=4)for(let t=0;t<2;t++){let s=2*t,a=t+1;e.teamScores.push({teamId:a,name:f[s+1]??"",score:parseInt(f[s],10)||0,playerCount:r.get(a)??0})}if(s>=t.length)return e;a();for(let i=0;i<10&&!(s>=t.length);i++){let t=a();t&&e.chatMessages.push(t)}if(st.text).join("");if(!s.trim())continue;let a=e[0].colorCode;if(e.some(t=>3===t.colorCode||4===t.colorCode)&&s.includes(": ")){let t=s.indexOf(": ");this.pushChatMessage({timeSec:0,sender:s.slice(0,t),text:s.slice(t+2),kind:"chat",colorCode:a,segments:e})}else this.pushChatMessage({timeSec:0,sender:"",text:s,kind:"server",colorCode:a,segments:e})}this.updateCameraAndHud()}getSnapshot(){if(this._cachedSnapshot&&this._cachedSnapshotTick===this.moveTicks)return this._cachedSnapshot;let t=this.buildSnapshot();return this._cachedSnapshot=t,this._cachedSnapshotTick=this.moveTicks,t}getEffectShapes(){let t=new Set,e=e=>{let s=e.dtsFileName;s&&t.add(s);let a=e.subExplosions;if(Array.isArray(a))for(let e of a){if(null==e)continue;let s=this.getDataBlockData(e);s?.dtsFileName&&t.add(s.dtsFileName)}};for(let[,t]of this.initialBlock.dataBlocks){let s=t.data?.explosion;if(null==s)continue;let a=this.getDataBlockData(s);a&&e(a)}return[...t]}stepToTime(t,e=1/0){let s=Math.floor(1e3*(Number.isFinite(t)?Math.max(0,t):0)/i.TICK_DURATION_MS),a=!1;s({index:t,ammo:e})),activeIndex:this.weaponsHud.activeIndex},n=a&&a.inventoryHudGen===this._inventoryHudGen?a.inventoryHud:{slots:Array.from(this.inventoryHud.slots.entries()).map(([t,e])=>({slot:t,count:e})),activeSlot:this.inventoryHud.activeSlot},l=a&&a.backpackPackIndex===this.backpackHud.packIndex&&a.backpackActive===this.backpackHud.active&&a.backpackText===this.backpackHud.text?a.backpackHud:this.backpackHud.packIndex>=0?{...this.backpackHud}:null;if(a&&a.teamScoresGen===this._teamScoresGen&&a.rosterGen===this._rosterGen)t=a.teamScores;else{t=this.teamScores.map(t=>({...t}));let e=new Map;for(let{teamId:t}of this.playerRoster.values())t>0&&e.set(t,(e.get(t)??0)+1);for(let s of t)s.playerCount=e.get(s.teamId)??0}return this._snap={teamScoresGen:this._teamScoresGen,rosterGen:this._rosterGen,teamScores:t,weaponsHudGen:this._weaponsHudGen,weaponsHud:r,inventoryHudGen:this._inventoryHudGen,inventoryHud:n,backpackPackIndex:this.backpackHud.packIndex,backpackActive:this.backpackHud.active,backpackText:this.backpackHud.text,backpackHud:l},{timeSec:s,exhausted:this.exhausted,camera:this.camera,entities:e,controlPlayerGhostId:this.controlPlayerGhostId,playerSensorGroup:this.playerSensorGroup,status:this.lastStatus,chatMessages:i,audioEvents:o,weaponsHud:r,backpackHud:l,inventoryHud:n,teamScores:t}}isPacketData(t){return!!t&&"object"==typeof t&&"gameState"in t&&"events"in t&&"ghosts"in t}isMoveData(t){return!!t&&"object"==typeof t&&"yaw"in t}isInfoData(t){return!!t&&"object"==typeof t&&"value1"in t&&"number"==typeof t.value1&&"value2"in t&&"number"==typeof t.value2}}async function l(t){let e=new s.DemoParser(new Uint8Array(t)),{header:a,initialBlock:i}=await e.load(),r=function(t){let e=null,s=null,a=null,i=null,r=null,n=null,l=null;for(let c=0;c=3&&h[1]?.endsWith("Game")&&(a=h[1]),"readplayerinfo"!==t[c])continue;let p=t[c+1];if(p){if(p.startsWith("1 ")){let t=p.split(" ");t[2]&&(n=(0,o.stripTaggedStringMarkup)(t[2]).trim());continue}if(p.startsWith("2 ")){let t=p.split(" ");t[1]&&(i=t[1]),t[3]&&(l=t[3]),t[4]&&(e=t[4]);continue}if(p.startsWith("3 ")){let t=p.split(" ");t[1]&&(r=t[1]),t[2]&&(s=t[2])}}}return{missionDisplayName:e,missionType:s,gameClassName:a,serverDisplayName:i,mod:r,recorderName:n,recordingDate:l}}(i.demoValues),l=new n(e);return l.missionDisplayName=r.missionDisplayName,l.missionTypeDisplayName=r.missionType,l.gameClassName=r.gameClassName,l.serverDisplayName=r.serverDisplayName,l.connectedPlayerName=r.recorderName,{source:"demo",duration:a.demoLengthMs/1e3,missionName:i.missionName??null,gameType:r.missionType,serverDisplayName:r.serverDisplayName,recorderName:r.recorderName,recordingDate:r.recordingDate,streamingPlayback:l}}t.s(["createDemoStreamingRecording",()=>l])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/f6808786c34b74b0.js b/docs/_next/static/chunks/628df86be2b8074c.js similarity index 93% rename from docs/_next/static/chunks/f6808786c34b74b0.js rename to docs/_next/static/chunks/628df86be2b8074c.js index 0f2938c5..13e96b40 100644 --- a/docs/_next/static/chunks/f6808786c34b74b0.js +++ b/docs/_next/static/chunks/628df86be2b8074c.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58647,79473,43595,e=>{"use strict";e.i(932);var t=e.i(8155);let r=e=>(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let s=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,l=e(n.getState());s=r=>{let n=e(r);if(!i(l,n)){let e=l;t(l=n,e)}},(null==r?void 0:r.fireImmediately)&&t(l,l)}return i(s)},e(t,r,n)};e.s(["subscribeWithSelector",()=>r],79473);var n=e.i(66748);function i(e){let t=new Map;for(let r of e.state.datablocks.values()){if("tsshapeconstructor"!==r._class)continue;let e=r.baseshape;if("string"!=typeof e)continue;let n=e.toLowerCase(),i=n.replace(/\.dts$/i,"")+"_",s=new Map;for(let e=0;e<=127;e++){let t=r[`sequence${e}`];if("string"!=typeof t)continue;let n=t.indexOf(" ");if(-1===n)continue;let l=t.slice(0,n).toLowerCase(),a=t.slice(n+1).trim().toLowerCase();if(!a||!l.startsWith(i)||!l.endsWith(".dsq"))continue;let o=l.slice(i.length,-4);o&&s.set(a,o)}s.size>0&&t.set(n,s)}return t}function s(e,t,r){let n=new Map;for(let r of e){let e=t.clipAction(r);n.set(r.name.toLowerCase(),e)}if(r)for(let[e,t]of r){let r=n.get(t);r&&!n.has(e)&&n.set(e,r)}return n}function l(e){return e.toLowerCase()}function a(e){let t=l(e.trim());return t.startsWith("$")?t.slice(1):t}e.s(["buildSequenceAliasMap",()=>i,"getAliasedActions",()=>s],43595);let o={runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},playback:{recording:null,status:"stopped",timeMs:0,rate:1,durationMs:0,streamSnapshot:null}},u=(0,t.createStore)()(r(e=>({...o,setRuntime(t){let r=function(e){let t={},r={},n={},i={};for(let r of e.state.objectsById.values())t[r._id]=0,r._name&&(n[l(r._name)]=r._id,r._isDatablock&&(i[l(r._name)]=r._id));for(let t of e.state.globals.keys())r[a(t)]=0;return{objectVersionById:t,globalVersionByName:r,objectIdsByName:n,datablockIdsByName:i}}(t),n=i(t);e(e=>({...e,runtime:{runtime:t,sequenceAliases:n,objectVersionById:r.objectVersionById,globalVersionByName:r.globalVersionByName,objectIdsByName:r.objectIdsByName,datablockIdsByName:r.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,r){0!==t.length&&e(e=>{let n={...e.runtime.objectVersionById},i={...e.runtime.globalVersionByName},s={...e.runtime.objectIdsByName},o={...e.runtime.datablockIdsByName},u=e=>{null!=e&&(n[e]=(n[e]??0)+1)};for(let e of t){if("object.created"===e.type){let t=e.object;if(u(e.objectId),t._name){let r=l(t._name);s[r]=e.objectId,t._isDatablock&&(o[r]=e.objectId)}u(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete n[e.objectId],t?._name){let e=l(t._name);delete s[e],t._isDatablock&&delete o[e]}u(t?._parent?._id);continue}if("field.changed"===e.type){u(e.objectId);continue}if("global.changed"===e.type){let t=a(e.name);i[t]=(i[t]??0)+1;continue}}let c=r?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);return{...e,runtime:{...e.runtime,objectVersionById:n,globalVersionByName:i,objectIdsByName:s,datablockIdsByName:o,lastRuntimeTick:c}}})},setRecording(t){let r=Math.max(0,(t?.duration??0)*1e3);e(e=>({...e,playback:{recording:t,status:t?"stopped":e.playback.status,timeMs:t?0:e.playback.timeMs,rate:t?1:e.playback.rate,durationMs:r,streamSnapshot:t?null:e.playback.streamSnapshot}}))},setPlaybackTime(t){e(e=>{var r,n,i;let s=(r=t,n=0,i=e.playback.durationMs,r<0?0:r>i?i:r);return{...e,playback:{...e.playback,timeMs:s}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var r,n,i;let s=Number.isFinite(t)?(n=.01,i=16,(r=t)<.01?.01:r>16?16:r):1;e(e=>({...e,playback:{...e.playback,rate:s}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))}}))),c=0;function f(){return c}function d(e,t){c+=e*t*1e3}function b(){return u}function g(e,t){return(0,n.useStoreWithEqualityFn)(u,e,t)}u.subscribe(e=>e.playback.status,e=>{"stopped"===e&&(c=0)}),e.s(["advanceEffectClock",()=>d,"effectNow",()=>f,"engineStore",0,u,"useEngineSelector",()=>g,"useEngineStoreApi",()=>b],58647)},12979,e=>{"use strict";var t=e.i(25645),r=e.i(91996),n=e.i(62395),i=e.i(71726);let s=(0,t.createLogger)("loaders"),l="/t2-mapper",a=`${l}/base/`,o=`${l}/magenta.png`;function u(e,t){let n;try{n=(0,r.getActualResourceKey)(e)}catch(r){if(t)return s.warn('Resource "%s" not found — rendering fallback',e),t;throw r}let[i,l]=(0,r.getSourceAndPath)(n);return i?`${a}@vl2/${i}/${l}`:`${a}${l}`}function c(e){return u(`interiors/${e}`).replace(/\.dif$/i,".glb")}function f(e){return u(`shapes/${e}`).replace(/\.dts$/i,".glb")}function d(e){return e=e.replace(/^terrain\./,""),u((0,r.getStandardTextureResourceKey)(`textures/terrain/${e}`),o)}function b(e,t){let n=(0,i.normalizePath)(t).split("/"),s=n.length>1?n.slice(0,-1).join("/")+"/":"",l=`${s}${e}`;return u((0,r.getStandardTextureResourceKey)(l),o)}function g(e){return u((0,r.getStandardTextureResourceKey)(`textures/${e}`),o)}function p(e){return u(`audio/${e}`).replace(/\.wav$/i,".m4a")}async function h(e){let t=u(`textures/${e}`),r=await fetch(t);return(await r.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function m(e){let t,i=(0,r.getMissionInfo)(e),s=await fetch(u(i.resourcePath)),l=await s.arrayBuffer();try{t=new TextDecoder("utf-8",{fatal:!0}).decode(l)}catch{t=new TextDecoder("windows-1252").decode(l)}return t=t.replaceAll("�","'"),(0,n.parseMissionScript)(t)}async function y(e){let t=u(`terrains/${e}`);s.debug("Fetching terrain: %s",t);let r=await fetch(t);if(!r.ok)throw Error(`[loadTerrain] Failed to fetch ${t}: ${r.status} ${r.statusText}`);let n=await r.arrayBuffer();return s.debug("Loaded terrain %s: %d bytes",e,n.byteLength),function(e){let t=new DataView(e),r=0,n=t.getUint8(r++),i=new Uint16Array(65536),s=[],l=e=>{let n="";for(let i=0;i0&&s.push(i)}let a=[];for(let e of s){let e=new Uint8Array(65536);for(let n=0;n<65536;n++){let i=t.getUint8(r++);e[n]=i}a.push(e)}return{version:n,textureNames:s,heightMap:i,alphaMaps:a}}(n)}async function v(e){let t=u(e),r=await fetch(t);return(await r.text()).split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>p,"getUrlForPath",()=>u,"iflTextureToUrl",()=>b,"interiorToUrl",()=>c,"loadDetailMapList",()=>h,"loadImageFrameList",()=>v,"loadMission",()=>m,"loadTerrain",()=>y,"shapeToUrl",()=>f,"terrainTextureToUrl",()=>d,"textureToUrl",()=>g],12979)},79474,(e,t,r)=>{"use strict";var n=e.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;r.c=function(e){return n.H.useMemoCache(e)}},932,(e,t,r)=>{"use strict";t.exports=e.r(79474)},55838,(e,t,r)=>{"use strict";var n=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=n.useState,l=n.useEffect,a=n.useLayoutEffect,o=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var c="u"{"use strict";t.exports=e.r(55838)},52822,(e,t,r)=>{"use strict";var n=e.r(71645),i=e.r(2239),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=i.useSyncExternalStore,a=n.useRef,o=n.useEffect,u=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var f=a(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;var b=l(e,(f=u(function(){function e(e){if(!o){if(o=!0,l=e,e=n(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return a=t}return a=e}if(t=a,s(l,e))return t;var r=n(e);return void 0!==i&&i(t,r)?(l=e,t):(l=e,a=r)}var l,a,o=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,n,i]))[0],f[1]);return o(function(){d.hasValue=!0,d.value=b},[b]),c(b),b}},30224,(e,t,r)=>{"use strict";t.exports=e.r(52822)},66748,8155,e=>{"use strict";var t=e.i(71645),r=e.i(30224);let n=e=>{let t,r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>l,subscribe:e=>(r.add(e),()=>r.delete(e))},l=t=e(n,i,s);return s},i=e=>e?n(e):n;e.s(["createStore",()=>i],8155);let{useSyncExternalStoreWithSelector:s}=r.default,l=e=>e;function a(e,r=l,n){let i=s(e.subscribe,e.getState,e.getInitialState,r,n);return t.default.useDebugValue(i),i}let o=(e,t)=>{let r=i(e),n=(e,n=t)=>a(r,e,n);return Object.assign(n,r),n},u=(e,t)=>e?o(e,t):o;e.s(["createWithEqualityFn",()=>u,"useStoreWithEqualityFn",()=>a],66748)},91996,71726,e=>{"use strict";var t=e.i(87447);function r(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>r],71726);let n=t.default;function i(e){return r(e).toLowerCase()}function s(){return n.resources}function l(e){let[t,...r]=n.resources[e],[i,s]=r[r.length-1];return[i,s??t]}function a(e){let t=i(e);if(n.resources[t])return t;let r=t.replace(/\d+(\.(png))$/i,"$1");if(n.resources[r])return r;throw Error(`Resource not found in manifest: ${e}`)}function o(){return Object.keys(n.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(e){let t=i(e);for(let e of u){let r=`${t}${e}`;if(n.resources[r])return r}return t}function f(e){let t=n.missions[e];if(!t)throw Error(`Mission not found: ${e}`);return t}function d(e){return e in n.missions}function b(){return Object.keys(n.missions)}e.s(["getActualResourceKey",()=>a,"getMissionInfo",()=>f,"getMissionList",()=>b,"getResourceKey",()=>i,"getResourceList",()=>o,"getResourceMap",()=>s,"getSourceAndPath",()=>l,"getStandardTextureResourceKey",()=>c,"hasMission",()=>d],91996)},71187,(e,t,r)=>{"use strict";function n(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}t.exports=function(e,t,r){var i=r&&r.stringify||n;if("object"==typeof e&&null!==e){var s=t.length+1;if(1===s)return e;var l=Array(s);l[0]=i(e);for(var a=1;a-1?f:0,e.charCodeAt(b+1)){case 100:case 102:if(c>=o||null==t[c])break;f=o||null==t[c])break;f=o||void 0===t[c])break;f",f=b+2,b++;break}u+=i(t[c]),f=b+2,b++;break;case 115:if(c>=o)break;f{"use strict";let n=e.r(71187);t.exports=c;let i=function(){function e(e){return void 0!==e&&e}try{if("u">typeof globalThis)return globalThis;return Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{};function s(e,t){return"silent"===e?1/0:t.levels.values[e]}let l=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),o={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function u(e,t){let r={logger:t,parent:e[a]};t[a]=r}function c(e){var t,r,n;let a,g,p;(e=e||{}).browser=e.browser||{};let h=e.browser.transmit;if(h&&"function"!=typeof h.send)throw Error("pino: transmit option must have a send function");let w=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);let j=e.serializers||{},S=(t=e.browser.serialize,Array.isArray(t)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(j)),O=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(O=!1);let _=Object.keys(e.customLevels||{}),k=["error","fatal","warn","info","debug","trace"].concat(_);"function"==typeof w&&k.forEach(function(e){w[e]=w}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");let E=e.level||"info",T=Object.create(w);T.log||(T.log=m),a={},k.forEach(e=>{a[e]=w[e]?w[e]:i[e]||i[o[e]||"log"]||m}),T[l]=a,u({},T),Object.defineProperty(T,"levelVal",{get:function(){return s(this.level,this)}}),Object.defineProperty(T,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,f(this,L,T,"error"),f(this,L,T,"fatal"),f(this,L,T,"warn"),f(this,L,T,"info"),f(this,L,T,"debug"),f(this,L,T,"trace"),_.forEach(e=>{f(this,L,T,e)})}});let L={transmit:h,serialize:S,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:k,timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?y:v,messageKey:e.messageKey||"msg",onChild:e.onChild||m};function R(t,r,n){if(!r)throw Error("missing bindings for child Pino");n=n||{},S&&r.serializers&&(n.serializers=r.serializers);let i=n.serializers;if(S&&i){var s=Object.assign({},j,i),l=!0===e.browser.serialize?Object.keys(s):S;delete r.serializers,d([r],l,s,this._stdErrSerialize)}function a(e){this._childLevel=(0|e._childLevel)+1,this.bindings=r,s&&(this.serializers=s,this._serialize=l),h&&(this._logEvent=b([].concat(e._logEvent.bindings,r)))}a.prototype=this;let o=new a(this);return u(this,o),o.child=function(...e){return R.call(this,t,...e)},o.level=n.level||this.level,t.onChild(o),o}return g=e.customLevels||{},T.levels={values:Object.assign({},c.levels.values,g),labels:Object.assign({},c.levels.labels,(p={},Object.keys(n=g).forEach(function(e){p[n[e]]=e}),p))},T.level=E,T.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},T.setMaxListeners=T.getMaxListeners=T.emit=T.addListener=T.on=T.prependListener=T.once=T.prependOnceListener=T.removeListener=T.removeAllListeners=T.listeners=T.listenerCount=T.eventNames=T.write=T.flush=m,T.serializers=j,T._serialize=S,T._stdErrSerialize=O,T.child=function(...e){return R.call(this,L,...e)},h&&(T._logEvent=b()),T}function f(e,t,r,o){var u,c,f,g,p,h,y;if(Object.defineProperty(e,o,{value:s(e.level,r)>s(o,r)?m:r[l][o],writable:!0,enumerable:!0,configurable:!0}),e[o]===m){if(!t.transmit)return;let n=s(t.transmit.level||e.level,r);if(s(o,r)e}=s.formatters||{},o=r.slice(),u=o[0],c={},f=(0|e._childLevel)+1;if(f<1&&(f=1),i&&(c.time=i),l?Object.assign(c,l(t,e.levels.values[t])):c.level=e.levels.values[t],s.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;f--&&"object"==typeof o[0];)Object.assign(c,o.shift());return[a(c),...o]}if(null!==u&&"object"==typeof u){for(;f--&&"object"==typeof o[0];)Object.assign(c,o.shift());u=o.length?n(o.shift(),o):void 0}else"string"==typeof u&&(u=n(o.shift(),o));return void 0!==u&&(c[s.messageKey]=u),[a(c)]}(this,g,t,e,c);if(c.reportCaller&&i&&i.length>0&&i[0]&&"object"==typeof i[0])try{let e=w();e&&(i[0].caller=e)}catch(e){}p.call(r,...i)}else{if(c.reportCaller)try{let e=w();e&&t.push(e)}catch(e){}p.apply(r,t)}if(c.transmit){let r=c.transmit.level||u._level,n=s(r,f),i=s(g,f);if(i-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function b(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function g(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)void 0===t[r]&&(t[r]=e[r]);return t}function p(){return{}}function h(e){return e}function m(){}function y(){return!1}function v(){return Date.now()}function w(){let e=Error().stack;if(!e)return null;let t=e.split("\n");for(let e=1;e{"use strict";var t=e.i(47167),r=e.i(2232);let n=new Set(["trace","debug","info","warn","error","fatal","silent"]),{globalLevel:i,modules:s}=function(){let e=t.default.env.NEXT_PUBLIC_LOG?.trim();if(!e)return{globalLevel:"info",modules:new Map};let r=null,i=new Map;for(let t of e.split(",")){let e=t.trim();if(e)if(e.includes(":")){let[t,r]=e.split(":");t&&r&&i.set(t,r)}else n.has(e)&&(r=e)}return{globalLevel:r??=i.size>0?"silent":"info",modules:i}}(),l={10:"debug",20:"debug",30:"log",40:"warn",50:"error",60:"error"},a=(0,r.default)({name:"t2-mapper",level:"trace",browser:{write:function(e){let t=l[e.level]??"log";console[t](e.module?`[${e.module}]`:"[t2-mapper]",e.msg)}}});function o(e){let t=s.get(e)??i;return a.child({module:e},{level:t})}e.s(["createLogger",()=>o])}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58647,79473,43595,e=>{"use strict";e.i(932);var t=e.i(8155);let r=e=>(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let s=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,l=e(n.getState());s=r=>{let n=e(r);if(!i(l,n)){let e=l;t(l=n,e)}},(null==r?void 0:r.fireImmediately)&&t(l,l)}return i(s)},e(t,r,n)};e.s(["subscribeWithSelector",()=>r],79473);var n=e.i(66748);function i(e){let t=new Map;for(let r of e.state.datablocks.values()){if("tsshapeconstructor"!==r._class)continue;let e=r.baseshape;if("string"!=typeof e)continue;let n=e.toLowerCase(),i=n.replace(/\.dts$/i,"")+"_",s=new Map;for(let e=0;e<=127;e++){let t=r[`sequence${e}`];if("string"!=typeof t)continue;let n=t.indexOf(" ");if(-1===n)continue;let l=t.slice(0,n).toLowerCase(),a=t.slice(n+1).trim().toLowerCase();if(!a||!l.startsWith(i)||!l.endsWith(".dsq"))continue;let o=l.slice(i.length,-4);o&&s.set(a,o)}s.size>0&&t.set(n,s)}return t}function s(e,t,r){let n=new Map;for(let r of e){let e=t.clipAction(r);n.set(r.name.toLowerCase(),e)}if(r)for(let[e,t]of r){let r=n.get(t);r&&!n.has(e)&&n.set(e,r)}return n}function l(e){return e.toLowerCase()}function a(e){let t=l(e.trim());return t.startsWith("$")?t.slice(1):t}e.s(["buildSequenceAliasMap",()=>i,"getAliasedActions",()=>s],43595);let o={runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},playback:{recording:null,status:"stopped",timeMs:0,rate:1,durationMs:0,streamSnapshot:null}},u=(0,t.createStore)()(r(e=>({...o,setRuntime(t){let r=function(e){let t={},r={},n={},i={};for(let r of e.state.objectsById.values())t[r._id]=0,r._name&&(n[l(r._name)]=r._id,r._isDatablock&&(i[l(r._name)]=r._id));for(let t of e.state.globals.keys())r[a(t)]=0;return{objectVersionById:t,globalVersionByName:r,objectIdsByName:n,datablockIdsByName:i}}(t),n=i(t);e(e=>({...e,runtime:{runtime:t,sequenceAliases:n,objectVersionById:r.objectVersionById,globalVersionByName:r.globalVersionByName,objectIdsByName:r.objectIdsByName,datablockIdsByName:r.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,sequenceAliases:new Map,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,r){0!==t.length&&e(e=>{let n={...e.runtime.objectVersionById},i={...e.runtime.globalVersionByName},s={...e.runtime.objectIdsByName},o={...e.runtime.datablockIdsByName},u=e=>{null!=e&&(n[e]=(n[e]??0)+1)};for(let e of t){if("object.created"===e.type){let t=e.object;if(u(e.objectId),t._name){let r=l(t._name);s[r]=e.objectId,t._isDatablock&&(o[r]=e.objectId)}u(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete n[e.objectId],t?._name){let e=l(t._name);delete s[e],t._isDatablock&&delete o[e]}u(t?._parent?._id);continue}if("field.changed"===e.type){u(e.objectId);continue}if("global.changed"===e.type){let t=a(e.name);i[t]=(i[t]??0)+1;continue}}let c=r?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);return{...e,runtime:{...e.runtime,objectVersionById:n,globalVersionByName:i,objectIdsByName:s,datablockIdsByName:o,lastRuntimeTick:c}}})},setRecording(t){let r=Math.max(0,(t?.duration??0)*1e3);e(e=>({...e,playback:{recording:t,status:t?"stopped":e.playback.status,timeMs:t?0:e.playback.timeMs,rate:t?1:e.playback.rate,durationMs:r,streamSnapshot:t?null:e.playback.streamSnapshot}}))},setPlaybackTime(t){e(e=>{var r,n,i;let s=(r=t,n=0,i=e.playback.durationMs,r<0?0:r>i?i:r);return{...e,playback:{...e.playback,timeMs:s}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var r,n,i;let s=Number.isFinite(t)?(n=.01,i=16,(r=t)<.01?.01:r>16?16:r):1;e(e=>({...e,playback:{...e.playback,rate:s}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))}}))),c=0;function f(){return c}function d(e,t){c+=e*t*1e3}function b(){return u}function g(e,t){return(0,n.useStoreWithEqualityFn)(u,e,t)}u.subscribe(e=>e.playback.status,e=>{"stopped"===e&&(c=0)}),e.s(["advanceEffectClock",()=>d,"effectNow",()=>f,"engineStore",0,u,"useEngineSelector",()=>g,"useEngineStoreApi",()=>b],58647)},12979,e=>{"use strict";var t=e.i(25645),r=e.i(91996),n=e.i(62395),i=e.i(71726);let s=(0,t.createLogger)("loaders"),l="/t2-mapper",a=`${l}/base/`,o=`${l}/magenta.png`;function u(e,t){let n;try{n=(0,r.getActualResourceKey)(e)}catch(r){if(t)return s.warn('Resource "%s" not found — rendering fallback',e),t;throw r}let[i,l]=(0,r.getSourceAndPath)(n);return i?`${a}@vl2/${i}/${l}`:`${a}${l}`}function c(e){return u(`interiors/${e}`).replace(/\.dif$/i,".glb")}function f(e){return u(`shapes/${e}`).replace(/\.dts$/i,".glb")}function d(e){return e=e.replace(/^terrain\./,""),u((0,r.getStandardTextureResourceKey)(`textures/terrain/${e}`),o)}function b(e,t){let n=(0,i.normalizePath)(t).split("/"),s=n.length>1?n.slice(0,-1).join("/")+"/":"",l=`${s}${e}`;return u((0,r.getStandardTextureResourceKey)(l),o)}function g(e){return u((0,r.getStandardTextureResourceKey)(`textures/${e}`),o)}function p(e){return u(`audio/${e}`).replace(/\.wav$/i,".m4a")}async function h(e){let t=u(`textures/${e}`),r=await fetch(t);return(await r.text()).split(/(?:\r\n|\r|\n)/).map(e=>{if(!(e=e.trim()).startsWith(";"))return e}).filter(Boolean)}async function m(e){let t,i=(0,r.getMissionInfo)(e),s=await fetch(u(i.resourcePath)),l=await s.arrayBuffer();try{t=new TextDecoder("utf-8",{fatal:!0}).decode(l)}catch{t=new TextDecoder("windows-1252").decode(l)}return t=t.replaceAll("�","'"),(0,n.parseMissionScript)(t)}async function y(e){let t=u(`terrains/${e}`);s.debug("Fetching terrain: %s",t);let r=await fetch(t);if(!r.ok)throw Error(`[loadTerrain] Failed to fetch ${t}: ${r.status} ${r.statusText}`);let n=await r.arrayBuffer();return s.debug("Loaded terrain %s: %d bytes",e,n.byteLength),function(e){let t=new DataView(e),r=0,n=t.getUint8(r++),i=new Uint16Array(65536),s=[],l=e=>{let n="";for(let i=0;i0&&s.push(i)}let a=[];for(let e of s){let e=new Uint8Array(65536);for(let n=0;n<65536;n++){let i=t.getUint8(r++);e[n]=i}a.push(e)}return{version:n,textureNames:s,heightMap:i,alphaMaps:a}}(n)}async function v(e){let t=u(e),r=await fetch(t);return(await r.text()).split(/(?:\r\n|\r|\n)/g).map(e=>e.trim()).filter(Boolean).filter(e=>!e.startsWith(";")).map(e=>{let t=e.match(/^(.+)\s(\d+)$/);if(!t)return{name:e,frameCount:1};{let e=parseInt(t[2],10);return{name:t[1],frameCount:e}}})}e.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>p,"getUrlForPath",()=>u,"iflTextureToUrl",()=>b,"interiorToUrl",()=>c,"loadDetailMapList",()=>h,"loadImageFrameList",()=>v,"loadMission",()=>m,"loadTerrain",()=>y,"shapeToUrl",()=>f,"terrainTextureToUrl",()=>d,"textureToUrl",()=>g],12979)},79474,(e,t,r)=>{"use strict";var n=e.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;r.c=function(e){return n.H.useMemoCache(e)}},932,(e,t,r)=>{"use strict";t.exports=e.r(79474)},55838,(e,t,r)=>{"use strict";var n=e.r(71645),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=n.useState,l=n.useEffect,a=n.useLayoutEffect,o=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var c="u"{"use strict";t.exports=e.r(55838)},52822,(e,t,r)=>{"use strict";var n=e.r(71645),i=e.r(2239),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=i.useSyncExternalStore,a=n.useRef,o=n.useEffect,u=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var f=a(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;var b=l(e,(f=u(function(){function e(e){if(!o){if(o=!0,l=e,e=n(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return a=t}return a=e}if(t=a,s(l,e))return t;var r=n(e);return void 0!==i&&i(t,r)?(l=e,t):(l=e,a=r)}var l,a,o=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,n,i]))[0],f[1]);return o(function(){d.hasValue=!0,d.value=b},[b]),c(b),b}},30224,(e,t,r)=>{"use strict";t.exports=e.r(52822)},66748,8155,e=>{"use strict";var t=e.i(71645),r=e.i(30224);let n=e=>{let t,r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>l,subscribe:e=>(r.add(e),()=>r.delete(e))},l=t=e(n,i,s);return s},i=e=>e?n(e):n;e.s(["createStore",()=>i],8155);let{useSyncExternalStoreWithSelector:s}=r.default,l=e=>e;function a(e,r=l,n){let i=s(e.subscribe,e.getState,e.getInitialState,r,n);return t.default.useDebugValue(i),i}let o=(e,t)=>{let r=i(e),n=(e,n=t)=>a(r,e,n);return Object.assign(n,r),n},u=(e,t)=>e?o(e,t):o;e.s(["createWithEqualityFn",()=>u,"useStoreWithEqualityFn",()=>a],66748)},91996,71726,e=>{"use strict";var t=e.i(87447);function r(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}e.s(["normalizePath",()=>r],71726);let n=t.default;function i(e){return r(e).toLowerCase()}function s(){return n.resources}function l(e){let[t,...r]=n.resources[e],[i,s]=r[r.length-1];return[i,s??t]}function a(e){let t=i(e);if(n.resources[t])return t;let r=t.replace(/\d+(\.(png))$/i,"$1");if(n.resources[r])return r;throw Error(`Resource not found in manifest: ${e}`)}function o(){return Object.keys(n.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(e){let t=i(e);for(let e of u){let r=`${t}${e}`;if(n.resources[r])return r}return t}function f(e){let t=n.missions[e];if(!t)throw Error(`Mission not found: ${e}`);return t}function d(e){return e in n.missions}function b(){return Object.keys(n.missions)}e.s(["getActualResourceKey",()=>a,"getMissionInfo",()=>f,"getMissionList",()=>b,"getResourceKey",()=>i,"getResourceList",()=>o,"getResourceMap",()=>s,"getSourceAndPath",()=>l,"getStandardTextureResourceKey",()=>c,"hasMission",()=>d],91996)},71187,(e,t,r)=>{"use strict";function n(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}t.exports=function(e,t,r){var i=r&&r.stringify||n;if("object"==typeof e&&null!==e){var s=t.length+1;if(1===s)return e;var l=Array(s);l[0]=i(e);for(var a=1;a-1?f:0,e.charCodeAt(b+1)){case 100:case 102:if(c>=o||null==t[c])break;f=o||null==t[c])break;f=o||void 0===t[c])break;f",f=b+2,b++;break}u+=i(t[c]),f=b+2,b++;break;case 115:if(c>=o)break;f{"use strict";let n=e.r(71187);t.exports=c;let i=function(){function e(e){return void 0!==e&&e}try{if("u">typeof globalThis)return globalThis;return Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{};function s(e,t){return"silent"===e?1/0:t.levels.values[e]}let l=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),o={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function u(e,t){let r={logger:t,parent:e[a]};t[a]=r}function c(e){var t,r,n;let a,g,p;(e=e||{}).browser=e.browser||{};let h=e.browser.transmit;if(h&&"function"!=typeof h.send)throw Error("pino: transmit option must have a send function");let w=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);let j=e.serializers||{},S=(t=e.browser.serialize,Array.isArray(t)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(j)),O=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(O=!1);let _=Object.keys(e.customLevels||{}),k=["error","fatal","warn","info","debug","trace"].concat(_);"function"==typeof w&&k.forEach(function(e){w[e]=w}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");let E=e.level||"info",T=Object.create(w);T.log||(T.log=m),a={},k.forEach(e=>{a[e]=w[e]?w[e]:i[e]||i[o[e]||"log"]||m}),T[l]=a,u({},T),Object.defineProperty(T,"levelVal",{get:function(){return s(this.level,this)}}),Object.defineProperty(T,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,f(this,R,T,"error"),f(this,R,T,"fatal"),f(this,R,T,"warn"),f(this,R,T,"info"),f(this,R,T,"debug"),f(this,R,T,"trace"),_.forEach(e=>{f(this,R,T,e)})}});let R={transmit:h,serialize:S,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:k,timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?y:v,messageKey:e.messageKey||"msg",onChild:e.onChild||m};function L(t,r,n){if(!r)throw Error("missing bindings for child Pino");n=n||{},S&&r.serializers&&(n.serializers=r.serializers);let i=n.serializers;if(S&&i){var s=Object.assign({},j,i),l=!0===e.browser.serialize?Object.keys(s):S;delete r.serializers,d([r],l,s,this._stdErrSerialize)}function a(e){this._childLevel=(0|e._childLevel)+1,this.bindings=r,s&&(this.serializers=s,this._serialize=l),h&&(this._logEvent=b([].concat(e._logEvent.bindings,r)))}a.prototype=this;let o=new a(this);return u(this,o),o.child=function(...e){return L.call(this,t,...e)},o.level=n.level||this.level,t.onChild(o),o}return g=e.customLevels||{},T.levels={values:Object.assign({},c.levels.values,g),labels:Object.assign({},c.levels.labels,(p={},Object.keys(n=g).forEach(function(e){p[n[e]]=e}),p))},T.level=E,T.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},T.setMaxListeners=T.getMaxListeners=T.emit=T.addListener=T.on=T.prependListener=T.once=T.prependOnceListener=T.removeListener=T.removeAllListeners=T.listeners=T.listenerCount=T.eventNames=T.write=T.flush=m,T.serializers=j,T._serialize=S,T._stdErrSerialize=O,T.child=function(...e){return L.call(this,R,...e)},h&&(T._logEvent=b()),T}function f(e,t,r,o){var u,c,f,g,p,h,y;if(Object.defineProperty(e,o,{value:s(e.level,r)>s(o,r)?m:r[l][o],writable:!0,enumerable:!0,configurable:!0}),e[o]===m){if(!t.transmit)return;let n=s(t.transmit.level||e.level,r);if(s(o,r)e}=s.formatters||{},o=r.slice(),u=o[0],c={},f=(0|e._childLevel)+1;if(f<1&&(f=1),i&&(c.time=i),l?Object.assign(c,l(t,e.levels.values[t])):c.level=e.levels.values[t],s.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;f--&&"object"==typeof o[0];)Object.assign(c,o.shift());return[a(c),...o]}if(null!==u&&"object"==typeof u){for(;f--&&"object"==typeof o[0];)Object.assign(c,o.shift());u=o.length?n(o.shift(),o):void 0}else"string"==typeof u&&(u=n(o.shift(),o));return void 0!==u&&(c[s.messageKey]=u),[a(c)]}(this,g,t,e,c);if(c.reportCaller&&i&&i.length>0&&i[0]&&"object"==typeof i[0])try{let e=w();e&&(i[0].caller=e)}catch(e){}p.call(r,...i)}else{if(c.reportCaller)try{let e=w();e&&t.push(e)}catch(e){}p.apply(r,t)}if(c.transmit){let r=c.transmit.level||u._level,n=s(r,f),i=s(g,f);if(i-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function b(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function g(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)void 0===t[r]&&(t[r]=e[r]);return t}function p(){return{}}function h(e){return e}function m(){}function y(){return!1}function v(){return Date.now()}function w(){let e=Error().stack;if(!e)return null;let t=e.split("\n");for(let e=1;e{"use strict";var t=e.i(2232);let r=new Set(["trace","debug","info","warn","error","fatal","silent"]),{globalLevel:n,modules:i}=function(){let e="".trim();if(!e)return{globalLevel:"info",modules:new Map};let t=null,n=new Map;for(let i of e.split(",")){let e=i.trim();if(e)if(e.includes(":")){let[t,r]=e.split(":");t&&r&&n.set(t,r)}else r.has(e)&&(t=e)}return{globalLevel:t??=n.size>0?"silent":"info",modules:n}}(),s={10:"debug",20:"debug",30:"log",40:"warn",50:"error",60:"error"},l=(0,t.default)({name:"t2-mapper",level:"trace",browser:{write:function(e){let t=s[e.level]??"log";console[t](e.module?`[${e.module}]`:"[t2-mapper]",e.msg)}}});function a(e){let t=i.get(e)??n;return l.child({module:e},{level:t})}e.s(["createLogger",()=>a])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/990cfb71eaf1c762.js b/docs/_next/static/chunks/d22dc3fe32e979ff.js similarity index 99% rename from docs/_next/static/chunks/990cfb71eaf1c762.js rename to docs/_next/static/chunks/d22dc3fe32e979ff.js index 48c4332e..cbbc8b83 100644 --- a/docs/_next/static/chunks/990cfb71eaf1c762.js +++ b/docs/_next/static/chunks/d22dc3fe32e979ff.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,66027,e=>{"use strict";var t=e.i(69230),s=e.i(69637);function n(e,n){return(0,s.useBaseQuery)(e,t.QueryObserver,n)}e.s(["useQuery",()=>n])},9672,e=>{"use strict";function t(e,t){return e[t.toLowerCase()]}function s(e,s){let n=t(e,s);if(null==n)return;let i=parseFloat(n);return Number.isFinite(i)?i:void 0}function n(e,s){let n=t(e,s);if(null==n)return;let i=parseInt(n,10);return Number.isFinite(i)?i:void 0}function i(e,t={x:0,y:0,z:0}){if(!e)return t;let s=e.split(" ").map(Number);return{x:s[0]??t.x,y:s[1]??t.y,z:s[2]??t.z}}function r(e,t={r:0,g:0,b:0}){if(!e)return t;let s=e.split(" ").map(Number);return{r:s[0]??t.r,g:s[1]??t.g,b:s[2]??t.b}}function a(e,t={r:.5,g:.5,b:.5,a:1}){if(!e)return t;let s=e.split(" ").map(Number);return{r:s[0]??t.r,g:s[1]??t.g,b:s[2]??t.b,a:s[3]??t.a}}function o(e,t){let s=i(e),n=(t??"1 0 0 0").split(" ").map(Number),r=n[0]??1,a=n[1]??0,o=n[2]??0,l=Math.PI/180*(n[3]??0),c=Math.sqrt(r*r+a*a+o*o),u=0,d=0,m=1;c>1e-8&&(u=r/c,d=a/c,m=o/c);let h=Math.cos(l),p=Math.sin(l),g=1-h,y=Array(16).fill(0);return y[0]=g*u*u+h,y[1]=g*u*d+p*m,y[2]=g*u*m-p*d,y[4]=g*u*d-p*m,y[5]=g*d*d+h,y[6]=g*d*m+p*u,y[8]=g*u*m+p*d,y[9]=g*d*m-p*u,y[10]=g*m*m+h,y[12]=s.x,y[13]=s.y,y[14]=s.z,y[15]=1,{elements:y,position:s}}function l(e){return{className:"TerrainBlock",ghostIndex:e._id,terrFileName:t(e,"terrainFile")??"",detailTextureName:t(e,"detailTexture")??"",squareSize:n(e,"squareSize")??8,emptySquareRuns:function(e){if(!e)return;let t=e.split(/\s+/).map(Number).filter(Number.isFinite);return t.length>0?t:void 0}(t(e,"emptySquares"))}}function c(e){return{className:"InteriorInstance",ghostIndex:e._id,interiorFile:t(e,"interiorFile")??"",transform:o(t(e,"position"),t(e,"rotation")),scale:i(t(e,"scale"),{x:1,y:1,z:1}),showTerrainInside:"1"===t(e,"showTerrainInside"),skinBase:t(e,"skinBase")??"",alarmState:!1}}function u(e){let a=[];for(let s=1;s<=3;s++){let n=function(e){if(!e)return null;let t=e.split(/\s+/).map(Number),s=t[0]??0,n=t[1]??0,i=t[2]??0;return 0===s&&0===n&&0===i?null:{visibleDistance:s,minHeight:n,maxHeight:i,color:{r:.5,g:.5,b:.5}}}(t(e,`fogVolume${s}`));n&&a.push(n)}let o=[];for(let n=0;n<3;n++){let i=t(e,`cloudText${n+1}`)??"",r=s(e,`cloudHeightPer[${n}]`)??s(e,`cloudheightper${n}`)??[.35,.25,.2][n],a=s(e,`cloudSpeed${n+1}`)??[1e-4,2e-4,3e-4][n];o.push({texture:i,heightPercent:r,speed:a})}return{className:"Sky",ghostIndex:e._id,materialList:t(e,"materialList")??"",fogColor:r(t(e,"fogColor")),visibleDistance:s(e,"visibleDistance")??1e3,fogDistance:s(e,"fogDistance")??0,skySolidColor:r(t(e,"SkySolidColor")),useSkyTextures:(n(e,"useSkyTextures")??1)!==0,fogVolumes:a,cloudLayers:o,windVelocity:i(t(e,"windVelocity"))}}function d(e){return{className:"Sun",ghostIndex:e._id,direction:i(t(e,"direction"),{x:.57735,y:.57735,z:-.57735}),color:a(t(e,"color"),{r:.7,g:.7,b:.7,a:1}),ambient:a(t(e,"ambient"),{r:.5,g:.5,b:.5,a:1})}}function m(e){let n=t(e,"area"),i={x:-512,y:-512,w:1024,h:1024};if(n){let e=n.split(/\s+/).map(Number);i={x:e[0]??i.x,y:e[1]??i.y,w:e[2]??i.w,h:e[3]??i.h}}return{className:"MissionArea",ghostIndex:e._id,area:i,flightCeiling:s(e,"flightCeiling")??2e3,flightCeilingRange:s(e,"flightCeilingRange")??50}}function h(e){return{className:"WaterBlock",ghostIndex:e._id,transform:o(t(e,"position"),t(e,"rotation")),scale:i(t(e,"scale"),{x:1,y:1,z:1}),surfaceName:t(e,"surfaceTexture")??"",envMapName:t(e,"envMapTexture")??"",surfaceOpacity:s(e,"surfaceOpacity")??.75,waveMagnitude:s(e,"waveMagnitude")??1,envMapIntensity:s(e,"envMapIntensity")??1}}e.s(["interiorFromMis",()=>c,"missionAreaFromMis",()=>m,"skyFromMis",()=>u,"sunFromMis",()=>d,"terrainFromMis",()=>l,"waterBlockFromMis",()=>h])},70847,47566,63318,e=>{"use strict";let t=(0,e.i(25645).createLogger)("ghostToScene");function s(e,t={x:0,y:0,z:0}){return e&&"object"==typeof e&&"x"in e?e:t}function n(e,t={r:0,g:0,b:0}){return e&&"object"==typeof e&&"r"in e?e:t}function i(e,t={r:.5,g:.5,b:.5,a:1}){return e&&"object"==typeof e&&"r"in e?e:t}function r(e){if(e&&"object"==typeof e&&"elements"in e&&Array.isArray(e.elements))return e;if(e&&"object"==typeof e&&"position"in e&&"rotation"in e){let{position:t,rotation:s}=e,n=s.x*s.x,i=s.y*s.y,r=s.z*s.z,a=s.x*s.y,o=s.x*s.z,l=s.y*s.z,c=s.w*s.x,u=s.w*s.y,d=s.w*s.z;return{elements:[1-2*(i+r),2*(a+d),2*(o-u),0,2*(a-d),1-2*(n+r),2*(l+c),0,2*(o+u),2*(l-c),1-2*(n+i),0,t.x,t.y,t.z,1],position:{x:t.x,y:t.y,z:t.z}}}return{elements:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],position:{x:0,y:0,z:0}}}function a(e,a,o){let l;switch(e){case"TerrainBlock":return l={className:"TerrainBlock",ghostIndex:a,terrFileName:o.terrFileName??"",detailTextureName:o.detailTextureName??"",squareSize:o.squareSize??8,emptySquareRuns:o.emptySquareRuns},t.debug("TerrainBlock #%d: terrFileName=%s",a,l.terrFileName),l;case"InteriorInstance":return l={className:"InteriorInstance",ghostIndex:a,interiorFile:o.interiorFile??"",transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1}),showTerrainInside:o.showTerrainInside??!1,skinBase:o.skinBase??"",alarmState:o.alarmState??!1},t.debug("InteriorInstance #%d: interiorFile=%s",a,l.interiorFile),l;case"TSStatic":return{className:"TSStatic",ghostIndex:a,shapeName:o.shapeName??"",transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1})};case"Sky":{let e,i;e=Array.isArray(o.fogVolumes)?o.fogVolumes.map(e=>({visibleDistance:e.visibleDistance??0,minHeight:e.minHeight??0,maxHeight:e.maxHeight??0,color:n(e.color)})):[],i=Array.isArray(o.cloudLayers)?o.cloudLayers.map(e=>({texture:e.texture??"",heightPercent:e.heightPercent??0,speed:e.speed??0})):[];let r=l={className:"Sky",ghostIndex:a,materialList:o.materialList??"",fogColor:n(o.fogColor),visibleDistance:o.visibleDistance??1e3,fogDistance:o.fogDistance??0,skySolidColor:n(o.skySolidColor),useSkyTextures:o.useSkyTextures??!0,fogVolumes:e,cloudLayers:i,windVelocity:s(o.windVelocity)};return t.debug("Sky #%d: materialList=%s fogColor=(%s, %s, %s) visibleDist=%d fogDist=%d useSkyTextures=%s",a,r.materialList,r.fogColor.r.toFixed(3),r.fogColor.g.toFixed(3),r.fogColor.b.toFixed(3),r.visibleDistance,r.fogDistance,r.useSkyTextures),l}case"Sun":{let e=l={className:"Sun",ghostIndex:a,direction:s(o.direction,{x:.57735,y:.57735,z:-.57735}),color:i(o.color,{r:.7,g:.7,b:.7,a:1}),ambient:i(o.ambient,{r:.5,g:.5,b:.5,a:1}),textures:Array.isArray(o.textures)?o.textures:void 0};return t.debug("Sun #%d: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",a,e.direction.x.toFixed(3),e.direction.y.toFixed(3),e.direction.z.toFixed(3),e.color.r.toFixed(3),e.color.g.toFixed(3),e.color.b.toFixed(3),e.ambient.r.toFixed(3),e.ambient.g.toFixed(3),e.ambient.b.toFixed(3)),l}case"MissionArea":return{className:"MissionArea",ghostIndex:a,area:o.area??{x:-512,y:-512,w:1024,h:1024},flightCeiling:o.flightCeiling??2e3,flightCeilingRange:o.flightCeilingRange??50};case"WaterBlock":return{className:"WaterBlock",ghostIndex:a,transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1}),surfaceName:o.surfaceName??"",envMapName:o.envMapName??"",surfaceOpacity:o.surfaceOpacity??.75,waveMagnitude:o.waveMagnitude??1,envMapIntensity:o.envMapIntensity??1};default:return null}}e.s(["ghostToSceneObject",()=>a],47566),e.i(9672);var o=e.i(90072);function l(e){return[e.y,e.z,e.x]}function c(e){return[e.y,e.z,e.x]}function u(e){let t=e.elements,s=new o.Matrix4,n=s.elements;n[0]=t[5],n[1]=t[6],n[2]=t[4],n[3]=0,n[4]=t[9],n[5]=t[10],n[6]=t[8],n[7]=0,n[8]=t[1],n[9]=t[2],n[10]=t[0],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1;let i=new o.Quaternion;return i.setFromRotationMatrix(s),i.conjugate(),i}e.s(["matrixFToQuaternion",()=>u,"torqueScaleToThree",()=>c,"torqueToThree",()=>l],63318),e.s([],70847)},92224,e=>{"use strict";e.i(932);var t=e.i(8155),s=e.i(66748),n=e.i(62395);let i=(0,t.createStore)()(e=>({missionEntities:new Map,streamEntities:new Map,isStreaming:!1,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:0,setEntity(t){e(e=>{let s=new Map(e.missionEntities);return s.set(t.id,t),{missionEntities:s,version:e.version+1}})},deleteEntity(t){e(e=>{if(!e.missionEntities.has(t))return e;let s=new Map(e.missionEntities);return s.delete(t),{missionEntities:s,version:e.version+1}})},setEntities(t){e(e=>{let s=new Map(e.missionEntities);for(let e of t)s.set(e.id,e);return{missionEntities:s,version:e.version+1}})},setAllEntities(t){e(e=>{let s=new Map;for(let e of t)s.set(e.id,e);return{missionEntities:s,dataSource:e.isStreaming?e.dataSource:"map"}})},clearEntities(){e(e=>0===e.missionEntities.size?e:e.isStreaming?{missionEntities:new Map,version:e.version+1}:{missionEntities:new Map,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1})},setMissionInfo(t){let s={};if(void 0!==t.missionName&&(s.missionName=t.missionName),void 0!==t.missionType&&(s.missionType=t.missionType),void 0!==t.missionTypeDisplayName&&(s.missionTypeDisplayName=t.missionTypeDisplayName),void 0!==t.missionDisplayName&&(s.missionDisplayName=t.missionDisplayName),void 0!==t.gameClassName&&(s.gameClassName=t.gameClassName,void 0===t.missionType))if(t.gameClassName){let e=t.gameClassName.replace(/Game$/i,"");s.missionType=n.normalizedMissionTypes[e.toLowerCase()]??e}else s.missionType=null;void 0!==t.serverDisplayName&&(s.serverDisplayName=t.serverDisplayName),void 0!==t.recorderName&&(s.recorderName=t.recorderName),void 0!==t.recordingDate&&(s.recordingDate=t.recordingDate),e(e=>({...s,version:e.version+1}))},beginStreaming(t){e(e=>({isStreaming:!0,dataSource:t,streamEntities:new Map,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1}))},endStreaming(){e(e=>e.isStreaming?{isStreaming:!1,dataSource:e.missionEntities.size>0?"map":null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,streamEntities:new Map,version:e.version+1}:e)},setStreamEntity(t){e(e=>{let s=new Map(e.streamEntities);return s.set(t.id,t),{streamEntities:s,version:e.version+1}})},deleteStreamEntity(t){e(e=>{if(!e.streamEntities.has(t))return e;let s=new Map(e.streamEntities);return s.delete(t),{streamEntities:s,version:e.version+1}})},setStreamEntities(t){e(e=>{let s=new Map(e.streamEntities);for(let e of t)s.set(e.id,e);return{streamEntities:s,version:e.version+1}})},setAllStreamEntities(t){e(e=>{let s=new Map;for(let e of t)s.set(e.id,e);let n=e.streamEntities;return s.size===n.size&&[...s.keys()].every(e=>n.has(e))?e:{streamEntities:s,version:e.version+1}})},clearStreamEntities(){e(e=>0===e.streamEntities.size?e:{streamEntities:new Map,version:e.version+1})}}));function r(e){let t=e.isStreaming?e.streamEntities:e.missionEntities,s=[];for(let e of t.values())"None"!==e.renderType&&s.push(e);return s}function a(e,t){if(e.length!==t.length)return!1;for(let s=0;so,"useDataSource",()=>m,"useMissionDisplayName",()=>k,"useMissionName",()=>p,"useMissionType",()=>y,"useMissionTypeDisplayName",()=>v,"useRecorderName",()=>E,"useRecordingDate",()=>x,"useSceneSky",()=>u,"useSceneSun",()=>d,"useServerDisplayName",()=>N])},98755,e=>{"use strict";e.i(47167);var t=e.i(8155),s=e.i(66748),n=e.i(25645);let i=(0,n.createLogger)("relayClient");class r{ws=null;handlers;url;_connected=!1;wsPingInterval=null;smoothedWsPing=0;constructor(e,t){this.url=e,this.handlers=t}get connected(){return this._connected}connect(){this.ws=new WebSocket(this.url),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{i.info("WebSocket connected to %s",this.url),this._connected=!0,this.startWsPing(),this.handlers.onOpen?.()},this.ws.onmessage=e=>{if(e.data instanceof ArrayBuffer)this.handlers.onGamePacket?.(new Uint8Array(e.data));else try{let t=JSON.parse(e.data);this.handleMessage(t)}catch(e){i.error("Failed to parse relay message: %o",e)}},this.ws.onclose=()=>{i.info("WebSocket disconnected"),this._connected=!1,this.stopWsPing(),this.handlers.onClose?.()},this.ws.onerror=()=>{i.error("WebSocket error"),this.handlers.onError?.("WebSocket connection error")}}handleMessage(e){switch(e.type){case"serverList":this.handlers.onServerList?.(e.servers);break;case"status":this.handlers.onStatus?.(e.status,e.message,e.connectSequence,e.mapName);break;case"ping":this.handlers.onPing?.(e.ms);break;case"wsPong":{let t=Date.now()-e.ts;this.smoothedWsPing=0===this.smoothedWsPing?t:.5*this.smoothedWsPing+.5*t,this.handlers.onWsPing?.(Math.round(this.smoothedWsPing));break}case"error":this.handlers.onError?.(e.message)}}listServers(){this.send({type:"listServers"})}sendWsPing(){this.send({type:"wsPing",ts:Date.now()})}joinServer(e,t){i.info("Joining server: %s",e),this.send({type:"joinServer",address:e,warriorName:t})}disconnectServer(){this.send({type:"disconnect"})}sendAuthEvent(e,t){this.send({type:"sendCommand",command:e,args:t})}sendCommand(e,t){this.send({type:"sendCommand",command:e,args:t})}sendCRCResponse(e,t,s){this.send({type:"sendCRCResponse",crcValue:e,field1:t,field2:s})}sendCRCCompute(e,t,s,n){this.send({type:"sendCRCCompute",seed:e,field2:t,includeTextures:n,datablocks:s})}sendGhostAck(e,t){this.send({type:"sendGhostAck",sequence:e,ghostCount:t})}sendMoves(e,t){this.send({type:"sendMoves",moves:e,moveStartIndex:t})}close(){this.stopWsPing(),this.ws&&(this.ws.close(),this.ws=null),this._connected=!1}startWsPing(){this.smoothedWsPing=0,this.send({type:"wsPing",ts:Date.now()}),this.wsPingInterval=setInterval(()=>{this.send({type:"wsPing",ts:Date.now()})},7e3)}stopWsPing(){null!=this.wsPingInterval&&(clearInterval(this.wsPingInterval),this.wsPingInterval=null)}send(e){this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):i.warn("send dropped (ws not open): %s",e.type)}}e.i(91891);var a=e.i(94802),o=e.i(89119),l=e.i(10244);let c=(0,n.createLogger)("liveStreaming");class u extends l.StreamEngine{packetParser;relay;currentTimeSec=0;connectSynced=!1;_snapshot=null;_snapshotTick=-1;_ready=!1;dataBlockClassNames=new Map;onReady;onMissionChange;missionName=null;lastMoveAck=0;constructor(e){super(),this.relay=e;const{registry:t,ghostTracker:s,packetParser:n}=(0,a.createLiveParser)();this.packetParser=n,this.ghostTracker=s,this.registry=t}getDataBlockData(e){return this.packetParser.getDataBlockDataMap()?.get(e)}_shapeConstructorCache=null;getShapeConstructorSequences(e){this._shapeConstructorCache=new Map;let t=this.packetParser.getDataBlockDataMap();if(t){for(let[,e]of t){let t=e.shape,s=e.sequences;t&&s&&this._shapeConstructorCache.set(t.toLowerCase(),s)}return this._shapeConstructorCache.get(e.toLowerCase())}}getTimeSec(){return this.currentTimeSec}getCameraYawPitch(e){return this.getAbsoluteRotation(e)??{yaw:0,pitch:0}}getEffectShapes(){let e=new Set,t=this.packetParser.getDataBlockDataMap();if(!t)return[];for(let[,s]of t){let n=s.explosion;if(null==n)continue;let i=t.get(n);i?.dtsFileName&&e.add(i.dtsFileName)}return[...e]}reset(){this.resetSharedState(),this.ghostTracker.clear?.(),this.currentTimeSec=0,this._snapshot=null,this._snapshotTick=-1,this.dataBlockClassNames.clear(),this.observerMode="fly",this.missionName=null}getSnapshot(){return this._snapshot&&this._snapshotTick===this.tickCount?this._snapshot:this.buildSnapshot()}stepToTime(e,t){return this.currentTimeSec=e,this.getSnapshot()}syncConnectSequence(e){if(this.connectSynced||e.length<1)return;this.connectSynced=!0;let t=e[0]>>1&1;this.packetParser.setConnectionProtocolState({lastSeqRecvdAtSend:Array(32).fill(0),lastSeqRecvd:0,highestAckedSeq:0,lastSendSeq:0x1fffffff,ackMask:0,connectSequence:t,lastRecvAckAck:0,connectionEstablished:!0})}feedPacket(e){this.syncConnectSequence(e),this.processPacket(e)}handleRelayCommands(e){if("RemoteCommandEvent"!==e.type)return;let t=e.funcName;if(!t)return;let s=this.resolveNetString(t);if(["t2csri_pokeClient","t2csri_getChallengeChunk","t2csri_decryptChallenge"].includes(s)){let t=(e.args??[]).map(e=>this.resolveNetString(e)).filter(e=>""!==e);c.info("auth event: %s %o",s,t),this.relay.sendAuthEvent(s,t);return}let n=(e.args??[]).map(e=>this.resolveNetString(e));if("MissionStartPhase1"===s){let e=n[0]??"",t=n[1]??null;c.info("mission phase 1, seq=%s mission=%s resolvedArgs=%o",e,t,n),t&&t!==this.missionName&&(this.missionName=t,this.entities.clear(),this.entityIdByGhostIndex.clear(),this._ready=!1,this._snapshot=null,this._snapshotTick=-1,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null,this.onMissionChange?.(t)),this.relay.sendCommand("MissionStartPhase1Done",[e])}else if("MissionStartPhase2"===s){let e=n[0]??"";c.info("mission phase 2 (datablocks), seq=%s",e),this.relay.sendCommand("MissionStartPhase2Done",[e])}else if("MissionStartPhase3"===s){let e=n[0]??"",t=n[1]??null;c.info("mission phase 3 (ghosting), seq=%s mission=%s",e,t),t&&(this.missionName=t),this.relay.sendCommand("setClientFav",[""]),this.relay.sendCommand("MissionStartPhase3Done",[e])}}handleCRCChallenge(e){if("CRCChallengeEvent"!==e.type)return;let t=e.crcValue,s=e.field1,n=e.field2,i=(1&s)!=0;c.info("CRC challenge: seed=0x%s f1=0x%s f2=0x%s includeTextures=%s",(t>>>0).toString(16),(s>>>0).toString(16),(n>>>0).toString(16),i);let r=this.packetParser.getDataBlockDataMap(),a=[];if(r)for(let[e,t]of r){let s=this.dataBlockClassNames.get(e);if(!s)continue;let n=(0,o.resolveShapeName)(s,t);a.push({objectId:e,className:s,shapeName:n??""})}c.info("CRC: sending %d datablocks for computation",a.length),this.relay.sendCRCCompute(t,n,a,i)}handleGhostingMessage(e){if("GhostingMessageEvent"!==e.type)return;let t=e.message,s=e.sequence,n=e.ghostCount;c.info("GhostingMessageEvent: message=%d sequence=%d ghostCount=%d",t,s,n),0===t&&(c.info("Sending ghost ack (type 1) for sequence %d",s),this.relay.sendGhostAck(s,n))}observerMode="fly";toggleObserverMode(){"fly"===this.observerMode?(c.info("observer: fly → follow"),this.observerMode="follow"):(c.info("observer: follow → fly"),this.observerMode="fly")}getPlayerList(){let e=[];for(let[t,s]of this.targetNames){let n=this.targetTeams.get(t)??0;e.push({targetId:t,name:s,sensorGroup:n})}return e}processPacket(e){try{let t=this.packetParser.protocolRejected,s=this.packetParser.protocolNoDispatch,n=this.packetParser.parsePacket(e),i=this.packetParser.protocolRejected>t,r=this.packetParser.protocolNoDispatch>s;(i||r)&&c.warn("packet #%d %s: %d bytes (total rejected=%d, noDispatch=%d)",this.tickCount,i?"REJECTED":"no-dispatch",e.length,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch);let a=this.tickCount<20,l=this.tickCount%100==0,u=a||l;for(let t of(u&&c.debug("packet #%d: %d events, %d ghosts, %d bytes%s%s",this.tickCount,n.events.length,n.ghosts.length,e.length,void 0!==n.gameState.controlObjectGhostIndex?`, control=${n.gameState.controlObjectGhostIndex}`:"",void 0!==n.gameState.cameraFov?`, fov=${n.gameState.cameraFov}`:""),this.lastMoveAck=n.gameState.lastMoveAck,this.processControlObject(n.gameState),n.events))if(t.parsedData){this.handleRelayCommands(t.parsedData),this.handleCRCChallenge(t.parsedData),this.handleGhostingMessage(t.parsedData);let e=t.parsedData.type;if("RemoteCommandEvent"===e){let e=this.resolveNetString(t.parsedData.funcName??"");c.debug("remote: %s",e)}if(a&&"NetStringEvent"!==e&&"RemoteCommandEvent"!==e&&c.debug("event: %s%s",e,"SimDataBlockEvent"===e?` id=${t.parsedData.objectId} class=${t.parsedData.dataBlockClassName}`:""),"SimDataBlockEvent"===e){let e=t.parsedData.objectId,s=t.parsedData.dataBlockClassName;if(null!=e&&s&&this.dataBlockClassNames.set(e,s),u){let n=t.parsedData.dataBlockData,i=(0,o.resolveShapeName)(s??"",n);c.debug("datablock: id=%d class=%s%s",e,s??"?",i?` shape=${i}`:"")}}let s=this.registry.getEventParser(t.classId)?.name;if(this.processEvent(t,s),a&&"NetStringEvent"===e){let e=t.parsedData.id,s=t.parsedData.value;null!=e&&"string"==typeof s&&c.trace('netString #%d = "%s"',e,s.length>60?s.slice(0,60)+"…":s)}if("TargetInfoEvent"===e){let e=t.parsedData.targetId,s=t.parsedData.nameTag;if(null!=e&&null!=s){let n=this.netStrings.get(s);if(n){let s=(0,o.stripTaggedStringMarkup)(n);c.info('target #%d: "%s" team=%s',e,s,t.parsedData.sensorGroup??"?")}}}if("SetSensorGroupEvent"===e){let e=t.parsedData.sensorGroup;null!=e&&c.info("sensor group changed: → %d",e)}if("SensorGroupColorEvent"===e){let e=t.parsedData.sensorGroup,s=t.parsedData.colors;s&&c.debug("sensor group colors: group=%d, %d entries",e,s.length)}}for(let e of n.ghosts){if("create"===e.type){let t=e.parsedData?.position,s=t&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.z,n=this.resolveGhostClassName(e.index,e.classId);c.debug("ghost create: #%d %s%s (%d entities total)",e.index,n??"?",s?` at (${t.x.toFixed(1)}, ${t.y.toFixed(1)}, ${t.z.toFixed(1)})`:"",this.entities.size+1),this._ready||(this._ready=!0,this.onReady?.())}else if("delete"===e.type){let t=this.entityIdByGhostIndex.get(e.index),s=t?this.entities.get(t):void 0;(this.tickCount<50||this.tickCount%200==0)&&c.debug("ghost delete: #%d %s (%d entities remaining)",e.index,s?.className??"?",this.entities.size-1)}this.processGhostUpdate(e)}if(this.tickCount++,this.advanceProjectiles(),this.advanceItems(),l&&this.tickCount>1){let e=this.packetParser.getDataBlockDataMap();c.info("status @ tick %d: %d entities, %d datablocks, rejected=%d, noDispatch=%d",this.tickCount,this.entities.size,e?.size??0,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch)}let d=this.entities.size;if(1===this.tickCount||d>0&&d%25==0&&this.tickCount<100){let e=new Map;for(let t of this.entities.values())e.set(t.type,(e.get(t.type)??0)+1);let t=[...e.entries()].map(([e,t])=>`${e}=${t}`).join(" ");c.info("entity count: %d (%s)",d,t)}let m=this.camera?.mode;if(this.updateCameraAndHud(),this.camera&&this.camera.mode!==m&&c.info("camera mode: %s → %s%s",m??"none",this.camera.mode,"third-person"===this.camera.mode?` orbit=${this.camera.orbitTargetId??"?"} dist=${this.camera.orbitDistance??"?"}`:""),this.tickCount<=5&&this.camera){let[e,t,s]=this.camera.position;c.debug("camera: mode=%s pos=(%s, %s, %s) fov=%s",this.camera.mode,e.toFixed(1),t.toFixed(1),s.toFixed(1),this.camera.fov)}}catch(s){let t={tickCount:this.tickCount,entityCount:this.entities.size,dataLength:e.length,controlGhost:this.latestControl.ghostIndex,connectSynced:this.connectSynced};c.error("Failed to process live packet: %o %o",s,t)}}buildSnapshot(){let e=this.buildEntityList(),t=this.currentTimeSec,{chatMessages:s,audioEvents:n}=this.buildTimeFilteredEvents(t),{weaponsHud:i,inventoryHud:r,backpackHud:a,teamScores:o}=this.buildHudState();this.camera||(this.camera={time:t,position:[0,0,200],rotation:[0,0,0,1],fov:90,mode:"observer"});let l={timeSec:t,exhausted:!1,camera:this.camera,entities:e,controlPlayerGhostId:this.controlPlayerGhostId,playerSensorGroup:this.playerSensorGroup,status:this.lastStatus,chatMessages:s,audioEvents:n,weaponsHud:i,backpackHud:a,inventoryHud:r,teamScores:o};return this._snapshot=l,this._snapshotTick=this.tickCount,l}}var d=e.i(92224);let m=(0,n.createLogger)("liveConnectionStore"),h="wss://t2-relay.fly.dev",p=(0,t.createStore)((e,t)=>({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,servers:[],serversLoading:!1,adapter:null,liveReady:!1,_relay:null,_adapter:null,_pending:[],_listInFlight:!1,connectRelay(s=h){let n=t();n._relay&&n._relay.close();let i=new r(s,{onOpen(){e({relayConnected:!0});let s=t();for(let e of s._pending)e();s._pending=[]},onStatus(t,s,n,i){m.info("game status: %s%s%s",t,s?` — ${s}`:"",i?` map=${i}`:""),e({gameStatus:t,gameStatusMessage:s,...i?{mapName:i}:{}})},onServerList(s){t()._listInFlight=!1,e({servers:s,serversLoading:!1})},onGamePacket(e){let s=t()._adapter;s||m.warn("received game packet but no adapter is active"),s?.feedPacket(e)},onPing(t){e({relayToGameServerPing:t})},onWsPing(t){e({browserToRelayPing:t})},onError(s){m.error("error: %s",s),t()._listInFlight=!1,e({serversLoading:!1})},onClose(){let s=t();s._relay===i&&(s._relay=null,s._adapter=null,s._pending=[],s._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1}))}});i.connect(),t()._relay=i},disconnectRelay(){let s=t();s._relay?.close(),s._relay=null,s._adapter=null,s._pending=[],s._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1})},listServers(){let s=t();if(s._listInFlight)return;s._listInFlight=!0;let n=()=>{let e=t();e._relay?.sendWsPing(),e._relay?.listServers()};e({serversLoading:!0}),s._relay?.connected?n():(s._pending.push(n),s._relay||t().connectRelay())},joinServer(s,n){let i=t();if(!i._relay)return;let r=i.servers.find(e=>e.address===s),a=new u(i._relay);a.onReady=()=>e({liveReady:!0}),a.onMissionChange=t=>{m.info("mission changed: %s",t),e({mapName:t,liveReady:!1}),d.gameEntityStore.getState().setMissionInfo({missionName:t,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null})},a.onMissionInfoChange=()=>{d.gameEntityStore.getState().setMissionInfo({missionDisplayName:a.missionDisplayName??void 0,missionTypeDisplayName:a.missionTypeDisplayName??void 0,gameClassName:a.gameClassName??void 0,serverDisplayName:a.serverDisplayName??void 0,recorderName:a.connectedPlayerName??void 0})},i._adapter=a,e({mapName:r?.mapName??i.mapName,serverName:r?.name,warriorName:n,liveReady:!1,gameStatus:null,adapter:a}),d.gameEntityStore.getState().setMissionInfo({missionName:r?.mapName??void 0,missionTypeDisplayName:r?.gameType??void 0,serverDisplayName:r?.name??void 0,recorderName:n??void 0}),i._relay.joinServer(s,n)},disconnectServer(){let s=t();s._relay?.disconnectServer(),s._adapter=null,e({adapter:null,liveReady:!1,gameStatus:null,mapName:void 0,serverName:void 0,relayToGameServerPing:null})},sendMoves(e,s){t()._relay?.sendMoves(e,s)},sendCommand(e,...s){t()._relay?.sendCommand(e,s)}}));function g(e,t){return(0,s.useStoreWithEqualityFn)(p,e,t)}function y(e){return null!=e.relayToGameServerPing&&null!=e.browserToRelayPing?e.relayToGameServerPing+e.browserToRelayPing:e.relayToGameServerPing??null}e.s(["liveConnectionStore",0,p,"selectPing",()=>y,"useLiveSelector",()=>g],98755)},66093,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645);let i=(0,n.createContext)(null);function r(){let e=(0,n.useContext)(i);if(!e)throw Error("No JoystickContext found. Did you forget to add a ?");return e}function a(e){let r,a,o,l,c,u,d=(0,s.c)(7),{children:m}=e;d[0]===Symbol.for("react.memo_cache_sentinel")?(r={angle:0,force:0},d[0]=r):r=d[0];let h=(0,n.useRef)(r);d[1]===Symbol.for("react.memo_cache_sentinel")?(a={angle:0,force:0},d[1]=a):a=d[1];let p=(0,n.useRef)(a);d[2]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{let{angle:t,force:s}=e;null!=t&&(h.current.angle=t),null!=s&&(h.current.force=s)},d[2]=o):o=d[2];let g=o;d[3]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let{angle:t,force:s}=e;null!=t&&(p.current.angle=t),null!=s&&(p.current.force=s)},d[3]=l):l=d[3];let y=l;d[4]===Symbol.for("react.memo_cache_sentinel")?(c={moveState:h,lookState:p,setMoveState:g,setLookState:y},d[4]=c):c=d[4];let f=c;return d[5]!==m?(u=(0,t.jsx)(i,{value:f,children:m}),d[5]=m,d[6]=u):u=d[6],u}e.s(["JoystickProvider",()=>a,"useJoystick",()=>r])},65349,e=>{"use strict";var t=e.i(71645);let s=(0,t.createContext)(null);function n(){let e=(0,t.useContext)(s);if(!e)throw Error("useInputContext must be used within an InputProvider");return e}function i(){return n().onInput}e.s(["InputContext",0,s,"useInputContext",()=>n,"useOnInput",()=>i])},32865,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(58647);function i(e){let n,i=(0,s.c)(2),{children:r}=e;return i[0]!==r?(n=(0,t.jsx)(t.Fragment,{children:r}),i[0]=r,i[1]=n):n=i[1],n}function r(){return(0,n.useEngineSelector)(a)}function a(e){return e.playback.recording}function o(){return(0,n.useEngineSelector)(l)}function l(e){return"playing"===e.playback.status}function c(){return(0,n.useEngineSelector)(u)}function u(e){return e.playback.timeMs/1e3}function d(){return(0,n.useEngineSelector)(m)}function m(e){return e.playback.durationMs/1e3}function h(){return(0,n.useEngineSelector)(p)}function p(e){return e.playback.rate}function g(){let e,t,i,a,o,l,c=(0,s.c)(17),u=r(),d=(0,n.useEngineSelector)(S),m=(0,n.useEngineSelector)(v),h=(0,n.useEngineSelector)(f),p=(0,n.useEngineSelector)(y);c[0]!==d?(e=e=>{d(e)},c[0]=d,c[1]=e):e=c[1];let g=e;c[2]!==u||c[3]!==m?(t=()=>{u&&m("playing")},c[2]=u,c[3]=m,c[4]=t):t=c[4];let k=t;c[5]!==m?(i=()=>{m("paused")},c[5]=m,c[6]=i):i=c[6];let b=i;c[7]!==h?(a=e=>{h(1e3*e)},c[7]=h,c[8]=a):a=c[8];let N=a;c[9]!==p?(o=e=>{p(e)},c[9]=p,c[10]=o):o=c[10];let C=o;return c[11]!==b||c[12]!==k||c[13]!==N||c[14]!==g||c[15]!==C?(l={setRecording:g,play:k,pause:b,seek:N,setSpeed:C},c[11]=b,c[12]=k,c[13]=N,c[14]=g,c[15]=C,c[16]=l):l=c[16],l}function y(e){return e.setPlaybackRate}function f(e){return e.setPlaybackTime}function v(e){return e.setPlaybackStatus}function S(e){return e.setRecording}e.s(["RecordingProvider",()=>i,"useCurrentTime",()=>c,"useDuration",()=>d,"useIsPlaying",()=>o,"usePlaybackActions",()=>g,"useRecording",()=>r,"useSpeed",()=>h])},12631,e=>{"use strict";var t=e.i(71645),s=e.i(8155);let n=e=>{let n=(0,s.createStore)(e),i=e=>(function(e,s=e=>e){let n=t.default.useSyncExternalStore(e.subscribe,t.default.useCallback(()=>s(e.getState()),[e,s]),t.default.useCallback(()=>s(e.getInitialState()),[e,s]));return t.default.useDebugValue(n),n})(n,e);return Object.assign(i,n),i};var i=e.i(79473);let r=t.createContext(null);function a({map:e,children:s,onChange:a,domElement:o}){let l=e.map(e=>e.name+e.keys).join("-"),c=t.useMemo(()=>{let t;return(t=(0,i.subscribeWithSelector)(()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{})))?n(t):n},[l]),u=t.useMemo(()=>[c.subscribe,c.getState,c],[l]),d=c.setState;return t.useEffect(()=>{let t=e.map(({name:e,keys:t,up:s})=>({keys:t,up:s,fn:t=>{d({[e]:t}),a&&a(e,t,u[1]())}})).reduce((e,{keys:t,fn:s,up:n=!0})=>(t.forEach(t=>e[t]={fn:s,pressed:!1,up:n}),e),{}),s=({key:e,code:s})=>{let n=t[e]||t[s];if(!n)return;let{fn:i,pressed:r,up:a}=n;n.pressed=!0,(a||!r)&&i(!0)},n=({key:e,code:s})=>{let n=t[e]||t[s];if(!n)return;let{fn:i,up:r}=n;n.pressed=!1,r&&i(!1)},i=o||window;return i.addEventListener("keydown",s,{passive:!0}),i.addEventListener("keyup",n,{passive:!0}),()=>{i.removeEventListener("keydown",s),i.removeEventListener("keyup",n)}},[o,l]),t.createElement(r.Provider,{value:u,children:s})}function o(e){let[s,n,i]=t.useContext(r);return e?i(e):[s,n]}e.s(["KeyboardControls",()=>a,"useKeyboardControls",()=>o],12631)},93784,e=>{"use strict";let t=(0,e.i(8155).createStore)()(()=>({time:0,playback:null,root:null,freeFlyCamera:!1,entities:new Map}));function s(){t.setState({time:0,playback:null,freeFlyCamera:!1})}e.s(["resetStreamPlayback",()=>s,"streamPlaybackStore",0,t])},46325,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645);let i=(0,e.i(25645).createLogger)("DebugSuspense");function r(e){let i,r,l,c=(0,s.c)(10),{name:u,fallback:d,children:m}=e,h=void 0===d?null:d;return c[0]!==h||c[1]!==u?(i=(0,t.jsx)(a,{name:u,children:h}),c[0]=h,c[1]=u,c[2]=i):i=c[2],c[3]!==u?(r=(0,t.jsx)(o,{name:u}),c[3]=u,c[4]=r):r=c[4],c[5]!==m||c[6]!==u||c[7]!==i||c[8]!==r?(l=(0,t.jsxs)(n.Suspense,{name:u,fallback:i,children:[r,m]}),c[5]=m,c[6]=u,c[7]=i,c[8]=r,c[9]=l):l=c[9],l}function a(e){let t,r,a=(0,s.c)(3),{name:o,children:l}=e;return a[0]!==o?(t=()=>{i.debug("🛑 SUSPENDED: %s",o)},r=[o],a[0]=o,a[1]=t,a[2]=r):(t=a[1],r=a[2]),(0,n.useEffect)(t,r),l}function o(e){let t,r,a=(0,s.c)(3),{name:o}=e;return a[0]!==o?(t=()=>{i.debug("✅ RESOLVED: %s",o)},r=[o],a[0]=o,a[1]=t,a[2]=r):(t=a[1],r=a[2]),(0,n.useEffect)(t,r),null}e.s(["DebugSuspense",()=>r])},51434,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645),i=e.i(15080),r=e.i(90072),a=e.i(58647),o=e.i(79123);let l=(0,n.createContext)(void 0);function c(e){let c,h,p,g,y,f,v=(0,s.c)(11),{children:S}=e,k=(0,i.useThree)(m),{audioVolume:b}=(0,o.useSettings)();v[0]===Symbol.for("react.memo_cache_sentinel")?(c={audioLoader:null,audioListener:null},v[0]=c):c=v[0];let[N,C]=(0,n.useState)(c);return v[1]!==k?(h=()=>{let e=new r.AudioLoader,t=k.children.find(d);t||(t=new r.AudioListener,k.add(t)),C({audioLoader:e,audioListener:t});let s=()=>{let e=t.context;e&&"suspended"===e.state&&e.resume().finally(()=>{document.removeEventListener("click",s),document.removeEventListener("keydown",s),document.removeEventListener("touchend",s)})};document.addEventListener("click",s),document.addEventListener("keydown",s),document.addEventListener("touchend",s);let n=a.engineStore.subscribe(u,e=>{let s=t.context;s&&("paused"===e?s.suspend():"suspended"===s.state&&s.resume())});return()=>{document.removeEventListener("click",s),document.removeEventListener("keydown",s),document.removeEventListener("touchend",s),n(),t&&k.remove(t)}},p=[k],v[1]=k,v[2]=h,v[3]=p):(h=v[2],p=v[3]),(0,n.useEffect)(h,p),v[4]!==N.audioListener||v[5]!==b?(g=()=>{N.audioListener?.setMasterVolume(b)},y=[b,N.audioListener],v[4]=N.audioListener,v[5]=b,v[6]=g,v[7]=y):(g=v[6],y=v[7]),(0,n.useEffect)(g,y),v[8]!==N||v[9]!==S?(f=(0,t.jsx)(l.Provider,{value:N,children:S}),v[8]=N,v[9]=S,v[10]=f):f=v[10],f}function u(e){return e.playback.status}function d(e){return e instanceof r.AudioListener}function m(e){return e.camera}function h(){let e=(0,n.useContext)(l);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>c,"useAudio",()=>h])},31999,e=>{"use strict";var t=e.i(71645);let s=(0,e.i(25645).createLogger)("ShapeErrorBoundary");class n extends t.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){s.error("Shape load failed: %s %s",e.message,t.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}e.s(["ShapeErrorBoundary",()=>n])},77964,e=>{"use strict";function t(e){switch(e.renderType){case"TerrainBlock":case"InteriorInstance":case"Sky":case"Sun":case"WaterBlock":case"MissionArea":return!0;default:return!1}}e.s(["isSceneEntity",()=>t])},60946,e=>{e.v(t=>Promise.all(["static/chunks/48d0203d138a3e57.js"].map(t=>e.l(t))).then(()=>t(0)))},30814,e=>{e.v(t=>Promise.all(["static/chunks/41fb9d5ac0e14608.js"].map(t=>e.l(t))).then(()=>t(9721)))},44325,e=>{e.v(t=>Promise.all(["static/chunks/c5f946098461b297.js"].map(t=>e.l(t))).then(()=>t(66789)))},62125,e=>{e.v(t=>Promise.all(["static/chunks/6c0bdfaab43cc40b.js"].map(t=>e.l(t))).then(()=>t(64972)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/2c772d15a5a10e4d.js"].map(t=>e.l(t))).then(()=>t(63724)))},61921,e=>{e.v(t=>Promise.all(["static/chunks/538e72dc81951677.js"].map(t=>e.l(t))).then(()=>t(29055)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/2070573ac43e863c.js"].map(t=>e.l(t))).then(()=>t(42585)))},34019,e=>{e.v(t=>Promise.all(["static/chunks/967c4aa315f919d7.js"].map(t=>e.l(t))).then(()=>t(66069)))},553,e=>{e.v(t=>Promise.all(["static/chunks/66f953934e42712b.css","static/chunks/e27b13e203064a85.js"].map(t=>e.l(t))).then(()=>t(18339)))},33487,e=>{e.v(t=>Promise.all(["static/chunks/9ffe862a9787606f.css","static/chunks/302e494fb721f5e6.js"].map(t=>e.l(t))).then(()=>t(40378)))},25483,e=>{e.v(t=>Promise.all(["static/chunks/41fb9d5ac0e14608.js","static/chunks/419d6e651fe3d509.js"].map(t=>e.l(t))).then(()=>t(51295)))},93884,e=>{e.v(t=>Promise.all(["static/chunks/1db3a9d62713e989.css","static/chunks/3770acf7d1a6ba0a.js"].map(t=>e.l(t))).then(()=>t(94737)))},88487,e=>{e.v(t=>Promise.all(["static/chunks/005e475439c5cb3e.js","static/chunks/3ec6b524f05ae0b6.css"].map(t=>e.l(t))).then(()=>t(86855)))},21683,e=>{e.v(t=>Promise.all(["static/chunks/4c292ca57f1d49be.js"].map(t=>e.l(t))).then(()=>t(91285)))},38496,e=>{e.v(t=>Promise.all(["static/chunks/fd10b9633e3b5488.js"].map(t=>e.l(t))).then(()=>t(9962)))},57567,e=>{e.v(t=>Promise.all(["static/chunks/dbc95e0f1d663220.css","static/chunks/4e0d5bbc5104adf2.js"].map(t=>e.l(t))).then(()=>t(49776)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/7317a925124598e3.css","static/chunks/7dcb40c178014bc9.js"].map(t=>e.l(t))).then(()=>t(94247)))},70012,e=>{e.v(t=>Promise.all(["static/chunks/7317a925124598e3.css","static/chunks/0070446447a9983b.js"].map(t=>e.l(t))).then(()=>t(45554)))}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,66027,e=>{"use strict";var t=e.i(69230),s=e.i(69637);function n(e,n){return(0,s.useBaseQuery)(e,t.QueryObserver,n)}e.s(["useQuery",()=>n])},9672,e=>{"use strict";function t(e,t){return e[t.toLowerCase()]}function s(e,s){let n=t(e,s);if(null==n)return;let i=parseFloat(n);return Number.isFinite(i)?i:void 0}function n(e,s){let n=t(e,s);if(null==n)return;let i=parseInt(n,10);return Number.isFinite(i)?i:void 0}function i(e,t={x:0,y:0,z:0}){if(!e)return t;let s=e.split(" ").map(Number);return{x:s[0]??t.x,y:s[1]??t.y,z:s[2]??t.z}}function r(e,t={r:0,g:0,b:0}){if(!e)return t;let s=e.split(" ").map(Number);return{r:s[0]??t.r,g:s[1]??t.g,b:s[2]??t.b}}function a(e,t={r:.5,g:.5,b:.5,a:1}){if(!e)return t;let s=e.split(" ").map(Number);return{r:s[0]??t.r,g:s[1]??t.g,b:s[2]??t.b,a:s[3]??t.a}}function o(e,t){let s=i(e),n=(t??"1 0 0 0").split(" ").map(Number),r=n[0]??1,a=n[1]??0,o=n[2]??0,l=Math.PI/180*(n[3]??0),c=Math.sqrt(r*r+a*a+o*o),u=0,d=0,m=1;c>1e-8&&(u=r/c,d=a/c,m=o/c);let h=Math.cos(l),p=Math.sin(l),g=1-h,y=Array(16).fill(0);return y[0]=g*u*u+h,y[1]=g*u*d+p*m,y[2]=g*u*m-p*d,y[4]=g*u*d-p*m,y[5]=g*d*d+h,y[6]=g*d*m+p*u,y[8]=g*u*m+p*d,y[9]=g*d*m-p*u,y[10]=g*m*m+h,y[12]=s.x,y[13]=s.y,y[14]=s.z,y[15]=1,{elements:y,position:s}}function l(e){return{className:"TerrainBlock",ghostIndex:e._id,terrFileName:t(e,"terrainFile")??"",detailTextureName:t(e,"detailTexture")??"",squareSize:n(e,"squareSize")??8,emptySquareRuns:function(e){if(!e)return;let t=e.split(/\s+/).map(Number).filter(Number.isFinite);return t.length>0?t:void 0}(t(e,"emptySquares"))}}function c(e){return{className:"InteriorInstance",ghostIndex:e._id,interiorFile:t(e,"interiorFile")??"",transform:o(t(e,"position"),t(e,"rotation")),scale:i(t(e,"scale"),{x:1,y:1,z:1}),showTerrainInside:"1"===t(e,"showTerrainInside"),skinBase:t(e,"skinBase")??"",alarmState:!1}}function u(e){let a=[];for(let s=1;s<=3;s++){let n=function(e){if(!e)return null;let t=e.split(/\s+/).map(Number),s=t[0]??0,n=t[1]??0,i=t[2]??0;return 0===s&&0===n&&0===i?null:{visibleDistance:s,minHeight:n,maxHeight:i,color:{r:.5,g:.5,b:.5}}}(t(e,`fogVolume${s}`));n&&a.push(n)}let o=[];for(let n=0;n<3;n++){let i=t(e,`cloudText${n+1}`)??"",r=s(e,`cloudHeightPer[${n}]`)??s(e,`cloudheightper${n}`)??[.35,.25,.2][n],a=s(e,`cloudSpeed${n+1}`)??[1e-4,2e-4,3e-4][n];o.push({texture:i,heightPercent:r,speed:a})}return{className:"Sky",ghostIndex:e._id,materialList:t(e,"materialList")??"",fogColor:r(t(e,"fogColor")),visibleDistance:s(e,"visibleDistance")??1e3,fogDistance:s(e,"fogDistance")??0,skySolidColor:r(t(e,"SkySolidColor")),useSkyTextures:(n(e,"useSkyTextures")??1)!==0,fogVolumes:a,cloudLayers:o,windVelocity:i(t(e,"windVelocity"))}}function d(e){return{className:"Sun",ghostIndex:e._id,direction:i(t(e,"direction"),{x:.57735,y:.57735,z:-.57735}),color:a(t(e,"color"),{r:.7,g:.7,b:.7,a:1}),ambient:a(t(e,"ambient"),{r:.5,g:.5,b:.5,a:1})}}function m(e){let n=t(e,"area"),i={x:-512,y:-512,w:1024,h:1024};if(n){let e=n.split(/\s+/).map(Number);i={x:e[0]??i.x,y:e[1]??i.y,w:e[2]??i.w,h:e[3]??i.h}}return{className:"MissionArea",ghostIndex:e._id,area:i,flightCeiling:s(e,"flightCeiling")??2e3,flightCeilingRange:s(e,"flightCeilingRange")??50}}function h(e){return{className:"WaterBlock",ghostIndex:e._id,transform:o(t(e,"position"),t(e,"rotation")),scale:i(t(e,"scale"),{x:1,y:1,z:1}),surfaceName:t(e,"surfaceTexture")??"",envMapName:t(e,"envMapTexture")??"",surfaceOpacity:s(e,"surfaceOpacity")??.75,waveMagnitude:s(e,"waveMagnitude")??1,envMapIntensity:s(e,"envMapIntensity")??1}}e.s(["interiorFromMis",()=>c,"missionAreaFromMis",()=>m,"skyFromMis",()=>u,"sunFromMis",()=>d,"terrainFromMis",()=>l,"waterBlockFromMis",()=>h])},70847,47566,63318,e=>{"use strict";let t=(0,e.i(25645).createLogger)("ghostToScene");function s(e,t={x:0,y:0,z:0}){return e&&"object"==typeof e&&"x"in e?e:t}function n(e,t={r:0,g:0,b:0}){return e&&"object"==typeof e&&"r"in e?e:t}function i(e,t={r:.5,g:.5,b:.5,a:1}){return e&&"object"==typeof e&&"r"in e?e:t}function r(e){if(e&&"object"==typeof e&&"elements"in e&&Array.isArray(e.elements))return e;if(e&&"object"==typeof e&&"position"in e&&"rotation"in e){let{position:t,rotation:s}=e,n=s.x*s.x,i=s.y*s.y,r=s.z*s.z,a=s.x*s.y,o=s.x*s.z,l=s.y*s.z,c=s.w*s.x,u=s.w*s.y,d=s.w*s.z;return{elements:[1-2*(i+r),2*(a+d),2*(o-u),0,2*(a-d),1-2*(n+r),2*(l+c),0,2*(o+u),2*(l-c),1-2*(n+i),0,t.x,t.y,t.z,1],position:{x:t.x,y:t.y,z:t.z}}}return{elements:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],position:{x:0,y:0,z:0}}}function a(e,a,o){let l;switch(e){case"TerrainBlock":return l={className:"TerrainBlock",ghostIndex:a,terrFileName:o.terrFileName??"",detailTextureName:o.detailTextureName??"",squareSize:o.squareSize??8,emptySquareRuns:o.emptySquareRuns},t.debug("TerrainBlock #%d: terrFileName=%s",a,l.terrFileName),l;case"InteriorInstance":return l={className:"InteriorInstance",ghostIndex:a,interiorFile:o.interiorFile??"",transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1}),showTerrainInside:o.showTerrainInside??!1,skinBase:o.skinBase??"",alarmState:o.alarmState??!1},t.debug("InteriorInstance #%d: interiorFile=%s",a,l.interiorFile),l;case"TSStatic":return{className:"TSStatic",ghostIndex:a,shapeName:o.shapeName??"",transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1})};case"Sky":{let e,i;e=Array.isArray(o.fogVolumes)?o.fogVolumes.map(e=>({visibleDistance:e.visibleDistance??0,minHeight:e.minHeight??0,maxHeight:e.maxHeight??0,color:n(e.color)})):[],i=Array.isArray(o.cloudLayers)?o.cloudLayers.map(e=>({texture:e.texture??"",heightPercent:e.heightPercent??0,speed:e.speed??0})):[];let r=l={className:"Sky",ghostIndex:a,materialList:o.materialList??"",fogColor:n(o.fogColor),visibleDistance:o.visibleDistance??1e3,fogDistance:o.fogDistance??0,skySolidColor:n(o.skySolidColor),useSkyTextures:o.useSkyTextures??!0,fogVolumes:e,cloudLayers:i,windVelocity:s(o.windVelocity)};return t.debug("Sky #%d: materialList=%s fogColor=(%s, %s, %s) visibleDist=%d fogDist=%d useSkyTextures=%s",a,r.materialList,r.fogColor.r.toFixed(3),r.fogColor.g.toFixed(3),r.fogColor.b.toFixed(3),r.visibleDistance,r.fogDistance,r.useSkyTextures),l}case"Sun":{let e=l={className:"Sun",ghostIndex:a,direction:s(o.direction,{x:.57735,y:.57735,z:-.57735}),color:i(o.color,{r:.7,g:.7,b:.7,a:1}),ambient:i(o.ambient,{r:.5,g:.5,b:.5,a:1}),textures:Array.isArray(o.textures)?o.textures:void 0};return t.debug("Sun #%d: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",a,e.direction.x.toFixed(3),e.direction.y.toFixed(3),e.direction.z.toFixed(3),e.color.r.toFixed(3),e.color.g.toFixed(3),e.color.b.toFixed(3),e.ambient.r.toFixed(3),e.ambient.g.toFixed(3),e.ambient.b.toFixed(3)),l}case"MissionArea":return{className:"MissionArea",ghostIndex:a,area:o.area??{x:-512,y:-512,w:1024,h:1024},flightCeiling:o.flightCeiling??2e3,flightCeilingRange:o.flightCeilingRange??50};case"WaterBlock":return{className:"WaterBlock",ghostIndex:a,transform:r(o.transform),scale:s(o.scale,{x:1,y:1,z:1}),surfaceName:o.surfaceName??"",envMapName:o.envMapName??"",surfaceOpacity:o.surfaceOpacity??.75,waveMagnitude:o.waveMagnitude??1,envMapIntensity:o.envMapIntensity??1};default:return null}}e.s(["ghostToSceneObject",()=>a],47566),e.i(9672);var o=e.i(90072);function l(e){return[e.y,e.z,e.x]}function c(e){return[e.y,e.z,e.x]}function u(e){let t=e.elements,s=new o.Matrix4,n=s.elements;n[0]=t[5],n[1]=t[6],n[2]=t[4],n[3]=0,n[4]=t[9],n[5]=t[10],n[6]=t[8],n[7]=0,n[8]=t[1],n[9]=t[2],n[10]=t[0],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1;let i=new o.Quaternion;return i.setFromRotationMatrix(s),i.conjugate(),i}e.s(["matrixFToQuaternion",()=>u,"torqueScaleToThree",()=>c,"torqueToThree",()=>l],63318),e.s([],70847)},92224,e=>{"use strict";e.i(932);var t=e.i(8155),s=e.i(66748),n=e.i(62395);let i=(0,t.createStore)()(e=>({missionEntities:new Map,streamEntities:new Map,isStreaming:!1,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:0,setEntity(t){e(e=>{let s=new Map(e.missionEntities);return s.set(t.id,t),{missionEntities:s,version:e.version+1}})},deleteEntity(t){e(e=>{if(!e.missionEntities.has(t))return e;let s=new Map(e.missionEntities);return s.delete(t),{missionEntities:s,version:e.version+1}})},setEntities(t){e(e=>{let s=new Map(e.missionEntities);for(let e of t)s.set(e.id,e);return{missionEntities:s,version:e.version+1}})},setAllEntities(t){e(e=>{let s=new Map;for(let e of t)s.set(e.id,e);return{missionEntities:s,dataSource:e.isStreaming?e.dataSource:"map"}})},clearEntities(){e(e=>0===e.missionEntities.size?e:e.isStreaming?{missionEntities:new Map,version:e.version+1}:{missionEntities:new Map,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1})},setMissionInfo(t){let s={};if(void 0!==t.missionName&&(s.missionName=t.missionName),void 0!==t.missionType&&(s.missionType=t.missionType),void 0!==t.missionTypeDisplayName&&(s.missionTypeDisplayName=t.missionTypeDisplayName),void 0!==t.missionDisplayName&&(s.missionDisplayName=t.missionDisplayName),void 0!==t.gameClassName&&(s.gameClassName=t.gameClassName,void 0===t.missionType))if(t.gameClassName){let e=t.gameClassName.replace(/Game$/i,"");s.missionType=n.normalizedMissionTypes[e.toLowerCase()]??e}else s.missionType=null;void 0!==t.serverDisplayName&&(s.serverDisplayName=t.serverDisplayName),void 0!==t.recorderName&&(s.recorderName=t.recorderName),void 0!==t.recordingDate&&(s.recordingDate=t.recordingDate),e(e=>({...s,version:e.version+1}))},beginStreaming(t){e(e=>({isStreaming:!0,dataSource:t,streamEntities:new Map,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1}))},endStreaming(){e(e=>e.isStreaming?{isStreaming:!1,dataSource:e.missionEntities.size>0?"map":null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,streamEntities:new Map,version:e.version+1}:e)},setStreamEntity(t){e(e=>{let s=new Map(e.streamEntities);return s.set(t.id,t),{streamEntities:s,version:e.version+1}})},deleteStreamEntity(t){e(e=>{if(!e.streamEntities.has(t))return e;let s=new Map(e.streamEntities);return s.delete(t),{streamEntities:s,version:e.version+1}})},setStreamEntities(t){e(e=>{let s=new Map(e.streamEntities);for(let e of t)s.set(e.id,e);return{streamEntities:s,version:e.version+1}})},setAllStreamEntities(t){e(e=>{let s=new Map;for(let e of t)s.set(e.id,e);let n=e.streamEntities;return s.size===n.size&&[...s.keys()].every(e=>n.has(e))?e:{streamEntities:s,version:e.version+1}})},clearStreamEntities(){e(e=>0===e.streamEntities.size?e:{streamEntities:new Map,version:e.version+1})}}));function r(e){let t=e.isStreaming?e.streamEntities:e.missionEntities,s=[];for(let e of t.values())"None"!==e.renderType&&s.push(e);return s}function a(e,t){if(e.length!==t.length)return!1;for(let s=0;so,"useDataSource",()=>m,"useMissionDisplayName",()=>k,"useMissionName",()=>p,"useMissionType",()=>y,"useMissionTypeDisplayName",()=>v,"useRecorderName",()=>E,"useRecordingDate",()=>x,"useSceneSky",()=>u,"useSceneSun",()=>d,"useServerDisplayName",()=>N])},98755,e=>{"use strict";e.i(47167);var t=e.i(8155),s=e.i(66748),n=e.i(25645);let i=(0,n.createLogger)("relayClient");class r{ws=null;handlers;url;_connected=!1;wsPingInterval=null;smoothedWsPing=0;constructor(e,t){this.url=e,this.handlers=t}get connected(){return this._connected}connect(){this.ws=new WebSocket(this.url),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{i.info("WebSocket connected to %s",this.url),this._connected=!0,this.startWsPing(),this.handlers.onOpen?.()},this.ws.onmessage=e=>{if(e.data instanceof ArrayBuffer)this.handlers.onGamePacket?.(new Uint8Array(e.data));else try{let t=JSON.parse(e.data);this.handleMessage(t)}catch(e){i.error("Failed to parse relay message: %o",e)}},this.ws.onclose=()=>{i.info("WebSocket disconnected"),this._connected=!1,this.stopWsPing(),this.handlers.onClose?.()},this.ws.onerror=()=>{i.error("WebSocket error"),this.handlers.onError?.("WebSocket connection error")}}handleMessage(e){switch(e.type){case"serverList":this.handlers.onServerList?.(e.servers);break;case"status":this.handlers.onStatus?.(e.status,e.message,e.connectSequence,e.mapName);break;case"ping":this.handlers.onPing?.(e.ms);break;case"wsPong":{let t=Date.now()-e.ts;this.smoothedWsPing=0===this.smoothedWsPing?t:.5*this.smoothedWsPing+.5*t,this.handlers.onWsPing?.(Math.round(this.smoothedWsPing));break}case"error":this.handlers.onError?.(e.message)}}listServers(){this.send({type:"listServers"})}sendWsPing(){this.send({type:"wsPing",ts:Date.now()})}joinServer(e,t){i.info("Joining server: %s",e),this.send({type:"joinServer",address:e,warriorName:t})}disconnectServer(){this.send({type:"disconnect"})}sendAuthEvent(e,t){this.send({type:"sendCommand",command:e,args:t})}sendCommand(e,t){this.send({type:"sendCommand",command:e,args:t})}sendCRCResponse(e,t,s){this.send({type:"sendCRCResponse",crcValue:e,field1:t,field2:s})}sendCRCCompute(e,t,s,n){this.send({type:"sendCRCCompute",seed:e,field2:t,includeTextures:n,datablocks:s})}sendGhostAck(e,t){this.send({type:"sendGhostAck",sequence:e,ghostCount:t})}sendMoves(e,t){this.send({type:"sendMoves",moves:e,moveStartIndex:t})}close(){this.stopWsPing(),this.ws&&(this.ws.close(),this.ws=null),this._connected=!1}startWsPing(){this.smoothedWsPing=0,this.send({type:"wsPing",ts:Date.now()}),this.wsPingInterval=setInterval(()=>{this.send({type:"wsPing",ts:Date.now()})},7e3)}stopWsPing(){null!=this.wsPingInterval&&(clearInterval(this.wsPingInterval),this.wsPingInterval=null)}send(e){this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):i.warn("send dropped (ws not open): %s",e.type)}}e.i(50593);var a=e.i(45853),o=e.i(89119),l=e.i(10244);let c=(0,n.createLogger)("liveStreaming");class u extends l.StreamEngine{packetParser;relay;currentTimeSec=0;connectSynced=!1;_snapshot=null;_snapshotTick=-1;_ready=!1;dataBlockClassNames=new Map;onReady;onMissionChange;missionName=null;lastMoveAck=0;constructor(e){super(),this.relay=e;const{registry:t,ghostTracker:s,packetParser:n}=(0,a.createLiveParser)();this.packetParser=n,this.ghostTracker=s,this.registry=t}getDataBlockData(e){return this.packetParser.getDataBlockDataMap()?.get(e)}_shapeConstructorCache=null;getShapeConstructorSequences(e){this._shapeConstructorCache=new Map;let t=this.packetParser.getDataBlockDataMap();if(t){for(let[,e]of t){let t=e.shape,s=e.sequences;t&&s&&this._shapeConstructorCache.set(t.toLowerCase(),s)}return this._shapeConstructorCache.get(e.toLowerCase())}}getTimeSec(){return this.currentTimeSec}getCameraYawPitch(e){return this.getAbsoluteRotation(e)??{yaw:0,pitch:0}}getEffectShapes(){let e=new Set,t=this.packetParser.getDataBlockDataMap();if(!t)return[];for(let[,s]of t){let n=s.explosion;if(null==n)continue;let i=t.get(n);i?.dtsFileName&&e.add(i.dtsFileName)}return[...e]}reset(){this.resetSharedState(),this.ghostTracker.clear?.(),this.currentTimeSec=0,this._snapshot=null,this._snapshotTick=-1,this.dataBlockClassNames.clear(),this.observerMode="fly",this.missionName=null}getSnapshot(){return this._snapshot&&this._snapshotTick===this.tickCount?this._snapshot:this.buildSnapshot()}stepToTime(e,t){return this.currentTimeSec=e,this.getSnapshot()}syncConnectSequence(e){if(this.connectSynced||e.length<1)return;this.connectSynced=!0;let t=e[0]>>1&1;this.packetParser.setConnectionProtocolState({lastSeqRecvdAtSend:Array(32).fill(0),lastSeqRecvd:0,highestAckedSeq:0,lastSendSeq:0x1fffffff,ackMask:0,connectSequence:t,lastRecvAckAck:0,connectionEstablished:!0})}feedPacket(e){this.syncConnectSequence(e),this.processPacket(e)}handleRelayCommands(e){if("RemoteCommandEvent"!==e.type)return;let t=e.funcName;if(!t)return;let s=this.resolveNetString(t);if(["t2csri_pokeClient","t2csri_getChallengeChunk","t2csri_decryptChallenge"].includes(s)){let t=(e.args??[]).map(e=>this.resolveNetString(e)).filter(e=>""!==e);c.info("auth event: %s %o",s,t),this.relay.sendAuthEvent(s,t);return}let n=(e.args??[]).map(e=>this.resolveNetString(e));if("MissionStartPhase1"===s){let e=n[0]??"",t=n[1]??null;c.info("mission phase 1, seq=%s mission=%s resolvedArgs=%o",e,t,n),t&&t!==this.missionName&&(this.missionName=t,this.entities.clear(),this.entityIdByGhostIndex.clear(),this._ready=!1,this._snapshot=null,this._snapshotTick=-1,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null,this.onMissionChange?.(t)),this.relay.sendCommand("MissionStartPhase1Done",[e])}else if("MissionStartPhase2"===s){let e=n[0]??"";c.info("mission phase 2 (datablocks), seq=%s",e),this.relay.sendCommand("MissionStartPhase2Done",[e])}else if("MissionStartPhase3"===s){let e=n[0]??"",t=n[1]??null;c.info("mission phase 3 (ghosting), seq=%s mission=%s",e,t),t&&(this.missionName=t),this.relay.sendCommand("setClientFav",[""]),this.relay.sendCommand("MissionStartPhase3Done",[e])}}handleCRCChallenge(e){if("CRCChallengeEvent"!==e.type)return;let t=e.crcValue,s=e.field1,n=e.field2,i=(1&s)!=0;c.info("CRC challenge: seed=0x%s f1=0x%s f2=0x%s includeTextures=%s",(t>>>0).toString(16),(s>>>0).toString(16),(n>>>0).toString(16),i);let r=this.packetParser.getDataBlockDataMap(),a=[];if(r)for(let[e,t]of r){let s=this.dataBlockClassNames.get(e);if(!s)continue;let n=(0,o.resolveShapeName)(s,t);a.push({objectId:e,className:s,shapeName:n??""})}c.info("CRC: sending %d datablocks for computation",a.length),this.relay.sendCRCCompute(t,n,a,i)}handleGhostingMessage(e){if("GhostingMessageEvent"!==e.type)return;let t=e.message,s=e.sequence,n=e.ghostCount;c.info("GhostingMessageEvent: message=%d sequence=%d ghostCount=%d",t,s,n),0===t&&(c.info("Sending ghost ack (type 1) for sequence %d",s),this.relay.sendGhostAck(s,n))}observerMode="fly";toggleObserverMode(){"fly"===this.observerMode?(c.info("observer: fly → follow"),this.observerMode="follow"):(c.info("observer: follow → fly"),this.observerMode="fly")}getPlayerList(){let e=[];for(let[t,s]of this.targetNames){let n=this.targetTeams.get(t)??0;e.push({targetId:t,name:s,sensorGroup:n})}return e}processPacket(e){try{let t=this.packetParser.protocolRejected,s=this.packetParser.protocolNoDispatch,n=this.packetParser.parsePacket(e),i=this.packetParser.protocolRejected>t,r=this.packetParser.protocolNoDispatch>s;(i||r)&&c.warn("packet #%d %s: %d bytes (total rejected=%d, noDispatch=%d)",this.tickCount,i?"REJECTED":"no-dispatch",e.length,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch);let a=this.tickCount<20,l=this.tickCount%100==0,u=a||l;for(let t of(u&&c.debug("packet #%d: %d events, %d ghosts, %d bytes%s%s",this.tickCount,n.events.length,n.ghosts.length,e.length,void 0!==n.gameState.controlObjectGhostIndex?`, control=${n.gameState.controlObjectGhostIndex}`:"",void 0!==n.gameState.cameraFov?`, fov=${n.gameState.cameraFov}`:""),this.lastMoveAck=n.gameState.lastMoveAck,this.processControlObject(n.gameState),n.events))if(t.parsedData){this.handleRelayCommands(t.parsedData),this.handleCRCChallenge(t.parsedData),this.handleGhostingMessage(t.parsedData);let e=t.parsedData.type;if("RemoteCommandEvent"===e){let e=this.resolveNetString(t.parsedData.funcName??"");c.debug("remote: %s",e)}if(a&&"NetStringEvent"!==e&&"RemoteCommandEvent"!==e&&c.debug("event: %s%s",e,"SimDataBlockEvent"===e?` id=${t.parsedData.objectId} class=${t.parsedData.dataBlockClassName}`:""),"SimDataBlockEvent"===e){let e=t.parsedData.objectId,s=t.parsedData.dataBlockClassName;if(null!=e&&s&&this.dataBlockClassNames.set(e,s),u){let n=t.parsedData.dataBlockData,i=(0,o.resolveShapeName)(s??"",n);c.debug("datablock: id=%d class=%s%s",e,s??"?",i?` shape=${i}`:"")}}let s=this.registry.getEventParser(t.classId)?.name;if(this.processEvent(t,s),a&&"NetStringEvent"===e){let e=t.parsedData.id,s=t.parsedData.value;null!=e&&"string"==typeof s&&c.trace('netString #%d = "%s"',e,s.length>60?s.slice(0,60)+"…":s)}if("TargetInfoEvent"===e){let e=t.parsedData.targetId,s=t.parsedData.nameTag;if(null!=e&&null!=s){let n=this.netStrings.get(s);if(n){let s=(0,o.stripTaggedStringMarkup)(n);c.info('target #%d: "%s" team=%s',e,s,t.parsedData.sensorGroup??"?")}}}if("SetSensorGroupEvent"===e){let e=t.parsedData.sensorGroup;null!=e&&c.info("sensor group changed: → %d",e)}if("SensorGroupColorEvent"===e){let e=t.parsedData.sensorGroup,s=t.parsedData.colors;s&&c.debug("sensor group colors: group=%d, %d entries",e,s.length)}}for(let e of n.ghosts){if("create"===e.type){let t=e.parsedData?.position,s=t&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.z,n=this.resolveGhostClassName(e.index,e.classId);c.debug("ghost create: #%d %s%s (%d entities total)",e.index,n??"?",s?` at (${t.x.toFixed(1)}, ${t.y.toFixed(1)}, ${t.z.toFixed(1)})`:"",this.entities.size+1),this._ready||(this._ready=!0,this.onReady?.())}else if("delete"===e.type){let t=this.entityIdByGhostIndex.get(e.index),s=t?this.entities.get(t):void 0;(this.tickCount<50||this.tickCount%200==0)&&c.debug("ghost delete: #%d %s (%d entities remaining)",e.index,s?.className??"?",this.entities.size-1)}this.processGhostUpdate(e)}if(this.tickCount++,this.advanceProjectiles(),this.advanceItems(),l&&this.tickCount>1){let e=this.packetParser.getDataBlockDataMap();c.info("status @ tick %d: %d entities, %d datablocks, rejected=%d, noDispatch=%d",this.tickCount,this.entities.size,e?.size??0,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch)}let d=this.entities.size;if(1===this.tickCount||d>0&&d%25==0&&this.tickCount<100){let e=new Map;for(let t of this.entities.values())e.set(t.type,(e.get(t.type)??0)+1);let t=[...e.entries()].map(([e,t])=>`${e}=${t}`).join(" ");c.info("entity count: %d (%s)",d,t)}let m=this.camera?.mode;if(this.updateCameraAndHud(),this.camera&&this.camera.mode!==m&&c.info("camera mode: %s → %s%s",m??"none",this.camera.mode,"third-person"===this.camera.mode?` orbit=${this.camera.orbitTargetId??"?"} dist=${this.camera.orbitDistance??"?"}`:""),this.tickCount<=5&&this.camera){let[e,t,s]=this.camera.position;c.debug("camera: mode=%s pos=(%s, %s, %s) fov=%s",this.camera.mode,e.toFixed(1),t.toFixed(1),s.toFixed(1),this.camera.fov)}}catch(s){let t={tickCount:this.tickCount,entityCount:this.entities.size,dataLength:e.length,controlGhost:this.latestControl.ghostIndex,connectSynced:this.connectSynced};c.error("Failed to process live packet: %o %o",s,t)}}buildSnapshot(){let e=this.buildEntityList(),t=this.currentTimeSec,{chatMessages:s,audioEvents:n}=this.buildTimeFilteredEvents(t),{weaponsHud:i,inventoryHud:r,backpackHud:a,teamScores:o}=this.buildHudState();this.camera||(this.camera={time:t,position:[0,0,200],rotation:[0,0,0,1],fov:90,mode:"observer"});let l={timeSec:t,exhausted:!1,camera:this.camera,entities:e,controlPlayerGhostId:this.controlPlayerGhostId,playerSensorGroup:this.playerSensorGroup,status:this.lastStatus,chatMessages:s,audioEvents:n,weaponsHud:i,backpackHud:a,inventoryHud:r,teamScores:o};return this._snapshot=l,this._snapshotTick=this.tickCount,l}}var d=e.i(92224);let m=(0,n.createLogger)("liveConnectionStore"),h="wss://t2-relay.fly.dev",p=(0,t.createStore)((e,t)=>({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,servers:[],serversLoading:!1,adapter:null,liveReady:!1,_relay:null,_adapter:null,_pending:[],_listInFlight:!1,connectRelay(s=h){let n=t();n._relay&&n._relay.close();let i=new r(s,{onOpen(){e({relayConnected:!0});let s=t();for(let e of s._pending)e();s._pending=[]},onStatus(t,s,n,i){m.info("game status: %s%s%s",t,s?` — ${s}`:"",i?` map=${i}`:""),e({gameStatus:t,gameStatusMessage:s,...i?{mapName:i}:{}})},onServerList(s){t()._listInFlight=!1,e({servers:s,serversLoading:!1})},onGamePacket(e){let s=t()._adapter;s||m.warn("received game packet but no adapter is active"),s?.feedPacket(e)},onPing(t){e({relayToGameServerPing:t})},onWsPing(t){e({browserToRelayPing:t})},onError(s){m.error("error: %s",s),t()._listInFlight=!1,e({serversLoading:!1})},onClose(){let s=t();s._relay===i&&(s._relay=null,s._adapter=null,s._pending=[],s._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1}))}});i.connect(),t()._relay=i},disconnectRelay(){let s=t();s._relay?.close(),s._relay=null,s._adapter=null,s._pending=[],s._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1})},listServers(){let s=t();if(s._listInFlight)return;s._listInFlight=!0;let n=()=>{let e=t();e._relay?.sendWsPing(),e._relay?.listServers()};e({serversLoading:!0}),s._relay?.connected?n():(s._pending.push(n),s._relay||t().connectRelay())},joinServer(s,n){let i=t();if(!i._relay)return;let r=i.servers.find(e=>e.address===s),a=new u(i._relay);a.onReady=()=>e({liveReady:!0}),a.onMissionChange=t=>{m.info("mission changed: %s",t),e({mapName:t,liveReady:!1}),d.gameEntityStore.getState().setMissionInfo({missionName:t,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null})},a.onMissionInfoChange=()=>{d.gameEntityStore.getState().setMissionInfo({missionDisplayName:a.missionDisplayName??void 0,missionTypeDisplayName:a.missionTypeDisplayName??void 0,gameClassName:a.gameClassName??void 0,serverDisplayName:a.serverDisplayName??void 0,recorderName:a.connectedPlayerName??void 0})},i._adapter=a,e({mapName:r?.mapName??i.mapName,serverName:r?.name,warriorName:n,liveReady:!1,gameStatus:null,adapter:a}),d.gameEntityStore.getState().setMissionInfo({missionName:r?.mapName??void 0,missionTypeDisplayName:r?.gameType??void 0,serverDisplayName:r?.name??void 0,recorderName:n??void 0}),i._relay.joinServer(s,n)},disconnectServer(){let s=t();s._relay?.disconnectServer(),s._adapter=null,e({adapter:null,liveReady:!1,gameStatus:null,mapName:void 0,serverName:void 0,relayToGameServerPing:null})},sendMoves(e,s){t()._relay?.sendMoves(e,s)},sendCommand(e,...s){t()._relay?.sendCommand(e,s)}}));function g(e,t){return(0,s.useStoreWithEqualityFn)(p,e,t)}function y(e){return null!=e.relayToGameServerPing&&null!=e.browserToRelayPing?e.relayToGameServerPing+e.browserToRelayPing:e.relayToGameServerPing??null}e.s(["liveConnectionStore",0,p,"selectPing",()=>y,"useLiveSelector",()=>g],98755)},66093,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645);let i=(0,n.createContext)(null);function r(){let e=(0,n.useContext)(i);if(!e)throw Error("No JoystickContext found. Did you forget to add a ?");return e}function a(e){let r,a,o,l,c,u,d=(0,s.c)(7),{children:m}=e;d[0]===Symbol.for("react.memo_cache_sentinel")?(r={angle:0,force:0},d[0]=r):r=d[0];let h=(0,n.useRef)(r);d[1]===Symbol.for("react.memo_cache_sentinel")?(a={angle:0,force:0},d[1]=a):a=d[1];let p=(0,n.useRef)(a);d[2]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{let{angle:t,force:s}=e;null!=t&&(h.current.angle=t),null!=s&&(h.current.force=s)},d[2]=o):o=d[2];let g=o;d[3]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let{angle:t,force:s}=e;null!=t&&(p.current.angle=t),null!=s&&(p.current.force=s)},d[3]=l):l=d[3];let y=l;d[4]===Symbol.for("react.memo_cache_sentinel")?(c={moveState:h,lookState:p,setMoveState:g,setLookState:y},d[4]=c):c=d[4];let f=c;return d[5]!==m?(u=(0,t.jsx)(i,{value:f,children:m}),d[5]=m,d[6]=u):u=d[6],u}e.s(["JoystickProvider",()=>a,"useJoystick",()=>r])},65349,e=>{"use strict";var t=e.i(71645);let s=(0,t.createContext)(null);function n(){let e=(0,t.useContext)(s);if(!e)throw Error("useInputContext must be used within an InputProvider");return e}function i(){return n().onInput}e.s(["InputContext",0,s,"useInputContext",()=>n,"useOnInput",()=>i])},32865,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(58647);function i(e){let n,i=(0,s.c)(2),{children:r}=e;return i[0]!==r?(n=(0,t.jsx)(t.Fragment,{children:r}),i[0]=r,i[1]=n):n=i[1],n}function r(){return(0,n.useEngineSelector)(a)}function a(e){return e.playback.recording}function o(){return(0,n.useEngineSelector)(l)}function l(e){return"playing"===e.playback.status}function c(){return(0,n.useEngineSelector)(u)}function u(e){return e.playback.timeMs/1e3}function d(){return(0,n.useEngineSelector)(m)}function m(e){return e.playback.durationMs/1e3}function h(){return(0,n.useEngineSelector)(p)}function p(e){return e.playback.rate}function g(){let e,t,i,a,o,l,c=(0,s.c)(17),u=r(),d=(0,n.useEngineSelector)(S),m=(0,n.useEngineSelector)(v),h=(0,n.useEngineSelector)(f),p=(0,n.useEngineSelector)(y);c[0]!==d?(e=e=>{d(e)},c[0]=d,c[1]=e):e=c[1];let g=e;c[2]!==u||c[3]!==m?(t=()=>{u&&m("playing")},c[2]=u,c[3]=m,c[4]=t):t=c[4];let k=t;c[5]!==m?(i=()=>{m("paused")},c[5]=m,c[6]=i):i=c[6];let b=i;c[7]!==h?(a=e=>{h(1e3*e)},c[7]=h,c[8]=a):a=c[8];let N=a;c[9]!==p?(o=e=>{p(e)},c[9]=p,c[10]=o):o=c[10];let C=o;return c[11]!==b||c[12]!==k||c[13]!==N||c[14]!==g||c[15]!==C?(l={setRecording:g,play:k,pause:b,seek:N,setSpeed:C},c[11]=b,c[12]=k,c[13]=N,c[14]=g,c[15]=C,c[16]=l):l=c[16],l}function y(e){return e.setPlaybackRate}function f(e){return e.setPlaybackTime}function v(e){return e.setPlaybackStatus}function S(e){return e.setRecording}e.s(["RecordingProvider",()=>i,"useCurrentTime",()=>c,"useDuration",()=>d,"useIsPlaying",()=>o,"usePlaybackActions",()=>g,"useRecording",()=>r,"useSpeed",()=>h])},12631,e=>{"use strict";var t=e.i(71645),s=e.i(8155);let n=e=>{let n=(0,s.createStore)(e),i=e=>(function(e,s=e=>e){let n=t.default.useSyncExternalStore(e.subscribe,t.default.useCallback(()=>s(e.getState()),[e,s]),t.default.useCallback(()=>s(e.getInitialState()),[e,s]));return t.default.useDebugValue(n),n})(n,e);return Object.assign(i,n),i};var i=e.i(79473);let r=t.createContext(null);function a({map:e,children:s,onChange:a,domElement:o}){let l=e.map(e=>e.name+e.keys).join("-"),c=t.useMemo(()=>{let t;return(t=(0,i.subscribeWithSelector)(()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{})))?n(t):n},[l]),u=t.useMemo(()=>[c.subscribe,c.getState,c],[l]),d=c.setState;return t.useEffect(()=>{let t=e.map(({name:e,keys:t,up:s})=>({keys:t,up:s,fn:t=>{d({[e]:t}),a&&a(e,t,u[1]())}})).reduce((e,{keys:t,fn:s,up:n=!0})=>(t.forEach(t=>e[t]={fn:s,pressed:!1,up:n}),e),{}),s=({key:e,code:s})=>{let n=t[e]||t[s];if(!n)return;let{fn:i,pressed:r,up:a}=n;n.pressed=!0,(a||!r)&&i(!0)},n=({key:e,code:s})=>{let n=t[e]||t[s];if(!n)return;let{fn:i,up:r}=n;n.pressed=!1,r&&i(!1)},i=o||window;return i.addEventListener("keydown",s,{passive:!0}),i.addEventListener("keyup",n,{passive:!0}),()=>{i.removeEventListener("keydown",s),i.removeEventListener("keyup",n)}},[o,l]),t.createElement(r.Provider,{value:u,children:s})}function o(e){let[s,n,i]=t.useContext(r);return e?i(e):[s,n]}e.s(["KeyboardControls",()=>a,"useKeyboardControls",()=>o],12631)},93784,e=>{"use strict";let t=(0,e.i(8155).createStore)()(()=>({time:0,playback:null,root:null,freeFlyCamera:!1,entities:new Map}));function s(){t.setState({time:0,playback:null,freeFlyCamera:!1})}e.s(["resetStreamPlayback",()=>s,"streamPlaybackStore",0,t])},46325,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645);let i=(0,e.i(25645).createLogger)("DebugSuspense");function r(e){let i,r,l,c=(0,s.c)(10),{name:u,fallback:d,children:m}=e,h=void 0===d?null:d;return c[0]!==h||c[1]!==u?(i=(0,t.jsx)(a,{name:u,children:h}),c[0]=h,c[1]=u,c[2]=i):i=c[2],c[3]!==u?(r=(0,t.jsx)(o,{name:u}),c[3]=u,c[4]=r):r=c[4],c[5]!==m||c[6]!==u||c[7]!==i||c[8]!==r?(l=(0,t.jsxs)(n.Suspense,{name:u,fallback:i,children:[r,m]}),c[5]=m,c[6]=u,c[7]=i,c[8]=r,c[9]=l):l=c[9],l}function a(e){let t,r,a=(0,s.c)(3),{name:o,children:l}=e;return a[0]!==o?(t=()=>{i.debug("🛑 SUSPENDED: %s",o)},r=[o],a[0]=o,a[1]=t,a[2]=r):(t=a[1],r=a[2]),(0,n.useEffect)(t,r),l}function o(e){let t,r,a=(0,s.c)(3),{name:o}=e;return a[0]!==o?(t=()=>{i.debug("✅ RESOLVED: %s",o)},r=[o],a[0]=o,a[1]=t,a[2]=r):(t=a[1],r=a[2]),(0,n.useEffect)(t,r),null}e.s(["DebugSuspense",()=>r])},51434,e=>{"use strict";var t=e.i(43476),s=e.i(932),n=e.i(71645),i=e.i(15080),r=e.i(90072),a=e.i(58647),o=e.i(79123);let l=(0,n.createContext)(void 0);function c(e){let c,h,p,g,y,f,v=(0,s.c)(11),{children:S}=e,k=(0,i.useThree)(m),{audioVolume:b}=(0,o.useSettings)();v[0]===Symbol.for("react.memo_cache_sentinel")?(c={audioLoader:null,audioListener:null},v[0]=c):c=v[0];let[N,C]=(0,n.useState)(c);return v[1]!==k?(h=()=>{let e=new r.AudioLoader,t=k.children.find(d);t||(t=new r.AudioListener,k.add(t)),C({audioLoader:e,audioListener:t});let s=()=>{let e=t.context;e&&"suspended"===e.state&&e.resume().finally(()=>{document.removeEventListener("click",s),document.removeEventListener("keydown",s),document.removeEventListener("touchend",s)})};document.addEventListener("click",s),document.addEventListener("keydown",s),document.addEventListener("touchend",s);let n=a.engineStore.subscribe(u,e=>{let s=t.context;s&&("paused"===e?s.suspend():"suspended"===s.state&&s.resume())});return()=>{document.removeEventListener("click",s),document.removeEventListener("keydown",s),document.removeEventListener("touchend",s),n(),t&&k.remove(t)}},p=[k],v[1]=k,v[2]=h,v[3]=p):(h=v[2],p=v[3]),(0,n.useEffect)(h,p),v[4]!==N.audioListener||v[5]!==b?(g=()=>{N.audioListener?.setMasterVolume(b)},y=[b,N.audioListener],v[4]=N.audioListener,v[5]=b,v[6]=g,v[7]=y):(g=v[6],y=v[7]),(0,n.useEffect)(g,y),v[8]!==N||v[9]!==S?(f=(0,t.jsx)(l.Provider,{value:N,children:S}),v[8]=N,v[9]=S,v[10]=f):f=v[10],f}function u(e){return e.playback.status}function d(e){return e instanceof r.AudioListener}function m(e){return e.camera}function h(){let e=(0,n.useContext)(l);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>c,"useAudio",()=>h])},31999,e=>{"use strict";var t=e.i(71645);let s=(0,e.i(25645).createLogger)("ShapeErrorBoundary");class n extends t.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){s.error("Shape load failed: %s %s",e.message,t.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}e.s(["ShapeErrorBoundary",()=>n])},77964,e=>{"use strict";function t(e){switch(e.renderType){case"TerrainBlock":case"InteriorInstance":case"Sky":case"Sun":case"WaterBlock":case"MissionArea":return!0;default:return!1}}e.s(["isSceneEntity",()=>t])},60946,e=>{e.v(t=>Promise.all(["static/chunks/4fb9edf01fb5e4f5.js"].map(t=>e.l(t))).then(()=>t(0)))},30814,e=>{e.v(t=>Promise.all(["static/chunks/41fb9d5ac0e14608.js"].map(t=>e.l(t))).then(()=>t(9721)))},44325,e=>{e.v(t=>Promise.all(["static/chunks/c5f946098461b297.js"].map(t=>e.l(t))).then(()=>t(66789)))},62125,e=>{e.v(t=>Promise.all(["static/chunks/6c0bdfaab43cc40b.js"].map(t=>e.l(t))).then(()=>t(64972)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/2c772d15a5a10e4d.js"].map(t=>e.l(t))).then(()=>t(63724)))},61921,e=>{e.v(t=>Promise.all(["static/chunks/538e72dc81951677.js"].map(t=>e.l(t))).then(()=>t(29055)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/2070573ac43e863c.js"].map(t=>e.l(t))).then(()=>t(42585)))},34019,e=>{e.v(t=>Promise.all(["static/chunks/967c4aa315f919d7.js"].map(t=>e.l(t))).then(()=>t(66069)))},553,e=>{e.v(t=>Promise.all(["static/chunks/66f953934e42712b.css","static/chunks/e27b13e203064a85.js"].map(t=>e.l(t))).then(()=>t(18339)))},33487,e=>{e.v(t=>Promise.all(["static/chunks/9ffe862a9787606f.css","static/chunks/302e494fb721f5e6.js"].map(t=>e.l(t))).then(()=>t(40378)))},25483,e=>{e.v(t=>Promise.all(["static/chunks/41fb9d5ac0e14608.js","static/chunks/419d6e651fe3d509.js"].map(t=>e.l(t))).then(()=>t(51295)))},93884,e=>{e.v(t=>Promise.all(["static/chunks/1db3a9d62713e989.css","static/chunks/3770acf7d1a6ba0a.js"].map(t=>e.l(t))).then(()=>t(94737)))},88487,e=>{e.v(t=>Promise.all(["static/chunks/005e475439c5cb3e.js","static/chunks/3ec6b524f05ae0b6.css"].map(t=>e.l(t))).then(()=>t(86855)))},21683,e=>{e.v(t=>Promise.all(["static/chunks/4c292ca57f1d49be.js"].map(t=>e.l(t))).then(()=>t(91285)))},38496,e=>{e.v(t=>Promise.all(["static/chunks/fd10b9633e3b5488.js"].map(t=>e.l(t))).then(()=>t(9962)))},57567,e=>{e.v(t=>Promise.all(["static/chunks/dbc95e0f1d663220.css","static/chunks/4e0d5bbc5104adf2.js"].map(t=>e.l(t))).then(()=>t(49776)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/7317a925124598e3.css","static/chunks/7dcb40c178014bc9.js"].map(t=>e.l(t))).then(()=>t(94247)))},70012,e=>{e.v(t=>Promise.all(["static/chunks/7317a925124598e3.css","static/chunks/0070446447a9983b.js"].map(t=>e.l(t))).then(()=>t(45554)))}]); \ No newline at end of file diff --git a/docs/_next/static/GVV-bte23-C1OKGsIpGF4/_buildManifest.js b/docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_buildManifest.js similarity index 100% rename from docs/_next/static/GVV-bte23-C1OKGsIpGF4/_buildManifest.js rename to docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_buildManifest.js diff --git a/docs/_next/static/GVV-bte23-C1OKGsIpGF4/_clientMiddlewareManifest.json b/docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/GVV-bte23-C1OKGsIpGF4/_clientMiddlewareManifest.json rename to docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_clientMiddlewareManifest.json diff --git a/docs/_next/static/GVV-bte23-C1OKGsIpGF4/_ssgManifest.js b/docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_ssgManifest.js similarity index 100% rename from docs/_next/static/GVV-bte23-C1OKGsIpGF4/_ssgManifest.js rename to docs/_next/static/qFiVWtG4yk0ykisMKiEZH/_ssgManifest.js diff --git a/docs/_not-found/__next._full.txt b/docs/_not-found/__next._full.txt index 9ea289c6..4b53c63b 100644 --- a/docs/_not-found/__next._full.txt +++ b/docs/_not-found/__next._full.txt @@ -8,7 +8,7 @@ a:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] c:I[68027,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} 9:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] d:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] 7:null diff --git a/docs/_not-found/__next._head.txt b/docs/_not-found/__next._head.txt index 7452a8cc..b1c7aafb 100644 --- a/docs/_not-found/__next._head.txt +++ b/docs/_not-found/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} diff --git a/docs/_not-found/__next._index.txt b/docs/_not-found/__next._index.txt index 0f8c5084..4c48efbe 100644 --- a/docs/_not-found/__next._index.txt +++ b/docs/_not-found/__next._index.txt @@ -3,4 +3,4 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/_not-found/__next._not-found.__PAGE__.txt b/docs/_not-found/__next._not-found.__PAGE__.txt index 962ecc14..1d5b52d1 100644 --- a/docs/_not-found/__next._not-found.__PAGE__.txt +++ b/docs/_not-found/__next._not-found.__PAGE__.txt @@ -1,5 +1,5 @@ 1:"$Sreact.fragment" 2:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] 3:"$Sreact.suspense" -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],null,["$","$L2",null,{"children":["$","$3",null,{"name":"Next.MetadataOutlet","children":"$@4"}]}]]}],"loading":null,"isPartial":false} 4:null diff --git a/docs/_not-found/__next._not-found.txt b/docs/_not-found/__next._not-found.txt index 13ca9055..99f5d0f6 100644 --- a/docs/_not-found/__next._not-found.txt +++ b/docs/_not-found/__next._not-found.txt @@ -1,4 +1,4 @@ 1:"$Sreact.fragment" 2:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 3:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/_not-found/__next._tree.txt b/docs/_not-found/__next._tree.txt index a21f46a7..8a9148ba 100644 --- a/docs/_not-found/__next._tree.txt +++ b/docs/_not-found/__next._tree.txt @@ -1,2 +1,2 @@ :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"/_not-found","paramType":null,"paramKey":"/_not-found","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/docs/_not-found/index.html b/docs/_not-found/index.html index 420eaa0e..47521b99 100644 --- a/docs/_not-found/index.html +++ b/docs/_not-found/index.html @@ -1 +1 @@ -404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.MapGenius – Explore maps for Tribes 2

404

This page could not be found.

\ No newline at end of file diff --git a/docs/_not-found/index.txt b/docs/_not-found/index.txt index 9ea289c6..4b53c63b 100644 --- a/docs/_not-found/index.txt +++ b/docs/_not-found/index.txt @@ -8,7 +8,7 @@ a:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] c:I[68027,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["","_not-found",""],"q":"","i":false,"f":[[["",{"children":["/_not-found",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:style","children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style","children":404}],["$","div",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style","children":["$","h2",null,{"style":"$0:f:0:1:0:props:children:1:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style","children":"This page could not be found."}]}]]}]}]],null,["$","$L5",null,{"children":["$","$6",null,{"name":"Next.MetadataOutlet","children":"$@7"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[["$","meta",null,{"name":"robots","content":"noindex"}],["$","$L8",null,{"children":"$L9"}],["$","div",null,{"hidden":true,"children":["$","$La",null,{"children":["$","$6",null,{"name":"Next.Metadata","children":"$Lb"}]}]}],null]}],false]],"m":"$undefined","G":["$c","$undefined"],"S":true} 9:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] d:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] 7:null diff --git a/docs/index.html b/docs/index.html index a580969d..9da218e6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -MapGenius – Explore maps for Tribes 2 \ No newline at end of file +MapGenius – Explore maps for Tribes 2 \ No newline at end of file diff --git a/docs/index.txt b/docs/index.txt index a736e8b8..715f0ea9 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -3,7 +3,7 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/0a364447adf881eb.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","/t2-mapper/_next/static/chunks/b30d580062e7b044.js","/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/26c11097581036eb.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js","/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","/t2-mapper/_next/static/chunks/048c0e679979d576.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] @@ -11,7 +11,7 @@ e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBounda 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/990cfb71eaf1c762.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/16e2b7e83646cebc.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/0a364447adf881eb.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/d22dc3fe32e979ff.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/b30d580062e7b044.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/e01e6e76b521dd3c.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/26c11097581036eb.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/af18e4f3fa33de6b.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/t2-mapper/_next/static/chunks/048c0e679979d576.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] diff --git a/docs/shapes/__next._full.txt b/docs/shapes/__next._full.txt index 3a6b67a1..3461c1de 100644 --- a/docs/shapes/__next._full.txt +++ b/docs/shapes/__next._full.txt @@ -3,7 +3,7 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] +6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] @@ -11,7 +11,7 @@ e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBounda 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] diff --git a/docs/shapes/__next._head.txt b/docs/shapes/__next._head.txt index c07e1c68..9da154c0 100644 --- a/docs/shapes/__next._head.txt +++ b/docs/shapes/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"IconMark"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"MapGenius – Explore maps for Tribes 2"}],["$","meta","1",{"name":"description","content":"Tribes 2 forever."}],["$","link","2",{"rel":"icon","href":"/t2-mapper/icon.png?icon.2911bba1.png","sizes":"108x128","type":"image/png"}],["$","$L5","3",{}]]}]}]}],null]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/__next._index.txt b/docs/shapes/__next._index.txt index 0f8c5084..4c48efbe 100644 --- a/docs/shapes/__next._index.txt +++ b/docs/shapes/__next._index.txt @@ -3,4 +3,4 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/__next._tree.txt b/docs/shapes/__next._tree.txt index 99b817c4..2065303c 100644 --- a/docs/shapes/__next._tree.txt +++ b/docs/shapes/__next._tree.txt @@ -1,3 +1,3 @@ :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"shapes","paramType":null,"paramKey":"shapes","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"shapes","paramType":null,"paramKey":"shapes","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/docs/shapes/__next.shapes.__PAGE__.txt b/docs/shapes/__next.shapes.__PAGE__.txt index 3d33d789..c55f1e70 100644 --- a/docs/shapes/__next.shapes.__PAGE__.txt +++ b/docs/shapes/__next.shapes.__PAGE__.txt @@ -1,10 +1,10 @@ 1:"$Sreact.fragment" 2:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -3:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] +3:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] 6:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] 7:"$Sreact.suspense" :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} 4:{} 5:"$0:rsc:props:children:0:props:serverProvidedParams:params" 8:null diff --git a/docs/shapes/__next.shapes.txt b/docs/shapes/__next.shapes.txt index 13ca9055..99f5d0f6 100644 --- a/docs/shapes/__next.shapes.txt +++ b/docs/shapes/__next.shapes.txt @@ -1,4 +1,4 @@ 1:"$Sreact.fragment" 2:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 3:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] -0:{"buildId":"GVV-bte23-C1OKGsIpGF4","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"qFiVWtG4yk0ykisMKiEZH","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} diff --git a/docs/shapes/index.html b/docs/shapes/index.html index e4cc1648..14c190f5 100644 --- a/docs/shapes/index.html +++ b/docs/shapes/index.html @@ -1 +1 @@ -MapGenius – Explore maps for Tribes 2 \ No newline at end of file +MapGenius – Explore maps for Tribes 2 \ No newline at end of file diff --git a/docs/shapes/index.txt b/docs/shapes/index.txt index 3a6b67a1..3461c1de 100644 --- a/docs/shapes/index.txt +++ b/docs/shapes/index.txt @@ -3,7 +3,7 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ClientPageRoot"] -6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] +6:I[39724,["/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","/t2-mapper/_next/static/chunks/628df86be2b8074c.js","/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","/t2-mapper/_next/static/chunks/9a99559140e82f06.js","/t2-mapper/_next/static/chunks/153d5796298dee1e.js","/t2-mapper/_next/static/chunks/21659079be7af0ab.js","/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","/t2-mapper/_next/static/chunks/727710e55f003daf.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"ViewportBoundary"] @@ -11,7 +11,7 @@ e:I[97367,["/t2-mapper/_next/static/chunks/2f236954d6a65e12.js"],"MetadataBounda 10:I[68027,[],"default"] :HL["/t2-mapper/_next/static/chunks/ad52ebedad251428.css","style"] :HL["/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","style"] -0:{"P":null,"b":"GVV-bte23-C1OKGsIpGF4","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/f6808786c34b74b0.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} +0:{"P":null,"b":"qFiVWtG4yk0ykisMKiEZH","c":["","shapes",""],"q":"","i":false,"f":[[["",{"children":["shapes",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/ad52ebedad251428.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/89fcb9c19e93d0ef.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"defaultOptions":{"clearOnDefault":false},"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[null,["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/3ec6b524f05ae0b6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/ad4fd30929cca23f.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/628df86be2b8074c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/44a6df9214eeac58.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/28c57db7b25d3d02.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/d712fc4c15db64e6.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/9a99559140e82f06.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/t2-mapper/_next/static/chunks/153d5796298dee1e.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/t2-mapper/_next/static/chunks/21659079be7af0ab.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/t2-mapper/_next/static/chunks/9549e76d03bf90ea.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/t2-mapper/_next/static/chunks/727710e55f003daf.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$Ld"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$Lf"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true} 7:{} 8:"$0:f:0:1:1:children:1:children:0:props:children:0:props:serverProvidedParams:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}]] diff --git a/package-lock.json b/package-lock.json index 50d4ea13..af8e18cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ }, "devDependencies": { "@eslint/js": "^9.39.2", + "@inquirer/prompts": "^8.3.0", "@types/express": "^5.0.6", "@types/lodash.orderby": "^4.6.9", "@types/node": "24.3.1", @@ -1603,6 +1604,350 @@ "url": "https://opencollective.com/libvips" } }, + "node_modules/@inquirer/ansi": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-2.0.3.tgz", + "integrity": "sha512-g44zhR3NIKVs0zUesa4iMzExmZpLUdTLRMCStqX3GE5NT6VkPcxQGJ+uC8tDgBUC/vB1rUhUd55cOf++4NZcmw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + } + }, + "node_modules/@inquirer/checkbox": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-5.1.0.tgz", + "integrity": "sha512-/HjF1LN0a1h4/OFsbGKHNDtWICFU/dqXCdym719HFTyJo9IG7Otr+ziGWc9S0iQuohRZllh+WprSgd5UW5Fw0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.3", + "@inquirer/core": "^11.1.5", + "@inquirer/figures": "^2.0.3", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/confirm": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-6.0.8.tgz", + "integrity": "sha512-Di6dgmiZ9xCSUxWUReWTqDtbhXCuG2MQm2xmgSAIruzQzBqNf49b8E07/vbCYY506kDe8BiwJbegXweG8M1klw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-11.1.5.tgz", + "integrity": "sha512-QQPAX+lka8GyLcZ7u7Nb1h6q72iZ/oy0blilC3IB2nSt1Qqxp7akt94Jqhi/DzARuN3Eo9QwJRvtl4tmVe4T5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.3", + "@inquirer/figures": "^2.0.3", + "@inquirer/type": "^4.0.3", + "cli-width": "^4.1.0", + "fast-wrap-ansi": "^0.2.0", + "mute-stream": "^3.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/editor": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-5.0.8.tgz", + "integrity": "sha512-sLcpbb9B3XqUEGrj1N66KwhDhEckzZ4nI/W6SvLXyBX8Wic3LDLENlWRvkOGpCPoserabe+MxQkpiMoI8irvyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/external-editor": "^2.0.3", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/expand": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-5.0.8.tgz", + "integrity": "sha512-QieW3F1prNw3j+hxO7/NKkG1pk3oz7pOB6+5Upwu3OIwADfPX0oZVppsqlL+Vl/uBHHDSOBY0BirLctLnXwGGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-2.0.3.tgz", + "integrity": "sha512-LgyI7Agbda74/cL5MvA88iDpvdXI2KuMBCGRkbCl2Dg1vzHeOgs+s0SDcXV7b+WZJrv2+ERpWSM65Fpi9VfY3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.2" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/figures": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-2.0.3.tgz", + "integrity": "sha512-y09iGt3JKoOCBQ3w4YrSJdokcD8ciSlMIWsD+auPu+OZpfxLuyz+gICAQ6GCBOmJJt4KEQGHuZSVff2jiNOy7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + } + }, + "node_modules/@inquirer/input": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-5.0.8.tgz", + "integrity": "sha512-p0IJslw0AmedLEkOU+yrEX3Aj2RTpQq7ZOf8nc1DIhjzaxRWrrgeuE5Kyh39fVRgtcACaMXx/9WNo8+GjgBOfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/number": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-4.0.8.tgz", + "integrity": "sha512-uGLiQah9A0F9UIvJBX52m0CnqtLaym0WpT9V4YZrjZ+YRDKZdwwoEPz06N6w8ChE2lrnsdyhY9sL+Y690Kh9gQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/password": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-5.0.8.tgz", + "integrity": "sha512-zt1sF4lYLdvPqvmvHdmjOzuUUjuCQ897pdUCO8RbXMUDKXJTTyOQgtn23le+jwcb+MpHl3VAFvzIdxRAf6aPlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.3", + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/prompts": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-8.3.0.tgz", + "integrity": "sha512-JAj66kjdH/F1+B7LCigjARbwstt3SNUOSzMdjpsvwJmzunK88gJeXmcm95L9nw1KynvFVuY4SzXh/3Y0lvtgSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^5.1.0", + "@inquirer/confirm": "^6.0.8", + "@inquirer/editor": "^5.0.8", + "@inquirer/expand": "^5.0.8", + "@inquirer/input": "^5.0.8", + "@inquirer/number": "^4.0.8", + "@inquirer/password": "^5.0.8", + "@inquirer/rawlist": "^5.2.4", + "@inquirer/search": "^4.1.4", + "@inquirer/select": "^5.1.0" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/rawlist": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-5.2.4.tgz", + "integrity": "sha512-fTuJ5Cq9W286isLxwj6GGyfTjx1Zdk4qppVEPexFuA6yioCCXS4V1zfKroQqw7QdbDPN73xs2DiIAlo55+kBqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/search": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-4.1.4.tgz", + "integrity": "sha512-9yPTxq7LPmYjrGn3DRuaPuPbmC6u3fiWcsE9ggfLcdgO/ICHYgxq7mEy1yJ39brVvgXhtOtvDVjDh9slJxE4LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^11.1.5", + "@inquirer/figures": "^2.0.3", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-5.1.0.tgz", + "integrity": "sha512-OyYbKnchS1u+zRe14LpYrN8S0wH1vD0p2yKISvSsJdH2TpI87fh4eZdWnpdbrGauCRWDph3NwxRmM4Pcm/hx1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.3", + "@inquirer/core": "^11.1.5", + "@inquirer/figures": "^2.0.3", + "@inquirer/type": "^4.0.3" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/type": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-4.0.3.tgz", + "integrity": "sha512-cKZN7qcXOpj1h+1eTTcGDVLaBIHNMT1Rz9JqJP5MnEJ0JhgVWllx7H/tahUp5YEK1qaByH2Itb8wLG/iScD5kw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/@isaacs/balanced-match": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", @@ -4430,6 +4775,13 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chardet": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz", + "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==", + "dev": true, + "license": "MIT" + }, "node_modules/chevrotain": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.5.0.tgz", @@ -4459,6 +4811,16 @@ "devtools-protocol": "*" } }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", @@ -5976,6 +6338,33 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.0.tgz", + "integrity": "sha512-rLV8JHxTyhVmFYhBJuMujcrHqOT2cnO5Zxj37qROj23CP39GXubJRBUFF0z8KFK77Uc0SukZUf7JZhsVEQ6n8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fastq": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", @@ -6600,9 +6989,9 @@ } }, "node_modules/iconv-lite": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", - "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", "dev": true, "license": "MIT", "dependencies": { @@ -7618,6 +8007,16 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/mute-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-3.0.0.tgz", + "integrity": "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, "node_modules/nanoid": { "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", @@ -9333,6 +9732,19 @@ "dev": true, "license": "ISC" }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", diff --git a/package.json b/package.json index 452b2b5d..a3a97d61 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ }, "devDependencies": { "@eslint/js": "^9.39.2", + "@inquirer/prompts": "^8.3.0", "@types/express": "^5.0.6", "@types/lodash.orderby": "^4.6.9", "@types/node": "24.3.1", diff --git a/relay/crc.ts b/relay/crc.ts index 42a599dc..ef068fab 100644 --- a/relay/crc.ts +++ b/relay/crc.ts @@ -59,6 +59,9 @@ interface Manifest { let cachedManifest: Manifest | null = null; +/** In-memory cache of shape file bytes, keyed by resolved local path. */ +const fileCache = new Map(); + /** * Path to manifest.json. Defaults to `public/manifest.json` relative to the * project root, but can be overridden via `MANIFEST_PATH` env var for @@ -137,15 +140,25 @@ export async function computeGameCRC( continue; } - let data: Uint8Array; - try { - data = new Uint8Array(await fs.readFile(localPath)); - } catch { + let data = fileCache.get(localPath); + if (data) { console.log( - `[crc] SKIP id=${db.objectId} ${db.className} "${db.shapeName}" — file read failed`, + `[crc] cache hit: "${localPath}"`, ); - filesMissing++; - continue; + } else { + console.log( + `[crc] cache miss, reading: "${localPath}"`, + ); + try { + data = new Uint8Array(await fs.readFile(localPath)); + fileCache.set(localPath, data); + } catch { + console.log( + `[crc] SKIP id=${db.objectId} ${db.className} "${db.shapeName}" — file read failed`, + ); + filesMissing++; + continue; + } } const prevCrc = crc; @@ -172,9 +185,14 @@ export async function computeGameCRC( const elapsed = performance.now() - startTime; + const cacheSizeBytes = [...fileCache.values()].reduce( + (sum, buf) => sum + buf.length, + 0, + ); console.log( `[crc] RESULT: ${filesFound} files CRC'd, ${filesMissing} missing, ` + - `crc=0x${crc.toString(16)}, totalSize=${totalSize}, elapsed=${elapsed.toFixed(0)}ms`, + `crc=0x${crc.toString(16)}, totalSize=${totalSize}, elapsed=${elapsed.toFixed(0)}ms, ` + + `cache=${fileCache.size} files (${(cacheSizeBytes / 1024).toFixed(0)} KB)`, ); return { crc, totalSize }; diff --git a/scripts/t2-login.ts b/scripts/t2-login.ts index 7496f80a..06258004 100644 --- a/scripts/t2-login.ts +++ b/scripts/t2-login.ts @@ -3,11 +3,12 @@ * from the auth server using username and password. * * Usage: - * tsx scripts/t2-login.ts [--env=] + * tsx scripts/t2-login.ts [--env ] [--update] * * Reads T2_ACCOUNT_NAME and T2_ACCOUNT_PASSWORD from .env / environment (or prompts). - * Writes/updates T2_ACCOUNT_CERTIFICATE and T2_ACCOUNT_ENCRYPTED_KEY in the - * target env file (default: .env.local). + * + * Without --update, prints the env lines to stdout. With --update, writes them + * to the target env file (default: .env.local). * * This only needs to be run once — the credentials persist until you change * your password or the auth server rotates keys. @@ -18,23 +19,30 @@ import net from "node:net"; import http from "node:http"; import fs from "node:fs/promises"; import path from "node:path"; -import readline from "node:readline/promises"; +import { parseArgs } from "node:util"; +import { input, password } from "@inquirer/prompts"; const ROOT = path.resolve(import.meta.dirname, ".."); -function sha1(data: string): string { - return crypto.createHash("sha1").update(data).digest("hex"); +const { values: args } = parseArgs({ + options: { + env: { type: "string", default: ".env.local" }, + update: { type: "boolean", default: false }, + }, + strict: true, +}); + + +function errorMessage(e: unknown): string { + if (e instanceof AggregateError && e.errors.length > 0) { + return errorMessage(e.errors[0]); + } + if (e instanceof Error && e.message) return e.message; + return String(e); } -/** Parse --env= from argv, resolve relative to project root. */ -function getEnvFilePath(): string { - for (const arg of process.argv.slice(2)) { - const match = arg.match(/^--env=(.+)$/); - if (match) { - return path.resolve(ROOT, match[1]); - } - } - return path.resolve(ROOT, ".env.local"); +function sha1(data: string): string { + return crypto.createHash("sha1").update(data).digest("hex"); } /** @@ -44,7 +52,11 @@ function getEnvFilePath(): string { async function readEnvLines(filePath: string): Promise { try { const content = await fs.readFile(filePath, "utf-8"); - return content.split("\n"); + const lines = content.split("\n"); + while (lines.length > 0 && lines[lines.length - 1] === "") { + lines.pop(); + } + return lines; } catch { return []; } @@ -72,16 +84,8 @@ function updateEnvLines( } // Append any keys that weren't already in the file - if (remaining.size > 0) { - // Ensure there's a blank line before new entries (unless file is empty - // or already ends with one) - const last = result[result.length - 1]; - if (result.length > 0 && last !== "" && last !== undefined) { - result.push(""); - } - for (const key of remaining) { - result.push(`${key}=${updates[key]}`); - } + for (const key of remaining) { + result.push(`${key}=${updates[key]}`); } // Ensure file ends with a newline @@ -165,10 +169,13 @@ async function downloadAccount( socket.on("timeout", () => { socket.destroy(); - reject(new Error("Auth server connection timed out")); + const err = new Error("Auth server connection timed out"); + (err as any).isNetwork = true; + reject(err); }); socket.on("error", (err: Error) => { + (err as any).isNetwork = true; reject(err); }); @@ -234,36 +241,30 @@ async function downloadAccount( } async function main() { - const envFilePath = getEnvFilePath(); - - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); + const envFilePath = path.resolve(ROOT, args.env!); // Credentials come from process.env (loaded via --env-file-if-exists in // the npm script, or set manually in the shell environment). let username = process.env.T2_ACCOUNT_NAME || ""; - let password = process.env.T2_ACCOUNT_PASSWORD || ""; + let pw = process.env.T2_ACCOUNT_PASSWORD || ""; if (!username) { - username = await rl.question("TribesNext username: "); + username = await input({ message: "TribesNext username:", required: true }); } else { console.log(`Using username: ${username}`); } - if (!password) { - password = await rl.question("TribesNext password: "); + if (!pw) { + pw = await password({ message: "TribesNext password:", mask: "•" }); + if (!pw) { + console.error("Password is required."); + process.exit(1); + } } else { console.log("Using password from environment"); } - rl.close(); - - if (!username || !password) { - console.error("Username and password are required."); - process.exit(1); - } + const maxRetries = 3; // Step 1: Find auth server let authAddress = process.env.T2_AUTH_SERVER || ""; @@ -271,23 +272,45 @@ async function main() { console.log(`Using auth server from environment: ${authAddress}`); } else { console.log("Looking up auth server..."); - try { - authAddress = await findAuthServer(); - console.log(`Auth server: ${authAddress}`); - } catch (e) { - console.error("Failed to find auth server:", e); - process.exit(1); + for (let attempt = 1; attempt <= maxRetries; attempt++) { + try { + authAddress = await findAuthServer(); + console.log(`Auth server: ${authAddress}`); + break; + } catch (e) { + if (attempt < maxRetries) { + const delay = attempt * 2; + const msg = errorMessage(e); + console.warn(`Attempt ${attempt} failed: ${msg}, retrying in ${delay}s...`); + await new Promise((r) => setTimeout(r, delay * 1000)); + } else { + const msg = errorMessage(e); + console.error(`Failed to find auth server: ${msg}`); + process.exit(1); + } + } } } - // Step 2: Download credentials + // Step 2: Download credentials (retry on network errors) console.log("Downloading account credentials..."); let credentials: { certificate: string; encryptedKey: string }; - try { - credentials = await downloadAccount(authAddress, username, password); - } catch (e) { - console.error("Failed to download credentials:", e); - process.exit(1); + for (let attempt = 1; attempt <= maxRetries; attempt++) { + try { + credentials = await downloadAccount(authAddress, username, pw); + break; + } catch (e: any) { + if (e?.isNetwork && attempt < maxRetries) { + const delay = attempt * 2; + const msg = errorMessage(e); + console.warn(`Attempt ${attempt} failed: ${msg}, retrying in ${delay}s...`); + await new Promise((r) => setTimeout(r, delay * 1000)); + } else { + const msg = errorMessage(e); + console.error(`Failed to download credentials: ${msg}`); + process.exit(1); + } + } } console.log("Successfully downloaded credentials!"); @@ -300,28 +323,37 @@ async function main() { console.log(` Public key length: ${certFields[3].length} hex chars`); } - // Step 3: Update the env file + // Step 3: Output or update the env file const certB64 = Buffer.from(credentials.certificate).toString("base64"); const keyB64 = Buffer.from(credentials.encryptedKey).toString("base64"); - const existingLines = await readEnvLines(envFilePath); - const updatedLines = updateEnvLines( - existingLines.length > 0 - ? existingLines - : ["# Generated by scripts/t2-login.ts"], - { - T2_ACCOUNT_NAME: username, - T2_ACCOUNT_PASSWORD: password, - T2_ACCOUNT_CERTIFICATE: certB64, - T2_ACCOUNT_ENCRYPTED_KEY: keyB64, - }, - ); + const envVars: Record = { + T2_ACCOUNT_NAME: username, + T2_ACCOUNT_PASSWORD: pw, + T2_ACCOUNT_CERTIFICATE: certB64, + T2_ACCOUNT_ENCRYPTED_KEY: keyB64, + }; - await fs.writeFile(envFilePath, updatedLines.join("\n"), "utf-8"); - console.log(`\nCredentials written to ${envFilePath}`); - console.log( - "The relay server will read these automatically. Run: npm run relay:dev", - ); + if (args.update) { + const existingLines = await readEnvLines(envFilePath); + const updatedLines = updateEnvLines( + existingLines.length > 0 + ? existingLines + : ["# Generated by scripts/t2-login.ts"], + envVars, + ); + + await fs.writeFile(envFilePath, updatedLines.join("\n"), "utf-8"); + console.log(`\nCredentials written to ${envFilePath}`); + console.log( + "The relay server will read these automatically. Run: npm run relay:dev", + ); + } else { + console.log(""); + for (const [key, value] of Object.entries(envVars)) { + console.log(`${key}=${value}`); + } + } } main().catch((e) => { diff --git a/src/components/InputConsumer.tsx b/src/components/InputConsumer.tsx index 128a6923..64f886f9 100644 --- a/src/components/InputConsumer.tsx +++ b/src/components/InputConsumer.tsx @@ -60,8 +60,6 @@ const _forwardVec = new Vector3(); const _sideVec = new Vector3(); const _moveVec = new Vector3(); const _lookEuler = new Euler(0, 0, 0, "YXZ"); -const _orbitDir = new Vector3(); -const _orbitTarget = new Vector3(); /** A buffered move sent to the server, awaiting acknowledgment. */ interface BufferedMove { @@ -167,6 +165,17 @@ export function InputConsumer() { // Whether prediction has been initialized from a server snapshot. const predInitialized = useRef(false); + // ── Orbit target position for follow mode (Torque coordinates) ── + // Maintained at tick rate from snapshot data, interpolated at frame rate + // using the same time base as the camera (TickProvider), matching how + // Tribes2.exe's Camera::interpolateTick reads getRenderWorldBox() using + // the same dt as all other entities' interpolateTick. + const prevOrbitTargetPos = useRef({ x: 0, y: 0, z: 0 }); + const currentOrbitTargetPos = useRef({ x: 0, y: 0, z: 0 }); + const orbitTargetInitialized = useRef(false); + /** Snapshot reference from last orbit target update (identity check). */ + const lastOrbitSnapshot = useRef(null); + // ── Accumulated input for current tick (live mode) ── const tickDeltaYaw = useRef(0); const tickDeltaPitch = useRef(0); @@ -206,6 +215,8 @@ export function InputConsumer() { // Reset prediction state for new connection. predInitialized.current = false; + orbitTargetInitialized.current = false; + lastOrbitSnapshot.current = null; moveBuffer.current.length = 0; nextMoveIndex.current = 0; lastProcessedAck.current = 0; @@ -219,6 +230,8 @@ export function InputConsumer() { } activeAdapterRef.current = null; predInitialized.current = false; + orbitTargetInitialized.current = false; + lastOrbitSnapshot.current = null; moveBuffer.current.length = 0; setMode("local"); @@ -294,7 +307,7 @@ export function InputConsumer() { // Always set trigger[1] (altTrigger) — the Torque Camera doubles its // movement speed when this trigger is active. Our speedMultiplier is // a fraction of this faster base speed, already applied by the input - // producer (KeyboardAndMouseHandler) to the movement axes. + // producer (MouseAndKeyboardHandler) to the movement axes. triggers[1] = true; // Build the move and assign a browser-owned index. @@ -312,7 +325,15 @@ export function InputConsumer() { // Buffer for prediction replay and re-sending. const buffer = moveBuffer.current; - buffer.push({ moveIndex, move, yaw: qYaw, pitch: qPitch, x: mx, y: my, z: mz }); + buffer.push({ + moveIndex, + move, + yaw: qYaw, + pitch: qPitch, + x: mx, + y: my, + z: mz, + }); // Cap buffer size. if (buffer.length > MAX_MOVE_BUFFER) { @@ -334,6 +355,35 @@ export function InputConsumer() { movesToSend[0].moveIndex, ); } + + // ── Orbit target position tracking (follow mode) ── + // Read the orbit target's position from the snapshot at tick rate, + // matching Camera::processTick which reads getWorldBox().getCenter(). + // Only update when the snapshot has actually changed (new packet data), + // otherwise prev gets overwritten with current on every useTick, destroying + // the interpolation endpoints between packets. + const snap = activeAdapterRef.current.getSnapshot(); + if (snap !== lastOrbitSnapshot.current) { + lastOrbitSnapshot.current = snap; + const cam = snap?.camera; + if (cam?.orbitTargetId) { + const targetEntity = snap.entities.find( + (e) => e.id === cam.orbitTargetId, + ); + if (targetEntity?.position) { + prevOrbitTargetPos.current = { ...currentOrbitTargetPos.current }; + currentOrbitTargetPos.current = { + x: targetEntity.position[0], + y: targetEntity.position[1], + z: targetEntity.position[2], + }; + if (!orbitTargetInitialized.current) { + prevOrbitTargetPos.current = { ...currentOrbitTargetPos.current }; + orbitTargetInitialized.current = true; + } + } + } + } }); // ── useFrame: drain moveQueue, reconcile, interpolateTick + render. ── @@ -468,36 +518,49 @@ export function InputConsumer() { prevPos.current = { ...predPos.current }; predInitialized.current = true; + + // Initialize orbit target position on first reconciliation with + // orbit data, so follow mode works immediately after mode switch. + if (serverCam.orbitTargetId && !orbitTargetInitialized.current) { + const targetEntity = snapshot.entities.find( + (e) => e.id === serverCam.orbitTargetId, + ); + if (targetEntity?.position) { + const pos = { + x: targetEntity.position[0], + y: targetEntity.position[1], + z: targetEntity.position[2], + }; + currentOrbitTargetPos.current = pos; + prevOrbitTargetPos.current = { ...pos }; + orbitTargetInitialized.current = true; + } + } } if (!predInitialized.current) return; if (mode === "fly") { - // ── Camera::interpolateTick equivalent for position ── - // Torque interpolates between prev and current tick states: - // renderState = prevState + (currentState - prevState) * tickFrac - // tickFrac goes 0→1 between ticks (0 = just after tick, 1 = next tick). - const tickFrac = getTickFraction(); - const pp = prevPos.current; - const cp = predPos.current; - const renderX = pp.x + (cp.x - pp.x) * tickFrac; - const renderY = pp.y + (cp.y - pp.y) * tickFrac; - const renderZ = pp.z + (cp.z - pp.z) * tickFrac; - - // Convert Torque coords (x=east, y=north, z=up) to Three.js (x=north, y=up, z=east). - state.camera.position.set(renderY, renderZ, renderX); - - // Rotation uses predicted values directly (already includes pending - // deltas from useFrame above for immediate responsiveness). - const [qx, qy, qz, qw] = yawPitchToQuaternion( + applyFlyCamera( + state.camera, + prevPos.current, + predPos.current, predYaw.current, predPitch.current, + getTickFraction(), ); - state.camera.quaternion.set(qx, qy, qz, qw); } else if (mode === "follow") { - // Follow/orbit mode: use server position for orbit target, - // but apply our predicted rotation for responsive orbit camera. - applyOrbitCamera(state, serverCam, predYaw.current, predPitch.current); + if (!orbitTargetInitialized.current) return; + applyOrbitCamera( + state.camera, + prevOrbitTargetPos.current, + currentOrbitTargetPos.current, + predYaw.current, + predPitch.current, + getTickFraction(), + serverCam?.orbitDistance ?? 4, + serverCam?.orbitTargetId, + ); } }); @@ -558,53 +621,87 @@ function applyLocalCamera( } } +interface TorquePos { + x: number; + y: number; + z: number; +} + /** - * In follow/orbit mode, recompute orbit camera position from the server's - * orbit target using our predicted rotation. + * Camera::interpolateTick for fly mode. + * Interpolates predicted position between tick states, sets rotation from + * frame-rate predicted values. */ -function applyOrbitCamera( - state: { camera: Camera }, - serverCam: StreamCamera | undefined, +function applyFlyCamera( + camera: Camera, + prevPos: TorquePos, + predPos: TorquePos, predYaw: number, predPitch: number, + tickFrac: number, ) { - if ( - !serverCam || - serverCam.mode !== "third-person" || - !serverCam.orbitTargetId - ) { - return; - } + // Torque interpolates: renderState = prev + (current - prev) * tickFrac + const renderX = prevPos.x + (predPos.x - prevPos.x) * tickFrac; + const renderY = prevPos.y + (predPos.y - prevPos.y) * tickFrac; + const renderZ = prevPos.z + (predPos.z - prevPos.z) * tickFrac; - const root = streamPlaybackStore.getState().root; - if (!root) return; + // Convert Torque coords (x=east, y=north, z=up) to Three.js (x=north, y=up, z=east). + camera.position.set(renderY, renderZ, renderX); - const targetGroup = root.children.find( - (child) => child.name === serverCam.orbitTargetId, - ); - if (!targetGroup) return; - - _orbitTarget.copy(targetGroup.position); - const entities = streamPlaybackStore.getState().entities; - const orbitEntity = entities.get(serverCam.orbitTargetId); - if (orbitEntity?.renderType === "Player") { - _orbitTarget.y += 1.0; - } - - const sx = Math.sin(predPitch); - const cx = Math.cos(predPitch); - const sz = Math.sin(predYaw); - const cz = Math.cos(predYaw); - // Camera pulls back along negative forward (Torque Rz*Rx column 1, - // converted to Three.js coords). - _orbitDir.set(-cz * cx, -sx, sz * cx); - - if (_orbitDir.lengthSq() > 1e-8) { - _orbitDir.normalize(); - const orbitDistance = Math.max(0.1, serverCam.orbitDistance ?? 4); - state.camera.position - .copy(_orbitTarget) - .addScaledVector(_orbitDir, orbitDistance); - state.camera.lookAt(_orbitTarget); - } + const [qx, qy, qz, qw] = yawPitchToQuaternion(predYaw, predPitch); + camera.quaternion.set(qx, qy, qz, qw); +} + +/** + * Camera::interpolateTick for orbit mode. + * Interpolates the orbit target's position between tick states using the + * camera's own tick fraction (matching Tribes2.exe where Camera and its + * orbit target use the same dt from ProcessList). Computes orbit pullback + * from frame-rate predicted rotation for responsive mouse control. + */ +function applyOrbitCamera( + camera: Camera, + prevTargetPos: TorquePos, + currentTargetPos: TorquePos, + predYaw: number, + predPitch: number, + tickFrac: number, + orbitDistance: number, + orbitTargetId: string | undefined, +) { + // Interpolate orbit target position between tick states (Torque coords). + const tx = + prevTargetPos.x + (currentTargetPos.x - prevTargetPos.x) * tickFrac; + const ty = + prevTargetPos.y + (currentTargetPos.y - prevTargetPos.y) * tickFrac; + const tz = + prevTargetPos.z + (currentTargetPos.z - prevTargetPos.z) * tickFrac; + + // Height offset: approximate getWorldBox().getCenter() for players. + const isPlayer = + orbitTargetId != null && + streamPlaybackStore.getState().entities.get(orbitTargetId)?.renderType === + "Player"; + const centerZ = tz + (isPlayer ? 1.0 : 0); + + // Compute orbit pullback using frame-rate predicted rotation. + const sp = Math.sin(predPitch); + const cp = Math.cos(predPitch); + const sy = Math.sin(predYaw); + const cy = Math.cos(predYaw); + + // Torque forward (column 1 of Rz*Rx, Torque convention): + // {sy*cp, cy*cp, -sp} + // Camera pulls back along negative forward: + // {-sy*cp, -cy*cp, sp} + const dist = Math.max(0.1, orbitDistance); + const camX = tx - sy * cp * dist; + const camY = ty - cy * cp * dist; + const camZ = centerZ + sp * dist; + + // Convert Torque coords to Three.js (x=north, y=up, z=east). + camera.position.set(camY, camZ, camX); + + const [qx, qy, qz, qw] = yawPitchToQuaternion(predYaw, predPitch); + camera.quaternion.set(qx, qy, qz, qw); } diff --git a/src/components/InputHandlers.tsx b/src/components/InputHandlers.tsx index 96f041ab..69d93b77 100644 --- a/src/components/InputHandlers.tsx +++ b/src/components/InputHandlers.tsx @@ -1,11 +1,18 @@ -import { lazy, ReactNode, Suspense, useCallback, useRef, useState } from "react"; +import { + lazy, + ReactNode, + Suspense, + useCallback, + useRef, + useState, +} from "react"; import { KeyboardControls } from "@react-three/drei"; import { JoystickProvider } from "./JoystickContext"; import { useTouchDevice } from "./useTouchDevice"; import { - KeyboardAndMouseHandler, + MouseAndKeyboardHandler, KEYBOARD_CONTROLS, -} from "./KeyboardAndMouseHandler"; +} from "./MouseAndKeyboardHandler"; import { InputContext, type InputFrame, @@ -41,7 +48,7 @@ export function InputProducers() { return ( <> - + {isTouch ? ( diff --git a/src/components/JoinServerButton.tsx b/src/components/JoinServerButton.tsx index e2c6fee5..94d4cbf9 100644 --- a/src/components/JoinServerButton.tsx +++ b/src/components/JoinServerButton.tsx @@ -17,6 +17,7 @@ export function JoinServerButton({ // const serverName = useLiveSelector((s) => s.serverName); const ping = useLiveSelector(selectPing); const disconnectServer = useLiveSelector((s) => s.disconnectServer); + const disconnectRelay = useLiveSelector((s) => s.disconnectRelay); const isLive = gameStatus === "connected"; const isConnecting = @@ -33,6 +34,7 @@ export function JoinServerButton({ onClick={() => { if (isLive) { disconnectServer(); + disconnectRelay(); } else { onOpenServerBrowser(); } diff --git a/src/components/KeyboardOverlay.tsx b/src/components/KeyboardOverlay.tsx index 913da458..685c41e6 100644 --- a/src/components/KeyboardOverlay.tsx +++ b/src/components/KeyboardOverlay.tsx @@ -1,5 +1,5 @@ import { useKeyboardControls } from "@react-three/drei"; -import { Controls } from "./KeyboardAndMouseHandler"; +import { Controls } from "./MouseAndKeyboardHandler"; import { useRecording } from "./RecordingProvider"; import styles from "./KeyboardOverlay.module.css"; diff --git a/src/components/KeyboardAndMouseHandler.tsx b/src/components/MouseAndKeyboardHandler.tsx similarity index 93% rename from src/components/KeyboardAndMouseHandler.tsx rename to src/components/MouseAndKeyboardHandler.tsx index ec669eff..635b471b 100644 --- a/src/components/KeyboardAndMouseHandler.tsx +++ b/src/components/MouseAndKeyboardHandler.tsx @@ -55,11 +55,11 @@ export const KEYBOARD_CONTROLS = [ ]; const MIN_SPEED_ADJUSTMENT = 2; -const MAX_SPEED_ADJUSTMENT = 10; +const MAX_SPEED_ADJUSTMENT = 11; const DRAG_THRESHOLD = 3; // px of movement before it counts as a drag /** Shared mouse/look sensitivity used across all modes (.mis, .rec, live). */ -export const MOUSE_SENSITIVITY = 0.003; +export const MOUSE_SENSITIVITY = 0.002; export const ARROW_LOOK_SPEED = 1; // radians/sec function quantizeSpeed(speedMultiplier: number): number { @@ -70,7 +70,7 @@ function quantizeSpeed(speedMultiplier: number): number { return (steps + 1) / 16; } -export function KeyboardAndMouseHandler() { +export function MouseAndKeyboardHandler() { // Don't let KeyboardControls handle stuff when metaKey is held. useEffect(() => { const handleKey = (e: KeyboardEvent) => { @@ -103,6 +103,7 @@ export function KeyboardAndMouseHandler() { const getInvertScroll = useEffectEvent(() => invertScroll); const getInvertDrag = useEffectEvent(() => invertDrag); + const getMode = useEffectEvent(() => mode); // Accumulated mouse deltas between frames. const mouseDeltaYaw = useRef(0); @@ -159,7 +160,11 @@ export function KeyboardAndMouseHandler() { } didDrag = true; - const dragSign = getInvertDrag() ? -1 : 1; + // In follow/orbit mode, drag direction is reversed because the camera + // orbits around a target — dragging right should move the camera right + // (decreasing yaw), opposite of fly mode. + const orbitFlip = getMode() === "follow" ? -1 : 1; + const dragSign = (getInvertDrag() ? 1 : -1) * orbitFlip; mouseDeltaYaw.current += dragSign * e.movementX * MOUSE_SENSITIVITY; mouseDeltaPitch.current += dragSign * e.movementY * MOUSE_SENSITIVITY; }; @@ -229,10 +234,14 @@ export function KeyboardAndMouseHandler() { const scrollSign = getInvertScroll() ? -1 : 1; const direction = (e.deltaY > 0 ? -1 : 1) * scrollSign; + // scale deltaY in a way that feels natural for both trackpads (often just + // a deltaY of 1 at a time!) and scroll wheels (can be 100s or more). + const scaledDeltaY = Math.ceil(Math.log2(Math.abs(e.deltaY) + 1)); + const delta = Math.max( MIN_SPEED_ADJUSTMENT, - Math.min(MAX_SPEED_ADJUSTMENT, Math.abs(e.deltaY * 0.01)), + Math.min(MAX_SPEED_ADJUSTMENT, scaledDeltaY), ) * direction; setSpeedMultiplier((prev) => { diff --git a/src/state/liveConnectionStore.ts b/src/state/liveConnectionStore.ts index 6b22da02..a058bb2f 100644 --- a/src/state/liveConnectionStore.ts +++ b/src/state/liveConnectionStore.ts @@ -215,6 +215,8 @@ export const liveConnectionStore = createStore( newAdapter.missionTypeDisplayName ?? undefined, gameClassName: newAdapter.gameClassName ?? undefined, serverDisplayName: newAdapter.serverDisplayName ?? undefined, + // connectedPlayerName is derived from the control object's target + // info, which reflects the server-assigned name (not warriorName). recorderName: newAdapter.connectedPlayerName ?? undefined, }); }; diff --git a/src/stream/StreamEngine.ts b/src/stream/StreamEngine.ts index 5168ed2b..5dcc27f1 100644 --- a/src/stream/StreamEngine.ts +++ b/src/stream/StreamEngine.ts @@ -1846,10 +1846,17 @@ export abstract class StreamEngine implements StreamingPlayback { }); this.onRosterChanged(); } - // The first MsgClientJoin is the connected player's own join message. + // Detect our own join: the server sends "Welcome to Tribes2" in the + // format string (args[1]) only for the joining client. This is the same + // technique the T2 community's player_support.cs uses. if (!this.connectedPlayerName && name) { - this.connectedPlayerName = name; - this.onMissionInfoChange?.(); + const msgFormat = stripTaggedStringMarkup( + this.resolveNetString(args[1]), + ); + if (msgFormat.includes("Welcome to Tribes")) { + this.connectedPlayerName = name; + this.onMissionInfoChange?.(); + } } } else if (msgType === "MsgClientDrop" && args.length >= 3) { const clientId = parseInt(this.resolveNetString(args[2]), 10);